@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
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import * as React$1 from "react";
|
|
2
|
+
//#region src/components/portal.d.ts
|
|
4
3
|
/**
|
|
5
4
|
* Overlay layer type:
|
|
6
5
|
* - 'base': Root level (page content, base floating elements)
|
|
@@ -20,14 +19,16 @@ type FloatingPortalStrategy = 'root' | 'nested';
|
|
|
20
19
|
*/
|
|
21
20
|
type FloatingZIndex = 'default' | 'elevated';
|
|
22
21
|
interface PortalContextValue {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
22
|
+
/** Current overlay layer */
|
|
23
|
+
layer: OverlayLayer;
|
|
24
|
+
/** Modal nesting depth (0 for first modal, 1 for nested, etc.) */
|
|
25
|
+
depth: number;
|
|
26
|
+
/** Strategy for where floating overlays should portal */
|
|
27
|
+
floatingPortalStrategy: FloatingPortalStrategy;
|
|
28
|
+
/** Z-index mode for floating overlays */
|
|
29
|
+
floatingZIndex: FloatingZIndex;
|
|
30
|
+
/** Explicit host for floating overlays when the modal primitive is not Base UI. */
|
|
31
|
+
floatingContainer?: HTMLElement;
|
|
31
32
|
}
|
|
32
33
|
declare const PORTAL_ROOT_ID = "portal-root";
|
|
33
34
|
/**
|
|
@@ -47,11 +48,12 @@ declare const PORTAL_ROOT_ID = "portal-root";
|
|
|
47
48
|
* </DialogPopup>
|
|
48
49
|
* ```
|
|
49
50
|
*/
|
|
50
|
-
declare function ModalPortalScope({ children, floatingPortalStrategy, floatingZIndex, }: {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
51
|
+
declare function ModalPortalScope({ children, floatingPortalStrategy, floatingZIndex, floatingContainer }: {
|
|
52
|
+
children: React$1.ReactNode;
|
|
53
|
+
floatingPortalStrategy?: FloatingPortalStrategy;
|
|
54
|
+
floatingZIndex?: FloatingZIndex;
|
|
55
|
+
floatingContainer?: HTMLElement | null;
|
|
56
|
+
}): React$1.JSX.Element;
|
|
55
57
|
/**
|
|
56
58
|
* Get the current portal context value.
|
|
57
59
|
* Used internally by other hooks.
|
|
@@ -62,7 +64,12 @@ declare function useInModalOverlay(): boolean;
|
|
|
62
64
|
* Get the root portal container element.
|
|
63
65
|
* Used by modal components (Dialog, Sheet, etc.) to render their portals.
|
|
64
66
|
*
|
|
65
|
-
*
|
|
67
|
+
* Reads `#portal-root` synchronously on the client so mount-on-open overlays
|
|
68
|
+
* (menus, selects, popovers, tooltips) get a real container on their first
|
|
69
|
+
* paint. A null→element handoff after layout effect is too late for Base UI
|
|
70
|
+
* portals that only mount while open — they stay empty forever.
|
|
71
|
+
*
|
|
72
|
+
* @returns The root portal container, or null during SSR / when unmounted
|
|
66
73
|
*/
|
|
67
74
|
declare function useRootPortalContainer(): HTMLElement | null;
|
|
68
75
|
/**
|
|
@@ -71,10 +78,12 @@ declare function useRootPortalContainer(): HTMLElement | null;
|
|
|
71
78
|
* - When `floatingPortalStrategy` is 'nested', Base UI will automatically portal
|
|
72
79
|
* into the nearest Base UI portal node (so dialog "inert" behavior includes it).
|
|
73
80
|
* - When it's 'root', we portal into #portal-root.
|
|
81
|
+
* - When the root is not ready yet, pass `undefined` (not `null`) so Base UI
|
|
82
|
+
* falls back to `document.body` instead of rendering into a dead portal.
|
|
74
83
|
*/
|
|
75
84
|
declare function useFloatingOverlayPortalProps(): {
|
|
76
|
-
|
|
77
|
-
|
|
85
|
+
container?: HTMLElement;
|
|
86
|
+
zIndexClass: string;
|
|
78
87
|
};
|
|
79
88
|
/**
|
|
80
89
|
* Portal root component to render in app layout.
|
|
@@ -82,7 +91,7 @@ declare function useFloatingOverlayPortalProps(): {
|
|
|
82
91
|
*
|
|
83
92
|
* Usage in layout.tsx:
|
|
84
93
|
* ```tsx
|
|
85
|
-
* import { PortalRoot } from '
|
|
94
|
+
* import { PortalRoot } from '@/components/ui/portal';
|
|
86
95
|
*
|
|
87
96
|
* export default function RootLayout({ children }) {
|
|
88
97
|
* return (
|
|
@@ -96,7 +105,7 @@ declare function useFloatingOverlayPortalProps(): {
|
|
|
96
105
|
* }
|
|
97
106
|
* ```
|
|
98
107
|
*/
|
|
99
|
-
declare function PortalRoot():
|
|
108
|
+
declare function PortalRoot(): React$1.JSX.Element;
|
|
100
109
|
/**
|
|
101
110
|
* Hook to get the portal container element for rendering floating UI elements.
|
|
102
111
|
* Returns the element with id="portal-root" if it exists in the DOM.
|
|
@@ -104,5 +113,6 @@ declare function PortalRoot(): react_jsx_runtime.JSX.Element;
|
|
|
104
113
|
* @deprecated Use useRootPortalContainer or useFloatingOverlayPortalProps instead
|
|
105
114
|
*/
|
|
106
115
|
declare function usePortalContainer(): HTMLElement | undefined;
|
|
107
|
-
|
|
108
|
-
export {
|
|
116
|
+
//#endregion
|
|
117
|
+
export { FloatingPortalStrategy, FloatingZIndex, ModalPortalScope, OverlayLayer, PORTAL_ROOT_ID, PortalRoot, useFloatingOverlayPortalProps, useInModalOverlay, usePortalContainer, usePortalContext, useRootPortalContainer };
|
|
118
|
+
//# sourceMappingURL=portal.d.ts.map
|
|
@@ -1,75 +1,146 @@
|
|
|
1
|
-
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
import { jsx } from 'react/jsx-runtime';
|
|
1
|
+
'use client';
|
|
4
2
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
3
|
+
import * as React$1 from "react";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
|
|
6
|
+
//#region src/components/portal.tsx
|
|
7
|
+
const PORTAL_ROOT_ID = "portal-root";
|
|
8
|
+
const PortalContext = React$1.createContext({
|
|
9
|
+
layer: "base",
|
|
10
|
+
depth: 0,
|
|
11
|
+
floatingPortalStrategy: "root",
|
|
12
|
+
floatingZIndex: "default"
|
|
11
13
|
});
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
14
|
+
/**
|
|
15
|
+
* Provider for modal overlays (Dialog, Sheet, Drawer, etc.)
|
|
16
|
+
*
|
|
17
|
+
* Wraps modal content to:
|
|
18
|
+
* 1. Create a scoped portal container for nested floating elements
|
|
19
|
+
* 2. Track the overlay layer (so floating elements know to use elevated z-index)
|
|
20
|
+
* 3. Track nesting depth for stacked modals
|
|
21
|
+
*
|
|
22
|
+
* Usage:
|
|
23
|
+
* ```tsx
|
|
24
|
+
* <DialogPopup>
|
|
25
|
+
* <ModalPortalScope>
|
|
26
|
+
* {children} // Popovers inside here will render in the scoped container
|
|
27
|
+
* </ModalPortalScope>
|
|
28
|
+
* </DialogPopup>
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
function ModalPortalScope({ children, floatingPortalStrategy = "nested", floatingZIndex = "default", floatingContainer }) {
|
|
32
|
+
const parentContext = React$1.useContext(PortalContext);
|
|
33
|
+
const depth = parentContext.layer === "modal" ? parentContext.depth + 1 : 0;
|
|
34
|
+
const value = React$1.useMemo(() => ({
|
|
35
|
+
layer: "modal",
|
|
36
|
+
depth,
|
|
37
|
+
floatingPortalStrategy,
|
|
38
|
+
floatingZIndex,
|
|
39
|
+
floatingContainer: floatingContainer ?? void 0
|
|
40
|
+
}), [
|
|
41
|
+
depth,
|
|
42
|
+
floatingContainer,
|
|
43
|
+
floatingPortalStrategy,
|
|
44
|
+
floatingZIndex
|
|
45
|
+
]);
|
|
46
|
+
return /* @__PURE__ */ jsx(PortalContext.Provider, {
|
|
47
|
+
value,
|
|
48
|
+
children
|
|
49
|
+
});
|
|
29
50
|
}
|
|
51
|
+
/**
|
|
52
|
+
* Get the current portal context value.
|
|
53
|
+
* Used internally by other hooks.
|
|
54
|
+
*/
|
|
30
55
|
function usePortalContext() {
|
|
31
|
-
|
|
56
|
+
return React$1.useContext(PortalContext);
|
|
32
57
|
}
|
|
33
58
|
function useInModalOverlay() {
|
|
34
|
-
|
|
59
|
+
return React$1.useContext(PortalContext).layer === "modal";
|
|
60
|
+
}
|
|
61
|
+
function getPortalRootElement() {
|
|
62
|
+
if (typeof document === "undefined") return null;
|
|
63
|
+
return document.getElementById(PORTAL_ROOT_ID);
|
|
35
64
|
}
|
|
65
|
+
/**
|
|
66
|
+
* Get the root portal container element.
|
|
67
|
+
* Used by modal components (Dialog, Sheet, etc.) to render their portals.
|
|
68
|
+
*
|
|
69
|
+
* Reads `#portal-root` synchronously on the client so mount-on-open overlays
|
|
70
|
+
* (menus, selects, popovers, tooltips) get a real container on their first
|
|
71
|
+
* paint. A null→element handoff after layout effect is too late for Base UI
|
|
72
|
+
* portals that only mount while open — they stay empty forever.
|
|
73
|
+
*
|
|
74
|
+
* @returns The root portal container, or null during SSR / when unmounted
|
|
75
|
+
*/
|
|
36
76
|
function useRootPortalContainer() {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
return container;
|
|
77
|
+
const [container, setContainer] = React$1.useState(getPortalRootElement);
|
|
78
|
+
React$1.useLayoutEffect(() => {
|
|
79
|
+
setContainer(getPortalRootElement());
|
|
80
|
+
}, []);
|
|
81
|
+
return container;
|
|
43
82
|
}
|
|
83
|
+
/**
|
|
84
|
+
* Centralized portal + z-index policy for floating overlays.
|
|
85
|
+
*
|
|
86
|
+
* - When `floatingPortalStrategy` is 'nested', Base UI will automatically portal
|
|
87
|
+
* into the nearest Base UI portal node (so dialog "inert" behavior includes it).
|
|
88
|
+
* - When it's 'root', we portal into #portal-root.
|
|
89
|
+
* - When the root is not ready yet, pass `undefined` (not `null`) so Base UI
|
|
90
|
+
* falls back to `document.body` instead of rendering into a dead portal.
|
|
91
|
+
*/
|
|
44
92
|
function useFloatingOverlayPortalProps() {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
93
|
+
const rootContainer = useRootPortalContainer();
|
|
94
|
+
const { floatingContainer, floatingPortalStrategy, floatingZIndex } = React$1.useContext(PortalContext);
|
|
95
|
+
return {
|
|
96
|
+
container: floatingContainer ?? (floatingPortalStrategy === "nested" ? void 0 : rootContainer ?? void 0),
|
|
97
|
+
zIndexClass: floatingZIndex === "elevated" ? "z-[var(--z-layer-floating-elevated)]" : "z-[var(--z-layer-floating)]"
|
|
98
|
+
};
|
|
50
99
|
}
|
|
100
|
+
/**
|
|
101
|
+
* Portal root component to render in app layout.
|
|
102
|
+
* All overlay components will render their portals inside this container.
|
|
103
|
+
*
|
|
104
|
+
* Usage in layout.tsx:
|
|
105
|
+
* ```tsx
|
|
106
|
+
* import { PortalRoot } from '@/components/ui/portal';
|
|
107
|
+
*
|
|
108
|
+
* export default function RootLayout({ children }) {
|
|
109
|
+
* return (
|
|
110
|
+
* <html>
|
|
111
|
+
* <body>
|
|
112
|
+
* {children}
|
|
113
|
+
* <PortalRoot />
|
|
114
|
+
* </body>
|
|
115
|
+
* </html>
|
|
116
|
+
* );
|
|
117
|
+
* }
|
|
118
|
+
* ```
|
|
119
|
+
*/
|
|
51
120
|
function PortalRoot() {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
// Children (portal contents) will have pointer-events: auto
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
);
|
|
121
|
+
return /* @__PURE__ */ jsx("div", {
|
|
122
|
+
id: PORTAL_ROOT_ID,
|
|
123
|
+
"data-slot": "portal-root",
|
|
124
|
+
style: {
|
|
125
|
+
position: "fixed",
|
|
126
|
+
inset: 0,
|
|
127
|
+
zIndex: "var(--z-layer-portal-root)",
|
|
128
|
+
pointerEvents: "none"
|
|
129
|
+
}
|
|
130
|
+
});
|
|
66
131
|
}
|
|
132
|
+
/**
|
|
133
|
+
* Hook to get the portal container element for rendering floating UI elements.
|
|
134
|
+
* Returns the element with id="portal-root" if it exists in the DOM.
|
|
135
|
+
*
|
|
136
|
+
* @deprecated Use useRootPortalContainer or useFloatingOverlayPortalProps instead
|
|
137
|
+
*/
|
|
67
138
|
function usePortalContainer() {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
139
|
+
if (typeof document === "undefined") return void 0;
|
|
140
|
+
const el = document.getElementById(PORTAL_ROOT_ID);
|
|
141
|
+
return el instanceof HTMLElement ? el : void 0;
|
|
71
142
|
}
|
|
72
143
|
|
|
144
|
+
//#endregion
|
|
73
145
|
export { ModalPortalScope, PORTAL_ROOT_ID, PortalRoot, useFloatingOverlayPortalProps, useInModalOverlay, usePortalContainer, usePortalContext, useRootPortalContainer };
|
|
74
|
-
//# sourceMappingURL=portal.js.map
|
|
75
146
|
//# sourceMappingURL=portal.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"portal.js","names":["React"],"sources":["../../src/components/portal.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\n\n// ============================================================================\n// Types\n// ============================================================================\n\n/**\n * Overlay layer type:\n * - 'base': Root level (page content, base floating elements)\n * - 'modal': Inside a modal overlay (dialog, sheet, drawer)\n */\nexport type OverlayLayer = 'base' | 'modal';\n\n/**\n * Where floating overlays should portal:\n * - 'root': always portal into #portal-root\n * - 'nested': let Base UI nest portals into the nearest Base UI portal node\n */\nexport type FloatingPortalStrategy = 'root' | 'nested';\n\n/**\n * Z-index mode for floating overlays.\n * - 'default': --z-layer-floating\n * - 'elevated': --z-layer-floating-elevated\n */\nexport type FloatingZIndex = 'default' | 'elevated';\n\ninterface PortalContextValue {\n\t/** Current overlay layer */\n\tlayer: OverlayLayer;\n\t/** Modal nesting depth (0 for first modal, 1 for nested, etc.) */\n\tdepth: number;\n\t/** Strategy for where floating overlays should portal */\n\tfloatingPortalStrategy: FloatingPortalStrategy;\n\t/** Z-index mode for floating overlays */\n\tfloatingZIndex: FloatingZIndex;\n\t/** Explicit host for floating overlays when the modal primitive is not Base UI. */\n\tfloatingContainer?: HTMLElement;\n}\n\n// ============================================================================\n// Constants\n// ============================================================================\n\nexport const PORTAL_ROOT_ID = 'portal-root';\n\n// ============================================================================\n// Context\n// ============================================================================\n\nconst PortalContext = React.createContext<PortalContextValue>({\n\tlayer: 'base',\n\tdepth: 0,\n\tfloatingPortalStrategy: 'root',\n\tfloatingZIndex: 'default',\n});\n\n// ============================================================================\n// Providers\n// ============================================================================\n\n/**\n * Provider for modal overlays (Dialog, Sheet, Drawer, etc.)\n *\n * Wraps modal content to:\n * 1. Create a scoped portal container for nested floating elements\n * 2. Track the overlay layer (so floating elements know to use elevated z-index)\n * 3. Track nesting depth for stacked modals\n *\n * Usage:\n * ```tsx\n * <DialogPopup>\n * <ModalPortalScope>\n * {children} // Popovers inside here will render in the scoped container\n * </ModalPortalScope>\n * </DialogPopup>\n * ```\n */\nexport function ModalPortalScope({\n\tchildren,\n\tfloatingPortalStrategy = 'nested',\n\tfloatingZIndex = 'default',\n\tfloatingContainer,\n}: {\n\tchildren: React.ReactNode;\n\tfloatingPortalStrategy?: FloatingPortalStrategy;\n\tfloatingZIndex?: FloatingZIndex;\n\tfloatingContainer?: HTMLElement | null;\n}) {\n\tconst parentContext = React.useContext(PortalContext);\n\n\t// Increment depth from parent if already in modal layer\n\tconst depth = parentContext.layer === 'modal' ? parentContext.depth + 1 : 0;\n\n\tconst value = React.useMemo<PortalContextValue>(\n\t\t() => ({\n\t\t\tlayer: 'modal',\n\t\t\tdepth,\n\t\t\tfloatingPortalStrategy,\n\t\t\tfloatingZIndex,\n\t\t\tfloatingContainer: floatingContainer ?? undefined,\n\t\t}),\n\t\t[depth, floatingContainer, floatingPortalStrategy, floatingZIndex],\n\t);\n\n\treturn <PortalContext.Provider value={value}>{children}</PortalContext.Provider>;\n}\n\n// ============================================================================\n// Hooks\n// ============================================================================\n\n/**\n * Get the current portal context value.\n * Used internally by other hooks.\n */\nexport function usePortalContext(): PortalContextValue {\n\treturn React.useContext(PortalContext);\n}\n\nexport function useInModalOverlay(): boolean {\n\treturn React.useContext(PortalContext).layer === 'modal';\n}\n\nfunction getPortalRootElement(): HTMLElement | null {\n\tif (typeof document === 'undefined') return null;\n\treturn document.getElementById(PORTAL_ROOT_ID);\n}\n\n/**\n * Get the root portal container element.\n * Used by modal components (Dialog, Sheet, etc.) to render their portals.\n *\n * Reads `#portal-root` synchronously on the client so mount-on-open overlays\n * (menus, selects, popovers, tooltips) get a real container on their first\n * paint. A null→element handoff after layout effect is too late for Base UI\n * portals that only mount while open — they stay empty forever.\n *\n * @returns The root portal container, or null during SSR / when unmounted\n */\nexport function useRootPortalContainer(): HTMLElement | null {\n\tconst [container, setContainer] = React.useState<HTMLElement | null>(getPortalRootElement);\n\n\tReact.useLayoutEffect(() => {\n\t\tsetContainer(getPortalRootElement());\n\t}, []);\n\n\treturn container;\n}\n\n/**\n * Centralized portal + z-index policy for floating overlays.\n *\n * - When `floatingPortalStrategy` is 'nested', Base UI will automatically portal\n * into the nearest Base UI portal node (so dialog \"inert\" behavior includes it).\n * - When it's 'root', we portal into #portal-root.\n * - When the root is not ready yet, pass `undefined` (not `null`) so Base UI\n * falls back to `document.body` instead of rendering into a dead portal.\n */\nexport function useFloatingOverlayPortalProps(): {\n\tcontainer?: HTMLElement;\n\tzIndexClass: string;\n} {\n\tconst rootContainer = useRootPortalContainer();\n\tconst { floatingContainer, floatingPortalStrategy, floatingZIndex } = React.useContext(PortalContext);\n\n\tconst container =\n\t\tfloatingContainer ??\n\t\t(floatingPortalStrategy === 'nested' ? undefined : (rootContainer ?? undefined));\n\tconst zIndexClass =\n\t\tfloatingZIndex === 'elevated'\n\t\t\t? 'z-[var(--z-layer-floating-elevated)]'\n\t\t\t: 'z-[var(--z-layer-floating)]';\n\n\treturn { container, zIndexClass };\n}\n\n// ============================================================================\n// Components\n// ============================================================================\n\n/**\n * Portal root component to render in app layout.\n * All overlay components will render their portals inside this container.\n *\n * Usage in layout.tsx:\n * ```tsx\n * import { PortalRoot } from '@/components/ui/portal';\n *\n * export default function RootLayout({ children }) {\n * return (\n * <html>\n * <body>\n * {children}\n * <PortalRoot />\n * </body>\n * </html>\n * );\n * }\n * ```\n */\nexport function PortalRoot() {\n\treturn (\n\t\t<div\n\t\t\tid={PORTAL_ROOT_ID}\n\t\t\tdata-slot=\"portal-root\"\n\t\t\tstyle={{\n\t\t\t\tposition: 'fixed',\n\t\t\t\tinset: 0,\n\t\t\t\tzIndex: 'var(--z-layer-portal-root)',\n\t\t\t\tpointerEvents: 'none',\n\t\t\t\t// Children (portal contents) will have pointer-events: auto\n\t\t\t}}\n\t\t/>\n\t);\n}\n\n/**\n * Hook to get the portal container element for rendering floating UI elements.\n * Returns the element with id=\"portal-root\" if it exists in the DOM.\n *\n * @deprecated Use useRootPortalContainer or useFloatingOverlayPortalProps instead\n */\nexport function usePortalContainer(): HTMLElement | undefined {\n\tif (typeof document === 'undefined') return undefined;\n\tconst el = document.getElementById(PORTAL_ROOT_ID);\n\treturn el instanceof HTMLElement ? el : undefined;\n}\n"],"mappings":";;;;;;AA8CA,MAAa,iBAAiB;AAM9B,MAAM,gBAAgBA,QAAM,cAAkC;CAC7D,OAAO;CACP,OAAO;CACP,wBAAwB;CACxB,gBAAgB;AACjB,CAAC;;;;;;;;;;;;;;;;;;AAuBD,SAAgB,iBAAiB,EAChC,UACA,yBAAyB,UACzB,iBAAiB,WACjB,qBAME;CACF,MAAM,gBAAgBA,QAAM,WAAW,aAAa;CAGpD,MAAM,QAAQ,cAAc,UAAU,UAAU,cAAc,QAAQ,IAAI;CAE1E,MAAM,QAAQA,QAAM,eACZ;EACN,OAAO;EACP;EACA;EACA;EACA,mBAAmB,qBAAqB;CACzC,IACA;EAAC;EAAO;EAAmB;EAAwB;CAAc,CAClE;CAEA,OAAO,oBAAC,cAAc,UAAf;EAA+B;EAAQ;CAAiC;AAChF;;;;;AAUA,SAAgB,mBAAuC;CACtD,OAAOA,QAAM,WAAW,aAAa;AACtC;AAEA,SAAgB,oBAA6B;CAC5C,OAAOA,QAAM,WAAW,aAAa,CAAC,CAAC,UAAU;AAClD;AAEA,SAAS,uBAA2C;CACnD,IAAI,OAAO,aAAa,aAAa,OAAO;CAC5C,OAAO,SAAS,eAAe,cAAc;AAC9C;;;;;;;;;;;;AAaA,SAAgB,yBAA6C;CAC5D,MAAM,CAAC,WAAW,gBAAgBA,QAAM,SAA6B,oBAAoB;CAEzF,QAAM,sBAAsB;EAC3B,aAAa,qBAAqB,CAAC;CACpC,GAAG,CAAC,CAAC;CAEL,OAAO;AACR;;;;;;;;;;AAWA,SAAgB,gCAGd;CACD,MAAM,gBAAgB,uBAAuB;CAC7C,MAAM,EAAE,mBAAmB,wBAAwB,mBAAmBA,QAAM,WAAW,aAAa;CAUpG,OAAO;EAAE,WAPR,sBACC,2BAA2B,WAAW,SAAa,iBAAiB;EAMlD,aAJnB,mBAAmB,aAChB,yCACA;CAE4B;AACjC;;;;;;;;;;;;;;;;;;;;;AA0BA,SAAgB,aAAa;CAC5B,OACC,oBAAC,OAAD;EACC,IAAI;EACJ,aAAU;EACV,OAAO;GACN,UAAU;GACV,OAAO;GACP,QAAQ;GACR,eAAe;EAEhB;CACA;AAEH;;;;;;;AAQA,SAAgB,qBAA8C;CAC7D,IAAI,OAAO,aAAa,aAAa,OAAO;CAC5C,MAAM,KAAK,SAAS,eAAe,cAAc;CACjD,OAAO,cAAc,cAAc,KAAK;AACzC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
+
const require_rolldown_runtime = require('../rolldown-runtime-D_qnwXdH.cjs');
|
|
5
|
+
const require_utils = require('../utils-CzTQ3-VI.cjs');
|
|
6
|
+
let react = require("react");
|
|
7
|
+
react = require_rolldown_runtime.__toESM(react, 1);
|
|
8
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
9
|
+
let _base_ui_react_progress = require("@base-ui/react/progress");
|
|
10
|
+
|
|
11
|
+
//#region src/components/progress.tsx
|
|
12
|
+
function Progress({ className, value, ...props }) {
|
|
13
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_base_ui_react_progress.Progress.Root, {
|
|
14
|
+
"data-slot": "progress",
|
|
15
|
+
value,
|
|
16
|
+
...props,
|
|
17
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_base_ui_react_progress.Progress.Track, {
|
|
18
|
+
"data-slot": "progress-track",
|
|
19
|
+
className: require_utils.cn("bg-primary/20 relative h-2 w-full overflow-hidden rounded-full", className),
|
|
20
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_base_ui_react_progress.Progress.Indicator, {
|
|
21
|
+
"data-slot": "progress-indicator",
|
|
22
|
+
className: "bg-primary h-full transition-[width] duration-200 ease-out motion-reduce:transition-none"
|
|
23
|
+
})
|
|
24
|
+
})
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
//#endregion
|
|
29
|
+
exports.Progress = Progress;
|
|
30
|
+
//# sourceMappingURL=progress.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"progress.cjs","names":["ProgressPrimitive","cn"],"sources":["../../src/components/progress.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { Progress as ProgressPrimitive } from '@base-ui/react/progress';\n\nimport { cn } from '../lib/utils';\n\ntype ProgressProps = Omit<React.ComponentProps<typeof ProgressPrimitive.Root>, 'children'> & {\n\tclassName?: string;\n};\n\nfunction Progress({ className, value, ...props }: ProgressProps) {\n\treturn (\n\t\t<ProgressPrimitive.Root data-slot=\"progress\" value={value} {...props}>\n\t\t\t<ProgressPrimitive.Track\n\t\t\t\tdata-slot=\"progress-track\"\n\t\t\t\tclassName={cn('bg-primary/20 relative h-2 w-full overflow-hidden rounded-full', className)}\n\t\t\t>\n\t\t\t\t<ProgressPrimitive.Indicator\n\t\t\t\t\tdata-slot=\"progress-indicator\"\n\t\t\t\t\tclassName=\"bg-primary h-full transition-[width] duration-200 ease-out motion-reduce:transition-none\"\n\t\t\t\t/>\n\t\t\t</ProgressPrimitive.Track>\n\t\t</ProgressPrimitive.Root>\n\t);\n}\n\nexport { Progress };\nexport type { ProgressProps };\n"],"mappings":";;;;;;;;;;;AAWA,SAAS,SAAS,EAAE,WAAW,OAAO,GAAG,SAAwB;CAChE,OACC,2CAACA,iCAAkB,MAAnB;EAAwB,aAAU;EAAkB;EAAO,GAAI;YAC9D,2CAACA,iCAAkB,OAAnB;GACC,aAAU;GACV,WAAWC,iBAAG,kEAAkE,SAAS;aAEzF,2CAACD,iCAAkB,WAAnB;IACC,aAAU;IACV,WAAU;GACV;EACuB;CACF;AAE1B"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as React$1 from "react";
|
|
2
|
+
import { Progress as Progress$1 } from "@base-ui/react/progress";
|
|
3
|
+
//#region src/components/progress.d.ts
|
|
4
|
+
type ProgressProps = Omit<React$1.ComponentProps<typeof Progress$1.Root>, 'children'> & {
|
|
5
|
+
className?: string;
|
|
6
|
+
};
|
|
7
|
+
declare function Progress({ className, value, ...props }: ProgressProps): React$1.JSX.Element;
|
|
8
|
+
//#endregion
|
|
9
|
+
export { Progress, type ProgressProps };
|
|
10
|
+
//# sourceMappingURL=progress.d.cts.map
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
className?: string;
|
|
1
|
+
import * as React$1 from "react";
|
|
2
|
+
import { Progress as Progress$1 } from "@base-ui/react/progress";
|
|
3
|
+
//#region src/components/progress.d.ts
|
|
4
|
+
type ProgressProps = Omit<React$1.ComponentProps<typeof Progress$1.Root>, 'children'> & {
|
|
5
|
+
className?: string;
|
|
7
6
|
};
|
|
8
|
-
declare function Progress({ className, value, ...props }: ProgressProps):
|
|
9
|
-
|
|
7
|
+
declare function Progress({ className, value, ...props }: ProgressProps): React$1.JSX.Element;
|
|
8
|
+
//#endregion
|
|
10
9
|
export { Progress, type ProgressProps };
|
|
10
|
+
//# sourceMappingURL=progress.d.ts.map
|
|
@@ -1,30 +1,27 @@
|
|
|
1
|
-
|
|
2
|
-
import { Progress as Progress$1 } from '@base-ui/react/progress';
|
|
3
|
-
import { clsx } from 'clsx';
|
|
4
|
-
import { twMerge } from 'tailwind-merge';
|
|
5
|
-
import { jsx } from 'react/jsx-runtime';
|
|
1
|
+
'use client';
|
|
6
2
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}
|
|
3
|
+
import { t as cn } from "../utils-BkMLyah9.js";
|
|
4
|
+
import "react";
|
|
5
|
+
import { jsx } from "react/jsx-runtime";
|
|
6
|
+
import { Progress as Progress$1 } from "@base-ui/react/progress";
|
|
7
|
+
|
|
8
|
+
//#region src/components/progress.tsx
|
|
10
9
|
function Progress({ className, value, ...props }) {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
-
) });
|
|
10
|
+
return /* @__PURE__ */ jsx(Progress$1.Root, {
|
|
11
|
+
"data-slot": "progress",
|
|
12
|
+
value,
|
|
13
|
+
...props,
|
|
14
|
+
children: /* @__PURE__ */ jsx(Progress$1.Track, {
|
|
15
|
+
"data-slot": "progress-track",
|
|
16
|
+
className: cn("bg-primary/20 relative h-2 w-full overflow-hidden rounded-full", className),
|
|
17
|
+
children: /* @__PURE__ */ jsx(Progress$1.Indicator, {
|
|
18
|
+
"data-slot": "progress-indicator",
|
|
19
|
+
className: "bg-primary h-full transition-[width] duration-200 ease-out motion-reduce:transition-none"
|
|
20
|
+
})
|
|
21
|
+
})
|
|
22
|
+
});
|
|
26
23
|
}
|
|
27
24
|
|
|
25
|
+
//#endregion
|
|
28
26
|
export { Progress };
|
|
29
|
-
//# sourceMappingURL=progress.js.map
|
|
30
27
|
//# sourceMappingURL=progress.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"progress.js","names":["ProgressPrimitive"],"sources":["../../src/components/progress.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { Progress as ProgressPrimitive } from '@base-ui/react/progress';\n\nimport { cn } from '../lib/utils';\n\ntype ProgressProps = Omit<React.ComponentProps<typeof ProgressPrimitive.Root>, 'children'> & {\n\tclassName?: string;\n};\n\nfunction Progress({ className, value, ...props }: ProgressProps) {\n\treturn (\n\t\t<ProgressPrimitive.Root data-slot=\"progress\" value={value} {...props}>\n\t\t\t<ProgressPrimitive.Track\n\t\t\t\tdata-slot=\"progress-track\"\n\t\t\t\tclassName={cn('bg-primary/20 relative h-2 w-full overflow-hidden rounded-full', className)}\n\t\t\t>\n\t\t\t\t<ProgressPrimitive.Indicator\n\t\t\t\t\tdata-slot=\"progress-indicator\"\n\t\t\t\t\tclassName=\"bg-primary h-full transition-[width] duration-200 ease-out motion-reduce:transition-none\"\n\t\t\t\t/>\n\t\t\t</ProgressPrimitive.Track>\n\t\t</ProgressPrimitive.Root>\n\t);\n}\n\nexport { Progress };\nexport type { ProgressProps };\n"],"mappings":";;;;;;;;AAWA,SAAS,SAAS,EAAE,WAAW,OAAO,GAAG,SAAwB;CAChE,OACC,oBAACA,WAAkB,MAAnB;EAAwB,aAAU;EAAkB;EAAO,GAAI;YAC9D,oBAACA,WAAkB,OAAnB;GACC,aAAU;GACV,WAAW,GAAG,kEAAkE,SAAS;aAEzF,oBAACA,WAAkB,WAAnB;IACC,aAAU;IACV,WAAU;GACV;EACuB;CACF;AAE1B"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
+
const require_utils = require('../utils-CzTQ3-VI.cjs');
|
|
5
|
+
const require_components_progressive_blur = require('./progressive-blur.cjs');
|
|
6
|
+
let react = require("react");
|
|
7
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
8
|
+
|
|
9
|
+
//#region src/components/progressive-blur-scroll-container.tsx
|
|
10
|
+
/**
|
|
11
|
+
* A scrollable container that shows progressive blur effects at the top and bottom
|
|
12
|
+
* when content overflows. Top blur appears when scrolled, bottom blur when more content below.
|
|
13
|
+
*/
|
|
14
|
+
function ProgressiveBlurScrollContainer({ children, className, scrollClassName, minItemsForBlur = 0, itemCount = 0, blurProps, showBlur = true }) {
|
|
15
|
+
const [hasOverflow, setHasOverflow] = (0, react.useState)(false);
|
|
16
|
+
const [isScrolledFromTop, setIsScrolledFromTop] = (0, react.useState)(false);
|
|
17
|
+
const [isScrolledFromBottom, setIsScrolledFromBottom] = (0, react.useState)(true);
|
|
18
|
+
const scrollRef = (0, react.useRef)(null);
|
|
19
|
+
const checkScrollPosition = (0, react.useCallback)(() => {
|
|
20
|
+
if (scrollRef.current) {
|
|
21
|
+
const el = scrollRef.current;
|
|
22
|
+
const scrollTop = el.scrollTop;
|
|
23
|
+
const scrollHeight = el.scrollHeight;
|
|
24
|
+
const clientHeight = el.clientHeight;
|
|
25
|
+
setIsScrolledFromTop(scrollTop > 10);
|
|
26
|
+
setIsScrolledFromBottom(scrollTop + clientHeight < scrollHeight - 10);
|
|
27
|
+
}
|
|
28
|
+
}, []);
|
|
29
|
+
(0, react.useEffect)(() => {
|
|
30
|
+
const checkOverflow = () => {
|
|
31
|
+
if (scrollRef.current) {
|
|
32
|
+
const el = scrollRef.current;
|
|
33
|
+
setHasOverflow(el.scrollHeight > el.clientHeight);
|
|
34
|
+
checkScrollPosition();
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
checkOverflow();
|
|
38
|
+
window.addEventListener("resize", checkOverflow);
|
|
39
|
+
return () => window.removeEventListener("resize", checkOverflow);
|
|
40
|
+
}, [children, checkScrollPosition]);
|
|
41
|
+
(0, react.useEffect)(() => {
|
|
42
|
+
const el = scrollRef.current;
|
|
43
|
+
if (!el) return;
|
|
44
|
+
el.addEventListener("scroll", checkScrollPosition, { passive: true });
|
|
45
|
+
return () => el.removeEventListener("scroll", checkScrollPosition);
|
|
46
|
+
}, [checkScrollPosition]);
|
|
47
|
+
const canShowBlur = showBlur && hasOverflow && (minItemsForBlur === 0 || itemCount > minItemsForBlur);
|
|
48
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
49
|
+
className: require_utils.cn("relative min-h-0 flex-1", className),
|
|
50
|
+
children: [
|
|
51
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
52
|
+
ref: scrollRef,
|
|
53
|
+
className: require_utils.cn("absolute inset-0 overflow-y-auto", scrollClassName),
|
|
54
|
+
children
|
|
55
|
+
}),
|
|
56
|
+
canShowBlur && isScrolledFromTop && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_progressive_blur.ProgressiveBlur, {
|
|
57
|
+
position: "top",
|
|
58
|
+
height: "48px",
|
|
59
|
+
surface: "background",
|
|
60
|
+
intensity: .2,
|
|
61
|
+
...blurProps
|
|
62
|
+
}),
|
|
63
|
+
canShowBlur && isScrolledFromBottom && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_progressive_blur.ProgressiveBlur, {
|
|
64
|
+
position: "bottom",
|
|
65
|
+
height: "64px",
|
|
66
|
+
surface: "background",
|
|
67
|
+
intensity: .25,
|
|
68
|
+
...blurProps
|
|
69
|
+
})
|
|
70
|
+
]
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
//#endregion
|
|
75
|
+
exports.ProgressiveBlurScrollContainer = ProgressiveBlurScrollContainer;
|
|
76
|
+
//# sourceMappingURL=progressive-blur-scroll-container.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"progressive-blur-scroll-container.cjs","names":["cn","ProgressiveBlur"],"sources":["../../src/components/progressive-blur-scroll-container.tsx"],"sourcesContent":["'use client';\n\nimport { useCallback, useEffect, useRef, useState, type ReactNode } from 'react';\n\nimport { cn } from '../lib/utils';\n\nimport { ProgressiveBlur, type ProgressiveBlurProps } from './progressive-blur';\n\nexport interface ProgressiveBlurScrollContainerProps {\n\tchildren: ReactNode;\n\tclassName?: string;\n\t/** Class name for the scrollable inner div */\n\tscrollClassName?: string;\n\t/** Minimum number of items to show blur (prevents blur on sparse content) */\n\tminItemsForBlur?: number;\n\t/** Current item count for minItemsForBlur check */\n\titemCount?: number;\n\t/** Props to pass to ProgressiveBlur */\n\tblurProps?: Partial<ProgressiveBlurProps>;\n\t/** Whether to show blur (in addition to overflow check) */\n\tshowBlur?: boolean;\n}\n\n/**\n * A scrollable container that shows progressive blur effects at the top and bottom\n * when content overflows. Top blur appears when scrolled, bottom blur when more content below.\n */\nexport function ProgressiveBlurScrollContainer({\n\tchildren,\n\tclassName,\n\tscrollClassName,\n\tminItemsForBlur = 0,\n\titemCount = 0,\n\tblurProps,\n\tshowBlur = true,\n}: ProgressiveBlurScrollContainerProps) {\n\tconst [hasOverflow, setHasOverflow] = useState(false);\n\tconst [isScrolledFromTop, setIsScrolledFromTop] = useState(false);\n\tconst [isScrolledFromBottom, setIsScrolledFromBottom] = useState(true);\n\tconst scrollRef = useRef<HTMLDivElement>(null);\n\n\tconst checkScrollPosition = useCallback(() => {\n\t\tif (scrollRef.current) {\n\t\t\tconst el = scrollRef.current;\n\t\t\tconst scrollTop = el.scrollTop;\n\t\t\tconst scrollHeight = el.scrollHeight;\n\t\t\tconst clientHeight = el.clientHeight;\n\n\t\t\t// Show top blur if scrolled more than 10px from top\n\t\t\tsetIsScrolledFromTop(scrollTop > 10);\n\t\t\t// Show bottom blur if not scrolled to bottom (with 10px threshold)\n\t\t\tsetIsScrolledFromBottom(scrollTop + clientHeight < scrollHeight - 10);\n\t\t}\n\t}, []);\n\n\tuseEffect(() => {\n\t\tconst checkOverflow = () => {\n\t\t\tif (scrollRef.current) {\n\t\t\t\tconst el = scrollRef.current;\n\t\t\t\tsetHasOverflow(el.scrollHeight > el.clientHeight);\n\t\t\t\tcheckScrollPosition();\n\t\t\t}\n\t\t};\n\t\tcheckOverflow();\n\t\twindow.addEventListener('resize', checkOverflow);\n\t\treturn () => window.removeEventListener('resize', checkOverflow);\n\t}, [children, checkScrollPosition]);\n\n\t// Listen to scroll events\n\tuseEffect(() => {\n\t\tconst el = scrollRef.current;\n\t\tif (!el) return;\n\n\t\tel.addEventListener('scroll', checkScrollPosition, { passive: true });\n\t\treturn () => el.removeEventListener('scroll', checkScrollPosition);\n\t}, [checkScrollPosition]);\n\n\tconst canShowBlur = showBlur && hasOverflow && (minItemsForBlur === 0 || itemCount > minItemsForBlur);\n\n\treturn (\n\t\t<div className={cn('relative min-h-0 flex-1', className)}>\n\t\t\t<div\n\t\t\t\tref={scrollRef}\n\t\t\t\tclassName={cn('absolute inset-0 overflow-y-auto', scrollClassName)}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</div>\n\t\t\t{canShowBlur && isScrolledFromTop && (\n\t\t\t\t<ProgressiveBlur\n\t\t\t\t\tposition='top'\n\t\t\t\t\theight='48px'\n\t\t\t\t\tsurface='background'\n\t\t\t\t\tintensity={0.2}\n\t\t\t\t\t{...blurProps}\n\t\t\t\t/>\n\t\t\t)}\n\t\t\t{canShowBlur && isScrolledFromBottom && (\n\t\t\t\t<ProgressiveBlur\n\t\t\t\t\tposition='bottom'\n\t\t\t\t\theight='64px'\n\t\t\t\t\tsurface='background'\n\t\t\t\t\tintensity={0.25}\n\t\t\t\t\t{...blurProps}\n\t\t\t\t/>\n\t\t\t)}\n\t\t</div>\n\t);\n}\n"],"mappings":";;;;;;;;;;;;;AA2BA,SAAgB,+BAA+B,EAC9C,UACA,WACA,iBACA,kBAAkB,GAClB,YAAY,GACZ,WACA,WAAW,QAC4B;CACvC,MAAM,CAAC,aAAa,sCAA2B,KAAK;CACpD,MAAM,CAAC,mBAAmB,4CAAiC,KAAK;CAChE,MAAM,CAAC,sBAAsB,+CAAoC,IAAI;CACrE,MAAM,8BAAmC,IAAI;CAE7C,MAAM,mDAAwC;EAC7C,IAAI,UAAU,SAAS;GACtB,MAAM,KAAK,UAAU;GACrB,MAAM,YAAY,GAAG;GACrB,MAAM,eAAe,GAAG;GACxB,MAAM,eAAe,GAAG;GAGxB,qBAAqB,YAAY,EAAE;GAEnC,wBAAwB,YAAY,eAAe,eAAe,EAAE;EACrE;CACD,GAAG,CAAC,CAAC;CAEL,2BAAgB;EACf,MAAM,sBAAsB;GAC3B,IAAI,UAAU,SAAS;IACtB,MAAM,KAAK,UAAU;IACrB,eAAe,GAAG,eAAe,GAAG,YAAY;IAChD,oBAAoB;GACrB;EACD;EACA,cAAc;EACd,OAAO,iBAAiB,UAAU,aAAa;EAC/C,aAAa,OAAO,oBAAoB,UAAU,aAAa;CAChE,GAAG,CAAC,UAAU,mBAAmB,CAAC;CAGlC,2BAAgB;EACf,MAAM,KAAK,UAAU;EACrB,IAAI,CAAC,IAAI;EAET,GAAG,iBAAiB,UAAU,qBAAqB,EAAE,SAAS,KAAK,CAAC;EACpE,aAAa,GAAG,oBAAoB,UAAU,mBAAmB;CAClE,GAAG,CAAC,mBAAmB,CAAC;CAExB,MAAM,cAAc,YAAY,gBAAgB,oBAAoB,KAAK,YAAY;CAErF,OACC,4CAAC,OAAD;EAAK,WAAWA,iBAAG,2BAA2B,SAAS;YAAvD;GACC,2CAAC,OAAD;IACC,KAAK;IACL,WAAWA,iBAAG,oCAAoC,eAAe;IAEhE;GACG;GACJ,eAAe,qBACf,2CAACC,qDAAD;IACC,UAAS;IACT,QAAO;IACP,SAAQ;IACR,WAAW;IACX,GAAI;GACJ;GAED,eAAe,wBACf,2CAACA,qDAAD;IACC,UAAS;IACT,QAAO;IACP,SAAQ;IACR,WAAW;IACX,GAAI;GACJ;EAEE;;AAEP"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ProgressiveBlurProps } from "./progressive-blur.cjs";
|
|
2
|
+
import { ReactNode } from "react";
|
|
3
|
+
//#region src/components/progressive-blur-scroll-container.d.ts
|
|
4
|
+
interface ProgressiveBlurScrollContainerProps {
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
className?: string;
|
|
7
|
+
/** Class name for the scrollable inner div */
|
|
8
|
+
scrollClassName?: string;
|
|
9
|
+
/** Minimum number of items to show blur (prevents blur on sparse content) */
|
|
10
|
+
minItemsForBlur?: number;
|
|
11
|
+
/** Current item count for minItemsForBlur check */
|
|
12
|
+
itemCount?: number;
|
|
13
|
+
/** Props to pass to ProgressiveBlur */
|
|
14
|
+
blurProps?: Partial<ProgressiveBlurProps>;
|
|
15
|
+
/** Whether to show blur (in addition to overflow check) */
|
|
16
|
+
showBlur?: boolean;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* A scrollable container that shows progressive blur effects at the top and bottom
|
|
20
|
+
* when content overflows. Top blur appears when scrolled, bottom blur when more content below.
|
|
21
|
+
*/
|
|
22
|
+
declare function ProgressiveBlurScrollContainer({ children, className, scrollClassName, minItemsForBlur, itemCount, blurProps, showBlur }: ProgressiveBlurScrollContainerProps): import("react").JSX.Element;
|
|
23
|
+
//#endregion
|
|
24
|
+
export { ProgressiveBlurScrollContainer, ProgressiveBlurScrollContainerProps };
|
|
25
|
+
//# sourceMappingURL=progressive-blur-scroll-container.d.cts.map
|