@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
|
@@ -0,0 +1,445 @@
|
|
|
1
|
+
import { devWarn } from "../../lib/dev-warn"
|
|
2
|
+
import {
|
|
3
|
+
type ConditionServices,
|
|
4
|
+
makeCondition,
|
|
5
|
+
matchRoute,
|
|
6
|
+
type RuntimeSetup,
|
|
7
|
+
resolveTarget,
|
|
8
|
+
sameState,
|
|
9
|
+
setupOf,
|
|
10
|
+
} from "./runtime"
|
|
11
|
+
import type {
|
|
12
|
+
ActionOptions,
|
|
13
|
+
AnyCondition,
|
|
14
|
+
CheckOptions,
|
|
15
|
+
CheckResult,
|
|
16
|
+
CombinedCondition,
|
|
17
|
+
Condition,
|
|
18
|
+
ConditionOptions,
|
|
19
|
+
ConditionSetup,
|
|
20
|
+
ConditionState,
|
|
21
|
+
ElementOptions,
|
|
22
|
+
RouteMatch,
|
|
23
|
+
TourChecklistItem,
|
|
24
|
+
TourContext,
|
|
25
|
+
TourTarget,
|
|
26
|
+
ValueOptions,
|
|
27
|
+
} from "./types"
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Step gates. Every helper is sugar over the same runtime `condition()` uses,
|
|
31
|
+
* so an app can write its own the same way.
|
|
32
|
+
*/
|
|
33
|
+
|
|
34
|
+
/** How long typing must pause before a failing `value()` shows its hint. */
|
|
35
|
+
export const HINT_DELAY = 800
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* The primitive every gate is built on. `setup` reports the state now,
|
|
39
|
+
* subscribes to whatever can change it, and returns the unsubscribe.
|
|
40
|
+
*
|
|
41
|
+
* ```ts
|
|
42
|
+
* const hasAvatar = condition((ctx, report) => {
|
|
43
|
+
* const check = (u: User) => report(u.avatar ? "valid" : "pending")
|
|
44
|
+
* check(userStore.getState())
|
|
45
|
+
* return userStore.subscribe(check)
|
|
46
|
+
* })
|
|
47
|
+
* ```
|
|
48
|
+
*
|
|
49
|
+
* Type `ctx.app` and `ctx.params` with the type arguments,
|
|
50
|
+
* `condition<{ queryClient: QueryClient }>(…)`: a tour using it must then
|
|
51
|
+
* declare that `App`, and `createTours` must be given it.
|
|
52
|
+
*
|
|
53
|
+
* In development, a setup that returns nothing and never reports is warned
|
|
54
|
+
* about when its step is left: it can never pass.
|
|
55
|
+
*/
|
|
56
|
+
export function condition<App = unknown, Params = unknown>(
|
|
57
|
+
setup: ConditionSetup<App, Params>,
|
|
58
|
+
options?: ConditionOptions,
|
|
59
|
+
): Condition<App, Params> {
|
|
60
|
+
return makeCondition(
|
|
61
|
+
(ctx, report) => {
|
|
62
|
+
let reported = false
|
|
63
|
+
const cleanup = setup(ctx as TourContext<App, Params>, (state) => {
|
|
64
|
+
reported = true
|
|
65
|
+
report(state)
|
|
66
|
+
})
|
|
67
|
+
if (cleanup) return cleanup
|
|
68
|
+
return () => {
|
|
69
|
+
if (!reported) {
|
|
70
|
+
devWarn(
|
|
71
|
+
"[tour] A condition() setup returned no cleanup and never reported: it can never pass.",
|
|
72
|
+
)
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
options?.advance ?? "auto",
|
|
77
|
+
options?.label,
|
|
78
|
+
)
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/** The element a helper watches: its own `target`, else the step's. */
|
|
82
|
+
const watched = (target: TourTarget | undefined, stepTarget: () => HTMLElement | null) =>
|
|
83
|
+
(target === undefined ? null : resolveTarget(target)) ?? stepTarget()
|
|
84
|
+
|
|
85
|
+
/** Listens on the document, in the capture phase, so an element that
|
|
86
|
+
* re-renders (and is replaced) between steps is still heard. */
|
|
87
|
+
const listen = <K extends keyof DocumentEventMap>(
|
|
88
|
+
type: K,
|
|
89
|
+
handler: (event: DocumentEventMap[K]) => void,
|
|
90
|
+
) => {
|
|
91
|
+
document.addEventListener(type, handler, true)
|
|
92
|
+
return () => document.removeEventListener(type, handler, true)
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/** Valid once the target (or `options.target`) is clicked. Advances by itself. */
|
|
96
|
+
export function click(options?: ActionOptions): Condition {
|
|
97
|
+
return makeCondition(
|
|
98
|
+
(_ctx, report, services) => {
|
|
99
|
+
report("pending")
|
|
100
|
+
return listen("click", (event) => {
|
|
101
|
+
const element = watched(options?.target, services.target)
|
|
102
|
+
if (element && event.target instanceof Node && element.contains(event.target))
|
|
103
|
+
report("valid")
|
|
104
|
+
})
|
|
105
|
+
},
|
|
106
|
+
options?.advance ?? "auto",
|
|
107
|
+
options?.label,
|
|
108
|
+
)
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/** A form field, or the first one inside `element`. */
|
|
112
|
+
type Field = HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement
|
|
113
|
+
const fieldOf = (element: HTMLElement | null): Field | null => {
|
|
114
|
+
if (!element) return null
|
|
115
|
+
if (
|
|
116
|
+
element instanceof HTMLInputElement ||
|
|
117
|
+
element instanceof HTMLTextAreaElement ||
|
|
118
|
+
element instanceof HTMLSelectElement
|
|
119
|
+
) {
|
|
120
|
+
return element
|
|
121
|
+
}
|
|
122
|
+
return element.querySelector<Field>("input, textarea, select")
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* The shared body of `value()` and `value.valid()`: valid as soon as the check
|
|
127
|
+
* passes; a failure stays pending while the user types, and shows the hint
|
|
128
|
+
* after a pause (`HINT_DELAY`) or when the field loses focus.
|
|
129
|
+
*/
|
|
130
|
+
const fieldCondition = (
|
|
131
|
+
test: (field: Field) => boolean,
|
|
132
|
+
hint: (field: Field) => string | undefined,
|
|
133
|
+
options: ValueOptions | undefined,
|
|
134
|
+
): Condition =>
|
|
135
|
+
makeCondition(
|
|
136
|
+
(_ctx, report, services) => {
|
|
137
|
+
let timer: ReturnType<typeof setTimeout> | undefined
|
|
138
|
+
const field = () => fieldOf(watched(options?.target, services.target))
|
|
139
|
+
const failed = (element: Field): ConditionState => {
|
|
140
|
+
const message = hint(element)
|
|
141
|
+
return message ? { invalid: message } : "pending"
|
|
142
|
+
}
|
|
143
|
+
const evaluate = (element: Field | null, settle: boolean) => {
|
|
144
|
+
clearTimeout(timer)
|
|
145
|
+
if (!element) return report("pending")
|
|
146
|
+
if (test(element)) return report("valid")
|
|
147
|
+
if (settle) return report(failed(element))
|
|
148
|
+
report("pending")
|
|
149
|
+
timer = setTimeout(() => report(failed(element)), HINT_DELAY)
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
const initial = field()
|
|
153
|
+
report(initial && test(initial) ? "valid" : "pending")
|
|
154
|
+
|
|
155
|
+
const onEdit = (event: Event) => {
|
|
156
|
+
const element = field()
|
|
157
|
+
if (element && event.target === element) evaluate(element, false)
|
|
158
|
+
}
|
|
159
|
+
const onBlur = (event: FocusEvent) => {
|
|
160
|
+
const element = field()
|
|
161
|
+
if (element && event.target === element) evaluate(element, true)
|
|
162
|
+
}
|
|
163
|
+
const stops = [listen("input", onEdit), listen("change", onEdit), listen("focusout", onBlur)]
|
|
164
|
+
return () => {
|
|
165
|
+
clearTimeout(timer)
|
|
166
|
+
for (const stop of stops) stop()
|
|
167
|
+
}
|
|
168
|
+
},
|
|
169
|
+
options?.advance ?? "manual",
|
|
170
|
+
options?.label,
|
|
171
|
+
)
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* Checks a field's value. Invalid shows `hint` after the field loses focus or
|
|
175
|
+
* the user pauses typing. Waits for Next once valid.
|
|
176
|
+
*
|
|
177
|
+
* ```ts
|
|
178
|
+
* until: value((v) => v.trim().length >= 3, { hint: "At least 3 characters" })
|
|
179
|
+
* ```
|
|
180
|
+
*/
|
|
181
|
+
export function value(check: (value: string) => boolean, options?: ValueOptions): Condition {
|
|
182
|
+
return fieldCondition(
|
|
183
|
+
(field) => check(field.value),
|
|
184
|
+
() => options?.hint,
|
|
185
|
+
options,
|
|
186
|
+
)
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
/** Reads the browser's constraint validation, so a field's `required` or
|
|
190
|
+
* `pattern` is the check. The hint defaults to the browser's message. */
|
|
191
|
+
value.valid = (options?: ValueOptions): Condition =>
|
|
192
|
+
fieldCondition(
|
|
193
|
+
(field) => field.checkValidity(),
|
|
194
|
+
(field) => options?.hint ?? (field.validationMessage || undefined),
|
|
195
|
+
options,
|
|
196
|
+
)
|
|
197
|
+
|
|
198
|
+
/** Valid once the target's form (or the target, if it is one) is submitted.
|
|
199
|
+
* Advances by itself. */
|
|
200
|
+
export function submit(options?: ActionOptions): Condition {
|
|
201
|
+
return makeCondition(
|
|
202
|
+
(_ctx, report, services) => {
|
|
203
|
+
report("pending")
|
|
204
|
+
return listen("submit", (event) => {
|
|
205
|
+
const element = watched(options?.target, services.target)
|
|
206
|
+
const form = element instanceof HTMLFormElement ? element : element?.closest("form")
|
|
207
|
+
if (form && event.target === form) report("valid")
|
|
208
|
+
})
|
|
209
|
+
},
|
|
210
|
+
options?.advance ?? "auto",
|
|
211
|
+
options?.label,
|
|
212
|
+
)
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
/** Valid once the pathname matches, read through `createTours({ location })`.
|
|
216
|
+
* Advances by itself. */
|
|
217
|
+
export function route(match: RouteMatch, options?: ConditionOptions): Condition {
|
|
218
|
+
const test = typeof match === "string" ? (path: string) => matchRoute(match, path) : match
|
|
219
|
+
return makeCondition(
|
|
220
|
+
(_ctx, report, services) => {
|
|
221
|
+
const check = () => report(test(services.location.get()) ? "valid" : "pending")
|
|
222
|
+
check()
|
|
223
|
+
return services.location.subscribe(check)
|
|
224
|
+
},
|
|
225
|
+
options?.advance ?? "auto",
|
|
226
|
+
options?.label,
|
|
227
|
+
)
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
/** Whether an element is on the page and rendered. */
|
|
231
|
+
const isVisible = (element: Element | null) => {
|
|
232
|
+
if (!element?.isConnected || element.closest("[hidden]")) return false
|
|
233
|
+
const style = getComputedStyle(element)
|
|
234
|
+
return style.display !== "none" && style.visibility !== "hidden"
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
/** Valid once an element is visible (or gone, with `state: "hidden"`).
|
|
238
|
+
* Advances by itself. */
|
|
239
|
+
export function element(selector: string, options?: ElementOptions): Condition {
|
|
240
|
+
const wanted = options?.state ?? "visible"
|
|
241
|
+
return makeCondition(
|
|
242
|
+
(_ctx, report) => {
|
|
243
|
+
const check = () => {
|
|
244
|
+
const visible = isVisible(resolveTarget(selector))
|
|
245
|
+
report(visible === (wanted === "visible") ? "valid" : "pending")
|
|
246
|
+
}
|
|
247
|
+
check()
|
|
248
|
+
const observer = new MutationObserver(check)
|
|
249
|
+
observer.observe(document.documentElement, {
|
|
250
|
+
childList: true,
|
|
251
|
+
subtree: true,
|
|
252
|
+
attributes: true,
|
|
253
|
+
attributeFilter: ["class", "style", "hidden"],
|
|
254
|
+
})
|
|
255
|
+
return () => observer.disconnect()
|
|
256
|
+
},
|
|
257
|
+
options?.advance ?? "auto",
|
|
258
|
+
options?.label,
|
|
259
|
+
)
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
/**
|
|
263
|
+
* Valid once the app fires `tours.signal(name)`, and `match` (if given)
|
|
264
|
+
* accepts its payload. Advances by itself. `name` becomes one of the
|
|
265
|
+
* registry's typed signal names. A signal fired earlier in the same run,
|
|
266
|
+
* before any step waited on it, counts: the step passes straight away. One
|
|
267
|
+
* fired while no tour runs is dropped.
|
|
268
|
+
*/
|
|
269
|
+
export function signal<const Name extends string>(
|
|
270
|
+
name: Name,
|
|
271
|
+
match?: (payload: unknown) => boolean,
|
|
272
|
+
options?: ConditionOptions,
|
|
273
|
+
): Condition<unknown, unknown, never, Name> {
|
|
274
|
+
return makeCondition(
|
|
275
|
+
(_ctx, report, services) => {
|
|
276
|
+
report("pending")
|
|
277
|
+
return services.onSignal(name, (payload) => {
|
|
278
|
+
const accepted = !match || match(payload)
|
|
279
|
+
if (accepted) report("valid")
|
|
280
|
+
return accepted
|
|
281
|
+
})
|
|
282
|
+
},
|
|
283
|
+
options?.advance ?? "auto",
|
|
284
|
+
options?.label,
|
|
285
|
+
)
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
/** A `check()` result as a state. */
|
|
289
|
+
const toState = (result: CheckResult): ConditionState => {
|
|
290
|
+
if (result === true) return "valid"
|
|
291
|
+
if (result === false) return "pending"
|
|
292
|
+
return result
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
/**
|
|
296
|
+
* Asks something async, typically the server. The card shows a loading state
|
|
297
|
+
* while it runs; `ctx.signal` aborts when the step is left. Runs once, or
|
|
298
|
+
* again every `interval` ms until it passes. A rejection counts as pending
|
|
299
|
+
* (and is retried on the next interval). Advances by itself.
|
|
300
|
+
*/
|
|
301
|
+
export function check<App = unknown, Params = unknown>(
|
|
302
|
+
run: (ctx: TourContext<App, Params>) => Promise<CheckResult>,
|
|
303
|
+
options?: CheckOptions,
|
|
304
|
+
): Condition<App, Params> {
|
|
305
|
+
return makeCondition(
|
|
306
|
+
(ctx, report, services) => {
|
|
307
|
+
let timer: ReturnType<typeof setTimeout> | undefined
|
|
308
|
+
const attempt = () => {
|
|
309
|
+
services.setChecking(true)
|
|
310
|
+
run(ctx as TourContext<App, Params>)
|
|
311
|
+
.then(toState, () => "pending" as const)
|
|
312
|
+
.then((state) => {
|
|
313
|
+
if (ctx.signal.aborted) return
|
|
314
|
+
services.setChecking(false)
|
|
315
|
+
report(state)
|
|
316
|
+
if (state !== "valid" && options?.interval)
|
|
317
|
+
timer = setTimeout(attempt, options.interval)
|
|
318
|
+
})
|
|
319
|
+
}
|
|
320
|
+
report("pending")
|
|
321
|
+
attempt()
|
|
322
|
+
return () => {
|
|
323
|
+
clearTimeout(timer)
|
|
324
|
+
services.setChecking(false)
|
|
325
|
+
}
|
|
326
|
+
},
|
|
327
|
+
options?.advance ?? "auto",
|
|
328
|
+
options?.label,
|
|
329
|
+
)
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
/** Runs each member condition with its own `report`, and calls `combine` with
|
|
333
|
+
* every member's latest state on each change. */
|
|
334
|
+
const runMembers = (
|
|
335
|
+
members: readonly (readonly [string, AnyCondition])[],
|
|
336
|
+
combine: (states: ConditionState[]) => void,
|
|
337
|
+
ctx: Parameters<RuntimeSetup>[0],
|
|
338
|
+
services: ConditionServices,
|
|
339
|
+
) => {
|
|
340
|
+
const states: ConditionState[] = members.map(() => "pending")
|
|
341
|
+
let ready = false
|
|
342
|
+
const cleanups = members.map(([, member], index) =>
|
|
343
|
+
setupOf(member)(
|
|
344
|
+
ctx,
|
|
345
|
+
(state) => {
|
|
346
|
+
if (sameState(states[index] ?? null, state)) return
|
|
347
|
+
states[index] = state
|
|
348
|
+
if (ready) combine(states)
|
|
349
|
+
},
|
|
350
|
+
{ ...services, setChecklist: () => {} },
|
|
351
|
+
),
|
|
352
|
+
)
|
|
353
|
+
ready = true
|
|
354
|
+
combine(states)
|
|
355
|
+
return () => {
|
|
356
|
+
for (const cleanup of cleanups) cleanup?.()
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
/** The first `{ invalid }` among `states`, if any. */
|
|
361
|
+
const firstInvalid = (states: readonly ConditionState[]) =>
|
|
362
|
+
states.find((state) => typeof state === "object")
|
|
363
|
+
|
|
364
|
+
/**
|
|
365
|
+
* Valid once every condition is. The card shows a small checklist, one line
|
|
366
|
+
* per key (or per condition's `label`). Waits for Next once valid.
|
|
367
|
+
*
|
|
368
|
+
* ```ts
|
|
369
|
+
* until: all({ title: value(…), date: value(…) })
|
|
370
|
+
* ```
|
|
371
|
+
*/
|
|
372
|
+
export function all<const C extends Record<string, AnyCondition>>(
|
|
373
|
+
conditions: C,
|
|
374
|
+
options?: ConditionOptions,
|
|
375
|
+
): CombinedCondition<C> {
|
|
376
|
+
const members = Object.entries(conditions)
|
|
377
|
+
return makeCondition(
|
|
378
|
+
(ctx, report, services) => {
|
|
379
|
+
const stop = runMembers(
|
|
380
|
+
members,
|
|
381
|
+
(states) => {
|
|
382
|
+
services.setChecklist(
|
|
383
|
+
members.map(
|
|
384
|
+
([key, member], index): TourChecklistItem => ({
|
|
385
|
+
key,
|
|
386
|
+
label: member.label ?? key,
|
|
387
|
+
state: states[index] ?? "pending",
|
|
388
|
+
}),
|
|
389
|
+
),
|
|
390
|
+
)
|
|
391
|
+
if (states.every((state) => state === "valid")) report("valid")
|
|
392
|
+
else report(firstInvalid(states) ?? "pending")
|
|
393
|
+
},
|
|
394
|
+
ctx,
|
|
395
|
+
services,
|
|
396
|
+
)
|
|
397
|
+
return () => {
|
|
398
|
+
stop()
|
|
399
|
+
services.setChecklist(null)
|
|
400
|
+
}
|
|
401
|
+
},
|
|
402
|
+
options?.advance ?? "manual",
|
|
403
|
+
options?.label,
|
|
404
|
+
)
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
/** Valid once any condition is: `any(click(), submit())`. Advances by itself. */
|
|
408
|
+
export function any<const C extends readonly AnyCondition[]>(
|
|
409
|
+
...conditions: C
|
|
410
|
+
): CombinedCondition<C> {
|
|
411
|
+
const members = conditions.map((member, index) => [String(index), member] as const)
|
|
412
|
+
return makeCondition(
|
|
413
|
+
(ctx, report, services) =>
|
|
414
|
+
runMembers(
|
|
415
|
+
members,
|
|
416
|
+
(states) => {
|
|
417
|
+
if (states.some((state) => state === "valid")) report("valid")
|
|
418
|
+
else report(firstInvalid(states) ?? "pending")
|
|
419
|
+
},
|
|
420
|
+
ctx,
|
|
421
|
+
services,
|
|
422
|
+
),
|
|
423
|
+
"auto",
|
|
424
|
+
)
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
/**
|
|
428
|
+
* Waits on a keyed value that a component reports with `useTourGate(key,
|
|
429
|
+
* state)`, for state that only lives in React. `key` becomes one of the
|
|
430
|
+
* registry's typed gate keys. Advances by itself.
|
|
431
|
+
*/
|
|
432
|
+
export function gate<const Key extends string>(
|
|
433
|
+
key: Key,
|
|
434
|
+
options?: ConditionOptions,
|
|
435
|
+
): Condition<unknown, unknown, Key> {
|
|
436
|
+
return makeCondition(
|
|
437
|
+
(_ctx, report, services) => {
|
|
438
|
+
const check = () => report(services.gates.get(key))
|
|
439
|
+
check()
|
|
440
|
+
return services.gates.subscribe(key, check)
|
|
441
|
+
},
|
|
442
|
+
options?.advance ?? "auto",
|
|
443
|
+
options?.label,
|
|
444
|
+
)
|
|
445
|
+
}
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import { type ReactNode, useEffect, useMemo, useSyncExternalStore } from "react"
|
|
4
|
+
import { createTourEngine } from "./store"
|
|
5
|
+
import { TourRenderer, type TourRendererProps } from "./tour"
|
|
6
|
+
import type {
|
|
7
|
+
ConditionState,
|
|
8
|
+
CreateToursConfig,
|
|
9
|
+
NoTourParams,
|
|
10
|
+
TourController,
|
|
11
|
+
TourDefinition,
|
|
12
|
+
TourEvent,
|
|
13
|
+
TourInput,
|
|
14
|
+
TourParams,
|
|
15
|
+
TourRegistry,
|
|
16
|
+
TourRenderProps,
|
|
17
|
+
TourSnapshot,
|
|
18
|
+
TourStorage,
|
|
19
|
+
ToursHandle,
|
|
20
|
+
ToursProps,
|
|
21
|
+
} from "./types"
|
|
22
|
+
|
|
23
|
+
/** The tour builder `defineTour<Params, App>()` returns. */
|
|
24
|
+
export type DefineTour<Params extends TourParams, App> = <
|
|
25
|
+
const Id extends string,
|
|
26
|
+
Gate extends string = never,
|
|
27
|
+
Signal extends string = never,
|
|
28
|
+
>(
|
|
29
|
+
tour: TourInput<Id, Params, App, Gate, Signal>,
|
|
30
|
+
) => TourDefinition<Id, Params, App, Gate, Signal>
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Defines a tour: data, kept next to the feature it explains. Step ids are
|
|
34
|
+
* inferred, so `goto`, `from` and `choices` are checked against them, and so
|
|
35
|
+
* are the gate keys and signal names its conditions wait on.
|
|
36
|
+
*
|
|
37
|
+
* A tour without params or app needs takes its steps directly:
|
|
38
|
+
* ```ts
|
|
39
|
+
* export const welcome = defineTour({
|
|
40
|
+
* steps: [{ id: "hello", type: "dialog", title: "Welcome" }],
|
|
41
|
+
* })
|
|
42
|
+
* ```
|
|
43
|
+
*
|
|
44
|
+
* A tour that reads `ctx.params` or `ctx.app` names them first:
|
|
45
|
+
* ```ts
|
|
46
|
+
* export const projectSetup = defineTour<{ campus?: string }>()({
|
|
47
|
+
* version: 2,
|
|
48
|
+
* steps: [
|
|
49
|
+
* { id: "campus", target: "[data-tour=campus]", title: "Pick a campus",
|
|
50
|
+
* when: (ctx) => ctx.params.campus === undefined },
|
|
51
|
+
* { id: "create", target: "[data-tour=create]", title: "Create it", until: click() },
|
|
52
|
+
* ],
|
|
53
|
+
* })
|
|
54
|
+
* ```
|
|
55
|
+
*/
|
|
56
|
+
export function defineTour<
|
|
57
|
+
const Id extends string,
|
|
58
|
+
Gate extends string = never,
|
|
59
|
+
Signal extends string = never,
|
|
60
|
+
>(
|
|
61
|
+
tour: TourInput<Id, NoTourParams, unknown, Gate, Signal>,
|
|
62
|
+
): TourDefinition<Id, NoTourParams, unknown, Gate, Signal>
|
|
63
|
+
export function defineTour<Params extends TourParams = NoTourParams, App = unknown>(): DefineTour<
|
|
64
|
+
Params,
|
|
65
|
+
App
|
|
66
|
+
>
|
|
67
|
+
export function defineTour(tour?: unknown): unknown {
|
|
68
|
+
type Input = TourInput<string, unknown, unknown, string, string>
|
|
69
|
+
const build = (input: Input) => ({
|
|
70
|
+
...input,
|
|
71
|
+
version: input.version ?? 1,
|
|
72
|
+
})
|
|
73
|
+
return tour === undefined ? build : build(tour as Input)
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* `createTours(config)`: the tours manager. Returns a bound `tours`
|
|
78
|
+
* controller (callable from anywhere), a `<Tours />` renderer to mount once
|
|
79
|
+
* near the app root, `useTours()` and `useTourGate()`.
|
|
80
|
+
*
|
|
81
|
+
* Typed through the registry like `createOverlays`, with no module
|
|
82
|
+
* augmentation:
|
|
83
|
+
* ```tsx
|
|
84
|
+
* export const { tours, Tours, useTours, useTourGate } = createTours({
|
|
85
|
+
* registry: { onboarding, projectSetup },
|
|
86
|
+
* app: { queryClient },
|
|
87
|
+
* storage: localStorageTours("42:tours"),
|
|
88
|
+
* onEvent: (event) => analytics.track(event.type, event),
|
|
89
|
+
* })
|
|
90
|
+
*
|
|
91
|
+
* const result = await tours.start("projectSetup", { params: { campus } })
|
|
92
|
+
* ```
|
|
93
|
+
*/
|
|
94
|
+
export function createTours<
|
|
95
|
+
const R extends TourRegistry,
|
|
96
|
+
Storage extends TourStorage | undefined = undefined,
|
|
97
|
+
>(
|
|
98
|
+
config: CreateToursConfig<R, Storage>,
|
|
99
|
+
): ToursHandle<R, Storage extends TourStorage ? true : false> {
|
|
100
|
+
const engine = createTourEngine({
|
|
101
|
+
registry: config.registry,
|
|
102
|
+
app: (config as { app?: unknown }).app,
|
|
103
|
+
location: config.location,
|
|
104
|
+
storage: config.storage,
|
|
105
|
+
onEvent: config.onEvent as ((event: TourEvent) => void) | undefined,
|
|
106
|
+
})
|
|
107
|
+
type Handle = ToursHandle<R, Storage extends TourStorage ? true : false>
|
|
108
|
+
// The engine is untyped inside; the registry's types are laid over it here,
|
|
109
|
+
// the way `createOverlays` presents its loose store entries.
|
|
110
|
+
const tours = engine.controller as unknown as Handle["tours"]
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* The renderer. Mount it once, near the app root. It registers the running
|
|
114
|
+
* tour as a layer (`lib/overlay-layer.tsx`), so page-level hotkeys yield to
|
|
115
|
+
* it like they do to a modal, and floating panels opened during it rise
|
|
116
|
+
* above it.
|
|
117
|
+
*/
|
|
118
|
+
const Tours = (props: ToursProps) => {
|
|
119
|
+
const active = useSyncExternalStore(engine.subscribe, engine.getSnapshot, () => null)
|
|
120
|
+
return (
|
|
121
|
+
<TourRenderer
|
|
122
|
+
active={active}
|
|
123
|
+
tours={engine.controller as unknown as TourController}
|
|
124
|
+
registry={config.registry as unknown as TourRendererProps["registry"]}
|
|
125
|
+
translations={config.translations}
|
|
126
|
+
render={config.render as ((props: TourRenderProps) => ReactNode) | undefined}
|
|
127
|
+
{...props}
|
|
128
|
+
/>
|
|
129
|
+
)
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
const useTours = () => {
|
|
133
|
+
const active = useSyncExternalStore(engine.subscribe, engine.getSnapshot, () => null)
|
|
134
|
+
return useMemo(() => [active as TourSnapshot<R> | null, tours] as const, [active])
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/** Writes the gate on each render where its state changes, and forgets it
|
|
138
|
+
* when the component unmounts (the gate reads pending again). Cheap when
|
|
139
|
+
* no step waits on it: a map write with no listener. */
|
|
140
|
+
const useTourGate = (key: string, state: ConditionState) => {
|
|
141
|
+
const invalid = typeof state === "object" ? state.invalid : undefined
|
|
142
|
+
const flat = typeof state === "object" ? "invalid" : state
|
|
143
|
+
useEffect(() => {
|
|
144
|
+
engine.gates.set(key, flat === "invalid" ? { invalid: invalid ?? "" } : flat)
|
|
145
|
+
}, [key, flat, invalid])
|
|
146
|
+
useEffect(() => () => engine.gates.remove(key), [key])
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
return { tours, Tours, useTours, useTourGate } as unknown as Handle
|
|
150
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
export {
|
|
4
|
+
all,
|
|
5
|
+
any,
|
|
6
|
+
check,
|
|
7
|
+
click,
|
|
8
|
+
condition,
|
|
9
|
+
element,
|
|
10
|
+
gate,
|
|
11
|
+
route,
|
|
12
|
+
signal,
|
|
13
|
+
submit,
|
|
14
|
+
value,
|
|
15
|
+
} from "./conditions"
|
|
16
|
+
export { createTours, type DefineTour, defineTour } from "./create-tours"
|
|
17
|
+
export { localStorageTours } from "./storage"
|
|
18
|
+
export { DEFAULT_TRANSLATIONS, Tour, type TourArrowProps } from "./tour"
|
|
19
|
+
export type {
|
|
20
|
+
ActionOptions,
|
|
21
|
+
AnyCondition,
|
|
22
|
+
AnyTourDefinition,
|
|
23
|
+
CheckOptions,
|
|
24
|
+
CheckResult,
|
|
25
|
+
CombinedCondition,
|
|
26
|
+
Condition,
|
|
27
|
+
ConditionCleanup,
|
|
28
|
+
ConditionOptions,
|
|
29
|
+
ConditionReport,
|
|
30
|
+
ConditionSetup,
|
|
31
|
+
ConditionState,
|
|
32
|
+
CreateToursConfig,
|
|
33
|
+
ElementOptions,
|
|
34
|
+
GateKeyOf,
|
|
35
|
+
NoTourParams,
|
|
36
|
+
RouteMatch,
|
|
37
|
+
SignalOf,
|
|
38
|
+
StepIdOf,
|
|
39
|
+
TourAction,
|
|
40
|
+
TourActionType,
|
|
41
|
+
TourAdvance,
|
|
42
|
+
TourAnswers,
|
|
43
|
+
TourAppOf,
|
|
44
|
+
TourChecklistItem,
|
|
45
|
+
TourChoice,
|
|
46
|
+
TourClassNames,
|
|
47
|
+
TourContext,
|
|
48
|
+
TourContextTours,
|
|
49
|
+
TourController,
|
|
50
|
+
TourDefinition,
|
|
51
|
+
TourEndStatus,
|
|
52
|
+
TourEvent,
|
|
53
|
+
TourEventOf,
|
|
54
|
+
TourEventType,
|
|
55
|
+
TourHelp,
|
|
56
|
+
TourIconSlot,
|
|
57
|
+
TourIcons,
|
|
58
|
+
TourInput,
|
|
59
|
+
TourKey,
|
|
60
|
+
TourLocation,
|
|
61
|
+
TourParams,
|
|
62
|
+
TourParamsOf,
|
|
63
|
+
TourRecord,
|
|
64
|
+
TourRegistry,
|
|
65
|
+
TourRenderProps,
|
|
66
|
+
TourResult,
|
|
67
|
+
TourRunId,
|
|
68
|
+
TourSlot,
|
|
69
|
+
TourSnapshot,
|
|
70
|
+
TourSnapshotOf,
|
|
71
|
+
TourStartArgs,
|
|
72
|
+
TourStartOptions,
|
|
73
|
+
TourStep,
|
|
74
|
+
TourStepPatch,
|
|
75
|
+
TourStepState,
|
|
76
|
+
TourStepType,
|
|
77
|
+
TourStorage,
|
|
78
|
+
ToursHandle,
|
|
79
|
+
ToursProps,
|
|
80
|
+
TourTarget,
|
|
81
|
+
TourTranslations,
|
|
82
|
+
TourWait,
|
|
83
|
+
UseTourGate,
|
|
84
|
+
UseToursReturn,
|
|
85
|
+
ValueOptions,
|
|
86
|
+
} from "./types"
|