@fragiola/primitives-vue 0.0.0-stage → 0.1.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 (544) hide show
  1. package/CHANGELOG.md +67 -0
  2. package/LICENSE +21 -0
  3. package/README.md +41 -2
  4. package/dist/accordion-CmKuKHkK.js +278 -0
  5. package/dist/accordion-CmKuKHkK.js.map +1 -0
  6. package/dist/accordion.d.ts +4 -0
  7. package/dist/accordion.js +1 -0
  8. package/dist/alert-dialog-CPG51QOk.js +38 -0
  9. package/dist/alert-dialog-CPG51QOk.js.map +1 -0
  10. package/dist/alert-dialog.d.ts +9 -0
  11. package/dist/alert-dialog.js +1 -0
  12. package/dist/aspect-ratio-Ba7GaRnV.js +37 -0
  13. package/dist/aspect-ratio-Ba7GaRnV.js.map +1 -0
  14. package/dist/aspect-ratio.d.ts +3 -0
  15. package/dist/aspect-ratio.js +1 -0
  16. package/dist/async-list-Dc8wqcxe.js +39 -0
  17. package/dist/async-list-Dc8wqcxe.js.map +1 -0
  18. package/dist/async-list.d.ts +2 -0
  19. package/dist/async-list.js +1 -0
  20. package/dist/autocomplete-virtual-D_2Wuih7.js +55 -0
  21. package/dist/autocomplete-virtual-D_2Wuih7.js.map +1 -0
  22. package/dist/autocomplete-virtual.d.ts +2 -0
  23. package/dist/autocomplete-virtual.js +3 -0
  24. package/dist/autocomplete.d.ts +6 -0
  25. package/dist/autocomplete.js +1 -0
  26. package/dist/avatar-DdDGa6x7.js +166 -0
  27. package/dist/avatar-DdDGa6x7.js.map +1 -0
  28. package/dist/avatar.d.ts +3 -0
  29. package/dist/avatar.js +1 -0
  30. package/dist/breadcrumbs-BFAjlnC_.js +131 -0
  31. package/dist/breadcrumbs-BFAjlnC_.js.map +1 -0
  32. package/dist/breadcrumbs.d.ts +3 -0
  33. package/dist/breadcrumbs.js +1 -0
  34. package/dist/button-DVUcUCXc.js +56 -0
  35. package/dist/button-DVUcUCXc.js.map +1 -0
  36. package/dist/button-attributes-Ue6sUse5.js +83 -0
  37. package/dist/button-attributes-Ue6sUse5.js.map +1 -0
  38. package/dist/button.d.ts +3 -0
  39. package/dist/button.js +1 -0
  40. package/dist/calendar-preset-Bjc7rcNX.js +84 -0
  41. package/dist/calendar-preset-Bjc7rcNX.js.map +1 -0
  42. package/dist/calendar-preset.d.ts +3 -0
  43. package/dist/calendar-preset.js +3 -0
  44. package/dist/calendar-prev-button-jluYmM-3.js +307 -0
  45. package/dist/calendar-prev-button-jluYmM-3.js.map +1 -0
  46. package/dist/calendar-root-base-C9dfkl55.js +310 -0
  47. package/dist/calendar-root-base-C9dfkl55.js.map +1 -0
  48. package/dist/calendar-view-Djy5iHGK.js +160 -0
  49. package/dist/calendar-view-Djy5iHGK.js.map +1 -0
  50. package/dist/calendar-view.d.ts +4 -0
  51. package/dist/calendar-view.js +4 -0
  52. package/dist/calendar.d.ts +5 -0
  53. package/dist/calendar.js +1 -0
  54. package/dist/carousel-BOacnCmz.js +553 -0
  55. package/dist/carousel-BOacnCmz.js.map +1 -0
  56. package/dist/carousel.d.ts +4 -0
  57. package/dist/carousel.js +1 -0
  58. package/dist/cascade-select-B-Nf6eOA.js +697 -0
  59. package/dist/cascade-select-B-Nf6eOA.js.map +1 -0
  60. package/dist/cascade-select.d.ts +6 -0
  61. package/dist/cascade-select.js +1 -0
  62. package/dist/change-details-Bc4-Xzdm.d.ts +37 -0
  63. package/dist/checkbox-D5NvqFgS.js +230 -0
  64. package/dist/checkbox-D5NvqFgS.js.map +1 -0
  65. package/dist/checkbox-group-C3XftlZd.js +104 -0
  66. package/dist/checkbox-group-C3XftlZd.js.map +1 -0
  67. package/dist/checkbox-group-context-C0Z5sWM1.js +5 -0
  68. package/dist/checkbox-group-context-C0Z5sWM1.js.map +1 -0
  69. package/dist/checkbox-group.d.ts +4 -0
  70. package/dist/checkbox-group.js +1 -0
  71. package/dist/checkbox.d.ts +4 -0
  72. package/dist/checkbox.js +1 -0
  73. package/dist/clipboard-BM-4-lTv.js +195 -0
  74. package/dist/clipboard-BM-4-lTv.js.map +1 -0
  75. package/dist/clipboard.d.ts +4 -0
  76. package/dist/clipboard.js +1 -0
  77. package/dist/collapsible-DSCxhlQN.js +158 -0
  78. package/dist/collapsible-DSCxhlQN.js.map +1 -0
  79. package/dist/collapsible.d.ts +4 -0
  80. package/dist/collapsible.js +1 -0
  81. package/dist/color-area-uEHPo-Nq.js +350 -0
  82. package/dist/color-area-uEHPo-Nq.js.map +1 -0
  83. package/dist/color-area.d.ts +4 -0
  84. package/dist/color-area.js +1 -0
  85. package/dist/color-field-Di2IbTa3.js +384 -0
  86. package/dist/color-field-Di2IbTa3.js.map +1 -0
  87. package/dist/color-field.d.ts +4 -0
  88. package/dist/color-field.js +1 -0
  89. package/dist/color-picker-BgFgq5R0.js +311 -0
  90. package/dist/color-picker-BgFgq5R0.js.map +1 -0
  91. package/dist/color-picker-binding-CJ-Cbxbj.js +5 -0
  92. package/dist/color-picker-binding-CJ-Cbxbj.js.map +1 -0
  93. package/dist/color-picker-popover-Dx6LX0V3.js +233 -0
  94. package/dist/color-picker-popover-Dx6LX0V3.js.map +1 -0
  95. package/dist/color-picker-popover.d.ts +6 -0
  96. package/dist/color-picker-popover.js +1 -0
  97. package/dist/color-picker.d.ts +4 -0
  98. package/dist/color-picker.js +1 -0
  99. package/dist/color-slider-BCqoolnY.js +410 -0
  100. package/dist/color-slider-BCqoolnY.js.map +1 -0
  101. package/dist/color-slider.d.ts +4 -0
  102. package/dist/color-slider.js +1 -0
  103. package/dist/color-swatch-C-8IN28V.js +54 -0
  104. package/dist/color-swatch-C-8IN28V.js.map +1 -0
  105. package/dist/color-swatch-picker-CU1wrhjX.js +312 -0
  106. package/dist/color-swatch-picker-CU1wrhjX.js.map +1 -0
  107. package/dist/color-swatch-picker.d.ts +4 -0
  108. package/dist/color-swatch-picker.js +1 -0
  109. package/dist/color-swatch.d.ts +3 -0
  110. package/dist/color-swatch.js +1 -0
  111. package/dist/color-wheel-F_BoXKON.js +284 -0
  112. package/dist/color-wheel-F_BoXKON.js.map +1 -0
  113. package/dist/color-wheel.d.ts +4 -0
  114. package/dist/color-wheel.js +1 -0
  115. package/dist/combobox-virtual-DTRTVq5N.js +56 -0
  116. package/dist/combobox-virtual-DTRTVq5N.js.map +1 -0
  117. package/dist/combobox-virtual.d.ts +2 -0
  118. package/dist/combobox-virtual.js +3 -0
  119. package/dist/combobox.d.ts +6 -0
  120. package/dist/combobox.js +1 -0
  121. package/dist/command-virtual-LoTBDEY5.js +59 -0
  122. package/dist/command-virtual-LoTBDEY5.js.map +1 -0
  123. package/dist/command-virtual.d.ts +3 -0
  124. package/dist/command-virtual.js +3 -0
  125. package/dist/command.d.ts +4 -0
  126. package/dist/command.js +1 -0
  127. package/dist/context-menu-zdHIGS9E.js +151 -0
  128. package/dist/context-menu-zdHIGS9E.js.map +1 -0
  129. package/dist/context-menu.d.ts +7 -0
  130. package/dist/context-menu.js +1 -0
  131. package/dist/date-field-pgSTZiPb.js +78 -0
  132. package/dist/date-field-pgSTZiPb.js.map +1 -0
  133. package/dist/date-field-root-base-CYLuAykm.js +212 -0
  134. package/dist/date-field-root-base-CYLuAykm.js.map +1 -0
  135. package/dist/date-field.d.ts +4 -0
  136. package/dist/date-field.js +1 -0
  137. package/dist/date-picker-input-CiuuRiWZ.js +16 -0
  138. package/dist/date-picker-input-CiuuRiWZ.js.map +1 -0
  139. package/dist/date-picker-input-root-base-ExPSLeKw.js +318 -0
  140. package/dist/date-picker-input-root-base-ExPSLeKw.js.map +1 -0
  141. package/dist/date-picker-input.d.ts +4 -0
  142. package/dist/date-picker-input.js +3 -0
  143. package/dist/date-picker-trigger-C2BlzvfR.js +349 -0
  144. package/dist/date-picker-trigger-C2BlzvfR.js.map +1 -0
  145. package/dist/date-picker.d.ts +6 -0
  146. package/dist/date-picker.js +1 -0
  147. package/dist/date-range-field-Bygmkl5c.js +80 -0
  148. package/dist/date-range-field-Bygmkl5c.js.map +1 -0
  149. package/dist/date-range-field-input-CivpQMYd.js +69 -0
  150. package/dist/date-range-field-input-CivpQMYd.js.map +1 -0
  151. package/dist/date-range-field-root-base-BP26TSWz.js +267 -0
  152. package/dist/date-range-field-root-base-BP26TSWz.js.map +1 -0
  153. package/dist/date-range-field.d.ts +4 -0
  154. package/dist/date-range-field.js +1 -0
  155. package/dist/date-range-picker-input-BUNCCXUY.js +17 -0
  156. package/dist/date-range-picker-input-BUNCCXUY.js.map +1 -0
  157. package/dist/date-range-picker-input.d.ts +4 -0
  158. package/dist/date-range-picker-input.js +3 -0
  159. package/dist/date-range-picker.d.ts +7 -0
  160. package/dist/date-range-picker.js +1 -0
  161. package/dist/dialog-MNjIMCfA.js +38 -0
  162. package/dist/dialog-MNjIMCfA.js.map +1 -0
  163. package/dist/dialog-root-base-jbZipaoQ.js +329 -0
  164. package/dist/dialog-root-base-jbZipaoQ.js.map +1 -0
  165. package/dist/dialog-viewport-tYqWTs9Q.d.ts +54 -0
  166. package/dist/dialog.d.ts +9 -0
  167. package/dist/dialog.js +1 -0
  168. package/dist/direction-CN_deiZU.js +30 -0
  169. package/dist/direction-CN_deiZU.js.map +1 -0
  170. package/dist/direction-context-D-C_P6Lm.js +19 -0
  171. package/dist/direction-context-D-C_P6Lm.js.map +1 -0
  172. package/dist/direction.d.ts +2 -0
  173. package/dist/direction.js +1 -0
  174. package/dist/drawer-BcnuGtEt.js +357 -0
  175. package/dist/drawer-BcnuGtEt.js.map +1 -0
  176. package/dist/drawer.d.ts +9 -0
  177. package/dist/drawer.js +1 -0
  178. package/dist/drop-zone-vFJ5Kvsy.js +98 -0
  179. package/dist/drop-zone-vFJ5Kvsy.js.map +1 -0
  180. package/dist/drop-zone.d.ts +4 -0
  181. package/dist/drop-zone.js +1 -0
  182. package/dist/editable-CabzXgiN.js +436 -0
  183. package/dist/editable-CabzXgiN.js.map +1 -0
  184. package/dist/editable.d.ts +4 -0
  185. package/dist/editable.js +1 -0
  186. package/dist/field-DQ2d5nhC.js +397 -0
  187. package/dist/field-DQ2d5nhC.js.map +1 -0
  188. package/dist/field.d.ts +4 -0
  189. package/dist/field.js +1 -0
  190. package/dist/fieldset-CmmDzOPs.js +80 -0
  191. package/dist/fieldset-CmmDzOPs.js.map +1 -0
  192. package/dist/fieldset-context-DtEOoG6M.js +5 -0
  193. package/dist/fieldset-context-DtEOoG6M.js.map +1 -0
  194. package/dist/fieldset.d.ts +3 -0
  195. package/dist/fieldset.js +1 -0
  196. package/dist/file-upload-_Hh-STdv.js +644 -0
  197. package/dist/file-upload-_Hh-STdv.js.map +1 -0
  198. package/dist/file-upload.d.ts +4 -0
  199. package/dist/file-upload.js +1 -0
  200. package/dist/form-context-DBnVT1lw.js +5 -0
  201. package/dist/form-context-DBnVT1lw.js.map +1 -0
  202. package/dist/form-s9HijjTL.js +92 -0
  203. package/dist/form-s9HijjTL.js.map +1 -0
  204. package/dist/form.d.ts +3 -0
  205. package/dist/form.js +1 -0
  206. package/dist/hover-card-rmd0fD17.js +355 -0
  207. package/dist/hover-card-rmd0fD17.js.map +1 -0
  208. package/dist/hover-card.d.ts +9 -0
  209. package/dist/hover-card.js +1 -0
  210. package/dist/index-5WtjXdX9.d.ts +63 -0
  211. package/dist/index-5eBkkEtv.d.ts +36 -0
  212. package/dist/index-B-vqAG6g.d.ts +33 -0
  213. package/dist/index-B1uYYVtV.d.ts +18 -0
  214. package/dist/index-B8E3X1CK.d.ts +66 -0
  215. package/dist/index-B8Ufhgzu.d.ts +36 -0
  216. package/dist/index-BJz7OWbi.d.ts +88 -0
  217. package/dist/index-BMjRueuv.d.ts +40 -0
  218. package/dist/index-BP7Tmb0E.d.ts +95 -0
  219. package/dist/index-Bbb1Zgwo.d.ts +50 -0
  220. package/dist/index-BdJFU5tH.d.ts +28 -0
  221. package/dist/index-BdfnRo-h.d.ts +55 -0
  222. package/dist/index-BniQvFN-.d.ts +38 -0
  223. package/dist/index-Bt0B-8RV.d.ts +14 -0
  224. package/dist/index-BuWJcRPC.d.ts +18 -0
  225. package/dist/index-Byf0GNd9.d.ts +41 -0
  226. package/dist/index-BzHLkAWU.d.ts +35 -0
  227. package/dist/index-C-QYKtWy.d.ts +28 -0
  228. package/dist/index-C7nh2Oil.d.ts +40 -0
  229. package/dist/index-CDKebSlA.d.ts +41 -0
  230. package/dist/index-CFPqV6qJ.d.ts +72 -0
  231. package/dist/index-CRJv_zWm.d.ts +37 -0
  232. package/dist/index-CTzUalDO.d.ts +76 -0
  233. package/dist/index-CZHLD5cJ.d.ts +17 -0
  234. package/dist/index-Cgwn5qgy.d.ts +88 -0
  235. package/dist/index-Ch4h1DFC.d.ts +55 -0
  236. package/dist/index-Cj3B9gY_.d.ts +50 -0
  237. package/dist/index-Cj6NwCBD.d.ts +44 -0
  238. package/dist/index-CkDThwop.d.ts +21 -0
  239. package/dist/index-Cn-D14iz.d.ts +13 -0
  240. package/dist/index-CpTiLSql.d.ts +53 -0
  241. package/dist/index-CqP363e5.d.ts +118 -0
  242. package/dist/index-Cv4dRdEa.d.ts +72 -0
  243. package/dist/index-CyI637MF.d.ts +37 -0
  244. package/dist/index-D11YCkvR.d.ts +42 -0
  245. package/dist/index-D3yyJGzf.d.ts +74 -0
  246. package/dist/index-D5PbKxcs.d.ts +26 -0
  247. package/dist/index-DAYklR-H.d.ts +18 -0
  248. package/dist/index-DIZSgXHM.d.ts +79 -0
  249. package/dist/index-DZckp3H0.d.ts +37 -0
  250. package/dist/index-DaqoBvQf.d.ts +56 -0
  251. package/dist/index-Df9i45Gr.d.ts +65 -0
  252. package/dist/index-DqI6n06W.d.ts +59 -0
  253. package/dist/index-Drp7svmT.d.ts +30 -0
  254. package/dist/index-DxsUcSGT.d.ts +99 -0
  255. package/dist/index-Dyyi-1mv.d.ts +35 -0
  256. package/dist/index-I2ewgOGz.d.ts +76 -0
  257. package/dist/index-JGhlANKo.d.ts +24 -0
  258. package/dist/index-KASc7z5u.d.ts +38 -0
  259. package/dist/index-LTcmDERY.d.ts +65 -0
  260. package/dist/index-Mf2RPgmw.d.ts +38 -0
  261. package/dist/index-NdY27G_d.d.ts +58 -0
  262. package/dist/index-QO79pDtI.d.ts +70 -0
  263. package/dist/index-S0FIwOSw.d.ts +59 -0
  264. package/dist/index-UxsyZS_A.d.ts +23 -0
  265. package/dist/index-W8aOtVIu.d.ts +40 -0
  266. package/dist/index-WC9xwMaX.d.ts +34 -0
  267. package/dist/index-Xwb9OtVU.d.ts +7 -0
  268. package/dist/index-ZWJJ2V_J.d.ts +49 -0
  269. package/dist/index-_Q_N8ZbU.d.ts +35 -0
  270. package/dist/index-bC3hHzam.d.ts +101 -0
  271. package/dist/index-baY49J-s.d.ts +15 -0
  272. package/dist/index-dCTvA7uS.d.ts +20 -0
  273. package/dist/index-mhpoLESL.d.ts +77 -0
  274. package/dist/index-p3t0BKd4.d.ts +22 -0
  275. package/dist/index-sgaMj_3p.d.ts +69 -0
  276. package/dist/index-tSLNRqTo.d.ts +33 -0
  277. package/dist/index-t_lSQgLA.d.ts +1346 -0
  278. package/dist/index-uL1dEAhG.d.ts +28 -0
  279. package/dist/index.d.ts +79 -0
  280. package/dist/index.js +106 -0
  281. package/dist/label-Ce-gIayi.js +35 -0
  282. package/dist/label-Ce-gIayi.js.map +1 -0
  283. package/dist/label.d.ts +3 -0
  284. package/dist/label.js +1 -0
  285. package/dist/labelled-part-DB2rXJFG.js +56 -0
  286. package/dist/labelled-part-DB2rXJFG.js.map +1 -0
  287. package/dist/link-CZ3ISaPX.js +42 -0
  288. package/dist/link-CZ3ISaPX.js.map +1 -0
  289. package/dist/link-attributes-D9UusWws.js +29 -0
  290. package/dist/link-attributes-D9UusWws.js.map +1 -0
  291. package/dist/link.d.ts +3 -0
  292. package/dist/link.js +1 -0
  293. package/dist/listbox-virtual-He6BWlPj.js +291 -0
  294. package/dist/listbox-virtual-He6BWlPj.js.map +1 -0
  295. package/dist/listbox-virtual.d.ts +5 -0
  296. package/dist/listbox-virtual.js +3 -0
  297. package/dist/listbox.d.ts +4 -0
  298. package/dist/listbox.js +1 -0
  299. package/dist/live-region-style-9ofmajhO.js +46 -0
  300. package/dist/live-region-style-9ofmajhO.js.map +1 -0
  301. package/dist/menu-D7TVxPdb.js +144 -0
  302. package/dist/menu-D7TVxPdb.js.map +1 -0
  303. package/dist/menu-bar-context-k5vMlwmW.js +13 -0
  304. package/dist/menu-bar-context-k5vMlwmW.js.map +1 -0
  305. package/dist/menu-submenu-trigger-ClI2Pm4X.js +885 -0
  306. package/dist/menu-submenu-trigger-ClI2Pm4X.js.map +1 -0
  307. package/dist/menu-submenu-trigger-DNH8_uUB.d.ts +127 -0
  308. package/dist/menu.d.ts +10 -0
  309. package/dist/menu.js +1 -0
  310. package/dist/menubar-CQn3AOiQ.js +212 -0
  311. package/dist/menubar-CQn3AOiQ.js.map +1 -0
  312. package/dist/menubar.d.ts +3 -0
  313. package/dist/menubar.js +1 -0
  314. package/dist/meter-7Qd_WaUY.js +202 -0
  315. package/dist/meter-7Qd_WaUY.js.map +1 -0
  316. package/dist/meter.d.ts +3 -0
  317. package/dist/meter.js +1 -0
  318. package/dist/month-calendar-root-base-VcD8ZNW5.js +354 -0
  319. package/dist/month-calendar-root-base-VcD8ZNW5.js.map +1 -0
  320. package/dist/month-calendar.d.ts +5 -0
  321. package/dist/month-calendar.js +1 -0
  322. package/dist/month-picker-DzOYqW1S.js +15 -0
  323. package/dist/month-picker-DzOYqW1S.js.map +1 -0
  324. package/dist/month-picker-root-base-ByMK_Mfq.js +158 -0
  325. package/dist/month-picker-root-base-ByMK_Mfq.js.map +1 -0
  326. package/dist/month-picker.d.ts +7 -0
  327. package/dist/month-picker.js +3 -0
  328. package/dist/month-range-calendar-CJAWu1-Z.js +18 -0
  329. package/dist/month-range-calendar-CJAWu1-Z.js.map +1 -0
  330. package/dist/month-range-calendar.d.ts +5 -0
  331. package/dist/month-range-calendar.js +3 -0
  332. package/dist/month-range-picker-CRJDG2HG.js +15 -0
  333. package/dist/month-range-picker-CRJDG2HG.js.map +1 -0
  334. package/dist/month-range-picker.d.ts +8 -0
  335. package/dist/month-range-picker.js +3 -0
  336. package/dist/multiple-calendar-BIb2zfBH.js +176 -0
  337. package/dist/multiple-calendar-BIb2zfBH.js.map +1 -0
  338. package/dist/multiple-calendar.d.ts +5 -0
  339. package/dist/multiple-calendar.js +3 -0
  340. package/dist/navigation-menu-COTxGol_.js +727 -0
  341. package/dist/navigation-menu-COTxGol_.js.map +1 -0
  342. package/dist/navigation-menu.d.ts +5 -0
  343. package/dist/navigation-menu.js +1 -0
  344. package/dist/number-field-CqxEnwiS.js +581 -0
  345. package/dist/number-field-CqxEnwiS.js.map +1 -0
  346. package/dist/number-field.d.ts +4 -0
  347. package/dist/number-field.js +1 -0
  348. package/dist/otp-field-DIDuypLU.js +420 -0
  349. package/dist/otp-field-DIDuypLU.js.map +1 -0
  350. package/dist/otp-field.d.ts +4 -0
  351. package/dist/otp-field.js +1 -0
  352. package/dist/overlay-handle-DUptsQOb.js +42 -0
  353. package/dist/overlay-handle-DUptsQOb.js.map +1 -0
  354. package/dist/overlay-handle-DzC9LJQo.d.ts +16 -0
  355. package/dist/overlay-portal-Cmn7Dt7E.d.ts +30 -0
  356. package/dist/overlay-portal-ZNtXmoFd.js +32 -0
  357. package/dist/overlay-portal-ZNtXmoFd.js.map +1 -0
  358. package/dist/pagination-BNUjFYxK.js +264 -0
  359. package/dist/pagination-BNUjFYxK.js.map +1 -0
  360. package/dist/pagination.d.ts +4 -0
  361. package/dist/pagination.js +1 -0
  362. package/dist/parts--mC44S1N.js +1023 -0
  363. package/dist/parts--mC44S1N.js.map +1 -0
  364. package/dist/parts-BP00C3Q5.js +874 -0
  365. package/dist/parts-BP00C3Q5.js.map +1 -0
  366. package/dist/parts-CMh29O5y.js +14 -0
  367. package/dist/parts-CMh29O5y.js.map +1 -0
  368. package/dist/parts-CZqNGRqe.js +20 -0
  369. package/dist/parts-CZqNGRqe.js.map +1 -0
  370. package/dist/parts-DMy2yQZs.js +254 -0
  371. package/dist/parts-DMy2yQZs.js.map +1 -0
  372. package/dist/parts-DVv0aov9.js +14 -0
  373. package/dist/parts-DVv0aov9.js.map +1 -0
  374. package/dist/parts-M3ThgZzl.js +489 -0
  375. package/dist/parts-M3ThgZzl.js.map +1 -0
  376. package/dist/parts-stPOp8dr.js +451 -0
  377. package/dist/parts-stPOp8dr.js.map +1 -0
  378. package/dist/parts-uxRkRrFr.js +668 -0
  379. package/dist/parts-uxRkRrFr.js.map +1 -0
  380. package/dist/password-input-DC39W-do.js +231 -0
  381. package/dist/password-input-DC39W-do.js.map +1 -0
  382. package/dist/password-input.d.ts +4 -0
  383. package/dist/password-input.js +1 -0
  384. package/dist/popover-BaQTGAYJ.js +328 -0
  385. package/dist/popover-BaQTGAYJ.js.map +1 -0
  386. package/dist/popover.d.ts +9 -0
  387. package/dist/popover.js +1 -0
  388. package/dist/progress-DH1Xrj73.js +219 -0
  389. package/dist/progress-DH1Xrj73.js.map +1 -0
  390. package/dist/progress.d.ts +3 -0
  391. package/dist/progress.js +1 -0
  392. package/dist/public-component-AV8E7mGp.js +8 -0
  393. package/dist/public-component-AV8E7mGp.js.map +1 -0
  394. package/dist/public-component-DYpU9aDh.d.ts +33 -0
  395. package/dist/radio-B9YCSnFs.js +159 -0
  396. package/dist/radio-B9YCSnFs.js.map +1 -0
  397. package/dist/radio-group-CmSF4FTc.js +173 -0
  398. package/dist/radio-group-CmSF4FTc.js.map +1 -0
  399. package/dist/radio-group-context-C196JZ9D.js +5 -0
  400. package/dist/radio-group-context-C196JZ9D.js.map +1 -0
  401. package/dist/radio-group.d.ts +4 -0
  402. package/dist/radio-group.js +1 -0
  403. package/dist/radio.d.ts +3 -0
  404. package/dist/radio.js +1 -0
  405. package/dist/range-calendar-BDbNdL75.js +20 -0
  406. package/dist/range-calendar-BDbNdL75.js.map +1 -0
  407. package/dist/range-calendar.d.ts +5 -0
  408. package/dist/range-calendar.js +1 -0
  409. package/dist/rating-oC2t52av.js +351 -0
  410. package/dist/rating-oC2t52av.js.map +1 -0
  411. package/dist/rating.d.ts +4 -0
  412. package/dist/rating.js +1 -0
  413. package/dist/render-part-B5XVbHaS.js +36 -0
  414. package/dist/render-part-B5XVbHaS.js.map +1 -0
  415. package/dist/render-part-BaTKiWBp.d.ts +28 -0
  416. package/dist/render.d.ts +3 -0
  417. package/dist/render.js +3 -0
  418. package/dist/roving-context-LyHQFJqZ.js +32 -0
  419. package/dist/roving-context-LyHQFJqZ.js.map +1 -0
  420. package/dist/scroll-area-_EApTP33.js +328 -0
  421. package/dist/scroll-area-_EApTP33.js.map +1 -0
  422. package/dist/scroll-area.d.ts +3 -0
  423. package/dist/scroll-area.js +1 -0
  424. package/dist/search-field-DJIr926A.js +221 -0
  425. package/dist/search-field-DJIr926A.js.map +1 -0
  426. package/dist/search-field.d.ts +4 -0
  427. package/dist/search-field.js +1 -0
  428. package/dist/segmented-control-BMvmqBpR.js +389 -0
  429. package/dist/segmented-control-BMvmqBpR.js.map +1 -0
  430. package/dist/segmented-control.d.ts +4 -0
  431. package/dist/segmented-control.js +1 -0
  432. package/dist/select-virtual-BwZrX4bh.js +53 -0
  433. package/dist/select-virtual-BwZrX4bh.js.map +1 -0
  434. package/dist/select-virtual.d.ts +3 -0
  435. package/dist/select-virtual.js +3 -0
  436. package/dist/select.d.ts +6 -0
  437. package/dist/select.js +1 -0
  438. package/dist/separator-SgHyzEHB.js +42 -0
  439. package/dist/separator-SgHyzEHB.js.map +1 -0
  440. package/dist/separator.d.ts +3 -0
  441. package/dist/separator.js +1 -0
  442. package/dist/slider-DU5Cx7yj.js +539 -0
  443. package/dist/slider-DU5Cx7yj.js.map +1 -0
  444. package/dist/slider.d.ts +4 -0
  445. package/dist/slider.js +1 -0
  446. package/dist/state-attributes-DhboDeMS.js +14 -0
  447. package/dist/state-attributes-DhboDeMS.js.map +1 -0
  448. package/dist/steps-Dl_mMqRB.js +363 -0
  449. package/dist/steps-Dl_mMqRB.js.map +1 -0
  450. package/dist/steps.d.ts +4 -0
  451. package/dist/steps.js +1 -0
  452. package/dist/switch-CT9QBKOs.js +183 -0
  453. package/dist/switch-CT9QBKOs.js.map +1 -0
  454. package/dist/switch.d.ts +4 -0
  455. package/dist/switch.js +1 -0
  456. package/dist/tabs-BhVbQ7AV.js +369 -0
  457. package/dist/tabs-BhVbQ7AV.js.map +1 -0
  458. package/dist/tabs.d.ts +4 -0
  459. package/dist/tabs.js +1 -0
  460. package/dist/tag-group-DdpjWmzb.js +422 -0
  461. package/dist/tag-group-DdpjWmzb.js.map +1 -0
  462. package/dist/tag-group.d.ts +4 -0
  463. package/dist/tag-group.js +1 -0
  464. package/dist/tags-input-Iw3mST3A.js +627 -0
  465. package/dist/tags-input-Iw3mST3A.js.map +1 -0
  466. package/dist/tags-input.d.ts +4 -0
  467. package/dist/tags-input.js +1 -0
  468. package/dist/time-field-5Ghk_4SZ.js +76 -0
  469. package/dist/time-field-5Ghk_4SZ.js.map +1 -0
  470. package/dist/time-field.d.ts +4 -0
  471. package/dist/time-field.js +1 -0
  472. package/dist/time-range-field-DNOZQK4F.js +77 -0
  473. package/dist/time-range-field-DNOZQK4F.js.map +1 -0
  474. package/dist/time-range-field.d.ts +4 -0
  475. package/dist/time-range-field.js +1 -0
  476. package/dist/toast-DBKxX79M.js +426 -0
  477. package/dist/toast-DBKxX79M.js.map +1 -0
  478. package/dist/toast.d.ts +3 -0
  479. package/dist/toast.js +1 -0
  480. package/dist/toggle-Cca0PFQv.js +101 -0
  481. package/dist/toggle-Cca0PFQv.js.map +1 -0
  482. package/dist/toggle-group-DTUrLX_H.js +102 -0
  483. package/dist/toggle-group-DTUrLX_H.js.map +1 -0
  484. package/dist/toggle-group-context-gMEC8r-Z.js +5 -0
  485. package/dist/toggle-group-context-gMEC8r-Z.js.map +1 -0
  486. package/dist/toggle-group.d.ts +4 -0
  487. package/dist/toggle-group.js +1 -0
  488. package/dist/toggle.d.ts +4 -0
  489. package/dist/toggle.js +1 -0
  490. package/dist/toolbar-WU8JwFd0.js +272 -0
  491. package/dist/toolbar-WU8JwFd0.js.map +1 -0
  492. package/dist/toolbar.d.ts +3 -0
  493. package/dist/toolbar.js +1 -0
  494. package/dist/tooltip-C1kKsTSh.js +358 -0
  495. package/dist/tooltip-C1kKsTSh.js.map +1 -0
  496. package/dist/tooltip.d.ts +9 -0
  497. package/dist/tooltip.js +1 -0
  498. package/dist/use-color-picker-binding-BrG-whys.js +32 -0
  499. package/dist/use-color-picker-binding-BrG-whys.js.map +1 -0
  500. package/dist/use-controllable-B46G4v0A.js +30 -0
  501. package/dist/use-controllable-B46G4v0A.js.map +1 -0
  502. package/dist/use-field-control-CdYqr0dK.js +109 -0
  503. package/dist/use-field-control-CdYqr0dK.js.map +1 -0
  504. package/dist/use-overlay-root-BkyTQIsX.js +296 -0
  505. package/dist/use-overlay-root-BkyTQIsX.js.map +1 -0
  506. package/dist/use-overlay-trigger-D9OXZ_6K.d.ts +12 -0
  507. package/dist/use-overlay-trigger-KM35pX0a.js +61 -0
  508. package/dist/use-overlay-trigger-KM35pX0a.js.map +1 -0
  509. package/dist/use-panel-transition-DF7f1nmF.js +112 -0
  510. package/dist/use-panel-transition-DF7f1nmF.js.map +1 -0
  511. package/dist/use-panel-transition-r_BlVRob.d.ts +2 -0
  512. package/dist/use-positioner-BD24G6q1.js +73 -0
  513. package/dist/use-positioner-BD24G6q1.js.map +1 -0
  514. package/dist/use-positioner-D98pYl_K.d.ts +12 -0
  515. package/dist/use-presence-BcvBOTDI.d.ts +3 -0
  516. package/dist/use-required-context-CPpEkr4Q.js +11 -0
  517. package/dist/use-required-context-CPpEkr4Q.js.map +1 -0
  518. package/dist/use-roving-composite-CW0mE_VU.js +71 -0
  519. package/dist/use-roving-composite-CW0mE_VU.js.map +1 -0
  520. package/dist/use-roving-item-B9Cil5Rq.js +42 -0
  521. package/dist/use-roving-item-B9Cil5Rq.js.map +1 -0
  522. package/dist/use-segment-group-CAlwM3KP.js +304 -0
  523. package/dist/use-segment-group-CAlwM3KP.js.map +1 -0
  524. package/dist/use-virtual-rows-DesBexmk.js +142 -0
  525. package/dist/use-virtual-rows-DesBexmk.js.map +1 -0
  526. package/dist/virtual-list-BNvYqnFf.js +49 -0
  527. package/dist/virtual-list-BNvYqnFf.js.map +1 -0
  528. package/dist/year-calendar-cYl3WHEM.js +18 -0
  529. package/dist/year-calendar-cYl3WHEM.js.map +1 -0
  530. package/dist/year-calendar.d.ts +5 -0
  531. package/dist/year-calendar.js +3 -0
  532. package/dist/year-picker-DYQZbF1h.js +15 -0
  533. package/dist/year-picker-DYQZbF1h.js.map +1 -0
  534. package/dist/year-picker.d.ts +8 -0
  535. package/dist/year-picker.js +3 -0
  536. package/dist/year-range-calendar-ODgfmdiv.js +18 -0
  537. package/dist/year-range-calendar-ODgfmdiv.js.map +1 -0
  538. package/dist/year-range-calendar.d.ts +5 -0
  539. package/dist/year-range-calendar.js +3 -0
  540. package/dist/year-range-picker-DKXlcy7I.js +15 -0
  541. package/dist/year-range-picker-DKXlcy7I.js.map +1 -0
  542. package/dist/year-range-picker.d.ts +8 -0
  543. package/dist/year-range-picker.js +3 -0
  544. package/package.json +548 -3
