{"version":3,"file":"otp-field.cjs","sources":["../../../components/otp-field/otp-field.tsx"],"sourcesContent":["'use client';\n\nimport { OTPField as OTPFieldPrimitive } from '@base-ui/react/otp-field';\nimport { Separator as SeparatorPrimitive } from '@base-ui/react/separator';\nimport { cx } from 'class-variance-authority';\nimport { useFieldContext } from '../field';\nimport styles from './otp-field.module.css';\n\nexport interface OTPFieldRootProps extends OTPFieldPrimitive.Root.Props {}\n\nconst OTPFieldRoot = ({\n  className,\n  disabled,\n  required,\n  length,\n  ref,\n  ...props\n}: OTPFieldRootProps) => {\n  const fieldContext = useFieldContext();\n  const resolvedDisabled = disabled ?? fieldContext?.disabled;\n  const resolvedRequired = required ?? fieldContext?.required;\n\n  return (\n    <OTPFieldPrimitive.Root\n      ref={ref}\n      className={cx(styles['otp-field'], className)}\n      disabled={resolvedDisabled}\n      required={resolvedRequired}\n      length={length}\n      data-slot='otp-field'\n      {...props}\n    />\n  );\n};\n\nOTPFieldRoot.displayName = 'OTPField';\n\nexport interface OTPFieldInputProps extends OTPFieldPrimitive.Input.Props {}\n\nconst OTPFieldInput = ({ className, ref, ...props }: OTPFieldInputProps) => (\n  <OTPFieldPrimitive.Input\n    ref={ref}\n    className={cx(styles['otp-field-input'], className)}\n    data-slot='otp-field-input'\n    {...props}\n  />\n);\n\nOTPFieldInput.displayName = 'OTPField.Input';\n\nexport type OTPFieldSeparatorProps = Omit<\n  SeparatorPrimitive.Props,\n  'orientation'\n>;\n\nconst OTPFieldSeparator = ({\n  className,\n  ref,\n  ...props\n}: OTPFieldSeparatorProps) => (\n  <SeparatorPrimitive\n    ref={ref}\n    orientation='horizontal'\n    className={cx(styles['otp-field-separator'], className)}\n    data-slot='otp-field-separator'\n    {...props}\n  />\n);\n\nOTPFieldSeparator.displayName = 'OTPField.Separator';\n\nexport const OTPField = Object.assign(OTPFieldRoot, {\n  Input: OTPFieldInput,\n  Separator: OTPFieldSeparator\n});\n"],"names":[],"mappings":";;;;;;;;;;;AAUA;AAQE;AACA;AACA;AAEA;AAWF;AAEA;AAIA;AASA;AAOA;AAcA;;AAGE;AACA;AACD;;"}