@constructive-io/ui 0.4.1 → 0.6.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/LICENSE +21 -0
- package/README.md +17 -22
- package/dist/button-D4vqTxhp.d.cts +20 -0
- package/dist/button-D4vqTxhp.d.ts +20 -0
- package/dist/components/alert-dialog.cjs +129 -0
- package/dist/components/alert-dialog.cjs.map +1 -0
- package/dist/components/alert-dialog.d.cts +33 -0
- package/dist/components/alert-dialog.d.ts +23 -21
- package/dist/components/alert-dialog.js +98 -296
- package/dist/components/alert-dialog.js.map +1 -1
- package/dist/components/alert.cjs +62 -0
- package/dist/components/alert.cjs.map +1 -0
- package/dist/components/alert.d.cts +19 -0
- package/dist/components/alert.d.ts +18 -13
- package/dist/components/alert.js +49 -31
- package/dist/components/alert.js.map +1 -1
- package/dist/components/app-bar.cjs +81 -0
- package/dist/components/app-bar.cjs.map +1 -0
- package/dist/components/app-bar.d.cts +27 -0
- package/dist/components/app-bar.d.ts +27 -0
- package/dist/components/app-bar.js +77 -0
- package/dist/components/app-bar.js.map +1 -0
- package/dist/components/app-shell.cjs +267 -0
- package/dist/components/app-shell.cjs.map +1 -0
- package/dist/components/app-shell.d.cts +98 -0
- package/dist/components/app-shell.d.ts +98 -0
- package/dist/components/app-shell.js +264 -0
- package/dist/components/app-shell.js.map +1 -0
- package/dist/components/autocomplete.cjs +167 -0
- package/dist/components/autocomplete.cjs.map +1 -0
- package/dist/components/autocomplete.d.cts +28 -0
- package/dist/components/autocomplete.d.ts +24 -24
- package/dist/components/autocomplete.js +146 -397
- package/dist/components/autocomplete.js.map +1 -1
- package/dist/components/avatar.cjs +39 -0
- package/dist/components/avatar.cjs.map +1 -0
- package/dist/components/avatar.d.cts +13 -0
- package/dist/components/avatar.d.ts +11 -11
- package/dist/components/avatar.js +24 -27
- package/dist/components/avatar.js.map +1 -1
- package/dist/components/badge.cjs +48 -0
- package/dist/components/badge.cjs.map +1 -0
- package/dist/components/badge.d.cts +15 -0
- package/dist/components/badge.d.ts +13 -13
- package/dist/components/badge.js +39 -38
- package/dist/components/badge.js.map +1 -1
- package/dist/components/breadcrumb.cjs +89 -0
- package/dist/components/breadcrumb.cjs.map +1 -0
- package/dist/components/breadcrumb.d.cts +15 -0
- package/dist/components/breadcrumb.d.ts +14 -13
- package/dist/components/breadcrumb.js +63 -137
- package/dist/components/breadcrumb.js.map +1 -1
- package/dist/components/button.cjs +75 -0
- package/dist/components/button.cjs.map +1 -0
- package/dist/components/button.d.cts +2 -0
- package/dist/components/button.d.ts +2 -17
- package/dist/components/button.js +66 -57
- package/dist/components/button.js.map +1 -1
- package/dist/components/calendar-rac.cjs +72 -0
- package/dist/components/calendar-rac.cjs.map +1 -0
- package/dist/components/calendar-rac.d.cts +13 -0
- package/dist/components/calendar-rac.d.ts +8 -8
- package/dist/components/calendar-rac.js +49 -61
- package/dist/components/calendar-rac.js.map +1 -1
- package/dist/components/card.cjs +86 -0
- package/dist/components/card.cjs.map +1 -0
- package/dist/components/card.d.cts +17 -0
- package/dist/components/card.d.ts +15 -17
- package/dist/components/card.js +58 -57
- package/dist/components/card.js.map +1 -1
- package/dist/components/checkbox-group.cjs +19 -0
- package/dist/components/checkbox-group.cjs.map +1 -0
- package/dist/components/checkbox-group.d.cts +7 -0
- package/dist/components/checkbox-group.d.ts +5 -5
- package/dist/components/checkbox-group.js +12 -10
- package/dist/components/checkbox-group.js.map +1 -1
- package/dist/components/checkbox.cjs +67 -0
- package/dist/components/checkbox.cjs.map +1 -0
- package/dist/components/checkbox.d.cts +8 -0
- package/dist/components/checkbox.d.ts +6 -6
- package/dist/components/checkbox.js +58 -61
- package/dist/components/checkbox.js.map +1 -1
- package/dist/components/collapsible.cjs +90 -0
- package/dist/components/collapsible.cjs.map +1 -0
- package/dist/components/collapsible.d.cts +45 -0
- package/dist/components/collapsible.d.ts +19 -28
- package/dist/components/collapsible.js +74 -112
- package/dist/components/collapsible.js.map +1 -1
- package/dist/components/combobox.cjs +257 -0
- package/dist/components/combobox.cjs.map +1 -0
- package/dist/components/combobox.d.cts +44 -0
- package/dist/components/combobox.d.ts +36 -36
- package/dist/components/combobox.js +229 -515
- package/dist/components/combobox.js.map +1 -1
- package/dist/components/command.cjs +139 -0
- package/dist/components/command.cjs.map +1 -0
- package/dist/components/command.d.cts +24 -0
- package/dist/components/command.d.ts +22 -22
- package/dist/components/command.js +109 -240
- package/dist/components/command.js.map +1 -1
- package/dist/components/dialog.cjs +139 -0
- package/dist/components/dialog.cjs.map +1 -0
- package/dist/components/dialog.d.cts +31 -0
- package/dist/components/dialog.d.ts +27 -31
- package/dist/components/dialog.js +112 -429
- package/dist/components/dialog.js.map +1 -1
- package/dist/components/dock.cjs +90 -0
- package/dist/components/dock.cjs.map +1 -0
- package/dist/components/dock.d.cts +30 -0
- package/dist/components/dock.d.ts +25 -26
- package/dist/components/dock.js +78 -104
- package/dist/components/dock.js.map +1 -1
- package/dist/components/drawer.cjs +115 -0
- package/dist/components/drawer.cjs.map +1 -0
- package/dist/components/drawer.d.cts +16 -0
- package/dist/components/drawer.d.ts +15 -15
- package/dist/components/drawer.js +77 -121
- package/dist/components/drawer.js.map +1 -1
- package/dist/components/dropdown-menu.cjs +217 -0
- package/dist/components/dropdown-menu.cjs.map +1 -0
- package/dist/components/dropdown-menu.d.cts +53 -0
- package/dist/components/dropdown-menu.d.ts +49 -46
- package/dist/components/dropdown-menu.js +177 -357
- package/dist/components/dropdown-menu.js.map +1 -1
- package/dist/components/empty.cjs +72 -0
- package/dist/components/empty.cjs.map +1 -0
- package/dist/components/empty.d.cts +15 -0
- package/dist/components/empty.d.ts +15 -0
- package/dist/components/empty.js +64 -0
- package/dist/components/empty.js.map +1 -0
- package/dist/components/field.cjs +186 -0
- package/dist/components/field.cjs.map +1 -0
- package/dist/components/field.d.cts +46 -0
- package/dist/components/field.d.ts +44 -49
- package/dist/components/field.js +166 -108
- package/dist/components/field.js.map +1 -1
- package/dist/components/flickering-grid.cjs +153 -0
- package/dist/components/flickering-grid.cjs.map +1 -0
- package/dist/components/flickering-grid.d.cts +16 -0
- package/dist/components/flickering-grid.d.ts +14 -13
- package/dist/components/flickering-grid.js +144 -141
- package/dist/components/flickering-grid.js.map +1 -1
- package/dist/components/flow-zoom-panel.cjs +62 -0
- package/dist/components/flow-zoom-panel.cjs.map +1 -0
- package/dist/components/flow-zoom-panel.d.cts +12 -0
- package/dist/components/flow-zoom-panel.d.ts +12 -0
- package/dist/components/flow-zoom-panel.js +61 -0
- package/dist/components/flow-zoom-panel.js.map +1 -0
- package/dist/components/form-control.cjs +65 -0
- package/dist/components/form-control.cjs.map +1 -0
- package/dist/components/form-control.d.cts +15 -0
- package/dist/components/form-control.d.ts +11 -11
- package/dist/components/form-control.js +56 -167
- package/dist/components/form-control.js.map +1 -1
- package/dist/components/form.cjs +102 -0
- package/dist/components/form.cjs.map +1 -0
- package/dist/components/form.d.cts +2 -0
- package/dist/components/form.d.ts +2 -37
- package/dist/components/form.js +76 -163
- package/dist/components/form.js.map +1 -1
- package/dist/components/input-group.cjs +70 -0
- package/dist/components/input-group.cjs.map +1 -0
- package/dist/components/input-group.d.cts +16 -0
- package/dist/components/input-group.d.ts +14 -16
- package/dist/components/input-group.js +51 -163
- package/dist/components/input-group.js.map +1 -1
- package/dist/components/input.cjs +37 -0
- package/dist/components/input.cjs.map +1 -0
- package/dist/components/input.d.cts +2 -0
- package/dist/components/input.d.ts +2 -11
- package/dist/components/input.js +30 -54
- package/dist/components/input.js.map +1 -1
- package/dist/components/json-input.cjs +147 -0
- package/dist/components/json-input.cjs.map +1 -0
- package/dist/components/json-input.d.cts +26 -0
- package/dist/components/json-input.d.ts +20 -19
- package/dist/components/json-input.js +132 -340
- package/dist/components/json-input.js.map +1 -1
- package/dist/components/label.cjs +27 -0
- package/dist/components/label.cjs.map +1 -0
- package/dist/components/label.d.cts +11 -0
- package/dist/components/label.d.ts +6 -6
- package/dist/components/label.js +17 -20
- package/dist/components/label.js.map +1 -1
- package/dist/components/motion-grid.cjs +68 -0
- package/dist/components/motion-grid.cjs.map +1 -0
- package/dist/components/motion-grid.d.cts +20 -0
- package/dist/components/motion-grid.d.ts +15 -15
- package/dist/components/motion-grid.js +59 -75
- package/dist/components/motion-grid.js.map +1 -1
- package/dist/components/multi-select.cjs +573 -0
- package/dist/components/multi-select.cjs.map +1 -0
- package/dist/components/multi-select.d.cts +198 -0
- package/dist/components/multi-select.d.ts +173 -173
- package/dist/components/multi-select.js +562 -874
- package/dist/components/multi-select.js.map +1 -1
- package/dist/components/page-header.cjs +30 -0
- package/dist/components/page-header.cjs.map +1 -0
- package/dist/components/page-header.d.cts +17 -0
- package/dist/components/page-header.d.ts +11 -11
- package/dist/components/page-header.js +23 -11
- package/dist/components/page-header.js.map +1 -1
- package/dist/components/pagination.cjs +95 -0
- package/dist/components/pagination.cjs.map +1 -0
- package/dist/components/pagination.d.cts +17 -0
- package/dist/components/pagination.d.ts +15 -17
- package/dist/components/pagination.js +70 -128
- package/dist/components/pagination.js.map +1 -1
- package/dist/components/popover.cjs +97 -0
- package/dist/components/popover.cjs.map +1 -0
- package/dist/components/popover.d.cts +40 -0
- package/dist/components/popover.d.ts +33 -28
- package/dist/components/popover.js +78 -178
- package/dist/components/popover.js.map +1 -1
- package/dist/components/portal.cjs +156 -0
- package/dist/components/portal.cjs.map +1 -0
- package/dist/components/portal.d.cts +118 -0
- package/dist/components/portal.d.ts +33 -23
- package/dist/components/portal.js +128 -57
- package/dist/components/portal.js.map +1 -1
- package/dist/components/progress.cjs +30 -0
- package/dist/components/progress.cjs.map +1 -0
- package/dist/components/progress.d.cts +10 -0
- package/dist/components/progress.d.ts +8 -8
- package/dist/components/progress.js +21 -24
- package/dist/components/progress.js.map +1 -1
- package/dist/components/progressive-blur-scroll-container.cjs +76 -0
- package/dist/components/progressive-blur-scroll-container.cjs.map +1 -0
- package/dist/components/progressive-blur-scroll-container.d.cts +25 -0
- package/dist/components/progressive-blur-scroll-container.d.ts +19 -19
- package/dist/components/progressive-blur-scroll-container.js +70 -137
- package/dist/components/progressive-blur-scroll-container.js.map +1 -1
- package/dist/components/progressive-blur.cjs +46 -0
- package/dist/components/progressive-blur.cjs.map +1 -0
- package/dist/components/progressive-blur.d.cts +17 -0
- package/dist/components/progressive-blur.d.ts +15 -14
- package/dist/components/progressive-blur.js +38 -63
- package/dist/components/progressive-blur.js.map +1 -1
- package/dist/components/radio-group.cjs +38 -0
- package/dist/components/radio-group.cjs.map +1 -0
- package/dist/components/radio-group.d.cts +10 -0
- package/dist/components/radio-group.d.ts +8 -8
- package/dist/components/radio-group.js +28 -30
- package/dist/components/radio-group.js.map +1 -1
- package/dist/components/record-picker.cjs +8 -0
- package/dist/components/record-picker.d.cts +16 -0
- package/dist/components/record-picker.d.ts +13 -13
- package/dist/components/record-picker.js +5 -364
- package/dist/components/resizable.cjs +50 -0
- package/dist/components/resizable.cjs.map +1 -0
- package/dist/components/resizable.d.cts +11 -0
- package/dist/components/resizable.d.ts +10 -10
- package/dist/components/resizable.js +29 -37
- package/dist/components/resizable.js.map +1 -1
- package/dist/components/responsive-diagram.cjs +56 -0
- package/dist/components/responsive-diagram.cjs.map +1 -0
- package/dist/components/responsive-diagram.d.cts +10 -0
- package/dist/components/responsive-diagram.d.ts +7 -7
- package/dist/components/responsive-diagram.js +50 -60
- package/dist/components/responsive-diagram.js.map +1 -1
- package/dist/components/scroll-area.cjs +46 -0
- package/dist/components/scroll-area.cjs.map +1 -0
- package/dist/components/scroll-area.d.cts +12 -0
- package/dist/components/scroll-area.d.ts +11 -11
- package/dist/components/scroll-area.js +35 -62
- package/dist/components/scroll-area.js.map +1 -1
- package/dist/components/select.cjs +204 -0
- package/dist/components/select.cjs.map +1 -0
- package/dist/components/select.d.cts +47 -0
- package/dist/components/select.d.ts +38 -38
- package/dist/components/select.js +172 -269
- package/dist/components/select.js.map +1 -1
- package/dist/components/separator.cjs +23 -0
- package/dist/components/separator.cjs.map +1 -0
- package/dist/components/separator.d.cts +2 -0
- package/dist/components/separator.d.ts +2 -11
- package/dist/components/separator.js +14 -18
- package/dist/components/separator.js.map +1 -1
- package/dist/components/sheet.cjs +19 -0
- package/dist/components/sheet.d.cts +107 -0
- package/dist/components/sheet.d.ts +85 -90
- package/dist/components/sheet.js +3 -598
- package/dist/components/sidebar.cjs +29 -0
- package/dist/components/sidebar.d.cts +67 -0
- package/dist/components/sidebar.d.ts +63 -73
- package/dist/components/sidebar.js +3 -1215
- package/dist/components/skeleton.cjs +24 -0
- package/dist/components/skeleton.cjs.map +1 -0
- package/dist/components/skeleton.d.cts +11 -0
- package/dist/components/skeleton.d.ts +10 -6
- package/dist/components/skeleton.js +15 -10
- package/dist/components/skeleton.js.map +1 -1
- package/dist/components/sonner.cjs +23 -0
- package/dist/components/sonner.cjs.map +1 -0
- package/dist/components/sonner.d.cts +10 -0
- package/dist/components/sonner.d.ts +7 -7
- package/dist/components/sonner.js +17 -18
- package/dist/components/sonner.js.map +1 -1
- package/dist/components/stack/index.cjs +44 -0
- package/dist/components/stack/index.d.cts +2 -0
- package/dist/components/stack/index.d.ts +2 -674
- package/dist/components/stack/index.js +3 -1444
- package/dist/components/stepper.cjs +160 -0
- package/dist/components/stepper.cjs.map +1 -0
- package/dist/components/stepper.d.cts +32 -0
- package/dist/components/stepper.d.ts +27 -25
- package/dist/components/stepper.js +133 -261
- package/dist/components/stepper.js.map +1 -1
- package/dist/components/switch.cjs +35 -0
- package/dist/components/switch.cjs.map +1 -0
- package/dist/components/switch.d.cts +8 -0
- package/dist/components/switch.d.ts +7 -7
- package/dist/components/switch.js +26 -34
- package/dist/components/switch.js.map +1 -1
- package/dist/components/table.cjs +85 -0
- package/dist/components/table.cjs.map +1 -0
- package/dist/components/table.d.cts +23 -0
- package/dist/components/table.d.ts +23 -15
- package/dist/components/table.js +56 -46
- package/dist/components/table.js.map +1 -1
- package/dist/components/tabs.cjs +49 -0
- package/dist/components/tabs.cjs.map +1 -0
- package/dist/components/tabs.d.cts +10 -0
- package/dist/components/tabs.d.ts +9 -9
- package/dist/components/tabs.js +31 -36
- package/dist/components/tabs.js.map +1 -1
- package/dist/components/tags.cjs +132 -0
- package/dist/components/tags.cjs.map +1 -0
- package/dist/components/tags.d.cts +36 -0
- package/dist/components/tags.d.ts +24 -28
- package/dist/components/tags.js +114 -438
- package/dist/components/tags.js.map +1 -1
- package/dist/components/textarea.cjs +34 -0
- package/dist/components/textarea.cjs.map +1 -0
- package/dist/components/textarea.d.cts +10 -0
- package/dist/components/textarea.d.ts +8 -8
- package/dist/components/textarea.js +27 -48
- package/dist/components/textarea.js.map +1 -1
- package/dist/components/toast/index.cjs +9 -0
- package/dist/components/toast/index.d.cts +2 -0
- package/dist/components/toast/index.d.ts +2 -52
- package/dist/components/toast/index.js +3 -623
- package/dist/components/tooltip.cjs +67 -0
- package/dist/components/tooltip.cjs.map +1 -0
- package/dist/components/tooltip.d.cts +2 -0
- package/dist/components/tooltip.d.ts +2 -29
- package/dist/components/tooltip.js +53 -166
- package/dist/components/tooltip.js.map +1 -1
- package/dist/components/unlink-button.cjs +24 -0
- package/dist/components/unlink-button.cjs.map +1 -0
- package/dist/components/unlink-button.d.cts +14 -0
- package/dist/components/unlink-button.d.ts +11 -11
- package/dist/components/unlink-button.js +18 -86
- package/dist/components/unlink-button.js.map +1 -1
- package/dist/form-DgRTv7O7.d.ts +54 -0
- package/dist/form-DoZEWSzb.d.cts +54 -0
- package/dist/index-CjA4CENl.d.cts +684 -0
- package/dist/index-CjA4CENl.d.ts +684 -0
- package/dist/index-UnM04j0t.d.cts +58 -0
- package/dist/index-UnM04j0t.d.ts +58 -0
- package/dist/index.cjs +408 -9346
- package/dist/index.d.cts +224 -2548
- package/dist/index.d.ts +224 -2548
- package/dist/index.js +65 -9022
- package/dist/input-CBrCuMH8.d.cts +11 -0
- package/dist/input-CBrCuMH8.d.ts +11 -0
- package/dist/motion-config-COCFHq1L.cjs +271 -0
- package/dist/motion-config-COCFHq1L.cjs.map +1 -0
- package/dist/motion-config-COsZ6azM.js +241 -0
- package/dist/motion-config-COsZ6azM.js.map +1 -0
- package/dist/record-picker-BbxngCeV.js +162 -0
- package/dist/record-picker-BbxngCeV.js.map +1 -0
- package/dist/record-picker-Bz4FApxD.cjs +167 -0
- package/dist/record-picker-Bz4FApxD.cjs.map +1 -0
- package/dist/rolldown-runtime-D_qnwXdH.cjs +35 -0
- package/dist/separator-BQEsr0Rc.d.cts +11 -0
- package/dist/separator-BQEsr0Rc.d.ts +11 -0
- package/dist/sheet-BLHnhLRH.js +425 -0
- package/dist/sheet-BLHnhLRH.js.map +1 -0
- package/dist/sheet-BdA0rfIz.cjs +515 -0
- package/dist/sheet-BdA0rfIz.cjs.map +1 -0
- package/dist/sidebar-CPy_fibW.cjs +608 -0
- package/dist/sidebar-CPy_fibW.cjs.map +1 -0
- package/dist/sidebar-Cfax0g0_.js +463 -0
- package/dist/sidebar-Cfax0g0_.js.map +1 -0
- package/dist/slot-C-jEfihz.cjs +122 -0
- package/dist/slot-C-jEfihz.cjs.map +1 -0
- package/dist/slot-EL8zfLG0.js +97 -0
- package/dist/slot-EL8zfLG0.js.map +1 -0
- package/dist/stack-DKdvlOM6.cjs +1771 -0
- package/dist/stack-DKdvlOM6.cjs.map +1 -0
- package/dist/stack-jMdxDrex.js +1531 -0
- package/dist/stack-jMdxDrex.js.map +1 -0
- package/dist/toast-D6MqijT2.cjs +316 -0
- package/dist/toast-D6MqijT2.cjs.map +1 -0
- package/dist/toast-D_BOLzm3.js +287 -0
- package/dist/toast-D_BOLzm3.js.map +1 -0
- package/dist/tooltip-CTRQoN1A.d.cts +29 -0
- package/dist/tooltip-CTRQoN1A.d.ts +29 -0
- package/dist/utils-BkMLyah9.js +12 -0
- package/dist/utils-BkMLyah9.js.map +1 -0
- package/dist/utils-CzTQ3-VI.cjs +17 -0
- package/dist/utils-CzTQ3-VI.cjs.map +1 -0
- package/package.json +288 -47
- package/src/styles/globals.css +155 -203
- package/dist/components/org-chart/index.d.ts +0 -54
- package/dist/components/org-chart/index.js +0 -861
- package/dist/components/org-chart/index.js.map +0 -1
- package/dist/components/record-picker.js.map +0 -1
- package/dist/components/sheet.js.map +0 -1
- package/dist/components/sidebar.js.map +0 -1
- package/dist/components/stack/index.js.map +0 -1
- package/dist/components/toast/index.js.map +0 -1
- package/dist/index.cjs.map +0 -1
- package/dist/index.js.map +0 -1
|
@@ -0,0 +1,1771 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
const require_rolldown_runtime = require('./rolldown-runtime-D_qnwXdH.cjs');
|
|
3
|
+
const require_utils = require('./utils-CzTQ3-VI.cjs');
|
|
4
|
+
const require_components_skeleton = require('./components/skeleton.cjs');
|
|
5
|
+
let react = require("react");
|
|
6
|
+
react = require_rolldown_runtime.__toESM(react, 1);
|
|
7
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
8
|
+
let lucide_react = require("lucide-react");
|
|
9
|
+
let _constructive_io_ui_portal = require("@constructive-io/ui/portal");
|
|
10
|
+
let motion_react = require("motion/react");
|
|
11
|
+
let react_dom = require("react-dom");
|
|
12
|
+
let _use_gesture_react = require("@use-gesture/react");
|
|
13
|
+
|
|
14
|
+
//#region src/components/stack/stack-context.tsx
|
|
15
|
+
const DEFAULT_Z_INDEX_BASE = 100;
|
|
16
|
+
const DEFAULT_PEEK_OFFSET = 48;
|
|
17
|
+
const DEFAULT_WIDTH = 480;
|
|
18
|
+
function stackReducer(state, action) {
|
|
19
|
+
switch (action.type) {
|
|
20
|
+
case "PUSH": return { cards: [...state.cards.filter((c) => c.id !== action.card.id), action.card] };
|
|
21
|
+
case "POP": {
|
|
22
|
+
const count = Math.max(1, action.count);
|
|
23
|
+
if (state.cards.length === 0) return state;
|
|
24
|
+
return { cards: state.cards.slice(0, -count) };
|
|
25
|
+
}
|
|
26
|
+
case "POP_TO": {
|
|
27
|
+
const index = state.cards.findIndex((c) => c.id === action.id);
|
|
28
|
+
if (index === -1) return state;
|
|
29
|
+
return { cards: state.cards.slice(0, index + 1) };
|
|
30
|
+
}
|
|
31
|
+
case "REPLACE_TOP": {
|
|
32
|
+
if (state.cards.length === 0) return { cards: [action.card] };
|
|
33
|
+
const newCards = [...state.cards];
|
|
34
|
+
newCards[newCards.length - 1] = action.card;
|
|
35
|
+
return { cards: newCards };
|
|
36
|
+
}
|
|
37
|
+
case "RESET": return { cards: action.cards };
|
|
38
|
+
case "CLEAR": return { cards: [] };
|
|
39
|
+
case "UPDATE_PROPS": {
|
|
40
|
+
const index = state.cards.findIndex((c) => c.id === action.id);
|
|
41
|
+
if (index === -1) return state;
|
|
42
|
+
const card = state.cards[index];
|
|
43
|
+
const prevProps = card.props ?? {};
|
|
44
|
+
const newProps = typeof action.patch === "function" ? action.patch(card.props) : {
|
|
45
|
+
...prevProps,
|
|
46
|
+
...action.patch
|
|
47
|
+
};
|
|
48
|
+
const newCards = [...state.cards];
|
|
49
|
+
newCards[index] = {
|
|
50
|
+
...card,
|
|
51
|
+
props: newProps
|
|
52
|
+
};
|
|
53
|
+
return { cards: newCards };
|
|
54
|
+
}
|
|
55
|
+
case "SET_TITLE": {
|
|
56
|
+
const index = state.cards.findIndex((c) => c.id === action.id);
|
|
57
|
+
if (index === -1) return state;
|
|
58
|
+
const newCards = [...state.cards];
|
|
59
|
+
newCards[index] = {
|
|
60
|
+
...newCards[index],
|
|
61
|
+
title: action.title
|
|
62
|
+
};
|
|
63
|
+
return { cards: newCards };
|
|
64
|
+
}
|
|
65
|
+
case "SET_DESCRIPTION": {
|
|
66
|
+
const index = state.cards.findIndex((c) => c.id === action.id);
|
|
67
|
+
if (index === -1) return state;
|
|
68
|
+
const newCards = [...state.cards];
|
|
69
|
+
newCards[index] = {
|
|
70
|
+
...newCards[index],
|
|
71
|
+
description: action.description
|
|
72
|
+
};
|
|
73
|
+
return { cards: newCards };
|
|
74
|
+
}
|
|
75
|
+
case "SET_WIDTH": {
|
|
76
|
+
const index = state.cards.findIndex((c) => c.id === action.id);
|
|
77
|
+
if (index === -1) return state;
|
|
78
|
+
const newCards = [...state.cards];
|
|
79
|
+
newCards[index] = {
|
|
80
|
+
...newCards[index],
|
|
81
|
+
width: action.width
|
|
82
|
+
};
|
|
83
|
+
return { cards: newCards };
|
|
84
|
+
}
|
|
85
|
+
case "SET_DISMISSABLE": {
|
|
86
|
+
const index = state.cards.findIndex((c) => c.id === action.id);
|
|
87
|
+
if (index === -1) return state;
|
|
88
|
+
const newCards = [...state.cards];
|
|
89
|
+
newCards[index] = {
|
|
90
|
+
...newCards[index],
|
|
91
|
+
dismissable: action.dismissable
|
|
92
|
+
};
|
|
93
|
+
return { cards: newCards };
|
|
94
|
+
}
|
|
95
|
+
case "DISMISS": {
|
|
96
|
+
const index = state.cards.findIndex((c) => c.id === action.id);
|
|
97
|
+
if (index === -1) return state;
|
|
98
|
+
if (action.cascade) return { cards: state.cards.slice(0, index) };
|
|
99
|
+
else return { cards: state.cards.filter((c) => c.id !== action.id) };
|
|
100
|
+
}
|
|
101
|
+
case "INSERT_AT": {
|
|
102
|
+
const clampedIndex = Math.max(0, Math.min(action.index, state.cards.length));
|
|
103
|
+
const newCards = [...state.cards.filter((c) => c.id !== action.card.id)];
|
|
104
|
+
newCards.splice(clampedIndex, 0, action.card);
|
|
105
|
+
return { cards: newCards };
|
|
106
|
+
}
|
|
107
|
+
default: return state;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
const StackContext = (0, react.createContext)(null);
|
|
111
|
+
function CardStackProvider({ children, routes = {}, initial = [], onChange, zIndexBase = DEFAULT_Z_INDEX_BASE, layoutMode = "cascade", defaultPeekOffset = DEFAULT_PEEK_OFFSET, defaultWidth = DEFAULT_WIDTH }) {
|
|
112
|
+
const [state, reducerDispatch] = (0, react.useReducer)(stackReducer, { cards: initial });
|
|
113
|
+
const routesRef = (0, react.useRef)(routes);
|
|
114
|
+
(0, react.useEffect)(() => {
|
|
115
|
+
routesRef.current = routes;
|
|
116
|
+
}, [routes]);
|
|
117
|
+
const stateRef = (0, react.useRef)(state);
|
|
118
|
+
(0, react.useEffect)(() => {
|
|
119
|
+
stateRef.current = state;
|
|
120
|
+
}, [state]);
|
|
121
|
+
const dispatch = react.useCallback((action) => {
|
|
122
|
+
stateRef.current = stackReducer(stateRef.current, action);
|
|
123
|
+
reducerDispatch(action);
|
|
124
|
+
}, [reducerDispatch]);
|
|
125
|
+
const prevCardsRef = (0, react.useRef)(state.cards);
|
|
126
|
+
(0, react.useEffect)(() => {
|
|
127
|
+
if (prevCardsRef.current !== state.cards) {
|
|
128
|
+
const prevCards = prevCardsRef.current;
|
|
129
|
+
const currentIds = new Set(state.cards.map((c) => c.id));
|
|
130
|
+
for (const card of prevCards) if (!currentIds.has(card.id)) card.onClose?.();
|
|
131
|
+
prevCardsRef.current = state.cards;
|
|
132
|
+
onChange?.(state.cards);
|
|
133
|
+
}
|
|
134
|
+
}, [state.cards, onChange]);
|
|
135
|
+
const api = (0, react.useMemo)(() => {
|
|
136
|
+
const top = () => {
|
|
137
|
+
const cards = stateRef.current.cards;
|
|
138
|
+
return cards.length > 0 ? cards[cards.length - 1] : null;
|
|
139
|
+
};
|
|
140
|
+
const currentId = () => top()?.id ?? null;
|
|
141
|
+
const canPop = () => stateRef.current.cards.length > 0;
|
|
142
|
+
const size = () => stateRef.current.cards.length;
|
|
143
|
+
const get = (id) => stateRef.current.cards.find((c) => c.id === id) ?? null;
|
|
144
|
+
const getAll = () => [...stateRef.current.cards];
|
|
145
|
+
const has = (id) => stateRef.current.cards.some((c) => c.id === id);
|
|
146
|
+
const push = (card, options) => {
|
|
147
|
+
if (options?.replaceFrom) {
|
|
148
|
+
const fromIndex = stateRef.current.cards.findIndex((c) => c.id === options.replaceFrom);
|
|
149
|
+
if (fromIndex !== -1 && fromIndex < stateRef.current.cards.length - 1) dispatch({
|
|
150
|
+
type: "POP_TO",
|
|
151
|
+
id: options.replaceFrom
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
dispatch({
|
|
155
|
+
type: "PUSH",
|
|
156
|
+
card
|
|
157
|
+
});
|
|
158
|
+
return card.id;
|
|
159
|
+
};
|
|
160
|
+
const pushRoute = (route, props, opts) => {
|
|
161
|
+
const routeDef = routesRef.current[route];
|
|
162
|
+
if (!routeDef) throw new Error(`Stack: Route "${route}" not found in registry`);
|
|
163
|
+
const id = opts?.id ?? routeDef.getId?.(props) ?? route;
|
|
164
|
+
const card = {
|
|
165
|
+
id,
|
|
166
|
+
title: opts?.title ?? routeDef.defaultTitle,
|
|
167
|
+
Component: routeDef.Component,
|
|
168
|
+
props,
|
|
169
|
+
width: opts?.width ?? routeDef.defaultWidth,
|
|
170
|
+
peekOffset: routeDef.defaultPeekOffset
|
|
171
|
+
};
|
|
172
|
+
dispatch({
|
|
173
|
+
type: "PUSH",
|
|
174
|
+
card
|
|
175
|
+
});
|
|
176
|
+
return id;
|
|
177
|
+
};
|
|
178
|
+
const pop = (count = 1) => {
|
|
179
|
+
dispatch({
|
|
180
|
+
type: "POP",
|
|
181
|
+
count
|
|
182
|
+
});
|
|
183
|
+
};
|
|
184
|
+
const popTo = (id) => {
|
|
185
|
+
dispatch({
|
|
186
|
+
type: "POP_TO",
|
|
187
|
+
id
|
|
188
|
+
});
|
|
189
|
+
};
|
|
190
|
+
const replaceTop = (card) => {
|
|
191
|
+
dispatch({
|
|
192
|
+
type: "REPLACE_TOP",
|
|
193
|
+
card
|
|
194
|
+
});
|
|
195
|
+
return card.id;
|
|
196
|
+
};
|
|
197
|
+
const reset = (cards) => {
|
|
198
|
+
dispatch({
|
|
199
|
+
type: "RESET",
|
|
200
|
+
cards
|
|
201
|
+
});
|
|
202
|
+
};
|
|
203
|
+
const clear = () => {
|
|
204
|
+
dispatch({ type: "CLEAR" });
|
|
205
|
+
};
|
|
206
|
+
const updateProps = (id, patch) => {
|
|
207
|
+
dispatch({
|
|
208
|
+
type: "UPDATE_PROPS",
|
|
209
|
+
id,
|
|
210
|
+
patch
|
|
211
|
+
});
|
|
212
|
+
};
|
|
213
|
+
const setTitle = (id, title) => {
|
|
214
|
+
dispatch({
|
|
215
|
+
type: "SET_TITLE",
|
|
216
|
+
id,
|
|
217
|
+
title
|
|
218
|
+
});
|
|
219
|
+
};
|
|
220
|
+
const setDescription = (id, description) => {
|
|
221
|
+
dispatch({
|
|
222
|
+
type: "SET_DESCRIPTION",
|
|
223
|
+
id,
|
|
224
|
+
description
|
|
225
|
+
});
|
|
226
|
+
};
|
|
227
|
+
const setWidth = (id, width) => {
|
|
228
|
+
dispatch({
|
|
229
|
+
type: "SET_WIDTH",
|
|
230
|
+
id,
|
|
231
|
+
width
|
|
232
|
+
});
|
|
233
|
+
};
|
|
234
|
+
const setDismissable = (id, dismissable) => {
|
|
235
|
+
dispatch({
|
|
236
|
+
type: "SET_DISMISSABLE",
|
|
237
|
+
id,
|
|
238
|
+
dismissable
|
|
239
|
+
});
|
|
240
|
+
};
|
|
241
|
+
const dismiss = (id, options) => {
|
|
242
|
+
const cascade = options?.cascade ?? true;
|
|
243
|
+
dispatch({
|
|
244
|
+
type: "DISMISS",
|
|
245
|
+
id,
|
|
246
|
+
cascade
|
|
247
|
+
});
|
|
248
|
+
};
|
|
249
|
+
const insertAt = (index, card) => {
|
|
250
|
+
dispatch({
|
|
251
|
+
type: "INSERT_AT",
|
|
252
|
+
index,
|
|
253
|
+
card
|
|
254
|
+
});
|
|
255
|
+
return card.id;
|
|
256
|
+
};
|
|
257
|
+
return {
|
|
258
|
+
top,
|
|
259
|
+
currentId,
|
|
260
|
+
canPop,
|
|
261
|
+
size,
|
|
262
|
+
get,
|
|
263
|
+
getAll,
|
|
264
|
+
has,
|
|
265
|
+
push,
|
|
266
|
+
pushRoute,
|
|
267
|
+
pop,
|
|
268
|
+
popTo,
|
|
269
|
+
replaceTop,
|
|
270
|
+
reset,
|
|
271
|
+
clear,
|
|
272
|
+
updateProps,
|
|
273
|
+
setTitle,
|
|
274
|
+
setDescription,
|
|
275
|
+
setWidth,
|
|
276
|
+
setDismissable,
|
|
277
|
+
dismiss,
|
|
278
|
+
insertAt
|
|
279
|
+
};
|
|
280
|
+
}, [dispatch]);
|
|
281
|
+
(0, react.useEffect)(() => {
|
|
282
|
+
const handleEscape = (event) => {
|
|
283
|
+
if (event.key === "Escape" && stateRef.current.cards.length > 0) {
|
|
284
|
+
event.preventDefault();
|
|
285
|
+
event.stopPropagation();
|
|
286
|
+
if (stateRef.current.cards[stateRef.current.cards.length - 1].dismissable !== false) api.pop();
|
|
287
|
+
}
|
|
288
|
+
};
|
|
289
|
+
document.addEventListener("keydown", handleEscape, true);
|
|
290
|
+
return () => document.removeEventListener("keydown", handleEscape, true);
|
|
291
|
+
}, [api]);
|
|
292
|
+
const contextValue = (0, react.useMemo)(() => ({
|
|
293
|
+
state,
|
|
294
|
+
api,
|
|
295
|
+
config: {
|
|
296
|
+
routes,
|
|
297
|
+
zIndexBase,
|
|
298
|
+
layoutMode,
|
|
299
|
+
defaultPeekOffset,
|
|
300
|
+
defaultWidth
|
|
301
|
+
}
|
|
302
|
+
}), [
|
|
303
|
+
state,
|
|
304
|
+
api,
|
|
305
|
+
routes,
|
|
306
|
+
zIndexBase,
|
|
307
|
+
layoutMode,
|
|
308
|
+
defaultPeekOffset,
|
|
309
|
+
defaultWidth
|
|
310
|
+
]);
|
|
311
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StackContext.Provider, {
|
|
312
|
+
value: contextValue,
|
|
313
|
+
children
|
|
314
|
+
});
|
|
315
|
+
}
|
|
316
|
+
function useCardStack() {
|
|
317
|
+
const context = (0, react.useContext)(StackContext);
|
|
318
|
+
if (!context) throw new Error("useCardStack must be used within a CardStackProvider");
|
|
319
|
+
return context.api;
|
|
320
|
+
}
|
|
321
|
+
function useStackContext() {
|
|
322
|
+
const context = (0, react.useContext)(StackContext);
|
|
323
|
+
if (!context) throw new Error("useStackContext must be used within a CardStackProvider");
|
|
324
|
+
return context;
|
|
325
|
+
}
|
|
326
|
+
/** Hook to get current layout mode */
|
|
327
|
+
function useStackLayoutMode() {
|
|
328
|
+
return useStackContext().config.layoutMode;
|
|
329
|
+
}
|
|
330
|
+
/** Hook to get stack cards (triggers re-render on change) */
|
|
331
|
+
function useStackCards() {
|
|
332
|
+
return useStackContext().state.cards;
|
|
333
|
+
}
|
|
334
|
+
/** Hook to check if a card is the top card */
|
|
335
|
+
function useIsTopCard(id) {
|
|
336
|
+
const cards = useStackContext().state.cards;
|
|
337
|
+
return cards.length > 0 && cards[cards.length - 1].id === id;
|
|
338
|
+
}
|
|
339
|
+
/** Hook to get card index in stack */
|
|
340
|
+
function useCardIndex(id) {
|
|
341
|
+
return useStackContext().state.cards.findIndex((c) => c.id === id);
|
|
342
|
+
}
|
|
343
|
+
/** Create injected card props for a specific card */
|
|
344
|
+
function useCardInjectedProps(id) {
|
|
345
|
+
const api = useCardStack();
|
|
346
|
+
return (0, react.useMemo)(() => ({ card: {
|
|
347
|
+
id,
|
|
348
|
+
push: (card, options) => {
|
|
349
|
+
const cardId = card.id ?? `${id}-child-${Date.now()}`;
|
|
350
|
+
const fullCard = {
|
|
351
|
+
...card,
|
|
352
|
+
id: cardId
|
|
353
|
+
};
|
|
354
|
+
if (options?.append) return api.push(fullCard);
|
|
355
|
+
else return api.push(fullCard, { replaceFrom: id });
|
|
356
|
+
},
|
|
357
|
+
close: () => api.dismiss(id),
|
|
358
|
+
setTitle: (title) => api.setTitle(id, title),
|
|
359
|
+
setDescription: (description) => api.setDescription(id, description),
|
|
360
|
+
setWidth: (width) => api.setWidth(id, width),
|
|
361
|
+
setDismissable: (dismissable) => api.setDismissable(id, dismissable),
|
|
362
|
+
updateProps: (patch) => api.updateProps(id, patch)
|
|
363
|
+
} }), [id, api]);
|
|
364
|
+
}
|
|
365
|
+
const CardReadyContext = (0, react.createContext)(null);
|
|
366
|
+
/** Provider for card animation state - used internally by StackCard */
|
|
367
|
+
function CardReadyProvider({ children, isAnimationComplete }) {
|
|
368
|
+
const value = (0, react.useMemo)(() => ({ isAnimationComplete }), [isAnimationComplete]);
|
|
369
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CardReadyContext.Provider, {
|
|
370
|
+
value,
|
|
371
|
+
children
|
|
372
|
+
});
|
|
373
|
+
}
|
|
374
|
+
/**
|
|
375
|
+
* Hook to check if the card's enter animation is complete.
|
|
376
|
+
* Use this to defer data fetching until after the slide-in animation.
|
|
377
|
+
*
|
|
378
|
+
* @example
|
|
379
|
+
* ```tsx
|
|
380
|
+
* function MyCard() {
|
|
381
|
+
* const { isReady } = useCardReady();
|
|
382
|
+
*
|
|
383
|
+
* // Data query that only runs after animation completes
|
|
384
|
+
* const { data, isLoading } = useQuery({
|
|
385
|
+
* queryKey: ['myData'],
|
|
386
|
+
* queryFn: fetchData,
|
|
387
|
+
* enabled: isReady, // Don't fetch until animation done
|
|
388
|
+
* });
|
|
389
|
+
*
|
|
390
|
+
* return (
|
|
391
|
+
* <Select disabled={isLoading || !isReady}>
|
|
392
|
+
* {data?.map(item => <SelectItem key={item.id}>{item.name}</SelectItem>)}
|
|
393
|
+
* </Select>
|
|
394
|
+
* );
|
|
395
|
+
* }
|
|
396
|
+
* ```
|
|
397
|
+
*/
|
|
398
|
+
function useCardReady() {
|
|
399
|
+
const context = (0, react.useContext)(CardReadyContext);
|
|
400
|
+
if (!context) return { isReady: true };
|
|
401
|
+
return { isReady: context.isAnimationComplete };
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
//#endregion
|
|
405
|
+
//#region src/components/stack/stack-animations.ts
|
|
406
|
+
const DEFAULT_ANIMATION_CONFIG = {
|
|
407
|
+
duration: .2,
|
|
408
|
+
enterEase: [
|
|
409
|
+
.32,
|
|
410
|
+
.72,
|
|
411
|
+
0,
|
|
412
|
+
1
|
|
413
|
+
],
|
|
414
|
+
exitEase: [
|
|
415
|
+
.4,
|
|
416
|
+
0,
|
|
417
|
+
.6,
|
|
418
|
+
1
|
|
419
|
+
]
|
|
420
|
+
};
|
|
421
|
+
/**
|
|
422
|
+
* Create motion variants for card enter/exit animations.
|
|
423
|
+
* Uses transform-only properties for GPU compositing.
|
|
424
|
+
*/
|
|
425
|
+
function createCardVariants(config = {}) {
|
|
426
|
+
const { duration, enterEase, exitEase } = {
|
|
427
|
+
...DEFAULT_ANIMATION_CONFIG,
|
|
428
|
+
...config
|
|
429
|
+
};
|
|
430
|
+
return {
|
|
431
|
+
initial: { x: "100%" },
|
|
432
|
+
animate: {
|
|
433
|
+
x: 0,
|
|
434
|
+
transition: {
|
|
435
|
+
type: "tween",
|
|
436
|
+
duration,
|
|
437
|
+
ease: enterEase
|
|
438
|
+
}
|
|
439
|
+
},
|
|
440
|
+
exit: {
|
|
441
|
+
x: "100%",
|
|
442
|
+
transition: {
|
|
443
|
+
type: "tween",
|
|
444
|
+
duration,
|
|
445
|
+
ease: exitEase
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
};
|
|
449
|
+
}
|
|
450
|
+
/**
|
|
451
|
+
* Create transition for offset animations (when cards above change).
|
|
452
|
+
* Uses spring for playful slide-back feel when cards are dismissed.
|
|
453
|
+
*/
|
|
454
|
+
function createOffsetTransition(_config = {}) {
|
|
455
|
+
return {
|
|
456
|
+
type: "spring",
|
|
457
|
+
stiffness: 300,
|
|
458
|
+
damping: 30,
|
|
459
|
+
mass: .8
|
|
460
|
+
};
|
|
461
|
+
}
|
|
462
|
+
const backdropVariants = {
|
|
463
|
+
initial: { opacity: 0 },
|
|
464
|
+
animate: {
|
|
465
|
+
opacity: 1,
|
|
466
|
+
transition: {
|
|
467
|
+
duration: .2,
|
|
468
|
+
ease: "easeOut"
|
|
469
|
+
}
|
|
470
|
+
},
|
|
471
|
+
exit: {
|
|
472
|
+
opacity: 0,
|
|
473
|
+
transition: {
|
|
474
|
+
duration: .25,
|
|
475
|
+
ease: [
|
|
476
|
+
.4,
|
|
477
|
+
0,
|
|
478
|
+
.6,
|
|
479
|
+
1
|
|
480
|
+
]
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
};
|
|
484
|
+
/**
|
|
485
|
+
* Create spring config for snap-back animation after cancelled swipe.
|
|
486
|
+
*/
|
|
487
|
+
const snapBackSpring = {
|
|
488
|
+
type: "spring",
|
|
489
|
+
stiffness: 400,
|
|
490
|
+
damping: 30,
|
|
491
|
+
mass: .8
|
|
492
|
+
};
|
|
493
|
+
/**
|
|
494
|
+
* Create transition for swipe-to-dismiss.
|
|
495
|
+
*/
|
|
496
|
+
const swipeDismissTransition = {
|
|
497
|
+
type: "tween",
|
|
498
|
+
duration: .2,
|
|
499
|
+
ease: [
|
|
500
|
+
.4,
|
|
501
|
+
0,
|
|
502
|
+
.6,
|
|
503
|
+
1
|
|
504
|
+
]
|
|
505
|
+
};
|
|
506
|
+
/**
|
|
507
|
+
* Exit transition for the last card - coordinated slide + fade.
|
|
508
|
+
* Uses tween (not spring) for smooth opacity animation.
|
|
509
|
+
*/
|
|
510
|
+
const lastCardExitTransition = {
|
|
511
|
+
type: "tween",
|
|
512
|
+
duration: .25,
|
|
513
|
+
ease: [
|
|
514
|
+
.4,
|
|
515
|
+
0,
|
|
516
|
+
.6,
|
|
517
|
+
1
|
|
518
|
+
]
|
|
519
|
+
};
|
|
520
|
+
/** Spring config for peek hover expansion - playful and bouncy */
|
|
521
|
+
const peekHoverSpring = {
|
|
522
|
+
type: "spring",
|
|
523
|
+
stiffness: 500,
|
|
524
|
+
damping: 25,
|
|
525
|
+
mass: .6
|
|
526
|
+
};
|
|
527
|
+
/** Spring config for peek drag - responsive during interaction */
|
|
528
|
+
const peekDragSpring = {
|
|
529
|
+
type: "spring",
|
|
530
|
+
stiffness: 600,
|
|
531
|
+
damping: 35,
|
|
532
|
+
mass: .5
|
|
533
|
+
};
|
|
534
|
+
/** Spring config for multi-card slide during peek drag */
|
|
535
|
+
const peekSlideSpring = {
|
|
536
|
+
type: "spring",
|
|
537
|
+
stiffness: 400,
|
|
538
|
+
damping: 30,
|
|
539
|
+
mass: .7
|
|
540
|
+
};
|
|
541
|
+
/**
|
|
542
|
+
* Create variants with reduced motion support.
|
|
543
|
+
* Instant transitions when user prefers reduced motion.
|
|
544
|
+
*/
|
|
545
|
+
function createReducedMotionVariants() {
|
|
546
|
+
return {
|
|
547
|
+
initial: {
|
|
548
|
+
x: 0,
|
|
549
|
+
opacity: 0
|
|
550
|
+
},
|
|
551
|
+
animate: {
|
|
552
|
+
x: 0,
|
|
553
|
+
opacity: 1,
|
|
554
|
+
transition: { duration: 0 }
|
|
555
|
+
},
|
|
556
|
+
exit: {
|
|
557
|
+
x: 0,
|
|
558
|
+
opacity: 0,
|
|
559
|
+
transition: { duration: 0 }
|
|
560
|
+
}
|
|
561
|
+
};
|
|
562
|
+
}
|
|
563
|
+
const reducedMotionBackdropVariants = {
|
|
564
|
+
initial: { opacity: 0 },
|
|
565
|
+
animate: {
|
|
566
|
+
opacity: 1,
|
|
567
|
+
transition: { duration: 0 }
|
|
568
|
+
},
|
|
569
|
+
exit: {
|
|
570
|
+
opacity: 0,
|
|
571
|
+
transition: { duration: 0 }
|
|
572
|
+
}
|
|
573
|
+
};
|
|
574
|
+
|
|
575
|
+
//#endregion
|
|
576
|
+
//#region src/components/stack/stack-backdrop.tsx
|
|
577
|
+
function StackBackdrop({ className, onClick, config: backdropConfig }) {
|
|
578
|
+
const { config, state } = useStackContext();
|
|
579
|
+
const api = useCardStack();
|
|
580
|
+
const prefersReducedMotion = (0, motion_react.useReducedMotion)();
|
|
581
|
+
const handleClick = react.useCallback(() => {
|
|
582
|
+
if (state.cards.some((c) => c.dismissable === false)) return;
|
|
583
|
+
if (onClick) onClick();
|
|
584
|
+
else api.clear();
|
|
585
|
+
}, [
|
|
586
|
+
onClick,
|
|
587
|
+
api,
|
|
588
|
+
state.cards
|
|
589
|
+
]);
|
|
590
|
+
const variants = prefersReducedMotion ? reducedMotionBackdropVariants : backdropVariants;
|
|
591
|
+
const useBlur = backdropConfig?.blur ?? false;
|
|
592
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(motion_react.motion.div, {
|
|
593
|
+
"data-slot": "stack-backdrop",
|
|
594
|
+
variants,
|
|
595
|
+
initial: "initial",
|
|
596
|
+
animate: "animate",
|
|
597
|
+
exit: "exit",
|
|
598
|
+
onClick: handleClick,
|
|
599
|
+
style: { zIndex: config.zIndexBase - 1 },
|
|
600
|
+
className: require_utils.cn("fixed inset-0", "cursor-pointer", backdropConfig?.className ?? "bg-black/50", useBlur && "backdrop-blur-sm", className)
|
|
601
|
+
});
|
|
602
|
+
}
|
|
603
|
+
|
|
604
|
+
//#endregion
|
|
605
|
+
//#region src/components/stack/stack-header.tsx
|
|
606
|
+
const sizeStyles = {
|
|
607
|
+
sm: {
|
|
608
|
+
title: "text-sm font-semibold",
|
|
609
|
+
description: "text-xs",
|
|
610
|
+
height: "h-12",
|
|
611
|
+
heightWithDesc: "h-14"
|
|
612
|
+
},
|
|
613
|
+
md: {
|
|
614
|
+
title: "text-base font-semibold",
|
|
615
|
+
description: "text-sm",
|
|
616
|
+
height: "h-14",
|
|
617
|
+
heightWithDesc: "h-18"
|
|
618
|
+
},
|
|
619
|
+
lg: {
|
|
620
|
+
title: "text-lg font-semibold",
|
|
621
|
+
description: "text-sm",
|
|
622
|
+
height: "h-16",
|
|
623
|
+
heightWithDesc: "h-20"
|
|
624
|
+
}
|
|
625
|
+
};
|
|
626
|
+
function StackHeader({ card, onClose, className, renderTitle }) {
|
|
627
|
+
const title = renderTitle ? renderTitle(card) : card.title;
|
|
628
|
+
const hasDescription = !!card.description;
|
|
629
|
+
const size = card.headerSize ?? "md";
|
|
630
|
+
const styles = sizeStyles[size];
|
|
631
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
632
|
+
"data-slot": "stack-header",
|
|
633
|
+
className: require_utils.cn("flex shrink-0 items-center justify-between", "border-b border-border/50", "px-4", hasDescription ? styles.heightWithDesc : styles.height, className),
|
|
634
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
635
|
+
className: "flex-1 min-w-0",
|
|
636
|
+
children: [title && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("h2", {
|
|
637
|
+
className: require_utils.cn("text-foreground truncate", styles.title),
|
|
638
|
+
children: title
|
|
639
|
+
}), card.description && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
640
|
+
className: require_utils.cn("text-muted-foreground truncate", styles.description),
|
|
641
|
+
children: card.description
|
|
642
|
+
})]
|
|
643
|
+
}), card.dismissable !== false && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
644
|
+
type: "button",
|
|
645
|
+
onClick: onClose,
|
|
646
|
+
className: require_utils.cn("flex h-8 w-8 items-center justify-center", "rounded-md", "text-muted-foreground hover:text-foreground", "hover:bg-muted/50", "transition-colors", "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"),
|
|
647
|
+
"aria-label": "Close",
|
|
648
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.ChevronRight, { className: "h-5 w-5" })
|
|
649
|
+
})]
|
|
650
|
+
});
|
|
651
|
+
}
|
|
652
|
+
/** Slot for custom header content */
|
|
653
|
+
function StackHeaderSlot({ className, children }) {
|
|
654
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
655
|
+
"data-slot": "stack-header-slot",
|
|
656
|
+
className: require_utils.cn("flex h-12 shrink-0 items-center", "border-b border-border/50", "px-4", className),
|
|
657
|
+
children
|
|
658
|
+
});
|
|
659
|
+
}
|
|
660
|
+
|
|
661
|
+
//#endregion
|
|
662
|
+
//#region src/components/stack/stack-utils.ts
|
|
663
|
+
/**
|
|
664
|
+
* Calculate the X offset for a card in cascade mode.
|
|
665
|
+
* Cards below the top are pushed left by (cardsAbove * peekOffset).
|
|
666
|
+
*/
|
|
667
|
+
function getCascadeOffset(cardIndex, totalCards, cards, defaultPeekOffset) {
|
|
668
|
+
const cardsAbove = totalCards - cardIndex - 1;
|
|
669
|
+
if (cardsAbove <= 0) return 0;
|
|
670
|
+
return cardsAbove * (cards[cardIndex]?.peekOffset ?? defaultPeekOffset);
|
|
671
|
+
}
|
|
672
|
+
/**
|
|
673
|
+
* Calculate the X offset for a card in side-by-side mode.
|
|
674
|
+
* - Top card: no offset
|
|
675
|
+
* - Second card: pushed by top card's width (fully visible side-by-side)
|
|
676
|
+
* - Deeper cards: cascade further with peekOffset increments
|
|
677
|
+
*/
|
|
678
|
+
function getSideBySideOffset(cardIndex, totalCards, topCardWidth, defaultPeekOffset) {
|
|
679
|
+
if (totalCards === 0) return 0;
|
|
680
|
+
const cardsAbove = totalCards - cardIndex - 1;
|
|
681
|
+
if (cardsAbove === 0) return 0;
|
|
682
|
+
if (cardsAbove === 1) return topCardWidth;
|
|
683
|
+
return topCardWidth + (cardsAbove - 1) * defaultPeekOffset;
|
|
684
|
+
}
|
|
685
|
+
/**
|
|
686
|
+
* Get the offset for a card based on layout mode.
|
|
687
|
+
*/
|
|
688
|
+
function getCardOffset(cardIndex, totalCards, cards, layoutMode, topCardWidth, defaultPeekOffset) {
|
|
689
|
+
if (layoutMode === "side-by-side") return getSideBySideOffset(cardIndex, totalCards, topCardWidth, defaultPeekOffset);
|
|
690
|
+
return getCascadeOffset(cardIndex, totalCards, cards, defaultPeekOffset);
|
|
691
|
+
}
|
|
692
|
+
/** Minimum visible peek for a card (in px) before it collapses - must be large enough to click */
|
|
693
|
+
const MIN_VISIBLE_PEEK = 24;
|
|
694
|
+
/** Padding from viewport edges */
|
|
695
|
+
const VIEWPORT_PADDING = 16;
|
|
696
|
+
/**
|
|
697
|
+
* Calculate responsive offset compression based on viewport width.
|
|
698
|
+
* As viewport shrinks, offsets compress until hitting mobile breakpoint.
|
|
699
|
+
*
|
|
700
|
+
* The algorithm:
|
|
701
|
+
* 1. Calculate space needed: topCardWidth + secondCardWidth (for side-by-side)
|
|
702
|
+
* 2. Calculate available space: viewportWidth - padding
|
|
703
|
+
* 3. If not enough space, compress the second card's offset
|
|
704
|
+
* 4. When compression reaches threshold, trigger collapse to mobile
|
|
705
|
+
*/
|
|
706
|
+
function calculateResponsiveOffset(config) {
|
|
707
|
+
const { viewportWidth, topCardWidth, secondCardWidth, totalCards, defaultPeekOffset, layoutMode } = config;
|
|
708
|
+
const availableWidth = viewportWidth - VIEWPORT_PADDING * 2;
|
|
709
|
+
if (totalCards <= 1) return {
|
|
710
|
+
compressionRatio: 1,
|
|
711
|
+
shouldCollapse: false,
|
|
712
|
+
adjustedPeekOffset: defaultPeekOffset,
|
|
713
|
+
availableSpace: availableWidth
|
|
714
|
+
};
|
|
715
|
+
if (layoutMode === "side-by-side") {
|
|
716
|
+
const idealWidth = topCardWidth + secondCardWidth;
|
|
717
|
+
if (availableWidth >= idealWidth) return {
|
|
718
|
+
compressionRatio: 1,
|
|
719
|
+
shouldCollapse: false,
|
|
720
|
+
adjustedPeekOffset: defaultPeekOffset,
|
|
721
|
+
availableSpace: availableWidth - topCardWidth
|
|
722
|
+
};
|
|
723
|
+
const overflow = idealWidth - availableWidth;
|
|
724
|
+
const maxCompression = secondCardWidth - MIN_VISIBLE_PEEK;
|
|
725
|
+
if (overflow >= maxCompression) return {
|
|
726
|
+
compressionRatio: 0,
|
|
727
|
+
shouldCollapse: true,
|
|
728
|
+
adjustedPeekOffset: 0,
|
|
729
|
+
availableSpace: 0
|
|
730
|
+
};
|
|
731
|
+
const compressionRatio = 1 - overflow / maxCompression;
|
|
732
|
+
const adjustedSecondCardVisible = secondCardWidth - overflow;
|
|
733
|
+
return {
|
|
734
|
+
compressionRatio,
|
|
735
|
+
shouldCollapse: false,
|
|
736
|
+
adjustedPeekOffset: defaultPeekOffset * compressionRatio,
|
|
737
|
+
availableSpace: adjustedSecondCardVisible
|
|
738
|
+
};
|
|
739
|
+
}
|
|
740
|
+
const cascadeDepth = totalCards - 1;
|
|
741
|
+
const totalPeekNeeded = cascadeDepth * defaultPeekOffset;
|
|
742
|
+
if (availableWidth >= topCardWidth + totalPeekNeeded) return {
|
|
743
|
+
compressionRatio: 1,
|
|
744
|
+
shouldCollapse: false,
|
|
745
|
+
adjustedPeekOffset: defaultPeekOffset,
|
|
746
|
+
availableSpace: totalPeekNeeded
|
|
747
|
+
};
|
|
748
|
+
const availableForPeek = Math.max(0, availableWidth - topCardWidth);
|
|
749
|
+
if (availableForPeek < cascadeDepth * MIN_VISIBLE_PEEK) return {
|
|
750
|
+
compressionRatio: 0,
|
|
751
|
+
shouldCollapse: true,
|
|
752
|
+
adjustedPeekOffset: 0,
|
|
753
|
+
availableSpace: 0
|
|
754
|
+
};
|
|
755
|
+
const compressionRatio = availableForPeek / totalPeekNeeded;
|
|
756
|
+
const adjustedPeekOffset = defaultPeekOffset * compressionRatio;
|
|
757
|
+
return {
|
|
758
|
+
compressionRatio,
|
|
759
|
+
shouldCollapse: false,
|
|
760
|
+
adjustedPeekOffset: Math.max(MIN_VISIBLE_PEEK, adjustedPeekOffset),
|
|
761
|
+
availableSpace: availableForPeek
|
|
762
|
+
};
|
|
763
|
+
}
|
|
764
|
+
/**
|
|
765
|
+
* Get responsive card offset that compresses based on viewport.
|
|
766
|
+
* Ensures every card has at least MIN_VISIBLE_PEEK visible past cards above it.
|
|
767
|
+
*/
|
|
768
|
+
function getResponsiveCardOffset(cardIndex, totalCards, cards, layoutMode, topCardWidth, adjustedPeekOffset, compressionRatio, defaultWidth = 480) {
|
|
769
|
+
if (totalCards === 0) return 0;
|
|
770
|
+
const cardsAbove = totalCards - cardIndex - 1;
|
|
771
|
+
if (cardsAbove === 0) return 0;
|
|
772
|
+
if (layoutMode === "side-by-side") {
|
|
773
|
+
const getWidth = (idx) => {
|
|
774
|
+
const w = cards[idx]?.width;
|
|
775
|
+
if (w === void 0) return defaultWidth;
|
|
776
|
+
if (typeof w === "number") return w;
|
|
777
|
+
if (w.endsWith("px")) return parseFloat(w) || defaultWidth;
|
|
778
|
+
return defaultWidth;
|
|
779
|
+
};
|
|
780
|
+
const getIdealOffset = (idx) => {
|
|
781
|
+
const cardsAboveIdx = totalCards - idx - 1;
|
|
782
|
+
if (cardsAboveIdx === 0) return 0;
|
|
783
|
+
if (cardsAboveIdx === 1) return topCardWidth * compressionRatio + adjustedPeekOffset * (1 - compressionRatio);
|
|
784
|
+
const extraDepth = cardsAboveIdx - 1;
|
|
785
|
+
return topCardWidth * compressionRatio + adjustedPeekOffset * (1 - compressionRatio) + extraDepth * adjustedPeekOffset;
|
|
786
|
+
};
|
|
787
|
+
const adjustedOffsets = new Array(totalCards).fill(0);
|
|
788
|
+
for (let idx = totalCards - 1; idx >= 0; idx--) {
|
|
789
|
+
const ideal = getIdealOffset(idx);
|
|
790
|
+
const width = getWidth(idx);
|
|
791
|
+
if (cards[idx]?.allowCover ?? false) {
|
|
792
|
+
adjustedOffsets[idx] = ideal;
|
|
793
|
+
continue;
|
|
794
|
+
}
|
|
795
|
+
let minRequired = 0;
|
|
796
|
+
for (let j = idx + 1; j < totalCards; j++) {
|
|
797
|
+
const required = adjustedOffsets[j] + getWidth(j) - width + MIN_VISIBLE_PEEK;
|
|
798
|
+
minRequired = Math.max(minRequired, required);
|
|
799
|
+
}
|
|
800
|
+
adjustedOffsets[idx] = Math.max(ideal, minRequired);
|
|
801
|
+
}
|
|
802
|
+
return adjustedOffsets[cardIndex];
|
|
803
|
+
}
|
|
804
|
+
return cardsAbove * (cards[cardIndex]?.peekOffset ?? adjustedPeekOffset) * compressionRatio + cardsAbove * MIN_VISIBLE_PEEK * (1 - compressionRatio);
|
|
805
|
+
}
|
|
806
|
+
/**
|
|
807
|
+
* Normalize width to CSS value.
|
|
808
|
+
*/
|
|
809
|
+
function normalizeWidth(width, defaultWidth) {
|
|
810
|
+
if (width === void 0) return typeof defaultWidth === "number" ? `${defaultWidth}px` : defaultWidth;
|
|
811
|
+
return typeof width === "number" ? `${width}px` : width;
|
|
812
|
+
}
|
|
813
|
+
/**
|
|
814
|
+
* Parse width to pixels (for offset calculations).
|
|
815
|
+
* Returns undefined if width cannot be parsed to pixels.
|
|
816
|
+
*/
|
|
817
|
+
function parseWidthToPixels(width) {
|
|
818
|
+
if (width === void 0) return void 0;
|
|
819
|
+
if (typeof width === "number") return width;
|
|
820
|
+
if (width.endsWith("px")) {
|
|
821
|
+
const parsed = parseFloat(width);
|
|
822
|
+
return isNaN(parsed) ? void 0 : parsed;
|
|
823
|
+
}
|
|
824
|
+
if (width.endsWith("rem")) {
|
|
825
|
+
const parsed = parseFloat(width);
|
|
826
|
+
return isNaN(parsed) ? void 0 : parsed * 16;
|
|
827
|
+
}
|
|
828
|
+
}
|
|
829
|
+
/**
|
|
830
|
+
* Calculate z-index for a card based on its position in the stack.
|
|
831
|
+
*/
|
|
832
|
+
function getCardZIndex(cardIndex, zIndexBase) {
|
|
833
|
+
return zIndexBase + cardIndex * 10;
|
|
834
|
+
}
|
|
835
|
+
/**
|
|
836
|
+
* Determine which cards should be rendered based on peekDepth.
|
|
837
|
+
* Returns indices of cards that should be rendered (from bottom to top).
|
|
838
|
+
*/
|
|
839
|
+
function getVisibleCardIndices(totalCards, peekDepth) {
|
|
840
|
+
if (totalCards === 0) return [];
|
|
841
|
+
const startIndex = Math.max(0, totalCards - peekDepth - 1);
|
|
842
|
+
const indices = [];
|
|
843
|
+
for (let i = startIndex; i < totalCards; i++) indices.push(i);
|
|
844
|
+
return indices;
|
|
845
|
+
}
|
|
846
|
+
/**
|
|
847
|
+
* Check if a card should be rendered based on peekDepth.
|
|
848
|
+
*/
|
|
849
|
+
function isCardVisible(cardIndex, totalCards, peekDepth) {
|
|
850
|
+
if (totalCards === 0) return false;
|
|
851
|
+
return cardIndex >= Math.max(0, totalCards - peekDepth - 1);
|
|
852
|
+
}
|
|
853
|
+
|
|
854
|
+
//#endregion
|
|
855
|
+
//#region src/components/stack/use-peek-gestures.ts
|
|
856
|
+
const DEFAULT_HOVER_EXPANSION$1 = 48;
|
|
857
|
+
const DEFAULT_DRAG_THRESHOLD = 80;
|
|
858
|
+
const DEFAULT_VELOCITY_THRESHOLD$1 = 400;
|
|
859
|
+
/**
|
|
860
|
+
* Hook for peek zone interactions: hover expansion, click-to-dismiss, drag-to-dismiss.
|
|
861
|
+
* Works on both mobile and desktop.
|
|
862
|
+
*/
|
|
863
|
+
function usePeekGestures(options) {
|
|
864
|
+
const { enabled = true, dragToDismiss = true, hoverExpansion = DEFAULT_HOVER_EXPANSION$1, dragThreshold = DEFAULT_DRAG_THRESHOLD, dragVelocityThreshold = DEFAULT_VELOCITY_THRESHOLD$1, cardIndex, totalCards, onPeekClick, onPeekDragDismiss, onPeekDrag, onPeekDragCancel } = options;
|
|
865
|
+
const prefersReducedMotion = (0, motion_react.useReducedMotion)();
|
|
866
|
+
const [isHovered, setIsHovered] = (0, react.useState)(false);
|
|
867
|
+
const [isDragging, setIsDragging] = (0, react.useState)(false);
|
|
868
|
+
const [dragOffset, setDragOffset] = (0, react.useState)(0);
|
|
869
|
+
const startXRef = (0, react.useRef)(0);
|
|
870
|
+
const startTimeRef = (0, react.useRef)(0);
|
|
871
|
+
const pointerIdRef = (0, react.useRef)(null);
|
|
872
|
+
const hasDraggedRef = (0, react.useRef)(false);
|
|
873
|
+
const isTopCard = cardIndex === totalCards - 1;
|
|
874
|
+
const isEnabled = enabled && !isTopCard;
|
|
875
|
+
const handleMouseEnter = (0, react.useCallback)(() => {
|
|
876
|
+
if (!isEnabled || prefersReducedMotion) return;
|
|
877
|
+
setIsHovered(true);
|
|
878
|
+
}, [isEnabled, prefersReducedMotion]);
|
|
879
|
+
const handleMouseLeave = (0, react.useCallback)(() => {
|
|
880
|
+
if (!isEnabled) return;
|
|
881
|
+
setIsHovered(false);
|
|
882
|
+
}, [isEnabled]);
|
|
883
|
+
const handleClick = (0, react.useCallback)((e) => {
|
|
884
|
+
if (!isEnabled) return;
|
|
885
|
+
if (hasDraggedRef.current) {
|
|
886
|
+
hasDraggedRef.current = false;
|
|
887
|
+
return;
|
|
888
|
+
}
|
|
889
|
+
e.stopPropagation();
|
|
890
|
+
onPeekClick();
|
|
891
|
+
}, [isEnabled, onPeekClick]);
|
|
892
|
+
const handlePointerDown = (0, react.useCallback)((e) => {
|
|
893
|
+
if (!isEnabled || !dragToDismiss) return;
|
|
894
|
+
if (e.pointerType === "mouse" && e.button !== 0) return;
|
|
895
|
+
pointerIdRef.current = e.pointerId;
|
|
896
|
+
e.target.setPointerCapture(e.pointerId);
|
|
897
|
+
startXRef.current = e.clientX;
|
|
898
|
+
startTimeRef.current = Date.now();
|
|
899
|
+
hasDraggedRef.current = false;
|
|
900
|
+
setIsDragging(true);
|
|
901
|
+
e.stopPropagation();
|
|
902
|
+
}, [isEnabled, dragToDismiss]);
|
|
903
|
+
const handlePointerMove = (0, react.useCallback)((e) => {
|
|
904
|
+
if (!isEnabled || pointerIdRef.current !== e.pointerId) return;
|
|
905
|
+
const deltaX = e.clientX - startXRef.current;
|
|
906
|
+
const clampedDelta = Math.max(0, deltaX);
|
|
907
|
+
if (clampedDelta > 5) hasDraggedRef.current = true;
|
|
908
|
+
setDragOffset(clampedDelta);
|
|
909
|
+
onPeekDrag?.(clampedDelta);
|
|
910
|
+
e.stopPropagation();
|
|
911
|
+
}, [isEnabled, onPeekDrag]);
|
|
912
|
+
const handlePointerUp = (0, react.useCallback)((e) => {
|
|
913
|
+
if (!isEnabled || pointerIdRef.current !== e.pointerId) return;
|
|
914
|
+
e.target.releasePointerCapture(e.pointerId);
|
|
915
|
+
const deltaX = e.clientX - startXRef.current;
|
|
916
|
+
const deltaTime = Date.now() - startTimeRef.current;
|
|
917
|
+
const velocity = deltaTime > 0 ? deltaX / deltaTime * 1e3 : 0;
|
|
918
|
+
if ((deltaX > dragThreshold || velocity > dragVelocityThreshold) && deltaX > 0) onPeekDragDismiss();
|
|
919
|
+
else onPeekDragCancel?.();
|
|
920
|
+
pointerIdRef.current = null;
|
|
921
|
+
setIsDragging(false);
|
|
922
|
+
setDragOffset(0);
|
|
923
|
+
e.stopPropagation();
|
|
924
|
+
}, [
|
|
925
|
+
isEnabled,
|
|
926
|
+
dragThreshold,
|
|
927
|
+
dragVelocityThreshold,
|
|
928
|
+
onPeekDragDismiss,
|
|
929
|
+
onPeekDragCancel
|
|
930
|
+
]);
|
|
931
|
+
const handlePointerCancel = (0, react.useCallback)((e) => {
|
|
932
|
+
if (pointerIdRef.current === e.pointerId) {
|
|
933
|
+
pointerIdRef.current = null;
|
|
934
|
+
setIsDragging(false);
|
|
935
|
+
setDragOffset(0);
|
|
936
|
+
onPeekDragCancel?.();
|
|
937
|
+
}
|
|
938
|
+
}, [onPeekDragCancel]);
|
|
939
|
+
return {
|
|
940
|
+
isHovered,
|
|
941
|
+
isDragging,
|
|
942
|
+
dragOffset,
|
|
943
|
+
hoverExpansion: isEnabled && !prefersReducedMotion ? hoverExpansion : 0,
|
|
944
|
+
handlers: {
|
|
945
|
+
onMouseEnter: handleMouseEnter,
|
|
946
|
+
onMouseLeave: handleMouseLeave,
|
|
947
|
+
onClick: handleClick,
|
|
948
|
+
onPointerDown: handlePointerDown,
|
|
949
|
+
onPointerMove: handlePointerMove,
|
|
950
|
+
onPointerUp: handlePointerUp,
|
|
951
|
+
onPointerCancel: handlePointerCancel
|
|
952
|
+
}
|
|
953
|
+
};
|
|
954
|
+
}
|
|
955
|
+
|
|
956
|
+
//#endregion
|
|
957
|
+
//#region src/components/stack/stack-card.tsx
|
|
958
|
+
/** Default hover expansion in pixels */
|
|
959
|
+
const DEFAULT_HOVER_EXPANSION = 48;
|
|
960
|
+
function StackCardInner({ card, index, totalCards, topCardWidth, animation, isMobile = false, renderHeader, peekGestureConfig, compressionRatio = 1, adjustedPeekOffset, dragX = 0, gestureBind, isPeekHovered = false, onPeekHoverStart, onPeekHoverEnd, peekDragOffset = 0, onPeekDragStart, onPeekDrag, onPeekDragEnd, isLastCard = false, className }) {
|
|
961
|
+
const { config, api, state } = useStackContext();
|
|
962
|
+
const prefersReducedMotion = (0, motion_react.useReducedMotion)();
|
|
963
|
+
const injectedProps = useCardInjectedProps(card.id);
|
|
964
|
+
const [isAnimationComplete, setAnimationComplete] = (0, react.useState)(prefersReducedMotion ?? false);
|
|
965
|
+
const handleAnimationComplete = (0, react.useCallback)(() => {
|
|
966
|
+
setAnimationComplete(true);
|
|
967
|
+
}, []);
|
|
968
|
+
const isTopCard = index === totalCards - 1;
|
|
969
|
+
const isSecondCard = index === totalCards - 2;
|
|
970
|
+
const hasPeekZone = !isTopCard && !isMobile && !(config.layoutMode === "side-by-side" && isSecondCard);
|
|
971
|
+
const zIndex = getCardZIndex(index, config.zIndexBase);
|
|
972
|
+
const effectivePeekOffset = adjustedPeekOffset ?? config.defaultPeekOffset;
|
|
973
|
+
const baseOffset = (0, react.useMemo)(() => getResponsiveCardOffset(index, totalCards, state.cards, config.layoutMode, topCardWidth, effectivePeekOffset, compressionRatio, typeof config.defaultWidth === "number" ? config.defaultWidth : 480), [
|
|
974
|
+
index,
|
|
975
|
+
totalCards,
|
|
976
|
+
state.cards,
|
|
977
|
+
config.layoutMode,
|
|
978
|
+
topCardWidth,
|
|
979
|
+
effectivePeekOffset,
|
|
980
|
+
compressionRatio,
|
|
981
|
+
config.defaultWidth
|
|
982
|
+
]);
|
|
983
|
+
const cardWidth = isMobile ? "100%" : normalizeWidth(card.width, config.defaultWidth);
|
|
984
|
+
const offsetTransition = createOffsetTransition(animation);
|
|
985
|
+
const handleClose = (0, react.useCallback)(() => {
|
|
986
|
+
api.dismiss(card.id);
|
|
987
|
+
}, [api, card.id]);
|
|
988
|
+
const handlePeekClick = (0, react.useCallback)(() => {
|
|
989
|
+
if (state.cards.slice(index + 1).some((c) => c.dismissable === false)) return;
|
|
990
|
+
api.popTo(card.id);
|
|
991
|
+
}, [
|
|
992
|
+
api,
|
|
993
|
+
card.id,
|
|
994
|
+
state.cards,
|
|
995
|
+
index
|
|
996
|
+
]);
|
|
997
|
+
const handlePeekDragDismiss = (0, react.useCallback)(() => {
|
|
998
|
+
if (state.cards.slice(index + 1).some((c) => c.dismissable === false)) return;
|
|
999
|
+
onPeekDragEnd?.(index, true);
|
|
1000
|
+
}, [
|
|
1001
|
+
index,
|
|
1002
|
+
onPeekDragEnd,
|
|
1003
|
+
state.cards
|
|
1004
|
+
]);
|
|
1005
|
+
const handlePeekDrag = (0, react.useCallback)((offset) => {
|
|
1006
|
+
onPeekDrag?.(index, offset);
|
|
1007
|
+
}, [index, onPeekDrag]);
|
|
1008
|
+
const handlePeekDragCancel = (0, react.useCallback)(() => {
|
|
1009
|
+
onPeekDragEnd?.(index, false);
|
|
1010
|
+
}, [index, onPeekDragEnd]);
|
|
1011
|
+
const handlePeekHoverStart = (0, react.useCallback)(() => {
|
|
1012
|
+
onPeekHoverStart?.(index);
|
|
1013
|
+
}, [index, onPeekHoverStart]);
|
|
1014
|
+
const handlePeekHoverEnd = (0, react.useCallback)(() => {
|
|
1015
|
+
onPeekHoverEnd?.(index);
|
|
1016
|
+
}, [index, onPeekHoverEnd]);
|
|
1017
|
+
const peekGestures = usePeekGestures({
|
|
1018
|
+
...peekGestureConfig,
|
|
1019
|
+
cardIndex: index,
|
|
1020
|
+
totalCards,
|
|
1021
|
+
onPeekClick: handlePeekClick,
|
|
1022
|
+
onPeekDragDismiss: handlePeekDragDismiss,
|
|
1023
|
+
onPeekDrag: handlePeekDrag,
|
|
1024
|
+
onPeekDragCancel: handlePeekDragCancel
|
|
1025
|
+
});
|
|
1026
|
+
const hoverExpansion = hasPeekZone && isPeekHovered && !peekGestures.isDragging && !prefersReducedMotion ? peekGestureConfig?.hoverExpansion ?? DEFAULT_HOVER_EXPANSION : 0;
|
|
1027
|
+
const xOffset = -baseOffset + dragX - hoverExpansion + peekDragOffset;
|
|
1028
|
+
const CardComponent = card.Component;
|
|
1029
|
+
const cardContent = (0, react.useMemo)(() => {
|
|
1030
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CardReadyProvider, {
|
|
1031
|
+
isAnimationComplete,
|
|
1032
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CardComponent, {
|
|
1033
|
+
...card.props,
|
|
1034
|
+
...injectedProps
|
|
1035
|
+
})
|
|
1036
|
+
});
|
|
1037
|
+
}, [
|
|
1038
|
+
CardComponent,
|
|
1039
|
+
card.props,
|
|
1040
|
+
injectedProps,
|
|
1041
|
+
isAnimationComplete
|
|
1042
|
+
]);
|
|
1043
|
+
const headerContent = renderHeader ? renderHeader(card, api) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StackHeader, {
|
|
1044
|
+
card,
|
|
1045
|
+
onClose: handleClose
|
|
1046
|
+
});
|
|
1047
|
+
const animateX = xOffset;
|
|
1048
|
+
const initialX = prefersReducedMotion ? xOffset : "100%";
|
|
1049
|
+
const exitX = prefersReducedMotion ? xOffset : "100%";
|
|
1050
|
+
const exitOpacity = prefersReducedMotion ? 0 : isLastCard ? 0 : 1;
|
|
1051
|
+
let activeTransition = offsetTransition;
|
|
1052
|
+
if (peekGestures.isDragging || peekDragOffset > 0) activeTransition = peekDragSpring;
|
|
1053
|
+
else if (isPeekHovered) activeTransition = peekHoverSpring;
|
|
1054
|
+
const exitAnimation = isLastCard && !prefersReducedMotion ? {
|
|
1055
|
+
x: exitX,
|
|
1056
|
+
opacity: exitOpacity,
|
|
1057
|
+
transition: lastCardExitTransition
|
|
1058
|
+
} : {
|
|
1059
|
+
x: exitX,
|
|
1060
|
+
opacity: exitOpacity
|
|
1061
|
+
};
|
|
1062
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(motion_react.motion.div, {
|
|
1063
|
+
"data-slot": "stack-card",
|
|
1064
|
+
"data-card-id": card.id,
|
|
1065
|
+
"data-card-index": index,
|
|
1066
|
+
"data-is-top": isTopCard,
|
|
1067
|
+
"data-offset": baseOffset,
|
|
1068
|
+
initial: {
|
|
1069
|
+
x: initialX,
|
|
1070
|
+
opacity: prefersReducedMotion ? 0 : 1
|
|
1071
|
+
},
|
|
1072
|
+
animate: {
|
|
1073
|
+
x: animateX,
|
|
1074
|
+
opacity: 1
|
|
1075
|
+
},
|
|
1076
|
+
exit: exitAnimation,
|
|
1077
|
+
transition: activeTransition,
|
|
1078
|
+
onAnimationComplete: handleAnimationComplete,
|
|
1079
|
+
style: {
|
|
1080
|
+
position: "fixed",
|
|
1081
|
+
top: 0,
|
|
1082
|
+
right: 0,
|
|
1083
|
+
height: "100dvh",
|
|
1084
|
+
width: cardWidth,
|
|
1085
|
+
zIndex,
|
|
1086
|
+
touchAction: isMobile ? "pan-y pinch-zoom" : void 0
|
|
1087
|
+
},
|
|
1088
|
+
className: require_utils.cn("flex flex-col", "bg-background", "shadow-lg", "border-l border-border/50", className),
|
|
1089
|
+
...isTopCard && isMobile && gestureBind ? gestureBind() : {},
|
|
1090
|
+
children: [
|
|
1091
|
+
hasPeekZone && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1092
|
+
"data-slot": "peek-zone",
|
|
1093
|
+
className: require_utils.cn("absolute inset-y-0", "cursor-pointer", isPeekHovered && "bg-primary/5", peekGestures.isDragging && "bg-primary/10"),
|
|
1094
|
+
style: {
|
|
1095
|
+
left: 0,
|
|
1096
|
+
width: isPeekHovered ? Math.max(32, baseOffset) + hoverExpansion : Math.max(32, baseOffset),
|
|
1097
|
+
zIndex: zIndex + 1,
|
|
1098
|
+
transition: "width 0.15s ease-out"
|
|
1099
|
+
},
|
|
1100
|
+
onMouseEnter: handlePeekHoverStart,
|
|
1101
|
+
onMouseLeave: handlePeekHoverEnd,
|
|
1102
|
+
onClick: peekGestures.handlers.onClick,
|
|
1103
|
+
onPointerDown: peekGestures.handlers.onPointerDown,
|
|
1104
|
+
onPointerMove: peekGestures.handlers.onPointerMove,
|
|
1105
|
+
onPointerUp: peekGestures.handlers.onPointerUp,
|
|
1106
|
+
onPointerCancel: peekGestures.handlers.onPointerCancel
|
|
1107
|
+
}),
|
|
1108
|
+
headerContent,
|
|
1109
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1110
|
+
"data-slot": "stack-card-content",
|
|
1111
|
+
className: "flex-1 overflow-auto",
|
|
1112
|
+
style: { touchAction: isMobile ? "pan-y pinch-zoom" : void 0 },
|
|
1113
|
+
...isTopCard && isMobile && gestureBind ? gestureBind() : {},
|
|
1114
|
+
children: cardContent
|
|
1115
|
+
})
|
|
1116
|
+
]
|
|
1117
|
+
});
|
|
1118
|
+
}
|
|
1119
|
+
const StackCard = (0, react.memo)(StackCardInner);
|
|
1120
|
+
|
|
1121
|
+
//#endregion
|
|
1122
|
+
//#region src/components/stack/use-stack-gestures.ts
|
|
1123
|
+
/** Distance threshold to trigger dismiss */
|
|
1124
|
+
const DEFAULT_SWIPE_THRESHOLD = 120;
|
|
1125
|
+
/** Velocity threshold for quick flick dismiss */
|
|
1126
|
+
const DEFAULT_VELOCITY_THRESHOLD = .6;
|
|
1127
|
+
/** Minimum drag distance before velocity dismiss can apply */
|
|
1128
|
+
const MIN_VELOCITY_DISTANCE = 60;
|
|
1129
|
+
/** Left edge zone to ignore (avoid iOS Safari back gesture conflict) */
|
|
1130
|
+
const EDGE_IGNORE_ZONE = 30;
|
|
1131
|
+
/**
|
|
1132
|
+
* Hook for swipe-to-dismiss gesture on stack cards using @use-gesture/react.
|
|
1133
|
+
*
|
|
1134
|
+
* Features:
|
|
1135
|
+
* - Only allows swiping to the right (positive X direction)
|
|
1136
|
+
* - Ignores touches near left edge (avoids iOS Safari back gesture conflict)
|
|
1137
|
+
* - Requires horizontal intent before activating (won't interfere with scroll)
|
|
1138
|
+
* - Dismisses on release after distance or velocity threshold
|
|
1139
|
+
* - Auto-dismisses near the end of the drag (configurable)
|
|
1140
|
+
* - 1:1 finger tracking for responsive feel
|
|
1141
|
+
*/
|
|
1142
|
+
function useStackGestures(options) {
|
|
1143
|
+
const { enabled = true, swipeToPop = true, swipeThreshold = DEFAULT_SWIPE_THRESHOLD, velocityThreshold = DEFAULT_VELOCITY_THRESHOLD, autoDismissThreshold, onDismiss } = options;
|
|
1144
|
+
const prefersReducedMotion = (0, motion_react.useReducedMotion)();
|
|
1145
|
+
const isEnabled = enabled && swipeToPop && !prefersReducedMotion;
|
|
1146
|
+
const [dragX, setDragX] = (0, react.useState)(0);
|
|
1147
|
+
const [isDragging, setIsDragging] = (0, react.useState)(false);
|
|
1148
|
+
const handleDismiss = (0, react.useCallback)(() => {
|
|
1149
|
+
onDismiss();
|
|
1150
|
+
}, [onDismiss]);
|
|
1151
|
+
const dismissedRef = (0, react.useRef)(false);
|
|
1152
|
+
const velocityMinDistance = Math.max(MIN_VELOCITY_DISTANCE, swipeThreshold * .25);
|
|
1153
|
+
return {
|
|
1154
|
+
dragX,
|
|
1155
|
+
isDragging,
|
|
1156
|
+
bind: (0, _use_gesture_react.useDrag)(({ active, movement: [mx], velocity: [vx], direction: [dx], initial: [initialX], xy: [currentX], cancel, first }) => {
|
|
1157
|
+
if (first && initialX < EDGE_IGNORE_ZONE) {
|
|
1158
|
+
cancel();
|
|
1159
|
+
return;
|
|
1160
|
+
}
|
|
1161
|
+
if (first) dismissedRef.current = false;
|
|
1162
|
+
const clampedX = Math.max(0, mx);
|
|
1163
|
+
if (active) {
|
|
1164
|
+
if (autoDismissThreshold !== void 0 && !dismissedRef.current && dx > 0 && clampedX >= 24 && currentX >= autoDismissThreshold) {
|
|
1165
|
+
dismissedRef.current = true;
|
|
1166
|
+
setDragX(0);
|
|
1167
|
+
setIsDragging(false);
|
|
1168
|
+
handleDismiss();
|
|
1169
|
+
cancel();
|
|
1170
|
+
return;
|
|
1171
|
+
}
|
|
1172
|
+
setDragX(clampedX);
|
|
1173
|
+
setIsDragging(true);
|
|
1174
|
+
return;
|
|
1175
|
+
}
|
|
1176
|
+
if (!dismissedRef.current) {
|
|
1177
|
+
if (dx > 0 && (clampedX > swipeThreshold || vx > velocityThreshold && clampedX > velocityMinDistance)) handleDismiss();
|
|
1178
|
+
}
|
|
1179
|
+
setDragX(0);
|
|
1180
|
+
setIsDragging(false);
|
|
1181
|
+
}, {
|
|
1182
|
+
enabled: isEnabled,
|
|
1183
|
+
threshold: 10,
|
|
1184
|
+
axis: "x",
|
|
1185
|
+
filterTaps: true,
|
|
1186
|
+
pointer: { touch: true }
|
|
1187
|
+
})
|
|
1188
|
+
};
|
|
1189
|
+
}
|
|
1190
|
+
|
|
1191
|
+
//#endregion
|
|
1192
|
+
//#region src/components/stack/use-stack-responsive.ts
|
|
1193
|
+
const DEFAULT_MOBILE_BREAKPOINT = 768;
|
|
1194
|
+
/**
|
|
1195
|
+
* Hook to detect mobile viewport and provide responsive information.
|
|
1196
|
+
*/
|
|
1197
|
+
function useStackResponsive(options = {}) {
|
|
1198
|
+
const { breakpoint = DEFAULT_MOBILE_BREAKPOINT } = options;
|
|
1199
|
+
const [state, setState] = (0, react.useState)(() => {
|
|
1200
|
+
if (typeof window === "undefined") return {
|
|
1201
|
+
isMobile: false,
|
|
1202
|
+
viewportWidth: 1024
|
|
1203
|
+
};
|
|
1204
|
+
const width = window.innerWidth;
|
|
1205
|
+
return {
|
|
1206
|
+
isMobile: width < breakpoint,
|
|
1207
|
+
viewportWidth: width
|
|
1208
|
+
};
|
|
1209
|
+
});
|
|
1210
|
+
const updateState = (0, react.useCallback)(() => {
|
|
1211
|
+
const width = window.innerWidth;
|
|
1212
|
+
setState((prev) => {
|
|
1213
|
+
const isMobile = width < breakpoint;
|
|
1214
|
+
if (prev.isMobile === isMobile && prev.viewportWidth === width) return prev;
|
|
1215
|
+
return {
|
|
1216
|
+
isMobile,
|
|
1217
|
+
viewportWidth: width
|
|
1218
|
+
};
|
|
1219
|
+
});
|
|
1220
|
+
}, [breakpoint]);
|
|
1221
|
+
(0, react.useEffect)(() => {
|
|
1222
|
+
updateState();
|
|
1223
|
+
window.addEventListener("resize", updateState);
|
|
1224
|
+
return () => window.removeEventListener("resize", updateState);
|
|
1225
|
+
}, [updateState]);
|
|
1226
|
+
return {
|
|
1227
|
+
isMobile: state.isMobile,
|
|
1228
|
+
viewportWidth: state.viewportWidth,
|
|
1229
|
+
breakpoint
|
|
1230
|
+
};
|
|
1231
|
+
}
|
|
1232
|
+
/**
|
|
1233
|
+
* Simple hook to just get isMobile boolean.
|
|
1234
|
+
*/
|
|
1235
|
+
function useIsMobile(breakpoint = DEFAULT_MOBILE_BREAKPOINT) {
|
|
1236
|
+
const { isMobile } = useStackResponsive({ breakpoint });
|
|
1237
|
+
return isMobile;
|
|
1238
|
+
}
|
|
1239
|
+
|
|
1240
|
+
//#endregion
|
|
1241
|
+
//#region src/components/stack/stack-viewport.tsx
|
|
1242
|
+
const DEFAULT_PEEK_DEPTH = 2;
|
|
1243
|
+
function CardStackViewport({ backdrop = true, renderBackdrop, renderHeader, renderEmpty, peekDepth = DEFAULT_PEEK_DEPTH, animation, mobile, peekGestures, className }) {
|
|
1244
|
+
const { config, api } = useStackContext();
|
|
1245
|
+
const cards = useStackCards();
|
|
1246
|
+
const { isMobile, viewportWidth } = useStackResponsive(mobile);
|
|
1247
|
+
const [peekDrag, setPeekDrag] = (0, react.useState)({
|
|
1248
|
+
sourceIndex: -1,
|
|
1249
|
+
offset: 0
|
|
1250
|
+
});
|
|
1251
|
+
const [peekHover, setPeekHover] = (0, react.useState)({ hoveredIndex: -1 });
|
|
1252
|
+
const hoverEndTimeoutRef = (0, react.useRef)(null);
|
|
1253
|
+
const prevCardCountRef = (0, react.useRef)(cards.length);
|
|
1254
|
+
const [exitComplete, setExitComplete] = (0, react.useState)(cards.length === 0);
|
|
1255
|
+
(0, react.useEffect)(() => {
|
|
1256
|
+
if (cards.length > 0) setExitComplete(false);
|
|
1257
|
+
}, [cards.length]);
|
|
1258
|
+
(0, react.useEffect)(() => {
|
|
1259
|
+
if (cards.length !== prevCardCountRef.current) {
|
|
1260
|
+
setPeekHover({ hoveredIndex: -1 });
|
|
1261
|
+
if (hoverEndTimeoutRef.current) {
|
|
1262
|
+
clearTimeout(hoverEndTimeoutRef.current);
|
|
1263
|
+
hoverEndTimeoutRef.current = null;
|
|
1264
|
+
}
|
|
1265
|
+
prevCardCountRef.current = cards.length;
|
|
1266
|
+
}
|
|
1267
|
+
}, [cards.length]);
|
|
1268
|
+
const handleExitComplete = (0, react.useCallback)(() => {
|
|
1269
|
+
setExitComplete(true);
|
|
1270
|
+
}, []);
|
|
1271
|
+
const cardWidths = (0, react.useMemo)(() => {
|
|
1272
|
+
if (cards.length === 0) return {
|
|
1273
|
+
topCardWidth: 0,
|
|
1274
|
+
secondCardWidth: 0
|
|
1275
|
+
};
|
|
1276
|
+
const topCard = cards[cards.length - 1];
|
|
1277
|
+
const topCardWidth = parseWidthToPixels(topCard.width ?? config.defaultWidth) ?? 480;
|
|
1278
|
+
const secondCard = cards.length > 1 ? cards[cards.length - 2] : null;
|
|
1279
|
+
return {
|
|
1280
|
+
topCardWidth,
|
|
1281
|
+
secondCardWidth: secondCard ? parseWidthToPixels(secondCard.width ?? config.defaultWidth) ?? 480 : 0
|
|
1282
|
+
};
|
|
1283
|
+
}, [cards, config.defaultWidth]);
|
|
1284
|
+
const responsiveOffset = (0, react.useMemo)(() => {
|
|
1285
|
+
return calculateResponsiveOffset({
|
|
1286
|
+
viewportWidth,
|
|
1287
|
+
topCardWidth: cardWidths.topCardWidth,
|
|
1288
|
+
secondCardWidth: cardWidths.secondCardWidth,
|
|
1289
|
+
totalCards: cards.length,
|
|
1290
|
+
defaultPeekOffset: config.defaultPeekOffset,
|
|
1291
|
+
layoutMode: config.layoutMode
|
|
1292
|
+
});
|
|
1293
|
+
}, [
|
|
1294
|
+
viewportWidth,
|
|
1295
|
+
cardWidths,
|
|
1296
|
+
cards.length,
|
|
1297
|
+
config.defaultPeekOffset,
|
|
1298
|
+
config.layoutMode
|
|
1299
|
+
]);
|
|
1300
|
+
const useFullScreen = isMobile || responsiveOffset.shouldCollapse;
|
|
1301
|
+
const handleDismiss = (0, react.useCallback)(() => {
|
|
1302
|
+
if (api.top()?.dismissable === false) return;
|
|
1303
|
+
api.pop();
|
|
1304
|
+
}, [api]);
|
|
1305
|
+
const swipeThreshold = mobile?.gestures?.swipeThreshold ?? Math.max(120, Math.round(viewportWidth * .35));
|
|
1306
|
+
const autoDismissThreshold = mobile?.gestures?.autoDismissThreshold ?? Math.max(swipeThreshold, Math.round(viewportWidth * .8));
|
|
1307
|
+
const { dragX, bind: gestureBind } = useStackGestures({
|
|
1308
|
+
enabled: useFullScreen && cards.length > 0,
|
|
1309
|
+
...mobile?.gestures,
|
|
1310
|
+
swipeThreshold,
|
|
1311
|
+
autoDismissThreshold,
|
|
1312
|
+
onDismiss: handleDismiss
|
|
1313
|
+
});
|
|
1314
|
+
const handlePeekHoverStart = (0, react.useCallback)((cardIndex) => {
|
|
1315
|
+
if (hoverEndTimeoutRef.current) {
|
|
1316
|
+
clearTimeout(hoverEndTimeoutRef.current);
|
|
1317
|
+
hoverEndTimeoutRef.current = null;
|
|
1318
|
+
}
|
|
1319
|
+
setPeekHover({ hoveredIndex: cardIndex });
|
|
1320
|
+
}, []);
|
|
1321
|
+
const handlePeekHoverEnd = (0, react.useCallback)((cardIndex) => {
|
|
1322
|
+
if (hoverEndTimeoutRef.current) clearTimeout(hoverEndTimeoutRef.current);
|
|
1323
|
+
hoverEndTimeoutRef.current = setTimeout(() => {
|
|
1324
|
+
setPeekHover((prev) => prev.hoveredIndex === cardIndex ? { hoveredIndex: -1 } : prev);
|
|
1325
|
+
hoverEndTimeoutRef.current = null;
|
|
1326
|
+
}, 100);
|
|
1327
|
+
}, []);
|
|
1328
|
+
const handlePeekDrag = (0, react.useCallback)((cardIndex, offset) => {
|
|
1329
|
+
setPeekDrag({
|
|
1330
|
+
sourceIndex: cardIndex,
|
|
1331
|
+
offset
|
|
1332
|
+
});
|
|
1333
|
+
}, []);
|
|
1334
|
+
const handlePeekDragEnd = (0, react.useCallback)((cardIndex, shouldDismiss) => {
|
|
1335
|
+
if (shouldDismiss) {
|
|
1336
|
+
if (cards.slice(cardIndex + 1).some((c) => c.dismissable === false)) {
|
|
1337
|
+
setPeekDrag({
|
|
1338
|
+
sourceIndex: -1,
|
|
1339
|
+
offset: 0
|
|
1340
|
+
});
|
|
1341
|
+
return;
|
|
1342
|
+
}
|
|
1343
|
+
const card = cards[cardIndex];
|
|
1344
|
+
if (card) api.popTo(card.id);
|
|
1345
|
+
}
|
|
1346
|
+
setPeekDrag({
|
|
1347
|
+
sourceIndex: -1,
|
|
1348
|
+
offset: 0
|
|
1349
|
+
});
|
|
1350
|
+
}, [api, cards]);
|
|
1351
|
+
const visibleCards = (0, react.useMemo)(() => {
|
|
1352
|
+
return cards.filter((_, index) => isCardVisible(index, cards.length, peekDepth));
|
|
1353
|
+
}, [cards, peekDepth]);
|
|
1354
|
+
const portalContainer = (0, _constructive_io_ui_portal.useRootPortalContainer)();
|
|
1355
|
+
const renderBackdropNode = (config) => {
|
|
1356
|
+
const defaultBackdrop = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StackBackdrop, {
|
|
1357
|
+
className: "pointer-events-auto",
|
|
1358
|
+
config
|
|
1359
|
+
}, "backdrop");
|
|
1360
|
+
if (renderBackdrop) {
|
|
1361
|
+
const customBackdrop = renderBackdrop();
|
|
1362
|
+
return react.isValidElement(customBackdrop) ? react.cloneElement(customBackdrop, { key: "backdrop" }) : defaultBackdrop;
|
|
1363
|
+
}
|
|
1364
|
+
return defaultBackdrop;
|
|
1365
|
+
};
|
|
1366
|
+
const hasCards = cards.length > 0;
|
|
1367
|
+
const resolvedBackdrop = (0, react.useMemo)(() => {
|
|
1368
|
+
const cardBackdrop = cards[0]?.backdrop;
|
|
1369
|
+
if (cardBackdrop !== void 0) {
|
|
1370
|
+
if (cardBackdrop === false) return {
|
|
1371
|
+
enabled: false,
|
|
1372
|
+
config: void 0
|
|
1373
|
+
};
|
|
1374
|
+
if (cardBackdrop === true) return {
|
|
1375
|
+
enabled: true,
|
|
1376
|
+
config: void 0
|
|
1377
|
+
};
|
|
1378
|
+
return {
|
|
1379
|
+
enabled: true,
|
|
1380
|
+
config: cardBackdrop
|
|
1381
|
+
};
|
|
1382
|
+
}
|
|
1383
|
+
if (backdrop === false) return {
|
|
1384
|
+
enabled: false,
|
|
1385
|
+
config: void 0
|
|
1386
|
+
};
|
|
1387
|
+
if (backdrop === true) return {
|
|
1388
|
+
enabled: true,
|
|
1389
|
+
config: void 0
|
|
1390
|
+
};
|
|
1391
|
+
return {
|
|
1392
|
+
enabled: true,
|
|
1393
|
+
config: backdrop
|
|
1394
|
+
};
|
|
1395
|
+
}, [cards, backdrop]);
|
|
1396
|
+
const shouldShowBackdrop = resolvedBackdrop.enabled;
|
|
1397
|
+
if (!hasCards && exitComplete) return renderEmpty ? renderEmpty() : null;
|
|
1398
|
+
const content = /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1399
|
+
"data-slot": "stack-viewport",
|
|
1400
|
+
className: require_utils.cn("pointer-events-none fixed inset-0", className),
|
|
1401
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(motion_react.AnimatePresence, {
|
|
1402
|
+
initial: false,
|
|
1403
|
+
mode: "popLayout",
|
|
1404
|
+
onExitComplete: handleExitComplete,
|
|
1405
|
+
children: [shouldShowBackdrop && hasCards && renderBackdropNode(resolvedBackdrop.config), visibleCards.map((card, visibleIndex) => {
|
|
1406
|
+
const actualIndex = cards.length - visibleCards.length + visibleIndex;
|
|
1407
|
+
const isTopCard = actualIndex === cards.length - 1;
|
|
1408
|
+
const isLastCard = cards.length === 1 && isTopCard;
|
|
1409
|
+
const peekDragOffset = peekDrag.sourceIndex >= 0 && actualIndex > peekDrag.sourceIndex ? peekDrag.offset : 0;
|
|
1410
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StackCard, {
|
|
1411
|
+
card,
|
|
1412
|
+
index: actualIndex,
|
|
1413
|
+
totalCards: cards.length,
|
|
1414
|
+
topCardWidth: cardWidths.topCardWidth,
|
|
1415
|
+
animation,
|
|
1416
|
+
isMobile: useFullScreen,
|
|
1417
|
+
renderHeader,
|
|
1418
|
+
peekGestureConfig: peekGestures,
|
|
1419
|
+
compressionRatio: responsiveOffset.compressionRatio,
|
|
1420
|
+
adjustedPeekOffset: responsiveOffset.adjustedPeekOffset,
|
|
1421
|
+
dragX: isTopCard ? dragX : 0,
|
|
1422
|
+
gestureBind: isTopCard ? gestureBind : void 0,
|
|
1423
|
+
isPeekHovered: peekHover.hoveredIndex === actualIndex,
|
|
1424
|
+
onPeekHoverStart: handlePeekHoverStart,
|
|
1425
|
+
onPeekHoverEnd: handlePeekHoverEnd,
|
|
1426
|
+
peekDragOffset,
|
|
1427
|
+
onPeekDrag: handlePeekDrag,
|
|
1428
|
+
onPeekDragEnd: handlePeekDragEnd,
|
|
1429
|
+
isLastCard,
|
|
1430
|
+
className: "pointer-events-auto"
|
|
1431
|
+
}, card.id);
|
|
1432
|
+
})]
|
|
1433
|
+
})
|
|
1434
|
+
});
|
|
1435
|
+
if (portalContainer) return (0, react_dom.createPortal)(content, portalContainer);
|
|
1436
|
+
return content;
|
|
1437
|
+
}
|
|
1438
|
+
|
|
1439
|
+
//#endregion
|
|
1440
|
+
//#region src/components/stack/deferred-card-content.tsx
|
|
1441
|
+
/**
|
|
1442
|
+
* Defers rendering of heavy content until after Stack card animation completes.
|
|
1443
|
+
* This prevents layout thrashing and dropped frames during the slide-in animation.
|
|
1444
|
+
*
|
|
1445
|
+
* Usage:
|
|
1446
|
+
* ```tsx
|
|
1447
|
+
* <DeferredCardContent placeholder={<MySkeleton />}>
|
|
1448
|
+
* <HeavyContent />
|
|
1449
|
+
* </DeferredCardContent>
|
|
1450
|
+
* ```
|
|
1451
|
+
*
|
|
1452
|
+
* With priority:
|
|
1453
|
+
* ```tsx
|
|
1454
|
+
* <DeferredCardContent priority="low" placeholder={<MySkeleton />}>
|
|
1455
|
+
* <NonCriticalContent />
|
|
1456
|
+
* </DeferredCardContent>
|
|
1457
|
+
* ```
|
|
1458
|
+
*/
|
|
1459
|
+
function DeferredCardContent({ children, placeholder, delay = 220, immediate = false, priority = "normal", onReady }) {
|
|
1460
|
+
const [ready, setReady] = (0, react.useState)(immediate);
|
|
1461
|
+
(0, react.useEffect)(() => {
|
|
1462
|
+
if (immediate) {
|
|
1463
|
+
onReady?.();
|
|
1464
|
+
return;
|
|
1465
|
+
}
|
|
1466
|
+
let cancelled = false;
|
|
1467
|
+
const scheduleReady = () => {
|
|
1468
|
+
if (cancelled) return;
|
|
1469
|
+
setReady(true);
|
|
1470
|
+
onReady?.();
|
|
1471
|
+
};
|
|
1472
|
+
const effectiveDelay = priority === "high" ? Math.floor(delay / 2) : delay;
|
|
1473
|
+
if (priority === "low" && "requestIdleCallback" in window) {
|
|
1474
|
+
const timeoutId = setTimeout(() => {
|
|
1475
|
+
const idleId = window.requestIdleCallback(scheduleReady, { timeout: effectiveDelay });
|
|
1476
|
+
return () => window.cancelIdleCallback(idleId);
|
|
1477
|
+
}, effectiveDelay);
|
|
1478
|
+
return () => {
|
|
1479
|
+
cancelled = true;
|
|
1480
|
+
clearTimeout(timeoutId);
|
|
1481
|
+
};
|
|
1482
|
+
}
|
|
1483
|
+
const timeoutId = setTimeout(() => {
|
|
1484
|
+
const rafId = requestAnimationFrame(scheduleReady);
|
|
1485
|
+
return () => cancelAnimationFrame(rafId);
|
|
1486
|
+
}, effectiveDelay);
|
|
1487
|
+
return () => {
|
|
1488
|
+
cancelled = true;
|
|
1489
|
+
clearTimeout(timeoutId);
|
|
1490
|
+
};
|
|
1491
|
+
}, [
|
|
1492
|
+
delay,
|
|
1493
|
+
immediate,
|
|
1494
|
+
priority,
|
|
1495
|
+
onReady
|
|
1496
|
+
]);
|
|
1497
|
+
if (!ready) return placeholder ?? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DefaultCardSkeleton, {});
|
|
1498
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, { children });
|
|
1499
|
+
}
|
|
1500
|
+
/**
|
|
1501
|
+
* Default skeleton placeholder for card content.
|
|
1502
|
+
* Shows a reasonable loading state for typical form-based cards.
|
|
1503
|
+
*/
|
|
1504
|
+
function DefaultCardSkeleton() {
|
|
1505
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1506
|
+
className: "space-y-6 p-6",
|
|
1507
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1508
|
+
className: "flex items-center justify-center py-4",
|
|
1509
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_skeleton.Skeleton, { className: "h-24 w-48 rounded-lg" })
|
|
1510
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1511
|
+
className: "space-y-4",
|
|
1512
|
+
children: [
|
|
1513
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1514
|
+
className: "space-y-2",
|
|
1515
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_skeleton.Skeleton, { className: "h-4 w-20" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_skeleton.Skeleton, { className: "h-10 w-full" })]
|
|
1516
|
+
}),
|
|
1517
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1518
|
+
className: "space-y-2",
|
|
1519
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_skeleton.Skeleton, { className: "h-4 w-16" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_skeleton.Skeleton, { className: "h-10 w-full" })]
|
|
1520
|
+
}),
|
|
1521
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1522
|
+
className: "space-y-2",
|
|
1523
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_skeleton.Skeleton, { className: "h-4 w-24" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_skeleton.Skeleton, { className: "h-10 w-full" })]
|
|
1524
|
+
})
|
|
1525
|
+
]
|
|
1526
|
+
})]
|
|
1527
|
+
});
|
|
1528
|
+
}
|
|
1529
|
+
|
|
1530
|
+
//#endregion
|
|
1531
|
+
Object.defineProperty(exports, 'CardStackProvider', {
|
|
1532
|
+
enumerable: true,
|
|
1533
|
+
get: function () {
|
|
1534
|
+
return CardStackProvider;
|
|
1535
|
+
}
|
|
1536
|
+
});
|
|
1537
|
+
Object.defineProperty(exports, 'CardStackViewport', {
|
|
1538
|
+
enumerable: true,
|
|
1539
|
+
get: function () {
|
|
1540
|
+
return CardStackViewport;
|
|
1541
|
+
}
|
|
1542
|
+
});
|
|
1543
|
+
Object.defineProperty(exports, 'DEFAULT_ANIMATION_CONFIG', {
|
|
1544
|
+
enumerable: true,
|
|
1545
|
+
get: function () {
|
|
1546
|
+
return DEFAULT_ANIMATION_CONFIG;
|
|
1547
|
+
}
|
|
1548
|
+
});
|
|
1549
|
+
Object.defineProperty(exports, 'DeferredCardContent', {
|
|
1550
|
+
enumerable: true,
|
|
1551
|
+
get: function () {
|
|
1552
|
+
return DeferredCardContent;
|
|
1553
|
+
}
|
|
1554
|
+
});
|
|
1555
|
+
Object.defineProperty(exports, 'StackBackdrop', {
|
|
1556
|
+
enumerable: true,
|
|
1557
|
+
get: function () {
|
|
1558
|
+
return StackBackdrop;
|
|
1559
|
+
}
|
|
1560
|
+
});
|
|
1561
|
+
Object.defineProperty(exports, 'StackCard', {
|
|
1562
|
+
enumerable: true,
|
|
1563
|
+
get: function () {
|
|
1564
|
+
return StackCard;
|
|
1565
|
+
}
|
|
1566
|
+
});
|
|
1567
|
+
Object.defineProperty(exports, 'StackHeader', {
|
|
1568
|
+
enumerable: true,
|
|
1569
|
+
get: function () {
|
|
1570
|
+
return StackHeader;
|
|
1571
|
+
}
|
|
1572
|
+
});
|
|
1573
|
+
Object.defineProperty(exports, 'StackHeaderSlot', {
|
|
1574
|
+
enumerable: true,
|
|
1575
|
+
get: function () {
|
|
1576
|
+
return StackHeaderSlot;
|
|
1577
|
+
}
|
|
1578
|
+
});
|
|
1579
|
+
Object.defineProperty(exports, 'backdropVariants', {
|
|
1580
|
+
enumerable: true,
|
|
1581
|
+
get: function () {
|
|
1582
|
+
return backdropVariants;
|
|
1583
|
+
}
|
|
1584
|
+
});
|
|
1585
|
+
Object.defineProperty(exports, 'calculateResponsiveOffset', {
|
|
1586
|
+
enumerable: true,
|
|
1587
|
+
get: function () {
|
|
1588
|
+
return calculateResponsiveOffset;
|
|
1589
|
+
}
|
|
1590
|
+
});
|
|
1591
|
+
Object.defineProperty(exports, 'createCardVariants', {
|
|
1592
|
+
enumerable: true,
|
|
1593
|
+
get: function () {
|
|
1594
|
+
return createCardVariants;
|
|
1595
|
+
}
|
|
1596
|
+
});
|
|
1597
|
+
Object.defineProperty(exports, 'createOffsetTransition', {
|
|
1598
|
+
enumerable: true,
|
|
1599
|
+
get: function () {
|
|
1600
|
+
return createOffsetTransition;
|
|
1601
|
+
}
|
|
1602
|
+
});
|
|
1603
|
+
Object.defineProperty(exports, 'createReducedMotionVariants', {
|
|
1604
|
+
enumerable: true,
|
|
1605
|
+
get: function () {
|
|
1606
|
+
return createReducedMotionVariants;
|
|
1607
|
+
}
|
|
1608
|
+
});
|
|
1609
|
+
Object.defineProperty(exports, 'getCardOffset', {
|
|
1610
|
+
enumerable: true,
|
|
1611
|
+
get: function () {
|
|
1612
|
+
return getCardOffset;
|
|
1613
|
+
}
|
|
1614
|
+
});
|
|
1615
|
+
Object.defineProperty(exports, 'getCardZIndex', {
|
|
1616
|
+
enumerable: true,
|
|
1617
|
+
get: function () {
|
|
1618
|
+
return getCardZIndex;
|
|
1619
|
+
}
|
|
1620
|
+
});
|
|
1621
|
+
Object.defineProperty(exports, 'getCascadeOffset', {
|
|
1622
|
+
enumerable: true,
|
|
1623
|
+
get: function () {
|
|
1624
|
+
return getCascadeOffset;
|
|
1625
|
+
}
|
|
1626
|
+
});
|
|
1627
|
+
Object.defineProperty(exports, 'getResponsiveCardOffset', {
|
|
1628
|
+
enumerable: true,
|
|
1629
|
+
get: function () {
|
|
1630
|
+
return getResponsiveCardOffset;
|
|
1631
|
+
}
|
|
1632
|
+
});
|
|
1633
|
+
Object.defineProperty(exports, 'getSideBySideOffset', {
|
|
1634
|
+
enumerable: true,
|
|
1635
|
+
get: function () {
|
|
1636
|
+
return getSideBySideOffset;
|
|
1637
|
+
}
|
|
1638
|
+
});
|
|
1639
|
+
Object.defineProperty(exports, 'getVisibleCardIndices', {
|
|
1640
|
+
enumerable: true,
|
|
1641
|
+
get: function () {
|
|
1642
|
+
return getVisibleCardIndices;
|
|
1643
|
+
}
|
|
1644
|
+
});
|
|
1645
|
+
Object.defineProperty(exports, 'isCardVisible', {
|
|
1646
|
+
enumerable: true,
|
|
1647
|
+
get: function () {
|
|
1648
|
+
return isCardVisible;
|
|
1649
|
+
}
|
|
1650
|
+
});
|
|
1651
|
+
Object.defineProperty(exports, 'normalizeWidth', {
|
|
1652
|
+
enumerable: true,
|
|
1653
|
+
get: function () {
|
|
1654
|
+
return normalizeWidth;
|
|
1655
|
+
}
|
|
1656
|
+
});
|
|
1657
|
+
Object.defineProperty(exports, 'parseWidthToPixels', {
|
|
1658
|
+
enumerable: true,
|
|
1659
|
+
get: function () {
|
|
1660
|
+
return parseWidthToPixels;
|
|
1661
|
+
}
|
|
1662
|
+
});
|
|
1663
|
+
Object.defineProperty(exports, 'peekDragSpring', {
|
|
1664
|
+
enumerable: true,
|
|
1665
|
+
get: function () {
|
|
1666
|
+
return peekDragSpring;
|
|
1667
|
+
}
|
|
1668
|
+
});
|
|
1669
|
+
Object.defineProperty(exports, 'peekHoverSpring', {
|
|
1670
|
+
enumerable: true,
|
|
1671
|
+
get: function () {
|
|
1672
|
+
return peekHoverSpring;
|
|
1673
|
+
}
|
|
1674
|
+
});
|
|
1675
|
+
Object.defineProperty(exports, 'peekSlideSpring', {
|
|
1676
|
+
enumerable: true,
|
|
1677
|
+
get: function () {
|
|
1678
|
+
return peekSlideSpring;
|
|
1679
|
+
}
|
|
1680
|
+
});
|
|
1681
|
+
Object.defineProperty(exports, 'reducedMotionBackdropVariants', {
|
|
1682
|
+
enumerable: true,
|
|
1683
|
+
get: function () {
|
|
1684
|
+
return reducedMotionBackdropVariants;
|
|
1685
|
+
}
|
|
1686
|
+
});
|
|
1687
|
+
Object.defineProperty(exports, 'snapBackSpring', {
|
|
1688
|
+
enumerable: true,
|
|
1689
|
+
get: function () {
|
|
1690
|
+
return snapBackSpring;
|
|
1691
|
+
}
|
|
1692
|
+
});
|
|
1693
|
+
Object.defineProperty(exports, 'swipeDismissTransition', {
|
|
1694
|
+
enumerable: true,
|
|
1695
|
+
get: function () {
|
|
1696
|
+
return swipeDismissTransition;
|
|
1697
|
+
}
|
|
1698
|
+
});
|
|
1699
|
+
Object.defineProperty(exports, 'useCardIndex', {
|
|
1700
|
+
enumerable: true,
|
|
1701
|
+
get: function () {
|
|
1702
|
+
return useCardIndex;
|
|
1703
|
+
}
|
|
1704
|
+
});
|
|
1705
|
+
Object.defineProperty(exports, 'useCardInjectedProps', {
|
|
1706
|
+
enumerable: true,
|
|
1707
|
+
get: function () {
|
|
1708
|
+
return useCardInjectedProps;
|
|
1709
|
+
}
|
|
1710
|
+
});
|
|
1711
|
+
Object.defineProperty(exports, 'useCardReady', {
|
|
1712
|
+
enumerable: true,
|
|
1713
|
+
get: function () {
|
|
1714
|
+
return useCardReady;
|
|
1715
|
+
}
|
|
1716
|
+
});
|
|
1717
|
+
Object.defineProperty(exports, 'useCardStack', {
|
|
1718
|
+
enumerable: true,
|
|
1719
|
+
get: function () {
|
|
1720
|
+
return useCardStack;
|
|
1721
|
+
}
|
|
1722
|
+
});
|
|
1723
|
+
Object.defineProperty(exports, 'useIsMobile', {
|
|
1724
|
+
enumerable: true,
|
|
1725
|
+
get: function () {
|
|
1726
|
+
return useIsMobile;
|
|
1727
|
+
}
|
|
1728
|
+
});
|
|
1729
|
+
Object.defineProperty(exports, 'useIsTopCard', {
|
|
1730
|
+
enumerable: true,
|
|
1731
|
+
get: function () {
|
|
1732
|
+
return useIsTopCard;
|
|
1733
|
+
}
|
|
1734
|
+
});
|
|
1735
|
+
Object.defineProperty(exports, 'usePeekGestures', {
|
|
1736
|
+
enumerable: true,
|
|
1737
|
+
get: function () {
|
|
1738
|
+
return usePeekGestures;
|
|
1739
|
+
}
|
|
1740
|
+
});
|
|
1741
|
+
Object.defineProperty(exports, 'useStackCards', {
|
|
1742
|
+
enumerable: true,
|
|
1743
|
+
get: function () {
|
|
1744
|
+
return useStackCards;
|
|
1745
|
+
}
|
|
1746
|
+
});
|
|
1747
|
+
Object.defineProperty(exports, 'useStackContext', {
|
|
1748
|
+
enumerable: true,
|
|
1749
|
+
get: function () {
|
|
1750
|
+
return useStackContext;
|
|
1751
|
+
}
|
|
1752
|
+
});
|
|
1753
|
+
Object.defineProperty(exports, 'useStackGestures', {
|
|
1754
|
+
enumerable: true,
|
|
1755
|
+
get: function () {
|
|
1756
|
+
return useStackGestures;
|
|
1757
|
+
}
|
|
1758
|
+
});
|
|
1759
|
+
Object.defineProperty(exports, 'useStackLayoutMode', {
|
|
1760
|
+
enumerable: true,
|
|
1761
|
+
get: function () {
|
|
1762
|
+
return useStackLayoutMode;
|
|
1763
|
+
}
|
|
1764
|
+
});
|
|
1765
|
+
Object.defineProperty(exports, 'useStackResponsive', {
|
|
1766
|
+
enumerable: true,
|
|
1767
|
+
get: function () {
|
|
1768
|
+
return useStackResponsive;
|
|
1769
|
+
}
|
|
1770
|
+
});
|
|
1771
|
+
//# sourceMappingURL=stack-DKdvlOM6.cjs.map
|