import { forwardRef, useImperativeHandle, useRef, type ComponentProps, type ReactNode, } from "react"; import { classNames } from "../../ui/classNames"; import styles from "./index.module.css"; export interface TextFieldProps extends Omit, "size"> { children?: ReactNode; align?: "left" | "center" | "right"; autoWidth?: boolean; variant?: "bubble" | "form"; size?: "regular" | "minor"; childrenAsSuffix?: boolean; } export const TextField = forwardRef( ( { children, className, autoWidth, placeholder, align, disabled, value, variant = "bubble", size = "regular", childrenAsSuffix, ...props }, ref, ) => { const input = useRef(null); useImperativeHandle(ref, () => input.current!, []); return (
{!childrenAsSuffix && children} {childrenAsSuffix && children}
); }, );