@42-central/ui-react 0.29.1 → 0.30.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-X6DESK37.js → chunk-2RRTT4AF.js} +17 -5
- package/dist/chunk-2RRTT4AF.js.map +1 -0
- package/dist/{chunk-TUP7WXQE.js → chunk-322I2RSV.js} +9 -6
- package/dist/chunk-322I2RSV.js.map +1 -0
- package/dist/{chunk-ISX3AM32.js → chunk-37SRSNLJ.js} +4 -4
- package/dist/{chunk-ISX3AM32.js.map → chunk-37SRSNLJ.js.map} +1 -1
- package/dist/{chunk-L5GH7LLD.js → chunk-3MFWUG5O.js} +4 -4
- package/dist/{chunk-L5GH7LLD.js.map → chunk-3MFWUG5O.js.map} +1 -1
- package/dist/{chunk-FQJNQW3G.js → chunk-3XQEOJCE.js} +8 -5
- package/dist/chunk-3XQEOJCE.js.map +1 -0
- package/dist/{chunk-JKFPRQB2.js → chunk-4LSZ5JWF.js} +3 -3
- package/dist/{chunk-JKFPRQB2.js.map → chunk-4LSZ5JWF.js.map} +1 -1
- package/dist/{chunk-V2QZG4IT.js → chunk-5HWFYYHW.js} +27 -9
- package/dist/chunk-5HWFYYHW.js.map +1 -0
- package/dist/{chunk-GEZYGBXY.js → chunk-6MVFCS46.js} +99 -42
- package/dist/chunk-6MVFCS46.js.map +1 -0
- package/dist/{chunk-NNPSBC7O.js → chunk-6WZSUS3U.js} +10 -9
- package/dist/chunk-6WZSUS3U.js.map +1 -0
- package/dist/chunk-6YRGP6PS.js +138 -0
- package/dist/chunk-6YRGP6PS.js.map +1 -0
- package/dist/{chunk-B5YHYI7E.js → chunk-ALANKV5Y.js} +23 -6
- package/dist/chunk-ALANKV5Y.js.map +1 -0
- package/dist/{chunk-IA6DCC3N.js → chunk-AUQPNDE5.js} +23 -13
- package/dist/chunk-AUQPNDE5.js.map +1 -0
- package/dist/{chunk-AKXALCUN.js → chunk-D7SW2E24.js} +4 -4
- package/dist/chunk-D7SW2E24.js.map +1 -0
- package/dist/{chunk-OXR7BXZA.js → chunk-DQIYYDFD.js} +4 -3
- package/dist/chunk-DQIYYDFD.js.map +1 -0
- package/dist/{chunk-HMNXNKDA.js → chunk-FCBYUN6F.js} +4 -4
- package/dist/{chunk-HMNXNKDA.js.map → chunk-FCBYUN6F.js.map} +1 -1
- package/dist/{chunk-2W7H43WL.js → chunk-FED6SJWM.js} +23 -14
- package/dist/chunk-FED6SJWM.js.map +1 -0
- package/dist/{chunk-7E7JNWOC.js → chunk-FEPIHXVI.js} +6 -5
- package/dist/chunk-FEPIHXVI.js.map +1 -0
- package/dist/{chunk-Y57NW6G7.js → chunk-G3YOSG3U.js} +4 -4
- package/dist/{chunk-Y57NW6G7.js.map → chunk-G3YOSG3U.js.map} +1 -1
- package/dist/chunk-GZN5CXMR.js +100 -0
- package/dist/chunk-GZN5CXMR.js.map +1 -0
- package/dist/{chunk-HCHGERDB.js → chunk-HCSZPBWV.js} +17 -115
- package/dist/chunk-HCSZPBWV.js.map +1 -0
- package/dist/{chunk-I4B3N3UX.js → chunk-HTVICHT4.js} +12 -7
- package/dist/chunk-HTVICHT4.js.map +1 -0
- package/dist/chunk-I7TC2C3I.js +163 -0
- package/dist/chunk-I7TC2C3I.js.map +1 -0
- package/dist/{chunk-7FPSQBWB.js → chunk-IBXYLO2J.js} +14 -13
- package/dist/chunk-IBXYLO2J.js.map +1 -0
- package/dist/{chunk-7KFUFAVP.js → chunk-IRYG6B5A.js} +9 -8
- package/dist/chunk-IRYG6B5A.js.map +1 -0
- package/dist/{chunk-2RQLPN4U.js → chunk-JCNEW4WJ.js} +8 -8
- package/dist/{chunk-2RQLPN4U.js.map → chunk-JCNEW4WJ.js.map} +1 -1
- package/dist/{chunk-SP6LCCTZ.js → chunk-KZDMVOL6.js} +35 -8
- package/dist/chunk-KZDMVOL6.js.map +1 -0
- package/dist/chunk-LR5U6TZZ.js +169 -0
- package/dist/chunk-LR5U6TZZ.js.map +1 -0
- package/dist/{chunk-MQHD3EJE.js → chunk-LZHZJWVM.js} +6 -4
- package/dist/chunk-LZHZJWVM.js.map +1 -0
- package/dist/{chunk-5EOMSWNO.js → chunk-MAM2X3MW.js} +5 -5
- package/dist/{chunk-5EOMSWNO.js.map → chunk-MAM2X3MW.js.map} +1 -1
- package/dist/{chunk-FSPS7TVD.js → chunk-MCMS4NMO.js} +5 -5
- package/dist/{chunk-FSPS7TVD.js.map → chunk-MCMS4NMO.js.map} +1 -1
- package/dist/{chunk-ZB5VMGKB.js → chunk-MV5DIE2T.js} +15 -4
- package/dist/chunk-MV5DIE2T.js.map +1 -0
- package/dist/chunk-NDI4HLQE.js +41 -0
- package/dist/chunk-NDI4HLQE.js.map +1 -0
- package/dist/{chunk-B4GNSSHU.js → chunk-NLJEQZQQ.js} +3 -3
- package/dist/{chunk-B4GNSSHU.js.map → chunk-NLJEQZQQ.js.map} +1 -1
- package/dist/{chunk-SBZJGFZ6.js → chunk-QHT4DCXE.js} +8 -7
- package/dist/chunk-QHT4DCXE.js.map +1 -0
- package/dist/{chunk-I4IJOLNA.js → chunk-RMUBCTEF.js} +5 -5
- package/dist/{chunk-I4IJOLNA.js.map → chunk-RMUBCTEF.js.map} +1 -1
- package/dist/{chunk-G3AD3NJG.js → chunk-RNTDM3RP.js} +9 -5
- package/dist/chunk-RNTDM3RP.js.map +1 -0
- package/dist/chunk-RPFN6ETQ.js +509 -0
- package/dist/chunk-RPFN6ETQ.js.map +1 -0
- package/dist/{chunk-HWBFRDX7.js → chunk-SI7C3W5M.js} +28 -9
- package/dist/chunk-SI7C3W5M.js.map +1 -0
- package/dist/chunk-TPOV3OCC.js +234 -0
- package/dist/chunk-TPOV3OCC.js.map +1 -0
- package/dist/{chunk-IANYMDKH.js → chunk-UBQ54W46.js} +4 -4
- package/dist/chunk-UBQ54W46.js.map +1 -0
- package/dist/{chunk-QVOBLRCM.js → chunk-UIKQ4X6W.js} +3 -3
- package/dist/{chunk-QVOBLRCM.js.map → chunk-UIKQ4X6W.js.map} +1 -1
- package/dist/chunk-UOWQH53N.js +70 -0
- package/dist/chunk-UOWQH53N.js.map +1 -0
- package/dist/{chunk-QRNQQIQM.js → chunk-WJUY6YWF.js} +52 -20
- package/dist/chunk-WJUY6YWF.js.map +1 -0
- package/dist/{chunk-3KARNPW4.js → chunk-WKIUMLRT.js} +3 -3
- package/dist/{chunk-3KARNPW4.js.map → chunk-WKIUMLRT.js.map} +1 -1
- package/dist/chunk-X6RB74JN.js +37 -0
- package/dist/chunk-X6RB74JN.js.map +1 -0
- package/dist/chunk-XQ6L2CM5.js +83 -0
- package/dist/chunk-XQ6L2CM5.js.map +1 -0
- package/dist/{chunk-RKCUXOU2.js → chunk-YUVKROMA.js} +44 -7
- package/dist/chunk-YUVKROMA.js.map +1 -0
- package/dist/components/action-icon/action-icon.d.ts +9 -2
- package/dist/components/action-icon/action-icon.d.ts.map +1 -1
- package/dist/components/action-icon/index.js +5 -1
- package/dist/components/alert/index.js +4 -4
- package/dist/components/anchor/anchor.d.ts +45 -0
- package/dist/components/anchor/anchor.d.ts.map +1 -0
- package/dist/components/anchor/index.d.ts +2 -0
- package/dist/components/anchor/index.d.ts.map +1 -0
- package/dist/components/anchor/index.js +11 -0
- package/dist/components/anchor/index.js.map +1 -0
- package/dist/components/app-shell/app-shell.d.ts +10 -6
- package/dist/components/app-shell/app-shell.d.ts.map +1 -1
- package/dist/components/app-shell/index.js +23 -24
- package/dist/components/app-shell/index.js.map +1 -1
- package/dist/components/autocomplete/autocomplete.d.ts +1 -1
- package/dist/components/autocomplete/autocomplete.d.ts.map +1 -1
- package/dist/components/autocomplete/index.js +15 -9
- package/dist/components/autocomplete/index.js.map +1 -1
- package/dist/components/avatar/index.js +1 -1
- package/dist/components/button/button.d.ts +15 -2
- package/dist/components/button/button.d.ts.map +1 -1
- package/dist/components/button/index.js +5 -1
- package/dist/components/button-multi-select/index.js +6 -4
- package/dist/components/button-multi-select/index.js.map +1 -1
- package/dist/components/button-select/button-select-control.d.ts.map +1 -1
- package/dist/components/button-select/button-select.d.ts +2 -2
- package/dist/components/button-select/button-select.d.ts.map +1 -1
- package/dist/components/button-select/index.js +6 -4
- package/dist/components/button-select/index.js.map +1 -1
- package/dist/components/calendar/aliases.d.ts +16 -0
- package/dist/components/calendar/aliases.d.ts.map +1 -0
- package/dist/components/calendar/calendar-body.d.ts +11 -1
- package/dist/components/calendar/calendar-body.d.ts.map +1 -1
- package/dist/components/calendar/calendar.d.ts +8 -4
- package/dist/components/calendar/calendar.d.ts.map +1 -1
- package/dist/components/calendar/index.d.ts +2 -1
- package/dist/components/calendar/index.d.ts.map +1 -1
- package/dist/components/calendar/index.js +15 -5
- package/dist/components/calendar/index.js.map +1 -1
- package/dist/components/calendar-heatmap/calendar-heatmap.d.ts.map +1 -1
- package/dist/components/calendar-heatmap/index.js +85 -73
- package/dist/components/calendar-heatmap/index.js.map +1 -1
- package/dist/components/camera/index.js +16 -14
- package/dist/components/carousel/index.js +3 -3
- package/dist/components/checkbox/checkbox.d.ts.map +1 -1
- package/dist/components/checkbox/index.js +2 -2
- package/dist/components/choice-card-group/index.js +2 -2
- package/dist/components/choice-card-group/index.js.map +1 -1
- package/dist/components/circular-progress/circular-progress.d.ts +22 -11
- package/dist/components/circular-progress/circular-progress.d.ts.map +1 -1
- package/dist/components/circular-progress/index.d.ts +1 -1
- package/dist/components/circular-progress/index.d.ts.map +1 -1
- package/dist/components/circular-progress/index.js +68 -49
- package/dist/components/circular-progress/index.js.map +1 -1
- package/dist/components/clipboard/index.js +7 -3
- package/dist/components/clipboard/index.js.map +1 -1
- package/dist/components/code/code.d.ts +10 -0
- package/dist/components/code/code.d.ts.map +1 -1
- package/dist/components/code/index.js +1 -0
- package/dist/components/code/index.js.map +1 -1
- package/dist/components/code-block/chrome.js +10 -6
- package/dist/components/code-block/index.js +10 -7
- package/dist/components/code-block/index.js.map +1 -1
- package/dist/components/combobox/combobox.d.ts +5 -3
- package/dist/components/combobox/combobox.d.ts.map +1 -1
- package/dist/components/combobox/index.js +12 -7
- package/dist/components/combobox-list/combobox-list.d.ts +1 -1
- package/dist/components/combobox-list/combobox-list.d.ts.map +1 -1
- package/dist/components/combobox-list/index.js +14 -9
- package/dist/components/compare/index.js +1 -1
- package/dist/components/data-list/data-list.d.ts +96 -0
- package/dist/components/data-list/data-list.d.ts.map +1 -0
- package/dist/components/data-list/index.d.ts +2 -0
- package/dist/components/data-list/index.d.ts.map +1 -0
- package/dist/components/data-list/index.js +147 -0
- package/dist/components/data-list/index.js.map +1 -0
- package/dist/components/data-table/data-table-group.d.ts.map +1 -1
- package/dist/components/data-table/data-table-placeholder.d.ts +12 -1
- package/dist/components/data-table/data-table-placeholder.d.ts.map +1 -1
- package/dist/components/data-table/data-table-stack.d.ts.map +1 -1
- package/dist/components/data-table/data-table.d.ts +5 -2
- package/dist/components/data-table/data-table.d.ts.map +1 -1
- package/dist/components/data-table/index.js +163 -168
- package/dist/components/data-table/index.js.map +1 -1
- package/dist/components/date-picker/aliases.d.ts +16 -0
- package/dist/components/date-picker/aliases.d.ts.map +1 -1
- package/dist/components/date-picker/date-picker.d.ts +22 -8
- package/dist/components/date-picker/date-picker.d.ts.map +1 -1
- package/dist/components/date-picker/index.d.ts +2 -2
- package/dist/components/date-picker/index.d.ts.map +1 -1
- package/dist/components/date-picker/index.js +34 -28
- package/dist/components/date-picker/index.js.map +1 -1
- package/dist/components/download-button/index.js +6 -2
- package/dist/components/drawer/drawer.d.ts +7 -4
- package/dist/components/drawer/drawer.d.ts.map +1 -1
- package/dist/components/drawer/index.js +11 -6
- package/dist/components/empty-state/empty-state.d.ts +57 -0
- package/dist/components/empty-state/empty-state.d.ts.map +1 -0
- package/dist/components/empty-state/index.d.ts +2 -0
- package/dist/components/empty-state/index.d.ts.map +1 -0
- package/dist/components/empty-state/index.js +8 -0
- package/dist/components/empty-state/index.js.map +1 -0
- package/dist/components/field/field.d.ts +20 -0
- package/dist/components/field/field.d.ts.map +1 -1
- package/dist/components/field/index.js +1 -1
- package/dist/components/fieldset/fieldset.d.ts +103 -0
- package/dist/components/fieldset/fieldset.d.ts.map +1 -0
- package/dist/components/fieldset/index.d.ts +2 -0
- package/dist/components/fieldset/index.d.ts.map +1 -0
- package/dist/components/fieldset/index.js +150 -0
- package/dist/components/fieldset/index.js.map +1 -0
- package/dist/components/file-item/index.js +10 -7
- package/dist/components/file-preview/file-preview.d.ts.map +1 -1
- package/dist/components/file-preview/index.js +10 -18
- package/dist/components/file-preview/index.js.map +1 -1
- package/dist/components/file-trigger/index.js +6 -2
- package/dist/components/file-upload/file-upload.d.ts.map +1 -1
- package/dist/components/file-upload/index.js +18 -14
- package/dist/components/file-upload/index.js.map +1 -1
- package/dist/components/gallery/index.js +3 -3
- package/dist/components/geodesic/a11y.d.ts +3 -3
- package/dist/components/geodesic/a11y.d.ts.map +1 -1
- package/dist/components/hover-card/hover-card.d.ts.map +1 -1
- package/dist/components/hover-card/index.js +10 -3
- package/dist/components/hover-card/index.js.map +1 -1
- package/dist/components/image/index.js +3 -3
- package/dist/components/image-cropper/index.js +9 -6
- package/dist/components/input/index.js +2 -2
- package/dist/components/input/input.d.ts.map +1 -1
- package/dist/components/kbd/index.js +3 -3
- package/dist/components/kbd/kbd.d.ts +4 -0
- package/dist/components/kbd/kbd.d.ts.map +1 -1
- package/dist/components/lightbox/index.js +13 -11
- package/dist/components/lightbox/index.js.map +1 -1
- package/dist/components/menu/index.js +9 -5
- package/dist/components/menu/index.js.map +1 -1
- package/dist/components/menu/menu.d.ts.map +1 -1
- package/dist/components/modal/index.js +11 -6
- package/dist/components/modal/modal.d.ts +10 -4
- package/dist/components/modal/modal.d.ts.map +1 -1
- package/dist/components/multi-combobox-list/index.js +13 -9
- package/dist/components/multi-combobox-list/multi-combobox-list.d.ts +1 -1
- package/dist/components/multi-combobox-list/multi-combobox-list.d.ts.map +1 -1
- package/dist/components/multi-select/index.js +13 -10
- package/dist/components/multi-select/index.js.map +1 -1
- package/dist/components/multi-select/multi-select.d.ts +1 -1
- package/dist/components/multi-select/multi-select.d.ts.map +1 -1
- package/dist/components/nav-link/index.js +4 -4
- package/dist/components/nav-link/tanstack.js +4 -4
- package/dist/components/notification/index.js +6 -6
- package/dist/components/notification/index.js.map +1 -1
- package/dist/components/number-input/index.js +11 -7
- package/dist/components/number-input/number-input.d.ts +1 -1
- package/dist/components/number-input/number-input.d.ts.map +1 -1
- package/dist/components/overlays/dialog-parts.d.ts +10 -1
- package/dist/components/overlays/dialog-parts.d.ts.map +1 -1
- package/dist/components/overlays/index.js +13 -8
- package/dist/components/overlays/index.js.map +1 -1
- package/dist/components/pagination/index.d.ts +2 -0
- package/dist/components/pagination/index.d.ts.map +1 -0
- package/dist/components/pagination/index.js +362 -0
- package/dist/components/pagination/index.js.map +1 -0
- package/dist/components/pagination/pagination.d.ts +147 -0
- package/dist/components/pagination/pagination.d.ts.map +1 -0
- package/dist/components/password-input/index.js +6 -5
- package/dist/components/password-input/index.js.map +1 -1
- package/dist/components/password-input/password-input.d.ts +1 -1
- package/dist/components/password-input/password-input.d.ts.map +1 -1
- package/dist/components/phone-input/index.js +14 -11
- package/dist/components/phone-input/index.js.map +1 -1
- package/dist/components/phone-input/phone-input.d.ts +1 -1
- package/dist/components/phone-input/phone-input.d.ts.map +1 -1
- package/dist/components/photo-capture/index.js +19 -17
- package/dist/components/photo-capture/index.js.map +1 -1
- package/dist/components/pills-input/index.js +4 -4
- package/dist/components/pills-input/pills-input.d.ts +1 -1
- package/dist/components/pills-input/pills-input.d.ts.map +1 -1
- package/dist/components/pin-input/index.js +6 -5
- package/dist/components/pin-input/index.js.map +1 -1
- package/dist/components/pin-input/pin-input.d.ts.map +1 -1
- package/dist/components/popover/index.js +7 -2
- package/dist/components/popover/popover.d.ts +41 -16
- package/dist/components/popover/popover.d.ts.map +1 -1
- package/dist/components/progress/index.d.ts +1 -1
- package/dist/components/progress/index.d.ts.map +1 -1
- package/dist/components/progress/index.js +4 -1
- package/dist/components/progress/progress.d.ts +22 -14
- package/dist/components/progress/progress.d.ts.map +1 -1
- package/dist/components/prose/index.d.ts +2 -0
- package/dist/components/prose/index.d.ts.map +1 -0
- package/dist/components/prose/index.js +17 -0
- package/dist/components/prose/index.js.map +1 -0
- package/dist/components/prose/prose.d.ts +49 -0
- package/dist/components/prose/prose.d.ts.map +1 -0
- package/dist/components/prose/styles.css +593 -0
- package/dist/components/radio-group/index.js +9 -3
- package/dist/components/radio-group/index.js.map +1 -1
- package/dist/components/radio-group/radio-group.d.ts.map +1 -1
- package/dist/components/rating/index.js +3 -2
- package/dist/components/rating/index.js.map +1 -1
- package/dist/components/rating/rating.d.ts.map +1 -1
- package/dist/components/schedule/index.js +10 -8
- package/dist/components/schedule/index.js.map +1 -1
- package/dist/components/scroll-area/index.d.ts +2 -0
- package/dist/components/scroll-area/index.d.ts.map +1 -0
- package/dist/components/scroll-area/index.js +10 -0
- package/dist/components/scroll-area/index.js.map +1 -0
- package/dist/components/scroll-area/scroll-area.d.ts +150 -0
- package/dist/components/scroll-area/scroll-area.d.ts.map +1 -0
- package/dist/components/segment-group/index.js +2 -2
- package/dist/components/segment-group/segment-group.d.ts.map +1 -1
- package/dist/components/select/index.js +12 -8
- package/dist/components/select/select.d.ts +1 -1
- package/dist/components/select/select.d.ts.map +1 -1
- package/dist/components/slider/index.js +2 -2
- package/dist/components/slider/slider.d.ts.map +1 -1
- package/dist/components/splitter/index.d.ts +2 -0
- package/dist/components/splitter/index.d.ts.map +1 -0
- package/dist/components/splitter/index.js +373 -0
- package/dist/components/splitter/index.js.map +1 -0
- package/dist/components/splitter/splitter.d.ts +159 -0
- package/dist/components/splitter/splitter.d.ts.map +1 -0
- package/dist/components/spotlight/index.js +23 -22
- package/dist/components/spotlight/index.js.map +1 -1
- package/dist/components/spotlight/spotlight.d.ts.map +1 -1
- package/dist/components/steps/index.d.ts +4 -0
- package/dist/components/steps/index.d.ts.map +1 -0
- package/dist/components/steps/index.js +478 -0
- package/dist/components/steps/index.js.map +1 -0
- package/dist/components/steps/steps-data.d.ts +78 -0
- package/dist/components/steps/steps-data.d.ts.map +1 -0
- package/dist/components/steps/steps.d.ts +183 -0
- package/dist/components/steps/steps.d.ts.map +1 -0
- package/dist/components/switch/index.js +4 -3
- package/dist/components/switch/index.js.map +1 -1
- package/dist/components/switch/switch.d.ts.map +1 -1
- package/dist/components/table-of-contents/index.d.ts +2 -0
- package/dist/components/table-of-contents/index.d.ts.map +1 -0
- package/dist/components/table-of-contents/index.js +471 -0
- package/dist/components/table-of-contents/index.js.map +1 -0
- package/dist/components/table-of-contents/table-of-contents.d.ts +173 -0
- package/dist/components/table-of-contents/table-of-contents.d.ts.map +1 -0
- package/dist/components/tags-input/index.js +12 -9
- package/dist/components/tags-input/index.js.map +1 -1
- package/dist/components/tags-input/tags-input.d.ts +1 -1
- package/dist/components/tags-input/tags-input.d.ts.map +1 -1
- package/dist/components/text-input/index.js +2 -2
- package/dist/components/textarea/index.js +8 -6
- package/dist/components/textarea/index.js.map +1 -1
- package/dist/components/textarea/textarea.d.ts.map +1 -1
- package/dist/components/time-input/index.js +11 -9
- package/dist/components/time-input/index.js.map +1 -1
- package/dist/components/tooltip/index.js +1 -1
- package/dist/components/tooltip/tooltip.d.ts +3 -8
- package/dist/components/tooltip/tooltip.d.ts.map +1 -1
- package/dist/components/tour/conditions.d.ts +83 -0
- package/dist/components/tour/conditions.d.ts.map +1 -0
- package/dist/components/tour/create-tours.d.ts +49 -0
- package/dist/components/tour/create-tours.d.ts.map +1 -0
- package/dist/components/tour/index.d.ts +6 -0
- package/dist/components/tour/index.d.ts.map +1 -0
- package/dist/components/tour/index.js +1449 -0
- package/dist/components/tour/index.js.map +1 -0
- package/dist/components/tour/runtime.d.ts +57 -0
- package/dist/components/tour/runtime.d.ts.map +1 -0
- package/dist/components/tour/storage.d.ts +14 -0
- package/dist/components/tour/storage.d.ts.map +1 -0
- package/dist/components/tour/store.d.ts +62 -0
- package/dist/components/tour/store.d.ts.map +1 -0
- package/dist/components/tour/tour.d.ts +77 -0
- package/dist/components/tour/tour.d.ts.map +1 -0
- package/dist/components/tour/types.d.ts +680 -0
- package/dist/components/tour/types.d.ts.map +1 -0
- package/dist/components/tree/index.d.ts +3 -0
- package/dist/components/tree/index.d.ts.map +1 -0
- package/dist/components/tree/index.js +457 -0
- package/dist/components/tree/index.js.map +1 -0
- package/dist/components/tree/tree-row.d.ts +72 -0
- package/dist/components/tree/tree-row.d.ts.map +1 -0
- package/dist/components/tree/tree.d.ts +193 -0
- package/dist/components/tree/tree.d.ts.map +1 -0
- package/dist/components/tree-multi-select/index.js +31 -54
- package/dist/components/tree-multi-select/index.js.map +1 -1
- package/dist/components/tree-multi-select/tree-multi-select.d.ts +16 -1
- package/dist/components/tree-multi-select/tree-multi-select.d.ts.map +1 -1
- package/dist/components/tree-select/index.js +30 -24
- package/dist/components/tree-select/index.js.map +1 -1
- package/dist/components/tree-select/tree-popover.d.ts +20 -31
- package/dist/components/tree-select/tree-popover.d.ts.map +1 -1
- package/dist/components/tree-select/tree-select.d.ts +1 -1
- package/dist/components/tree-select/tree-select.d.ts.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -8
- package/dist/index.js.map +1 -1
- package/dist/lib/date-predicates.d.ts +7 -5
- package/dist/lib/date-predicates.d.ts.map +1 -1
- package/dist/lib/date-value.d.ts +20 -0
- package/dist/lib/date-value.d.ts.map +1 -1
- package/dist/lib/floating-arrow.d.ts +53 -0
- package/dist/lib/floating-arrow.d.ts.map +1 -0
- package/dist/lib/focus-return.d.ts +53 -0
- package/dist/lib/focus-return.d.ts.map +1 -0
- package/dist/lib/meter.d.ts +104 -0
- package/dist/lib/meter.d.ts.map +1 -0
- package/dist/lib/overlay-layer.d.ts +26 -8
- package/dist/lib/overlay-layer.d.ts.map +1 -1
- package/dist/lib/pressed.d.ts +92 -0
- package/dist/lib/pressed.d.ts.map +1 -0
- package/dist/lib/tree-data.d.ts +18 -2
- package/dist/lib/tree-data.d.ts.map +1 -1
- package/dist/lib/use-pagination.d.ts +102 -0
- package/dist/lib/use-pagination.d.ts.map +1 -0
- package/dist/lib/use-scroll-spy.d.ts +126 -0
- package/dist/lib/use-scroll-spy.d.ts.map +1 -0
- package/dist/theme.css +39 -3
- package/package.json +1 -1
- package/src/as-child.contract.test.tsx +283 -1
- package/src/components/action-icon/action-icon.tsx +34 -4
- package/src/components/anchor/anchor.test.tsx +232 -0
- package/src/components/anchor/anchor.tsx +187 -0
- package/src/components/anchor/index.ts +12 -0
- package/src/components/app-shell/app-shell.test.tsx +15 -7
- package/src/components/app-shell/app-shell.tsx +27 -20
- package/src/components/autocomplete/autocomplete.tsx +11 -3
- package/src/components/button/button-pressed.test.tsx +202 -0
- package/src/components/button/button.tsx +48 -6
- package/src/components/button-select/button-select-control.tsx +2 -2
- package/src/components/button-select/button-select.tsx +22 -2
- package/src/components/calendar/aliases.tsx +28 -0
- package/src/components/calendar/calendar-body.tsx +310 -210
- package/src/components/calendar/calendar.tsx +43 -12
- package/src/components/calendar/index.ts +7 -1
- package/src/components/calendar/month-year-calendar.test.tsx +106 -0
- package/src/components/calendar-heatmap/calendar-heatmap.tsx +88 -73
- package/src/components/checkbox/checkbox.tsx +7 -2
- package/src/components/choice-card-group/choice-card-group.tsx +2 -2
- package/src/components/circular-progress/circular-progress.test.tsx +35 -0
- package/src/components/circular-progress/circular-progress.tsx +116 -59
- package/src/components/circular-progress/index.ts +1 -0
- package/src/components/code/code.test.tsx +16 -0
- package/src/components/code/code.tsx +11 -0
- package/src/components/combobox/combobox.tsx +63 -28
- package/src/components/combobox-list/combobox-list.tsx +11 -3
- package/src/components/data-list/data-list.test.tsx +149 -0
- package/src/components/data-list/data-list.tsx +268 -0
- package/src/components/data-list/index.ts +9 -0
- package/src/components/data-table/data-table-group.test.tsx +16 -0
- package/src/components/data-table/data-table-group.tsx +15 -2
- package/src/components/data-table/data-table-placeholder.tsx +28 -36
- package/src/components/data-table/data-table-stack.tsx +33 -39
- package/src/components/data-table/data-table.test.tsx +31 -0
- package/src/components/data-table/data-table.tsx +41 -42
- package/src/components/date-picker/aliases.tsx +28 -0
- package/src/components/date-picker/date-picker.test.tsx +29 -0
- package/src/components/date-picker/date-picker.tsx +164 -45
- package/src/components/date-picker/index.ts +5 -1
- package/src/components/date-picker/month-year-picker.test.tsx +362 -0
- package/src/components/drawer/drawer.test.tsx +41 -0
- package/src/components/drawer/drawer.tsx +7 -1
- package/src/components/empty-state/empty-state.test.tsx +109 -0
- package/src/components/empty-state/empty-state.tsx +180 -0
- package/src/components/empty-state/index.ts +9 -0
- package/src/components/field/field.tsx +35 -1
- package/src/components/fieldset/fieldset.test.tsx +352 -0
- package/src/components/fieldset/fieldset.tsx +268 -0
- package/src/components/fieldset/index.ts +11 -0
- package/src/components/file-preview/file-preview.test.tsx +2 -1
- package/src/components/file-preview/file-preview.tsx +7 -13
- package/src/components/file-upload/file-upload.tsx +14 -5
- package/src/components/hover-card/hover-card.tsx +5 -1
- package/src/components/input/input.tsx +12 -5
- package/src/components/kbd/kbd.test.tsx +13 -0
- package/src/components/kbd/kbd.tsx +6 -0
- package/src/components/menu/menu.tsx +6 -2
- package/src/components/modal/modal.test.tsx +41 -0
- package/src/components/modal/modal.tsx +17 -9
- package/src/components/multi-combobox-list/multi-combobox-list.tsx +11 -3
- package/src/components/multi-select/multi-select.tsx +11 -3
- package/src/components/notification/create-notifier.tsx +1 -1
- package/src/components/number-input/number-input.tsx +12 -3
- package/src/components/overlays/dialog-parts.tsx +42 -5
- package/src/components/pagination/index.ts +19 -0
- package/src/components/pagination/pagination.test.tsx +187 -0
- package/src/components/pagination/pagination.tsx +563 -0
- package/src/components/password-input/password-input.tsx +12 -3
- package/src/components/phone-input/phone-input.tsx +12 -3
- package/src/components/pills-input/pills-input.tsx +7 -2
- package/src/components/pin-input/pin-input.tsx +13 -4
- package/src/components/popover/popover.tsx +87 -17
- package/src/components/progress/index.ts +1 -0
- package/src/components/progress/progress.test.tsx +102 -0
- package/src/components/progress/progress.tsx +116 -62
- package/src/components/prose/index.ts +1 -0
- package/src/components/prose/prose.test.tsx +90 -0
- package/src/components/prose/prose.tsx +60 -0
- package/src/components/prose/styles.css +593 -0
- package/src/components/radio-group/radio-group.tsx +8 -3
- package/src/components/rating/rating.tsx +5 -2
- package/src/components/scroll-area/index.ts +18 -0
- package/src/components/scroll-area/scroll-area.test.tsx +184 -0
- package/src/components/scroll-area/scroll-area.tsx +448 -0
- package/src/components/segment-group/segment-group.tsx +2 -2
- package/src/components/select/select.tsx +37 -18
- package/src/components/slider/slider.tsx +2 -2
- package/src/components/splitter/index.ts +15 -0
- package/src/components/splitter/splitter.test.tsx +244 -0
- package/src/components/splitter/splitter.tsx +625 -0
- package/src/components/spotlight/spotlight.test.tsx +34 -26
- package/src/components/spotlight/spotlight.tsx +7 -9
- package/src/components/steps/index.ts +21 -0
- package/src/components/steps/steps-data.tsx +179 -0
- package/src/components/steps/steps.test.tsx +235 -0
- package/src/components/steps/steps.tsx +686 -0
- package/src/components/switch/switch.tsx +7 -2
- package/src/components/table-of-contents/index.ts +17 -0
- package/src/components/table-of-contents/table-of-contents.test.tsx +289 -0
- package/src/components/table-of-contents/table-of-contents.tsx +708 -0
- package/src/components/tags-input/tags-input.tsx +12 -3
- package/src/components/textarea/textarea.tsx +15 -5
- package/src/components/tooltip/tooltip.tsx +8 -17
- package/src/components/tour/conditions.test.ts +527 -0
- package/src/components/tour/conditions.ts +445 -0
- package/src/components/tour/create-tours.tsx +150 -0
- package/src/components/tour/index.ts +86 -0
- package/src/components/tour/runtime.ts +187 -0
- package/src/components/tour/storage.test.ts +68 -0
- package/src/components/tour/storage.ts +44 -0
- package/src/components/tour/store.test.tsx +784 -0
- package/src/components/tour/store.ts +661 -0
- package/src/components/tour/tour.test.tsx +318 -0
- package/src/components/tour/tour.tsx +773 -0
- package/src/components/tour/tour.types.test.ts +185 -0
- package/src/components/tour/types.ts +904 -0
- package/src/components/tree/index.ts +24 -0
- package/src/components/tree/tree-row.tsx +179 -0
- package/src/components/tree/tree.test.tsx +296 -0
- package/src/components/tree/tree.tsx +796 -0
- package/src/components/tree-multi-select/tree-multi-select.tsx +29 -58
- package/src/components/tree-select/tree-popover.tsx +26 -107
- package/src/components/tree-select/tree-select.tsx +24 -16
- package/src/icon-stroke.test.tsx +2 -0
- package/src/index.ts +16 -0
- package/src/lib/date-predicates.test.ts +46 -0
- package/src/lib/date-predicates.ts +44 -24
- package/src/lib/date-value.test.ts +24 -1
- package/src/lib/date-value.ts +42 -1
- package/src/lib/floating-arrow.tsx +73 -0
- package/src/lib/focus-return.test.tsx +143 -0
- package/src/lib/focus-return.ts +106 -0
- package/src/lib/meter.test.ts +40 -0
- package/src/lib/meter.ts +159 -0
- package/src/lib/overlay-layer.test.tsx +47 -1
- package/src/lib/overlay-layer.tsx +65 -8
- package/src/lib/pressed.ts +130 -0
- package/src/lib/tree-data.ts +42 -2
- package/src/lib/use-pagination.test.ts +105 -0
- package/src/lib/use-pagination.ts +179 -0
- package/src/lib/use-scroll-spy.test.tsx +238 -0
- package/src/lib/use-scroll-spy.ts +336 -0
- package/src/theme.css +39 -3
- package/src/theme.test.ts +29 -1
- package/src/visually-hidden-containment.test.tsx +9 -0
- package/dist/chunk-2W7H43WL.js.map +0 -1
- package/dist/chunk-7E7JNWOC.js.map +0 -1
- package/dist/chunk-7FPSQBWB.js.map +0 -1
- package/dist/chunk-7KFUFAVP.js.map +0 -1
- package/dist/chunk-AKXALCUN.js.map +0 -1
- package/dist/chunk-B5YHYI7E.js.map +0 -1
- package/dist/chunk-FQJNQW3G.js.map +0 -1
- package/dist/chunk-G3AD3NJG.js.map +0 -1
- package/dist/chunk-GEZYGBXY.js.map +0 -1
- package/dist/chunk-HCHGERDB.js.map +0 -1
- package/dist/chunk-HWBFRDX7.js.map +0 -1
- package/dist/chunk-I4B3N3UX.js.map +0 -1
- package/dist/chunk-IA6DCC3N.js.map +0 -1
- package/dist/chunk-IANYMDKH.js.map +0 -1
- package/dist/chunk-MQHD3EJE.js.map +0 -1
- package/dist/chunk-NNPSBC7O.js.map +0 -1
- package/dist/chunk-OXR7BXZA.js.map +0 -1
- package/dist/chunk-QKSLDQM2.js +0 -120
- package/dist/chunk-QKSLDQM2.js.map +0 -1
- package/dist/chunk-QRNQQIQM.js.map +0 -1
- package/dist/chunk-RKCUXOU2.js.map +0 -1
- package/dist/chunk-S5CQRCTF.js +0 -426
- package/dist/chunk-S5CQRCTF.js.map +0 -1
- package/dist/chunk-SBZJGFZ6.js.map +0 -1
- package/dist/chunk-SP6LCCTZ.js.map +0 -1
- package/dist/chunk-TUP7WXQE.js.map +0 -1
- package/dist/chunk-V2QZG4IT.js.map +0 -1
- package/dist/chunk-X6DESK37.js.map +0 -1
- package/dist/chunk-ZB5VMGKB.js.map +0 -1
|
@@ -0,0 +1,680 @@
|
|
|
1
|
+
import type { ReactNode, RefObject } from "react";
|
|
2
|
+
import type { Unavailable } from "../../lib/available-if";
|
|
3
|
+
import type { Brand } from "../../lib/brand";
|
|
4
|
+
import type { Color } from "../../lib/colors";
|
|
5
|
+
import type { IconMap } from "../../lib/icons";
|
|
6
|
+
import type { LogicalPosition, Placement } from "../../lib/placement";
|
|
7
|
+
/**
|
|
8
|
+
* Public types for the tour manager: `createTours`, `defineTour`, the
|
|
9
|
+
* condition helpers and everything they hand to the app.
|
|
10
|
+
*
|
|
11
|
+
* Typing works like `createOverlays`' registry, without module augmentation:
|
|
12
|
+
* `defineTour` infers each tour's step ids, the gate keys and signal names its
|
|
13
|
+
* conditions wait on, and carries its params and app shape as phantom types.
|
|
14
|
+
* `createTours({ registry })` reads them back, so `start`, `goto`, `from`,
|
|
15
|
+
* `signal` and `useTourGate` are checked against the tours that exist.
|
|
16
|
+
*/
|
|
17
|
+
/** Carries a tour's types. Never exists at runtime, and not exported, so only
|
|
18
|
+
* `defineTour` can make a `TourDefinition`. */
|
|
19
|
+
declare const tourTypes: unique symbol;
|
|
20
|
+
/** Carries a condition's types. Same rules as `tourTypes`. */
|
|
21
|
+
declare const conditionTypes: unique symbol;
|
|
22
|
+
/** The id of one run of a tour. Branded so it can't be confused with a step id
|
|
23
|
+
* or another manager's id. Minted by `createTours`. */
|
|
24
|
+
export type TourRunId = Brand<string, "TourRunId">;
|
|
25
|
+
/** What a tour receives from `tours.start(key, { params })`. */
|
|
26
|
+
export type TourParams = Record<string, unknown>;
|
|
27
|
+
/** The params of a tour that declares none: `start` takes no `params`, and
|
|
28
|
+
* passing some is an error. */
|
|
29
|
+
export type NoTourParams = Record<string, never>;
|
|
30
|
+
/** The answers given to `choices` steps so far, by step id. */
|
|
31
|
+
export type TourAnswers<Id extends string = string> = Partial<Record<Id, string>>;
|
|
32
|
+
/**
|
|
33
|
+
* The element a step highlights: a CSS selector (re-resolved until it
|
|
34
|
+
* matches, so a target that mounts late still works), a ref, or a function
|
|
35
|
+
* called on every position update.
|
|
36
|
+
*/
|
|
37
|
+
export type TourTarget = string | RefObject<HTMLElement | null> | (() => HTMLElement | null);
|
|
38
|
+
/**
|
|
39
|
+
* What a condition, a step's `when` and a tour's `when` can do to the running
|
|
40
|
+
* tour. Reading, plus `goto` for branching. Conditions report state and let
|
|
41
|
+
* the step decide; they don't move the tour themselves.
|
|
42
|
+
*/
|
|
43
|
+
export type TourContextTours<Id extends string = string> = {
|
|
44
|
+
/** The running tour, or `null` between tours. */
|
|
45
|
+
readonly active: TourSnapshot | null;
|
|
46
|
+
/** Jumps to a step of this tour. */
|
|
47
|
+
goto: (step: Id) => void;
|
|
48
|
+
};
|
|
49
|
+
/**
|
|
50
|
+
* The context every condition and `when` receives. `App` is the object passed
|
|
51
|
+
* to `createTours({ app })`, `Params` the tour's params, `Id` its step ids.
|
|
52
|
+
*/
|
|
53
|
+
export type TourContext<App = unknown, Params = unknown, Id extends string = string> = {
|
|
54
|
+
/** The step's target element, or `null` (dialog steps, a tour's `when`). */
|
|
55
|
+
target: HTMLElement | null;
|
|
56
|
+
/** The params `tours.start` was called with. */
|
|
57
|
+
params: Params;
|
|
58
|
+
/** The answers given to `choices` steps so far. */
|
|
59
|
+
answers: TourAnswers<Id>;
|
|
60
|
+
/** The current pathname, read through the `location` adapter. */
|
|
61
|
+
location: string;
|
|
62
|
+
/** Whether a media query matches right now. */
|
|
63
|
+
media: (query: string) => boolean;
|
|
64
|
+
/** The object passed to `createTours({ app })`, typed. */
|
|
65
|
+
app: App;
|
|
66
|
+
/** Fires when the step is left. Pass it to `fetch`, or check `aborted`
|
|
67
|
+
* before reporting. */
|
|
68
|
+
signal: AbortSignal;
|
|
69
|
+
/** The tour controller, for reading and for `goto`. */
|
|
70
|
+
tours: TourContextTours<Id>;
|
|
71
|
+
};
|
|
72
|
+
/**
|
|
73
|
+
* The state a condition reports, and the card follows:
|
|
74
|
+
* - `"pending"`: not done yet (the starting state). Next is disabled and its
|
|
75
|
+
* tooltip says what to do; no message.
|
|
76
|
+
* - `{ invalid }`: the user tried and it's wrong. The hint shows and is
|
|
77
|
+
* announced politely to screen readers.
|
|
78
|
+
* - `"valid"`: done. A short tick shows, then the step advances (see
|
|
79
|
+
* `TourAdvance`).
|
|
80
|
+
*/
|
|
81
|
+
export type ConditionState = "pending" | "valid" | {
|
|
82
|
+
invalid: string;
|
|
83
|
+
};
|
|
84
|
+
/** Reports a condition's state. Call it synchronously in setup when the state
|
|
85
|
+
* is known, and again on every change. */
|
|
86
|
+
export type ConditionReport = (state: ConditionState) => void;
|
|
87
|
+
/** Stops listening. The tour calls it when the step is left. */
|
|
88
|
+
export type ConditionCleanup = () => void;
|
|
89
|
+
/**
|
|
90
|
+
* A condition's body: report the state now, subscribe to whatever can change
|
|
91
|
+
* it, and return the unsubscribe. Runs when the step appears and again on
|
|
92
|
+
* every re-entry (Back, `resume`, `from`). Returning nothing is allowed for a
|
|
93
|
+
* condition with nothing to unsubscribe; in development the kit warns when
|
|
94
|
+
* setup returns nothing *and* never reported.
|
|
95
|
+
*/
|
|
96
|
+
export type ConditionSetup<App = unknown, Params = unknown> = (ctx: TourContext<App, Params>, report: ConditionReport) => ConditionCleanup | undefined;
|
|
97
|
+
/**
|
|
98
|
+
* Whether a step moves on by itself once its condition is valid. `"auto"`
|
|
99
|
+
* advances after the tick; `"manual"` shows the tick and waits for Next.
|
|
100
|
+
* Defaults (D5): auto for actions (`click`, `submit`, `route`, `element`,
|
|
101
|
+
* `signal`, `check`, `gate`, `condition`), manual for `value` and `all`.
|
|
102
|
+
*/
|
|
103
|
+
export type TourAdvance = "auto" | "manual";
|
|
104
|
+
/** Options every condition helper takes. */
|
|
105
|
+
export type ConditionOptions = {
|
|
106
|
+
/** Its line in an `all()` checklist. Defaults to the key it has there. */
|
|
107
|
+
label?: string;
|
|
108
|
+
/** Overrides the helper's default `advance`. A step's own `advance` wins. */
|
|
109
|
+
advance?: TourAdvance;
|
|
110
|
+
};
|
|
111
|
+
/**
|
|
112
|
+
* A gate a step waits on: the value `until` takes. Built by `condition()` or
|
|
113
|
+
* one of the helpers, never by hand.
|
|
114
|
+
*
|
|
115
|
+
* The type parameters are phantoms the tour reads back: the `App` and
|
|
116
|
+
* `Params` the condition needs (a tour must provide at least those), and the
|
|
117
|
+
* gate keys and signal names it waits on (they become the registry's typed
|
|
118
|
+
* keys for `useTourGate` and `tours.signal`).
|
|
119
|
+
*/
|
|
120
|
+
export type Condition<App = unknown, Params = unknown, Gate extends string = never, Signal extends string = never> = {
|
|
121
|
+
readonly [conditionTypes]: {
|
|
122
|
+
readonly app: (app: App) => void;
|
|
123
|
+
readonly params: (params: Params) => void;
|
|
124
|
+
readonly gate: Gate;
|
|
125
|
+
readonly signal: Signal;
|
|
126
|
+
};
|
|
127
|
+
/** The default `advance` this condition was built with. */
|
|
128
|
+
readonly advance: TourAdvance;
|
|
129
|
+
/** Its line in an `all()` checklist. */
|
|
130
|
+
readonly label?: string;
|
|
131
|
+
};
|
|
132
|
+
/** Any condition, whatever it needs and waits on. */
|
|
133
|
+
export type AnyCondition = Condition<any, any, string, string>;
|
|
134
|
+
/** The conditions in a record or a tuple. */
|
|
135
|
+
type Members<C> = C extends readonly unknown[] ? C[number] : C[keyof C];
|
|
136
|
+
/** Each member's phantom types, as a union. */
|
|
137
|
+
type PhantomOf<M> = M extends {
|
|
138
|
+
readonly [conditionTypes]: infer T;
|
|
139
|
+
} ? T : never;
|
|
140
|
+
/**
|
|
141
|
+
* What `all()` and `any()` return: every member's `App` and `Params` together
|
|
142
|
+
* (an intersection, read through the contravariant phantoms), and every gate
|
|
143
|
+
* key and signal name they wait on.
|
|
144
|
+
*/
|
|
145
|
+
export type CombinedCondition<C extends Record<string, AnyCondition> | readonly AnyCondition[]> = Condition<PhantomOf<Members<C>>["app"] extends (app: infer A) => void ? A : never, PhantomOf<Members<C>>["params"] extends (params: infer P) => void ? P : never, PhantomOf<Members<C>>["gate"], PhantomOf<Members<C>>["signal"]>;
|
|
146
|
+
/** Options of `value()`. */
|
|
147
|
+
export type ValueOptions = ConditionOptions & {
|
|
148
|
+
/** The field to read. Defaults to the step's target, or the first field
|
|
149
|
+
* inside it. */
|
|
150
|
+
target?: TourTarget;
|
|
151
|
+
/** Shown (and announced) when the check fails, after the field loses focus
|
|
152
|
+
* or the user pauses typing. */
|
|
153
|
+
hint?: string;
|
|
154
|
+
};
|
|
155
|
+
/** Options of `click()` and `submit()`. */
|
|
156
|
+
export type ActionOptions = ConditionOptions & {
|
|
157
|
+
/** The element to watch. Defaults to the step's target (for `submit`, the
|
|
158
|
+
* form it is or sits in). */
|
|
159
|
+
target?: TourTarget;
|
|
160
|
+
};
|
|
161
|
+
/** Options of `element()`. */
|
|
162
|
+
export type ElementOptions = ConditionOptions & {
|
|
163
|
+
/** Wait for the element to be visible (the default) or gone. */
|
|
164
|
+
state?: "visible" | "hidden";
|
|
165
|
+
};
|
|
166
|
+
/** Options of `check()`. */
|
|
167
|
+
export type CheckOptions = ConditionOptions & {
|
|
168
|
+
/** Runs the check again every this many ms until it passes. Runs once when
|
|
169
|
+
* unset. */
|
|
170
|
+
interval?: number;
|
|
171
|
+
};
|
|
172
|
+
/** What a `check()` function resolves with: `true` is `"valid"`, `false` is
|
|
173
|
+
* `"pending"`, or any `ConditionState`. */
|
|
174
|
+
export type CheckResult = boolean | ConditionState;
|
|
175
|
+
/** A route pattern (`"/projects/:id"`) or a predicate on the pathname. */
|
|
176
|
+
export type RouteMatch = string | ((pathname: string) => boolean);
|
|
177
|
+
/** One answer offered by a `choices` step. */
|
|
178
|
+
export type TourChoice<Id extends string = string> = {
|
|
179
|
+
/** The button's label. */
|
|
180
|
+
label: ReactNode;
|
|
181
|
+
/** Stored in `answers[stepId]` and in the result. */
|
|
182
|
+
value: string;
|
|
183
|
+
/** The step to go to next. Defaults to the following step. */
|
|
184
|
+
goto?: Id;
|
|
185
|
+
};
|
|
186
|
+
/** Help for a user who is stuck on a step. */
|
|
187
|
+
export type TourHelp = {
|
|
188
|
+
/** Ms without progress before the help shows. */
|
|
189
|
+
after: number;
|
|
190
|
+
/** The hint shown in the card (and announced politely). */
|
|
191
|
+
hint?: string;
|
|
192
|
+
/** Pulses the target. */
|
|
193
|
+
pulse?: boolean;
|
|
194
|
+
};
|
|
195
|
+
/** What to do while a step's target is missing (D3). */
|
|
196
|
+
export type TourWait = {
|
|
197
|
+
/** Ms before Skip step and Close appear next to the spinner.
|
|
198
|
+
* @default 5000 */
|
|
199
|
+
timeout?: number;
|
|
200
|
+
};
|
|
201
|
+
/** What a card button does. */
|
|
202
|
+
export type TourActionType = "next" | "back" | "skip" | "dismiss";
|
|
203
|
+
/** A button in the card. */
|
|
204
|
+
export type TourAction = {
|
|
205
|
+
/** The button's label. */
|
|
206
|
+
label: ReactNode;
|
|
207
|
+
/** A built-in move, or a function. */
|
|
208
|
+
action: TourActionType | (() => void);
|
|
209
|
+
};
|
|
210
|
+
/** Fields every step has, whatever its type. */
|
|
211
|
+
type StepCore<Id extends string, Ids extends string, Params, App, Gate extends string, Signal extends string> = {
|
|
212
|
+
/** The step's id, unique within the tour. `goto`, `from` and the events use it. */
|
|
213
|
+
id: Id;
|
|
214
|
+
/** The gate the user must meet to move on. */
|
|
215
|
+
until?: Condition<App, Params, Gate, Signal>;
|
|
216
|
+
/** Overrides the condition's default `advance`. */
|
|
217
|
+
advance?: TourAdvance;
|
|
218
|
+
/** Help when the user is stuck. */
|
|
219
|
+
help?: TourHelp;
|
|
220
|
+
/** Shows the step only when this returns true. Checked when the tour starts
|
|
221
|
+
* and again before the step shows. */
|
|
222
|
+
when?: (ctx: TourContext<App, Params, Ids>) => boolean;
|
|
223
|
+
/** What to do while the target is missing. */
|
|
224
|
+
wait?: TourWait;
|
|
225
|
+
};
|
|
226
|
+
/** Fields of a step that shows a card. */
|
|
227
|
+
type CardFields<Ids extends string> = {
|
|
228
|
+
/** The card's title. */
|
|
229
|
+
title?: ReactNode;
|
|
230
|
+
/** The card's body. */
|
|
231
|
+
description?: ReactNode;
|
|
232
|
+
/** Hides Skip (D6). Close and Esc still end the tour. */
|
|
233
|
+
required?: boolean;
|
|
234
|
+
/** Branches on an answer: one button per choice. */
|
|
235
|
+
choices?: readonly TourChoice<Ids>[];
|
|
236
|
+
/** Replaces the default Back / Next / Done buttons. */
|
|
237
|
+
actions?: readonly TourAction[];
|
|
238
|
+
/** Dims the page behind the step. @default true */
|
|
239
|
+
withBackdrop?: boolean;
|
|
240
|
+
};
|
|
241
|
+
/** Fields of a step anchored to an element. */
|
|
242
|
+
type AnchorFields = {
|
|
243
|
+
/** Where the card sits, RTL-aware. @default "bottom" */
|
|
244
|
+
position?: LogicalPosition<Placement>;
|
|
245
|
+
/** Whether the highlighted element stays clickable (D2). Always true on a
|
|
246
|
+
* gated step. @default true */
|
|
247
|
+
interactive?: boolean;
|
|
248
|
+
/** Draws the arrow from the card to the target. @default true */
|
|
249
|
+
withArrow?: boolean;
|
|
250
|
+
};
|
|
251
|
+
/**
|
|
252
|
+
* One step of a tour. `type` picks the shape:
|
|
253
|
+
* - `"tooltip"` (the default): a card anchored to `target`.
|
|
254
|
+
* - `"floating"`: a card placed on the viewport, with an optional target.
|
|
255
|
+
* - `"dialog"`: a centred card, no target.
|
|
256
|
+
* - `"wait"`: no card; waits on `until` (required) before moving on.
|
|
257
|
+
*/
|
|
258
|
+
export type TourStep<Id extends string = string, Ids extends string = string, Params = unknown, App = unknown, Gate extends string = never, Signal extends string = never> = (StepCore<Id, Ids, Params, App, Gate, Signal> & CardFields<Ids> & AnchorFields & {
|
|
259
|
+
type?: "tooltip";
|
|
260
|
+
/** The element the step highlights. */
|
|
261
|
+
target: TourTarget;
|
|
262
|
+
}) | (StepCore<Id, Ids, Params, App, Gate, Signal> & CardFields<Ids> & AnchorFields & {
|
|
263
|
+
type: "floating";
|
|
264
|
+
/** The element the step highlights, if any. */
|
|
265
|
+
target?: TourTarget;
|
|
266
|
+
}) | (StepCore<Id, Ids, Params, App, Gate, Signal> & CardFields<Ids> & {
|
|
267
|
+
type: "dialog";
|
|
268
|
+
target?: never;
|
|
269
|
+
}) | (StepCore<Id, Ids, Params, App, Gate, Signal> & {
|
|
270
|
+
type: "wait";
|
|
271
|
+
/** An element to watch, for `click()` and the like. Not highlighted. */
|
|
272
|
+
target?: TourTarget;
|
|
273
|
+
/** What the step waits for. */
|
|
274
|
+
until: Condition<App, Params, Gate, Signal>;
|
|
275
|
+
});
|
|
276
|
+
/** The step types. */
|
|
277
|
+
export type TourStepType = NonNullable<TourStep["type"]>;
|
|
278
|
+
/** What `defineTour` takes. */
|
|
279
|
+
export type TourInput<Id extends string, Params, App, Gate extends string, Signal extends string> = {
|
|
280
|
+
/** Bump it to show the tour again to people who completed, skipped or
|
|
281
|
+
* dismissed an older version (`startOnce`). @default 1 */
|
|
282
|
+
version?: number;
|
|
283
|
+
/** Entry rule for the whole tour: it doesn't start when this returns false. */
|
|
284
|
+
when?: (ctx: TourContext<App, Params, NoInfer<Id>>) => boolean;
|
|
285
|
+
/** The steps, in order. */
|
|
286
|
+
steps: readonly TourStep<Id, NoInfer<Id>, Params, App, Gate, Signal>[];
|
|
287
|
+
};
|
|
288
|
+
/**
|
|
289
|
+
* A tour, built by `defineTour` and registered in `createTours({ registry })`.
|
|
290
|
+
* Its type carries the step ids, params, app shape, gate keys and signal names
|
|
291
|
+
* the registry reads back.
|
|
292
|
+
*/
|
|
293
|
+
export type TourDefinition<Id extends string = string, Params = NoTourParams, App = unknown, Gate extends string = never, Signal extends string = never> = {
|
|
294
|
+
readonly [tourTypes]: {
|
|
295
|
+
readonly id: Id;
|
|
296
|
+
readonly params: (params: Params) => void;
|
|
297
|
+
readonly app: (app: App) => void;
|
|
298
|
+
readonly gate: Gate;
|
|
299
|
+
readonly signal: Signal;
|
|
300
|
+
};
|
|
301
|
+
/** The tour's version. */
|
|
302
|
+
readonly version: number;
|
|
303
|
+
/** The entry rule. */
|
|
304
|
+
readonly when?: (ctx: TourContext<App, Params, Id>) => boolean;
|
|
305
|
+
/** The steps, in order. */
|
|
306
|
+
readonly steps: readonly TourStep<Id, Id, Params, App, Gate, Signal>[];
|
|
307
|
+
};
|
|
308
|
+
/** Any tour, whatever its types. */
|
|
309
|
+
export type AnyTourDefinition = TourDefinition<string, any, any, string, string>;
|
|
310
|
+
/** The tours an app registers, by key. */
|
|
311
|
+
export type TourRegistry = Record<string, AnyTourDefinition>;
|
|
312
|
+
/** A registered tour's key. */
|
|
313
|
+
export type TourKey<R extends TourRegistry> = keyof R & string;
|
|
314
|
+
/** The step ids of one registered tour, or of every tour when `K` is omitted. */
|
|
315
|
+
export type StepIdOf<R extends TourRegistry, K extends TourKey<R> = TourKey<R>> = R[K][typeof tourTypes]["id"];
|
|
316
|
+
/** The params a registered tour expects. */
|
|
317
|
+
export type TourParamsOf<R extends TourRegistry, K extends TourKey<R>> = R[K][typeof tourTypes]["params"] extends (params: infer P) => void ? P : never;
|
|
318
|
+
/** Every gate key the registry's tours wait on: what `useTourGate` accepts. */
|
|
319
|
+
export type GateKeyOf<R extends TourRegistry> = R[TourKey<R>][typeof tourTypes]["gate"];
|
|
320
|
+
/** Every signal name the registry's tours wait on: what `tours.signal` accepts. */
|
|
321
|
+
export type SignalOf<R extends TourRegistry> = R[TourKey<R>][typeof tourTypes]["signal"];
|
|
322
|
+
/** The `app` object the registry's tours need, all of them together. */
|
|
323
|
+
export type TourAppOf<R extends TourRegistry> = R[TourKey<R>][typeof tourTypes]["app"] extends (app: infer A) => void ? A : never;
|
|
324
|
+
/**
|
|
325
|
+
* How a tour ended:
|
|
326
|
+
* - `"completed"`: Done on the last step.
|
|
327
|
+
* - `"skipped"`: Skip, which ends the whole tour, or skipping the last step
|
|
328
|
+
* (Next on an unmet gate, Skip step on a missing target).
|
|
329
|
+
* - `"dismissed"`: Close, Esc, an outside click, or `tours.dismiss()`.
|
|
330
|
+
* - `"not-found"`: nothing to show: the tour's `when` was false, or every
|
|
331
|
+
* step was filtered out.
|
|
332
|
+
*/
|
|
333
|
+
export type TourEndStatus = "completed" | "skipped" | "dismissed" | "not-found";
|
|
334
|
+
/** What `tours.start` resolves with when the tour ends. */
|
|
335
|
+
export type TourResult<Id extends string = string> = {
|
|
336
|
+
/** How the tour ended. */
|
|
337
|
+
status: TourEndStatus;
|
|
338
|
+
/** The step it ended on, or `null` when no step showed. */
|
|
339
|
+
stepId: Id | null;
|
|
340
|
+
/** The answers given to `choices` steps. */
|
|
341
|
+
answers: TourAnswers<Id>;
|
|
342
|
+
};
|
|
343
|
+
/**
|
|
344
|
+
* Where the active step is:
|
|
345
|
+
* - `"loading"`: its target isn't on the page yet; the card shows a spinner.
|
|
346
|
+
* - `"timeout"`: still missing after `wait.timeout`; Skip step and Close show.
|
|
347
|
+
* - `"shown"`: the step is showing.
|
|
348
|
+
*/
|
|
349
|
+
export type TourStepState = "loading" | "timeout" | "shown";
|
|
350
|
+
/** A snapshot of the running tour, for one registered key. */
|
|
351
|
+
export type TourSnapshotOf<Key extends string, Id extends string> = {
|
|
352
|
+
/** This run's id. */
|
|
353
|
+
run: TourRunId;
|
|
354
|
+
/** The tour's key in the registry. */
|
|
355
|
+
key: Key;
|
|
356
|
+
/** The tour's version. */
|
|
357
|
+
version: number;
|
|
358
|
+
/** The active step. */
|
|
359
|
+
stepId: Id;
|
|
360
|
+
/** The active step's index among the steps that show. */
|
|
361
|
+
index: number;
|
|
362
|
+
/** How many steps show. */
|
|
363
|
+
total: number;
|
|
364
|
+
/** Where the active step is. */
|
|
365
|
+
state: TourStepState;
|
|
366
|
+
/** The step's gate, or `null` when it has none. */
|
|
367
|
+
gate: ConditionState | null;
|
|
368
|
+
/** One line per condition of an `all()` gate, or `null`. */
|
|
369
|
+
checklist: readonly TourChecklistItem[] | null;
|
|
370
|
+
/** A `check()` is running: the card shows a loading state. */
|
|
371
|
+
checking: boolean;
|
|
372
|
+
/** The step's `help`, once the user has been stuck for `help.after`. */
|
|
373
|
+
help: {
|
|
374
|
+
hint: string | undefined;
|
|
375
|
+
pulse: boolean;
|
|
376
|
+
} | null;
|
|
377
|
+
/** The active step, with `tours.update` patches applied. */
|
|
378
|
+
step: TourStep<Id, Id>;
|
|
379
|
+
/** The answers given so far. */
|
|
380
|
+
answers: TourAnswers<Id>;
|
|
381
|
+
};
|
|
382
|
+
/** One line of an `all()` checklist. */
|
|
383
|
+
export type TourChecklistItem = {
|
|
384
|
+
/** The condition's key in `all({ … })`. */
|
|
385
|
+
key: string;
|
|
386
|
+
/** Its `label`, or the key. */
|
|
387
|
+
label: string;
|
|
388
|
+
/** Its state. */
|
|
389
|
+
state: ConditionState;
|
|
390
|
+
};
|
|
391
|
+
/** A snapshot of the running tour, discriminated by `key`. */
|
|
392
|
+
export type TourSnapshot<R extends TourRegistry = TourRegistry> = {
|
|
393
|
+
[K in TourKey<R>]: TourSnapshotOf<K, StepIdOf<R, K>>;
|
|
394
|
+
}[TourKey<R>];
|
|
395
|
+
/** Fields every event carries. */
|
|
396
|
+
type EventBase<Key extends string, Id extends string> = {
|
|
397
|
+
/** The tour's key in the registry. */
|
|
398
|
+
key: Key;
|
|
399
|
+
/** The tour's version. */
|
|
400
|
+
version: number;
|
|
401
|
+
/** This run's id, to group a run's events. */
|
|
402
|
+
run: TourRunId;
|
|
403
|
+
/** The step the event is about. */
|
|
404
|
+
stepId: Id;
|
|
405
|
+
/** That step's index among the steps that show. */
|
|
406
|
+
index: number;
|
|
407
|
+
};
|
|
408
|
+
/** The events of one registered tour. */
|
|
409
|
+
export type TourEventOf<Key extends string, Id extends string> = (Omit<EventBase<Key, Id>, "stepId"> & {
|
|
410
|
+
type: "tour:start";
|
|
411
|
+
/** The first step, or `null` when nothing shows. */
|
|
412
|
+
stepId: Id | null;
|
|
413
|
+
/** Started with `resume`. */
|
|
414
|
+
resumed: boolean;
|
|
415
|
+
}) | (EventBase<Key, Id> & {
|
|
416
|
+
type: "step:show";
|
|
417
|
+
}) | (EventBase<Key, Id> & {
|
|
418
|
+
type: "step:invalid";
|
|
419
|
+
/** The hint the condition reported. */
|
|
420
|
+
message: string;
|
|
421
|
+
/** How many times the step was invalid so far. */
|
|
422
|
+
attempts: number;
|
|
423
|
+
}) | (EventBase<Key, Id> & {
|
|
424
|
+
type: "step:hint";
|
|
425
|
+
/** The help hint that showed. */
|
|
426
|
+
hint: string | undefined;
|
|
427
|
+
}) | (EventBase<Key, Id> & {
|
|
428
|
+
type: "step:complete";
|
|
429
|
+
/** Ms spent on the step. */
|
|
430
|
+
duration: number;
|
|
431
|
+
/** How many times the step was invalid before it passed. */
|
|
432
|
+
attempts: number;
|
|
433
|
+
}) | (EventBase<Key, Id> & {
|
|
434
|
+
type: "step:skip";
|
|
435
|
+
}) | (EventBase<Key, Id> & {
|
|
436
|
+
type: "step:waiting";
|
|
437
|
+
}) | (EventBase<Key, Id> & {
|
|
438
|
+
type: "step:timeout";
|
|
439
|
+
/** Ms waited for the target. */
|
|
440
|
+
timeout: number;
|
|
441
|
+
}) | (Omit<EventBase<Key, Id>, "stepId"> & {
|
|
442
|
+
type: "tour:end";
|
|
443
|
+
/** The step it ended on, or `null` when nothing showed. */
|
|
444
|
+
stepId: Id | null;
|
|
445
|
+
/** How the tour ended. */
|
|
446
|
+
status: TourEndStatus;
|
|
447
|
+
});
|
|
448
|
+
/** Everything sent to `onEvent`, discriminated by `type` and by `key`. */
|
|
449
|
+
export type TourEvent<R extends TourRegistry = TourRegistry> = {
|
|
450
|
+
[K in TourKey<R>]: TourEventOf<K, StepIdOf<R, K>>;
|
|
451
|
+
}[TourKey<R>];
|
|
452
|
+
/** An event's `type`. */
|
|
453
|
+
export type TourEventType = TourEventOf<string, string>["type"];
|
|
454
|
+
/** What storage keeps about one tour. */
|
|
455
|
+
export type TourRecord = {
|
|
456
|
+
/** The version the record is about. A record for an older version counts
|
|
457
|
+
* as never seen. */
|
|
458
|
+
version: number;
|
|
459
|
+
/** `"active"` while it runs; how it ended after that. Any end status
|
|
460
|
+
* (completed, skipped, dismissed) marks this version as seen. */
|
|
461
|
+
status: "active" | Exclude<TourEndStatus, "not-found">;
|
|
462
|
+
/** The last step shown, for `resume`. */
|
|
463
|
+
stepId: string | null;
|
|
464
|
+
/** The answers given so far. */
|
|
465
|
+
answers: TourAnswers;
|
|
466
|
+
/** When the record was written, in ms since the epoch. */
|
|
467
|
+
updatedAt: number;
|
|
468
|
+
};
|
|
469
|
+
/**
|
|
470
|
+
* Where `startOnce` and `resume` keep progress. The kit ships
|
|
471
|
+
* `localStorageTours()`; an app can store it on the server with the same
|
|
472
|
+
* shape. Every method may be sync or async.
|
|
473
|
+
*/
|
|
474
|
+
export type TourStorage = {
|
|
475
|
+
/** Reads a tour's record, or `null` when there is none. */
|
|
476
|
+
get: (key: string) => TourRecord | null | Promise<TourRecord | null>;
|
|
477
|
+
/** Writes a tour's record. */
|
|
478
|
+
set: (key: string, record: TourRecord) => void | Promise<void>;
|
|
479
|
+
/** Forgets a tour's record. */
|
|
480
|
+
remove: (key: string) => void | Promise<void>;
|
|
481
|
+
};
|
|
482
|
+
/** Whether a tour's params can be left out: true when none is required. */
|
|
483
|
+
type ParamsOptional<Params> = NoTourParams extends Params ? true : false;
|
|
484
|
+
/** Options of `tours.start`, `startOnce` and `resume`. */
|
|
485
|
+
export type TourStartOptions<Params, Id extends string> = {
|
|
486
|
+
/** Starts at this step, for QA and "show me again" links. */
|
|
487
|
+
from?: Id;
|
|
488
|
+
} & (ParamsOptional<Params> extends true ? {
|
|
489
|
+
/** The tour's params. */
|
|
490
|
+
params?: Params;
|
|
491
|
+
} : {
|
|
492
|
+
/** The tour's params. */
|
|
493
|
+
params: Params;
|
|
494
|
+
});
|
|
495
|
+
/** `start`'s arguments after the key: the options are required when the tour
|
|
496
|
+
* has required params. */
|
|
497
|
+
export type TourStartArgs<Params, Id extends string> = ParamsOptional<Params> extends true ? [options?: TourStartOptions<Params, Id>] : [options: TourStartOptions<Params, Id>];
|
|
498
|
+
/** What `tours.update` can patch on the step that shows. */
|
|
499
|
+
export type TourStepPatch = {
|
|
500
|
+
/** The card's title. */
|
|
501
|
+
title?: ReactNode;
|
|
502
|
+
/** The card's body. */
|
|
503
|
+
description?: ReactNode;
|
|
504
|
+
/** The card's buttons. */
|
|
505
|
+
actions?: readonly TourAction[];
|
|
506
|
+
};
|
|
507
|
+
/** The key a `start` call accepts. Written as a conditional so an unknown key
|
|
508
|
+
* is reported against the list of registered keys, instead of failing the
|
|
509
|
+
* arguments after it. */
|
|
510
|
+
type KeyArg<R extends TourRegistry, K extends string> = K extends TourKey<R> ? K : TourKey<R>;
|
|
511
|
+
/** The arguments after the key, for a registered key. */
|
|
512
|
+
type StartArgsOf<R extends TourRegistry, K extends string> = K extends TourKey<R> ? TourStartArgs<TourParamsOf<R, K>, StepIdOf<R, K>> : [options?: never];
|
|
513
|
+
/** Why a storage method is missing. */
|
|
514
|
+
type NeedsStorage = Unavailable<"needs `storage` in createTours">;
|
|
515
|
+
/**
|
|
516
|
+
* The tours controller: callable from anywhere (a button, a route loader, a
|
|
517
|
+
* first-login effect). Typed against the registry.
|
|
518
|
+
*/
|
|
519
|
+
export type TourController<R extends TourRegistry = TourRegistry, Stored extends boolean = boolean> = {
|
|
520
|
+
/**
|
|
521
|
+
* Starts a tour and resolves when it ends. Queued while another tour runs
|
|
522
|
+
* or a modal is open (D7).
|
|
523
|
+
*/
|
|
524
|
+
start: <const K extends string>(key: KeyArg<R, K>, ...args: StartArgsOf<R, K>) => Promise<TourResult<StepIdOf<R, K & TourKey<R>>>>;
|
|
525
|
+
/**
|
|
526
|
+
* Starts only if this version of the tour was never seen: not completed,
|
|
527
|
+
* skipped or dismissed. Resolves `null` when it didn't start. Bumping the
|
|
528
|
+
* tour's `version`, or `tours.reset(key)`, shows it again.
|
|
529
|
+
*/
|
|
530
|
+
startOnce: Stored extends true ? <const K extends string>(key: KeyArg<R, K>, ...args: StartArgsOf<R, K>) => Promise<TourResult<StepIdOf<R, K & TourKey<R>>> | null> : NeedsStorage;
|
|
531
|
+
/**
|
|
532
|
+
* Continues from the saved step, or starts from the first one when nothing
|
|
533
|
+
* is saved. Takes the same options as `start`: params aren't stored.
|
|
534
|
+
*/
|
|
535
|
+
resume: Stored extends true ? <const K extends string>(key: KeyArg<R, K>, ...args: StartArgsOf<R, K>) => Promise<TourResult<StepIdOf<R, K & TourKey<R>>>> : NeedsStorage;
|
|
536
|
+
/** Forgets a tour's stored progress, for a "Replay the tour" menu item. */
|
|
537
|
+
reset: Stored extends true ? (key: TourKey<R>) => Promise<void> : NeedsStorage;
|
|
538
|
+
/**
|
|
539
|
+
* Moves to the next step. Counts as completing the step (`step:complete`)
|
|
540
|
+
* when its gate is valid or it has none, and as skipping it (`step:skip`)
|
|
541
|
+
* otherwise: Skip step on a missing target is `next()`. On the last step it
|
|
542
|
+
* ends the tour, `"completed"` or `"skipped"` accordingly.
|
|
543
|
+
*/
|
|
544
|
+
next: () => void;
|
|
545
|
+
/** Moves to the previous step. */
|
|
546
|
+
back: () => void;
|
|
547
|
+
/** Jumps to a step of the running tour. */
|
|
548
|
+
goto: (step: StepIdOf<R>) => void;
|
|
549
|
+
/** Answers a `choices` step: records the value in `answers` and moves to
|
|
550
|
+
* the choice's `goto`, or the next step. */
|
|
551
|
+
choose: (value: string) => void;
|
|
552
|
+
/** Ends the tour with `"skipped"`. */
|
|
553
|
+
skip: () => void;
|
|
554
|
+
/** Ends the tour with `"dismissed"`. */
|
|
555
|
+
dismiss: () => void;
|
|
556
|
+
/** Tells the running tour that a business event happened. A step waiting on
|
|
557
|
+
* it passes; if none waits yet, the run remembers it for a later step.
|
|
558
|
+
* Dropped when no tour runs. */
|
|
559
|
+
signal: (name: SignalOf<R>, payload?: unknown) => void;
|
|
560
|
+
/** Patches the step that shows. */
|
|
561
|
+
update: (patch: TourStepPatch) => void;
|
|
562
|
+
/** The running tour, or `null`. */
|
|
563
|
+
readonly active: TourSnapshot<R> | null;
|
|
564
|
+
};
|
|
565
|
+
/** `useTours()`'s return: `[active, tours]`, like `useOverlays()`. */
|
|
566
|
+
export type UseToursReturn<R extends TourRegistry = TourRegistry, Stored extends boolean = boolean> = readonly [TourSnapshot<R> | null, TourController<R, Stored>];
|
|
567
|
+
/**
|
|
568
|
+
* Reports a gate's state from the component that owns it. Writes on each
|
|
569
|
+
* render where the state changes; does nothing while no step waits on `key`.
|
|
570
|
+
*/
|
|
571
|
+
export type UseTourGate<R extends TourRegistry = TourRegistry> = (key: GateKeyOf<R>, state: ConditionState) => void;
|
|
572
|
+
/** The card's strings. They also become the triggers' `aria-label`s. */
|
|
573
|
+
export type TourTranslations = {
|
|
574
|
+
/** "2 of 5". `current` counts from 1. */
|
|
575
|
+
progressText?: (details: {
|
|
576
|
+
current: number;
|
|
577
|
+
total: number;
|
|
578
|
+
}) => string;
|
|
579
|
+
/** The Next button. */
|
|
580
|
+
next?: string;
|
|
581
|
+
/** The Back button. */
|
|
582
|
+
back?: string;
|
|
583
|
+
/** The Done button on the last step. */
|
|
584
|
+
done?: string;
|
|
585
|
+
/** The Skip button, which ends the tour. */
|
|
586
|
+
skip?: string;
|
|
587
|
+
/** The Skip step button, shown when a target is missing. */
|
|
588
|
+
skipStep?: string;
|
|
589
|
+
/** The close button. */
|
|
590
|
+
close?: string;
|
|
591
|
+
/** Shown while a step's target is missing. */
|
|
592
|
+
loading?: string;
|
|
593
|
+
/** Announced when a gate passes, beside the tick. */
|
|
594
|
+
valid?: string;
|
|
595
|
+
/** Next's tooltip while the step's gate isn't met and has no hint. */
|
|
596
|
+
blocked?: string;
|
|
597
|
+
};
|
|
598
|
+
/** The card's styleable parts. */
|
|
599
|
+
export type TourSlot = "backdrop" | "spotlight" | "positioner" | "content" | "arrow" | "title" | "description" | "progress" | "checklist" | "hint" | "actions" | "close";
|
|
600
|
+
/** A class per part. */
|
|
601
|
+
export type TourClassNames = Partial<Record<TourSlot, string>>;
|
|
602
|
+
/** The card's replaceable icons. */
|
|
603
|
+
export type TourIconSlot = "close" | "check";
|
|
604
|
+
/** `icons` for the card. */
|
|
605
|
+
export type TourIcons = IconMap<TourIconSlot>;
|
|
606
|
+
/** What a custom `render` receives. */
|
|
607
|
+
export type TourRenderProps<R extends TourRegistry = TourRegistry> = {
|
|
608
|
+
/** The running tour. */
|
|
609
|
+
active: TourSnapshot<R>;
|
|
610
|
+
/** The step that shows, with `tours.update` patches applied. */
|
|
611
|
+
step: TourStep<StepIdOf<R>, StepIdOf<R>>;
|
|
612
|
+
/** The tour controller. */
|
|
613
|
+
tours: TourController<R>;
|
|
614
|
+
/** The step is waiting for its target (D3). */
|
|
615
|
+
loading: boolean;
|
|
616
|
+
/** The merged translations. */
|
|
617
|
+
translations: Required<TourTranslations>;
|
|
618
|
+
};
|
|
619
|
+
/** Props of the `<Tours />` renderer. */
|
|
620
|
+
export type ToursProps = {
|
|
621
|
+
/** The card's accent. Never `gray`: use `neutral`. */
|
|
622
|
+
color?: Color;
|
|
623
|
+
/** A class per part. */
|
|
624
|
+
classNames?: TourClassNames;
|
|
625
|
+
/** The card's icons. */
|
|
626
|
+
icons?: TourIcons;
|
|
627
|
+
/** Draws the arrow on anchored steps. A step's own `withArrow` wins. @default true */
|
|
628
|
+
withArrow?: boolean;
|
|
629
|
+
/** Dims the page. A step's own `withBackdrop` wins. @default true */
|
|
630
|
+
withBackdrop?: boolean;
|
|
631
|
+
/** Shows the close button. @default true */
|
|
632
|
+
withCloseButton?: boolean;
|
|
633
|
+
/** `data-testid` on the content; each part gets `${testId}-${part}`. */
|
|
634
|
+
testId?: string;
|
|
635
|
+
};
|
|
636
|
+
/** Reads the current pathname and says when it changes, for `route()`. */
|
|
637
|
+
export type TourLocation = {
|
|
638
|
+
/** The current pathname. */
|
|
639
|
+
get: () => string;
|
|
640
|
+
/** Calls `listener` on every navigation; returns the unsubscribe. */
|
|
641
|
+
subscribe: (listener: () => void) => () => void;
|
|
642
|
+
};
|
|
643
|
+
/** `createTours`' `app`: required when a registered tour needs one. */
|
|
644
|
+
type AppField<App> = unknown extends App ? {
|
|
645
|
+
/** Handed to every condition as `ctx.app`. */
|
|
646
|
+
app?: App;
|
|
647
|
+
} : {
|
|
648
|
+
/** Handed to every condition as `ctx.app`. A registered tour needs it. */
|
|
649
|
+
app: App;
|
|
650
|
+
};
|
|
651
|
+
/** What `createTours` takes. */
|
|
652
|
+
export type CreateToursConfig<R extends TourRegistry = TourRegistry, Storage extends TourStorage | undefined = TourStorage | undefined> = AppField<TourAppOf<R>> & {
|
|
653
|
+
/** The tours, by key, each built with `defineTour`. */
|
|
654
|
+
registry: R;
|
|
655
|
+
/** Where `route()` reads the pathname. Defaults to `window.location`,
|
|
656
|
+
* updated on `popstate` (and the Navigation API where available). */
|
|
657
|
+
location?: TourLocation;
|
|
658
|
+
/** Enables `startOnce`, `resume` and `reset`. */
|
|
659
|
+
storage?: Storage;
|
|
660
|
+
/** One typed stream of everything that happens, for analytics. */
|
|
661
|
+
onEvent?: (event: TourEvent<R>) => void;
|
|
662
|
+
/** The card's strings. */
|
|
663
|
+
translations?: TourTranslations;
|
|
664
|
+
/** Replaces the default card. Rendered inside `Tour.Root`, so the compound
|
|
665
|
+
* parts work. */
|
|
666
|
+
render?: (props: TourRenderProps<R>) => ReactNode;
|
|
667
|
+
};
|
|
668
|
+
/** What `createTours` returns. */
|
|
669
|
+
export type ToursHandle<R extends TourRegistry = TourRegistry, Stored extends boolean = boolean> = {
|
|
670
|
+
/** The controller, callable from anywhere. */
|
|
671
|
+
tours: TourController<R, Stored>;
|
|
672
|
+
/** The renderer. Mount it once, near the app root. */
|
|
673
|
+
Tours: (props: ToursProps) => React.JSX.Element | null;
|
|
674
|
+
/** `[active, tours]`, reactive. */
|
|
675
|
+
useTours: () => UseToursReturn<R, Stored>;
|
|
676
|
+
/** Reports a gate from the component that owns its state. */
|
|
677
|
+
useTourGate: UseTourGate<R>;
|
|
678
|
+
};
|
|
679
|
+
export {};
|
|
680
|
+
//# sourceMappingURL=types.d.ts.map
|