@constructive-io/ui 0.14.1 → 0.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. package/dist/{ai-B08ufcbD.cjs → ai-DpeOFEwx.cjs} +9 -10
  2. package/dist/ai-DpeOFEwx.cjs.map +1 -0
  3. package/dist/{ai-4JrVVL3q.js → ai-b5y3Iqy4.js} +9 -10
  4. package/dist/ai-b5y3Iqy4.js.map +1 -0
  5. package/dist/components/ai/index.cjs +1 -1
  6. package/dist/components/ai/index.js +1 -1
  7. package/dist/components/autocomplete.cjs +1 -1
  8. package/dist/components/autocomplete.js +1 -1
  9. package/dist/components/badge.d.cts +2 -2
  10. package/dist/components/badge.d.ts +2 -2
  11. package/dist/components/button.cjs +2 -2
  12. package/dist/components/button.cjs.map +1 -1
  13. package/dist/components/button.d.cts +2 -2
  14. package/dist/components/button.d.ts +2 -2
  15. package/dist/components/button.js +2 -2
  16. package/dist/components/button.js.map +1 -1
  17. package/dist/components/card.d.cts +1 -1
  18. package/dist/components/card.d.ts +1 -1
  19. package/dist/components/combobox.cjs +1 -1
  20. package/dist/components/combobox.js +1 -1
  21. package/dist/components/command.cjs +1 -1
  22. package/dist/components/command.js +1 -1
  23. package/dist/components/dropdown-menu.cjs +8 -7
  24. package/dist/components/dropdown-menu.cjs.map +1 -1
  25. package/dist/components/dropdown-menu.js +8 -7
  26. package/dist/components/dropdown-menu.js.map +1 -1
  27. package/dist/components/input-group.cjs +2 -2
  28. package/dist/components/input-group.cjs.map +1 -1
  29. package/dist/components/input-group.js +2 -2
  30. package/dist/components/input-group.js.map +1 -1
  31. package/dist/components/input-otp.cjs +5 -2
  32. package/dist/components/input-otp.cjs.map +1 -1
  33. package/dist/components/input-otp.js +5 -2
  34. package/dist/components/input-otp.js.map +1 -1
  35. package/dist/components/item.d.cts +1 -1
  36. package/dist/components/item.d.ts +1 -1
  37. package/dist/components/multi-select.cjs +1 -1
  38. package/dist/components/multi-select.js +1 -1
  39. package/dist/components/select.cjs +5 -5
  40. package/dist/components/select.cjs.map +1 -1
  41. package/dist/components/select.js +5 -5
  42. package/dist/components/select.js.map +1 -1
  43. package/dist/components/sheet.cjs +1 -1
  44. package/dist/components/sheet.js +1 -1
  45. package/dist/components/sidebar.cjs +1 -1
  46. package/dist/components/sidebar.js +1 -1
  47. package/dist/components/stack/index.d.cts +1 -1
  48. package/dist/components/stack/index.d.ts +1 -1
  49. package/dist/components/toggle-group.cjs +6 -2
  50. package/dist/components/toggle-group.cjs.map +1 -1
  51. package/dist/components/toggle-group.js +6 -2
  52. package/dist/components/toggle-group.js.map +1 -1
  53. package/dist/components/workspace-kit/index.cjs +1 -1
  54. package/dist/components/workspace-kit/index.js +1 -1
  55. package/dist/{fluid-highlight-YWFRZXsw.cjs → fluid-highlight-B8olepSM.cjs} +7 -5
  56. package/dist/fluid-highlight-B8olepSM.cjs.map +1 -0
  57. package/dist/{fluid-highlight-CNELHV8o.js → fluid-highlight-BXVfWNk9.js} +7 -5
  58. package/dist/fluid-highlight-BXVfWNk9.js.map +1 -0
  59. package/dist/{index-B7cT7gZU.d.cts → index-BzLmDsId.d.cts} +3 -3
  60. package/dist/{index-B7cT7gZU.d.ts → index-BzLmDsId.d.ts} +3 -3
  61. package/dist/index.cjs +3 -3
  62. package/dist/index.d.cts +1 -1
  63. package/dist/index.d.ts +1 -1
  64. package/dist/index.js +3 -3
  65. package/dist/{sheet-OxWlnT_G.cjs → sheet-CGFqOAoI.cjs} +2 -2
  66. package/dist/{sheet-OxWlnT_G.cjs.map → sheet-CGFqOAoI.cjs.map} +1 -1
  67. package/dist/{sheet-wPF_l9Cn.js → sheet-LOK_d8-K.js} +2 -2
  68. package/dist/{sheet-wPF_l9Cn.js.map → sheet-LOK_d8-K.js.map} +1 -1
  69. package/dist/{sidebar-DWl1Azyv.js → sidebar-BNZkdIvO.js} +2 -2
  70. package/dist/{sidebar-DWl1Azyv.js.map → sidebar-BNZkdIvO.js.map} +1 -1
  71. package/dist/{sidebar-BEEWmJwC.cjs → sidebar-Bt7qXsqo.cjs} +2 -2
  72. package/dist/{sidebar-BEEWmJwC.cjs.map → sidebar-Bt7qXsqo.cjs.map} +1 -1
  73. package/package.json +2 -2
  74. package/dist/ai-4JrVVL3q.js.map +0 -1
  75. package/dist/ai-B08ufcbD.cjs.map +0 -1
  76. package/dist/fluid-highlight-CNELHV8o.js.map +0 -1
  77. package/dist/fluid-highlight-YWFRZXsw.cjs.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"dropdown-menu.js","names":["React","MenuPrimitive"],"sources":["../../src/components/dropdown-menu.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { Menu as MenuPrimitive } from '@base-ui/react/menu';\nimport { CheckIcon, ChevronRightIcon, CircleIcon } from 'lucide-react';\n\nimport { useFloatingOverlayPortalProps } from '@constructive-io/ui/portal';\nimport { FluidHighlight } from '../lib/motion/fluid-highlight';\nimport { cn } from '../lib/utils';\n\nconst DropdownMenuGroupContext = React.createContext(false);\n\nfunction DropdownMenu({ ...props }: React.ComponentProps<typeof MenuPrimitive.Root>) {\n\treturn <MenuPrimitive.Root data-slot=\"dropdown-menu\" {...props} />;\n}\n\nfunction DropdownMenuPortal({ ...props }: React.ComponentProps<typeof MenuPrimitive.Portal>) {\n\tconst { container } = useFloatingOverlayPortalProps();\n\treturn <MenuPrimitive.Portal data-slot=\"dropdown-menu-portal\" container={container} {...props} />;\n}\n\ntype DropdownMenuTriggerProps = React.ComponentProps<typeof MenuPrimitive.Trigger> & {\n\t/** When true, merges props onto the child element instead of rendering a button */\n\tasChild?: boolean;\n};\n\nfunction DropdownMenuTrigger({ asChild, children, render, nativeButton, ...props }: DropdownMenuTriggerProps) {\n\tconst childRender = render === undefined && asChild && React.isValidElement(children) ? children : undefined;\n\n\treturn (\n\t\t<MenuPrimitive.Trigger\n\t\t\tdata-slot=\"dropdown-menu-trigger\"\n\t\t\tnativeButton={nativeButton ?? (childRender ? true : undefined)}\n\t\t\trender={render ?? childRender}\n\t\t\t{...props}\n\t\t>\n\t\t\t{childRender ? undefined : children}\n\t\t</MenuPrimitive.Trigger>\n\t);\n}\n\ntype DropdownMenuContentProps = React.ComponentProps<typeof MenuPrimitive.Popup> & {\n\tsideOffset?: number;\n\tside?: 'top' | 'bottom' | 'left' | 'right';\n\talign?: 'start' | 'center' | 'end';\n\t/** @deprecated Not supported in Base UI */\n\tonPointerDown?: (e: React.PointerEvent) => void;\n\t/** @deprecated Not supported in Base UI */\n\tonPointerDownOutside?: (e: Event) => void;\n\t/** @deprecated Not supported in Base UI */\n\tonCloseAutoFocus?: (e: Event) => void;\n\t/** @deprecated Base UI menus mount on open automatically */\n\tforceMount?: boolean;\n};\n\nfunction DropdownMenuContent({\n\tclassName,\n\tsideOffset = 4,\n\tside = 'bottom',\n\talign = 'start',\n\tonPointerDown: _onPointerDown,\n\tonPointerDownOutside: _onPointerDownOutside,\n\tonCloseAutoFocus: _onCloseAutoFocus,\n\tforceMount: _forceMount,\n\tchildren,\n\t...props\n}: DropdownMenuContentProps) {\n\tconst { zIndexClass } = useFloatingOverlayPortalProps();\n\n\treturn (\n\t\t<DropdownMenuPortal>\n\t\t\t<MenuPrimitive.Positioner side={side} align={align} sideOffset={sideOffset} className={zIndexClass}>\n\t\t\t\t<MenuPrimitive.Popup\n\t\t\t\t\tdata-slot=\"dropdown-menu-content\"\n\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t`bg-popover text-popover-foreground relative origin-(--transform-origin) max-h-(--available-height) min-w-40\n\t\t\t\t\t\tmax-w-(--available-width) overflow-y-auto overscroll-contain rounded-lg border p-1 [overflow-wrap:anywhere]\n\t\t\t\t\t\tshadow-lg transition-[scale,opacity,translate] duration-(--duration-moderate) ease-out data-starting-style:scale-95\n\t\t\t\t\t\tdata-ending-style:scale-95 data-starting-style:opacity-0 data-ending-style:opacity-0\n\t\t\t\t\t\tdata-[side=bottom]:data-starting-style:-translate-y-2\n\t\t\t\t\t\tdata-[side=left]:data-starting-style:translate-x-2\n\t\t\t\t\t\tdata-[side=right]:data-starting-style:-translate-x-2\n\t\t\t\t\t\tdata-[side=top]:data-starting-style:translate-y-2 motion-reduce:transition-none`,\n\t\t\t\t\t\tclassName,\n\t\t\t\t\t)}\n\t\t\t\t\t{...props}\n\t\t\t\t>\n\t\t\t\t\t<FluidHighlight />\n\t\t\t\t\t{children}\n\t\t\t\t</MenuPrimitive.Popup>\n\t\t\t</MenuPrimitive.Positioner>\n\t\t</DropdownMenuPortal>\n\t);\n}\n\nfunction DropdownMenuGroup({ ...props }: React.ComponentProps<typeof MenuPrimitive.Group>) {\n\treturn (\n\t\t<DropdownMenuGroupContext.Provider value={true}>\n\t\t\t<MenuPrimitive.Group data-slot=\"dropdown-menu-group\" {...props} />\n\t\t</DropdownMenuGroupContext.Provider>\n\t);\n}\n\ntype DropdownMenuItemProps = React.ComponentProps<typeof MenuPrimitive.Item> & {\n\tinset?: boolean;\n\tvariant?: 'default' | 'destructive';\n\t/** When true, merges props onto the child element instead of rendering a div */\n\tasChild?: boolean;\n};\n\nfunction DropdownMenuItem({\n\tclassName,\n\tinset,\n\tvariant = 'default',\n\tasChild,\n\tchildren,\n\trender,\n\t...props\n}: DropdownMenuItemProps) {\n\tconst childRender = render === undefined && asChild && React.isValidElement(children) ? children : undefined;\n\tconst itemClassName = cn(\n\t\t`data-[highlighted]:text-accent-foreground data-[variant=destructive]:text-destructive\n\t\tdata-[variant=destructive]:data-[highlighted]:bg-destructive/10 dark:data-[variant=destructive]:data-[highlighted]:bg-destructive/40\n\t\tdata-[variant=destructive]:data-[highlighted]:text-destructive\n\t\tdata-[variant=destructive]:*:[svg]:!text-destructive relative flex cursor-default items-center gap-2 pointer-coarse:min-h-11\n\t\trounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none\n\t\tdata-[disabled]:opacity-64 data-[inset]:ps-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,\n\t\tclassName,\n\t);\n\n\treturn (\n\t\t<MenuPrimitive.Item\n\t\t\tdata-slot=\"dropdown-menu-item\"\n\t\t\tdata-inset={inset}\n\t\t\tdata-variant={variant}\n\t\t\tclassName={itemClassName}\n\t\t\trender={render ?? childRender}\n\t\t\t{...props}\n\t\t>\n\t\t\t{childRender ? undefined : children}\n\t\t</MenuPrimitive.Item>\n\t);\n}\n\nfunction DropdownMenuCheckboxItem({\n\tclassName,\n\tchildren,\n\tchecked,\n\t...props\n}: React.ComponentProps<typeof MenuPrimitive.CheckboxItem>) {\n\treturn (\n\t\t<MenuPrimitive.CheckboxItem\n\t\t\tdata-slot=\"dropdown-menu-checkbox-item\"\n\t\t\tclassName={cn(\n\t\t\t\t`data-[highlighted]:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5\n\t\t\t\tpe-2 ps-8 text-sm outline-hidden select-none pointer-coarse:min-h-11 data-[disabled]:pointer-events-none data-[disabled]:opacity-64\n\t\t\t\t[&_svg]:pointer-events-none [&_svg]:shrink-0`,\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\tchecked={checked}\n\t\t\t{...props}\n\t\t>\n\t\t\t<span className='pointer-events-none absolute start-2 flex size-3.5 items-center justify-center'>\n\t\t\t\t\t<MenuPrimitive.CheckboxItemIndicator\n\t\t\t\t\t\tkeepMounted\n\t\t\t\t\t\tclassName='transition-[opacity,scale,filter] duration-(--duration-slow) ease-out data-unchecked:scale-[0.25] data-unchecked:opacity-0 data-unchecked:blur-[4px] motion-reduce:transition-none'\n\t\t\t\t\t>\n\t\t\t\t\t<CheckIcon size={16} />\n\t\t\t\t</MenuPrimitive.CheckboxItemIndicator>\n\t\t\t</span>\n\t\t\t{children}\n\t\t</MenuPrimitive.CheckboxItem>\n\t);\n}\n\nfunction DropdownMenuRadioGroup({ ...props }: React.ComponentProps<typeof MenuPrimitive.RadioGroup>) {\n\treturn <MenuPrimitive.RadioGroup data-slot=\"dropdown-menu-radio-group\" {...props} />;\n}\n\nfunction DropdownMenuRadioItem({\n\tclassName,\n\tchildren,\n\t...props\n}: React.ComponentProps<typeof MenuPrimitive.RadioItem>) {\n\treturn (\n\t\t<MenuPrimitive.RadioItem\n\t\t\tdata-slot=\"dropdown-menu-radio-item\"\n\t\t\tclassName={cn(\n\t\t\t\t`data-[highlighted]:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5\n\t\t\t\tpe-2 ps-8 text-sm outline-hidden select-none pointer-coarse:min-h-11 data-[disabled]:pointer-events-none data-[disabled]:opacity-64\n\t\t\t\t[&_svg]:pointer-events-none [&_svg]:shrink-0`,\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t>\n\t\t\t<span className='pointer-events-none absolute start-2 flex size-3.5 items-center justify-center'>\n\t\t\t\t\t<MenuPrimitive.RadioItemIndicator\n\t\t\t\t\t\tkeepMounted\n\t\t\t\t\t\tclassName='transition-[opacity,scale,filter] duration-(--duration-slow) ease-out data-unchecked:scale-[0.25] data-unchecked:opacity-0 data-unchecked:blur-[4px] motion-reduce:transition-none'\n\t\t\t\t\t>\n\t\t\t\t\t<CircleIcon className='size-2 fill-current' />\n\t\t\t\t</MenuPrimitive.RadioItemIndicator>\n\t\t\t</span>\n\t\t\t{children}\n\t\t</MenuPrimitive.RadioItem>\n\t);\n}\n\n/**\n * Uses Base UI's semantic GroupLabel inside DropdownMenuGroup. The standalone\n * div fallback preserves compatibility with earlier Constructive menu markup,\n * where labels were allowed directly inside DropdownMenuContent.\n */\nfunction DropdownMenuLabel({\n\tclassName,\n\tinset,\n\t...props\n}: React.ComponentProps<'div'> & {\n\tinset?: boolean;\n}) {\n\tconst isGrouped = React.useContext(DropdownMenuGroupContext);\n\tconst labelProps = {\n\t\t'data-slot': 'dropdown-menu-label',\n\t\t'data-inset': inset,\n\t\tclassName: cn('text-muted-foreground px-2 py-1.5 text-xs font-medium data-[inset]:ps-8', className),\n\t\t...props,\n\t};\n\n\tif (isGrouped) {\n\t\treturn <MenuPrimitive.GroupLabel {...labelProps} />;\n\t}\n\n\treturn (\n\t\t<div {...labelProps} />\n\t);\n}\n\nfunction DropdownMenuSeparator({ className, ...props }: React.ComponentProps<typeof MenuPrimitive.Separator>) {\n\treturn (\n\t\t<MenuPrimitive.Separator\n\t\t\tdata-slot=\"dropdown-menu-separator\"\n\t\t\tclassName={cn('bg-border -mx-1 my-1 h-px', className)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nfunction DropdownMenuShortcut({ className, ...props }: React.ComponentProps<'span'>) {\n\treturn (\n\t\t<kbd\n\t\t\tdata-slot=\"dropdown-menu-shortcut\"\n\t\t\t// Key chords read left to right in every script (\"⌘T\", never \"T⌘\"), and a long chord must not shrink.\n\t\t\tdir=\"ltr\"\n\t\t\tclassName={cn(\n\t\t\t\t`bg-background text-subtle-foreground ms-auto -me-1 inline-flex h-5 max-h-full shrink-0 items-center rounded border\n\t\t\t\tpx-1 font-[inherit] text-[0.625rem] font-medium whitespace-nowrap`,\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nfunction DropdownMenuSub({ ...props }: React.ComponentProps<typeof MenuPrimitive.SubmenuRoot>) {\n\treturn <MenuPrimitive.SubmenuRoot data-slot=\"dropdown-menu-sub\" {...props} />;\n}\n\nfunction DropdownMenuSubTrigger({\n\tclassName,\n\tinset,\n\tchildren,\n\t...props\n}: React.ComponentProps<typeof MenuPrimitive.SubmenuTrigger> & {\n\tinset?: boolean;\n}) {\n\treturn (\n\t\t<MenuPrimitive.SubmenuTrigger\n\t\t\tdata-slot=\"dropdown-menu-sub-trigger\"\n\t\t\tdata-inset={inset}\n\t\t\tclassName={cn(\n\t\t\t\t`data-[highlighted]:text-accent-foreground data-[popup-open]:bg-accent\n\t\t\t\tdata-[popup-open]:text-accent-foreground relative flex cursor-default items-center rounded-sm px-2 py-1.5 text-sm pointer-coarse:min-h-11\n\t\t\t\toutline-hidden select-none data-[inset]:ps-8`,\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t>\n\t\t\t{children}\n\t\t\t<ChevronRightIcon size={16} className='text-muted-foreground/80 ms-auto rtl:rotate-180' />\n\t\t</MenuPrimitive.SubmenuTrigger>\n\t);\n}\n\nfunction DropdownMenuSubContent({ className, children, ...props }: React.ComponentProps<typeof MenuPrimitive.Popup>) {\n\tconst { container, zIndexClass } = useFloatingOverlayPortalProps();\n\n\treturn (\n\t\t<MenuPrimitive.Portal container={container}>\n\t\t\t<MenuPrimitive.Positioner side='inline-end' sideOffset={-4} className={zIndexClass}>\n\t\t\t\t<MenuPrimitive.Popup\n\t\t\t\t\tdata-slot=\"dropdown-menu-sub-content\"\n\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t`bg-popover text-popover-foreground relative origin-(--transform-origin) max-h-(--available-height) min-w-40\n\t\t\t\t\t\tmax-w-(--available-width) overflow-y-auto overscroll-contain rounded-lg border p-1 [overflow-wrap:anywhere]\n\t\t\t\t\t\tshadow-lg transition-[scale,opacity,translate] duration-(--duration-moderate) ease-out data-starting-style:scale-95\n\t\t\t\t\t\tdata-ending-style:scale-95 data-starting-style:opacity-0 data-ending-style:opacity-0\n\t\t\t\t\t\tdata-[side=bottom]:data-starting-style:-translate-y-2\n\t\t\t\t\t\tdata-[side=left]:data-starting-style:translate-x-2\n\t\t\t\t\t\tdata-[side=right]:data-starting-style:-translate-x-2\n\t\t\t\t\t\tdata-[side=top]:data-starting-style:translate-y-2 motion-reduce:transition-none`,\n\t\t\t\t\t\tclassName,\n\t\t\t\t\t)}\n\t\t\t\t\t{...props}\n\t\t\t\t>\n\t\t\t\t\t<FluidHighlight />\n\t\t\t\t\t{children}\n\t\t\t\t</MenuPrimitive.Popup>\n\t\t\t</MenuPrimitive.Positioner>\n\t\t</MenuPrimitive.Portal>\n\t);\n}\n\nexport {\n\tDropdownMenu,\n\tDropdownMenuCheckboxItem,\n\tDropdownMenuContent,\n\tDropdownMenuGroup,\n\tDropdownMenuItem,\n\tDropdownMenuLabel,\n\tDropdownMenuPortal,\n\tDropdownMenuRadioGroup,\n\tDropdownMenuRadioItem,\n\tDropdownMenuSeparator,\n\tDropdownMenuShortcut,\n\tDropdownMenuSub,\n\tDropdownMenuSubContent,\n\tDropdownMenuSubTrigger,\n\tDropdownMenuTrigger,\n};\n"],"mappings":";;;;;;;;;;;AAUA,MAAM,2BAA2BA,QAAM,cAAc,KAAK;AAE1D,SAAS,aAAa,EAAE,GAAG,SAA0D;CACpF,OAAO,oBAACC,OAAc,MAAf;EAAoB,aAAU;EAAgB,GAAI;CAAQ;AAClE;AAEA,SAAS,mBAAmB,EAAE,GAAG,SAA4D;CAC5F,MAAM,EAAE,cAAc,8BAA8B;CACpD,OAAO,oBAACA,OAAc,QAAf;EAAsB,aAAU;EAAkC;EAAW,GAAI;CAAQ;AACjG;AAOA,SAAS,oBAAoB,EAAE,SAAS,UAAU,QAAQ,cAAc,GAAG,SAAmC;CAC7G,MAAM,cAAc,WAAW,UAAa,WAAWD,QAAM,eAAe,QAAQ,IAAI,WAAW;CAEnG,OACC,oBAACC,OAAc,SAAf;EACC,aAAU;EACV,cAAc,iBAAiB,cAAc,OAAO;EACpD,QAAQ,UAAU;EAClB,GAAI;YAEH,cAAc,SAAY;CACL;AAEzB;AAgBA,SAAS,oBAAoB,EAC5B,WACA,aAAa,GACb,OAAO,UACP,QAAQ,SACR,eAAe,gBACf,sBAAsB,uBACtB,kBAAkB,mBAClB,YAAY,aACZ,UACA,GAAG,SACyB;CAC5B,MAAM,EAAE,gBAAgB,8BAA8B;CAEtD,OACC,oBAAC,oBAAD,YACC,oBAACA,OAAc,YAAf;EAAgC;EAAa;EAAmB;EAAY,WAAW;YACtF,qBAACA,OAAc,OAAf;GACC,aAAU;GACV,WAAW,GACV;;;;;;;wFAQA,SACD;GACA,GAAI;aAbL,CAeC,oBAAC,gBAAD,CAAiB,IAChB,QACmB;;CACI,GACP;AAEtB;AAEA,SAAS,kBAAkB,EAAE,G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M,aAAa;EAClB,aAAa;EACb,cAAc;EACd,WAAW,GAAG,2EAA2E,SAAS;EAClG,GAAG;CACJ;CAEA,IAAI,WACH,OAAO,oBAACC,OAAc,YAAf,EAA0B,GAAI,WAAa;CAGnD,OACC,oBAAC,OAAD,EAAK,GAAI,WAAa;AAExB;AAEA,SAAS,sBAAsB,EAAE,WAAW,GAAG,SAA+D;CAC7G,OACC,oBAACA,OAAc,WAAf;EACC,aAAU;EACV,WAAW,GAAG,6BAA6B,SAAS;EACpD,GAAI;CACJ;AAEH;AAEA,SAAS,qBAAqB,EAAE,WAAW,GAAG,SAAuC;CACpF,OACC,oBAAC,OAAD;EACC,aAAU;EAEV,KAAI;EACJ,WAAW,GACV;wEAEA,SACD;EACA,GAAI;CACJ;AAEH;AAEA,SAAS,gBAAgB,EAAE,GAAG,SAAiE;CAC9F,OAAO,oBAACA,OAAc,aAAf;EAA2B,aAAU;EAAoB,GAAI;CAAQ;AAC7E;AAEA,SAAS,uBAAuB,EAC/B,WACA,OACA,UACA,GAAG,SAGD;CACF,OACC,qBAACA,OAAc,gBAAf;EACC,aAAU;EACV,cAAY;EACZ,WAAW,GACV;;mDAGA,SACD;EACA,GAAI;YATL,CAWE,UACD,oBAAC,kBAAD;GAAkB,MAAM;GAAI,WAAU;EAAmD,EAC5D;;AAEhC;AAEA,SAAS,uBAAuB,EAAE,WAAW,UAAU,GAAG,SAA2D;CACpH,MAAM,EAAE,WAAW,gBAAgB,8BAA8B;CAEjE,OACC,oBAACA,OAAc,QAAf;EAAiC;YAChC,oBAACA,OAAc,YAAf;GAA0B,MAAK;GAAa,YAAY;GAAI,WAAW;aACtE,qBAACA,OAAc,OAAf;IACC,aAAU;IACV,WAAW,GACV;;;;;;;wFAQA,SACD;IACA,GAAI;cAbL,CAeC,oBAAC,gBAAD,CAAiB,IAChB,QACmB;;EACI;CACL;AAExB"}
