@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,1449 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { modalSurface } from '../../chunk-IBXYLO2J.js';
|
|
3
|
+
import { Button } from '../../chunk-KZDMVOL6.js';
|
|
4
|
+
import '../../chunk-5HWFYYHW.js';
|
|
5
|
+
import { popoverChrome } from '../../chunk-YUVKROMA.js';
|
|
6
|
+
import '../../chunk-TPOV3OCC.js';
|
|
7
|
+
import { useNestedLayer, isModalOpen, subscribeLayers } from '../../chunk-SI7C3W5M.js';
|
|
8
|
+
import '../../chunk-HBWV5EPU.js';
|
|
9
|
+
import '../../chunk-OBSZ4NE2.js';
|
|
10
|
+
import { createFloatingArrow, Tooltip } from '../../chunk-FED6SJWM.js';
|
|
11
|
+
import { resolveLogicalPlacement } from '../../chunk-V6PY7C6S.js';
|
|
12
|
+
import '../../chunk-SLUOF7XW.js';
|
|
13
|
+
import { ActionIcon } from '../../chunk-ALANKV5Y.js';
|
|
14
|
+
import '../../chunk-NDI4HLQE.js';
|
|
15
|
+
import '../../chunk-6B2GNPJP.js';
|
|
16
|
+
import { mergeIcons, iconStroke } from '../../chunk-XXOR34T4.js';
|
|
17
|
+
import { Spinner } from '../../chunk-W3XX7BYT.js';
|
|
18
|
+
import { devWarn } from '../../chunk-PQZSTI3R.js';
|
|
19
|
+
import '../../chunk-PMUCGFY5.js';
|
|
20
|
+
import { useIsomorphicLayoutEffect } from '../../chunk-BUIHQJGE.js';
|
|
21
|
+
import '../../chunk-R5LYFTHA.js';
|
|
22
|
+
import { props } from '../../chunk-WYCMIIRR.js';
|
|
23
|
+
import '../../chunk-C6NVU4F7.js';
|
|
24
|
+
import '../../chunk-GIPQUKCN.js';
|
|
25
|
+
import { cn } from '../../chunk-4ASNIDV7.js';
|
|
26
|
+
import { useSyncExternalStore, useMemo, useEffect, useRef, useState } from 'react';
|
|
27
|
+
import { customAlphabet } from 'nanoid';
|
|
28
|
+
import { useLocaleContext } from '@ark-ui/react/locale';
|
|
29
|
+
import { Portal } from '@ark-ui/react/portal';
|
|
30
|
+
import { Tour as Tour$1, useTour } from '@ark-ui/react/tour';
|
|
31
|
+
import { CheckIcon, XIcon, CircleIcon } from 'lucide-react';
|
|
32
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
33
|
+
|
|
34
|
+
// src/components/tour/runtime.ts
|
|
35
|
+
var SETUP = /* @__PURE__ */ Symbol("tour.condition");
|
|
36
|
+
var makeCondition = (setup, advance, label) => ({ advance, label, [SETUP]: setup });
|
|
37
|
+
var setupOf = (condition2) => condition2[SETUP];
|
|
38
|
+
var sameState = (a, b) => a === b || typeof a === "object" && a !== null && typeof b === "object" && b !== null && a.invalid === b.invalid;
|
|
39
|
+
var resolveTarget = (target) => {
|
|
40
|
+
if (target === void 0 || typeof document === "undefined") return null;
|
|
41
|
+
if (typeof target === "function") return target();
|
|
42
|
+
if (typeof target === "string") {
|
|
43
|
+
try {
|
|
44
|
+
return document.querySelector(target);
|
|
45
|
+
} catch {
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
return target.current;
|
|
50
|
+
};
|
|
51
|
+
var spotlightTarget = (el) => el?.matches("input, textarea, select, [role=combobox]") ? el.closest("[data-frame]") ?? el : el;
|
|
52
|
+
function createGateStore() {
|
|
53
|
+
const values = /* @__PURE__ */ new Map();
|
|
54
|
+
const listeners = /* @__PURE__ */ new Map();
|
|
55
|
+
const notify = (key) => {
|
|
56
|
+
for (const listener of listeners.get(key) ?? []) listener();
|
|
57
|
+
};
|
|
58
|
+
return {
|
|
59
|
+
get: (key) => values.get(key) ?? "pending",
|
|
60
|
+
set: (key, state) => {
|
|
61
|
+
if (sameState(values.get(key) ?? null, state)) return;
|
|
62
|
+
values.set(key, state);
|
|
63
|
+
notify(key);
|
|
64
|
+
},
|
|
65
|
+
remove: (key) => {
|
|
66
|
+
if (!values.delete(key)) return;
|
|
67
|
+
notify(key);
|
|
68
|
+
},
|
|
69
|
+
subscribe: (key, listener) => {
|
|
70
|
+
let set = listeners.get(key);
|
|
71
|
+
if (!set) {
|
|
72
|
+
set = /* @__PURE__ */ new Set();
|
|
73
|
+
listeners.set(key, set);
|
|
74
|
+
}
|
|
75
|
+
set.add(listener);
|
|
76
|
+
return () => {
|
|
77
|
+
set.delete(listener);
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
var navigation = () => window.navigation;
|
|
83
|
+
var windowLocation = {
|
|
84
|
+
get: () => typeof window === "undefined" ? "/" : window.location.pathname,
|
|
85
|
+
subscribe: (listener) => {
|
|
86
|
+
if (typeof window === "undefined") return () => {
|
|
87
|
+
};
|
|
88
|
+
window.addEventListener("popstate", listener);
|
|
89
|
+
navigation()?.addEventListener("currententrychange", listener);
|
|
90
|
+
return () => {
|
|
91
|
+
window.removeEventListener("popstate", listener);
|
|
92
|
+
navigation()?.removeEventListener("currententrychange", listener);
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
var matchRoute = (pattern, pathname) => {
|
|
97
|
+
const trim = (path) => path.length > 1 ? path.replace(/\/+$/, "") : path;
|
|
98
|
+
const source = trim(pattern).split("/").map((segment) => {
|
|
99
|
+
if (segment === "*") return ".*";
|
|
100
|
+
if (segment.startsWith(":")) return "[^/]+";
|
|
101
|
+
return segment.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
102
|
+
}).join("/");
|
|
103
|
+
return new RegExp(`^${source}$`).test(trim(pathname));
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
// src/components/tour/conditions.ts
|
|
107
|
+
var HINT_DELAY = 800;
|
|
108
|
+
function condition(setup, options) {
|
|
109
|
+
return makeCondition(
|
|
110
|
+
(ctx, report) => {
|
|
111
|
+
let reported = false;
|
|
112
|
+
const cleanup = setup(ctx, (state) => {
|
|
113
|
+
reported = true;
|
|
114
|
+
report(state);
|
|
115
|
+
});
|
|
116
|
+
if (cleanup) return cleanup;
|
|
117
|
+
return () => {
|
|
118
|
+
if (!reported) {
|
|
119
|
+
devWarn(
|
|
120
|
+
"[tour] A condition() setup returned no cleanup and never reported: it can never pass."
|
|
121
|
+
);
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
},
|
|
125
|
+
options?.advance ?? "auto",
|
|
126
|
+
options?.label
|
|
127
|
+
);
|
|
128
|
+
}
|
|
129
|
+
var watched = (target, stepTarget) => (target === void 0 ? null : resolveTarget(target)) ?? stepTarget();
|
|
130
|
+
var listen = (type, handler) => {
|
|
131
|
+
document.addEventListener(type, handler, true);
|
|
132
|
+
return () => document.removeEventListener(type, handler, true);
|
|
133
|
+
};
|
|
134
|
+
function click(options) {
|
|
135
|
+
return makeCondition(
|
|
136
|
+
(_ctx, report, services) => {
|
|
137
|
+
report("pending");
|
|
138
|
+
return listen("click", (event) => {
|
|
139
|
+
const element2 = watched(options?.target, services.target);
|
|
140
|
+
if (element2 && event.target instanceof Node && element2.contains(event.target))
|
|
141
|
+
report("valid");
|
|
142
|
+
});
|
|
143
|
+
},
|
|
144
|
+
options?.advance ?? "auto",
|
|
145
|
+
options?.label
|
|
146
|
+
);
|
|
147
|
+
}
|
|
148
|
+
var fieldOf = (element2) => {
|
|
149
|
+
if (!element2) return null;
|
|
150
|
+
if (element2 instanceof HTMLInputElement || element2 instanceof HTMLTextAreaElement || element2 instanceof HTMLSelectElement) {
|
|
151
|
+
return element2;
|
|
152
|
+
}
|
|
153
|
+
return element2.querySelector("input, textarea, select");
|
|
154
|
+
};
|
|
155
|
+
var fieldCondition = (test, hint, options) => makeCondition(
|
|
156
|
+
(_ctx, report, services) => {
|
|
157
|
+
let timer;
|
|
158
|
+
const field = () => fieldOf(watched(options?.target, services.target));
|
|
159
|
+
const failed = (element2) => {
|
|
160
|
+
const message = hint(element2);
|
|
161
|
+
return message ? { invalid: message } : "pending";
|
|
162
|
+
};
|
|
163
|
+
const evaluate = (element2, settle) => {
|
|
164
|
+
clearTimeout(timer);
|
|
165
|
+
if (!element2) return report("pending");
|
|
166
|
+
if (test(element2)) return report("valid");
|
|
167
|
+
if (settle) return report(failed(element2));
|
|
168
|
+
report("pending");
|
|
169
|
+
timer = setTimeout(() => report(failed(element2)), HINT_DELAY);
|
|
170
|
+
};
|
|
171
|
+
const initial = field();
|
|
172
|
+
report(initial && test(initial) ? "valid" : "pending");
|
|
173
|
+
const onEdit = (event) => {
|
|
174
|
+
const element2 = field();
|
|
175
|
+
if (element2 && event.target === element2) evaluate(element2, false);
|
|
176
|
+
};
|
|
177
|
+
const onBlur = (event) => {
|
|
178
|
+
const element2 = field();
|
|
179
|
+
if (element2 && event.target === element2) evaluate(element2, true);
|
|
180
|
+
};
|
|
181
|
+
const stops = [listen("input", onEdit), listen("change", onEdit), listen("focusout", onBlur)];
|
|
182
|
+
return () => {
|
|
183
|
+
clearTimeout(timer);
|
|
184
|
+
for (const stop of stops) stop();
|
|
185
|
+
};
|
|
186
|
+
},
|
|
187
|
+
options?.advance ?? "manual",
|
|
188
|
+
options?.label
|
|
189
|
+
);
|
|
190
|
+
function value(check2, options) {
|
|
191
|
+
return fieldCondition(
|
|
192
|
+
(field) => check2(field.value),
|
|
193
|
+
() => options?.hint,
|
|
194
|
+
options
|
|
195
|
+
);
|
|
196
|
+
}
|
|
197
|
+
value.valid = (options) => fieldCondition(
|
|
198
|
+
(field) => field.checkValidity(),
|
|
199
|
+
(field) => options?.hint ?? (field.validationMessage || void 0),
|
|
200
|
+
options
|
|
201
|
+
);
|
|
202
|
+
function submit(options) {
|
|
203
|
+
return makeCondition(
|
|
204
|
+
(_ctx, report, services) => {
|
|
205
|
+
report("pending");
|
|
206
|
+
return listen("submit", (event) => {
|
|
207
|
+
const element2 = watched(options?.target, services.target);
|
|
208
|
+
const form = element2 instanceof HTMLFormElement ? element2 : element2?.closest("form");
|
|
209
|
+
if (form && event.target === form) report("valid");
|
|
210
|
+
});
|
|
211
|
+
},
|
|
212
|
+
options?.advance ?? "auto",
|
|
213
|
+
options?.label
|
|
214
|
+
);
|
|
215
|
+
}
|
|
216
|
+
function route(match, options) {
|
|
217
|
+
const test = typeof match === "string" ? (path) => matchRoute(match, path) : match;
|
|
218
|
+
return makeCondition(
|
|
219
|
+
(_ctx, report, services) => {
|
|
220
|
+
const check2 = () => report(test(services.location.get()) ? "valid" : "pending");
|
|
221
|
+
check2();
|
|
222
|
+
return services.location.subscribe(check2);
|
|
223
|
+
},
|
|
224
|
+
options?.advance ?? "auto",
|
|
225
|
+
options?.label
|
|
226
|
+
);
|
|
227
|
+
}
|
|
228
|
+
var isVisible = (element2) => {
|
|
229
|
+
if (!element2?.isConnected || element2.closest("[hidden]")) return false;
|
|
230
|
+
const style = getComputedStyle(element2);
|
|
231
|
+
return style.display !== "none" && style.visibility !== "hidden";
|
|
232
|
+
};
|
|
233
|
+
function element(selector, options) {
|
|
234
|
+
const wanted = options?.state ?? "visible";
|
|
235
|
+
return makeCondition(
|
|
236
|
+
(_ctx, report) => {
|
|
237
|
+
const check2 = () => {
|
|
238
|
+
const visible = isVisible(resolveTarget(selector));
|
|
239
|
+
report(visible === (wanted === "visible") ? "valid" : "pending");
|
|
240
|
+
};
|
|
241
|
+
check2();
|
|
242
|
+
const observer = new MutationObserver(check2);
|
|
243
|
+
observer.observe(document.documentElement, {
|
|
244
|
+
childList: true,
|
|
245
|
+
subtree: true,
|
|
246
|
+
attributes: true,
|
|
247
|
+
attributeFilter: ["class", "style", "hidden"]
|
|
248
|
+
});
|
|
249
|
+
return () => observer.disconnect();
|
|
250
|
+
},
|
|
251
|
+
options?.advance ?? "auto",
|
|
252
|
+
options?.label
|
|
253
|
+
);
|
|
254
|
+
}
|
|
255
|
+
function signal(name, match, options) {
|
|
256
|
+
return makeCondition(
|
|
257
|
+
(_ctx, report, services) => {
|
|
258
|
+
report("pending");
|
|
259
|
+
return services.onSignal(name, (payload) => {
|
|
260
|
+
const accepted = !match || match(payload);
|
|
261
|
+
if (accepted) report("valid");
|
|
262
|
+
return accepted;
|
|
263
|
+
});
|
|
264
|
+
},
|
|
265
|
+
options?.advance ?? "auto",
|
|
266
|
+
options?.label
|
|
267
|
+
);
|
|
268
|
+
}
|
|
269
|
+
var toState = (result) => {
|
|
270
|
+
if (result === true) return "valid";
|
|
271
|
+
if (result === false) return "pending";
|
|
272
|
+
return result;
|
|
273
|
+
};
|
|
274
|
+
function check(run, options) {
|
|
275
|
+
return makeCondition(
|
|
276
|
+
(ctx, report, services) => {
|
|
277
|
+
let timer;
|
|
278
|
+
const attempt = () => {
|
|
279
|
+
services.setChecking(true);
|
|
280
|
+
run(ctx).then(toState, () => "pending").then((state) => {
|
|
281
|
+
if (ctx.signal.aborted) return;
|
|
282
|
+
services.setChecking(false);
|
|
283
|
+
report(state);
|
|
284
|
+
if (state !== "valid" && options?.interval)
|
|
285
|
+
timer = setTimeout(attempt, options.interval);
|
|
286
|
+
});
|
|
287
|
+
};
|
|
288
|
+
report("pending");
|
|
289
|
+
attempt();
|
|
290
|
+
return () => {
|
|
291
|
+
clearTimeout(timer);
|
|
292
|
+
services.setChecking(false);
|
|
293
|
+
};
|
|
294
|
+
},
|
|
295
|
+
options?.advance ?? "auto",
|
|
296
|
+
options?.label
|
|
297
|
+
);
|
|
298
|
+
}
|
|
299
|
+
var runMembers = (members, combine, ctx, services) => {
|
|
300
|
+
const states = members.map(() => "pending");
|
|
301
|
+
let ready = false;
|
|
302
|
+
const cleanups = members.map(
|
|
303
|
+
([, member], index) => setupOf(member)(
|
|
304
|
+
ctx,
|
|
305
|
+
(state) => {
|
|
306
|
+
if (sameState(states[index] ?? null, state)) return;
|
|
307
|
+
states[index] = state;
|
|
308
|
+
if (ready) combine(states);
|
|
309
|
+
},
|
|
310
|
+
{ ...services, setChecklist: () => {
|
|
311
|
+
} }
|
|
312
|
+
)
|
|
313
|
+
);
|
|
314
|
+
ready = true;
|
|
315
|
+
combine(states);
|
|
316
|
+
return () => {
|
|
317
|
+
for (const cleanup of cleanups) cleanup?.();
|
|
318
|
+
};
|
|
319
|
+
};
|
|
320
|
+
var firstInvalid = (states) => states.find((state) => typeof state === "object");
|
|
321
|
+
function all(conditions, options) {
|
|
322
|
+
const members = Object.entries(conditions);
|
|
323
|
+
return makeCondition(
|
|
324
|
+
(ctx, report, services) => {
|
|
325
|
+
const stop = runMembers(
|
|
326
|
+
members,
|
|
327
|
+
(states) => {
|
|
328
|
+
services.setChecklist(
|
|
329
|
+
members.map(
|
|
330
|
+
([key, member], index) => ({
|
|
331
|
+
key,
|
|
332
|
+
label: member.label ?? key,
|
|
333
|
+
state: states[index] ?? "pending"
|
|
334
|
+
})
|
|
335
|
+
)
|
|
336
|
+
);
|
|
337
|
+
if (states.every((state) => state === "valid")) report("valid");
|
|
338
|
+
else report(firstInvalid(states) ?? "pending");
|
|
339
|
+
},
|
|
340
|
+
ctx,
|
|
341
|
+
services
|
|
342
|
+
);
|
|
343
|
+
return () => {
|
|
344
|
+
stop();
|
|
345
|
+
services.setChecklist(null);
|
|
346
|
+
};
|
|
347
|
+
},
|
|
348
|
+
options?.advance ?? "manual",
|
|
349
|
+
options?.label
|
|
350
|
+
);
|
|
351
|
+
}
|
|
352
|
+
function any(...conditions) {
|
|
353
|
+
const members = conditions.map((member, index) => [String(index), member]);
|
|
354
|
+
return makeCondition(
|
|
355
|
+
(ctx, report, services) => runMembers(
|
|
356
|
+
members,
|
|
357
|
+
(states) => {
|
|
358
|
+
if (states.some((state) => state === "valid")) report("valid");
|
|
359
|
+
else report(firstInvalid(states) ?? "pending");
|
|
360
|
+
},
|
|
361
|
+
ctx,
|
|
362
|
+
services
|
|
363
|
+
),
|
|
364
|
+
"auto"
|
|
365
|
+
);
|
|
366
|
+
}
|
|
367
|
+
function gate(key, options) {
|
|
368
|
+
return makeCondition(
|
|
369
|
+
(_ctx, report, services) => {
|
|
370
|
+
const check2 = () => report(services.gates.get(key));
|
|
371
|
+
check2();
|
|
372
|
+
return services.gates.subscribe(key, check2);
|
|
373
|
+
},
|
|
374
|
+
options?.advance ?? "auto",
|
|
375
|
+
options?.label
|
|
376
|
+
);
|
|
377
|
+
}
|
|
378
|
+
var deepActiveElement = (root = document) => {
|
|
379
|
+
const active = root.activeElement;
|
|
380
|
+
return active?.shadowRoot ? deepActiveElement(active.shadowRoot) ?? active : active;
|
|
381
|
+
};
|
|
382
|
+
var canFocus = (element2) => element2.isConnected && !element2.disabled && element2.closest("[inert]") === null;
|
|
383
|
+
function createFocusReturn(within = () => []) {
|
|
384
|
+
let saved = null;
|
|
385
|
+
return {
|
|
386
|
+
capture: () => {
|
|
387
|
+
const active = deepActiveElement();
|
|
388
|
+
saved = active instanceof HTMLElement && active !== document.body ? active : null;
|
|
389
|
+
},
|
|
390
|
+
restore: () => {
|
|
391
|
+
const target = saved;
|
|
392
|
+
saved = null;
|
|
393
|
+
if (!target || !canFocus(target)) return false;
|
|
394
|
+
const active = deepActiveElement();
|
|
395
|
+
const owned = active === null || active === document.body || within().some((node) => node != null && active !== null && node.contains(active));
|
|
396
|
+
if (!owned) return false;
|
|
397
|
+
target.focus({ preventScroll: true });
|
|
398
|
+
return deepActiveElement() === target;
|
|
399
|
+
}
|
|
400
|
+
};
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
// src/components/tour/store.ts
|
|
404
|
+
var TICK = 600;
|
|
405
|
+
var WAIT_TIMEOUT = 5e3;
|
|
406
|
+
var nanoid = customAlphabet("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", 8);
|
|
407
|
+
var mintRunId = () => nanoid();
|
|
408
|
+
var choicesOf = (step) => "choices" in step ? step.choices : void 0;
|
|
409
|
+
var needsTarget = (step) => step.target !== void 0 && (step.type === void 0 || step.type === "tooltip" || step.type === "floating");
|
|
410
|
+
var tourElements = () => typeof document === "undefined" ? [] : [...document.querySelectorAll('[data-scope="tour"]')];
|
|
411
|
+
function createTourEngine(config) {
|
|
412
|
+
const location = config.location ?? windowLocation;
|
|
413
|
+
const gates = createGateStore();
|
|
414
|
+
const signals = /* @__PURE__ */ new Map();
|
|
415
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
416
|
+
const queue = [];
|
|
417
|
+
let run = null;
|
|
418
|
+
let snapshot = null;
|
|
419
|
+
let stopWaitingForModal = null;
|
|
420
|
+
const emitChange = () => {
|
|
421
|
+
snapshot = run?.step ? buildSnapshot(run, run.step) : null;
|
|
422
|
+
for (const listener of listeners) listener();
|
|
423
|
+
};
|
|
424
|
+
const persist = (key, record2) => {
|
|
425
|
+
if (!config.storage) return;
|
|
426
|
+
try {
|
|
427
|
+
Promise.resolve(config.storage.set(key, { ...record2, updatedAt: Date.now() })).catch(() => {
|
|
428
|
+
});
|
|
429
|
+
} catch {
|
|
430
|
+
}
|
|
431
|
+
};
|
|
432
|
+
const visibleIndexes = (current) => current.tour.steps.flatMap((step, index) => isEligible(current, step) ? [index] : []);
|
|
433
|
+
const event = (current, step) => {
|
|
434
|
+
const index = step ? Math.max(0, current.visible.indexOf(step.index)) : 0;
|
|
435
|
+
return {
|
|
436
|
+
key: current.key,
|
|
437
|
+
version: current.tour.version,
|
|
438
|
+
run: current.id,
|
|
439
|
+
stepId: step ? current.tour.steps[step.index]?.id ?? null : null,
|
|
440
|
+
index
|
|
441
|
+
};
|
|
442
|
+
};
|
|
443
|
+
const send = (payload) => config.onEvent?.(payload);
|
|
444
|
+
const media = (query) => typeof window !== "undefined" && typeof window.matchMedia === "function" && window.matchMedia(query).matches;
|
|
445
|
+
const contextFor = (current, target, signal2) => ({
|
|
446
|
+
target,
|
|
447
|
+
params: current.params,
|
|
448
|
+
answers: current.answers,
|
|
449
|
+
get location() {
|
|
450
|
+
return location.get();
|
|
451
|
+
},
|
|
452
|
+
media,
|
|
453
|
+
app: config.app,
|
|
454
|
+
signal: signal2,
|
|
455
|
+
tours: {
|
|
456
|
+
get active() {
|
|
457
|
+
return snapshot;
|
|
458
|
+
},
|
|
459
|
+
goto: (id) => controller.goto(id)
|
|
460
|
+
}
|
|
461
|
+
});
|
|
462
|
+
const isEligible = (current, step) => {
|
|
463
|
+
if (!step.when) return true;
|
|
464
|
+
const probe = new AbortController();
|
|
465
|
+
const eligible = step.when(contextFor(current, resolveTarget(step.target), probe.signal));
|
|
466
|
+
probe.abort();
|
|
467
|
+
return eligible;
|
|
468
|
+
};
|
|
469
|
+
const findStep = (current, index, direction) => {
|
|
470
|
+
for (let i = index; i >= 0 && i < current.tour.steps.length; i += direction) {
|
|
471
|
+
const step = current.tour.steps[i];
|
|
472
|
+
if (step && isEligible(current, step)) return i;
|
|
473
|
+
}
|
|
474
|
+
return -1;
|
|
475
|
+
};
|
|
476
|
+
const buildSnapshot = (current, step) => {
|
|
477
|
+
const definition = current.tour.steps[step.index];
|
|
478
|
+
const visible = current.visible;
|
|
479
|
+
return {
|
|
480
|
+
run: current.id,
|
|
481
|
+
key: current.key,
|
|
482
|
+
version: current.tour.version,
|
|
483
|
+
stepId: definition.id,
|
|
484
|
+
index: Math.max(0, visible.indexOf(step.index)),
|
|
485
|
+
total: visible.length,
|
|
486
|
+
state: step.state,
|
|
487
|
+
gate: step.gate,
|
|
488
|
+
checklist: step.checklist,
|
|
489
|
+
checking: step.checking,
|
|
490
|
+
help: step.help,
|
|
491
|
+
step: { ...definition, ...step.patch },
|
|
492
|
+
answers: { ...current.answers }
|
|
493
|
+
};
|
|
494
|
+
};
|
|
495
|
+
const leaveStep = (current) => {
|
|
496
|
+
const step = current.step;
|
|
497
|
+
if (!step) return;
|
|
498
|
+
step.abort.abort();
|
|
499
|
+
clearTimeout(step.advanceTimer);
|
|
500
|
+
clearTimeout(step.helpTimer);
|
|
501
|
+
clearTimeout(step.waitTimer);
|
|
502
|
+
step.conditionCleanup?.();
|
|
503
|
+
for (const undo of step.undo) undo();
|
|
504
|
+
current.step = null;
|
|
505
|
+
};
|
|
506
|
+
const armHelp = (current, step) => {
|
|
507
|
+
const help = current.tour.steps[step.index]?.help;
|
|
508
|
+
clearTimeout(step.helpTimer);
|
|
509
|
+
if (!help || step.gate === "valid") return;
|
|
510
|
+
step.helpTimer = setTimeout(() => {
|
|
511
|
+
if (current.step !== step) return;
|
|
512
|
+
step.help = { hint: help.hint, pulse: help.pulse ?? false };
|
|
513
|
+
send({ ...event(current, step), type: "step:hint", hint: help.hint });
|
|
514
|
+
emitChange();
|
|
515
|
+
}, help.after);
|
|
516
|
+
};
|
|
517
|
+
const onReport = (current, step, state) => {
|
|
518
|
+
if (current.step !== step || step.abort.signal.aborted || sameState(step.gate, state)) return;
|
|
519
|
+
step.gate = state;
|
|
520
|
+
step.help = null;
|
|
521
|
+
clearTimeout(step.advanceTimer);
|
|
522
|
+
if (typeof state === "object") {
|
|
523
|
+
step.attempts += 1;
|
|
524
|
+
send({
|
|
525
|
+
...event(current, step),
|
|
526
|
+
type: "step:invalid",
|
|
527
|
+
message: state.invalid,
|
|
528
|
+
attempts: step.attempts
|
|
529
|
+
});
|
|
530
|
+
}
|
|
531
|
+
const definition = current.tour.steps[step.index];
|
|
532
|
+
const advance = definition.advance ?? definition.until?.advance ?? "auto";
|
|
533
|
+
if (state === "valid" && advance === "auto") {
|
|
534
|
+
step.advanceTimer = setTimeout(() => {
|
|
535
|
+
if (current.step === step) moveOn(current, "complete");
|
|
536
|
+
}, TICK);
|
|
537
|
+
}
|
|
538
|
+
armHelp(current, step);
|
|
539
|
+
emitChange();
|
|
540
|
+
};
|
|
541
|
+
const services = (current, step) => ({
|
|
542
|
+
target: () => resolveTarget(current.tour.steps[step.index]?.target),
|
|
543
|
+
location,
|
|
544
|
+
onSignal: (name, listener) => {
|
|
545
|
+
const remembered = current.signals.get(name) ?? [];
|
|
546
|
+
const taken = remembered.findIndex((payload) => listener(payload));
|
|
547
|
+
if (taken >= 0) remembered.splice(taken, 1);
|
|
548
|
+
let set = signals.get(name);
|
|
549
|
+
if (!set) {
|
|
550
|
+
set = /* @__PURE__ */ new Set();
|
|
551
|
+
signals.set(name, set);
|
|
552
|
+
}
|
|
553
|
+
set.add(listener);
|
|
554
|
+
return () => {
|
|
555
|
+
set.delete(listener);
|
|
556
|
+
};
|
|
557
|
+
},
|
|
558
|
+
gates,
|
|
559
|
+
setChecking: (checking) => {
|
|
560
|
+
if (current.step !== step || step.checking === checking) return;
|
|
561
|
+
step.checking = checking;
|
|
562
|
+
emitChange();
|
|
563
|
+
},
|
|
564
|
+
setChecklist: (items) => {
|
|
565
|
+
if (current.step !== step) return;
|
|
566
|
+
step.checklist = items;
|
|
567
|
+
emitChange();
|
|
568
|
+
}
|
|
569
|
+
});
|
|
570
|
+
const show = (current, step) => {
|
|
571
|
+
clearTimeout(step.waitTimer);
|
|
572
|
+
step.state = "shown";
|
|
573
|
+
if (step.shown) return emitChange();
|
|
574
|
+
step.shown = true;
|
|
575
|
+
step.startedAt = Date.now();
|
|
576
|
+
const definition = current.tour.steps[step.index];
|
|
577
|
+
send({ ...event(current, step), type: "step:show" });
|
|
578
|
+
persist(current.key, {
|
|
579
|
+
version: current.tour.version,
|
|
580
|
+
status: "active",
|
|
581
|
+
stepId: definition.id,
|
|
582
|
+
answers: current.answers
|
|
583
|
+
});
|
|
584
|
+
if (definition.until) {
|
|
585
|
+
const target = resolveTarget(definition.target);
|
|
586
|
+
step.conditionCleanup = setupOf(definition.until)(
|
|
587
|
+
contextFor(current, target, step.abort.signal),
|
|
588
|
+
(state) => onReport(current, step, state),
|
|
589
|
+
services(current, step)
|
|
590
|
+
);
|
|
591
|
+
}
|
|
592
|
+
armHelp(current, step);
|
|
593
|
+
emitChange();
|
|
594
|
+
};
|
|
595
|
+
const wait = (current, step) => {
|
|
596
|
+
step.state = "loading";
|
|
597
|
+
const definition = current.tour.steps[step.index];
|
|
598
|
+
send({ ...event(current, step), type: "step:waiting" });
|
|
599
|
+
const timeout = definition.wait?.timeout ?? WAIT_TIMEOUT;
|
|
600
|
+
clearTimeout(step.waitTimer);
|
|
601
|
+
step.waitTimer = setTimeout(() => {
|
|
602
|
+
if (current.step !== step || step.state !== "loading") return;
|
|
603
|
+
step.state = "timeout";
|
|
604
|
+
devWarn(
|
|
605
|
+
`[tour] "${current.key}" step "${definition.id}": its target is still missing after ${timeout}ms.`
|
|
606
|
+
);
|
|
607
|
+
send({ ...event(current, step), type: "step:timeout", timeout });
|
|
608
|
+
emitChange();
|
|
609
|
+
}, timeout);
|
|
610
|
+
emitChange();
|
|
611
|
+
};
|
|
612
|
+
const enter = (current, index) => {
|
|
613
|
+
leaveStep(current);
|
|
614
|
+
current.visible = visibleIndexes(current);
|
|
615
|
+
const definition = current.tour.steps[index];
|
|
616
|
+
const step = {
|
|
617
|
+
index,
|
|
618
|
+
state: "loading",
|
|
619
|
+
gate: definition.until ? "pending" : null,
|
|
620
|
+
checklist: null,
|
|
621
|
+
checking: false,
|
|
622
|
+
help: null,
|
|
623
|
+
patch: {},
|
|
624
|
+
attempts: 0,
|
|
625
|
+
startedAt: Date.now(),
|
|
626
|
+
shown: false,
|
|
627
|
+
abort: new AbortController(),
|
|
628
|
+
undo: []
|
|
629
|
+
};
|
|
630
|
+
current.step = step;
|
|
631
|
+
if (!needsTarget(definition)) return show(current, step);
|
|
632
|
+
const sync = () => {
|
|
633
|
+
if (current.step !== step) return;
|
|
634
|
+
const present = resolveTarget(definition.target) !== null;
|
|
635
|
+
if (present && step.state !== "shown") show(current, step);
|
|
636
|
+
else if (!present && step.state === "shown") wait(current, step);
|
|
637
|
+
};
|
|
638
|
+
if (typeof MutationObserver !== "undefined" && typeof document !== "undefined") {
|
|
639
|
+
const observer = new MutationObserver(sync);
|
|
640
|
+
observer.observe(document.documentElement, {
|
|
641
|
+
childList: true,
|
|
642
|
+
subtree: true,
|
|
643
|
+
attributes: true
|
|
644
|
+
});
|
|
645
|
+
step.undo.push(() => observer.disconnect());
|
|
646
|
+
}
|
|
647
|
+
if (resolveTarget(definition.target)) show(current, step);
|
|
648
|
+
else wait(current, step);
|
|
649
|
+
};
|
|
650
|
+
const moveOn = (current, how, to) => {
|
|
651
|
+
const step = current.step;
|
|
652
|
+
if (!step) return;
|
|
653
|
+
const base = event(current, step);
|
|
654
|
+
if (how === "complete") {
|
|
655
|
+
send({
|
|
656
|
+
...base,
|
|
657
|
+
type: "step:complete",
|
|
658
|
+
duration: Date.now() - step.startedAt,
|
|
659
|
+
attempts: step.attempts
|
|
660
|
+
});
|
|
661
|
+
} else {
|
|
662
|
+
send({ ...base, type: "step:skip" });
|
|
663
|
+
}
|
|
664
|
+
const next = to ?? findStep(current, step.index + 1, 1);
|
|
665
|
+
if (next < 0) return end(current, how === "skip" ? "skipped" : "completed");
|
|
666
|
+
current.history.push(step.index);
|
|
667
|
+
enter(current, next);
|
|
668
|
+
};
|
|
669
|
+
const end = (current, status) => {
|
|
670
|
+
const step = current.step;
|
|
671
|
+
const stepId = step ? current.tour.steps[step.index]?.id ?? null : null;
|
|
672
|
+
send({ ...event(current, step), type: "tour:end", stepId, status });
|
|
673
|
+
leaveStep(current);
|
|
674
|
+
if (status !== "not-found") {
|
|
675
|
+
persist(current.key, {
|
|
676
|
+
version: current.tour.version,
|
|
677
|
+
status,
|
|
678
|
+
stepId,
|
|
679
|
+
answers: current.answers
|
|
680
|
+
});
|
|
681
|
+
}
|
|
682
|
+
run = null;
|
|
683
|
+
emitChange();
|
|
684
|
+
current.focus.restore();
|
|
685
|
+
current.resolve({ status, stepId, answers: { ...current.answers } });
|
|
686
|
+
pump();
|
|
687
|
+
};
|
|
688
|
+
const begin = (request2) => {
|
|
689
|
+
const tour = config.registry[request2.key];
|
|
690
|
+
if (!tour) {
|
|
691
|
+
devWarn(`[tour] start: no tour registered as "${request2.key}".`);
|
|
692
|
+
request2.resolve({ status: "not-found", stepId: null, answers: {} });
|
|
693
|
+
return pump();
|
|
694
|
+
}
|
|
695
|
+
const current = {
|
|
696
|
+
id: mintRunId(),
|
|
697
|
+
key: request2.key,
|
|
698
|
+
tour,
|
|
699
|
+
params: request2.params ?? {},
|
|
700
|
+
answers: { ...request2.answers },
|
|
701
|
+
history: [],
|
|
702
|
+
visible: [],
|
|
703
|
+
signals: /* @__PURE__ */ new Map(),
|
|
704
|
+
step: null,
|
|
705
|
+
focus: createFocusReturn(tourElements),
|
|
706
|
+
resolve: request2.resolve
|
|
707
|
+
};
|
|
708
|
+
run = current;
|
|
709
|
+
current.focus.capture();
|
|
710
|
+
const probe = new AbortController();
|
|
711
|
+
const allowed = tour.when ? tour.when(contextFor(current, null, probe.signal)) : true;
|
|
712
|
+
probe.abort();
|
|
713
|
+
let first = -1;
|
|
714
|
+
if (allowed) {
|
|
715
|
+
const from = request2.from === void 0 ? 0 : tour.steps.findIndex((s) => s.id === request2.from);
|
|
716
|
+
if (from < 0)
|
|
717
|
+
devWarn(`[tour] "${request2.key}" has no step "${request2.from}"; starting at the first.`);
|
|
718
|
+
first = findStep(current, Math.max(0, from), 1);
|
|
719
|
+
}
|
|
720
|
+
send({
|
|
721
|
+
...event(current, null),
|
|
722
|
+
type: "tour:start",
|
|
723
|
+
stepId: first < 0 ? null : tour.steps[first]?.id ?? null,
|
|
724
|
+
resumed: request2.resumed
|
|
725
|
+
});
|
|
726
|
+
if (first < 0) return end(current, "not-found");
|
|
727
|
+
enter(current, first);
|
|
728
|
+
};
|
|
729
|
+
const pump = () => {
|
|
730
|
+
if (run || queue.length === 0) return;
|
|
731
|
+
if (isModalOpen()) {
|
|
732
|
+
stopWaitingForModal ??= subscribeLayers(() => {
|
|
733
|
+
if (isModalOpen()) return;
|
|
734
|
+
stopWaitingForModal?.();
|
|
735
|
+
stopWaitingForModal = null;
|
|
736
|
+
pump();
|
|
737
|
+
});
|
|
738
|
+
return;
|
|
739
|
+
}
|
|
740
|
+
const next = queue.shift();
|
|
741
|
+
if (next) begin(next);
|
|
742
|
+
};
|
|
743
|
+
const request = (key, options = {}, resumed = false, answers = {}) => new Promise((resolve) => {
|
|
744
|
+
queue.push({ key, params: options.params, from: options.from, resumed, answers, resolve });
|
|
745
|
+
pump();
|
|
746
|
+
});
|
|
747
|
+
const record = async (key) => {
|
|
748
|
+
if (!config.storage) return null;
|
|
749
|
+
try {
|
|
750
|
+
return await config.storage.get(key) ?? null;
|
|
751
|
+
} catch {
|
|
752
|
+
return null;
|
|
753
|
+
}
|
|
754
|
+
};
|
|
755
|
+
const withRun = (name, action) => {
|
|
756
|
+
if (!run?.step) {
|
|
757
|
+
devWarn(`[tour] ${name}: no tour is running.`);
|
|
758
|
+
return;
|
|
759
|
+
}
|
|
760
|
+
action(run, run.step);
|
|
761
|
+
};
|
|
762
|
+
const controller = {
|
|
763
|
+
start: (key, options) => request(key, options),
|
|
764
|
+
startOnce: async (key, options) => {
|
|
765
|
+
const saved = await record(key);
|
|
766
|
+
const version = config.registry[key]?.version;
|
|
767
|
+
if (saved && saved.version === version && saved.status !== "active") return null;
|
|
768
|
+
return request(key, options);
|
|
769
|
+
},
|
|
770
|
+
resume: async (key, options) => {
|
|
771
|
+
const saved = await record(key);
|
|
772
|
+
const version = config.registry[key]?.version;
|
|
773
|
+
const resumable = saved && saved.version === version && saved.status === "active" && saved.stepId;
|
|
774
|
+
if (!resumable) return request(key, options);
|
|
775
|
+
return request(
|
|
776
|
+
key,
|
|
777
|
+
{ ...options, from: options?.from ?? saved.stepId ?? void 0 },
|
|
778
|
+
true,
|
|
779
|
+
saved.answers
|
|
780
|
+
);
|
|
781
|
+
},
|
|
782
|
+
reset: async (key) => {
|
|
783
|
+
try {
|
|
784
|
+
await config.storage?.remove(key);
|
|
785
|
+
} catch {
|
|
786
|
+
}
|
|
787
|
+
},
|
|
788
|
+
next: () => withRun("next", (current, step) => {
|
|
789
|
+
const definition = current.tour.steps[step.index];
|
|
790
|
+
const answered = !choicesOf(definition) || current.answers[definition.id] !== void 0;
|
|
791
|
+
const done = step.state === "shown" && (step.gate === null || step.gate === "valid") && answered;
|
|
792
|
+
moveOn(current, done ? "complete" : "skip");
|
|
793
|
+
}),
|
|
794
|
+
back: () => withRun("back", (current) => {
|
|
795
|
+
const previous = current.history.pop();
|
|
796
|
+
if (previous === void 0) return;
|
|
797
|
+
enter(current, previous);
|
|
798
|
+
}),
|
|
799
|
+
goto: (id) => withRun("goto", (current, step) => {
|
|
800
|
+
const index = current.tour.steps.findIndex((s) => s.id === id);
|
|
801
|
+
if (index < 0) return devWarn(`[tour] goto: "${current.key}" has no step "${id}".`);
|
|
802
|
+
const target = findStep(current, index, 1);
|
|
803
|
+
if (target < 0) return end(current, "completed");
|
|
804
|
+
current.history.push(step.index);
|
|
805
|
+
enter(current, target);
|
|
806
|
+
}),
|
|
807
|
+
choose: (value2) => withRun("choose", (current, step) => {
|
|
808
|
+
const definition = current.tour.steps[step.index];
|
|
809
|
+
const choice = choicesOf(definition)?.find((c) => c.value === value2);
|
|
810
|
+
if (!choice)
|
|
811
|
+
return devWarn(`[tour] choose: step "${definition.id}" offers no choice "${value2}".`);
|
|
812
|
+
current.answers[definition.id] = value2;
|
|
813
|
+
const to = choice.goto === void 0 ? void 0 : current.tour.steps.findIndex((s) => s.id === choice.goto);
|
|
814
|
+
moveOn(
|
|
815
|
+
current,
|
|
816
|
+
"complete",
|
|
817
|
+
to === void 0 || to < 0 ? void 0 : findStep(current, to, 1)
|
|
818
|
+
);
|
|
819
|
+
}),
|
|
820
|
+
skip: () => withRun("skip", (current) => end(current, "skipped")),
|
|
821
|
+
dismiss: () => withRun("dismiss", (current) => end(current, "dismissed")),
|
|
822
|
+
signal: (name, payload) => {
|
|
823
|
+
if (!run) return;
|
|
824
|
+
const listening = [...signals.get(name) ?? []];
|
|
825
|
+
const heard = listening.map((listener) => listener(payload)).some(Boolean);
|
|
826
|
+
if (heard) return;
|
|
827
|
+
const remembered = run.signals.get(name) ?? [];
|
|
828
|
+
remembered.push(payload);
|
|
829
|
+
run.signals.set(name, remembered);
|
|
830
|
+
},
|
|
831
|
+
update: (patch) => withRun("update", (_current, step) => {
|
|
832
|
+
step.patch = { ...step.patch, ...patch };
|
|
833
|
+
emitChange();
|
|
834
|
+
}),
|
|
835
|
+
get active() {
|
|
836
|
+
return snapshot;
|
|
837
|
+
}
|
|
838
|
+
};
|
|
839
|
+
return {
|
|
840
|
+
controller,
|
|
841
|
+
gates,
|
|
842
|
+
subscribe: (listener) => {
|
|
843
|
+
listeners.add(listener);
|
|
844
|
+
return () => {
|
|
845
|
+
listeners.delete(listener);
|
|
846
|
+
};
|
|
847
|
+
},
|
|
848
|
+
getSnapshot: () => snapshot
|
|
849
|
+
};
|
|
850
|
+
}
|
|
851
|
+
var DEFAULT_TRANSLATIONS = {
|
|
852
|
+
progressText: ({ current, total }) => `${current} of ${total}`,
|
|
853
|
+
next: "Next",
|
|
854
|
+
back: "Back",
|
|
855
|
+
done: "Done",
|
|
856
|
+
skip: "Skip tour",
|
|
857
|
+
skipStep: "Skip step",
|
|
858
|
+
close: "Close tour",
|
|
859
|
+
loading: "Loading\u2026",
|
|
860
|
+
valid: "Done",
|
|
861
|
+
blocked: "Finish this step to continue"
|
|
862
|
+
};
|
|
863
|
+
var DEFAULT_ICONS = {
|
|
864
|
+
close: /* @__PURE__ */ jsx(XIcon, { className: iconStroke }),
|
|
865
|
+
check: /* @__PURE__ */ jsx(CheckIcon, { className: iconStroke })
|
|
866
|
+
};
|
|
867
|
+
var motion = cn(
|
|
868
|
+
"in-data-glide:duration-300 in-data-glide:ease-in-out",
|
|
869
|
+
"motion-reduce:transition-none"
|
|
870
|
+
);
|
|
871
|
+
var backdropClass = cn(
|
|
872
|
+
"bg-black/50 dark:bg-black/75 in-data-glide:transition-[clip-path]",
|
|
873
|
+
motion,
|
|
874
|
+
"data-[state=open]:animate-fade-in data-[state=closed]:animate-fade-out"
|
|
875
|
+
);
|
|
876
|
+
var spotlightClass = cn(
|
|
877
|
+
"ring-1 ring-brand-900/20 dark:ring-white/35",
|
|
878
|
+
"in-data-glide:transition-[left,top,width,height]",
|
|
879
|
+
motion
|
|
880
|
+
);
|
|
881
|
+
var positionerClass = cn(
|
|
882
|
+
"in-data-glide:transition-transform",
|
|
883
|
+
motion,
|
|
884
|
+
"data-[type=dialog]:pointer-events-none data-[type=dialog]:fixed data-[type=dialog]:inset-0",
|
|
885
|
+
"data-[type=dialog]:flex data-[type=dialog]:items-center data-[type=dialog]:justify-center data-[type=dialog]:p-4",
|
|
886
|
+
"data-[type=floating]:fixed data-[type=floating]:end-4 data-[type=floating]:bottom-4"
|
|
887
|
+
);
|
|
888
|
+
var cardBase = "pointer-events-auto relative flex flex-col gap-3 text-sm";
|
|
889
|
+
var contentClass = {
|
|
890
|
+
/** Tooltip and floating steps: the popover surface, made opaque. A
|
|
891
|
+
* popover's translucent fill reads well over a live page; a tour card sits
|
|
892
|
+
* over its own dimmed backdrop and often right over the page it explains,
|
|
893
|
+
* so whatever it covers would show through it as stray outlines. Opaque,
|
|
894
|
+
* it also matches the arrow's solid tip. */
|
|
895
|
+
anchored: cn(
|
|
896
|
+
popoverChrome,
|
|
897
|
+
"bg-brand-50 backdrop-blur-none dark:bg-brand-950",
|
|
898
|
+
cardBase,
|
|
899
|
+
"w-80 max-w-[calc(100vw-2rem)] p-4"
|
|
900
|
+
),
|
|
901
|
+
/** Dialog steps: Modal's surface. */
|
|
902
|
+
dialog: cn(modalSurface, cardBase, "w-full max-w-(--width-sm) rounded-sm p-6")
|
|
903
|
+
};
|
|
904
|
+
var arrowSurface = cn(
|
|
905
|
+
"bg-brand-50! dark:bg-brand-950!",
|
|
906
|
+
"border-t border-l border-brand-900/20 dark:border-white/15"
|
|
907
|
+
);
|
|
908
|
+
var Backdrop = ({
|
|
909
|
+
className,
|
|
910
|
+
testId,
|
|
911
|
+
asChild: _asChild,
|
|
912
|
+
...rest
|
|
913
|
+
}) => /* @__PURE__ */ jsx(
|
|
914
|
+
Tour$1.Backdrop,
|
|
915
|
+
{
|
|
916
|
+
className: cn(backdropClass, className),
|
|
917
|
+
...props({ "data-testid": testId }),
|
|
918
|
+
...rest
|
|
919
|
+
}
|
|
920
|
+
);
|
|
921
|
+
var Spotlight = ({
|
|
922
|
+
className,
|
|
923
|
+
testId,
|
|
924
|
+
asChild: _asChild,
|
|
925
|
+
...rest
|
|
926
|
+
}) => /* @__PURE__ */ jsx(
|
|
927
|
+
Tour$1.Spotlight,
|
|
928
|
+
{
|
|
929
|
+
className: cn(spotlightClass, className),
|
|
930
|
+
...props({ "data-testid": testId }),
|
|
931
|
+
...rest
|
|
932
|
+
}
|
|
933
|
+
);
|
|
934
|
+
var Positioner = ({
|
|
935
|
+
className,
|
|
936
|
+
asChild: _asChild,
|
|
937
|
+
...rest
|
|
938
|
+
}) => /* @__PURE__ */ jsx(Tour$1.Positioner, { className: cn(positionerClass, className), ...rest });
|
|
939
|
+
var Content = ({
|
|
940
|
+
className,
|
|
941
|
+
surface = "anchored",
|
|
942
|
+
testId,
|
|
943
|
+
asChild: _asChild,
|
|
944
|
+
...rest
|
|
945
|
+
}) => /* @__PURE__ */ jsx(
|
|
946
|
+
Tour$1.Content,
|
|
947
|
+
{
|
|
948
|
+
className: cn(contentClass[surface], className),
|
|
949
|
+
...props({ "data-testid": testId }),
|
|
950
|
+
...rest
|
|
951
|
+
}
|
|
952
|
+
);
|
|
953
|
+
var Arrow = createFloatingArrow(Tour$1.Arrow, Tour$1.ArrowTip, arrowSurface);
|
|
954
|
+
var Title = ({
|
|
955
|
+
className,
|
|
956
|
+
testId,
|
|
957
|
+
asChild: _asChild,
|
|
958
|
+
...rest
|
|
959
|
+
}) => /* @__PURE__ */ jsx(
|
|
960
|
+
Tour$1.Title,
|
|
961
|
+
{
|
|
962
|
+
className: cn("pe-8 font-semibold text-base leading-snug", className),
|
|
963
|
+
...props({ "data-testid": testId }),
|
|
964
|
+
...rest
|
|
965
|
+
}
|
|
966
|
+
);
|
|
967
|
+
var Description = ({
|
|
968
|
+
className,
|
|
969
|
+
testId,
|
|
970
|
+
asChild: _asChild,
|
|
971
|
+
...rest
|
|
972
|
+
}) => /* @__PURE__ */ jsx(
|
|
973
|
+
Tour$1.Description,
|
|
974
|
+
{
|
|
975
|
+
className: cn("text-brand-900/80 dark:text-white/75", className),
|
|
976
|
+
...props({ "data-testid": testId }),
|
|
977
|
+
...rest
|
|
978
|
+
}
|
|
979
|
+
);
|
|
980
|
+
var Tour = {
|
|
981
|
+
Backdrop,
|
|
982
|
+
Spotlight,
|
|
983
|
+
Positioner,
|
|
984
|
+
Content,
|
|
985
|
+
Arrow,
|
|
986
|
+
Title,
|
|
987
|
+
Description
|
|
988
|
+
};
|
|
989
|
+
var needsTarget2 = (step) => step.target !== void 0 && (step.type === void 0 || step.type === "tooltip" || step.type === "floating");
|
|
990
|
+
var zagIdOf = (active) => {
|
|
991
|
+
const step = active.step;
|
|
992
|
+
if (needsTarget2(step) && active.state !== "shown") return `${step.id}~loading`;
|
|
993
|
+
if (step.type === "wait" && active.help) return `${step.id}~help`;
|
|
994
|
+
return step.id;
|
|
995
|
+
};
|
|
996
|
+
var toZagSteps = (steps, dir, defaults) => steps.flatMap((step) => {
|
|
997
|
+
const base = { title: null, description: null };
|
|
998
|
+
const backdrop = "withBackdrop" in step ? step.withBackdrop ?? defaults.withBackdrop : defaults.withBackdrop;
|
|
999
|
+
if (step.type === "wait") {
|
|
1000
|
+
return [
|
|
1001
|
+
{ ...base, id: step.id, type: "wait", backdrop: false },
|
|
1002
|
+
{
|
|
1003
|
+
...base,
|
|
1004
|
+
id: `${step.id}~help`,
|
|
1005
|
+
type: "floating",
|
|
1006
|
+
placement: "bottom-end",
|
|
1007
|
+
backdrop: false
|
|
1008
|
+
}
|
|
1009
|
+
];
|
|
1010
|
+
}
|
|
1011
|
+
if (step.type === "dialog") return [{ ...base, id: step.id, type: "dialog", backdrop }];
|
|
1012
|
+
const anchored = step;
|
|
1013
|
+
const shown = {
|
|
1014
|
+
...base,
|
|
1015
|
+
id: step.id,
|
|
1016
|
+
type: step.type === "floating" && !step.target ? "floating" : "tooltip",
|
|
1017
|
+
target: step.target ? () => spotlightTarget(resolveTarget(step.target)) : void 0,
|
|
1018
|
+
placement: resolveLogicalPlacement(anchored.position ?? "bottom", dir),
|
|
1019
|
+
backdrop,
|
|
1020
|
+
arrow: anchored.withArrow ?? defaults.withArrow
|
|
1021
|
+
};
|
|
1022
|
+
if (!needsTarget2(step)) return [shown];
|
|
1023
|
+
return [shown, { ...base, id: `${step.id}~loading`, type: "dialog", backdrop }];
|
|
1024
|
+
});
|
|
1025
|
+
var isMet = (gate2) => gate2 === null || gate2 === "valid";
|
|
1026
|
+
var Checklist = ({
|
|
1027
|
+
items,
|
|
1028
|
+
className
|
|
1029
|
+
}) => /* @__PURE__ */ jsx("ul", { className: cn("flex flex-col gap-1.5", className), children: items.map((item) => {
|
|
1030
|
+
const valid = item.state === "valid";
|
|
1031
|
+
return /* @__PURE__ */ jsxs(
|
|
1032
|
+
"li",
|
|
1033
|
+
{
|
|
1034
|
+
"data-state": valid ? "valid" : "pending",
|
|
1035
|
+
className: "flex items-center gap-2",
|
|
1036
|
+
children: [
|
|
1037
|
+
/* @__PURE__ */ jsx(
|
|
1038
|
+
"span",
|
|
1039
|
+
{
|
|
1040
|
+
"aria-hidden": true,
|
|
1041
|
+
className: cn(
|
|
1042
|
+
"flex size-4 shrink-0 items-center justify-center rounded-full [&_svg]:size-3",
|
|
1043
|
+
valid ? "bg-green-600 text-white" : "text-brand-900/40 dark:text-white/40"
|
|
1044
|
+
),
|
|
1045
|
+
children: valid ? /* @__PURE__ */ jsx(CheckIcon, { className: iconStroke }) : /* @__PURE__ */ jsx(CircleIcon, { className: iconStroke })
|
|
1046
|
+
}
|
|
1047
|
+
),
|
|
1048
|
+
/* @__PURE__ */ jsx("span", { className: cn(valid && "text-brand-900/60 line-through dark:text-white/60"), children: item.label })
|
|
1049
|
+
]
|
|
1050
|
+
},
|
|
1051
|
+
item.key
|
|
1052
|
+
);
|
|
1053
|
+
}) });
|
|
1054
|
+
var part = (testId, name) => testId ? `${testId}-${name}` : void 0;
|
|
1055
|
+
var CardBody = ({
|
|
1056
|
+
active,
|
|
1057
|
+
tours,
|
|
1058
|
+
translations: t,
|
|
1059
|
+
icons,
|
|
1060
|
+
classNames,
|
|
1061
|
+
withCloseButton,
|
|
1062
|
+
testId
|
|
1063
|
+
}) => {
|
|
1064
|
+
const step = active.step;
|
|
1065
|
+
const loading = needsTarget2(step) && active.state !== "shown";
|
|
1066
|
+
const card = "title" in step ? step : null;
|
|
1067
|
+
const choices = card?.choices;
|
|
1068
|
+
const last = active.index === active.total - 1;
|
|
1069
|
+
const met = isMet(active.gate);
|
|
1070
|
+
const invalid = typeof active.gate === "object" && active.gate !== null ? active.gate.invalid : void 0;
|
|
1071
|
+
const hint = invalid ?? active.help?.hint;
|
|
1072
|
+
const required = card?.required ?? false;
|
|
1073
|
+
const close = withCloseButton && /* @__PURE__ */ jsx(
|
|
1074
|
+
ActionIcon,
|
|
1075
|
+
{
|
|
1076
|
+
variant: "subtle",
|
|
1077
|
+
color: "neutral",
|
|
1078
|
+
size: "sm",
|
|
1079
|
+
"aria-label": t.close,
|
|
1080
|
+
className: cn("absolute end-2 top-2", classNames.close),
|
|
1081
|
+
onClick: () => tours.dismiss(),
|
|
1082
|
+
testId: part(testId, "close"),
|
|
1083
|
+
children: icons.close
|
|
1084
|
+
}
|
|
1085
|
+
);
|
|
1086
|
+
if (loading) {
|
|
1087
|
+
const stuck = active.state === "timeout";
|
|
1088
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1089
|
+
close,
|
|
1090
|
+
/* @__PURE__ */ jsxs("div", { role: "status", className: "flex items-center gap-3 pe-8", "data-state": active.state, children: [
|
|
1091
|
+
/* @__PURE__ */ jsx(Spinner, { size: "sm" }),
|
|
1092
|
+
/* @__PURE__ */ jsx("span", { children: t.loading })
|
|
1093
|
+
] }),
|
|
1094
|
+
stuck && /* @__PURE__ */ jsxs("div", { className: cn("flex justify-end gap-2", classNames.actions), children: [
|
|
1095
|
+
/* @__PURE__ */ jsx(Button, { variant: "subtle", color: "neutral", size: "sm", onClick: () => tours.dismiss(), children: t.close }),
|
|
1096
|
+
/* @__PURE__ */ jsx(
|
|
1097
|
+
Button,
|
|
1098
|
+
{
|
|
1099
|
+
variant: "light",
|
|
1100
|
+
size: "sm",
|
|
1101
|
+
onClick: () => tours.next(),
|
|
1102
|
+
testId: part(testId, "skip-step"),
|
|
1103
|
+
children: t.skipStep
|
|
1104
|
+
}
|
|
1105
|
+
)
|
|
1106
|
+
] })
|
|
1107
|
+
] });
|
|
1108
|
+
}
|
|
1109
|
+
const next = /* @__PURE__ */ jsx(
|
|
1110
|
+
Button,
|
|
1111
|
+
{
|
|
1112
|
+
size: "sm",
|
|
1113
|
+
"aria-disabled": met ? void 0 : true,
|
|
1114
|
+
"data-disabled": met ? void 0 : "",
|
|
1115
|
+
onClick: () => {
|
|
1116
|
+
if (met) tours.next();
|
|
1117
|
+
},
|
|
1118
|
+
testId: part(testId, "next"),
|
|
1119
|
+
children: last ? t.done : t.next
|
|
1120
|
+
}
|
|
1121
|
+
);
|
|
1122
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1123
|
+
close,
|
|
1124
|
+
card?.title !== void 0 && /* @__PURE__ */ jsx(Title, { className: classNames.title, testId: part(testId, "title"), children: card.title }),
|
|
1125
|
+
card?.description !== void 0 && /* @__PURE__ */ jsx(Description, { className: classNames.description, testId: part(testId, "description"), children: card.description }),
|
|
1126
|
+
active.checklist && /* @__PURE__ */ jsx(Checklist, { items: active.checklist, className: classNames.checklist }),
|
|
1127
|
+
choices && /* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-2", children: choices.map((choice) => /* @__PURE__ */ jsx(
|
|
1128
|
+
Button,
|
|
1129
|
+
{
|
|
1130
|
+
variant: "light",
|
|
1131
|
+
size: "sm",
|
|
1132
|
+
onClick: () => tours.choose(choice.value),
|
|
1133
|
+
children: choice.label
|
|
1134
|
+
},
|
|
1135
|
+
choice.value
|
|
1136
|
+
)) }),
|
|
1137
|
+
/* @__PURE__ */ jsx(
|
|
1138
|
+
"p",
|
|
1139
|
+
{
|
|
1140
|
+
role: "status",
|
|
1141
|
+
className: cn(
|
|
1142
|
+
// Takes no room when there's nothing to show; the tick's word is
|
|
1143
|
+
// for screen readers only.
|
|
1144
|
+
"empty:hidden",
|
|
1145
|
+
active.gate === "valid" && "sr-only",
|
|
1146
|
+
invalid ? "text-red-700 dark:text-red-400" : "text-brand-900/80 dark:text-white/75",
|
|
1147
|
+
classNames.hint
|
|
1148
|
+
),
|
|
1149
|
+
...props({ "data-testid": part(testId, "hint") }),
|
|
1150
|
+
children: active.gate === "valid" ? t.valid : hint
|
|
1151
|
+
}
|
|
1152
|
+
),
|
|
1153
|
+
/* @__PURE__ */ jsxs("div", { className: cn("flex items-center gap-2", classNames.actions), children: [
|
|
1154
|
+
/* @__PURE__ */ jsx(
|
|
1155
|
+
"span",
|
|
1156
|
+
{
|
|
1157
|
+
dir: "auto",
|
|
1158
|
+
className: cn(
|
|
1159
|
+
"me-auto text-brand-900/60 text-xs tabular-nums dark:text-white/60",
|
|
1160
|
+
classNames.progress
|
|
1161
|
+
),
|
|
1162
|
+
...props({ "data-testid": part(testId, "progress") }),
|
|
1163
|
+
children: active.total > 1 && t.progressText({ current: active.index + 1, total: active.total })
|
|
1164
|
+
}
|
|
1165
|
+
),
|
|
1166
|
+
active.gate === "valid" && /* @__PURE__ */ jsx(
|
|
1167
|
+
"span",
|
|
1168
|
+
{
|
|
1169
|
+
"aria-hidden": true,
|
|
1170
|
+
"data-part": "tick",
|
|
1171
|
+
className: "flex size-6 items-center justify-center rounded-full bg-green-600 text-white motion-safe:animate-fade-in [&_svg]:size-3.5",
|
|
1172
|
+
children: icons.check
|
|
1173
|
+
}
|
|
1174
|
+
),
|
|
1175
|
+
!required && !last && /* @__PURE__ */ jsx(
|
|
1176
|
+
Button,
|
|
1177
|
+
{
|
|
1178
|
+
variant: "subtle",
|
|
1179
|
+
color: "neutral",
|
|
1180
|
+
size: "sm",
|
|
1181
|
+
onClick: () => tours.skip(),
|
|
1182
|
+
testId: part(testId, "skip"),
|
|
1183
|
+
children: t.skip
|
|
1184
|
+
}
|
|
1185
|
+
),
|
|
1186
|
+
active.index > 0 && /* @__PURE__ */ jsx(
|
|
1187
|
+
Button,
|
|
1188
|
+
{
|
|
1189
|
+
variant: "light",
|
|
1190
|
+
size: "sm",
|
|
1191
|
+
onClick: () => tours.back(),
|
|
1192
|
+
testId: part(testId, "back"),
|
|
1193
|
+
children: t.back
|
|
1194
|
+
}
|
|
1195
|
+
),
|
|
1196
|
+
!choices && (met ? next : (
|
|
1197
|
+
// The trigger is a wrapper: Button's disabled look also turns off
|
|
1198
|
+
// its pointer events, so the button itself would never be hovered.
|
|
1199
|
+
// Focus on the (aria-disabled, still focusable) button bubbles up.
|
|
1200
|
+
/* @__PURE__ */ jsx(Tooltip, { label: invalid ?? t.blocked, asChild: true, children: /* @__PURE__ */ jsx("span", { className: "inline-flex", children: next }) })
|
|
1201
|
+
))
|
|
1202
|
+
] })
|
|
1203
|
+
] });
|
|
1204
|
+
};
|
|
1205
|
+
var raisedPanelOpen = () => document.querySelector('[data-part="content"][data-raised][data-state="open"]') !== null;
|
|
1206
|
+
var useDocumentHeight = (active) => {
|
|
1207
|
+
const [height, setHeight] = useState();
|
|
1208
|
+
useIsomorphicLayoutEffect(() => {
|
|
1209
|
+
if (!active || typeof ResizeObserver === "undefined") return;
|
|
1210
|
+
const root = document.documentElement;
|
|
1211
|
+
const measure = () => setHeight(root.scrollHeight);
|
|
1212
|
+
measure();
|
|
1213
|
+
const observer = new ResizeObserver(measure);
|
|
1214
|
+
observer.observe(document.body);
|
|
1215
|
+
return () => observer.disconnect();
|
|
1216
|
+
}, [active]);
|
|
1217
|
+
return height;
|
|
1218
|
+
};
|
|
1219
|
+
var TourRun = ({
|
|
1220
|
+
active,
|
|
1221
|
+
tours,
|
|
1222
|
+
translations,
|
|
1223
|
+
render,
|
|
1224
|
+
color,
|
|
1225
|
+
classNames = {},
|
|
1226
|
+
icons,
|
|
1227
|
+
withArrow = true,
|
|
1228
|
+
withBackdrop = true,
|
|
1229
|
+
withCloseButton = true,
|
|
1230
|
+
testId,
|
|
1231
|
+
tour
|
|
1232
|
+
}) => {
|
|
1233
|
+
const { dir } = useLocaleContext();
|
|
1234
|
+
const steps = useMemo(
|
|
1235
|
+
() => toZagSteps(tour.steps, dir, { withArrow, withBackdrop }),
|
|
1236
|
+
[tour, dir, withArrow, withBackdrop]
|
|
1237
|
+
);
|
|
1238
|
+
const zagId = zagIdOf(active);
|
|
1239
|
+
const api = useTour({
|
|
1240
|
+
steps,
|
|
1241
|
+
keyboardNavigation: false,
|
|
1242
|
+
// zag pads the cut-out 10px all round, which reads as a loose frame around
|
|
1243
|
+
// a field or a button; 4px clears the element's own focus ring and border.
|
|
1244
|
+
spotlightOffset: { x: 4, y: 4 },
|
|
1245
|
+
closeOnEscape: false,
|
|
1246
|
+
closeOnInteractOutside: false,
|
|
1247
|
+
translations: {
|
|
1248
|
+
close: translations.close,
|
|
1249
|
+
nextStep: translations.next,
|
|
1250
|
+
prevStep: translations.back
|
|
1251
|
+
}
|
|
1252
|
+
});
|
|
1253
|
+
const first = useRef(true);
|
|
1254
|
+
useIsomorphicLayoutEffect(() => {
|
|
1255
|
+
if (first.current) {
|
|
1256
|
+
first.current = false;
|
|
1257
|
+
return;
|
|
1258
|
+
}
|
|
1259
|
+
api.setSteps(steps);
|
|
1260
|
+
}, [steps]);
|
|
1261
|
+
const started = useRef(false);
|
|
1262
|
+
useIsomorphicLayoutEffect(() => {
|
|
1263
|
+
if (!started.current) {
|
|
1264
|
+
started.current = true;
|
|
1265
|
+
api.start(zagId);
|
|
1266
|
+
return;
|
|
1267
|
+
}
|
|
1268
|
+
api.setStep(zagId);
|
|
1269
|
+
}, [zagId]);
|
|
1270
|
+
useEffect(() => {
|
|
1271
|
+
const onKeyDown2 = (event) => {
|
|
1272
|
+
if (event.key !== "Escape" || event.defaultPrevented || raisedPanelOpen()) return;
|
|
1273
|
+
tours.dismiss();
|
|
1274
|
+
};
|
|
1275
|
+
document.addEventListener("keydown", onKeyDown2);
|
|
1276
|
+
return () => document.removeEventListener("keydown", onKeyDown2);
|
|
1277
|
+
}, [tours]);
|
|
1278
|
+
const onKeyDown = (event) => {
|
|
1279
|
+
if (event.key !== "ArrowRight" && event.key !== "ArrowLeft") return;
|
|
1280
|
+
if (event.target instanceof HTMLInputElement || event.target instanceof HTMLTextAreaElement)
|
|
1281
|
+
return;
|
|
1282
|
+
const forward = event.key === "ArrowRight" === (dir === "ltr");
|
|
1283
|
+
if (forward && isMet(active.gate) && !("choices" in active.step && active.step.choices))
|
|
1284
|
+
tours.next();
|
|
1285
|
+
if (!forward && active.index > 0) tours.back();
|
|
1286
|
+
};
|
|
1287
|
+
const step = active.step;
|
|
1288
|
+
const loading = needsTarget2(step) && active.state !== "shown";
|
|
1289
|
+
const surface = loading || step.type === "dialog" ? "dialog" : "anchored";
|
|
1290
|
+
const last = useRef({
|
|
1291
|
+
id: zagId,
|
|
1292
|
+
surface,
|
|
1293
|
+
from: null
|
|
1294
|
+
});
|
|
1295
|
+
if (last.current.id !== zagId) last.current = { id: zagId, surface, from: last.current.surface };
|
|
1296
|
+
const glide = surface === "anchored" && last.current.from === "anchored";
|
|
1297
|
+
const blocking = "interactive" in step && step.interactive === false && active.gate === null;
|
|
1298
|
+
const resolvedIcons = mergeIcons(DEFAULT_ICONS, icons);
|
|
1299
|
+
const height = useDocumentHeight(api.open);
|
|
1300
|
+
return /* @__PURE__ */ jsx(Tour$1.Root, { tour: api, children: /* @__PURE__ */ jsx(Portal, { children: render ? render({ active, step, tours, translations, loading }) : /* @__PURE__ */ jsxs("div", { "data-glide": glide ? "" : void 0, "data-color": color, className: "contents", children: [
|
|
1301
|
+
/* @__PURE__ */ jsx(
|
|
1302
|
+
Backdrop,
|
|
1303
|
+
{
|
|
1304
|
+
className: classNames.backdrop,
|
|
1305
|
+
style: surface === "anchored" && height ? { height } : void 0,
|
|
1306
|
+
testId: part(testId, "backdrop")
|
|
1307
|
+
}
|
|
1308
|
+
),
|
|
1309
|
+
/* @__PURE__ */ jsx(
|
|
1310
|
+
Spotlight,
|
|
1311
|
+
{
|
|
1312
|
+
"data-pulse": active.help?.pulse ? "" : void 0,
|
|
1313
|
+
className: cn(
|
|
1314
|
+
// D2's opt-out: the box over the target takes the clicks.
|
|
1315
|
+
blocking && "pointer-events-auto!",
|
|
1316
|
+
classNames.spotlight
|
|
1317
|
+
),
|
|
1318
|
+
testId: part(testId, "spotlight"),
|
|
1319
|
+
children: active.help?.pulse && /* @__PURE__ */ jsx(
|
|
1320
|
+
"span",
|
|
1321
|
+
{
|
|
1322
|
+
"aria-hidden": true,
|
|
1323
|
+
className: "absolute inset-0 animate-ping rounded-[inherit] ring-2 ring-white motion-reduce:animate-none"
|
|
1324
|
+
}
|
|
1325
|
+
)
|
|
1326
|
+
}
|
|
1327
|
+
),
|
|
1328
|
+
/* @__PURE__ */ jsx(Positioner, { className: classNames.positioner, children: /* @__PURE__ */ jsxs(
|
|
1329
|
+
Content,
|
|
1330
|
+
{
|
|
1331
|
+
surface,
|
|
1332
|
+
className: classNames.content,
|
|
1333
|
+
"data-step": step.id,
|
|
1334
|
+
"data-gate": typeof active.gate === "object" && active.gate ? "invalid" : active.gate ?? void 0,
|
|
1335
|
+
onKeyDown,
|
|
1336
|
+
testId,
|
|
1337
|
+
children: [
|
|
1338
|
+
surface === "anchored" && withArrow && /* @__PURE__ */ jsx(Arrow, { className: classNames.arrow }),
|
|
1339
|
+
/* @__PURE__ */ jsx(
|
|
1340
|
+
CardBody,
|
|
1341
|
+
{
|
|
1342
|
+
active,
|
|
1343
|
+
tours,
|
|
1344
|
+
translations,
|
|
1345
|
+
icons: resolvedIcons,
|
|
1346
|
+
classNames,
|
|
1347
|
+
withCloseButton,
|
|
1348
|
+
testId
|
|
1349
|
+
}
|
|
1350
|
+
)
|
|
1351
|
+
]
|
|
1352
|
+
}
|
|
1353
|
+
) })
|
|
1354
|
+
] }) }) });
|
|
1355
|
+
};
|
|
1356
|
+
var TourRenderer = ({ active, translations, registry, ...rest }) => {
|
|
1357
|
+
useNestedLayer(active !== null, { tour: true });
|
|
1358
|
+
const merged = useMemo(() => ({ ...DEFAULT_TRANSLATIONS, ...translations }), [translations]);
|
|
1359
|
+
const tour = active ? registry[active.key] : void 0;
|
|
1360
|
+
if (!active || !tour) return null;
|
|
1361
|
+
return /* @__PURE__ */ jsx(
|
|
1362
|
+
TourRun,
|
|
1363
|
+
{
|
|
1364
|
+
active,
|
|
1365
|
+
translations: merged,
|
|
1366
|
+
tour,
|
|
1367
|
+
registry,
|
|
1368
|
+
...rest
|
|
1369
|
+
},
|
|
1370
|
+
active.run
|
|
1371
|
+
);
|
|
1372
|
+
};
|
|
1373
|
+
function defineTour(tour) {
|
|
1374
|
+
const build = (input) => ({
|
|
1375
|
+
...input,
|
|
1376
|
+
version: input.version ?? 1
|
|
1377
|
+
});
|
|
1378
|
+
return tour === void 0 ? build : build(tour);
|
|
1379
|
+
}
|
|
1380
|
+
function createTours(config) {
|
|
1381
|
+
const engine = createTourEngine({
|
|
1382
|
+
registry: config.registry,
|
|
1383
|
+
app: config.app,
|
|
1384
|
+
location: config.location,
|
|
1385
|
+
storage: config.storage,
|
|
1386
|
+
onEvent: config.onEvent
|
|
1387
|
+
});
|
|
1388
|
+
const tours = engine.controller;
|
|
1389
|
+
const Tours = (props2) => {
|
|
1390
|
+
const active = useSyncExternalStore(engine.subscribe, engine.getSnapshot, () => null);
|
|
1391
|
+
return /* @__PURE__ */ jsx(
|
|
1392
|
+
TourRenderer,
|
|
1393
|
+
{
|
|
1394
|
+
active,
|
|
1395
|
+
tours: engine.controller,
|
|
1396
|
+
registry: config.registry,
|
|
1397
|
+
translations: config.translations,
|
|
1398
|
+
render: config.render,
|
|
1399
|
+
...props2
|
|
1400
|
+
}
|
|
1401
|
+
);
|
|
1402
|
+
};
|
|
1403
|
+
const useTours = () => {
|
|
1404
|
+
const active = useSyncExternalStore(engine.subscribe, engine.getSnapshot, () => null);
|
|
1405
|
+
return useMemo(() => [active, tours], [active]);
|
|
1406
|
+
};
|
|
1407
|
+
const useTourGate = (key, state) => {
|
|
1408
|
+
const invalid = typeof state === "object" ? state.invalid : void 0;
|
|
1409
|
+
const flat = typeof state === "object" ? "invalid" : state;
|
|
1410
|
+
useEffect(() => {
|
|
1411
|
+
engine.gates.set(key, flat === "invalid" ? { invalid: invalid ?? "" } : flat);
|
|
1412
|
+
}, [key, flat, invalid]);
|
|
1413
|
+
useEffect(() => () => engine.gates.remove(key), [key]);
|
|
1414
|
+
};
|
|
1415
|
+
return { tours, Tours, useTours, useTourGate };
|
|
1416
|
+
}
|
|
1417
|
+
|
|
1418
|
+
// src/components/tour/storage.ts
|
|
1419
|
+
function localStorageTours(namespace) {
|
|
1420
|
+
const keyOf = (key) => `${namespace}:${key}`;
|
|
1421
|
+
return {
|
|
1422
|
+
get: (key) => {
|
|
1423
|
+
try {
|
|
1424
|
+
const raw = localStorage.getItem(keyOf(key));
|
|
1425
|
+
if (raw === null) return null;
|
|
1426
|
+
const record = JSON.parse(raw);
|
|
1427
|
+
return typeof record === "object" && record !== null && typeof record.version === "number" ? record : null;
|
|
1428
|
+
} catch {
|
|
1429
|
+
return null;
|
|
1430
|
+
}
|
|
1431
|
+
},
|
|
1432
|
+
set: (key, record) => {
|
|
1433
|
+
try {
|
|
1434
|
+
localStorage.setItem(keyOf(key), JSON.stringify(record));
|
|
1435
|
+
} catch {
|
|
1436
|
+
}
|
|
1437
|
+
},
|
|
1438
|
+
remove: (key) => {
|
|
1439
|
+
try {
|
|
1440
|
+
localStorage.removeItem(keyOf(key));
|
|
1441
|
+
} catch {
|
|
1442
|
+
}
|
|
1443
|
+
}
|
|
1444
|
+
};
|
|
1445
|
+
}
|
|
1446
|
+
|
|
1447
|
+
export { DEFAULT_TRANSLATIONS, Tour, all, any, check, click, condition, createTours, defineTour, element, gate, localStorageTours, route, signal, submit, value };
|
|
1448
|
+
//# sourceMappingURL=index.js.map
|
|
1449
|
+
//# sourceMappingURL=index.js.map
|