@constructive-io/ui 0.6.0 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/button-D4vqTxhp.d.cts +20 -0
- package/dist/button-D4vqTxhp.d.ts +20 -0
- package/dist/components/alert-dialog.cjs +98 -302
- package/dist/components/alert-dialog.cjs.map +1 -1
- package/dist/components/alert-dialog.d.cts +22 -21
- package/dist/components/alert-dialog.d.ts +22 -21
- package/dist/components/alert-dialog.js +96 -281
- package/dist/components/alert-dialog.js.map +1 -1
- package/dist/components/alert.cjs +51 -108
- package/dist/components/alert.cjs.map +1 -1
- package/dist/components/alert.d.cts +13 -13
- package/dist/components/alert.d.ts +13 -13
- package/dist/components/alert.js +49 -87
- package/dist/components/alert.js.map +1 -1
- package/dist/components/app-bar.cjs +73 -359
- package/dist/components/app-bar.cjs.map +1 -1
- package/dist/components/app-bar.d.cts +21 -20
- package/dist/components/app-bar.d.ts +21 -20
- package/dist/components/app-bar.js +71 -338
- package/dist/components/app-bar.js.map +1 -1
- package/dist/components/app-shell.cjs +252 -1777
- package/dist/components/app-shell.cjs.map +1 -1
- package/dist/components/app-shell.d.cts +77 -85
- package/dist/components/app-shell.d.ts +77 -85
- package/dist/components/app-shell.js +249 -1756
- package/dist/components/app-shell.js.map +1 -1
- package/dist/components/autocomplete.cjs +146 -397
- package/dist/components/autocomplete.cjs.map +1 -1
- package/dist/components/autocomplete.d.cts +24 -24
- package/dist/components/autocomplete.d.ts +24 -24
- package/dist/components/autocomplete.js +146 -376
- package/dist/components/autocomplete.js.map +1 -1
- package/dist/components/avatar.cjs +26 -38
- package/dist/components/avatar.cjs.map +1 -1
- package/dist/components/avatar.d.cts +11 -10
- package/dist/components/avatar.d.ts +11 -10
- package/dist/components/avatar.js +24 -37
- package/dist/components/avatar.js.map +1 -1
- package/dist/components/badge.cjs +42 -60
- package/dist/components/badge.cjs.map +1 -1
- package/dist/components/badge.d.cts +13 -13
- 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 +65 -94
- package/dist/components/breadcrumb.cjs.map +1 -1
- package/dist/components/breadcrumb.d.cts +14 -13
- package/dist/components/breadcrumb.d.ts +14 -13
- package/dist/components/breadcrumb.js +63 -73
- package/dist/components/breadcrumb.js.map +1 -1
- package/dist/components/button.cjs +68 -162
- package/dist/components/button.cjs.map +1 -1
- package/dist/components/button.d.cts +2 -20
- package/dist/components/button.d.ts +2 -20
- package/dist/components/button.js +65 -140
- package/dist/components/button.js.map +1 -1
- package/dist/components/calendar-rac.cjs +49 -62
- package/dist/components/calendar-rac.cjs.map +1 -1
- package/dist/components/calendar-rac.d.cts +8 -8
- 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 +61 -74
- package/dist/components/card.cjs.map +1 -1
- package/dist/components/card.d.cts +15 -16
- package/dist/components/card.d.ts +15 -16
- package/dist/components/card.js +58 -72
- package/dist/components/card.js.map +1 -1
- package/dist/components/checkbox-group.cjs +12 -11
- package/dist/components/checkbox-group.cjs.map +1 -1
- package/dist/components/checkbox-group.d.cts +5 -5
- 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 +60 -114
- package/dist/components/checkbox.cjs.map +1 -1
- package/dist/components/checkbox.d.cts +6 -6
- package/dist/components/checkbox.d.ts +6 -6
- package/dist/components/checkbox.js +58 -93
- package/dist/components/checkbox.js.map +1 -1
- package/dist/components/collapsible.cjs +76 -113
- package/dist/components/collapsible.cjs.map +1 -1
- package/dist/components/collapsible.d.cts +16 -15
- package/dist/components/collapsible.d.ts +16 -15
- package/dist/components/collapsible.js +74 -92
- package/dist/components/collapsible.js.map +1 -1
- package/dist/components/combobox.cjs +213 -507
- package/dist/components/combobox.cjs.map +1 -1
- package/dist/components/combobox.d.cts +36 -35
- package/dist/components/combobox.d.ts +36 -35
- package/dist/components/combobox.js +229 -504
- package/dist/components/combobox.js.map +1 -1
- package/dist/components/command.cjs +102 -199
- package/dist/components/command.cjs.map +1 -1
- package/dist/components/command.d.cts +22 -21
- package/dist/components/command.d.ts +22 -21
- package/dist/components/command.js +100 -198
- package/dist/components/command.js.map +1 -1
- package/dist/components/dialog.cjs +110 -402
- package/dist/components/dialog.cjs.map +1 -1
- package/dist/components/dialog.d.cts +27 -26
- package/dist/components/dialog.d.ts +27 -26
- package/dist/components/dialog.js +107 -380
- package/dist/components/dialog.js.map +1 -1
- package/dist/components/dock.cjs +80 -111
- package/dist/components/dock.cjs.map +1 -1
- package/dist/components/dock.d.cts +25 -25
- package/dist/components/dock.d.ts +25 -25
- package/dist/components/dock.js +78 -106
- package/dist/components/dock.js.map +1 -1
- package/dist/components/drawer.cjs +77 -111
- package/dist/components/drawer.cjs.map +1 -1
- package/dist/components/drawer.d.cts +15 -14
- package/dist/components/drawer.d.ts +15 -14
- package/dist/components/drawer.js +75 -90
- package/dist/components/drawer.js.map +1 -1
- package/dist/components/dropdown-menu.cjs +163 -238
- package/dist/components/dropdown-menu.cjs.map +1 -1
- package/dist/components/dropdown-menu.d.cts +44 -43
- package/dist/components/dropdown-menu.d.ts +44 -43
- package/dist/components/dropdown-menu.js +161 -217
- package/dist/components/dropdown-menu.js.map +1 -1
- package/dist/components/empty.cjs +51 -85
- package/dist/components/empty.cjs.map +1 -1
- package/dist/components/empty.d.cts +13 -13
- package/dist/components/empty.d.ts +13 -13
- package/dist/components/empty.js +48 -83
- package/dist/components/empty.js.map +1 -1
- package/dist/components/field.cjs +150 -259
- package/dist/components/field.cjs.map +1 -1
- package/dist/components/field.d.cts +39 -39
- package/dist/components/field.d.ts +39 -39
- package/dist/components/field.js +148 -238
- package/dist/components/field.js.map +1 -1
- package/dist/components/flickering-grid.cjs +143 -166
- package/dist/components/flickering-grid.cjs.map +1 -1
- package/dist/components/flickering-grid.d.cts +14 -13
- package/dist/components/flickering-grid.d.ts +14 -13
- package/dist/components/flickering-grid.js +141 -161
- package/dist/components/flickering-grid.js.map +1 -1
- package/dist/components/flow-zoom-panel.cjs +56 -188
- package/dist/components/flow-zoom-panel.cjs.map +1 -1
- package/dist/components/flow-zoom-panel.d.cts +9 -9
- package/dist/components/flow-zoom-panel.d.ts +9 -9
- package/dist/components/flow-zoom-panel.js +56 -168
- package/dist/components/flow-zoom-panel.js.map +1 -1
- package/dist/components/form-control.cjs +58 -186
- package/dist/components/form-control.cjs.map +1 -1
- package/dist/components/form-control.d.cts +11 -10
- package/dist/components/form-control.d.ts +11 -10
- package/dist/components/form-control.js +56 -165
- package/dist/components/form-control.js.map +1 -1
- package/dist/components/form.cjs +78 -184
- package/dist/components/form.cjs.map +1 -1
- package/dist/components/form.d.cts +2 -36
- package/dist/components/form.d.ts +2 -36
- package/dist/components/form.js +76 -163
- package/dist/components/form.js.map +1 -1
- package/dist/components/input-group.cjs +51 -165
- package/dist/components/input-group.cjs.map +1 -1
- package/dist/components/input-group.d.cts +14 -15
- package/dist/components/input-group.d.ts +14 -15
- package/dist/components/input-group.js +51 -164
- package/dist/components/input-group.js.map +1 -1
- package/dist/components/input.cjs +30 -55
- package/dist/components/input.cjs.map +1 -1
- package/dist/components/input.d.cts +2 -10
- package/dist/components/input.d.ts +2 -10
- package/dist/components/input.js +30 -54
- package/dist/components/input.js.map +1 -1
- package/dist/components/json-input.cjs +133 -337
- package/dist/components/json-input.cjs.map +1 -1
- package/dist/components/json-input.d.cts +20 -19
- package/dist/components/json-input.d.ts +20 -19
- package/dist/components/json-input.js +132 -317
- package/dist/components/json-input.js.map +1 -1
- package/dist/components/label.cjs +19 -21
- package/dist/components/label.cjs.map +1 -1
- package/dist/components/label.d.cts +6 -5
- package/dist/components/label.d.ts +6 -5
- package/dist/components/label.js +17 -20
- package/dist/components/label.js.map +1 -1
- package/dist/components/motion-grid.cjs +61 -101
- package/dist/components/motion-grid.cjs.map +1 -1
- package/dist/components/motion-grid.d.cts +15 -14
- package/dist/components/motion-grid.d.ts +15 -14
- package/dist/components/motion-grid.js +59 -80
- package/dist/components/motion-grid.js.map +1 -1
- package/dist/components/multi-select.cjs +563 -786
- package/dist/components/multi-select.cjs.map +1 -1
- package/dist/components/multi-select.d.cts +173 -173
- package/dist/components/multi-select.d.ts +173 -173
- package/dist/components/multi-select.js +561 -765
- package/dist/components/multi-select.js.map +1 -1
- package/dist/components/page-header.cjs +24 -13
- package/dist/components/page-header.cjs.map +1 -1
- package/dist/components/page-header.d.cts +11 -11
- 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 +72 -272
- package/dist/components/pagination.cjs.map +1 -1
- package/dist/components/pagination.d.cts +15 -16
- package/dist/components/pagination.d.ts +15 -16
- package/dist/components/pagination.js +69 -250
- package/dist/components/pagination.js.map +1 -1
- package/dist/components/popover.cjs +68 -111
- package/dist/components/popover.cjs.map +1 -1
- package/dist/components/popover.d.cts +31 -30
- package/dist/components/popover.d.ts +31 -30
- package/dist/components/popover.js +66 -90
- package/dist/components/popover.js.map +1 -1
- package/dist/components/portal.cjs +128 -81
- package/dist/components/portal.cjs.map +1 -1
- package/dist/components/portal.d.cts +24 -23
- package/dist/components/portal.d.ts +24 -23
- package/dist/components/portal.js +126 -60
- package/dist/components/portal.js.map +1 -1
- package/dist/components/progress.cjs +23 -24
- package/dist/components/progress.cjs.map +1 -1
- package/dist/components/progress.d.cts +8 -7
- package/dist/components/progress.d.ts +8 -7
- package/dist/components/progress.js +21 -23
- package/dist/components/progress.js.map +1 -1
- package/dist/components/progressive-blur-scroll-container.cjs +70 -138
- package/dist/components/progressive-blur-scroll-container.cjs.map +1 -1
- package/dist/components/progressive-blur-scroll-container.d.cts +19 -19
- 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 +40 -64
- package/dist/components/progressive-blur.cjs.map +1 -1
- package/dist/components/progressive-blur.d.cts +15 -14
- 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 +28 -42
- package/dist/components/radio-group.cjs.map +1 -1
- package/dist/components/radio-group.d.cts +8 -8
- package/dist/components/radio-group.d.ts +8 -8
- package/dist/components/radio-group.js +28 -41
- package/dist/components/radio-group.js.map +1 -1
- package/dist/components/record-picker.cjs +6 -418
- package/dist/components/record-picker.d.cts +13 -13
- package/dist/components/record-picker.d.ts +13 -13
- package/dist/components/record-picker.js +5 -397
- package/dist/components/resizable.cjs +32 -58
- package/dist/components/resizable.cjs.map +1 -1
- package/dist/components/resizable.d.cts +10 -9
- package/dist/components/resizable.d.ts +10 -9
- package/dist/components/resizable.js +29 -37
- package/dist/components/resizable.js.map +1 -1
- package/dist/components/responsive-diagram.cjs +50 -61
- package/dist/components/responsive-diagram.cjs.map +1 -1
- package/dist/components/responsive-diagram.d.cts +7 -7
- 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 +37 -83
- package/dist/components/scroll-area.cjs.map +1 -1
- package/dist/components/scroll-area.d.cts +9 -8
- package/dist/components/scroll-area.d.ts +9 -8
- package/dist/components/scroll-area.js +35 -62
- package/dist/components/scroll-area.js.map +1 -1
- package/dist/components/select.cjs +175 -300
- package/dist/components/select.cjs.map +1 -1
- package/dist/components/select.d.cts +36 -35
- package/dist/components/select.d.ts +36 -35
- package/dist/components/select.js +172 -278
- package/dist/components/select.js.map +1 -1
- package/dist/components/separator.cjs +16 -19
- package/dist/components/separator.cjs.map +1 -1
- package/dist/components/separator.d.cts +2 -10
- package/dist/components/separator.d.ts +2 -10
- package/dist/components/separator.js +14 -18
- package/dist/components/separator.js.map +1 -1
- package/dist/components/sheet.cjs +17 -487
- package/dist/components/sheet.d.cts +85 -85
- package/dist/components/sheet.d.ts +85 -85
- package/dist/components/sheet.js +3 -453
- package/dist/components/sidebar.cjs +27 -1298
- package/dist/components/sidebar.d.cts +62 -65
- package/dist/components/sidebar.d.ts +62 -65
- package/dist/components/sidebar.js +3 -1254
- package/dist/components/skeleton.cjs +18 -30
- package/dist/components/skeleton.cjs.map +1 -1
- package/dist/components/skeleton.d.cts +6 -5
- package/dist/components/skeleton.d.ts +6 -5
- package/dist/components/skeleton.js +15 -28
- package/dist/components/skeleton.js.map +1 -1
- package/dist/components/sonner.cjs +17 -19
- package/dist/components/sonner.cjs.map +1 -1
- package/dist/components/sonner.d.cts +7 -7
- 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 +43 -1515
- package/dist/components/stack/index.d.cts +2 -672
- package/dist/components/stack/index.d.ts +2 -672
- package/dist/components/stack/index.js +3 -1455
- package/dist/components/stepper.cjs +131 -285
- package/dist/components/stepper.cjs.map +1 -1
- package/dist/components/stepper.d.cts +27 -26
- package/dist/components/stepper.d.ts +27 -26
- package/dist/components/stepper.js +130 -265
- package/dist/components/stepper.js.map +1 -1
- package/dist/components/switch.cjs +21 -32
- package/dist/components/switch.cjs.map +1 -1
- package/dist/components/switch.d.cts +7 -6
- package/dist/components/switch.d.ts +7 -6
- package/dist/components/switch.js +19 -31
- package/dist/components/switch.js.map +1 -1
- package/dist/components/table.cjs +58 -106
- package/dist/components/table.cjs.map +1 -1
- package/dist/components/table.d.cts +17 -16
- package/dist/components/table.d.ts +17 -16
- package/dist/components/table.js +55 -104
- package/dist/components/table.js.map +1 -1
- package/dist/components/tabs.cjs +31 -35
- package/dist/components/tabs.cjs.map +1 -1
- package/dist/components/tabs.d.cts +9 -8
- package/dist/components/tabs.d.ts +9 -8
- package/dist/components/tabs.js +29 -34
- package/dist/components/tabs.js.map +1 -1
- package/dist/components/tags.cjs +114 -433
- package/dist/components/tags.cjs.map +1 -1
- package/dist/components/tags.d.cts +24 -28
- package/dist/components/tags.d.ts +24 -28
- package/dist/components/tags.js +114 -413
- package/dist/components/tags.js.map +1 -1
- package/dist/components/textarea.cjs +27 -49
- package/dist/components/textarea.cjs.map +1 -1
- package/dist/components/textarea.d.cts +8 -7
- package/dist/components/textarea.d.ts +8 -7
- package/dist/components/textarea.js +27 -48
- package/dist/components/textarea.js.map +1 -1
- package/dist/components/toast/index.cjs +9 -612
- package/dist/components/toast/index.d.cts +2 -52
- package/dist/components/toast/index.d.ts +2 -52
- package/dist/components/toast/index.js +3 -586
- package/dist/components/tooltip.cjs +47 -72
- package/dist/components/tooltip.cjs.map +1 -1
- package/dist/components/tooltip.d.cts +2 -28
- package/dist/components/tooltip.d.ts +2 -28
- package/dist/components/tooltip.js +45 -51
- package/dist/components/tooltip.js.map +1 -1
- package/dist/components/unlink-button.cjs +19 -192
- package/dist/components/unlink-button.cjs.map +1 -1
- package/dist/components/unlink-button.d.cts +11 -11
- package/dist/components/unlink-button.d.ts +11 -11
- package/dist/components/unlink-button.js +18 -170
- 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 -8697
- package/dist/index.d.cts +224 -2136
- package/dist/index.d.ts +224 -2136
- package/dist/index.js +65 -8350
- 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-BavjjJp0.cjs +625 -0
- package/dist/sidebar-BavjjJp0.cjs.map +1 -0
- package/dist/sidebar-DeoL2ttp.js +481 -0
- package/dist/sidebar-DeoL2ttp.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 +5 -5
- package/dist/components/record-picker.cjs.map +0 -1
- package/dist/components/record-picker.js.map +0 -1
- package/dist/components/sheet.cjs.map +0 -1
- package/dist/components/sheet.js.map +0 -1
- package/dist/components/sidebar.cjs.map +0 -1
- package/dist/components/sidebar.js.map +0 -1
- package/dist/components/stack/index.cjs.map +0 -1
- package/dist/components/stack/index.js.map +0 -1
- package/dist/components/toast/index.cjs.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 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"portal.cjs","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,MAAM,cAAkC;CAC7D,OAAO;CACP,OAAO;CACP,wBAAwB;CACxB,gBAAgB;AACjB,CAAC;;;;;;;;;;;;;;;;;;AAuBD,SAAgB,iBAAiB,EAChC,UACA,yBAAyB,UACzB,iBAAiB,WACjB,qBAME;CACF,MAAM,gBAAgBA,MAAM,WAAW,aAAa;CAGpD,MAAM,QAAQ,cAAc,UAAU,UAAU,cAAc,QAAQ,IAAI;CAE1E,MAAM,QAAQA,MAAM,eACZ;EACN,OAAO;EACP;EACA;EACA;EACA,mBAAmB,qBAAqB;CACzC,IACA;EAAC;EAAO;EAAmB;EAAwB;CAAc,CAClE;CAEA,OAAO,2CAAC,cAAc,UAAf;EAA+B;EAAQ;CAAiC;AAChF;;;;;AAUA,SAAgB,mBAAuC;CACtD,OAAOA,MAAM,WAAW,aAAa;AACtC;AAEA,SAAgB,oBAA6B;CAC5C,OAAOA,MAAM,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,MAAM,SAA6B,oBAAoB;CAEzF,MAAM,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,MAAM,WAAW,aAAa;CAUpG,OAAO;EAAE,WAPR,sBACC,2BAA2B,WAAW,SAAa,iBAAiB;EAMlD,aAJnB,mBAAmB,aAChB,yCACA;CAE4B;AACjC;;;;;;;;;;;;;;;;;;;;;AA0BA,SAAgB,aAAa;CAC5B,OACC,2CAAC,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"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as React from
|
|
2
|
-
|
|
1
|
+
import * as React$1 from "react";
|
|
2
|
+
//#region src/components/portal.d.ts
|
|
3
3
|
/**
|
|
4
4
|
* Overlay layer type:
|
|
5
5
|
* - 'base': Root level (page content, base floating elements)
|
|
@@ -19,16 +19,16 @@ type FloatingPortalStrategy = 'root' | 'nested';
|
|
|
19
19
|
*/
|
|
20
20
|
type FloatingZIndex = 'default' | 'elevated';
|
|
21
21
|
interface PortalContextValue {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
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;
|
|
32
32
|
}
|
|
33
33
|
declare const PORTAL_ROOT_ID = "portal-root";
|
|
34
34
|
/**
|
|
@@ -48,12 +48,12 @@ declare const PORTAL_ROOT_ID = "portal-root";
|
|
|
48
48
|
* </DialogPopup>
|
|
49
49
|
* ```
|
|
50
50
|
*/
|
|
51
|
-
declare function ModalPortalScope({ children, floatingPortalStrategy, floatingZIndex, floatingContainer
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
}): React.JSX.Element;
|
|
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;
|
|
57
57
|
/**
|
|
58
58
|
* Get the current portal context value.
|
|
59
59
|
* Used internally by other hooks.
|
|
@@ -82,8 +82,8 @@ declare function useRootPortalContainer(): HTMLElement | null;
|
|
|
82
82
|
* falls back to `document.body` instead of rendering into a dead portal.
|
|
83
83
|
*/
|
|
84
84
|
declare function useFloatingOverlayPortalProps(): {
|
|
85
|
-
|
|
86
|
-
|
|
85
|
+
container?: HTMLElement;
|
|
86
|
+
zIndexClass: string;
|
|
87
87
|
};
|
|
88
88
|
/**
|
|
89
89
|
* Portal root component to render in app layout.
|
|
@@ -105,7 +105,7 @@ declare function useFloatingOverlayPortalProps(): {
|
|
|
105
105
|
* }
|
|
106
106
|
* ```
|
|
107
107
|
*/
|
|
108
|
-
declare function PortalRoot(): React.JSX.Element;
|
|
108
|
+
declare function PortalRoot(): React$1.JSX.Element;
|
|
109
109
|
/**
|
|
110
110
|
* Hook to get the portal container element for rendering floating UI elements.
|
|
111
111
|
* Returns the element with id="portal-root" if it exists in the DOM.
|
|
@@ -113,5 +113,6 @@ declare function PortalRoot(): React.JSX.Element;
|
|
|
113
113
|
* @deprecated Use useRootPortalContainer or useFloatingOverlayPortalProps instead
|
|
114
114
|
*/
|
|
115
115
|
declare function usePortalContainer(): HTMLElement | undefined;
|
|
116
|
-
|
|
117
|
-
export {
|
|
116
|
+
//#endregion
|
|
117
|
+
export { FloatingPortalStrategy, FloatingZIndex, ModalPortalScope, OverlayLayer, PORTAL_ROOT_ID, PortalRoot, useFloatingOverlayPortalProps, useInModalOverlay, usePortalContainer, usePortalContext, useRootPortalContainer };
|
|
118
|
+
//# sourceMappingURL=portal.d.cts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as React from
|
|
2
|
-
|
|
1
|
+
import * as React$1 from "react";
|
|
2
|
+
//#region src/components/portal.d.ts
|
|
3
3
|
/**
|
|
4
4
|
* Overlay layer type:
|
|
5
5
|
* - 'base': Root level (page content, base floating elements)
|
|
@@ -19,16 +19,16 @@ type FloatingPortalStrategy = 'root' | 'nested';
|
|
|
19
19
|
*/
|
|
20
20
|
type FloatingZIndex = 'default' | 'elevated';
|
|
21
21
|
interface PortalContextValue {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
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;
|
|
32
32
|
}
|
|
33
33
|
declare const PORTAL_ROOT_ID = "portal-root";
|
|
34
34
|
/**
|
|
@@ -48,12 +48,12 @@ declare const PORTAL_ROOT_ID = "portal-root";
|
|
|
48
48
|
* </DialogPopup>
|
|
49
49
|
* ```
|
|
50
50
|
*/
|
|
51
|
-
declare function ModalPortalScope({ children, floatingPortalStrategy, floatingZIndex, floatingContainer
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
}): React.JSX.Element;
|
|
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;
|
|
57
57
|
/**
|
|
58
58
|
* Get the current portal context value.
|
|
59
59
|
* Used internally by other hooks.
|
|
@@ -82,8 +82,8 @@ declare function useRootPortalContainer(): HTMLElement | null;
|
|
|
82
82
|
* falls back to `document.body` instead of rendering into a dead portal.
|
|
83
83
|
*/
|
|
84
84
|
declare function useFloatingOverlayPortalProps(): {
|
|
85
|
-
|
|
86
|
-
|
|
85
|
+
container?: HTMLElement;
|
|
86
|
+
zIndexClass: string;
|
|
87
87
|
};
|
|
88
88
|
/**
|
|
89
89
|
* Portal root component to render in app layout.
|
|
@@ -105,7 +105,7 @@ declare function useFloatingOverlayPortalProps(): {
|
|
|
105
105
|
* }
|
|
106
106
|
* ```
|
|
107
107
|
*/
|
|
108
|
-
declare function PortalRoot(): React.JSX.Element;
|
|
108
|
+
declare function PortalRoot(): React$1.JSX.Element;
|
|
109
109
|
/**
|
|
110
110
|
* Hook to get the portal container element for rendering floating UI elements.
|
|
111
111
|
* Returns the element with id="portal-root" if it exists in the DOM.
|
|
@@ -113,5 +113,6 @@ declare function PortalRoot(): React.JSX.Element;
|
|
|
113
113
|
* @deprecated Use useRootPortalContainer or useFloatingOverlayPortalProps instead
|
|
114
114
|
*/
|
|
115
115
|
declare function usePortalContainer(): HTMLElement | undefined;
|
|
116
|
-
|
|
117
|
-
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,80 +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
|
-
|
|
29
|
-
|
|
30
|
-
|
|
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
|
+
});
|
|
31
50
|
}
|
|
51
|
+
/**
|
|
52
|
+
* Get the current portal context value.
|
|
53
|
+
* Used internally by other hooks.
|
|
54
|
+
*/
|
|
32
55
|
function usePortalContext() {
|
|
33
|
-
|
|
56
|
+
return React$1.useContext(PortalContext);
|
|
34
57
|
}
|
|
35
58
|
function useInModalOverlay() {
|
|
36
|
-
|
|
59
|
+
return React$1.useContext(PortalContext).layer === "modal";
|
|
37
60
|
}
|
|
38
61
|
function getPortalRootElement() {
|
|
39
|
-
|
|
40
|
-
|
|
62
|
+
if (typeof document === "undefined") return null;
|
|
63
|
+
return document.getElementById(PORTAL_ROOT_ID);
|
|
41
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
|
+
*/
|
|
42
76
|
function useRootPortalContainer() {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
77
|
+
const [container, setContainer] = React$1.useState(getPortalRootElement);
|
|
78
|
+
React$1.useLayoutEffect(() => {
|
|
79
|
+
setContainer(getPortalRootElement());
|
|
80
|
+
}, []);
|
|
81
|
+
return container;
|
|
48
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
|
+
*/
|
|
49
92
|
function useFloatingOverlayPortalProps() {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
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
|
+
};
|
|
55
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
|
+
*/
|
|
56
120
|
function PortalRoot() {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
// Children (portal contents) will have pointer-events: auto
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
);
|
|
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
|
+
});
|
|
71
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
|
+
*/
|
|
72
138
|
function usePortalContainer() {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
139
|
+
if (typeof document === "undefined") return void 0;
|
|
140
|
+
const el = document.getElementById(PORTAL_ROOT_ID);
|
|
141
|
+
return el instanceof HTMLElement ? el : void 0;
|
|
76
142
|
}
|
|
77
143
|
|
|
144
|
+
//#endregion
|
|
78
145
|
export { ModalPortalScope, PORTAL_ROOT_ID, PortalRoot, useFloatingOverlayPortalProps, useInModalOverlay, usePortalContainer, usePortalContext, useRootPortalContainer };
|
|
79
|
-
//# sourceMappingURL=portal.js.map
|
|
80
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"}
|
|
@@ -1,31 +1,30 @@
|
|
|
1
|
-
|
|
2
|
-
'use strict';
|
|
1
|
+
'use client';
|
|
3
2
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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");
|
|
8
10
|
|
|
9
|
-
|
|
10
|
-
return tailwindMerge.twMerge(clsx.clsx(inputs));
|
|
11
|
-
}
|
|
11
|
+
//#region src/components/progress.tsx
|
|
12
12
|
function Progress({ className, value, ...props }) {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
) });
|
|
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
|
+
});
|
|
27
26
|
}
|
|
28
27
|
|
|
28
|
+
//#endregion
|
|
29
29
|
exports.Progress = Progress;
|
|
30
|
-
//# sourceMappingURL=progress.cjs.map
|
|
31
30
|
//# sourceMappingURL=progress.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
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"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import * as React from
|
|
2
|
-
import { Progress as Progress$1 } from
|
|
3
|
-
|
|
4
|
-
type ProgressProps = Omit<React.ComponentProps<typeof Progress$1.Root>, 'children'> & {
|
|
5
|
-
|
|
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
6
|
};
|
|
7
|
-
declare function Progress({ className, value, ...props }: ProgressProps): React.JSX.Element;
|
|
8
|
-
|
|
7
|
+
declare function Progress({ className, value, ...props }: ProgressProps): React$1.JSX.Element;
|
|
8
|
+
//#endregion
|
|
9
9
|
export { Progress, type ProgressProps };
|
|
10
|
+
//# sourceMappingURL=progress.d.cts.map
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import * as React from
|
|
2
|
-
import { Progress as Progress$1 } from
|
|
3
|
-
|
|
4
|
-
type ProgressProps = Omit<React.ComponentProps<typeof Progress$1.Root>, 'children'> & {
|
|
5
|
-
|
|
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
6
|
};
|
|
7
|
-
declare function Progress({ className, value, ...props }: ProgressProps): React.JSX.Element;
|
|
8
|
-
|
|
7
|
+
declare function Progress({ className, value, ...props }: ProgressProps): React$1.JSX.Element;
|
|
8
|
+
//#endregion
|
|
9
9
|
export { Progress, type ProgressProps };
|
|
10
|
+
//# sourceMappingURL=progress.d.ts.map
|
|
@@ -1,29 +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
|
-
) });
|
|
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
|
+
});
|
|
25
23
|
}
|
|
26
24
|
|
|
25
|
+
//#endregion
|
|
27
26
|
export { Progress };
|
|
28
|
-
//# sourceMappingURL=progress.js.map
|
|
29
27
|
//# sourceMappingURL=progress.js.map
|