{"version":3,"sources":["../../../../node_modules/.pnpm/clsx@1.2.1/node_modules/clsx/dist/clsx.m.js","../../src/components/Textarea/index.tsx","../../src/components/FormField/index.tsx","../../src/components/FormField/FormFieldContext.tsx","../../src/components/FormField/useFormFieldContext.ts","../../src/components/FormField/FormFieldDescription/index.tsx","../../src/components/FormField/FormFieldError/index.tsx","../../src/components/FormField/FormFieldLabel/index.tsx","../../src/components/UnstyledInput/index.tsx","../../src/utils/joinLabelIds.ts","../../src/components/Box/index.tsx"],"names":["r","t","f","n","clsx","clsx_m_default","forwardRef","React","Fragment","jsx","FormFieldContext","useFormFieldContext","styles","FormFieldDescription","className","style","description","descriptionId","FormFieldError","error","errorId","FormFieldLabel","id","label","labelId","jsxs","FormField","_id","custom","fill","children","useIdValue","ctxValue","content","FormFieldContainer","joinLabelIds","ids","_Box","component","props","ref","Box","_UnstyledInput","inputProps","forwardedRef","isError","UnstyledInput","Textarea","textarea"],"mappings":"AAAA,SAASA,EAAE,EAAE,CAAC,IAAIC,EAAEC,EAAEC,EAAE,GAAG,GAAa,OAAO,GAAjB,UAA8B,OAAO,GAAjB,SAAmBA,GAAG,UAAoB,OAAO,GAAjB,SAAmB,GAAG,MAAM,QAAQ,CAAC,EAAE,IAAIF,EAAE,EAAEA,EAAE,EAAE,OAAOA,IAAI,EAAEA,CAAC,IAAIC,EAAEF,EAAE,EAAEC,CAAC,CAAC,KAAKE,IAAIA,GAAG,KAAKA,GAAGD,OAAQ,KAAID,KAAK,EAAE,EAAEA,CAAC,IAAIE,IAAIA,GAAG,KAAKA,GAAGF,GAAG,OAAOE,CAAC,CAAQ,SAASC,GAAM,CAAC,QAAQ,EAAEH,EAAEC,EAAE,EAAEC,EAAE,GAAGD,EAAE,UAAU,SAAS,EAAE,UAAUA,GAAG,KAAKD,EAAED,EAAE,CAAC,KAAKG,IAAIA,GAAG,KAAKA,GAAGF,GAAG,OAAOE,CAAC,CAAC,IAAOE,EAAQD,ECCjX,OAAS,cAAAE,MAAkB,QCA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"==typeof e||\"number\"==typeof e)n+=e;else if(\"object\"==typeof e)if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(f=r(e[t]))&&(n&&(n+=\" \"),n+=f);else for(t in e)e[t]&&(n&&(n+=\" \"),n+=t);return n}export function clsx(){for(var e,t,f=0,n=\"\";f<arguments.length;)(e=arguments[f++])&&(t=r(e))&&(n&&(n+=\" \"),n+=t);return n}export default clsx;","import clsx from \"clsx\";\nimport { forwardRef } from \"react\";\n\nimport { FormField, type FormFieldProps } from \"../FormField\";\nimport { UnstyledInput } from \"../UnstyledInput\";\n\nimport styles from \"./styles.module.scss\";\n\ntype TextareaNativeProps = JSX.IntrinsicElements[\"textarea\"];\n\nexport type TextareaProps = {\n  fill?: boolean;\n} & TextareaNativeProps &\n  Pick<Partial<FormFieldProps>, \"description\" | \"error\" | \"label\">;\n\nexport const Textarea = forwardRef<HTMLTextAreaElement, TextareaProps>(\n  (\n    { description, error, label, id, fill, className, ...props },\n    forwardedRef\n  ) => {\n    const textarea = (\n      <UnstyledInput\n        component=\"textarea\"\n        {...props}\n        ref={forwardedRef}\n        className={clsx(styles.Block, fill && styles[`Block--fill`], className)}\n      />\n    );\n\n    if (!label) return textarea;\n\n    return (\n      <FormField\n        description={description}\n        error={error}\n        label={label}\n        id={id}\n        fill={fill}\n      >\n        {textarea}\n      </FormField>\n    );\n  }\n);\n\nTextarea.displayName = \"Textarea\";\n","import clsx from \"clsx\";\nimport React from \"react\";\n\nimport { BaseProps } from \"src/types\";\n\nimport { FormFieldContext, FormFieldContextValue } from \"./FormFieldContext\";\nimport { FormFieldDescription } from \"./FormFieldDescription\";\nimport { FormFieldError } from \"./FormFieldError\";\nimport { FormFieldLabel } from \"./FormFieldLabel\";\nimport styles from \"./styles.module.scss\";\n\nexport type FormFieldProps = {\n  label: React.ReactNode;\n  description?: React.ReactNode;\n  error?: boolean | string;\n  id?: string;\n  custom?: boolean;\n  fill?: boolean;\n  children:\n    | React.ReactNode\n    | ((props: FormFieldContextValue) => React.ReactNode);\n  // using `& BaseProps` breaks react-docgen somehow\n  className?: string;\n  style?: React.CSSProperties;\n};\n\ntype FormFieldApi = React.FC<FormFieldProps> & {\n  Container: typeof FormFieldContainer;\n  Label: typeof FormFieldLabel;\n  Description: typeof FormFieldDescription;\n  Error: typeof FormFieldError;\n};\n\nexport const FormField = (({\n  label,\n  description,\n  error = false,\n  id: _id,\n  custom = false,\n  fill = false,\n  children,\n  className,\n  style,\n}: FormFieldProps) => {\n  const useIdValue = React.useId();\n  const id = _id || useIdValue;\n  const labelId = `${id}--label`;\n  const descriptionId = description ? `${id}--description` : undefined;\n  const errorId = typeof error === \"string\" ? `${id}--error` : undefined;\n  const ctxValue = {\n    id,\n    label,\n    labelId,\n    description,\n    descriptionId,\n    error,\n    errorId,\n    isError: !!error,\n  };\n\n  const content = (\n    <FormFieldContext.Provider value={ctxValue}>\n      {!custom && <FormFieldLabel />}\n      {!custom && <FormFieldDescription />}\n      {typeof children === \"function\" ? children(ctxValue) : children}\n      {!custom && <FormFieldError />}\n    </FormFieldContext.Provider>\n  );\n\n  return custom ? (\n    content\n  ) : (\n    <FormFieldContainer fill={fill} className={className} style={style}>\n      {content}\n    </FormFieldContainer>\n  );\n}) as FormFieldApi;\n\nfunction FormFieldContainer({\n  fill,\n  children,\n  className,\n  style,\n}: {\n  fill: boolean;\n  children: React.ReactNode;\n} & BaseProps) {\n  return (\n    <div\n      className={clsx(styles.Block, fill && styles[\"Block--fill\"], className)}\n      style={style}\n    >\n      {children}\n    </div>\n  );\n}\n\nFormField.Container = FormFieldContainer;\nFormField.Label = FormFieldLabel;\nFormField.Description = FormFieldDescription;\nFormField.Error = FormFieldError;\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","import React from \"react\";\n\nimport { FormFieldContext } from \"./FormFieldContext\";\n\nexport function useFormFieldContext() {\n  return React.useContext(FormFieldContext);\n}\n","import clsx from \"clsx\";\n\nimport { BaseProps } from \"../../../types\";\nimport { useFormFieldContext } from \"../useFormFieldContext\";\n\nimport styles from \"./styles.module.scss\";\n\nexport type FormHelperTextProps = BaseProps;\n\nexport function FormFieldDescription({\n  className,\n  style,\n}: FormHelperTextProps) {\n  const { description, descriptionId } = useFormFieldContext();\n\n  if (!description || !descriptionId) return null;\n\n  return (\n    <span\n      id={descriptionId}\n      className={clsx(styles[\"Block\"], className)}\n      style={style}\n    >\n      {description}\n    </span>\n  );\n}\n","import clsx from \"clsx\";\n\nimport { BaseProps } from \"../../../types\";\nimport { useFormFieldContext } from \"../useFormFieldContext\";\n\nimport styles from \"./styles.module.scss\";\n\nexport type FormHelperTextProps = BaseProps;\n\nexport function FormFieldError({ className, style }: FormHelperTextProps) {\n  const { error, errorId } = useFormFieldContext();\n\n  if (!error || !errorId) return null;\n\n  return (\n    <span\n      id={errorId}\n      className={clsx(styles[\"Block\"], className)}\n      style={style}\n    >\n      {error}\n    </span>\n  );\n}\n","import clsx from \"clsx\";\n\nimport { BaseProps } from \"../../../types\";\nimport { useFormFieldContext } from \"../useFormFieldContext\";\n\nimport styles from \"./styles.module.scss\";\n\nexport type FormLabelProps = BaseProps;\n\nexport function FormFieldLabel({ className, style }: FormLabelProps) {\n  const { id, label, labelId } = useFormFieldContext();\n\n  return (\n    <label\n      htmlFor={id}\n      id={labelId}\n      className={clsx(styles[\"Block\"], className)}\n      style={style}\n    >\n      {label}\n    </label>\n  );\n}\n","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"]}