(props: InputProps)
| 11 | } |
| 12 | |
| 13 | export function Input(props: InputProps) { |
| 14 | const styles = createStyles() |
| 15 | const [val, setVal] = createSignal(() => props.value || '') |
| 16 | const id = createUniqueId() |
| 17 | const descriptionId = `${id}-description` |
| 18 | |
| 19 | const handleChange = (e: Event) => { |
| 20 | const value = (e.target as HTMLInputElement).value |
| 21 | setVal(value) |
| 22 | props.onChange?.(value) |
| 23 | } |
| 24 | |
| 25 | return ( |
| 26 | <div class={styles().inputContainer}> |
| 27 | <div class={styles().inputWrapper}> |
| 28 | {props.label && ( |
| 29 | <label for={id} class={styles().inputLabel}> |
| 30 | {props.label} |
| 31 | </label> |
| 32 | )} |
| 33 | {props.description && ( |
| 34 | <p id={descriptionId} class={styles().inputDescription}> |
| 35 | {props.description} |
| 36 | </p> |
| 37 | )} |
| 38 | <input |
| 39 | id={id} |
| 40 | data-tsd-control |
| 41 | aria-describedby={props.description ? descriptionId : undefined} |
| 42 | type={props.type || 'text'} |
| 43 | class={styles().input} |
| 44 | value={val()} |
| 45 | placeholder={props.placeholder} |
nothing calls this directly
no test coverage detected