- add nullable title column to scenario steps; exposed in create/edit forms and step table - add scenario-credential join (many-to-many with CredentialEntity) with CRUD endpoints - expose environment URLs in code executor helpers via helpers.env and helpers.getEnvUrl() - resolve and cache environment per run from the login step's environmentName in scheduler - add section spacing and step table title column to ScenarioDetailPage
41 lines
1.1 KiB
TypeScript
41 lines
1.1 KiB
TypeScript
import React, { useId } from 'react';
|
|
import styles from './Textarea.module.css';
|
|
|
|
export interface TextareaProps
|
|
extends Omit<React.TextareaHTMLAttributes<HTMLTextAreaElement>, 'id'> {
|
|
label?: string;
|
|
hint?: string;
|
|
error?: string;
|
|
}
|
|
|
|
export function Textarea({ label, hint, error, className, ...props }: TextareaProps) {
|
|
const id = useId();
|
|
return (
|
|
<div className={styles.wrapper}>
|
|
{label && (
|
|
<label htmlFor={id} className={styles.label}>
|
|
{label}
|
|
</label>
|
|
)}
|
|
<textarea
|
|
id={id}
|
|
className={[styles.textarea, error ? styles.hasError : '', className]
|
|
.filter(Boolean)
|
|
.join(' ')}
|
|
aria-describedby={error ? `${id}-error` : hint ? `${id}-hint` : undefined}
|
|
aria-invalid={error ? true : undefined}
|
|
{...props}
|
|
/>
|
|
{error ? (
|
|
<span id={`${id}-error`} className={styles.error} role="alert">
|
|
{error}
|
|
</span>
|
|
) : hint ? (
|
|
<span id={`${id}-hint`} className={styles.hint}>
|
|
{hint}
|
|
</span>
|
|
) : null}
|
|
</div>
|
|
);
|
|
}
|