@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
|
@@ -7,7 +7,13 @@ import { cn } from "../../lib/cn"
|
|
|
7
7
|
import type { Color } from "../../lib/colors"
|
|
8
8
|
import { props } from "../../lib/props"
|
|
9
9
|
import type { WithTestId } from "../../lib/test-id"
|
|
10
|
-
import {
|
|
10
|
+
import {
|
|
11
|
+
type FieldProps,
|
|
12
|
+
FieldShell,
|
|
13
|
+
fieldA11yProps,
|
|
14
|
+
useInheritedDisabled,
|
|
15
|
+
useInheritedInvalid,
|
|
16
|
+
} from "../field/field"
|
|
11
17
|
import {
|
|
12
18
|
type InputSize,
|
|
13
19
|
type InputVariant,
|
|
@@ -154,7 +160,7 @@ export const TagsInput = ({
|
|
|
154
160
|
size = "md",
|
|
155
161
|
variant = "default",
|
|
156
162
|
color,
|
|
157
|
-
disabled,
|
|
163
|
+
disabled: disabledProp,
|
|
158
164
|
readOnly,
|
|
159
165
|
required,
|
|
160
166
|
invalid,
|
|
@@ -171,9 +177,12 @@ export const TagsInput = ({
|
|
|
171
177
|
}: TagsInputProps) => {
|
|
172
178
|
// `overflowCount` is the counter's own; the rest are Ark's.
|
|
173
179
|
const { overflowCount, ...arkTranslations } = translations ?? {}
|
|
180
|
+
// With no `label` there is no `Field` to pass a `Fieldset`'s state on, so
|
|
181
|
+
// read it here: the shell, the pills and the clear button all key off it.
|
|
182
|
+
const disabled = useInheritedDisabled(disabledProp)
|
|
174
183
|
// Red state is driven independently of the `Field` error slot so a form
|
|
175
184
|
// library can flip it from `fieldState.invalid` (see FormControlProps).
|
|
176
|
-
const isInvalid = invalid || error != null
|
|
185
|
+
const isInvalid = useInheritedInvalid(invalid || error != null)
|
|
177
186
|
// Ark owns the tag state; the line-cap only needs its length to re-measure
|
|
178
187
|
// on add / remove. A controlled `value` gives it directly; uncontrolled, we
|
|
179
188
|
// mirror the length Ark reports.
|
|
@@ -6,7 +6,13 @@ import type { CSSProperties, Ref } from "react"
|
|
|
6
6
|
import { cn } from "../../lib/cn"
|
|
7
7
|
import { props } from "../../lib/props"
|
|
8
8
|
import type { WithTestId } from "../../lib/test-id"
|
|
9
|
-
import {
|
|
9
|
+
import {
|
|
10
|
+
type FieldProps,
|
|
11
|
+
FieldShell,
|
|
12
|
+
fieldA11yProps,
|
|
13
|
+
useInheritedDisabled,
|
|
14
|
+
useInheritedInvalid,
|
|
15
|
+
} from "../field/field"
|
|
10
16
|
import { InputBase, type InputSize, type InputVariant, inputControlClasses } from "../input/input"
|
|
11
17
|
|
|
12
18
|
/**
|
|
@@ -116,6 +122,10 @@ const TextareaControl = ({
|
|
|
116
122
|
...rest
|
|
117
123
|
}: Omit<TextareaProps, "label" | "description" | "error" | "required">) => {
|
|
118
124
|
const field = useFieldContext()
|
|
125
|
+
// A `Fieldset` reaches the control even with no `Field` (and so no label)
|
|
126
|
+
// between them: the `<fieldset>` disables the element, this dims the shell.
|
|
127
|
+
const isDisabled = useInheritedDisabled(disabled)
|
|
128
|
+
const isInvalid = useInheritedInvalid(invalid)
|
|
119
129
|
const fieldTextareaProps = field?.getTextareaProps()
|
|
120
130
|
const padding = TEXTAREA_PADDING[size ?? "md"]
|
|
121
131
|
const minRowsValue = minRows ?? 3
|
|
@@ -135,8 +145,8 @@ const TextareaControl = ({
|
|
|
135
145
|
className={cn("min-h-0! items-start! ps-0! pe-0! overflow-clip", className)}
|
|
136
146
|
classNames={{ root: classNames?.root }}
|
|
137
147
|
{...props({
|
|
138
|
-
disabled:
|
|
139
|
-
invalid:
|
|
148
|
+
disabled: isDisabled,
|
|
149
|
+
invalid: isInvalid,
|
|
140
150
|
readOnly: readOnly || field?.readOnly,
|
|
141
151
|
})}
|
|
142
152
|
>
|
|
@@ -145,8 +155,8 @@ const TextareaControl = ({
|
|
|
145
155
|
{...fieldTextareaProps}
|
|
146
156
|
{...fieldA11yProps(field)}
|
|
147
157
|
{...props({
|
|
148
|
-
disabled:
|
|
149
|
-
"aria-invalid":
|
|
158
|
+
disabled: isDisabled,
|
|
159
|
+
"aria-invalid": isInvalid,
|
|
150
160
|
readOnly: readOnly || field?.readOnly,
|
|
151
161
|
"data-testid": testId,
|
|
152
162
|
})}
|
|
@@ -6,8 +6,8 @@ import { Tooltip as ArkTooltip } from "@ark-ui/react/tooltip"
|
|
|
6
6
|
import { cva, type VariantProps } from "class-variance-authority"
|
|
7
7
|
import { createContext, type ReactNode, useContext } from "react"
|
|
8
8
|
import { match } from "ts-pattern"
|
|
9
|
-
import type { NoAsChild } from "../../lib/as-child"
|
|
10
9
|
import { cn } from "../../lib/cn"
|
|
10
|
+
import { createFloatingArrow, type FloatingArrowProps } from "../../lib/floating-arrow"
|
|
11
11
|
import { focusStyles } from "../../lib/focus-styles"
|
|
12
12
|
import { useOverlayContainer } from "../../lib/overlay-container"
|
|
13
13
|
import { type LogicalPosition, resolveLogicalPlacement } from "../../lib/placement"
|
|
@@ -71,10 +71,9 @@ const tooltipContent = cn(
|
|
|
71
71
|
* `rounded-xs` matches the content radius so the shadow's corners line up. */
|
|
72
72
|
const tooltipPositioner = "rounded-xs shadow-md"
|
|
73
73
|
|
|
74
|
-
/** Inverted arrow matching the bubble
|
|
75
|
-
*
|
|
76
|
-
|
|
77
|
-
const tooltipArrow = cn("-z-1! rounded-xxs", "bg-brand-950! dark:bg-white!")
|
|
74
|
+
/** Inverted arrow surface, matching the bubble. The rest of the arrow recipe
|
|
75
|
+
* (size, tuck, `-z-1`) is the kit's shared `createFloatingArrow`. */
|
|
76
|
+
const tooltipArrowSurface = "bg-brand-950! dark:bg-white!"
|
|
78
77
|
|
|
79
78
|
/** Resets the `<button type="button">` the default trigger renders down to plain
|
|
80
79
|
* inline text, so a Tooltip can sit on a word inside a `<p>` (a `<button>` is
|
|
@@ -181,21 +180,13 @@ const Content = ({ className, children, testId, ...rest }: TooltipContentProps)
|
|
|
181
180
|
return <Portal container={portalContainer}>{bubble}</Portal>
|
|
182
181
|
}
|
|
183
182
|
|
|
184
|
-
export type TooltipArrowProps =
|
|
183
|
+
export type TooltipArrowProps = FloatingArrowProps<ArkTooltip.ArrowProps>
|
|
185
184
|
|
|
186
185
|
/** The little arrow linking the bubble to its trigger. Compose it inside a
|
|
187
186
|
* `Tooltip.Content` (or let the convenience form's `withArrow` add it for you).
|
|
188
|
-
*
|
|
189
|
-
* bubble
|
|
190
|
-
const Arrow = (
|
|
191
|
-
<ArkTooltip.Arrow
|
|
192
|
-
style={{ ["--arrow-size" as string]: "12px", ["--arrow-offset" as string]: "-8px", ...style }}
|
|
193
|
-
{...props({ "data-testid": testId })}
|
|
194
|
-
{...rest}
|
|
195
|
-
>
|
|
196
|
-
<ArkTooltip.ArrowTip className={cn(tooltipArrow, className)} />
|
|
197
|
-
</ArkTooltip.Arrow>
|
|
198
|
-
)
|
|
187
|
+
* Built on the kit's shared floating arrow, so it sizes and tucks under the
|
|
188
|
+
* bubble like every other floating panel's arrow. */
|
|
189
|
+
const Arrow = createFloatingArrow(ArkTooltip.Arrow, ArkTooltip.ArrowTip, tooltipArrowSurface)
|
|
199
190
|
|
|
200
191
|
export type TooltipProps = TooltipRootProps &
|
|
201
192
|
WithTestId & {
|
|
@@ -0,0 +1,527 @@
|
|
|
1
|
+
import { fireEvent } from "@testing-library/react"
|
|
2
|
+
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest"
|
|
3
|
+
import {
|
|
4
|
+
all,
|
|
5
|
+
any,
|
|
6
|
+
check,
|
|
7
|
+
click,
|
|
8
|
+
condition,
|
|
9
|
+
element,
|
|
10
|
+
gate,
|
|
11
|
+
HINT_DELAY,
|
|
12
|
+
route,
|
|
13
|
+
signal,
|
|
14
|
+
submit,
|
|
15
|
+
value,
|
|
16
|
+
} from "./conditions"
|
|
17
|
+
import { type ConditionServices, createGateStore, matchRoute, setupOf } from "./runtime"
|
|
18
|
+
import type { AnyCondition, ConditionState, TourChecklistItem, TourContext } from "./types"
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Each helper run on its own, the way the engine runs it: a context, a
|
|
22
|
+
* `report` and the engine's services, all faked here except the DOM.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
const html = (markup: string) => {
|
|
26
|
+
document.body.innerHTML = markup
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/** A location adapter the test drives. */
|
|
30
|
+
const fakeLocation = (initial = "/") => {
|
|
31
|
+
let path = initial
|
|
32
|
+
const listeners = new Set<() => void>()
|
|
33
|
+
return {
|
|
34
|
+
get: () => path,
|
|
35
|
+
subscribe: (listener: () => void) => {
|
|
36
|
+
listeners.add(listener)
|
|
37
|
+
return () => listeners.delete(listener)
|
|
38
|
+
},
|
|
39
|
+
go: (next: string) => {
|
|
40
|
+
path = next
|
|
41
|
+
for (const listener of listeners) listener()
|
|
42
|
+
},
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const run = (
|
|
47
|
+
until: AnyCondition,
|
|
48
|
+
options: { target?: string; location?: ReturnType<typeof fakeLocation>; params?: unknown } = {},
|
|
49
|
+
) => {
|
|
50
|
+
const states: ConditionState[] = []
|
|
51
|
+
const checklist: (readonly TourChecklistItem[] | null)[] = []
|
|
52
|
+
const checking: boolean[] = []
|
|
53
|
+
const signals = new Map<string, Set<(payload: unknown) => boolean>>()
|
|
54
|
+
const gates = createGateStore()
|
|
55
|
+
const abort = new AbortController()
|
|
56
|
+
const services: ConditionServices = {
|
|
57
|
+
target: () => (options.target ? document.querySelector<HTMLElement>(options.target) : null),
|
|
58
|
+
location: options.location ?? fakeLocation(),
|
|
59
|
+
onSignal: (name, listener) => {
|
|
60
|
+
const set = signals.get(name) ?? new Set()
|
|
61
|
+
signals.set(name, set)
|
|
62
|
+
set.add(listener)
|
|
63
|
+
return () => set.delete(listener)
|
|
64
|
+
},
|
|
65
|
+
gates,
|
|
66
|
+
setChecking: (busy) => checking.push(busy),
|
|
67
|
+
setChecklist: (items) => checklist.push(items),
|
|
68
|
+
}
|
|
69
|
+
const ctx = {
|
|
70
|
+
target: services.target(),
|
|
71
|
+
params: options.params ?? {},
|
|
72
|
+
answers: {},
|
|
73
|
+
location: services.location.get(),
|
|
74
|
+
media: () => false,
|
|
75
|
+
app: undefined,
|
|
76
|
+
signal: abort.signal,
|
|
77
|
+
tours: { active: null, goto: () => {} },
|
|
78
|
+
} as TourContext
|
|
79
|
+
const cleanup = setupOf(until)(ctx, (state) => states.push(state), services)
|
|
80
|
+
return {
|
|
81
|
+
states,
|
|
82
|
+
last: () => states.at(-1),
|
|
83
|
+
checklist,
|
|
84
|
+
checking,
|
|
85
|
+
gates,
|
|
86
|
+
fire: (name: string, payload?: unknown) => {
|
|
87
|
+
for (const listener of signals.get(name) ?? []) listener(payload)
|
|
88
|
+
},
|
|
89
|
+
stop: () => {
|
|
90
|
+
abort.abort()
|
|
91
|
+
cleanup?.()
|
|
92
|
+
},
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
beforeEach(() => {
|
|
97
|
+
vi.useFakeTimers()
|
|
98
|
+
})
|
|
99
|
+
afterEach(() => {
|
|
100
|
+
vi.useRealTimers()
|
|
101
|
+
document.body.innerHTML = ""
|
|
102
|
+
})
|
|
103
|
+
|
|
104
|
+
describe("condition()", () => {
|
|
105
|
+
it("reports through the setup and cleans up on leave", () => {
|
|
106
|
+
const unsubscribe = vi.fn()
|
|
107
|
+
const c = run(
|
|
108
|
+
condition((_ctx, report) => {
|
|
109
|
+
report("valid")
|
|
110
|
+
return unsubscribe
|
|
111
|
+
}),
|
|
112
|
+
)
|
|
113
|
+
expect(c.last()).toBe("valid")
|
|
114
|
+
c.stop()
|
|
115
|
+
expect(unsubscribe).toHaveBeenCalledOnce()
|
|
116
|
+
})
|
|
117
|
+
|
|
118
|
+
it("advances by itself unless told otherwise", () => {
|
|
119
|
+
expect(condition(() => undefined).advance).toBe("auto")
|
|
120
|
+
expect(condition(() => undefined, { advance: "manual" }).advance).toBe("manual")
|
|
121
|
+
})
|
|
122
|
+
|
|
123
|
+
it("warns in development when setup neither reports nor returns a cleanup", () => {
|
|
124
|
+
const warn = vi.spyOn(console, "warn").mockImplementation(() => {})
|
|
125
|
+
run(condition(() => undefined)).stop()
|
|
126
|
+
expect(warn).toHaveBeenCalledWith(expect.stringContaining("never reported"))
|
|
127
|
+
warn.mockRestore()
|
|
128
|
+
})
|
|
129
|
+
|
|
130
|
+
it("doesn't warn when setup reported, even without a cleanup", () => {
|
|
131
|
+
const warn = vi.spyOn(console, "warn").mockImplementation(() => {})
|
|
132
|
+
run(
|
|
133
|
+
condition((_ctx, report) => {
|
|
134
|
+
report("valid")
|
|
135
|
+
return undefined
|
|
136
|
+
}),
|
|
137
|
+
).stop()
|
|
138
|
+
expect(warn).not.toHaveBeenCalled()
|
|
139
|
+
warn.mockRestore()
|
|
140
|
+
})
|
|
141
|
+
})
|
|
142
|
+
|
|
143
|
+
describe("click()", () => {
|
|
144
|
+
it("is valid once the step's target, or anything inside it, is clicked", () => {
|
|
145
|
+
html(`<button id="create"><span>Create</span></button><button id="other">Other</button>`)
|
|
146
|
+
const c = run(click(), { target: "#create" })
|
|
147
|
+
expect(c.last()).toBe("pending")
|
|
148
|
+
fireEvent.click(document.getElementById("other") as HTMLElement)
|
|
149
|
+
expect(c.last()).toBe("pending")
|
|
150
|
+
fireEvent.click(document.querySelector("#create span") as HTMLElement)
|
|
151
|
+
expect(c.last()).toBe("valid")
|
|
152
|
+
})
|
|
153
|
+
|
|
154
|
+
it("watches its own target when given one", () => {
|
|
155
|
+
html(`<button id="a">A</button><button id="b">B</button>`)
|
|
156
|
+
const c = run(click({ target: "#b" }), { target: "#a" })
|
|
157
|
+
fireEvent.click(document.getElementById("a") as HTMLElement)
|
|
158
|
+
expect(c.last()).toBe("pending")
|
|
159
|
+
fireEvent.click(document.getElementById("b") as HTMLElement)
|
|
160
|
+
expect(c.last()).toBe("valid")
|
|
161
|
+
})
|
|
162
|
+
|
|
163
|
+
it("still hears an element that was replaced after the step showed", () => {
|
|
164
|
+
html(`<button id="create">Create</button>`)
|
|
165
|
+
const c = run(click(), { target: "#create" })
|
|
166
|
+
html(`<button id="create">Create, re-rendered</button>`)
|
|
167
|
+
fireEvent.click(document.getElementById("create") as HTMLElement)
|
|
168
|
+
expect(c.last()).toBe("valid")
|
|
169
|
+
})
|
|
170
|
+
|
|
171
|
+
it("stops listening when the step is left", () => {
|
|
172
|
+
html(`<button id="create">Create</button>`)
|
|
173
|
+
const c = run(click(), { target: "#create" })
|
|
174
|
+
c.stop()
|
|
175
|
+
fireEvent.click(document.getElementById("create") as HTMLElement)
|
|
176
|
+
expect(c.last()).toBe("pending")
|
|
177
|
+
})
|
|
178
|
+
})
|
|
179
|
+
|
|
180
|
+
describe("value()", () => {
|
|
181
|
+
const atLeast3 = value((v) => v.trim().length >= 3, { hint: "At least 3 characters" })
|
|
182
|
+
|
|
183
|
+
it("is valid as soon as the check passes, with no wait", () => {
|
|
184
|
+
html(`<input id="name" />`)
|
|
185
|
+
const c = run(atLeast3, { target: "#name" })
|
|
186
|
+
expect(c.last()).toBe("pending")
|
|
187
|
+
fireEvent.input(document.getElementById("name") as HTMLElement, { target: { value: "Norm" } })
|
|
188
|
+
expect(c.last()).toBe("valid")
|
|
189
|
+
})
|
|
190
|
+
|
|
191
|
+
it("is valid on setup when the field already passes, so it never flashes pending", () => {
|
|
192
|
+
html(`<input id="name" value="Already" />`)
|
|
193
|
+
expect(run(atLeast3, { target: "#name" }).states).toEqual(["valid"])
|
|
194
|
+
})
|
|
195
|
+
|
|
196
|
+
it("holds the hint while the user types, and shows it after a pause", () => {
|
|
197
|
+
html(`<input id="name" />`)
|
|
198
|
+
const c = run(atLeast3, { target: "#name" })
|
|
199
|
+
fireEvent.input(document.getElementById("name") as HTMLElement, { target: { value: "N" } })
|
|
200
|
+
expect(c.last()).toBe("pending")
|
|
201
|
+
vi.advanceTimersByTime(HINT_DELAY - 1)
|
|
202
|
+
fireEvent.input(document.getElementById("name") as HTMLElement, { target: { value: "No" } })
|
|
203
|
+
vi.advanceTimersByTime(HINT_DELAY - 1)
|
|
204
|
+
expect(c.last()).toBe("pending")
|
|
205
|
+
vi.advanceTimersByTime(1)
|
|
206
|
+
expect(c.last()).toEqual({ invalid: "At least 3 characters" })
|
|
207
|
+
})
|
|
208
|
+
|
|
209
|
+
it("shows the hint at once when the field loses focus", () => {
|
|
210
|
+
html(`<input id="name" />`)
|
|
211
|
+
const c = run(atLeast3, { target: "#name" })
|
|
212
|
+
const field = document.getElementById("name") as HTMLElement
|
|
213
|
+
fireEvent.input(field, { target: { value: "N" } })
|
|
214
|
+
fireEvent.focusOut(field)
|
|
215
|
+
expect(c.last()).toEqual({ invalid: "At least 3 characters" })
|
|
216
|
+
})
|
|
217
|
+
|
|
218
|
+
it("stays pending without a hint: there is nothing to say", () => {
|
|
219
|
+
html(`<input id="name" />`)
|
|
220
|
+
const c = run(
|
|
221
|
+
value((v) => v.length > 3),
|
|
222
|
+
{ target: "#name" },
|
|
223
|
+
)
|
|
224
|
+
fireEvent.input(document.getElementById("name") as HTMLElement, { target: { value: "N" } })
|
|
225
|
+
fireEvent.focusOut(document.getElementById("name") as HTMLElement)
|
|
226
|
+
vi.advanceTimersByTime(HINT_DELAY)
|
|
227
|
+
expect(c.states.every((state) => state === "pending")).toBe(true)
|
|
228
|
+
})
|
|
229
|
+
|
|
230
|
+
it("finds the field inside a wrapper target", () => {
|
|
231
|
+
html(`<label id="field">Name <input /></label>`)
|
|
232
|
+
const c = run(atLeast3, { target: "#field" })
|
|
233
|
+
fireEvent.input(document.querySelector("#field input") as HTMLElement, {
|
|
234
|
+
target: { value: "Norm" },
|
|
235
|
+
})
|
|
236
|
+
expect(c.last()).toBe("valid")
|
|
237
|
+
})
|
|
238
|
+
|
|
239
|
+
it("waits for Next once valid (D5)", () => {
|
|
240
|
+
expect(atLeast3.advance).toBe("manual")
|
|
241
|
+
})
|
|
242
|
+
|
|
243
|
+
it("cancels a pending hint when the step is left", () => {
|
|
244
|
+
html(`<input id="name" />`)
|
|
245
|
+
const c = run(atLeast3, { target: "#name" })
|
|
246
|
+
fireEvent.input(document.getElementById("name") as HTMLElement, { target: { value: "N" } })
|
|
247
|
+
c.stop()
|
|
248
|
+
vi.advanceTimersByTime(HINT_DELAY)
|
|
249
|
+
expect(c.last()).toBe("pending")
|
|
250
|
+
})
|
|
251
|
+
})
|
|
252
|
+
|
|
253
|
+
describe("value.valid()", () => {
|
|
254
|
+
it("reads the browser's constraint validation and its message", () => {
|
|
255
|
+
html(`<input id="email" type="email" required />`)
|
|
256
|
+
const c = run(value.valid(), { target: "#email" })
|
|
257
|
+
const field = document.getElementById("email") as HTMLInputElement
|
|
258
|
+
fireEvent.input(field, { target: { value: "not-an-email" } })
|
|
259
|
+
fireEvent.focusOut(field)
|
|
260
|
+
expect(c.last()).toEqual({ invalid: field.validationMessage })
|
|
261
|
+
fireEvent.input(field, { target: { value: "norm@42.fr" } })
|
|
262
|
+
expect(c.last()).toBe("valid")
|
|
263
|
+
})
|
|
264
|
+
|
|
265
|
+
it("prefers its own hint over the browser's message", () => {
|
|
266
|
+
html(`<input id="name" required />`)
|
|
267
|
+
const c = run(value.valid({ hint: "Required" }), { target: "#name" })
|
|
268
|
+
fireEvent.focusOut(document.getElementById("name") as HTMLElement)
|
|
269
|
+
expect(c.last()).toEqual({ invalid: "Required" })
|
|
270
|
+
})
|
|
271
|
+
})
|
|
272
|
+
|
|
273
|
+
describe("submit()", () => {
|
|
274
|
+
it("is valid once the target's form is submitted", () => {
|
|
275
|
+
html(`<form id="f"><button id="save" type="submit">Save</button></form><form id="g"></form>`)
|
|
276
|
+
const c = run(submit(), { target: "#save" })
|
|
277
|
+
fireEvent.submit(document.getElementById("g") as HTMLElement)
|
|
278
|
+
expect(c.last()).toBe("pending")
|
|
279
|
+
fireEvent.submit(document.getElementById("f") as HTMLElement)
|
|
280
|
+
expect(c.last()).toBe("valid")
|
|
281
|
+
})
|
|
282
|
+
|
|
283
|
+
it("accepts the form itself as the target", () => {
|
|
284
|
+
html(`<form id="f"></form>`)
|
|
285
|
+
const c = run(submit(), { target: "#f" })
|
|
286
|
+
fireEvent.submit(document.getElementById("f") as HTMLElement)
|
|
287
|
+
expect(c.last()).toBe("valid")
|
|
288
|
+
})
|
|
289
|
+
})
|
|
290
|
+
|
|
291
|
+
describe("route()", () => {
|
|
292
|
+
it("matches the pattern through the location adapter, now and on each change", () => {
|
|
293
|
+
const location = fakeLocation("/projects/new")
|
|
294
|
+
const c = run(route("/projects/:id"), { location })
|
|
295
|
+
expect(c.last()).toBe("valid")
|
|
296
|
+
location.go("/home")
|
|
297
|
+
expect(c.last()).toBe("pending")
|
|
298
|
+
location.go("/projects/42/")
|
|
299
|
+
expect(c.last()).toBe("valid")
|
|
300
|
+
})
|
|
301
|
+
|
|
302
|
+
it("takes a predicate on the pathname", () => {
|
|
303
|
+
const location = fakeLocation("/a")
|
|
304
|
+
const c = run(
|
|
305
|
+
route((path) => path.startsWith("/b")),
|
|
306
|
+
{ location },
|
|
307
|
+
)
|
|
308
|
+
expect(c.last()).toBe("pending")
|
|
309
|
+
location.go("/b/c")
|
|
310
|
+
expect(c.last()).toBe("valid")
|
|
311
|
+
})
|
|
312
|
+
|
|
313
|
+
it("stops listening when the step is left", () => {
|
|
314
|
+
const location = fakeLocation("/")
|
|
315
|
+
const c = run(route("/done"), { location })
|
|
316
|
+
c.stop()
|
|
317
|
+
location.go("/done")
|
|
318
|
+
expect(c.last()).toBe("pending")
|
|
319
|
+
})
|
|
320
|
+
|
|
321
|
+
it.each([
|
|
322
|
+
["/projects/:id", "/projects/42", true],
|
|
323
|
+
["/projects/:id", "/projects/42/edit", false],
|
|
324
|
+
["/projects/:id/edit", "/projects/42/edit", true],
|
|
325
|
+
["/docs/*", "/docs/a/b", true],
|
|
326
|
+
["/", "/", true],
|
|
327
|
+
["/a.b", "/axb", false],
|
|
328
|
+
])("matchRoute(%s, %s) is %s", (pattern, path, expected) => {
|
|
329
|
+
expect(matchRoute(pattern, path)).toBe(expected)
|
|
330
|
+
})
|
|
331
|
+
})
|
|
332
|
+
|
|
333
|
+
describe("element()", () => {
|
|
334
|
+
it("is valid once the element is on the page and shown", async () => {
|
|
335
|
+
html(`<div id="root"></div>`)
|
|
336
|
+
const c = run(element("[data-dialog]"))
|
|
337
|
+
expect(c.last()).toBe("pending")
|
|
338
|
+
document
|
|
339
|
+
.getElementById("root")
|
|
340
|
+
?.insertAdjacentHTML("beforeend", `<div data-dialog hidden></div>`)
|
|
341
|
+
await Promise.resolve()
|
|
342
|
+
expect(c.last()).toBe("pending")
|
|
343
|
+
document.querySelector("[data-dialog]")?.removeAttribute("hidden")
|
|
344
|
+
await Promise.resolve()
|
|
345
|
+
expect(c.last()).toBe("valid")
|
|
346
|
+
})
|
|
347
|
+
|
|
348
|
+
it("waits for an element to go away with state: hidden", async () => {
|
|
349
|
+
html(`<div class="spinner"></div>`)
|
|
350
|
+
const c = run(element(".spinner", { state: "hidden" }))
|
|
351
|
+
expect(c.last()).toBe("pending")
|
|
352
|
+
document.querySelector(".spinner")?.remove()
|
|
353
|
+
await Promise.resolve()
|
|
354
|
+
expect(c.last()).toBe("valid")
|
|
355
|
+
})
|
|
356
|
+
})
|
|
357
|
+
|
|
358
|
+
describe("signal()", () => {
|
|
359
|
+
it("is valid when the app fires the signal", () => {
|
|
360
|
+
const c = run(signal("project:created"))
|
|
361
|
+
c.fire("project:other")
|
|
362
|
+
expect(c.last()).toBe("pending")
|
|
363
|
+
c.fire("project:created")
|
|
364
|
+
expect(c.last()).toBe("valid")
|
|
365
|
+
})
|
|
366
|
+
|
|
367
|
+
it("checks the payload with match", () => {
|
|
368
|
+
const c = run(signal("saved", (payload) => (payload as { ok: boolean }).ok))
|
|
369
|
+
c.fire("saved", { ok: false })
|
|
370
|
+
expect(c.last()).toBe("pending")
|
|
371
|
+
c.fire("saved", { ok: true })
|
|
372
|
+
expect(c.last()).toBe("valid")
|
|
373
|
+
})
|
|
374
|
+
})
|
|
375
|
+
|
|
376
|
+
describe("check()", () => {
|
|
377
|
+
it("shows a loading state while it runs, then reports its result", async () => {
|
|
378
|
+
const c = run(check(async () => true))
|
|
379
|
+
expect(c.checking).toEqual([true])
|
|
380
|
+
await vi.runAllTimersAsync()
|
|
381
|
+
expect(c.checking).toEqual([true, false])
|
|
382
|
+
expect(c.last()).toBe("valid")
|
|
383
|
+
})
|
|
384
|
+
|
|
385
|
+
it("runs again every interval until it passes", async () => {
|
|
386
|
+
const answers = [false, { invalid: "Still cloning" }, true] as const
|
|
387
|
+
let calls = 0
|
|
388
|
+
const c = run(check(async () => answers[calls++] ?? true, { interval: 1000 }))
|
|
389
|
+
await vi.advanceTimersByTimeAsync(0)
|
|
390
|
+
expect(c.last()).toBe("pending")
|
|
391
|
+
await vi.advanceTimersByTimeAsync(1000)
|
|
392
|
+
expect(c.last()).toEqual({ invalid: "Still cloning" })
|
|
393
|
+
await vi.advanceTimersByTimeAsync(1000)
|
|
394
|
+
expect(c.last()).toBe("valid")
|
|
395
|
+
await vi.advanceTimersByTimeAsync(5000)
|
|
396
|
+
expect(calls).toBe(3)
|
|
397
|
+
})
|
|
398
|
+
|
|
399
|
+
it("aborts when the step is left, and never reports after that", async () => {
|
|
400
|
+
let seen: AbortSignal | undefined
|
|
401
|
+
const c = run(
|
|
402
|
+
check(async (ctx) => {
|
|
403
|
+
seen = ctx.signal
|
|
404
|
+
await new Promise((resolve) => setTimeout(resolve, 100))
|
|
405
|
+
return true
|
|
406
|
+
}),
|
|
407
|
+
)
|
|
408
|
+
c.stop()
|
|
409
|
+
expect(seen?.aborted).toBe(true)
|
|
410
|
+
await vi.advanceTimersByTimeAsync(200)
|
|
411
|
+
expect(c.last()).toBe("pending")
|
|
412
|
+
})
|
|
413
|
+
|
|
414
|
+
it("counts a rejection as pending, and retries on the interval", async () => {
|
|
415
|
+
let calls = 0
|
|
416
|
+
const c = run(
|
|
417
|
+
check(
|
|
418
|
+
async () => {
|
|
419
|
+
calls += 1
|
|
420
|
+
if (calls === 1) throw new Error("offline")
|
|
421
|
+
return true
|
|
422
|
+
},
|
|
423
|
+
{ interval: 500 },
|
|
424
|
+
),
|
|
425
|
+
)
|
|
426
|
+
await vi.advanceTimersByTimeAsync(0)
|
|
427
|
+
expect(c.last()).toBe("pending")
|
|
428
|
+
await vi.advanceTimersByTimeAsync(500)
|
|
429
|
+
expect(c.last()).toBe("valid")
|
|
430
|
+
})
|
|
431
|
+
|
|
432
|
+
it("receives the tour's params", async () => {
|
|
433
|
+
const seen = vi.fn(
|
|
434
|
+
async (ctx: TourContext<unknown, { repo: string }>) => ctx.params.repo === "libft",
|
|
435
|
+
)
|
|
436
|
+
const c = run(check(seen), { params: { repo: "libft" } })
|
|
437
|
+
await vi.runAllTimersAsync()
|
|
438
|
+
expect(c.last()).toBe("valid")
|
|
439
|
+
})
|
|
440
|
+
})
|
|
441
|
+
|
|
442
|
+
describe("all()", () => {
|
|
443
|
+
it("is valid once every member is, with a checklist line per key", () => {
|
|
444
|
+
const c = run(all({ title: gate("title"), date: gate("date", { label: "Pick a date" }) }))
|
|
445
|
+
expect(c.last()).toBe("pending")
|
|
446
|
+
expect(c.checklist.at(-1)).toEqual([
|
|
447
|
+
{ key: "title", label: "title", state: "pending" },
|
|
448
|
+
{ key: "date", label: "Pick a date", state: "pending" },
|
|
449
|
+
])
|
|
450
|
+
c.gates.set("title", "valid")
|
|
451
|
+
expect(c.last()).toBe("pending")
|
|
452
|
+
expect(c.checklist.at(-1)?.[0]?.state).toBe("valid")
|
|
453
|
+
c.gates.set("date", "valid")
|
|
454
|
+
expect(c.last()).toBe("valid")
|
|
455
|
+
})
|
|
456
|
+
|
|
457
|
+
it("surfaces a member's hint", () => {
|
|
458
|
+
const c = run(all({ title: gate("title") }))
|
|
459
|
+
c.gates.set("title", { invalid: "Too short" })
|
|
460
|
+
expect(c.last()).toEqual({ invalid: "Too short" })
|
|
461
|
+
})
|
|
462
|
+
|
|
463
|
+
it("hides the checklist when the step is left, and waits for Next once valid (D5)", () => {
|
|
464
|
+
const c = run(all({ title: gate("title") }))
|
|
465
|
+
c.stop()
|
|
466
|
+
expect(c.checklist.at(-1)).toBeNull()
|
|
467
|
+
expect(all({}).advance).toBe("manual")
|
|
468
|
+
})
|
|
469
|
+
})
|
|
470
|
+
|
|
471
|
+
describe("any()", () => {
|
|
472
|
+
it("is valid once one member is", () => {
|
|
473
|
+
html(`<form id="f"><button id="create">Create</button></form>`)
|
|
474
|
+
const c = run(any(click(), submit()), { target: "#create" })
|
|
475
|
+
expect(c.last()).toBe("pending")
|
|
476
|
+
fireEvent.submit(document.getElementById("f") as HTMLElement)
|
|
477
|
+
expect(c.last()).toBe("valid")
|
|
478
|
+
})
|
|
479
|
+
|
|
480
|
+
it("cleans up every member", () => {
|
|
481
|
+
const stops = [vi.fn(), vi.fn()]
|
|
482
|
+
const c = run(any(...stops.map((stop) => condition(() => stop))))
|
|
483
|
+
c.stop()
|
|
484
|
+
for (const stop of stops) expect(stop).toHaveBeenCalledOnce()
|
|
485
|
+
})
|
|
486
|
+
})
|
|
487
|
+
|
|
488
|
+
describe("gate()", () => {
|
|
489
|
+
it("reads the gate's current value, then follows it", () => {
|
|
490
|
+
const c = run(gate("avatar"))
|
|
491
|
+
expect(c.last()).toBe("pending")
|
|
492
|
+
c.gates.set("avatar", { invalid: "Upload a photo first" })
|
|
493
|
+
expect(c.last()).toEqual({ invalid: "Upload a photo first" })
|
|
494
|
+
c.gates.set("avatar", "valid")
|
|
495
|
+
expect(c.last()).toBe("valid")
|
|
496
|
+
c.gates.remove("avatar")
|
|
497
|
+
expect(c.last()).toBe("pending")
|
|
498
|
+
})
|
|
499
|
+
})
|
|
500
|
+
|
|
501
|
+
describe("D5 advance defaults", () => {
|
|
502
|
+
it.each([
|
|
503
|
+
["click", click()],
|
|
504
|
+
["submit", submit()],
|
|
505
|
+
["route", route("/")],
|
|
506
|
+
["element", element("#x")],
|
|
507
|
+
["signal", signal("s")],
|
|
508
|
+
["check", check(async () => true)],
|
|
509
|
+
["gate", gate("g")],
|
|
510
|
+
["any", any()],
|
|
511
|
+
] as const)("%s advances by itself", (_, c) => {
|
|
512
|
+
expect(c.advance).toBe("auto")
|
|
513
|
+
})
|
|
514
|
+
|
|
515
|
+
it.each([
|
|
516
|
+
["value", value(() => true)],
|
|
517
|
+
["value.valid", value.valid()],
|
|
518
|
+
["all", all({})],
|
|
519
|
+
] as const)("%s waits for Next", (_, c) => {
|
|
520
|
+
expect(c.advance).toBe("manual")
|
|
521
|
+
})
|
|
522
|
+
|
|
523
|
+
it("lets a helper's own option override its default", () => {
|
|
524
|
+
expect(click({ advance: "manual" }).advance).toBe("manual")
|
|
525
|
+
expect(value(() => true, { advance: "auto" }).advance).toBe("auto")
|
|
526
|
+
})
|
|
527
|
+
})
|