{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "otp-input",
  "title": "Input OTP",
  "description": "A one-time code in separate boxes, where each character rises into its box as it is typed or pasted.",
  "dependencies": [
    "@ui-sdk/react",
    "@ui-sdk/core"
  ],
  "registryDependencies": [
    "https://kinoui.com/r/refs.json",
    "https://kinoui.com/r/separator.json",
    "https://kinoui.com/r/theme.json"
  ],
  "files": [
    {
      "path": "registry/components/kino/otp-input.tsx",
      "content": "'use client'\n\nimport { separatorVariants } from '@/registry/components/kino/separator'\nimport { markMounted } from '@/registry/lib/refs'\nimport {\n  OTPInputGroup as OTPInputGroupPrimitive,\n  OTPInput as OTPInputPrimitive,\n  OTPInputSeparator as OTPInputSeparatorPrimitive,\n  OTPInputSlot as OTPInputSlotPrimitive,\n} from '@ui-sdk/react/otp-input'\nimport { type ComponentProps, createContext, use } from 'react'\n\nimport { cn } from '@/lib/utils'\n\n/*\n * A one-time code in separate boxes. ui-sdk keeps the code in one input laid\n * over the boxes, which a screen reader hears as one field; each box draws a\n * character, which rises into it as it's typed or pasted, and the box typing\n * goes to shows the focus and, while empty, a caret.\n */\n\n/** Whether the boxes show a dot for each character. */\nconst MaskContext = createContext(false)\n\nfunction OTPInput({\n  className,\n  mask = false,\n  ...props\n}: Omit<ComponentProps<typeof OTPInputPrimitive>, 'className'> & {\n  className?: string\n  /** Shows a dot for each character, as a password does. */\n  mask?: boolean\n}) {\n  return (\n    <MaskContext value={mask}>\n      <OTPInputPrimitive\n        className={cn('group/otp flex min-w-0 items-center gap-2', className)}\n        {...props}\n      />\n    </MaskContext>\n  )\n}\n\nfunction OTPInputGroup({\n  className,\n  ...props\n}: Omit<ComponentProps<typeof OTPInputGroupPrimitive>, 'className'> & {\n  className?: string\n}) {\n  return (\n    <OTPInputGroupPrimitive\n      className={cn('flex min-w-0 items-center gap-2', className)}\n      {...props}\n    />\n  )\n}\n\n/**\n * A box drawn as Input's is, whose states come from the one input over the\n * boxes: the focus ring on the box typing goes to, and the invalid mark, a\n * dashed outline under forced colours, on every box. It narrows when the row\n * is short of room, so a long code stays on one line.\n */\nconst slotClassName =\n  'group/slot relative flex h-(--control-height-lg) w-[calc(var(--control-height-lg)*0.9)] min-w-6 items-center justify-center rounded-(--control-radius) border border-input bg-transparent shadow-xs transition-[color,background-color,border-color,box-shadow] duration-(--motion-press-duration) ease-(--motion-press-fade-easing) group-has-focus-visible/otp:data-active:border-ring group-has-focus-visible/otp:data-active:ring-3 group-has-focus-visible/otp:data-active:ring-ring/50 forced-colors:group-has-focus-visible/otp:data-active:outline-2 forced-colors:group-has-focus-visible/otp:data-active:outline-[Highlight] group-has-aria-invalid/otp:border-destructive group-has-aria-invalid/otp:group-has-focus-visible/otp:data-active:border-destructive group-has-aria-invalid/otp:group-has-focus-visible/otp:data-active:ring-destructive/20 forced-colors:group-has-aria-invalid/otp:outline-2 forced-colors:group-has-aria-invalid/otp:outline-offset-1 forced-colors:group-has-aria-invalid/otp:outline-dashed data-disabled:opacity-50 dark:bg-input/30 dark:group-has-aria-invalid/otp:border-destructive/70 dark:group-has-aria-invalid/otp:group-has-focus-visible/otp:data-active:ring-destructive/40'\n\nfunction OTPInputSlot({\n  className,\n  ...props\n}: Omit<ComponentProps<typeof OTPInputSlotPrimitive>, 'className' | 'children'> & {\n  className?: string\n}) {\n  const mask = use(MaskContext)\n  return (\n    <OTPInputSlotPrimitive\n      ref={markMounted}\n      className={cn(slotClassName, className)}\n      {...props}\n    >\n      {({ char }) => (\n        <>\n          <span\n            key={char}\n            className='pointer-events-none text-lg font-medium tabular-nums transition-[opacity,translate,scale] duration-(--motion-enter-duration) ease-(--motion-enter-easing) group-data-mounted/slot:starting:opacity-0 motion-safe:group-data-mounted/slot:starting:translate-y-(--otp-input-rise,0.375rem) motion-safe:group-data-mounted/slot:starting:scale-95'\n          >\n            {mask && char ? '•' : char}\n          </span>\n          <span className='bg-foreground pointer-events-none absolute hidden h-5 w-px animate-pulse group-data-fake-caret/slot:block motion-reduce:animate-none' />\n        </>\n      )}\n    </OTPInputSlotPrimitive>\n  )\n}\n\nfunction OTPInputSeparator({\n  className,\n  ...props\n}: Omit<ComponentProps<typeof OTPInputSeparatorPrimitive>, 'className'> & {\n  className?: string\n}) {\n  return (\n    <OTPInputSeparatorPrimitive\n      className={cn(separatorVariants(), 'w-2.5', className)}\n      {...props}\n    />\n  )\n}\n\nexport { OTPInput, OTPInputGroup, OTPInputSeparator, OTPInputSlot }\n",
      "type": "registry:component",
      "target": "@components/kino/otp-input.tsx"
    }
  ],
  "type": "registry:component"
}