{"version":3,"sources":["../../src/components/input-otp.tsx"],"sourcesContent":["import React, {\n  ComponentProps,\n  ComponentPropsWithoutRef,\n  ElementRef,\n} from \"react\";\nimport {\n  OTPInput as PrimitiveInputOTP,\n  OTPInputContext as PrimitiveInputOTPContext,\n} from \"input-otp\";\nimport { clx } from \"../utils\";\nimport { cva } from \"class-variance-authority\";\n\ninterface BaseInputOTPProps {\n  maxLength: number;\n  value?: string;\n  onChange?: (value: string) => void;\n  containerClassName?: string;\n  children: React.ReactNode;\n  invalid?: boolean;\n}\n\ninterface InputOTPProps\n  extends BaseInputOTPProps,\n    Omit<ComponentProps<\"input\">, keyof BaseInputOTPProps> {}\n\nconst InputOTP = React.forwardRef<\n  ElementRef<typeof PrimitiveInputOTP>,\n  InputOTPProps\n>(({ className, containerClassName, children, invalid, ...props }, ref) => (\n  <PrimitiveInputOTP\n    ref={ref}\n    containerClassName={clx(\n      \"group flex items-center gap-1.5\",\n      containerClassName,\n    )}\n    className={clx(\"disabled:cursor-not-allowed\", className)}\n    aria-invalid={invalid}\n    {...props}\n  >\n    {children}\n  </PrimitiveInputOTP>\n));\nInputOTP.displayName = \"InputOTP\";\n\nconst slot_cva = cva(\n  [\n    \"relative flex h-[68px] w-[50px] items-center justify-center rounded-md border bg-bg-white text-4xl font-medium text-txt-black-900 transition-all\",\n    \"border-otl-gray-200 group-has-[input[aria-invalid=true]]:border-otl-danger-300\",\n    \"group-has-[:disabled]:bg-bg-washed group-has-[:disabled]:text-txt-black-500\",\n  ],\n  {\n    variants: {\n      active: {\n        true: \"z-10 border-otl-primary-300 ring ring-otl-primary-200 group-has-[input[aria-invalid=true]]:ring-otl-danger-200\",\n        false: \"\",\n      },\n    },\n    defaultVariants: {},\n  },\n);\n\nconst InputOTPSlot = React.forwardRef<\n  ElementRef<\"div\">,\n  ComponentPropsWithoutRef<\"div\"> & { index: number }\n>(({ index, className, ...props }, ref) => {\n  const { slots } = React.useContext(PrimitiveInputOTPContext);\n  const { char, hasFakeCaret, isActive } = slots[index]!;\n\n  return (\n    <div\n      ref={ref}\n      className={slot_cva({ active: isActive, className })}\n      {...props}\n    >\n      {char}\n      {hasFakeCaret && (\n        <div className=\"pointer-events-none absolute inset-0 flex items-center justify-center\">\n          <div className=\"animate-caret-blink bg-bg-black-900 h-11 w-px duration-1000\" />\n        </div>\n      )}\n    </div>\n  );\n});\nInputOTPSlot.displayName = \"InputOTPSlot\";\n\nexport { InputOTP, InputOTPSlot };\n"],"mappings":"kGAAA,OAAOA,MAIA,QACP,OACE,YAAYC,EACZ,mBAAmBC,MACd,YAEP,OAAS,OAAAC,MAAW,2BAmBlB,cAAAC,EAwCE,QAAAC,MAxCF,oBAJF,IAAMC,EAAWC,EAAM,WAGrB,CAACC,EAAgEC,IAAK,CAArE,IAAAC,EAAAF,EAAE,WAAAG,EAAW,mBAAAC,EAAoB,SAAAC,EAAU,QAAAC,CA5B9C,EA4BGJ,EAAuDK,EAAAC,EAAvDN,EAAuD,CAArD,YAAW,qBAAoB,WAAU,YAC5C,OAAAN,EAACa,EAAAC,EAAAC,EAAA,CACC,IAAKV,EACL,mBAAoBW,EAClB,kCACAR,CACF,EACA,UAAWQ,EAAI,8BAA+BT,CAAS,EACvD,eAAcG,GACVC,GARL,CAUE,SAAAF,GACH,EACD,EACDP,EAAS,YAAc,WAEvB,IAAMe,EAAWC,EACf,CACE,mJACA,iFACA,6EACF,EACA,CACE,SAAU,CACR,OAAQ,CACN,KAAM,iHACN,MAAO,EACT,CACF,EACA,gBAAiB,CAAC,CACpB,CACF,EAEMC,EAAehB,EAAM,WAGzB,CAACC,EAAgCC,IAAQ,CAAxC,IAAAC,EAAAF,EAAE,OAAAgB,EAAO,UAAAb,CAhEZ,EAgEGD,EAAuBK,EAAAC,EAAvBN,EAAuB,CAArB,QAAO,cACV,GAAM,CAAE,MAAAe,CAAM,EAAIlB,EAAM,WAAWmB,CAAwB,EACrD,CAAE,KAAAC,EAAM,aAAAC,EAAc,SAAAC,CAAS,EAAIJ,EAAMD,CAAK,EAEpD,OACEnB,EAAC,MAAAa,EAAAC,EAAA,CACC,IAAKV,EACL,UAAWY,EAAS,CAAE,OAAQQ,EAAU,UAAAlB,CAAU,CAAC,GAC/CI,GAHL,CAKE,UAAAY,EACAC,GACCxB,EAAC,OAAI,UAAU,wEACb,SAAAA,EAAC,OAAI,UAAU,8DAA8D,EAC/E,IAEJ,CAEJ,CAAC,EACDmB,EAAa,YAAc","names":["React","PrimitiveInputOTP","PrimitiveInputOTPContext","cva","jsx","jsxs","InputOTP","React","_a","ref","_b","className","containerClassName","children","invalid","props","__objRest","PrimitiveInputOTP","__spreadProps","__spreadValues","clx","slot_cva","cva","InputOTPSlot","index","slots","PrimitiveInputOTPContext","char","hasFakeCaret","isActive"]}