reka-ui 2.1.0 → 2.2.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 (817) hide show
  1. package/README.md +1 -1
  2. package/dist/Accordion/AccordionContent.cjs +2 -1
  3. package/dist/Accordion/AccordionContent.cjs.map +1 -1
  4. package/dist/Accordion/AccordionContent.js +3 -2
  5. package/dist/Accordion/AccordionContent.js.map +1 -1
  6. package/dist/Accordion/AccordionHeader.js +1 -1
  7. package/dist/Accordion/AccordionItem.cjs +2 -2
  8. package/dist/Accordion/AccordionItem.cjs.map +1 -1
  9. package/dist/Accordion/AccordionItem.js +3 -3
  10. package/dist/Accordion/AccordionItem.js.map +1 -1
  11. package/dist/Accordion/AccordionRoot.cjs +1 -1
  12. package/dist/Accordion/AccordionRoot.js +2 -2
  13. package/dist/Accordion/AccordionTrigger.cjs +2 -2
  14. package/dist/Accordion/AccordionTrigger.cjs.map +1 -1
  15. package/dist/Accordion/AccordionTrigger.js +3 -3
  16. package/dist/Accordion/AccordionTrigger.js.map +1 -1
  17. package/dist/AlertDialog/AlertDialogAction.js +1 -1
  18. package/dist/AlertDialog/AlertDialogCancel.js +1 -1
  19. package/dist/AlertDialog/AlertDialogContent.cjs +1 -1
  20. package/dist/AlertDialog/AlertDialogContent.js +2 -2
  21. package/dist/AlertDialog/AlertDialogDescription.js +1 -1
  22. package/dist/AlertDialog/AlertDialogOverlay.js +1 -1
  23. package/dist/AlertDialog/AlertDialogPortal.js +1 -1
  24. package/dist/AlertDialog/AlertDialogRoot.js +1 -1
  25. package/dist/AlertDialog/AlertDialogTitle.js +1 -1
  26. package/dist/AlertDialog/AlertDialogTrigger.js +1 -1
  27. package/dist/AspectRatio/AspectRatio.js +1 -1
  28. package/dist/Avatar/AvatarFallback.js +1 -1
  29. package/dist/Avatar/AvatarImage.js +1 -1
  30. package/dist/Avatar/AvatarRoot.cjs +1 -1
  31. package/dist/Avatar/AvatarRoot.js +2 -2
  32. package/dist/Calendar/CalendarCell.cjs +2 -2
  33. package/dist/Calendar/CalendarCell.js +3 -3
  34. package/dist/Calendar/CalendarCellTrigger.cjs +74 -48
  35. package/dist/Calendar/CalendarCellTrigger.cjs.map +1 -1
  36. package/dist/Calendar/CalendarCellTrigger.js +75 -49
  37. package/dist/Calendar/CalendarCellTrigger.js.map +1 -1
  38. package/dist/Calendar/CalendarGrid.cjs +2 -2
  39. package/dist/Calendar/CalendarGrid.cjs.map +1 -1
  40. package/dist/Calendar/CalendarGrid.js +3 -3
  41. package/dist/Calendar/CalendarGrid.js.map +1 -1
  42. package/dist/Calendar/CalendarGridBody.js +1 -1
  43. package/dist/Calendar/CalendarGridHead.js +1 -1
  44. package/dist/Calendar/CalendarGridRow.js +1 -1
  45. package/dist/Calendar/CalendarHeadCell.js +1 -1
  46. package/dist/Calendar/CalendarHeader.js +1 -1
  47. package/dist/Calendar/CalendarHeading.cjs +1 -1
  48. package/dist/Calendar/CalendarHeading.js +2 -2
  49. package/dist/Calendar/CalendarNext.cjs +3 -3
  50. package/dist/Calendar/CalendarNext.js +4 -4
  51. package/dist/Calendar/CalendarPrev.cjs +3 -3
  52. package/dist/Calendar/CalendarPrev.js +4 -4
  53. package/dist/Calendar/CalendarRoot.cjs +14 -12
  54. package/dist/Calendar/CalendarRoot.cjs.map +1 -1
  55. package/dist/Calendar/CalendarRoot.js +15 -13
  56. package/dist/Calendar/CalendarRoot.js.map +1 -1
  57. package/dist/Calendar/useCalendar.js +1 -1
  58. package/dist/Calendar/utils.cjs +9 -0
  59. package/dist/Calendar/utils.cjs.map +1 -0
  60. package/dist/Calendar/utils.js +7 -0
  61. package/dist/Calendar/utils.js.map +1 -0
  62. package/dist/Checkbox/CheckboxGroupRoot.cjs +3 -3
  63. package/dist/Checkbox/CheckboxGroupRoot.js +4 -4
  64. package/dist/Checkbox/CheckboxIndicator.cjs +1 -1
  65. package/dist/Checkbox/CheckboxIndicator.js +2 -2
  66. package/dist/Checkbox/CheckboxRoot.cjs +8 -8
  67. package/dist/Checkbox/CheckboxRoot.cjs.map +1 -1
  68. package/dist/Checkbox/CheckboxRoot.js +10 -10
  69. package/dist/Checkbox/CheckboxRoot.js.map +1 -1
  70. package/dist/Collapsible/CollapsibleContent.cjs +4 -4
  71. package/dist/Collapsible/CollapsibleContent.cjs.map +1 -1
  72. package/dist/Collapsible/CollapsibleContent.js +5 -5
  73. package/dist/Collapsible/CollapsibleContent.js.map +1 -1
  74. package/dist/Collapsible/CollapsibleRoot.cjs +4 -4
  75. package/dist/Collapsible/CollapsibleRoot.js +5 -5
  76. package/dist/Collapsible/CollapsibleTrigger.cjs +2 -2
  77. package/dist/Collapsible/CollapsibleTrigger.js +3 -3
  78. package/dist/Combobox/ComboboxAnchor.js +1 -1
  79. package/dist/Combobox/ComboboxArrow.js +1 -1
  80. package/dist/Combobox/ComboboxCancel.cjs +1 -1
  81. package/dist/Combobox/ComboboxCancel.js +2 -2
  82. package/dist/Combobox/ComboboxContent.cjs +1 -1
  83. package/dist/Combobox/ComboboxContent.cjs.map +1 -1
  84. package/dist/Combobox/ComboboxContent.js +2 -2
  85. package/dist/Combobox/ComboboxContent.js.map +1 -1
  86. package/dist/Combobox/ComboboxContentImpl.cjs +1 -1
  87. package/dist/Combobox/ComboboxContentImpl.js +2 -2
  88. package/dist/Combobox/ComboboxEmpty.js +1 -1
  89. package/dist/Combobox/ComboboxGroup.cjs +3 -3
  90. package/dist/Combobox/ComboboxGroup.cjs.map +1 -1
  91. package/dist/Combobox/ComboboxGroup.js +4 -4
  92. package/dist/Combobox/ComboboxGroup.js.map +1 -1
  93. package/dist/Combobox/ComboboxInput.cjs +1 -1
  94. package/dist/Combobox/ComboboxInput.js +2 -2
  95. package/dist/Combobox/ComboboxItem.cjs +2 -5
  96. package/dist/Combobox/ComboboxItem.cjs.map +1 -1
  97. package/dist/Combobox/ComboboxItem.js +4 -6
  98. package/dist/Combobox/ComboboxItem.js.map +1 -1
  99. package/dist/Combobox/ComboboxItemIndicator.js +1 -1
  100. package/dist/Combobox/ComboboxLabel.cjs +1 -1
  101. package/dist/Combobox/ComboboxLabel.cjs.map +1 -1
  102. package/dist/Combobox/ComboboxLabel.js +2 -2
  103. package/dist/Combobox/ComboboxLabel.js.map +1 -1
  104. package/dist/Combobox/ComboboxPortal.js +1 -1
  105. package/dist/Combobox/ComboboxRoot.cjs +7 -7
  106. package/dist/Combobox/ComboboxRoot.cjs.map +1 -1
  107. package/dist/Combobox/ComboboxRoot.js +8 -8
  108. package/dist/Combobox/ComboboxRoot.js.map +1 -1
  109. package/dist/Combobox/ComboboxSeparator.js +1 -1
  110. package/dist/Combobox/ComboboxTrigger.cjs +3 -3
  111. package/dist/Combobox/ComboboxTrigger.js +4 -4
  112. package/dist/Combobox/ComboboxViewport.cjs +1 -1
  113. package/dist/Combobox/ComboboxViewport.js +2 -2
  114. package/dist/Combobox/ComboboxVirtualizer.js +1 -1
  115. package/dist/ConfigProvider/ConfigProvider.cjs +2 -2
  116. package/dist/ConfigProvider/ConfigProvider.js +2 -2
  117. package/dist/ContextMenu/ContextMenuArrow.js +1 -1
  118. package/dist/ContextMenu/ContextMenuCheckboxItem.js +1 -1
  119. package/dist/ContextMenu/ContextMenuContent.js +1 -1
  120. package/dist/ContextMenu/ContextMenuGroup.js +1 -1
  121. package/dist/ContextMenu/ContextMenuItem.js +1 -1
  122. package/dist/ContextMenu/ContextMenuItemIndicator.js +1 -1
  123. package/dist/ContextMenu/ContextMenuLabel.js +1 -1
  124. package/dist/ContextMenu/ContextMenuPortal.js +1 -1
  125. package/dist/ContextMenu/ContextMenuRadioGroup.js +1 -1
  126. package/dist/ContextMenu/ContextMenuRadioItem.js +1 -1
  127. package/dist/ContextMenu/ContextMenuRoot.cjs +1 -1
  128. package/dist/ContextMenu/ContextMenuRoot.js +2 -2
  129. package/dist/ContextMenu/ContextMenuSeparator.js +1 -1
  130. package/dist/ContextMenu/ContextMenuSub.cjs +2 -2
  131. package/dist/ContextMenu/ContextMenuSub.js +3 -3
  132. package/dist/ContextMenu/ContextMenuSubContent.js +1 -1
  133. package/dist/ContextMenu/ContextMenuSubTrigger.js +1 -1
  134. package/dist/ContextMenu/ContextMenuTrigger.cjs +1 -1
  135. package/dist/ContextMenu/ContextMenuTrigger.js +2 -2
  136. package/dist/DateField/DateFieldInput.cjs +5 -5
  137. package/dist/DateField/DateFieldInput.js +6 -6
  138. package/dist/DateField/DateFieldRoot.cjs +10 -10
  139. package/dist/DateField/DateFieldRoot.js +11 -11
  140. package/dist/DatePicker/DatePickerArrow.js +1 -1
  141. package/dist/DatePicker/DatePickerCalendar.js +1 -1
  142. package/dist/DatePicker/DatePickerCell.js +1 -1
  143. package/dist/DatePicker/DatePickerCellTrigger.js +1 -1
  144. package/dist/DatePicker/DatePickerClose.js +1 -1
  145. package/dist/DatePicker/DatePickerContent.js +1 -1
  146. package/dist/DatePicker/DatePickerField.js +1 -1
  147. package/dist/DatePicker/DatePickerGrid.js +1 -1
  148. package/dist/DatePicker/DatePickerGridBody.js +1 -1
  149. package/dist/DatePicker/DatePickerGridHead.js +1 -1
  150. package/dist/DatePicker/DatePickerGridRow.js +1 -1
  151. package/dist/DatePicker/DatePickerHeadCell.js +1 -1
  152. package/dist/DatePicker/DatePickerHeader.js +1 -1
  153. package/dist/DatePicker/DatePickerHeading.js +1 -1
  154. package/dist/DatePicker/DatePickerInput.js +1 -1
  155. package/dist/DatePicker/DatePickerNext.js +1 -1
  156. package/dist/DatePicker/DatePickerPrev.js +1 -1
  157. package/dist/DatePicker/DatePickerRoot.cjs +11 -11
  158. package/dist/DatePicker/DatePickerRoot.cjs.map +1 -1
  159. package/dist/DatePicker/DatePickerRoot.js +12 -12
  160. package/dist/DatePicker/DatePickerRoot.js.map +1 -1
  161. package/dist/DatePicker/DatePickerTrigger.js +1 -1
  162. package/dist/DateRangeField/DateRangeFieldInput.cjs +5 -5
  163. package/dist/DateRangeField/DateRangeFieldInput.js +6 -6
  164. package/dist/DateRangeField/DateRangeFieldRoot.cjs +22 -18
  165. package/dist/DateRangeField/DateRangeFieldRoot.cjs.map +1 -1
  166. package/dist/DateRangeField/DateRangeFieldRoot.js +23 -19
  167. package/dist/DateRangeField/DateRangeFieldRoot.js.map +1 -1
  168. package/dist/DateRangePicker/DateRangePickerAnchor.js +1 -1
  169. package/dist/DateRangePicker/DateRangePickerArrow.js +1 -1
  170. package/dist/DateRangePicker/DateRangePickerCalendar.js +1 -1
  171. package/dist/DateRangePicker/DateRangePickerCell.js +1 -1
  172. package/dist/DateRangePicker/DateRangePickerCellTrigger.js +1 -1
  173. package/dist/DateRangePicker/DateRangePickerClose.js +1 -1
  174. package/dist/DateRangePicker/DateRangePickerContent.js +1 -1
  175. package/dist/DateRangePicker/DateRangePickerField.js +1 -1
  176. package/dist/DateRangePicker/DateRangePickerGrid.js +1 -1
  177. package/dist/DateRangePicker/DateRangePickerGridBody.js +1 -1
  178. package/dist/DateRangePicker/DateRangePickerGridHead.js +1 -1
  179. package/dist/DateRangePicker/DateRangePickerGridRow.js +1 -1
  180. package/dist/DateRangePicker/DateRangePickerHeadCell.js +1 -1
  181. package/dist/DateRangePicker/DateRangePickerHeader.js +1 -1
  182. package/dist/DateRangePicker/DateRangePickerHeading.js +1 -1
  183. package/dist/DateRangePicker/DateRangePickerInput.js +1 -1
  184. package/dist/DateRangePicker/DateRangePickerNext.js +1 -1
  185. package/dist/DateRangePicker/DateRangePickerPrev.js +1 -1
  186. package/dist/DateRangePicker/DateRangePickerRoot.cjs +11 -11
  187. package/dist/DateRangePicker/DateRangePickerRoot.cjs.map +1 -1
  188. package/dist/DateRangePicker/DateRangePickerRoot.js +12 -12
  189. package/dist/DateRangePicker/DateRangePickerRoot.js.map +1 -1
  190. package/dist/DateRangePicker/DateRangePickerTrigger.js +1 -1
  191. package/dist/Dialog/DialogClose.cjs +1 -1
  192. package/dist/Dialog/DialogClose.js +2 -2
  193. package/dist/Dialog/DialogContent.js +1 -1
  194. package/dist/Dialog/DialogContentImpl.cjs +2 -2
  195. package/dist/Dialog/DialogContentImpl.cjs.map +1 -1
  196. package/dist/Dialog/DialogContentImpl.js +3 -3
  197. package/dist/Dialog/DialogContentImpl.js.map +1 -1
  198. package/dist/Dialog/DialogContentModal.js +1 -1
  199. package/dist/Dialog/DialogContentNonModal.js +1 -1
  200. package/dist/Dialog/DialogDescription.js +1 -1
  201. package/dist/Dialog/DialogOverlay.js +1 -1
  202. package/dist/Dialog/DialogOverlayImpl.js +1 -1
  203. package/dist/Dialog/DialogPortal.js +1 -1
  204. package/dist/Dialog/DialogRoot.cjs +2 -2
  205. package/dist/Dialog/DialogRoot.js +2 -2
  206. package/dist/Dialog/DialogTitle.js +1 -1
  207. package/dist/Dialog/DialogTrigger.cjs +3 -3
  208. package/dist/Dialog/DialogTrigger.cjs.map +1 -1
  209. package/dist/Dialog/DialogTrigger.js +4 -4
  210. package/dist/Dialog/DialogTrigger.js.map +1 -1
  211. package/dist/DismissableLayer/DismissableLayer.cjs +1 -1
  212. package/dist/DismissableLayer/DismissableLayer.js +2 -2
  213. package/dist/DismissableLayer/DismissableLayerBranch.js +1 -1
  214. package/dist/DismissableLayer/utils.cjs +1 -0
  215. package/dist/DismissableLayer/utils.cjs.map +1 -1
  216. package/dist/DismissableLayer/utils.js +1 -0
  217. package/dist/DismissableLayer/utils.js.map +1 -1
  218. package/dist/DropdownMenu/DropdownMenuArrow.js +1 -1
  219. package/dist/DropdownMenu/DropdownMenuCheckboxItem.js +1 -1
  220. package/dist/DropdownMenu/DropdownMenuContent.cjs +1 -1
  221. package/dist/DropdownMenu/DropdownMenuContent.cjs.map +1 -1
  222. package/dist/DropdownMenu/DropdownMenuContent.js +2 -2
  223. package/dist/DropdownMenu/DropdownMenuContent.js.map +1 -1
  224. package/dist/DropdownMenu/DropdownMenuGroup.js +1 -1
  225. package/dist/DropdownMenu/DropdownMenuItem.js +1 -1
  226. package/dist/DropdownMenu/DropdownMenuItemIndicator.js +1 -1
  227. package/dist/DropdownMenu/DropdownMenuLabel.js +1 -1
  228. package/dist/DropdownMenu/DropdownMenuPortal.js +1 -1
  229. package/dist/DropdownMenu/DropdownMenuRadioGroup.js +1 -1
  230. package/dist/DropdownMenu/DropdownMenuRadioItem.js +1 -1
  231. package/dist/DropdownMenu/DropdownMenuRoot.cjs +3 -3
  232. package/dist/DropdownMenu/DropdownMenuRoot.js +4 -4
  233. package/dist/DropdownMenu/DropdownMenuSeparator.js +1 -1
  234. package/dist/DropdownMenu/DropdownMenuSub.cjs +2 -2
  235. package/dist/DropdownMenu/DropdownMenuSub.cjs.map +1 -1
  236. package/dist/DropdownMenu/DropdownMenuSub.js +3 -3
  237. package/dist/DropdownMenu/DropdownMenuSub.js.map +1 -1
  238. package/dist/DropdownMenu/DropdownMenuSubContent.js +1 -1
  239. package/dist/DropdownMenu/DropdownMenuSubTrigger.js +1 -1
  240. package/dist/DropdownMenu/DropdownMenuTrigger.cjs +4 -4
  241. package/dist/DropdownMenu/DropdownMenuTrigger.cjs.map +1 -1
  242. package/dist/DropdownMenu/DropdownMenuTrigger.js +5 -5
  243. package/dist/DropdownMenu/DropdownMenuTrigger.js.map +1 -1
  244. package/dist/Editable/EditableArea.cjs +7 -7
  245. package/dist/Editable/EditableArea.js +8 -8
  246. package/dist/Editable/EditableCancelTrigger.cjs +4 -4
  247. package/dist/Editable/EditableCancelTrigger.js +5 -5
  248. package/dist/Editable/EditableEditTrigger.cjs +4 -4
  249. package/dist/Editable/EditableEditTrigger.js +5 -5
  250. package/dist/Editable/EditableInput.cjs +4 -4
  251. package/dist/Editable/EditableInput.js +5 -5
  252. package/dist/Editable/EditablePreview.cjs +4 -4
  253. package/dist/Editable/EditablePreview.js +5 -5
  254. package/dist/Editable/EditableRoot.cjs +2 -2
  255. package/dist/Editable/EditableRoot.js +3 -3
  256. package/dist/Editable/EditableSubmitTrigger.cjs +4 -4
  257. package/dist/Editable/EditableSubmitTrigger.js +5 -5
  258. package/dist/FocusScope/FocusScope.js +1 -1
  259. package/dist/FocusScope/utils.cjs +1 -1
  260. package/dist/FocusScope/utils.cjs.map +1 -1
  261. package/dist/FocusScope/utils.js +1 -1
  262. package/dist/FocusScope/utils.js.map +1 -1
  263. package/dist/HoverCard/HoverCardArrow.js +1 -1
  264. package/dist/HoverCard/HoverCardContent.js +1 -1
  265. package/dist/HoverCard/HoverCardContentImpl.cjs +2 -2
  266. package/dist/HoverCard/HoverCardContentImpl.js +3 -3
  267. package/dist/HoverCard/HoverCardPortal.js +1 -1
  268. package/dist/HoverCard/HoverCardRoot.cjs +3 -3
  269. package/dist/HoverCard/HoverCardRoot.cjs.map +1 -1
  270. package/dist/HoverCard/HoverCardRoot.js +4 -4
  271. package/dist/HoverCard/HoverCardRoot.js.map +1 -1
  272. package/dist/HoverCard/HoverCardTrigger.js +1 -1
  273. package/dist/HoverCard/utils.cjs +1 -1
  274. package/dist/HoverCard/utils.cjs.map +1 -1
  275. package/dist/HoverCard/utils.js +1 -1
  276. package/dist/HoverCard/utils.js.map +1 -1
  277. package/dist/Label/Label.js +1 -1
  278. package/dist/Listbox/ListboxContent.cjs +2 -2
  279. package/dist/Listbox/ListboxContent.js +3 -3
  280. package/dist/Listbox/ListboxFilter.cjs +8 -5
  281. package/dist/Listbox/ListboxFilter.cjs.map +1 -1
  282. package/dist/Listbox/ListboxFilter.js +9 -6
  283. package/dist/Listbox/ListboxFilter.js.map +1 -1
  284. package/dist/Listbox/ListboxGroup.cjs +2 -2
  285. package/dist/Listbox/ListboxGroup.cjs.map +1 -1
  286. package/dist/Listbox/ListboxGroup.js +3 -3
  287. package/dist/Listbox/ListboxGroup.js.map +1 -1
  288. package/dist/Listbox/ListboxGroupLabel.js +1 -1
  289. package/dist/Listbox/ListboxItem.cjs +6 -6
  290. package/dist/Listbox/ListboxItem.cjs.map +1 -1
  291. package/dist/Listbox/ListboxItem.js +7 -7
  292. package/dist/Listbox/ListboxItem.js.map +1 -1
  293. package/dist/Listbox/ListboxItemIndicator.js +1 -1
  294. package/dist/Listbox/ListboxRoot.cjs +6 -6
  295. package/dist/Listbox/ListboxRoot.cjs.map +1 -1
  296. package/dist/Listbox/ListboxRoot.js +7 -7
  297. package/dist/Listbox/ListboxRoot.js.map +1 -1
  298. package/dist/Listbox/ListboxVirtualizer.js +1 -1
  299. package/dist/Listbox/utils.cjs +2 -2
  300. package/dist/Listbox/utils.cjs.map +1 -1
  301. package/dist/Listbox/utils.js +2 -2
  302. package/dist/Listbox/utils.js.map +1 -1
  303. package/dist/Menu/MenuAnchor.js +1 -1
  304. package/dist/Menu/MenuArrow.js +1 -1
  305. package/dist/Menu/MenuCheckboxItem.js +1 -1
  306. package/dist/Menu/MenuContent.js +1 -1
  307. package/dist/Menu/MenuContentImpl.cjs +2 -2
  308. package/dist/Menu/MenuContentImpl.js +4 -4
  309. package/dist/Menu/MenuGroup.js +1 -1
  310. package/dist/Menu/MenuItem.js +1 -1
  311. package/dist/Menu/MenuItemImpl.cjs +3 -3
  312. package/dist/Menu/MenuItemImpl.js +4 -4
  313. package/dist/Menu/MenuItemIndicator.cjs +1 -1
  314. package/dist/Menu/MenuItemIndicator.js +2 -2
  315. package/dist/Menu/MenuLabel.js +1 -1
  316. package/dist/Menu/MenuPortal.js +1 -1
  317. package/dist/Menu/MenuRadioGroup.js +1 -1
  318. package/dist/Menu/MenuRadioItem.js +1 -1
  319. package/dist/Menu/MenuRoot.js +1 -1
  320. package/dist/Menu/MenuRootContentModal.js +1 -1
  321. package/dist/Menu/MenuRootContentNonModal.js +1 -1
  322. package/dist/Menu/MenuSeparator.js +1 -1
  323. package/dist/Menu/MenuSub.cjs +2 -2
  324. package/dist/Menu/MenuSub.js +3 -3
  325. package/dist/Menu/MenuSubContent.cjs +1 -1
  326. package/dist/Menu/MenuSubContent.cjs.map +1 -1
  327. package/dist/Menu/MenuSubContent.js +2 -2
  328. package/dist/Menu/MenuSubContent.js.map +1 -1
  329. package/dist/Menu/MenuSubTrigger.cjs +2 -2
  330. package/dist/Menu/MenuSubTrigger.cjs.map +1 -1
  331. package/dist/Menu/MenuSubTrigger.js +3 -3
  332. package/dist/Menu/MenuSubTrigger.js.map +1 -1
  333. package/dist/Menubar/MenubarArrow.js +1 -1
  334. package/dist/Menubar/MenubarCheckboxItem.js +1 -1
  335. package/dist/Menubar/MenubarContent.cjs +1 -1
  336. package/dist/Menubar/MenubarContent.cjs.map +1 -1
  337. package/dist/Menubar/MenubarContent.js +2 -2
  338. package/dist/Menubar/MenubarContent.js.map +1 -1
  339. package/dist/Menubar/MenubarGroup.js +1 -1
  340. package/dist/Menubar/MenubarItem.js +1 -1
  341. package/dist/Menubar/MenubarItemIndicator.js +1 -1
  342. package/dist/Menubar/MenubarLabel.js +1 -1
  343. package/dist/Menubar/MenubarMenu.cjs +1 -1
  344. package/dist/Menubar/MenubarMenu.js +2 -2
  345. package/dist/Menubar/MenubarPortal.js +1 -1
  346. package/dist/Menubar/MenubarRadioGroup.js +1 -1
  347. package/dist/Menubar/MenubarRadioItem.js +1 -1
  348. package/dist/Menubar/MenubarRoot.cjs +3 -3
  349. package/dist/Menubar/MenubarRoot.js +4 -4
  350. package/dist/Menubar/MenubarSeparator.js +1 -1
  351. package/dist/Menubar/MenubarSub.cjs +2 -2
  352. package/dist/Menubar/MenubarSub.js +3 -3
  353. package/dist/Menubar/MenubarSubContent.js +1 -1
  354. package/dist/Menubar/MenubarSubTrigger.js +1 -1
  355. package/dist/Menubar/MenubarTrigger.cjs +5 -5
  356. package/dist/Menubar/MenubarTrigger.js +6 -6
  357. package/dist/NavigationMenu/NavigationMenuContent.cjs +1 -1
  358. package/dist/NavigationMenu/NavigationMenuContent.js +2 -2
  359. package/dist/NavigationMenu/NavigationMenuContentImpl.cjs +1 -1
  360. package/dist/NavigationMenu/NavigationMenuContentImpl.cjs.map +1 -1
  361. package/dist/NavigationMenu/NavigationMenuContentImpl.js +2 -2
  362. package/dist/NavigationMenu/NavigationMenuContentImpl.js.map +1 -1
  363. package/dist/NavigationMenu/NavigationMenuIndicator.js +1 -1
  364. package/dist/NavigationMenu/NavigationMenuItem.cjs +2 -2
  365. package/dist/NavigationMenu/NavigationMenuItem.cjs.map +1 -1
  366. package/dist/NavigationMenu/NavigationMenuItem.js +3 -3
  367. package/dist/NavigationMenu/NavigationMenuItem.js.map +1 -1
  368. package/dist/NavigationMenu/NavigationMenuLink.cjs +2 -2
  369. package/dist/NavigationMenu/NavigationMenuLink.js +3 -3
  370. package/dist/NavigationMenu/NavigationMenuList.js +1 -1
  371. package/dist/NavigationMenu/NavigationMenuRoot.cjs +4 -4
  372. package/dist/NavigationMenu/NavigationMenuRoot.cjs.map +1 -1
  373. package/dist/NavigationMenu/NavigationMenuRoot.js +5 -5
  374. package/dist/NavigationMenu/NavigationMenuRoot.js.map +1 -1
  375. package/dist/NavigationMenu/NavigationMenuSub.cjs +12 -2
  376. package/dist/NavigationMenu/NavigationMenuSub.cjs.map +1 -1
  377. package/dist/NavigationMenu/NavigationMenuSub.js +13 -3
  378. package/dist/NavigationMenu/NavigationMenuSub.js.map +1 -1
  379. package/dist/NavigationMenu/NavigationMenuTrigger.cjs +2 -2
  380. package/dist/NavigationMenu/NavigationMenuTrigger.cjs.map +1 -1
  381. package/dist/NavigationMenu/NavigationMenuTrigger.js +3 -3
  382. package/dist/NavigationMenu/NavigationMenuTrigger.js.map +1 -1
  383. package/dist/NavigationMenu/NavigationMenuViewport.cjs +8 -8
  384. package/dist/NavigationMenu/NavigationMenuViewport.cjs.map +1 -1
  385. package/dist/NavigationMenu/NavigationMenuViewport.js +10 -10
  386. package/dist/NavigationMenu/NavigationMenuViewport.js.map +1 -1
  387. package/dist/NavigationMenu/utils.cjs +1 -1
  388. package/dist/NavigationMenu/utils.cjs.map +1 -1
  389. package/dist/NavigationMenu/utils.js +1 -1
  390. package/dist/NavigationMenu/utils.js.map +1 -1
  391. package/dist/NumberField/NumberFieldDecrement.cjs +5 -5
  392. package/dist/NumberField/NumberFieldDecrement.js +6 -6
  393. package/dist/NumberField/NumberFieldIncrement.cjs +5 -5
  394. package/dist/NumberField/NumberFieldIncrement.js +6 -6
  395. package/dist/NumberField/NumberFieldInput.cjs +3 -3
  396. package/dist/NumberField/NumberFieldInput.js +4 -4
  397. package/dist/NumberField/NumberFieldRoot.cjs +7 -7
  398. package/dist/NumberField/NumberFieldRoot.cjs.map +1 -1
  399. package/dist/NumberField/NumberFieldRoot.js +8 -8
  400. package/dist/NumberField/NumberFieldRoot.js.map +1 -1
  401. package/dist/NumberField/utils.js +1 -1
  402. package/dist/Pagination/PaginationEllipsis.js +1 -1
  403. package/dist/Pagination/PaginationFirst.cjs +1 -1
  404. package/dist/Pagination/PaginationFirst.js +2 -2
  405. package/dist/Pagination/PaginationLast.cjs +1 -1
  406. package/dist/Pagination/PaginationLast.js +2 -2
  407. package/dist/Pagination/PaginationList.js +1 -1
  408. package/dist/Pagination/PaginationListItem.cjs +3 -3
  409. package/dist/Pagination/PaginationListItem.js +4 -4
  410. package/dist/Pagination/PaginationNext.cjs +1 -1
  411. package/dist/Pagination/PaginationNext.js +2 -2
  412. package/dist/Pagination/PaginationPrev.cjs +1 -1
  413. package/dist/Pagination/PaginationPrev.js +2 -2
  414. package/dist/Pagination/PaginationRoot.cjs +2 -2
  415. package/dist/Pagination/PaginationRoot.js +3 -3
  416. package/dist/PinInput/PinInputInput.cjs +4 -4
  417. package/dist/PinInput/PinInputInput.cjs.map +1 -1
  418. package/dist/PinInput/PinInputInput.js +5 -5
  419. package/dist/PinInput/PinInputInput.js.map +1 -1
  420. package/dist/PinInput/PinInputRoot.cjs +4 -4
  421. package/dist/PinInput/PinInputRoot.js +5 -5
  422. package/dist/Popover/PopoverAnchor.js +1 -1
  423. package/dist/Popover/PopoverArrow.js +1 -1
  424. package/dist/Popover/PopoverClose.cjs +1 -1
  425. package/dist/Popover/PopoverClose.js +2 -2
  426. package/dist/Popover/PopoverContent.cjs +1 -1
  427. package/dist/Popover/PopoverContent.cjs.map +1 -1
  428. package/dist/Popover/PopoverContent.js +2 -2
  429. package/dist/Popover/PopoverContent.js.map +1 -1
  430. package/dist/Popover/PopoverContentImpl.js +1 -1
  431. package/dist/Popover/PopoverContentModal.js +1 -1
  432. package/dist/Popover/PopoverContentNonModal.js +1 -1
  433. package/dist/Popover/PopoverPortal.js +1 -1
  434. package/dist/Popover/PopoverRoot.cjs +2 -2
  435. package/dist/Popover/PopoverRoot.js +3 -3
  436. package/dist/Popover/PopoverTrigger.cjs +2 -2
  437. package/dist/Popover/PopoverTrigger.cjs.map +1 -1
  438. package/dist/Popover/PopoverTrigger.js +3 -3
  439. package/dist/Popover/PopoverTrigger.js.map +1 -1
  440. package/dist/Popper/PopperAnchor.js +1 -1
  441. package/dist/Popper/PopperArrow.cjs +4 -4
  442. package/dist/Popper/PopperArrow.js +5 -5
  443. package/dist/Popper/PopperContent.cjs +3 -3
  444. package/dist/Popper/PopperContent.cjs.map +1 -1
  445. package/dist/Popper/PopperContent.js +5 -5
  446. package/dist/Popper/PopperContent.js.map +1 -1
  447. package/dist/Presence/usePresence.cjs +2 -2
  448. package/dist/Presence/usePresence.cjs.map +1 -1
  449. package/dist/Presence/usePresence.js +2 -2
  450. package/dist/Presence/usePresence.js.map +1 -1
  451. package/dist/Primitive/Primitive.cjs +1 -1
  452. package/dist/Primitive/Primitive.cjs.map +1 -1
  453. package/dist/Primitive/Primitive.js +1 -1
  454. package/dist/Primitive/Primitive.js.map +1 -1
  455. package/dist/Progress/ProgressIndicator.cjs +1 -1
  456. package/dist/Progress/ProgressIndicator.js +2 -2
  457. package/dist/Progress/ProgressRoot.cjs +5 -5
  458. package/dist/Progress/ProgressRoot.js +6 -6
  459. package/dist/RadioGroup/Radio.cjs +6 -6
  460. package/dist/RadioGroup/Radio.cjs.map +1 -1
  461. package/dist/RadioGroup/Radio.js +7 -7
  462. package/dist/RadioGroup/Radio.js.map +1 -1
  463. package/dist/RadioGroup/RadioGroupIndicator.cjs +1 -1
  464. package/dist/RadioGroup/RadioGroupIndicator.js +2 -2
  465. package/dist/RadioGroup/RadioGroupItem.cjs +2 -2
  466. package/dist/RadioGroup/RadioGroupItem.js +3 -3
  467. package/dist/RadioGroup/RadioGroupRoot.cjs +5 -5
  468. package/dist/RadioGroup/RadioGroupRoot.js +6 -6
  469. package/dist/RangeCalendar/RangeCalendarCell.cjs +2 -2
  470. package/dist/RangeCalendar/RangeCalendarCell.js +3 -3
  471. package/dist/RangeCalendar/RangeCalendarCellTrigger.cjs +84 -58
  472. package/dist/RangeCalendar/RangeCalendarCellTrigger.cjs.map +1 -1
  473. package/dist/RangeCalendar/RangeCalendarCellTrigger.js +85 -59
  474. package/dist/RangeCalendar/RangeCalendarCellTrigger.js.map +1 -1
  475. package/dist/RangeCalendar/RangeCalendarGrid.cjs +2 -2
  476. package/dist/RangeCalendar/RangeCalendarGrid.cjs.map +1 -1
  477. package/dist/RangeCalendar/RangeCalendarGrid.js +3 -3
  478. package/dist/RangeCalendar/RangeCalendarGrid.js.map +1 -1
  479. package/dist/RangeCalendar/RangeCalendarGridBody.js +1 -1
  480. package/dist/RangeCalendar/RangeCalendarGridHead.js +1 -1
  481. package/dist/RangeCalendar/RangeCalendarGridRow.js +1 -1
  482. package/dist/RangeCalendar/RangeCalendarHeadCell.js +1 -1
  483. package/dist/RangeCalendar/RangeCalendarHeader.js +1 -1
  484. package/dist/RangeCalendar/RangeCalendarHeading.cjs +1 -1
  485. package/dist/RangeCalendar/RangeCalendarHeading.js +2 -2
  486. package/dist/RangeCalendar/RangeCalendarNext.cjs +3 -3
  487. package/dist/RangeCalendar/RangeCalendarNext.js +4 -4
  488. package/dist/RangeCalendar/RangeCalendarPrev.cjs +3 -3
  489. package/dist/RangeCalendar/RangeCalendarPrev.js +4 -4
  490. package/dist/RangeCalendar/RangeCalendarRoot.cjs +18 -16
  491. package/dist/RangeCalendar/RangeCalendarRoot.cjs.map +1 -1
  492. package/dist/RangeCalendar/RangeCalendarRoot.js +19 -17
  493. package/dist/RangeCalendar/RangeCalendarRoot.js.map +1 -1
  494. package/dist/RovingFocus/RovingFocusGroup.cjs +4 -4
  495. package/dist/RovingFocus/RovingFocusGroup.cjs.map +1 -1
  496. package/dist/RovingFocus/RovingFocusGroup.js +5 -5
  497. package/dist/RovingFocus/RovingFocusGroup.js.map +1 -1
  498. package/dist/RovingFocus/RovingFocusItem.cjs +4 -4
  499. package/dist/RovingFocus/RovingFocusItem.cjs.map +1 -1
  500. package/dist/RovingFocus/RovingFocusItem.js +5 -5
  501. package/dist/RovingFocus/RovingFocusItem.js.map +1 -1
  502. package/dist/RovingFocus/utils.cjs +2 -2
  503. package/dist/RovingFocus/utils.cjs.map +1 -1
  504. package/dist/RovingFocus/utils.js +2 -2
  505. package/dist/RovingFocus/utils.js.map +1 -1
  506. package/dist/ScrollArea/ScrollAreaCorner.js +1 -1
  507. package/dist/ScrollArea/ScrollAreaCornerImpl.cjs +2 -2
  508. package/dist/ScrollArea/ScrollAreaCornerImpl.js +3 -3
  509. package/dist/ScrollArea/ScrollAreaRoot.cjs +4 -4
  510. package/dist/ScrollArea/ScrollAreaRoot.cjs.map +1 -1
  511. package/dist/ScrollArea/ScrollAreaRoot.js +5 -5
  512. package/dist/ScrollArea/ScrollAreaRoot.js.map +1 -1
  513. package/dist/ScrollArea/ScrollAreaScrollbar.cjs +1 -1
  514. package/dist/ScrollArea/ScrollAreaScrollbar.js +2 -2
  515. package/dist/ScrollArea/ScrollAreaScrollbarAuto.js +1 -1
  516. package/dist/ScrollArea/ScrollAreaScrollbarHover.js +1 -1
  517. package/dist/ScrollArea/ScrollAreaScrollbarImpl.cjs +1 -1
  518. package/dist/ScrollArea/ScrollAreaScrollbarImpl.cjs.map +1 -1
  519. package/dist/ScrollArea/ScrollAreaScrollbarImpl.js +2 -2
  520. package/dist/ScrollArea/ScrollAreaScrollbarImpl.js.map +1 -1
  521. package/dist/ScrollArea/ScrollAreaScrollbarScroll.js +1 -1
  522. package/dist/ScrollArea/ScrollAreaScrollbarVisible.js +1 -1
  523. package/dist/ScrollArea/ScrollAreaScrollbarX.cjs +1 -1
  524. package/dist/ScrollArea/ScrollAreaScrollbarX.js +2 -2
  525. package/dist/ScrollArea/ScrollAreaScrollbarY.cjs +3 -3
  526. package/dist/ScrollArea/ScrollAreaScrollbarY.js +4 -4
  527. package/dist/ScrollArea/ScrollAreaThumb.js +1 -1
  528. package/dist/ScrollArea/ScrollAreaViewport.cjs +1 -1
  529. package/dist/ScrollArea/ScrollAreaViewport.js +2 -2
  530. package/dist/Select/BubbleSelect.cjs +2 -2
  531. package/dist/Select/BubbleSelect.cjs.map +1 -1
  532. package/dist/Select/BubbleSelect.js +3 -3
  533. package/dist/Select/BubbleSelect.js.map +1 -1
  534. package/dist/Select/SelectArrow.js +1 -1
  535. package/dist/Select/SelectContent.js +1 -1
  536. package/dist/Select/SelectContentImpl.cjs +17 -7
  537. package/dist/Select/SelectContentImpl.cjs.map +1 -1
  538. package/dist/Select/SelectContentImpl.js +18 -8
  539. package/dist/Select/SelectContentImpl.js.map +1 -1
  540. package/dist/Select/SelectGroup.cjs +2 -2
  541. package/dist/Select/SelectGroup.cjs.map +1 -1
  542. package/dist/Select/SelectGroup.js +3 -3
  543. package/dist/Select/SelectGroup.js.map +1 -1
  544. package/dist/Select/SelectIcon.js +1 -1
  545. package/dist/Select/SelectItem.cjs +6 -6
  546. package/dist/Select/SelectItem.cjs.map +1 -1
  547. package/dist/Select/SelectItem.js +7 -7
  548. package/dist/Select/SelectItem.js.map +1 -1
  549. package/dist/Select/SelectItemAlignedPosition.cjs +1 -1
  550. package/dist/Select/SelectItemAlignedPosition.js +2 -2
  551. package/dist/Select/SelectItemIndicator.js +1 -1
  552. package/dist/Select/SelectItemText.js +1 -1
  553. package/dist/Select/SelectLabel.js +1 -1
  554. package/dist/Select/SelectPopperPosition.js +1 -1
  555. package/dist/Select/SelectPortal.js +1 -1
  556. package/dist/Select/SelectRoot.cjs +6 -6
  557. package/dist/Select/SelectRoot.cjs.map +1 -1
  558. package/dist/Select/SelectRoot.js +7 -7
  559. package/dist/Select/SelectRoot.js.map +1 -1
  560. package/dist/Select/SelectScrollButtonImpl.js +1 -1
  561. package/dist/Select/SelectScrollDownButton.cjs +1 -1
  562. package/dist/Select/SelectScrollDownButton.cjs.map +1 -1
  563. package/dist/Select/SelectScrollDownButton.js +2 -2
  564. package/dist/Select/SelectScrollDownButton.js.map +1 -1
  565. package/dist/Select/SelectScrollUpButton.cjs +1 -1
  566. package/dist/Select/SelectScrollUpButton.cjs.map +1 -1
  567. package/dist/Select/SelectScrollUpButton.js +2 -2
  568. package/dist/Select/SelectScrollUpButton.js.map +1 -1
  569. package/dist/Select/SelectSeparator.js +1 -1
  570. package/dist/Select/SelectTrigger.cjs +4 -4
  571. package/dist/Select/SelectTrigger.cjs.map +1 -1
  572. package/dist/Select/SelectTrigger.js +5 -5
  573. package/dist/Select/SelectTrigger.js.map +1 -1
  574. package/dist/Select/SelectValue.cjs +1 -1
  575. package/dist/Select/SelectValue.js +2 -2
  576. package/dist/Select/SelectViewport.cjs +1 -1
  577. package/dist/Select/SelectViewport.cjs.map +1 -1
  578. package/dist/Select/SelectViewport.js +2 -2
  579. package/dist/Select/SelectViewport.js.map +1 -1
  580. package/dist/Select/utils.cjs +2 -2
  581. package/dist/Select/utils.cjs.map +1 -1
  582. package/dist/Select/utils.js +2 -2
  583. package/dist/Select/utils.js.map +1 -1
  584. package/dist/Separator/Separator.js +1 -1
  585. package/dist/Slider/SliderHorizontal.cjs +2 -2
  586. package/dist/Slider/SliderHorizontal.js +3 -3
  587. package/dist/Slider/SliderImpl.js +1 -1
  588. package/dist/Slider/SliderRange.cjs +1 -1
  589. package/dist/Slider/SliderRange.js +2 -2
  590. package/dist/Slider/SliderRoot.cjs +4 -4
  591. package/dist/Slider/SliderRoot.cjs.map +1 -1
  592. package/dist/Slider/SliderRoot.js +5 -5
  593. package/dist/Slider/SliderRoot.js.map +1 -1
  594. package/dist/Slider/SliderThumb.cjs +1 -1
  595. package/dist/Slider/SliderThumb.cjs.map +1 -1
  596. package/dist/Slider/SliderThumb.js +2 -2
  597. package/dist/Slider/SliderThumb.js.map +1 -1
  598. package/dist/Slider/SliderThumbImpl.cjs +4 -4
  599. package/dist/Slider/SliderThumbImpl.cjs.map +1 -1
  600. package/dist/Slider/SliderThumbImpl.js +5 -5
  601. package/dist/Slider/SliderThumbImpl.js.map +1 -1
  602. package/dist/Slider/SliderTrack.cjs +1 -1
  603. package/dist/Slider/SliderTrack.js +2 -2
  604. package/dist/Slider/SliderVertical.cjs +2 -2
  605. package/dist/Slider/SliderVertical.js +3 -3
  606. package/dist/Slider/utils.cjs +1 -1
  607. package/dist/Slider/utils.cjs.map +1 -1
  608. package/dist/Slider/utils.js +1 -1
  609. package/dist/Slider/utils.js.map +1 -1
  610. package/dist/Splitter/SplitterGroup.cjs +2 -2
  611. package/dist/Splitter/SplitterGroup.cjs.map +1 -1
  612. package/dist/Splitter/SplitterGroup.js +3 -3
  613. package/dist/Splitter/SplitterGroup.js.map +1 -1
  614. package/dist/Splitter/SplitterPanel.cjs +3 -3
  615. package/dist/Splitter/SplitterPanel.cjs.map +1 -1
  616. package/dist/Splitter/SplitterPanel.js +4 -4
  617. package/dist/Splitter/SplitterPanel.js.map +1 -1
  618. package/dist/Splitter/SplitterResizeHandle.cjs +2 -2
  619. package/dist/Splitter/SplitterResizeHandle.js +3 -3
  620. package/dist/Stepper/StepperDescription.js +1 -1
  621. package/dist/Stepper/StepperIndicator.js +1 -1
  622. package/dist/Stepper/StepperItem.cjs +6 -6
  623. package/dist/Stepper/StepperItem.cjs.map +1 -1
  624. package/dist/Stepper/StepperItem.js +7 -7
  625. package/dist/Stepper/StepperItem.js.map +1 -1
  626. package/dist/Stepper/StepperRoot.cjs +3 -3
  627. package/dist/Stepper/StepperRoot.js +4 -4
  628. package/dist/Stepper/StepperSeparator.js +1 -1
  629. package/dist/Stepper/StepperTitle.js +1 -1
  630. package/dist/Stepper/StepperTrigger.cjs +5 -5
  631. package/dist/Stepper/StepperTrigger.cjs.map +1 -1
  632. package/dist/Stepper/StepperTrigger.js +6 -6
  633. package/dist/Stepper/StepperTrigger.js.map +1 -1
  634. package/dist/Switch/SwitchRoot.cjs +6 -6
  635. package/dist/Switch/SwitchRoot.cjs.map +1 -1
  636. package/dist/Switch/SwitchRoot.js +7 -7
  637. package/dist/Switch/SwitchRoot.js.map +1 -1
  638. package/dist/Switch/SwitchThumb.cjs +1 -1
  639. package/dist/Switch/SwitchThumb.js +2 -2
  640. package/dist/Tabs/TabsContent.cjs +1 -1
  641. package/dist/Tabs/TabsContent.js +2 -2
  642. package/dist/Tabs/TabsIndicator.js +1 -1
  643. package/dist/Tabs/TabsList.cjs +1 -1
  644. package/dist/Tabs/TabsList.js +2 -2
  645. package/dist/Tabs/TabsRoot.cjs +3 -3
  646. package/dist/Tabs/TabsRoot.cjs.map +1 -1
  647. package/dist/Tabs/TabsRoot.js +4 -4
  648. package/dist/Tabs/TabsRoot.js.map +1 -1
  649. package/dist/Tabs/TabsTrigger.cjs +3 -3
  650. package/dist/Tabs/TabsTrigger.js +4 -4
  651. package/dist/TagsInput/TagsInputClear.cjs +2 -2
  652. package/dist/TagsInput/TagsInputClear.js +3 -3
  653. package/dist/TagsInput/TagsInputInput.cjs +1 -1
  654. package/dist/TagsInput/TagsInputInput.js +2 -2
  655. package/dist/TagsInput/TagsInputItem.cjs +2 -2
  656. package/dist/TagsInput/TagsInputItem.js +3 -3
  657. package/dist/TagsInput/TagsInputItemDelete.cjs +4 -3
  658. package/dist/TagsInput/TagsInputItemDelete.cjs.map +1 -1
  659. package/dist/TagsInput/TagsInputItemDelete.js +5 -4
  660. package/dist/TagsInput/TagsInputItemDelete.js.map +1 -1
  661. package/dist/TagsInput/TagsInputItemText.cjs +1 -1
  662. package/dist/TagsInput/TagsInputItemText.cjs.map +1 -1
  663. package/dist/TagsInput/TagsInputItemText.js +2 -2
  664. package/dist/TagsInput/TagsInputItemText.js.map +1 -1
  665. package/dist/TagsInput/TagsInputRoot.cjs +7 -7
  666. package/dist/TagsInput/TagsInputRoot.cjs.map +1 -1
  667. package/dist/TagsInput/TagsInputRoot.js +8 -8
  668. package/dist/TagsInput/TagsInputRoot.js.map +1 -1
  669. package/dist/Teleport/Teleport.js +1 -1
  670. package/dist/TimeField/TimeFieldInput.cjs +5 -5
  671. package/dist/TimeField/TimeFieldInput.js +6 -6
  672. package/dist/TimeField/TimeFieldRoot.cjs +17 -14
  673. package/dist/TimeField/TimeFieldRoot.cjs.map +1 -1
  674. package/dist/TimeField/TimeFieldRoot.js +19 -16
  675. package/dist/TimeField/TimeFieldRoot.js.map +1 -1
  676. package/dist/Toast/FocusProxy.js +1 -1
  677. package/dist/Toast/ToastAction.js +1 -1
  678. package/dist/Toast/ToastAnnounce.js +1 -1
  679. package/dist/Toast/ToastAnnounceExclude.cjs +1 -1
  680. package/dist/Toast/ToastAnnounceExclude.js +2 -2
  681. package/dist/Toast/ToastClose.cjs +3 -3
  682. package/dist/Toast/ToastClose.cjs.map +1 -1
  683. package/dist/Toast/ToastClose.js +4 -4
  684. package/dist/Toast/ToastClose.js.map +1 -1
  685. package/dist/Toast/ToastDescription.js +1 -1
  686. package/dist/Toast/ToastPortal.js +1 -1
  687. package/dist/Toast/ToastRoot.cjs +5 -2
  688. package/dist/Toast/ToastRoot.cjs.map +1 -1
  689. package/dist/Toast/ToastRoot.js +6 -3
  690. package/dist/Toast/ToastRoot.js.map +1 -1
  691. package/dist/Toast/ToastRootImpl.cjs +7 -4
  692. package/dist/Toast/ToastRootImpl.cjs.map +1 -1
  693. package/dist/Toast/ToastRootImpl.js +9 -6
  694. package/dist/Toast/ToastRootImpl.js.map +1 -1
  695. package/dist/Toast/ToastTitle.js +1 -1
  696. package/dist/Toast/ToastViewport.cjs +3 -3
  697. package/dist/Toast/ToastViewport.js +4 -4
  698. package/dist/Toast/utils.js +1 -1
  699. package/dist/Toggle/Toggle.cjs +4 -4
  700. package/dist/Toggle/Toggle.js +5 -5
  701. package/dist/ToggleGroup/ToggleGroupItem.cjs +1 -1
  702. package/dist/ToggleGroup/ToggleGroupItem.js +2 -2
  703. package/dist/ToggleGroup/ToggleGroupRoot.cjs +4 -4
  704. package/dist/ToggleGroup/ToggleGroupRoot.js +5 -5
  705. package/dist/Toolbar/ToolbarButton.cjs +2 -2
  706. package/dist/Toolbar/ToolbarButton.js +3 -3
  707. package/dist/Toolbar/ToolbarLink.cjs +1 -1
  708. package/dist/Toolbar/ToolbarLink.js +2 -2
  709. package/dist/Toolbar/ToolbarRoot.cjs +2 -2
  710. package/dist/Toolbar/ToolbarRoot.js +3 -3
  711. package/dist/Toolbar/ToolbarSeparator.js +1 -1
  712. package/dist/Toolbar/ToolbarToggleGroup.js +1 -1
  713. package/dist/Toolbar/ToolbarToggleItem.js +1 -1
  714. package/dist/Tooltip/TooltipArrow.js +1 -1
  715. package/dist/Tooltip/TooltipContent.js +1 -1
  716. package/dist/Tooltip/TooltipContentHoverable.js +1 -1
  717. package/dist/Tooltip/TooltipContentImpl.js +1 -1
  718. package/dist/Tooltip/TooltipPortal.js +1 -1
  719. package/dist/Tooltip/TooltipProvider.cjs +1 -1
  720. package/dist/Tooltip/TooltipProvider.js +1 -1
  721. package/dist/Tooltip/TooltipRoot.cjs +8 -8
  722. package/dist/Tooltip/TooltipRoot.js +9 -9
  723. package/dist/Tooltip/TooltipTrigger.cjs +2 -2
  724. package/dist/Tooltip/TooltipTrigger.cjs.map +1 -1
  725. package/dist/Tooltip/TooltipTrigger.js +3 -3
  726. package/dist/Tooltip/TooltipTrigger.js.map +1 -1
  727. package/dist/Tree/TreeItem.cjs +5 -5
  728. package/dist/Tree/TreeItem.cjs.map +1 -1
  729. package/dist/Tree/TreeItem.js +6 -6
  730. package/dist/Tree/TreeItem.js.map +1 -1
  731. package/dist/Tree/TreeRoot.cjs +8 -8
  732. package/dist/Tree/TreeRoot.cjs.map +1 -1
  733. package/dist/Tree/TreeRoot.js +9 -9
  734. package/dist/Tree/TreeRoot.js.map +1 -1
  735. package/dist/Tree/TreeVirtualizer.js +1 -1
  736. package/dist/Viewport/Viewport.js +1 -1
  737. package/dist/VisuallyHidden/VisuallyHidden.cjs +3 -3
  738. package/dist/VisuallyHidden/VisuallyHidden.js +4 -4
  739. package/dist/VisuallyHidden/VisuallyHiddenInput.cjs +9 -3
  740. package/dist/VisuallyHidden/VisuallyHiddenInput.cjs.map +1 -1
  741. package/dist/VisuallyHidden/VisuallyHiddenInput.js +10 -4
  742. package/dist/VisuallyHidden/VisuallyHiddenInput.js.map +1 -1
  743. package/dist/VisuallyHidden/VisuallyHiddenInputBubble.cjs +1 -1
  744. package/dist/VisuallyHidden/VisuallyHiddenInputBubble.js +2 -2
  745. package/dist/component/Arrow.cjs +2 -2
  746. package/dist/component/Arrow.js +3 -3
  747. package/dist/component/BaseSeparator.cjs +1 -1
  748. package/dist/component/BaseSeparator.js +2 -2
  749. package/dist/constant/components.cjs +4 -0
  750. package/dist/constant/components.cjs.map +1 -1
  751. package/dist/constant/components.js +4 -0
  752. package/dist/constant/components.js.map +1 -1
  753. package/dist/date/comparators.cjs +1 -1
  754. package/dist/date/comparators.cjs.map +1 -1
  755. package/dist/date/comparators.js +2 -2
  756. package/dist/date/comparators.js.map +1 -1
  757. package/dist/date/parser.cjs +2 -2
  758. package/dist/date/parser.js +3 -3
  759. package/dist/date/useDateField.cjs +9 -9
  760. package/dist/date/useDateField.cjs.map +1 -1
  761. package/dist/date/useDateField.js +10 -10
  762. package/dist/date/useDateField.js.map +1 -1
  763. package/dist/date/utils.cjs +2 -2
  764. package/dist/date/utils.cjs.map +1 -1
  765. package/dist/date/utils.js +2 -2
  766. package/dist/date/utils.js.map +1 -1
  767. package/dist/index.cjs +91 -87
  768. package/dist/index.cjs.map +1 -1
  769. package/dist/index.d.ts +75 -12
  770. package/dist/index.js +43 -41
  771. package/dist/index.js.map +1 -1
  772. package/dist/shared/nullish.cjs +1 -1
  773. package/dist/shared/nullish.cjs.map +1 -1
  774. package/dist/shared/nullish.js +1 -1
  775. package/dist/shared/nullish.js.map +1 -1
  776. package/dist/shared/useBodyScrollLock.cjs +2 -2
  777. package/dist/shared/useBodyScrollLock.cjs.map +1 -1
  778. package/dist/shared/useBodyScrollLock.js +4 -4
  779. package/dist/shared/useBodyScrollLock.js.map +1 -1
  780. package/dist/shared/useDateFormatter.js +2 -2
  781. package/dist/shared/useForwardProps.cjs +2 -2
  782. package/dist/shared/useForwardProps.cjs.map +1 -1
  783. package/dist/shared/useForwardProps.js +2 -2
  784. package/dist/shared/useForwardProps.js.map +1 -1
  785. package/dist/shared/useGraceArea.cjs +1 -1
  786. package/dist/shared/useGraceArea.cjs.map +1 -1
  787. package/dist/shared/useGraceArea.js +1 -1
  788. package/dist/shared/useGraceArea.js.map +1 -1
  789. package/dist/shared/useId.cjs +1 -1
  790. package/dist/shared/useId.cjs.map +1 -1
  791. package/dist/shared/useId.js +1 -1
  792. package/dist/shared/useId.js.map +1 -1
  793. package/dist/shared/useSelectionBehavior.cjs +1 -1
  794. package/dist/shared/useSelectionBehavior.cjs.map +1 -1
  795. package/dist/shared/useSelectionBehavior.js +1 -1
  796. package/dist/shared/useSelectionBehavior.js.map +1 -1
  797. package/dist/shared/useSingleOrMultipleValue.cjs +5 -5
  798. package/dist/shared/useSingleOrMultipleValue.cjs.map +1 -1
  799. package/dist/shared/useSingleOrMultipleValue.js +5 -5
  800. package/dist/shared/useSingleOrMultipleValue.js.map +1 -1
  801. package/dist/shared/useSize.cjs +1 -1
  802. package/dist/shared/useSize.cjs.map +1 -1
  803. package/dist/shared/useSize.js +1 -1
  804. package/dist/shared/useSize.js.map +1 -1
  805. package/dist/shared/useTypeahead.cjs +1 -1
  806. package/dist/shared/useTypeahead.cjs.map +1 -1
  807. package/dist/shared/useTypeahead.js +1 -1
  808. package/dist/shared/useTypeahead.js.map +1 -1
  809. package/dist/utils/layout.cjs +1 -1
  810. package/dist/utils/layout.cjs.map +1 -1
  811. package/dist/utils/layout.js +1 -1
  812. package/dist/utils/layout.js.map +1 -1
  813. package/dist/utils/style.cjs +2 -2
  814. package/dist/utils/style.cjs.map +1 -1
  815. package/dist/utils/style.js +3 -3
  816. package/dist/utils/style.js.map +1 -1
  817. package/package.json +3 -3
