@42-central/ui-react 0.29.1 → 0.30.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/dist/{chunk-X6DESK37.js → chunk-2RRTT4AF.js} +17 -5
- package/dist/chunk-2RRTT4AF.js.map +1 -0
- package/dist/{chunk-TUP7WXQE.js → chunk-322I2RSV.js} +9 -6
- package/dist/chunk-322I2RSV.js.map +1 -0
- package/dist/{chunk-ISX3AM32.js → chunk-37SRSNLJ.js} +4 -4
- package/dist/{chunk-ISX3AM32.js.map → chunk-37SRSNLJ.js.map} +1 -1
- package/dist/{chunk-L5GH7LLD.js → chunk-3MFWUG5O.js} +4 -4
- package/dist/{chunk-L5GH7LLD.js.map → chunk-3MFWUG5O.js.map} +1 -1
- package/dist/{chunk-FQJNQW3G.js → chunk-3XQEOJCE.js} +8 -5
- package/dist/chunk-3XQEOJCE.js.map +1 -0
- package/dist/{chunk-JKFPRQB2.js → chunk-4LSZ5JWF.js} +3 -3
- package/dist/{chunk-JKFPRQB2.js.map → chunk-4LSZ5JWF.js.map} +1 -1
- package/dist/{chunk-V2QZG4IT.js → chunk-5HWFYYHW.js} +27 -9
- package/dist/chunk-5HWFYYHW.js.map +1 -0
- package/dist/{chunk-GEZYGBXY.js → chunk-6MVFCS46.js} +99 -42
- package/dist/chunk-6MVFCS46.js.map +1 -0
- package/dist/{chunk-NNPSBC7O.js → chunk-6WZSUS3U.js} +10 -9
- package/dist/chunk-6WZSUS3U.js.map +1 -0
- package/dist/chunk-6YRGP6PS.js +138 -0
- package/dist/chunk-6YRGP6PS.js.map +1 -0
- package/dist/{chunk-B5YHYI7E.js → chunk-ALANKV5Y.js} +23 -6
- package/dist/chunk-ALANKV5Y.js.map +1 -0
- package/dist/{chunk-IA6DCC3N.js → chunk-AUQPNDE5.js} +23 -13
- package/dist/chunk-AUQPNDE5.js.map +1 -0
- package/dist/{chunk-AKXALCUN.js → chunk-D7SW2E24.js} +4 -4
- package/dist/chunk-D7SW2E24.js.map +1 -0
- package/dist/{chunk-OXR7BXZA.js → chunk-DQIYYDFD.js} +4 -3
- package/dist/chunk-DQIYYDFD.js.map +1 -0
- package/dist/{chunk-HMNXNKDA.js → chunk-FCBYUN6F.js} +4 -4
- package/dist/{chunk-HMNXNKDA.js.map → chunk-FCBYUN6F.js.map} +1 -1
- package/dist/{chunk-2W7H43WL.js → chunk-FED6SJWM.js} +23 -14
- package/dist/chunk-FED6SJWM.js.map +1 -0
- package/dist/{chunk-7E7JNWOC.js → chunk-FEPIHXVI.js} +6 -5
- package/dist/chunk-FEPIHXVI.js.map +1 -0
- package/dist/{chunk-Y57NW6G7.js → chunk-G3YOSG3U.js} +4 -4
- package/dist/{chunk-Y57NW6G7.js.map → chunk-G3YOSG3U.js.map} +1 -1
- package/dist/chunk-GZN5CXMR.js +100 -0
- package/dist/chunk-GZN5CXMR.js.map +1 -0
- package/dist/{chunk-HCHGERDB.js → chunk-HCSZPBWV.js} +17 -115
- package/dist/chunk-HCSZPBWV.js.map +1 -0
- package/dist/{chunk-I4B3N3UX.js → chunk-HTVICHT4.js} +12 -7
- package/dist/chunk-HTVICHT4.js.map +1 -0
- package/dist/chunk-I7TC2C3I.js +163 -0
- package/dist/chunk-I7TC2C3I.js.map +1 -0
- package/dist/{chunk-7FPSQBWB.js → chunk-IBXYLO2J.js} +14 -13
- package/dist/chunk-IBXYLO2J.js.map +1 -0
- package/dist/{chunk-7KFUFAVP.js → chunk-IRYG6B5A.js} +9 -8
- package/dist/chunk-IRYG6B5A.js.map +1 -0
- package/dist/{chunk-2RQLPN4U.js → chunk-JCNEW4WJ.js} +8 -8
- package/dist/{chunk-2RQLPN4U.js.map → chunk-JCNEW4WJ.js.map} +1 -1
- package/dist/{chunk-SP6LCCTZ.js → chunk-KZDMVOL6.js} +35 -8
- package/dist/chunk-KZDMVOL6.js.map +1 -0
- package/dist/chunk-LR5U6TZZ.js +169 -0
- package/dist/chunk-LR5U6TZZ.js.map +1 -0
- package/dist/{chunk-MQHD3EJE.js → chunk-LZHZJWVM.js} +6 -4
- package/dist/chunk-LZHZJWVM.js.map +1 -0
- package/dist/{chunk-5EOMSWNO.js → chunk-MAM2X3MW.js} +5 -5
- package/dist/{chunk-5EOMSWNO.js.map → chunk-MAM2X3MW.js.map} +1 -1
- package/dist/{chunk-FSPS7TVD.js → chunk-MCMS4NMO.js} +5 -5
- package/dist/{chunk-FSPS7TVD.js.map → chunk-MCMS4NMO.js.map} +1 -1
- package/dist/{chunk-ZB5VMGKB.js → chunk-MV5DIE2T.js} +15 -4
- package/dist/chunk-MV5DIE2T.js.map +1 -0
- package/dist/chunk-NDI4HLQE.js +41 -0
- package/dist/chunk-NDI4HLQE.js.map +1 -0
- package/dist/{chunk-B4GNSSHU.js → chunk-NLJEQZQQ.js} +3 -3
- package/dist/{chunk-B4GNSSHU.js.map → chunk-NLJEQZQQ.js.map} +1 -1
- package/dist/{chunk-SBZJGFZ6.js → chunk-QHT4DCXE.js} +8 -7
- package/dist/chunk-QHT4DCXE.js.map +1 -0
- package/dist/{chunk-I4IJOLNA.js → chunk-RMUBCTEF.js} +5 -5
- package/dist/{chunk-I4IJOLNA.js.map → chunk-RMUBCTEF.js.map} +1 -1
- package/dist/{chunk-G3AD3NJG.js → chunk-RNTDM3RP.js} +9 -5
- package/dist/chunk-RNTDM3RP.js.map +1 -0
- package/dist/chunk-RPFN6ETQ.js +509 -0
- package/dist/chunk-RPFN6ETQ.js.map +1 -0
- package/dist/{chunk-HWBFRDX7.js → chunk-SI7C3W5M.js} +28 -9
- package/dist/chunk-SI7C3W5M.js.map +1 -0
- package/dist/chunk-TPOV3OCC.js +234 -0
- package/dist/chunk-TPOV3OCC.js.map +1 -0
- package/dist/{chunk-IANYMDKH.js → chunk-UBQ54W46.js} +4 -4
- package/dist/chunk-UBQ54W46.js.map +1 -0
- package/dist/{chunk-QVOBLRCM.js → chunk-UIKQ4X6W.js} +3 -3
- package/dist/{chunk-QVOBLRCM.js.map → chunk-UIKQ4X6W.js.map} +1 -1
- package/dist/chunk-UOWQH53N.js +70 -0
- package/dist/chunk-UOWQH53N.js.map +1 -0
- package/dist/{chunk-QRNQQIQM.js → chunk-WJUY6YWF.js} +52 -20
- package/dist/chunk-WJUY6YWF.js.map +1 -0
- package/dist/{chunk-3KARNPW4.js → chunk-WKIUMLRT.js} +3 -3
- package/dist/{chunk-3KARNPW4.js.map → chunk-WKIUMLRT.js.map} +1 -1
- package/dist/chunk-X6RB74JN.js +37 -0
- package/dist/chunk-X6RB74JN.js.map +1 -0
- package/dist/chunk-XQ6L2CM5.js +83 -0
- package/dist/chunk-XQ6L2CM5.js.map +1 -0
- package/dist/{chunk-RKCUXOU2.js → chunk-YUVKROMA.js} +44 -7
- package/dist/chunk-YUVKROMA.js.map +1 -0
- package/dist/components/action-icon/action-icon.d.ts +9 -2
- package/dist/components/action-icon/action-icon.d.ts.map +1 -1
- package/dist/components/action-icon/index.js +5 -1
- package/dist/components/alert/index.js +4 -4
- package/dist/components/anchor/anchor.d.ts +45 -0
- package/dist/components/anchor/anchor.d.ts.map +1 -0
- package/dist/components/anchor/index.d.ts +2 -0
- package/dist/components/anchor/index.d.ts.map +1 -0
- package/dist/components/anchor/index.js +11 -0
- package/dist/components/anchor/index.js.map +1 -0
- package/dist/components/app-shell/app-shell.d.ts +10 -6
- package/dist/components/app-shell/app-shell.d.ts.map +1 -1
- package/dist/components/app-shell/index.js +23 -24
- package/dist/components/app-shell/index.js.map +1 -1
- package/dist/components/autocomplete/autocomplete.d.ts +1 -1
- package/dist/components/autocomplete/autocomplete.d.ts.map +1 -1
- package/dist/components/autocomplete/index.js +15 -9
- package/dist/components/autocomplete/index.js.map +1 -1
- package/dist/components/avatar/index.js +1 -1
- package/dist/components/button/button.d.ts +15 -2
- package/dist/components/button/button.d.ts.map +1 -1
- package/dist/components/button/index.js +5 -1
- package/dist/components/button-multi-select/index.js +6 -4
- package/dist/components/button-multi-select/index.js.map +1 -1
- package/dist/components/button-select/button-select-control.d.ts.map +1 -1
- package/dist/components/button-select/button-select.d.ts +2 -2
- package/dist/components/button-select/button-select.d.ts.map +1 -1
- package/dist/components/button-select/index.js +6 -4
- package/dist/components/button-select/index.js.map +1 -1
- package/dist/components/calendar/aliases.d.ts +16 -0
- package/dist/components/calendar/aliases.d.ts.map +1 -0
- package/dist/components/calendar/calendar-body.d.ts +11 -1
- package/dist/components/calendar/calendar-body.d.ts.map +1 -1
- package/dist/components/calendar/calendar.d.ts +8 -4
- package/dist/components/calendar/calendar.d.ts.map +1 -1
- package/dist/components/calendar/index.d.ts +2 -1
- package/dist/components/calendar/index.d.ts.map +1 -1
- package/dist/components/calendar/index.js +15 -5
- package/dist/components/calendar/index.js.map +1 -1
- package/dist/components/calendar-heatmap/calendar-heatmap.d.ts.map +1 -1
- package/dist/components/calendar-heatmap/index.js +85 -73
- package/dist/components/calendar-heatmap/index.js.map +1 -1
- package/dist/components/camera/index.js +16 -14
- package/dist/components/carousel/index.js +3 -3
- package/dist/components/checkbox/checkbox.d.ts.map +1 -1
- package/dist/components/checkbox/index.js +2 -2
- package/dist/components/choice-card-group/index.js +2 -2
- package/dist/components/choice-card-group/index.js.map +1 -1
- package/dist/components/circular-progress/circular-progress.d.ts +22 -11
- package/dist/components/circular-progress/circular-progress.d.ts.map +1 -1
- package/dist/components/circular-progress/index.d.ts +1 -1
- package/dist/components/circular-progress/index.d.ts.map +1 -1
- package/dist/components/circular-progress/index.js +68 -49
- package/dist/components/circular-progress/index.js.map +1 -1
- package/dist/components/clipboard/index.js +7 -3
- package/dist/components/clipboard/index.js.map +1 -1
- package/dist/components/code/code.d.ts +10 -0
- package/dist/components/code/code.d.ts.map +1 -1
- package/dist/components/code/index.js +1 -0
- package/dist/components/code/index.js.map +1 -1
- package/dist/components/code-block/chrome.js +10 -6
- package/dist/components/code-block/index.js +10 -7
- package/dist/components/code-block/index.js.map +1 -1
- package/dist/components/combobox/combobox.d.ts +5 -3
- package/dist/components/combobox/combobox.d.ts.map +1 -1
- package/dist/components/combobox/index.js +12 -7
- package/dist/components/combobox-list/combobox-list.d.ts +1 -1
- package/dist/components/combobox-list/combobox-list.d.ts.map +1 -1
- package/dist/components/combobox-list/index.js +14 -9
- package/dist/components/compare/index.js +1 -1
- package/dist/components/data-list/data-list.d.ts +96 -0
- package/dist/components/data-list/data-list.d.ts.map +1 -0
- package/dist/components/data-list/index.d.ts +2 -0
- package/dist/components/data-list/index.d.ts.map +1 -0
- package/dist/components/data-list/index.js +147 -0
- package/dist/components/data-list/index.js.map +1 -0
- package/dist/components/data-table/data-table-group.d.ts.map +1 -1
- package/dist/components/data-table/data-table-placeholder.d.ts +12 -1
- package/dist/components/data-table/data-table-placeholder.d.ts.map +1 -1
- package/dist/components/data-table/data-table-stack.d.ts.map +1 -1
- package/dist/components/data-table/data-table.d.ts +5 -2
- package/dist/components/data-table/data-table.d.ts.map +1 -1
- package/dist/components/data-table/index.js +163 -168
- package/dist/components/data-table/index.js.map +1 -1
- package/dist/components/date-picker/aliases.d.ts +16 -0
- package/dist/components/date-picker/aliases.d.ts.map +1 -1
- package/dist/components/date-picker/date-picker.d.ts +22 -8
- package/dist/components/date-picker/date-picker.d.ts.map +1 -1
- package/dist/components/date-picker/index.d.ts +2 -2
- package/dist/components/date-picker/index.d.ts.map +1 -1
- package/dist/components/date-picker/index.js +34 -28
- package/dist/components/date-picker/index.js.map +1 -1
- package/dist/components/download-button/index.js +6 -2
- package/dist/components/drawer/drawer.d.ts +7 -4
- package/dist/components/drawer/drawer.d.ts.map +1 -1
- package/dist/components/drawer/index.js +11 -6
- package/dist/components/empty-state/empty-state.d.ts +57 -0
- package/dist/components/empty-state/empty-state.d.ts.map +1 -0
- package/dist/components/empty-state/index.d.ts +2 -0
- package/dist/components/empty-state/index.d.ts.map +1 -0
- package/dist/components/empty-state/index.js +8 -0
- package/dist/components/empty-state/index.js.map +1 -0
- package/dist/components/field/field.d.ts +20 -0
- package/dist/components/field/field.d.ts.map +1 -1
- package/dist/components/field/index.js +1 -1
- package/dist/components/fieldset/fieldset.d.ts +103 -0
- package/dist/components/fieldset/fieldset.d.ts.map +1 -0
- package/dist/components/fieldset/index.d.ts +2 -0
- package/dist/components/fieldset/index.d.ts.map +1 -0
- package/dist/components/fieldset/index.js +150 -0
- package/dist/components/fieldset/index.js.map +1 -0
- package/dist/components/file-item/index.js +10 -7
- package/dist/components/file-preview/file-preview.d.ts.map +1 -1
- package/dist/components/file-preview/index.js +10 -18
- package/dist/components/file-preview/index.js.map +1 -1
- package/dist/components/file-trigger/index.js +6 -2
- package/dist/components/file-upload/file-upload.d.ts.map +1 -1
- package/dist/components/file-upload/index.js +18 -14
- package/dist/components/file-upload/index.js.map +1 -1
- package/dist/components/gallery/index.js +3 -3
- package/dist/components/geodesic/a11y.d.ts +3 -3
- package/dist/components/geodesic/a11y.d.ts.map +1 -1
- package/dist/components/hover-card/hover-card.d.ts.map +1 -1
- package/dist/components/hover-card/index.js +10 -3
- package/dist/components/hover-card/index.js.map +1 -1
- package/dist/components/image/index.js +3 -3
- package/dist/components/image-cropper/index.js +9 -6
- package/dist/components/input/index.js +2 -2
- package/dist/components/input/input.d.ts.map +1 -1
- package/dist/components/kbd/index.js +3 -3
- package/dist/components/kbd/kbd.d.ts +4 -0
- package/dist/components/kbd/kbd.d.ts.map +1 -1
- package/dist/components/lightbox/index.js +13 -11
- package/dist/components/lightbox/index.js.map +1 -1
- package/dist/components/menu/index.js +9 -5
- package/dist/components/menu/index.js.map +1 -1
- package/dist/components/menu/menu.d.ts.map +1 -1
- package/dist/components/modal/index.js +11 -6
- package/dist/components/modal/modal.d.ts +10 -4
- package/dist/components/modal/modal.d.ts.map +1 -1
- package/dist/components/multi-combobox-list/index.js +13 -9
- package/dist/components/multi-combobox-list/multi-combobox-list.d.ts +1 -1
- package/dist/components/multi-combobox-list/multi-combobox-list.d.ts.map +1 -1
- package/dist/components/multi-select/index.js +13 -10
- package/dist/components/multi-select/index.js.map +1 -1
- package/dist/components/multi-select/multi-select.d.ts +1 -1
- package/dist/components/multi-select/multi-select.d.ts.map +1 -1
- package/dist/components/nav-link/index.js +4 -4
- package/dist/components/nav-link/tanstack.js +4 -4
- package/dist/components/notification/index.js +6 -6
- package/dist/components/notification/index.js.map +1 -1
- package/dist/components/number-input/index.js +11 -7
- package/dist/components/number-input/number-input.d.ts +1 -1
- package/dist/components/number-input/number-input.d.ts.map +1 -1
- package/dist/components/overlays/dialog-parts.d.ts +10 -1
- package/dist/components/overlays/dialog-parts.d.ts.map +1 -1
- package/dist/components/overlays/index.js +13 -8
- package/dist/components/overlays/index.js.map +1 -1
- package/dist/components/pagination/index.d.ts +2 -0
- package/dist/components/pagination/index.d.ts.map +1 -0
- package/dist/components/pagination/index.js +362 -0
- package/dist/components/pagination/index.js.map +1 -0
- package/dist/components/pagination/pagination.d.ts +147 -0
- package/dist/components/pagination/pagination.d.ts.map +1 -0
- package/dist/components/password-input/index.js +6 -5
- package/dist/components/password-input/index.js.map +1 -1
- package/dist/components/password-input/password-input.d.ts +1 -1
- package/dist/components/password-input/password-input.d.ts.map +1 -1
- package/dist/components/phone-input/index.js +14 -11
- package/dist/components/phone-input/index.js.map +1 -1
- package/dist/components/phone-input/phone-input.d.ts +1 -1
- package/dist/components/phone-input/phone-input.d.ts.map +1 -1
- package/dist/components/photo-capture/index.js +19 -17
- package/dist/components/photo-capture/index.js.map +1 -1
- package/dist/components/pills-input/index.js +4 -4
- package/dist/components/pills-input/pills-input.d.ts +1 -1
- package/dist/components/pills-input/pills-input.d.ts.map +1 -1
- package/dist/components/pin-input/index.js +6 -5
- package/dist/components/pin-input/index.js.map +1 -1
- package/dist/components/pin-input/pin-input.d.ts.map +1 -1
- package/dist/components/popover/index.js +7 -2
- package/dist/components/popover/popover.d.ts +41 -16
- package/dist/components/popover/popover.d.ts.map +1 -1
- package/dist/components/progress/index.d.ts +1 -1
- package/dist/components/progress/index.d.ts.map +1 -1
- package/dist/components/progress/index.js +4 -1
- package/dist/components/progress/progress.d.ts +22 -14
- package/dist/components/progress/progress.d.ts.map +1 -1
- package/dist/components/prose/index.d.ts +2 -0
- package/dist/components/prose/index.d.ts.map +1 -0
- package/dist/components/prose/index.js +17 -0
- package/dist/components/prose/index.js.map +1 -0
- package/dist/components/prose/prose.d.ts +49 -0
- package/dist/components/prose/prose.d.ts.map +1 -0
- package/dist/components/prose/styles.css +593 -0
- package/dist/components/radio-group/index.js +9 -3
- package/dist/components/radio-group/index.js.map +1 -1
- package/dist/components/radio-group/radio-group.d.ts.map +1 -1
- package/dist/components/rating/index.js +3 -2
- package/dist/components/rating/index.js.map +1 -1
- package/dist/components/rating/rating.d.ts.map +1 -1
- package/dist/components/schedule/index.js +10 -8
- package/dist/components/schedule/index.js.map +1 -1
- package/dist/components/scroll-area/index.d.ts +2 -0
- package/dist/components/scroll-area/index.d.ts.map +1 -0
- package/dist/components/scroll-area/index.js +10 -0
- package/dist/components/scroll-area/index.js.map +1 -0
- package/dist/components/scroll-area/scroll-area.d.ts +150 -0
- package/dist/components/scroll-area/scroll-area.d.ts.map +1 -0
- package/dist/components/segment-group/index.js +2 -2
- package/dist/components/segment-group/segment-group.d.ts.map +1 -1
- package/dist/components/select/index.js +12 -8
- package/dist/components/select/select.d.ts +1 -1
- package/dist/components/select/select.d.ts.map +1 -1
- package/dist/components/slider/index.js +2 -2
- package/dist/components/slider/slider.d.ts.map +1 -1
- package/dist/components/splitter/index.d.ts +2 -0
- package/dist/components/splitter/index.d.ts.map +1 -0
- package/dist/components/splitter/index.js +373 -0
- package/dist/components/splitter/index.js.map +1 -0
- package/dist/components/splitter/splitter.d.ts +159 -0
- package/dist/components/splitter/splitter.d.ts.map +1 -0
- package/dist/components/spotlight/index.js +23 -22
- package/dist/components/spotlight/index.js.map +1 -1
- package/dist/components/spotlight/spotlight.d.ts.map +1 -1
- package/dist/components/steps/index.d.ts +4 -0
- package/dist/components/steps/index.d.ts.map +1 -0
- package/dist/components/steps/index.js +478 -0
- package/dist/components/steps/index.js.map +1 -0
- package/dist/components/steps/steps-data.d.ts +78 -0
- package/dist/components/steps/steps-data.d.ts.map +1 -0
- package/dist/components/steps/steps.d.ts +183 -0
- package/dist/components/steps/steps.d.ts.map +1 -0
- package/dist/components/switch/index.js +4 -3
- package/dist/components/switch/index.js.map +1 -1
- package/dist/components/switch/switch.d.ts.map +1 -1
- package/dist/components/table-of-contents/index.d.ts +2 -0
- package/dist/components/table-of-contents/index.d.ts.map +1 -0
- package/dist/components/table-of-contents/index.js +471 -0
- package/dist/components/table-of-contents/index.js.map +1 -0
- package/dist/components/table-of-contents/table-of-contents.d.ts +173 -0
- package/dist/components/table-of-contents/table-of-contents.d.ts.map +1 -0
- package/dist/components/tags-input/index.js +12 -9
- package/dist/components/tags-input/index.js.map +1 -1
- package/dist/components/tags-input/tags-input.d.ts +1 -1
- package/dist/components/tags-input/tags-input.d.ts.map +1 -1
- package/dist/components/text-input/index.js +2 -2
- package/dist/components/textarea/index.js +8 -6
- package/dist/components/textarea/index.js.map +1 -1
- package/dist/components/textarea/textarea.d.ts.map +1 -1
- package/dist/components/time-input/index.js +11 -9
- package/dist/components/time-input/index.js.map +1 -1
- package/dist/components/tooltip/index.js +1 -1
- package/dist/components/tooltip/tooltip.d.ts +3 -8
- package/dist/components/tooltip/tooltip.d.ts.map +1 -1
- package/dist/components/tour/conditions.d.ts +83 -0
- package/dist/components/tour/conditions.d.ts.map +1 -0
- package/dist/components/tour/create-tours.d.ts +49 -0
- package/dist/components/tour/create-tours.d.ts.map +1 -0
- package/dist/components/tour/index.d.ts +6 -0
- package/dist/components/tour/index.d.ts.map +1 -0
- package/dist/components/tour/index.js +1449 -0
- package/dist/components/tour/index.js.map +1 -0
- package/dist/components/tour/runtime.d.ts +57 -0
- package/dist/components/tour/runtime.d.ts.map +1 -0
- package/dist/components/tour/storage.d.ts +14 -0
- package/dist/components/tour/storage.d.ts.map +1 -0
- package/dist/components/tour/store.d.ts +62 -0
- package/dist/components/tour/store.d.ts.map +1 -0
- package/dist/components/tour/tour.d.ts +77 -0
- package/dist/components/tour/tour.d.ts.map +1 -0
- package/dist/components/tour/types.d.ts +680 -0
- package/dist/components/tour/types.d.ts.map +1 -0
- package/dist/components/tree/index.d.ts +3 -0
- package/dist/components/tree/index.d.ts.map +1 -0
- package/dist/components/tree/index.js +457 -0
- package/dist/components/tree/index.js.map +1 -0
- package/dist/components/tree/tree-row.d.ts +72 -0
- package/dist/components/tree/tree-row.d.ts.map +1 -0
- package/dist/components/tree/tree.d.ts +193 -0
- package/dist/components/tree/tree.d.ts.map +1 -0
- package/dist/components/tree-multi-select/index.js +31 -54
- package/dist/components/tree-multi-select/index.js.map +1 -1
- package/dist/components/tree-multi-select/tree-multi-select.d.ts +16 -1
- package/dist/components/tree-multi-select/tree-multi-select.d.ts.map +1 -1
- package/dist/components/tree-select/index.js +30 -24
- package/dist/components/tree-select/index.js.map +1 -1
- package/dist/components/tree-select/tree-popover.d.ts +20 -31
- package/dist/components/tree-select/tree-popover.d.ts.map +1 -1
- package/dist/components/tree-select/tree-select.d.ts +1 -1
- package/dist/components/tree-select/tree-select.d.ts.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -8
- package/dist/index.js.map +1 -1
- package/dist/lib/date-predicates.d.ts +7 -5
- package/dist/lib/date-predicates.d.ts.map +1 -1
- package/dist/lib/date-value.d.ts +20 -0
- package/dist/lib/date-value.d.ts.map +1 -1
- package/dist/lib/floating-arrow.d.ts +53 -0
- package/dist/lib/floating-arrow.d.ts.map +1 -0
- package/dist/lib/focus-return.d.ts +53 -0
- package/dist/lib/focus-return.d.ts.map +1 -0
- package/dist/lib/meter.d.ts +104 -0
- package/dist/lib/meter.d.ts.map +1 -0
- package/dist/lib/overlay-layer.d.ts +26 -8
- package/dist/lib/overlay-layer.d.ts.map +1 -1
- package/dist/lib/pressed.d.ts +92 -0
- package/dist/lib/pressed.d.ts.map +1 -0
- package/dist/lib/tree-data.d.ts +18 -2
- package/dist/lib/tree-data.d.ts.map +1 -1
- package/dist/lib/use-pagination.d.ts +102 -0
- package/dist/lib/use-pagination.d.ts.map +1 -0
- package/dist/lib/use-scroll-spy.d.ts +126 -0
- package/dist/lib/use-scroll-spy.d.ts.map +1 -0
- package/dist/theme.css +39 -3
- package/package.json +1 -1
- package/src/as-child.contract.test.tsx +283 -1
- package/src/components/action-icon/action-icon.tsx +34 -4
- package/src/components/anchor/anchor.test.tsx +232 -0
- package/src/components/anchor/anchor.tsx +187 -0
- package/src/components/anchor/index.ts +12 -0
- package/src/components/app-shell/app-shell.test.tsx +15 -7
- package/src/components/app-shell/app-shell.tsx +27 -20
- package/src/components/autocomplete/autocomplete.tsx +11 -3
- package/src/components/button/button-pressed.test.tsx +202 -0
- package/src/components/button/button.tsx +48 -6
- package/src/components/button-select/button-select-control.tsx +2 -2
- package/src/components/button-select/button-select.tsx +22 -2
- package/src/components/calendar/aliases.tsx +28 -0
- package/src/components/calendar/calendar-body.tsx +310 -210
- package/src/components/calendar/calendar.tsx +43 -12
- package/src/components/calendar/index.ts +7 -1
- package/src/components/calendar/month-year-calendar.test.tsx +106 -0
- package/src/components/calendar-heatmap/calendar-heatmap.tsx +88 -73
- package/src/components/checkbox/checkbox.tsx +7 -2
- package/src/components/choice-card-group/choice-card-group.tsx +2 -2
- package/src/components/circular-progress/circular-progress.test.tsx +35 -0
- package/src/components/circular-progress/circular-progress.tsx +116 -59
- package/src/components/circular-progress/index.ts +1 -0
- package/src/components/code/code.test.tsx +16 -0
- package/src/components/code/code.tsx +11 -0
- package/src/components/combobox/combobox.tsx +63 -28
- package/src/components/combobox-list/combobox-list.tsx +11 -3
- package/src/components/data-list/data-list.test.tsx +149 -0
- package/src/components/data-list/data-list.tsx +268 -0
- package/src/components/data-list/index.ts +9 -0
- package/src/components/data-table/data-table-group.test.tsx +16 -0
- package/src/components/data-table/data-table-group.tsx +15 -2
- package/src/components/data-table/data-table-placeholder.tsx +28 -36
- package/src/components/data-table/data-table-stack.tsx +33 -39
- package/src/components/data-table/data-table.test.tsx +31 -0
- package/src/components/data-table/data-table.tsx +41 -42
- package/src/components/date-picker/aliases.tsx +28 -0
- package/src/components/date-picker/date-picker.test.tsx +29 -0
- package/src/components/date-picker/date-picker.tsx +164 -45
- package/src/components/date-picker/index.ts +5 -1
- package/src/components/date-picker/month-year-picker.test.tsx +362 -0
- package/src/components/drawer/drawer.test.tsx +41 -0
- package/src/components/drawer/drawer.tsx +7 -1
- package/src/components/empty-state/empty-state.test.tsx +109 -0
- package/src/components/empty-state/empty-state.tsx +180 -0
- package/src/components/empty-state/index.ts +9 -0
- package/src/components/field/field.tsx +35 -1
- package/src/components/fieldset/fieldset.test.tsx +352 -0
- package/src/components/fieldset/fieldset.tsx +268 -0
- package/src/components/fieldset/index.ts +11 -0
- package/src/components/file-preview/file-preview.test.tsx +2 -1
- package/src/components/file-preview/file-preview.tsx +7 -13
- package/src/components/file-upload/file-upload.tsx +14 -5
- package/src/components/hover-card/hover-card.tsx +5 -1
- package/src/components/input/input.tsx +12 -5
- package/src/components/kbd/kbd.test.tsx +13 -0
- package/src/components/kbd/kbd.tsx +6 -0
- package/src/components/menu/menu.tsx +6 -2
- package/src/components/modal/modal.test.tsx +41 -0
- package/src/components/modal/modal.tsx +17 -9
- package/src/components/multi-combobox-list/multi-combobox-list.tsx +11 -3
- package/src/components/multi-select/multi-select.tsx +11 -3
- package/src/components/notification/create-notifier.tsx +1 -1
- package/src/components/number-input/number-input.tsx +12 -3
- package/src/components/overlays/dialog-parts.tsx +42 -5
- package/src/components/pagination/index.ts +19 -0
- package/src/components/pagination/pagination.test.tsx +187 -0
- package/src/components/pagination/pagination.tsx +563 -0
- package/src/components/password-input/password-input.tsx +12 -3
- package/src/components/phone-input/phone-input.tsx +12 -3
- package/src/components/pills-input/pills-input.tsx +7 -2
- package/src/components/pin-input/pin-input.tsx +13 -4
- package/src/components/popover/popover.tsx +87 -17
- package/src/components/progress/index.ts +1 -0
- package/src/components/progress/progress.test.tsx +102 -0
- package/src/components/progress/progress.tsx +116 -62
- package/src/components/prose/index.ts +1 -0
- package/src/components/prose/prose.test.tsx +90 -0
- package/src/components/prose/prose.tsx +60 -0
- package/src/components/prose/styles.css +593 -0
- package/src/components/radio-group/radio-group.tsx +8 -3
- package/src/components/rating/rating.tsx +5 -2
- package/src/components/scroll-area/index.ts +18 -0
- package/src/components/scroll-area/scroll-area.test.tsx +184 -0
- package/src/components/scroll-area/scroll-area.tsx +448 -0
- package/src/components/segment-group/segment-group.tsx +2 -2
- package/src/components/select/select.tsx +37 -18
- package/src/components/slider/slider.tsx +2 -2
- package/src/components/splitter/index.ts +15 -0
- package/src/components/splitter/splitter.test.tsx +244 -0
- package/src/components/splitter/splitter.tsx +625 -0
- package/src/components/spotlight/spotlight.test.tsx +34 -26
- package/src/components/spotlight/spotlight.tsx +7 -9
- package/src/components/steps/index.ts +21 -0
- package/src/components/steps/steps-data.tsx +179 -0
- package/src/components/steps/steps.test.tsx +235 -0
- package/src/components/steps/steps.tsx +686 -0
- package/src/components/switch/switch.tsx +7 -2
- package/src/components/table-of-contents/index.ts +17 -0
- package/src/components/table-of-contents/table-of-contents.test.tsx +289 -0
- package/src/components/table-of-contents/table-of-contents.tsx +708 -0
- package/src/components/tags-input/tags-input.tsx +12 -3
- package/src/components/textarea/textarea.tsx +15 -5
- package/src/components/tooltip/tooltip.tsx +8 -17
- package/src/components/tour/conditions.test.ts +527 -0
- package/src/components/tour/conditions.ts +445 -0
- package/src/components/tour/create-tours.tsx +150 -0
- package/src/components/tour/index.ts +86 -0
- package/src/components/tour/runtime.ts +187 -0
- package/src/components/tour/storage.test.ts +68 -0
- package/src/components/tour/storage.ts +44 -0
- package/src/components/tour/store.test.tsx +784 -0
- package/src/components/tour/store.ts +661 -0
- package/src/components/tour/tour.test.tsx +318 -0
- package/src/components/tour/tour.tsx +773 -0
- package/src/components/tour/tour.types.test.ts +185 -0
- package/src/components/tour/types.ts +904 -0
- package/src/components/tree/index.ts +24 -0
- package/src/components/tree/tree-row.tsx +179 -0
- package/src/components/tree/tree.test.tsx +296 -0
- package/src/components/tree/tree.tsx +796 -0
- package/src/components/tree-multi-select/tree-multi-select.tsx +29 -58
- package/src/components/tree-select/tree-popover.tsx +26 -107
- package/src/components/tree-select/tree-select.tsx +24 -16
- package/src/icon-stroke.test.tsx +2 -0
- package/src/index.ts +16 -0
- package/src/lib/date-predicates.test.ts +46 -0
- package/src/lib/date-predicates.ts +44 -24
- package/src/lib/date-value.test.ts +24 -1
- package/src/lib/date-value.ts +42 -1
- package/src/lib/floating-arrow.tsx +73 -0
- package/src/lib/focus-return.test.tsx +143 -0
- package/src/lib/focus-return.ts +106 -0
- package/src/lib/meter.test.ts +40 -0
- package/src/lib/meter.ts +159 -0
- package/src/lib/overlay-layer.test.tsx +47 -1
- package/src/lib/overlay-layer.tsx +65 -8
- package/src/lib/pressed.ts +130 -0
- package/src/lib/tree-data.ts +42 -2
- package/src/lib/use-pagination.test.ts +105 -0
- package/src/lib/use-pagination.ts +179 -0
- package/src/lib/use-scroll-spy.test.tsx +238 -0
- package/src/lib/use-scroll-spy.ts +336 -0
- package/src/theme.css +39 -3
- package/src/theme.test.ts +29 -1
- package/src/visually-hidden-containment.test.tsx +9 -0
- package/dist/chunk-2W7H43WL.js.map +0 -1
- package/dist/chunk-7E7JNWOC.js.map +0 -1
- package/dist/chunk-7FPSQBWB.js.map +0 -1
- package/dist/chunk-7KFUFAVP.js.map +0 -1
- package/dist/chunk-AKXALCUN.js.map +0 -1
- package/dist/chunk-B5YHYI7E.js.map +0 -1
- package/dist/chunk-FQJNQW3G.js.map +0 -1
- package/dist/chunk-G3AD3NJG.js.map +0 -1
- package/dist/chunk-GEZYGBXY.js.map +0 -1
- package/dist/chunk-HCHGERDB.js.map +0 -1
- package/dist/chunk-HWBFRDX7.js.map +0 -1
- package/dist/chunk-I4B3N3UX.js.map +0 -1
- package/dist/chunk-IA6DCC3N.js.map +0 -1
- package/dist/chunk-IANYMDKH.js.map +0 -1
- package/dist/chunk-MQHD3EJE.js.map +0 -1
- package/dist/chunk-NNPSBC7O.js.map +0 -1
- package/dist/chunk-OXR7BXZA.js.map +0 -1
- package/dist/chunk-QKSLDQM2.js +0 -120
- package/dist/chunk-QKSLDQM2.js.map +0 -1
- package/dist/chunk-QRNQQIQM.js.map +0 -1
- package/dist/chunk-RKCUXOU2.js.map +0 -1
- package/dist/chunk-S5CQRCTF.js +0 -426
- package/dist/chunk-S5CQRCTF.js.map +0 -1
- package/dist/chunk-SBZJGFZ6.js.map +0 -1
- package/dist/chunk-SP6LCCTZ.js.map +0 -1
- package/dist/chunk-TUP7WXQE.js.map +0 -1
- package/dist/chunk-V2QZG4IT.js.map +0 -1
- package/dist/chunk-X6DESK37.js.map +0 -1
- package/dist/chunk-ZB5VMGKB.js.map +0 -1
|
@@ -11,16 +11,22 @@ import {
|
|
|
11
11
|
buildMaps,
|
|
12
12
|
filterTree,
|
|
13
13
|
flattenTree,
|
|
14
|
+
getCheckState,
|
|
14
15
|
isLeaf,
|
|
15
16
|
type RenderTreeMultiSelectItem,
|
|
16
17
|
type TreeNodeData,
|
|
17
18
|
type TreePayload,
|
|
18
19
|
type TreeSelectData,
|
|
19
20
|
type TreeValue,
|
|
21
|
+
toggleChecked,
|
|
20
22
|
} from "../../lib/tree-data"
|
|
21
23
|
import { useUncontrolled } from "../../lib/use-uncontrolled"
|
|
22
|
-
import {
|
|
23
|
-
|
|
24
|
+
import {
|
|
25
|
+
type FieldProps,
|
|
26
|
+
FieldShell,
|
|
27
|
+
useInheritedDisabled,
|
|
28
|
+
useInheritedInvalid,
|
|
29
|
+
} from "../field/field"
|
|
24
30
|
import { type InputSize, type InputVariant, inputShell, placeholderColor } from "../input/input"
|
|
25
31
|
import type { MultiSelectTranslations } from "../multi-select/multi-select"
|
|
26
32
|
import { Pill } from "../pill/pill"
|
|
@@ -32,16 +38,13 @@ import {
|
|
|
32
38
|
} from "../pills-input/pills-input"
|
|
33
39
|
import { CheckIcon, ChevronIcon, CloseIcon, MinusIcon } from "../popover/icons"
|
|
34
40
|
import { Popover } from "../popover/popover"
|
|
41
|
+
import { TreeCheckMark, TreeLabel, type TreePosition, TreeRow } from "../tree/tree-row"
|
|
35
42
|
import {
|
|
36
43
|
renderTree,
|
|
37
44
|
TreeBody,
|
|
38
|
-
TreeLabel,
|
|
39
|
-
type TreePosition,
|
|
40
|
-
TreeRails,
|
|
41
45
|
TreeSearch,
|
|
42
46
|
TreeTrigger,
|
|
43
47
|
treeItemAria,
|
|
44
|
-
treeRow,
|
|
45
48
|
useTreeRovingFocus,
|
|
46
49
|
} from "../tree-select/tree-popover"
|
|
47
50
|
import type { TreeSelectTranslations } from "../tree-select/tree-select"
|
|
@@ -62,38 +65,6 @@ import type { TreeSelectTranslations } from "../tree-select/tree-select"
|
|
|
62
65
|
* - For a single-value tree picker, use `TreeSelect`.
|
|
63
66
|
*/
|
|
64
67
|
|
|
65
|
-
type NodeState = "checked" | "indeterminate" | "unchecked"
|
|
66
|
-
|
|
67
|
-
/** Every *enabled* leaf value under `node` (the node itself when it's a leaf). */
|
|
68
|
-
const getLeafValues = (node: TreeNodeData, acc: string[] = []): string[] => {
|
|
69
|
-
if (isLeaf(node)) {
|
|
70
|
-
if (!node.disabled) acc.push(node.value)
|
|
71
|
-
return acc
|
|
72
|
-
}
|
|
73
|
-
if (node.children) for (const child of node.children) getLeafValues(child, acc)
|
|
74
|
-
return acc
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
/** Tri-state of a node, derived from the set of selected leaf values. */
|
|
78
|
-
const getNodeState = (node: TreeNodeData, selected: Set<string>): NodeState => {
|
|
79
|
-
const leaves = getLeafValues(node)
|
|
80
|
-
if (leaves.length === 0) return "unchecked"
|
|
81
|
-
let on = 0
|
|
82
|
-
for (const v of leaves) if (selected.has(v)) on++
|
|
83
|
-
if (on === 0) return "unchecked"
|
|
84
|
-
return on === leaves.length ? "checked" : "indeterminate"
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
/** Toggle a node: fully-checked clears its leaves, otherwise selects them all. */
|
|
88
|
-
const toggleNode = (node: TreeNodeData, current: string[]): string[] => {
|
|
89
|
-
const leaves = getLeafValues(node)
|
|
90
|
-
if (leaves.length === 0) return current
|
|
91
|
-
const set = new Set(current)
|
|
92
|
-
const fullyChecked = leaves.every((v) => set.has(v))
|
|
93
|
-
for (const v of leaves) fullyChecked ? set.delete(v) : set.add(v)
|
|
94
|
-
return [...set]
|
|
95
|
-
}
|
|
96
|
-
|
|
97
68
|
type TreeMultiSelectClassNames = {
|
|
98
69
|
field?: string
|
|
99
70
|
trigger?: string
|
|
@@ -211,7 +182,7 @@ export const TreeMultiSelect = <const Data extends TreeSelectData = TreeNodeData
|
|
|
211
182
|
size = "md",
|
|
212
183
|
variant = "default",
|
|
213
184
|
color,
|
|
214
|
-
disabled,
|
|
185
|
+
disabled: disabledProp,
|
|
215
186
|
readOnly,
|
|
216
187
|
required,
|
|
217
188
|
invalid,
|
|
@@ -227,6 +198,9 @@ export const TreeMultiSelect = <const Data extends TreeSelectData = TreeNodeData
|
|
|
227
198
|
translations,
|
|
228
199
|
icons: iconsProp,
|
|
229
200
|
}: TreeMultiSelectProps<Data>) => {
|
|
201
|
+
// A `Field` or `Fieldset` around the picker disables it too: the trigger is a
|
|
202
|
+
// plain `<div>`, which neither the `<fieldset>` nor an Ark machine reaches.
|
|
203
|
+
const disabled = useInheritedDisabled(disabledProp)
|
|
230
204
|
const icons = mergeIcons(DEFAULT_ICONS, iconsProp)
|
|
231
205
|
const resolvedTranslations = { ...TREE_MULTI_SELECT_DEFAULT_TRANSLATIONS, ...translations }
|
|
232
206
|
const [value, setValue] = useUncontrolled<TreeValue<Data>[]>({
|
|
@@ -241,7 +215,7 @@ export const TreeMultiSelect = <const Data extends TreeSelectData = TreeNodeData
|
|
|
241
215
|
|
|
242
216
|
// Red state is driven independently of the `Field` error slot so a form
|
|
243
217
|
// library can flip it from `fieldState.invalid` (see FormControlProps).
|
|
244
|
-
const isInvalid = invalid || error != null
|
|
218
|
+
const isInvalid = useInheritedInvalid(invalid || error != null)
|
|
245
219
|
|
|
246
220
|
const { labelMap, nodeMap } = useMemo(() => buildMaps(data), [data])
|
|
247
221
|
const labelSearch = useLabelSearch()
|
|
@@ -253,7 +227,7 @@ export const TreeMultiSelect = <const Data extends TreeSelectData = TreeNodeData
|
|
|
253
227
|
const flat = useMemo(() => flattenTree(filteredData, !!disabled), [filteredData, disabled])
|
|
254
228
|
const enabledValues = useMemo(() => flat.filter((f) => !f.disabled).map((f) => f.value), [flat])
|
|
255
229
|
|
|
256
|
-
const toggle = (node: TreeNodeData) => setValue(
|
|
230
|
+
const toggle = (node: TreeNodeData) => setValue(toggleChecked(node, value) as TreeValue<Data>[])
|
|
257
231
|
const removeValue = (v: string) => setValue(value.filter((x) => x !== v))
|
|
258
232
|
|
|
259
233
|
const { activeValue, setActiveValue, searchRef, rowProps, onTreeKeyDown, onSearchKeyDown } =
|
|
@@ -277,7 +251,7 @@ export const TreeMultiSelect = <const Data extends TreeSelectData = TreeNodeData
|
|
|
277
251
|
// Render structure comes from the (possibly filtered) node, but cascade
|
|
278
252
|
// state is derived from the original node so hidden leaves still count.
|
|
279
253
|
const source = nodeMap.get(node.value) ?? node
|
|
280
|
-
const state =
|
|
254
|
+
const state = getCheckState(source, selectedSet)
|
|
281
255
|
const checked = state === "checked"
|
|
282
256
|
const mixed = state === "indeterminate"
|
|
283
257
|
const nodeDisabled = disabled || node.disabled
|
|
@@ -295,25 +269,21 @@ export const TreeMultiSelect = <const Data extends TreeSelectData = TreeNodeData
|
|
|
295
269
|
})
|
|
296
270
|
) : (
|
|
297
271
|
<>
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
>
|
|
306
|
-
{checked && icons.check}
|
|
307
|
-
{mixed && icons.indeterminate}
|
|
308
|
-
</span>
|
|
272
|
+
<TreeCheckMark
|
|
273
|
+
checked={checked}
|
|
274
|
+
indeterminate={mixed}
|
|
275
|
+
size={size}
|
|
276
|
+
icons={icons}
|
|
277
|
+
className={classNames?.checkbox}
|
|
278
|
+
/>
|
|
309
279
|
|
|
310
280
|
<TreeLabel className={classNames?.label}>{node.label}</TreeLabel>
|
|
311
281
|
</>
|
|
312
282
|
)
|
|
313
283
|
|
|
314
284
|
return (
|
|
315
|
-
//
|
|
316
|
-
<
|
|
285
|
+
// Enter / Space are handled centrally by the tree's onKeyDown (roving focus).
|
|
286
|
+
<TreeRow
|
|
317
287
|
role="treeitem"
|
|
318
288
|
{...treeItemAria(position)}
|
|
319
289
|
aria-checked={mixed ? "mixed" : checked}
|
|
@@ -331,11 +301,12 @@ export const TreeMultiSelect = <const Data extends TreeSelectData = TreeNodeData
|
|
|
331
301
|
setActiveValue(node.value)
|
|
332
302
|
toggle(source)
|
|
333
303
|
}}
|
|
334
|
-
|
|
304
|
+
position={position}
|
|
305
|
+
size={size}
|
|
306
|
+
className={classNames?.node}
|
|
335
307
|
>
|
|
336
|
-
<TreeRails {...position} />
|
|
337
308
|
{content}
|
|
338
|
-
</
|
|
309
|
+
</TreeRow>
|
|
339
310
|
)
|
|
340
311
|
}
|
|
341
312
|
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use client"
|
|
2
2
|
|
|
3
3
|
import { useFieldContext } from "@ark-ui/react/field"
|
|
4
|
-
import { cva } from "class-variance-authority"
|
|
5
4
|
import {
|
|
6
5
|
type ComponentProps,
|
|
7
6
|
Fragment,
|
|
@@ -14,78 +13,36 @@ import {
|
|
|
14
13
|
} from "react"
|
|
15
14
|
import { cn } from "../../lib/cn"
|
|
16
15
|
import type { Color } from "../../lib/colors"
|
|
17
|
-
import { focusStyles } from "../../lib/focus-styles"
|
|
18
16
|
import { props } from "../../lib/props"
|
|
19
17
|
import type { ClearSectionMode } from "../../lib/select-data"
|
|
20
18
|
import type { WithTestId } from "../../lib/test-id"
|
|
21
19
|
import type { TreeNodeData } from "../../lib/tree-data"
|
|
22
|
-
import { TEXT_COLOR_CLASSES } from "../../lib/typography-size"
|
|
23
20
|
import { fieldA11yProps } from "../field/field"
|
|
24
21
|
import { inputControlClasses, inputSlot } from "../input/input"
|
|
25
22
|
import { Popover, popoverChevron, popoverClearTrigger, popoverEmpty } from "../popover/popover"
|
|
23
|
+
import { type TreePosition, treePositions } from "../tree/tree-row"
|
|
26
24
|
|
|
27
25
|
/**
|
|
28
|
-
* The internals `TreeSelect` and `TreeMultiSelect` share
|
|
29
|
-
*
|
|
30
|
-
* roving focus (arrows, Home / End, type-ahead). Each
|
|
31
|
-
* differs: what a row shows, and what activating one does.
|
|
26
|
+
* The internals `TreeSelect` and `TreeMultiSelect` share on top of the kit's tree row
|
|
27
|
+
* (`tree/tree-row.tsx`, which `Tree` draws too): the flat walk, the combobox trigger, the
|
|
28
|
+
* search header, the tree body and the roving focus (arrows, Home / End, type-ahead). Each
|
|
29
|
+
* picker keeps only what differs: what a row shows, and what activating one does.
|
|
30
|
+
*
|
|
31
|
+
* Why the pickers don't run on Ark's `tree-view` machine, like `Tree` does (checked against
|
|
32
|
+
* `@zag-js/tree-view` 1.43):
|
|
33
|
+
* - Its arrow keys, Home / End and type-ahead walk every visible node, branches included
|
|
34
|
+
* (`collection.getNextNode` with a `skip` that only hides collapsed subtrees, not a
|
|
35
|
+
* prop). TreeSelect's focus visits selectable leaves only.
|
|
36
|
+
* - Enter, Space and a click on a branch send `BRANCH_NODE.CLICK`, which selects the
|
|
37
|
+
* branch and, with `expandOnClick`, collapses it; ← / → collapse and expand. The pickers'
|
|
38
|
+
* trees are always fully expanded: a branch is organizational (TreeSelect) or a cascade
|
|
39
|
+
* checkbox (TreeMultiSelect), and ← / → do nothing.
|
|
40
|
+
* - Its branch `treeitem` wraps the branch's `role="button"` control and a `role="group"`
|
|
41
|
+
* of its children. The pickers' tree is one flat list of `treeitem`s, its hierarchy
|
|
42
|
+
* carried by `aria-level`: that nesting would change their accessibility tree.
|
|
43
|
+
* - Its type-ahead matches disabled nodes too (`visibleNodes`); the pickers' skips them.
|
|
32
44
|
*/
|
|
33
45
|
|
|
34
|
-
/** Indent guide / connector colour, shared by rails and the elbow. */
|
|
35
|
-
const treeLine = "bg-brand-900/20 dark:bg-white/15"
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* One tree row. `interactive` rows (every TreeMultiSelect row, TreeSelect's
|
|
39
|
-
* leaves) take roving focus and hover/active surfaces: neutral and
|
|
40
|
-
* transparent, a low-opacity black/white wash rather than an opaque gray,
|
|
41
|
-
* matching the popover surface's own background-dependent tint (no Figma
|
|
42
|
-
* reference for this state yet). The others are TreeSelect's branches:
|
|
43
|
-
* organizational, present for structure and levels, never focused.
|
|
44
|
-
*/
|
|
45
|
-
export const treeRow = cva(
|
|
46
|
-
["group/row relative flex w-full items-center rounded-sm ps-1.5 outline-none select-none"],
|
|
47
|
-
{
|
|
48
|
-
variants: {
|
|
49
|
-
size: {
|
|
50
|
-
xs: "min-h-7 pe-1.5 text-xs",
|
|
51
|
-
sm: "min-h-8 pe-2 text-sm",
|
|
52
|
-
md: "min-h-9 pe-2 text-md",
|
|
53
|
-
lg: "min-h-10 pe-2.5 text-lg",
|
|
54
|
-
xl: "min-h-11 pe-3 text-xl",
|
|
55
|
-
},
|
|
56
|
-
interactive: {
|
|
57
|
-
true: [
|
|
58
|
-
"cursor-pointer",
|
|
59
|
-
TEXT_COLOR_CLASSES.primary,
|
|
60
|
-
"hover:bg-black/5 dark:hover:bg-white/8",
|
|
61
|
-
"data-active:bg-black/5 dark:data-active:bg-white/8",
|
|
62
|
-
"data-disabled:pointer-events-none data-disabled:opacity-50",
|
|
63
|
-
// Palette, not brand: the focused row is also the active one, and brand-500
|
|
64
|
-
// measured 2.73:1 against that light fill. `--c-text` (the popover's
|
|
65
|
-
// `data-color`, neutral by default) clears it in both themes.
|
|
66
|
-
focusStyles({ ring: "palette", offset: false, inset: true }),
|
|
67
|
-
],
|
|
68
|
-
false: ["cursor-default font-medium", TEXT_COLOR_CLASSES.secondary],
|
|
69
|
-
},
|
|
70
|
-
},
|
|
71
|
-
defaultVariants: { size: "md", interactive: true },
|
|
72
|
-
},
|
|
73
|
-
)
|
|
74
|
-
|
|
75
|
-
/** Where a node sits in the rendered tree: what its rails and set position need. */
|
|
76
|
-
export type TreePosition = {
|
|
77
|
-
/** 0-based; the row renders `aria-level={depth + 1}`. */
|
|
78
|
-
depth: number
|
|
79
|
-
/** Per ancestor below the top level: whether it has a sibling after it (its rail continues). */
|
|
80
|
-
ancestorHasNextSibling: boolean[]
|
|
81
|
-
/** Last among its siblings: the connector stops at the elbow. */
|
|
82
|
-
isLast: boolean
|
|
83
|
-
/** 1-based index among its siblings. */
|
|
84
|
-
posinset: number
|
|
85
|
-
/** Number of siblings, itself included. */
|
|
86
|
-
setsize: number
|
|
87
|
-
}
|
|
88
|
-
|
|
89
46
|
/**
|
|
90
47
|
* Walk `nodes` depth-first, rendering each through `row` with its position,
|
|
91
48
|
* its subtree flattened right after it: the tree is one flat list of rows,
|
|
@@ -94,30 +51,19 @@ export type TreePosition = {
|
|
|
94
51
|
export const renderTree = <P,>(
|
|
95
52
|
nodes: ReadonlyArray<TreeNodeData<P>>,
|
|
96
53
|
row: (node: TreeNodeData<P>, position: TreePosition) => ReactNode,
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
nodes.map((node, i) => {
|
|
101
|
-
const position =
|
|
102
|
-
depth,
|
|
103
|
-
ancestorHasNextSibling,
|
|
104
|
-
isLast: i === nodes.length - 1,
|
|
105
|
-
posinset: i + 1,
|
|
106
|
-
setsize: nodes.length,
|
|
107
|
-
}
|
|
54
|
+
parent?: TreePosition,
|
|
55
|
+
): ReactNode => {
|
|
56
|
+
const positions = treePositions(nodes.length, parent)
|
|
57
|
+
return nodes.map((node, i) => {
|
|
58
|
+
const position = positions[i] as TreePosition
|
|
108
59
|
return (
|
|
109
60
|
<Fragment key={node.value}>
|
|
110
61
|
{row(node, position)}
|
|
111
|
-
{node.children &&
|
|
112
|
-
renderTree(
|
|
113
|
-
node.children,
|
|
114
|
-
row,
|
|
115
|
-
depth + 1,
|
|
116
|
-
depth === 0 ? [] : [...ancestorHasNextSibling, !position.isLast],
|
|
117
|
-
)}
|
|
62
|
+
{node.children && renderTree(node.children, row, position)}
|
|
118
63
|
</Fragment>
|
|
119
64
|
)
|
|
120
65
|
})
|
|
66
|
+
}
|
|
121
67
|
|
|
122
68
|
/** A row's level and set position. The tree renders flat, so the browser can't derive them. */
|
|
123
69
|
export const treeItemAria = ({ depth, setsize, posinset }: TreePosition) => ({
|
|
@@ -126,33 +72,6 @@ export const treeItemAria = ({ depth, setsize, posinset }: TreePosition) => ({
|
|
|
126
72
|
"aria-posinset": posinset,
|
|
127
73
|
})
|
|
128
74
|
|
|
129
|
-
/** The indent guides before a row's content. Top-level rows sit flush. */
|
|
130
|
-
export const TreeRails = ({ depth, ancestorHasNextSibling, isLast }: TreePosition) =>
|
|
131
|
-
depth > 0 && (
|
|
132
|
-
<>
|
|
133
|
-
{/* ancestor rails: a vertical guide where that ancestor has a sibling below */}
|
|
134
|
-
{ancestorHasNextSibling.map((hasNext, i) => (
|
|
135
|
-
// biome-ignore lint/suspicious/noArrayIndexKey: Indentation is stable inside component, we would want to rerender anyway.
|
|
136
|
-
<span key={i} aria-hidden className="relative w-4 shrink-0 self-stretch">
|
|
137
|
-
{hasNext && <span className={cn("absolute inset-y-0 inset-s-1/2 w-px", treeLine)} />}
|
|
138
|
-
</span>
|
|
139
|
-
))}
|
|
140
|
-
|
|
141
|
-
{/* connector: vertical (├ continues / └ stops) + horizontal elbow */}
|
|
142
|
-
<span aria-hidden className="relative w-4 shrink-0 self-stretch">
|
|
143
|
-
<span
|
|
144
|
-
className={cn("absolute inset-s-1/2 top-0 w-px", treeLine, isLast ? "h-1/2" : "bottom-0")}
|
|
145
|
-
/>
|
|
146
|
-
<span className={cn("absolute inset-s-1/2 top-1/2 h-px w-1/2", treeLine)} />
|
|
147
|
-
</span>
|
|
148
|
-
</>
|
|
149
|
-
)
|
|
150
|
-
|
|
151
|
-
/** A row's default label, after the rails. */
|
|
152
|
-
export const TreeLabel = ({ className, children }: { className?: string; children: ReactNode }) => (
|
|
153
|
-
<span className={cn("ms-1.5 min-w-0 flex-1 truncate text-start", className)}>{children}</span>
|
|
154
|
-
)
|
|
155
|
-
|
|
156
75
|
type TreeTriggerProps = Omit<ComponentProps<"div">, "role" | "tabIndex" | "color"> &
|
|
157
76
|
WithTestId & {
|
|
158
77
|
open: boolean
|
|
@@ -20,20 +20,22 @@ import {
|
|
|
20
20
|
} from "../../lib/tree-data"
|
|
21
21
|
import { useUncontrolled } from "../../lib/use-uncontrolled"
|
|
22
22
|
import type { ComboboxTranslations } from "../combobox/combobox"
|
|
23
|
-
import {
|
|
23
|
+
import {
|
|
24
|
+
type FieldProps,
|
|
25
|
+
FieldShell,
|
|
26
|
+
useInheritedDisabled,
|
|
27
|
+
useInheritedInvalid,
|
|
28
|
+
} from "../field/field"
|
|
24
29
|
import { type InputSize, type InputVariant, inputShell, placeholderColor } from "../input/input"
|
|
25
30
|
import { CheckIcon, ChevronIcon, CloseIcon } from "../popover/icons"
|
|
26
31
|
import { Popover, popoverIndicator } from "../popover/popover"
|
|
32
|
+
import { TreeLabel, type TreePosition, TreeRow } from "../tree/tree-row"
|
|
27
33
|
import {
|
|
28
34
|
renderTree,
|
|
29
35
|
TreeBody,
|
|
30
|
-
TreeLabel,
|
|
31
|
-
type TreePosition,
|
|
32
|
-
TreeRails,
|
|
33
36
|
TreeSearch,
|
|
34
37
|
TreeTrigger,
|
|
35
38
|
treeItemAria,
|
|
36
|
-
treeRow,
|
|
37
39
|
useTreeRovingFocus,
|
|
38
40
|
} from "./tree-popover"
|
|
39
41
|
|
|
@@ -162,7 +164,7 @@ export const TreeSelect = <const Data extends TreeSelectData = TreeNodeData[]>({
|
|
|
162
164
|
size = "md",
|
|
163
165
|
variant = "default",
|
|
164
166
|
color,
|
|
165
|
-
disabled,
|
|
167
|
+
disabled: disabledProp,
|
|
166
168
|
readOnly,
|
|
167
169
|
required,
|
|
168
170
|
invalid,
|
|
@@ -178,6 +180,9 @@ export const TreeSelect = <const Data extends TreeSelectData = TreeNodeData[]>({
|
|
|
178
180
|
translations,
|
|
179
181
|
icons: iconsProp,
|
|
180
182
|
}: TreeSelectProps<Data>) => {
|
|
183
|
+
// A `Field` or `Fieldset` around the picker disables it too: the trigger is a
|
|
184
|
+
// plain `<div>`, which neither the `<fieldset>` nor an Ark machine reaches.
|
|
185
|
+
const disabled = useInheritedDisabled(disabledProp)
|
|
181
186
|
const icons = mergeIcons(DEFAULT_ICONS, iconsProp)
|
|
182
187
|
const resolvedTranslations = { ...TREE_SELECT_DEFAULT_TRANSLATIONS, ...translations }
|
|
183
188
|
const [value, setValue] = useUncontrolled<TreeValue<Data> | null>({
|
|
@@ -192,7 +197,7 @@ export const TreeSelect = <const Data extends TreeSelectData = TreeNodeData[]>({
|
|
|
192
197
|
|
|
193
198
|
// Red state is driven independently of the `Field` error slot so a form
|
|
194
199
|
// library can flip it from `fieldState.invalid` (see FormControlProps).
|
|
195
|
-
const isInvalid = invalid || error != null
|
|
200
|
+
const isInvalid = useInheritedInvalid(invalid || error != null)
|
|
196
201
|
|
|
197
202
|
const { labelMap, nodeMap } = useMemo(() => buildMaps(data), [data])
|
|
198
203
|
const labelSearch = useLabelSearch()
|
|
@@ -256,8 +261,8 @@ export const TreeSelect = <const Data extends TreeSelectData = TreeNodeData[]>({
|
|
|
256
261
|
)
|
|
257
262
|
|
|
258
263
|
return leaf ? (
|
|
259
|
-
//
|
|
260
|
-
<
|
|
264
|
+
// Enter / Space are handled centrally by the tree's onKeyDown (roving focus).
|
|
265
|
+
<TreeRow
|
|
261
266
|
role="treeitem"
|
|
262
267
|
{...treeItemAria(position)}
|
|
263
268
|
aria-selected={selected}
|
|
@@ -270,26 +275,29 @@ export const TreeSelect = <const Data extends TreeSelectData = TreeNodeData[]>({
|
|
|
270
275
|
setActiveValue(node.value)
|
|
271
276
|
selectLeaf(source)
|
|
272
277
|
}}
|
|
273
|
-
|
|
278
|
+
position={position}
|
|
279
|
+
size={size}
|
|
280
|
+
className={cn(selected && "font-medium", classNames?.node)}
|
|
274
281
|
>
|
|
275
|
-
<TreeRails {...position} />
|
|
276
282
|
{content}
|
|
277
|
-
</
|
|
283
|
+
</TreeRow>
|
|
278
284
|
) : (
|
|
279
285
|
// Present as a treeitem for well-formed levels; `tabIndex={-1}` keeps it
|
|
280
286
|
// out of the tab order, and roving focus + arrow nav stay on leaves.
|
|
281
|
-
<
|
|
287
|
+
<TreeRow
|
|
282
288
|
role="treeitem"
|
|
283
289
|
{...treeItemAria(position)}
|
|
284
290
|
aria-expanded
|
|
285
291
|
{...props({ "aria-disabled": nodeDisabled })}
|
|
286
292
|
data-testid={rowTestId}
|
|
287
293
|
tabIndex={-1}
|
|
288
|
-
|
|
294
|
+
position={position}
|
|
295
|
+
size={size}
|
|
296
|
+
interactive={false}
|
|
297
|
+
className={classNames?.node}
|
|
289
298
|
>
|
|
290
|
-
<TreeRails {...position} />
|
|
291
299
|
{content}
|
|
292
|
-
</
|
|
300
|
+
</TreeRow>
|
|
293
301
|
)
|
|
294
302
|
}
|
|
295
303
|
|
package/src/icon-stroke.test.tsx
CHANGED
|
@@ -37,6 +37,8 @@ const NOT_ICONS: Record<string, string> = {
|
|
|
37
37
|
"an illustration: the orbit is drawn in viewBox units, scaling with the token",
|
|
38
38
|
"geodesic/planet.tsx": "an illustration: its own wire weights, fixed with non-scaling-stroke",
|
|
39
39
|
"spinner/spinner.tsx": "a loading ring, weighted to read while it spins",
|
|
40
|
+
"table-of-contents/table-of-contents.tsx":
|
|
41
|
+
"the track: a measured path whose viewBox is its own pixel box, so 1 unit is 1px",
|
|
40
42
|
}
|
|
41
43
|
|
|
42
44
|
/** A JSX opening tag from `<` to its closing `>`, skipping `>`s inside `{…}`. */
|
package/src/index.ts
CHANGED
|
@@ -127,6 +127,22 @@ export {
|
|
|
127
127
|
type UseObjectUrlOptions,
|
|
128
128
|
useObjectUrl,
|
|
129
129
|
} from "./lib/use-object-url"
|
|
130
|
+
export {
|
|
131
|
+
type PaginationItem,
|
|
132
|
+
type PaginationTotal,
|
|
133
|
+
paginationRange,
|
|
134
|
+
type UsePaginationOptions,
|
|
135
|
+
type UsePaginationReturnValue,
|
|
136
|
+
usePagination,
|
|
137
|
+
} from "./lib/use-pagination"
|
|
138
|
+
export {
|
|
139
|
+
type ScrollSpyEntry,
|
|
140
|
+
type ScrollSpyHeading,
|
|
141
|
+
type ScrollSpyScrollOptions,
|
|
142
|
+
type UseScrollSpyOptions,
|
|
143
|
+
type UseScrollSpyReturnValue,
|
|
144
|
+
useScrollSpy,
|
|
145
|
+
} from "./lib/use-scroll-spy"
|
|
130
146
|
export { type UseThemeOptions, type UseThemeReturnValue, useTheme } from "./lib/use-theme"
|
|
131
147
|
export {
|
|
132
148
|
type UseUncontrolledOptions,
|
|
@@ -147,3 +147,49 @@ describe("timeZone argument", () => {
|
|
|
147
147
|
}
|
|
148
148
|
})
|
|
149
149
|
})
|
|
150
|
+
|
|
151
|
+
describe("the unit argument (month and year pickers)", () => {
|
|
152
|
+
// A month picker asks about each month as its first day, at unit "month".
|
|
153
|
+
const tz = getLocalTimeZone()
|
|
154
|
+
|
|
155
|
+
it("disablePast keeps the current month and year open, closes the ones before", () => {
|
|
156
|
+
const predicate = disablePast()
|
|
157
|
+
expect(predicate(day(2026, 6, 1), tz, "month")).toBe(false)
|
|
158
|
+
expect(predicate(day(2026, 5, 1), tz, "month")).toBe(true)
|
|
159
|
+
expect(predicate(day(2026, 0, 1), tz, "year")).toBe(false)
|
|
160
|
+
expect(predicate(day(2025, 0, 1), tz, "year")).toBe(true)
|
|
161
|
+
})
|
|
162
|
+
|
|
163
|
+
it("disableFuture closes the months after the current one", () => {
|
|
164
|
+
const predicate = disableFuture()
|
|
165
|
+
expect(predicate(day(2026, 6, 1), tz, "month")).toBe(false)
|
|
166
|
+
expect(predicate(day(2026, 7, 1), tz, "month")).toBe(true)
|
|
167
|
+
})
|
|
168
|
+
|
|
169
|
+
it("beforeDate / afterDate compare whole months: the boundary's own month stays open", () => {
|
|
170
|
+
const boundary = day(2026, 2, 20)
|
|
171
|
+
expect(beforeDate(boundary)(day(2026, 2, 1), tz, "month")).toBe(false)
|
|
172
|
+
expect(beforeDate(boundary)(day(2026, 1, 1), tz, "month")).toBe(true)
|
|
173
|
+
expect(afterDate(boundary)(day(2026, 2, 1), tz, "month")).toBe(false)
|
|
174
|
+
expect(afterDate(boundary)(day(2026, 3, 1), tz, "month")).toBe(true)
|
|
175
|
+
})
|
|
176
|
+
|
|
177
|
+
it("disableDates disables the months holding the listed days", () => {
|
|
178
|
+
const predicate = disableDates([day(2026, 4, 17)])
|
|
179
|
+
expect(predicate(day(2026, 4, 1), tz, "month")).toBe(true)
|
|
180
|
+
expect(predicate(day(2026, 5, 1), tz, "month")).toBe(false)
|
|
181
|
+
expect(predicate(day(2026, 0, 1), tz, "year")).toBe(true)
|
|
182
|
+
})
|
|
183
|
+
|
|
184
|
+
it("disableWeekends is day-only: no month or year is a weekend", () => {
|
|
185
|
+
// August 1st 2026 is a Saturday.
|
|
186
|
+
expect(disableWeekends()(day(2026, 7, 1), tz, "day")).toBe(true)
|
|
187
|
+
expect(disableWeekends()(day(2026, 7, 1), tz, "month")).toBe(false)
|
|
188
|
+
})
|
|
189
|
+
|
|
190
|
+
it("anyOf / allOf pass the unit through", () => {
|
|
191
|
+
const predicate = anyOf(disableWeekends(), disablePast())
|
|
192
|
+
expect(predicate(day(2026, 7, 1), tz, "month")).toBe(false)
|
|
193
|
+
expect(allOf(disablePast(), disablePast())(day(2026, 5, 1), tz, "month")).toBe(true)
|
|
194
|
+
})
|
|
195
|
+
})
|
|
@@ -1,5 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import {
|
|
2
|
+
type DateValue,
|
|
3
|
+
getLocalTimeZone,
|
|
4
|
+
isSameDay,
|
|
5
|
+
isWeekend,
|
|
6
|
+
today,
|
|
7
|
+
} from "@internationalized/date"
|
|
8
|
+
import { type DateUnit, dateToCalendarValue, snapToUnit } from "./date-value"
|
|
3
9
|
|
|
4
10
|
/**
|
|
5
11
|
* RFC §7 (`docs/rfcs/date-picker.md`) restriction-predicate helpers — composable `DatePredicate`
|
|
@@ -14,6 +20,11 @@ import { dateToCalendarValue } from "./date-value"
|
|
|
14
20
|
* can't disagree with the component restricting by it — `<Calendar timeZone="UTC"
|
|
15
21
|
* isDateUnavailable={disableWeekends()} />` disables UTC Saturdays whatever the host zone is,
|
|
16
22
|
* instead of whichever days happened to be weekends where the code ran.
|
|
23
|
+
*
|
|
24
|
+
* A month or year picker calls the same predicate once per *cell*, with that month's or year's
|
|
25
|
+
* first day and a third `unit` argument. The helpers compare at that unit, so `disablePast()`
|
|
26
|
+
* keeps the current month open in a `MonthPicker` (its first day is past, the month isn't), and
|
|
27
|
+
* the day-only `disableWeekends()` disables nothing there.
|
|
17
28
|
*/
|
|
18
29
|
|
|
19
30
|
/** `isWeekend` needs a locale; these helpers don't take one, so the Gregorian Saturday/Sunday
|
|
@@ -27,57 +38,66 @@ const WEEKEND_LOCALE = "en-US"
|
|
|
27
38
|
* only so a predicate stays callable on its own (filtering a plain `Date[]`, a unit test), where
|
|
28
39
|
* it falls back to the host zone exactly as before.
|
|
29
40
|
*/
|
|
30
|
-
export type DatePredicate = (date: Date, timeZone?: string) => boolean
|
|
41
|
+
export type DatePredicate = (date: Date, timeZone?: string, unit?: DateUnit) => boolean
|
|
42
|
+
|
|
43
|
+
/** `date` as the first day of its `unit`, read in `timeZone`: the one thing every helper compares. */
|
|
44
|
+
const at = (date: Date, timeZone: string, unit: DateUnit = "day"): DateValue =>
|
|
45
|
+
snapToUnit(dateToCalendarValue(date, timeZone), unit)
|
|
46
|
+
|
|
47
|
+
/** `today`, as the first day of its `unit`. */
|
|
48
|
+
const now = (timeZone: string, unit: DateUnit = "day"): DateValue =>
|
|
49
|
+
snapToUnit(today(timeZone), unit)
|
|
31
50
|
|
|
32
51
|
/** Disable every day before today, today itself included as available. Reads the clock on every
|
|
33
52
|
* call rather than once at factory time, so a long-lived predicate's boundary keeps up as time
|
|
34
53
|
* passes instead of going stale — same rationale as `schedule-predicates.ts`'s own `disablePast`. */
|
|
35
54
|
export const disablePast =
|
|
36
55
|
(): DatePredicate =>
|
|
37
|
-
(date, timeZone = getLocalTimeZone()) =>
|
|
38
|
-
|
|
56
|
+
(date, timeZone = getLocalTimeZone(), unit) =>
|
|
57
|
+
at(date, timeZone, unit).compare(now(timeZone, unit)) < 0
|
|
39
58
|
|
|
40
59
|
/** Disable every day after today, today itself included as available. Same per-call clock read as
|
|
41
60
|
* `disablePast`. */
|
|
42
61
|
export const disableFuture =
|
|
43
62
|
(): DatePredicate =>
|
|
44
|
-
(date, timeZone = getLocalTimeZone()) =>
|
|
45
|
-
|
|
63
|
+
(date, timeZone = getLocalTimeZone(), unit) =>
|
|
64
|
+
at(date, timeZone, unit).compare(now(timeZone, unit)) > 0
|
|
46
65
|
|
|
47
|
-
/** Disable Saturdays/Sundays. */
|
|
66
|
+
/** Disable Saturdays/Sundays. A day-only rule: a month or year cell is never a weekend. */
|
|
48
67
|
export const disableWeekends =
|
|
49
68
|
(): DatePredicate =>
|
|
50
|
-
(date, timeZone = getLocalTimeZone()) =>
|
|
51
|
-
isWeekend(dateToCalendarValue(date, timeZone), WEEKEND_LOCALE)
|
|
69
|
+
(date, timeZone = getLocalTimeZone(), unit = "day") =>
|
|
70
|
+
unit === "day" && isWeekend(dateToCalendarValue(date, timeZone), WEEKEND_LOCALE)
|
|
52
71
|
|
|
53
|
-
/** Disable every day strictly before `boundary
|
|
72
|
+
/** Disable every day strictly before `boundary` (every month or year before its own, at that unit). */
|
|
54
73
|
export const beforeDate =
|
|
55
74
|
(boundary: Date): DatePredicate =>
|
|
56
|
-
(date, timeZone = getLocalTimeZone()) =>
|
|
57
|
-
|
|
75
|
+
(date, timeZone = getLocalTimeZone(), unit) =>
|
|
76
|
+
at(date, timeZone, unit).compare(at(boundary, timeZone, unit)) < 0
|
|
58
77
|
|
|
59
|
-
/** Disable every day strictly after `boundary
|
|
78
|
+
/** Disable every day strictly after `boundary` (every month or year after its own, at that unit). */
|
|
60
79
|
export const afterDate =
|
|
61
80
|
(boundary: Date): DatePredicate =>
|
|
62
|
-
(date, timeZone = getLocalTimeZone()) =>
|
|
63
|
-
|
|
81
|
+
(date, timeZone = getLocalTimeZone(), unit) =>
|
|
82
|
+
at(date, timeZone, unit).compare(at(boundary, timeZone, unit)) > 0
|
|
64
83
|
|
|
65
|
-
/** Disable an explicit set of days (matched by calendar day, not exact instant).
|
|
84
|
+
/** Disable an explicit set of days (matched by calendar day, not exact instant). At a month or
|
|
85
|
+
* year unit, the months or years holding them. */
|
|
66
86
|
export const disableDates =
|
|
67
87
|
(dates: Date[]): DatePredicate =>
|
|
68
|
-
(date, timeZone = getLocalTimeZone()) => {
|
|
69
|
-
const value =
|
|
70
|
-
return dates.some((
|
|
88
|
+
(date, timeZone = getLocalTimeZone(), unit) => {
|
|
89
|
+
const value = at(date, timeZone, unit)
|
|
90
|
+
return dates.some((other) => isSameDay(value, at(other, timeZone, unit)))
|
|
71
91
|
}
|
|
72
92
|
|
|
73
93
|
/** OR-combine predicates — unavailable if ANY predicate disables the day. */
|
|
74
94
|
export const anyOf =
|
|
75
95
|
(...predicates: DatePredicate[]): DatePredicate =>
|
|
76
|
-
(date, timeZone) =>
|
|
77
|
-
predicates.some((predicate) => predicate(date, timeZone))
|
|
96
|
+
(date, timeZone, unit) =>
|
|
97
|
+
predicates.some((predicate) => predicate(date, timeZone, unit))
|
|
78
98
|
|
|
79
99
|
/** AND-combine predicates — unavailable only if EVERY predicate disables the day. */
|
|
80
100
|
export const allOf =
|
|
81
101
|
(...predicates: DatePredicate[]): DatePredicate =>
|
|
82
|
-
(date, timeZone) =>
|
|
83
|
-
predicates.every((predicate) => predicate(date, timeZone))
|
|
102
|
+
(date, timeZone, unit) =>
|
|
103
|
+
predicates.every((predicate) => predicate(date, timeZone, unit))
|