{"version":3,"sources":["../../src/components/Input/index.tsx"],"names":["forwardRef","styles","jsx","Input","type","size","fill","description","error","label","id","className","inputProps","forwardedRef","input","UnstyledInput","clsx_m_default","FormField"],"mappings":"wNACA,OAAS,cAAAA,MAAkB,QAQ3B,OAAOC,MAAY,uBA4Bb,cAAAC,MAAA,oBAhBC,IAAMC,EAAQH,EACnB,CACE,CACE,KAAAI,EAAO,OACP,KAAAC,EAAO,KACP,KAAAC,EACA,YAAAC,EACA,MAAAC,EACA,MAAAC,EACA,GAAAC,EACA,UAAAC,EACA,GAAGC,CACL,EACAC,IACG,CACH,IAAMC,EACJZ,EAACa,EAAA,CACC,KAAMX,EACL,GAAGQ,EACJ,IAAKC,EACL,UAAWG,EACTf,EAAO,MACPA,EAAO,UAAUI,GAAM,EACvBC,GAAQL,EAAO,aAAa,EAC5BU,CACF,EACF,EAGF,OAAKF,EAGHP,EAACe,EAAA,CACC,YAAaV,EACb,MAAOC,EACP,MAAOC,EACP,GAAIC,EACJ,KAAMJ,EAEL,SAAAQ,EACH,EAXiBA,CAarB,CACF,EAEAX,EAAM,YAAc","sourcesContent":["import clsx from \"clsx\";\nimport { forwardRef } from \"react\";\n\nimport type { Size } from \"@camome/system\";\n\nimport { BaseProps } from \"../../types\";\nimport { FormField, FormFieldProps } from \"../FormField\";\nimport { UnstyledInput } from \"../UnstyledInput\";\n\nimport styles from \"./styles.module.scss\";\n\ntype OmittedNativeProps = \"size\";\ntype NativeProps = Omit<JSX.IntrinsicElements[\"input\"], OmittedNativeProps>;\n\nexport type InputProps = {\n  size?: Size;\n  fill?: boolean;\n} & BaseProps &\n  NativeProps &\n  Pick<Partial<FormFieldProps>, \"description\" | \"error\" | \"label\">;\n\nexport const Input = forwardRef<HTMLInputElement, InputProps>(\n  (\n    {\n      type = \"text\",\n      size = \"md\",\n      fill,\n      description,\n      error,\n      label,\n      id,\n      className,\n      ...inputProps\n    },\n    forwardedRef\n  ) => {\n    const input = (\n      <UnstyledInput\n        type={type}\n        {...inputProps}\n        ref={forwardedRef}\n        className={clsx(\n          styles.Block,\n          styles[`Block--${size}`],\n          fill && styles[`Block--fill`],\n          className\n        )}\n      />\n    );\n\n    if (!label) return input;\n\n    return (\n      <FormField\n        description={description}\n        error={error}\n        label={label}\n        id={id}\n        fill={fill}\n      >\n        {input}\n      </FormField>\n    );\n  }\n);\n\nInput.displayName = \"Input\";\n"]}