@fragiola/primitives-vue 0.0.0-stage → 0.0.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.
- package/LICENSE +21 -0
- package/README.md +41 -2
- package/dist/accordion-CmKuKHkK.js +278 -0
- package/dist/accordion-CmKuKHkK.js.map +1 -0
- package/dist/accordion.d.ts +4 -0
- package/dist/accordion.js +1 -0
- package/dist/alert-dialog-CPG51QOk.js +38 -0
- package/dist/alert-dialog-CPG51QOk.js.map +1 -0
- package/dist/alert-dialog.d.ts +9 -0
- package/dist/alert-dialog.js +1 -0
- package/dist/aspect-ratio-Ba7GaRnV.js +37 -0
- package/dist/aspect-ratio-Ba7GaRnV.js.map +1 -0
- package/dist/aspect-ratio.d.ts +3 -0
- package/dist/aspect-ratio.js +1 -0
- package/dist/async-list-Dc8wqcxe.js +39 -0
- package/dist/async-list-Dc8wqcxe.js.map +1 -0
- package/dist/async-list.d.ts +2 -0
- package/dist/async-list.js +1 -0
- package/dist/autocomplete-virtual-D_2Wuih7.js +55 -0
- package/dist/autocomplete-virtual-D_2Wuih7.js.map +1 -0
- package/dist/autocomplete-virtual.d.ts +2 -0
- package/dist/autocomplete-virtual.js +3 -0
- package/dist/autocomplete.d.ts +6 -0
- package/dist/autocomplete.js +1 -0
- package/dist/avatar-DdDGa6x7.js +166 -0
- package/dist/avatar-DdDGa6x7.js.map +1 -0
- package/dist/avatar.d.ts +3 -0
- package/dist/avatar.js +1 -0
- package/dist/breadcrumbs-BFAjlnC_.js +131 -0
- package/dist/breadcrumbs-BFAjlnC_.js.map +1 -0
- package/dist/breadcrumbs.d.ts +3 -0
- package/dist/breadcrumbs.js +1 -0
- package/dist/button-DVUcUCXc.js +56 -0
- package/dist/button-DVUcUCXc.js.map +1 -0
- package/dist/button-attributes-Ue6sUse5.js +83 -0
- package/dist/button-attributes-Ue6sUse5.js.map +1 -0
- package/dist/button.d.ts +3 -0
- package/dist/button.js +1 -0
- package/dist/calendar-preset-Bjc7rcNX.js +84 -0
- package/dist/calendar-preset-Bjc7rcNX.js.map +1 -0
- package/dist/calendar-preset.d.ts +3 -0
- package/dist/calendar-preset.js +3 -0
- package/dist/calendar-prev-button-jluYmM-3.js +307 -0
- package/dist/calendar-prev-button-jluYmM-3.js.map +1 -0
- package/dist/calendar-root-base-C9dfkl55.js +310 -0
- package/dist/calendar-root-base-C9dfkl55.js.map +1 -0
- package/dist/calendar-view-Djy5iHGK.js +160 -0
- package/dist/calendar-view-Djy5iHGK.js.map +1 -0
- package/dist/calendar-view.d.ts +4 -0
- package/dist/calendar-view.js +4 -0
- package/dist/calendar.d.ts +5 -0
- package/dist/calendar.js +1 -0
- package/dist/carousel-BOacnCmz.js +553 -0
- package/dist/carousel-BOacnCmz.js.map +1 -0
- package/dist/carousel.d.ts +4 -0
- package/dist/carousel.js +1 -0
- package/dist/cascade-select-B-Nf6eOA.js +697 -0
- package/dist/cascade-select-B-Nf6eOA.js.map +1 -0
- package/dist/cascade-select.d.ts +6 -0
- package/dist/cascade-select.js +1 -0
- package/dist/change-details-Bc4-Xzdm.d.ts +37 -0
- package/dist/checkbox-D5NvqFgS.js +230 -0
- package/dist/checkbox-D5NvqFgS.js.map +1 -0
- package/dist/checkbox-group-C3XftlZd.js +104 -0
- package/dist/checkbox-group-C3XftlZd.js.map +1 -0
- package/dist/checkbox-group-context-C0Z5sWM1.js +5 -0
- package/dist/checkbox-group-context-C0Z5sWM1.js.map +1 -0
- package/dist/checkbox-group.d.ts +4 -0
- package/dist/checkbox-group.js +1 -0
- package/dist/checkbox.d.ts +4 -0
- package/dist/checkbox.js +1 -0
- package/dist/clipboard-BM-4-lTv.js +195 -0
- package/dist/clipboard-BM-4-lTv.js.map +1 -0
- package/dist/clipboard.d.ts +4 -0
- package/dist/clipboard.js +1 -0
- package/dist/collapsible-DSCxhlQN.js +158 -0
- package/dist/collapsible-DSCxhlQN.js.map +1 -0
- package/dist/collapsible.d.ts +4 -0
- package/dist/collapsible.js +1 -0
- package/dist/color-area-uEHPo-Nq.js +350 -0
- package/dist/color-area-uEHPo-Nq.js.map +1 -0
- package/dist/color-area.d.ts +4 -0
- package/dist/color-area.js +1 -0
- package/dist/color-field-Di2IbTa3.js +384 -0
- package/dist/color-field-Di2IbTa3.js.map +1 -0
- package/dist/color-field.d.ts +4 -0
- package/dist/color-field.js +1 -0
- package/dist/color-picker-BgFgq5R0.js +311 -0
- package/dist/color-picker-BgFgq5R0.js.map +1 -0
- package/dist/color-picker-binding-CJ-Cbxbj.js +5 -0
- package/dist/color-picker-binding-CJ-Cbxbj.js.map +1 -0
- package/dist/color-picker-popover-Dx6LX0V3.js +233 -0
- package/dist/color-picker-popover-Dx6LX0V3.js.map +1 -0
- package/dist/color-picker-popover.d.ts +6 -0
- package/dist/color-picker-popover.js +1 -0
- package/dist/color-picker.d.ts +4 -0
- package/dist/color-picker.js +1 -0
- package/dist/color-slider-BCqoolnY.js +410 -0
- package/dist/color-slider-BCqoolnY.js.map +1 -0
- package/dist/color-slider.d.ts +4 -0
- package/dist/color-slider.js +1 -0
- package/dist/color-swatch-C-8IN28V.js +54 -0
- package/dist/color-swatch-C-8IN28V.js.map +1 -0
- package/dist/color-swatch-picker-CU1wrhjX.js +312 -0
- package/dist/color-swatch-picker-CU1wrhjX.js.map +1 -0
- package/dist/color-swatch-picker.d.ts +4 -0
- package/dist/color-swatch-picker.js +1 -0
- package/dist/color-swatch.d.ts +3 -0
- package/dist/color-swatch.js +1 -0
- package/dist/color-wheel-F_BoXKON.js +284 -0
- package/dist/color-wheel-F_BoXKON.js.map +1 -0
- package/dist/color-wheel.d.ts +4 -0
- package/dist/color-wheel.js +1 -0
- package/dist/combobox-virtual-DTRTVq5N.js +56 -0
- package/dist/combobox-virtual-DTRTVq5N.js.map +1 -0
- package/dist/combobox-virtual.d.ts +2 -0
- package/dist/combobox-virtual.js +3 -0
- package/dist/combobox.d.ts +6 -0
- package/dist/combobox.js +1 -0
- package/dist/command-virtual-LoTBDEY5.js +59 -0
- package/dist/command-virtual-LoTBDEY5.js.map +1 -0
- package/dist/command-virtual.d.ts +3 -0
- package/dist/command-virtual.js +3 -0
- package/dist/command.d.ts +4 -0
- package/dist/command.js +1 -0
- package/dist/context-menu-zdHIGS9E.js +151 -0
- package/dist/context-menu-zdHIGS9E.js.map +1 -0
- package/dist/context-menu.d.ts +7 -0
- package/dist/context-menu.js +1 -0
- package/dist/date-field-pgSTZiPb.js +78 -0
- package/dist/date-field-pgSTZiPb.js.map +1 -0
- package/dist/date-field-root-base-CYLuAykm.js +212 -0
- package/dist/date-field-root-base-CYLuAykm.js.map +1 -0
- package/dist/date-field.d.ts +4 -0
- package/dist/date-field.js +1 -0
- package/dist/date-picker-input-CiuuRiWZ.js +16 -0
- package/dist/date-picker-input-CiuuRiWZ.js.map +1 -0
- package/dist/date-picker-input-root-base-ExPSLeKw.js +318 -0
- package/dist/date-picker-input-root-base-ExPSLeKw.js.map +1 -0
- package/dist/date-picker-input.d.ts +4 -0
- package/dist/date-picker-input.js +3 -0
- package/dist/date-picker-trigger-C2BlzvfR.js +349 -0
- package/dist/date-picker-trigger-C2BlzvfR.js.map +1 -0
- package/dist/date-picker.d.ts +6 -0
- package/dist/date-picker.js +1 -0
- package/dist/date-range-field-Bygmkl5c.js +80 -0
- package/dist/date-range-field-Bygmkl5c.js.map +1 -0
- package/dist/date-range-field-input-CivpQMYd.js +69 -0
- package/dist/date-range-field-input-CivpQMYd.js.map +1 -0
- package/dist/date-range-field-root-base-BP26TSWz.js +267 -0
- package/dist/date-range-field-root-base-BP26TSWz.js.map +1 -0
- package/dist/date-range-field.d.ts +4 -0
- package/dist/date-range-field.js +1 -0
- package/dist/date-range-picker-input-BUNCCXUY.js +17 -0
- package/dist/date-range-picker-input-BUNCCXUY.js.map +1 -0
- package/dist/date-range-picker-input.d.ts +4 -0
- package/dist/date-range-picker-input.js +3 -0
- package/dist/date-range-picker.d.ts +7 -0
- package/dist/date-range-picker.js +1 -0
- package/dist/dialog-MNjIMCfA.js +38 -0
- package/dist/dialog-MNjIMCfA.js.map +1 -0
- package/dist/dialog-root-base-jbZipaoQ.js +329 -0
- package/dist/dialog-root-base-jbZipaoQ.js.map +1 -0
- package/dist/dialog-viewport-tYqWTs9Q.d.ts +54 -0
- package/dist/dialog.d.ts +9 -0
- package/dist/dialog.js +1 -0
- package/dist/direction-CN_deiZU.js +30 -0
- package/dist/direction-CN_deiZU.js.map +1 -0
- package/dist/direction-context-D-C_P6Lm.js +19 -0
- package/dist/direction-context-D-C_P6Lm.js.map +1 -0
- package/dist/direction.d.ts +2 -0
- package/dist/direction.js +1 -0
- package/dist/drawer-BcnuGtEt.js +357 -0
- package/dist/drawer-BcnuGtEt.js.map +1 -0
- package/dist/drawer.d.ts +9 -0
- package/dist/drawer.js +1 -0
- package/dist/drop-zone-vFJ5Kvsy.js +98 -0
- package/dist/drop-zone-vFJ5Kvsy.js.map +1 -0
- package/dist/drop-zone.d.ts +4 -0
- package/dist/drop-zone.js +1 -0
- package/dist/editable-CabzXgiN.js +436 -0
- package/dist/editable-CabzXgiN.js.map +1 -0
- package/dist/editable.d.ts +4 -0
- package/dist/editable.js +1 -0
- package/dist/field-DQ2d5nhC.js +397 -0
- package/dist/field-DQ2d5nhC.js.map +1 -0
- package/dist/field.d.ts +4 -0
- package/dist/field.js +1 -0
- package/dist/fieldset-CmmDzOPs.js +80 -0
- package/dist/fieldset-CmmDzOPs.js.map +1 -0
- package/dist/fieldset-context-DtEOoG6M.js +5 -0
- package/dist/fieldset-context-DtEOoG6M.js.map +1 -0
- package/dist/fieldset.d.ts +3 -0
- package/dist/fieldset.js +1 -0
- package/dist/file-upload-_Hh-STdv.js +644 -0
- package/dist/file-upload-_Hh-STdv.js.map +1 -0
- package/dist/file-upload.d.ts +4 -0
- package/dist/file-upload.js +1 -0
- package/dist/form-context-DBnVT1lw.js +5 -0
- package/dist/form-context-DBnVT1lw.js.map +1 -0
- package/dist/form-s9HijjTL.js +92 -0
- package/dist/form-s9HijjTL.js.map +1 -0
- package/dist/form.d.ts +3 -0
- package/dist/form.js +1 -0
- package/dist/hover-card-rmd0fD17.js +355 -0
- package/dist/hover-card-rmd0fD17.js.map +1 -0
- package/dist/hover-card.d.ts +9 -0
- package/dist/hover-card.js +1 -0
- package/dist/index-5WtjXdX9.d.ts +63 -0
- package/dist/index-5eBkkEtv.d.ts +36 -0
- package/dist/index-B-vqAG6g.d.ts +33 -0
- package/dist/index-B1uYYVtV.d.ts +18 -0
- package/dist/index-B8E3X1CK.d.ts +66 -0
- package/dist/index-B8Ufhgzu.d.ts +36 -0
- package/dist/index-BJz7OWbi.d.ts +88 -0
- package/dist/index-BMjRueuv.d.ts +40 -0
- package/dist/index-BP7Tmb0E.d.ts +95 -0
- package/dist/index-Bbb1Zgwo.d.ts +50 -0
- package/dist/index-BdJFU5tH.d.ts +28 -0
- package/dist/index-BdfnRo-h.d.ts +55 -0
- package/dist/index-BniQvFN-.d.ts +38 -0
- package/dist/index-Bt0B-8RV.d.ts +14 -0
- package/dist/index-BuWJcRPC.d.ts +18 -0
- package/dist/index-Byf0GNd9.d.ts +41 -0
- package/dist/index-BzHLkAWU.d.ts +35 -0
- package/dist/index-C-QYKtWy.d.ts +28 -0
- package/dist/index-C7nh2Oil.d.ts +40 -0
- package/dist/index-CDKebSlA.d.ts +41 -0
- package/dist/index-CFPqV6qJ.d.ts +72 -0
- package/dist/index-CRJv_zWm.d.ts +37 -0
- package/dist/index-CTzUalDO.d.ts +76 -0
- package/dist/index-CZHLD5cJ.d.ts +17 -0
- package/dist/index-Cgwn5qgy.d.ts +88 -0
- package/dist/index-Ch4h1DFC.d.ts +55 -0
- package/dist/index-Cj3B9gY_.d.ts +50 -0
- package/dist/index-Cj6NwCBD.d.ts +44 -0
- package/dist/index-CkDThwop.d.ts +21 -0
- package/dist/index-Cn-D14iz.d.ts +13 -0
- package/dist/index-CpTiLSql.d.ts +53 -0
- package/dist/index-CqP363e5.d.ts +118 -0
- package/dist/index-Cv4dRdEa.d.ts +72 -0
- package/dist/index-CyI637MF.d.ts +37 -0
- package/dist/index-D11YCkvR.d.ts +42 -0
- package/dist/index-D3yyJGzf.d.ts +74 -0
- package/dist/index-D5PbKxcs.d.ts +26 -0
- package/dist/index-DAYklR-H.d.ts +18 -0
- package/dist/index-DIZSgXHM.d.ts +79 -0
- package/dist/index-DZckp3H0.d.ts +37 -0
- package/dist/index-DaqoBvQf.d.ts +56 -0
- package/dist/index-Df9i45Gr.d.ts +65 -0
- package/dist/index-DqI6n06W.d.ts +59 -0
- package/dist/index-Drp7svmT.d.ts +30 -0
- package/dist/index-DxsUcSGT.d.ts +99 -0
- package/dist/index-Dyyi-1mv.d.ts +35 -0
- package/dist/index-I2ewgOGz.d.ts +76 -0
- package/dist/index-JGhlANKo.d.ts +24 -0
- package/dist/index-KASc7z5u.d.ts +38 -0
- package/dist/index-LTcmDERY.d.ts +65 -0
- package/dist/index-Mf2RPgmw.d.ts +38 -0
- package/dist/index-NdY27G_d.d.ts +58 -0
- package/dist/index-QO79pDtI.d.ts +70 -0
- package/dist/index-S0FIwOSw.d.ts +59 -0
- package/dist/index-UxsyZS_A.d.ts +23 -0
- package/dist/index-W8aOtVIu.d.ts +40 -0
- package/dist/index-WC9xwMaX.d.ts +34 -0
- package/dist/index-Xwb9OtVU.d.ts +7 -0
- package/dist/index-ZWJJ2V_J.d.ts +49 -0
- package/dist/index-_Q_N8ZbU.d.ts +35 -0
- package/dist/index-bC3hHzam.d.ts +101 -0
- package/dist/index-baY49J-s.d.ts +15 -0
- package/dist/index-dCTvA7uS.d.ts +20 -0
- package/dist/index-mhpoLESL.d.ts +77 -0
- package/dist/index-p3t0BKd4.d.ts +22 -0
- package/dist/index-sgaMj_3p.d.ts +69 -0
- package/dist/index-tSLNRqTo.d.ts +33 -0
- package/dist/index-t_lSQgLA.d.ts +1346 -0
- package/dist/index-uL1dEAhG.d.ts +28 -0
- package/dist/index.d.ts +79 -0
- package/dist/index.js +106 -0
- package/dist/label-Ce-gIayi.js +35 -0
- package/dist/label-Ce-gIayi.js.map +1 -0
- package/dist/label.d.ts +3 -0
- package/dist/label.js +1 -0
- package/dist/labelled-part-DB2rXJFG.js +56 -0
- package/dist/labelled-part-DB2rXJFG.js.map +1 -0
- package/dist/link-CZ3ISaPX.js +42 -0
- package/dist/link-CZ3ISaPX.js.map +1 -0
- package/dist/link-attributes-D9UusWws.js +29 -0
- package/dist/link-attributes-D9UusWws.js.map +1 -0
- package/dist/link.d.ts +3 -0
- package/dist/link.js +1 -0
- package/dist/listbox-virtual-He6BWlPj.js +291 -0
- package/dist/listbox-virtual-He6BWlPj.js.map +1 -0
- package/dist/listbox-virtual.d.ts +5 -0
- package/dist/listbox-virtual.js +3 -0
- package/dist/listbox.d.ts +4 -0
- package/dist/listbox.js +1 -0
- package/dist/live-region-style-9ofmajhO.js +46 -0
- package/dist/live-region-style-9ofmajhO.js.map +1 -0
- package/dist/menu-D7TVxPdb.js +144 -0
- package/dist/menu-D7TVxPdb.js.map +1 -0
- package/dist/menu-bar-context-k5vMlwmW.js +13 -0
- package/dist/menu-bar-context-k5vMlwmW.js.map +1 -0
- package/dist/menu-submenu-trigger-ClI2Pm4X.js +885 -0
- package/dist/menu-submenu-trigger-ClI2Pm4X.js.map +1 -0
- package/dist/menu-submenu-trigger-DNH8_uUB.d.ts +127 -0
- package/dist/menu.d.ts +10 -0
- package/dist/menu.js +1 -0
- package/dist/menubar-CQn3AOiQ.js +212 -0
- package/dist/menubar-CQn3AOiQ.js.map +1 -0
- package/dist/menubar.d.ts +3 -0
- package/dist/menubar.js +1 -0
- package/dist/meter-7Qd_WaUY.js +202 -0
- package/dist/meter-7Qd_WaUY.js.map +1 -0
- package/dist/meter.d.ts +3 -0
- package/dist/meter.js +1 -0
- package/dist/month-calendar-root-base-VcD8ZNW5.js +354 -0
- package/dist/month-calendar-root-base-VcD8ZNW5.js.map +1 -0
- package/dist/month-calendar.d.ts +5 -0
- package/dist/month-calendar.js +1 -0
- package/dist/month-picker-DzOYqW1S.js +15 -0
- package/dist/month-picker-DzOYqW1S.js.map +1 -0
- package/dist/month-picker-root-base-ByMK_Mfq.js +158 -0
- package/dist/month-picker-root-base-ByMK_Mfq.js.map +1 -0
- package/dist/month-picker.d.ts +7 -0
- package/dist/month-picker.js +3 -0
- package/dist/month-range-calendar-CJAWu1-Z.js +18 -0
- package/dist/month-range-calendar-CJAWu1-Z.js.map +1 -0
- package/dist/month-range-calendar.d.ts +5 -0
- package/dist/month-range-calendar.js +3 -0
- package/dist/month-range-picker-CRJDG2HG.js +15 -0
- package/dist/month-range-picker-CRJDG2HG.js.map +1 -0
- package/dist/month-range-picker.d.ts +8 -0
- package/dist/month-range-picker.js +3 -0
- package/dist/multiple-calendar-BIb2zfBH.js +176 -0
- package/dist/multiple-calendar-BIb2zfBH.js.map +1 -0
- package/dist/multiple-calendar.d.ts +5 -0
- package/dist/multiple-calendar.js +3 -0
- package/dist/navigation-menu-COTxGol_.js +727 -0
- package/dist/navigation-menu-COTxGol_.js.map +1 -0
- package/dist/navigation-menu.d.ts +5 -0
- package/dist/navigation-menu.js +1 -0
- package/dist/number-field-CqxEnwiS.js +581 -0
- package/dist/number-field-CqxEnwiS.js.map +1 -0
- package/dist/number-field.d.ts +4 -0
- package/dist/number-field.js +1 -0
- package/dist/otp-field-DIDuypLU.js +420 -0
- package/dist/otp-field-DIDuypLU.js.map +1 -0
- package/dist/otp-field.d.ts +4 -0
- package/dist/otp-field.js +1 -0
- package/dist/overlay-handle-DUptsQOb.js +42 -0
- package/dist/overlay-handle-DUptsQOb.js.map +1 -0
- package/dist/overlay-handle-DzC9LJQo.d.ts +16 -0
- package/dist/overlay-portal-Cmn7Dt7E.d.ts +30 -0
- package/dist/overlay-portal-ZNtXmoFd.js +32 -0
- package/dist/overlay-portal-ZNtXmoFd.js.map +1 -0
- package/dist/pagination-BNUjFYxK.js +264 -0
- package/dist/pagination-BNUjFYxK.js.map +1 -0
- package/dist/pagination.d.ts +4 -0
- package/dist/pagination.js +1 -0
- package/dist/parts--mC44S1N.js +1023 -0
- package/dist/parts--mC44S1N.js.map +1 -0
- package/dist/parts-BP00C3Q5.js +874 -0
- package/dist/parts-BP00C3Q5.js.map +1 -0
- package/dist/parts-CMh29O5y.js +14 -0
- package/dist/parts-CMh29O5y.js.map +1 -0
- package/dist/parts-CZqNGRqe.js +20 -0
- package/dist/parts-CZqNGRqe.js.map +1 -0
- package/dist/parts-DMy2yQZs.js +254 -0
- package/dist/parts-DMy2yQZs.js.map +1 -0
- package/dist/parts-DVv0aov9.js +14 -0
- package/dist/parts-DVv0aov9.js.map +1 -0
- package/dist/parts-M3ThgZzl.js +489 -0
- package/dist/parts-M3ThgZzl.js.map +1 -0
- package/dist/parts-stPOp8dr.js +451 -0
- package/dist/parts-stPOp8dr.js.map +1 -0
- package/dist/parts-uxRkRrFr.js +668 -0
- package/dist/parts-uxRkRrFr.js.map +1 -0
- package/dist/password-input-DC39W-do.js +231 -0
- package/dist/password-input-DC39W-do.js.map +1 -0
- package/dist/password-input.d.ts +4 -0
- package/dist/password-input.js +1 -0
- package/dist/popover-BaQTGAYJ.js +328 -0
- package/dist/popover-BaQTGAYJ.js.map +1 -0
- package/dist/popover.d.ts +9 -0
- package/dist/popover.js +1 -0
- package/dist/progress-DH1Xrj73.js +219 -0
- package/dist/progress-DH1Xrj73.js.map +1 -0
- package/dist/progress.d.ts +3 -0
- package/dist/progress.js +1 -0
- package/dist/public-component-AV8E7mGp.js +8 -0
- package/dist/public-component-AV8E7mGp.js.map +1 -0
- package/dist/public-component-DYpU9aDh.d.ts +33 -0
- package/dist/radio-B9YCSnFs.js +159 -0
- package/dist/radio-B9YCSnFs.js.map +1 -0
- package/dist/radio-group-CmSF4FTc.js +173 -0
- package/dist/radio-group-CmSF4FTc.js.map +1 -0
- package/dist/radio-group-context-C196JZ9D.js +5 -0
- package/dist/radio-group-context-C196JZ9D.js.map +1 -0
- package/dist/radio-group.d.ts +4 -0
- package/dist/radio-group.js +1 -0
- package/dist/radio.d.ts +3 -0
- package/dist/radio.js +1 -0
- package/dist/range-calendar-BDbNdL75.js +20 -0
- package/dist/range-calendar-BDbNdL75.js.map +1 -0
- package/dist/range-calendar.d.ts +5 -0
- package/dist/range-calendar.js +1 -0
- package/dist/rating-oC2t52av.js +351 -0
- package/dist/rating-oC2t52av.js.map +1 -0
- package/dist/rating.d.ts +4 -0
- package/dist/rating.js +1 -0
- package/dist/render-part-B5XVbHaS.js +36 -0
- package/dist/render-part-B5XVbHaS.js.map +1 -0
- package/dist/render-part-BaTKiWBp.d.ts +28 -0
- package/dist/render.d.ts +3 -0
- package/dist/render.js +3 -0
- package/dist/roving-context-LyHQFJqZ.js +32 -0
- package/dist/roving-context-LyHQFJqZ.js.map +1 -0
- package/dist/scroll-area-_EApTP33.js +328 -0
- package/dist/scroll-area-_EApTP33.js.map +1 -0
- package/dist/scroll-area.d.ts +3 -0
- package/dist/scroll-area.js +1 -0
- package/dist/search-field-DJIr926A.js +221 -0
- package/dist/search-field-DJIr926A.js.map +1 -0
- package/dist/search-field.d.ts +4 -0
- package/dist/search-field.js +1 -0
- package/dist/segmented-control-BMvmqBpR.js +389 -0
- package/dist/segmented-control-BMvmqBpR.js.map +1 -0
- package/dist/segmented-control.d.ts +4 -0
- package/dist/segmented-control.js +1 -0
- package/dist/select-virtual-BwZrX4bh.js +53 -0
- package/dist/select-virtual-BwZrX4bh.js.map +1 -0
- package/dist/select-virtual.d.ts +3 -0
- package/dist/select-virtual.js +3 -0
- package/dist/select.d.ts +6 -0
- package/dist/select.js +1 -0
- package/dist/separator-SgHyzEHB.js +42 -0
- package/dist/separator-SgHyzEHB.js.map +1 -0
- package/dist/separator.d.ts +3 -0
- package/dist/separator.js +1 -0
- package/dist/slider-DU5Cx7yj.js +539 -0
- package/dist/slider-DU5Cx7yj.js.map +1 -0
- package/dist/slider.d.ts +4 -0
- package/dist/slider.js +1 -0
- package/dist/state-attributes-DhboDeMS.js +14 -0
- package/dist/state-attributes-DhboDeMS.js.map +1 -0
- package/dist/steps-Dl_mMqRB.js +363 -0
- package/dist/steps-Dl_mMqRB.js.map +1 -0
- package/dist/steps.d.ts +4 -0
- package/dist/steps.js +1 -0
- package/dist/switch-CT9QBKOs.js +183 -0
- package/dist/switch-CT9QBKOs.js.map +1 -0
- package/dist/switch.d.ts +4 -0
- package/dist/switch.js +1 -0
- package/dist/tabs-BhVbQ7AV.js +369 -0
- package/dist/tabs-BhVbQ7AV.js.map +1 -0
- package/dist/tabs.d.ts +4 -0
- package/dist/tabs.js +1 -0
- package/dist/tag-group-DdpjWmzb.js +422 -0
- package/dist/tag-group-DdpjWmzb.js.map +1 -0
- package/dist/tag-group.d.ts +4 -0
- package/dist/tag-group.js +1 -0
- package/dist/tags-input-Iw3mST3A.js +627 -0
- package/dist/tags-input-Iw3mST3A.js.map +1 -0
- package/dist/tags-input.d.ts +4 -0
- package/dist/tags-input.js +1 -0
- package/dist/time-field-5Ghk_4SZ.js +76 -0
- package/dist/time-field-5Ghk_4SZ.js.map +1 -0
- package/dist/time-field.d.ts +4 -0
- package/dist/time-field.js +1 -0
- package/dist/time-range-field-DNOZQK4F.js +77 -0
- package/dist/time-range-field-DNOZQK4F.js.map +1 -0
- package/dist/time-range-field.d.ts +4 -0
- package/dist/time-range-field.js +1 -0
- package/dist/toast-DBKxX79M.js +426 -0
- package/dist/toast-DBKxX79M.js.map +1 -0
- package/dist/toast.d.ts +3 -0
- package/dist/toast.js +1 -0
- package/dist/toggle-Cca0PFQv.js +101 -0
- package/dist/toggle-Cca0PFQv.js.map +1 -0
- package/dist/toggle-group-DTUrLX_H.js +102 -0
- package/dist/toggle-group-DTUrLX_H.js.map +1 -0
- package/dist/toggle-group-context-gMEC8r-Z.js +5 -0
- package/dist/toggle-group-context-gMEC8r-Z.js.map +1 -0
- package/dist/toggle-group.d.ts +4 -0
- package/dist/toggle-group.js +1 -0
- package/dist/toggle.d.ts +4 -0
- package/dist/toggle.js +1 -0
- package/dist/toolbar-WU8JwFd0.js +272 -0
- package/dist/toolbar-WU8JwFd0.js.map +1 -0
- package/dist/toolbar.d.ts +3 -0
- package/dist/toolbar.js +1 -0
- package/dist/tooltip-C1kKsTSh.js +358 -0
- package/dist/tooltip-C1kKsTSh.js.map +1 -0
- package/dist/tooltip.d.ts +9 -0
- package/dist/tooltip.js +1 -0
- package/dist/use-color-picker-binding-BrG-whys.js +32 -0
- package/dist/use-color-picker-binding-BrG-whys.js.map +1 -0
- package/dist/use-controllable-B46G4v0A.js +30 -0
- package/dist/use-controllable-B46G4v0A.js.map +1 -0
- package/dist/use-field-control-CdYqr0dK.js +109 -0
- package/dist/use-field-control-CdYqr0dK.js.map +1 -0
- package/dist/use-overlay-root-BkyTQIsX.js +296 -0
- package/dist/use-overlay-root-BkyTQIsX.js.map +1 -0
- package/dist/use-overlay-trigger-D9OXZ_6K.d.ts +12 -0
- package/dist/use-overlay-trigger-KM35pX0a.js +61 -0
- package/dist/use-overlay-trigger-KM35pX0a.js.map +1 -0
- package/dist/use-panel-transition-DF7f1nmF.js +112 -0
- package/dist/use-panel-transition-DF7f1nmF.js.map +1 -0
- package/dist/use-panel-transition-r_BlVRob.d.ts +2 -0
- package/dist/use-positioner-BD24G6q1.js +73 -0
- package/dist/use-positioner-BD24G6q1.js.map +1 -0
- package/dist/use-positioner-D98pYl_K.d.ts +12 -0
- package/dist/use-presence-BcvBOTDI.d.ts +3 -0
- package/dist/use-required-context-CPpEkr4Q.js +11 -0
- package/dist/use-required-context-CPpEkr4Q.js.map +1 -0
- package/dist/use-roving-composite-CW0mE_VU.js +71 -0
- package/dist/use-roving-composite-CW0mE_VU.js.map +1 -0
- package/dist/use-roving-item-B9Cil5Rq.js +42 -0
- package/dist/use-roving-item-B9Cil5Rq.js.map +1 -0
- package/dist/use-segment-group-CAlwM3KP.js +304 -0
- package/dist/use-segment-group-CAlwM3KP.js.map +1 -0
- package/dist/use-virtual-rows-DesBexmk.js +142 -0
- package/dist/use-virtual-rows-DesBexmk.js.map +1 -0
- package/dist/virtual-list-BNvYqnFf.js +49 -0
- package/dist/virtual-list-BNvYqnFf.js.map +1 -0
- package/dist/year-calendar-cYl3WHEM.js +18 -0
- package/dist/year-calendar-cYl3WHEM.js.map +1 -0
- package/dist/year-calendar.d.ts +5 -0
- package/dist/year-calendar.js +3 -0
- package/dist/year-picker-DYQZbF1h.js +15 -0
- package/dist/year-picker-DYQZbF1h.js.map +1 -0
- package/dist/year-picker.d.ts +8 -0
- package/dist/year-picker.js +3 -0
- package/dist/year-range-calendar-ODgfmdiv.js +18 -0
- package/dist/year-range-calendar-ODgfmdiv.js.map +1 -0
- package/dist/year-range-calendar.d.ts +5 -0
- package/dist/year-range-calendar.js +3 -0
- package/dist/year-range-picker-DKXlcy7I.js +15 -0
- package/dist/year-range-picker-DKXlcy7I.js.map +1 -0
- package/dist/year-range-picker.d.ts +8 -0
- package/dist/year-range-picker.js +3 -0
- package/package.json +548 -3
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { n as useProvidedDirection } from "./direction-context-D-C_P6Lm.js";
|
|
2
|
+
import { ref, watch } from "vue";
|
|
3
|
+
import { anchorFloating } from "@fragiola/primitives/positioning";
|
|
4
|
+
// src/composables/use-positioner.ts
|
|
5
|
+
const positionerProps = {
|
|
6
|
+
side: {
|
|
7
|
+
type: String,
|
|
8
|
+
default: void 0
|
|
9
|
+
},
|
|
10
|
+
align: {
|
|
11
|
+
type: String,
|
|
12
|
+
default: void 0
|
|
13
|
+
},
|
|
14
|
+
sideOffset: {
|
|
15
|
+
type: Number,
|
|
16
|
+
default: 0
|
|
17
|
+
},
|
|
18
|
+
alignOffset: {
|
|
19
|
+
type: Number,
|
|
20
|
+
default: 0
|
|
21
|
+
},
|
|
22
|
+
collisionPadding: {
|
|
23
|
+
type: Number,
|
|
24
|
+
default: 8
|
|
25
|
+
},
|
|
26
|
+
anchor: {
|
|
27
|
+
type: Object,
|
|
28
|
+
default: void 0
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* Positions an overlay's positioner next to its anchor while both exist and the overlay is
|
|
33
|
+
* `mounted` (open or its exit running): a kept-mounted closed overlay is not positioned
|
|
34
|
+
* (spec/README.md, "Lifecycle"). Reports where it went.
|
|
35
|
+
*/
|
|
36
|
+
function usePositioner(props, defaults, anchor, positioner, arrow, mounted) {
|
|
37
|
+
const direction = useProvidedDirection();
|
|
38
|
+
const placed = ref({
|
|
39
|
+
side: props.side ?? defaults.side,
|
|
40
|
+
align: props.align ?? defaults.align
|
|
41
|
+
});
|
|
42
|
+
watch(() => [
|
|
43
|
+
mounted === void 0 || mounted.value ? props.anchor ?? anchor.value : null,
|
|
44
|
+
positioner.value,
|
|
45
|
+
arrow?.value ?? null,
|
|
46
|
+
props.side ?? defaults.side,
|
|
47
|
+
props.align ?? defaults.align,
|
|
48
|
+
props.sideOffset ?? 0,
|
|
49
|
+
props.alignOffset ?? 0,
|
|
50
|
+
props.collisionPadding ?? 8
|
|
51
|
+
], ([anchorElement, floating, arrowElement, side, align, sideOffset, alignOffset, collisionPadding], _, onCleanup) => {
|
|
52
|
+
if (!anchorElement || !floating) return;
|
|
53
|
+
onCleanup(anchorFloating(anchorElement, floating, {
|
|
54
|
+
side,
|
|
55
|
+
align,
|
|
56
|
+
sideOffset,
|
|
57
|
+
alignOffset,
|
|
58
|
+
collisionPadding,
|
|
59
|
+
arrow: arrowElement,
|
|
60
|
+
direction,
|
|
61
|
+
onPlaced: (next) => {
|
|
62
|
+
if (placed.value.side !== next.side || placed.value.align !== next.align) placed.value = next;
|
|
63
|
+
}
|
|
64
|
+
}));
|
|
65
|
+
}, {
|
|
66
|
+
flush: "post",
|
|
67
|
+
immediate: true
|
|
68
|
+
});
|
|
69
|
+
return placed;
|
|
70
|
+
}
|
|
71
|
+
export { usePositioner as n, positionerProps as t };
|
|
72
|
+
|
|
73
|
+
//# sourceMappingURL=use-positioner-BD24G6q1.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-positioner-BD24G6q1.js","names":[],"sources":["../src/composables/use-positioner.ts"],"sourcesContent":["import {\n type Align,\n anchorFloating,\n type Side,\n type VirtualAnchor,\n} from \"@fragiola/primitives/positioning\";\nimport { type Ref, ref, watch } from \"vue\";\nimport { useProvidedDirection } from \"../direction/direction-context.ts\";\n\nexport interface PositionerProps {\n side?: Side;\n align?: Align;\n sideOffset?: number;\n alignOffset?: number;\n collisionPadding?: number;\n /** The element to anchor to (default: the trigger). */\n anchor?: Element | null;\n}\n\nexport const positionerProps = {\n side: { type: String as () => Side, default: undefined },\n align: { type: String as () => Align, default: undefined },\n sideOffset: { type: Number, default: 0 },\n alignOffset: { type: Number, default: 0 },\n collisionPadding: { type: Number, default: 8 },\n anchor: { type: Object as () => Element | null, default: undefined },\n};\n\n/**\n * Positions an overlay's positioner next to its anchor while both exist and the overlay is\n * `mounted` (open or its exit running): a kept-mounted closed overlay is not positioned\n * (spec/README.md, \"Lifecycle\"). Reports where it went.\n */\nexport function usePositioner(\n props: PositionerProps,\n defaults: { side: Side; align: Align },\n /** The trigger, or what the overlay anchors to instead (a context menu's point). */\n anchor: Readonly<Ref<Element | VirtualAnchor | null>>,\n positioner: Ref<HTMLElement | null>,\n arrow: Ref<HTMLElement | null> | null,\n mounted?: Ref<boolean>,\n) {\n const direction = useProvidedDirection();\n const placed = ref<{ side: Side; align: Align }>({\n side: props.side ?? defaults.side,\n align: props.align ?? defaults.align,\n });\n watch(\n () =>\n [\n mounted === undefined || mounted.value\n ? (props.anchor ?? anchor.value)\n : null,\n positioner.value,\n arrow?.value ?? null,\n props.side ?? defaults.side,\n props.align ?? defaults.align,\n props.sideOffset ?? 0,\n props.alignOffset ?? 0,\n props.collisionPadding ?? 8,\n ] as const,\n (\n [\n anchorElement,\n floating,\n arrowElement,\n side,\n align,\n sideOffset,\n alignOffset,\n collisionPadding,\n ],\n _,\n onCleanup,\n ) => {\n if (!anchorElement || !floating) {\n return;\n }\n onCleanup(\n anchorFloating(anchorElement, floating, {\n side,\n align,\n sideOffset,\n alignOffset,\n collisionPadding,\n arrow: arrowElement,\n direction,\n onPlaced: (next) => {\n if (\n placed.value.side !== next.side ||\n placed.value.align !== next.align\n ) {\n placed.value = next;\n }\n },\n }),\n );\n },\n { flush: \"post\", immediate: true },\n );\n return placed;\n}\n"],"mappings":";;;;AAmBA,MAAa,kBAAkB;CAC3B,MAAM;EAAE,MAAM;EAAsB,SAAS,KAAA;CAAU;CACvD,OAAO;EAAE,MAAM;EAAuB,SAAS,KAAA;CAAU;CACzD,YAAY;EAAE,MAAM;EAAQ,SAAS;CAAE;CACvC,aAAa;EAAE,MAAM;EAAQ,SAAS;CAAE;CACxC,kBAAkB;EAAE,MAAM;EAAQ,SAAS;CAAE;CAC7C,QAAQ;EAAE,MAAM;EAAgC,SAAS,KAAA;CAAU;AACvE;;;;;;AAOA,SAAgB,cACZ,OACA,UAEA,QACA,YACA,OACA,SACF;CACE,MAAM,YAAY,qBAAqB;CACvC,MAAM,SAAS,IAAkC;EAC7C,MAAM,MAAM,QAAQ,SAAS;EAC7B,OAAO,MAAM,SAAS,SAAS;CACnC,CAAC;CACD,YAEQ;EACI,YAAY,KAAA,KAAa,QAAQ,QAC1B,MAAM,UAAU,OAAO,QACxB;EACN,WAAW;EACX,OAAO,SAAS;EAChB,MAAM,QAAQ,SAAS;EACvB,MAAM,SAAS,SAAS;EACxB,MAAM,cAAc;EACpB,MAAM,eAAe;EACrB,MAAM,oBAAoB;CAC9B,IAEA,CACI,eACA,UACA,cACA,MACA,OACA,YACA,aACA,mBAEJ,GACA,cACC;EACD,IAAI,CAAC,iBAAiB,CAAC,UACnB;EAEJ,UACI,eAAe,eAAe,UAAU;GACpC;GACA;GACA;GACA;GACA;GACA,OAAO;GACP;GACA,WAAW,SAAS;IAChB,IACI,OAAO,MAAM,SAAS,KAAK,QAC3B,OAAO,MAAM,UAAU,KAAK,OAE5B,OAAO,QAAQ;GAEvB;EACJ,CAAC,CACL;CACJ,GACA;EAAE,OAAO;EAAQ,WAAW;CAAK,CACrC;CACA,OAAO;AACX"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import "vue";
|
|
2
|
+
import { Align, Side } from "@fragiola/primitives/positioning";
|
|
3
|
+
interface PositionerProps {
|
|
4
|
+
side?: Side;
|
|
5
|
+
align?: Align;
|
|
6
|
+
sideOffset?: number;
|
|
7
|
+
alignOffset?: number;
|
|
8
|
+
collisionPadding?: number;
|
|
9
|
+
/** The element to anchor to (default: the trigger). */
|
|
10
|
+
anchor?: Element | null;
|
|
11
|
+
}
|
|
12
|
+
export { PositionerProps as t };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { inject } from "vue";
|
|
2
|
+
// src/composables/use-required-context.ts
|
|
3
|
+
/** Reads a part's root context, failing with the part's name outside its root. */
|
|
4
|
+
function useRequiredContext(key, part) {
|
|
5
|
+
const value = inject(key, null);
|
|
6
|
+
if (value === null) throw new Error(`<${part}> must be inside its Root.`);
|
|
7
|
+
return value;
|
|
8
|
+
}
|
|
9
|
+
export { useRequiredContext as t };
|
|
10
|
+
|
|
11
|
+
//# sourceMappingURL=use-required-context-CPpEkr4Q.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-required-context-CPpEkr4Q.js","names":[],"sources":["../src/composables/use-required-context.ts"],"sourcesContent":["import { type InjectionKey, inject } from \"vue\";\n\n/** Reads a part's root context, failing with the part's name outside its root. */\nexport function useRequiredContext<T>(key: InjectionKey<T>, part: string): T {\n const value = inject(key, null);\n if (value === null) {\n throw new Error(`<${part}> must be inside its Root.`);\n }\n return value;\n}\n"],"mappings":";;;AAGA,SAAgB,mBAAsB,KAAsB,MAAiB;CACzE,MAAM,QAAQ,OAAO,KAAK,IAAI;CAC9B,IAAI,UAAU,MACV,MAAM,IAAI,MAAM,IAAI,KAAK,2BAA2B;CAExD,OAAO;AACX"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { n as useProvidedDirection } from "./direction-context-D-C_P6Lm.js";
|
|
2
|
+
import { t as elementSetter } from "./use-overlay-root-BkyTQIsX.js";
|
|
3
|
+
import { computed, shallowRef } from "vue";
|
|
4
|
+
import { inDocumentOrder, rovingKeyTarget, rovingKeys, rovingTabStop, textFieldKeepsKey } from "@fragiola/primitives/collection";
|
|
5
|
+
import { getDirection } from "@fragiola/primitives/direction";
|
|
6
|
+
// src/composables/use-roving-composite.ts
|
|
7
|
+
/**
|
|
8
|
+
* The root of a roving-focus scope (spec/toolbar.md, "Focus" and "Nested composites"): its
|
|
9
|
+
* registered items, the one holding the tab stop (the one that last had focus while it can take
|
|
10
|
+
* focus, else the first that can), and the key listener its element takes: the orientation's
|
|
11
|
+
* arrows (mirrored in RTL), Home and End move the focus through the items in document order,
|
|
12
|
+
* unless a listener before it prevented the key, or a text field keeps it.
|
|
13
|
+
*/
|
|
14
|
+
function useRovingComposite({ orientation, loopFocus, disabled }) {
|
|
15
|
+
const direction = useProvidedDirection();
|
|
16
|
+
const items = shallowRef([]);
|
|
17
|
+
const active = shallowRef(null);
|
|
18
|
+
const root = shallowRef(null);
|
|
19
|
+
const ordered = computed(() => inDocumentOrder(items.value, (item) => item.element));
|
|
20
|
+
const tabStop = computed(() => {
|
|
21
|
+
const list = ordered.value;
|
|
22
|
+
return list[rovingTabStop(list.length, list.findIndex((item) => item.element === active.value), (candidate) => !list[candidate]?.focusable())]?.element ?? null;
|
|
23
|
+
});
|
|
24
|
+
const register = (element, focusable) => {
|
|
25
|
+
const item = {
|
|
26
|
+
element,
|
|
27
|
+
focusable
|
|
28
|
+
};
|
|
29
|
+
items.value = [...items.value, item];
|
|
30
|
+
return () => {
|
|
31
|
+
items.value = items.value.filter((entry) => entry !== item);
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
const focused = (element) => {
|
|
35
|
+
active.value = element;
|
|
36
|
+
};
|
|
37
|
+
const onKeydown = (event) => {
|
|
38
|
+
if (event.defaultPrevented || event.altKey || event.ctrlKey || event.metaKey || event.shiftKey) return;
|
|
39
|
+
const list = ordered.value;
|
|
40
|
+
const from = list.findIndex((item) => item.element === event.target);
|
|
41
|
+
if (from === -1) return;
|
|
42
|
+
const rtl = getDirection(event.currentTarget, direction()) === "rtl";
|
|
43
|
+
if (textFieldKeepsKey(event.target, event.key, rovingKeys(orientation(), rtl))) return;
|
|
44
|
+
const target = rovingKeyTarget(event.key, from, list.length, {
|
|
45
|
+
orientation: orientation(),
|
|
46
|
+
rtl,
|
|
47
|
+
loop: loopFocus(),
|
|
48
|
+
skip: (candidate) => !list[candidate]?.focusable()
|
|
49
|
+
});
|
|
50
|
+
const element = target === null ? void 0 : list[target]?.element;
|
|
51
|
+
if (element === void 0) return;
|
|
52
|
+
event.preventDefault();
|
|
53
|
+
element.focus();
|
|
54
|
+
if (element.tagName === "INPUT" || element.tagName === "TEXTAREA") element.select();
|
|
55
|
+
};
|
|
56
|
+
return {
|
|
57
|
+
scope: {
|
|
58
|
+
orientation,
|
|
59
|
+
disabled,
|
|
60
|
+
root: () => root.value,
|
|
61
|
+
tabStop: () => tabStop.value,
|
|
62
|
+
register,
|
|
63
|
+
focused
|
|
64
|
+
},
|
|
65
|
+
onKeydown,
|
|
66
|
+
ref: elementSetter(root)
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
export { useRovingComposite as t };
|
|
70
|
+
|
|
71
|
+
//# sourceMappingURL=use-roving-composite-CW0mE_VU.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-roving-composite-CW0mE_VU.js","names":[],"sources":["../src/composables/use-roving-composite.ts"],"sourcesContent":["import {\n inDocumentOrder,\n type RovingOrientation,\n rovingKeys,\n rovingKeyTarget,\n rovingTabStop,\n textFieldKeepsKey,\n} from \"@fragiola/primitives/collection\";\nimport { getDirection } from \"@fragiola/primitives/direction\";\nimport { computed, shallowRef } from \"vue\";\nimport { useProvidedDirection } from \"../direction/direction-context.ts\";\nimport type { RovingScope } from \"../utils/roving-context.ts\";\nimport { elementSetter } from \"./use-overlay-root.ts\";\n\ninterface RovingItem {\n element: HTMLElement;\n focusable: () => boolean;\n}\n\nexport interface RovingCompositeOptions {\n orientation: () => RovingOrientation;\n loopFocus: () => boolean;\n disabled: () => boolean;\n}\n\n/**\n * The root of a roving-focus scope (spec/toolbar.md, \"Focus\" and \"Nested composites\"): its\n * registered items, the one holding the tab stop (the one that last had focus while it can take\n * focus, else the first that can), and the key listener its element takes: the orientation's\n * arrows (mirrored in RTL), Home and End move the focus through the items in document order,\n * unless a listener before it prevented the key, or a text field keeps it.\n */\nexport function useRovingComposite({\n orientation,\n loopFocus,\n disabled,\n}: RovingCompositeOptions): {\n scope: RovingScope;\n onKeydown: (event: KeyboardEvent) => void;\n /** The template ref of the scope's root element (only an element inside it is an item). */\n ref: (value: unknown) => void;\n} {\n const direction = useProvidedDirection();\n const items = shallowRef<readonly RovingItem[]>([]);\n const active = shallowRef<HTMLElement | null>(null);\n const root = shallowRef<HTMLElement | null>(null);\n const ordered = computed(() =>\n inDocumentOrder(items.value, (item) => item.element),\n );\n const tabStop = computed(() => {\n const list = ordered.value;\n const index = rovingTabStop(\n list.length,\n list.findIndex((item) => item.element === active.value),\n (candidate) => !list[candidate]?.focusable(),\n );\n return list[index]?.element ?? null;\n });\n\n const register = (element: HTMLElement, focusable: () => boolean) => {\n const item = { element, focusable };\n items.value = [...items.value, item];\n return () => {\n items.value = items.value.filter((entry) => entry !== item);\n };\n };\n const focused = (element: HTMLElement) => {\n active.value = element;\n };\n\n const onKeydown = (event: KeyboardEvent) => {\n if (\n event.defaultPrevented ||\n event.altKey ||\n event.ctrlKey ||\n event.metaKey ||\n event.shiftKey\n ) {\n return;\n }\n const list = ordered.value;\n const from = list.findIndex((item) => item.element === event.target);\n if (from === -1) {\n // not one of its items (a menu's popup rendered from an item): not its key\n return;\n }\n const rtl =\n getDirection(event.currentTarget as HTMLElement, direction()) ===\n \"rtl\";\n if (\n textFieldKeepsKey(\n event.target as Element,\n event.key,\n rovingKeys(orientation(), rtl),\n )\n ) {\n return;\n }\n const target = rovingKeyTarget(event.key, from, list.length, {\n orientation: orientation(),\n rtl,\n loop: loopFocus(),\n skip: (candidate) => !list[candidate]?.focusable(),\n });\n const element = target === null ? undefined : list[target]?.element;\n if (element === undefined) {\n return;\n }\n event.preventDefault();\n element.focus();\n // the toolbar's keys select a text field's whole text (Base UI)\n if (element.tagName === \"INPUT\" || element.tagName === \"TEXTAREA\") {\n (element as HTMLInputElement).select();\n }\n };\n\n return {\n scope: {\n orientation,\n disabled,\n root: () => root.value,\n tabStop: () => tabStop.value,\n register,\n focused,\n },\n onKeydown,\n ref: elementSetter(root),\n };\n}\n"],"mappings":";;;;;;;;;;;;;AAgCA,SAAgB,mBAAmB,EAC/B,aACA,WACA,YAMF;CACE,MAAM,YAAY,qBAAqB;CACvC,MAAM,QAAQ,WAAkC,CAAC,CAAC;CAClD,MAAM,SAAS,WAA+B,IAAI;CAClD,MAAM,OAAO,WAA+B,IAAI;CAChD,MAAM,UAAU,eACZ,gBAAgB,MAAM,QAAQ,SAAS,KAAK,OAAO,CACvD;CACA,MAAM,UAAU,eAAe;EAC3B,MAAM,OAAO,QAAQ;EAMrB,OAAO,KALO,cACV,KAAK,QACL,KAAK,WAAW,SAAS,KAAK,YAAY,OAAO,KAAK,IACrD,cAAc,CAAC,KAAK,UAAU,EAAE,UAAU,CAE/B,EAAE,EAAE,WAAW;CACnC,CAAC;CAED,MAAM,YAAY,SAAsB,cAA6B;EACjE,MAAM,OAAO;GAAE;GAAS;EAAU;EAClC,MAAM,QAAQ,CAAC,GAAG,MAAM,OAAO,IAAI;EACnC,aAAa;GACT,MAAM,QAAQ,MAAM,MAAM,QAAQ,UAAU,UAAU,IAAI;EAC9D;CACJ;CACA,MAAM,WAAW,YAAyB;EACtC,OAAO,QAAQ;CACnB;CAEA,MAAM,aAAa,UAAyB;EACxC,IACI,MAAM,oBACN,MAAM,UACN,MAAM,WACN,MAAM,WACN,MAAM,UAEN;EAEJ,MAAM,OAAO,QAAQ;EACrB,MAAM,OAAO,KAAK,WAAW,SAAS,KAAK,YAAY,MAAM,MAAM;EACnE,IAAI,SAAS,IAET;EAEJ,MAAM,MACF,aAAa,MAAM,eAA8B,UAAU,CAAC,MAC5D;EACJ,IACI,kBACI,MAAM,QACN,MAAM,KACN,WAAW,YAAY,GAAG,GAAG,CACjC,GAEA;EAEJ,MAAM,SAAS,gBAAgB,MAAM,KAAK,MAAM,KAAK,QAAQ;GACzD,aAAa,YAAY;GACzB;GACA,MAAM,UAAU;GAChB,OAAO,cAAc,CAAC,KAAK,UAAU,EAAE,UAAU;EACrD,CAAC;EACD,MAAM,UAAU,WAAW,OAAO,KAAA,IAAY,KAAK,OAAO,EAAE;EAC5D,IAAI,YAAY,KAAA,GACZ;EAEJ,MAAM,eAAe;EACrB,QAAQ,MAAM;EAEd,IAAI,QAAQ,YAAY,WAAW,QAAQ,YAAY,YAClD,QAA6B,OAAO;CAE7C;CAEA,OAAO;EACH,OAAO;GACH;GACA;GACA,YAAY,KAAK;GACjB,eAAe,QAAQ;GACvB;GACA;EACJ;EACA;EACA,KAAK,cAAc,IAAI;CAC3B;AACJ"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { r as scopeOfElement, t as RovingKey } from "./roving-context-LyHQFJqZ.js";
|
|
2
|
+
import { t as elementSetter } from "./use-overlay-root-BkyTQIsX.js";
|
|
3
|
+
import { inject, shallowRef, watch } from "vue";
|
|
4
|
+
// src/composables/use-roving-item.ts
|
|
5
|
+
/**
|
|
6
|
+
* An item of the nearest roving-focus scope (spec/toolbar.md, "Nested composites"), or `null`
|
|
7
|
+
* with none around it: it registers its element, takes the roving `tabindex` (`0` on the scope's
|
|
8
|
+
* tab stop, `-1` on every other item and before the items are known, on a server) and tells the
|
|
9
|
+
* scope when it takes focus. An element outside the scope's root (rendered through a Teleport) is
|
|
10
|
+
* in no scope ("Nested composites", 6). `explicit` names the scope instead of the nearest one (a
|
|
11
|
+
* Menubar's, which its Triggers read from the bar's contract; `null`: none).
|
|
12
|
+
*/
|
|
13
|
+
function useRovingItem(focusable, explicit) {
|
|
14
|
+
const nearest = inject(RovingKey, null);
|
|
15
|
+
const around = explicit === void 0 ? nearest : explicit;
|
|
16
|
+
if (around === null) return null;
|
|
17
|
+
const element = shallowRef(null);
|
|
18
|
+
const scope = () => scopeOfElement(around, element.value);
|
|
19
|
+
watch([
|
|
20
|
+
element,
|
|
21
|
+
scope,
|
|
22
|
+
() => around.root()
|
|
23
|
+
], ([node, current], _, onCleanup) => {
|
|
24
|
+
if (node !== null && current !== null) onCleanup(current.register(node, focusable));
|
|
25
|
+
}, { immediate: true });
|
|
26
|
+
return {
|
|
27
|
+
scope,
|
|
28
|
+
tabIndex: () => {
|
|
29
|
+
const current = scope();
|
|
30
|
+
if (current === null) return;
|
|
31
|
+
return element.value !== null && current.tabStop() === element.value ? 0 : -1;
|
|
32
|
+
},
|
|
33
|
+
ref: elementSetter(element),
|
|
34
|
+
onFocus: () => {
|
|
35
|
+
const current = scope();
|
|
36
|
+
if (element.value !== null && current !== null) current.focused(element.value);
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
export { useRovingItem as t };
|
|
41
|
+
|
|
42
|
+
//# sourceMappingURL=use-roving-item-B9Cil5Rq.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-roving-item-B9Cil5Rq.js","names":[],"sources":["../src/composables/use-roving-item.ts"],"sourcesContent":["import { inject, shallowRef, watch } from \"vue\";\nimport {\n RovingKey,\n type RovingScope,\n scopeOfElement,\n} from \"../utils/roving-context.ts\";\nimport { elementSetter } from \"./use-overlay-root.ts\";\n\nexport interface RovingItem {\n /**\n * The scope it is an item of: the nearest one (or `explicit`), unless its element is outside\n * that scope's root (a popup a Teleport renders); `null` then.\n */\n scope: () => RovingScope | null;\n /** The roving `tabindex`; `undefined` outside the scope. */\n tabIndex: () => number | undefined;\n /** The item's element (also while it is outside the scope's root, so it keeps knowing where it is). */\n ref: (value: unknown) => void;\n onFocus: () => void;\n}\n\n/**\n * An item of the nearest roving-focus scope (spec/toolbar.md, \"Nested composites\"), or `null`\n * with none around it: it registers its element, takes the roving `tabindex` (`0` on the scope's\n * tab stop, `-1` on every other item and before the items are known, on a server) and tells the\n * scope when it takes focus. An element outside the scope's root (rendered through a Teleport) is\n * in no scope (\"Nested composites\", 6). `explicit` names the scope instead of the nearest one (a\n * Menubar's, which its Triggers read from the bar's contract; `null`: none).\n */\nexport function useRovingItem(\n focusable: () => boolean,\n explicit?: RovingScope | null,\n): RovingItem | null {\n const nearest = inject(RovingKey, null);\n const around = explicit === undefined ? nearest : explicit;\n if (around === null) {\n return null;\n }\n const element = shallowRef<HTMLElement | null>(null);\n const scope = () => scopeOfElement(around, element.value);\n // the root is watched too: a forwarding scope (a ToggleGroup's) changes it with the scope its\n // items are in\n watch(\n [element, scope, () => around.root()],\n ([node, current], _, onCleanup) => {\n if (node !== null && current !== null) {\n onCleanup(current.register(node, focusable));\n }\n },\n { immediate: true },\n );\n return {\n scope,\n tabIndex: () => {\n const current = scope();\n if (current === null) {\n return undefined;\n }\n return element.value !== null && current.tabStop() === element.value\n ? 0\n : -1;\n },\n ref: elementSetter(element),\n onFocus: () => {\n const current = scope();\n if (element.value !== null && current !== null) {\n current.focused(element.value);\n }\n },\n };\n}\n"],"mappings":";;;;;;;;;;;;AA6BA,SAAgB,cACZ,WACA,UACiB;CACjB,MAAM,UAAU,OAAO,WAAW,IAAI;CACtC,MAAM,SAAS,aAAa,KAAA,IAAY,UAAU;CAClD,IAAI,WAAW,MACX,OAAO;CAEX,MAAM,UAAU,WAA+B,IAAI;CACnD,MAAM,cAAc,eAAe,QAAQ,QAAQ,KAAK;CAGxD,MACI;EAAC;EAAS;QAAa,OAAO,KAAK;CAAC,IACnC,CAAC,MAAM,UAAU,GAAG,cAAc;EAC/B,IAAI,SAAS,QAAQ,YAAY,MAC7B,UAAU,QAAQ,SAAS,MAAM,SAAS,CAAC;CAEnD,GACA,EAAE,WAAW,KAAK,CACtB;CACA,OAAO;EACH;EACA,gBAAgB;GACZ,MAAM,UAAU,MAAM;GACtB,IAAI,YAAY,MACZ;GAEJ,OAAO,QAAQ,UAAU,QAAQ,QAAQ,QAAQ,MAAM,QAAQ,QACzD,IACA;EACV;EACA,KAAK,cAAc,OAAO;EAC1B,eAAe;GACX,MAAM,UAAU,MAAM;GACtB,IAAI,QAAQ,UAAU,QAAQ,YAAY,MACtC,QAAQ,QAAQ,QAAQ,KAAK;EAErC;CACJ;AACJ"}
|
|
@@ -0,0 +1,304 @@
|
|
|
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 elementSetter } from "./use-overlay-root-BkyTQIsX.js";
|
|
5
|
+
import { computed, defineComponent, h, onBeforeUnmount, onMounted, shallowRef, useId, watch } from "vue";
|
|
6
|
+
import { toIsoDate, watchDocumentLanguage } from "@fragiola/primitives/date";
|
|
7
|
+
import { dateSegments, isSegmentsComplete, segmentKeyDown, segmentTarget, segmentValuesOf, segmentsToDate, segmentsToDateTime, segmentsToTime, typeSegment } from "@fragiola/primitives/segments";
|
|
8
|
+
import { compareDateTimes, compareTimes, toIsoDateTime, toIsoTime } from "@fragiola/primitives/time";
|
|
9
|
+
// src/components/date-field/date-field-context.ts
|
|
10
|
+
const DateFieldKey = Symbol("DateField");
|
|
11
|
+
// src/components/date-field/date-field-segment.ts
|
|
12
|
+
const NUMERIC_STYLE = {
|
|
13
|
+
unicodeBidi: "embed",
|
|
14
|
+
direction: "ltr"
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* One segment: a `spinbutton` the user types into or steps (the APG), or a literal hidden from
|
|
18
|
+
* assistive technology (spec/date-field.md, "State attributes and ARIA").
|
|
19
|
+
*/
|
|
20
|
+
const DateFieldSegment = publicComponent(defineComponent({
|
|
21
|
+
name: "DateFieldSegment",
|
|
22
|
+
inheritAttrs: false,
|
|
23
|
+
props: {
|
|
24
|
+
...asProp,
|
|
25
|
+
segment: {
|
|
26
|
+
type: Object,
|
|
27
|
+
required: true
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
setup(props, { attrs, slots }) {
|
|
31
|
+
const context = useRequiredContext(DateFieldKey, "DateField.Segment");
|
|
32
|
+
const id = useId();
|
|
33
|
+
const element = shallowRef(null);
|
|
34
|
+
const setElement = elementSetter(element);
|
|
35
|
+
const writable = computed(() => {
|
|
36
|
+
const { disabled, readOnly } = context.state.value;
|
|
37
|
+
return props.segment.editable && !disabled && !readOnly;
|
|
38
|
+
});
|
|
39
|
+
watch([
|
|
40
|
+
element,
|
|
41
|
+
() => props.segment.editable,
|
|
42
|
+
writable
|
|
43
|
+
], ([node, editable, canWrite], _, onCleanup) => {
|
|
44
|
+
if (node === null || !editable) return;
|
|
45
|
+
const onKeydown = (event) => {
|
|
46
|
+
if (context.onSegmentKey(props.segment, event, node)) event.preventDefault();
|
|
47
|
+
};
|
|
48
|
+
const onFocus = () => context.field.onFocus();
|
|
49
|
+
const onBlur = (event) => context.onSegmentBlur(props.segment, event);
|
|
50
|
+
const onBeforeInput = (event) => {
|
|
51
|
+
if (!canWrite) return;
|
|
52
|
+
event.preventDefault();
|
|
53
|
+
if (event.inputType === "deleteContentBackward") {
|
|
54
|
+
context.onSegmentKey(props.segment, new KeyboardEvent("keydown", { key: "Backspace" }), node);
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
if (event.data !== null && event.data !== "") context.onSegmentText(props.segment, event.data, event, node);
|
|
58
|
+
};
|
|
59
|
+
const capture = { capture: true };
|
|
60
|
+
node.addEventListener("keydown", onKeydown, capture);
|
|
61
|
+
node.addEventListener("focus", onFocus, capture);
|
|
62
|
+
node.addEventListener("blur", onBlur, capture);
|
|
63
|
+
node.addEventListener("beforeinput", onBeforeInput, capture);
|
|
64
|
+
onCleanup(() => {
|
|
65
|
+
node.removeEventListener("keydown", onKeydown, capture);
|
|
66
|
+
node.removeEventListener("focus", onFocus, capture);
|
|
67
|
+
node.removeEventListener("blur", onBlur, capture);
|
|
68
|
+
node.removeEventListener("beforeinput", onBeforeInput, capture);
|
|
69
|
+
});
|
|
70
|
+
}, {
|
|
71
|
+
flush: "post",
|
|
72
|
+
immediate: true
|
|
73
|
+
});
|
|
74
|
+
return () => {
|
|
75
|
+
const { segment } = props;
|
|
76
|
+
const { disabled, readOnly, required, invalid } = context.state.value;
|
|
77
|
+
const state = {
|
|
78
|
+
disabled,
|
|
79
|
+
readOnly,
|
|
80
|
+
required,
|
|
81
|
+
invalid,
|
|
82
|
+
type: segment.type,
|
|
83
|
+
placeholder: segment.placeholder
|
|
84
|
+
};
|
|
85
|
+
const content = () => slots.default ? slots.default({ state }) : segment.text;
|
|
86
|
+
if (!segment.editable) return renderPart("span", {
|
|
87
|
+
attrs,
|
|
88
|
+
slots
|
|
89
|
+
}, props.as, state, {
|
|
90
|
+
"aria-hidden": segment.type === "literal" ? "true" : void 0,
|
|
91
|
+
"data-primitives-part": `${context.component}-segment`,
|
|
92
|
+
"data-type": segment.type,
|
|
93
|
+
...context.attributes(),
|
|
94
|
+
ref: setElement
|
|
95
|
+
}, content);
|
|
96
|
+
const labelId = context.labelId();
|
|
97
|
+
const textual = segment.type === "dayPeriod" || segment.type === "era";
|
|
98
|
+
return renderPart("span", {
|
|
99
|
+
attrs,
|
|
100
|
+
slots
|
|
101
|
+
}, props.as, state, {
|
|
102
|
+
id,
|
|
103
|
+
role: "spinbutton",
|
|
104
|
+
tabindex: disabled ? void 0 : 0,
|
|
105
|
+
"aria-label": segment.label ?? void 0,
|
|
106
|
+
"aria-labelledby": labelId === void 0 ? void 0 : `${labelId} ${id}`,
|
|
107
|
+
"aria-valuenow": segment.value ?? void 0,
|
|
108
|
+
"aria-valuetext": segment.valueText ?? void 0,
|
|
109
|
+
"aria-valuemin": segment.min ?? void 0,
|
|
110
|
+
"aria-valuemax": segment.max ?? void 0,
|
|
111
|
+
"aria-invalid": invalid ? "true" : void 0,
|
|
112
|
+
"aria-required": required ? "true" : void 0,
|
|
113
|
+
"aria-readonly": readOnly ? "true" : void 0,
|
|
114
|
+
"aria-disabled": disabled ? "true" : void 0,
|
|
115
|
+
contenteditable: writable.value ? "true" : void 0,
|
|
116
|
+
inputmode: textual ? "text" : "numeric",
|
|
117
|
+
spellcheck: "false",
|
|
118
|
+
autocorrect: "off",
|
|
119
|
+
autocapitalize: "off",
|
|
120
|
+
enterkeyhint: "next",
|
|
121
|
+
style: textual ? void 0 : NUMERIC_STYLE,
|
|
122
|
+
"data-primitives-part": `${context.component}-segment`,
|
|
123
|
+
"data-type": segment.type,
|
|
124
|
+
"data-placeholder": segment.placeholder ? "" : void 0,
|
|
125
|
+
...context.attributes(),
|
|
126
|
+
ref: setElement
|
|
127
|
+
}, content);
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
}));
|
|
131
|
+
// src/components/date-field/date-field-input.ts
|
|
132
|
+
/** The `group` of the segments (spec/date-field.md, "Anatomy"). */
|
|
133
|
+
const DateFieldInput = publicComponent(defineComponent({
|
|
134
|
+
name: "DateFieldInput",
|
|
135
|
+
inheritAttrs: false,
|
|
136
|
+
props: asProp,
|
|
137
|
+
setup(props, { attrs, slots }) {
|
|
138
|
+
const context = useRequiredContext(DateFieldKey, "DateField.Input");
|
|
139
|
+
const children = () => {
|
|
140
|
+
const each = slots.default;
|
|
141
|
+
return context.segments.value.flatMap((segment) => each ? each({ segment }) : [h(DateFieldSegment, {
|
|
142
|
+
key: segment.index,
|
|
143
|
+
segment
|
|
144
|
+
})]);
|
|
145
|
+
};
|
|
146
|
+
return () => {
|
|
147
|
+
const aria = context.field.aria();
|
|
148
|
+
return renderPart("div", {
|
|
149
|
+
attrs,
|
|
150
|
+
slots
|
|
151
|
+
}, props.as, context.state.value, {
|
|
152
|
+
role: "group",
|
|
153
|
+
"aria-labelledby": aria["aria-labelledby"],
|
|
154
|
+
"aria-describedby": aria["aria-describedby"],
|
|
155
|
+
"data-primitives-part": context.inputPart ?? `${context.component}-input`,
|
|
156
|
+
...context.attributes(),
|
|
157
|
+
ref: context.setInputElement
|
|
158
|
+
}, children);
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
}));
|
|
162
|
+
// src/components/date-field/field-value.ts
|
|
163
|
+
/**
|
|
164
|
+
* A value's ISO text at the field's granularity (spec/date-field.md, "Forms"); a zoned value's with
|
|
165
|
+
* its offset and zone (spec/time-zones.md).
|
|
166
|
+
*/
|
|
167
|
+
function isoOf(kind, granularity, value, timeZone) {
|
|
168
|
+
if (value == null) return "";
|
|
169
|
+
const precision = granularity === "second" ? "second" : "minute";
|
|
170
|
+
if (timeZone && "offset" in value) return timeZone.toIso(value, precision);
|
|
171
|
+
if (kind === "time") return toIsoTime(value, precision);
|
|
172
|
+
if (granularity === "day") return toIsoDate(value);
|
|
173
|
+
const { hour = 0, minute = 0, second = 0, millisecond = 0 } = value;
|
|
174
|
+
return toIsoDateTime({
|
|
175
|
+
...value,
|
|
176
|
+
hour,
|
|
177
|
+
minute,
|
|
178
|
+
second,
|
|
179
|
+
millisecond
|
|
180
|
+
}, precision);
|
|
181
|
+
}
|
|
182
|
+
/** Orders two values of a field (a `PlainDate` counts as its midnight). */
|
|
183
|
+
function compareValues(kind, a, b) {
|
|
184
|
+
return kind === "time" ? compareTimes(a, b) : compareDateTimes(a, b);
|
|
185
|
+
}
|
|
186
|
+
/** Whether a value is out of `min` / `max`, or (a date) unavailable (spec/date-field.md). */
|
|
187
|
+
function isOutOfRange(kind, value, min, max, isDateUnavailable) {
|
|
188
|
+
return min !== void 0 && compareValues(kind, value, min) < 0 || max !== void 0 && compareValues(kind, value, max) > 0 || kind === "date" && isDateUnavailable?.(value) === true;
|
|
189
|
+
}
|
|
190
|
+
/** The value complete segment values make (`null` while one is a placeholder). */
|
|
191
|
+
function composeSegments(format, kind, granularity, values) {
|
|
192
|
+
return !isSegmentsComplete(format, values) ? null : kind === "time" ? segmentsToTime(values) : granularity === "day" ? segmentsToDate(values, format) : segmentsToDateTime(values, format);
|
|
193
|
+
}
|
|
194
|
+
/** A bound's ISO text for a hidden input's `min` / `max` (`undefined` with none). */
|
|
195
|
+
function boundIso(kind, granularity, edge) {
|
|
196
|
+
return edge === void 0 ? void 0 : isoOf(kind, granularity, edge);
|
|
197
|
+
}
|
|
198
|
+
// src/components/date-field/use-document-locale.ts
|
|
199
|
+
/** The locale of the first render with no `locale`: a server knows neither of the others. */
|
|
200
|
+
const FIRST_RENDER_LOCALE = "en-US";
|
|
201
|
+
function documentLocale() {
|
|
202
|
+
if (typeof document !== "undefined" && document.documentElement.lang) return document.documentElement.lang;
|
|
203
|
+
return typeof navigator !== "undefined" ? navigator.language : FIRST_RENDER_LOCALE;
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* A date or time field's locale (spec/date-field.md, "API"): its own, else the document's `lang`,
|
|
207
|
+
* else the browser's language, read once mounted: a server render and its hydration use `en-US`,
|
|
208
|
+
* and a later change of `<html lang>` is followed (the calendars' rule, spec/calendar.md "API").
|
|
209
|
+
* The calendars keep their own copy, so their entries are unchanged.
|
|
210
|
+
*/
|
|
211
|
+
function useDocumentLocale(locale) {
|
|
212
|
+
const mounted = shallowRef();
|
|
213
|
+
let stop = () => {};
|
|
214
|
+
onMounted(() => {
|
|
215
|
+
mounted.value = documentLocale();
|
|
216
|
+
stop = watchDocumentLanguage(document, () => {
|
|
217
|
+
mounted.value = documentLocale();
|
|
218
|
+
});
|
|
219
|
+
});
|
|
220
|
+
onBeforeUnmount(() => stop());
|
|
221
|
+
return () => locale() ?? mounted.value ?? FIRST_RENDER_LOCALE;
|
|
222
|
+
}
|
|
223
|
+
// src/components/date-field/use-segment-group.ts
|
|
224
|
+
/** The change reason of an edit (spec/date-field.md, "API"): `null` after an erase clears. */
|
|
225
|
+
function editReason(edit, value) {
|
|
226
|
+
return edit === "step" ? "keyboard" : edit === "erase" && value === null ? "input-clear" : "input-change";
|
|
227
|
+
}
|
|
228
|
+
const FIRST_SEGMENT = "[role=\"spinbutton\"][tabindex]";
|
|
229
|
+
/**
|
|
230
|
+
* One group of segments (spec/date-field.md): the values the user set, the digits being typed,
|
|
231
|
+
* the segments to render and what their keys and text do. A DateField has one; a range field and
|
|
232
|
+
* a range picker's typed input two, one per end (spec/date-range-field.md). The value and its
|
|
233
|
+
* reports are the root's: the group says what its segments make after each edit.
|
|
234
|
+
*/
|
|
235
|
+
function useSegmentGroup(options) {
|
|
236
|
+
const values = shallowRef(segmentValuesOf(options.format(), options.initial));
|
|
237
|
+
const edit = shallowRef(null);
|
|
238
|
+
const element = shallowRef(null);
|
|
239
|
+
/** Applies new segment values, and reports what they make. */
|
|
240
|
+
const apply = (next, nextEdit, kind, event) => {
|
|
241
|
+
values.value = next;
|
|
242
|
+
edit.value = nextEdit;
|
|
243
|
+
options.onEdit(composeSegments(options.format(), options.kind, options.granularity(), next), kind, event);
|
|
244
|
+
};
|
|
245
|
+
const editable = () => !options.disabled() && !options.readOnly();
|
|
246
|
+
const move = (from, to) => segmentTarget(from, to, options.groups?.())?.focus();
|
|
247
|
+
return {
|
|
248
|
+
segments: computed(() => dateSegments(options.format(), values.value, edit.value)),
|
|
249
|
+
/** The segment values as of the last change. */
|
|
250
|
+
values,
|
|
251
|
+
element,
|
|
252
|
+
setElement: elementSetter(element),
|
|
253
|
+
/** The first editable segment: the focus target, where a label press and a failed validation go. */
|
|
254
|
+
firstSegment: () => element.value?.querySelector(FIRST_SEGMENT) ?? null,
|
|
255
|
+
/** Whether every segment is set. */
|
|
256
|
+
complete: () => isSegmentsComplete(options.format(), values.value),
|
|
257
|
+
/** Replaces the segments with a value's (`null`: every one a placeholder). */
|
|
258
|
+
replace: (value) => {
|
|
259
|
+
values.value = segmentValuesOf(options.format(), value);
|
|
260
|
+
edit.value = null;
|
|
261
|
+
},
|
|
262
|
+
/** A key on a segment: whether the group took it (its default is then prevented). */
|
|
263
|
+
onSegmentKey: (segment, event, target) => {
|
|
264
|
+
if (!segment.editable || options.disabled() || event.altKey || event.ctrlKey || event.metaKey) return false;
|
|
265
|
+
const result = segmentKeyDown(options.format(), values.value, segment.type, event.key, edit.value, {
|
|
266
|
+
seed: options.seed(),
|
|
267
|
+
readOnly: !editable()
|
|
268
|
+
});
|
|
269
|
+
if (result === null) return false;
|
|
270
|
+
if (result.kind !== "move") apply(result.values, result.edit, result.kind === "step" ? "step" : "erase", event);
|
|
271
|
+
if (result.move !== null) move(target, result.move);
|
|
272
|
+
return true;
|
|
273
|
+
},
|
|
274
|
+
/** Text typed into a segment (`beforeinput`'s data). */
|
|
275
|
+
onSegmentText: (segment, text, event, target) => {
|
|
276
|
+
if (!segment.editable || !editable()) return;
|
|
277
|
+
let next = values.value;
|
|
278
|
+
let typing = edit.value;
|
|
279
|
+
let advance = false;
|
|
280
|
+
for (const character of text) {
|
|
281
|
+
const result = typeSegment(options.format(), next, segment.type, character, typing, options.seed());
|
|
282
|
+
if (result === null) continue;
|
|
283
|
+
next = result.values;
|
|
284
|
+
typing = result.edit;
|
|
285
|
+
advance = result.advance;
|
|
286
|
+
}
|
|
287
|
+
if (next === values.value && typing === edit.value) return;
|
|
288
|
+
apply(next, typing, "type", event);
|
|
289
|
+
if (advance) move(target, "next");
|
|
290
|
+
},
|
|
291
|
+
/** A segment lost the focus: its typed digits are dropped; leaving the groups blurs. */
|
|
292
|
+
onSegmentBlur: (segment, event) => {
|
|
293
|
+
const typing = edit.value;
|
|
294
|
+
if (typing !== null && typing.type === segment.type) edit.value = null;
|
|
295
|
+
const own = event.currentTarget?.closest("[role=\"group\"]");
|
|
296
|
+
const groups = options.groups?.() ?? (own == null ? [] : [own]);
|
|
297
|
+
const to = event.relatedTarget;
|
|
298
|
+
if (to === null || !groups.some((group) => group.contains(to))) options.onBlur();
|
|
299
|
+
}
|
|
300
|
+
};
|
|
301
|
+
}
|
|
302
|
+
export { compareValues as a, isoOf as c, DateFieldKey as d, boundIso as i, DateFieldInput as l, useSegmentGroup as n, composeSegments as o, useDocumentLocale as r, isOutOfRange as s, editReason as t, DateFieldSegment as u };
|
|
303
|
+
|
|
304
|
+
//# sourceMappingURL=use-segment-group-CAlwM3KP.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-segment-group-CAlwM3KP.js","names":[],"sources":["../src/components/date-field/date-field-context.ts","../src/components/date-field/date-field-segment.ts","../src/components/date-field/date-field-input.ts","../src/components/date-field/field-value.ts","../src/components/date-field/use-document-locale.ts","../src/components/date-field/use-segment-group.ts"],"sourcesContent":["import type { DateSegment, SegmentFormat } from \"@fragiola/primitives/segments\";\nimport type { ComputedRef, InjectionKey } from \"vue\";\nimport type { FieldControlBinding } from \"../../composables/use-field-control.ts\";\n\n/**\n * Which root the shared parts sit in: their part attribute names it (spec/date-field.md; the\n * range fields' and the pickers' typed input, spec/date-range-field.md and spec/calendar.md).\n */\nexport type DateFieldComponent =\n | \"date-field\"\n | \"time-field\"\n | \"date-range-field\"\n | \"time-range-field\"\n | \"date-picker\"\n | \"date-range-picker\";\n\n/** The state every part renders with (spec/date-field.md, \"State attributes and ARIA\"). */\nexport interface DateFieldState {\n disabled: boolean;\n readOnly: boolean;\n required: boolean;\n /** Out of range or unavailable, or the Field shows an error. */\n invalid: boolean;\n}\n\n/** A Segment's state: the field's, with its own type and placeholder state. */\nexport interface DateFieldSegmentState extends DateFieldState {\n type: DateSegment[\"type\"];\n placeholder: boolean;\n}\n\nexport interface DateFieldContext {\n component: DateFieldComponent;\n /** The Input's part attribute, when not `<component>-input` (a picker's `-segments`). */\n inputPart?: string;\n state: ComputedRef<DateFieldState>;\n format: ComputedRef<SegmentFormat>;\n segments: ComputedRef<DateSegment[]>;\n /** The Field's label id (the segments' `aria-labelledby` starts with it). */\n labelId: () => string | undefined;\n field: FieldControlBinding;\n /** The state attributes and the field's, for every part. */\n attributes: () => Record<string, string>;\n setInputElement: (value: unknown) => void;\n /** A key on a segment: whether the field took it (its default is then prevented). */\n onSegmentKey: (\n segment: DateSegment,\n event: KeyboardEvent,\n element: HTMLElement,\n ) => boolean;\n /** Text typed into a segment (`beforeinput`'s data). */\n onSegmentText: (\n segment: DateSegment,\n text: string,\n event: Event,\n element: HTMLElement,\n ) => void;\n /** A segment lost the focus. */\n onSegmentBlur: (segment: DateSegment, event: FocusEvent) => void;\n}\n\nexport const DateFieldKey: InjectionKey<DateFieldContext> = Symbol(\"DateField\");\n","import type { DateSegment } from \"@fragiola/primitives/segments\";\nimport {\n computed,\n defineComponent,\n type PropType,\n shallowRef,\n useId,\n watch,\n} 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 DateFieldKey,\n type DateFieldSegmentState,\n} from \"./date-field-context.ts\";\n\nexport interface DateFieldSegmentProps {\n /** One of the Input's segments. */\n segment: DateSegment;\n}\n\n// numeric segments are one left-to-right run, so they keep the locale's order in any direction\n// (spec/date-field.md, \"Bidirectional text\": structural, React Aria's fix)\nconst NUMERIC_STYLE = { unicodeBidi: \"embed\", direction: \"ltr\" } as const;\n\n/**\n * One segment: a `spinbutton` the user types into or steps (the APG), or a literal hidden from\n * assistive technology (spec/date-field.md, \"State attributes and ARIA\").\n */\nexport const DateFieldSegment: PartComponent<\n DateFieldSegmentProps,\n DateFieldSegmentState\n> = publicComponent(\n defineComponent({\n name: \"DateFieldSegment\",\n inheritAttrs: false,\n props: {\n ...asProp,\n segment: {\n type: Object as PropType<DateSegment>,\n required: true,\n },\n },\n setup(props, { attrs, slots }) {\n const context = useRequiredContext(\n DateFieldKey,\n \"DateField.Segment\",\n );\n const id = useId();\n const element = shallowRef<HTMLElement | null>(null);\n const setElement = elementSetter(element);\n const writable = computed(() => {\n const { disabled, readOnly } = context.state.value;\n return props.segment.editable && !disabled && !readOnly;\n });\n\n // native listeners: Vue's invoker skips an event whose timestamp is not later than the\n // listener's, which the tests' fixed clock makes equal (docs/decisions.md). In the\n // capture phase, so the field's run before the consumer's listeners on the segment.\n // Every edit the browser would make is cancelled: the field writes the text from its\n // state.\n watch(\n [element, () => props.segment.editable, writable],\n ([node, editable, canWrite], _, onCleanup) => {\n if (node === null || !editable) {\n return;\n }\n const onKeydown = (event: KeyboardEvent) => {\n if (context.onSegmentKey(props.segment, event, node)) {\n event.preventDefault();\n }\n };\n const onFocus = () => context.field.onFocus();\n const onBlur = (event: FocusEvent) =>\n context.onSegmentBlur(props.segment, event);\n const onBeforeInput = (event: InputEvent) => {\n if (!canWrite) {\n return;\n }\n event.preventDefault();\n if (event.inputType === \"deleteContentBackward\") {\n context.onSegmentKey(\n props.segment,\n new KeyboardEvent(\"keydown\", {\n key: \"Backspace\",\n }),\n node,\n );\n return;\n }\n if (event.data !== null && event.data !== \"\") {\n context.onSegmentText(\n props.segment,\n event.data,\n event,\n node,\n );\n }\n };\n const capture = { capture: true };\n node.addEventListener(\"keydown\", onKeydown, capture);\n node.addEventListener(\"focus\", onFocus, capture);\n node.addEventListener(\"blur\", onBlur, capture);\n node.addEventListener(\n \"beforeinput\",\n onBeforeInput,\n capture,\n );\n onCleanup(() => {\n node.removeEventListener(\"keydown\", onKeydown, capture);\n node.removeEventListener(\"focus\", onFocus, capture);\n node.removeEventListener(\"blur\", onBlur, capture);\n node.removeEventListener(\n \"beforeinput\",\n onBeforeInput,\n capture,\n );\n });\n },\n { flush: \"post\", immediate: true },\n );\n\n return () => {\n const { segment } = props;\n const { disabled, readOnly, required, invalid } =\n context.state.value;\n const state: DateFieldSegmentState = {\n disabled,\n readOnly,\n required,\n invalid,\n type: segment.type,\n placeholder: segment.placeholder,\n };\n const content = () =>\n slots.default ? slots.default({ state }) : segment.text;\n if (!segment.editable) {\n return renderPart(\n \"span\",\n { attrs, slots },\n props.as,\n state,\n {\n \"aria-hidden\":\n segment.type === \"literal\" ? \"true\" : undefined,\n \"data-primitives-part\": `${context.component}-segment`,\n \"data-type\": segment.type,\n ...context.attributes(),\n ref: setElement,\n },\n content,\n );\n }\n const labelId = context.labelId();\n const textual =\n segment.type === \"dayPeriod\" || segment.type === \"era\";\n return renderPart(\n \"span\",\n { attrs, slots },\n props.as,\n state,\n {\n id,\n role: \"spinbutton\",\n tabindex: disabled ? undefined : 0,\n \"aria-label\": segment.label ?? undefined,\n \"aria-labelledby\":\n labelId === undefined\n ? undefined\n : `${labelId} ${id}`,\n \"aria-valuenow\": segment.value ?? undefined,\n \"aria-valuetext\": segment.valueText ?? undefined,\n \"aria-valuemin\": segment.min ?? undefined,\n \"aria-valuemax\": segment.max ?? undefined,\n \"aria-invalid\": invalid ? \"true\" : undefined,\n \"aria-required\": required ? \"true\" : undefined,\n \"aria-readonly\": readOnly ? \"true\" : undefined,\n \"aria-disabled\": disabled ? \"true\" : undefined,\n contenteditable: writable.value ? \"true\" : undefined,\n // a day period and an era take letters\n inputmode: textual ? \"text\" : \"numeric\",\n spellcheck: \"false\",\n autocorrect: \"off\",\n autocapitalize: \"off\",\n enterkeyhint: \"next\",\n style: textual ? undefined : NUMERIC_STYLE,\n \"data-primitives-part\": `${context.component}-segment`,\n \"data-type\": segment.type,\n \"data-placeholder\": segment.placeholder\n ? \"\"\n : undefined,\n ...context.attributes(),\n ref: setElement,\n },\n content,\n );\n };\n },\n }),\n);\n","import type { DateSegment } from \"@fragiola/primitives/segments\";\nimport { defineComponent, h, type VNode, type VNodeChild } from \"vue\";\nimport { useRequiredContext } from \"../../composables/use-required-context.ts\";\nimport type { PublicComponent } from \"../../utils/public-component.ts\";\nimport { publicComponent } from \"../../utils/public-component.ts\";\nimport {\n type AsProp,\n asProp,\n type RenderSlotProps,\n renderPart,\n} from \"../../utils/render-part.ts\";\nimport { DateFieldKey, type DateFieldState } from \"./date-field-context.ts\";\nimport { DateFieldSegment } from \"./date-field-segment.ts\";\n\n/** The Input's slots: each segment (default: every segment with its own text), or `render`. */\nexport interface DateFieldInputSlots {\n default?: (scope: { segment: DateSegment }) => VNode[];\n render?: (scope: RenderSlotProps<DateFieldState>) => VNode[];\n}\n\n/** The `group` of the segments (spec/date-field.md, \"Anatomy\"). */\nexport const DateFieldInput: PublicComponent<\n { as?: AsProp },\n DateFieldInputSlots\n> = publicComponent(\n defineComponent({\n name: \"DateFieldInput\",\n inheritAttrs: false,\n props: asProp,\n setup(props, { attrs, slots }) {\n const context = useRequiredContext(DateFieldKey, \"DateField.Input\");\n const children = (): VNodeChild[] => {\n const each = slots.default;\n return context.segments.value.flatMap(\n (segment): VNodeChild[] =>\n each\n ? each({ segment })\n : [\n h(DateFieldSegment, {\n key: segment.index,\n segment,\n }),\n ],\n );\n };\n return () => {\n const aria = context.field.aria();\n return renderPart(\n \"div\",\n { attrs, slots },\n props.as,\n context.state.value,\n {\n role: \"group\",\n \"aria-labelledby\": aria[\"aria-labelledby\"],\n \"aria-describedby\": aria[\"aria-describedby\"],\n \"data-primitives-part\":\n context.inputPart ?? `${context.component}-input`,\n ...context.attributes(),\n ref: context.setInputElement,\n },\n children,\n );\n };\n },\n }),\n);\n","import { type PlainDate, toIsoDate } from \"@fragiola/primitives/date\";\nimport {\n isSegmentsComplete,\n type SegmentFormat,\n type SegmentGranularity,\n type SegmentKind,\n type SegmentValues,\n segmentsToDate,\n segmentsToDateTime,\n segmentsToTime,\n} from \"@fragiola/primitives/segments\";\nimport {\n compareDateTimes,\n compareTimes,\n type PlainDateTime,\n type PlainTime,\n toIsoDateTime,\n toIsoTime,\n} from \"@fragiola/primitives/time\";\nimport type { TimeZone, ZonedDateTime } from \"@fragiola/primitives/time-zone\";\n\n/** What a date or time field holds: a date, a date and time, or a time. */\nexport type FieldValue = PlainDate | PlainDateTime | PlainTime;\n\n/**\n * A value's ISO text at the field's granularity (spec/date-field.md, \"Forms\"); a zoned value's with\n * its offset and zone (spec/time-zones.md).\n */\nexport function isoOf(\n kind: SegmentKind,\n granularity: SegmentGranularity,\n value: FieldValue | null | undefined,\n timeZone?: TimeZone,\n): string {\n if (value == null) {\n return \"\";\n }\n const precision = granularity === \"second\" ? \"second\" : \"minute\";\n if (timeZone && \"offset\" in value) {\n return timeZone.toIso(value as ZonedDateTime, precision);\n }\n if (kind === \"time\") {\n return toIsoTime(value as PlainTime, precision);\n }\n if (granularity === \"day\") {\n return toIsoDate(value as PlainDate);\n }\n // a `PlainDate` bound counts as its midnight\n const {\n hour = 0,\n minute = 0,\n second = 0,\n millisecond = 0,\n } = value as Partial<PlainDateTime>;\n return toIsoDateTime(\n { ...(value as PlainDate), hour, minute, second, millisecond },\n precision,\n );\n}\n\n/** Orders two values of a field (a `PlainDate` counts as its midnight). */\nexport function compareValues(\n kind: SegmentKind,\n a: FieldValue,\n b: FieldValue,\n): number {\n return kind === \"time\"\n ? compareTimes(a as PlainTime, b as PlainTime)\n : compareDateTimes(a as PlainDate, b as PlainDate);\n}\n\n/** Whether a value is out of `min` / `max`, or (a date) unavailable (spec/date-field.md). */\nexport function isOutOfRange(\n kind: SegmentKind,\n value: FieldValue,\n min: FieldValue | undefined,\n max: FieldValue | undefined,\n isDateUnavailable: ((date: PlainDate) => boolean) | undefined,\n): boolean {\n return (\n (min !== undefined && compareValues(kind, value, min) < 0) ||\n (max !== undefined && compareValues(kind, value, max) > 0) ||\n (kind === \"date\" && isDateUnavailable?.(value as PlainDate) === true)\n );\n}\n\n/** The value complete segment values make (`null` while one is a placeholder). */\nexport function composeSegments(\n format: SegmentFormat,\n kind: SegmentKind,\n granularity: SegmentGranularity,\n values: SegmentValues,\n): FieldValue | null {\n return !isSegmentsComplete(format, values)\n ? null\n : kind === \"time\"\n ? segmentsToTime(values)\n : granularity === \"day\"\n ? segmentsToDate(values, format)\n : segmentsToDateTime(values, format);\n}\n\n/** A bound's ISO text for a hidden input's `min` / `max` (`undefined` with none). */\nexport function boundIso(\n kind: SegmentKind,\n granularity: SegmentGranularity,\n edge: FieldValue | undefined,\n): string | undefined {\n return edge === undefined ? undefined : isoOf(kind, granularity, edge);\n}\n","import { watchDocumentLanguage } from \"@fragiola/primitives/date\";\nimport { onBeforeUnmount, onMounted, shallowRef } from \"vue\";\n\n/** The locale of the first render with no `locale`: a server knows neither of the others. */\nconst FIRST_RENDER_LOCALE = \"en-US\";\n\nfunction documentLocale(): string {\n if (typeof document !== \"undefined\" && document.documentElement.lang) {\n return document.documentElement.lang;\n }\n return typeof navigator !== \"undefined\"\n ? navigator.language\n : FIRST_RENDER_LOCALE;\n}\n\n/**\n * A date or time field's locale (spec/date-field.md, \"API\"): its own, else the document's `lang`,\n * else the browser's language, read once mounted: a server render and its hydration use `en-US`,\n * and a later change of `<html lang>` is followed (the calendars' rule, spec/calendar.md \"API\").\n * The calendars keep their own copy, so their entries are unchanged.\n */\nexport function useDocumentLocale(\n locale: () => string | undefined,\n): () => string {\n const mounted = shallowRef<string>();\n let stop = () => {};\n onMounted(() => {\n mounted.value = documentLocale();\n stop = watchDocumentLanguage(document, () => {\n mounted.value = documentLocale();\n });\n });\n onBeforeUnmount(() => stop());\n return () => locale() ?? mounted.value ?? FIRST_RENDER_LOCALE;\n}\n","import {\n type DateSegment,\n dateSegments,\n type EditableSegmentType,\n isSegmentsComplete,\n type SegmentEdit,\n type SegmentFormat,\n type SegmentGranularity,\n type SegmentKind,\n type SegmentMove,\n type SegmentValues,\n segmentKeyDown,\n segmentTarget,\n segmentValuesOf,\n typeSegment,\n} from \"@fragiola/primitives/segments\";\nimport type { PlainDateTime } from \"@fragiola/primitives/time\";\nimport { computed, shallowRef } from \"vue\";\nimport { elementSetter } from \"../../composables/use-overlay-root.ts\";\nimport type { ChangeReason } from \"../../utils/change-details.ts\";\nimport { composeSegments, type FieldValue } from \"./field-value.ts\";\n\n/** What an edit did: typed a character, erased one (Backspace, Delete), or stepped a segment. */\nexport type SegmentEditKind = \"type\" | \"erase\" | \"step\";\n\n/** The change reason of an edit (spec/date-field.md, \"API\"): `null` after an erase clears. */\nexport function editReason(\n edit: SegmentEditKind,\n value: unknown,\n): ChangeReason {\n return edit === \"step\"\n ? \"keyboard\"\n : edit === \"erase\" && value === null\n ? \"input-clear\"\n : \"input-change\";\n}\n\nexport interface SegmentGroupOptions {\n format: () => SegmentFormat;\n kind: SegmentKind;\n granularity: () => SegmentGranularity;\n /** The segment values a placeholder's first step starts from (the `placeholderValue`'s). */\n seed: () => SegmentValues;\n /** The value the segments start from. */\n initial: Partial<PlainDateTime> | null;\n disabled: () => boolean;\n readOnly: () => boolean;\n /**\n * The groups the focus moves among, in order (a range's two ends: spec/date-range-field.md);\n * default: this group alone.\n */\n groups?: () => readonly Element[];\n /** An edit changed the segments: the value they make now (`null` while incomplete). */\n onEdit: (\n composed: FieldValue | null,\n edit: SegmentEditKind,\n event: Event,\n ) => void;\n /** The focus left every group (the field's blur). */\n onBlur: () => void;\n}\n\nconst FIRST_SEGMENT = '[role=\"spinbutton\"][tabindex]';\n\n/**\n * One group of segments (spec/date-field.md): the values the user set, the digits being typed,\n * the segments to render and what their keys and text do. A DateField has one; a range field and\n * a range picker's typed input two, one per end (spec/date-range-field.md). The value and its\n * reports are the root's: the group says what its segments make after each edit.\n */\nexport function useSegmentGroup(options: SegmentGroupOptions) {\n const values = shallowRef<SegmentValues>(\n segmentValuesOf(options.format(), options.initial),\n );\n const edit = shallowRef<SegmentEdit | null>(null);\n const element = shallowRef<HTMLElement | null>(null);\n\n /** Applies new segment values, and reports what they make. */\n const apply = (\n next: SegmentValues,\n nextEdit: SegmentEdit | null,\n kind: SegmentEditKind,\n event: Event,\n ) => {\n values.value = next;\n edit.value = nextEdit;\n options.onEdit(\n composeSegments(\n options.format(),\n options.kind,\n options.granularity(),\n next,\n ),\n kind,\n event,\n );\n };\n const editable = () => !options.disabled() && !options.readOnly();\n const move = (from: HTMLElement, to: SegmentMove) =>\n segmentTarget(from, to, options.groups?.())?.focus();\n\n return {\n segments: computed(() =>\n dateSegments(options.format(), values.value, edit.value),\n ),\n /** The segment values as of the last change. */\n values,\n element,\n setElement: elementSetter(element),\n /** The first editable segment: the focus target, where a label press and a failed validation go. */\n firstSegment: () =>\n element.value?.querySelector<HTMLElement>(FIRST_SEGMENT) ?? null,\n /** Whether every segment is set. */\n complete: () => isSegmentsComplete(options.format(), values.value),\n /** Replaces the segments with a value's (`null`: every one a placeholder). */\n replace: (value: Partial<PlainDateTime> | null) => {\n values.value = segmentValuesOf(options.format(), value);\n edit.value = null;\n },\n /** A key on a segment: whether the group took it (its default is then prevented). */\n onSegmentKey: (\n segment: DateSegment,\n event: KeyboardEvent,\n target: HTMLElement,\n ) => {\n if (\n !segment.editable ||\n options.disabled() ||\n event.altKey ||\n event.ctrlKey ||\n event.metaKey\n ) {\n return false;\n }\n const result = segmentKeyDown(\n options.format(),\n values.value,\n segment.type as EditableSegmentType,\n event.key,\n edit.value,\n { seed: options.seed(), readOnly: !editable() },\n );\n if (result === null) {\n return false;\n }\n if (result.kind !== \"move\") {\n apply(\n result.values,\n result.edit,\n result.kind === \"step\" ? \"step\" : \"erase\",\n event,\n );\n }\n if (result.move !== null) {\n move(target, result.move);\n }\n return true;\n },\n /** Text typed into a segment (`beforeinput`'s data). */\n onSegmentText: (\n segment: DateSegment,\n text: string,\n event: Event,\n target: HTMLElement,\n ) => {\n if (!segment.editable || !editable()) {\n return;\n }\n let next = values.value;\n let typing = edit.value;\n let advance = false;\n for (const character of text) {\n const result = typeSegment(\n options.format(),\n next,\n segment.type as EditableSegmentType,\n character,\n typing,\n options.seed(),\n );\n if (result === null) {\n continue;\n }\n next = result.values;\n typing = result.edit;\n advance = result.advance;\n }\n if (next === values.value && typing === edit.value) {\n return;\n }\n apply(next, typing, \"type\", event);\n if (advance) {\n move(target, \"next\");\n }\n },\n /** A segment lost the focus: its typed digits are dropped; leaving the groups blurs. */\n onSegmentBlur: (segment: DateSegment, event: FocusEvent) => {\n const typing = edit.value;\n if (typing !== null && typing.type === segment.type) {\n edit.value = null;\n }\n const own = (event.currentTarget as HTMLElement | null)?.closest(\n '[role=\"group\"]',\n );\n const groups = options.groups?.() ?? (own == null ? [] : [own]);\n const to = event.relatedTarget as Node | null;\n if (to === null || !groups.some((group) => group.contains(to))) {\n options.onBlur();\n }\n },\n };\n}\n\nexport type SegmentGroup = ReturnType<typeof useSegmentGroup>;\n"],"mappings":";;;;;;;;;AA6DA,MAAa,eAA+C,OAAO,WAAW;;ACjC9E,MAAM,gBAAgB;CAAE,aAAa;CAAS,WAAW;AAAM;;;;;AAM/D,MAAa,mBAGT,gBACA,gBAAgB;CACZ,MAAM;CACN,cAAc;CACd,OAAO;EACH,GAAG;EACH,SAAS;GACL,MAAM;GACN,UAAU;EACd;CACJ;CACA,MAAM,OAAO,EAAE,OAAO,SAAS;EAC3B,MAAM,UAAU,mBACZ,cACA,mBACJ;EACA,MAAM,KAAK,MAAM;EACjB,MAAM,UAAU,WAA+B,IAAI;EACnD,MAAM,aAAa,cAAc,OAAO;EACxC,MAAM,WAAW,eAAe;GAC5B,MAAM,EAAE,UAAU,aAAa,QAAQ,MAAM;GAC7C,OAAO,MAAM,QAAQ,YAAY,CAAC,YAAY,CAAC;EACnD,CAAC;EAOD,MACI;GAAC;SAAe,MAAM,QAAQ;GAAU;EAAQ,IAC/C,CAAC,MAAM,UAAU,WAAW,GAAG,cAAc;GAC1C,IAAI,SAAS,QAAQ,CAAC,UAClB;GAEJ,MAAM,aAAa,UAAyB;IACxC,IAAI,QAAQ,aAAa,MAAM,SAAS,OAAO,IAAI,GAC/C,MAAM,eAAe;GAE7B;GACA,MAAM,gBAAgB,QAAQ,MAAM,QAAQ;GAC5C,MAAM,UAAU,UACZ,QAAQ,cAAc,MAAM,SAAS,KAAK;GAC9C,MAAM,iBAAiB,UAAsB;IACzC,IAAI,CAAC,UACD;IAEJ,MAAM,eAAe;IACrB,IAAI,MAAM,cAAc,yBAAyB;KAC7C,QAAQ,aACJ,MAAM,SACN,IAAI,cAAc,WAAW,EACzB,KAAK,YACT,CAAC,GACD,IACJ;KACA;IACJ;IACA,IAAI,MAAM,SAAS,QAAQ,MAAM,SAAS,IACtC,QAAQ,cACJ,MAA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