1
+ {"version":3,"file":"dropdown-menu.js","names":["React","MenuPrimitive"],"sources":["../../src/components/dropdown-menu.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { Menu as MenuPrimitive } from '@base-ui/react/menu';\nimport { CheckIcon, ChevronRightIcon, CircleIcon } from 'lucide-react';\n\nimport { useFloatingOverlayPortalProps } from '@constructive-io/ui/portal';\nimport { FluidHighlight } from '../lib/motion/fluid-highlight';\nimport { cn } from '../lib/utils';\n\n// The popup is 10px round with a 1px border and 4px of padding, so its items and their\n// highlight sit 5px in and are 10px - 5px round: the corners stay parallel.\nconst MENU_ITEM_RADIUS = 'rounded-[calc(var(--radius-lg)-5px)]';\n\nconst DropdownMenuGroupContext = React.createContext(false);\n\nfunction DropdownMenu({ ...props }: React.ComponentProps<typeof MenuPrimitive.Root>) {\n\treturn <MenuPrimitive.Root data-slot=\"dropdown-menu\" {...props} />;\n}\n\nfunction DropdownMenuPortal({ ...props }: React.ComponentProps<typeof MenuPrimitive.Portal>) {\n\tconst { container } = useFloatingOverlayPortalProps();\n\treturn <MenuPrimitive.Portal data-slot=\"dropdown-menu-portal\" container={container} {...props} />;\n}\n\ntype DropdownMenuTriggerProps = React.ComponentProps<typeof MenuPrimitive.Trigger> & {\n\t/** When true, merges props onto the child element instead of rendering a button */\n\tasChild?: boolean;\n};\n\nfunction DropdownMenuTrigger({ asChild, children, render, nativeButton, ...props }: DropdownMenuTriggerProps) {\n\tconst childRender = render === undefined && asChild && React.isValidElement(children) ? children : undefined;\n\n\treturn (\n\t\t<MenuPrimitive.Trigger\n\t\t\tdata-slot=\"dropdown-menu-trigger\"\n\t\t\tnativeButton={nativeButton ?? (childRender ? true : undefined)}\n\t\t\trender={render ?? childRender}\n\t\t\t{...props}\n\t\t>\n\t\t\t{childRender ? undefined : children}\n\t\t</MenuPrimitive.Trigger>\n\t);\n}\n\ntype DropdownMenuContentProps = React.ComponentProps<typeof MenuPrimitive.Popup> & {\n\tsideOffset?: number;\n\tside?: 'top' | 'bottom' | 'left' | 'right';\n\talign?: 'start' | 'center' | 'end';\n\t/** @deprecated Not supported in Base UI */\n\tonPointerDown?: (e: React.PointerEvent) => void;\n\t/** @deprecated Not supported in Base UI */\n\tonPointerDownOutside?: (e: Event) => void;\n\t/** @deprecated Not supported in Base UI */\n\tonCloseAutoFocus?: (e: Event) => void;\n\t/** @deprecated Base UI menus mount on open automatically */\n\tforceMount?: boolean;\n};\n\nfunction DropdownMenuContent({\n\tclassName,\n\tsideOffset = 4,\n\tside = 'bottom',\n\talign = 'start',\n\tonPointerDown: _onPointerDown,\n\tonPointerDownOutside: _onPointerDownOutside,\n\tonCloseAutoFocus: _onCloseAutoFocus,\n\tforceMount: _forceMount,\n\tchildren,\n\t...props\n}: DropdownMenuContentProps) {\n\tconst { zIndexClass } = useFloatingOverlayPortalProps();\n\n\treturn (\n\t\t<DropdownMenuPortal>\n\t\t\t<MenuPrimitive.Positioner side={side} align={align} sideOffset={sideOffset} className={zIndexClass}>\n\t\t\t\t<MenuPrimitive.Popup\n\t\t\t\t\tdata-slot=\"dropdown-menu-content\"\n\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t`bg-popover text-popover-foreground relative origin-(--transform-origin) max-h-(--available-height) min-w-40\n\t\t\t\t\t\tmax-w-(--available-width) overflow-y-auto overscroll-contain rounded-lg border p-1 [overflow-wrap:anywhere]\n\t\t\t\t\t\tshadow-lg transition-[scale,opacity,translate] duration-(--duration-moderate) ease-out data-starting-style:scale-95\n\t\t\t\t\t\tdata-ending-style:scale-95 data-starting-style:opacity-0 data-ending-style:opacity-0\n\t\t\t\t\t\tdata-[side=bottom]:data-starting-style:-translate-y-2\n\t\t\t\t\t\tdata-[side=left]:data-starting-style:translate-x-2\n\t\t\t\t\t\tdata-[side=right]:data-starting-style:-translate-x-2\n\t\t\t\t\t\tdata-[side=top]:data-starting-style:translate-y-2 motion-reduce:transition-none`,\n\t\t\t\t\t\tclassName,\n\t\t\t\t\t)}\n\t\t\t\t\t{...props}\n\t\t\t\t>\n\t\t\t\t\t<FluidHighlight className={MENU_ITEM_RADIUS} />\n\t\t\t\t\t{children}\n\t\t\t\t</MenuPrimitive.Popup>\n\t\t\t</MenuPrimitive.Positioner>\n\t\t</DropdownMenuPortal>\n\t);\n}\n\nfunction DropdownMenuGroup({ ...props }: React.ComponentProps<typeof MenuPrimitive.Group>) {\n\treturn (\n\t\t<DropdownMenuGroupContext.Provider value={true}>\n\t\t\t<MenuPrimitive.Group data-slot=\"dropdown-menu-group\" {...props} />\n\t\t</DropdownMenuGroupContext.Provider>\n\t);\n}\n\ntype DropdownMenuItemProps = React.ComponentProps<typeof MenuPrimitive.Item> & {\n\tinset?: boolean;\n\tvariant?: 'default' | 'destructive';\n\t/** When true, merges props onto the child element instead of rendering a div */\n\tasChild?: boolean;\n};\n\nfunction DropdownMenuItem({\n\tclassName,\n\tinset,\n\tvariant = 'default',\n\tasChild,\n\tchildren,\n\trender,\n\t...props\n}: DropdownMenuItemProps) {\n\tconst childRender = render === undefined && asChild && React.isValidElement(children) ? children : undefined;\n\tconst itemClassName = cn(\n\t\t`data-[highlighted]:text-accent-foreground data-[variant=destructive]:text-destructive\n\t\tdata-[variant=destructive]:data-[highlighted]:bg-destructive/10 dark:data-[variant=destructive]:data-[highlighted]:bg-destructive/40\n\t\tdata-[variant=destructive]:data-[highlighted]:text-destructive\n\t\tdata-[variant=destructive]:*:[svg]:!text-destructive relative flex cursor-default items-center gap-2 pointer-coarse:min-h-11\n\t\trounded-[calc(var(--radius-lg)-5px)] px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none\n\t\tdata-[disabled]:opacity-64 data-[inset]:ps-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,\n\t\tclassName,\n\t);\n\n\treturn (\n\t\t<MenuPrimitive.Item\n\t\t\tdata-slot=\"dropdown-menu-item\"\n\t\t\tdata-inset={inset}\n\t\t\tdata-variant={variant}\n\t\t\tclassName={itemClassName}\n\t\t\trender={render ?? childRender}\n\t\t\t{...props}\n\t\t>\n\t\t\t{childRender ? undefined : children}\n\t\t</MenuPrimitive.Item>\n\t);\n}\n\nfunction DropdownMenuCheckboxItem({\n\tclassName,\n\tchildren,\n\tchecked,\n\t...props\n}: React.ComponentProps<typeof MenuPrimitive.CheckboxItem>) {\n\treturn (\n\t\t<MenuPrimitive.CheckboxItem\n\t\t\tdata-slot=\"dropdown-menu-checkbox-item\"\n\t\t\tclassName={cn(\n\t\t\t\t`data-[highlighted]:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-[calc(var(--radius-lg)-5px)] py-1.5\n\t\t\t\tpe-2 ps-8 text-sm outline-hidden select-none pointer-coarse:min-h-11 data-[disabled]:pointer-events-none data-[disabled]:opacity-64\n\t\t\t\t[&_svg]:pointer-events-none [&_svg]:shrink-0`,\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\tchecked={checked}\n\t\t\t{...props}\n\t\t>\n\t\t\t<span className='pointer-events-none absolute start-2 flex size-3.5 items-center justify-center'>\n\t\t\t\t\t<MenuPrimitive.CheckboxItemIndicator\n\t\t\t\t\t\tkeepMounted\n\t\t\t\t\t\tclassName='transition-[opacity,scale,filter] duration-(--duration-slow) ease-out data-unchecked:scale-[0.25] data-unchecked:opacity-0 data-unchecked:blur-[4px] motion-reduce:transition-none'\n\t\t\t\t\t>\n\t\t\t\t\t<CheckIcon size={16} />\n\t\t\t\t</MenuPrimitive.CheckboxItemIndicator>\n\t\t\t</span>\n\t\t\t{children}\n\t\t</MenuPrimitive.CheckboxItem>\n\t);\n}\n\nfunction DropdownMenuRadioGroup({ ...props }: React.ComponentProps<typeof MenuPrimitive.RadioGroup>) {\n\treturn <MenuPrimitive.RadioGroup data-slot=\"dropdown-menu-radio-group\" {...props} />;\n}\n\nfunction DropdownMenuRadioItem({\n\tclassName,\n\tchildren,\n\t...props\n}: React.ComponentProps<typeof MenuPrimitive.RadioItem>) {\n\treturn (\n\t\t<MenuPrimitive.RadioItem\n\t\t\tdata-slot=\"dropdown-menu-radio-item\"\n\t\t\tclassName={cn(\n\t\t\t\t`data-[highlighted]:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-[calc(var(--radius-lg)-5px)] py-1.5\n\t\t\t\tpe-2 ps-8 text-sm outline-hidden select-none pointer-coarse:min-h-11 data-[disabled]:pointer-events-none data-[disabled]:opacity-64\n\t\t\t\t[&_svg]:pointer-events-none [&_svg]:shrink-0`,\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t>\n\t\t\t<span className='pointer-events-none absolute start-2 flex size-3.5 items-center justify-center'>\n\t\t\t\t\t<MenuPrimitive.RadioItemIndicator\n\t\t\t\t\t\tkeepMounted\n\t\t\t\t\t\tclassName='transition-[opacity,scale,filter] duration-(--duration-slow) ease-out data-unchecked:scale-[0.25] data-unchecked:opacity-0 data-unchecked:blur-[4px] motion-reduce:transition-none'\n\t\t\t\t\t>\n\t\t\t\t\t<CircleIcon className='size-2 fill-current' />\n\t\t\t\t</MenuPrimitive.RadioItemIndicator>\n\t\t\t</span>\n\t\t\t{children}\n\t\t</MenuPrimitive.RadioItem>\n\t);\n}\n\n/**\n * Uses Base UI's semantic GroupLabel inside DropdownMenuGroup. The standalone\n * div fallback preserves compatibility with earlier Constructive menu markup,\n * where labels were allowed directly inside DropdownMenuContent.\n */\nfunction DropdownMenuLabel({\n\tclassName,\n\tinset,\n\t...props\n}: React.ComponentProps<'div'> & {\n\tinset?: boolean;\n}) {\n\tconst isGrouped = React.useContext(DropdownMenuGroupContext);\n\tconst labelProps = {\n\t\t'data-slot': 'dropdown-menu-label',\n\t\t'data-inset': inset,\n\t\tclassName: cn('text-muted-foreground px-2 py-1.5 text-xs font-medium data-[inset]:ps-8', className),\n\t\t...props,\n\t};\n\n\tif (isGrouped) {\n\t\treturn <MenuPrimitive.GroupLabel {...labelProps} />;\n\t}\n\n\treturn (\n\t\t<div {...labelProps} />\n\t);\n}\n\nfunction DropdownMenuSeparator({ className, ...props }: React.ComponentProps<typeof MenuPrimitive.Separator>) {\n\treturn (\n\t\t<MenuPrimitive.Separator\n\t\t\tdata-slot=\"dropdown-menu-separator\"\n\t\t\tclassName={cn('bg-border -mx-1 my-1 h-px', className)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nfunction DropdownMenuShortcut({ className, ...props }: React.ComponentProps<'span'>) {\n\treturn (\n\t\t<kbd\n\t\t\tdata-slot=\"dropdown-menu-shortcut\"\n\t\t\t// Key chords read left to right in every script (\"⌘T\", never \"T⌘\"), and a long chord must not shrink.\n\t\t\tdir=\"ltr\"\n\t\t\tclassName={cn(\n\t\t\t\t`bg-background text-subtle-foreground ms-auto -me-1 inline-flex h-5 max-h-full shrink-0 items-center rounded border\n\t\t\t\tpx-1 font-[inherit] text-[0.625rem] font-medium whitespace-nowrap`,\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nfunction DropdownMenuSub({ ...props }: React.ComponentProps<typeof MenuPrimitive.SubmenuRoot>) {\n\treturn <MenuPrimitive.SubmenuRoot data-slot=\"dropdown-menu-sub\" {...props} />;\n}\n\nfunction DropdownMenuSubTrigger({\n\tclassName,\n\tinset,\n\tchildren,\n\t...props\n}: React.ComponentProps<typeof MenuPrimitive.SubmenuTrigger> & {\n\tinset?: boolean;\n}) {\n\treturn (\n\t\t<MenuPrimitive.SubmenuTrigger\n\t\t\tdata-slot=\"dropdown-menu-sub-trigger\"\n\t\t\tdata-inset={inset}\n\t\t\tclassName={cn(\n\t\t\t\t`data-[highlighted]:text-accent-foreground data-[popup-open]:bg-accent\n\t\t\t\tdata-[popup-open]:text-accent-foreground relative flex cursor-default items-center rounded-[calc(var(--radius-lg)-5px)] px-2 py-1.5 text-sm pointer-coarse:min-h-11\n\t\t\t\toutline-hidden select-none data-[inset]:ps-8`,\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t>\n\t\t\t{children}\n\t\t\t<ChevronRightIcon size={16} className='text-muted-foreground/80 ms-auto rtl:rotate-180' />\n\t\t</MenuPrimitive.SubmenuTrigger>\n\t);\n}\n\nfunction DropdownMenuSubContent({ className, children, ...props }: React.ComponentProps<typeof MenuPrimitive.Popup>) {\n\tconst { container, zIndexClass } = useFloatingOverlayPortalProps();\n\n\treturn (\n\t\t<MenuPrimitive.Portal container={container}>\n\t\t\t<MenuPrimitive.Positioner side='inline-end' sideOffset={-4} className={zIndexClass}>\n\t\t\t\t<MenuPrimitive.Popup\n\t\t\t\t\tdata-slot=\"dropdown-menu-sub-content\"\n\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t`bg-popover text-popover-foreground relative origin-(--transform-origin) max-h-(--available-height) min-w-40\n\t\t\t\t\t\tmax-w-(--available-width) overflow-y-auto overscroll-contain rounded-lg border p-1 [overflow-wrap:anywhere]\n\t\t\t\t\t\tshadow-lg transition-[scale,opacity,translate] duration-(--duration-moderate) ease-out data-starting-style:scale-95\n\t\t\t\t\t\tdata-ending-style:scale-95 data-starting-style:opacity-0 data-ending-style:opacity-0\n\t\t\t\t\t\tdata-[side=bottom]:data-starting-style:-translate-y-2\n\t\t\t\t\t\tdata-[side=left]:data-starting-style:translate-x-2\n\t\t\t\t\t\tdata-[side=right]:data-starting-style:-translate-x-2\n\t\t\t\t\t\tdata-[side=top]:data-starting-style:translate-y-2 motion-reduce:transition-none`,\n\t\t\t\t\t\tclassName,\n\t\t\t\t\t)}\n\t\t\t\t\t{...props}\n\t\t\t\t>\n\t\t\t\t\t<FluidHighlight className={MENU_ITEM_RADIUS} />\n\t\t\t\t\t{children}\n\t\t\t\t</MenuPrimitive.Popup>\n\t\t\t</MenuPrimitive.Positioner>\n\t\t</MenuPrimitive.Portal>\n\t);\n}\n\nexport {\n\tDropdownMenu,\n\tDropdownMenuCheckboxItem,\n\tDropdownMenuContent,\n\tDropdownMenuGroup,\n\tDropdownMenuItem,\n\tDropdownMenuLabel,\n\tDropdownMenuPortal,\n\tDropdownMenuRadioGroup,\n\tDropdownMenuRadioItem,\n\tDropdownMenuSeparator,\n\tDropdownMenuShortcut,\n\tDropdownMenuSub,\n\t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OAAc,YAAf,EAA0B,GAAI,WAAa;CAGnD,OACC,oBAAC,OAAD,EAAK,GAAI,WAAa;AAExB;AAEA,SAAS,sBAAsB,EAAE,WAAW,GAAG,SAA+D;CAC7G,OACC,oBAACA,OAAc,WAAf;EACC,aAAU;EACV,WAAW,GAAG,6BAA6B,SAAS;EACpD,GAAI;CACJ;AAEH;AAEA,SAAS,qBAAqB,EAAE,WAAW,GAAG,SAAuC;CACpF,OACC,oBAAC,OAAD;EACC,aAAU;EAEV,KAAI;EACJ,WAAW,GACV;wEAEA,SACD;EACA,GAAI;CACJ;AAEH;AAEA,SAAS,gBAAgB,EAAE,GAAG,SAAiE;CAC9F,OAAO,oBAACA,OAAc,aAAf;EAA2B,aAAU;EAAoB,GAAI;CAAQ;AAC7E;AAEA,SAAS,uBAAuB,EAC/B,WACA,OACA,UACA,GAAG,SAGD;CACF,OACC,qBAACA,OAAc,gBAAf;EACC,aAAU;EACV,cAAY;EACZ,WAAW,GACV;;mDAGA,SACD;EACA,GAAI;YATL,CAWE,UACD,oBAAC,kBAAD;GAAkB,MAAM;GAAI,WAAU;EAAmD,EAC5D;;AAEhC;AAEA,SAAS,uBAAuB,EAAE,WAAW,UAAU,GAAG,SAA2D;CACpH,MAAM,EAAE,WAAW,gBAAgB,8BAA8B;CAEjE,OACC,oBAACA,OAAc,QAAf;EAAiC;YAChC,oBAACA,OAAc,YAAf;GAA0B,MAAK;GAAa,YAAY;GAAI,WAAW;aACtE,qBAACA,OAAc,OAAf;IACC,aAAU;IACV,WAAW,GACV;;;;;;;wFAQA,SACD;IACA,GAAI;cAbL,CAeC,oBAAC,gBAAD,EAAgB,WAAW,iBAAmB,IAC7C,QACmB;;EACI;CACL;AAExB"}
@@ -25,8 +25,8 @@ const inputGroupAddonVariants = (0, class_variance_authority.cva)("[&_svg]:-mx-0
25
25
  variants: { align: {
26
26
  "block-end": "order-last w-full justify-start px-[calc(--spacing(3)-1px)] pb-[calc(--spacing(3)-1px)] [.border-t]:pt-[calc(--spacing(3)-1px)] [[data-size=sm]+&]:px-[calc(--spacing(2.5)-1px)]",
27
27
  "block-start": "order-first w-full justify-start px-[calc(--spacing(3)-1px)] pt-[calc(--spacing(3)-1px)] [.border-b]:pb-[calc(--spacing(3)-1px)] [[data-size=sm]+&]:px-[calc(--spacing(2.5)-1px)]",
28
- "inline-end": "overflow-x-clip has-[>:last-child[data-slot=badge]]:-me-1.5 has-[>button]:-me-2 order-last pe-[calc(--spacing(3)-1px)] has-[>kbd:last-child]:me-[-0.35rem] [[data-size=sm]+&]:pe-[calc(--spacing(2.5)-1px)]",
29
- "inline-start": "overflow-x-clip has-[>:last-child[data-slot=badge]]:-ms-1.5 has-[>button]:-ms-2 order-first ps-[calc(--spacing(3)-1px)] has-[>kbd:last-child]:ms-[-0.35rem] [[data-size=sm]+&]:ps-[calc(--spacing(2.5)-1px)]"
28
+ "inline-end": "overflow-x-clip ps-0.5 -ms-0.5 has-[>:last-child[data-slot=badge]]:-me-1.5 has-[>button]:-me-2 order-last pe-[calc(--spacing(3)-1px)] has-[>kbd:last-child]:me-[-0.35rem] [[data-size=sm]+&]:pe-[calc(--spacing(2.5)-1px)]",
29
+ "inline-start": "overflow-x-clip pe-0.5 -me-0.5 has-[>:last-child[data-slot=badge]]:-ms-1.5 has-[>button]:-ms-2 order-first ps-[calc(--spacing(3)-1px)] has-[>kbd:last-child]:ms-[-0.35rem] [[data-size=sm]+&]:ps-[calc(--spacing(2.5)-1px)]"
30
30
  } }
31
31
  });
