@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 @@
|
|
|
1
|
+
{"version":3,"file":"state-attributes-DhboDeMS.js","names":[],"sources":["../src/utils/state-attributes.ts"],"sourcesContent":["/**\n * `data-*` attributes from a state record (spec/README.md, \"State attributes\"): `true` gives an\n * empty attribute, `false`, `null` and `undefined` give none (never `\"false\"`), strings are values.\n */\nexport function stateAttributes(\n state: Record<string, boolean | string | null | undefined>,\n): Record<string, string> {\n const attributes: Record<string, string> = {};\n for (const [key, value] of Object.entries(state)) {\n if (value === true) {\n attributes[`data-${key}`] = \"\";\n } else if (typeof value === \"string\") {\n attributes[`data-${key}`] = value;\n }\n }\n return attributes;\n}\n"],"mappings":";;;;;AAIA,SAAgB,gBACZ,OACsB;CACtB,MAAM,aAAqC,CAAC;CAC5C,KAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,KAAK,GAC3C,IAAI,UAAU,MACV,WAAW,QAAQ,SAAS;MACzB,IAAI,OAAO,UAAU,UACxB,WAAW,QAAQ,SAAS;CAGpC,OAAO;AACX"}
|
|
@@ -0,0 +1,363 @@
|
|
|
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 { computed, defineComponent, provide, useId } from "vue";
|
|
7
|
+
// src/components/steps/steps-context.ts
|
|
8
|
+
const StepsKey = Symbol("Steps");
|
|
9
|
+
/** The Item a Trigger, an Indicator or a Separator sits in: its index. */
|
|
10
|
+
const StepsItemKey = Symbol("StepsItem");
|
|
11
|
+
/** Whether a step can be reached from the current one (spec/steps.md). */
|
|
12
|
+
function stepReachable(context, index) {
|
|
13
|
+
if (index <= context.state().step || !context.linear()) return true;
|
|
14
|
+
for (let before = 0; before < index; before++) if (!context.isStepValid(before)) return false;
|
|
15
|
+
return true;
|
|
16
|
+
}
|
|
17
|
+
function stepsItemState(context, index) {
|
|
18
|
+
const { step, orientation } = context.state();
|
|
19
|
+
return {
|
|
20
|
+
index,
|
|
21
|
+
current: index === step,
|
|
22
|
+
completed: index < step,
|
|
23
|
+
incomplete: index > step,
|
|
24
|
+
disabled: !stepReachable(context, index),
|
|
25
|
+
orientation
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
/** A step's `data-*` attributes (spec/steps.md, "State attributes and ARIA"). */
|
|
29
|
+
function itemAttributes(state) {
|
|
30
|
+
return stateAttributes({
|
|
31
|
+
current: state.current,
|
|
32
|
+
completed: state.completed,
|
|
33
|
+
incomplete: state.incomplete,
|
|
34
|
+
disabled: state.disabled,
|
|
35
|
+
orientation: state.orientation
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
const stepsContentId = (baseId, index) => `${baseId}-content-${index}`;
|
|
39
|
+
// src/components/steps/steps-completed-content.ts
|
|
40
|
+
/** What shows once every step is done (spec/steps.md): `hidden` until then. */
|
|
41
|
+
const StepsCompletedContent = publicComponent(defineComponent({
|
|
42
|
+
name: "StepsCompletedContent",
|
|
43
|
+
inheritAttrs: false,
|
|
44
|
+
props: asProp,
|
|
45
|
+
setup(props, { attrs, slots }) {
|
|
46
|
+
const context = useRequiredContext(StepsKey, "Steps.CompletedContent");
|
|
47
|
+
return () => {
|
|
48
|
+
const state = context.state();
|
|
49
|
+
return renderPart("div", {
|
|
50
|
+
attrs,
|
|
51
|
+
slots
|
|
52
|
+
}, props.as, state, {
|
|
53
|
+
hidden: !state.completed,
|
|
54
|
+
"data-primitives-part": "steps-completed-content"
|
|
55
|
+
});
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
}));
|
|
59
|
+
// src/components/steps/steps-content.ts
|
|
60
|
+
/** The content of one step (spec/steps.md): `hidden` unless it is the current one. */
|
|
61
|
+
const StepsContent = publicComponent(defineComponent({
|
|
62
|
+
name: "StepsContent",
|
|
63
|
+
inheritAttrs: false,
|
|
64
|
+
props: {
|
|
65
|
+
...asProp,
|
|
66
|
+
index: {
|
|
67
|
+
type: Number,
|
|
68
|
+
required: true
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
setup(props, { attrs, slots }) {
|
|
72
|
+
const context = useRequiredContext(StepsKey, "Steps.Content");
|
|
73
|
+
return () => {
|
|
74
|
+
const state = stepsItemState(context, props.index);
|
|
75
|
+
return renderPart("div", {
|
|
76
|
+
attrs,
|
|
77
|
+
slots
|
|
78
|
+
}, props.as, state, {
|
|
79
|
+
id: stepsContentId(context.baseId, props.index),
|
|
80
|
+
hidden: !state.current,
|
|
81
|
+
"data-primitives-part": "steps-content",
|
|
82
|
+
...stateAttributes({ current: state.current })
|
|
83
|
+
});
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
}));
|
|
87
|
+
// src/components/steps/use-steps-item.ts
|
|
88
|
+
/** The Root's context and the enclosing Item's state, for a part inside an Item. */
|
|
89
|
+
function useStepsItem(part) {
|
|
90
|
+
const context = useRequiredContext(StepsKey, part);
|
|
91
|
+
const index = useRequiredContext(StepsItemKey, part);
|
|
92
|
+
return {
|
|
93
|
+
context,
|
|
94
|
+
state: () => stepsItemState(context, index())
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
// src/components/steps/steps-indicator.ts
|
|
98
|
+
/** Its step's number or check mark (spec/steps.md), hidden from assistive technology. */
|
|
99
|
+
const StepsIndicator = publicComponent(defineComponent({
|
|
100
|
+
name: "StepsIndicator",
|
|
101
|
+
inheritAttrs: false,
|
|
102
|
+
props: asProp,
|
|
103
|
+
setup(props, { attrs, slots }) {
|
|
104
|
+
const { state: read } = useStepsItem("Steps.Indicator");
|
|
105
|
+
return () => {
|
|
106
|
+
const state = read();
|
|
107
|
+
return renderPart("span", {
|
|
108
|
+
attrs,
|
|
109
|
+
slots
|
|
110
|
+
}, props.as, state, {
|
|
111
|
+
"aria-hidden": "true",
|
|
112
|
+
"data-primitives-part": "steps-indicator",
|
|
113
|
+
...stateAttributes({
|
|
114
|
+
current: state.current,
|
|
115
|
+
completed: state.completed,
|
|
116
|
+
incomplete: state.incomplete
|
|
117
|
+
})
|
|
118
|
+
});
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
}));
|
|
122
|
+
// src/components/steps/steps-item.ts
|
|
123
|
+
/** One step (spec/steps.md): `aria-current="step"` while it is the current one. */
|
|
124
|
+
const StepsItem = publicComponent(defineComponent({
|
|
125
|
+
name: "StepsItem",
|
|
126
|
+
inheritAttrs: false,
|
|
127
|
+
props: {
|
|
128
|
+
...asProp,
|
|
129
|
+
index: {
|
|
130
|
+
type: Number,
|
|
131
|
+
required: true
|
|
132
|
+
}
|
|
133
|
+
},
|
|
134
|
+
setup(props, { attrs, slots }) {
|
|
135
|
+
const context = useRequiredContext(StepsKey, "Steps.Item");
|
|
136
|
+
provide(StepsItemKey, () => props.index);
|
|
137
|
+
return () => {
|
|
138
|
+
const state = stepsItemState(context, props.index);
|
|
139
|
+
return renderPart("li", {
|
|
140
|
+
attrs,
|
|
141
|
+
slots
|
|
142
|
+
}, props.as, state, {
|
|
143
|
+
"aria-current": state.current ? "step" : void 0,
|
|
144
|
+
"data-primitives-part": "steps-item",
|
|
145
|
+
...itemAttributes(state)
|
|
146
|
+
});
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
}));
|
|
150
|
+
// src/components/steps/steps-list.ts
|
|
151
|
+
/** The steps, an ordered list (spec/steps.md); the app names it. */
|
|
152
|
+
const StepsList = publicComponent(defineComponent({
|
|
153
|
+
name: "StepsList",
|
|
154
|
+
inheritAttrs: false,
|
|
155
|
+
props: asProp,
|
|
156
|
+
setup(props, { attrs, slots }) {
|
|
157
|
+
const context = useRequiredContext(StepsKey, "Steps.List");
|
|
158
|
+
return () => {
|
|
159
|
+
const state = context.state();
|
|
160
|
+
return renderPart("ol", {
|
|
161
|
+
attrs,
|
|
162
|
+
slots
|
|
163
|
+
}, props.as, state, {
|
|
164
|
+
"data-primitives-part": "steps-list",
|
|
165
|
+
...stateAttributes({ orientation: state.orientation })
|
|
166
|
+
});
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
}));
|
|
170
|
+
// src/components/steps/steps-step-trigger.ts
|
|
171
|
+
/**
|
|
172
|
+
* The setup of a PrevTrigger or a NextTrigger (spec/steps.md): disabled where it cannot move.
|
|
173
|
+
* Each part declares its own component with it.
|
|
174
|
+
*/
|
|
175
|
+
function setupStepsStepTrigger(kind, name, props, { attrs, slots }) {
|
|
176
|
+
const context = useRequiredContext(StepsKey, name);
|
|
177
|
+
return () => {
|
|
178
|
+
const { step, count } = context.state();
|
|
179
|
+
const target = kind === "prev" ? step - 1 : step + 1;
|
|
180
|
+
const disabled = kind === "prev" ? step <= 0 : step >= count || context.linear() && !context.isStepValid(step);
|
|
181
|
+
return renderPart("button", {
|
|
182
|
+
attrs,
|
|
183
|
+
slots
|
|
184
|
+
}, props.as, {
|
|
185
|
+
step: Math.min(count, Math.max(0, target)),
|
|
186
|
+
disabled
|
|
187
|
+
}, {
|
|
188
|
+
type: "button",
|
|
189
|
+
disabled: disabled || void 0,
|
|
190
|
+
onClick: (event) => {
|
|
191
|
+
if (disabled) return;
|
|
192
|
+
context.setStep(target, {
|
|
193
|
+
reason: kind === "prev" ? "previous-press" : "next-press",
|
|
194
|
+
event
|
|
195
|
+
});
|
|
196
|
+
},
|
|
197
|
+
"data-primitives-part": `steps-${kind}-trigger`,
|
|
198
|
+
...stateAttributes({ disabled })
|
|
199
|
+
});
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
// src/components/steps/steps-next-trigger.ts
|
|
203
|
+
/** The step after, past the last the completed state (spec/steps.md): disabled once completed, and in a linear process while the current step is not valid. */
|
|
204
|
+
const StepsNextTrigger = publicComponent(defineComponent({
|
|
205
|
+
name: "StepsNextTrigger",
|
|
206
|
+
inheritAttrs: false,
|
|
207
|
+
props: asProp,
|
|
208
|
+
setup: (props, context) => setupStepsStepTrigger("next", "Steps.NextTrigger", props, context)
|
|
209
|
+
}));
|
|
210
|
+
// src/components/steps/steps-prev-trigger.ts
|
|
211
|
+
/** The step before (spec/steps.md): disabled on the first step. */
|
|
212
|
+
const StepsPrevTrigger = publicComponent(defineComponent({
|
|
213
|
+
name: "StepsPrevTrigger",
|
|
214
|
+
inheritAttrs: false,
|
|
215
|
+
props: asProp,
|
|
216
|
+
setup: (props, context) => setupStepsStepTrigger("prev", "Steps.PrevTrigger", props, context)
|
|
217
|
+
}));
|
|
218
|
+
// src/components/steps/steps-root.ts
|
|
219
|
+
const ALWAYS_VALID = () => true;
|
|
220
|
+
/** A process in a fixed number of steps (spec/steps.md): it holds the step and the validation. */
|
|
221
|
+
const StepsRoot = publicComponent(defineComponent({
|
|
222
|
+
name: "StepsRoot",
|
|
223
|
+
inheritAttrs: false,
|
|
224
|
+
props: {
|
|
225
|
+
...asProp,
|
|
226
|
+
step: {
|
|
227
|
+
type: Number,
|
|
228
|
+
default: void 0
|
|
229
|
+
},
|
|
230
|
+
defaultStep: {
|
|
231
|
+
type: Number,
|
|
232
|
+
default: 0
|
|
233
|
+
},
|
|
234
|
+
count: {
|
|
235
|
+
type: Number,
|
|
236
|
+
required: true
|
|
237
|
+
},
|
|
238
|
+
linear: {
|
|
239
|
+
type: Boolean,
|
|
240
|
+
default: false
|
|
241
|
+
},
|
|
242
|
+
isStepValid: {
|
|
243
|
+
type: Function,
|
|
244
|
+
default: void 0
|
|
245
|
+
},
|
|
246
|
+
orientation: {
|
|
247
|
+
type: String,
|
|
248
|
+
default: "horizontal"
|
|
249
|
+
}
|
|
250
|
+
},
|
|
251
|
+
emits: {
|
|
252
|
+
"update:step": (_step) => true,
|
|
253
|
+
stepChange: (_step, _details) => true
|
|
254
|
+
},
|
|
255
|
+
setup(props, { attrs, slots, emit }) {
|
|
256
|
+
const own = useControllable(() => props.step, props.defaultStep, (next, details) => {
|
|
257
|
+
emit("update:step", next);
|
|
258
|
+
emit("stepChange", next, details);
|
|
259
|
+
});
|
|
260
|
+
const count = computed(() => Math.max(0, Math.floor(props.count)));
|
|
261
|
+
const step = computed(() => Math.min(count.value, Math.max(0, Math.floor(own.value.value))));
|
|
262
|
+
const state = () => ({
|
|
263
|
+
step: step.value,
|
|
264
|
+
count: count.value,
|
|
265
|
+
completed: step.value === count.value,
|
|
266
|
+
orientation: props.orientation
|
|
267
|
+
});
|
|
268
|
+
provide(StepsKey, {
|
|
269
|
+
state,
|
|
270
|
+
linear: () => props.linear,
|
|
271
|
+
isStepValid: (index) => (props.isStepValid ?? ALWAYS_VALID)(index),
|
|
272
|
+
baseId: useId(),
|
|
273
|
+
setStep: (next, details) => {
|
|
274
|
+
const target = Math.min(count.value, Math.max(0, next));
|
|
275
|
+
if (target !== step.value) own.set(target, details);
|
|
276
|
+
}
|
|
277
|
+
});
|
|
278
|
+
return () => {
|
|
279
|
+
const current = state();
|
|
280
|
+
return renderPart("div", {
|
|
281
|
+
attrs,
|
|
282
|
+
slots
|
|
283
|
+
}, props.as, current, {
|
|
284
|
+
"data-primitives-part": "steps-root",
|
|
285
|
+
...stateAttributes({
|
|
286
|
+
orientation: current.orientation,
|
|
287
|
+
completed: current.completed
|
|
288
|
+
})
|
|
289
|
+
});
|
|
290
|
+
};
|
|
291
|
+
}
|
|
292
|
+
}));
|
|
293
|
+
// src/components/steps/steps-separator.ts
|
|
294
|
+
/** The line from its step to the next (spec/steps.md), hidden from assistive technology. */
|
|
295
|
+
const StepsSeparator = publicComponent(defineComponent({
|
|
296
|
+
name: "StepsSeparator",
|
|
297
|
+
inheritAttrs: false,
|
|
298
|
+
props: asProp,
|
|
299
|
+
setup(props, { attrs, slots }) {
|
|
300
|
+
const { state: read } = useStepsItem("Steps.Separator");
|
|
301
|
+
return () => {
|
|
302
|
+
const state = read();
|
|
303
|
+
return renderPart("div", {
|
|
304
|
+
attrs,
|
|
305
|
+
slots
|
|
306
|
+
}, props.as, state, {
|
|
307
|
+
"aria-hidden": "true",
|
|
308
|
+
"data-primitives-part": "steps-separator",
|
|
309
|
+
...stateAttributes({
|
|
310
|
+
current: state.current,
|
|
311
|
+
completed: state.completed,
|
|
312
|
+
incomplete: state.incomplete,
|
|
313
|
+
orientation: state.orientation
|
|
314
|
+
})
|
|
315
|
+
});
|
|
316
|
+
};
|
|
317
|
+
}
|
|
318
|
+
}));
|
|
319
|
+
// src/components/steps/parts.ts
|
|
320
|
+
/** spec/steps.md */
|
|
321
|
+
const Steps = {
|
|
322
|
+
Root: StepsRoot,
|
|
323
|
+
List: StepsList,
|
|
324
|
+
Item: StepsItem,
|
|
325
|
+
Trigger: publicComponent(defineComponent({
|
|
326
|
+
name: "StepsTrigger",
|
|
327
|
+
inheritAttrs: false,
|
|
328
|
+
props: asProp,
|
|
329
|
+
setup(props, { attrs, slots }) {
|
|
330
|
+
const { context, state: read } = useStepsItem("Steps.Trigger");
|
|
331
|
+
return () => {
|
|
332
|
+
const state = read();
|
|
333
|
+
return renderPart("button", {
|
|
334
|
+
attrs,
|
|
335
|
+
slots
|
|
336
|
+
}, props.as, state, {
|
|
337
|
+
type: "button",
|
|
338
|
+
disabled: state.disabled || void 0,
|
|
339
|
+
"aria-current": state.current ? "step" : void 0,
|
|
340
|
+
"aria-controls": stepsContentId(context.baseId, state.index),
|
|
341
|
+
onClick: (event) => {
|
|
342
|
+
if (state.disabled) return;
|
|
343
|
+
context.setStep(state.index, {
|
|
344
|
+
reason: "trigger-press",
|
|
345
|
+
event
|
|
346
|
+
});
|
|
347
|
+
},
|
|
348
|
+
"data-primitives-part": "steps-trigger",
|
|
349
|
+
...itemAttributes(state)
|
|
350
|
+
});
|
|
351
|
+
};
|
|
352
|
+
}
|
|
353
|
+
})),
|
|
354
|
+
Indicator: StepsIndicator,
|
|
355
|
+
Separator: StepsSeparator,
|
|
356
|
+
Content: StepsContent,
|
|
357
|
+
PrevTrigger: StepsPrevTrigger,
|
|
358
|
+
NextTrigger: StepsNextTrigger,
|
|
359
|
+
CompletedContent: StepsCompletedContent
|
|
360
|
+
};
|
|
361
|
+
export { Steps as t };
|
|
362
|
+
|
|
363
|
+
//# sourceMappingURL=steps-Dl_mMqRB.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"steps-Dl_mMqRB.js","names":[],"sources":["../src/components/steps/steps-context.ts","../src/components/steps/steps-completed-content.ts","../src/components/steps/steps-content.ts","../src/components/steps/use-steps-item.ts","../src/components/steps/steps-indicator.ts","../src/components/steps/steps-item.ts","../src/components/steps/steps-list.ts","../src/components/steps/steps-step-trigger.ts","../src/components/steps/steps-next-trigger.ts","../src/components/steps/steps-prev-trigger.ts","../src/components/steps/steps-root.ts","../src/components/steps/steps-separator.ts","../src/components/steps/steps-trigger.ts","../src/components/steps/parts.ts"],"sourcesContent":["import type { InjectionKey } from \"vue\";\nimport type { ChangeDetails } from \"../../utils/change-details.ts\";\nimport { stateAttributes } from \"../../utils/state-attributes.ts\";\n\n/** What the Root renders with (spec/steps.md). */\nexport interface StepsState {\n /** The current step, from 0; `count` once completed. */\n step: number;\n count: number;\n /** Every step is done. */\n completed: boolean;\n orientation: \"horizontal\" | \"vertical\";\n}\n\nexport interface StepsContext {\n state: () => StepsState;\n linear: () => boolean;\n isStepValid: (index: number) => boolean;\n baseId: string;\n setStep: (step: number, details: ChangeDetails) => void;\n}\n\nexport const StepsKey: InjectionKey<StepsContext> = Symbol(\"Steps\");\n\n/** The Item a Trigger, an Indicator or a Separator sits in: its index. */\nexport const StepsItemKey: InjectionKey<() => number> = Symbol(\"StepsItem\");\n\n/** What a step's parts render with: its index and where it is from the current step. */\nexport interface StepsItemState {\n index: number;\n current: boolean;\n completed: boolean;\n incomplete: boolean;\n /** The step cannot be reached (spec/steps.md, \"Which steps can be reached\"). */\n disabled: boolean;\n orientation: \"horizontal\" | \"vertical\";\n}\n\n/** Whether a step can be reached from the current one (spec/steps.md). */\nexport function stepReachable(context: StepsContext, index: number): boolean {\n if (index <= context.state().step || !context.linear()) {\n return true;\n }\n for (let before = 0; before < index; before++) {\n if (!context.isStepValid(before)) {\n return false;\n }\n }\n return true;\n}\n\nexport function stepsItemState(\n context: StepsContext,\n index: number,\n): StepsItemState {\n const { step, orientation } = context.state();\n return {\n index,\n current: index === step,\n completed: index < step,\n incomplete: index > step,\n disabled: !stepReachable(context, index),\n orientation,\n };\n}\n\n/** A step's `data-*` attributes (spec/steps.md, \"State attributes and ARIA\"). */\nexport function itemAttributes(state: StepsItemState): Record<string, string> {\n return stateAttributes({\n current: state.current,\n completed: state.completed,\n incomplete: state.incomplete,\n disabled: state.disabled,\n orientation: state.orientation,\n });\n}\n\nexport const stepsContentId = (baseId: string, index: number) =>\n `${baseId}-content-${index}`;\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 { StepsKey, type StepsState } from \"./steps-context.ts\";\n\n/** What shows once every step is done (spec/steps.md): `hidden` until then. */\nexport const StepsCompletedContent: PartComponent<\n Record<never, never>,\n StepsState\n> = publicComponent(\n defineComponent({\n name: \"StepsCompletedContent\",\n inheritAttrs: false,\n props: asProp,\n setup(props, { attrs, slots }) {\n const context = useRequiredContext(\n StepsKey,\n \"Steps.CompletedContent\",\n );\n return () => {\n const state = context.state();\n return renderPart(\"div\", { attrs, slots }, props.as, state, {\n hidden: !state.completed,\n \"data-primitives-part\": \"steps-completed-content\",\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 { stateAttributes } from \"../../utils/state-attributes.ts\";\nimport {\n type StepsItemState,\n StepsKey,\n stepsContentId,\n stepsItemState,\n} from \"./steps-context.ts\";\n\nexport interface StepsContentProps {\n /** Its step, from 0. */\n index: number;\n}\n\n/** The content of one step (spec/steps.md): `hidden` unless it is the current one. */\nexport const StepsContent: PartComponent<StepsContentProps, StepsItemState> =\n publicComponent(\n defineComponent({\n name: \"StepsContent\",\n inheritAttrs: false,\n props: { ...asProp, index: { type: Number, required: true } },\n setup(props, { attrs, slots }) {\n const context = useRequiredContext(StepsKey, \"Steps.Content\");\n return () => {\n const state = stepsItemState(context, props.index);\n return renderPart(\n \"div\",\n { attrs, slots },\n props.as,\n state,\n {\n id: stepsContentId(context.baseId, props.index),\n hidden: !state.current,\n \"data-primitives-part\": \"steps-content\",\n ...stateAttributes({ current: state.current }),\n },\n );\n };\n },\n }),\n );\n","import { useRequiredContext } from \"../../composables/use-required-context.ts\";\nimport {\n type StepsContext,\n StepsItemKey,\n type StepsItemState,\n StepsKey,\n stepsItemState,\n} from \"./steps-context.ts\";\n\n/** The Root's context and the enclosing Item's state, for a part inside an Item. */\nexport function useStepsItem(part: string): {\n context: StepsContext;\n state: () => StepsItemState;\n} {\n const context = useRequiredContext(StepsKey, part);\n const index = useRequiredContext(StepsItemKey, part);\n return { context, state: () => stepsItemState(context, index()) };\n}\n","import { defineComponent } from \"vue\";\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 { StepsItemState } from \"./steps-context.ts\";\nimport { useStepsItem } from \"./use-steps-item.ts\";\n\n/** Its step's number or check mark (spec/steps.md), hidden from assistive technology. */\nexport const StepsIndicator: PartComponent<\n Record<never, never>,\n StepsItemState\n> = publicComponent(\n defineComponent({\n name: \"StepsIndicator\",\n inheritAttrs: false,\n props: asProp,\n setup(props, { attrs, slots }) {\n const { state: read } = useStepsItem(\"Steps.Indicator\");\n return () => {\n const state = read();\n return renderPart(\"span\", { attrs, slots }, props.as, state, {\n \"aria-hidden\": \"true\",\n \"data-primitives-part\": \"steps-indicator\",\n ...stateAttributes({\n current: state.current,\n completed: state.completed,\n incomplete: state.incomplete,\n }),\n });\n };\n },\n }),\n);\n","import { defineComponent, provide } 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 itemAttributes,\n StepsItemKey,\n type StepsItemState,\n StepsKey,\n stepsItemState,\n} from \"./steps-context.ts\";\n\nexport interface StepsItemProps {\n /** Its step, from 0. */\n index: number;\n}\n\n/** One step (spec/steps.md): `aria-current=\"step\"` while it is the current one. */\nexport const StepsItem: PartComponent<StepsItemProps, StepsItemState> =\n publicComponent(\n defineComponent({\n name: \"StepsItem\",\n inheritAttrs: false,\n props: { ...asProp, index: { type: Number, required: true } },\n setup(props, { attrs, slots }) {\n const context = useRequiredContext(StepsKey, \"Steps.Item\");\n provide(StepsItemKey, () => props.index);\n return () => {\n const state = stepsItemState(context, props.index);\n return renderPart(\"li\", { attrs, slots }, props.as, state, {\n \"aria-current\": state.current ? \"step\" : undefined,\n \"data-primitives-part\": \"steps-item\",\n ...itemAttributes(state),\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 { stateAttributes } from \"../../utils/state-attributes.ts\";\nimport { StepsKey, type StepsState } from \"./steps-context.ts\";\n\n/** The steps, an ordered list (spec/steps.md); the app names it. */\nexport const StepsList: PartComponent<\n Record<never, never>,\n StepsState\n> = publicComponent(\n defineComponent({\n name: \"StepsList\",\n inheritAttrs: false,\n props: asProp,\n setup(props, { attrs, slots }) {\n const context = useRequiredContext(StepsKey, \"Steps.List\");\n return () => {\n const state = context.state();\n return renderPart(\"ol\", { attrs, slots }, props.as, state, {\n \"data-primitives-part\": \"steps-list\",\n ...stateAttributes({ orientation: state.orientation }),\n });\n };\n },\n }),\n);\n","import type { SetupContext, VNode } from \"vue\";\nimport { useRequiredContext } from \"../../composables/use-required-context.ts\";\nimport { type AsProp, renderPart } from \"../../utils/render-part.ts\";\nimport { stateAttributes } from \"../../utils/state-attributes.ts\";\nimport { StepsKey } from \"./steps-context.ts\";\n\n/** What a PrevTrigger or a NextTrigger renders with. */\nexport interface StepsStepTriggerState {\n /** The step it moves to. */\n step: number;\n disabled: boolean;\n}\n\n/**\n * The setup of a PrevTrigger or a NextTrigger (spec/steps.md): disabled where it cannot move.\n * Each part declares its own component with it.\n */\nexport function setupStepsStepTrigger(\n kind: \"prev\" | \"next\",\n name: string,\n props: { as?: AsProp | undefined },\n { attrs, slots }: Pick<SetupContext, \"attrs\" | \"slots\">,\n): () => VNode {\n const context = useRequiredContext(StepsKey, name);\n return () => {\n const { step, count } = context.state();\n const target = kind === \"prev\" ? step - 1 : step + 1;\n const disabled =\n kind === \"prev\"\n ? step <= 0\n : step >= count ||\n (context.linear() && !context.isStepValid(step));\n return renderPart(\n \"button\",\n { attrs, slots },\n props.as,\n { step: Math.min(count, Math.max(0, target)), disabled },\n {\n type: \"button\",\n disabled: disabled || undefined,\n onClick: (event: MouseEvent) => {\n if (disabled) {\n return;\n }\n context.setStep(target, {\n reason:\n kind === \"prev\" ? \"previous-press\" : \"next-press\",\n event,\n });\n },\n \"data-primitives-part\": `steps-${kind}-trigger`,\n ...stateAttributes({ disabled }),\n },\n );\n };\n}\n","import { defineComponent } from \"vue\";\nimport {\n type PartComponent,\n publicComponent,\n} from \"../../utils/public-component.ts\";\nimport { asProp } from \"../../utils/render-part.ts\";\nimport {\n type StepsStepTriggerState,\n setupStepsStepTrigger,\n} from \"./steps-step-trigger.ts\";\n\n/** The step after, past the last the completed state (spec/steps.md): disabled once completed, and in a linear process while the current step is not valid. */\nexport const StepsNextTrigger: PartComponent<\n Record<never, never>,\n StepsStepTriggerState\n> = publicComponent(\n defineComponent({\n name: \"StepsNextTrigger\",\n inheritAttrs: false,\n props: asProp,\n setup: (props, context) =>\n setupStepsStepTrigger(\"next\", \"Steps.NextTrigger\", props, context),\n }),\n);\n","import { defineComponent } from \"vue\";\nimport {\n type PartComponent,\n publicComponent,\n} from \"../../utils/public-component.ts\";\nimport { asProp } from \"../../utils/render-part.ts\";\nimport {\n type StepsStepTriggerState,\n setupStepsStepTrigger,\n} from \"./steps-step-trigger.ts\";\n\n/** The step before (spec/steps.md): disabled on the first step. */\nexport const StepsPrevTrigger: PartComponent<\n Record<never, never>,\n StepsStepTriggerState\n> = publicComponent(\n defineComponent({\n name: \"StepsPrevTrigger\",\n inheritAttrs: false,\n props: asProp,\n setup: (props, context) =>\n setupStepsStepTrigger(\"prev\", \"Steps.PrevTrigger\", props, context),\n }),\n);\n","import { computed, defineComponent, type PropType, provide, useId } from \"vue\";\nimport { useControllable } from \"../../composables/use-controllable.ts\";\nimport type { ChangeDetails } 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 { StepsKey, type StepsState } from \"./steps-context.ts\";\n\nexport interface StepsRootProps {\n /** The current step, from 0; `count` is the completed state (`v-model:step`). */\n step?: number;\n /** The step at first (default `0`). */\n defaultStep?: number;\n /** The number of steps. */\n count: number;\n /** A step can only be reached once every step before it is valid. */\n linear?: boolean;\n /** Whether a step is valid (default: every step), read at each render. */\n isStepValid?: (index: number) => boolean;\n orientation?: \"horizontal\" | \"vertical\";\n}\n\nexport type StepsRootEmits = {\n /** The new step (`v-model:step`). */\n \"update:step\": (step: number) => true;\n /** Every step change, with its reason. */\n stepChange: (step: number, details: ChangeDetails) => true;\n};\n\nconst ALWAYS_VALID = () => true;\n\n/** A process in a fixed number of steps (spec/steps.md): it holds the step and the validation. */\nexport const StepsRoot: PartComponent<\n StepsRootProps,\n StepsState,\n StepsRootEmits\n> = publicComponent(\n defineComponent({\n name: \"StepsRoot\",\n inheritAttrs: false,\n props: {\n ...asProp,\n step: { type: Number, default: undefined },\n defaultStep: { type: Number, default: 0 },\n count: { type: Number, required: true },\n linear: { type: Boolean, default: false },\n isStepValid: {\n type: Function as PropType<(index: number) => boolean>,\n default: undefined,\n },\n orientation: {\n type: String as PropType<\"horizontal\" | \"vertical\">,\n default: \"horizontal\",\n },\n },\n emits: {\n \"update:step\": (_step: number) => true,\n stepChange: (_step: number, _details: ChangeDetails) => true,\n },\n setup(props, { attrs, slots, emit }) {\n const own = useControllable<number, ChangeDetails>(\n () => props.step,\n props.defaultStep,\n (next, details) => {\n emit(\"update:step\", next);\n emit(\"stepChange\", next, details);\n },\n );\n const count = computed(() => Math.max(0, Math.floor(props.count)));\n const step = computed(() =>\n Math.min(count.value, Math.max(0, Math.floor(own.value.value))),\n );\n const state = (): StepsState => ({\n step: step.value,\n count: count.value,\n completed: step.value === count.value,\n orientation: props.orientation,\n });\n provide(StepsKey, {\n state,\n linear: () => props.linear,\n isStepValid: (index) =>\n (props.isStepValid ?? ALWAYS_VALID)(index),\n baseId: useId(),\n setStep: (next, details) => {\n const target = Math.min(count.value, Math.max(0, next));\n if (target !== step.value) {\n own.set(target, details);\n }\n },\n });\n return () => {\n const current = state();\n return renderPart(\"div\", { attrs, slots }, props.as, current, {\n \"data-primitives-part\": \"steps-root\",\n ...stateAttributes({\n orientation: current.orientation,\n completed: current.completed,\n }),\n });\n };\n },\n }),\n);\n","import { defineComponent } from \"vue\";\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 { StepsItemState } from \"./steps-context.ts\";\nimport { useStepsItem } from \"./use-steps-item.ts\";\n\n/** The line from its step to the next (spec/steps.md), hidden from assistive technology. */\nexport const StepsSeparator: PartComponent<\n Record<never, never>,\n StepsItemState\n> = publicComponent(\n defineComponent({\n name: \"StepsSeparator\",\n inheritAttrs: false,\n props: asProp,\n setup(props, { attrs, slots }) {\n const { state: read } = useStepsItem(\"Steps.Separator\");\n return () => {\n const state = read();\n return renderPart(\"div\", { attrs, slots }, props.as, state, {\n \"aria-hidden\": \"true\",\n \"data-primitives-part\": \"steps-separator\",\n ...stateAttributes({\n current: state.current,\n completed: state.completed,\n incomplete: state.incomplete,\n orientation: state.orientation,\n }),\n });\n };\n },\n }),\n);\n","import { defineComponent } from \"vue\";\nimport {\n type PartComponent,\n publicComponent,\n} from \"../../utils/public-component.ts\";\nimport { asProp, renderPart } from \"../../utils/render-part.ts\";\nimport {\n itemAttributes,\n type StepsItemState,\n stepsContentId,\n} from \"./steps-context.ts\";\nimport { useStepsItem } from \"./use-steps-item.ts\";\n\n/** Moves to its Item's step (spec/steps.md): disabled while that step cannot be reached. */\nexport const StepsTrigger: PartComponent<\n Record<never, never>,\n StepsItemState\n> = publicComponent(\n defineComponent({\n name: \"StepsTrigger\",\n inheritAttrs: false,\n props: asProp,\n setup(props, { attrs, slots }) {\n const { context, state: read } = useStepsItem(\"Steps.Trigger\");\n return () => {\n const state = read();\n return renderPart(\"button\", { attrs, slots }, props.as, state, {\n type: \"button\",\n disabled: state.disabled || undefined,\n \"aria-current\": state.current ? \"step\" : undefined,\n \"aria-controls\": stepsContentId(\n context.baseId,\n state.index,\n ),\n onClick: (event: MouseEvent) => {\n if (state.disabled) {\n return;\n }\n context.setStep(state.index, {\n reason: \"trigger-press\",\n event,\n });\n },\n \"data-primitives-part\": \"steps-trigger\",\n ...itemAttributes(state),\n });\n };\n },\n }),\n);\n","import { StepsCompletedContent } from \"./steps-completed-content.ts\";\nimport { StepsContent } from \"./steps-content.ts\";\nimport { StepsIndicator } from \"./steps-indicator.ts\";\nimport { StepsItem } from \"./steps-item.ts\";\nimport { StepsList } from \"./steps-list.ts\";\nimport { StepsNextTrigger } from \"./steps-next-trigger.ts\";\nimport { StepsPrevTrigger } from \"./steps-prev-trigger.ts\";\nimport { StepsRoot } from \"./steps-root.ts\";\nimport { StepsSeparator } from \"./steps-separator.ts\";\nimport { StepsTrigger } from \"./steps-trigger.ts\";\n\n/** spec/steps.md */\nexport const Steps = {\n Root: StepsRoot,\n List: StepsList,\n Item: StepsItem,\n Trigger: StepsTrigger,\n Indicator: StepsIndicator,\n Separator: StepsSeparator,\n Content: StepsContent,\n PrevTrigger: StepsPrevTrigger,\n NextTrigger: StepsNextTrigger,\n CompletedContent: StepsCompletedContent,\n};\n"],"mappings":";;;;;;;AAsBA,MAAa,WAAuC,OAAO,OAAO;;AAGlE,MAAa,eAA2C,OAAO,WAAW;;AAc1E,SAAgB,cAAc,SAAuB,OAAwB;CACzE,IAAI,SAAS,QAAQ,MAAM,CAAC,CAAC,QAAQ,CAAC,QAAQ,OAAO,GACjD,OAAO;CAEX,KAAK,IAAI,SAAS,GAAG,SAAS,OAAO,UACjC,IAAI,CAAC,QAAQ,YAAY,MAAM,GAC3B,OAAO;CAGf,OAAO;AACX;AAEA,SAAgB,eACZ,SACA,OACc;CACd,MAAM,EAAE,MAAM,gBAAgB,QAAQ,MAAM;CAC5C,OAA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
|
+
import { n as RenderSlotProps } from "./render-part-BaTKiWBp.js";
|
|
3
|
+
import { a as StepsRootEmits, c as StepsState, i as StepsItemProps, n as StepsStepTriggerState, o as StepsRootProps, r as StepsContentProps, s as StepsItemState, t as Steps } from "./index-QO79pDtI.js";
|
|
4
|
+
export { type ChangeDetails, type ChangeReason, type RenderSlotProps, Steps, type StepsContentProps, type StepsItemProps, type StepsItemState, type StepsRootEmits, type StepsRootProps, type StepsState, type StepsStepTriggerState };
|
package/dist/steps.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { t as Steps } from "./steps-Dl_mMqRB.js";
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
import { t as useControllable } from "./use-controllable-B46G4v0A.js";
|
|
2
|
+
import { n as useFieldControl } from "./use-field-control-CdYqr0dK.js";
|
|
3
|
+
import { t as elementSetter } from "./use-overlay-root-BkyTQIsX.js";
|
|
4
|
+
import { t as publicComponent } from "./public-component-AV8E7mGp.js";
|
|
5
|
+
import { n as renderPart, t as asProp } from "./render-part-B5XVbHaS.js";
|
|
6
|
+
import { t as stateAttributes } from "./state-attributes-DhboDeMS.js";
|
|
7
|
+
import { t as useRequiredContext } from "./use-required-context-CPpEkr4Q.js";
|
|
8
|
+
import { Fragment, computed, defineComponent, h, provide, shallowRef, useId, watch } from "vue";
|
|
9
|
+
import { VISUALLY_HIDDEN_INPUT_STYLE, bridgeForm } from "@fragiola/primitives/form";
|
|
10
|
+
// src/components/switch/switch-context.ts
|
|
11
|
+
const SwitchKey = Symbol("Switch");
|
|
12
|
+
/** `data-checked` / `data-unchecked` (exactly one), and the switch's flags (spec/switch.md). */
|
|
13
|
+
function switchAttributes(state) {
|
|
14
|
+
return {
|
|
15
|
+
checked: state.checked,
|
|
16
|
+
unchecked: !state.checked,
|
|
17
|
+
disabled: state.disabled,
|
|
18
|
+
readonly: state.readOnly,
|
|
19
|
+
required: state.required
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
// src/components/switch/parts.ts
|
|
23
|
+
/** spec/switch.md */
|
|
24
|
+
const Switch = {
|
|
25
|
+
Root: publicComponent(defineComponent({
|
|
26
|
+
name: "SwitchRoot",
|
|
27
|
+
inheritAttrs: false,
|
|
28
|
+
props: {
|
|
29
|
+
...asProp,
|
|
30
|
+
checked: {
|
|
31
|
+
type: Boolean,
|
|
32
|
+
default: void 0
|
|
33
|
+
},
|
|
34
|
+
defaultChecked: {
|
|
35
|
+
type: Boolean,
|
|
36
|
+
default: false
|
|
37
|
+
},
|
|
38
|
+
disabled: {
|
|
39
|
+
type: Boolean,
|
|
40
|
+
default: false
|
|
41
|
+
},
|
|
42
|
+
required: {
|
|
43
|
+
type: Boolean,
|
|
44
|
+
default: false
|
|
45
|
+
},
|
|
46
|
+
/** Focusable and submitted, but a press or a key does not toggle it. */
|
|
47
|
+
readOnly: {
|
|
48
|
+
type: Boolean,
|
|
49
|
+
default: false
|
|
50
|
+
},
|
|
51
|
+
name: {
|
|
52
|
+
type: String,
|
|
53
|
+
default: void 0
|
|
54
|
+
},
|
|
55
|
+
/** Submitted while on (`"on"`). */
|
|
56
|
+
value: {
|
|
57
|
+
type: String,
|
|
58
|
+
default: "on"
|
|
59
|
+
},
|
|
60
|
+
/** Submitted while off, when given (Base UI). */
|
|
61
|
+
uncheckedValue: {
|
|
62
|
+
type: String,
|
|
63
|
+
default: void 0
|
|
64
|
+
},
|
|
65
|
+
id: {
|
|
66
|
+
type: String,
|
|
67
|
+
default: void 0
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
emits: {
|
|
71
|
+
"update:checked": (_checked) => true,
|
|
72
|
+
checkedChange: (_checked, _details) => true
|
|
73
|
+
},
|
|
74
|
+
setup(props, { attrs, slots, emit }) {
|
|
75
|
+
const generatedId = useId();
|
|
76
|
+
const id = computed(() => props.id ?? generatedId);
|
|
77
|
+
const own = useControllable(() => props.checked, props.defaultChecked, (next, details) => {
|
|
78
|
+
emit("update:checked", next);
|
|
79
|
+
emit("checkedChange", next, details);
|
|
80
|
+
});
|
|
81
|
+
const button = shallowRef(null);
|
|
82
|
+
const setButton = elementSetter(button);
|
|
83
|
+
const input = shallowRef(null);
|
|
84
|
+
const field = useFieldControl({
|
|
85
|
+
id: () => id.value,
|
|
86
|
+
labelable: true,
|
|
87
|
+
value: () => own.value.value,
|
|
88
|
+
filled: () => own.value.value,
|
|
89
|
+
input: () => input.value,
|
|
90
|
+
focusTarget: () => button.value
|
|
91
|
+
});
|
|
92
|
+
const state = computed(() => ({
|
|
93
|
+
checked: own.value.value,
|
|
94
|
+
disabled: props.disabled || field.disabled(),
|
|
95
|
+
readOnly: props.readOnly,
|
|
96
|
+
required: props.required
|
|
97
|
+
}));
|
|
98
|
+
provide(SwitchKey, state);
|
|
99
|
+
watch(input, (element, _, onCleanup) => {
|
|
100
|
+
if (element === null) return;
|
|
101
|
+
onCleanup(bridgeForm(element, {
|
|
102
|
+
reset: () => {
|
|
103
|
+
const checked = own.value.value;
|
|
104
|
+
field.reset();
|
|
105
|
+
own.set(props.defaultChecked, { reason: "none" });
|
|
106
|
+
element.checked = checked;
|
|
107
|
+
},
|
|
108
|
+
invalid: () => button.value
|
|
109
|
+
}));
|
|
110
|
+
}, { flush: "post" });
|
|
111
|
+
const toggle = () => {
|
|
112
|
+
const current = state.value;
|
|
113
|
+
if (!current.disabled && !current.readOnly) own.set(!current.checked, { reason: "none" });
|
|
114
|
+
};
|
|
115
|
+
return () => {
|
|
116
|
+
const current = state.value;
|
|
117
|
+
const formName = field.name() ?? props.name;
|
|
118
|
+
return h(Fragment, [
|
|
119
|
+
renderPart("button", {
|
|
120
|
+
attrs,
|
|
121
|
+
slots
|
|
122
|
+
}, props.as, current, {
|
|
123
|
+
type: "button",
|
|
124
|
+
role: "switch",
|
|
125
|
+
id: id.value,
|
|
126
|
+
disabled: current.disabled,
|
|
127
|
+
"aria-checked": current.checked ? "true" : "false",
|
|
128
|
+
"aria-required": current.required ? "true" : void 0,
|
|
129
|
+
"aria-readonly": current.readOnly ? "true" : void 0,
|
|
130
|
+
...field.aria(),
|
|
131
|
+
"data-primitives-part": "switch-root",
|
|
132
|
+
...field.attributes(),
|
|
133
|
+
...stateAttributes(switchAttributes(current)),
|
|
134
|
+
onClick: toggle,
|
|
135
|
+
onFocus: field.onFocus,
|
|
136
|
+
onBlur: field.onBlur,
|
|
137
|
+
ref: setButton
|
|
138
|
+
}),
|
|
139
|
+
h("input", {
|
|
140
|
+
ref: (element) => {
|
|
141
|
+
input.value = element;
|
|
142
|
+
},
|
|
143
|
+
type: "checkbox",
|
|
144
|
+
"aria-hidden": "true",
|
|
145
|
+
tabindex: -1,
|
|
146
|
+
name: formName,
|
|
147
|
+
value: props.value,
|
|
148
|
+
checked: current.checked,
|
|
149
|
+
required: current.required,
|
|
150
|
+
disabled: current.disabled,
|
|
151
|
+
style: VISUALLY_HIDDEN_INPUT_STYLE,
|
|
152
|
+
"data-primitives-part": "switch-input"
|
|
153
|
+
}),
|
|
154
|
+
!current.checked && props.uncheckedValue !== void 0 ? h("input", {
|
|
155
|
+
type: "hidden",
|
|
156
|
+
name: formName,
|
|
157
|
+
value: props.uncheckedValue,
|
|
158
|
+
disabled: current.disabled,
|
|
159
|
+
"data-primitives-part": "switch-unchecked-input"
|
|
160
|
+
}) : null
|
|
161
|
+
]);
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
})),
|
|
165
|
+
Thumb: publicComponent(defineComponent({
|
|
166
|
+
name: "SwitchThumb",
|
|
167
|
+
inheritAttrs: false,
|
|
168
|
+
props: asProp,
|
|
169
|
+
setup(props, { attrs, slots }) {
|
|
170
|
+
const state = useRequiredContext(SwitchKey, "Switch.Thumb");
|
|
171
|
+
return () => renderPart("span", {
|
|
172
|
+
attrs,
|
|
173
|
+
slots
|
|
174
|
+
}, props.as, state.value, {
|
|
175
|
+
"data-primitives-part": "switch-thumb",
|
|
176
|
+
...stateAttributes(switchAttributes(state.value))
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
}))
|
|
180
|
+
};
|
|
181
|
+
export { Switch as t };
|
|
182
|
+
|
|
183
|
+
//# sourceMappingURL=switch-CT9QBKOs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"switch-CT9QBKOs.js","names":[],"sources":["../src/components/switch/switch-context.ts","../src/components/switch/switch-root.ts","../src/components/switch/switch-thumb.ts","../src/components/switch/parts.ts"],"sourcesContent":["import type { ComputedRef, InjectionKey } from \"vue\";\n\nexport interface SwitchState {\n checked: boolean;\n disabled: boolean;\n readOnly: boolean;\n required: boolean;\n}\n\nexport const SwitchKey: InjectionKey<ComputedRef<SwitchState>> =\n Symbol(\"Switch\");\n\n/** `data-checked` / `data-unchecked` (exactly one), and the switch's flags (spec/switch.md). */\nexport function switchAttributes(state: SwitchState) {\n return {\n checked: state.checked,\n unchecked: !state.checked,\n disabled: state.disabled,\n readonly: state.readOnly,\n required: state.required,\n };\n}\n","import {\n bridgeForm,\n VISUALLY_HIDDEN_INPUT_STYLE,\n} from \"@fragiola/primitives/form\";\nimport {\n computed,\n defineComponent,\n Fragment,\n h,\n provide,\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 { ChangeDetails } 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 SwitchKey,\n type SwitchState,\n switchAttributes,\n} from \"./switch-context.ts\";\n\nexport interface SwitchRootProps {\n checked?: boolean;\n defaultChecked?: boolean;\n disabled?: boolean;\n required?: boolean;\n /** Focusable and submitted, but a press or a key does not toggle it. */\n readOnly?: boolean;\n name?: string;\n /** Submitted while on (`\"on\"`). */\n value?: string;\n /** Submitted while off, when given (Base UI); nothing is submitted while off without it. */\n uncheckedValue?: string;\n id?: string;\n}\n\nexport type SwitchRootEmits = {\n \"update:checked\": (checked: boolean) => true;\n checkedChange: (checked: boolean, details: ChangeDetails) => true;\n};\n\n/** A `switch` (`v-model:checked`) with its hidden form inputs (spec/switch.md, the APG switch). */\nexport const SwitchRoot: PartComponent<\n SwitchRootProps,\n SwitchState,\n SwitchRootEmits\n> = publicComponent(\n defineComponent({\n name: \"SwitchRoot\",\n inheritAttrs: false,\n props: {\n ...asProp,\n checked: { type: Boolean, default: undefined },\n defaultChecked: { type: Boolean, default: false },\n disabled: { type: Boolean, default: false },\n required: { type: Boolean, default: false },\n /** Focusable and submitted, but a press or a key does not toggle it. */\n readOnly: { type: Boolean, default: false },\n name: { type: String, default: undefined },\n /** Submitted while on (`\"on\"`). */\n value: { type: String, default: \"on\" },\n /** Submitted while off, when given (Base UI). */\n uncheckedValue: { type: String, default: undefined },\n id: { type: String, default: undefined },\n },\n emits: {\n \"update:checked\": (_checked: boolean) => true,\n checkedChange: (_checked: boolean, _details: ChangeDetails) => true,\n },\n setup(props, { attrs, slots, emit }) {\n const generatedId = useId();\n const id = computed(() => props.id ?? generatedId);\n const own = useControllable<boolean, ChangeDetails>(\n () => props.checked,\n props.defaultChecked,\n (next, details) => {\n emit(\"update:checked\", next);\n emit(\"checkedChange\", next, details);\n },\n );\n const button = shallowRef<HTMLElement | null>(null);\n const setButton = elementSetter(button);\n const input = shallowRef<HTMLInputElement | null>(null);\n const field = useFieldControl({\n id: () => id.value,\n labelable: true,\n value: () => own.value.value,\n filled: () => own.value.value,\n input: () => input.value,\n focusTarget: () => button.value,\n });\n const state = computed<SwitchState>(() => ({\n checked: own.value.value,\n disabled: props.disabled || field.disabled(),\n readOnly: props.readOnly,\n required: props.required,\n }));\n provide(SwitchKey, state);\n\n watch(\n input,\n (element, _, onCleanup) => {\n if (element === null) {\n return;\n }\n onCleanup(\n bridgeForm(element, {\n reset: () => {\n const checked = own.value.value;\n field.reset();\n own.set(props.defaultChecked, {\n reason: \"none\",\n });\n // the rendered state, which a patch follows (a controlled\n // switch that refuses the reset keeps its input)\n element.checked = checked;\n },\n invalid: () => button.value,\n }),\n );\n },\n { flush: \"post\" },\n );\n\n // Space and Enter click a native button: both toggle (APG, Base UI)\n const toggle = () => {\n const current = state.value;\n if (!current.disabled && !current.readOnly) {\n own.set(!current.checked, { reason: \"none\" });\n }\n };\n\n return () => {\n const current = state.value;\n const formName = field.name() ?? props.name;\n return h(Fragment, [\n renderPart(\"button\", { attrs, slots }, props.as, current, {\n type: \"button\",\n role: \"switch\",\n id: id.value,\n disabled: current.disabled,\n \"aria-checked\": current.checked ? \"true\" : \"false\",\n \"aria-required\": current.required ? \"true\" : undefined,\n \"aria-readonly\": current.readOnly ? \"true\" : undefined,\n ...field.aria(),\n \"data-primitives-part\": \"switch-root\",\n ...field.attributes(),\n ...stateAttributes(switchAttributes(current)),\n onClick: toggle,\n onFocus: field.onFocus,\n onBlur: field.onBlur,\n ref: setButton,\n }),\n h(\"input\", {\n ref: (element: unknown) => {\n input.value = element as HTMLInputElement | null;\n },\n type: \"checkbox\",\n \"aria-hidden\": \"true\",\n tabindex: -1,\n name: formName,\n value: props.value,\n checked: current.checked,\n required: current.required,\n disabled: current.disabled,\n style: VISUALLY_HIDDEN_INPUT_STYLE,\n \"data-primitives-part\": \"switch-input\",\n }),\n !current.checked && props.uncheckedValue !== undefined\n ? h(\"input\", {\n type: \"hidden\",\n name: formName,\n value: props.uncheckedValue,\n disabled: current.disabled,\n \"data-primitives-part\": \"switch-unchecked-input\",\n })\n : null,\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 { stateAttributes } from \"../../utils/state-attributes.ts\";\nimport {\n SwitchKey,\n type SwitchState,\n switchAttributes,\n} from \"./switch-context.ts\";\n\n/** The moving part, always rendered; the recipe places it from `data-checked` (spec/switch.md). */\nexport const SwitchThumb: PartComponent<\n Record<never, never>,\n SwitchState\n> = publicComponent(\n defineComponent({\n name: \"SwitchThumb\",\n inheritAttrs: false,\n props: asProp,\n setup(props, { attrs, slots }) {\n const state = useRequiredContext(SwitchKey, \"Switch.Thumb\");\n return () =>\n renderPart(\"span\", { attrs, slots }, props.as, state.value, {\n \"data-primitives-part\": \"switch-thumb\",\n ...stateAttributes(switchAttributes(state.value)),\n });\n },\n }),\n);\n","import { SwitchRoot } from \"./switch-root.ts\";\nimport { SwitchThumb } from \"./switch-thumb.ts\";\n\n/** spec/switch.md */\nexport const Switch = {\n Root: SwitchRoot,\n Thumb: SwitchThumb,\n};\n"],"mappings":";;;;;;;;;;AASA,MAAa,YACT,OAAO,QAAQ;;AAGnB,SAAgB,iBAAiB,OAAoB;CACjD,OAAO;EACH,SAAS,MAAM;EACf,WAAW,CAAC,MAAM;EAClB,UAAU,MAAM;EAChB,UAAU,MAAM;EAChB,UAAU,MAAM;CACpB;AACJ;;;AGjBA,MAAa,SAAS;CAClB,MFkDA,gBACA,gBAAgB;EACZ,MAAM;EACN,cAAc;EACd,OAAO;GACH,GAAG;GACH,SAAS;IAAE,MAAM;IAAS,SAAS,KAAA;GAAU;GAC7C,gBAAgB;IAAE,MAAM;IAAS,SAAS;GAAM;GAChD,UAAU;IAAE,MAAM;IAAS,SAAS;GAAM;GAC1C,UAAU;IAAE,MAAM;IAAS,SAAS;GAAM;;GAE1C,UAAU;IAAE,MAAM;IAAS,SAAS;GAAM;GAC1C,MAAM;IAAE,MAAM;IAAQ,SAAS,KAAA;GAAU;;GAEzC,OAAO;IAAE,MAAM;IAAQ,SAAS;GAAK;;GAErC,gBAAgB;IAAE,MAAM;IAAQ,SAAS,KAAA;GAAU;GACnD,IAAI;IAAE,MAAM;IAAQ,SAAS,KAAA;GAAU;EAC3C;EACA,OAAO;GACH,mBAAmB,aAAsB;GACzC,gBAAgB,UAAmB,aAA4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as RenderSlotProps } from "./render-part-BaTKiWBp.js";
|
|
3
|
+
import { i as SwitchState, n as SwitchRootEmits, r as SwitchRootProps, t as Switch } from "./index-WC9xwMaX.js";
|
|
4
|
+
export { type ChangeDetails, type ChangeReason, type RenderSlotProps, Switch, type SwitchRootEmits, type SwitchRootProps, type SwitchState };
|
package/dist/switch.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { t as Switch } from "./switch-CT9QBKOs.js";
|