{"version":3,"sources":["../../src/components/UnstyledInput/index.tsx","../../src/utils/joinLabelIds.ts","../../src/components/Box/index.tsx","../../src/components/FormField/useFormFieldContext.ts","../../src/components/FormField/FormFieldContext.tsx"],"names":["React","joinLabelIds","ids","id","jsx","_Box","className","component","style","props","ref","Box","Fragment","FormFieldContext","useFormFieldContext","_UnstyledInput","inputProps","forwardedRef","descriptionId","errorId","isError","UnstyledInput"],"mappings":"AAAA,OAAOA,MAAW,QCAX,SAASC,KAAgBC,EAA6B,CAC3D,OAAOA,EAAI,OAAQC,GAAO,CAAC,CAACA,CAAE,EAAE,KAAK,GAAG,GAAK,MAC/C,CCFA,OAAOH,MAAW,QAgBT,cAAAI,MAAA,oBALF,IAAMC,EAAOL,EAAM,WAGxB,CAAC,CAAE,UAAAM,EAAW,UAAAC,EAAW,MAAAC,EAAO,GAAGC,CAAM,EAAGC,IAErCN,EADSG,GAAa,MACrB,CAAQ,IAAKG,EAAK,UAAWJ,EAAW,MAAOE,EAAQ,GAAGC,EAAO,CAC1E,EAEDJ,EAAK,YAAc,MAEZ,IAAMM,EAAkDN,ECrB/D,OAAOL,MAAW,QCAlB,OAAOA,MAAW,QAeT,mBAAAY,EAAA,OAAAR,MAAA,oBAFF,IAAMS,EAAmBb,EAAM,cAAqC,CACzE,GAAI,OACJ,MAAOI,EAAAQ,EAAA,EAAE,EACT,QAAS,GACT,YAAa,OACb,cAAe,OACf,MAAO,OACP,QAAS,OACT,QAAS,EACX,CAAC,EDlBM,SAASE,GAAsB,CACpC,OAAOd,EAAM,WAAWa,CAAgB,CAC1C,CHQI,cAAAT,MAAA,oBANJ,IAAMW,EAAiBf,EAAM,WAG3B,CAAC,CAAE,UAAAO,EAAY,QAAS,GAAGS,CAAW,EAAGC,IAAiB,CAC1D,GAAM,CAAE,GAAAd,EAAI,cAAAe,EAAe,QAAAC,EAAS,QAAAC,CAAQ,EAAIN,EAAoB,EACpE,OACEV,EAACO,EAAA,CACC,UAAWJ,EACX,GAAIJ,EACJ,mBAAkBF,EAAaiB,EAAeC,CAAO,EACrD,eAAcC,EACd,IAAKH,EACJ,GAAGD,EACN,CAEJ,CAAC,EAEDD,EAAe,YAAc,QAEtB,IAAMM,EACXN","sourcesContent":["import React from \"react\";\n\nimport { BaseProps, PolymorphicProps } from \"../../types\";\nimport { createPolymorphicComponent } from \"../../utils/createPolymorphicComponent\";\nimport { joinLabelIds } from \"../../utils/joinLabelIds\";\nimport { Box } from \"../Box\";\nimport { useFormFieldContext } from \"../FormField/useFormFieldContext\";\n\nconst _UnstyledInput = React.forwardRef<\n  HTMLInputElement,\n  BaseProps & PolymorphicProps\n>(({ component = \"input\", ...inputProps }, forwardedRef) => {\n  const { id, descriptionId, errorId, isError } = useFormFieldContext();\n  return (\n    <Box\n      component={component}\n      id={id}\n      aria-describedby={joinLabelIds(descriptionId, errorId)}\n      aria-invalid={isError}\n      ref={forwardedRef}\n      {...inputProps}\n    />\n  );\n});\n\n_UnstyledInput.displayName = \"Input\";\n\nexport const UnstyledInput = createPolymorphicComponent<\"input\", BaseProps>(\n  _UnstyledInput\n);\n","export function joinLabelIds(...ids: (string | undefined)[]) {\n  return ids.filter((id) => !!id).join(\" \") || undefined;\n}\n","import React from \"react\";\n\nimport { PolymorphicProps } from \"../../types\";\nimport { createPolymorphicComponent } from \"../../utils/createPolymorphicComponent\";\n\nexport type BoxProps = {\n  className?: string;\n  children?: React.ReactNode;\n  style?: React.CSSProperties;\n};\n\nexport const _Box = React.forwardRef<\n  HTMLDivElement,\n  BoxProps & PolymorphicProps\n>(({ className, component, style, ...props }, ref) => {\n  const Element = component || \"div\";\n  return <Element ref={ref} className={className} style={style} {...props} />;\n});\n\n_Box.displayName = \"Box\";\n\nexport const Box = createPolymorphicComponent<\"div\", BoxProps>(_Box);\n","import React from \"react\";\n\nimport { FormFieldContext } from \"./FormFieldContext\";\n\nexport function useFormFieldContext() {\n  return React.useContext(FormFieldContext);\n}\n","import React from \"react\";\n\nexport type FormFieldContextValue = {\n  id: string | undefined;\n  label: React.ReactNode;\n  labelId: string;\n  description: React.ReactNode | undefined;\n  descriptionId: string | undefined;\n  error: React.ReactNode | undefined;\n  errorId: string | undefined;\n  isError: boolean;\n};\n\nexport const FormFieldContext = React.createContext<FormFieldContextValue>({\n  id: undefined,\n  label: <></>,\n  labelId: \"\",\n  description: undefined,\n  descriptionId: undefined,\n  error: undefined,\n  errorId: undefined,\n  isError: false,\n});\n"]}