UNPKG

@yamada-ui/input

Version:

Yamada UI input component

1 lines 2.34 kB
{"version":3,"sources":["../src/input.tsx"],"sourcesContent":["import type {\n ColorModeToken,\n CSS,\n CSSUIObject,\n HTMLUIProps,\n ThemeProps,\n} from \"@yamada-ui/core\"\nimport type { FormControlOptions } from \"@yamada-ui/form-control\"\nimport {\n forwardRef,\n omitThemeProps,\n ui,\n useComponentMultiStyle,\n} from \"@yamada-ui/core\"\nimport { useFormControlProps } from \"@yamada-ui/form-control\"\nimport { cx } from \"@yamada-ui/utils\"\n\ninterface InputOptions {\n /**\n * The border color when the input is invalid.\n */\n errorBorderColor?: ColorModeToken<CSS.Property.BorderColor, \"colors\">\n /**\n * The border color when the input is focused.\n */\n focusBorderColor?: ColorModeToken<CSS.Property.BorderColor, \"colors\">\n /**\n * The native HTML `size` attribute to be passed to the `input`.\n */\n htmlSize?: number\n}\n\nexport interface InputProps\n extends Omit<\n HTMLUIProps<\"input\">,\n \"disabled\" | \"readOnly\" | \"required\" | \"size\"\n >,\n ThemeProps<\"Input\">,\n InputOptions,\n FormControlOptions {}\n\n/**\n * `Input` is a component used to obtain text input from the user.\n *\n * @see Docs https://yamada-ui.com/components/forms/input\n */\nexport const Input = forwardRef<InputProps, \"input\">((props, ref) => {\n const [styles, mergedProps] = useComponentMultiStyle(\"Input\", props)\n const computedProps = omitThemeProps(mergedProps)\n const { className, htmlSize, __css, ...rest } =\n useFormControlProps(computedProps)\n\n const css: CSSUIObject = { ...styles.field, ...__css }\n\n return (\n <ui.input\n ref={ref}\n className={cx(\"ui-input\", className)}\n size={htmlSize}\n __css={css}\n {...rest}\n />\n )\n})\n\nInput.displayName = \"Input\"\nInput.__ui__ = \"Input\"\n"],"mappings":";;;AAQA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,2BAA2B;AACpC,SAAS,UAAU;AAwCf;AATG,IAAM,QAAQ,WAAgC,CAAC,OAAO,QAAQ;AACnE,QAAM,CAAC,QAAQ,WAAW,IAAI,uBAAuB,SAAS,KAAK;AACnE,QAAM,gBAAgB,eAAe,WAAW;AAChD,QAAM,EAAE,WAAW,UAAU,OAAO,GAAG,KAAK,IAC1C,oBAAoB,aAAa;AAEnC,QAAM,MAAmB,EAAE,GAAG,OAAO,OAAO,GAAG,MAAM;AAErD,SACE;AAAA,IAAC,GAAG;AAAA,IAAH;AAAA,MACC;AAAA,MACA,WAAW,GAAG,YAAY,SAAS;AAAA,MACnC,MAAM;AAAA,MACN,OAAO;AAAA,MACN,GAAG;AAAA;AAAA,EACN;AAEJ,CAAC;AAED,MAAM,cAAc;AACpB,MAAM,SAAS;","names":[]}