32
32
  function InputGroupAddon({ className, align = "inline-start", ...props }) {
@@ -1 +1 @@
1
- {"version":3,"file":"input-group.cjs","names":["cn","truncateTextRuns","Input","Textarea"],"sources":["../../src/components/input-group.tsx"],"sourcesContent":["\"use client\";\n\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport * as React from \"react\";\n\nimport { truncateTextRuns } from \"../lib/text-runs\";\nimport { cn } from \"../lib/utils\";\nimport { Input, type InputProps } from \"./input\";\nimport { Textarea, type TextareaProps } from \"./textarea\";\n\nfunction InputGroup({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n className={cn(\n // Match aria-invalid=\"true\" only. aria-invalid=\"false\" must not paint as invalid.\n \"relative inline-flex w-full min-w-0 items-center overflow-x-clip rounded-md border border-input bg-background bg-clip-padding text-base transition-shadow before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-md)-1px)] not-has-[input:disabled,textarea:disabled]:not-has-[input:focus-visible,textarea:focus-visible]:not-has-[input[aria-invalid=true],textarea[aria-invalid=true]]:before:shadow-[0_1px_--theme(--color-black/4%)] has-[input:focus-visible,textarea:focus-visible]:has-[input[aria-invalid=true],textarea[aria-invalid=true]]:border-destructive/64 has-[input:focus-visible,textarea:focus-visible]:has-[input[aria-invalid=true],textarea[aria-invalid=true]]:ring-destructive/16 has-[textarea]:h-auto has-data-[align=block-end]:h-auto has-data-[align=block-start]:h-auto has-data-[align=block-end]:flex-col has-data-[align=block-start]:flex-col has-[input:focus-visible,textarea:focus-visible]:border-ring/60 has-[input[aria-invalid=true],textarea[aria-invalid=true]]:border-destructive/36 has-[input:disabled,textarea:disabled]:opacity-64 has-[input:disabled,textarea:disabled,input:focus-visible,textarea:focus-visible,input[aria-invalid=true],textarea[aria-invalid=true]]:shadow-none has-[input:focus-visible,textarea:focus-visible]:ring-[3px] has-[input:focus-visible,textarea:focus-visible]:ring-ring/35 sm:text-sm dark:bg-input/32 dark:bg-clip-border dark:has-[input[aria-invalid=true],textarea[aria-invalid=true]]:ring-destructive/24 dark:not-has-[input:disabled,textarea:disabled]:not-has-[input:focus-visible,textarea:focus-visible]:not-has-[input[aria-invalid=true],textarea[aria-invalid=true]]:before:shadow-[0_-1px_--theme(--color-white/8%)] has-data-[align=inline-start]:**:[[data-size=sm]_input]:ps-1.5 has-data-[align=inline-end]:**:[[data-size=sm]_input]:pe-1.5 *:[[data-slot=input-control],[data-slot=textarea-control]]:contents *:[[data-slot=input-control],[data-slot=textarea-control]]:before:hidden has-[[data-align=block-start],[data-align=block-end]]:**:[input]:h-auto has-data-[align=inline-start]:**:[input]:ps-2 has-data-[align=inline-end]:**:[input]:pe-2 has-data-[align=block-end]:**:[input]:pt-1.5 has-data-[align=block-start]:**:[input]:pb-1.5 **:data-[slot=input]:min-w-[max(8ch,35%)] **:data-[slot=input]:flex-1 **:[textarea]:min-h-20.5 **:[textarea]:resize-none **:[textarea]:py-[calc(--spacing(3)-1px)] **:[textarea]:max-sm:min-h-23.5 **:[textarea_button]:rounded-[calc(var(--radius-md)-2px)]\",\n className,\n )}\n data-slot=\"input-group\"\n role=\"group\"\n {...props}\n />\n );\n}\n\nconst inputGroupAddonVariants = cva(\n \"[&_svg]:-mx-0.5 flex h-auto min-w-0 shrink-0 cursor-text select-none items-center justify-center gap-2 has-[[data-slot=input-group-text]]:shrink [&_svg]:shrink-0 [&>kbd]:rounded-[calc(var(--radius)-5px)] in-[[data-slot=input-group]:has([data-slot=input-control],[data-slot=textarea-control])]:[&_svg:not([class*='size-'])]:size-4.5 sm:in-[[data-slot=input-group]:has([data-slot=input-control],[data-slot=textarea-control])]:[&_svg:not([class*='size-'])]:size-4 not-has-[button]:**:[svg:not([class*='opacity-'])]:opacity-80\",\n {\n defaultVariants: {\n align: \"inline-start\",\n },\n variants: {\n align: {\n \"block-end\":\n \"order-last w-full justify-start px-[calc(--spacing(3)-1px)] pb-[calc(--spacing(3)-1px)] [.border-t]:pt-[calc(--spacing(3)-1px)] [[data-size=sm]+&]:px-[calc(--spacing(2.5)-1px)]\",\n \"block-start\":\n \"order-first w-full justify-start px-[calc(--spacing(3)-1px)] pt-[calc(--spacing(3)-1px)] [.border-b]:pb-[calc(--spacing(3)-1px)] [[data-size=sm]+&]:px-[calc(--spacing(2.5)-1px)]\",\n \"inline-end\":\n \"overflow-x-clip has-[>:last-child[data-slot=badge]]:-me-1.5 has-[>button]:-me-2 order-last pe-[calc(--spacing(3)-1px)] has-[>kbd:last-child]:me-[-0.35rem] [[data-size=sm]+&]:pe-[calc(--spacing(2.5)-1px)]\",\n \"inline-start\":\n \"overflow-x-clip has-[>:last-child[data-slot=badge]]:-ms-1.5 has-[>button]:-ms-2 order-first ps-[calc(--spacing(3)-1px)] has-[>kbd:last-child]:ms-[-0.35rem] [[data-size=sm]+&]:ps-[calc(--spacing(2.5)-1px)]\",\n },\n },\n },\n);\n\nfunction InputGroupAddon({\n className,\n align = \"inline-start\",\n ...props\n}: React.ComponentProps<\"div\"> & VariantProps<typeof inputGroupAddonVariants>) {\n return (\n <div\n className={cn(inputGroupAddonVariants({ align }), className)}\n data-align={align}\n data-slot=\"input-group-addon\"\n onMouseDown={(e) => {\n const target = e.target as HTMLElement;\n const isInteractive = target.closest(\"button, a\");\n if (isInteractive) return;\n e.preventDefault();\n const parent = e.currentTarget.parentElement;\n const input = parent?.querySelector<\n HTMLInputElement | HTMLTextAreaElement\n >(\"input, textarea\");\n if (input && !parent?.querySelector(\"input:focus, textarea:focus\")) {\n input.focus();\n }\n }}\n {...props}\n />\n );\n}\n\nfunction InputGroupText({ className, children, ...props }: React.ComponentProps<\"span\">) {\n return (\n <span\n data-slot=\"input-group-text\"\n className={cn(\n \"[&_svg]:-mx-0.5 flex min-w-0 items-center gap-2 text-subtle-foreground [&_svg]:shrink-0 in-[[data-slot=input-group]:has([data-slot=input-control],[data-slot=textarea-control])]:[&_svg:not([class*='size-'])]:size-4.5 sm:in-[[data-slot=input-group]:has([data-slot=input-control],[data-slot=textarea-control])]:[&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none\",\n className,\n )}\n {...props}\n >\n {truncateTextRuns(children).nodes}\n </span>\n );\n}\n\nfunction InputGroupInput({ className, ...props }: InputProps) {\n return <Input className={className} unstyled {...props} />;\n}\n\nfunction InputGroupTextarea({ className, ...props }: TextareaProps) {\n return <Textarea className={className} unstyled {...props} />;\n}\n\nexport {\n InputGroup,\n InputGroupAddon,\n InputGroupText,\n InputGroupInput,\n InputGroupTextarea,\n};\n"],"mappings":";;;;;;;;;;;;;;AAUA,SAAS,WAAW,EAAE,WAAW,GAAG,SAAsC;CACxE,OACE,2CAAC,OAAD;EACE,WAAWA,iBAET,u6EACA,SACF;EACA,aAAU;EACV,MAAK;EACL,GAAI;CACL;AAEL;AAEA,MAAM,4DACJ,8gBACA;CACE,iBAAiB,EACf,OAAO,eACT;CACA,UAAU,EACR,OAAO;EACL,aACE;EACF,eACE;EACF,cACE;EACF,gBACE;CACJ,EACF;AACF,CACF;AAEA,SAAS,gBAAgB,EACvB,WACA,QAAQ,gBACR,GAAG,SAC0E;CAC7E,OACE,2CAAC,OAAD;EACE,WAAWA,iBAAG,wBAAwB,EAAE,MAAM,CAAC,GAAG,SAAS;EAC3D,cAAY;EACZ,aAAU;EACV,cAAc,MAAM;GAGlB,IAFe,EAAE,OACY,QAAQ,WACrB,GAAG;GACnB,EAAE,eAAe;GACjB,MAAM,SAAS,EAAE,cAAc;GAC/B,MAAM,QAAQ,QAAQ,cAEpB,iBAAiB;GACnB,IAAI,SAAS,CAAC,QAAQ,cAAc,6BAA6B,GAC/D,MAAM,MAAM;EAEhB;EACA,GAAI;CACL;AAEL;AAEA,SAAS,eAAe,EAAE,WAAW,UAAU,GAAG,SAAuC;CACvF,OACE,2CAAC,QAAD;EACE,aAAU;EACV,WAAWA,iBACT,wXACA,SACF;EACA,GAAI;YAEHC,mCAAiB,QAAQ,CAAC,CAAC;CACxB;AAEV;AAEA,SAAS,gBAAgB,EAAE,WAAW,GAAG,SAAqB;CAC5D,OAAO,2CAACC,gCAAD;EAAkB;EAAW;EAAS,GAAI;CAAQ;AAC3D;AAEA,SAAS,mBAAmB,EAAE,WAAW,GAAG,SAAwB;CAClE,OAAO,2CAACC,sCAAD;EAAqB;EAAW;EAAS,GAAI;CAAQ;AAC9D"}
1
+ {"version":3,"file":"input-group.cjs","names":["cn","truncateTextRuns","Input","Textarea"],"sources":["../../src/components/input-group.tsx"],"sourcesContent":["\"use client\";\n\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport * as React from \"react\";\n\nimport { truncateTextRuns } from \"../lib/text-runs\";\nimport { cn } from \"../lib/utils\";\nimport { Input, type InputProps } from \"./input\";\nimport { Textarea, type TextareaProps } from \"./textarea\";\n\nfunction InputGroup({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n className={cn(\n // Match aria-invalid=\"true\" only. aria-invalid=\"false\" must not paint as invalid.\n \"relative inline-flex w-full min-w-0 items-center overflow-x-clip rounded-md border border-input bg-background bg-clip-padding text-base transition-shadow before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-md)-1px)] not-has-[input:disabled,textarea:disabled]:not-has-[input:focus-visible,textarea:focus-visible]:not-has-[input[aria-invalid=true],textarea[aria-invalid=true]]:before:shadow-[0_1px_--theme(--color-black/4%)] has-[input:focus-visible,textarea:focus-visible]:has-[input[aria-invalid=true],textarea[aria-invalid=true]]:border-destructive/64 has-[input:focus-visible,textarea:focus-visible]:has-[input[aria-invalid=true],textarea[aria-invalid=true]]:ring-destructive/16 has-[textarea]:h-auto has-data-[align=block-end]:h-auto has-data-[align=block-start]:h-auto has-data-[align=block-end]:flex-col has-data-[align=block-start]:flex-col has-[input:focus-visible,textarea:focus-visible]:border-ring/60 has-[input[aria-invalid=true],textarea[aria-invalid=true]]:border-destructive/36 has-[input:disabled,textarea:disabled]:opacity-64 has-[input:disabled,textarea:disabled,input:focus-visible,textarea:focus-visible,input[aria-invalid=true],textarea[aria-invalid=true]]:shadow-none has-[input:focus-visible,textarea:focus-visible]:ring-[3px] has-[input:focus-visible,textarea:focus-visible]:ring-ring/35 sm:text-sm dark:bg-input/32 dark:bg-clip-border dark:has-[input[aria-invalid=true],textarea[aria-invalid=true]]:ring-destructive/24 dark:not-has-[input:disabled,textarea:disabled]:not-has-[input:focus-visible,textarea:focus-visible]:not-has-[input[aria-invalid=true],textarea[aria-invalid=true]]:before:shadow-[0_-1px_--theme(--color-white/8%)] has-data-[align=inline-start]:**:[[data-size=sm]_input]:ps-1.5 has-data-[align=inline-end]:**:[[data-size=sm]_input]:pe-1.5 *:[[data-slot=input-control],[data-slot=textarea-control]]:contents *:[[data-slot=input-control],[data-slot=textarea-control]]:before:hidden has-[[data-align=block-start],[data-align=block-end]]:**:[input]:h-auto has-data-[align=inline-start]:**:[input]:ps-2 has-data-[align=inline-end]:**:[input]:pe-2 has-data-[align=block-end]:**:[input]:pt-1.5 has-data-[align=block-start]:**:[input]:pb-1.5 **:data-[slot=input]:min-w-[max(8ch,35%)] **:data-[slot=input]:flex-1 **:[textarea]:min-h-20.5 **:[textarea]:resize-none **:[textarea]:py-[calc(--spacing(3)-1px)] **:[textarea]:max-sm:min-h-23.5 **:[textarea_button]:rounded-[calc(var(--radius-md)-2px)]\",\n className,\n )}\n data-slot=\"input-group\"\n role=\"group\"\n {...props}\n />\n );\n}\n\nconst inputGroupAddonVariants = cva(\n \"[&_svg]:-mx-0.5 flex h-auto min-w-0 shrink-0 cursor-text select-none items-center justify-center gap-2 has-[[data-slot=input-group-text]]:shrink [&_svg]:shrink-0 [&>kbd]:rounded-[calc(var(--radius)-5px)] in-[[data-slot=input-group]:has([data-slot=input-control],[data-slot=textarea-control])]:[&_svg:not([class*='size-'])]:size-4.5 sm:in-[[data-slot=input-group]:has([data-slot=input-control],[data-slot=textarea-control])]:[&_svg:not([class*='size-'])]:size-4 not-has-[button]:**:[svg:not([class*='opacity-'])]:opacity-80\",\n {\n defaultVariants: {\n align: \"inline-start\",\n },\n variants: {\n align: {\n \"block-end\":\n \"order-last w-full justify-start px-[calc(--spacing(3)-1px)] pb-[calc(--spacing(3)-1px)] [.border-t]:pt-[calc(--spacing(3)-1px)] [[data-size=sm]+&]:px-[calc(--spacing(2.5)-1px)]\",\n \"block-start\":\n \"order-first w-full justify-start px-[calc(--spacing(3)-1px)] pt-[calc(--spacing(3)-1px)] [.border-b]:pb-[calc(--spacing(3)-1px)] [[data-size=sm]+&]:px-[calc(--spacing(2.5)-1px)]\",\n // `[&_svg]:-mx-0.5` lets an icon hang 2px past the addon's content box, and\n // `overflow-x-clip` cuts at the padding box, so the inner side gets 2px of\n // padding for the icon and a matching negative margin that keeps the input\n // where it was.\n \"inline-end\":\n \"overflow-x-clip ps-0.5 -ms-0.5 has-[>:last-child[data-slot=badge]]:-me-1.5 has-[>button]:-me-2 order-last pe-[calc(--spacing(3)-1px)] has-[>kbd:last-child]:me-[-0.35rem] [[data-size=sm]+&]:pe-[calc(--spacing(2.5)-1px)]\",\n \"inline-start\":\n \"overflow-x-clip pe-0.5 -me-0.5 has-[>:last-child[data-slot=badge]]:-ms-1.5 has-[>button]:-ms-2 order-first ps-[calc(--spacing(3)-1px)] has-[>kbd:last-child]:ms-[-0.35rem] [[data-size=sm]+&]:ps-[calc(--spacing(2.5)-1px)]\",\n },\n },\n },\n);\n\nfunction InputGroupAddon({\n className,\n align = \"inline-start\",\n ...props\n}: React.ComponentProps<\"div\"> & VariantProps<typeof inputGroupAddonVariants>) {\n return (\n <div\n className={cn(inputGroupAddonVariants({ align }), className)}\n data-align={align}\n data-slot=\"input-group-addon\"\n onMouseDown={(e) => {\n const target = e.target as HTMLElement;\n const isInteractive = target.closest(\"button, a\");\n if (isInteractive) return;\n e.preventDefault();\n const parent = e.currentTarget.parentElement;\n const input = parent?.querySelector<\n HTMLInputElement | HTMLTextAreaElement\n >(\"input, textarea\");\n if (input && !parent?.querySelector(\"input:focus, textarea:focus\")) {\n input.focus();\n }\n }}\n {...props}\n />\n );\n}\n\nfunction InputGroupText({ className, children, ...props }: React.ComponentProps<\"span\">) {\n return (\n <span\n data-slot=\"input-group-text\"\n className={cn(\n \"[&_svg]:-mx-0.5 flex min-w-0 items-center gap-2 text-subtle-foreground [&_svg]:shrink-0 in-[[data-slot=input-group]:has([data-slot=input-control],[data-slot=textarea-control])]:[&_svg:not([class*='size-'])]:size-4.5 sm:in-[[data-slot=input-group]:has([data-slot=input-control],[data-slot=textarea-control])]:[&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none\",\n className,\n )}\n {...props}\n >\n {truncateTextRuns(children).nodes}\n </span>\n );\n}\n\nfunction InputGroupInput({ className, ...props }: InputProps) {\n return <Input className={className} unstyled {...props} />;\n}\n\nfunction InputGroupTextarea({ className, ...props }: TextareaProps) {\n return <Textarea className={className} unstyled {...props} />;\n}\n\nexport {\n InputGroup,\n InputGroupAddon,\n InputGroupText,\n InputGroupInput,\n InputGroupTextarea,\n};\n"],"mappings":";;;;;;;;;;;;;;AAUA,SAAS,WAAW,EAAE,WAAW,GAAG,SAAsC;CACxE,OACE,2CAAC,OAAD;EACE,WAAWA,iBAET,u6EACA,SACF;EACA,aAAU;EACV,MAAK;EACL,GAAI;CACL;AAEL;AAEA,MAAM,4DACJ,8gBACA;CACE,iBAAiB,EACf,OAAO,eACT;CACA,UAAU,EACR,OAAO;EACL,aACE;EACF,eACE;EAKF,cACE;EACF,gBACE;CACJ,EACF;AACF,CACF;AAEA,SAAS,gBAAgB,EACvB,WACA,QAAQ,gBACR,GAAG,SAC0E;CAC7E,OACE,2CAAC,OAAD;EACE,WAAWA,iBAAG,wBAAwB,EAAE,MAAM,CAAC,GAAG,SAAS;EAC3D,cAAY;EACZ,aAAU;EACV,cAAc,MAAM;GAGlB,IAFe,EAAE,OACY,QAAQ,WACrB,GAAG;GACnB,EAAE,eAAe;GACjB,MAAM,SAAS,EAAE,cAAc;GAC/B,MAAM,QAAQ,QAAQ,cAEpB,iBAAiB;GACnB,IAAI,SAAS,CAAC,QAAQ,cAAc,6BAA6B,GAC/D,MAAM,MAAM;EAEhB;EACA,GAAI;CACL;AAEL;AAEA,SAAS,eAAe,EAAE,WAAW,UAAU,GAAG,SAAuC;CACvF,OACE,2CAAC,QAAD;EACE,aAAU;EACV,WAAWA,iBACT,wXACA,SACF;EACA,GAAI;YAEHC,mCAAiB,QAAQ,CAAC,CAAC;CACxB;AAEV;AAEA,SAAS,gBAAgB,EAAE,WAAW,GAAG,SAAqB;CAC5D,OAAO,2CAACC,gCAAD;EAAkB;EAAW;EAAS,GAAI;CAAQ;AAC3D;AAEA,SAAS,mBAAmB,EAAE,WAAW,GAAG,SAAwB;CAClE,OAAO,2CAACC,sCAAD;EAAqB;EAAW;EAAS,GAAI;CAAQ;AAC9D"}
@@ -22,8 +22,8 @@ const inputGroupAddonVariants = cva("[&_svg]:-mx-0.5 flex h-auto min-w-0 shrink-
22
22
  variants: { align: {
23
23
  "block-end": "order-last w-full justify-start px-[calc(--spacing(3)-1px)] pb-[calc(--spacing(3)-1px)] [.border-t]:pt-[calc(--spacing(3)-1px)] [[data-size=sm]+&]:px-[calc(--spacing(2.5)-1px)]",
24
24
  "block-start": "order-first w-full justify-start px-[calc(--spacing(3)-1px)] pt-[calc(--spacing(3)-1px)] [.border-b]:pb-[calc(--spacing(3)-1px)] [[data-size=sm]+&]:px-[calc(--spacing(2.5)-1px)]",
25
- "inline-end": "overflow-x-clip has-[>:last-child[data-slot=badge]]:-me-1.5 has-[>button]:-me-2 order-last pe-[calc(--spacing(3)-1px)] has-[>kbd:last-child]:me-[-0.35rem] [[data-size=sm]+&]:pe-[calc(--spacing(2.5)-1px)]",
26
- "inline-start": "overflow-x-clip has-[>:last-child[data-slot=badge]]:-ms-1.5 has-[>button]:-ms-2 order-first ps-[calc(--spacing(3)-1px)] has-[>kbd:last-child]:ms-[-0.35rem] [[data-size=sm]+&]:ps-[calc(--spacing(2.5)-1px)]"
25
+ "inline-end": "overflow-x-clip ps-0.5 -ms-0.5 has-[>:last-child[data-slot=badge]]:-me-1.5 has-[>button]:-me-2 order-last pe-[calc(--spacing(3)-1px)] has-[>kbd:last-child]:me-[-0.35rem] [[data-size=sm]+&]:pe-[calc(--spacing(2.5)-1px)]",
26
+ "inline-start": "overflow-x-clip pe-0.5 -me-0.5 has-[>:last-child[data-slot=badge]]:-ms-1.5 has-[>button]:-ms-2 order-first ps-[calc(--spacing(3)-1px)] has-[>kbd:last-child]:ms-[-0.35rem] [[data-size=sm]+&]:ps-[calc(--spacing(2.5)-1px)]"
27
27
  } }
28
28
  });
