@constructive-io/ui 0.12.0 → 0.13.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/README.md +1 -1
- package/dist/{ai-CiaH2sfF.js → ai-B7XNnqYL.js} +1674 -228
- package/dist/ai-B7XNnqYL.js.map +1 -0
- package/dist/{ai-lAkichk8.cjs → ai-DJ-YPj8c.cjs} +1768 -226
- package/dist/ai-DJ-YPj8c.cjs.map +1 -0
- package/dist/{alert-BXuP0ayz.d.ts → alert-CJ4Qyk6W.d.cts} +4 -2
- package/dist/{alert-BXuP0ayz.d.cts → alert-CJ4Qyk6W.d.ts} +4 -2
- package/dist/components/accordion.cjs +60 -0
- package/dist/components/accordion.cjs.map +1 -0
- package/dist/components/accordion.d.cts +14 -0
- package/dist/components/accordion.d.ts +14 -0
- package/dist/components/accordion.js +54 -0
- package/dist/components/accordion.js.map +1 -0
- package/dist/components/ai/index.cjs +17 -1
- package/dist/components/ai/index.d.cts +2 -2
- package/dist/components/ai/index.d.ts +2 -2
- package/dist/components/ai/index.js +2 -2
- package/dist/components/alert-dialog.cjs +17 -8
- package/dist/components/alert-dialog.cjs.map +1 -1
- package/dist/components/alert-dialog.d.cts +1 -1
- package/dist/components/alert-dialog.d.ts +1 -1
- package/dist/components/alert-dialog.js +17 -8
- package/dist/components/alert-dialog.js.map +1 -1
- package/dist/components/alert.cjs +18 -8
- package/dist/components/alert.cjs.map +1 -1
- package/dist/components/alert.d.cts +2 -2
- package/dist/components/alert.d.ts +2 -2
- package/dist/components/alert.js +18 -9
- package/dist/components/alert.js.map +1 -1
- package/dist/components/autocomplete.cjs +9 -5
- package/dist/components/autocomplete.cjs.map +1 -1
- package/dist/components/autocomplete.js +9 -5
- package/dist/components/autocomplete.js.map +1 -1
- package/dist/components/avatar.cjs +9 -3
- package/dist/components/avatar.cjs.map +1 -1
- package/dist/components/avatar.d.cts +6 -0
- package/dist/components/avatar.d.ts +6 -0
- package/dist/components/avatar.js +9 -3
- package/dist/components/avatar.js.map +1 -1
- package/dist/components/badge.cjs +25 -18
- package/dist/components/badge.cjs.map +1 -1
- package/dist/components/badge.d.cts +2 -2
- package/dist/components/badge.d.ts +2 -2
- package/dist/components/badge.js +25 -18
- package/dist/components/badge.js.map +1 -1
- package/dist/components/breadcrumb.cjs +9 -6
- package/dist/components/breadcrumb.cjs.map +1 -1
- package/dist/components/breadcrumb.js +9 -6
- package/dist/components/breadcrumb.js.map +1 -1
- package/dist/components/button-group.cjs +57 -0
- package/dist/components/button-group.cjs.map +1 -0
- package/dist/components/button-group.d.cts +16 -0
- package/dist/components/button-group.d.ts +16 -0
- package/dist/components/button-group.js +51 -0
- package/dist/components/button-group.js.map +1 -0
- package/dist/components/button.cjs +59 -15
- package/dist/components/button.cjs.map +1 -1
- package/dist/components/button.d.cts +32 -2
- package/dist/components/button.d.ts +32 -2
- package/dist/components/button.js +59 -15
- package/dist/components/button.js.map +1 -1
- package/dist/components/calendar-rac.cjs +14 -8
- package/dist/components/calendar-rac.cjs.map +1 -1
- package/dist/components/calendar-rac.js +14 -8
- package/dist/components/calendar-rac.js.map +1 -1
- package/dist/components/card.cjs +35 -23
- package/dist/components/card.cjs.map +1 -1
- package/dist/components/card.d.cts +2 -1
- package/dist/components/card.d.ts +2 -1
- package/dist/components/card.js +35 -23
- package/dist/components/card.js.map +1 -1
- package/dist/components/checkbox.cjs +5 -5
- package/dist/components/checkbox.cjs.map +1 -1
- package/dist/components/checkbox.js +5 -5
- package/dist/components/checkbox.js.map +1 -1
- package/dist/components/collapsible.cjs +3 -3
- package/dist/components/collapsible.cjs.map +1 -1
- package/dist/components/collapsible.js +3 -3
- package/dist/components/collapsible.js.map +1 -1
- package/dist/components/combobox.cjs +24 -12
- package/dist/components/combobox.cjs.map +1 -1
- package/dist/components/combobox.d.cts +2 -1
- package/dist/components/combobox.d.ts +2 -1
- package/dist/components/combobox.js +24 -12
- package/dist/components/combobox.js.map +1 -1
- package/dist/components/command.cjs +25 -14
- package/dist/components/command.cjs.map +1 -1
- package/dist/components/command.d.cts +6 -2
- package/dist/components/command.d.ts +6 -2
- package/dist/components/command.js +25 -14
- package/dist/components/command.js.map +1 -1
- package/dist/components/dialog.cjs +22 -12
- package/dist/components/dialog.cjs.map +1 -1
- package/dist/components/dialog.d.cts +5 -2
- package/dist/components/dialog.d.ts +5 -2
- package/dist/components/dialog.js +22 -12
- package/dist/components/dialog.js.map +1 -1
- package/dist/components/dock.cjs +50 -27
- package/dist/components/dock.cjs.map +1 -1
- package/dist/components/dock.d.cts +1 -1
- package/dist/components/dock.d.ts +1 -1
- package/dist/components/dock.js +51 -28
- package/dist/components/dock.js.map +1 -1
- package/dist/components/drawer.cjs +22 -14
- package/dist/components/drawer.cjs.map +1 -1
- package/dist/components/drawer.js +22 -14
- package/dist/components/drawer.js.map +1 -1
- package/dist/components/dropdown-menu.cjs +34 -28
- package/dist/components/dropdown-menu.cjs.map +1 -1
- package/dist/components/dropdown-menu.d.cts +2 -2
- package/dist/components/dropdown-menu.d.ts +2 -2
- package/dist/components/dropdown-menu.js +52 -46
- package/dist/components/dropdown-menu.js.map +1 -1
- package/dist/components/empty.cjs +4 -4
- package/dist/components/empty.cjs.map +1 -1
- package/dist/components/empty.js +4 -4
- package/dist/components/empty.js.map +1 -1
- package/dist/components/field.cjs +33 -33
- package/dist/components/field.cjs.map +1 -1
- package/dist/components/field.d.cts +1 -1
- package/dist/components/field.d.ts +1 -1
- package/dist/components/field.js +34 -34
- package/dist/components/field.js.map +1 -1
- package/dist/components/flickering-grid.cjs +1 -1
- package/dist/components/flickering-grid.cjs.map +1 -1
- package/dist/components/flickering-grid.js +1 -1
- package/dist/components/flickering-grid.js.map +1 -1
- package/dist/components/flow-zoom-panel.cjs +10 -5
- package/dist/components/flow-zoom-panel.cjs.map +1 -1
- package/dist/components/flow-zoom-panel.d.cts +8 -1
- package/dist/components/flow-zoom-panel.d.ts +8 -1
- package/dist/components/flow-zoom-panel.js +10 -5
- package/dist/components/flow-zoom-panel.js.map +1 -1
- package/dist/components/form-control.cjs +12 -8
- package/dist/components/form-control.cjs.map +1 -1
- package/dist/components/form-control.js +12 -8
- package/dist/components/form-control.js.map +1 -1
- package/dist/components/form.cjs +5 -5
- package/dist/components/form.cjs.map +1 -1
- package/dist/components/form.js +5 -5
- package/dist/components/form.js.map +1 -1
- package/dist/components/input-group.cjs +13 -7
- package/dist/components/input-group.cjs.map +1 -1
- package/dist/components/input-group.d.cts +2 -2
- package/dist/components/input-group.d.ts +2 -2
- package/dist/components/input-group.js +11 -7
- package/dist/components/input-group.js.map +1 -1
- package/dist/components/input-otp.cjs +252 -0
- package/dist/components/input-otp.cjs.map +1 -0
- package/dist/components/input-otp.d.cts +44 -0
- package/dist/components/input-otp.d.ts +44 -0
- package/dist/components/input-otp.js +251 -0
- package/dist/components/input-otp.js.map +1 -0
- package/dist/components/input.cjs +10 -4
- package/dist/components/input.cjs.map +1 -1
- package/dist/components/input.d.cts +11 -2
- package/dist/components/input.d.ts +11 -2
- package/dist/components/input.js +10 -4
- package/dist/components/input.js.map +1 -1
- package/dist/components/item.cjs +151 -0
- package/dist/components/item.cjs.map +1 -0
- package/dist/components/item.d.cts +37 -0
- package/dist/components/item.d.ts +37 -0
- package/dist/components/item.js +137 -0
- package/dist/components/item.js.map +1 -0
- package/dist/components/json-input.cjs +4 -143
- package/dist/components/json-input.d.cts +6 -4
- package/dist/components/json-input.d.ts +6 -4
- package/dist/components/json-input.js +2 -140
- package/dist/components/kbd.cjs +35 -0
- package/dist/components/kbd.cjs.map +1 -0
- package/dist/components/kbd.d.cts +16 -0
- package/dist/components/kbd.d.ts +16 -0
- package/dist/components/kbd.js +31 -0
- package/dist/components/kbd.js.map +1 -0
- package/dist/components/label.cjs +3 -3
- package/dist/components/label.cjs.map +1 -1
- package/dist/components/label.js +3 -3
- package/dist/components/label.js.map +1 -1
- package/dist/components/motion-grid.cjs +20 -8
- package/dist/components/motion-grid.cjs.map +1 -1
- package/dist/components/motion-grid.js +20 -8
- package/dist/components/motion-grid.js.map +1 -1
- package/dist/components/multi-select.cjs +77 -67
- package/dist/components/multi-select.cjs.map +1 -1
- package/dist/components/multi-select.js +77 -67
- package/dist/components/multi-select.js.map +1 -1
- package/dist/components/page-header.cjs +12 -9
- package/dist/components/page-header.cjs.map +1 -1
- package/dist/components/page-header.js +12 -9
- package/dist/components/page-header.js.map +1 -1
- package/dist/components/pagination.cjs +10 -4
- package/dist/components/pagination.cjs.map +1 -1
- package/dist/components/pagination.d.cts +1 -1
- package/dist/components/pagination.d.ts +1 -1
- package/dist/components/pagination.js +10 -4
- package/dist/components/pagination.js.map +1 -1
- package/dist/components/phone-input.cjs +228 -0
- package/dist/components/phone-input.cjs.map +1 -0
- package/dist/components/phone-input.d.cts +42 -0
- package/dist/components/phone-input.d.ts +42 -0
- package/dist/components/phone-input.js +220 -0
- package/dist/components/phone-input.js.map +1 -0
- package/dist/components/popover.cjs +5 -4
- package/dist/components/popover.cjs.map +1 -1
- package/dist/components/popover.js +5 -4
- package/dist/components/popover.js.map +1 -1
- package/dist/components/progress.cjs +20 -3
- package/dist/components/progress.cjs.map +1 -1
- package/dist/components/progress.d.cts +1 -1
- package/dist/components/progress.d.ts +1 -1
- package/dist/components/progress.js +20 -3
- package/dist/components/progress.js.map +1 -1
- package/dist/components/progressive-blur-scroll-container.cjs +2 -2
- package/dist/components/progressive-blur-scroll-container.cjs.map +1 -1
- package/dist/components/progressive-blur-scroll-container.d.cts +1 -1
- package/dist/components/progressive-blur-scroll-container.d.ts +1 -1
- package/dist/components/progressive-blur-scroll-container.js +2 -2
- package/dist/components/progressive-blur-scroll-container.js.map +1 -1
- package/dist/components/progressive-blur.cjs +3 -2
- package/dist/components/progressive-blur.cjs.map +1 -1
- package/dist/components/progressive-blur.js +3 -2
- package/dist/components/progressive-blur.js.map +1 -1
- package/dist/components/radio-group.cjs +2 -2
- package/dist/components/radio-group.cjs.map +1 -1
- package/dist/components/radio-group.js +2 -2
- package/dist/components/radio-group.js.map +1 -1
- package/dist/components/record-picker.cjs +1 -1
- package/dist/components/record-picker.js +1 -1
- package/dist/components/resizable.cjs +2 -2
- package/dist/components/resizable.cjs.map +1 -1
- package/dist/components/resizable.js +2 -2
- package/dist/components/resizable.js.map +1 -1
- package/dist/components/responsive-diagram.cjs +43 -21
- package/dist/components/responsive-diagram.cjs.map +1 -1
- package/dist/components/responsive-diagram.d.cts +7 -1
- package/dist/components/responsive-diagram.d.ts +7 -1
- package/dist/components/responsive-diagram.js +43 -21
- package/dist/components/responsive-diagram.js.map +1 -1
- package/dist/components/scroll-area.cjs +2 -2
- package/dist/components/scroll-area.cjs.map +1 -1
- package/dist/components/scroll-area.js +2 -2
- package/dist/components/scroll-area.js.map +1 -1
- package/dist/components/select.cjs +84 -20
- package/dist/components/select.cjs.map +1 -1
- package/dist/components/select.d.cts +12 -7
- package/dist/components/select.d.ts +12 -7
- package/dist/components/select.js +84 -20
- package/dist/components/select.js.map +1 -1
- package/dist/components/separator.cjs +1 -1
- package/dist/components/separator.cjs.map +1 -1
- package/dist/components/separator.d.cts +11 -2
- package/dist/components/separator.d.ts +11 -2
- package/dist/components/separator.js +1 -1
- package/dist/components/separator.js.map +1 -1
- package/dist/components/sheet.cjs +1 -1
- package/dist/components/sheet.d.cts +11 -5
- package/dist/components/sheet.d.ts +12 -6
- package/dist/components/sheet.js +1 -1
- package/dist/components/sidebar.cjs +2 -1
- package/dist/components/sidebar.d.cts +7 -6
- package/dist/components/sidebar.d.ts +7 -6
- package/dist/components/sidebar.js +2 -1
- package/dist/components/slider.cjs +47 -0
- package/dist/components/slider.cjs.map +1 -0
- package/dist/components/slider.d.cts +8 -0
- package/dist/components/slider.d.ts +8 -0
- package/dist/components/slider.js +44 -0
- package/dist/components/slider.js.map +1 -0
- package/dist/components/sonner.cjs +15 -4
- package/dist/components/sonner.cjs.map +1 -1
- package/dist/components/sonner.d.cts +10 -1
- package/dist/components/sonner.d.ts +10 -1
- package/dist/components/sonner.js +16 -5
- package/dist/components/sonner.js.map +1 -1
- package/dist/components/spinner.cjs +25 -0
- package/dist/components/spinner.cjs.map +1 -0
- package/dist/components/spinner.d.cts +16 -0
- package/dist/components/spinner.d.ts +16 -0
- package/dist/components/spinner.js +22 -0
- package/dist/components/spinner.js.map +1 -0
- package/dist/components/stack/index.cjs +1 -1
- package/dist/components/stack/index.d.cts +1 -1
- package/dist/components/stack/index.d.ts +1 -1
- package/dist/components/stack/index.js +1 -1
- package/dist/components/stepper.cjs +23 -17
- package/dist/components/stepper.cjs.map +1 -1
- package/dist/components/stepper.d.cts +2 -2
- package/dist/components/stepper.d.ts +2 -2
- package/dist/components/stepper.js +23 -17
- package/dist/components/stepper.js.map +1 -1
- package/dist/components/switch.cjs +5 -5
- package/dist/components/switch.cjs.map +1 -1
- package/dist/components/switch.js +5 -5
- package/dist/components/switch.js.map +1 -1
- package/dist/components/table.cjs +26 -7
- package/dist/components/table.cjs.map +1 -1
- package/dist/components/table.d.cts +20 -2
- package/dist/components/table.d.ts +20 -2
- package/dist/components/table.js +26 -8
- package/dist/components/table.js.map +1 -1
- package/dist/components/tabs.cjs +61 -8
- package/dist/components/tabs.cjs.map +1 -1
- package/dist/components/tabs.d.cts +13 -2
- package/dist/components/tabs.d.ts +13 -2
- package/dist/components/tabs.js +63 -11
- package/dist/components/tabs.js.map +1 -1
- package/dist/components/tags.cjs +10 -5
- package/dist/components/tags.cjs.map +1 -1
- package/dist/components/tags.d.cts +1 -1
- package/dist/components/tags.d.ts +1 -1
- package/dist/components/tags.js +10 -5
- package/dist/components/tags.js.map +1 -1
- package/dist/components/textarea.cjs +5 -4
- package/dist/components/textarea.cjs.map +1 -1
- package/dist/components/textarea.js +5 -4
- package/dist/components/textarea.js.map +1 -1
- package/dist/components/toast/index.cjs +1 -1
- package/dist/components/toast/index.d.cts +2 -2
- package/dist/components/toast/index.d.ts +2 -2
- package/dist/components/toast/index.js +1 -1
- package/dist/components/toggle-group.cjs +69 -0
- package/dist/components/toggle-group.cjs.map +1 -0
- package/dist/components/toggle-group.d.cts +27 -0
- package/dist/components/toggle-group.d.ts +27 -0
- package/dist/components/toggle-group.js +65 -0
- package/dist/components/toggle-group.js.map +1 -0
- package/dist/components/toggle.cjs +54 -0
- package/dist/components/toggle.cjs.map +1 -0
- package/dist/components/toggle.d.cts +13 -0
- package/dist/components/toggle.d.ts +13 -0
- package/dist/components/toggle.js +50 -0
- package/dist/components/toggle.js.map +1 -0
- package/dist/components/tooltip.cjs +18 -6
- package/dist/components/tooltip.cjs.map +1 -1
- package/dist/components/tooltip.d.cts +1 -1
- package/dist/components/tooltip.d.ts +1 -1
- package/dist/components/tooltip.js +18 -6
- package/dist/components/tooltip.js.map +1 -1
- package/dist/components/unlink-button.cjs +2 -2
- package/dist/components/unlink-button.cjs.map +1 -1
- package/dist/components/unlink-button.d.cts +1 -0
- package/dist/components/unlink-button.d.ts +1 -0
- package/dist/components/unlink-button.js +2 -2
- package/dist/components/unlink-button.js.map +1 -1
- package/dist/components/workspace-kit/index.cjs +1477 -0
- package/dist/components/workspace-kit/index.cjs.map +1 -0
- package/dist/components/workspace-kit/index.d.cts +716 -0
- package/dist/components/workspace-kit/index.d.ts +716 -0
- package/dist/components/workspace-kit/index.js +1410 -0
- package/dist/components/workspace-kit/index.js.map +1 -0
- package/dist/compose-refs-Mbma1O3M.js +47 -0
- package/dist/compose-refs-Mbma1O3M.js.map +1 -0
- package/dist/compose-refs-uPrvNoiU.cjs +52 -0
- package/dist/compose-refs-uPrvNoiU.cjs.map +1 -0
- package/dist/fluid-highlight-AW-OITqJ.cjs +124 -0
- package/dist/fluid-highlight-AW-OITqJ.cjs.map +1 -0
- package/dist/fluid-highlight-DxWeZ7iu.js +119 -0
- package/dist/fluid-highlight-DxWeZ7iu.js.map +1 -0
- package/dist/{index-BzLmDsId.d.cts → index-B7cT7gZU.d.cts} +3 -3
- package/dist/{index-BzLmDsId.d.ts → index-B7cT7gZU.d.ts} +3 -3
- package/dist/{index-UnM04j0t.d.ts → index-BQZxmMpw.d.cts} +11 -31
- package/dist/{index-UnM04j0t.d.cts → index-BQZxmMpw.d.ts} +11 -31
- package/dist/{index-B0wXxIAb.d.ts → index-CiO-3M_X.d.cts} +334 -18
- package/dist/{index-CyaFaZe2.d.cts → index-z3LqQ5L5.d.ts} +334 -18
- package/dist/index.cjs +107 -17
- package/dist/index.d.cts +64 -14
- package/dist/index.d.ts +64 -14
- package/dist/index.js +27 -14
- package/dist/initial-focus-B8RLtyOZ.cjs +67 -0
- package/dist/initial-focus-B8RLtyOZ.cjs.map +1 -0
- package/dist/initial-focus-j2E0EnIx.js +61 -0
- package/dist/initial-focus-j2E0EnIx.js.map +1 -0
- package/dist/initials-DSkWTOb0.cjs +127 -0
- package/dist/initials-DSkWTOb0.cjs.map +1 -0
- package/dist/initials-kCcHgrSy.js +97 -0
- package/dist/initials-kCcHgrSy.js.map +1 -0
- package/dist/json-input-CH5aEmoA.js +293 -0
- package/dist/json-input-CH5aEmoA.js.map +1 -0
- package/dist/json-input-D8yM578l.cjs +311 -0
- package/dist/json-input-D8yM578l.cjs.map +1 -0
- package/dist/{motion-config-COCFHq1L.cjs → motion-config-DZ7w5Uhq.cjs} +32 -2
- package/dist/motion-config-DZ7w5Uhq.cjs.map +1 -0
- package/dist/{motion-config-COsZ6azM.js → motion-config-DoFp4I8f.js} +21 -3
- package/dist/motion-config-DoFp4I8f.js.map +1 -0
- package/dist/{record-picker-Bz4FApxD.cjs → record-picker-BQ1-Vx0g.cjs} +23 -8
- package/dist/record-picker-BQ1-Vx0g.cjs.map +1 -0
- package/dist/{record-picker-BbxngCeV.js → record-picker-DSRo4RXV.js} +23 -8
- package/dist/record-picker-DSRo4RXV.js.map +1 -0
- package/dist/{sheet-BdA0rfIz.cjs → sheet-OxWlnT_G.cjs} +25 -32
- package/dist/sheet-OxWlnT_G.cjs.map +1 -0
- package/dist/{sheet-BLHnhLRH.js → sheet-wPF_l9Cn.js} +25 -32
- package/dist/sheet-wPF_l9Cn.js.map +1 -0
- package/dist/{sidebar-BavjjJp0.cjs → sidebar-BEEWmJwC.cjs} +74 -57
- package/dist/sidebar-BEEWmJwC.cjs.map +1 -0
- package/dist/{sidebar-DeoL2ttp.js → sidebar-DWl1Azyv.js} +74 -57
- package/dist/sidebar-DWl1Azyv.js.map +1 -0
- package/dist/{stack-ci2lkfkr.cjs → stack-CEvmUSwF.cjs} +12 -10
- package/dist/stack-CEvmUSwF.cjs.map +1 -0
- package/dist/{stack-C9GROTGA.js → stack-Kqu7YaR0.js} +12 -10
- package/dist/stack-Kqu7YaR0.js.map +1 -0
- package/dist/text-runs-CdmlS5C7.cjs +52 -0
- package/dist/text-runs-CdmlS5C7.cjs.map +1 -0
- package/dist/text-runs-DqcEO8L_.js +45 -0
- package/dist/text-runs-DqcEO8L_.js.map +1 -0
- package/dist/theme-DTTTlylA.d.cts +520 -0
- package/dist/theme-DTTTlylA.d.ts +520 -0
- package/dist/theme-dials-config.cjs +273 -0
- package/dist/theme-dials-config.cjs.map +1 -0
- package/dist/theme-dials-config.d.cts +95 -0
- package/dist/theme-dials-config.d.ts +95 -0
- package/dist/theme-dials-config.js +269 -0
- package/dist/theme-dials-config.js.map +1 -0
- package/dist/theme-presets.cjs +922 -0
- package/dist/theme-presets.cjs.map +1 -0
- package/dist/theme-presets.d.cts +89 -0
- package/dist/theme-presets.d.ts +89 -0
- package/dist/theme-presets.js +912 -0
- package/dist/theme-presets.js.map +1 -0
- package/dist/theme-tuning-DjgDvV8V.d.ts +158 -0
- package/dist/theme-tuning-TJ76tnxZ.d.cts +158 -0
- package/dist/theme-tuning.cjs +349 -0
- package/dist/theme-tuning.cjs.map +1 -0
- package/dist/theme-tuning.d.cts +2 -0
- package/dist/theme-tuning.d.ts +2 -0
- package/dist/theme-tuning.js +333 -0
- package/dist/theme-tuning.js.map +1 -0
- package/dist/theme.cjs +432 -0
- package/dist/theme.cjs.map +1 -0
- package/dist/theme.d.cts +2 -0
- package/dist/theme.d.ts +2 -0
- package/dist/theme.js +430 -0
- package/dist/theme.js.map +1 -0
- package/dist/toast-08jF1DBQ.cjs +193 -0
- package/dist/toast-08jF1DBQ.cjs.map +1 -0
- package/dist/toast-CVW5XY4u.js +164 -0
- package/dist/toast-CVW5XY4u.js.map +1 -0
- package/dist/toast-details-BdxxSLlN.cjs +209 -0
- package/dist/toast-details-BdxxSLlN.cjs.map +1 -0
- package/dist/toast-details-CfsB1Vxb.js +198 -0
- package/dist/toast-details-CfsB1Vxb.js.map +1 -0
- package/dist/{tooltip-CTRQoN1A.d.ts → tooltip-Fqb4JK-g.d.cts} +2 -2
- package/dist/{tooltip-CTRQoN1A.d.cts → tooltip-Fqb4JK-g.d.ts} +2 -2
- package/dist/tuning-BKVFsxLr.js +48 -0
- package/dist/tuning-BKVFsxLr.js.map +1 -0
- package/dist/tuning-BRPG7U1U.cjs +71 -0
- package/dist/tuning-BRPG7U1U.cjs.map +1 -0
- package/dist/use-document-theme-BSEuNsEE.cjs +43 -0
- package/dist/use-document-theme-BSEuNsEE.cjs.map +1 -0
- package/dist/use-document-theme-Ch_PqxZz.js +38 -0
- package/dist/use-document-theme-Ch_PqxZz.js.map +1 -0
- package/dist/use-scroll-fade-CaHp52u4.cjs +79 -0
- package/dist/use-scroll-fade-CaHp52u4.cjs.map +1 -0
- package/dist/use-scroll-fade-ilq-o00-.js +72 -0
- package/dist/use-scroll-fade-ilq-o00-.js.map +1 -0
- package/package.json +163 -27
- package/src/styles/globals.css +176 -97
- package/dist/ai-CiaH2sfF.js.map +0 -1
- package/dist/ai-lAkichk8.cjs.map +0 -1
- package/dist/button-Bvh83YGs.d.cts +0 -20
- package/dist/button-Bvh83YGs.d.ts +0 -20
- package/dist/components/app-bar.cjs +0 -81
- package/dist/components/app-bar.cjs.map +0 -1
- package/dist/components/app-bar.d.cts +0 -27
- package/dist/components/app-bar.d.ts +0 -27
- package/dist/components/app-bar.js +0 -77
- package/dist/components/app-bar.js.map +0 -1
- package/dist/components/app-shell.cjs +0 -267
- package/dist/components/app-shell.cjs.map +0 -1
- package/dist/components/app-shell.d.cts +0 -98
- package/dist/components/app-shell.d.ts +0 -98
- package/dist/components/app-shell.js +0 -264
- package/dist/components/app-shell.js.map +0 -1
- package/dist/components/json-input.cjs.map +0 -1
- package/dist/components/json-input.js.map +0 -1
- package/dist/input-CBrCuMH8.d.cts +0 -11
- package/dist/input-CBrCuMH8.d.ts +0 -11
- package/dist/motion-config-COCFHq1L.cjs.map +0 -1
- package/dist/motion-config-COsZ6azM.js.map +0 -1
- package/dist/record-picker-BbxngCeV.js.map +0 -1
- package/dist/record-picker-Bz4FApxD.cjs.map +0 -1
- package/dist/separator-BQEsr0Rc.d.cts +0 -11
- package/dist/separator-BQEsr0Rc.d.ts +0 -11
- package/dist/sheet-BLHnhLRH.js.map +0 -1
- package/dist/sheet-BdA0rfIz.cjs.map +0 -1
- package/dist/sidebar-BavjjJp0.cjs.map +0 -1
- package/dist/sidebar-DeoL2ttp.js.map +0 -1
- package/dist/stack-C9GROTGA.js.map +0 -1
- package/dist/stack-ci2lkfkr.cjs.map +0 -1
- package/dist/toast-D6MqijT2.cjs +0 -316
- package/dist/toast-D6MqijT2.cjs.map +0 -1
- package/dist/toast-D_BOLzm3.js +0 -287
- package/dist/toast-D_BOLzm3.js.map +0 -1
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { t as cn } from "../utils-BkMLyah9.js";
|
|
4
|
+
import { InputGroup, InputGroupInput } from "./input-group.js";
|
|
5
|
+
import { Combobox, ComboboxEmpty, ComboboxInput, ComboboxItem, ComboboxList, ComboboxPopup, ComboboxTrigger, useComboboxFilter } from "./combobox.js";
|
|
6
|
+
import { useMemo, useSyncExternalStore } from "react";
|
|
7
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
import { ChevronDownIcon, GlobeIcon } from "lucide-react";
|
|
9
|
+
import * as BasePhoneInput from "react-phone-number-input";
|
|
10
|
+
|
|
11
|
+
//#region src/components/phone-input.tsx
|
|
12
|
+
const FALLBACK_COUNTRY = "US";
|
|
13
|
+
const E164 = /^\+[1-9]\d{6,14}$/;
|
|
14
|
+
const defaultLabels = {
|
|
15
|
+
country: "Country: {{country}}",
|
|
16
|
+
countryFallback: "Country",
|
|
17
|
+
search: "Search countries",
|
|
18
|
+
empty: "No country found."
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* The user's region from their browser's language preferences, e.g. `en-GB` → GB, or `de` → DE by likely
|
|
22
|
+
* subtags. The first one the picker supports wins. There is no browser API from a timezone to a country, and a
|
|
23
|
+
* locale's region is the signal the browser does carry.
|
|
24
|
+
*/
|
|
25
|
+
function detectCountry(languages = typeof navigator === "undefined" ? [] : navigator.languages ?? [navigator.language]) {
|
|
26
|
+
for (const tag of languages) try {
|
|
27
|
+
const region = new Intl.Locale(tag).maximize().region;
|
|
28
|
+
if (region && BasePhoneInput.isSupportedCountry(region)) return region;
|
|
29
|
+
} catch {}
|
|
30
|
+
}
|
|
31
|
+
function subscribeToLanguage(onChange) {
|
|
32
|
+
window.addEventListener("languagechange", onChange);
|
|
33
|
+
return () => window.removeEventListener("languagechange", onChange);
|
|
34
|
+
}
|
|
35
|
+
let detected;
|
|
36
|
+
function detectedCountrySnapshot() {
|
|
37
|
+
const languages = navigator.languages ?? [navigator.language];
|
|
38
|
+
const key = languages.join();
|
|
39
|
+
if (detected?.languages !== key) detected = {
|
|
40
|
+
languages: key,
|
|
41
|
+
country: detectCountry(languages) ?? FALLBACK_COUNTRY
|
|
42
|
+
};
|
|
43
|
+
return detected.country;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* The server renders the fallback so hydration matches; the client then reports the detected country, which the
|
|
47
|
+
* phone field adopts only while the user has not typed a number or picked a country.
|
|
48
|
+
*/
|
|
49
|
+
function useDetectedCountry() {
|
|
50
|
+
return useSyncExternalStore(subscribeToLanguage, detectedCountrySnapshot, () => FALLBACK_COUNTRY);
|
|
51
|
+
}
|
|
52
|
+
let flagComponents;
|
|
53
|
+
let flagsRequest;
|
|
54
|
+
const flagListeners = /* @__PURE__ */ new Set();
|
|
55
|
+
function subscribeToFlags(onChange) {
|
|
56
|
+
flagListeners.add(onChange);
|
|
57
|
+
flagsRequest ??= import("react-phone-number-input/flags").then((module) => {
|
|
58
|
+
flagComponents = module.default;
|
|
59
|
+
for (const listener of flagListeners) listener();
|
|
60
|
+
});
|
|
61
|
+
return () => flagListeners.delete(onChange);
|
|
62
|
+
}
|
|
63
|
+
function useFlagComponents() {
|
|
64
|
+
return useSyncExternalStore(subscribeToFlags, () => flagComponents, () => void 0);
|
|
65
|
+
}
|
|
66
|
+
/** Returns the number in E.164 form, or null when it is not a possible number for its country. */
|
|
67
|
+
function normalizePhoneNumber(raw) {
|
|
68
|
+
const digits = raw.replace(/[\s().-]/g, "");
|
|
69
|
+
const candidate = digits.startsWith("00") ? `+${digits.slice(2)}` : digits;
|
|
70
|
+
return E164.test(candidate) && BasePhoneInput.isPossiblePhoneNumber(candidate) ? candidate : null;
|
|
71
|
+
}
|
|
72
|
+
/** International grouping for reading, e.g. +1 202 555 0143; unparseable input is returned as-is. */
|
|
73
|
+
function formatPhoneNumber(e164) {
|
|
74
|
+
return BasePhoneInput.formatPhoneNumberIntl(e164) || e164;
|
|
75
|
+
}
|
|
76
|
+
/** The country calling code a number carries, e.g. +1, +44, +353; '' when it cannot be parsed. */
|
|
77
|
+
function phoneCallingCode(e164) {
|
|
78
|
+
const code = BasePhoneInput.parsePhoneNumber(e164)?.countryCallingCode;
|
|
79
|
+
return code ? `+${code}` : "";
|
|
80
|
+
}
|
|
81
|
+
/** Country picker + national-format number field; digits only, emits E.164. Defaults to the user's region. */
|
|
82
|
+
function PhoneInput({ className, value, onChange, defaultCountry, invalid, disabled, labels: labelOverrides, ...props }) {
|
|
83
|
+
const detected = useDetectedCountry();
|
|
84
|
+
const labels = {
|
|
85
|
+
...defaultLabels,
|
|
86
|
+
...labelOverrides
|
|
87
|
+
};
|
|
88
|
+
return /* @__PURE__ */ jsx(BasePhoneInput.default, {
|
|
89
|
+
className,
|
|
90
|
+
value: value || void 0,
|
|
91
|
+
onChange: (next) => onChange(next ?? ""),
|
|
92
|
+
defaultCountry: defaultCountry ?? detected,
|
|
93
|
+
initialValueFormat: "national",
|
|
94
|
+
disabled,
|
|
95
|
+
addInternationalOption: false,
|
|
96
|
+
limitMaxLength: true,
|
|
97
|
+
focusInputOnCountrySelection: true,
|
|
98
|
+
containerComponent: PhoneInputGroup,
|
|
99
|
+
countrySelectComponent: CountrySelect,
|
|
100
|
+
countrySelectProps: { labels },
|
|
101
|
+
inputComponent: NumberInput,
|
|
102
|
+
flagComponent: PhoneFlag,
|
|
103
|
+
"aria-invalid": invalid || void 0,
|
|
104
|
+
"data-slot": "phone-input",
|
|
105
|
+
...props
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
function PhoneInputGroup({ className, children, ...props }) {
|
|
109
|
+
return /* @__PURE__ */ jsx(InputGroup, {
|
|
110
|
+
className: cn("overflow-hidden", className),
|
|
111
|
+
...props,
|
|
112
|
+
children
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
function NumberInput({ className, ...props }) {
|
|
116
|
+
return /* @__PURE__ */ jsx(InputGroupInput, {
|
|
117
|
+
className: cn("tabular-nums", className),
|
|
118
|
+
...props
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
function CountrySelect({ value, onChange, options, disabled, labels }) {
|
|
122
|
+
const items = useMemo(() => options.flatMap((option) => option.value ? [{
|
|
123
|
+
value: option.value,
|
|
124
|
+
label: option.label,
|
|
125
|
+
code: `+${BasePhoneInput.getCountryCallingCode(option.value)}`
|
|
126
|
+
}] : []), [options]);
|
|
127
|
+
const selected = items.find((item) => item.value === value) ?? null;
|
|
128
|
+
const { contains } = useComboboxFilter();
|
|
129
|
+
const matches = (item, query) => contains(item, query, (country) => `${country.label} ${country.code}`);
|
|
130
|
+
return /* @__PURE__ */ jsxs(Combobox, {
|
|
131
|
+
items,
|
|
132
|
+
value: selected,
|
|
133
|
+
filter: matches,
|
|
134
|
+
onValueChange: (next) => next && onChange(next.value),
|
|
135
|
+
disabled,
|
|
136
|
+
children: [/* @__PURE__ */ jsxs(ComboboxTrigger, {
|
|
137
|
+
"aria-label": selected ? labels.country.replace("{{country}}", selected.label) : labels.countryFallback,
|
|
138
|
+
"data-slot": "phone-input-country",
|
|
139
|
+
className: "flex shrink-0 cursor-pointer items-center gap-2 self-stretch border-e border-input ps-3 pe-2 text-sm tabular-nums text-foreground outline-none hover:bg-accent/60 focus-visible:bg-accent/60 disabled:cursor-not-allowed data-popup-open:bg-accent/60",
|
|
140
|
+
children: [
|
|
141
|
+
selected && /* @__PURE__ */ jsx(PhoneFlag, {
|
|
142
|
+
country: selected.value,
|
|
143
|
+
countryName: selected.label
|
|
144
|
+
}),
|
|
145
|
+
/* @__PURE__ */ jsx("span", {
|
|
146
|
+
dir: "ltr",
|
|
147
|
+
className: "[unicode-bidi:isolate]",
|
|
148
|
+
children: selected?.code
|
|
149
|
+
}),
|
|
150
|
+
/* @__PURE__ */ jsx(ChevronDownIcon, {
|
|
151
|
+
className: "size-3.5 text-muted-foreground",
|
|
152
|
+
"aria-hidden": true
|
|
153
|
+
})
|
|
154
|
+
]
|
|
155
|
+
}), /* @__PURE__ */ jsxs(ComboboxPopup, {
|
|
156
|
+
style: { width: "17rem" },
|
|
157
|
+
align: "start",
|
|
158
|
+
children: [
|
|
159
|
+
/* @__PURE__ */ jsx("div", {
|
|
160
|
+
className: "border-b p-1",
|
|
161
|
+
children: /* @__PURE__ */ jsx(ComboboxInput, {
|
|
162
|
+
placeholder: labels.search,
|
|
163
|
+
showTrigger: false,
|
|
164
|
+
size: "sm"
|
|
165
|
+
})
|
|
166
|
+
}),
|
|
167
|
+
/* @__PURE__ */ jsx(ComboboxEmpty, { children: labels.empty }),
|
|
168
|
+
/* @__PURE__ */ jsx(ComboboxList, { children: (item) => /* @__PURE__ */ jsx(ComboboxItem, {
|
|
169
|
+
value: item,
|
|
170
|
+
children: /* @__PURE__ */ jsxs("span", {
|
|
171
|
+
className: "flex items-center gap-2",
|
|
172
|
+
children: [
|
|
173
|
+
/* @__PURE__ */ jsx(PhoneFlag, {
|
|
174
|
+
country: item.value,
|
|
175
|
+
countryName: item.label
|
|
176
|
+
}),
|
|
177
|
+
/* @__PURE__ */ jsx("span", {
|
|
178
|
+
className: "min-w-0 flex-1 truncate",
|
|
179
|
+
title: item.label,
|
|
180
|
+
children: item.label
|
|
181
|
+
}),
|
|
182
|
+
/* @__PURE__ */ jsx("span", {
|
|
183
|
+
dir: "ltr",
|
|
184
|
+
className: "text-xs tabular-nums text-muted-foreground [unicode-bidi:isolate]",
|
|
185
|
+
children: item.code
|
|
186
|
+
})
|
|
187
|
+
]
|
|
188
|
+
})
|
|
189
|
+
}, item.value) })
|
|
190
|
+
]
|
|
191
|
+
})]
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
/** 3:2 flag with a faint inset edge so white-heavy flags keep their shape on any surface. */
|
|
195
|
+
function PhoneFlag({ country, countryName }) {
|
|
196
|
+
const Svg = useFlagComponents()?.[country];
|
|
197
|
+
return /* @__PURE__ */ jsx("span", {
|
|
198
|
+
"data-slot": "phone-flag",
|
|
199
|
+
className: "relative flex h-3 w-4.5 shrink-0 overflow-hidden rounded-[2px] bg-muted after:absolute after:inset-0 after:rounded-[inherit] after:outline after:-outline-offset-1 after:outline-black/10 dark:after:outline-white/10 [&_svg]:size-full",
|
|
200
|
+
children: Svg && /* @__PURE__ */ jsx(Svg, { title: countryName })
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
/** The flag of the country an E.164 number belongs to; a neutral globe when the number cannot be placed. */
|
|
204
|
+
function CountryFlag({ number, className }) {
|
|
205
|
+
const country = BasePhoneInput.parsePhoneNumber(number)?.country;
|
|
206
|
+
return /* @__PURE__ */ jsx("span", {
|
|
207
|
+
className: cn("flex h-3 w-4.5 shrink-0 items-center justify-center", className),
|
|
208
|
+
children: country ? /* @__PURE__ */ jsx(PhoneFlag, {
|
|
209
|
+
country,
|
|
210
|
+
countryName: country
|
|
211
|
+
}) : /* @__PURE__ */ jsx(GlobeIcon, {
|
|
212
|
+
className: "size-3.5 text-muted-foreground",
|
|
213
|
+
"aria-hidden": true
|
|
214
|
+
})
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
//#endregion
|
|
219
|
+
export { CountryFlag, PhoneInput, detectCountry, formatPhoneNumber, normalizePhoneNumber, phoneCallingCode };
|
|
220
|
+
//# sourceMappingURL=phone-input.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"phone-input.js","names":[],"sources":["../../src/components/phone-input.tsx"],"sourcesContent":["'use client';\n\n// Adapted from ReUI Phone Input (MIT), https://reui.io/docs/components/phone-input, rebuilt on the Constructive\n// Combobox and InputGroup so it shares their focus, invalid and popup styling.\n\nimport { useMemo, useSyncExternalStore } from 'react';\nimport type * as React from 'react';\nimport { ChevronDownIcon, GlobeIcon } from 'lucide-react';\nimport * as BasePhoneInput from 'react-phone-number-input';\n\nimport { cn } from '../lib/utils';\nimport {\n\tCombobox,\n\tComboboxEmpty,\n\tComboboxInput,\n\tComboboxItem,\n\tComboboxList,\n\tComboboxPopup,\n\tComboboxTrigger,\n\tuseComboboxFilter,\n} from './combobox';\nimport { InputGroup, InputGroupInput } from './input-group';\n\ntype PhoneCountry = BasePhoneInput.Country;\n\ntype PhoneInputLabels = {\n\t/** Accessible name of the country picker; `{{country}}` is replaced with the selected country's name. */\n\tcountry: string;\n\tcountryFallback: string;\n\tsearch: string;\n\tempty: string;\n};\n\ntype PhoneInputProps = Omit<React.ComponentProps<'input'>, 'onChange' | 'value' | 'ref' | 'size' | 'defaultValue'> & {\n\t/** E.164, or '' when empty. */\n\tvalue: string;\n\tonChange: (value: string) => void;\n\t/** Overrides the country detected from the browser's language preferences. */\n\tdefaultCountry?: PhoneCountry;\n\tinvalid?: boolean;\n\tlabels?: Partial<PhoneInputLabels>;\n};\n\nconst FALLBACK_COUNTRY: PhoneCountry = 'US';\nconst E164 = /^\\+[1-9]\\d{6,14}$/;\n\nconst defaultLabels: PhoneInputLabels = {\n\tcountry: 'Country: {{country}}',\n\tcountryFallback: 'Country',\n\tsearch: 'Search countries',\n\tempty: 'No country found.',\n};\n\n/**\n * The user's region from their browser's language preferences, e.g. `en-GB` → GB, or `de` → DE by likely\n * subtags. The first one the picker supports wins. There is no browser API from a timezone to a country, and a\n * locale's region is the signal the browser does carry.\n */\nfunction detectCountry(\n\tlanguages: readonly string[] = typeof navigator === 'undefined' ? [] : (navigator.languages ?? [navigator.language]),\n): PhoneCountry | undefined {\n\tfor (const tag of languages) {\n\t\ttry {\n\t\t\tconst region = new Intl.Locale(tag).maximize().region;\n\t\t\tif (region && BasePhoneInput.isSupportedCountry(region)) return region;\n\t\t} catch {\n\t\t\t// A malformed tag says nothing about the region; the next preference might.\n\t\t}\n\t}\n\treturn undefined;\n}\n\nfunction subscribeToLanguage(onChange: () => void) {\n\twindow.addEventListener('languagechange', onChange);\n\treturn () => window.removeEventListener('languagechange', onChange);\n}\n\n// getSnapshot runs on every render, so the Intl work only reruns when the language list itself changes.\nlet detected: { languages: string; country: PhoneCountry } | undefined;\nfunction detectedCountrySnapshot(): PhoneCountry {\n\tconst languages = navigator.languages ?? [navigator.language];\n\tconst key = languages.join();\n\tif (detected?.languages !== key) detected = { languages: key, country: detectCountry(languages) ?? FALLBACK_COUNTRY };\n\treturn detected.country;\n}\n\n/**\n * The server renders the fallback so hydration matches; the client then reports the detected country, which the\n * phone field adopts only while the user has not typed a number or picked a country.\n */\nfunction useDetectedCountry() {\n\treturn useSyncExternalStore(subscribeToLanguage, detectedCountrySnapshot, () => FALLBACK_COUNTRY);\n}\n\n// The full flag set is about as large as the phone metadata itself (~50 kB gzipped), so it loads in its own chunk\n// the first time a flag renders. Until then, flags show their muted 18×12 tile, so nothing shifts when they arrive.\nlet flagComponents: BasePhoneInput.Flags | undefined;\nlet flagsRequest: Promise<void> | undefined;\nconst flagListeners = new Set<() => void>();\n\nfunction subscribeToFlags(onChange: () => void) {\n\tflagListeners.add(onChange);\n\tflagsRequest ??= import('react-phone-number-input/flags').then((module) => {\n\t\tflagComponents = module.default;\n\t\tfor (const listener of flagListeners) listener();\n\t});\n\treturn () => flagListeners.delete(onChange);\n}\n\nfunction useFlagComponents() {\n\treturn useSyncExternalStore<BasePhoneInput.Flags | undefined>(\n\t\tsubscribeToFlags,\n\t\t() => flagComponents,\n\t\t() => undefined,\n\t);\n}\n\n/** Returns the number in E.164 form, or null when it is not a possible number for its country. */\nfunction normalizePhoneNumber(raw: string): string | null {\n\tconst digits = raw.replace(/[\\s().-]/g, '');\n\tconst candidate = digits.startsWith('00') ? `+${digits.slice(2)}` : digits;\n\treturn E164.test(candidate) && BasePhoneInput.isPossiblePhoneNumber(candidate) ? candidate : null;\n}\n\n/** International grouping for reading, e.g. +1 202 555 0143; unparseable input is returned as-is. */\nfunction formatPhoneNumber(e164: string): string {\n\treturn BasePhoneInput.formatPhoneNumberIntl(e164) || e164;\n}\n\n/** The country calling code a number carries, e.g. +1, +44, +353; '' when it cannot be parsed. */\nfunction phoneCallingCode(e164: string): string {\n\tconst code = BasePhoneInput.parsePhoneNumber(e164)?.countryCallingCode;\n\treturn code ? `+${code}` : '';\n}\n\n/** Country picker + national-format number field; digits only, emits E.164. Defaults to the user's region. */\nfunction PhoneInput({\n\tclassName,\n\tvalue,\n\tonChange,\n\tdefaultCountry,\n\tinvalid,\n\tdisabled,\n\tlabels: labelOverrides,\n\t...props\n}: PhoneInputProps) {\n\tconst detected = useDetectedCountry();\n\tconst labels = { ...defaultLabels, ...labelOverrides };\n\treturn (\n\t\t<BasePhoneInput.default\n\t\t\tclassName={className}\n\t\t\tvalue={value || undefined}\n\t\t\tonChange={(next) => onChange(next ?? '')}\n\t\t\tdefaultCountry={defaultCountry ?? detected}\n\t\t\t// The picker already shows the calling code, so a stored E.164 value renders in national form.\n\t\t\tinitialValueFormat=\"national\"\n\t\t\tdisabled={disabled}\n\t\t\taddInternationalOption={false}\n\t\t\t// A number past the country's longest valid length is not E.164; stop accepting digits there.\n\t\t\tlimitMaxLength\n\t\t\tfocusInputOnCountrySelection\n\t\t\tcontainerComponent={PhoneInputGroup}\n\t\t\tcountrySelectComponent={CountrySelect}\n\t\t\tcountrySelectProps={{ labels }}\n\t\t\tinputComponent={NumberInput}\n\t\t\tflagComponent={PhoneFlag}\n\t\t\taria-invalid={invalid || undefined}\n\t\t\tdata-slot=\"phone-input\"\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nfunction PhoneInputGroup({ className, children, ...props }: React.ComponentProps<'div'>) {\n\treturn (\n\t\t<InputGroup className={cn('overflow-hidden', className)} {...props}>\n\t\t\t{children}\n\t\t</InputGroup>\n\t);\n}\n\nfunction NumberInput({ className, ...props }: React.ComponentProps<typeof InputGroupInput>) {\n\treturn <InputGroupInput className={cn('tabular-nums', className)} {...props} />;\n}\n\ntype CountryOption = { value?: PhoneCountry; label: string };\ntype CountryItem = { value: PhoneCountry; label: string; code: string };\n\nfunction CountrySelect({\n\tvalue,\n\tonChange,\n\toptions,\n\tdisabled,\n\tlabels,\n}: {\n\tvalue?: PhoneCountry;\n\tonChange: (country?: PhoneCountry) => void;\n\toptions: CountryOption[];\n\tdisabled?: boolean;\n\tlabels: PhoneInputLabels;\n}) {\n\tconst items = useMemo<CountryItem[]>(\n\t\t() =>\n\t\t\toptions.flatMap((option) =>\n\t\t\t\toption.value\n\t\t\t\t\t? [{ value: option.value, label: option.label, code: `+${BasePhoneInput.getCountryCallingCode(option.value)}` }]\n\t\t\t\t\t: [],\n\t\t\t),\n\t\t[options],\n\t);\n\tconst selected = items.find((item) => item.value === value) ?? null;\n\t// Rows show their calling code, so the picker matches on it as well as on the name (\"+44\", \"44\", \"kingdom\").\n\tconst { contains } = useComboboxFilter();\n\tconst matches = (item: CountryItem, query: string) => contains(item, query, (country) => `${country.label} ${country.code}`);\n\n\treturn (\n\t\t<Combobox\n\t\t\titems={items}\n\t\t\tvalue={selected}\n\t\t\tfilter={matches}\n\t\t\tonValueChange={(next) => next && onChange(next.value)}\n\t\t\tdisabled={disabled}\n\t\t>\n\t\t\t<ComboboxTrigger\n\t\t\t\taria-label={selected ? labels.country.replace('{{country}}', selected.label) : labels.countryFallback}\n\t\t\t\tdata-slot=\"phone-input-country\"\n\t\t\t\tclassName=\"flex shrink-0 cursor-pointer items-center gap-2 self-stretch border-e border-input ps-3 pe-2 text-sm tabular-nums text-foreground outline-none hover:bg-accent/60 focus-visible:bg-accent/60 disabled:cursor-not-allowed data-popup-open:bg-accent/60\"\n\t\t\t>\n\t\t\t\t{selected && <PhoneFlag country={selected.value} countryName={selected.label} />}\n\t\t\t\t<span dir=\"ltr\" className=\"[unicode-bidi:isolate]\">\n\t\t\t\t\t{selected?.code}\n\t\t\t\t</span>\n\t\t\t\t<ChevronDownIcon className=\"size-3.5 text-muted-foreground\" aria-hidden />\n\t\t\t</ComboboxTrigger>\n\t\t\t<ComboboxPopup style={{ width: '17rem' }} align=\"start\">\n\t\t\t\t<div className=\"border-b p-1\">\n\t\t\t\t\t<ComboboxInput placeholder={labels.search} showTrigger={false} size=\"sm\" />\n\t\t\t\t</div>\n\t\t\t\t<ComboboxEmpty>{labels.empty}</ComboboxEmpty>\n\t\t\t\t<ComboboxList>\n\t\t\t\t\t{(item: CountryItem) => (\n\t\t\t\t\t\t<ComboboxItem key={item.value} value={item}>\n\t\t\t\t\t\t\t<span className=\"flex items-center gap-2\">\n\t\t\t\t\t\t\t\t<PhoneFlag country={item.value} countryName={item.label} />\n\t\t\t\t\t\t\t\t<span className=\"min-w-0 flex-1 truncate\" title={item.label}>\n\t\t\t\t\t\t\t\t\t{item.label}\n\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t<span dir=\"ltr\" className=\"text-xs tabular-nums text-muted-foreground [unicode-bidi:isolate]\">\n\t\t\t\t\t\t\t\t\t{item.code}\n\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t</ComboboxItem>\n\t\t\t\t\t)}\n\t\t\t\t</ComboboxList>\n\t\t\t</ComboboxPopup>\n\t\t</Combobox>\n\t);\n}\n\n/** 3:2 flag with a faint inset edge so white-heavy flags keep their shape on any surface. */\nfunction PhoneFlag({ country, countryName }: { country: PhoneCountry; countryName: string }) {\n\tconst Svg = useFlagComponents()?.[country];\n\treturn (\n\t\t<span\n\t\t\tdata-slot=\"phone-flag\"\n\t\t\tclassName=\"relative flex h-3 w-4.5 shrink-0 overflow-hidden rounded-[2px] bg-muted after:absolute after:inset-0 after:rounded-[inherit] after:outline after:-outline-offset-1 after:outline-black/10 dark:after:outline-white/10 [&_svg]:size-full\"\n\t\t>\n\t\t\t{Svg && <Svg title={countryName} />}\n\t\t</span>\n\t);\n}\n\n/** The flag of the country an E.164 number belongs to; a neutral globe when the number cannot be placed. */\nfunction CountryFlag({ number, className }: { number: string; className?: string }) {\n\tconst country = BasePhoneInput.parsePhoneNumber(number)?.country;\n\treturn (\n\t\t<span className={cn('flex h-3 w-4.5 shrink-0 items-center justify-center', className)}>\n\t\t\t{country ? (\n\t\t\t\t<PhoneFlag country={country} countryName={country} />\n\t\t\t) : (\n\t\t\t\t<GlobeIcon className=\"size-3.5 text-muted-foreground\" aria-hidden />\n\t\t\t)}\n\t\t</span>\n\t);\n}\n\nexport { CountryFlag, detectCountry, formatPhoneNumber, normalizePhoneNumber, PhoneInput, phoneCallingCode };\nexport type { PhoneCountry, PhoneInputLabels, PhoneInputProps };\n"],"mappings":";;;;;;;;;;;AA2CA,MAAM,mBAAiC;AACvC,MAAM,OAAO;AAEb,MAAM,gBAAkC;CACvC,SAAS;CACT,iBAAiB;CACjB,QAAQ;CACR,OAAO;AACR;;;;;;AAOA,SAAS,cACR,YAA+B,OAAO,cAAc,cAAc,CAAC,IAAK,UAAU,aAAa,CAAC,UAAU,QAAQ,GACvF;CAC3B,KAAK,MAAM,OAAO,WACjB,IAAI;EACH,MAAM,SAAS,IAAI,KAAK,OAAO,GAAG,CAAC,CAAC,SAAS,CAAC,CAAC;EAC/C,IAAI,UAAU,eAAe,mBAAmB,MAAM,GAAG,OAAO;CACjE,QAAQ,CAER;AAGF;AAEA,SAAS,oBAAoB,UAAsB;CAClD,OAAO,iBAAiB,kBAAkB,QAAQ;CAClD,aAAa,OAAO,oBAAoB,kBAAkB,QAAQ;AACnE;AAGA,IAAI;AACJ,SAAS,0BAAwC;CAChD,MAAM,YAAY,UAAU,aAAa,CAAC,UAAU,QAAQ;CAC5D,MAAM,MAAM,UAAU,KAAK;CAC3B,IAAI,UAAU,cAAc,KAAK,WAAW;EAAE,WAAW;EAAK,SAAS,cAAc,SAAS,KAAK;CAAiB;CACpH,OAAO,SAAS;AACjB;;;;;AAMA,SAAS,qBAAqB;CAC7B,OAAO,qBAAqB,qBAAqB,+BAA+B,gBAAgB;AACjG;AAIA,IAAI;AACJ,IAAI;AACJ,MAAM,gCAAgB,IAAI,IAAgB;AAE1C,SAAS,iBAAiB,UAAsB;CAC/C,cAAc,IAAI,QAAQ;CAC1B,iBAAiB,OAAO,iCAAiC,CAAC,MAAM,WAAW;EAC1E,iBAAiB,OAAO;EACxB,KAAK,MAAM,YAAY,eAAe,SAAS;CAChD,CAAC;CACD,aAAa,cAAc,OAAO,QAAQ;AAC3C;AAEA,SAAS,oBAAoB;CAC5B,OAAO,qBACN,wBACM,sBACA,MACP;AACD;;AAGA,SAAS,qBAAqB,KAA4B;CACzD,MAAM,SAAS,IAAI,QAAQ,aAAa,EAAE;CAC1C,MAAM,YAAY,OAAO,WAAW,IAAI,IAAI,IAAI,OAAO,MAAM,CAAC,MAAM;CACpE,OAAO,KAAK,KAAK,SAAS,KAAK,eAAe,sBAAsB,SAAS,IAAI,YAAY;AAC9F;;AAGA,SAAS,kBAAkB,MAAsB;CAChD,OAAO,eAAe,sBAAsB,IAAI,KAAK;AACtD;;AAGA,SAAS,iBAAiB,MAAsB;CAC/C,MAAM,OAAO,eAAe,iBAAiB,IAAI,CAAC,EAAE;CACpD,OAAO,OAAO,IAAI,SAAS;AAC5B;;AAGA,SAAS,WAAW,EACnB,WACA,OACA,UACA,gBACA,SACA,UACA,QAAQ,gBACR,GAAG,SACgB;CACnB,MAAM,WAAW,mBAAmB;CACpC,MAAM,SAAS;EAAE,GAAG;EAAe,GAAG;CAAe;CACrD,OACC,oBAAC,eAAe,SAAhB;EACY;EACX,OAAO,SAAS;EAChB,WAAW,SAAS,SAAS,QAAQ,EAAE;EACvC,gBAAgB,kBAAkB;EAElC,oBAAmB;EACT;EACV,wBAAwB;EAExB;EACA;EACA,oBAAoB;EACpB,wBAAwB;EACxB,oBAAoB,EAAE,OAAO;EAC7B,gBAAgB;EAChB,eAAe;EACf,gBAAc,WAAW;EACzB,aAAU;EACV,GAAI;CACJ;AAEH;AAEA,SAAS,gBAAgB,EAAE,WAAW,UAAU,GAAG,SAAsC;CACxF,OACC,oBAAC,YAAD;EAAY,WAAW,GAAG,mBAAmB,SAAS;EAAG,GAAI;EAC3D;CACU;AAEd;AAEA,SAAS,YAAY,EAAE,WAAW,GAAG,SAAuD;CAC3F,OAAO,oBAAC,iBAAD;EAAiB,WAAW,GAAG,gBAAgB,SAAS;EAAG,GAAI;CAAQ;AAC/E;AAKA,SAAS,cAAc,EACtB,OACA,UACA,SACA,UACA,UAOE;CACF,MAAM,QAAQ,cAEZ,QAAQ,SAAS,WAChB,OAAO,QACJ,CAAC;EAAE,OAAO,OAAO;EAAO,OAAO,OAAO;EAAO,MAAM,IAAI,eAAe,sBAAsB,OAAO,KAAK;CAAI,CAAC,IAC7G,CAAC,CACL,GACD,CAAC,OAAO,CACT;CACA,MAAM,WAAW,MAAM,MAAM,SAAS,KAAK,UAAU,KAAK,KAAK;CAE/D,MAAM,EAAE,aAAa,kBAAkB;CACvC,MAAM,WAAW,MAAmB,UAAkB,SAAS,MAAM,QAAQ,YAAY,GAAG,QAAQ,MAAM,GAAG,QAAQ,MAAM;CAE3H,OACC,qBAAC,UAAD;EACQ;EACP,OAAO;EACP,QAAQ;EACR,gBAAgB,SAAS,QAAQ,SAAS,KAAK,KAAK;EAC1C;YALX,CAOC,qBAAC,iBAAD;GACC,cAAY,WAAW,OAAO,QAAQ,QAAQ,eAAe,SAAS,KAAK,IAAI,OAAO;GACtF,aAAU;GACV,WAAU;aAHX;IAKE,YAAY,oBAAC,WAAD;KAAW,SAAS,SAAS;KAAO,aAAa,SAAS;IAAQ;IAC/E,oBAAC,QAAD;KAAM,KAAI;KAAM,WAAU;eACxB,UAAU;IACN;IACN,oBAAC,iBAAD;KAAiB,WAAU;KAAiC;IAAa;GACzD;MACjB,qBAAC,eAAD;GAAe,OAAO,EAAE,OAAO,QAAQ;GAAG,OAAM;aAAhD;IACC,oBAAC,OAAD;KAAK,WAAU;eACd,oBAAC,eAAD;MAAe,aAAa,OAAO;MAAQ,aAAa;MAAO,MAAK;KAAM;IACtE;IACL,oBAAC,eAAD,YAAgB,OAAO,MAAqB;IAC5C,oBAAC,cAAD,aACG,SACD,oBAAC,cAAD;KAA+B,OAAO;eACrC,qBAAC,QAAD;MAAM,WAAU;gBAAhB;OACC,oBAAC,WAAD;QAAW,SAAS,KAAK;QAAO,aAAa,KAAK;OAAQ;OAC1D,oBAAC,QAAD;QAAM,WAAU;QAA0B,OAAO,KAAK;kBACpD,KAAK;OACD;OACN,oBAAC,QAAD;QAAM,KAAI;QAAM,WAAU;kBACxB,KAAK;OACD;MACD;;IACO,GAVK,KAAK,KAUV,EAEF;GACA;IACN;;AAEZ;;AAGA,SAAS,UAAU,EAAE,SAAS,eAA+D;CAC5F,MAAM,MAAM,kBAAkB,CAAC,GAAG;CAClC,OACC,oBAAC,QAAD;EACC,aAAU;EACV,WAAU;YAET,OAAO,oBAAC,KAAD,EAAK,OAAO,YAAc;CAC7B;AAER;;AAGA,SAAS,YAAY,EAAE,QAAQ,aAAqD;CACnF,MAAM,UAAU,eAAe,iBAAiB,MAAM,CAAC,EAAE;CACzD,OACC,oBAAC,QAAD;EAAM,WAAW,GAAG,uDAAuD,SAAS;YAClF,UACA,oBAAC,WAAD;GAAoB;GAAS,aAAa;EAAU,KAEpD,oBAAC,WAAD;GAAW,WAAU;GAAiC;EAAa;CAE/D;AAER"}
|
|
@@ -47,13 +47,14 @@ function PopoverContent({ className, align = "center", sideOffset = 4, showArrow
|
|
|
47
47
|
className: zIndexClass,
|
|
48
48
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_base_ui_react_popover.Popover.Popup, {
|
|
49
49
|
"data-slot": "popover-content",
|
|
50
|
-
className: require_utils.cn(`bg-popover text-popover-foreground origin-(--transform-origin) w-72
|
|
51
|
-
|
|
50
|
+
className: require_utils.cn(`bg-popover text-popover-foreground origin-(--transform-origin) max-h-(--available-height) w-72 max-w-(--available-width)
|
|
51
|
+
rounded-lg border p-4 shadow-lg outline-hidden [overflow-wrap:break-word]
|
|
52
|
+
transition-[scale,opacity,translate] duration-(--duration-moderate) ease-out data-starting-style:scale-95
|
|
52
53
|
data-ending-style:scale-95 data-starting-style:opacity-0 data-ending-style:opacity-0
|
|
53
54
|
data-[side=bottom]:data-starting-style:-translate-y-2
|
|
54
55
|
data-[side=left]:data-starting-style:translate-x-2
|
|
55
56
|
data-[side=right]:data-starting-style:-translate-x-2
|
|
56
|
-
data-[side=top]:data-starting-style:translate-y-2 motion-reduce:transition-none`, className),
|
|
57
|
+
data-[side=top]:data-starting-style:translate-y-2 motion-reduce:transition-none`, !showArrow && "overflow-y-auto overscroll-contain", className),
|
|
57
58
|
...props,
|
|
58
59
|
children: [children, showArrow && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_base_ui_react_popover.Popover.Arrow, { className: "fill-popover -my-px drop-shadow-[0_1px_0_var(--border)]" })]
|
|
59
60
|
})
|
|
@@ -74,7 +75,7 @@ function PopoverAnchor({ ...props }) {
|
|
|
74
75
|
function PopoverTitle({ className, ...props }) {
|
|
75
76
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_base_ui_react_popover.Popover.Title, {
|
|
76
77
|
"data-slot": "popover-title",
|
|
77
|
-
className: require_utils.cn("font-medium leading-
|
|
78
|
+
className: require_utils.cn("font-medium leading-tight", className),
|
|
78
79
|
...props
|
|
79
80
|
});
|
|
80
81
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"popover.cjs","names":["PopoverPrimitive","React","cn"],"sources":["../../src/components/popover.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { Popover as PopoverPrimitive } from '@base-ui/react/popover';\n\nimport { useFloatingOverlayPortalProps } from '@constructive-io/ui/portal';\nimport { cn } from '../lib/utils';\n\nfunction Popover({ ...props }: React.ComponentProps<typeof PopoverPrimitive.Root>) {\n\treturn <PopoverPrimitive.Root data-slot=\"popover\" {...props} />;\n}\n\ntype PopoverTriggerProps = React.ComponentProps<typeof PopoverPrimitive.Trigger> & {\n\t/** When true, merges props onto the child element instead of rendering a button */\n\tasChild?: boolean;\n};\n\nfunction PopoverTrigger({ asChild, children, render, nativeButton, ...props }: PopoverTriggerProps) {\n\tconst childRender = render === undefined && asChild && React.isValidElement(children) ? children : undefined;\n\n\treturn (\n\t\t<PopoverPrimitive.Trigger\n\t\t\tdata-slot=\"popover-trigger\"\n\t\t\tnativeButton={nativeButton ?? (childRender ? true : undefined)}\n\t\t\trender={render ?? childRender}\n\t\t\t{...props}\n\t\t>\n\t\t\t{childRender ? undefined : children}\n\t\t</PopoverPrimitive.Trigger>\n\t);\n}\n\ntype PopoverCloseProps = React.ComponentProps<typeof PopoverPrimitive.Close> & {\n\t/** When true, merges props onto the child element instead of rendering a button */\n\tasChild?: boolean;\n};\n\nfunction PopoverClose({ asChild, children, render, nativeButton, ...props }: PopoverCloseProps) {\n\tconst childRender = render === undefined && asChild && React.isValidElement(children) ? children : undefined;\n\n\treturn (\n\t\t<PopoverPrimitive.Close\n\t\t\tdata-slot=\"popover-close\"\n\t\t\tnativeButton={nativeButton ?? (childRender ? true : undefined)}\n\t\t\trender={render ?? childRender}\n\t\t\t{...props}\n\t\t>\n\t\t\t{childRender ? undefined : children}\n\t\t</PopoverPrimitive.Close>\n\t);\n}\n\ntype PopoverContentProps = React.ComponentProps<typeof PopoverPrimitive.Popup> & {\n\talign?: 'start' | 'center' | 'end';\n\tsideOffset?: number;\n\tshowArrow?: boolean;\n\tside?: 'top' | 'bottom' | 'left' | 'right';\n\t/** @deprecated Base UI uses different focus management */\n\tonOpenAutoFocus?: (e: Event) => void;\n\t/** @deprecated Base UI uses different focus management */\n\tonCloseAutoFocus?: (e: Event) => void;\n\t/** @deprecated Use onOpenChange on Root instead */\n\tonFocusOutside?: (e: Event) => void;\n\t/** @deprecated Use onOpenChange on Root instead */\n\tonEscapeKeyDown?: () => void;\n};\n\nfunction PopoverContent({\n\tclassName,\n\talign = 'center',\n\tsideOffset = 4,\n\tshowArrow = false,\n\tside = 'bottom',\n\tchildren,\n\tonOpenAutoFocus: _onOpenAutoFocus,\n\tonCloseAutoFocus: _onCloseAutoFocus,\n\tonFocusOutside: _onFocusOutside,\n\tonEscapeKeyDown: _onEscapeKeyDown,\n\t...props\n}: PopoverContentProps) {\n\tconst { container, zIndexClass } = useFloatingOverlayPortalProps();\n\n\treturn (\n\t\t<PopoverPrimitive.Portal container={container}>\n\t\t\t<PopoverPrimitive.Positioner\n\t\t\t\tside={side}\n\t\t\t\talign={align}\n\t\t\t\tsideOffset={sideOffset}\n\t\t\t\tclassName={zIndexClass}\n\t\t\t>\n\t\t\t\t<PopoverPrimitive.Popup\n\t\t\t\t\tdata-slot=\"popover-content\"\n\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t`bg-popover text-popover-foreground origin-(--transform-origin) w-72
|
|
1
|
+
{"version":3,"file":"popover.cjs","names":["PopoverPrimitive","React","cn"],"sources":["../../src/components/popover.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { Popover as PopoverPrimitive } from '@base-ui/react/popover';\n\nimport { useFloatingOverlayPortalProps } from '@constructive-io/ui/portal';\nimport { cn } from '../lib/utils';\n\nfunction Popover({ ...props }: React.ComponentProps<typeof PopoverPrimitive.Root>) {\n\treturn <PopoverPrimitive.Root data-slot=\"popover\" {...props} />;\n}\n\ntype PopoverTriggerProps = React.ComponentProps<typeof PopoverPrimitive.Trigger> & {\n\t/** When true, merges props onto the child element instead of rendering a button */\n\tasChild?: boolean;\n};\n\nfunction PopoverTrigger({ asChild, children, render, nativeButton, ...props }: PopoverTriggerProps) {\n\tconst childRender = render === undefined && asChild && React.isValidElement(children) ? children : undefined;\n\n\treturn (\n\t\t<PopoverPrimitive.Trigger\n\t\t\tdata-slot=\"popover-trigger\"\n\t\t\tnativeButton={nativeButton ?? (childRender ? true : undefined)}\n\t\t\trender={render ?? childRender}\n\t\t\t{...props}\n\t\t>\n\t\t\t{childRender ? undefined : children}\n\t\t</PopoverPrimitive.Trigger>\n\t);\n}\n\ntype PopoverCloseProps = React.ComponentProps<typeof PopoverPrimitive.Close> & {\n\t/** When true, merges props onto the child element instead of rendering a button */\n\tasChild?: boolean;\n};\n\nfunction PopoverClose({ asChild, children, render, nativeButton, ...props }: PopoverCloseProps) {\n\tconst childRender = render === undefined && asChild && React.isValidElement(children) ? children : undefined;\n\n\treturn (\n\t\t<PopoverPrimitive.Close\n\t\t\tdata-slot=\"popover-close\"\n\t\t\tnativeButton={nativeButton ?? (childRender ? true : undefined)}\n\t\t\trender={render ?? childRender}\n\t\t\t{...props}\n\t\t>\n\t\t\t{childRender ? undefined : children}\n\t\t</PopoverPrimitive.Close>\n\t);\n}\n\ntype PopoverContentProps = React.ComponentProps<typeof PopoverPrimitive.Popup> & {\n\talign?: 'start' | 'center' | 'end';\n\tsideOffset?: number;\n\tshowArrow?: boolean;\n\tside?: 'top' | 'bottom' | 'left' | 'right';\n\t/** @deprecated Base UI uses different focus management */\n\tonOpenAutoFocus?: (e: Event) => void;\n\t/** @deprecated Base UI uses different focus management */\n\tonCloseAutoFocus?: (e: Event) => void;\n\t/** @deprecated Use onOpenChange on Root instead */\n\tonFocusOutside?: (e: Event) => void;\n\t/** @deprecated Use onOpenChange on Root instead */\n\tonEscapeKeyDown?: () => void;\n};\n\nfunction PopoverContent({\n\tclassName,\n\talign = 'center',\n\tsideOffset = 4,\n\tshowArrow = false,\n\tside = 'bottom',\n\tchildren,\n\tonOpenAutoFocus: _onOpenAutoFocus,\n\tonCloseAutoFocus: _onCloseAutoFocus,\n\tonFocusOutside: _onFocusOutside,\n\tonEscapeKeyDown: _onEscapeKeyDown,\n\t...props\n}: PopoverContentProps) {\n\tconst { container, zIndexClass } = useFloatingOverlayPortalProps();\n\n\treturn (\n\t\t<PopoverPrimitive.Portal container={container}>\n\t\t\t<PopoverPrimitive.Positioner\n\t\t\t\tside={side}\n\t\t\t\talign={align}\n\t\t\t\tsideOffset={sideOffset}\n\t\t\t\tclassName={zIndexClass}\n\t\t\t>\n\t\t\t\t<PopoverPrimitive.Popup\n\t\t\t\t\tdata-slot=\"popover-content\"\n\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t`bg-popover text-popover-foreground origin-(--transform-origin) max-h-(--available-height) w-72 max-w-(--available-width)\n\t\t\t\t\t\trounded-lg border p-4 shadow-lg outline-hidden [overflow-wrap:break-word]\n\t\t\t\t\t\ttransition-[scale,opacity,translate] duration-(--duration-moderate) ease-out data-starting-style:scale-95\n\t\t\t\t\t\tdata-ending-style:scale-95 data-starting-style:opacity-0 data-ending-style:opacity-0\n\t\t\t\t\t\tdata-[side=bottom]:data-starting-style:-translate-y-2\n\t\t\t\t\t\tdata-[side=left]:data-starting-style:translate-x-2\n\t\t\t\t\t\tdata-[side=right]:data-starting-style:-translate-x-2\n\t\t\t\t\t\tdata-[side=top]:data-starting-style:translate-y-2 motion-reduce:transition-none`,\n\t\t\t\t\t\t// Capped to the room Base UI measured and scrolled inside. The arrow sits outside the box, so an arrowed popover keeps `overflow: visible`.\n\t\t\t\t\t\t!showArrow && 'overflow-y-auto overscroll-contain',\n\t\t\t\t\t\tclassName,\n\t\t\t\t\t)}\n\t\t\t\t\t{...props}\n\t\t\t\t>\n\t\t\t\t\t{children}\n\t\t\t\t\t{showArrow && (\n\t\t\t\t\t\t<PopoverPrimitive.Arrow className='fill-popover -my-px drop-shadow-[0_1px_0_var(--border)]' />\n\t\t\t\t\t)}\n\t\t\t\t</PopoverPrimitive.Popup>\n\t\t\t</PopoverPrimitive.Positioner>\n\t\t</PopoverPrimitive.Portal>\n\t);\n}\n\n/**\n * PopoverAnchor - placeholder for positioning anchor.\n * @deprecated Base UI Popover positions relative to Trigger by default.\n * For custom anchoring, use Popover.Positioner with anchor prop.\n */\nfunction PopoverAnchor({ ...props }: React.HTMLAttributes<HTMLDivElement>) {\n\treturn <div data-slot=\"popover-anchor\" {...props} />;\n}\n\nfunction PopoverTitle({ className, ...props }: React.ComponentProps<typeof PopoverPrimitive.Title>) {\n\treturn (\n\t\t<PopoverPrimitive.Title\n\t\t\tdata-slot=\"popover-title\"\n\t\t\tclassName={cn('font-medium leading-tight', className)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nfunction PopoverDescription({ className, ...props }: React.ComponentProps<typeof PopoverPrimitive.Description>) {\n\treturn (\n\t\t<PopoverPrimitive.Description\n\t\t\tdata-slot=\"popover-description\"\n\t\t\tclassName={cn('text-muted-foreground text-sm', className)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nexport {\n\tPopover,\n\tPopoverAnchor,\n\tPopoverClose,\n\tPopoverContent,\n\tPopoverDescription,\n\tPopoverTitle,\n\tPopoverTrigger,\n};\n"],"mappings":";;;;;;;;;;;;AAQA,SAAS,QAAQ,EAAE,GAAG,SAA6D;CAClF,OAAO,2CAACA,+BAAiB,MAAlB;EAAuB,aAAU;EAAU,GAAI;CAAQ;AAC/D;AAOA,SAAS,eAAe,EAAE,SAAS,UAAU,QAAQ,cAAc,GAAG,SAA8B;CACnG,MAAM,cAAc,WAAW,UAAa,WAAWC,MAAM,eAAe,QAAQ,IAAI,WAAW;CAEnG,OACC,2CAACD,+BAAiB,SAAlB;EACC,aAAU;EACV,cAAc,iBAAiB,cAAc,OAAO;EACpD,QAAQ,UAAU;EAClB,GAAI;YAEH,cAAc,SAAY;CACF;AAE5B;AAOA,SAAS,aAAa,EAAE,SAAS,UAAU,QAAQ,cAAc,GAAG,SAA4B;CAC/F,MAAM,cAAc,WAAW,UAAa,WAAWC,MAAM,eAAe,QAAQ,IAAI,WAAW;CAEnG,OACC,2CAACD,+BAAiB,OAAlB;EACC,aAAU;EACV,cAAc,iBAAiB,cAAc,OAAO;EACpD,QAAQ,UAAU;EAClB,GAAI;YAEH,cAAc,SAAY;CACJ;AAE1B;AAiBA,SAAS,eAAe,EACvB,WACA,QAAQ,UACR,aAAa,GACb,YAAY,OACZ,OAAO,UACP,UACA,iBAAiB,kBACjB,kBAAkB,mBAClB,gBAAgB,iBAChB,iBAAiB,kBACjB,GAAG,SACoB;CACvB,MAAM,EAAE,WAAW,8EAA8C;CAEjE,OACC,2CAACA,+BAAiB,QAAlB;EAAoC;YACnC,2CAACA,+BAAiB,YAAlB;GACO;GACC;GACK;GACZ,WAAW;aAEX,4CAACA,+BAAiB,OAAlB;IACC,aAAU;IACV,WAAWE,iBACV;;;;;;;wFASA,CAAC,aAAa,sCACd,SACD;IACA,GAAI;cAfL,CAiBE,UACA,aACA,2CAACF,+BAAiB,OAAlB,EAAwB,WAAU,0DAA2D,EAEvE;;EACI;CACL;AAE3B;;;;;;AAOA,SAAS,cAAc,EAAE,GAAG,SAA+C;CAC1E,OAAO,2CAAC,OAAD;EAAK,aAAU;EAAiB,GAAI;CAAQ;AACpD;AAEA,SAAS,aAAa,EAAE,WAAW,GAAG,SAA8D;CACnG,OACC,2CAACA,+BAAiB,OAAlB;EACC,aAAU;EACV,WAAWE,iBAAG,6BAA6B,SAAS;EACpD,GAAI;CACJ;AAEH;AAEA,SAAS,mBAAmB,EAAE,WAAW,GAAG,SAAoE;CAC/G,OACC,2CAACF,+BAAiB,aAAlB;EACC,aAAU;EACV,WAAWE,iBAAG,iCAAiC,SAAS;EACxD,GAAI;CACJ;AAEH"}
|
|
@@ -44,13 +44,14 @@ function PopoverContent({ className, align = "center", sideOffset = 4, showArrow
|
|
|
44
44
|
className: zIndexClass,
|
|
45
45
|
children: /* @__PURE__ */ jsxs(Popover$1.Popup, {
|
|
46
46
|
"data-slot": "popover-content",
|
|
47
|
-
className: cn(`bg-popover text-popover-foreground origin-(--transform-origin) w-72
|
|
48
|
-
|
|
47
|
+
className: cn(`bg-popover text-popover-foreground origin-(--transform-origin) max-h-(--available-height) w-72 max-w-(--available-width)
|
|
48
|
+
rounded-lg border p-4 shadow-lg outline-hidden [overflow-wrap:break-word]
|
|
49
|
+
transition-[scale,opacity,translate] duration-(--duration-moderate) ease-out data-starting-style:scale-95
|
|
49
50
|
data-ending-style:scale-95 data-starting-style:opacity-0 data-ending-style:opacity-0
|
|
50
51
|
data-[side=bottom]:data-starting-style:-translate-y-2
|
|
51
52
|
data-[side=left]:data-starting-style:translate-x-2
|
|
52
53
|
data-[side=right]:data-starting-style:-translate-x-2
|
|
53
|
-
data-[side=top]:data-starting-style:translate-y-2 motion-reduce:transition-none`, className),
|
|
54
|
+
data-[side=top]:data-starting-style:translate-y-2 motion-reduce:transition-none`, !showArrow && "overflow-y-auto overscroll-contain", className),
|
|
54
55
|
...props,
|
|
55
56
|
children: [children, showArrow && /* @__PURE__ */ jsx(Popover$1.Arrow, { className: "fill-popover -my-px drop-shadow-[0_1px_0_var(--border)]" })]
|
|
56
57
|
})
|
|
@@ -71,7 +72,7 @@ function PopoverAnchor({ ...props }) {
|
|
|
71
72
|
function PopoverTitle({ className, ...props }) {
|
|
72
73
|
return /* @__PURE__ */ jsx(Popover$1.Title, {
|
|
73
74
|
"data-slot": "popover-title",
|
|
74
|
-
className: cn("font-medium leading-
|
|
75
|
+
className: cn("font-medium leading-tight", className),
|
|
75
76
|
...props
|
|
76
77
|
});
|
|
77
78
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"popover.js","names":["PopoverPrimitive","React"],"sources":["../../src/components/popover.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { Popover as PopoverPrimitive } from '@base-ui/react/popover';\n\nimport { useFloatingOverlayPortalProps } from '@constructive-io/ui/portal';\nimport { cn } from '../lib/utils';\n\nfunction Popover({ ...props }: React.ComponentProps<typeof PopoverPrimitive.Root>) {\n\treturn <PopoverPrimitive.Root data-slot=\"popover\" {...props} />;\n}\n\ntype PopoverTriggerProps = React.ComponentProps<typeof PopoverPrimitive.Trigger> & {\n\t/** When true, merges props onto the child element instead of rendering a button */\n\tasChild?: boolean;\n};\n\nfunction PopoverTrigger({ asChild, children, render, nativeButton, ...props }: PopoverTriggerProps) {\n\tconst childRender = render === undefined && asChild && React.isValidElement(children) ? children : undefined;\n\n\treturn (\n\t\t<PopoverPrimitive.Trigger\n\t\t\tdata-slot=\"popover-trigger\"\n\t\t\tnativeButton={nativeButton ?? (childRender ? true : undefined)}\n\t\t\trender={render ?? childRender}\n\t\t\t{...props}\n\t\t>\n\t\t\t{childRender ? undefined : children}\n\t\t</PopoverPrimitive.Trigger>\n\t);\n}\n\ntype PopoverCloseProps = React.ComponentProps<typeof PopoverPrimitive.Close> & {\n\t/** When true, merges props onto the child element instead of rendering a button */\n\tasChild?: boolean;\n};\n\nfunction PopoverClose({ asChild, children, render, nativeButton, ...props }: PopoverCloseProps) {\n\tconst childRender = render === undefined && asChild && React.isValidElement(children) ? children : undefined;\n\n\treturn (\n\t\t<PopoverPrimitive.Close\n\t\t\tdata-slot=\"popover-close\"\n\t\t\tnativeButton={nativeButton ?? (childRender ? true : undefined)}\n\t\t\trender={render ?? childRender}\n\t\t\t{...props}\n\t\t>\n\t\t\t{childRender ? undefined : children}\n\t\t</PopoverPrimitive.Close>\n\t);\n}\n\ntype PopoverContentProps = React.ComponentProps<typeof PopoverPrimitive.Popup> & {\n\talign?: 'start' | 'center' | 'end';\n\tsideOffset?: number;\n\tshowArrow?: boolean;\n\tside?: 'top' | 'bottom' | 'left' | 'right';\n\t/** @deprecated Base UI uses different focus management */\n\tonOpenAutoFocus?: (e: Event) => void;\n\t/** @deprecated Base UI uses different focus management */\n\tonCloseAutoFocus?: (e: Event) => void;\n\t/** @deprecated Use onOpenChange on Root instead */\n\tonFocusOutside?: (e: Event) => void;\n\t/** @deprecated Use onOpenChange on Root instead */\n\tonEscapeKeyDown?: () => void;\n};\n\nfunction PopoverContent({\n\tclassName,\n\talign = 'center',\n\tsideOffset = 4,\n\tshowArrow = false,\n\tside = 'bottom',\n\tchildren,\n\tonOpenAutoFocus: _onOpenAutoFocus,\n\tonCloseAutoFocus: _onCloseAutoFocus,\n\tonFocusOutside: _onFocusOutside,\n\tonEscapeKeyDown: _onEscapeKeyDown,\n\t...props\n}: PopoverContentProps) {\n\tconst { container, zIndexClass } = useFloatingOverlayPortalProps();\n\n\treturn (\n\t\t<PopoverPrimitive.Portal container={container}>\n\t\t\t<PopoverPrimitive.Positioner\n\t\t\t\tside={side}\n\t\t\t\talign={align}\n\t\t\t\tsideOffset={sideOffset}\n\t\t\t\tclassName={zIndexClass}\n\t\t\t>\n\t\t\t\t<PopoverPrimitive.Popup\n\t\t\t\t\tdata-slot=\"popover-content\"\n\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t`bg-popover text-popover-foreground origin-(--transform-origin) w-72
|
|
1
|
+
{"version":3,"file":"popover.js","names":["PopoverPrimitive","React"],"sources":["../../src/components/popover.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { Popover as PopoverPrimitive } from '@base-ui/react/popover';\n\nimport { useFloatingOverlayPortalProps } from '@constructive-io/ui/portal';\nimport { cn } from '../lib/utils';\n\nfunction Popover({ ...props }: React.ComponentProps<typeof PopoverPrimitive.Root>) {\n\treturn <PopoverPrimitive.Root data-slot=\"popover\" {...props} />;\n}\n\ntype PopoverTriggerProps = React.ComponentProps<typeof PopoverPrimitive.Trigger> & {\n\t/** When true, merges props onto the child element instead of rendering a button */\n\tasChild?: boolean;\n};\n\nfunction PopoverTrigger({ asChild, children, render, nativeButton, ...props }: PopoverTriggerProps) {\n\tconst childRender = render === undefined && asChild && React.isValidElement(children) ? children : undefined;\n\n\treturn (\n\t\t<PopoverPrimitive.Trigger\n\t\t\tdata-slot=\"popover-trigger\"\n\t\t\tnativeButton={nativeButton ?? (childRender ? true : undefined)}\n\t\t\trender={render ?? childRender}\n\t\t\t{...props}\n\t\t>\n\t\t\t{childRender ? undefined : children}\n\t\t</PopoverPrimitive.Trigger>\n\t);\n}\n\ntype PopoverCloseProps = React.ComponentProps<typeof PopoverPrimitive.Close> & {\n\t/** When true, merges props onto the child element instead of rendering a button */\n\tasChild?: boolean;\n};\n\nfunction PopoverClose({ asChild, children, render, nativeButton, ...props }: PopoverCloseProps) {\n\tconst childRender = render === undefined && asChild && React.isValidElement(children) ? children : undefined;\n\n\treturn (\n\t\t<PopoverPrimitive.Close\n\t\t\tdata-slot=\"popover-close\"\n\t\t\tnativeButton={nativeButton ?? (childRender ? true : undefined)}\n\t\t\trender={render ?? childRender}\n\t\t\t{...props}\n\t\t>\n\t\t\t{childRender ? undefined : children}\n\t\t</PopoverPrimitive.Close>\n\t);\n}\n\ntype PopoverContentProps = React.ComponentProps<typeof PopoverPrimitive.Popup> & {\n\talign?: 'start' | 'center' | 'end';\n\tsideOffset?: number;\n\tshowArrow?: boolean;\n\tside?: 'top' | 'bottom' | 'left' | 'right';\n\t/** @deprecated Base UI uses different focus management */\n\tonOpenAutoFocus?: (e: Event) => void;\n\t/** @deprecated Base UI uses different focus management */\n\tonCloseAutoFocus?: (e: Event) => void;\n\t/** @deprecated Use onOpenChange on Root instead */\n\tonFocusOutside?: (e: Event) => void;\n\t/** @deprecated Use onOpenChange on Root instead */\n\tonEscapeKeyDown?: () => void;\n};\n\nfunction PopoverContent({\n\tclassName,\n\talign = 'center',\n\tsideOffset = 4,\n\tshowArrow = false,\n\tside = 'bottom',\n\tchildren,\n\tonOpenAutoFocus: _onOpenAutoFocus,\n\tonCloseAutoFocus: _onCloseAutoFocus,\n\tonFocusOutside: _onFocusOutside,\n\tonEscapeKeyDown: _onEscapeKeyDown,\n\t...props\n}: PopoverContentProps) {\n\tconst { container, zIndexClass } = useFloatingOverlayPortalProps();\n\n\treturn (\n\t\t<PopoverPrimitive.Portal container={container}>\n\t\t\t<PopoverPrimitive.Positioner\n\t\t\t\tside={side}\n\t\t\t\talign={align}\n\t\t\t\tsideOffset={sideOffset}\n\t\t\t\tclassName={zIndexClass}\n\t\t\t>\n\t\t\t\t<PopoverPrimitive.Popup\n\t\t\t\t\tdata-slot=\"popover-content\"\n\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t`bg-popover text-popover-foreground origin-(--transform-origin) max-h-(--available-height) w-72 max-w-(--available-width)\n\t\t\t\t\t\trounded-lg border p-4 shadow-lg outline-hidden [overflow-wrap:break-word]\n\t\t\t\t\t\ttransition-[scale,opacity,translate] duration-(--duration-moderate) ease-out data-starting-style:scale-95\n\t\t\t\t\t\tdata-ending-style:scale-95 data-starting-style:opacity-0 data-ending-style:opacity-0\n\t\t\t\t\t\tdata-[side=bottom]:data-starting-style:-translate-y-2\n\t\t\t\t\t\tdata-[side=left]:data-starting-style:translate-x-2\n\t\t\t\t\t\tdata-[side=right]:data-starting-style:-translate-x-2\n\t\t\t\t\t\tdata-[side=top]:data-starting-style:translate-y-2 motion-reduce:transition-none`,\n\t\t\t\t\t\t// Capped to the room Base UI measured and scrolled inside. The arrow sits outside the box, so an arrowed popover keeps `overflow: visible`.\n\t\t\t\t\t\t!showArrow && 'overflow-y-auto overscroll-contain',\n\t\t\t\t\t\tclassName,\n\t\t\t\t\t)}\n\t\t\t\t\t{...props}\n\t\t\t\t>\n\t\t\t\t\t{children}\n\t\t\t\t\t{showArrow && (\n\t\t\t\t\t\t<PopoverPrimitive.Arrow className='fill-popover -my-px drop-shadow-[0_1px_0_var(--border)]' />\n\t\t\t\t\t)}\n\t\t\t\t</PopoverPrimitive.Popup>\n\t\t\t</PopoverPrimitive.Positioner>\n\t\t</PopoverPrimitive.Portal>\n\t);\n}\n\n/**\n * PopoverAnchor - placeholder for positioning anchor.\n * @deprecated Base UI Popover positions relative to Trigger by default.\n * For custom anchoring, use Popover.Positioner with anchor prop.\n */\nfunction PopoverAnchor({ ...props }: React.HTMLAttributes<HTMLDivElement>) {\n\treturn <div data-slot=\"popover-anchor\" {...props} />;\n}\n\nfunction PopoverTitle({ className, ...props }: React.ComponentProps<typeof PopoverPrimitive.Title>) {\n\treturn (\n\t\t<PopoverPrimitive.Title\n\t\t\tdata-slot=\"popover-title\"\n\t\t\tclassName={cn('font-medium leading-tight', className)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nfunction PopoverDescription({ className, ...props }: React.ComponentProps<typeof PopoverPrimitive.Description>) {\n\treturn (\n\t\t<PopoverPrimitive.Description\n\t\t\tdata-slot=\"popover-description\"\n\t\t\tclassName={cn('text-muted-foreground text-sm', className)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nexport {\n\tPopover,\n\tPopoverAnchor,\n\tPopoverClose,\n\tPopoverContent,\n\tPopoverDescription,\n\tPopoverTitle,\n\tPopoverTrigger,\n};\n"],"mappings":";;;;;;;;;AAQA,SAAS,QAAQ,EAAE,GAAG,SAA6D;CAClF,OAAO,oBAACA,UAAiB,MAAlB;EAAuB,aAAU;EAAU,GAAI;CAAQ;AAC/D;AAOA,SAAS,eAAe,EAAE,SAAS,UAAU,QAAQ,cAAc,GAAG,SAA8B;CACnG,MAAM,cAAc,WAAW,UAAa,WAAWC,QAAM,eAAe,QAAQ,IAAI,WAAW;CAEnG,OACC,oBAACD,UAAiB,SAAlB;EACC,aAAU;EACV,cAAc,iBAAiB,cAAc,OAAO;EACpD,QAAQ,UAAU;EAClB,GAAI;YAEH,cAAc,SAAY;CACF;AAE5B;AAOA,SAAS,aAAa,EAAE,SAAS,UAAU,QAAQ,cAAc,GAAG,SAA4B;CAC/F,MAAM,cAAc,WAAW,UAAa,WAAWC,QAAM,eAAe,QAAQ,IAAI,WAAW;CAEnG,OACC,oBAACD,UAAiB,OAAlB;EACC,aAAU;EACV,cAAc,iBAAiB,cAAc,OAAO;EACpD,QAAQ,UAAU;EAClB,GAAI;YAEH,cAAc,SAAY;CACJ;AAE1B;AAiBA,SAAS,eAAe,EACvB,WACA,QAAQ,UACR,aAAa,GACb,YAAY,OACZ,OAAO,UACP,UACA,iBAAiB,kBACjB,kBAAkB,mBAClB,gBAAgB,iBAChB,iBAAiB,kBACjB,GAAG,SACoB;CACvB,MAAM,EAAE,WAAW,gBAAgB,8BAA8B;CAEjE,OACC,oBAACA,UAAiB,QAAlB;EAAoC;YACnC,oBAACA,UAAiB,YAAlB;GACO;GACC;GACK;GACZ,WAAW;aAEX,qBAACA,UAAiB,OAAlB;IACC,aAAU;IACV,WAAW,GACV;;;;;;;wFASA,CAAC,aAAa,sCACd,SACD;IACA,GAAI;cAfL,CAiBE,UACA,aACA,oBAACA,UAAiB,OAAlB,EAAwB,WAAU,0DAA2D,EAEvE;;EACI;CACL;AAE3B;;;;;;AAOA,SAAS,cAAc,EAAE,GAAG,SAA+C;CAC1E,OAAO,oBAAC,OAAD;EAAK,aAAU;EAAiB,GAAI;CAAQ;AACpD;AAEA,SAAS,aAAa,EAAE,WAAW,GAAG,SAA8D;CACnG,OACC,oBAACA,UAAiB,OAAlB;EACC,aAAU;EACV,WAAW,GAAG,6BAA6B,SAAS;EACpD,GAAI;CACJ;AAEH;AAEA,SAAS,mBAAmB,EAAE,WAAW,GAAG,SAAoE;CAC/G,OACC,oBAACA,UAAiB,aAAlB;EACC,aAAU;EACV,WAAW,GAAG,iCAAiC,SAAS;EACxD,GAAI;CACJ;AAEH"}
|
|
@@ -9,17 +9,34 @@ let react_jsx_runtime = require("react/jsx-runtime");
|
|
|
9
9
|
let _base_ui_react_progress = require("@base-ui/react/progress");
|
|
10
10
|
|
|
11
11
|
//#region src/components/progress.tsx
|
|
12
|
-
|
|
12
|
+
/**
|
|
13
|
+
* Keeps the bar honest for values a calculation can really produce: finite
|
|
14
|
+
* values clamp into `[min, max]`; `null`, `undefined`, `NaN`, `Infinity` and
|
|
15
|
+
* unusable bounds are indeterminate. Without this Base UI drops the indicator
|
|
16
|
+
* width for them and the block fills the track, which reads as 100%.
|
|
17
|
+
*/
|
|
18
|
+
function normalizeProgressValue(value, min, max) {
|
|
19
|
+
if (value == null || !Number.isFinite(value)) return null;
|
|
20
|
+
if (!Number.isFinite(min) || !Number.isFinite(max) || max <= min) return null;
|
|
21
|
+
return Math.min(Math.max(value, min), max);
|
|
22
|
+
}
|
|
23
|
+
function Progress({ className, value, min = 0, max = 100, ...props }) {
|
|
24
|
+
const normalized = normalizeProgressValue(value, min, max);
|
|
25
|
+
const overflowAttribute = normalized !== null && typeof value === "number" && value > max ? { "data-overflow": "" } : void 0;
|
|
13
26
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_base_ui_react_progress.Progress.Root, {
|
|
14
27
|
"data-slot": "progress",
|
|
15
|
-
value,
|
|
28
|
+
value: normalized,
|
|
29
|
+
min,
|
|
30
|
+
max,
|
|
31
|
+
...overflowAttribute,
|
|
16
32
|
...props,
|
|
17
33
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_base_ui_react_progress.Progress.Track, {
|
|
18
34
|
"data-slot": "progress-track",
|
|
19
35
|
className: require_utils.cn("bg-primary/20 relative h-2 w-full overflow-hidden rounded-full", className),
|
|
20
36
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_base_ui_react_progress.Progress.Indicator, {
|
|
21
37
|
"data-slot": "progress-indicator",
|
|
22
|
-
|
|
38
|
+
...overflowAttribute,
|
|
39
|
+
className: require_utils.cn("bg-primary h-full transition-[width] duration-(--duration-slow) ease-out motion-reduce:transition-none", "data-indeterminate:bg-transparent data-indeterminate:[background-image:linear-gradient(90deg,transparent_0%,var(--primary)_50%,transparent_100%)] data-indeterminate:bg-[length:200%_100%] data-indeterminate:animate-[shimmer_1.6s_linear_infinite]", "motion-reduce:data-indeterminate:animate-none motion-reduce:data-indeterminate:[background-position:50%_0]")
|
|
23
40
|
})
|
|
24
41
|
})
|
|
25
42
|
});
|
|
@@ -1 +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={
|
|
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\n/**\n * Keeps the bar honest for values a calculation can really produce: finite\n * values clamp into `[min, max]`; `null`, `undefined`, `NaN`, `Infinity` and\n * unusable bounds are indeterminate. Without this Base UI drops the indicator\n * width for them and the block fills the track, which reads as 100%.\n */\nfunction normalizeProgressValue(value: number | null | undefined, min: number, max: number): number | null {\n\tif (value == null || !Number.isFinite(value)) return null;\n\tif (!Number.isFinite(min) || !Number.isFinite(max) || max <= min) return null;\n\treturn Math.min(Math.max(value, min), max);\n}\n\nfunction Progress({ className, value, min = 0, max = 100, ...props }: ProgressProps) {\n\tconst normalized = normalizeProgressValue(value, min, max);\n\t// Over the maximum the bar stays full; `data-overflow` lets apps colour it.\n\tconst overflow = normalized !== null && typeof value === 'number' && value > max;\n\tconst overflowAttribute = overflow ? { 'data-overflow': '' } : undefined;\n\n\treturn (\n\t\t<ProgressPrimitive.Root data-slot=\"progress\" value={normalized} min={min} max={max} {...overflowAttribute} {...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\t{...overflowAttribute}\n\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t'bg-primary h-full transition-[width] duration-(--duration-slow) ease-out motion-reduce:transition-none',\n\t\t\t\t\t\t// Indeterminate: a band sweeps the track instead of a solid bar that reads as complete.\n\t\t\t\t\t\t'data-indeterminate:bg-transparent data-indeterminate:[background-image:linear-gradient(90deg,transparent_0%,var(--primary)_50%,transparent_100%)] data-indeterminate:bg-[length:200%_100%] data-indeterminate:animate-[shimmer_1.6s_linear_infinite]',\n\t\t\t\t\t\t'motion-reduce:data-indeterminate:animate-none motion-reduce:data-indeterminate:[background-position:50%_0]',\n\t\t\t\t\t)}\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":";;;;;;;;;;;;;;;;;AAiBA,SAAS,uBAAuB,OAAkC,KAAa,KAA4B;CAC1G,IAAI,SAAS,QAAQ,CAAC,OAAO,SAAS,KAAK,GAAG,OAAO;CACrD,IAAI,CAAC,OAAO,SAAS,GAAG,KAAK,CAAC,OAAO,SAAS,GAAG,KAAK,OAAO,KAAK,OAAO;CACzE,OAAO,KAAK,IAAI,KAAK,IAAI,OAAO,GAAG,GAAG,GAAG;AAC1C;AAEA,SAAS,SAAS,EAAE,WAAW,OAAO,MAAM,GAAG,MAAM,KAAK,GAAG,SAAwB;CACpF,MAAM,aAAa,uBAAuB,OAAO,KAAK,GAAG;CAGzD,MAAM,oBADW,eAAe,QAAQ,OAAO,UAAU,YAAY,QAAQ,MACxC,EAAE,iBAAiB,GAAG,IAAI;CAE/D,OACC,2CAACA,iCAAkB,MAAnB;EAAwB,aAAU;EAAW,OAAO;EAAiB;EAAU;EAAK,GAAI;EAAmB,GAAI;YAC9G,2CAACA,iCAAkB,OAAnB;GACC,aAAU;GACV,WAAWC,iBAAG,kEAAkE,SAAS;aAEzF,2CAACD,iCAAkB,WAAnB;IACC,aAAU;IACV,GAAI;IACJ,WAAWC,iBACV,0GAEA,wPACA,4GACD;GACA;EACuB;CACF;AAE1B"}
|
|
@@ -4,7 +4,7 @@ import { Progress as Progress$1 } from "@base-ui/react/progress";
|
|
|
4
4
|
type ProgressProps = Omit<React$1.ComponentProps<typeof Progress$1.Root>, 'children'> & {
|
|
5
5
|
className?: string;
|
|
6
6
|
};
|
|
7
|
-
declare function Progress({ className, value, ...props }: ProgressProps): React$1.JSX.Element;
|
|
7
|
+
declare function Progress({ className, value, min, max, ...props }: ProgressProps): React$1.JSX.Element;
|
|
8
8
|
//#endregion
|
|
9
9
|
export { Progress, type ProgressProps };
|
|
10
10
|
//# sourceMappingURL=progress.d.cts.map
|
|
@@ -4,7 +4,7 @@ import { Progress as Progress$1 } from "@base-ui/react/progress";
|
|
|
4
4
|
type ProgressProps = Omit<React$1.ComponentProps<typeof Progress$1.Root>, 'children'> & {
|
|
5
5
|
className?: string;
|
|
6
6
|
};
|
|
7
|
-
declare function Progress({ className, value, ...props }: ProgressProps): React$1.JSX.Element;
|
|
7
|
+
declare function Progress({ className, value, min, max, ...props }: ProgressProps): React$1.JSX.Element;
|
|
8
8
|
//#endregion
|
|
9
9
|
export { Progress, type ProgressProps };
|
|
10
10
|
//# sourceMappingURL=progress.d.ts.map
|
|
@@ -6,17 +6,34 @@ import { jsx } from "react/jsx-runtime";
|
|
|
6
6
|
import { Progress as Progress$1 } from "@base-ui/react/progress";
|
|
7
7
|
|
|
8
8
|
//#region src/components/progress.tsx
|
|
9
|
-
|
|
9
|
+
/**
|
|
10
|
+
* Keeps the bar honest for values a calculation can really produce: finite
|
|
11
|
+
* values clamp into `[min, max]`; `null`, `undefined`, `NaN`, `Infinity` and
|
|
12
|
+
* unusable bounds are indeterminate. Without this Base UI drops the indicator
|
|
13
|
+
* width for them and the block fills the track, which reads as 100%.
|
|
14
|
+
*/
|
|
15
|
+
function normalizeProgressValue(value, min, max) {
|
|
16
|
+
if (value == null || !Number.isFinite(value)) return null;
|
|
17
|
+
if (!Number.isFinite(min) || !Number.isFinite(max) || max <= min) return null;
|
|
18
|
+
return Math.min(Math.max(value, min), max);
|
|
19
|
+
}
|
|
20
|
+
function Progress({ className, value, min = 0, max = 100, ...props }) {
|
|
21
|
+
const normalized = normalizeProgressValue(value, min, max);
|
|
22
|
+
const overflowAttribute = normalized !== null && typeof value === "number" && value > max ? { "data-overflow": "" } : void 0;
|
|
10
23
|
return /* @__PURE__ */ jsx(Progress$1.Root, {
|
|
11
24
|
"data-slot": "progress",
|
|
12
|
-
value,
|
|
25
|
+
value: normalized,
|
|
26
|
+
min,
|
|
27
|
+
max,
|
|
28
|
+
...overflowAttribute,
|
|
13
29
|
...props,
|
|
14
30
|
children: /* @__PURE__ */ jsx(Progress$1.Track, {
|
|
15
31
|
"data-slot": "progress-track",
|
|
16
32
|
className: cn("bg-primary/20 relative h-2 w-full overflow-hidden rounded-full", className),
|
|
17
33
|
children: /* @__PURE__ */ jsx(Progress$1.Indicator, {
|
|
18
34
|
"data-slot": "progress-indicator",
|
|
19
|
-
|
|
35
|
+
...overflowAttribute,
|
|
36
|
+
className: cn("bg-primary h-full transition-[width] duration-(--duration-slow) ease-out motion-reduce:transition-none", "data-indeterminate:bg-transparent data-indeterminate:[background-image:linear-gradient(90deg,transparent_0%,var(--primary)_50%,transparent_100%)] data-indeterminate:bg-[length:200%_100%] data-indeterminate:animate-[shimmer_1.6s_linear_infinite]", "motion-reduce:data-indeterminate:animate-none motion-reduce:data-indeterminate:[background-position:50%_0]")
|
|
20
37
|
})
|
|
21
38
|
})
|
|
22
39
|
});
|
|
@@ -1 +1 @@
|
|
|
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={
|
|
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\n/**\n * Keeps the bar honest for values a calculation can really produce: finite\n * values clamp into `[min, max]`; `null`, `undefined`, `NaN`, `Infinity` and\n * unusable bounds are indeterminate. Without this Base UI drops the indicator\n * width for them and the block fills the track, which reads as 100%.\n */\nfunction normalizeProgressValue(value: number | null | undefined, min: number, max: number): number | null {\n\tif (value == null || !Number.isFinite(value)) return null;\n\tif (!Number.isFinite(min) || !Number.isFinite(max) || max <= min) return null;\n\treturn Math.min(Math.max(value, min), max);\n}\n\nfunction Progress({ className, value, min = 0, max = 100, ...props }: ProgressProps) {\n\tconst normalized = normalizeProgressValue(value, min, max);\n\t// Over the maximum the bar stays full; `data-overflow` lets apps colour it.\n\tconst overflow = normalized !== null && typeof value === 'number' && value > max;\n\tconst overflowAttribute = overflow ? { 'data-overflow': '' } : undefined;\n\n\treturn (\n\t\t<ProgressPrimitive.Root data-slot=\"progress\" value={normalized} min={min} max={max} {...overflowAttribute} {...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\t{...overflowAttribute}\n\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t'bg-primary h-full transition-[width] duration-(--duration-slow) ease-out motion-reduce:transition-none',\n\t\t\t\t\t\t// Indeterminate: a band sweeps the track instead of a solid bar that reads as complete.\n\t\t\t\t\t\t'data-indeterminate:bg-transparent data-indeterminate:[background-image:linear-gradient(90deg,transparent_0%,var(--primary)_50%,transparent_100%)] data-indeterminate:bg-[length:200%_100%] data-indeterminate:animate-[shimmer_1.6s_linear_infinite]',\n\t\t\t\t\t\t'motion-reduce:data-indeterminate:animate-none motion-reduce:data-indeterminate:[background-position:50%_0]',\n\t\t\t\t\t)}\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":";;;;;;;;;;;;;;AAiBA,SAAS,uBAAuB,OAAkC,KAAa,KAA4B;CAC1G,IAAI,SAAS,QAAQ,CAAC,OAAO,SAAS,KAAK,GAAG,OAAO;CACrD,IAAI,CAAC,OAAO,SAAS,GAAG,KAAK,CAAC,OAAO,SAAS,GAAG,KAAK,OAAO,KAAK,OAAO;CACzE,OAAO,KAAK,IAAI,KAAK,IAAI,OAAO,GAAG,GAAG,GAAG;AAC1C;AAEA,SAAS,SAAS,EAAE,WAAW,OAAO,MAAM,GAAG,MAAM,KAAK,GAAG,SAAwB;CACpF,MAAM,aAAa,uBAAuB,OAAO,KAAK,GAAG;CAGzD,MAAM,oBADW,eAAe,QAAQ,OAAO,UAAU,YAAY,QAAQ,MACxC,EAAE,iBAAiB,GAAG,IAAI;CAE/D,OACC,oBAACA,WAAkB,MAAnB;EAAwB,aAAU;EAAW,OAAO;EAAiB;EAAU;EAAK,GAAI;EAAmB,GAAI;YAC9G,oBAACA,WAAkB,OAAnB;GACC,aAAU;GACV,WAAW,GAAG,kEAAkE,SAAS;aAEzF,oBAACA,WAAkB,WAAnB;IACC,aAAU;IACV,GAAI;IACJ,WAAW,GACV,0GAEA,wPACA,4GACD;GACA;EACuB;CACF;AAE1B"}
|
|
@@ -11,7 +11,7 @@ let react_jsx_runtime = require("react/jsx-runtime");
|
|
|
11
11
|
* A scrollable container that shows progressive blur effects at the top and bottom
|
|
12
12
|
* when content overflows. Top blur appears when scrolled, bottom blur when more content below.
|
|
13
13
|
*/
|
|
14
|
-
function ProgressiveBlurScrollContainer({ children, className, scrollClassName, minItemsForBlur = 0, itemCount
|
|
14
|
+
function ProgressiveBlurScrollContainer({ children, className, scrollClassName, minItemsForBlur = 0, itemCount, blurProps, showBlur = true }) {
|
|
15
15
|
const [hasOverflow, setHasOverflow] = (0, react.useState)(false);
|
|
16
16
|
const [isScrolledFromTop, setIsScrolledFromTop] = (0, react.useState)(false);
|
|
17
17
|
const [isScrolledFromBottom, setIsScrolledFromBottom] = (0, react.useState)(true);
|
|
@@ -44,7 +44,7 @@ function ProgressiveBlurScrollContainer({ children, className, scrollClassName,
|
|
|
44
44
|
el.addEventListener("scroll", checkScrollPosition, { passive: true });
|
|
45
45
|
return () => el.removeEventListener("scroll", checkScrollPosition);
|
|
46
46
|
}, [checkScrollPosition]);
|
|
47
|
-
const canShowBlur = showBlur && hasOverflow && (minItemsForBlur === 0 || itemCount > minItemsForBlur);
|
|
47
|
+
const canShowBlur = showBlur && hasOverflow && (minItemsForBlur === 0 || itemCount === void 0 || itemCount > minItemsForBlur);
|
|
48
48
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
49
49
|
className: require_utils.cn("relative min-h-0 flex-1", className),
|
|
50
50
|
children: [
|
|
@@ -1 +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
|
|
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 the `minItemsForBlur` check. Leave it out and the threshold is ignored. */\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,\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 === undefined || 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,WACA,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,cAAc,UAAa,YAAY;CAEhH,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"}
|
|
@@ -8,7 +8,7 @@ interface ProgressiveBlurScrollContainerProps {
|
|
|
8
8
|
scrollClassName?: string;
|
|
9
9
|
/** Minimum number of items to show blur (prevents blur on sparse content) */
|
|
10
10
|
minItemsForBlur?: number;
|
|
11
|
-
/** Current item count for minItemsForBlur check */
|
|
11
|
+
/** Current item count for the `minItemsForBlur` check. Leave it out and the threshold is ignored. */
|
|
12
12
|
itemCount?: number;
|
|
13
13
|
/** Props to pass to ProgressiveBlur */
|
|
14
14
|
blurProps?: Partial<ProgressiveBlurProps>;
|
|
@@ -8,7 +8,7 @@ interface ProgressiveBlurScrollContainerProps {
|
|
|
8
8
|
scrollClassName?: string;
|
|
9
9
|
/** Minimum number of items to show blur (prevents blur on sparse content) */
|
|
10
10
|
minItemsForBlur?: number;
|
|
11
|
-
/** Current item count for minItemsForBlur check */
|
|
11
|
+
/** Current item count for the `minItemsForBlur` check. Leave it out and the threshold is ignored. */
|
|
12
12
|
itemCount?: number;
|
|
13
13
|
/** Props to pass to ProgressiveBlur */
|
|
14
14
|
blurProps?: Partial<ProgressiveBlurProps>;
|
|
@@ -10,7 +10,7 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
10
10
|
* A scrollable container that shows progressive blur effects at the top and bottom
|
|
11
11
|
* when content overflows. Top blur appears when scrolled, bottom blur when more content below.
|
|
12
12
|
*/
|
|
13
|
-
function ProgressiveBlurScrollContainer({ children, className, scrollClassName, minItemsForBlur = 0, itemCount
|
|
13
|
+
function ProgressiveBlurScrollContainer({ children, className, scrollClassName, minItemsForBlur = 0, itemCount, blurProps, showBlur = true }) {
|
|
14
14
|
const [hasOverflow, setHasOverflow] = useState(false);
|
|
15
15
|
const [isScrolledFromTop, setIsScrolledFromTop] = useState(false);
|
|
16
16
|
const [isScrolledFromBottom, setIsScrolledFromBottom] = useState(true);
|
|
@@ -43,7 +43,7 @@ function ProgressiveBlurScrollContainer({ children, className, scrollClassName,
|
|
|
43
43
|
el.addEventListener("scroll", checkScrollPosition, { passive: true });
|
|
44
44
|
return () => el.removeEventListener("scroll", checkScrollPosition);
|
|
45
45
|
}, [checkScrollPosition]);
|
|
46
|
-
const canShowBlur = showBlur && hasOverflow && (minItemsForBlur === 0 || itemCount > minItemsForBlur);
|
|
46
|
+
const canShowBlur = showBlur && hasOverflow && (minItemsForBlur === 0 || itemCount === void 0 || itemCount > minItemsForBlur);
|
|
47
47
|
return /* @__PURE__ */ jsxs("div", {
|
|
48
48
|
className: cn("relative min-h-0 flex-1", className),
|
|
49
49
|
children: [
|