@@ -1 +1 @@
1
- {"version":3,"file":"NumberFieldRoot.cjs","sources":["../../src/NumberField/NumberFieldRoot.vue"],"sourcesContent":["<script lang=\"ts\">\nimport type { PrimitiveProps } from '@/Primitive'\nimport { useVModel } from '@vueuse/core'\nimport { clamp, createContext, snapValueToStep, useFormControl, useLocale } from '@/shared'\nimport { type HTMLAttributes, type Ref, computed, ref, toRefs } from 'vue'\nimport type { FormFieldProps } from '@/shared/types'\n\nexport interface NumberFieldRootProps extends PrimitiveProps, FormFieldProps {\n defaultValue?: number\n modelValue?: number | null\n /** The smallest value allowed for the input. */\n min?: number\n /** The largest value allowed for the input. */\n max?: number\n /** The amount that the input value changes with each increment or decrement \"tick\". */\n step?: number\n /** When `false`, prevents the value from snapping to the nearest increment of the step value */\n stepSnapping?: boolean\n /** Formatting options for the value displayed in the number field. This also affects what characters are allowed to be typed by the user. */\n formatOptions?: Intl.NumberFormatOptions\n /** The locale to use for formatting dates */\n locale?: string\n /** When `true`, prevents the user from interacting with the Number Field. */\n disabled?: boolean\n /** When `true`, prevents the value from changing on wheel scroll. */\n disableWheelChange?: boolean\n /** Id of the element */\n id?: string\n}\n\nexport type NumberFieldRootEmits = {\n 'update:modelValue': [val: number]\n}\n\ninterface NumberFieldRootContext {\n modelValue: Ref<number>\n handleIncrease: (multiplier?: number) => void\n handleDecrease: (multiplier?: number) => void\n handleMinMaxValue: (type: 'min' | 'max') => void\n inputEl: Ref<HTMLInputElement | undefined>\n onInputElement: (el: HTMLInputElement) => void\n inputMode: Ref<HTMLAttributes['inputmode']>\n textValue: Ref<string>\n validate: (val: string) => boolean\n applyInputValue: (val: string) => void\n disabled: Ref<boolean>\n disableWheelChange: Ref<boolean>\n max: Ref<number | undefined>\n min: Ref<number | undefined>\n isDecreaseDisabled: Ref<boolean>\n isIncreaseDisabled: Ref<boolean>\n id: Ref<string | undefined>\n}\n\nexport const [injectNumberFieldRootContext, provideNumberFieldRootContext] = createContext<NumberFieldRootContext>('NumberFieldRoot')\n</script>\n\n<script setup lang=\"ts\">\nimport { Primitive, usePrimitiveElement } from '@/Primitive'\nimport { handleDecimalOperation, useNumberFormatter, useNumberParser } from './utils'\nimport { VisuallyHiddenInput } from '@/VisuallyHidden'\n\ndefineOptions({\n inheritAttrs: false,\n})\n\nconst props = withDefaults(defineProps<NumberFieldRootProps>(), {\n as: 'div',\n defaultValue: undefined,\n step: 1,\n stepSnapping: true,\n})\nconst emits = defineEmits<NumberFieldRootEmits>()\nconst { disabled, disableWheelChange, min, max, step, stepSnapping, formatOptions, id, locale: propLocale } = toRefs(props)\n\nconst modelValue = useVModel(props, 'modelValue', emits, {\n defaultValue: props.defaultValue,\n passive: (props.modelValue === undefined) as false,\n}) as Ref<number>\n\nconst { primitiveElement, currentElement } = usePrimitiveElement()\n\nconst locale = useLocale(propLocale)\nconst isFormControl = useFormControl(currentElement)\nconst inputEl = ref<HTMLInputElement>()\n\nconst isDecreaseDisabled = computed(() => (\n clampInputValue(modelValue.value) === min.value\n || (min.value && !isNaN(modelValue.value) ? (handleDecimalOperation('-', modelValue.value, step.value) < min.value) : false)),\n)\nconst isIncreaseDisabled = computed(() => (\n clampInputValue(modelValue.value) === max.value\n || (max.value && !isNaN(modelValue.value) ? (handleDecimalOperation('+', modelValue.value, step.value) > max.value) : false)),\n)\n\nfunction handleChangingValue(type: 'increase' | 'decrease', multiplier = 1) {\n inputEl.value?.focus()\n const currentInputValue = numberParser.parse(inputEl.value?.value ?? '')\n if (props.disabled)\n return\n if (isNaN(currentInputValue)) {\n modelValue.value = min.value ?? 0\n }\n else {\n if (type === 'increase')\n modelValue.value = clampInputValue(currentInputValue + ((step.value ?? 1) * multiplier))\n else\n modelValue.value = clampInputValue(currentInputValue - ((step.value ?? 1) * multiplier))\n }\n}\n\nfunction handleIncrease(multiplier = 1) {\n handleChangingValue('increase', multiplier)\n}\nfunction handleDecrease(multiplier = 1) {\n handleChangingValue('decrease', multiplier)\n}\n\nfunction handleMinMaxValue(type: 'min' | 'max') {\n if (type === 'min' && min.value !== undefined)\n modelValue.value = clampInputValue(min.value)\n else if (type === 'max' && max.value !== undefined)\n modelValue.value = clampInputValue(max.value)\n}\n\n// Formatter\nconst numberFormatter = useNumberFormatter(locale, formatOptions)\nconst numberParser = useNumberParser(locale, formatOptions)\n\nconst inputMode = computed<HTMLAttributes['inputmode']>(() => {\n // The inputMode attribute influences the software keyboard that is shown on touch devices.\n // Browsers and operating systems are quite inconsistent about what keys are available, however.\n // We choose between numeric and decimal based on whether we allow negative and fractional numbers,\n // and based on testing on various devices to determine what keys are available in each inputMode.\n const hasDecimals = numberFormatter.resolvedOptions().maximumFractionDigits! > 0\n\n return hasDecimals ? 'decimal' : 'numeric'\n})\n// Replace negative textValue formatted using currencySign: 'accounting'\n// with a textValue that can be announced using a minus sign.\nconst textValueFormatter = useNumberFormatter(locale, formatOptions)\nconst textValue = computed(() => isNaN(modelValue.value) ? '' : textValueFormatter.format(modelValue.value))\n\nfunction validate(val: string) {\n return numberParser.isValidPartialNumber(val, min.value, max.value)\n}\n\nfunction setInputValue(val: string) {\n if (inputEl.value)\n inputEl.value.value = val\n}\n\nfunction clampInputValue(val: number) {\n // Clamp to min and max, round to the nearest step, and round to specified number of digits\n let clampedValue: number\n if (step.value === undefined || isNaN(step.value) || !stepSnapping.value)\n clampedValue = clamp(val, min.value, max.value)\n else\n clampedValue = snapValueToStep(val, min.value, max.value, step.value)\n\n clampedValue = numberParser.parse(numberFormatter.format(clampedValue))\n return clampedValue\n}\n\nfunction applyInputValue(val: string) {\n const parsedValue = numberParser.parse(val)\n\n modelValue.value = clampInputValue(parsedValue)\n // Set to empty state if input value is empty\n if (!val.length)\n return setInputValue(val)\n\n // if it failed to parse, then reset input to formatted version of current number\n if (isNaN(parsedValue))\n return setInputValue(textValue.value)\n\n return setInputValue(textValue.value)\n}\n\nprovideNumberFieldRootContext({\n modelValue,\n handleDecrease,\n handleIncrease,\n handleMinMaxValue,\n inputMode,\n inputEl,\n onInputElement: el => inputEl.value = el,\n textValue,\n validate,\n applyInputValue,\n disabled,\n disableWheelChange,\n max,\n min,\n isDecreaseDisabled,\n isIncreaseDisabled,\n id,\n})\n</script>\n\n<template>\n <Primitive\n v-bind=\"$attrs\"\n ref=\"primitiveElement\"\n role=\"group\"\n :as=\"as\"\n :as-child=\"asChild\"\n :data-disabled=\"disabled ? '' : undefined\"\n >\n <slot\n :model-value=\"modelValue\"\n :text-value=\"textValue\"\n />\n\n <VisuallyHiddenInput\n v-if=\"isFormControl && name\"\n type=\"text\"\n :value=\"modelValue\"\n :name=\"name\"\n :disabled=\"disabled\"\n :required=\"required\"\n />\n </Primitive>\n</template>\n"],"names":["createContext","toRefs","useVModel","usePrimitiveElement","useLocale","useFormControl","ref","computed","handleDecimalOperation","useNumberFormatter","useNumberParser","clamp","snapValueToStep"],"mappings":";;;;;;;;;;;;;AAsDO,MAAM,CAAC,4BAAA,EAA8B,6BAA6B,CAAA,GAAIA,mCAAsC,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;AAYpI,IAAA,MAAM,KAAQ,GAAA,OAAA;AAMd,IAAA,MAAM,KAAQ,GAAA,MAAA;AACd,IAAA,MAAM,EAAE,QAAA,EAAU,kBAAoB,EAAA,GAAA,EAAK,GAAK,EAAA,IAAA,EAAM,YAAc,EAAA,aAAA,EAAe,EAAI,EAAA,MAAA,EAAQ,UAAW,EAAA,GAAIC,WAAO,KAAK,CAAA;AAE1H,IAAA,MAAM,UAAa,GAAAC,cAAA,CAAU,KAAO,EAAA,YAAA,EAAc,KAAO,EAAA;AAAA,MACvD,cAAc,KAAM,CAAA,YAAA;AAAA,MACpB,OAAA,EAAU,MAAM,UAAe,KAAA;AAAA,KAChC,CAAA;AAED,IAAA,MAAM,EAAE,gBAAA,EAAkB,cAAe,EAAA,GAAIC,iDAAoB,EAAA;AAEjE,IAAM,MAAA,MAAA,GAASC,2BAAU,UAAU,CAAA;AACnC,IAAM,MAAA,aAAA,GAAgBC,qCAAe,cAAc,CAAA;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AAM,EAAA,KAAA,OAAA,CAAQ,KAAQ,GAAA,EAAA;AAAA,MACtC,SAAA;AAAA,MACA,QAAA;AAAA,MACA,eAAA;AAAA,MACA,QAAA;AAAA,MACA,kBAAA;AAAA,MACA,GAAA;AAAA,MACA,GAAA;AAAA,MACA,kBAAA;AAAA,MACA,kBAAA;AAAA,MACA;AAAA,KACD,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"NumberFieldRoot.cjs","sources":["../../src/NumberField/NumberFieldRoot.vue"],"sourcesContent":["<script lang=\"ts\">\nimport type { PrimitiveProps } from '@/Primitive'\nimport { useVModel } from '@vueuse/core'\nimport { clamp, createContext, snapValueToStep, useFormControl, useLocale } from '@/shared'\nimport { type HTMLAttributes, type Ref, computed, ref, toRefs } from 'vue'\nimport type { FormFieldProps } from '@/shared/types'\n\nexport interface NumberFieldRootProps extends PrimitiveProps, FormFieldProps {\n defaultValue?: number\n modelValue?: number | null\n /** The smallest value allowed for the input. */\n min?: number\n /** The largest value allowed for the input. */\n max?: number\n /** The amount that the input value changes with each increment or decrement \"tick\". */\n step?: number\n /** When `false`, prevents the value from snapping to the nearest increment of the step value */\n stepSnapping?: boolean\n /** Formatting options for the value displayed in the number field. This also affects what characters are allowed to be typed by the user. */\n formatOptions?: Intl.NumberFormatOptions\n /** The locale to use for formatting dates */\n locale?: string\n /** When `true`, prevents the user from interacting with the Number Field. */\n disabled?: boolean\n /** When `true`, prevents the value from changing on wheel scroll. */\n disableWheelChange?: boolean\n /** Id of the element */\n id?: string\n}\n\nexport type NumberFieldRootEmits = {\n 'update:modelValue': [val: number]\n}\n\ninterface NumberFieldRootContext {\n modelValue: Ref<number>\n handleIncrease: (multiplier?: number) => void\n handleDecrease: (multiplier?: number) => void\n handleMinMaxValue: (type: 'min' | 'max') => void\n inputEl: Ref<HTMLInputElement | undefined>\n onInputElement: (el: HTMLInputElement) => void\n inputMode: Ref<HTMLAttributes['inputmode']>\n textValue: Ref<string>\n validate: (val: string) => boolean\n applyInputValue: (val: string) => void\n disabled: Ref<boolean>\n disableWheelChange: Ref<boolean>\n max: Ref<number | undefined>\n min: Ref<number | undefined>\n isDecreaseDisabled: Ref<boolean>\n isIncreaseDisabled: Ref<boolean>\n id: Ref<string | undefined>\n}\n\nexport const [injectNumberFieldRootContext, provideNumberFieldRootContext] = createContext<NumberFieldRootContext>('NumberFieldRoot')\n</script>\n\n<script setup lang=\"ts\">\nimport { Primitive, usePrimitiveElement } from '@/Primitive'\nimport { handleDecimalOperation, useNumberFormatter, useNumberParser } from './utils'\nimport { VisuallyHiddenInput } from '@/VisuallyHidden'\n\ndefineOptions({\n inheritAttrs: false,\n})\n\nconst props = withDefaults(defineProps<NumberFieldRootProps>(), {\n as: 'div',\n defaultValue: undefined,\n step: 1,\n stepSnapping: true,\n})\nconst emits = defineEmits<NumberFieldRootEmits>()\nconst { disabled, disableWheelChange, min, max, step, stepSnapping, formatOptions, id, locale: propLocale } = toRefs(props)\n\nconst modelValue = useVModel(props, 'modelValue', emits, {\n defaultValue: props.defaultValue,\n passive: (props.modelValue === undefined) as false,\n}) as Ref<number>\n\nconst { primitiveElement, currentElement } = usePrimitiveElement()\n\nconst locale = useLocale(propLocale)\nconst isFormControl = useFormControl(currentElement)\nconst inputEl = ref<HTMLInputElement>()\n\nconst isDecreaseDisabled = computed(() => (\n clampInputValue(modelValue.value) === min.value\n || (min.value && !isNaN(modelValue.value) ? (handleDecimalOperation('-', modelValue.value, step.value) < min.value) : false)),\n)\nconst isIncreaseDisabled = computed(() => (\n clampInputValue(modelValue.value) === max.value\n || (max.value && !isNaN(modelValue.value) ? (handleDecimalOperation('+', modelValue.value, step.value) > max.value) : false)),\n)\n\nfunction handleChangingValue(type: 'increase' | 'decrease', multiplier = 1) {\n inputEl.value?.focus()\n const currentInputValue = numberParser.parse(inputEl.value?.value ?? '')\n if (props.disabled)\n return\n if (isNaN(currentInputValue)) {\n modelValue.value = min.value ?? 0\n }\n else {\n if (type === 'increase')\n modelValue.value = clampInputValue(currentInputValue + ((step.value ?? 1) * multiplier))\n else\n modelValue.value = clampInputValue(currentInputValue - ((step.value ?? 1) * multiplier))\n }\n}\n\nfunction handleIncrease(multiplier = 1) {\n handleChangingValue('increase', multiplier)\n}\nfunction handleDecrease(multiplier = 1) {\n handleChangingValue('decrease', multiplier)\n}\n\nfunction handleMinMaxValue(type: 'min' | 'max') {\n if (type === 'min' && min.value !== undefined)\n modelValue.value = clampInputValue(min.value)\n else if (type === 'max' && max.value !== undefined)\n modelValue.value = clampInputValue(max.value)\n}\n\n// Formatter\nconst numberFormatter = useNumberFormatter(locale, formatOptions)\nconst numberParser = useNumberParser(locale, formatOptions)\n\nconst inputMode = computed<HTMLAttributes['inputmode']>(() => {\n // The inputMode attribute influences the software keyboard that is shown on touch devices.\n // Browsers and operating systems are quite inconsistent about what keys are available, however.\n // We choose between numeric and decimal based on whether we allow negative and fractional numbers,\n // and based on testing on various devices to determine what keys are available in each inputMode.\n const hasDecimals = numberFormatter.resolvedOptions().maximumFractionDigits! > 0\n\n return hasDecimals ? 'decimal' : 'numeric'\n})\n// Replace negative textValue formatted using currencySign: 'accounting'\n// with a textValue that can be announced using a minus sign.\nconst textValueFormatter = useNumberFormatter(locale, formatOptions)\nconst textValue = computed(() => isNaN(modelValue.value) ? '' : textValueFormatter.format(modelValue.value))\n\nfunction validate(val: string) {\n return numberParser.isValidPartialNumber(val, min.value, max.value)\n}\n\nfunction setInputValue(val: string) {\n if (inputEl.value)\n inputEl.value.value = val\n}\n\nfunction clampInputValue(val: number) {\n // Clamp to min and max, round to the nearest step, and round to specified number of digits\n let clampedValue: number\n if (step.value === undefined || isNaN(step.value) || !stepSnapping.value)\n clampedValue = clamp(val, min.value, max.value)\n else\n clampedValue = snapValueToStep(val, min.value, max.value, step.value)\n\n clampedValue = numberParser.parse(numberFormatter.format(clampedValue))\n return clampedValue\n}\n\nfunction applyInputValue(val: string) {\n const parsedValue = numberParser.parse(val)\n\n modelValue.value = clampInputValue(parsedValue)\n // Set to empty state if input value is empty\n if (!val.length)\n return setInputValue(val)\n\n // if it failed to parse, then reset input to formatted version of current number\n if (isNaN(parsedValue))\n return setInputValue(textValue.value)\n\n return setInputValue(textValue.value)\n}\n\nprovideNumberFieldRootContext({\n modelValue,\n handleDecrease,\n handleIncrease,\n handleMinMaxValue,\n inputMode,\n inputEl,\n onInputElement: el => inputEl.value = el,\n textValue,\n validate,\n applyInputValue,\n disabled,\n disableWheelChange,\n max,\n min,\n isDecreaseDisabled,\n isIncreaseDisabled,\n id,\n})\n</script>\n\n<template>\n <Primitive\n v-bind=\"$attrs\"\n ref=\"primitiveElement\"\n role=\"group\"\n :as=\"as\"\n :as-child=\"asChild\"\n :data-disabled=\"disabled ? '' : undefined\"\n >\n <slot\n :model-value=\"modelValue\"\n :text-value=\"textValue\"\n />\n\n <VisuallyHiddenInput\n v-if=\"isFormControl && name\"\n type=\"text\"\n :value=\"modelValue\"\n :name=\"name\"\n :disabled=\"disabled\"\n :required=\"required\"\n />\n </Primitive>\n</template>\n"],"names":["createContext","toRefs","useVModel","usePrimitiveElement","useLocale","useFormControl","ref","computed","handleDecimalOperation","useNumberFormatter","useNumberParser","clamp","snapValueToStep"],"mappings":";;;;;;;;;;;;;AAsDO,MAAM,CAAC,4BAAA,EAA8B,6BAA6B,CAAA,GAAIA,mCAAsC,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;AAYpI,IAAA,MAAM,KAAQ,GAAA,OAAA;AAMd,IAAA,MAAM,KAAQ,GAAA,MAAA;AACd,IAAA,MAAM,EAAE,QAAA,EAAU,kBAAoB,EAAA,GAAA,EAAK,GAAK,EAAA,IAAA,EAAM,YAAc,EAAA,aAAA,EAAe,EAAI,EAAA,MAAA,EAAQ,UAAW,EAAA,GAAIC,WAAO,KAAK,CAAA;AAE1H,IAAA,MAAM,UAAa,GAAAC,cAAA,CAAU,KAAO,EAAA,YAAA,EAAc,KAAO,EAAA;AAAA,MACvD,cAAc,KAAM,CA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aAAA,CAAc,UAAU,KAAK,CAAA;AAEtC,MAAO,OAAA,aAAA,CAAc,UAAU,KAAK,CAAA;AAAA;AAGtC,IAA8B,6BAAA,CAAA;AAAA,MAC5B,UAAA;AAAA,MACA,cAAA;AAAA,MACA,cAAA;AAAA,MACA,iBAAA;AAAA,MACA,SAAA;AAAA,MACA,OAAA;AAAA,MACA,cAAA,EAAgB,CAAM,EAAA,KAAA,OAAA,CAAQ,KAAQ,GAAA,EAAA;AAAA,MACtC,SAAA;AAAA,MACA,QAAA;AAAA,MACA,eAAA;AAAA,MACA,QAAA;AAAA,MACA,kBAAA;AAAA,MACA,GAAA;AAAA,MACA,GAAA;AAAA,MACA,kBAAA;AAAA,MACA,kBAAA;AAAA,MACA;AAAA,KACD,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,13 +1,13 @@
1
- import { defineComponent, toRefs, ref, computed, openBlock, createBlock, unref, mergeProps, withCtx, renderSlot, createCommentVNode } from 'vue';
1
+ import { defineComponent, toRefs, ref, computed, createBlock, openBlock, unref, mergeProps, withCtx, renderSlot, createCommentVNode } from 'vue';
2
2
  import { h as handleDecimalOperation, a as useNumberFormatter, b as useNumberParser } from './utils.js';