29
29
  function InputGroupAddon({ className, align = "inline-start", ...props }) {
@@ -1 +1 @@
1
- {"version":3,"file":"input-group.js","names":[],"sources":["../../src/components/input-group.tsx"],"sourcesContent":["\"use client\";\n\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport * as React from \"react\";\n\nimport { truncateTextRuns } from \"../lib/text-runs\";\nimport { cn } from \"../lib/utils\";\nimport { Input, type InputProps } from \"./input\";\nimport { Textarea, type TextareaProps } from \"./textarea\";\n\nfunction InputGroup({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n className={cn(\n // Match aria-invalid=\"true\" only. aria-invalid=\"false\" must not paint as invalid.\n \"relative inline-flex w-full min-w-0 items-center overflow-x-clip rounded-md border border-input bg-background bg-clip-padding text-base transition-shadow before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-md)-1px)] not-has-[input:disabled,textarea:disabled]:not-has-[input:focus-visible,textarea:focus-visible]:not-has-[input[aria-invalid=true],textarea[aria-invalid=true]]:before:shadow-[0_1px_--theme(--color-black/4%)] has-[input:focus-visible,textarea:focus-visible]:has-[input[aria-invalid=true],textarea[aria-invalid=true]]:border-destructive/64 has-[input:focus-visible,textarea:focus-visible]:has-[input[aria-invalid=true],textarea[aria-invalid=true]]:ring-destructive/16 has-[textarea]:h-auto has-data-[align=block-end]:h-auto has-data-[align=block-start]:h-auto has-data-[align=block-end]:flex-col has-data-[align=block-start]:flex-col has-[input:focus-visible,textarea:focus-visible]:border-ring/60 has-[input[aria-invalid=true],textarea[aria-invalid=true]]:border-destructive/36 has-[input:disabled,textarea:disabled]:opacity-64 has-[input:disabled,textarea:disabled,input:focus-visible,textarea:focus-visible,input[aria-invalid=true],textarea[aria-invalid=true]]:shadow-none has-[input:focus-visible,textarea:focus-visible]:ring-[3px] has-[input:focus-visible,textarea:focus-visible]:ring-ring/35 sm:text-sm dark:bg-input/32 dark:bg-clip-border dark:has-[input[aria-invalid=true],textarea[aria-invalid=true]]:ring-destructive/24 dark:not-has-[input:disabled,textarea:disabled]:not-has-[input:focus-visible,textarea:focus-visible]:not-has-[input[aria-invalid=true],textarea[aria-invalid=true]]:before:shadow-[0_-1px_--theme(--color-white/8%)] has-data-[align=inline-start]:**:[[data-size=sm]_input]:ps-1.5 has-data-[align=inline-end]:**:[[data-size=sm]_input]:pe-1.5 *:[[data-slot=input-control],[data-slot=textarea-control]]:contents *:[[data-slot=input-control],[data-slot=textarea-control]]:before:hidden has-[[data-align=block-start],[data-align=block-end]]:**:[input]:h-auto has-data-[align=inline-start]:**:[input]:ps-2 has-data-[align=inline-end]:**:[input]:pe-2 has-data-[align=block-end]:**:[input]:pt-1.5 has-data-[align=block-start]:**:[input]:pb-1.5 **:data-[slot=input]:min-w-[max(8ch,35%)] **:data-[slot=input]:flex-1 **:[textarea]:min-h-20.5 **:[textarea]:resize-none **:[textarea]:py-[calc(--spacing(3)-1px)] **:[textarea]:max-sm:min-h-23.5 **:[textarea_button]:rounded-[calc(var(--radius-md)-2px)]\",\n className,\n )}\n data-slot=\"input-group\"\n role=\"group\"\n {...props}\n />\n );\n}\n\nconst inputGroupAddonVariants = cva(\n \"[&_svg]:-mx-0.5 flex h-auto min-w-0 shrink-0 cursor-text select-none items-center justify-center gap-2 has-[[data-slot=input-group-text]]:shrink [&_svg]:shrink-0 [&>kbd]:rounded-[calc(var(--radius)-5px)] in-[[data-slot=input-group]:has([data-slot=input-control],[data-slot=textarea-control])]:[&_svg:not([class*='size-'])]:size-4.5 sm:in-[[data-slot=input-group]:has([data-slot=input-control],[data-slot=textarea-control])]:[&_svg:not([class*='size-'])]:size-4 not-has-[button]:**:[svg:not([class*='opacity-'])]:opacity-80\",\n {\n defaultVariants: {\n align: \"inline-start\",\n },\n variants: {\n align: {\n \"block-end\":\n \"order-last w-full justify-start px-[calc(--spacing(3)-1px)] pb-[calc(--spacing(3)-1px)] [.border-t]:pt-[calc(--spacing(3)-1px)] [[data-size=sm]+&]:px-[calc(--spacing(2.5)-1px)]\",\n \"block-start\":\n \"order-first w-full justify-start px-[calc(--spacing(3)-1px)] pt-[calc(--spacing(3)-1px)] [.border-b]:pb-[calc(--spacing(3)-1px)] [[data-size=sm]+&]:px-[calc(--spacing(2.5)-1px)]\",\n \"inline-end\":\n \"overflow-x-clip has-[>:last-child[data-slot=badge]]:-me-1.5 has-[>button]:-me-2 order-last pe-[calc(--spacing(3)-1px)] has-[>kbd:last-child]:me-[-0.35rem] [[data-size=sm]+&]:pe-[calc(--spacing(2.5)-1px)]\",\n \"inline-start\":\n \"overflow-x-clip has-[>:last-child[data-slot=badge]]:-ms-1.5 has-[>button]:-ms-2 order-first ps-[calc(--spacing(3)-1px)] has-[>kbd:last-child]:ms-[-0.35rem] [[data-size=sm]+&]:ps-[calc(--spacing(2.5)-1px)]\",\n },\n },\n },\n);\n\nfunction InputGroupAddon({\n className,\n align = \"inline-start\",\n ...props\n}: React.ComponentProps<\"div\"> & VariantProps<typeof inputGroupAddonVariants>) {\n return (\n <div\n className={cn(inputGroupAddonVariants({ align }), className)}\n data-align={align}\n data-slot=\"input-group-addon\"\n onMouseDown={(e) => {\n const target = e.target as HTMLElement;\n const isInteractive = target.closest(\"button, a\");\n if (isInteractive) return;\n e.preventDefault();\n const parent = e.currentTarget.parentElement;\n const input = parent?.querySelector<\n HTMLInputElement | HTMLTextAreaElement\n >(\"input, textarea\");\n if (input && !parent?.querySelector(\"input:focus, textarea:focus\")) {\n input.focus();\n }\n }}\n {...props}\n />\n );\n}\n\nfunction InputGroupText({ className, children, ...props }: React.ComponentProps<\"span\">) {\n return (\n <span\n data-slot=\"input-group-text\"\n className={cn(\n \"[&_svg]:-mx-0.5 flex min-w-0 items-center gap-2 text-subtle-foreground [&_svg]:shrink-0 in-[[data-slot=input-group]:has([data-slot=input-control],[data-slot=textarea-control])]:[&_svg:not([class*='size-'])]:size-4.5 sm:in-[[data-slot=input-group]:has([data-slot=input-control],[data-slot=textarea-control])]:[&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none\",\n className,\n )}\n {...props}\n >\n {truncateTextRuns(children).nodes}\n </span>\n );\n}\n\nfunction InputGroupInput({ className, ...props }: InputProps) {\n return <Input className={className} unstyled {...props} />;\n}\n\nfunction InputGroupTextarea({ className, ...props }: TextareaProps) {\n return <Textarea className={className} unstyled {...props} />;\n}\n\nexport {\n InputGroup,\n InputGroupAddon,\n InputGroupText,\n InputGroupInput,\n InputGroupTextarea,\n};\n"],"mappings":";;;;;;;;;;;AAUA,SAAS,WAAW,EAAE,WAAW,GAAG,SAAsC;CACxE,OACE,oBAAC,OAAD;EACE,WAAW,GAET,u6EACA,SACF;EACA,aAAU;EACV,MAAK;EACL,GAAI;CACL;AAEL;AAEA,MAAM,0BAA0B,IAC9B,8gBACA;CACE,iBAAiB,EACf,OAAO,eACT;CACA,UAAU,EACR,OAAO;EACL,aACE;EACF,eACE;EACF,cACE;EACF,gBACE;CACJ,EACF;AACF,CACF;AAEA,SAAS,gBAAgB,EACvB,WACA,QAAQ,gBACR,GAAG,SAC0E;CAC7E,OACE,oBAAC,OAAD;EACE,WAAW,GAAG,wBAAwB,EAAE,MAAM,CAAC,GAAG,SAAS;EAC3D,cAAY;EACZ,aAAU;EACV,cAAc,MAAM;GAGlB,IAFe,EAAE,OACY,QAAQ,WACrB,GAAG;GACnB,EAAE,eAAe;GACjB,MAAM,SAAS,EAAE,cAAc;GAC/B,MAAM,QAAQ,QAAQ,cAEpB,iBAAiB;GACnB,IAAI,SAAS,CAAC,QAAQ,cAAc,6BAA6B,GAC/D,MAAM,MAAM;EAEhB;EACA,GAAI;CACL;AAEL;AAEA,SAAS,eAAe,EAAE,WAAW,UAAU,GAAG,SAAuC;CACvF,OACE,oBAAC,QAAD;EACE,aAAU;EACV,WAAW,GACT,wXACA,SACF;EACA,GAAI;YAEH,iBAAiB,QAAQ,CAAC,CAAC;CACxB;AAEV;AAEA,SAAS,gBAAgB,EAAE,WAAW,GAAG,SAAqB;CAC5D,OAAO,oBAAC,OAAD;EAAkB;EAAW;EAAS,GAAI;CAAQ;AAC3D;AAEA,SAAS,mBAAmB,EAAE,WAAW,GAAG,SAAwB;CAClE,OAAO,oBAAC,UAAD;EAAqB;EAAW;EAAS,GAAI;CAAQ;AAC9D"}
1
+ {"version":3,"file":"input-group.js","names":[],"sources":["../../src/components/input-group.tsx"],"sourcesContent":["\"use client\";\n\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport * as React from \"react\";\n\nimport { truncateTextRuns } from \"../lib/text-runs\";\nimport { cn } from \"../lib/utils\";\nimport { Input, type InputProps } from \"./input\";\nimport { Textarea, type TextareaProps } from \"./textarea\";\n\nfunction InputGroup({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n className={cn(\n // Match aria-invalid=\"true\" only. aria-invalid=\"false\" must not paint as invalid.\n \"relative inline-flex w-full min-w-0 items-center overflow-x-clip rounded-md border border-input bg-background bg-clip-padding text-base transition-shadow before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-md)-1px)] not-has-[input:disabled,textarea:disabled]:not-has-[input:focus-visible,textarea:focus-visible]:not-has-[input[aria-invalid=true],textarea[aria-invalid=true]]:before:shadow-[0_1px_--theme(--color-black/4%)] has-[input:focus-visible,textarea:focus-visible]:has-[input[aria-invalid=true],textarea[aria-invalid=true]]:border-destructive/64 has-[input:focus-visible,textarea:focus-visible]:has-[input[aria-invalid=true],textarea[aria-invalid=true]]:ring-destructive/16 has-[textarea]:h-auto has-data-[align=block-end]:h-auto has-data-[align=block-start]:h-auto has-data-[align=block-end]:flex-col has-data-[align=block-start]:flex-col has-[input:focus-visible,textarea:focus-visible]:border-ring/60 has-[input[aria-invalid=true],textarea[aria-invalid=true]]:border-destructive/36 has-[input:disabled,textarea:disabled]:opacity-64 has-[input:disabled,textarea:disabled,input:focus-visible,textarea:focus-visible,input[aria-invalid=true],textarea[aria-invalid=true]]:shadow-none has-[input:focus-visible,textarea:focus-visible]:ring-[3px] has-[input:focus-visible,textarea:focus-visible]:ring-ring/35 sm:text-sm dark:bg-input/32 dark:bg-clip-border dark:has-[input[aria-invalid=true],textarea[aria-invalid=true]]:ring-destructive/24 dark:not-has-[input:disabled,textarea:disabled]:not-has-[input:focus-visible,textarea:focus-visible]:not-has-[input[aria-invalid=true],textarea[aria-invalid=true]]:before:shadow-[0_-1px_--theme(--color-white/8%)] has-data-[align=inline-start]:**:[[data-size=sm]_input]:ps-1.5 has-data-[align=inline-end]:**:[[data-size=sm]_input]:pe-1.5 *:[[data-slot=input-control],[data-slot=textarea-control]]:contents *:[[data-slot=input-control],[data-slot=textarea-control]]:before:hidden has-[[data-align=block-start],[data-align=block-end]]:**:[input]:h-auto has-data-[align=inline-start]:**:[input]:ps-2 has-data-[align=inline-end]:**:[input]:pe-2 has-data-[align=block-end]:**:[input]:pt-1.5 has-data-[align=block-start]:**:[input]:pb-1.5 **:data-[slot=input]:min-w-[max(8ch,35%)] **:data-[slot=input]:flex-1 **:[textarea]:min-h-20.5 **:[textarea]:resize-none **:[textarea]:py-[calc(--spacing(3)-1px)] **:[textarea]:max-sm:min-h-23.5 **:[textarea_button]:rounded-[calc(var(--radius-md)-2px)]\",\n className,\n )}\n data-slot=\"input-group\"\n role=\"group\"\n {...props}\n />\n );\n}\n\nconst inputGroupAddonVariants = cva(\n \"[&_svg]:-mx-0.5 flex h-auto min-w-0 shrink-0 cursor-text select-none items-center justify-center gap-2 has-[[data-slot=input-group-text]]:shrink [&_svg]:shrink-0 [&>kbd]:rounded-[calc(var(--radius)-5px)] in-[[data-slot=input-group]:has([data-slot=input-control],[data-slot=textarea-control])]:[&_svg:not([class*='size-'])]:size-4.5 sm:in-[[data-slot=input-group]:has([data-slot=input-control],[data-slot=textarea-control])]:[&_svg:not([class*='size-'])]:size-4 not-has-[button]:**:[svg:not([class*='opacity-'])]:opacity-80\",\n {\n defaultVariants: {\n align: \"inline-start\",\n },\n variants: {\n align: {\n \"block-end\":\n \"order-last w-full justify-start px-[calc(--spacing(3)-1px)] pb-[calc(--spacing(3)-1px)] [.border-t]:pt-[calc(--spacing(3)-1px)] [[data-size=sm]+&]:px-[calc(--spacing(2.5)-1px)]\",\n \"block-start\":\n \"order-first w-full justify-start px-[calc(--spacing(3)-1px)] pt-[calc(--spacing(3)-1px)] [.border-b]:pb-[calc(--spacing(3)-1px)] [[data-size=sm]+&]:px-[calc(--spacing(2.5)-1px)]\",\n // `[&_svg]:-mx-0.5` lets an icon hang 2px past the addon's content box, and\n // `overflow-x-clip` cuts at the padding box, so the inner side gets 2px of\n // padding for the icon and a matching negative margin that keeps the input\n // where it was.\n \"inline-end\":\n \"overflow-x-clip ps-0.5 -ms-0.5 has-[>:last-child[data-slot=badge]]:-me-1.5 has-[>button]:-me-2 order-last pe-[calc(--spacing(3)-1px)] has-[>kbd:last-child]:me-[-0.35rem] [[data-size=sm]+&]:pe-[calc(--spacing(2.5)-1px)]\",\n \"inline-start\":\n \"overflow-x-clip pe-0.5 -me-0.5 has-[>:last-child[data-slot=badge]]:-ms-1.5 has-[>button]:-ms-2 order-first ps-[calc(--spacing(3)-1px)] has-[>kbd:last-child]:ms-[-0.35rem] [[data-size=sm]+&]:ps-[calc(--spacing(2.5)-1px)]\",\n },\n },\n },\n);\n\nfunction InputGroupAddon({\n className,\n align = \"inline-start\",\n ...props\n}: React.ComponentProps<\"div\"> & VariantProps<typeof inputGroupAddonVariants>) {\n return (\n <div\n className={cn(inputGroupAddonVariants({ align }), className)}\n data-align={align}\n data-slot=\"input-group-addon\"\n onMouseDown={(e) => {\n const target = e.target as HTMLElement;\n const isInteractive = target.closest(\"button, a\");\n if (isInteractive) return;\n e.preventDefault();\n const parent = e.currentTarget.parentElement;\n const input = parent?.querySelector<\n HTMLInputElement | HTMLTextAreaElement\n >(\"input, textarea\");\n if (input && !parent?.querySelector(\"input:focus, textarea:focus\")) {\n input.focus();\n }\n }}\n {...props}\n />\n );\n}\n\nfunction InputGroupText({ className, children, ...props }: React.ComponentProps<\"span\">) {\n return (\n <span\n data-slot=\"input-group-text\"\n className={cn(\n \"[&_svg]:-mx-0.5 flex min-w-0 items-center gap-2 text-subtle-foreground [&_svg]:shrink-0 in-[[data-slot=input-group]:has([data-slot=input-control],[data-slot=textarea-control])]:[&_svg:not([class*='size-'])]:size-4.5 sm:in-[[data-slot=input-group]:has([data-slot=input-control],[data-slot=textarea-control])]:[&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none\",\n className,\n )}\n {...props}\n >\n {truncateTextRuns(children).nodes}\n </span>\n );\n}\n\nfunction InputGroupInput({ className, ...props }: InputProps) {\n return <Input className={className} unstyled {...props} />;\n}\n\nfunction InputGroupTextarea({ className, ...props }: TextareaProps) {\n return <Textarea className={className} unstyled {...props} />;\n}\n\nexport {\n InputGroup,\n InputGroupAddon,\n InputGroupText,\n InputGroupInput,\n InputGroupTextarea,\n};\n"],"mappings":";;;;;;;;;;;AAUA,SAAS,WAAW,EAAE,WAAW,GAAG,SAAsC;CACxE,OACE,oBAAC,OAAD;EACE,WAAW,GAET,u6EACA,SACF;EACA,aAAU;EACV,MAAK;EACL,GAAI;CACL;AAEL;AAEA,MAAM,0BAA0B,IAC9B,8gBACA;CACE,iBAAiB,EACf,OAAO,eACT;CACA,UAAU,EACR,OAAO;EACL,aACE;EACF,eACE;EAKF,cACE;EACF,gBACE;CACJ,EACF;AACF,CACF;AAEA,SAAS,gBAAgB,EACvB,WACA,QAAQ,gBACR,GAAG,SAC0E;CAC7E,OACE,oBAAC,OAAD;EACE,WAAW,GAAG,wBAAwB,EAAE,MAAM,CAAC,GAAG,SAAS;EAC3D,cAAY;EACZ,aAAU;EACV,cAAc,MAAM;GAGlB,IAFe,EAAE,OACY,QAAQ,WACrB,GAAG;GACnB,EAAE,eAAe;GACjB,MAAM,SAAS,EAAE,cAAc;GAC/B,MAAM,QAAQ,QAAQ,cAEpB,iBAAiB;GACnB,IAAI,SAAS,CAAC,QAAQ,cAAc,6BAA6B,GAC/D,MAAM,MAAM;EAEhB;EACA,GAAI;CACL;AAEL;AAEA,SAAS,eAAe,EAAE,WAAW,UAAU,GAAG,SAAuC;CACvF,OACE,oBAAC,QAAD;EACE,aAAU;EACV,WAAW,GACT,wXACA,SACF;EACA,GAAI;YAEH,iBAAiB,QAAQ,CAAC,CAAC;CACxB;AAEV;AAEA,SAAS,gBAAgB,EAAE,WAAW,GAAG,SAAqB;CAC5D,OAAO,oBAAC,OAAD;EAAkB;EAAW;EAAS,GAAI;CAAQ;AAC3D;AAEA,SAAS,mBAAmB,EAAE,WAAW,GAAG,SAAwB;CAClE,OAAO,oBAAC,UAAD;EAAqB;EAAW;EAAS,GAAI;CAAQ;AAC9D"}
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
4
  const require_utils = require('../utils-CzTQ3-VI.cjs');
5
- const require_fluid_highlight = require('../fluid-highlight-YWFRZXsw.cjs');
5
+ const require_fluid_highlight = require('../fluid-highlight-B8olepSM.cjs');
6
6
  let react = require("react");
7
7
  let react_jsx_runtime = require("react/jsx-runtime");
8
8
  let motion_react = require("motion/react");
@@ -222,7 +222,10 @@ function InputOtp({ length = 6, value, defaultValue = "", onChange, onComplete,
222
222
  })]
223
223
  }, index);
224
224
  }),
225
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_fluid_highlight.FluidHighlight, { className: require_utils.cn("z-10 border bg-transparent", size === "sm" ? "rounded-md" : "rounded-lg", isInvalid ? "border-destructive ring-[3px] ring-destructive/25" : "border-ring/60 ring-[3px] ring-ring/35") }),
225
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_fluid_highlight.FluidHighlight, {
226
+ travel: true,
227
+ className: require_utils.cn("z-10 border bg-transparent", size === "sm" ? "rounded-md" : "rounded-lg", isInvalid ? "border-destructive ring-[3px] ring-destructive/25" : "border-ring/60 ring-[3px] ring-ring/35")
228
+ }),
226
229
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
227
230
  ref: inputRef,
228
231
  type: "text",
