@42-central/ui-react 0.29.1 → 0.30.1
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/breadcrumb/breadcrumb.d.ts +5 -1
- package/dist/components/breadcrumb/breadcrumb.d.ts.map +1 -1
- package/dist/components/breadcrumb/index.js +12 -0
- package/dist/components/breadcrumb/index.js.map +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/breadcrumb/breadcrumb.test.tsx +24 -0
- package/src/components/breadcrumb/breadcrumb.tsx +20 -1
- 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
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
"use client"
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
createContext,
|
|
5
|
+
type ReactNode,
|
|
6
|
+
useCallback,
|
|
7
|
+
useContext,
|
|
8
|
+
useRef,
|
|
9
|
+
useSyncExternalStore,
|
|
10
|
+
} from "react"
|
|
4
11
|
import { useIsomorphicLayoutEffect } from "./use-isomorphic-layout-effect"
|
|
5
12
|
|
|
6
13
|
/**
|
|
@@ -55,6 +62,43 @@ const OPEN_MODALS = new Set<symbol>()
|
|
|
55
62
|
* when a toast is created, to raise it above the modal (`--toast-raised-z`). */
|
|
56
63
|
export const isModalOpen = () => OPEN_MODALS.size > 0
|
|
57
64
|
|
|
65
|
+
/** The tours showing right now. Module scope like `OPEN_MODALS`. */
|
|
66
|
+
const OPEN_TOURS = new Set<symbol>()
|
|
67
|
+
|
|
68
|
+
/** Told whenever a modal or a tour opens or closes. A panel that is already
|
|
69
|
+
* open must rise the moment a tour starts over it, and a queued tour starts
|
|
70
|
+
* the moment the modal in its way closes; neither can wait for a render. */
|
|
71
|
+
const layerListeners = new Set<() => void>()
|
|
72
|
+
const emitLayers = () => {
|
|
73
|
+
for (const listener of layerListeners) listener()
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/** Calls `listener` whenever a Modal, Drawer, Lightbox or tour opens or
|
|
77
|
+
* closes. Returns the unsubscribe. */
|
|
78
|
+
export const subscribeLayers = (listener: () => void) => {
|
|
79
|
+
layerListeners.add(listener)
|
|
80
|
+
return () => {
|
|
81
|
+
layerListeners.delete(listener)
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/** Whether a tour is showing right now. */
|
|
86
|
+
export const isTourOpen = () => OPEN_TOURS.size > 0
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* For a floating panel (Popover, Menu, HoverCard, Select, Combobox,
|
|
90
|
+
* DatePicker): whether it must be lifted above a running tour. A panel
|
|
91
|
+
* opened from the element a tour highlights would otherwise paint under the
|
|
92
|
+
* tour's backdrop. Spread the result as `data-raised` on the content part;
|
|
93
|
+
* `theme.css` moves a raised panel into the `--tour-z` band, above the
|
|
94
|
+
* tour's card. False while the panel is closed, so a closed panel never
|
|
95
|
+
* re-renders when a tour starts or ends.
|
|
96
|
+
*/
|
|
97
|
+
export const useTourRaised = (open: boolean): boolean => {
|
|
98
|
+
const tourOpen = useSyncExternalStore(subscribeLayers, isTourOpen, () => false)
|
|
99
|
+
return open && tourOpen
|
|
100
|
+
}
|
|
101
|
+
|
|
58
102
|
/** A press on a toast is never "outside" a layer. Toasts raised from a modal
|
|
59
103
|
* paint above it, and dismissing one must not take the modal (and the form
|
|
60
104
|
* in it) along. zag dispatches its outside event on the layer's own content
|
|
@@ -88,30 +132,43 @@ export const OverlayLayerProvider = ({
|
|
|
88
132
|
children?: ReactNode
|
|
89
133
|
}) => <OverlayLayerContext.Provider value={value}>{children}</OverlayLayerContext.Provider>
|
|
90
134
|
|
|
135
|
+
/** What kind of layer registers, beyond counting in its parent's set. */
|
|
136
|
+
export type NestedLayerOptions = {
|
|
137
|
+
/** A Modal, Drawer or Lightbox, which `isModalOpen` counts. */
|
|
138
|
+
modal?: boolean
|
|
139
|
+
/** A tour, which `isTourOpen` counts and `useTourRaised` answers to. */
|
|
140
|
+
tour?: boolean
|
|
141
|
+
}
|
|
142
|
+
|
|
91
143
|
/** For a child layer: registers with the nearest parent (the page's set when
|
|
92
144
|
* none encloses it) while `open`. Keyed on
|
|
93
145
|
* `open`, not presence, so a panel playing its exit animation no longer holds
|
|
94
146
|
* the parent's next click. A layout effect so the registration is in place
|
|
95
|
-
* before the browser can deliver the next pointerdown.
|
|
96
|
-
|
|
97
|
-
|
|
147
|
+
* before the browser can deliver the next pointerdown. */
|
|
148
|
+
export const useNestedLayer = (
|
|
149
|
+
open: boolean,
|
|
150
|
+
{ modal = false, tour = false }: NestedLayerOptions = {},
|
|
151
|
+
) => {
|
|
98
152
|
const parent = useContext(OverlayLayerContext)
|
|
99
153
|
useIsomorphicLayoutEffect(() => {
|
|
100
154
|
if (!open) return
|
|
101
155
|
const token = Symbol()
|
|
102
156
|
parent.add(token)
|
|
103
157
|
if (modal) OPEN_MODALS.add(token)
|
|
158
|
+
if (tour) OPEN_TOURS.add(token)
|
|
159
|
+
if (modal || tour) emitLayers()
|
|
104
160
|
return () => {
|
|
105
161
|
parent.delete(token)
|
|
106
|
-
OPEN_MODALS.delete(token)
|
|
162
|
+
const closed = OPEN_MODALS.delete(token)
|
|
163
|
+
if (OPEN_TOURS.delete(token) || closed) emitLayers()
|
|
107
164
|
}
|
|
108
|
-
}, [open, modal, parent])
|
|
165
|
+
}, [open, modal, tour, parent])
|
|
109
166
|
}
|
|
110
167
|
|
|
111
168
|
/** `useNestedLayer` as an element, for call sites that only have the machine's
|
|
112
169
|
* `open` inside a render prop (`<Ark.Context>{(api) => …}</Ark.Context>`). */
|
|
113
|
-
export const NestedLayer = ({ open, modal }: { open: boolean
|
|
114
|
-
useNestedLayer(open, { modal })
|
|
170
|
+
export const NestedLayer = ({ open, modal, tour }: { open: boolean } & NestedLayerOptions) => {
|
|
171
|
+
useNestedLayer(open, { modal, tour })
|
|
115
172
|
return null
|
|
116
173
|
}
|
|
117
174
|
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { isValidElement, type MouseEvent, type MouseEventHandler, type ReactNode } from "react"
|
|
2
|
+
import type { Unavailable } from "./available-if"
|
|
3
|
+
import { devWarnOnce } from "./dev-warn"
|
|
4
|
+
import { useUncontrolled } from "./use-uncontrolled"
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The toggle (pressed) state shared by `Button` and `ActionIcon`.
|
|
8
|
+
*
|
|
9
|
+
* Passing `pressed`, `defaultPressed` or `onPressedChange` turns the control
|
|
10
|
+
* into a toggle button: it renders `aria-pressed`, a click flips the state,
|
|
11
|
+
* and its look swaps from `variant` to `pressedVariant`, the same swap
|
|
12
|
+
* `ButtonSelect` makes with `selectedVariant`. Without any of the three the
|
|
13
|
+
* control renders exactly as before: no `aria-pressed`, no extra click work.
|
|
14
|
+
*
|
|
15
|
+
* Built on `useUncontrolled` rather than Ark's `toggle` machine. The machine
|
|
16
|
+
* holds one boolean and flips it on click, but its root props bring their own
|
|
17
|
+
* `type="button"`, `disabled` and an `onClick` that knows nothing of
|
|
18
|
+
* `loading`, all of which `Button` already owns (and gets right under
|
|
19
|
+
* `asChild`, where `disabled` does nothing). Every Button would also start a
|
|
20
|
+
* zag service it mostly never uses, since a hook can't be called
|
|
21
|
+
* conditionally. The state is the only part worth sharing, and this is it.
|
|
22
|
+
*/
|
|
23
|
+
export type PressedProps<Variant extends string> = {
|
|
24
|
+
/**
|
|
25
|
+
* Controlled pressed state. Passing it (or `defaultPressed`, or
|
|
26
|
+
* `onPressedChange`) makes the control a toggle: it renders `aria-pressed`
|
|
27
|
+
* and a click flips the state.
|
|
28
|
+
*/
|
|
29
|
+
pressed?: boolean
|
|
30
|
+
/** Uncontrolled initial pressed state. */
|
|
31
|
+
defaultPressed?: boolean
|
|
32
|
+
/** Fires with the next pressed state when a click flips it. */
|
|
33
|
+
onPressedChange?: (pressed: boolean) => void
|
|
34
|
+
/**
|
|
35
|
+
* Treatment while pressed, the toggle's counterpart of `ButtonSelect`'s
|
|
36
|
+
* `selectedVariant`. A toggle's `variant` (its unpressed look) defaults to
|
|
37
|
+
* `light` and this to `filled`, the same pair as `ButtonSelect`, so a lone
|
|
38
|
+
* toggle and one in a group look alike.
|
|
39
|
+
*/
|
|
40
|
+
pressedVariant?: Variant
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Why a toggle can't be a link, printed verbatim in the compile error and
|
|
45
|
+
* the dev warning.
|
|
46
|
+
*/
|
|
47
|
+
export type PressedLinkReason =
|
|
48
|
+
"aria-pressed has no meaning on a link: a toggle must render a <button>, not an <a>"
|
|
49
|
+
|
|
50
|
+
const reason: PressedLinkReason =
|
|
51
|
+
"aria-pressed has no meaning on a link: a toggle must render a <button>, not an <a>"
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* `href` forbidden on `Button` and `ActionIcon`, carrying the reason.
|
|
55
|
+
*
|
|
56
|
+
* Both render a `<button>`, which has no `href`, and the only way to make one
|
|
57
|
+
* a link is `asChild` around an `<a>` or a router `Link`. TypeScript can't see
|
|
58
|
+
* through that (every JSX child is a plain `JSX.Element`), so the runtime
|
|
59
|
+
* guard in `usePressed` covers it. What the type *can* catch is an `href`
|
|
60
|
+
* forwarded in a prop bag — `<Button pressed {...linkProps} />` — which would
|
|
61
|
+
* otherwise land silently on the `<button>`. Omitting the key wouldn't: excess
|
|
62
|
+
* property checks skip JSX spreads. See `available-if.ts` for the brand.
|
|
63
|
+
*/
|
|
64
|
+
export type ForbidHref = {
|
|
65
|
+
/** Unavailable: a Button renders a `<button>`. For a link, use `asChild`
|
|
66
|
+
* around an `<a>`, without the pressed props. */
|
|
67
|
+
href?: Unavailable<PressedLinkReason> | undefined
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* A link child under `asChild`: an `<a>`, or any element carrying an `href`
|
|
72
|
+
* (Next's `Link`) or a `to` (TanStack Router's and React Router's `Link`).
|
|
73
|
+
*/
|
|
74
|
+
export const isLinkElement = (child: ReactNode): boolean =>
|
|
75
|
+
isValidElement<{ href?: unknown; to?: unknown }>(child) &&
|
|
76
|
+
(child.type === "a" || child.props.href != null || child.props.to != null)
|
|
77
|
+
|
|
78
|
+
type UsePressedOptions = Pick<
|
|
79
|
+
PressedProps<string>,
|
|
80
|
+
"pressed" | "defaultPressed" | "onPressedChange"
|
|
81
|
+
> & {
|
|
82
|
+
/** Native `disabled` or `loading`: a click never flips the state. Needed
|
|
83
|
+
* for an `asChild` element, where native `disabled` doesn't stop clicks. */
|
|
84
|
+
disabled: boolean
|
|
85
|
+
/** The consumer's own `onClick`, run first. Calling `preventDefault` in it
|
|
86
|
+
* keeps the state as it is. */
|
|
87
|
+
onClick: MouseEventHandler<HTMLButtonElement> | undefined
|
|
88
|
+
/** Whether the `asChild` child is a link (`isLinkElement`). */
|
|
89
|
+
link: boolean
|
|
90
|
+
/** Component name, for the dev warning. */
|
|
91
|
+
component: string
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Resolves a control's toggle state. `toggle` is false unless one of the
|
|
96
|
+
* pressed props is passed (and the control isn't a link), and then `onClick`
|
|
97
|
+
* is the consumer's own, untouched.
|
|
98
|
+
*/
|
|
99
|
+
export const usePressed = ({
|
|
100
|
+
pressed: pressedProp,
|
|
101
|
+
defaultPressed,
|
|
102
|
+
onPressedChange,
|
|
103
|
+
disabled,
|
|
104
|
+
onClick,
|
|
105
|
+
link,
|
|
106
|
+
component,
|
|
107
|
+
}: UsePressedOptions) => {
|
|
108
|
+
const [pressed, setPressed] = useUncontrolled<boolean>({
|
|
109
|
+
value: pressedProp,
|
|
110
|
+
defaultValue: defaultPressed,
|
|
111
|
+
finalValue: false,
|
|
112
|
+
onChange: onPressedChange,
|
|
113
|
+
})
|
|
114
|
+
const requested =
|
|
115
|
+
pressedProp !== undefined || defaultPressed !== undefined || onPressedChange !== undefined
|
|
116
|
+
if (requested && link) {
|
|
117
|
+
devWarnOnce(`${component}: ignoring \`pressed\` on an \`asChild\` link. ${reason}.`)
|
|
118
|
+
}
|
|
119
|
+
const toggle = requested && !link
|
|
120
|
+
if (!toggle) return { toggle, pressed: false, onClick }
|
|
121
|
+
return {
|
|
122
|
+
toggle,
|
|
123
|
+
pressed,
|
|
124
|
+
onClick: (event: MouseEvent<HTMLButtonElement>) => {
|
|
125
|
+
onClick?.(event)
|
|
126
|
+
if (event.defaultPrevented || disabled) return
|
|
127
|
+
setPressed((previous) => !previous)
|
|
128
|
+
},
|
|
129
|
+
}
|
|
130
|
+
}
|
package/src/lib/tree-data.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Shared tree model + pure helpers for the hierarchical
|
|
3
|
-
* TreeMultiSelect). `data` is a tree of `{ value, label, disabled?, children? }`;
|
|
2
|
+
* Shared tree model + pure helpers for the hierarchical components (Tree,
|
|
3
|
+
* TreeSelect, TreeMultiSelect). `data` is a tree of `{ value, label, disabled?, children? }`;
|
|
4
4
|
* a node with `children` is a *branch*, one without is a *leaf*. These helpers
|
|
5
5
|
* are selection-agnostic — the single / multi cascade logic lives in each
|
|
6
6
|
* component (mirrors `lib/select-data.ts` for the flat pickers).
|
|
@@ -26,6 +26,12 @@ export type TreeNodeData<P = unknown> = {
|
|
|
26
26
|
* there's no free `data-part` / `data-value` here — `testId` is the row's
|
|
27
27
|
* only stable selector. */
|
|
28
28
|
testId?: string
|
|
29
|
+
/** `Tree` only: a branch whose children aren't in `data` yet. Expanding it calls the tree's
|
|
30
|
+
* `loadChildren` once, then shows what it returns. The pickers ignore it. */
|
|
31
|
+
hasChildren?: boolean
|
|
32
|
+
/** `Tree` only: this node's icon, in place of the default folder / file. `null` draws none.
|
|
33
|
+
* The pickers ignore it. */
|
|
34
|
+
icon?: ReactNode
|
|
29
35
|
}
|
|
30
36
|
|
|
31
37
|
/**
|
|
@@ -162,3 +168,37 @@ export const filterTree = <P>(
|
|
|
162
168
|
}
|
|
163
169
|
return recurse(nodes)
|
|
164
170
|
}
|
|
171
|
+
|
|
172
|
+
/** Every *enabled* leaf value under `node` (the node itself when it's a leaf). */
|
|
173
|
+
export const getLeafValues = (node: TreeNodeData, acc: string[] = []): string[] => {
|
|
174
|
+
if (isLeaf(node)) {
|
|
175
|
+
if (!node.disabled) acc.push(node.value)
|
|
176
|
+
return acc
|
|
177
|
+
}
|
|
178
|
+
if (node.children) for (const child of node.children) getLeafValues(child, acc)
|
|
179
|
+
return acc
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
/** A checkbox tree's tri-state per node. */
|
|
183
|
+
export type TreeCheckState = "checked" | "indeterminate" | "unchecked"
|
|
184
|
+
|
|
185
|
+
/** Tri-state of a node, derived from the set of checked leaf values: a branch is checked when
|
|
186
|
+
* all its enabled leaves are, indeterminate when some are. */
|
|
187
|
+
export const getCheckState = (node: TreeNodeData, checked: ReadonlySet<string>): TreeCheckState => {
|
|
188
|
+
const leaves = getLeafValues(node)
|
|
189
|
+
if (leaves.length === 0) return "unchecked"
|
|
190
|
+
const on = leaves.filter((v) => checked.has(v)).length
|
|
191
|
+
if (on === 0) return "unchecked"
|
|
192
|
+
return on === leaves.length ? "checked" : "indeterminate"
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
/** Toggle a node in a leaf selection: a fully checked node clears its leaves, any other selects
|
|
196
|
+
* them all. Disabled leaves keep their state. */
|
|
197
|
+
export const toggleChecked = (node: TreeNodeData, current: readonly string[]): string[] => {
|
|
198
|
+
const leaves = getLeafValues(node)
|
|
199
|
+
if (leaves.length === 0) return [...current]
|
|
200
|
+
const set = new Set(current)
|
|
201
|
+
const fullyChecked = leaves.every((v) => set.has(v))
|
|
202
|
+
for (const v of leaves) fullyChecked ? set.delete(v) : set.add(v)
|
|
203
|
+
return [...set]
|
|
204
|
+
}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { act, renderHook } from "@testing-library/react"
|
|
2
|
+
import { describe, expect, it, vi } from "vitest"
|
|
3
|
+
import { paginationRange, usePagination } from "./use-pagination"
|
|
4
|
+
|
|
5
|
+
const E = "ellipsis"
|
|
6
|
+
|
|
7
|
+
describe("paginationRange", () => {
|
|
8
|
+
it("lists every page when they fit", () => {
|
|
9
|
+
expect(paginationRange({ page: 1, totalPages: 7 })).toEqual([1, 2, 3, 4, 5, 6, 7])
|
|
10
|
+
expect(paginationRange({ page: 1, totalPages: 0 })).toEqual([])
|
|
11
|
+
})
|
|
12
|
+
|
|
13
|
+
it("keeps the same slot count wherever the page is", () => {
|
|
14
|
+
const at = (page: number) => paginationRange({ page, totalPages: 10 })
|
|
15
|
+
expect(at(1)).toEqual([1, 2, 3, 4, 5, E, 10])
|
|
16
|
+
expect(at(4)).toEqual([1, 2, 3, 4, 5, E, 10])
|
|
17
|
+
expect(at(5)).toEqual([1, E, 4, 5, 6, E, 10])
|
|
18
|
+
expect(at(7)).toEqual([1, E, 6, 7, 8, 9, 10])
|
|
19
|
+
expect(at(10)).toEqual([1, E, 6, 7, 8, 9, 10])
|
|
20
|
+
expect(new Set([1, 2, 3, 4, 5, 6, 7, 8, 9, 10].map((p) => at(p).length))).toEqual(new Set([7]))
|
|
21
|
+
})
|
|
22
|
+
|
|
23
|
+
it("honours siblings and boundaries", () => {
|
|
24
|
+
expect(paginationRange({ page: 10, totalPages: 20, siblings: 2, boundaries: 2 })).toEqual([
|
|
25
|
+
1,
|
|
26
|
+
2,
|
|
27
|
+
E,
|
|
28
|
+
8,
|
|
29
|
+
9,
|
|
30
|
+
10,
|
|
31
|
+
11,
|
|
32
|
+
12,
|
|
33
|
+
E,
|
|
34
|
+
19,
|
|
35
|
+
20,
|
|
36
|
+
])
|
|
37
|
+
expect(paginationRange({ page: 10, totalPages: 20, siblings: 0, boundaries: 0 })).toEqual([
|
|
38
|
+
E,
|
|
39
|
+
10,
|
|
40
|
+
E,
|
|
41
|
+
])
|
|
42
|
+
})
|
|
43
|
+
})
|
|
44
|
+
|
|
45
|
+
describe("usePagination", () => {
|
|
46
|
+
it("derives the page count from count and pageSize", () => {
|
|
47
|
+
const { result } = renderHook(() => usePagination({ count: 95, pageSize: 10 }))
|
|
48
|
+
expect(result.current.totalPages).toBe(10)
|
|
49
|
+
expect(result.current.range).toEqual({ from: 1, to: 10 })
|
|
50
|
+
})
|
|
51
|
+
|
|
52
|
+
it("defaults pageSize to 10, and takes pages directly", () => {
|
|
53
|
+
expect(renderHook(() => usePagination({ count: 21 })).result.current.totalPages).toBe(3)
|
|
54
|
+
const { result } = renderHook(() => usePagination({ pages: 4 }))
|
|
55
|
+
expect(result.current.totalPages).toBe(4)
|
|
56
|
+
expect(result.current.range).toBeNull()
|
|
57
|
+
})
|
|
58
|
+
|
|
59
|
+
it("moves between pages and clamps at the ends", () => {
|
|
60
|
+
const onPageChange = vi.fn()
|
|
61
|
+
const { result } = renderHook(() => usePagination({ count: 95, onPageChange }))
|
|
62
|
+
act(() => result.current.previous())
|
|
63
|
+
expect(onPageChange).not.toHaveBeenCalled()
|
|
64
|
+
act(() => result.current.last())
|
|
65
|
+
expect(result.current.page).toBe(10)
|
|
66
|
+
expect(result.current.range).toEqual({ from: 91, to: 95 })
|
|
67
|
+
expect(result.current.canNext).toBe(false)
|
|
68
|
+
act(() => result.current.setPage(42))
|
|
69
|
+
expect(result.current.page).toBe(10)
|
|
70
|
+
act(() => result.current.previous())
|
|
71
|
+
expect(result.current.page).toBe(9)
|
|
72
|
+
act(() => result.current.first())
|
|
73
|
+
expect(onPageChange.mock.calls.map(([page]) => page)).toEqual([10, 9, 1])
|
|
74
|
+
})
|
|
75
|
+
|
|
76
|
+
it("is controlled by page", () => {
|
|
77
|
+
const onPageChange = vi.fn()
|
|
78
|
+
const { result, rerender } = renderHook(
|
|
79
|
+
({ page }) => usePagination({ pages: 5, page, onPageChange }),
|
|
80
|
+
{ initialProps: { page: 2 } },
|
|
81
|
+
)
|
|
82
|
+
act(() => result.current.next())
|
|
83
|
+
expect(onPageChange).toHaveBeenCalledWith(3)
|
|
84
|
+
expect(result.current.page).toBe(2)
|
|
85
|
+
rerender({ page: 3 })
|
|
86
|
+
expect(result.current.page).toBe(3)
|
|
87
|
+
})
|
|
88
|
+
|
|
89
|
+
it("clamps a page beyond a shrunk total", () => {
|
|
90
|
+
const { result } = renderHook(() => usePagination({ pages: 2, defaultPage: 5 }))
|
|
91
|
+
expect(result.current.page).toBe(2)
|
|
92
|
+
})
|
|
93
|
+
|
|
94
|
+
it("reports an empty list as one page with nothing on it", () => {
|
|
95
|
+
const { result } = renderHook(() => usePagination({ count: 0 }))
|
|
96
|
+
expect(result.current).toMatchObject({
|
|
97
|
+
page: 1,
|
|
98
|
+
totalPages: 0,
|
|
99
|
+
items: [],
|
|
100
|
+
range: { from: 0, to: 0 },
|
|
101
|
+
canPrevious: false,
|
|
102
|
+
canNext: false,
|
|
103
|
+
})
|
|
104
|
+
})
|
|
105
|
+
})
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import { useUncontrolled } from "./use-uncontrolled"
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* One slot of a pagination bar: a page number, or an ellipsis standing in for
|
|
5
|
+
* the pages it hides. `index` is the slot's position in `items`, a stable key.
|
|
6
|
+
*/
|
|
7
|
+
export type PaginationItem = { type: "page"; value: number } | { type: "ellipsis"; index: number }
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* How many pages there are. Either the item total and the page size (the
|
|
11
|
+
* usual case: the server tells you how many rows match), or the page count
|
|
12
|
+
* itself (a CMS that already knows it has 12 pages).
|
|
13
|
+
*/
|
|
14
|
+
export type PaginationTotal =
|
|
15
|
+
| {
|
|
16
|
+
/** How many items there are in all. With `pageSize`, sets the page count. */
|
|
17
|
+
count: number
|
|
18
|
+
/** How many items one page holds. @default 10 */
|
|
19
|
+
pageSize?: number
|
|
20
|
+
pages?: never
|
|
21
|
+
}
|
|
22
|
+
| {
|
|
23
|
+
/** How many pages there are, when you know it directly. */
|
|
24
|
+
pages: number
|
|
25
|
+
count?: never
|
|
26
|
+
pageSize?: never
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export type UsePaginationOptions = PaginationTotal & {
|
|
30
|
+
/** The current page, 1-based, when you control it. */
|
|
31
|
+
page?: number
|
|
32
|
+
/** The page to start on when uncontrolled. @default 1 */
|
|
33
|
+
defaultPage?: number
|
|
34
|
+
/** Called with the next page (1-based) when it changes. */
|
|
35
|
+
onPageChange?: (page: number) => void
|
|
36
|
+
/** How many pages stay visible on each side of the current one. @default 1 */
|
|
37
|
+
siblings?: number
|
|
38
|
+
/** How many pages stay visible at each end of the bar. @default 1 */
|
|
39
|
+
boundaries?: number
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export type UsePaginationReturnValue = {
|
|
43
|
+
/** The current page, 1-based, clamped to `[1, totalPages]`. `1` when there are no pages. */
|
|
44
|
+
page: number
|
|
45
|
+
/** How many pages there are. `0` when there is nothing to page through. */
|
|
46
|
+
totalPages: number
|
|
47
|
+
/** The pages to draw, with an ellipsis wherever pages are hidden. The length
|
|
48
|
+
* holds steady as the page moves (`2 × siblings + 2 × boundaries + 3` once
|
|
49
|
+
* there are more pages than that), so the bar never shifts under the pointer. */
|
|
50
|
+
items: PaginationItem[]
|
|
51
|
+
/** The items on the current page, 1-based and inclusive (`{ from: 21, to: 30 }`):
|
|
52
|
+
* what a "21–30 of 95" line prints, and `data.slice(from - 1, to)` for a
|
|
53
|
+
* list paged on the client. `null` when the total was given as `pages`. */
|
|
54
|
+
range: { from: number; to: number } | null
|
|
55
|
+
/** Whether there is a page before this one. */
|
|
56
|
+
canPrevious: boolean
|
|
57
|
+
/** Whether there is a page after this one. */
|
|
58
|
+
canNext: boolean
|
|
59
|
+
/** Moves to `page`, clamped to the existing pages. Does nothing for the current page. */
|
|
60
|
+
setPage: (page: number) => void
|
|
61
|
+
/** Moves to the previous page, if any. */
|
|
62
|
+
previous: () => void
|
|
63
|
+
/** Moves to the next page, if any. */
|
|
64
|
+
next: () => void
|
|
65
|
+
/** Moves to the first page. */
|
|
66
|
+
first: () => void
|
|
67
|
+
/** Moves to the last page. */
|
|
68
|
+
last: () => void
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/** `[start, start + 1, …, end]`, or `[]` when `end < start`. */
|
|
72
|
+
const span = (start: number, end: number) =>
|
|
73
|
+
Array.from({ length: Math.max(end - start + 1, 0) }, (_, i) => start + i)
|
|
74
|
+
|
|
75
|
+
const ELLIPSIS = "ellipsis" as const
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* The page numbers to draw around `page`, with `"ellipsis"` for each run of
|
|
79
|
+
* hidden pages. Always the first and last `boundaries` pages, `siblings` on
|
|
80
|
+
* each side of `page`, and a constant slot count once the pages outnumber
|
|
81
|
+
* the slots: an ellipsis that would hide a single page shows that page
|
|
82
|
+
* instead, so the bar keeps its width as you page through it.
|
|
83
|
+
*/
|
|
84
|
+
export const paginationRange = ({
|
|
85
|
+
page,
|
|
86
|
+
totalPages,
|
|
87
|
+
siblings = 1,
|
|
88
|
+
boundaries = 1,
|
|
89
|
+
}: {
|
|
90
|
+
page: number
|
|
91
|
+
totalPages: number
|
|
92
|
+
siblings?: number
|
|
93
|
+
boundaries?: number
|
|
94
|
+
}): (number | typeof ELLIPSIS)[] => {
|
|
95
|
+
const slots = siblings * 2 + boundaries * 2 + 3
|
|
96
|
+
if (totalPages <= slots) return span(1, totalPages)
|
|
97
|
+
|
|
98
|
+
const left = Math.max(page - siblings, boundaries)
|
|
99
|
+
const right = Math.min(page + siblings, totalPages - boundaries)
|
|
100
|
+
const head = span(1, boundaries)
|
|
101
|
+
const tail = span(totalPages - boundaries + 1, totalPages)
|
|
102
|
+
const leftGap = left > boundaries + 2
|
|
103
|
+
const rightGap = right < totalPages - boundaries - 1
|
|
104
|
+
|
|
105
|
+
if (!leftGap) return [...span(1, siblings * 2 + boundaries + 2), ELLIPSIS, ...tail]
|
|
106
|
+
if (!rightGap) {
|
|
107
|
+
return [...head, ELLIPSIS, ...span(totalPages - siblings * 2 - boundaries - 1, totalPages)]
|
|
108
|
+
}
|
|
109
|
+
return [...head, ELLIPSIS, ...span(left, right), ELLIPSIS, ...tail]
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
const clamp = (page: number, totalPages: number) =>
|
|
113
|
+
Math.min(Math.max(Math.trunc(page), 1), Math.max(totalPages, 1))
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* The page math behind a pagination bar, without the bar: the current page
|
|
117
|
+
* (controlled or not), the page count, the items to draw with their
|
|
118
|
+
* ellipses, the range of items on the page, and the moves between pages.
|
|
119
|
+
* `Pagination` is built on it. Reach for it to draw a pager of your own, or
|
|
120
|
+
* to page a list on the client:
|
|
121
|
+
*
|
|
122
|
+
* ```tsx
|
|
123
|
+
* const { items, range, setPage } = usePagination({ count: rows.length, pageSize: 20 })
|
|
124
|
+
* const visible = rows.slice(range.from - 1, range.to)
|
|
125
|
+
* ```
|
|
126
|
+
*
|
|
127
|
+
* Pages are 1-based throughout, as they are printed.
|
|
128
|
+
*/
|
|
129
|
+
export function usePagination(options: UsePaginationOptions): UsePaginationReturnValue {
|
|
130
|
+
const { siblings = 1, boundaries = 1 } = options
|
|
131
|
+
const pageSize = Math.max(options.pageSize ?? 10, 1)
|
|
132
|
+
const count = options.count
|
|
133
|
+
const totalPages = Math.max(
|
|
134
|
+
count === undefined ? (options.pages ?? 0) : Math.ceil(count / pageSize),
|
|
135
|
+
0,
|
|
136
|
+
)
|
|
137
|
+
|
|
138
|
+
const [rawPage, setRawPage] = useUncontrolled({
|
|
139
|
+
value: options.page,
|
|
140
|
+
defaultValue: options.defaultPage,
|
|
141
|
+
finalValue: 1,
|
|
142
|
+
onChange: options.onPageChange,
|
|
143
|
+
})
|
|
144
|
+
// A shrinking total (a filter that leaves two pages while you're on the
|
|
145
|
+
// fifth) clamps what's drawn; the state itself waits for the next move.
|
|
146
|
+
const page = clamp(rawPage, totalPages)
|
|
147
|
+
|
|
148
|
+
const setPage = (next: number) => {
|
|
149
|
+
const target = clamp(next, totalPages)
|
|
150
|
+
if (target !== page) setRawPage(target)
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
const items = paginationRange({ page, totalPages, siblings, boundaries }).map(
|
|
154
|
+
(slot, index): PaginationItem =>
|
|
155
|
+
slot === ELLIPSIS ? { type: "ellipsis", index } : { type: "page", value: slot },
|
|
156
|
+
)
|
|
157
|
+
|
|
158
|
+
const range =
|
|
159
|
+
count === undefined
|
|
160
|
+
? null
|
|
161
|
+
: {
|
|
162
|
+
from: count === 0 ? 0 : (page - 1) * pageSize + 1,
|
|
163
|
+
to: Math.min(page * pageSize, count),
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
return {
|
|
167
|
+
page,
|
|
168
|
+
totalPages,
|
|
169
|
+
items,
|
|
170
|
+
range,
|
|
171
|
+
canPrevious: page > 1,
|
|
172
|
+
canNext: page < totalPages,
|
|
173
|
+
setPage,
|
|
174
|
+
previous: () => setPage(page - 1),
|
|
175
|
+
next: () => setPage(page + 1),
|
|
176
|
+
first: () => setPage(1),
|
|
177
|
+
last: () => setPage(totalPages),
|
|
178
|
+
}
|
|
179
|
+
}
|