@@ -0,0 +1 @@
1
+ {"version":3,"file":"number-field-CqxEnwiS.js","names":[],"sources":["../src/components/number-field/number-field-context.ts","../src/components/number-field/use-stepper-button.ts","../src/components/number-field/number-field-decrement.ts","../src/components/number-field/number-field-group.ts","../src/components/number-field/number-field-increment.ts","../src/components/number-field/number-field-input.ts","../src/components/number-field/number-field-root.ts","../src/components/number-field/number-field-scrub-area.ts","../src/components/number-field/number-field-scrub-area-cursor.ts","../src/components/number-field/parts.ts"],"sourcesContent":["import type { ScrubPoint } from \"@fragiola/primitives/number\";\nimport type { ComputedRef, InjectionKey, Ref } from \"vue\";\nimport type { FieldControlBinding } from \"../../composables/use-field-control.ts\";\nimport type { ChangeReason } from \"../../utils/change-details.ts\";\n\n/** The state every part renders with (spec/number-field.md, \"State attributes and ARIA\"). */\nexport interface NumberFieldState {\n /** The value: a number, or `null` while empty. */\n value: number | null;\n /** The Input's text. */\n inputValue: string;\n disabled: boolean;\n readOnly: boolean;\n required: boolean;\n scrubbing: boolean;\n}\n\nexport interface NumberFieldContext {\n state: ComputedRef<NumberFieldState>;\n inputId: () => string;\n min: () => number | undefined;\n max: () => number | undefined;\n format: () => Intl.NumberFormatOptions | undefined;\n /** The value as `format` writes it (`aria-valuetext`), `\"\"` while empty. */\n formattedValue: () => string;\n allowWheelScrub: () => boolean;\n field: FieldControlBinding;\n /** The state attributes and the field's, for every part. */\n attributes: () => Record<string, string>;\n /** The amount of one step for an event's modifier keys (Alt: small, Shift: large). */\n amount: (\n event: { altKey?: boolean; shiftKey?: boolean } | undefined,\n ) => number;\n /**\n * Steps `times` times by `amount` (negative: down) from the value (or the typed text): returns\n * whether another step that way could still change it (a bound not reached).\n */\n stepBy: (\n amount: number,\n reason: ChangeReason,\n event: Event | undefined,\n times?: number,\n ) => boolean;\n /** Sets the value, as a step does (Home and End set a bound). */\n stepTo: (\n value: number,\n reason: ChangeReason,\n event: Event | undefined,\n ) => void;\n /** The Input's text changed: `false` when it is refused (the text stays as it was). */\n onInputText: (text: string, event: Event) => boolean;\n /** The Input lost focus. */\n onInputBlur: (event: Event) => void;\n setInputElement: (value: unknown) => void;\n scrubbing: Ref<boolean>;\n /** The virtual cursor of a locked scrub, `null` otherwise. */\n cursor: Ref<ScrubPoint | null>;\n}\n\nexport const NumberFieldKey: InjectionKey<NumberFieldContext> =\n Symbol(\"NumberField\");\n","import { watchAutoRepeat } from \"@fragiola/primitives/number\";\nimport { shallowRef, watch } from \"vue\";\nimport { elementSetter } from \"../../composables/use-overlay-root.ts\";\nimport type { NumberFieldContext } from \"./number-field-context.ts\";\n\n/**\n * An Increment's or a Decrement's press and hold (spec/number-field.md, \"Pointer\"), and whether\n * it is disabled: the field disabled or read-only, or its step would change nothing.\n */\nexport function useStepperButton(\n context: NumberFieldContext,\n direction: 1 | -1,\n) {\n const element = shallowRef<HTMLElement | null>(null);\n watch(\n element,\n (button, _, onCleanup) => {\n if (button === null) {\n return;\n }\n onCleanup(\n watchAutoRepeat(button, {\n onStep: (event) =>\n context.stepBy(\n direction * context.amount(event as MouseEvent),\n direction > 0\n ? \"increment-press\"\n : \"decrement-press\",\n event,\n ),\n }),\n );\n },\n { flush: \"post\" },\n );\n return {\n ref: elementSetter(element),\n disabled: () => {\n const { value, disabled, readOnly } = context.state.value;\n const min = context.min();\n const max = context.max();\n const atBound =\n value !== null &&\n (direction > 0\n ? max !== undefined && value >= max\n : min !== undefined && value <= min);\n return disabled || readOnly || atBound;\n },\n };\n}\n","import { defineComponent } from \"vue\";\nimport { useRequiredContext } from \"../../composables/use-required-context.ts\";\nimport {\n type PartComponent,\n publicComponent,\n} from \"../../utils/public-component.ts\";\nimport { asProp, renderPart } from \"../../utils/render-part.ts\";\nimport {\n NumberFieldKey,\n type NumberFieldState,\n} from \"./number-field-context.ts\";\nimport { useStepperButton } from \"./use-stepper-button.ts\";\n\n/**\n * Steps the value down, once or held (spec/number-field.md, \"Pointer\"); out of the tab order, its\n * name the consumer's.\n */\nexport const NumberFieldDecrement: PartComponent<\n Record<never, never>,\n NumberFieldState\n> = publicComponent(\n defineComponent({\n name: \"NumberFieldDecrement\",\n inheritAttrs: false,\n props: asProp,\n setup(props, { attrs, slots }) {\n const context = useRequiredContext(\n NumberFieldKey,\n \"NumberField.Decrement\",\n );\n const button = useStepperButton(context, -1);\n return () =>\n renderPart(\n \"button\",\n { attrs, slots },\n props.as,\n context.state.value,\n {\n type: \"button\",\n tabindex: -1,\n disabled: button.disabled(),\n \"aria-controls\": context.inputId(),\n \"data-primitives-part\": \"number-field-decrement\",\n ...context.attributes(),\n ref: button.ref,\n },\n );\n },\n }),\n);\n","import { defineComponent } from \"vue\";\nimport { useRequiredContext } from \"../../composables/use-required-context.ts\";\nimport {\n type PartComponent,\n publicComponent,\n} from \"../../utils/public-component.ts\";\nimport { asProp, renderPart } from \"../../utils/render-part.ts\";\nimport {\n NumberFieldKey,\n type NumberFieldState,\n} from \"./number-field-context.ts\";\n\n/** Groups the Input with its buttons (`role=\"group\"`, spec/number-field.md). */\nexport const NumberFieldGroup: PartComponent<\n Record<never, never>,\n NumberFieldState\n> = publicComponent(\n defineComponent({\n name: \"NumberFieldGroup\",\n inheritAttrs: false,\n props: asProp,\n setup(props, { attrs, slots }) {\n const context = useRequiredContext(\n NumberFieldKey,\n \"NumberField.Group\",\n );\n return () =>\n renderPart(\n \"div\",\n { attrs, slots },\n props.as,\n context.state.value,\n {\n role: \"group\",\n \"data-primitives-part\": \"number-field-group\",\n ...context.attributes(),\n },\n );\n },\n }),\n);\n","import { defineComponent } from \"vue\";\nimport { useRequiredContext } from \"../../composables/use-required-context.ts\";\nimport {\n type PartComponent,\n publicComponent,\n} from \"../../utils/public-component.ts\";\nimport { asProp, renderPart } from \"../../utils/render-part.ts\";\nimport {\n NumberFieldKey,\n type NumberFieldState,\n} from \"./number-field-context.ts\";\nimport { useStepperButton } from \"./use-stepper-button.ts\";\n\n/**\n * Steps the value up, once or held (spec/number-field.md, \"Pointer\"); out of the tab order, its\n * name the consumer's.\n */\nexport const NumberFieldIncrement: PartComponent<\n Record<never, never>,\n NumberFieldState\n> = publicComponent(\n defineComponent({\n name: \"NumberFieldIncrement\",\n inheritAttrs: false,\n props: asProp,\n setup(props, { attrs, slots }) {\n const context = useRequiredContext(\n NumberFieldKey,\n \"NumberField.Increment\",\n );\n const button = useStepperButton(context, 1);\n return () =>\n renderPart(\n \"button\",\n { attrs, slots },\n props.as,\n context.state.value,\n {\n type: \"button\",\n tabindex: -1,\n disabled: button.disabled(),\n \"aria-controls\": context.inputId(),\n \"data-primitives-part\": \"number-field-increment\",\n ...context.attributes(),\n ref: button.ref,\n },\n );\n },\n }),\n);\n","import { defineComponent, nextTick, shallowRef, watch } from \"vue\";\nimport { useRequiredContext } from \"../../composables/use-required-context.ts\";\nimport {\n type PartComponent,\n publicComponent,\n} from \"../../utils/public-component.ts\";\nimport { asProp, renderPart } from \"../../utils/render-part.ts\";\nimport {\n NumberFieldKey,\n type NumberFieldState,\n} from \"./number-field-context.ts\";\n\n/** The `spinbutton`: a text input with the formatted value (spec/number-field.md, the APG). */\nexport const NumberFieldInput: PartComponent<\n Record<never, never>,\n NumberFieldState\n> = publicComponent(\n defineComponent({\n name: \"NumberFieldInput\",\n inheritAttrs: false,\n props: asProp,\n setup(props, { attrs, slots }) {\n const context = useRequiredContext(\n NumberFieldKey,\n \"NumberField.Input\",\n );\n const element = shallowRef<HTMLInputElement | null>(null);\n const setElement = (value: unknown) => {\n context.setInputElement(value);\n const next =\n value instanceof HTMLInputElement\n ? value\n : ((value as { $el?: HTMLInputElement } | null)?.$el ??\n null);\n if (element.value !== next) {\n element.value = next;\n }\n };\n\n // the wheel over the focused Input steps it, and the page does not scroll (a\n // non-passive listener)\n watch(\n [element, context.allowWheelScrub],\n ([input, allowed], _, onCleanup) => {\n if (input === null || !allowed) {\n return;\n }\n const onWheel = (event: WheelEvent) => {\n if (\n input.ownerDocument.activeElement !== input ||\n event.deltaY === 0\n ) {\n return;\n }\n const { disabled, readOnly } = context.state.value;\n if (disabled || readOnly) {\n return;\n }\n event.preventDefault();\n const amount = context.amount(event);\n context.stepBy(\n event.deltaY < 0 ? amount : -amount,\n \"wheel\",\n event,\n );\n };\n input.addEventListener(\"wheel\", onWheel, {\n passive: false,\n });\n onCleanup(() =>\n input.removeEventListener(\"wheel\", onWheel),\n );\n },\n { flush: \"post\" },\n );\n\n const onKeydown = (event: KeyboardEvent) => {\n const { disabled, readOnly } = context.state.value;\n if (disabled || readOnly) {\n return;\n }\n const amount = context.amount(event);\n const large = context.amount({ shiftKey: true });\n switch (event.key) {\n case \"ArrowUp\":\n context.stepBy(amount, \"keyboard\", event);\n break;\n case \"ArrowDown\":\n context.stepBy(-amount, \"keyboard\", event);\n break;\n case \"PageUp\":\n context.stepBy(large, \"keyboard\", event);\n break;\n case \"PageDown\":\n context.stepBy(-large, \"keyboard\", event);\n break;\n case \"Home\": {\n const min = context.min();\n if (min === undefined) {\n return;\n }\n context.stepTo(min, \"keyboard\", event);\n break;\n }\n case \"End\": {\n const max = context.max();\n if (max === undefined) {\n return;\n }\n context.stepTo(max, \"keyboard\", event);\n break;\n }\n default:\n return;\n }\n event.preventDefault();\n };\n\n const onInput = (event: Event) => {\n const input = event.target as HTMLInputElement;\n if (!context.onInputText(input.value, event)) {\n // refused: the text stays as it was (spec/number-field.md, \"Typing\")\n input.value = context.state.value.inputValue;\n }\n // a text the render does not change (a controlled value the consumer kept) is\n // re-asserted once the update rendered\n void nextTick().then(() => {\n const text = context.state.value.inputValue;\n if (input.value !== text) {\n input.value = text;\n }\n });\n };\n\n return () => {\n const state = context.state.value;\n const { value, disabled, readOnly, required } = state;\n const min = context.min();\n const max = context.max();\n const integer =\n context.format()?.maximumFractionDigits === 0 &&\n min !== undefined &&\n min >= 0;\n const { field } = context;\n return renderPart(\"input\", { attrs, slots }, props.as, state, {\n id: context.inputId(),\n type: \"text\",\n role: \"spinbutton\",\n inputmode: integer ? \"numeric\" : \"decimal\",\n autocomplete: \"off\",\n autocorrect: \"off\",\n spellcheck: \"false\",\n value: state.inputValue,\n disabled,\n readonly: readOnly,\n \"aria-valuenow\": value ?? undefined,\n \"aria-valuemin\": min,\n \"aria-valuemax\": max,\n \"aria-valuetext\":\n value === null ? undefined : context.formattedValue(),\n \"aria-required\": required ? \"true\" : undefined,\n \"aria-readonly\": readOnly ? \"true\" : undefined,\n ...field.aria(),\n \"data-primitives-part\": \"number-field-input\",\n ...context.attributes(),\n onInput,\n onKeydown,\n onFocus: field.onFocus,\n onBlur: (event: FocusEvent) => {\n context.onInputBlur(event);\n field.onBlur();\n },\n ref: setElement,\n });\n };\n },\n }),\n);\n","import {\n bridgeForm,\n VISUALLY_HIDDEN_INPUT_STYLE,\n} from \"@fragiola/primitives/form\";\nimport {\n clampNumber,\n formatNumber,\n isNumberText,\n parseNumber,\n type ScrubPoint,\n stepNumber,\n} from \"@fragiola/primitives/number\";\nimport {\n computed,\n defineComponent,\n Fragment,\n h,\n type PropType,\n provide,\n ref,\n shallowRef,\n useId,\n watch,\n} from \"vue\";\nimport { useControllable } from \"../../composables/use-controllable.ts\";\nimport { useFieldControl } from \"../../composables/use-field-control.ts\";\nimport { elementSetter } from \"../../composables/use-overlay-root.ts\";\nimport type {\n ChangeDetails,\n ChangeReason,\n} from \"../../utils/change-details.ts\";\nimport {\n type PartComponent,\n publicComponent,\n} from \"../../utils/public-component.ts\";\nimport { asProp, renderPart } from \"../../utils/render-part.ts\";\nimport { stateAttributes } from \"../../utils/state-attributes.ts\";\nimport {\n NumberFieldKey,\n type NumberFieldState,\n} from \"./number-field-context.ts\";\n\nexport interface NumberFieldRootProps {\n /** A number, or `null` while empty (`v-model:value`). */\n value?: number | null;\n defaultValue?: number | null;\n min?: number;\n max?: number;\n /** The amount of a step (default `1`). */\n step?: number;\n /** The amount of a step with Alt (default `0.1`). */\n smallStep?: number;\n /** The amount of a step with Shift, Page Up and Page Down (default `10`). */\n largeStep?: number;\n /** A step from a value off the grid goes to the grid's next point. */\n snapOnStep?: boolean;\n /** A typed value outside `[min, max]` is clamped on blur (default `true`). */\n clampOnBlur?: boolean;\n /** How the Input writes the value; default: the plain number in the locale. */\n format?: Intl.NumberFormatOptions;\n /** The locale of the format and the parsing (BCP 47; default: the runtime's). */\n locale?: string;\n /** The mouse wheel steps the value over the focused Input. */\n allowWheelScrub?: boolean;\n required?: boolean;\n readOnly?: boolean;\n disabled?: boolean;\n name?: string;\n /** The Input's `id`. */\n id?: string;\n}\n\nexport type NumberFieldRootEmits = {\n \"update:value\": (value: number | null) => true;\n valueChange: (value: number | null, details: ChangeDetails) => true;\n};\n\nconst NUMBER_OR_NULL = [Number, null] as PropType<number | null>;\n\n/**\n * Holds a NumberField's value (`v-model:value`), its text and its hidden form input\n * (spec/number-field.md, the APG spinbutton).\n */\nexport const NumberFieldRoot: PartComponent<\n NumberFieldRootProps,\n NumberFieldState,\n NumberFieldRootEmits\n> = publicComponent(\n defineComponent({\n name: \"NumberFieldRoot\",\n inheritAttrs: false,\n props: {\n ...asProp,\n value: { type: NUMBER_OR_NULL, default: undefined },\n defaultValue: { type: NUMBER_OR_NULL, default: null },\n min: { type: Number, default: undefined },\n max: { type: Number, default: undefined },\n step: { type: Number, default: 1 },\n smallStep: { type: Number, default: 0.1 },\n largeStep: { type: Number, default: 10 },\n snapOnStep: { type: Boolean, default: false },\n clampOnBlur: { type: Boolean, default: true },\n format: {\n type: Object as PropType<Intl.NumberFormatOptions>,\n default: undefined,\n },\n locale: { type: String, default: undefined },\n allowWheelScrub: { type: Boolean, default: false },\n required: { type: Boolean, default: false },\n readOnly: { type: Boolean, default: false },\n disabled: { type: Boolean, default: false },\n name: { type: String, default: undefined },\n id: { type: String, default: undefined },\n },\n emits: {\n \"update:value\": (_value: number | null) => true,\n valueChange: (_value: number | null, _details: ChangeDetails) =>\n true,\n },\n setup(props, { attrs, slots, emit }) {\n const generatedId = useId();\n const inputId = () => props.id ?? generatedId;\n const own = useControllable<number | null, ChangeDetails>(\n () => props.value,\n props.defaultValue,\n (next, details) => {\n emit(\"update:value\", next);\n emit(\"valueChange\", next, details);\n },\n );\n // the text the user typed, until the blur formats it (`null`: the formatted value)\n const typed = ref<string | null>(null);\n const scrubbing = ref(false);\n const cursor = shallowRef<ScrubPoint | null>(null);\n const input = shallowRef<HTMLElement | null>(null);\n const hidden = shallowRef<HTMLInputElement | null>(null);\n const field = useFieldControl({\n id: inputId,\n labelable: true,\n value: () => own.value.value,\n filled: () => own.value.value !== null,\n input: () => hidden.value,\n focusTarget: () => input.value,\n });\n const disabled = () => props.disabled || field.disabled();\n const formattedValue = computed(() =>\n formatNumber(own.value.value, {\n locale: props.locale,\n format: props.format,\n }),\n );\n const state = computed<NumberFieldState>(() => ({\n value: own.value.value,\n inputValue: typed.value ?? formattedValue.value,\n disabled: disabled(),\n readOnly: props.readOnly,\n required: props.required,\n scrubbing: scrubbing.value,\n }));\n\n // the value as of the last change, so a held button's steps never read a value a\n // controlled consumer has not rendered yet\n let current = own.value.value;\n watch(\n () => own.value.value,\n (next) => {\n current = next;\n },\n { flush: \"sync\" },\n );\n const setValue = (next: number | null, details: ChangeDetails) => {\n current = next;\n own.set(next, details);\n // an override for the steps of this task only: a consumer that refused the value\n // renders nothing, and the next task steps from the value it kept\n setTimeout(() => {\n current = own.value.value;\n });\n };\n const options = () => ({\n locale: props.locale,\n format: props.format,\n });\n /** The value a step starts from: the typed text when it reads as a number. */\n const base = (): number | null => {\n const text = typed.value;\n if (text === null) {\n return current;\n }\n const parsed = parseNumber(text, options());\n return parsed === null || Number.isNaN(parsed)\n ? current\n : parsed;\n };\n const amount = (\n event: { altKey?: boolean; shiftKey?: boolean } | undefined,\n ) =>\n event?.altKey\n ? props.smallStep\n : event?.shiftKey\n ? props.largeStep\n : props.step;\n const stepBy = (\n by: number,\n reason: ChangeReason,\n event: Event | undefined,\n times = 1,\n ) => {\n if (disabled() || props.readOnly) {\n return false;\n }\n let next = base();\n for (let index = 0; index < times; index += 1) {\n next = stepNumber(next, by, {\n min: props.min,\n max: props.max,\n snapOnStep: props.snapOnStep,\n });\n }\n typed.value = null;\n if (!Object.is(next, current)) {\n setValue(next, { reason, event });\n }\n const bound = by > 0 ? props.max : props.min;\n return bound === undefined || next !== bound;\n };\n const stepTo = (\n next: number,\n reason: ChangeReason,\n event: Event | undefined,\n ) => {\n if (disabled() || props.readOnly) {\n return;\n }\n typed.value = null;\n if (!Object.is(next, current)) {\n setValue(next, { reason, event });\n }\n };\n const onInputText = (text: string, event: Event) => {\n if (disabled() || props.readOnly) {\n return false;\n }\n if (!isNumberText(text, options())) {\n // refused: the text stays as it was (spec/number-field.md, \"Typing\")\n return false;\n }\n typed.value = text;\n if (text.trim() === \"\") {\n setValue(null, { reason: \"input-clear\", event });\n return true;\n }\n const parsed = parseNumber(text, options());\n if (parsed !== null && !Number.isNaN(parsed)) {\n setValue(parsed, { reason: \"input-change\", event });\n }\n return true;\n };\n const onInputBlur = (event: Event) => {\n if (typed.value === null) {\n return;\n }\n let next = base();\n if (props.clampOnBlur && next !== null) {\n next = clampNumber(next, props.min, props.max);\n }\n typed.value = null;\n if (!Object.is(next, current)) {\n setValue(next, { reason: \"input-blur\", event });\n }\n };\n\n // a form reset returns it to its default, and writes the rendered value back\n // (Switch's way, docs/decisions.md)\n watch(\n hidden,\n (element, _, onCleanup) => {\n if (element === null) {\n return;\n }\n onCleanup(\n bridgeForm(element, {\n reset: () => {\n const rendered = own.value.value;\n field.reset();\n typed.value = null;\n setValue(props.defaultValue, {\n reason: \"none\",\n });\n // the rendered value, which a patch follows (a controlled\n // field that refuses the reset keeps its input)\n element.value =\n rendered === null ? \"\" : String(rendered);\n // and the Input's text: Vue sets `value` as a property only, so\n // the browser's reset emptied it, and an unchanged value patches\n // nothing\n const text = input.value;\n if (text instanceof HTMLInputElement) {\n text.value =\n rendered === null\n ? \"\"\n : formatNumber(rendered, options());\n }\n },\n invalid: () => input.value,\n }),\n );\n },\n { flush: \"post\" },\n );\n\n const attributes = () => ({\n ...stateAttributes({\n disabled: disabled(),\n readonly: props.readOnly,\n required: props.required,\n scrubbing: scrubbing.value,\n }),\n ...field.attributes(),\n });\n provide(NumberFieldKey, {\n state,\n inputId,\n min: () => props.min,\n max: () => props.max,\n format: () => props.format,\n formattedValue: () => formattedValue.value,\n allowWheelScrub: () => props.allowWheelScrub,\n field,\n attributes,\n amount,\n stepBy,\n stepTo,\n onInputText,\n onInputBlur,\n setInputElement: elementSetter(input),\n scrubbing,\n cursor,\n });\n\n return () => {\n const currentState = state.value;\n const { value } = currentState;\n return h(Fragment, [\n renderPart(\n \"div\",\n { attrs, slots },\n props.as,\n currentState,\n {\n \"data-primitives-part\": \"number-field-root\",\n ...attributes(),\n },\n ),\n h(\"input\", {\n ref: (element: unknown) => {\n hidden.value = element as HTMLInputElement | null;\n },\n type: \"number\",\n \"aria-hidden\": \"true\",\n tabindex: -1,\n name: field.name() ?? props.name,\n value: value === null ? \"\" : String(value),\n min: props.min,\n max: props.max,\n step: \"any\",\n required: currentState.required,\n disabled: currentState.disabled,\n onFocus: () => input.value?.focus(),\n style: VISUALLY_HIDDEN_INPUT_STYLE,\n \"data-primitives-part\": \"number-field-hidden-input\",\n }),\n ]);\n };\n },\n }),\n);\n","import { watchScrub } from \"@fragiola/primitives/number\";\nimport { defineComponent, type PropType, shallowRef, watch } from \"vue\";\nimport { elementSetter } from \"../../composables/use-overlay-root.ts\";\nimport { useRequiredContext } from \"../../composables/use-required-context.ts\";\nimport {\n type PartComponent,\n publicComponent,\n} from \"../../utils/public-component.ts\";\nimport { asProp, renderPart } from \"../../utils/render-part.ts\";\nimport {\n NumberFieldKey,\n type NumberFieldState,\n} from \"./number-field-context.ts\";\n\nexport interface NumberFieldScrubAreaProps {\n /** The axis the pointer scrubs along (default `\"horizontal\"`). */\n direction?: \"horizontal\" | \"vertical\";\n /** The pixels one step takes (default `2`). */\n pixelSensitivity?: number;\n}\n\nconst STYLE = { touchAction: \"none\", userSelect: \"none\" } as const;\n\n/** A press dragged along it steps the value (spec/number-field.md, \"Pointer\": scrub). */\nexport const NumberFieldScrubArea: PartComponent<\n NumberFieldScrubAreaProps,\n NumberFieldState\n> = publicComponent(\n defineComponent({\n name: \"NumberFieldScrubArea\",\n inheritAttrs: false,\n props: {\n ...asProp,\n direction: {\n type: String as PropType<\"horizontal\" | \"vertical\">,\n default: \"horizontal\",\n },\n pixelSensitivity: { type: Number, default: 2 },\n },\n setup(props, { attrs, slots }) {\n const context = useRequiredContext(\n NumberFieldKey,\n \"NumberField.ScrubArea\",\n );\n const element = shallowRef<HTMLElement | null>(null);\n const setElement = elementSetter(element);\n watch(\n [element, () => props.direction, () => props.pixelSensitivity],\n ([area, direction, pixelSensitivity], _, onCleanup) => {\n if (area === null) {\n return;\n }\n onCleanup(\n watchScrub(area, {\n direction,\n pixelSensitivity,\n onStart: () => {\n const { disabled, readOnly } =\n context.state.value;\n if (disabled || readOnly) {\n return false;\n }\n context.scrubbing.value = true;\n return true;\n },\n onScrub: (steps, event) => {\n const amount = context.amount(event);\n context.stepBy(\n steps > 0 ? amount : -amount,\n \"scrub\",\n event,\n Math.abs(steps),\n );\n },\n onEnd: () => {\n context.scrubbing.value = false;\n },\n onCursor: (point) => {\n context.cursor.value = point;\n },\n }),\n );\n },\n { flush: \"post\" },\n );\n return () =>\n renderPart(\n \"span\",\n { attrs, slots },\n props.as,\n context.state.value,\n {\n style: STYLE,\n // a press keeps the focus where it is\n onMousedown: (event: MouseEvent) => {\n if (event.button === 0) {\n event.preventDefault();\n }\n },\n \"data-primitives-part\": \"number-field-scrub-area\",\n ...context.attributes(),\n ref: setElement,\n },\n );\n },\n }),\n);\n","import { defineComponent, h, Teleport } from \"vue\";\nimport { useRequiredContext } from \"../../composables/use-required-context.ts\";\nimport {\n type PartComponent,\n publicComponent,\n} from \"../../utils/public-component.ts\";\nimport { asProp, renderPart } from \"../../utils/render-part.ts\";\nimport {\n NumberFieldKey,\n type NumberFieldState,\n} from \"./number-field-context.ts\";\n\n/**\n * The virtual cursor of a locked scrub (spec/number-field.md, \"Pointer\"), teleported into `body`:\n * rendered only while a mouse scrubs with the pointer locked.\n */\nexport const NumberFieldScrubAreaCursor: PartComponent<\n Record<never, never>,\n NumberFieldState\n> = publicComponent(\n defineComponent({\n name: \"NumberFieldScrubAreaCursor\",\n inheritAttrs: false,\n props: asProp,\n setup(props, { attrs, slots }) {\n const context = useRequiredContext(\n NumberFieldKey,\n \"NumberField.ScrubAreaCursor\",\n );\n return () => {\n const cursor = context.cursor.value;\n if (cursor === null) {\n return null;\n }\n return h(Teleport, { to: \"body\" }, [\n renderPart(\n \"span\",\n { attrs, slots },\n props.as,\n context.state.value,\n {\n style: {\n position: \"fixed\",\n top: 0,\n left: 0,\n pointerEvents: \"none\",\n transform: `translate3d(${cursor.x}px, ${cursor.y}px, 0)`,\n },\n \"data-primitives-part\":\n \"number-field-scrub-area-cursor\",\n ...context.attributes(),\n },\n ),\n ]);\n };\n },\n }),\n);\n","import { NumberFieldDecrement } from \"./number-field-decrement.ts\";\nimport { NumberFieldGroup } from \"./number-field-group.ts\";\nimport { NumberFieldIncrement } from \"./number-field-increment.ts\";\nimport { NumberFieldInput } from \"./number-field-input.ts\";\nimport { NumberFieldRoot } from \"./number-field-root.ts\";\nimport { NumberFieldScrubArea } from \"./number-field-scrub-area.ts\";\nimport { NumberFieldScrubAreaCursor } from \"./number-field-scrub-area-cursor.ts\";\n\n/** spec/number-field.md */\nexport const NumberField = {\n Root: NumberFieldRoot,\n Group: NumberFieldGroup,\n Input: NumberFieldInput,\n Increment: NumberFieldIncrement,\n Decrement: NumberFieldDecrement,\n ScrubArea: NumberFieldScrubArea,\n ScrubAreaCursor: NumberFieldScrubAreaCursor,\n};\n"],"mappings":";;;;;;;;;;;AA2DA,MAAa,iBACT,OAAO,aAAa;;;;;;ACnDxB,SAAgB,iBACZ,SACA,WACF;CACE,MAAM,UAAU,WAA+B,IAAI;CACnD,MACI,UACC,QAAQ,GAAG,cAAc;EACtB,IAAI,WAAW,MACX;EAEJ,UACI,gBAAgB,QAAQ,EACpB,SAAS,UACL,QAAQ,OACJ,YAAY,QAAQ,OAAO,KAAmB,GAC9C,YAAY,IACN,oBACA,mBACN,KACJ,EACR,CAAC,CACL;CACJ,GACA,EAAE,OAAO,OAAO,CACpB;CACA,OAAO;EACH,KAAK,cAAc,OAAO;EAC1B,gBAAgB;GACZ,MAAM,EAAE,OAAO,UAAU,aAAa,QAAQ,MAAM;GACpD,MAAM,MAAM,QAAQ,IAAI;GACxB,MAAM,MAAM,QAAQ,IAAI;GAMxB,OAAO,YAAY,YAJf,UAAU,SACT,YAAY,IACP,QAAQ,KAAA,KAAa,SAAS,MAC9B,QAAQ,KAAA,KAAa,SAAS;EAE5C;CACJ;AACJ;;;;;;AChCA,MAAa,uBAGT,gBACA,gBAAgB;CACZ,MAAM;CACN,cAAc;CACd,OAAO;CACP,MAAM,OAAO,EAAE,OAAO,SAAS;EAC3B,MAAM,UAAU,mBACZ,gBACA,uBACJ;EACA,MAAM,SAAS,iBAAiB,SAAS,EAAE;EAC3C,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wB;IACxB,GAAG,QAAQ,WAAW;IACtB,KAAK;GACT,CACJ;EACR;CACJ,CAAC,CE1FU;CACX,iBDGA,gBACA,gBAAgB;EACZ,MAAM;EACN,cAAc;EACd,OAAO;EACP,MAAM,OAAO,EAAE,OAAO,SAAS;GAC3B,MAAM,UAAU,mBACZ,gBACA,6BACJ;GACA,aAAa;IACT,MAAM,SAAS,QAAQ,OAAO;IAC9B,IAAI,WAAW,MACX,OAAO;IAEX,OAAO,EAAE,UAAU,EAAE,IAAI,OAAO,GAAG,CAC/B,WACI,QACA;KAAE;KAAO;IAAM,GACf,MAAM,IACN,QAAQ,MAAM,OACd;KACI,OAAO;MACH,UAAU;MACV,KAAK;MACL,MAAM;MACN,eAAe;MACf,WAAW,eAAe,OAAO,EAAE,MAAM,OAAO,EAAE;KACtD;KACA,wBACI;KACJ,GAAG,QAAQ,WAAW;IAC1B,CACJ,CACJ,CAAC;GACL;EACJ;CACJ,CAAC,CCxCgB;AACrB"}
@@ -0,0 +1,4 @@
1
+ import { n as ChangeReason, t as ChangeDetails } from "./change-details-Bc4-Xzdm.js";
2
+ import { n as RenderSlotProps } from "./render-part-BaTKiWBp.js";
3
+ import { a as NumberFieldState, i as NumberFieldRootProps, n as NumberFieldScrubAreaProps, r as NumberFieldRootEmits, t as NumberField } from "./index-B8E3X1CK.js";
4
+ export { type ChangeDetails, type ChangeReason, NumberField, type NumberFieldRootEmits, type NumberFieldRootProps, type NumberFieldScrubAreaProps, type NumberFieldState, type RenderSlotProps };
@@ -0,0 +1 @@
1
+ export { t as NumberField } from "./number-field-CqxEnwiS.js";
@@ -0,0 +1,420 @@
1
+ import { t as useRequiredContext } from "./use-required-context-CPpEkr4Q.js";
2
+ import { t as publicComponent } from "./public-component-AV8E7mGp.js";
3
+ import { n as renderPart, t as asProp } from "./render-part-B5XVbHaS.js";
4
+ import { t as stateAttributes } from "./state-attributes-DhboDeMS.js";
5
+ import { t as useControllable } from "./use-controllable-B46G4v0A.js";
6
+ import { n as useFieldControl } from "./use-field-control-CdYqr0dK.js";
7
+ import { t as elementSetter } from "./use-overlay-root-BkyTQIsX.js";
8
+ import { n as useProvidedDirection } from "./direction-context-D-C_P6Lm.js";
9
+ import { Fragment, computed, defineComponent, h, nextTick, provide, ref, shallowRef, useId, watch } from "vue";
10
+ import { inDocumentOrder } from "@fragiola/primitives/collection";
11
+ import { getDirection } from "@fragiola/primitives/direction";
12
+ import { VISUALLY_HIDDEN_INPUT_STYLE, bridgeForm, normalizeOtp, otpInputMode, otpPattern, removeOtpCharacter, replaceOtp } from "@fragiola/primitives/form";
13
+ // src/components/otp-field/otp-field-context.ts
14
+ const OTPFieldKey = Symbol("OTPField");
15
+ // src/components/otp-field/otp-field-input.ts
16
+ /**
17
+ * One slot of the code: a native input holding one character (spec/otp-field.md). Its name is
18
+ * the consumer's, which says its position.
19
+ */
20
+ const OTPFieldInput = publicComponent(defineComponent({
21
+ name: "OTPFieldInput",
22
+ inheritAttrs: false,
23
+ props: asProp,
24
+ setup(props, { attrs, slots }) {
25
+ const context = useRequiredContext(OTPFieldKey, "OTPField.Input");
26
+ const element = shallowRef(null);
27
+ const setElement = (value) => {
28
+ const next = value instanceof HTMLInputElement ? value : value?.$el ?? null;
29
+ if (element.value !== next) element.value = next;
30
+ };
31
+ watch(element, (slot, _, onCleanup) => {
32
+ if (slot !== null) onCleanup(context.register(slot));
33
+ }, { flush: "post" });
34
+ const index = () => context.indexOf(element.value);
35
+ const character = () => {
36
+ const at = index();
37
+ return at >= 0 ? Array.from(context.state.value.value)[at] ?? "" : "";
38
+ };
39
+ const onMousedown = (event) => {
40
+ const at = index();
41
+ if (event.button !== 0 || context.state.value.disabled || at < 0) return;
42
+ event.preventDefault();
43
+ context.focusSlot(at);
44
+ };
45
+ const onFocus = (event) => {
46
+ const at = index();
47
+ if (at >= 0) context.onSlotFocus(at, event.currentTarget);
48
+ };
49
+ const onBlur = (event) => context.onSlotBlur(event.relatedTarget);
50
+ const onInput = (event) => {
51
+ const at = index();
52
+ const input = event.currentTarget;
53
+ if (at >= 0) context.onSlotText(at, input.value, event);
54
+ input.value = character();
55
+ nextTick().then(() => {
56
+ const text = character();
57
+ if (input.value !== text) input.value = text;
58
+ });
59
+ };
60
+ const onPaste = (event) => {
61
+ const at = index();
62
+ const { disabled, readOnly } = context.state.value;
63
+ if (at < 0 || disabled || readOnly) return;
64
+ event.preventDefault();
65
+ context.onSlotPaste(at, event.clipboardData?.getData("text/plain") ?? "", event);
66
+ };
67
+ const onKeydown = (event) => {
68
+ const at = index();
69
+ if (at >= 0) context.onSlotKeydown(at, event);
70
+ };
71
+ return () => {
72
+ const at = index();
73
+ const known = at >= 0;
74
+ const slotCharacter = character();
75
+ const root = context.state.value;
76
+ const state = {
77
+ ...root,
78
+ index: at,
79
+ character: slotCharacter,
80
+ filled: slotCharacter !== ""
81
+ };
82
+ const named = attrs["aria-label"] !== void 0 || attrs["aria-labelledby"] !== void 0;
83
+ const aria = context.field.aria();
84
+ const id = context.id();
85
+ return renderPart("input", {
86
+ attrs,
87
+ slots
88
+ }, props.as, state, {
89
+ id: known ? at === 0 ? id : `${id}-${at + 1}` : void 0,
90
+ type: context.mask() ? "password" : "text",
91
+ inputmode: context.inputMode(),
92
+ autocomplete: at === 0 ? context.autoComplete() : "off",
93
+ autocorrect: "off",
94
+ spellcheck: "false",
95
+ enterkeyhint: at === root.length - 1 ? "done" : "next",
96
+ maxlength: at === 0 ? root.length : void 0,
97
+ tabindex: known && at === context.activeIndex() ? 0 : -1,
98
+ value: slotCharacter,
99
+ disabled: root.disabled,
100
+ readonly: root.readOnly,
101
+ "aria-labelledby": named ? void 0 : aria["aria-labelledby"],
102
+ "aria-invalid": aria["aria-invalid"],
103
+ "data-primitives-part": "otp-field-input",
104
+ ...context.attributes(),
105
+ ...stateAttributes({
106
+ filled: slotCharacter !== "",
107
+ index: known ? String(at) : void 0
108
+ }),
109
+ onMousedown,
110
+ onFocus,
111
+ onBlur,
112
+ onInput,
113
+ onPaste,
114
+ onKeydown,
115
+ ref: setElement
116
+ });
117
+ };
118
+ }
119
+ }));
120
+ // src/components/otp-field/parts.ts
121
+ /** spec/otp-field.md */
122
+ const OTPField = {
123
+ Root: publicComponent(defineComponent({
124
+ name: "OTPFieldRoot",
125
+ inheritAttrs: false,
126
+ props: {
127
+ ...asProp,
128
+ length: {
129
+ type: Number,
130
+ required: true
131
+ },
132
+ value: {
133
+ type: String,
134
+ default: void 0
135
+ },
136
+ defaultValue: {
137
+ type: String,
138
+ default: ""
139
+ },
140
+ validationType: {
141
+ type: [String, RegExp],
142
+ default: "numeric"
143
+ },
144
+ mask: {
145
+ type: Boolean,
146
+ default: false
147
+ },
148
+ autoComplete: {
149
+ type: String,
150
+ default: "one-time-code"
151
+ },
152
+ inputMode: {
153
+ type: String,
154
+ default: void 0
155
+ },
156
+ required: {
157
+ type: Boolean,
158
+ default: false
159
+ },
160
+ readOnly: {
161
+ type: Boolean,
162
+ default: false
163
+ },
164
+ disabled: {
165
+ type: Boolean,
166
+ default: false
167
+ },
168
+ name: {
169
+ type: String,
170
+ default: void 0
171
+ },
172
+ id: {
173
+ type: String,
174
+ default: void 0
175
+ }
176
+ },
177
+ emits: {
178
+ "update:value": (_value) => true,
179
+ valueChange: (_value, _details) => true,
180
+ valueComplete: (_value, _details) => true,
181
+ valueInvalid: (_text, _details) => true
182
+ },
183
+ setup(props, { attrs, slots, emit }) {
184
+ const generatedId = useId();
185
+ const id = () => props.id ?? generatedId;
186
+ const direction = useProvidedDirection();
187
+ const own = useControllable(() => props.value, props.defaultValue, (next, details) => {
188
+ emit("update:value", next);
189
+ emit("valueChange", next, details);
190
+ });
191
+ const value = computed(() => normalizeOtp(own.value.value, props.length, props.validationType).value);
192
+ const items = shallowRef([]);
193
+ const ordered = computed(() => inDocumentOrder(items.value, (slot) => slot));
194
+ const focusedIndex = ref(null);
195
+ const root = shallowRef(null);
196
+ const setRoot = elementSetter(root);
197
+ const hidden = shallowRef(null);
198
+ const last = () => Math.max(props.length - 1, 0);
199
+ const field = useFieldControl({
200
+ id,
201
+ labelable: true,
202
+ value: () => value.value,
203
+ filled: () => value.value !== "",
204
+ input: () => hidden.value,
205
+ focusTarget: () => ordered.value[Math.min(value.value.length, last())] ?? null
206
+ });
207
+ const disabled = () => props.disabled || field.disabled();
208
+ const state = computed(() => ({
209
+ value: value.value,
210
+ length: props.length,
211
+ complete: value.value.length === props.length && props.length > 0,
212
+ disabled: disabled(),
213
+ readOnly: props.readOnly,
214
+ required: props.required
215
+ }));
216
+ let current = value.value;
217
+ watch(value, (next) => {
218
+ current = next;
219
+ }, { flush: "sync" });
220
+ const register = (element) => {
221
+ items.value = [...items.value, element];
222
+ return () => {
223
+ items.value = items.value.filter((slot) => slot !== element);
224
+ };
225
+ };
226
+ const setValue = (next, reason, event) => {
227
+ const details = {
228
+ reason,
229
+ event
230
+ };
231
+ if (next === current) {
232
+ if (reason === "input-paste" && next.length === props.length) emit("valueComplete", next, details);
233
+ return;
234
+ }
235
+ current = next;
236
+ own.set(next, details);
237
+ setTimeout(() => {
238
+ current = value.value;
239
+ });
240
+ if (next.length === props.length) emit("valueComplete", next, details);
241
+ };
242
+ const focusSlot = (index) => {
243
+ const target = Math.max(0, Math.min(index, current.length, props.length - 1));
244
+ const slot = ordered.value[target];
245
+ if (slot !== void 0) {
246
+ slot.focus();
247
+ slot.select();
248
+ }
249
+ };
250
+ const commit = (index, text, reason, event) => {
251
+ if (disabled() || props.readOnly) return;
252
+ const normalized = normalizeOtp(text, props.length, props.validationType);
253
+ if (normalized.rejected) emit("valueInvalid", text, {
254
+ reason,
255
+ event
256
+ });
257
+ if (normalized.value === "") {
258
+ if (reason === "input-change" && text === "") setValue(removeOtpCharacter(current, index), "input-clear", event);
259
+ return;
260
+ }
261
+ const next = replaceOtp(current, index, normalized.value, props.length, props.validationType);
262
+ setValue(next, reason, event);
263
+ focusSlot(index + Array.from(normalized.value).length);
264
+ };
265
+ const onSlotKeydown = (index, event) => {
266
+ if (event.defaultPrevented || disabled()) return;
267
+ const input = event.currentTarget;
268
+ const end = Math.min(current.length, props.length - 1);
269
+ const boundary = (event.ctrlKey || event.metaKey) && !event.altKey;
270
+ const rtl = getDirection(input, direction()) === "rtl";
271
+ const previousKey = rtl ? "ArrowRight" : "ArrowLeft";
272
+ const nextKey = rtl ? "ArrowLeft" : "ArrowRight";
273
+ const move = (target) => {
274
+ event.preventDefault();
275
+ focusSlot(target);
276
+ };
277
+ if (event.key === previousKey) {
278
+ move(boundary ? 0 : Math.max(0, index - 1));
279
+ return;
280
+ }
281
+ if (event.key === nextKey) {
282
+ move(boundary ? end : Math.min(props.length - 1, index + 1));
283
+ return;
284
+ }
285
+ if (event.key === "Home" || event.key === "ArrowUp") {
286
+ move(0);
287
+ return;
288
+ }
289
+ if (event.key === "End" || event.key === "ArrowDown") {
290
+ move(end);
291
+ return;
292
+ }
293
+ if (props.readOnly) return;
294
+ const character = Array.from(current)[index] ?? "";
295
+ if (event.key === "Backspace" && boundary) {
296
+ event.preventDefault();
297
+ setValue("", "keyboard", event);
298
+ focusSlot(0);
299
+ return;
300
+ }
301
+ if (event.key === "Delete") {
302
+ event.preventDefault();
303
+ setValue(removeOtpCharacter(current, index), "keyboard", event);
304
+ focusSlot(index);
305
+ return;
306
+ }
307
+ if (event.key === "Backspace") {
308
+ event.preventDefault();
309
+ const target = Math.max(0, index - 1);
310
+ setValue(removeOtpCharacter(current, character === "" ? target : index), "keyboard", event);
311
+ focusSlot(target);
312
+ return;
313
+ }
314
+ const selectsAll = input.selectionStart === 0 && input.selectionEnd === input.value.length;
315
+ if (event.key.length === 1 && !boundary && selectsAll && character === event.key) {
316
+ event.preventDefault();
317
+ if (index < props.length - 1) focusSlot(index + 1);
318
+ }
319
+ };
320
+ const onSlotFocus = (index, element) => {
321
+ if (index > current.length) {
322
+ focusSlot(current.length);
323
+ return;
324
+ }
325
+ focusedIndex.value = index;
326
+ element.select();
327
+ field.onFocus();
328
+ };
329
+ const onSlotBlur = (related) => {
330
+ if (related instanceof Node && root.value?.contains(related)) return;
331
+ focusedIndex.value = null;
332
+ field.onBlur();
333
+ };
334
+ watch(hidden, (element, _, onCleanup) => {
335
+ if (element === null) return;
336
+ onCleanup(bridgeForm(element, {
337
+ reset: () => {
338
+ const rendered = value.value;
339
+ field.reset();
340
+ setValue(normalizeOtp(props.defaultValue, props.length, props.validationType).value, "none", void 0);
341
+ element.value = rendered;
342
+ const characters = Array.from(rendered);
343
+ ordered.value.forEach((slot, index) => {
344
+ slot.value = characters[index] ?? "";
345
+ });
346
+ },
347
+ invalid: () => ordered.value[Math.min(current.length, props.length - 1)] ?? null
348
+ }));
349
+ }, { flush: "post" });
350
+ const attributes = () => ({
351
+ ...stateAttributes({
352
+ disabled: state.value.disabled,
353
+ readonly: state.value.readOnly,
354
+ required: state.value.required,
355
+ complete: state.value.complete
356
+ }),
357
+ ...field.attributes()
358
+ });
359
+ provide(OTPFieldKey, {
360
+ state,
361
+ field,
362
+ id,
363
+ mask: () => props.mask,
364
+ autoComplete: () => props.autoComplete,
365
+ inputMode: () => props.inputMode ?? otpInputMode(props.validationType),
366
+ activeIndex: () => focusedIndex.value ?? Math.min(value.value.length, last()),
367
+ attributes,
368
+ register,
369
+ indexOf: (element) => element === null ? -1 : ordered.value.indexOf(element),
370
+ onSlotText: (index, text, event) => commit(index, text, "input-change", event),
371
+ onSlotPaste: (index, text, event) => commit(index, text, "input-paste", event),
372
+ onSlotKeydown,
373
+ onSlotFocus,
374
+ onSlotBlur,
375
+ focusSlot
376
+ });
377
+ const onHiddenInput = (event) => {
378
+ const { value: next } = normalizeOtp(event.target.value, props.length, props.validationType);
379
+ if (!disabled() && !props.readOnly) setValue(next, "input-change", event);
380
+ };
381
+ return () => {
382
+ const currentState = state.value;
383
+ const aria = field.aria();
384
+ return h(Fragment, [renderPart("div", {
385
+ attrs,
386
+ slots
387
+ }, props.as, currentState, {
388
+ role: "group",
389
+ "aria-labelledby": aria["aria-labelledby"],
390
+ "aria-describedby": aria["aria-describedby"],
391
+ "data-primitives-part": "otp-field-root",
392
+ ...attributes(),
393
+ ref: setRoot
394
+ }), h("input", {
395
+ ref: (element) => {
396
+ hidden.value = element;
397
+ },
398
+ type: "text",
399
+ "aria-hidden": "true",
400
+ tabindex: -1,
401
+ name: field.name() ?? props.name,
402
+ value: currentState.value,
403
+ autocomplete: props.autoComplete,
404
+ maxlength: props.length,
405
+ pattern: otpPattern(props.validationType, props.length),
406
+ required: currentState.required,
407
+ disabled: currentState.disabled,
408
+ onFocus: () => focusSlot(0),
409
+ onInput: onHiddenInput,
410
+ style: VISUALLY_HIDDEN_INPUT_STYLE,
411
+ "data-primitives-part": "otp-field-hidden-input"
412
+ })]);
413
+ };
414
+ }
415
+ })),
416
+ Input: OTPFieldInput
417
+ };
418
+ export { OTPField as t };
419
+
420
+ //# sourceMappingURL=otp-field-DIDuypLU.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"otp-field-DIDuypLU.js","names":[],"sources":["../src/components/otp-field/otp-field-context.ts","../src/components/otp-field/otp-field-input.ts","../src/components/otp-field/otp-field-root.ts","../src/components/otp-field/parts.ts"],"sourcesContent":["import type { ComputedRef, InjectionKey } from \"vue\";\nimport type { FieldControlBinding } from \"../../composables/use-field-control.ts\";\n\n/** The state every part renders with (spec/otp-field.md, \"State attributes and ARIA\"). */\nexport interface OTPFieldState {\n /** The code typed so far. */\n value: string;\n length: number;\n /** The value is `length` characters long. */\n complete: boolean;\n disabled: boolean;\n readOnly: boolean;\n required: boolean;\n}\n\nexport interface OTPFieldInputState extends OTPFieldState {\n /** The slot's index; `-1` before the slots are known (a server render). */\n index: number;\n /** The slot's character, `\"\"` when empty. */\n character: string;\n /** The slot holds a character. */\n filled: boolean;\n}\n\nexport interface OTPFieldContext {\n state: ComputedRef<OTPFieldState>;\n field: FieldControlBinding;\n /** The first slot's `id`; slot `n` gets `<id>-<n>`. */\n id: () => string;\n mask: () => boolean;\n autoComplete: () => string;\n inputMode: () => string;\n /** The slot holding the tab stop. */\n activeIndex: () => number;\n /** The state attributes and the field's, for every part. */\n attributes: () => Record<string, string>;\n /** Registers a slot; returns the cleanup. */\n register: (element: HTMLInputElement) => () => void;\n /** A slot's index in document order, `-1` while unknown. */\n indexOf: (element: HTMLInputElement | null) => number;\n onSlotText: (index: number, text: string, event: Event) => void;\n onSlotPaste: (index: number, text: string, event: Event) => void;\n onSlotKeydown: (index: number, event: KeyboardEvent) => void;\n onSlotFocus: (index: number, element: HTMLInputElement) => void;\n onSlotBlur: (related: EventTarget | null) => void;\n /** Focuses a slot, or the first empty one when it lies after it (no gap). */\n focusSlot: (index: number) => void;\n}\n\nexport const OTPFieldKey: InjectionKey<OTPFieldContext> = Symbol(\"OTPField\");\n","import { defineComponent, nextTick, shallowRef, watch } from \"vue\";\nimport { useRequiredContext } from \"../../composables/use-required-context.ts\";\nimport {\n type PartComponent,\n publicComponent,\n} from \"../../utils/public-component.ts\";\nimport { asProp, renderPart } from \"../../utils/render-part.ts\";\nimport { stateAttributes } from \"../../utils/state-attributes.ts\";\nimport { type OTPFieldInputState, OTPFieldKey } from \"./otp-field-context.ts\";\n\n/**\n * One slot of the code: a native input holding one character (spec/otp-field.md). Its name is\n * the consumer's, which says its position.\n */\nexport const OTPFieldInput: PartComponent<\n Record<never, never>,\n OTPFieldInputState\n> = publicComponent(\n defineComponent({\n name: \"OTPFieldInput\",\n inheritAttrs: false,\n props: asProp,\n setup(props, { attrs, slots }) {\n const context = useRequiredContext(OTPFieldKey, \"OTPField.Input\");\n const element = shallowRef<HTMLInputElement | null>(null);\n const setElement = (value: unknown) => {\n const next =\n value instanceof HTMLInputElement\n ? value\n : ((value as { $el?: HTMLInputElement } | null)?.$el ??\n null);\n if (element.value !== next) {\n element.value = next;\n }\n };\n // once mounted, in document order (as Toolbar's items): a server render knows no slot\n watch(\n element,\n (slot, _, onCleanup) => {\n if (slot !== null) {\n onCleanup(context.register(slot));\n }\n },\n { flush: \"post\" },\n );\n const index = () => context.indexOf(element.value);\n const character = () => {\n const at = index();\n return at >= 0\n ? (Array.from(context.state.value.value)[at] ?? \"\")\n : \"\";\n };\n\n const onMousedown = (event: MouseEvent) => {\n const at = index();\n if (\n event.button !== 0 ||\n context.state.value.disabled ||\n at < 0\n ) {\n return;\n }\n // focused without a caret inside its character: it is selected\n event.preventDefault();\n context.focusSlot(at);\n };\n const onFocus = (event: FocusEvent) => {\n const at = index();\n if (at >= 0) {\n context.onSlotFocus(\n at,\n event.currentTarget as HTMLInputElement,\n );\n }\n };\n const onBlur = (event: FocusEvent) =>\n context.onSlotBlur(event.relatedTarget);\n const onInput = (event: Event) => {\n const at = index();\n const input = event.currentTarget as HTMLInputElement;\n if (at >= 0) {\n context.onSlotText(at, input.value, event);\n }\n // the slot shows its character: a refused one, or one the render does not change\n // (a controlled value the consumer kept), is written back\n input.value = character();\n void nextTick().then(() => {\n const text = character();\n if (input.value !== text) {\n input.value = text;\n }\n });\n };\n const onPaste = (event: ClipboardEvent) => {\n const at = index();\n const { disabled, readOnly } = context.state.value;\n if (at < 0 || disabled || readOnly) {\n return;\n }\n event.preventDefault();\n context.onSlotPaste(\n at,\n event.clipboardData?.getData(\"text/plain\") ?? \"\",\n event,\n );\n };\n const onKeydown = (event: KeyboardEvent) => {\n const at = index();\n if (at >= 0) {\n context.onSlotKeydown(at, event);\n }\n };\n\n return () => {\n const at = index();\n const known = at >= 0;\n const slotCharacter = character();\n const root = context.state.value;\n const state: OTPFieldInputState = {\n ...root,\n index: at,\n character: slotCharacter,\n filled: slotCharacter !== \"\",\n };\n const named =\n attrs[\"aria-label\"] !== undefined ||\n attrs[\"aria-labelledby\"] !== undefined;\n const aria = context.field.aria();\n const id = context.id();\n return renderPart(\"input\", { attrs, slots }, props.as, state, {\n id: known ? (at === 0 ? id : `${id}-${at + 1}`) : undefined,\n type: context.mask() ? \"password\" : \"text\",\n inputmode: context.inputMode(),\n autocomplete: at === 0 ? context.autoComplete() : \"off\",\n autocorrect: \"off\",\n spellcheck: \"false\",\n enterkeyhint: at === root.length - 1 ? \"done\" : \"next\",\n maxlength: at === 0 ? root.length : undefined,\n tabindex: known && at === context.activeIndex() ? 0 : -1,\n value: slotCharacter,\n disabled: root.disabled,\n readonly: root.readOnly,\n \"aria-labelledby\": named\n ? undefined\n : aria[\"aria-labelledby\"],\n \"aria-invalid\": aria[\"aria-invalid\"],\n \"data-primitives-part\": \"otp-field-input\",\n ...context.attributes(),\n ...stateAttributes({\n filled: slotCharacter !== \"\",\n index: known ? String(at) : undefined,\n }),\n onMousedown,\n onFocus,\n onBlur,\n onInput,\n onPaste,\n onKeydown,\n ref: setElement,\n });\n };\n },\n }),\n);\n","import { inDocumentOrder } from \"@fragiola/primitives/collection\";\nimport { getDirection } from \"@fragiola/primitives/direction\";\nimport {\n bridgeForm,\n normalizeOtp,\n type OtpValidationType,\n otpInputMode,\n otpPattern,\n removeOtpCharacter,\n replaceOtp,\n VISUALLY_HIDDEN_INPUT_STYLE,\n} from \"@fragiola/primitives/form\";\nimport {\n computed,\n defineComponent,\n Fragment,\n h,\n type PropType,\n provide,\n ref,\n shallowRef,\n useId,\n watch,\n} from \"vue\";\nimport { useControllable } from \"../../composables/use-controllable.ts\";\nimport { useFieldControl } from \"../../composables/use-field-control.ts\";\nimport { elementSetter } from \"../../composables/use-overlay-root.ts\";\nimport { useProvidedDirection } from \"../../direction/direction-context.ts\";\nimport type {\n ChangeDetails,\n ChangeReason,\n} from \"../../utils/change-details.ts\";\nimport {\n type PartComponent,\n publicComponent,\n} from \"../../utils/public-component.ts\";\nimport { asProp, renderPart } from \"../../utils/render-part.ts\";\nimport { stateAttributes } from \"../../utils/state-attributes.ts\";\nimport { OTPFieldKey, type OTPFieldState } from \"./otp-field-context.ts\";\n\nexport interface OTPFieldRootProps {\n /** The number of slots. */\n length: number;\n /** The code (`v-model:value`). */\n value?: string;\n defaultValue?: string;\n /** The characters a slot accepts (default `\"numeric\"`). */\n validationType?: OtpValidationType;\n /** The slots hide their characters (`type=\"password\"`). */\n mask?: boolean;\n /** The first slot's and the hidden input's `autocomplete` (default `\"one-time-code\"`). */\n autoComplete?: string;\n /** The slots' virtual keyboard (default from `validationType`). */\n inputMode?: string;\n required?: boolean;\n readOnly?: boolean;\n disabled?: boolean;\n name?: string;\n /** The first slot's `id`; slot `n` gets `<id>-<n>`. */\n id?: string;\n}\n\nexport type OTPFieldRootEmits = {\n \"update:value\": (value: string) => true;\n valueChange: (value: string, details: ChangeDetails) => true;\n /** The value became `length` long, or a complete code was pasted again. */\n valueComplete: (value: string, details: ChangeDetails) => true;\n /** Typed or pasted text held characters `validationType` refuses. */\n valueInvalid: (text: string, details: ChangeDetails) => true;\n};\n\n/**\n * Holds an OTP field's code (`v-model:value`), its slots and its hidden form input\n * (spec/otp-field.md: one native input per slot, in a `group` with one tab stop).\n */\nexport const OTPFieldRoot: PartComponent<\n OTPFieldRootProps,\n OTPFieldState,\n OTPFieldRootEmits\n> = publicComponent(\n defineComponent({\n name: \"OTPFieldRoot\",\n inheritAttrs: false,\n props: {\n ...asProp,\n length: { type: Number, required: true },\n value: { type: String, default: undefined },\n defaultValue: { type: String, default: \"\" },\n validationType: {\n type: [String, RegExp] as PropType<OtpValidationType>,\n default: \"numeric\",\n },\n mask: { type: Boolean, default: false },\n autoComplete: { type: String, default: \"one-time-code\" },\n inputMode: { type: String, default: undefined },\n required: { type: Boolean, default: false },\n readOnly: { type: Boolean, default: false },\n disabled: { type: Boolean, default: false },\n name: { type: String, default: undefined },\n id: { type: String, default: undefined },\n },\n emits: {\n \"update:value\": (_value: string) => true,\n valueChange: (_value: string, _details: ChangeDetails) => true,\n valueComplete: (_value: string, _details: ChangeDetails) => true,\n valueInvalid: (_text: string, _details: ChangeDetails) => true,\n },\n setup(props, { attrs, slots, emit }) {\n const generatedId = useId();\n const id = () => props.id ?? generatedId;\n const direction = useProvidedDirection();\n const own = useControllable<string, ChangeDetails>(\n () => props.value,\n props.defaultValue,\n (next, details) => {\n emit(\"update:value\", next);\n emit(\"valueChange\", next, details);\n },\n );\n const value = computed(\n () =>\n normalizeOtp(\n own.value.value,\n props.length,\n props.validationType,\n ).value,\n );\n const items = shallowRef<readonly HTMLInputElement[]>([]);\n const ordered = computed(() =>\n inDocumentOrder(items.value, (slot) => slot),\n );\n const focusedIndex = ref<number | null>(null);\n const root = shallowRef<HTMLElement | null>(null);\n const setRoot = elementSetter(root);\n const hidden = shallowRef<HTMLInputElement | null>(null);\n const last = () => Math.max(props.length - 1, 0);\n const field = useFieldControl({\n id,\n labelable: true,\n value: () => value.value,\n filled: () => value.value !== \"\",\n input: () => hidden.value,\n focusTarget: () =>\n ordered.value[Math.min(value.value.length, last())] ?? null,\n });\n const disabled = () => props.disabled || field.disabled();\n const state = computed<OTPFieldState>(() => ({\n value: value.value,\n length: props.length,\n complete:\n value.value.length === props.length && props.length > 0,\n disabled: disabled(),\n readOnly: props.readOnly,\n required: props.required,\n }));\n\n // the value as of the last change: a focus right after it reads it before the\n // consumer's update renders\n let current = value.value;\n watch(\n value,\n (next) => {\n current = next;\n },\n { flush: \"sync\" },\n );\n\n const register = (element: HTMLInputElement) => {\n items.value = [...items.value, element];\n return () => {\n items.value = items.value.filter(\n (slot) => slot !== element,\n );\n };\n };\n\n const setValue = (\n next: string,\n reason: ChangeReason,\n event: Event | undefined,\n ) => {\n const details: ChangeDetails = { reason, event };\n if (next === current) {\n // a complete code pasted again completes again (Base UI)\n if (\n reason === \"input-paste\" &&\n next.length === props.length\n ) {\n emit(\"valueComplete\", next, details);\n }\n return;\n }\n current = next;\n own.set(next, details);\n // an override for this task only: a consumer that refused the value renders\n // nothing, and the next key reads the value it kept\n setTimeout(() => {\n current = value.value;\n });\n if (next.length === props.length) {\n emit(\"valueComplete\", next, details);\n }\n };\n const focusSlot = (index: number) => {\n const target = Math.max(\n 0,\n Math.min(index, current.length, props.length - 1),\n );\n const slot = ordered.value[target];\n if (slot !== undefined) {\n slot.focus();\n slot.select();\n }\n };\n const commit = (\n index: number,\n text: string,\n reason: \"input-change\" | \"input-paste\",\n event: Event,\n ) => {\n if (disabled() || props.readOnly) {\n return;\n }\n const normalized = normalizeOtp(\n text,\n props.length,\n props.validationType,\n );\n if (normalized.rejected) {\n emit(\"valueInvalid\", text, { reason, event });\n }\n if (normalized.value === \"\") {\n if (reason === \"input-change\" && text === \"\") {\n setValue(\n removeOtpCharacter(current, index),\n \"input-clear\",\n event,\n );\n }\n return;\n }\n const next = replaceOtp(\n current,\n index,\n normalized.value,\n props.length,\n props.validationType,\n );\n setValue(next, reason, event);\n focusSlot(index + Array.from(normalized.value).length);\n };\n\n const onSlotKeydown = (index: number, event: KeyboardEvent) => {\n if (event.defaultPrevented || disabled()) {\n return;\n }\n const input = event.currentTarget as HTMLInputElement;\n const end = Math.min(current.length, props.length - 1);\n const boundary =\n (event.ctrlKey || event.metaKey) && !event.altKey;\n const rtl = getDirection(input, direction()) === \"rtl\";\n const previousKey = rtl ? \"ArrowRight\" : \"ArrowLeft\";\n const nextKey = rtl ? \"ArrowLeft\" : \"ArrowRight\";\n const move = (target: number) => {\n event.preventDefault();\n focusSlot(target);\n };\n if (event.key === previousKey) {\n move(boundary ? 0 : Math.max(0, index - 1));\n return;\n }\n if (event.key === nextKey) {\n move(\n boundary ? end : Math.min(props.length - 1, index + 1),\n );\n return;\n }\n if (event.key === \"Home\" || event.key === \"ArrowUp\") {\n move(0);\n return;\n }\n if (event.key === \"End\" || event.key === \"ArrowDown\") {\n move(end);\n return;\n }\n if (props.readOnly) {\n return;\n }\n const character = Array.from(current)[index] ?? \"\";\n if (event.key === \"Backspace\" && boundary) {\n event.preventDefault();\n setValue(\"\", \"keyboard\", event);\n focusSlot(0);\n return;\n }\n if (event.key === \"Delete\") {\n event.preventDefault();\n setValue(\n removeOtpCharacter(current, index),\n \"keyboard\",\n event,\n );\n focusSlot(index);\n return;\n }\n if (event.key === \"Backspace\") {\n event.preventDefault();\n const target = Math.max(0, index - 1);\n setValue(\n removeOtpCharacter(\n current,\n character === \"\" ? target : index,\n ),\n \"keyboard\",\n event,\n );\n focusSlot(target);\n return;\n }\n const selectsAll =\n input.selectionStart === 0 &&\n input.selectionEnd === input.value.length;\n if (\n event.key.length === 1 &&\n !boundary &&\n selectsAll &&\n character === event.key\n ) {\n // the character it already holds: only move on\n event.preventDefault();\n if (index < props.length - 1) {\n focusSlot(index + 1);\n }\n }\n };\n\n const onSlotFocus = (index: number, element: HTMLInputElement) => {\n if (index > current.length) {\n // no gap: the first empty slot takes the focus\n focusSlot(current.length);\n return;\n }\n focusedIndex.value = index;\n element.select();\n field.onFocus();\n };\n const onSlotBlur = (related: EventTarget | null) => {\n if (related instanceof Node && root.value?.contains(related)) {\n return;\n }\n focusedIndex.value = null;\n field.onBlur();\n };\n\n // a form reset returns it to its default, and writes the rendered value back\n // (Switch's way, docs/decisions.md)\n watch(\n hidden,\n (element, _, onCleanup) => {\n if (element === null) {\n return;\n }\n onCleanup(\n bridgeForm(element, {\n reset: () => {\n const rendered = value.value;\n field.reset();\n setValue(\n normalizeOtp(\n props.defaultValue,\n props.length,\n props.validationType,\n ).value,\n \"none\",\n undefined,\n );\n // the rendered value, which a patch follows (a controlled\n // field that refuses the reset keeps its input)\n element.value = rendered;\n // and the slots' characters: Vue sets `value` as a property only,\n // so the browser's reset emptied them, and an unchanged value\n // patches nothing\n const characters = Array.from(rendered);\n ordered.value.forEach((slot, index) => {\n slot.value = characters[index] ?? \"\";\n });\n },\n invalid: () =>\n ordered.value[\n Math.min(current.length, props.length - 1)\n ] ?? null,\n }),\n );\n },\n { flush: \"post\" },\n );\n\n const attributes = () => ({\n ...stateAttributes({\n disabled: state.value.disabled,\n readonly: state.value.readOnly,\n required: state.value.required,\n complete: state.value.complete,\n }),\n ...field.attributes(),\n });\n provide(OTPFieldKey, {\n state,\n field,\n id,\n mask: () => props.mask,\n autoComplete: () => props.autoComplete,\n inputMode: () =>\n props.inputMode ?? otpInputMode(props.validationType),\n activeIndex: () =>\n focusedIndex.value ?? Math.min(value.value.length, last()),\n attributes,\n register,\n indexOf: (element) =>\n element === null ? -1 : ordered.value.indexOf(element),\n onSlotText: (index, text, event) =>\n commit(index, text, \"input-change\", event),\n onSlotPaste: (index, text, event) =>\n commit(index, text, \"input-paste\", event),\n onSlotKeydown,\n onSlotFocus,\n onSlotBlur,\n focusSlot,\n });\n\n // the browser's autofill of the hidden input\n const onHiddenInput = (event: Event) => {\n const { value: next } = normalizeOtp(\n (event.target as HTMLInputElement).value,\n props.length,\n props.validationType,\n );\n if (!disabled() && !props.readOnly) {\n setValue(next, \"input-change\", event);\n }\n };\n\n return () => {\n const currentState = state.value;\n const aria = field.aria();\n return h(Fragment, [\n renderPart(\n \"div\",\n { attrs, slots },\n props.as,\n currentState,\n {\n role: \"group\",\n \"aria-labelledby\": aria[\"aria-labelledby\"],\n \"aria-describedby\": aria[\"aria-describedby\"],\n \"data-primitives-part\": \"otp-field-root\",\n ...attributes(),\n ref: setRoot,\n },\n ),\n h(\"input\", {\n ref: (element: unknown) => {\n hidden.value = element as HTMLInputElement | null;\n },\n type: \"text\",\n \"aria-hidden\": \"true\",\n tabindex: -1,\n name: field.name() ?? props.name,\n value: currentState.value,\n autocomplete: props.autoComplete,\n maxlength: props.length,\n pattern: otpPattern(props.validationType, props.length),\n required: currentState.required,\n disabled: currentState.disabled,\n onFocus: () => focusSlot(0),\n onInput: onHiddenInput,\n style: VISUALLY_HIDDEN_INPUT_STYLE,\n \"data-primitives-part\": \"otp-field-hidden-input\",\n }),\n ]);\n };\n },\n }),\n);\n","import { OTPFieldInput } from \"./otp-field-input.ts\";\nimport { OTPFieldRoot } from \"./otp-field-root.ts\";\n\n/** spec/otp-field.md */\nexport const OTPField = {\n Root: OTPFieldRoot,\n Input: OTPFieldInput,\n};\n"],"mappings":";;;;;;;;;;;;;AAiDA,MAAa,cAA6C,OAAO,UAAU;;;;;;ACnC3E,MAAa,gBAGT,gBACA,gBAAgB;CACZ,MAAM;CACN,cAAc;CACd,OAAO;CACP,MAAM,OAAO,EAAE,OAAO,SAAS;EAC3B,MAAM,UAAU,mBAAmB,aAAa,gBAAgB;EAChE,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OAAO,MAAM,KAAK;IACxB,OAAO,EAAE,UAAU,CACf,WACI,OACA;KAAE;KAAO;IAAM,GACf,MAAM,IACN,cACA;KACI,MAAM;KACN,mBAAmB,KAAK;KACxB,oBAAoB,KAAK;KACzB,wBAAwB;KACxB,GAAG,WAAW;KACd,KAAK;IACT,CACJ,GACA,EAAE,SAAS;KACP,MAAM,YAAqB;MACvB,OAAO,QAAQ;KACnB;KACA,MAAM;KACN,eAAe;KACf,UAAU;KACV,MAAM,MAAM,KAAK,KAAK,MAAM;KAC5B,OAAO,aAAa;KACpB,cAAc,MAAM;KACpB,WAAW,MAAM;KACjB,SAAS,WAAW,MAAM,gBAAgB,MAAM,MAAM;KACtD,UAAU,aAAa;KACvB,UAAU,aAAa;KACvB,eAAe,UAAU,CAAC;KAC1B,SAAS;KACT,OAAO;KACP,wBAAwB;IAC5B,CAAC,CACL,CAAC;GACL;EACJ;CACJ,CAAC,CC7dK;CACN,OAAO;AACX"}
@@ -0,0 +1,4 @@
1
+ import { n as ChangeReason, t as ChangeDetails } from "./change-details-Bc4-Xzdm.js";
2
+ import { n as RenderSlotProps } from "./render-part-BaTKiWBp.js";
3
+ import { a as OTPFieldInputState, i as OTPFieldRootProps, n as OTPField, o as OTPFieldState, r as OTPFieldRootEmits, t as OtpValidationType } from "./index-S0FIwOSw.js";
4
+ export { type ChangeDetails, type ChangeReason, OTPField, type OTPFieldInputState, type OTPFieldRootEmits, type OTPFieldRootProps, type OTPFieldState, type OtpValidationType, type RenderSlotProps };
@@ -0,0 +1 @@
1
+ export { t as OTPField } from "./otp-field-DIDuypLU.js";