3
3
  import { useVModel } from '@vueuse/core';
4
+ import { c as createContext } from '../shared/createContext.js';
4
5
  import { u as usePrimitiveElement } from '../Primitive/usePrimitiveElement.js';
5
6
  import { u as useLocale } from '../shared/useLocale.js';
6
7
  import { u as useFormControl } from '../shared/useFormControl.js';
7
8
  import { c as clamp, s as snapValueToStep } from '../shared/clamp.js';
8
9
  import { P as Primitive } from '../Primitive/Primitive.js';
9
10
  import { _ as _sfc_main$1 } from '../VisuallyHidden/VisuallyHiddenInput.js';
10
- import { c as createContext } from '../shared/createContext.js';
11
11
 
12
12
  const [injectNumberFieldRootContext, provideNumberFieldRootContext] = createContext("NumberFieldRoot");
13
13
  const _sfc_main = /* @__PURE__ */ defineComponent({
@@ -16,7 +16,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
16
16
  },
17
17
  __name: "NumberFieldRoot",
18
18
  props: {
19
- defaultValue: { default: undefined },
19
+ defaultValue: { default: void 0 },
20
20
  modelValue: {},
21
21
  min: {},
22
22
  max: {},
@@ -39,7 +39,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
39
39
  const { disabled, disableWheelChange, min, max, step, stepSnapping, formatOptions, id, locale: propLocale } = toRefs(props);
40
40
  const modelValue = useVModel(props, "modelValue", emits, {
41
41
  defaultValue: props.defaultValue,
42
- passive: props.modelValue === undefined
42
+ passive: props.modelValue === void 0
43
43
  });
44
44
  const { primitiveElement, currentElement } = usePrimitiveElement();
45
45
  const locale = useLocale(propLocale);
@@ -72,9 +72,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
72
72
  handleChangingValue("decrease", multiplier);
73
73
  }
74
74
  function handleMinMaxValue(type) {
75
- if (type === "min" && min.value !== undefined)
75
+ if (type === "min" && min.value !== void 0)
76
76
  modelValue.value = clampInputValue(min.value);
77
- else if (type === "max" && max.value !== undefined)
77
+ else if (type === "max" && max.value !== void 0)
78
78
  modelValue.value = clampInputValue(max.value);
79
79
  }
80
80
  const numberFormatter = useNumberFormatter(locale, formatOptions);
@@ -94,7 +94,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
94
94
  }