@@ -1 +1 @@
1
- {"version":3,"file":"input-otp.cjs","names":["cn","motion","FluidHighlight"],"sources":["../../src/components/input-otp.tsx"],"sourcesContent":["'use client';\n\nimport { useEffect, useRef, useState, type ChangeEvent, type ClipboardEvent, type FocusEvent, type Ref } from 'react';\nimport { motion, useAnimate, useReducedMotion, type Transition } from 'motion/react';\n\nimport { FluidHighlight } from '../lib/motion/fluid-highlight';\nimport { cn } from '../lib/utils';\n\n/**\n * One-time-code input: one slot per digit, side by side.\n *\n * The slots are drawn, not typed into. A single transparent `<input>` lies over the whole row and owns the value,\n * the caret, and the selection; the slots mirror it. That one-field model is what makes the code behave like text:\n *\n * type fills the selected slot and moves on\n * Backspace deletes like any text field; later digits close the gap\n * ⌘A / Shift selects across slots, so cut, copy, and paste work on the whole code or a slice of it\n * paste strips separators and inserts at the caret; a complete code replaces the value outright\n * autofill the OS hands the whole code to the one field, which is all `autoComplete=\"one-time-code\"` needs\n *\n * It also means one tab stop and one labelled field for assistive tech, rather than six \"digit N\" boxes.\n *\n * Because the real glyphs and caret are transparent, the slots can animate what the user sees: digits rise into\n * place, a drawn caret blinks in the empty active slot, the focus ring glides between slots, and the row shakes\n * once when the code turns invalid. All of it stands still under reduced motion.\n */\ninterface InputOtpProps {\n\t/** Number of digit slots. */\n\tlength?: number;\n\t/** Controlled value. Non-digits are dropped and longer strings are truncated to `length`. */\n\tvalue?: string;\n\tdefaultValue?: string;\n\tonChange?: (value: string) => void;\n\t/** Fires when an edit leaves every slot filled with a code that differs from the previous one. */\n\tonComplete?: (value: string) => void;\n\tisDisabled?: boolean;\n\tisInvalid?: boolean;\n\t/** Renders a gap between groups, e.g. `3` gives 000 000. */\n\tgroupEvery?: number;\n\t/** `sm` fits the code into an inline row (e.g. a settings list) instead of a dialog. */\n\tsize?: 'default' | 'sm';\n\t'aria-label'?: string;\n\t'aria-describedby'?: string;\n\tclassName?: string;\n\tref?: Ref<HTMLDivElement>;\n}\n\ninterface SlotSelection {\n\tstart: number;\n\tend: number;\n}\n\ntype SelectionDirection = 'forward' | 'backward' | 'none';\n\nconst DIGITS_ONLY = /\\D/g;\n// Arabic-Indic, Persian, Devanagari, Bengali, Thai and full-width digits come from native numeric keyboards and IMEs.\n// They map to ASCII before everything else is dropped, so a code typed or pasted in them is not silently discarded.\nconst NON_ASCII_DIGITS = /[\\u0660-\\u0669\\u06F0-\\u06F9\\u0966-\\u096F\\u09E6-\\u09EF\\u0E50-\\u0E59\\uFF10-\\uFF19]/g;\nconst ZERO_CODE_POINTS = [0x0660, 0x06f0, 0x0966, 0x09e6, 0x0e50, 0xff10];\nconst toAsciiDigits = (raw: string) =>\n\traw.replace(NON_ASCII_DIGITS, (char) => {\n\t\tconst code = char.charCodeAt(0);\n\t\tconst zero = ZERO_CODE_POINTS.find((start) => code >= start && code <= start + 9)!;\n\t\treturn String(code - zero);\n\t});\n// Chrome restores autofill styling and the caret position a beat after a value change, so the mirror re-reads them.\nconst RESYNC_DELAYS = [0, 10, 50];\n// A hard on/off blink, like a text caret, rather than a fade.\nconst CARET_BLINK = { opacity: [1, 1, 0, 0] };\nconst CARET_TIMING: Transition = { duration: 1, times: [0, 0.5, 0.5, 1], ease: 'linear', repeat: Infinity };\n\nconst toCode = (raw: string, length: number) => toAsciiDigits(raw).replace(DIGITS_ONLY, '').slice(0, length);\n\nfunction InputOtp({\n\tlength = 6,\n\tvalue,\n\tdefaultValue = '',\n\tonChange,\n\tonComplete,\n\tisDisabled = false,\n\tisInvalid = false,\n\tgroupEvery,\n\tsize = 'default',\n\t'aria-label': ariaLabel = 'One-time code',\n\t'aria-describedby': ariaDescribedBy,\n\tclassName,\n\tref,\n}: InputOtpProps) {\n\tconst inputRef = useRef<HTMLInputElement>(null);\n\tconst previousSelection = useRef<[number | null, number | null, SelectionDirection]>([null, null, 'none']);\n\tconst wasInvalid = useRef(isInvalid);\n\tconst [rowRef, animate] = useAnimate<HTMLDivElement>();\n\tconst reduceMotion = useReducedMotion();\n\tconst [internal, setInternal] = useState(() => toCode(defaultValue, length));\n\tconst [isFocused, setIsFocused] = useState(false);\n\tconst [selection, setSelection] = useState<SlotSelection | null>(null);\n\n\tconst controlled = value !== undefined;\n\tconst code = toCode(controlled ? value : internal, length);\n\n\tconst mirror = (start: number, end: number) =>\n\t\tsetSelection((current) => (current?.start === start && current.end === end ? current : { start, end }));\n\n\tconst commit = (next: string) => {\n\t\tif (next === code) return;\n\t\tif (!controlled) setInternal(next);\n\t\tonChange?.(next);\n\t\t// Comparing against the previous code keeps a re-render or an identical paste from verifying twice, while\n\t\t// correcting one digit of a full code still counts as a new attempt.\n\t\tif (next.length === length) onComplete?.(next);\n\t};\n\n\tuseEffect(() => {\n\t\tconst input = inputRef.current;\n\t\tif (!input) return;\n\n\t\t// The native caret only ever sits between characters. Over a slot, that reads as nothing being selected, so\n\t\t// a collapsed caret inside a full run is widened to select the digit after it (or before it, when moving left).\n\t\tconst syncSelection = () => {\n\t\t\tif (document.activeElement !== input) {\n\t\t\t\tsetSelection(null);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst { selectionStart, selectionEnd, selectionDirection, maxLength, value: current } = input;\n\t\t\tconst [, previousEnd] = previousSelection.current;\n\t\t\tlet start = -1;\n\t\t\tlet end = -1;\n\t\t\tlet direction: SelectionDirection | undefined;\n\n\t\t\tif (current.length !== 0 && selectionStart !== null && selectionEnd !== null) {\n\t\t\t\tconst isCaret = selectionStart === selectionEnd;\n\t\t\t\tconst isAppending = selectionStart === current.length && current.length < maxLength;\n\t\t\t\tif (isCaret && !isAppending) {\n\t\t\t\t\tconst caret = selectionStart;\n\t\t\t\t\tif (caret === 0) {\n\t\t\t\t\t\t[start, end, direction] = [0, 1, 'forward'];\n\t\t\t\t\t} else if (caret === maxLength) {\n\t\t\t\t\t\t[start, end, direction] = [caret - 1, caret, 'backward'];\n\t\t\t\t\t} else if (maxLength > 1 && current.length > 1) {\n\t\t\t\t\t\tlet offset = 0;\n\t\t\t\t\t\tconst [previousStart] = previousSelection.current;\n\t\t\t\t\t\tif (previousStart !== null && previousEnd !== null) {\n\t\t\t\t\t\t\tdirection = caret < previousEnd ? 'backward' : 'forward';\n\t\t\t\t\t\t\tconst wasAppending = previousStart === previousEnd && previousStart < maxLength;\n\t\t\t\t\t\t\tif (direction === 'backward' && !wasAppending) offset = -1;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tstart = caret + offset;\n\t\t\t\t\t\tend = caret + offset + 1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (start !== -1 && end !== -1 && start !== end) input.setSelectionRange(start, end, direction);\n\t\t\t}\n\n\t\t\tconst nextStart = start !== -1 ? start : (selectionStart ?? 0);\n\t\t\tconst nextEnd = end !== -1 ? end : (selectionEnd ?? 0);\n\t\t\tmirror(nextStart, nextEnd);\n\t\t\tpreviousSelection.current = [nextStart, nextEnd, direction ?? selectionDirection ?? 'none'];\n\t\t};\n\n\t\tdocument.addEventListener('selectionchange', syncSelection, { capture: true });\n\t\tsyncSelection();\n\t\tif (document.activeElement === input) setIsFocused(true);\n\t\treturn () => document.removeEventListener('selectionchange', syncSelection, { capture: true });\n\t}, []);\n\n\tuseEffect(() => {\n\t\tconst timeouts = RESYNC_DELAYS.map((delay) =>\n\t\t\tsetTimeout(() => {\n\t\t\t\tconst input = inputRef.current;\n\t\t\t\tif (!input) return;\n\t\t\t\t// A non-bubbling `input` event clears Chrome's `:autofill` state without reaching React's onChange.\n\t\t\t\tinput.dispatchEvent(new Event('input'));\n\t\t\t\tif (document.activeElement !== input || input.selectionStart === null || input.selectionEnd === null) return;\n\t\t\t\tmirror(input.selectionStart, input.selectionEnd);\n\t\t\t\tpreviousSelection.current = [input.selectionStart, input.selectionEnd, input.selectionDirection ?? 'none'];\n\t\t\t}, delay),\n\t\t);\n\t\treturn () => timeouts.forEach(clearTimeout);\n\t}, [code, isFocused]);\n\n\tuseEffect(() => {\n\t\tconst turnedInvalid = isInvalid && !wasInvalid.current;\n\t\twasInvalid.current = isInvalid;\n\t\tif (!turnedInvalid || reduceMotion || !rowRef.current) return;\n\t\tanimate(rowRef.current, { x: [0, -6, 6, -4, 4, -2, 0] }, { duration: 0.4, ease: 'easeInOut' });\n\t}, [isInvalid, reduceMotion, animate, rowRef]);\n\n\tconst onInputChange = (event: ChangeEvent<HTMLInputElement>) => {\n\t\tconst next = toCode(event.target.value, length);\n\t\t// Deleting doesn't fire `selectionchange`, so the mirror is nudged by hand.\n\t\tif (next.length < code.length) document.dispatchEvent(new Event('selectionchange'));\n\t\tcommit(next);\n\t};\n\n\tconst onPaste = (event: ClipboardEvent<HTMLInputElement>) => {\n\t\t// Always handled here: a native paste of \"123 456\" would be cut to `maxLength` before the spaces were dropped,\n\t\t// and iOS pastes over the whole field rather than at the caret.\n\t\tevent.preventDefault();\n\t\tconst input = event.currentTarget;\n\t\tconst pasted = toAsciiDigits(event.clipboardData.getData('text/plain')).replace(DIGITS_ONLY, '');\n\t\tif (pasted === '') return;\n\t\tconst start = input.selectionStart ?? code.length;\n\t\tconst end = input.selectionEnd ?? start;\n\t\t// A complete code replaces the value even when the caret is mid-way; it's an autofill or a copied message.\n\t\tconst next =\n\t\t\tpasted.length >= length ? pasted.slice(0, length) : (code.slice(0, start) + pasted + code.slice(end)).slice(0, length);\n\t\tinput.value = next;\n\t\tcommit(next);\n\t\tconst caret = Math.min(next.length, length - 1);\n\t\tinput.setSelectionRange(caret, next.length);\n\t\tmirror(caret, next.length);\n\t};\n\n\tconst onFocus = (event: FocusEvent<HTMLInputElement>) => {\n\t\t// Focus lands on the first empty slot, or selects the last digit of a full code so typing replaces it.\n\t\tconst input = event.currentTarget;\n\t\tconst start = Math.min(input.value.length, length - 1);\n\t\tinput.setSelectionRange(start, input.value.length);\n\t\tmirror(start, input.value.length);\n\t\tsetIsFocused(true);\n\t};\n\n\tconst isSlotActive = (index: number) =>\n\t\tisFocused &&\n\t\tselection !== null &&\n\t\t(selection.start === selection.end ? index === selection.start : index >= selection.start && index < selection.end);\n\tconst isRange = selection !== null && selection.end - selection.start > 1;\n\n\treturn (\n\t\t<div\n\t\t\tref={ref}\n\t\t\tdata-slot=\"input-otp\"\n\t\t\tdata-size={size}\n\t\t\t// Chrome Translate wraps text nodes in <font>, which breaks React's next update; a code is never translatable.\n\t\t\ttranslate=\"no\"\n\t\t\t// Digits read left to right in every script, so the row, the caret mirror, and the slot order stay LTR in RTL pages.\n\t\t\tdir=\"ltr\"\n\t\t\tclassName={cn('w-full', size === 'sm' ? 'max-w-[15.5rem]' : 'max-w-[21rem]', className)}\n\t\t>\n\t\t\t<div\n\t\t\t\tref={rowRef}\n\t\t\t\t// Gaps are a share of the row, not rem, so they cannot eat the slots when the root font size is raised.\n\t\t\t\tclassName={cn(\n\t\t\t\t\t'group/otp relative flex w-full items-center',\n\t\t\t\t\tsize === 'sm' ? 'gap-[min(0.375rem,2.5%)]' : 'gap-[min(0.25rem,2.5%)] sm:gap-[min(0.5rem,2.5%)]',\n\t\t\t\t)}\n\t\t\t>\n\t\t\t\t{Array.from({ length }, (_, index) => {\n\t\t\t\t\tconst digit = code[index];\n\t\t\t\t\tconst isActive = isSlotActive(index);\n\t\t\t\t\tconst gapBefore = groupEvery !== undefined && index > 0 && index % groupEvery === 0;\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tkey={index}\n\t\t\t\t\t\t\taria-hidden\n\t\t\t\t\t\t\tdata-slot=\"input-otp-slot\"\n\t\t\t\t\t\t\tdata-active={isActive || undefined}\n\t\t\t\t\t\t\t// The single active slot is what the gliding ring tracks; a range is shown by the slots themselves.\n\t\t\t\t\t\t\tdata-highlighted={(isActive && !isRange) || undefined}\n\t\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t\t'relative flex min-w-0 flex-1 items-center justify-center overflow-hidden font-mono tabular-nums',\n\t\t\t\t\t\t\t\tsize === 'sm' ? 'h-9 max-w-9 rounded-md text-base' : 'h-11 max-w-10 rounded-lg text-lg sm:h-12 sm:max-w-12',\n\t\t\t\t\t\t\t\tgapBefore &&\n\t\t\t\t\t\t\t\t\t(size === 'sm' ? 'ms-[min(0.375rem,2.5%)]' : 'ms-[min(0.25rem,2.5%)] sm:ms-[min(0.5rem,2.5%)]'),\n\t\t\t\t\t\t\t\t'border border-input bg-background text-foreground shadow-xs dark:bg-input/32',\n\t\t\t\t\t\t\t\t'transition-[background-color,border-color] duration-150 ease-out motion-reduce:transition-none',\n\t\t\t\t\t\t\t\t!isDisabled && 'group-hover/otp:border-ring/50',\n\t\t\t\t\t\t\t\tisActive && isRange && 'bg-accent',\n\t\t\t\t\t\t\t\t// Keep the invalid state visible without relying on tint alone.\n\t\t\t\t\t\t\t\tisInvalid && 'border-destructive bg-destructive/5 text-destructive group-hover/otp:border-destructive',\n\t\t\t\t\t\t\t\tisDisabled && 'bg-muted text-muted-foreground shadow-none',\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{digit !== undefined && (\n\t\t\t\t\t\t\t\t// Keyed on the digit so each new one replays the rise, including a correction in place.\n\t\t\t\t\t\t\t\t<span\n\t\t\t\t\t\t\t\t\tkey={digit}\n\t\t\t\t\t\t\t\t\tclassName=\"inline-block transition-[translate,opacity] duration-150 ease-out starting:translate-y-2 starting:opacity-0 motion-reduce:transition-none\"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{digit}\n\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t{isActive && digit === undefined && (\n\t\t\t\t\t\t\t\t// The real caret is transparent, so the empty active slot draws its own.\n\t\t\t\t\t\t\t\t<motion.span\n\t\t\t\t\t\t\t\t\tclassName={cn('pointer-events-none absolute w-px bg-foreground', size === 'sm' ? 'h-4' : 'h-5')}\n\t\t\t\t\t\t\t\t\tanimate={reduceMotion ? undefined : CARET_BLINK}\n\t\t\t\t\t\t\t\t\ttransition={CARET_TIMING}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t);\n\t\t\t\t})}\n\t\t\t\t<FluidHighlight\n\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t'z-10 border bg-transparent',\n\t\t\t\t\t\tsize === 'sm' ? 'rounded-md' : 'rounded-lg',\n\t\t\t\t\t\tisInvalid ? 'border-destructive ring-[3px] ring-destructive/25' : 'border-ring/60 ring-[3px] ring-ring/35',\n\t\t\t\t\t)}\n\t\t\t\t/>\n\t\t\t\t<input\n\t\t\t\t\tref={inputRef}\n\t\t\t\t\t// `text` with a numeric mode rather than `number`: a number input brings spinners, accepts `e`\n\t\t\t\t\t// and `-`, and reports an empty value for anything it considers malformed.\n\t\t\t\t\ttype=\"text\"\n\t\t\t\t\tinputMode=\"numeric\"\n\t\t\t\t\tautoComplete=\"one-time-code\"\n\t\t\t\t\tspellCheck={false}\n\t\t\t\t\tmaxLength={length}\n\t\t\t\t\tdisabled={isDisabled}\n\t\t\t\t\taria-label={ariaLabel}\n\t\t\t\t\taria-describedby={ariaDescribedBy}\n\t\t\t\t\taria-invalid={isInvalid || undefined}\n\t\t\t\t\tdata-slot=\"input-otp-input\"\n\t\t\t\t\tvalue={code}\n\t\t\t\t\tonChange={onInputChange}\n\t\t\t\t\tonPaste={onPaste}\n\t\t\t\t\tonFocus={onFocus}\n\t\t\t\t\tonBlur={() => setIsFocused(false)}\n\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t// Present and hit-testable over the whole row, but invisible: transparent ink rather than opacity,\n\t\t\t\t\t\t// because iOS only offers paste on a press-and-hold over a visible field.\n\t\t\t\t\t\t'absolute inset-0 z-20 size-full cursor-text appearance-none border-0 bg-transparent p-0 font-mono leading-none',\n\t\t\t\t\t\t'text-transparent caret-transparent tracking-[-0.5em] tabular-nums shadow-none outline-none',\n\t\t\t\t\t\t// A font as tall as the row keeps every glyph under the slots, so a tap anywhere lands in the field.\n\t\t\t\t\t\tsize === 'sm' ? 'text-[36px]' : 'text-[44px] sm:text-[48px]',\n\t\t\t\t\t\t'selection:bg-transparent selection:text-transparent',\n\t\t\t\t\t\t'autofill:opacity-0! autofill:shadow-none! autofill:[-webkit-text-fill-color:transparent]!',\n\t\t\t\t\t\t// iOS lays the glyphs out wider and leaks the caret at the edge; squeeze them back under the slots.\n\t\t\t\t\t\t'supports-[-webkit-touch-callout:none]:-left-px supports-[-webkit-touch-callout:none]:right-px',\n\t\t\t\t\t\t'supports-[-webkit-touch-callout:none]:font-thin supports-[-webkit-touch-callout:none]:tracking-[-0.6em]',\n\t\t\t\t\t\t'disabled:cursor-not-allowed',\n\t\t\t\t\t)}\n\t\t\t\t/>\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n\nexport { InputOtp };\nexport type { InputOtpProps };\n"],"mappings":";;;;;;;;;;AAsDA,MAAM,cAAc;AAGpB,MAAM,mBAAmB;AACzB,MAAM,mBAAmB;CAAC;CAAQ;CAAQ;CAAQ;CAAQ;CAAQ;AAAM;AACxE,MAAM,iBAAiB,QACtB,IAAI,QAAQ,mBAAmB,SAAS;CACvC,MAAM,OAAO,KAAK,WAAW,CAAC;CAC9B,MAAM,OAAO,iBAAiB,MAAM,UAAU,QAAQ,SAAS,QAAQ,QAAQ,CAAC;CAChF,OAAO,OAAO,OAAO,IAAI;AAC1B,CAAC;AAEF,MAAM,gBAAgB;CAAC;CAAG;CAAI;AAAE;AAEhC,MAAM,cAAc,EAAE,SAAS;CAAC;CAAG;CAAG;CAAG;AAAC,EAAE;AAC5C,MAAM,eAA2B;CAAE,UAAU;CAAG,OAAO;EAAC;EAAG;EAAK;EAAK;CAAC;CAAG,MAAM;CAAU,QAAQ;AAAS;AAE1G,MAAM,UAAU,KAAa,WAAmB,cAAc,GAAG,CAAC,CAAC,QAAQ,aAAa,EAAE,CAAC,CAAC,MAAM,GAAG,MAAM;AAE3G,SAAS,SAAS,EACjB,SAAS,GACT,OACA,eAAe,IACf,UACA,YACA,aAAa,OACb,YAAY,OACZ,YACA,OAAO,WACP,cAAc,YAAY,iBAC1B,oBAAoB,iBACpB,WACA,OACiB;CACjB,MAAM,6BAAoC,IAAI;CAC9C,MAAM,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b,YAAY;KACZ,WAAW;KACX,UAAU;KACV,cAAY;KACZ,oBAAkB;KAClB,gBAAc,aAAa;KAC3B,aAAU;KACV,OAAO;KACP,UAAU;KACD;KACA;KACT,cAAc,aAAa,KAAK;KAChC,WAAWA,iBAGV,kHACA,8FAEA,SAAS,OAAO,gBAAgB,8BAChC,uDACA,6FAEA,iGACA,2GACA,6BACD;IACA;GACG;;CACD;AAEP"}
1
+ {"version":3,"file":"input-otp.cjs","names":["cn","motion","FluidHighlight"],"sources":["../../src/components/input-otp.tsx"],"sourcesContent":["'use client';\n\nimport { useEffect, useRef, useState, type ChangeEvent, type ClipboardEvent, type FocusEvent, type Ref } from 'react';\nimport { motion, useAnimate, useReducedMotion, type Transition } from 'motion/react';\n\nimport { FluidHighlight } from '../lib/motion/fluid-highlight';\nimport { cn } from '../lib/utils';\n\n/**\n * One-time-code input: one slot per digit, side by side.\n *\n * The slots are drawn, not typed into. A single transparent `<input>` lies over the whole row and owns the value,\n * the caret, and the selection; the slots mirror it. That one-field model is what makes the code behave like text:\n *\n * type fills the selected slot and moves on\n * Backspace deletes like any text field; later digits close the gap\n * ⌘A / Shift selects across slots, so cut, copy, and paste work on the whole code or a slice of it\n * paste strips separators and inserts at the caret; a complete code replaces the value outright\n * autofill the OS hands the whole code to the one field, which is all `autoComplete=\"one-time-code\"` needs\n *\n * It also means one tab stop and one labelled field for assistive tech, rather than six \"digit N\" boxes.\n *\n * Because the real glyphs and caret are transparent, the slots can animate what the user sees: digits rise into\n * place, a drawn caret blinks in the empty active slot, the focus ring glides between slots, and the row shakes\n * once when the code turns invalid. All of it stands still under reduced motion.\n */\ninterface InputOtpProps {\n\t/** Number of digit slots. */\n\tlength?: number;\n\t/** Controlled value. Non-digits are dropped and longer strings are truncated to `length`. */\n\tvalue?: string;\n\tdefaultValue?: string;\n\tonChange?: (value: string) => void;\n\t/** Fires when an edit leaves every slot filled with a code that differs from the previous one. */\n\tonComplete?: (value: string) => void;\n\tisDisabled?: boolean;\n\tisInvalid?: boolean;\n\t/** Renders a gap between groups, e.g. `3` gives 000 000. */\n\tgroupEvery?: number;\n\t/** `sm` fits the code into an inline row (e.g. a settings list) instead of a dialog. */\n\tsize?: 'default' | 'sm';\n\t'aria-label'?: string;\n\t'aria-describedby'?: string;\n\tclassName?: string;\n\tref?: Ref<HTMLDivElement>;\n}\n\ninterface SlotSelection {\n\tstart: number;\n\tend: number;\n}\n\ntype SelectionDirection = 'forward' | 'backward' | 'none';\n\nconst DIGITS_ONLY = /\\D/g;\n// Arabic-Indic, Persian, Devanagari, Bengali, Thai and full-width digits come from native numeric keyboards and IMEs.\n// They map to ASCII before everything else is dropped, so a code typed or pasted in them is not silently discarded.\nconst NON_ASCII_DIGITS = /[\\u0660-\\u0669\\u06F0-\\u06F9\\u0966-\\u096F\\u09E6-\\u09EF\\u0E50-\\u0E59\\uFF10-\\uFF19]/g;\nconst ZERO_CODE_POINTS = [0x0660, 0x06f0, 0x0966, 0x09e6, 0x0e50, 0xff10];\nconst toAsciiDigits = (raw: string) =>\n\traw.replace(NON_ASCII_DIGITS, (char) => {\n\t\tconst code = char.charCodeAt(0);\n\t\tconst zero = ZERO_CODE_POINTS.find((start) => code >= start && code <= start + 9)!;\n\t\treturn String(code - zero);\n\t});\n// Chrome restores autofill styling and the caret position a beat after a value change, so the mirror re-reads them.\nconst RESYNC_DELAYS = [0, 10, 50];\n// A hard on/off blink, like a text caret, rather than a fade.\nconst CARET_BLINK = { opacity: [1, 1, 0, 0] };\nconst CARET_TIMING: Transition = { duration: 1, times: [0, 0.5, 0.5, 1], ease: 'linear', repeat: Infinity };\n\nconst toCode = (raw: string, length: number) => toAsciiDigits(raw).replace(DIGITS_ONLY, '').slice(0, length);\n\nfunction InputOtp({\n\tlength = 6,\n\tvalue,\n\tdefaultValue = '',\n\tonChange,\n\tonComplete,\n\tisDisabled = false,\n\tisInvalid = false,\n\tgroupEvery,\n\tsize = 'default',\n\t'aria-label': ariaLabel = 'One-time code',\n\t'aria-describedby': ariaDescribedBy,\n\tclassName,\n\tref,\n}: InputOtpProps) {\n\tconst inputRef = useRef<HTMLInputElement>(null);\n\tconst previousSelection = useRef<[number | null, number | null, SelectionDirection]>([null, null, 'none']);\n\tconst wasInvalid = useRef(isInvalid);\n\tconst [rowRef, animate] = useAnimate<HTMLDivElement>();\n\tconst reduceMotion = useReducedMotion();\n\tconst [internal, setInternal] = useState(() => toCode(defaultValue, length));\n\tconst [isFocused, setIsFocused] = useState(false);\n\tconst [selection, setSelection] = useState<SlotSelection | null>(null);\n\n\tconst controlled = value !== undefined;\n\tconst code = toCode(controlled ? value : internal, length);\n\n\tconst mirror = (start: number, end: number) =>\n\t\tsetSelection((current) => (current?.start === start && current.end === end ? current : { start, end }));\n\n\tconst commit = (next: string) => {\n\t\tif (next === code) return;\n\t\tif (!controlled) setInternal(next);\n\t\tonChange?.(next);\n\t\t// Comparing against the previous code keeps a re-render or an identical paste from verifying twice, while\n\t\t// correcting one digit of a full code still counts as a new attempt.\n\t\tif (next.length === length) onComplete?.(next);\n\t};\n\n\tuseEffect(() => {\n\t\tconst input = inputRef.current;\n\t\tif (!input) return;\n\n\t\t// The native caret only ever sits between characters. Over a slot, that reads as nothing being selected, so\n\t\t// a collapsed caret inside a full run is widened to select the digit after it (or before it, when moving left).\n\t\tconst syncSelection = () => {\n\t\t\tif (document.activeElement !== input) {\n\t\t\t\tsetSelection(null);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst { selectionStart, selectionEnd, selectionDirection, maxLength, value: current } = input;\n\t\t\tconst [, previousEnd] = previousSelection.current;\n\t\t\tlet start = -1;\n\t\t\tlet end = -1;\n\t\t\tlet direction: SelectionDirection | undefined;\n\n\t\t\tif (current.length !== 0 && selectionStart !== null && selectionEnd !== null) {\n\t\t\t\tconst isCaret = selectionStart === selectionEnd;\n\t\t\t\tconst isAppending = selectionStart === current.length && current.length < maxLength;\n\t\t\t\tif (isCaret && !isAppending) {\n\t\t\t\t\tconst caret = selectionStart;\n\t\t\t\t\tif (caret === 0) {\n\t\t\t\t\t\t[start, end, direction] = [0, 1, 'forward'];\n\t\t\t\t\t} else if (caret === maxLength) {\n\t\t\t\t\t\t[start, end, direction] = [caret - 1, caret, 'backward'];\n\t\t\t\t\t} else if (maxLength > 1 && current.length > 1) {\n\t\t\t\t\t\tlet offset = 0;\n\t\t\t\t\t\tconst [previousStart] = previousSelection.current;\n\t\t\t\t\t\tif (previousStart !== null && previousEnd !== null) {\n\t\t\t\t\t\t\tdirection = caret < previousEnd ? 'backward' : 'forward';\n\t\t\t\t\t\t\tconst wasAppending = previousStart === previousEnd && previousStart < maxLength;\n\t\t\t\t\t\t\tif (direction === 'backward' && !wasAppending) offset = -1;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tstart = caret + offset;\n\t\t\t\t\t\tend = caret + offset + 1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (start !== -1 && end !== -1 && start !== end) input.setSelectionRange(start, end, direction);\n\t\t\t}\n\n\t\t\tconst nextStart = start !== -1 ? start : (selectionStart ?? 0);\n\t\t\tconst nextEnd = end !== -1 ? end : (selectionEnd ?? 0);\n\t\t\tmirror(nextStart, nextEnd);\n\t\t\tpreviousSelection.current = [nextStart, nextEnd, direction ?? selectionDirection ?? 'none'];\n\t\t};\n\n\t\tdocument.addEventListener('selectionchange', syncSelection, { capture: true });\n\t\tsyncSelection();\n\t\tif (document.activeElement === input) setIsFocused(true);\n\t\treturn () => document.removeEventListener('selectionchange', syncSelection, { capture: true });\n\t}, []);\n\n\tuseEffect(() => {\n\t\tconst timeouts = RESYNC_DELAYS.map((delay) =>\n\t\t\tsetTimeout(() => {\n\t\t\t\tconst input = inputRef.current;\n\t\t\t\tif (!input) return;\n\t\t\t\t// A non-bubbling `input` event clears Chrome's `:autofill` state without reaching React's onChange.\n\t\t\t\tinput.dispatchEvent(new Event('input'));\n\t\t\t\tif (document.activeElement !== input || input.selectionStart === null || input.selectionEnd === null) return;\n\t\t\t\tmirror(input.selectionStart, input.selectionEnd);\n\t\t\t\tpreviousSelection.current = [input.selectionStart, input.selectionEnd, input.selectionDirection ?? 'none'];\n\t\t\t}, delay),\n\t\t);\n\t\treturn () => timeouts.forEach(clearTimeout);\n\t}, [code, isFocused]);\n\n\tuseEffect(() => {\n\t\tconst turnedInvalid = isInvalid && !wasInvalid.current;\n\t\twasInvalid.current = isInvalid;\n\t\tif (!turnedInvalid || reduceMotion || !rowRef.current) return;\n\t\tanimate(rowRef.current, { x: [0, -6, 6, -4, 4, -2, 0] }, { duration: 0.4, ease: 'easeInOut' });\n\t}, [isInvalid, reduceMotion, animate, rowRef]);\n\n\tconst onInputChange = (event: ChangeEvent<HTMLInputElement>) => {\n\t\tconst next = toCode(event.target.value, length);\n\t\t// Deleting doesn't fire `selectionchange`, so the mirror is nudged by hand.\n\t\tif (next.length < code.length) document.dispatchEvent(new Event('selectionchange'));\n\t\tcommit(next);\n\t};\n\n\tconst onPaste = (event: ClipboardEvent<HTMLInputElement>) => {\n\t\t// Always handled here: a native paste of \"123 456\" would be cut to `maxLength` before the spaces were dropped,\n\t\t// and iOS pastes over the whole field rather than at the caret.\n\t\tevent.preventDefault();\n\t\tconst input = event.currentTarget;\n\t\tconst pasted = toAsciiDigits(event.clipboardData.getData('text/plain')).replace(DIGITS_ONLY, '');\n\t\tif (pasted === '') return;\n\t\tconst start = input.selectionStart ?? code.length;\n\t\tconst end = input.selectionEnd ?? start;\n\t\t// A complete code replaces the value even when the caret is mid-way; it's an autofill or a copied message.\n\t\tconst next =\n\t\t\tpasted.length >= length ? pasted.slice(0, length) : (code.slice(0, start) + pasted + code.slice(end)).slice(0, length);\n\t\tinput.value = next;\n\t\tcommit(next);\n\t\tconst caret = Math.min(next.length, length - 1);\n\t\tinput.setSelectionRange(caret, next.length);\n\t\tmirror(caret, next.length);\n\t};\n\n\tconst onFocus = (event: FocusEvent<HTMLInputElement>) => {\n\t\t// Focus lands on the first empty slot, or selects the last digit of a full code so typing replaces it.\n\t\tconst input = event.currentTarget;\n\t\tconst start = Math.min(input.value.length, length - 1);\n\t\tinput.setSelectionRange(start, input.value.length);\n\t\tmirror(start, input.value.length);\n\t\tsetIsFocused(true);\n\t};\n\n\tconst isSlotActive = (index: number) =>\n\t\tisFocused &&\n\t\tselection !== null &&\n\t\t(selection.start === selection.end ? index === selection.start : index >= selection.start && index < selection.end);\n\tconst isRange = selection !== null && selection.end - selection.start > 1;\n\n\treturn (\n\t\t<div\n\t\t\tref={ref}\n\t\t\tdata-slot=\"input-otp\"\n\t\t\tdata-size={size}\n\t\t\t// Chrome Translate wraps text nodes in <font>, which breaks React's next update; a code is never translatable.\n\t\t\ttranslate=\"no\"\n\t\t\t// Digits read left to right in every script, so the row, the caret mirror, and the slot order stay LTR in RTL pages.\n\t\t\tdir=\"ltr\"\n\t\t\tclassName={cn('w-full', size === 'sm' ? 'max-w-[15.5rem]' : 'max-w-[21rem]', className)}\n\t\t>\n\t\t\t<div\n\t\t\t\tref={rowRef}\n\t\t\t\t// Gaps are a share of the row, not rem, so they cannot eat the slots when the root font size is raised.\n\t\t\t\tclassName={cn(\n\t\t\t\t\t'group/otp relative flex w-full items-center',\n\t\t\t\t\tsize === 'sm' ? 'gap-[min(0.375rem,2.5%)]' : 'gap-[min(0.25rem,2.5%)] sm:gap-[min(0.5rem,2.5%)]',\n\t\t\t\t)}\n\t\t\t>\n\t\t\t\t{Array.from({ length }, (_, index) => {\n\t\t\t\t\tconst digit = code[index];\n\t\t\t\t\tconst isActive = isSlotActive(index);\n\t\t\t\t\tconst gapBefore = groupEvery !== undefined && index > 0 && index % groupEvery === 0;\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tkey={index}\n\t\t\t\t\t\t\taria-hidden\n\t\t\t\t\t\t\tdata-slot=\"input-otp-slot\"\n\t\t\t\t\t\t\tdata-active={isActive || undefined}\n\t\t\t\t\t\t\t// The single active slot is what the gliding ring tracks; a range is shown by the slots themselves.\n\t\t\t\t\t\t\tdata-highlighted={(isActive && !isRange) || undefined}\n\t\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t\t'relative flex min-w-0 flex-1 items-center justify-center overflow-hidden font-mono tabular-nums',\n\t\t\t\t\t\t\t\tsize === 'sm' ? 'h-9 max-w-9 rounded-md text-base' : 'h-11 max-w-10 rounded-lg text-lg sm:h-12 sm:max-w-12',\n\t\t\t\t\t\t\t\tgapBefore &&\n\t\t\t\t\t\t\t\t\t(size === 'sm' ? 'ms-[min(0.375rem,2.5%)]' : 'ms-[min(0.25rem,2.5%)] sm:ms-[min(0.5rem,2.5%)]'),\n\t\t\t\t\t\t\t\t'border border-input bg-background text-foreground shadow-xs dark:bg-input/32',\n\t\t\t\t\t\t\t\t'transition-[background-color,border-color] duration-150 ease-out motion-reduce:transition-none',\n\t\t\t\t\t\t\t\t!isDisabled && 'group-hover/otp:border-ring/50',\n\t\t\t\t\t\t\t\tisActive && isRange && 'bg-accent',\n\t\t\t\t\t\t\t\t// Keep the invalid state visible without relying on tint alone.\n\t\t\t\t\t\t\t\tisInvalid && 'border-destructive bg-destructive/5 text-destructive group-hover/otp:border-destructive',\n\t\t\t\t\t\t\t\tisDisabled && 'bg-muted text-muted-foreground shadow-none',\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{digit !== undefined && (\n\t\t\t\t\t\t\t\t// Keyed on the digit so each new one replays the rise, including a correction in place.\n\t\t\t\t\t\t\t\t<span\n\t\t\t\t\t\t\t\t\tkey={digit}\n\t\t\t\t\t\t\t\t\tclassName=\"inline-block transition-[translate,opacity] duration-150 ease-out starting:translate-y-2 starting:opacity-0 motion-reduce:transition-none\"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{digit}\n\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t{isActive && digit === undefined && (\n\t\t\t\t\t\t\t\t// The real caret is transparent, so the empty active slot draws its own.\n\t\t\t\t\t\t\t\t<motion.span\n\t\t\t\t\t\t\t\t\tclassName={cn('pointer-events-none absolute w-px bg-foreground', size === 'sm' ? 'h-4' : 'h-5')}\n\t\t\t\t\t\t\t\t\tanimate={reduceMotion ? undefined : CARET_BLINK}\n\t\t\t\t\t\t\t\t\ttransition={CARET_TIMING}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t);\n\t\t\t\t})}\n\t\t\t\t<FluidHighlight\n\t\t\t\t\ttravel\n\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t'z-10 border bg-transparent',\n\t\t\t\t\t\tsize === 'sm' ? 'rounded-md' : 'rounded-lg',\n\t\t\t\t\t\tisInvalid ? 'border-destructive ring-[3px] ring-destructive/25' : 'border-ring/60 ring-[3px] ring-ring/35',\n\t\t\t\t\t)}\n\t\t\t\t/>\n\t\t\t\t<input\n\t\t\t\t\tref={inputRef}\n\t\t\t\t\t// `text` with a numeric mode rather than `number`: a number input brings spinners, accepts `e`\n\t\t\t\t\t// and `-`, and reports an empty value for anything it considers malformed.\n\t\t\t\t\ttype=\"text\"\n\t\t\t\t\tinputMode=\"numeric\"\n\t\t\t\t\tautoComplete=\"one-time-code\"\n\t\t\t\t\tspellCheck={false}\n\t\t\t\t\tmaxLength={length}\n\t\t\t\t\tdisabled={isDisabled}\n\t\t\t\t\taria-label={ariaLabel}\n\t\t\t\t\taria-describedby={ariaDescribedBy}\n\t\t\t\t\taria-invalid={isInvalid || undefined}\n\t\t\t\t\tdata-slot=\"input-otp-input\"\n\t\t\t\t\tvalue={code}\n\t\t\t\t\tonChange={onInputChange}\n\t\t\t\t\tonPaste={onPaste}\n\t\t\t\t\tonFocus={onFocus}\n\t\t\t\t\tonBlur={() => setIsFocused(false)}\n\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t// Present and hit-testable over the whole row, but invisible: transparent ink rather than opacity,\n\t\t\t\t\t\t// because iOS only offers paste on a press-and-hold over a visible field.\n\t\t\t\t\t\t'absolute inset-0 z-20 size-full cursor-text appearance-none border-0 bg-transparent p-0 font-mono leading-none',\n\t\t\t\t\t\t'text-transparent caret-transparent tracking-[-0.5em] tabular-nums shadow-none outline-none',\n\t\t\t\t\t\t// A font as tall as the row keeps every glyph under the slots, so a tap anywhere lands in the field.\n\t\t\t\t\t\tsize === 'sm' ? 'text-[36px]' : 'text-[44px] sm:text-[48px]',\n\t\t\t\t\t\t'selection:bg-transparent selection:text-transparent',\n\t\t\t\t\t\t'autofill:opacity-0! autofill:shadow-none! autofill:[-webkit-text-fill-color:transparent]!',\n\t\t\t\t\t\t// iOS lays the glyphs out wider and leaks the caret at the edge; squeeze them back under the slots.\n\t\t\t\t\t\t'supports-[-webkit-touch-callout:none]:-left-px supports-[-webkit-touch-callout:none]:right-px',\n\t\t\t\t\t\t'supports-[-webkit-touch-callout:none]:font-thin supports-[-webkit-touch-callout:none]:tracking-[-0.6em]',\n\t\t\t\t\t\t'disabled:cursor-not-allowed',\n\t\t\t\t\t)}\n\t\t\t\t/>\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n\nexport { InputOtp };\nexport type { InputOtpProps };\n"],"mappings":";;;;;;;;;;AAsDA,MAAM,cAAc;AAGpB,MAAM,mBAAmB;AACzB,MAAM,mBAAmB;CAAC;CAAQ;CAAQ;CAAQ;CAAQ;CAAQ;AAAM;AACxE,MAAM,iBAAiB,QACtB,IAAI,QAAQ,mBAAmB,SAAS;CACvC,MAAM,OAAO,KAAK,WAAW,CAAC;CAC9B,MAAM,OAAO,iBAAiB,MAAM,UAAU,QAAQ,SAAS,QAAQ,QAAQ,CAAC;CAChF,OAAO,OAAO,OAAO,IAAI;AAC1B,CAAC;AAEF,MAAM,gBAAgB;CAAC;CAAG;CAAI;AAAE;AAEhC,MAAM,cAAc,EAAE,SAAS;CAAC;CAAG;CAAG;CAAG;AAAC,EAAE;AAC5C,MAAM,eAA2B;CAAE,UAAU;CAAG,OAAO;EAAC;EAAG;EAAK;EAAK;CAAC;CAAG,M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,UAEtB,2CAACC,oBAAO,MAAR;OACC,WAAWD,iBAAG,mDAAmD,SAAS,OAAO,QAAQ,KAAK;OAC9F,SAAS,eAAe,SAAY;OACpC,YAAY;MACZ,EAEE;QArCC,KAqCD;IAEP,CAAC;IACD,2CAACE,wCAAD;KACC;KACA,WAAWF,iBACV,8BACA,SAAS,OAAO,eAAe,cAC/B,YAAY,sDAAsD,wCACnE;IACA;IACD,2CAAC,SAAD;KACC,KAAK;KAGL,MAAK;KACL,WAAU;KACV,cAAa;KACb,YAAY;KACZ,WAAW;KACX,UAAU;KACV,cAAY;KACZ,oBAAkB;KAClB,gBAAc,aAAa;KAC3B,aAAU;KACV,OAAO;KACP,UAAU;KACD;KACA;KACT,cAAc,aAAa,KAAK;KAChC,WAAWA,iBAGV,kHACA,8FAEA,SAAS,OAAO,gBAAgB,8BAChC,uDACA,6FAEA,iGACA,2GACA,6BACD;IACA;GACG;;CACD;AAEP"}
@@ -1,7 +1,7 @@
1
1
  'use client';
