(props: {
value: string;
onChange: (e: ChangeEvent<HTMLInputElement>) => void;
label: string;
className?: string;
floatingClassName?: string;
onBlur?: FocusEventHandler;
})
| 4 | import { AutoGrowingTextArea } from "./autoGrowingTextarea"; |
| 5 | |
| 6 | export default function FloatingLabelInput(props: { |
| 7 | value: string; |
| 8 | onChange: (e: ChangeEvent<HTMLInputElement>) => void; |
| 9 | label: string; |
| 10 | className?: string; |
| 11 | floatingClassName?: string; |
| 12 | onBlur?: FocusEventHandler; |
| 13 | }) { |
| 14 | return ( |
| 15 | <div className="relative"> |
| 16 | <input |
| 17 | className={classNames( |
| 18 | "peer w-full pt-4 pb-1 rounded outline-0 border-gray-200 focus:border-purple-600 focus:ring-purple-600", |
| 19 | props.className || "", |
| 20 | )} |
| 21 | placeholder="" |
| 22 | value={props.value} |
| 23 | onChange={(e) => props.onChange(e)} |
| 24 | onBlur={(e) => (props.onBlur ? props.onBlur(e) : null)} |
| 25 | /> |
| 26 | <div |
| 27 | className={classNames( |
| 28 | props.floatingClassName || "", |
| 29 | "absolute pointer-events-none text-gray-400 left-4 top-3 peer-focus:scale-75 peer-focus:-translate-y-5/8 select-none transition duration-300", |
| 30 | props.value |
| 31 | ? "-translate-x-1/8 -translate-y-5/8 scale-75" |
| 32 | : "peer-focus:-translate-x-1/8", |
| 33 | )} |
| 34 | > |
| 35 | {props.label} |
| 36 | </div> |
| 37 | </div> |
| 38 | ); |
| 39 | } |
| 40 | |
| 41 | export function FloatingLabelTextArea(props: { |
| 42 | content: string; |
nothing calls this directly
no test coverage detected