95
95
  function clampInputValue(val) {
96
96
  let clampedValue;
97
- if (step.value === undefined || isNaN(step.value) || !stepSnapping.value)
97
+ if (step.value === void 0 || isNaN(step.value) || !stepSnapping.value)
98
98
  clampedValue = clamp(val, min.value, max.value);
99
99
  else
100
100
  clampedValue = snapValueToStep(val, min.value, max.value, step.value);
@@ -136,7 +136,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
136
136
  role: "group",
137
137
  as: _ctx.as,
138
138
  "as-child": _ctx.asChild,
139
- "data-disabled": unref(disabled) ? "" : undefined
139
+ "data-disabled": unref(disabled) ? "" : void 0
140
140
  }), {
141
141
  default: withCtx(() => [
142
142
  renderSlot(_ctx.$slots, "default", {
@@ -1 +1 @@
1
- {"version":3,"file":"NumberFieldRoot.js","sources":["../../src/NumberField/NumberFieldRoot.vue"],"sourcesContent":["<script lang=\"ts\">\nimport type { PrimitiveProps } from '@/Primitive'\nimport { useVModel } from '@vueuse/core'\nimport { clamp, createContext, snapValueToStep, useFormControl, useLocale } from '@/shared'\nimport { type HTMLAttributes, type Ref, computed, ref, toRefs } from 'vue'\nimport type { FormFieldProps } from '@/shared/types'\n\nexport interface NumberFieldRootProps extends PrimitiveProps, FormFieldProps {\n defaultValue?: number\n modelValue?: number | null\n /** The smallest value allowed for the input. */\n min?: number\n /** The largest value allowed for the input. */\n max?: number\n /** The amount that the input value changes with each increment or decrement \"tick\". */\n step?: number\n /** When `false`, prevents the value from snapping to the nearest increment of the step value */\n stepSnapping?: boolean\n /** Formatting options for the value displayed in the number field. This also affects what characters are allowed to be typed by the user. */\n formatOptions?: Intl.NumberFormatOptions\n /** The locale to use for formatting dates */\n locale?: string\n /** When `true`, prevents the user from interacting with the Number Field. */\n disabled?: boolean\n /** When `true`, prevents the value from changing on wheel scroll. */\n disableWheelChange?: boolean\n /** Id of the element */\n id?: string\n}\n\nexport type NumberFieldRootEmits = {\n 'update:modelValue': [val: number]\n}\n\ninterface NumberFieldRootContext {\n modelValue: Ref<number>\n handleIncrease: (multiplier?: number) => void\n handleDecrease: (multiplier?: number) => void\n handleMinMaxValue: (type: 'min' | 'max') => void\n inputEl: Ref<HTMLInputElement | undefined>\n onInputElement: (el: HTMLInputElement) => void\n inputMode: Ref<HTMLAttributes['inputmode']>\n textValue: Ref<string>\n validate: (val: string) => boolean\n applyInputValue: (val: string) => void\n disabled: Ref<boolean>\n disableWheelChange: Ref<boolean>\n max: Ref<number | undefined>\n min: Ref<number | undefined>\n isDecreaseDisabled: Ref<boolean>\n isIncreaseDisabled: Ref<boolean>\n id: Ref<string | undefined>\n}\n\nexport const [injectNumberFieldRootContext, provideNumberFieldRootContext] = createContext<NumberFieldRootContext>('NumberFieldRoot')\n</script>\n\n<script setup lang=\"ts\">\nimport { Primitive, usePrimitiveElement } from '@/Primitive'\nimport { handleDecimalOperation, useNumberFormatter, useNumberParser } from './utils'\nimport { VisuallyHiddenInput } from '@/VisuallyHidden'\n\ndefineOptions({\n inheritAttrs: false,\n})\n\nconst props = withDefaults(defineProps<NumberFieldRootProps>(), {\n as: 'div',\n defaultValue: undefined,\n step: 1,\n stepSnapping: true,\n})\nconst emits = defineEmits<NumberFieldRootEmits>()\nconst { disabled, disableWheelChange, min, max, step, stepSnapping, formatOptions, id, locale: propLocale } = toRefs(props)\n\nconst modelValue = useVModel(props, 'modelValue', emits, {\n defaultValue: props.defaultValue,\n passive: (props.modelValue === undefined) as false,\n}) as Ref<number>\n\nconst { primitiveElement, currentElement } = usePrimitiveElement()\n\nconst locale = useLocale(propLocale)\nconst isFormControl = useFormControl(currentElement)\nconst inputEl = ref<HTMLInputElement>()\n\nconst isDecreaseDisabled = computed(() => (\n clampInputValue(modelValue.value) === min.value\n || (min.value && !isNaN(modelValue.value) ? (handleDecimalOperation('-', modelValue.value, step.value) < min.value) : false)),\n)\nconst isIncreaseDisabled = computed(() => (\n clampInputValue(modelValue.value) === max.value\n || (max.value && !isNaN(modelValue.value) ? (handleDecimalOperation('+', modelValue.value, step.value) > max.value) : false)),\n)\n\nfunction handleChangingValue(type: 'increase' | 'decrease', multiplier = 1) {\n inputEl.value?.focus()\n const currentInputValue = numberParser.parse(inputEl.value?.value ?? '')\n if (props.disabled)\n return\n if (isNaN(currentInputValue)) {\n modelValue.value = min.value ?? 0\n }\n else {\n if (type === 'increase')\n modelValue.value = clampInputValue(currentInputValue + ((step.value ?? 1) * multiplier))\n else\n modelValue.value = clampInputValue(currentInputValue - ((step.value ?? 1) * multiplier))\n }\n}\n\nfunction handleIncrease(multiplier = 1) {\n handleChangingValue('increase', multiplier)\n}\nfunction handleDecrease(multiplier = 1) {\n handleChangingValue('decrease', multiplier)\n}\n\nfunction handleMinMaxValue(type: 'min' | 'max') {\n if (type === 'min' && min.value !== undefined)\n modelValue.value = clampInputValue(min.value)\n else if (type === 'max' && max.value !== undefined)\n modelValue.value = clampInputValue(max.value)\n}\n\n// Formatter\nconst numberFormatter = useNumberFormatter(locale, formatOptions)\nconst numberParser = useNumberParser(locale, formatOptions)\n\nconst inputMode = computed<HTMLAttributes['inputmode']>(() => {\n // The inputMode attribute influences the software keyboard that is shown on touch devices.\n // Browsers and operating systems are quite inconsistent about what keys are available, however.\n // We choose between numeric and decimal based on whether we allow negative and fractional numbers,\n // and based on testing on various devices to determine what keys are available in each inputMode.\n const hasDecimals = numberFormatter.resolvedOptions().maximumFractionDigits! > 0\n\n return hasDecimals ? 'decimal' : 'numeric'\n})\n// Replace negative textValue formatted using currencySign: 'accounting'\n// with a textValue that can be announced using a minus sign.\nconst textValueFormatter = useNumberFormatter(locale, formatOptions)\nconst textValue = computed(() => isNaN(modelValue.value) ? '' : textValueFormatter.format(modelValue.value))\n\nfunction validate(val: string) {\n return numberParser.isValidPartialNumber(val, min.value, max.value)\n}\n\nfunction setInputValue(val: string) {\n if (inputEl.value)\n inputEl.value.value = val\n}\n\nfunction clampInputValue(val: number) {\n // Clamp to min and max, round to the nearest step, and round to specified number of digits\n let clampedValue: number\n if (step.value === undefined || isNaN(step.value) || !stepSnapping.value)\n clampedValue = clamp(val, min.value, max.value)\n else\n clampedValue = snapValueToStep(val, min.value, max.value, step.value)\n\n clampedValue = numberParser.parse(numberFormatter.format(clampedValue))\n return clampedValue\n}\n\nfunction applyInputValue(val: string) {\n const parsedValue = numberParser.parse(val)\n\n modelValue.value = clampInputValue(parsedValue)\n // Set to empty state if input value is empty\n if (!val.length)\n return setInputValue(val)\n\n // if it failed to parse, then reset input to formatted version of current number\n if (isNaN(parsedValue))\n return setInputValue(textValue.value)\n\n return setInputValue(textValue.value)\n}\n\nprovideNumberFieldRootContext({\n modelValue,\n handleDecrease,\n handleIncrease,\n handleMinMaxValue,\n inputMode,\n inputEl,\n onInputElement: el => inputEl.value = el,\n textValue,\n validate,\n applyInputValue,\n disabled,\n disableWheelChange,\n max,\n min,\n isDecreaseDisabled,\n isIncreaseDisabled,\n id,\n})\n</script>\n\n<template>\n <Primitive\n v-bind=\"$attrs\"\n ref=\"primitiveElement\"\n role=\"group\"\n :as=\"as\"\n :as-child=\"asChild\"\n :data-disabled=\"disabled ? '' : undefined\"\n >\n <slot\n :model-value=\"modelValue\"\n :text-value=\"textValue\"\n />\n\n <VisuallyHiddenInput\n v-if=\"isFormControl && name\"\n type=\"text\"\n :value=\"modelValue\"\n :name=\"name\"\n :disabled=\"disabled\"\n :required=\"required\"\n />\n </Primitive>\n</template>\n"],"names":[],"mappings":";;;;;;;;;;;AAsDO,MAAM,CAAC,4BAAA,EAA8B,6BAA6B,CAAA,GAAI,cAAsC,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;AAYpI,IAAA,MAAM,KAAQ,GAAA,OAAA;AAMd,IAAA,MAAM,KAAQ,GAAA,MAAA;AACd,IAAA,MAAM,EAAE,QAAA,EAAU,kBAAoB,EAAA,GAAA,EAAK,GAAK,EAAA,IAAA,EAAM,YAAc,EAAA,aAAA,EAAe,EAAI,EAAA,MAAA,EAAQ,UAAW,EAAA,GAAI,OAAO,KAAK,CAAA;AAE1H,IAAA,MAAM,UAAa,GAAA,SAAA,CAAU,KAAO,EAAA,YAAA,EAAc,KAAO,EAAA;AAAA,MACvD,cAAc,KAAM,CAAA,YAAA;AAAA,MACpB,OAAA,EAAU,MAAM,UAAe,KAAA;AAAA,KAChC,CAAA;AAED,IAAA,MAAM,EAAE,gBAAA,EAAkB,cAAe,EAAA,GAAI,mBAAoB,EAAA;AAEjE,IAAM,MAAA,MAAA,GAAS,UAAU,UAAU,CAAA;AACnC,IAAM,MAAA,aAAA,GAAgB,eAAe,cAAc,CAAA;AACnD,IAAA,MAAM,UAAU,GAAsB,EAAA;AAEtC,IAAA,MAAM,kBAAqB,GAAA,QAAA;AAAA,MAAS,MAClC,gBAAgB,UAAW,CAAA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AAA;AAAA,MACA,GAAA;AAAA,MACA,GAAA;AAAA,MACA,kBAAA;AAAA,MACA,kBAAA;AAAA,MACA;AAAA,KACD,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"NumberFieldRoot.js","sources":["../../src/NumberField/NumberFieldRoot.vue"],"sourcesContent":["<script lang=\"ts\">\nimport type { PrimitiveProps } from '@/Primitive'\nimport { useVModel } from '@vueuse/core'\nimport { clamp, createContext, snapValueToStep, useFormControl, useLocale } from '@/shared'\nimport { type HTMLAttributes, type Ref, computed, ref, toRefs } from 'vue'\nimport type { FormFieldProps } from '@/shared/types'\n\nexport interface NumberFieldRootProps extends PrimitiveProps, FormFieldProps {\n defaultValue?: number\n modelValue?: number | null\n /** The smallest value allowed for the input. */\n min?: number\n /** The largest value allowed for the input. */\n max?: number\n /** The amount that the input value changes with each increment or decrement \"tick\". */\n step?: number\n /** When `false`, prevents the value from snapping to the nearest increment of the step value */\n stepSnapping?: boolean\n /** Formatting options for the value displayed in the number field. This also affects what characters are allowed to be typed by the user. */\n formatOptions?: Intl.NumberFormatOptions\n /** The locale to use for formatting dates */\n locale?: string\n /** When `true`, prevents the user from interacting with the Number Field. */\n disabled?: boolean\n /** When `true`, prevents the value from changing on wheel scroll. */\n disableWheelChange?: boolean\n /** Id of the element */\n id?: string\n}\n\nexport type NumberFieldRootEmits = {\n 'update:modelValue': [val: number]\n}\n\ninterface NumberFieldRootContext {\n modelValue: Ref<number>\n handleIncrease: (multiplier?: number) => void\n handleDecrease: (multiplier?: number) => void\n handleMinMaxValue: (type: 'min' | 'max') => void\n inputEl: Ref<HTMLInputElement | undefined>\n onInputElement: (el: HTMLInputElement) => void\n inputMode: Ref<HTMLAttributes['inputmode']>\n textValue: Ref<string>\n validate: (val: string) => boolean\n applyInputValue: (val: string) => void\n disabled: Ref<boolean>\n disableWheelChange: Ref<boolean>\n max: Ref<number | undefined>\n min: Ref<number | undefined>\n isDecreaseDisabled: Ref<boolean>\n isIncreaseDisabled: Ref<boolean>\n id: Ref<string | undefined>\n}\n\nexport const [injectNumberFieldRootContext, provideNumberFieldRootContext] = createContext<NumberFieldRootContext>('NumberFieldRoot')\n</script>\n\n<script setup lang=\"ts\">\nimport { Primitive, usePrimitiveElement } from '@/Primitive'\nimport { handleDecimalOperation, useNumberFormatter, useNumberParser } from './utils'\nimport { VisuallyHiddenInput } from '@/VisuallyHidden'\n\ndefineOptions({\n inheritAttrs: false,\n})\n\nconst props = withDefaults(defineProps<NumberFieldRootProps>(), {\n as: 'div',\n defaultValue: undefined,\n step: 1,\n stepSnapping: true,\n})\nconst emits = defineEmits<NumberFieldRootEmits>()\nconst { disabled, disableWheelChange, min, max, step, stepSnapping, formatOptions, id, locale: propLocale } = toRefs(props)\n\nconst modelValue = useVModel(props, 'modelValue', emits, {\n defaultValue: props.defaultValue,\n passive: (props.modelValue === undefined) as false,\n}) as Ref<number>\n\nconst { primitiveElement, currentElement } = usePrimitiveElement()\n\nconst locale = useLocale(propLocale)\nconst isFormControl = useFormControl(currentElement)\nconst inputEl = ref<HTMLInputElement>()\n\nconst isDecreaseDisabled = computed(() => (\n clampInputValue(modelValue.value) === min.value\n || (min.value && !isNaN(modelValue.value) ? (handleDecimalOperation('-', modelValue.value, step.value) < min.value) : false)),\n)\nconst isIncreaseDisabled = computed(() => (\n clampInputValue(modelValue.value) === max.value\n || (max.value && !isNaN(modelValue.value) ? (handleDecimalOperation('+', modelValue.value, step.value) > max.value) : false)),\n)\n\nfunction handleChangingValue(type: 'increase' | 'decrease', multiplier = 1) {\n inputEl.value?.focus()\n const currentInputValue = numberParser.parse(inputEl.value?.value ?? '')\n if (props.disabled)\n return\n if (isNaN(currentInputValue)) {\n modelValue.value = min.value ?? 0\n }\n else {\n if (type === 'increase')\n modelValue.value = clampInputValue(currentInputValue + ((step.value ?? 1) * multiplier))\n else\n modelValue.value = clampInputValue(currentInputValue - ((step.value ?? 1) * multiplier))\n }\n}\n\nfunction handleIncrease(multiplier = 1) {\n handleChangingValue('increase', multiplier)\n}\nfunction handleDecrease(multiplier = 1) {\n handleChangingValue('decrease', multiplier)\n}\n\nfunction handleMinMaxValue(type: 'min' | 'max') {\n if (type === 'min' && min.value !== undefined)\n modelValue.value = clampInputValue(min.value)\n else if (type === 'max' && max.value !== undefined)\n modelValue.value = clampInputValue(max.value)\n}\n\n// Formatter\nconst numberFormatter = useNumberFormatter(locale, formatOptions)\nconst numberParser = useNumberParser(locale, formatOptions)\n\nconst inputMode = computed<HTMLAttributes['inputmode']>(() => {\n // The inputMode attribute influences the software keyboard that is shown on touch devices.\n // Browsers and operating systems are quite inconsistent about what keys are available, however.\n // We choose between numeric and decimal based on whether we allow negative and fractional numbers,\n // and based on testing on various devices to determine what keys are available in each inputMode.\n const hasDecimals = numberFormatter.resolvedOptions().maximumFractionDigits! > 0\n\n return hasDecimals ? 'decimal' : 'numeric'\n})\n// Replace negative textValue formatted using currencySign: 'accounting'\n// with a textValue that can be announced using a minus sign.\nconst textValueFormatter = useNumberFormatter(locale, formatOptions)\nconst textValue = computed(() => isNaN(modelValue.value) ? '' : textValueFormatter.format(modelValue.value))\n\nfunction validate(val: string) {\n return numberParser.isValidPartialNumber(val, min.value, max.value)\n}\n\nfunction setInputValue(val: string) {\n if (inputEl.value)\n inputEl.value.value = val\n}\n\nfunction clampInputValue(val: number) {\n // Clamp to min and max, round to the nearest step, and round to specified number of digits\n let clampedValue: number\n if (step.value === undefined || isNaN(step.value) || !stepSnapping.value)\n clampedValue = clamp(val, min.value, max.value)\n else\n clampedValue = snapValueToStep(val, min.value, max.value, step.value)\n\n clampedValue = numberParser.parse(numberFormatter.format(clampedValue))\n return clampedValue\n}\n\nfunction applyInputValue(val: string) {\n const parsedValue = numberParser.parse(val)\n\n modelValue.value = clampInputValue(parsedValue)\n // Set to empty state if input value is empty\n if (!val.length)\n return setInputValue(val)\n\n // if it failed to parse, then reset input to formatted version of current number\n if (isNaN(parsedValue))\n return setInputValue(textValue.value)\n\n return setInputValue(textValue.value)\n}\n\nprovideNumberFieldRootContext({\n modelValue,\n handleDecrease,\n handleIncrease,\n handleMinMaxValue,\n inputMode,\n inputEl,\n onInputElement: el => inputEl.value = el,\n textValue,\n validate,\n applyInputValue,\n disabled,\n disableWheelChange,\n max,\n min,\n isDecreaseDisabled,\n isIncreaseDisabled,\n id,\n})\n</script>\n\n<template>\n <Primitive\n v-bind=\"$attrs\"\n ref=\"primitiveElement\"\n role=\"group\"\n :as=\"as\"\n :as-child=\"asChild\"\n :data-disabled=\"disabled ? '' : undefined\"\n >\n <slot\n :model-value=\"modelValue\"\n :text-value=\"textValue\"\n />\n\n <VisuallyHiddenInput\n v-if=\"isFormControl && name\"\n type=\"text\"\n :value=\"modelValue\"\n :name=\"name\"\n :disabled=\"disabled\"\n :required=\"required\"\n />\n </Primitive>\n</template>\n"],"names":[],"mappings":";;;;;;;;;;;AAsDO,MAAM,CAAC,4BAAA,EAA8B,6BAA6B,CAAA,GAAI,cAAsC,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;AAYpI,IAAA,MAAM,KAAQ,GAAA,OAAA;AAMd,IAAA,MAAM,KAAQ,GAAA,MAAA;AACd,IAAA,MAAM,EAAE,QAAA,EAAU,kBAAoB,EAAA,GAAA,EAAK,GAAK,EAAA,IAAA,EAAM,YAAc,EAAA,aAAA,EAAe,EAAI,EAAA,MAAA,EAAQ,UAAW,EAAA,GAAI,OAAO,KAAK,CAAA;AAE1H,IAAA,MAAM,UAAa,GAAA,SAAA,CAAU,KAAO,EAAA,YAAA,EAAc,KAAO,EAAA;AAAA,MACvD,cAAc,KAAM,CAAA,YAAA;AAAA,MACpB,OAAA,EAAU,MAAM,UAAe,KAAA;AAAA,KAChC,CAAA;AAED,IAAA,MAAM,EAAE,gBAAA,EAAkB,cAAe,EAAA,GAAI,mBAAoB,EAAA;AAEjE,IAAM,MAAA,MAAA,GAAS,UAAU,UAAU,CAAA;AACnC,IAAM,MAAA,aAAA,GAAgB,eAAe,cAAc,CAAA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,OAAA,CAAQ,KAAQ,GAAA,EAAA;AAAA,MACtC,SAAA;AAAA,MACA,QAAA;AAAA,MACA,eAAA;AAAA,MACA,QAAA;AAAA,MACA,kBAAA;AAAA,MACA,GAAA;AAAA,MACA,GAAA;AAAA,MACA,kBAAA;AAAA,MACA,kBAAA;AAAA,MACA;AAAA,KACD,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,6 +1,6 @@
1
1
  import { NumberFormatter, NumberParser } from '@internationalized/number';
2
2
  import { unrefElement, useEventListener } from '@vueuse/core';
3
- import { createEventHook, isClient, reactiveComputed } from '@vueuse/shared';
3
+ import { reactiveComputed, createEventHook, isClient } from '@vueuse/shared';
4
4
  import { ref, computed } from 'vue';
5
5
 
6
6
  function usePressedHold(options) {
@@ -1,4 +1,4 @@
1
- import { defineComponent, openBlock, createBlock, unref, mergeProps, withCtx, renderSlot, createTextVNode } from 'vue';
1
+ import { defineComponent, createBlock, openBlock, unref, mergeProps, withCtx, renderSlot, createTextVNode } from 'vue';
2
2
  import { u as useForwardExpose } from '../shared/useForwardExpose.js';
3
3
  import { P as Primitive } from '../Primitive/Primitive.js';
4
4
 
@@ -19,7 +19,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
19
19
  return (_ctx, _cache) => {
20
20
  return vue.openBlock(), vue.createBlock(vue.unref(Primitive_Primitive.Primitive), vue.mergeProps(props, {
21
21
  "aria-label": "First Page",
22
- type: _ctx.as === "button" ? "button" : undefined,
22
+ type: _ctx.as === "button" ? "button" : void 0,
23
23
  disabled: disabled.value,
24
24
  onClick: _cache[0] || (_cache[0] = ($event) => !disabled.value && vue.unref(rootContext).onPageChange(1))
25
25
  }), {
@@ -1,4 +1,4 @@
1
- import { defineComponent, computed, openBlock, createBlock, unref, mergeProps, withCtx, renderSlot, createTextVNode } from 'vue';
1
+ import { defineComponent, computed, createBlock, openBlock, unref, mergeProps, withCtx, renderSlot, createTextVNode } from 'vue';
2
2
  import { i as injectPaginationRootContext } from './PaginationRoot.js';
3
3
  import { u as useForwardExpose } from '../shared/useForwardExpose.js';
4
4
  import { P as Primitive } from '../Primitive/Primitive.js';
@@ -17,7 +17,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
17
17
  return (_ctx, _cache) => {
18
18
  return openBlock(), createBlock(unref(Primitive), mergeProps(props, {
19
19
  "aria-label": "First Page",
20
- type: _ctx.as === "button" ? "button" : undefined,
20
+ type: _ctx.as === "button" ? "button" : void 0,
21
21
  disabled: disabled.value,
22
22
  onClick: _cache[0] || (_cache[0] = ($event) => !disabled.value && unref(rootContext).onPageChange(1))
23
23
  }), {
@@ -19,7 +19,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
19
19
  return (_ctx, _cache) => {
20
20
  return vue.openBlock(), vue.createBlock(vue.unref(Primitive_Primitive.Primitive), vue.mergeProps(props, {
21
21
  "aria-label": "Last Page",
22
- type: _ctx.as === "button" ? "button" : undefined,
22
+ type: _ctx.as === "button" ? "button" : void 0,
23
23
  disabled: disabled.value,
24
24
  onClick: _cache[0] || (_cache[0] = ($event) => !disabled.value && vue.unref(rootContext).onPageChange(vue.unref(rootContext).pageCount.value))
25
25
  }), {
@@ -1,4 +1,4 @@
1
- import { defineComponent, computed, openBlock, createBlock, unref, mergeProps, withCtx, renderSlot, createTextVNode } from 'vue';
1
+ import { defineComponent, computed, createBlock, openBlock, unref, mergeProps, withCtx, renderSlot, createTextVNode } from 'vue';
2
2
  import { u as useForwardExpose } from '../shared/useForwardExpose.js';
3
3
  import { P as Primitive } from '../Primitive/Primitive.js';
4
4
  import { i as injectPaginationRootContext } from './PaginationRoot.js';
@@ -17,7 +17,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
17
17
  return (_ctx, _cache) => {
18
18
  return openBlock(), createBlock(unref(Primitive), mergeProps(props, {
19
19
  "aria-label": "Last Page",
20
- type: _ctx.as === "button" ? "button" : undefined,
20
+ type: _ctx.as === "button" ? "button" : void 0,
21
21
  disabled: disabled.value,
22
22
  onClick: _cache[0] || (_cache[0] = ($event) => !disabled.value && unref(rootContext).onPageChange(unref(rootContext).pageCount.value))
23
23
  }), {
@@ -1,4 +1,4 @@
1
- import { defineComponent, computed, openBlock, createBlock, unref, normalizeProps, guardReactiveProps, withCtx, renderSlot } from 'vue';
1
+ import { defineComponent, computed, createBlock, openBlock, unref, normalizeProps, guardReactiveProps, withCtx, renderSlot } from 'vue';
2
2
  import { t as transform, g as getRange } from './utils.js';
3
3
  import { u as useForwardExpose } from '../shared/useForwardExpose.js';
4
4
  import { P as Primitive } from '../Primitive/Primitive.js';
@@ -22,10 +22,10 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
22
22
  return vue.openBlock(), vue.createBlock(vue.unref(Primitive_Primitive.Primitive), vue.mergeProps(props, {
23
23
  "data-type": "page",
24
24
  "aria-label": `Page ${_ctx.value}`,
25
- "aria-current": isSelected.value ? "page" : undefined,
26
- "data-selected": isSelected.value ? "true" : undefined,
25
+ "aria-current": isSelected.value ? "page" : void 0,
26
+ "data-selected": isSelected.value ? "true" : void 0,
27
27
  disabled: disabled.value,
28
- type: _ctx.as === "button" ? "button" : undefined,
28
+ type: _ctx.as === "button" ? "button" : void 0,
29
29
  onClick: _cache[0] || (_cache[0] = ($event) => !disabled.value && vue.unref(rootContext).onPageChange(_ctx.value))
30
30
  }), {
31
31
  default: vue.withCtx(() => [
@@ -1,4 +1,4 @@
1
- import { defineComponent, computed, openBlock, createBlock, unref, mergeProps, withCtx, renderSlot, createTextVNode, toDisplayString } from 'vue';
1
+ import { defineComponent, computed, createBlock, openBlock, unref, mergeProps, withCtx, renderSlot, createTextVNode, toDisplayString } from 'vue';
2
2
  import { u as useForwardExpose } from '../shared/useForwardExpose.js';
3
3
  import { P as Primitive } from '../Primitive/Primitive.js';
4
4
  import { i as injectPaginationRootContext } from './PaginationRoot.js';
@@ -20,10 +20,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
20
20
  return openBlock(), createBlock(unref(Primitive), mergeProps(props, {
21
21
  "data-type": "page",
22
22
  "aria-label": `Page ${_ctx.value}`,
23
- "aria-current": isSelected.value ? "page" : undefined,
24
- "data-selected": isSelected.value ? "true" : undefined,
23
+ "aria-current": isSelected.value ? "page" : void 0,
24
+ "data-selected": isSelected.value ? "true" : void 0,
25
25
  disabled: disabled.value,
26
- type: _ctx.as === "button" ? "button" : undefined,
26
+ type: _ctx.as === "button" ? "button" : void 0,
27
27
  onClick: _cache[0] || (_cache[0] = ($event) => !disabled.value && unref(rootContext).onPageChange(_ctx.value))
28
28
  }), {
29
29
  default: withCtx(() => [
@@ -19,7 +19,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
19
19
  return (_ctx, _cache) => {
20
20
  return vue.openBlock(), vue.createBlock(vue.unref(Primitive_Primitive.Primitive), vue.mergeProps(props, {
21
21
  "aria-label": "Next Page",
22
- type: _ctx.as === "button" ? "button" : undefined,
22
+ type: _ctx.as === "button" ? "button" : void 0,
23
23
  disabled: disabled.value,
24
24
  onClick: _cache[0] || (_cache[0] = ($event) => !disabled.value && vue.unref(rootContext).onPageChange(vue.unref(rootContext).page.value + 1))
25
25
  }), {
@@ -1,4 +1,4 @@
1
- import { defineComponent, computed, openBlock, createBlock, unref, mergeProps, withCtx, renderSlot, createTextVNode } from 'vue';
1
+ import { defineComponent, computed, createBlock, openBlock, unref, mergeProps, withCtx, renderSlot, createTextVNode } from 'vue';
2
2
  import { u as useForwardExpose } from '../shared/useForwardExpose.js';
3
3
  import { P as Primitive } from '../Primitive/Primitive.js';
4
4
  import { i as injectPaginationRootContext } from './PaginationRoot.js';
@@ -17,7 +17,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
17
17
  return (_ctx, _cache) => {
18
18
  return openBlock(), createBlock(unref(Primitive), mergeProps(props, {
19
19
  "aria-label": "Next Page",
20
- type: _ctx.as === "button" ? "button" : undefined,
20
+ type: _ctx.as === "button" ? "button" : void 0,
21
21
  disabled: disabled.value,
22
22
  onClick: _cache[0] || (_cache[0] = ($event) => !disabled.value && unref(rootContext).onPageChange(unref(rootContext).page.value + 1))
23
23
  }), {
@@ -19,7 +19,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
19
19
  return (_ctx, _cache) => {
20
20
  return vue.openBlock(), vue.createBlock(vue.unref(Primitive_Primitive.Primitive), vue.mergeProps(props, {
21
21
  "aria-label": "Previous Page",
22
- type: _ctx.as === "button" ? "button" : undefined,
22
+ type: _ctx.as === "button" ? "button" : void 0,
23
23
  disabled: disabled.value,
24
24
  onClick: _cache[0] || (_cache[0] = ($event) => !disabled.value && vue.unref(rootContext).onPageChange(vue.unref(rootContext).page.value - 1))
25
25
  }), {
@@ -1,4 +1,4 @@
1
- import { defineComponent, computed, openBlock, createBlock, unref, mergeProps, withCtx, renderSlot, createTextVNode } from 'vue';
1
+ import { defineComponent, computed, createBlock, openBlock, unref, mergeProps, withCtx, renderSlot, createTextVNode } from 'vue';
2
2
  import { u as useForwardExpose } from '../shared/useForwardExpose.js';
3
3
  import { P as Primitive } from '../Primitive/Primitive.js';
4
4
  import { i as injectPaginationRootContext } from './PaginationRoot.js';
@@ -17,7 +17,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
17
17
  return (_ctx, _cache) => {
18
18
  return openBlock(), createBlock(unref(Primitive), mergeProps(props, {
19
19
  "aria-label": "Previous Page",
20
- type: _ctx.as === "button" ? "button" : undefined,
20
+ type: _ctx.as === "button" ? "button" : void 0,
21
21
  disabled: disabled.value,
22
22
  onClick: _cache[0] || (_cache[0] = ($event) => !disabled.value && unref(rootContext).onPageChange(unref(rootContext).page.value - 1))
23
23
  }), {
@@ -2,9 +2,9 @@
2
2
 
3
3
  const vue = require('vue');
4
4
  const core = require('@vueuse/core');
5
+ const shared_createContext = require('../shared/createContext.cjs');
5
6
  const shared_useForwardExpose = require('../shared/useForwardExpose.cjs');
6
7
  const Primitive_Primitive = require('../Primitive/Primitive.cjs');
7
- const shared_createContext = require('../shared/createContext.cjs');
8
8
 
9
9
  const [injectPaginationRootContext, providePaginationRootContext] = shared_createContext.createContext("PaginationRoot");
10
10
  const _sfc_main = /* @__PURE__ */ vue.defineComponent({
@@ -28,7 +28,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
28
28
  shared_useForwardExpose.useForwardExpose();
29
29
  const page = core.useVModel(props, "page", emits, {
30
30
  defaultValue: props.defaultPage,
31
- passive: props.page === undefined
31
+ passive: props.page === void 0
32
32
  });
33
33
  const pageCount = vue.computed(() => Math.max(1, Math.ceil(props.total / (props.itemsPerPage || 1))));
34
34
  providePaginationRootContext({
@@ -1,8 +1,8 @@
1
- import { defineComponent, toRefs, computed, openBlock, createBlock, unref, withCtx, renderSlot } from 'vue';
1
+ import { defineComponent, toRefs, computed, createBlock, openBlock, unref, withCtx, renderSlot } from 'vue';
2
2
  import { useVModel } from '@vueuse/core';
3
+ import { c as createContext } from '../shared/createContext.js';
3
4
  import { u as useForwardExpose } from '../shared/useForwardExpose.js';
4
5
  import { P as Primitive } from '../Primitive/Primitive.js';
5
- import { c as createContext } from '../shared/createContext.js';
6
6
 
7
7
  const [injectPaginationRootContext, providePaginationRootContext] = createContext("PaginationRoot");
8
8
  const _sfc_main = /* @__PURE__ */ defineComponent({
@@ -26,7 +26,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
26
26
  useForwardExpose();
27
27
  const page = useVModel(props, "page", emits, {
28
28
  defaultValue: props.defaultPage,
29
- passive: props.page === undefined
29
+ passive: props.page === void 0
30
30
  });
31
31
  const pageCount = computed(() => Math.max(1, Math.ceil(props.total / (props.itemsPerPage || 1))));
32
32
  providePaginationRootContext({
@@ -49,7 +49,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
49
49
  });
50
50
  }
51
51
  function handleKeydown(event) {
52
- shared_useArrowNavigation.useArrowNavigation(event, shared_getActiveElement.getActiveElement(), undefined, {
52
+ shared_useArrowNavigation.useArrowNavigation(event, shared_getActiveElement.getActiveElement(), void 0, {
53
53
  itemsArray: inputElements.value,
54
54
  focus: true,
55
55
  loop: false,
@@ -143,12 +143,12 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
143
143
  autocomplete: isOtpMode.value ? "one-time-code" : "false",
144
144
  type: isPasswordMode.value ? "password" : "text",
145
145
  inputmode: isNumericMode.value ? "numeric" : "text",
146
- pattern: isNumericMode.value ? "[0-9]*" : undefined,
146
+ pattern: isNumericMode.value ? "[0-9]*" : void 0,
147
147
  placeholder: vue.unref(context).placeholder.value,
148
148
  value: currentValue.value,
149
149
  disabled: disabled.value,
150
- "data-disabled": disabled.value ? "" : undefined,
151
- "data-complete": vue.unref(context).isCompleted.value ? "" : undefined,
150
+ "data-disabled": disabled.value ? "" : void 0,
151
+ "data-complete": vue.unref(context).isCompleted.value ? "" : void 0,
152
152
  "aria-label": `pin input ${_ctx.index + 1} of ${inputElements.value.length}`,
153
153
  onInput: _cache[0] || (_cache[0] = ($event) => handleInput($event)),
154
154
  onKeydown: [
@@ -1 +1 @@
1
- {"version":3,"file":"PinInputInput.cjs","sources":["../../src/PinInput/PinInputInput.vue"],"sourcesContent":["<script lang=\"ts\">\nimport { Primitive, type PrimitiveProps, usePrimitiveElement } from '@/Primitive'\nimport { injectPinInputRootContext } from './PinInputRoot.vue'\nimport { getActiveElement, useArrowNavigation } from '@/shared'\n\nexport interface PinInputInputProps extends PrimitiveProps {\n /** Position of the value this input binds to. */\n index: number\n /** When `true`, prevents the user from interacting with the pin input */\n disabled?: boolean\n}\n</script>\n\n<script setup lang=\"ts\">\nimport { computed, nextTick, onMounted, onUnmounted, watch } from 'vue'\n\nconst props = withDefaults(defineProps<PinInputInputProps>(), {\n as: 'input',\n})\n\nconst context = injectPinInputRootContext()\nconst inputElements = computed(() => Array.from(context.inputElements!.value))\nconst currentValue = computed(() => context.currentModelValue.value[props.index])\n\nconst disabled = computed(() => props.disabled || context.disabled.value)\nconst isOtpMode = computed(() => context.otp.value)\nconst isNumericMode = computed(() => context.type.value === 'number')\nconst isPasswordMode = computed(() => context.mask.value)\n\nconst { primitiveElement, currentElement } = usePrimitiveElement()\nfunction handleInput(event: InputEvent) {\n const target = event.target as HTMLInputElement\n\n if ((event.data?.length ?? 0) > 1) {\n handleMultipleCharacter(target.value)\n return\n }\n\n if (isNumericMode.value && !/^\\d*$/.test(target.value)) {\n target.value = target.value.replace(/\\D/g, '')\n return\n }\n\n target.value = target.value.slice(-1)\n updateModelValueAt(props.index, target.value)\n\n const nextEl = inputElements.value[props.index + 1]\n if (nextEl)\n nextEl.focus()\n}\n\nfunction resetPlaceholder() {\n const target = currentElement.value as HTMLInputElement\n nextTick(() => {\n if (target && !target.value)\n target.placeholder = context.placeholder.value\n })\n}\n\nfunction handleKeydown(event: KeyboardEvent) {\n useArrowNavigation(event, getActiveElement() as HTMLElement, undefined, {\n itemsArray: inputElements.value,\n focus: true,\n loop: false,\n arrowKeyOptions: 'horizontal',\n dir: context.dir.value,\n })\n}\n\nfunction handleBackspace(event: KeyboardEvent) {\n event.preventDefault()\n const target = event.target as HTMLInputElement\n const value = target.value\n\n if (value) {\n updateModelValueAt(props.index, '')\n }\n else {\n const prevEl = inputElements.value[props.index - 1]\n if (prevEl) {\n prevEl.focus()\n updateModelValueAt(props.index - 1, '')\n }\n }\n}\n\nfunction handleDelete(event: KeyboardEvent) {\n if (event.key === 'Delete') {\n event.preventDefault()\n updateModelValueAt(props.index, '')\n }\n}\n\nfunction handleFocus(event: FocusEvent) {\n const target = event.target as HTMLInputElement\n target.setSelectionRange(1, 1)\n\n if (!target.value)\n target.placeholder = ''\n}\n\nfunction handleBlur(event: FocusEvent) {\n resetPlaceholder()\n}\n\nfunction handlePaste(event: ClipboardEvent) {\n event.preventDefault()\n const clipboardData = event.clipboardData\n if (!clipboardData)\n return\n\n const values = clipboardData.getData('text')\n handleMultipleCharacter(values)\n}\n\nfunction handleMultipleCharacter(values: string) {\n const tempModelValue = [...context.currentModelValue.value]\n const initialIndex = values.length >= inputElements.value.length ? 0 : props.index\n const lastIndex = Math.min(initialIndex + values.length, inputElements.value.length)\n for (let i = initialIndex; i < lastIndex; i++) {\n const input = inputElements.value[i]\n const value = values[i - initialIndex]\n if (isNumericMode.value && !/^\\d*$/.test(value))\n continue\n\n tempModelValue[i] = value\n input.focus()\n }\n context.modelValue.value = tempModelValue\n inputElements.value[lastIndex]?.focus()\n}\n\nfunction removeTrailingEmptyStrings(input: string[]) {\n let i = input.length - 1\n\n while (i >= 0 && input[i] === '') {\n input.pop()\n i--\n }\n\n return input\n}\n\nfunction updateModelValueAt(index: number, value: string) {\n const tempModelValue = [...context.currentModelValue.value]\n tempModelValue[index] = value\n context.modelValue.value = removeTrailingEmptyStrings(tempModelValue)\n}\n\nwatch(currentValue, () => {\n if (!currentValue.value) {\n resetPlaceholder()\n }\n})\n\nonMounted(() => {\n context.onInputElementChange(currentElement.value as HTMLInputElement)\n})\nonUnmounted(() => {\n context.inputElements?.value.delete(currentElement.value as HTMLInputElement)\n})\n</script>\n\n<template>\n <Primitive\n ref=\"primitiveElement\"\n autocapitalize=\"none\"\n :as=\"as\"\n :as-child=\"asChild\"\n :autocomplete=\"isOtpMode ? 'one-time-code' : 'false'\"\n :type=\"isPasswordMode ? 'password' : 'text'\"\n :inputmode=\"isNumericMode ? 'numeric' : 'text'\"\n :pattern=\"isNumericMode ? '[0-9]*' : undefined\"\n :placeholder=\"context.placeholder.value\"\n :value=\"currentValue\"\n :disabled=\"disabled\"\n :data-disabled=\"disabled ? '' : undefined\"\n :data-complete=\"context.isCompleted.value ? '' : undefined\"\n :aria-label=\"`pin input ${index + 1} of ${inputElements.length}`\"\n @input=\"handleInput($event as InputEvent)\"\n @keydown.left.right.up.down.home.end=\"handleKeydown\"\n @keydown.backspace=\"handleBackspace\"\n @keydown.delete=\"handleDelete\"\n @focus=\"handleFocus\"\n @blur=\"handleBlur\"\n @paste=\"handlePaste\"\n >\n <slot />\n </Primitive>\n</template>\n"],"names":["injectPinInputRootContext","computed","usePrimitiveElement","nextTick","useArrowNavigation","getActiveElement","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e,KAAyB,CAAA;AAAA,KACtE,CAAA;AACD,IAAAC,eAAA,CAAY,MAAM;AAChB,MAAA,OAAA,CAAQ,aAAe,EAAA,KAAA,CAAM,MAAO,CAAA,cAAA,CAAe,KAAyB,CAAA;AAAA,KAC7E,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"PinInputInput.cjs","sources":["../../src/PinInput/PinInputInput.vue"],"sourcesContent":["<script lang=\"ts\">\nimport { Primitive, type PrimitiveProps, usePrimitiveElement } from '@/Primitive'\nimport { injectPinInputRootContext } from './PinInputRoot.vue'\nimport { getActiveElement, useArrowNavigation } from '@/shared'\n\nexport interface PinInputInputProps extends PrimitiveProps {\n /** Position of the value this input binds to. */\n index: number\n /** When `true`, prevents the user from interacting with the pin input */\n disabled?: boolean\n}\n</script>\n\n<script setup lang=\"ts\">\nimport { computed, nextTick, onMounted, onUnmounted, watch } from 'vue'\n\nconst props = withDefaults(defineProps<PinInputInputProps>(), {\n as: 'input',\n})\n\nconst context = injectPinInputRootContext()\nconst inputElements = computed(() => Array.from(context.inputElements!.value))\nconst currentValue = computed(() => context.currentModelValue.value[props.index])\n\nconst disabled = computed(() => props.disabled || context.disabled.value)\nconst isOtpMode = computed(() => context.otp.value)\nconst isNumericMode = computed(() => context.type.value === 'number')\nconst isPasswordMode = computed(() => context.mask.value)\n\nconst { primitiveElement, currentElement } = usePrimitiveElement()\nfunction handleInput(event: InputEvent) {\n const target = event.target as HTMLInputElement\n\n if ((event.data?.length ?? 0) > 1) {\n handleMultipleCharacter(target.value)\n return\n }\n\n if (isNumericMode.value && !/^\\d*$/.test(target.value)) {\n target.value = target.value.replace(/\\D/g, '')\n return\n }\n\n target.value = target.value.slice(-1)\n updateModelValueAt(props.index, target.value)\n\n const nextEl = inputElements.value[props.index + 1]\n if (nextEl)\n nextEl.focus()\n}\n\nfunction resetPlaceholder() {\n const target = currentElement.value as HTMLInputElement\n nextTick(() => {\n if (target && !target.value)\n target.placeholder = context.placeholder.value\n })\n}\n\nfunction handleKeydown(event: KeyboardEvent) {\n useArrowNavigation(event, getActiveElement() as HTMLElement, undefined, {\n itemsArray: inputElements.value,\n focus: true,\n loop: false,\n arrowKeyOptions: 'horizontal',\n dir: context.dir.value,\n })\n}\n\nfunction handleBackspace(event: KeyboardEvent) {\n event.preventDefault()\n const target = event.target as HTMLInputElement\n const value = target.value\n\n if (value) {\n updateModelValueAt(props.index, '')\n }\n else {\n const prevEl = inputElements.value[props.index - 1]\n if (prevEl) {\n prevEl.focus()\n updateModelValueAt(props.index - 1, '')\n }\n }\n}\n\nfunction handleDelete(event: KeyboardEvent) {\n if (event.key === 'Delete') {\n event.preventDefault()\n updateModelValueAt(props.index, '')\n }\n}\n\nfunction handleFocus(event: FocusEvent) {\n const target = event.target as HTMLInputElement\n target.setSelectionRange(1, 1)\n\n if (!target.value)\n target.placeholder = ''\n}\n\nfunction handleBlur(event: FocusEvent) {\n resetPlaceholder()\n}\n\nfunction handlePaste(event: ClipboardEvent) {\n event.preventDefault()\n const clipboardData = event.clipboardData\n if (!clipboardData)\n return\n\n const values = clipboardData.getData('text')\n handleMultipleCharacter(values)\n}\n\nfunction handleMultipleCharacter(values: string) {\n const tempModelValue = [...context.currentModelValue.value]\n const initialIndex = values.length >= inputElements.value.length ? 0 : props.index\n const lastIndex = Math.min(initialIndex + values.length, inputElements.value.length)\n for (let i = initialIndex; i < lastIndex; i++) {\n const input = inputElements.value[i]\n const value = values[i - initialIndex]\n if (isNumericMode.value && !/^\\d*$/.test(value))\n continue\n\n tempModelValue[i] = value\n input.focus()\n }\n context.modelValue.value = tempModelValue\n inputElements.value[lastIndex]?.focus()\n}\n\nfunction removeTrailingEmptyStrings(input: string[]) {\n let i = input.length - 1\n\n while (i >= 0 && input[i] === '') {\n input.pop()\n i--\n }\n\n return input\n}\n\nfunction updateModelValueAt(index: number, value: string) {\n const tempModelValue = [...context.currentModelValue.value]\n tempModelValue[index] = value\n context.modelValue.value = removeTrailingEmptyStrings(tempModelValue)\n}\n\nwatch(currentValue, () => {\n if (!currentValue.value) {\n resetPlaceholder()\n }\n})\n\nonMounted(() => {\n context.onInputElementChange(currentElement.value as HTMLInputElement)\n})\nonUnmounted(() => {\n context.inputElements?.value.delete(currentElement.value as HTMLInputElement)\n})\n</script>\n\n<template>\n <Primitive\n ref=\"primitiveElement\"\n autocapitalize=\"none\"\n :as=\"as\"\n :as-child=\"asChild\"\n :autocomplete=\"isOtpMode ? 'one-time-code' : 'false'\"\n :type=\"isPasswordMode ? 'password' : 'text'\"\n :inputmode=\"isNumericMode ? 'numeric' : 'text'\"\n :pattern=\"isNumericMode ? '[0-9]*' : undefined\"\n :placeholder=\"context.placeholder.value\"\n :value=\"currentValue\"\n :disabled=\"disabled\"\n :data-disabled=\"disabled ? '' : undefined\"\n :data-complete=\"context.isCompleted.value ? '' : undefined\"\n :aria-label=\"`pin input ${index + 1} of ${inputElements.length}`\"\n @input=\"handleInput($event as InputEvent)\"\n @keydown.left.right.up.down.home.end=\"handleKeydown\"\n @keydown.backspace=\"handleBackspace\"\n @keydown.delete=\"handleDelete\"\n @focus=\"handleFocus\"\n @blur=\"handleBlur\"\n @paste=\"handlePaste\"\n >\n <slot />\n </Primitive>\n</template>\n"],"names":["injectPinInputRootContext","computed","usePrimitiveElement","nextTick","useArrowNavigation","getActiveElement","watch","onMounted","onUnmounted"],"mappings":";;;;;;;;;;;;;;;;;;AAgBA,IAAA,MAAM,KAAQ,GAAA,OAAA;AAId,IAAA,MAAM,UAAUA,+CAA0B,EAAA;AAC1C,IAAM,MAAA,aAAA,GAAgBC,aAAS,MAAM,KAAA,CAAM,KAAK,OAAQ,CAAA,aAAA,CAAe,KAAK,CAAC,CAAA;AAC7E,IAAM,MAAA,YAAA,GAAeA,aAAS,MAAM,OAAA,CAAQ,kBAAkB,KAAM,CAAA,KAAA,CAAM,KAAK,CAAC,CAAA;AAEhF,IAAA,MAAM,WAAWA,YAAS,CAAA,MAAM,MAAM,QAAY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CAAQ,WAAW,KAAQ,GAAA,cAAA;AAC3B,MAAc,aAAA,CAAA,KAAA,CAAM,SAAS,CAAA,EAAG,KAAM,EAAA;AAAA;AAGxC,IAAA,SAAS,2BAA2B,KAAiB,EAAA;AACnD,MAAI,IAAA,CAAA,GAAI,MAAM,MAAS,GAAA,CAAA;AAEvB,MAAA,OAAO,CAAK,IAAA,CAAA,IAAK,KAAM,CAAA,CAAC,MAAM,EAAI,EAAA;AAChC,QAAA,KAAA,CAAM,GAAI,EAAA;AACV,QAAA,CAAA,EAAA;AAAA;AAGF,MAAO,OAAA,KAAA;AAAA;AAGT,IAAS,SAAA,kBAAA,CAAmB,OAAe,KAAe,EAAA;AACxD,MAAA,MAAM,cAAiB,GAAA,CAAC,GAAG,OAAA,CAAQ,kBAAkB,KAAK,CAAA;AAC1D,MAAA,cAAA,CAAe,KAAK,CAAI,GAAA,KAAA;AACxB,MAAQ,OAAA,CAAA,UAAA,CAAW,KAAQ,GAAA,0BAAA,CAA2B,cAAc,CAAA;AAAA;AAGtE,IAAAC,SAAA,CAAM,cAAc,MAAM;AACxB,MAAI,IAAA,CAAC,aAAa,KAAO,EAAA;AACvB,QAAiB,gBAAA,EAAA;AAAA;AACnB,KACD,CAAA;AAED,IAAAC,aAAA,CAAU,MAAM;AACd,MAAQ,OAAA,CAAA,oBAAA,CAAqB,eAAe,KAAyB,CAAA;AAAA,KACtE,CAAA;AACD,IAAAC,eAAA,CAAY,MAAM;AAChB,MAAA,OAAA,CAAQ,aAAe,EAAA,KAAA,CAAM,MAAO,CAAA,cAAA,CAAe,KAAyB,CAAA;AAAA,KAC7E,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,4 +1,4 @@
1
- import { defineComponent, computed, watch, onMounted, onUnmounted, openBlock, createBlock, unref, withKeys, withCtx, renderSlot, nextTick } from 'vue';
1
+ import { defineComponent, computed, watch, onMounted, onUnmounted, createBlock, openBlock, unref, withKeys, withCtx, renderSlot, nextTick } from 'vue';
2
2
  import { i as injectPinInputRootContext } from './PinInputRoot.js';
3
3
  import { u as usePrimitiveElement } from '../Primitive/usePrimitiveElement.js';
4
4
  import { P as Primitive } from '../Primitive/Primitive.js';
@@ -47,7 +47,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
47
47
  });
48
48
  }
49
49
  function handleKeydown(event) {
50
- useArrowNavigation(event, getActiveElement(), undefined, {
50
+ useArrowNavigation(event, getActiveElement(), void 0, {
51
51
  itemsArray: inputElements.value,
52
52
  focus: true,
53
53
  loop: false,
@@ -141,12 +141,12 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
141
141
  autocomplete: isOtpMode.value ? "one-time-code" : "false",
142
142
  type: isPasswordMode.value ? "password" : "text",
143
143
  inputmode: isNumericMode.value ? "numeric" : "text",
144
- pattern: isNumericMode.value ? "[0-9]*" : undefined,
144
+ pattern: isNumericMode.value ? "[0-9]*" : void 0,
145
145
  placeholder: unref(context).placeholder.value,
146
146
  value: currentValue.value,
147
147
  disabled: disabled.value,
148
- "data-disabled": disabled.value ? "" : undefined,
149
- "data-complete": unref(context).isCompleted.value ? "" : undefined,
148
+ "data-disabled": disabled.value ? "" : void 0,
149
+ "data-complete": unref(context).isCompleted.value ? "" : void 0,
150
150
  "aria-label": `pin input ${_ctx.index + 1} of ${inputElements.value.length}`,
151
151
  onInput: _cache[0] || (_cache[0] = ($event) => handleInput($event)),
152
152
  onKeydown: [
@@ -1 +1 @@
1
- {"version":3,"file":"PinInputInput.js","sources":["../../src/PinInput/PinInputInput.vue"],"sourcesContent":["<script lang=\"ts\">\nimport { Primitive, type PrimitiveProps, usePrimitiveElement } from '@/Primitive'\nimport { injectPinInputRootContext } from './PinInputRoot.vue'\nimport { getActiveElement, useArrowNavigation } from '@/shared'\n\nexport interface PinInputInputProps extends PrimitiveProps {\n /** Position of the value this input binds to. */\n index: number\n /** When `true`, prevents the user from interacting with the pin input */\n disabled?: boolean\n}\n</script>\n\n<script setup lang=\"ts\">\nimport { computed, nextTick, onMounted, onUnmounted, watch } from 'vue'\n\nconst props = withDefaults(defineProps<PinInputInputProps>(), {\n as: 'input',\n})\n\nconst context = injectPinInputRootContext()\nconst inputElements = computed(() => Array.from(context.inputElements!.value))\nconst currentValue = computed(() => context.currentModelValue.value[props.index])\n\nconst disabled = computed(() => props.disabled || context.disabled.value)\nconst isOtpMode = computed(() => context.otp.value)\nconst isNumericMode = computed(() => context.type.value === 'number')\nconst isPasswordMode = computed(() => context.mask.value)\n\nconst { primitiveElement, currentElement } = usePrimitiveElement()\nfunction handleInput(event: InputEvent) {\n const target = event.target as HTMLInputElement\n\n if ((event.data?.length ?? 0) > 1) {\n handleMultipleCharacter(target.value)\n return\n }\n\n if (isNumericMode.value && !/^\\d*$/.test(target.value)) {\n target.value = target.value.replace(/\\D/g, '')\n return\n }\n\n target.value = target.value.slice(-1)\n updateModelValueAt(props.index, target.value)\n\n const nextEl = inputElements.value[props.index + 1]\n if (nextEl)\n nextEl.focus()\n}\n\nfunction resetPlaceholder() {\n const target = currentElement.value as HTMLInputElement\n nextTick(() => {\n if (target && !target.value)\n target.placeholder = context.placeholder.value\n })\n}\n\nfunction handleKeydown(event: KeyboardEvent) {\n useArrowNavigation(event, getActiveElement() as HTMLElement, undefined, {\n itemsArray: inputElements.value,\n focus: true,\n loop: false,\n arrowKeyOptions: 'horizontal',\n dir: context.dir.value,\n })\n}\n\nfunction handleBackspace(event: KeyboardEvent) {\n event.preventDefault()\n const target = event.target as HTMLInputElement\n const value = target.value\n\n if (value) {\n updateModelValueAt(props.index, '')\n }\n else {\n const prevEl = inputElements.value[props.index - 1]\n if (prevEl) {\n prevEl.focus()\n updateModelValueAt(props.index - 1, '')\n }\n }\n}\n\nfunction handleDelete(event: KeyboardEvent) {\n if (event.key === 'Delete') {\n event.preventDefault()\n updateModelValueAt(props.index, '')\n }\n}\n\nfunction handleFocus(event: FocusEvent) {\n const target = event.target as HTMLInputElement\n target.setSelectionRange(1, 1)\n\n if (!target.value)\n target.placeholder = ''\n}\n\nfunction handleBlur(event: FocusEvent) {\n resetPlaceholder()\n}\n\nfunction handlePaste(event: ClipboardEvent) {\n event.preventDefault()\n const clipboardData = event.clipboardData\n if (!clipboardData)\n return\n\n const values = clipboardData.getData('text')\n handleMultipleCharacter(values)\n}\n\nfunction handleMultipleCharacter(values: string) {\n const tempModelValue = [...context.currentModelValue.value]\n const initialIndex = values.length >= inputElements.value.length ? 0 : props.index\n const lastIndex = Math.min(initialIndex + values.length, inputElements.value.length)\n for (let i = initialIndex; i < lastIndex; i++) {\n const input = inputElements.value[i]\n const value = values[i - initialIndex]\n if (isNumericMode.value && !/^\\d*$/.test(value))\n continue\n\n tempModelValue[i] = value\n input.focus()\n }\n context.modelValue.value = tempModelValue\n inputElements.value[lastIndex]?.focus()\n}\n\nfunction removeTrailingEmptyStrings(input: string[]) {\n let i = input.length - 1\n\n while (i >= 0 && input[i] === '') {\n input.pop()\n i--\n }\n\n return input\n}\n\nfunction updateModelValueAt(index: number, value: string) {\n const tempModelValue = [...context.currentModelValue.value]\n tempModelValue[index] = value\n context.modelValue.value = removeTrailingEmptyStrings(tempModelValue)\n}\n\nwatch(currentValue, () => {\n if (!currentValue.value) {\n resetPlaceholder()\n }\n})\n\nonMounted(() => {\n context.onInputElementChange(currentElement.value as HTMLInputElement)\n})\nonUnmounted(() => {\n context.inputElements?.value.delete(currentElement.value as HTMLInputElement)\n})\n</script>\n\n<template>\n <Primitive\n ref=\"primitiveElement\"\n autocapitalize=\"none\"\n :as=\"as\"\n :as-child=\"asChild\"\n :autocomplete=\"isOtpMode ? 'one-time-code' : 'false'\"\n :type=\"isPasswordMode ? 'password' : 'text'\"\n :inputmode=\"isNumericMode ? 'numeric' : 'text'\"\n :pattern=\"isNumericMode ? '[0-9]*' : undefined\"\n :placeholder=\"context.placeholder.value\"\n :value=\"currentValue\"\n :disabled=\"disabled\"\n :data-disabled=\"disabled ? '' : undefined\"\n :data-complete=\"context.isCompleted.value ? '' : undefined\"\n :aria-label=\"`pin input ${index + 1} of ${inputElements.length}`\"\n @input=\"handleInput($event as InputEvent)\"\n @keydown.left.right.up.down.home.end=\"handleKeydown\"\n @keydown.backspace=\"handleBackspace\"\n @keydown.delete=\"handleDelete\"\n @focus=\"handleFocus\"\n @blur=\"handleBlur\"\n @paste=\"handlePaste\"\n >\n <slot />\n </Primitive>\n</template>\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAgBA,IAAA,MAAM,KAAQ,GAAA,OAAA;AAId,IAAA,MAAM,UAAU,yBAA0B,EAAA;AAC1C,IAAM,MAAA,aAAA,GAAgB,SAAS,MAAM,KAAA,CAAM,KAAK,OAAQ,CAAA,aAAA,CAAe,KAAK,CAAC,CAAA;AAC7E,IAAM,MAAA,YAAA,GAAe,SAAS,MAAM,OAAA,CAAQ,kBAAkB,KAAM,CAAA,KAAA,CAAM,KAAK,CAAC,CAAA;AAEhF,IAAA,MAAM,WAAW,QAAS,CAAA,MAAM,MAAM,QAAY,IAAA,OAAA,CAAQ,SAAS,KAAK,CAAA;AACxE,IAAA,MAAM,SAAY,GAAA,QAAA,CAAS,MAAM,OAAA,CAAQ,IAAI,KAAK,CAAA;AAClD,IAAA,MAAM,gBAAgB,QAAS,CAAA,MAAM,OAAQ,CAAA,IAAA,CAAK,UAAU,QAAQ,CAAA;AACpE,IAAA,MAAM,cAAiB,GAAA,QAAA,CAAS,MAAM,OAAA,CAAQ,KAAK,KAAK,CAAA;AAExD,IAAA,MAAM,EAAE,gBAAA,EAAkB,cAAe,EAAA,GAAI,mBAAoB,EAAA;AACjE,IAAA,SAAS,YAAY,KAAmB,EAAA;AACtC,MAAA,MAAM,SAAS,KAAM,CAAA,MAAA;AAErB,MAAA,IAAA,CAAK,KAAM,CAAA,IAAA,EAAM,MAAU,IAAA,CAAA,IAAK,CAAG,EAAA;AACjC,QAAA,uBAAA,CAAwB,OAAO,KAAK,CAAA;AACpC,QAAA;AAAA;AAGF,MAAA,IAAI,cAAc,KAAS,IAAA,CAAC,QA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GtE,IAAA,KAAA,CAAM,cAAc,MAAM;AACxB,MAAI,IAAA,CAAC,aAAa,KAAO,EAAA;AACvB,QAAiB,gBAAA,EAAA;AAAA;AACnB,KACD,CAAA;AAED,IAAA,SAAA,CAAU,MAAM;AACd,MAAQ,OAAA,CAAA,oBAAA,CAAqB,eAAe,KAAyB,CAAA;AAAA,KACtE,CAAA;AACD,IAAA,WAAA,CAAY,MAAM;AAChB,MAAA,OAAA,CAAQ,aAAe,EAAA,KAAA,CAAM,MAAO,CAAA,cAAA,CAAe,KAAyB,CAAA;AAAA,KAC7E,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"PinInputInput.js","sources":["../../src/PinInput/PinInputInput.vue"],"sourcesContent":["<script lang=\"ts\">\nimport { Primitive, type PrimitiveProps, usePrimitiveElement } from '@/Primitive'\nimport { injectPinInputRootContext } from './PinInputRoot.vue'\nimport { getActiveElement, useArrowNavigation } from '@/shared'\n\nexport interface PinInputInputProps extends PrimitiveProps {\n /** Position of the value this input binds to. */\n index: number\n /** When `true`, prevents the user from interacting with the pin input */\n disabled?: boolean\n}\n</script>\n\n<script setup lang=\"ts\">\nimport { computed, nextTick, onMounted, onUnmounted, watch } from 'vue'\n\nconst props = withDefaults(defineProps<PinInputInputProps>(), {\n as: 'input',\n})\n\nconst context = injectPinInputRootContext()\nconst inputElements = computed(() => Array.from(context.inputElements!.value))\nconst currentValue = computed(() => context.currentModelValue.value[props.index])\n\nconst disabled = computed(() => props.disabled || context.disabled.value)\nconst isOtpMode = computed(() => context.otp.value)\nconst isNumericMode = computed(() => context.type.value === 'number')\nconst isPasswordMode = computed(() => context.mask.value)\n\nconst { primitiveElement, currentElement } = usePrimitiveElement()\nfunction handleInput(event: InputEvent) {\n const target = event.target as HTMLInputElement\n\n if ((event.data?.length ?? 0) > 1) {\n handleMultipleCharacter(target.value)\n return\n }\n\n if (isNumericMode.value && !/^\\d*$/.test(target.value)) {\n target.value = target.value.replace(/\\D/g, '')\n return\n }\n\n target.value = target.value.slice(-1)\n updateModelValueAt(props.index, target.value)\n\n const nextEl = inputElements.value[props.index + 1]\n if (nextEl)\n nextEl.focus()\n}\n\nfunction resetPlaceholder() {\n const target = currentElement.value as HTMLInputElement\n nextTick(() => {\n if (target && !target.value)\n target.placeholder = context.placeholder.value\n })\n}\n\nfunction handleKeydown(event: KeyboardEvent) {\n useArrowNavigation(event, getActiveElement() as HTMLElement, undefined, {\n itemsArray: inputElements.value,\n focus: true,\n loop: false,\n arrowKeyOptions: 'horizontal',\n dir: context.dir.value,\n })\n}\n\nfunction handleBackspace(event: KeyboardEvent) {\n event.preventDefault()\n const target = event.target as HTMLInputElement\n const value = target.value\n\n if (value) {\n updateModelValueAt(props.index, '')\n }\n else {\n const prevEl = inputElements.value[props.index - 1]\n if (prevEl) {\n prevEl.focus()\n updateModelValueAt(props.index - 1, '')\n }\n }\n}\n\nfunction handleDelete(event: KeyboardEvent) {\n if (event.key === 'Delete') {\n event.preventDefault()\n updateModelValueAt(props.index, '')\n }\n}\n\nfunction handleFocus(event: FocusEvent) {\n const target = event.target as HTMLInputElement\n target.setSelectionRange(1, 1)\n\n if (!target.value)\n target.placeholder = ''\n}\n\nfunction handleBlur(event: FocusEvent) {\n resetPlaceholder()\n}\n\nfunction handlePaste(event: ClipboardEvent) {\n event.preventDefault()\n const clipboardData = event.clipboardData\n if (!clipboardData)\n return\n\n const values = clipboardData.getData('text')\n handleMultipleCharacter(values)\n}\n\nfunction handleMultipleCharacter(values: string) {\n const tempModelValue = [...context.currentModelValue.value]\n const initialIndex = values.length >= inputElements.value.length ? 0 : props.index\n const lastIndex = Math.min(initialIndex + values.length, inputElements.value.length)\n for (let i = initialIndex; i < lastIndex; i++) {\n const input = inputElements.value[i]\n const value = values[i - initialIndex]\n if (isNumericMode.value && !/^\\d*$/.test(value))\n continue\n\n tempModelValue[i] = value\n input.focus()\n }\n context.modelValue.value = tempModelValue\n inputElements.value[lastIndex]?.focus()\n}\n\nfunction removeTrailingEmptyStrings(input: string[]) {\n let i = input.length - 1\n\n while (i >= 0 && input[i] === '') {\n input.pop()\n i--\n }\n\n return input\n}\n\nfunction updateModelValueAt(index: number, value: string) {\n const tempModelValue = [...context.currentModelValue.value]\n tempModelValue[index] = value\n context.modelValue.value = removeTrailingEmptyStrings(tempModelValue)\n}\n\nwatch(currentValue, () => {\n if (!currentValue.value) {\n resetPlaceholder()\n }\n})\n\nonMounted(() => {\n context.onInputElementChange(currentElement.value as HTMLInputElement)\n})\nonUnmounted(() => {\n context.inputElements?.value.delete(currentElement.value as HTMLInputElement)\n})\n</script>\n\n<template>\n <Primitive\n ref=\"primitiveElement\"\n autocapitalize=\"none\"\n :as=\"as\"\n :as-child=\"asChild\"\n :autocomplete=\"isOtpMode ? 'one-time-code' : 'false'\"\n :type=\"isPasswordMode ? 'password' : 'text'\"\n :inputmode=\"isNumericMode ? 'numeric' : 'text'\"\n :pattern=\"isNumericMode ? '[0-9]*' : undefined\"\n :placeholder=\"context.placeholder.value\"\n :value=\"currentValue\"\n :disabled=\"disabled\"\n :data-disabled=\"disabled ? '' : undefined\"\n :data-complete=\"context.isCompleted.value ? '' : undefined\"\n :aria-label=\"`pin input ${index + 1} of ${inputElements.length}`\"\n @input=\"handleInput($event as InputEvent)\"\n @keydown.left.right.up.down.home.end=\"handleKeydown\"\n @keydown.backspace=\"handleBackspace\"\n @keydown.delete=\"handleDelete\"\n @focus=\"handleFocus\"\n @blur=\"handleBlur\"\n @paste=\"handlePaste\"\n >\n <slot />\n </Primitive>\n</template>\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAgBA,IAAA,MAAM,KAAQ,GAAA,OAAA;AAId,IAAA,MAAM,UAAU,yBAA0B,EAAA;AAC1C,IAAM,MAAA,aAAA,GAAgB,SAAS,MAAM,KAAA,CAAM,KAAK,OAAQ,CAAA,aAAA,CAAe,KAAK,CAAC,CAAA;AAC7E,IAAM,MAAA,YAAA,GAAe,SAAS,MAAM,OAA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Hidden_VisuallyHiddenInput = require('../VisuallyHidden/VisuallyHiddenInput.cjs');
6
+ const shared_createContext = require('../shared/createContext.cjs');
6
7
  const shared_useForwardExpose = require('../shared/useForwardExpose.cjs');
7
8
  const shared_useDirection = require('../shared/useDirection.cjs');
8
9
  const Primitive_Primitive = require('../Primitive/Primitive.cjs');
9
- const shared_createContext = require('../shared/createContext.cjs');
10
10
 
11
11
  const [injectPinInputRootContext, providePinInputRootContext] = shared_createContext.createContext("PinInputRoot");
12
12
  const _sfc_main = /* @__PURE__ */ vue.defineComponent({
@@ -38,7 +38,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
38
38
  const dir = shared_useDirection.useDirection(propDir);
39
39
  const modelValue = core.useVModel(props, "modelValue", emits, {
40
40
  defaultValue: props.defaultValue ?? [],
41
- passive: props.modelValue === undefined
41
+ passive: props.modelValue === void 0
42
42
  });
43
43
  const currentModelValue = vue.computed(() => Array.isArray(modelValue.value) ? [...modelValue.value] : []);
44
44
  const inputElements = vue.ref(/* @__PURE__ */ new Set());
@@ -70,8 +70,8 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
70
70
  return vue.openBlock(), vue.createBlock(vue.unref(Primitive_Primitive.Primitive), vue.mergeProps(_ctx.$attrs, {
71
71
  ref: vue.unref(forwardRef),
72
72
  dir: vue.unref(dir),
73
- "data-complete": isCompleted.value ? "" : undefined,
74
- "data-disabled": vue.unref(disabled) ? "" : undefined
73
+ "data-complete": isCompleted.value ? "" : void 0,
74
+ "data-disabled": vue.unref(disabled) ? "" : void 0
75
75
  }), {
76
76
  default: vue.withCtx(() => [
77
77
  vue.renderSlot(_ctx.$slots, "default", { modelValue: vue.unref(modelValue) }),