2
2
 
3
3
  import { t as cn } from "../utils-BkMLyah9.js";
4
- import { t as FluidHighlight } from "../fluid-highlight-CNELHV8o.js";
4
+ import { t as FluidHighlight } from "../fluid-highlight-BXVfWNk9.js";
5
5
  import { useEffect, useRef, useState } from "react";
6
6
  import { jsx, jsxs } from "react/jsx-runtime";
7
7
  import { motion, useAnimate, useReducedMotion } from "motion/react";
@@ -221,7 +221,10 @@ function InputOtp({ length = 6, value, defaultValue = "", onChange, onComplete,
221
221
  })]
222
222
  }, index);
223
223
  }),
224
- /* @__PURE__ */ jsx(FluidHighlight, { className: cn("z-10 border bg-transparent", size === "sm" ? "rounded-md" : "rounded-lg", isInvalid ? "border-destructive ring-[3px] ring-destructive/25" : "border-ring/60 ring-[3px] ring-ring/35") }),
224
+ /* @__PURE__ */ jsx(FluidHighlight, {
225
+ travel: true,
226
+ className: cn("z-10 border bg-transparent", size === "sm" ? "rounded-md" : "rounded-lg", isInvalid ? "border-destructive ring-[3px] ring-destructive/25" : "border-ring/60 ring-[3px] ring-ring/35")
227
+ }),
225
228
  /* @__PURE__ */ jsx("input", {
226
229
  ref: inputRef,
227
230
  type: "text",
@@ -1 +1 @@
1
- {"version":3,"file":"input-otp.js","names":[],"sources":["../../src/components/input-otp.tsx"],"sourcesContent":["'use client';\n\nimport { useEffect, useRef, useState, type ChangeEvent, type ClipboardEvent, type FocusEvent, type Ref } from 'react';\nimport { motion, useAnimate, useReducedMotion, type Transition } from 'motion/react';\n\nimport { FluidHighlight } from '../lib/motion/fluid-highlight';\nimport { cn } from '../lib/utils';\n\n/**\n * One-time-code input: one slot per digit, side by side.\n *\n * The slots are drawn, not typed into. A single transparent `<input>` lies over the whole row and owns the value,\n * the caret, and the selection; the slots mirror it. That one-field model is what makes the code behave like text:\n *\n * type fills the selected slot and moves on\n * Backspace deletes like any text field; later digits close the gap\n * ⌘A / Shift selects across slots, so cut, copy, and paste work on the whole code or a slice of it\n * paste strips separators and inserts at the caret; a complete code replaces the value outright\n * autofill the OS hands the whole code to the one field, which is all `autoComplete=\"one-time-code\"` needs\n *\n * It also means one tab stop and one labelled field for assistive tech, rather than six \"digit N\" boxes.\n *\n * Because the real glyphs and caret are transparent, the slots can animate what the user sees: digits rise into\n * place, a drawn caret blinks in the empty active slot, the focus ring glides between slots, and the row shakes\n * once when the code turns invalid. All of it stands still under reduced motion.\n */\ninterface InputOtpProps {\n\t/** Number of digit slots. */\n\tlength?: number;\n\t/** Controlled value. Non-digits are dropped and longer strings are truncated to `length`. */\n\tvalue?: string;\n\tdefaultValue?: string;\n\tonChange?: (value: string) => void;\n\t/** Fires when an edit leaves every slot filled with a code that differs from the previous one. */\n\tonComplete?: (value: string) => void;\n\tisDisabled?: boolean;\n\tisInvalid?: boolean;\n\t/** Renders a gap between groups, e.g. `3` gives 000 000. */\n\tgroupEvery?: number;\n\t/** `sm` fits the code into an inline row (e.g. a settings list) instead of a dialog. */\n\tsize?: 'default' | 'sm';\n\t'aria-label'?: string;\n\t'aria-describedby'?: string;\n\tclassName?: string;\n\tref?: Ref<HTMLDivElement>;\n}\n\ninterface SlotSelection {\n\tstart: number;\n\tend: number;\n}\n\ntype SelectionDirection = 'forward' | 'backward' | 'none';\n\nconst DIGITS_ONLY = /\\D/g;\n// Arabic-Indic, Persian, Devanagari, Bengali, Thai and full-width digits come from native numeric keyboards and IMEs.\n// They map to ASCII before everything else is dropped, so a code typed or pasted in them is not silently discarded.\nconst NON_ASCII_DIGITS = /[\\u0660-\\u0669\\u06F0-\\u06F9\\u0966-\\u096F\\u09E6-\\u09EF\\u0E50-\\u0E59\\uFF10-\\uFF19]/g;\nconst ZERO_CODE_POINTS = [0x0660, 0x06f0, 0x0966, 0x09e6, 0x0e50, 0xff10];\nconst toAsciiDigits = (raw: string) =>\n\traw.replace(NON_ASCII_DIGITS, (char) => {\n\t\tconst code = char.charCodeAt(0);\n\t\tconst zero = ZERO_CODE_POINTS.find((start) => code >= start && code <= start + 9)!;\n\t\treturn String(code - zero);\n\t});\n// Chrome restores autofill styling and the caret position a beat after a value change, so the mirror re-reads them.\nconst RESYNC_DELAYS = [0, 10, 50];\n// A hard on/off blink, like a text caret, rather than a fade.\nconst CARET_BLINK = { opacity: [1, 1, 0, 0] };\nconst CARET_TIMING: Transition = { duration: 1, times: [0, 0.5, 0.5, 1], ease: 'linear', repeat: Infinity };\n\nconst toCode = (raw: string, length: number) => toAsciiDigits(raw).replace(DIGITS_ONLY, '').slice(0, length);\n\nfunction InputOtp({\n\tlength = 6,\n\tvalue,\n\tdefaultValue = '',\n\tonChange,\n\tonComplete,\n\tisDisabled = false,\n\tisInvalid = false,\n\tgroupEvery,\n\tsize = 'default',\n\t'aria-label': ariaLabel = 'One-time code',\n\t'aria-describedby': ariaDescribedBy,\n\tclassName,\n\tref,\n}: InputOtpProps) {\n\tconst inputRef = useRef<HTMLInputElement>(null);\n\tconst previousSelection = useRef<[number | null, number | null, SelectionDirection]>([null, null, 'none']);\n\tconst wasInvalid = useRef(isInvalid);\n\tconst [rowRef, animate] = useAnimate<HTMLDivElement>();\n\tconst reduceMotion = useReducedMotion();\n\tconst [internal, setInternal] = useState(() => toCode(defaultValue, length));\n\tconst [isFocused, setIsFocused] = useState(false);\n\tconst [selection, setSelection] = useState<SlotSelection | null>(null);\n\n\tconst controlled = value !== undefined;\n\tconst code = toCode(controlled ? value : internal, length);\n\n\tconst mirror = (start: number, end: number) =>\n\t\tsetSelection((current) => (current?.start === start && current.end === end ? current : { start, end }));\n\n\tconst commit = (next: string) => {\n\t\tif (next === code) return;\n\t\tif (!controlled) setInternal(next);\n\t\tonChange?.(next);\n\t\t// Comparing against the previous code keeps a re-render or an identical paste from verifying twice, while\n\t\t// correcting one digit of a full code still counts as a new attempt.\n\t\tif (next.length === length) onComplete?.(next);\n\t};\n\n\tuseEffect(() => {\n\t\tconst input = inputRef.current;\n\t\tif (!input) return;\n\n\t\t// The native caret only ever sits between characters. Over a slot, that reads as nothing being selected, so\n\t\t// a collapsed caret inside a full run is widened to select the digit after it (or before it, when moving left).\n\t\tconst syncSelection = () => {\n\t\t\tif (document.activeElement !== input) {\n\t\t\t\tsetSelection(null);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst { selectionStart, selectionEnd, selectionDirection, maxLength, value: current } = input;\n\t\t\tconst [, previousEnd] = previousSelection.current;\n\t\t\tlet start = -1;\n\t\t\tlet end = -1;\n\t\t\tlet direction: SelectionDirection | undefined;\n\n\t\t\tif (current.length !== 0 && selectionStart !== null && selectionEnd !== null) {\n\t\t\t\tconst isCaret = selectionStart === selectionEnd;\n\t\t\t\tconst isAppending = selectionStart === current.length && current.length < maxLength;\n\t\t\t\tif (isCaret && !isAppending) {\n\t\t\t\t\tconst caret = selectionStart;\n\t\t\t\t\tif (caret === 0) {\n\t\t\t\t\t\t[start, end, direction] = [0, 1, 'forward'];\n\t\t\t\t\t} else if (caret === maxLength) {\n\t\t\t\t\t\t[start, end, direction] = [caret - 1, caret, 'backward'];\n\t\t\t\t\t} else if (maxLength > 1 && current.length > 1) {\n\t\t\t\t\t\tlet offset = 0;\n\t\t\t\t\t\tconst [previousStart] = previousSelection.current;\n\t\t\t\t\t\tif (previousStart !== null && previousEnd !== null) {\n\t\t\t\t\t\t\tdirection = caret < previousEnd ? 'backward' : 'forward';\n\t\t\t\t\t\t\tconst wasAppending = previousStart === previousEnd && previousStart < maxLength;\n\t\t\t\t\t\t\tif (direction === 'backward' && !wasAppending) offset = -1;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tstart = caret + offset;\n\t\t\t\t\t\tend = caret + offset + 1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (start !== -1 && end !== -1 && start !== end) input.setSelectionRange(start, end, direction);\n\t\t\t}\n\n\t\t\tconst nextStart = start !== -1 ? start : (selectionStart ?? 0);\n\t\t\tconst nextEnd = end !== -1 ? end : (selectionEnd ?? 0);\n\t\t\tmirror(nextStart, nextEnd);\n\t\t\tpreviousSelection.current = [nextStart, nextEnd, direction ?? selectionDirection ?? 'none'];\n\t\t};\n\n\t\tdocument.addEventListener('selectionchange', syncSelection, { capture: true });\n\t\tsyncSelection();\n\t\tif (document.activeElement === input) setIsFocused(true);\n\t\treturn () => document.removeEventListener('selectionchange', syncSelection, { capture: true });\n\t}, []);\n\n\tuseEffect(() => {\n\t\tconst timeouts = RESYNC_DELAYS.map((delay) =>\n\t\t\tsetTimeout(() => {\n\t\t\t\tconst input = inputRef.current;\n\t\t\t\tif (!input) return;\n\t\t\t\t// A non-bubbling `input` event clears Chrome's `:autofill` state without reaching React's onChange.\n\t\t\t\tinput.dispatchEvent(new Event('input'));\n\t\t\t\tif (document.activeElement !== input || input.selectionStart === null || input.selectionEnd === null) return;\n\t\t\t\tmirror(input.selectionStart, input.selectionEnd);\n\t\t\t\tpreviousSelection.current = [input.selectionStart, input.selectionEnd, input.selectionDirection ?? 'none'];\n\t\t\t}, delay),\n\t\t);\n\t\treturn () => timeouts.forEach(clearTimeout);\n\t}, [code, isFocused]);\n\n\tuseEffect(() => {\n\t\tconst turnedInvalid = isInvalid && !wasInvalid.current;\n\t\twasInvalid.current = isInvalid;\n\t\tif (!turnedInvalid || reduceMotion || !rowRef.current) return;\n\t\tanimate(rowRef.current, { x: [0, -6, 6, -4, 4, -2, 0] }, { duration: 0.4, ease: 'easeInOut' });\n\t}, [isInvalid, reduceMotion, animate, rowRef]);\n\n\tconst onInputChange = (event: ChangeEvent<HTMLInputElement>) => {\n\t\tconst next = toCode(event.target.value, length);\n\t\t// Deleting doesn't fire `selectionchange`, so the mirror is nudged by hand.\n\t\tif (next.length < code.length) document.dispatchEvent(new Event('selectionchange'));\n\t\tcommit(next);\n\t};\n\n\tconst onPaste = (event: ClipboardEvent<HTMLInputElement>) => {\n\t\t// Always handled here: a native paste of \"123 456\" would be cut to `maxLength` before the spaces were dropped,\n\t\t// and iOS pastes over the whole field rather than at the caret.\n\t\tevent.preventDefault();\n\t\tconst input = event.currentTarget;\n\t\tconst pasted = toAsciiDigits(event.clipboardData.getData('text/plain')).replace(DIGITS_ONLY, '');\n\t\tif (pasted === '') return;\n\t\tconst start = input.selectionStart ?? code.length;\n\t\tconst end = input.selectionEnd ?? start;\n\t\t// A complete code replaces the value even when the caret is mid-way; it's an autofill or a copied message.\n\t\tconst next =\n\t\t\tpasted.length >= length ? pasted.slice(0, length) : (code.slice(0, start) + pasted + code.slice(end)).slice(0, length);\n\t\tinput.value = next;\n\t\tcommit(next);\n\t\tconst caret = Math.min(next.length, length - 1);\n\t\tinput.setSelectionRange(caret, next.length);\n\t\tmirror(caret, next.length);\n\t};\n\n\tconst onFocus = (event: FocusEvent<HTMLInputElement>) => {\n\t\t// Focus lands on the first empty slot, or selects the last digit of a full code so typing replaces it.\n\t\tconst input = event.currentTarget;\n\t\tconst start = Math.min(input.value.length, length - 1);\n\t\tinput.setSelectionRange(start, input.value.length);\n\t\tmirror(start, input.value.length);\n\t\tsetIsFocused(true);\n\t};\n\n\tconst isSlotActive = (index: number) =>\n\t\tisFocused &&\n\t\tselection !== null &&\n\t\t(selection.start === selection.end ? index === selection.start : index >= selection.start && index < selection.end);\n\tconst isRange = selection !== null && selection.end - selection.start > 1;\n\n\treturn (\n\t\t<div\n\t\t\tref={ref}\n\t\t\tdata-slot=\"input-otp\"\n\t\t\tdata-size={size}\n\t\t\t// Chrome Translate wraps text nodes in <font>, which breaks React's next update; a code is never translatable.\n\t\t\ttranslate=\"no\"\n\t\t\t// Digits read left to right in every script, so the row, the caret mirror, and the slot order stay LTR in RTL pages.\n\t\t\tdir=\"ltr\"\n\t\t\tclassName={cn('w-full', size === 'sm' ? 'max-w-[15.5rem]' : 'max-w-[21rem]', className)}\n\t\t>\n\t\t\t<div\n\t\t\t\tref={rowRef}\n\t\t\t\t// Gaps are a share of the row, not rem, so they cannot eat the slots when the root font size is raised.\n\t\t\t\tclassName={cn(\n\t\t\t\t\t'group/otp relative flex w-full items-center',\n\t\t\t\t\tsize === 'sm' ? 'gap-[min(0.375rem,2.5%)]' : 'gap-[min(0.25rem,2.5%)] sm:gap-[min(0.5rem,2.5%)]',\n\t\t\t\t)}\n\t\t\t>\n\t\t\t\t{Array.from({ length }, (_, index) => {\n\t\t\t\t\tconst digit = code[index];\n\t\t\t\t\tconst isActive = isSlotActive(index);\n\t\t\t\t\tconst gapBefore = groupEvery !== undefined && index > 0 && index % groupEvery === 0;\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tkey={index}\n\t\t\t\t\t\t\taria-hidden\n\t\t\t\t\t\t\tdata-slot=\"input-otp-slot\"\n\t\t\t\t\t\t\tdata-active={isActive || undefined}\n\t\t\t\t\t\t\t// The single active slot is what the gliding ring tracks; a range is shown by the slots themselves.\n\t\t\t\t\t\t\tdata-highlighted={(isActive && !isRange) || undefined}\n\t\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t\t'relative flex min-w-0 flex-1 items-center justify-center overflow-hidden font-mono tabular-nums',\n\t\t\t\t\t\t\t\tsize === 'sm' ? 'h-9 max-w-9 rounded-md text-base' : 'h-11 max-w-10 rounded-lg text-lg sm:h-12 sm:max-w-12',\n\t\t\t\t\t\t\t\tgapBefore &&\n\t\t\t\t\t\t\t\t\t(size === 'sm' ? 'ms-[min(0.375rem,2.5%)]' : 'ms-[min(0.25rem,2.5%)] sm:ms-[min(0.5rem,2.5%)]'),\n\t\t\t\t\t\t\t\t'border border-input bg-background text-foreground shadow-xs dark:bg-input/32',\n\t\t\t\t\t\t\t\t'transition-[background-color,border-color] duration-150 ease-out motion-reduce:transition-none',\n\t\t\t\t\t\t\t\t!isDisabled && 'group-hover/otp:border-ring/50',\n\t\t\t\t\t\t\t\tisActive && isRange && 'bg-accent',\n\t\t\t\t\t\t\t\t// Keep the invalid state visible without relying on tint alone.\n\t\t\t\t\t\t\t\tisInvalid && 'border-destructive bg-destructive/5 text-destructive group-hover/otp:border-destructive',\n\t\t\t\t\t\t\t\tisDisabled && 'bg-muted text-muted-foreground shadow-none',\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{digit !== undefined && (\n\t\t\t\t\t\t\t\t// Keyed on the digit so each new one replays the rise, including a correction in place.\n\t\t\t\t\t\t\t\t<span\n\t\t\t\t\t\t\t\t\tkey={digit}\n\t\t\t\t\t\t\t\t\tclassName=\"inline-block transition-[translate,opacity] duration-150 ease-out starting:translate-y-2 starting:opacity-0 motion-reduce:transition-none\"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{digit}\n\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t{isActive && digit === undefined && (\n\t\t\t\t\t\t\t\t// The real caret is transparent, so the empty active slot draws its own.\n\t\t\t\t\t\t\t\t<motion.span\n\t\t\t\t\t\t\t\t\tclassName={cn('pointer-events-none absolute w-px bg-foreground', size === 'sm' ? 'h-4' : 'h-5')}\n\t\t\t\t\t\t\t\t\tanimate={reduceMotion ? undefined : CARET_BLINK}\n\t\t\t\t\t\t\t\t\ttransition={CARET_TIMING}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t);\n\t\t\t\t})}\n\t\t\t\t<FluidHighlight\n\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t'z-10 border bg-transparent',\n\t\t\t\t\t\tsize === 'sm' ? 'rounded-md' : 'rounded-lg',\n\t\t\t\t\t\tisInvalid ? 'border-destructive ring-[3px] ring-destructive/25' : 'border-ring/60 ring-[3px] ring-ring/35',\n\t\t\t\t\t)}\n\t\t\t\t/>\n\t\t\t\t<input\n\t\t\t\t\tref={inputRef}\n\t\t\t\t\t// `text` with a numeric mode rather than `number`: a number input brings spinners, accepts `e`\n\t\t\t\t\t// and `-`, and reports an empty value for anything it considers malformed.\n\t\t\t\t\ttype=\"text\"\n\t\t\t\t\tinputMode=\"numeric\"\n\t\t\t\t\tautoComplete=\"one-time-code\"\n\t\t\t\t\tspellCheck={false}\n\t\t\t\t\tmaxLength={length}\n\t\t\t\t\tdisabled={isDisabled}\n\t\t\t\t\taria-label={ariaLabel}\n\t\t\t\t\taria-describedby={ariaDescribedBy}\n\t\t\t\t\taria-invalid={isInvalid || undefined}\n\t\t\t\t\tdata-slot=\"input-otp-input\"\n\t\t\t\t\tvalue={code}\n\t\t\t\t\tonChange={onInputChange}\n\t\t\t\t\tonPaste={onPaste}\n\t\t\t\t\tonFocus={onFocus}\n\t\t\t\t\tonBlur={() => setIsFocused(false)}\n\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t// Present and hit-testable over the whole row, but invisible: transparent ink rather than opacity,\n\t\t\t\t\t\t// because iOS only offers paste on a press-and-hold over a visible field.\n\t\t\t\t\t\t'absolute inset-0 z-20 size-full cursor-text appearance-none border-0 bg-transparent p-0 font-mono leading-none',\n\t\t\t\t\t\t'text-transparent caret-transparent tracking-[-0.5em] tabular-nums shadow-none outline-none',\n\t\t\t\t\t\t// A font as tall as the row keeps every glyph under the slots, so a tap anywhere lands in the field.\n\t\t\t\t\t\tsize === 'sm' ? 'text-[36px]' : 'text-[44px] sm:text-[48px]',\n\t\t\t\t\t\t'selection:bg-transparent selection:text-transparent',\n\t\t\t\t\t\t'autofill:opacity-0! autofill:shadow-none! autofill:[-webkit-text-fill-color:transparent]!',\n\t\t\t\t\t\t// iOS lays the glyphs out wider and leaks the caret at the edge; squeeze them back under the slots.\n\t\t\t\t\t\t'supports-[-webkit-touch-callout:none]:-left-px supports-[-webkit-touch-callout:none]:right-px',\n\t\t\t\t\t\t'supports-[-webkit-touch-callout:none]:font-thin supports-[-webkit-touch-callout:none]:tracking-[-0.6em]',\n\t\t\t\t\t\t'disabled:cursor-not-allowed',\n\t\t\t\t\t)}\n\t\t\t\t/>\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n\nexport { InputOtp };\nexport type { InputOtpProps };\n"],"mappings":";;;;;;;;;AAsDA,MAAM,cAAc;AAGpB,MAAM,mBAAmB;AACzB,MAAM,mBAAmB;CAAC;CAAQ;CAAQ;CAAQ;CAAQ;CAAQ;AAAM;AACxE,MAAM,iBAAiB,QACtB,IAAI,QAAQ,mBAAmB,SAAS;CACvC,MAAM,OAAO,KAAK,WAAW,CAAC;CAC9B,MAAM,OAAO,iBAAiB,MAAM,UAAU,QAAQ,SAAS,QAAQ,QAAQ,CAAC;CAChF,OAAO,OAAO,OAAO,IAAI;AAC1B,CAAC;AAEF,MAAM,gBAAgB;CAAC;CAAG;CAAI;AAAE;AAEhC,MAAM,cAAc,EAAE,SAAS;CAAC;CAAG;CAAG;CAAG;AAAC,EAAE;AAC5C,MAAM,eAA2B;CAAE,UAAU;CAAG,OAAO;EAAC;EAAG;EAAK;EAAK;CAAC;CAAG,MAAM;CAAU,QAAQ;AAAS;AAE1G,MAAM,UAAU,KAAa,WAAmB,cAAc,GAAG,CAAC,CAAC,QAAQ,aAAa,EAAE,CAAC,CAAC,MAAM,GAAG,MAAM;AAE3G,SAAS,SAAS,EACjB,SAAS,GACT,OACA,eAAe,IACf,UACA,YACA,aAAa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AAC,gBAAD,EACC,WAAW,GACV,8BACA,SAAS,OAAO,eAAe,cAC/B,YAAY,sDAAsD,wCACnE,EACA;IACD,oBAAC,SAAD;KACC,KAAK;KAGL,MAAK;KACL,WAAU;KACV,cAAa;KACb,YAAY;KACZ,WAAW;KACX,UAAU;KACV,cAAY;KACZ,oBAAkB;KAClB,gBAAc,aAAa;KAC3B,aAAU;KACV,OAAO;KACP,UAAU;KACD;KACA;KACT,cAAc,aAAa,KAAK;KAChC,WAAW,GAGV,kHACA,8FAEA,SAAS,OAAO,gBAAgB,8BAChC,uDACA,6FAEA,iGACA,2GACA,6BACD;IACA;GACG;;CACD;AAEP"}
1
+ {"version":3,"file":"input-otp.js","names":[],"sources":["../../src/components/input-otp.tsx"],"sourcesContent":["'use client';\n\nimport { useEffect, useRef, useState, type ChangeEvent, type ClipboardEvent, type FocusEvent, type Ref } from 'react';\nimport { motion, useAnimate, useReducedMotion, type Transition } from 'motion/react';\n\nimport { FluidHighlight } from '../lib/motion/fluid-highlight';\nimport { cn } from '../lib/utils';\n\n/**\n * One-time-code input: one slot per digit, side by side.\n *\n * The slots are drawn, not typed into. A single transparent `<input>` lies over the whole row and owns the value,\n * the caret, and the selection; the slots mirror it. That one-field model is what makes the code behave like text:\n *\n * type fills the selected slot and moves on\n * Backspace deletes like any text field; later digits close the gap\n * ⌘A / Shift selects across slots, so cut, copy, and paste work on the whole code or a slice of it\n * paste strips separators and inserts at the caret; a complete code replaces the value outright\n * autofill the OS hands the whole code to the one field, which is all `autoComplete=\"one-time-code\"` needs\n *\n * It also means one tab stop and one labelled field for assistive tech, rather than six \"digit N\" boxes.\n *\n * Because the real glyphs and caret are transparent, the slots can animate what the user sees: digits rise into\n * place, a drawn caret blinks in the empty active slot, the focus ring glides between slots, and the row shakes\n * once when the code turns invalid. All of it stands still under reduced motion.\n */\ninterface InputOtpProps {\n\t/** Number of digit slots. */\n\tlength?: number;\n\t/** Controlled value. Non-digits are dropped and longer strings are truncated to `length`. */\n\tvalue?: string;\n\tdefaultValue?: string;\n\tonChange?: (value: string) => void;\n\t/** Fires when an edit leaves every slot filled with a code that differs from the previous one. */\n\tonComplete?: (value: string) => void;\n\tisDisabled?: boolean;\n\tisInvalid?: boolean;\n\t/** Renders a gap between groups, e.g. `3` gives 000 000. */\n\tgroupEvery?: number;\n\t/** `sm` fits the code into an inline row (e.g. a settings list) instead of a dialog. */\n\tsize?: 'default' | 'sm';\n\t'aria-label'?: string;\n\t'aria-describedby'?: string;\n\tclassName?: string;\n\tref?: Ref<HTMLDivElement>;\n}\n\ninterface SlotSelection {\n\tstart: number;\n\tend: number;\n}\n\ntype SelectionDirection = 'forward' | 'backward' | 'none';\n\nconst DIGITS_ONLY = /\\D/g;\n// Arabic-Indic, Persian, Devanagari, Bengali, Thai and full-width digits come from native numeric keyboards and IMEs.\n// They map to ASCII before everything else is dropped, so a code typed or pasted in them is not silently discarded.\nconst NON_ASCII_DIGITS = /[\\u0660-\\u0669\\u06F0-\\u06F9\\u0966-\\u096F\\u09E6-\\u09EF\\u0E50-\\u0E59\\uFF10-\\uFF19]/g;\nconst ZERO_CODE_POINTS = [0x0660, 0x06f0, 0x0966, 0x09e6, 0x0e50, 0xff10];\nconst toAsciiDigits = (raw: string) =>\n\traw.replace(NON_ASCII_DIGITS, (char) => {\n\t\tconst code = char.charCodeAt(0);\n\t\tconst zero = ZERO_CODE_POINTS.find((start) => code >= start && code <= start + 9)!;\n\t\treturn String(code - zero);\n\t});\n// Chrome restores autofill styling and the caret position a beat after a value change, so the mirror re-reads them.\nconst RESYNC_DELAYS = [0, 10, 50];\n// A hard on/off blink, like a text caret, rather than a fade.\nconst CARET_BLINK = { opacity: [1, 1, 0, 0] };\nconst CARET_TIMING: Transition = { duration: 1, times: [0, 0.5, 0.5, 1], ease: 'linear', repeat: Infinity };\n\nconst toCode = (raw: string, length: number) => toAsciiDigits(raw).replace(DIGITS_ONLY, '').slice(0, length);\n\nfunction InputOtp({\n\tlength = 6,\n\tvalue,\n\tdefaultValue = '',\n\tonChange,\n\tonComplete,\n\tisDisabled = false,\n\tisInvalid = false,\n\tgroupEvery,\n\tsize = 'default',\n\t'aria-label': ariaLabel = 'One-time code',\n\t'aria-describedby': ariaDescribedBy,\n\tclassName,\n\tref,\n}: InputOtpProps) {\n\tconst inputRef = useRef<HTMLInputElement>(null);\n\tconst previousSelection = useRef<[number | null, number | null, SelectionDirection]>([null, null, 'none']);\n\tconst wasInvalid = useRef(isInvalid);\n\tconst [rowRef, animate] = useAnimate<HTMLDivElement>();\n\tconst reduceMotion = useReducedMotion();\n\tconst [internal, setInternal] = useState(() => toCode(defaultValue, length));\n\tconst [isFocused, setIsFocused] = useState(false);\n\tconst [selection, setSelection] = useState<SlotSelection | null>(null);\n\n\tconst controlled = value !== undefined;\n\tconst code = toCode(controlled ? value : internal, length);\n\n\tconst mirror = (start: number, end: number) =>\n\t\tsetSelection((current) => (current?.start === start && current.end === end ? current : { start, end }));\n\n\tconst commit = (next: string) => {\n\t\tif (next === code) return;\n\t\tif (!controlled) setInternal(next);\n\t\tonChange?.(next);\n\t\t// Comparing against the previous code keeps a re-render or an identical paste from verifying twice, while\n\t\t// correcting one digit of a full code still counts as a new attempt.\n\t\tif (next.length === length) onComplete?.(next);\n\t};\n\n\tuseEffect(() => {\n\t\tconst input = inputRef.current;\n\t\tif (!input) return;\n\n\t\t// The native caret only ever sits between characters. Over a slot, that reads as nothing being selected, so\n\t\t// a collapsed caret inside a full run is widened to select the digit after it (or before it, when moving left).\n\t\tconst syncSelection = () => {\n\t\t\tif (document.activeElement !== input) {\n\t\t\t\tsetSelection(null);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst { selectionStart, selectionEnd, selectionDirection, maxLength, value: current } = input;\n\t\t\tconst [, previousEnd] = previousSelection.current;\n\t\t\tlet start = -1;\n\t\t\tlet end = -1;\n\t\t\tlet direction: SelectionDirection | undefined;\n\n\t\t\tif (current.length !== 0 && selectionStart !== null && selectionEnd !== null) {\n\t\t\t\tconst isCaret = selectionStart === selectionEnd;\n\t\t\t\tconst isAppending = selectionStart === current.length && current.length < maxLength;\n\t\t\t\tif (isCaret && !isAppending) {\n\t\t\t\t\tconst caret = selectionStart;\n\t\t\t\t\tif (caret === 0) {\n\t\t\t\t\t\t[start, end, direction] = [0, 1, 'forward'];\n\t\t\t\t\t} else if (caret === maxLength) {\n\t\t\t\t\t\t[start, end, direction] = [caret - 1, caret, 'backward'];\n\t\t\t\t\t} else if (maxLength > 1 && current.length > 1) {\n\t\t\t\t\t\tlet offset = 0;\n\t\t\t\t\t\tconst [previousStart] = previousSelection.current;\n\t\t\t\t\t\tif (previousStart !== null && previousEnd !== null) {\n\t\t\t\t\t\t\tdirection = caret < previousEnd ? 'backward' : 'forward';\n\t\t\t\t\t\t\tconst wasAppending = previousStart === previousEnd && previousStart < maxLength;\n\t\t\t\t\t\t\tif (direction === 'backward' && !wasAppending) offset = -1;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tstart = caret + offset;\n\t\t\t\t\t\tend = caret + offset + 1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (start !== -1 && end !== -1 && start !== end) input.setSelectionRange(start, end, direction);\n\t\t\t}\n\n\t\t\tconst nextStart = start !== -1 ? start : (selectionStart ?? 0);\n\t\t\tconst nextEnd = end !== -1 ? end : (selectionEnd ?? 0);\n\t\t\tmirror(nextStart, nextEnd);\n\t\t\tpreviousSelection.current = [nextStart, nextEnd, direction ?? selectionDirection ?? 'none'];\n\t\t};\n\n\t\tdocument.addEventListener('selectionchange', syncSelection, { capture: true });\n\t\tsyncSelection();\n\t\tif (document.activeElement === input) setIsFocused(true);\n\t\treturn () => document.removeEventListener('selectionchange', syncSelection, { capture: true });\n\t}, []);\n\n\tuseEffect(() => {\n\t\tconst timeouts = RESYNC_DELAYS.map((delay) =>\n\t\t\tsetTimeout(() => {\n\t\t\t\tconst input = inputRef.current;\n\t\t\t\tif (!input) return;\n\t\t\t\t// A non-bubbling `input` event clears Chrome's `:autofill` state without reaching React's onChange.\n\t\t\t\tinput.dispatchEvent(new Event('input'));\n\t\t\t\tif (document.activeElement !== input || input.selectionStart === null || input.selectionEnd === null) return;\n\t\t\t\tmirror(input.selectionStart, input.selectionEnd);\n\t\t\t\tpreviousSelection.current = [input.selectionStart, input.selectionEnd, input.selectionDirection ?? 'none'];\n\t\t\t}, delay),\n\t\t);\n\t\treturn () => timeouts.forEach(clearTimeout);\n\t}, [code, isFocused]);\n\n\tuseEffect(() => {\n\t\tconst turnedInvalid = isInvalid && !wasInvalid.current;\n\t\twasInvalid.current = isInvalid;\n\t\tif (!turnedInvalid || reduceMotion || !rowRef.current) return;\n\t\tanimate(rowRef.current, { x: [0, -6, 6, -4, 4, -2, 0] }, { duration: 0.4, ease: 'easeInOut' });\n\t}, [isInvalid, reduceMotion, animate, rowRef]);\n\n\tconst onInputChange = (event: ChangeEvent<HTMLInputElement>) => {\n\t\tconst next = toCode(event.target.value, length);\n\t\t// Deleting doesn't fire `selectionchange`, so the mirror is nudged by hand.\n\t\tif (next.length < code.length) document.dispatchEvent(new Event('selectionchange'));\n\t\tcommit(next);\n\t};\n\n\tconst onPaste = (event: ClipboardEvent<HTMLInputElement>) => {\n\t\t// Always handled here: a native paste of \"123 456\" would be cut to `maxLength` before the spaces were dropped,\n\t\t// and iOS pastes over the whole field rather than at the caret.\n\t\tevent.preventDefault();\n\t\tconst input = event.currentTarget;\n\t\tconst pasted = toAsciiDigits(event.clipboardData.getData('text/plain')).replace(DIGITS_ONLY, '');\n\t\tif (pasted === '') return;\n\t\tconst start = input.selectionStart ?? code.length;\n\t\tconst end = input.selectionEnd ?? start;\n\t\t// A complete code replaces the value even when the caret is mid-way; it's an autofill or a copied message.\n\t\tconst next =\n\t\t\tpasted.length >= length ? pasted.slice(0, length) : (code.slice(0, start) + pasted + code.slice(end)).slice(0, length);\n\t\tinput.value = next;\n\t\tcommit(next);\n\t\tconst caret = Math.min(next.length, length - 1);\n\t\tinput.setSelectionRange(caret, next.length);\n\t\tmirror(caret, next.length);\n\t};\n\n\tconst onFocus = (event: FocusEvent<HTMLInputElement>) => {\n\t\t// Focus lands on the first empty slot, or selects the last digit of a full code so typing replaces it.\n\t\tconst input = event.currentTarget;\n\t\tconst start = Math.min(input.value.length, length - 1);\n\t\tinput.setSelectionRange(start, input.value.length);\n\t\tmirror(start, input.value.length);\n\t\tsetIsFocused(true);\n\t};\n\n\tconst isSlotActive = (index: number) =>\n\t\tisFocused &&\n\t\tselection !== null &&\n\t\t(selection.start === selection.end ? index === selection.start : index >= selection.start && index < selection.end);\n\tconst isRange = selection !== null && selection.end - selection.start > 1;\n\n\treturn (\n\t\t<div\n\t\t\tref={ref}\n\t\t\tdata-slot=\"input-otp\"\n\t\t\tdata-size={size}\n\t\t\t// Chrome Translate wraps text nodes in <font>, which breaks React's next update; a code is never translatable.\n\t\t\ttranslate=\"no\"\n\t\t\t// Digits read left to right in every script, so the row, the caret mirror, and the slot order stay LTR in RTL pages.\n\t\t\tdir=\"ltr\"\n\t\t\tclassName={cn('w-full', size === 'sm' ? 'max-w-[15.5rem]' : 'max-w-[21rem]', className)}\n\t\t>\n\t\t\t<div\n\t\t\t\tref={rowRef}\n\t\t\t\t// Gaps are a share of the row, not rem, so they cannot eat the slots when the root font size is raised.\n\t\t\t\tclassName={cn(\n\t\t\t\t\t'group/otp relative flex w-full items-center',\n\t\t\t\t\tsize === 'sm' ? 'gap-[min(0.375rem,2.5%)]' : 'gap-[min(0.25rem,2.5%)] sm:gap-[min(0.5rem,2.5%)]',\n\t\t\t\t)}\n\t\t\t>\n\t\t\t\t{Array.from({ length }, (_, index) => {\n\t\t\t\t\tconst digit = code[index];\n\t\t\t\t\tconst isActive = isSlotActive(index);\n\t\t\t\t\tconst gapBefore = groupEvery !== undefined && index > 0 && index % groupEvery === 0;\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tkey={index}\n\t\t\t\t\t\t\taria-hidden\n\t\t\t\t\t\t\tdata-slot=\"input-otp-slot\"\n\t\t\t\t\t\t\tdata-active={isActive || undefined}\n\t\t\t\t\t\t\t// The single active slot is what the gliding ring tracks; a range is shown by the slots themselves.\n\t\t\t\t\t\t\tdata-highlighted={(isActive && !isRange) || undefined}\n\t\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t\t'relative flex min-w-0 flex-1 items-center justify-center overflow-hidden font-mono tabular-nums',\n\t\t\t\t\t\t\t\tsize === 'sm' ? 'h-9 max-w-9 rounded-md text-base' : 'h-11 max-w-10 rounded-lg text-lg sm:h-12 sm:max-w-12',\n\t\t\t\t\t\t\t\tgapBefore &&\n\t\t\t\t\t\t\t\t\t(size === 'sm' ? 'ms-[min(0.375rem,2.5%)]' : 'ms-[min(0.25rem,2.5%)] sm:ms-[min(0.5rem,2.5%)]'),\n\t\t\t\t\t\t\t\t'border border-input bg-background text-foreground shadow-xs dark:bg-input/32',\n\t\t\t\t\t\t\t\t'transition-[background-color,border-color] duration-150 ease-out motion-reduce:transition-none',\n\t\t\t\t\t\t\t\t!isDisabled && 'group-hover/otp:border-ring/50',\n\t\t\t\t\t\t\t\tisActive && isRange && 'bg-accent',\n\t\t\t\t\t\t\t\t// Keep the invalid state visible without relying on tint alone.\n\t\t\t\t\t\t\t\tisInvalid && 'border-destructive bg-destructive/5 text-destructive group-hover/otp:border-destructive',\n\t\t\t\t\t\t\t\tisDisabled && 'bg-muted text-muted-foreground shadow-none',\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{digit !== undefined && (\n\t\t\t\t\t\t\t\t// Keyed on the digit so each new one replays the rise, including a correction in place.\n\t\t\t\t\t\t\t\t<span\n\t\t\t\t\t\t\t\t\tkey={digit}\n\t\t\t\t\t\t\t\t\tclassName=\"inline-block transition-[translate,opacity] duration-150 ease-out starting:translate-y-2 starting:opacity-0 motion-reduce:transition-none\"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{digit}\n\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t{isActive && digit === undefined && (\n\t\t\t\t\t\t\t\t// The real caret is transparent, so the empty active slot draws its own.\n\t\t\t\t\t\t\t\t<motion.span\n\t\t\t\t\t\t\t\t\tclassName={cn('pointer-events-none absolute w-px bg-foreground', size === 'sm' ? 'h-4' : 'h-5')}\n\t\t\t\t\t\t\t\t\tanimate={reduceMotion ? undefined : CARET_BLINK}\n\t\t\t\t\t\t\t\t\ttransition={CARET_TIMING}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t);\n\t\t\t\t})}\n\t\t\t\t<FluidHighlight\n\t\t\t\t\ttravel\n\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t'z-10 border bg-transparent',\n\t\t\t\t\t\tsize === 'sm' ? 'rounded-md' : 'rounded-lg',\n\t\t\t\t\t\tisInvalid ? 'border-destructive ring-[3px] ring-destructive/25' : 'border-ring/60 ring-[3px] ring-ring/35',\n\t\t\t\t\t)}\n\t\t\t\t/>\n\t\t\t\t<input\n\t\t\t\t\tref={inputRef}\n\t\t\t\t\t// `text` with a numeric mode rather than `number`: a number input brings spinners, accepts `e`\n\t\t\t\t\t// and `-`, and reports an empty value for anything it considers malformed.\n\t\t\t\t\ttype=\"text\"\n\t\t\t\t\tinputMode=\"numeric\"\n\t\t\t\t\tautoComplete=\"one-time-code\"\n\t\t\t\t\tspellCheck={false}\n\t\t\t\t\tmaxLength={length}\n\t\t\t\t\tdisabled={isDisabled}\n\t\t\t\t\taria-label={ariaLabel}\n\t\t\t\t\taria-describedby={ariaDescribedBy}\n\t\t\t\t\taria-invalid={isInvalid || undefined}\n\t\t\t\t\tdata-slot=\"input-otp-input\"\n\t\t\t\t\tvalue={code}\n\t\t\t\t\tonChange={onInputChange}\n\t\t\t\t\tonPaste={onPaste}\n\t\t\t\t\tonFocus={onFocus}\n\t\t\t\t\tonBlur={() => setIsFocused(false)}\n\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t// Present and hit-testable over the whole row, but invisible: transparent ink rather than opacity,\n\t\t\t\t\t\t// because iOS only offers paste on a press-and-hold over a visible field.\n\t\t\t\t\t\t'absolute inset-0 z-20 size-full cursor-text appearance-none border-0 bg-transparent p-0 font-mono leading-none',\n\t\t\t\t\t\t'text-transparent caret-transparent tracking-[-0.5em] tabular-nums shadow-none outline-none',\n\t\t\t\t\t\t// A font as tall as the row keeps every glyph under the slots, so a tap anywhere lands in the field.\n\t\t\t\t\t\tsize === 'sm' ? 'text-[36px]' : 'text-[44px] sm:text-[48px]',\n\t\t\t\t\t\t'selection:bg-transparent selection:text-transparent',\n\t\t\t\t\t\t'autofill:opacity-0! autofill:shadow-none! autofill:[-webkit-text-fill-color:transparent]!',\n\t\t\t\t\t\t// iOS lays the glyphs out wider and leaks the caret at the edge; squeeze them back under the slots.\n\t\t\t\t\t\t'supports-[-webkit-touch-callout:none]:-left-px supports-[-webkit-touch-callout:none]:right-px',\n\t\t\t\t\t\t'supports-[-webkit-touch-callout:none]:font-thin supports-[-webkit-touch-callout:none]:tracking-[-0.6em]',\n\t\t\t\t\t\t'disabled:cursor-not-allowed',\n\t\t\t\t\t)}\n\t\t\t\t/>\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n\nexport { InputOtp };\nexport type { InputOtpProps };\n"],"mappings":";;;;;;;;;AAsDA,MAAM,cAAc;AAGpB,MAAM,mBAAmB;AACzB,MAAM,mBAAmB;CAAC;CAAQ;CAAQ;CAAQ;CAAQ;CAAQ;AAAM;AACxE,MAAM,iBAAiB,QACtB,IAAI,QAAQ,mBAAmB,SAAS;CACvC,MAAM,OAAO,KAAK,WAAW,CAAC;CAC9B,MAAM,OAAO,iBAAiB,MAAM,UAAU,QAAQ,SAAS,QAAQ,QAAQ,CAAC;CAChF,OAAO,OAAO,OAAO,IAAI;AAC1B,CAAC;AAEF,MAAM,gBAAgB;CAAC;CAAG;CAAI;AAAE;AAEhC,MAAM,cAAc,EA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ACA,kGACA,CAAC,cAAc,kCACf,YAAY,WAAW,aAEvB,aAAa,2FACb,cAAc,4CACf;gBAnBD,CAqBE,UAAU,UAEV,oBAAC,QAAD;OAEC,WAAU;iBAET;MACI,GAJA,KAIA,GAEN,YAAY,UAAU,UAEtB,oBAAC,OAAO,MAAR;OACC,WAAW,GAAG,mDAAmD,SAAS,OAAO,QAAQ,KAAK;OAC9F,SAAS,eAAe,SAAY;OACpC,YAAY;MACZ,EAEE;QArCC,KAqCD;IAEP,CAAC;IACD,oBAAC,gBAAD;KACC;KACA,WAAW,GACV,8BACA,SAAS,OAAO,eAAe,cAC/B,YAAY,sDAAsD,wCACnE;IACA;IACD,oBAAC,SAAD;KACC,KAAK;KAGL,MAAK;KACL,WAAU;KACV,cAAa;KACb,YAAY;KACZ,WAAW;KACX,UAAU;KACV,cAAY;KACZ,oBAAkB;KAClB,gBAAc,aAAa;KAC3B,aAAU;KACV,OAAO;KACP,UAAU;KACD;KACA;KACT,cAAc,aAAa,KAAK;KAChC,WAAW,GAGV,kHACA,8FAEA,SAAS,OAAO,gBAAgB,8BAChC,uDACA,6FAEA,iGACA,2GACA,6BACD;IACA;GACG;;CACD;AAEP"}
@@ -16,7 +16,7 @@ interface ItemProps extends React$1.HTMLAttributes<HTMLDivElement>, VariantProps
16
16
  }
17
17
  declare const Item: React$1.ForwardRefExoticComponent<ItemProps & React$1.RefAttributes<HTMLDivElement>>;
18
18
  declare const itemMediaVariants: (props?: ({
19
- variant?: "image" | "default" | "icon" | null | undefined;
19
+ variant?: "default" | "icon" | "image" | null | undefined;
20
20
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
21
21
  interface ItemMediaProps extends React$1.HTMLAttributes<HTMLDivElement>, VariantProps<typeof itemMediaVariants> {}
22
22
  declare function ItemMedia({ className, variant, ...props }: ItemMediaProps): React$1.JSX.Element;
@@ -16,7 +16,7 @@ interface ItemProps extends React$1.HTMLAttributes<HTMLDivElement>, VariantProps
16
16
  }
17
17
  declare const Item: React$1.ForwardRefExoticComponent<ItemProps & React$1.RefAttributes<HTMLDivElement>>;
18
18
  declare const itemMediaVariants: (props?: ({
19
- variant?: "image" | "default" | "icon" | null | undefined;
19
+ variant?: "default" | "icon" | "image" | null | undefined;
20
20
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
21
21
  interface ItemMediaProps extends React$1.HTMLAttributes<HTMLDivElement>, VariantProps<typeof itemMediaVariants> {}
22
22
  declare function ItemMedia({ className, variant, ...props }: ItemMediaProps): React$1.JSX.Element;
@@ -5,7 +5,7 @@ const require_rolldown_runtime = require('../rolldown-runtime-D_qnwXdH.cjs');
5
5
  const require_utils = require('../utils-CzTQ3-VI.cjs');
6
6
  const require_components_separator = require('./separator.cjs');
7
7
  const require_components_badge = require('./badge.cjs');
8
- const require_fluid_highlight = require('../fluid-highlight-YWFRZXsw.cjs');
8
+ const require_fluid_highlight = require('../fluid-highlight-B8olepSM.cjs');
9
9
  const require_components_popover = require('./popover.cjs');
10
10
  let react = require("react");
11
11
  react = require_rolldown_runtime.__toESM(react, 1);
@@ -3,7 +3,7 @@
3
3
  import { t as cn } from "../utils-BkMLyah9.js";
4
4
  import { Separator } from "./separator.js";
5
5
  import { Badge } from "./badge.js";
6
- import { t as FluidHighlight } from "../fluid-highlight-CNELHV8o.js";
6
+ import { t as FluidHighlight } from "../fluid-highlight-BXVfWNk9.js";
7
7
  import { Popover, PopoverContent, PopoverTrigger } from "./popover.js";
8
8
  import * as React$1 from "react";
9
9
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
4
  const require_rolldown_runtime = require('../rolldown-runtime-D_qnwXdH.cjs');
5
5
  const require_utils = require('../utils-CzTQ3-VI.cjs');
6
- const require_fluid_highlight = require('../fluid-highlight-YWFRZXsw.cjs');
6
+ const require_fluid_highlight = require('../fluid-highlight-B8olepSM.cjs');
7
7
  let react = require("react");
8
8
  react = require_rolldown_runtime.__toESM(react, 1);
9
9
  let react_jsx_runtime = require("react/jsx-runtime");
@@ -120,7 +120,7 @@ function SelectPopup({ className, children, sideOffset = 4, alignItemWithTrigger
120
120
  className: require_utils.cn("relative max-h-(--available-height) min-w-(--anchor-width) scroll-py-6 overflow-y-auto p-1 [&:not(:has([role=option]))>[data-slot=select-empty]]:block", className),
121
121
  "data-slot": "select-list",
122
122
  children: [
123
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_fluid_highlight.FluidHighlight, {}),
123
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_fluid_highlight.FluidHighlight, { className: "rounded-[calc(var(--radius-lg)-5px)]" }),
124
124
  children,
125
125
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
126
126
  className: "hidden px-2 py-1.5 text-center text-muted-foreground text-sm",
@@ -143,7 +143,7 @@ function SelectPopup({ className, children, sideOffset = 4, alignItemWithTrigger
143
143
  }
144
144
  function SelectItem({ className, children, ...props }) {
145
145
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_base_ui_react_select.Select.Item, {
146
- className: require_utils.cn("relative grid min-h-8 in-data-[side=none]:min-w-[calc(var(--anchor-width)+1.25rem)] cursor-default grid-cols-[1rem_minmax(0,1fr)] items-center gap-2 rounded-sm py-1 ps-2 pe-4 text-base outline-none pointer-coarse:min-h-11 sm:pointer-coarse:min-h-11 data-disabled:pointer-events-none data-highlighted:text-accent-foreground data-disabled:opacity-64 sm:min-h-7 sm:text-sm [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0", className),
146
+ className: require_utils.cn("relative grid min-h-8 in-data-[side=none]:min-w-[calc(var(--anchor-width)+1.25rem)] cursor-default grid-cols-[1rem_minmax(0,1fr)] items-center gap-2 rounded-[calc(var(--radius-lg)-5px)] py-1 ps-2 pe-4 text-base outline-none pointer-coarse:min-h-11 sm:pointer-coarse:min-h-11 data-disabled:pointer-events-none data-highlighted:text-accent-foreground data-disabled:opacity-64 sm:min-h-7 sm:text-sm [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0", className),
147
147
  "data-slot": "select-item",
148
148
  ...props,
149
149
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_base_ui_react_select.Select.ItemIndicator, {
@@ -189,7 +189,7 @@ function SelectGroupLabel({ ...props }) {
189
189
  }
190
190
  function SelectRichItem({ className, children, label, description, icon, ...props }) {
191
191
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_base_ui_react_select.Select.Item, {
192
- className: require_utils.cn("relative grid min-h-8 in-data-[side=none]:min-w-[calc(var(--anchor-width)+1.25rem)] cursor-default grid-cols-[1rem_minmax(0,1fr)] items-center gap-2 rounded-sm py-1.5 ps-2 pe-4 text-base outline-none pointer-coarse:min-h-11 sm:pointer-coarse:min-h-11 data-disabled:pointer-events-none data-highlighted:text-accent-foreground data-disabled:opacity-64 sm:min-h-7 sm:text-sm [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0", className),
192
+ className: require_utils.cn("relative grid min-h-8 in-data-[side=none]:min-w-[calc(var(--anchor-width)+1.25rem)] cursor-default grid-cols-[1rem_minmax(0,1fr)] items-center gap-2 rounded-[calc(var(--radius-lg)-5px)] py-1.5 ps-2 pe-4 text-base outline-none pointer-coarse:min-h-11 sm:pointer-coarse:min-h-11 data-disabled:pointer-events-none data-highlighted:text-accent-foreground data-disabled:opacity-64 sm:min-h-7 sm:text-sm [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0", className),
193
193
  "data-slot": "select-rich-item",
194
194
  ...props,
195
195
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_base_ui_react_select.Select.ItemIndicator, {
@@ -221,7 +221,7 @@ function SelectRichItem({ className, children, label, description, icon, ...prop
221
221
  }
222
222
  function SelectFieldItem({ className, name, type, ...props }) {
223
223
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_base_ui_react_select.Select.Item, {
224
- className: require_utils.cn("relative grid min-h-8 in-data-[side=none]:min-w-[calc(var(--anchor-width)+1.25rem)] cursor-default grid-cols-[1rem_minmax(0,1fr)] items-center gap-2 rounded-sm py-1 ps-2 pe-4 text-base outline-none pointer-coarse:min-h-11 sm:pointer-coarse:min-h-11 data-disabled:pointer-events-none data-highlighted:text-accent-foreground data-disabled:opacity-64 sm:min-h-7 sm:text-sm [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0", className),
224
+ className: require_utils.cn("relative grid min-h-8 in-data-[side=none]:min-w-[calc(var(--anchor-width)+1.25rem)] cursor-default grid-cols-[1rem_minmax(0,1fr)] items-center gap-2 rounded-[calc(var(--radius-lg)-5px)] py-1 ps-2 pe-4 text-base outline-none pointer-coarse:min-h-11 sm:pointer-coarse:min-h-11 data-disabled:pointer-events-none data-highlighted:text-accent-foreground data-disabled:opacity-64 sm:min-h-7 sm:text-sm [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0", className),
225
225
  "data-slot": "select-field-item",
226
226
  ...props,
227
227
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_base_ui_react_select.Select.ItemIndicator, {