@justanarthur/modo-ui 0.6.0-canary.9 → 1.0.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 +197 -643
- package/blocks/sidebar-app/examples.mdx +2 -2
- package/blocks/sidebar-app/index.tsx +20 -7
- package/blocks/sidebar-app/inset-topbar.tsx +3 -8
- package/blocks/sidebar-app/menu-grid.ts +8 -18
- package/blocks/sidebar-app/nav-data.ts +1 -1
- package/blocks/sidebar-app/search-field.tsx +8 -15
- package/blocks/sidebar-app/thread-page.tsx +58 -0
- package/blocks/sidebar-app/user-footer.tsx +8 -15
- package/blocks/sidebar-app/workspace-header.tsx +9 -28
- package/components/AI/input-message/examples.mdx +37 -33
- package/components/AI/input-message/file-preview-tile.tsx +59 -0
- package/components/AI/input-message/file-thumbnail.tsx +26 -53
- package/components/AI/input-message/index.tsx +362 -1122
- package/components/AI/input-message/input-message.css +25 -0
- package/components/AI/input-message/queued-row.tsx +102 -0
- package/components/AI/input-message/shared.ts +38 -0
- package/components/AI/input-message/suggestion-row.tsx +64 -0
- package/components/AI/input-message/use-composer-files.ts +142 -0
- package/components/AI/input-message/use-history-nav.ts +60 -0
- package/components/AI/input-message/use-message-queue.ts +108 -0
- package/components/AI/input-message/use-region-height.ts +34 -0
- package/components/AI/thinking-indicator/index.tsx +9 -31
- package/components/accordion/accordion-content.tsx +217 -0
- package/components/accordion/accordion-context.tsx +118 -0
- package/components/accordion/accordion-group.tsx +215 -0
- package/components/accordion/examples.mdx +64 -132
- package/components/accordion/index.tsx +127 -891
- package/components/avatar/examples.mdx +2 -2
- package/components/avatar/index.tsx +40 -34
- package/components/badge/change-demo.tsx +2 -0
- package/components/badge/examples.mdx +16 -34
- package/components/badge/index.tsx +31 -69
- package/components/badge/variants.ts +5 -30
- package/components/button/examples.mdx +79 -94
- package/components/button/index.tsx +97 -188
- package/components/button/loading-demo.tsx +2 -0
- package/components/button/variants.ts +12 -117
- package/components/card/card-group.tsx +184 -0
- package/components/card/card-media.tsx +207 -0
- package/components/card/card-parts.tsx +179 -0
- package/components/card/examples.mdx +91 -143
- package/components/card/index.tsx +190 -881
- package/components/copy/examples.mdx +29 -67
- package/components/copy/index.tsx +58 -285
- package/components/inputs/checkbox/examples.mdx +22 -39
- package/components/inputs/checkbox/index.tsx +103 -255
- package/components/inputs/checkbox/select-all-demo.tsx +8 -6
- package/components/inputs/color-picker/channel-sliders.tsx +70 -0
- package/components/inputs/color-picker/color-input.tsx +387 -0
- package/components/inputs/color-picker/{variants.ts → color-math.ts} +22 -57
- package/components/inputs/color-picker/context.ts +11 -0
- package/components/inputs/color-picker/examples.mdx +20 -59
- package/components/inputs/color-picker/format-menu.tsx +212 -0
- package/components/inputs/color-picker/index.tsx +190 -1776
- package/components/inputs/color-picker/inputs-row.tsx +196 -0
- package/components/inputs/color-picker/popover.tsx +161 -0
- package/components/inputs/color-picker/saturation-square.tsx +167 -0
- package/components/inputs/color-picker/swatches.tsx +178 -0
- package/components/inputs/combobox/context.ts +90 -0
- package/components/inputs/combobox/examples.mdx +103 -206
- package/components/inputs/combobox/fields.tsx +328 -0
- package/components/inputs/combobox/index.tsx +155 -1310
- package/components/inputs/combobox/list.tsx +415 -0
- package/components/inputs/combobox/remote-demo.tsx +70 -74
- package/components/inputs/date-time/calendar/examples.mdx +0 -11
- package/components/inputs/date-time/calendar/index.tsx +32 -59
- package/components/inputs/date-time/calendar/use-month-window.ts +35 -32
- package/components/inputs/date-time/date-picker/examples.mdx +59 -155
- package/components/inputs/date-time/date-picker/index.tsx +186 -370
- package/components/inputs/date-time/date-picker/masked-date-input.tsx +105 -247
- package/components/inputs/date-time/date-range-picker/examples.mdx +6 -62
- package/components/inputs/date-time/date-range-picker/index.tsx +105 -404
- package/components/inputs/date-time/date-value.ts +37 -0
- package/components/inputs/date-time/day-rules.ts +22 -0
- package/components/inputs/date-time/duration-picker/examples.mdx +0 -24
- package/components/inputs/date-time/duration-picker/index.tsx +50 -140
- package/components/inputs/date-time/month-picker/examples.mdx +0 -29
- package/components/inputs/date-time/month-picker/index.tsx +48 -132
- package/components/inputs/date-time/picker-shell.tsx +226 -347
- package/components/inputs/date-time/time-columns.tsx +11 -15
- package/components/inputs/date-time/time-picker/examples.mdx +0 -31
- package/components/inputs/date-time/time-picker/index.tsx +37 -118
- package/components/inputs/field/examples.mdx +81 -39
- package/components/inputs/field/index.tsx +113 -103
- package/components/inputs/file-dropzone/examples.mdx +23 -24
- package/components/inputs/file-dropzone/file-row.tsx +20 -21
- package/components/inputs/file-dropzone/index.tsx +130 -129
- package/components/inputs/file-dropzone/upload-demo.tsx +22 -18
- package/components/inputs/file-dropzone/variants.ts +3 -1
- package/components/inputs/input/examples.mdx +19 -74
- package/components/inputs/input/index.tsx +86 -149
- package/components/inputs/input/password-demo.tsx +5 -5
- package/components/inputs/label/examples.mdx +19 -26
- package/components/inputs/label/index.tsx +21 -34
- package/components/inputs/number-input/examples.mdx +63 -36
- package/components/inputs/number-input/index.tsx +62 -57
- package/components/inputs/radio/examples.mdx +24 -39
- package/components/inputs/radio/index.tsx +125 -328
- package/components/inputs/search/examples.mdx +3 -3
- package/components/inputs/search/index.tsx +46 -39
- package/components/inputs/select/examples.mdx +76 -167
- package/components/inputs/select/index.tsx +252 -776
- package/components/inputs/slider/comfortable.tsx +524 -0
- package/components/inputs/slider/compact.tsx +690 -0
- package/components/inputs/slider/examples.mdx +9 -35
- package/components/inputs/slider/geometry.ts +88 -0
- package/components/inputs/slider/index.tsx +65 -1796
- package/components/inputs/slider/value-display.tsx +184 -0
- package/components/inputs/switch/examples.mdx +31 -33
- package/components/inputs/switch/index.tsx +55 -107
- package/components/inputs/textarea/examples.mdx +23 -61
- package/components/inputs/textarea/index.tsx +21 -99
- package/components/navigation/navigation-menu/content.tsx +76 -0
- package/components/navigation/navigation-menu/context.ts +34 -0
- package/components/navigation/navigation-menu/examples.mdx +21 -84
- package/components/navigation/navigation-menu/index.tsx +139 -639
- package/components/navigation/navigation-menu/item.tsx +47 -0
- package/components/navigation/navigation-menu/link.tsx +104 -0
- package/components/navigation/navigation-menu/list.tsx +86 -0
- package/components/navigation/navigation-menu/trigger.tsx +78 -0
- package/components/navigation/navigation-menu/use-dom-rows.ts +56 -0
- package/components/navigation/pagination/examples.mdx +25 -34
- package/components/navigation/pagination/index.tsx +75 -153
- package/components/navigation/sidebar/examples.mdx +17 -23
- package/components/navigation/sidebar/index.tsx +59 -119
- package/components/navigation/sidebar/menu-scope.tsx +439 -0
- package/components/navigation/sidebar/row-label.tsx +61 -0
- package/components/navigation/sidebar/sidebar-context.tsx +71 -0
- package/components/navigation/sidebar/sidebar-group.tsx +299 -0
- package/components/navigation/sidebar/sidebar-menu-actions.tsx +209 -0
- package/components/navigation/sidebar/sidebar-menu-button.tsx +214 -0
- package/components/navigation/sidebar/sidebar-menu-item.tsx +207 -0
- package/components/navigation/sidebar/sidebar-menu-sub.tsx +180 -0
- package/components/navigation/sidebar/sidebar-parts.tsx +94 -0
- package/components/navigation/sidebar/sidebar-provider.tsx +248 -0
- package/components/navigation/sidebar/sidebar-rail.tsx +206 -0
- package/components/navigation/sidebar/sidebar-shell.tsx +180 -0
- package/components/navigation/sidebar/sidebar-shortcut.tsx +101 -0
- package/components/navigation/sidebar/sidebar.css +7 -11
- package/components/navigation/sidebar/use-measured-collapse.ts +62 -0
- package/components/navigation/tabs/context.ts +45 -0
- package/components/navigation/tabs/examples.mdx +63 -17
- package/components/navigation/tabs/index.tsx +82 -434
- package/components/navigation/tabs/item.tsx +161 -0
- package/components/navigation/tabs/list.tsx +143 -0
- package/components/overlays/alert-dialog/examples.mdx +2 -36
- package/components/overlays/alert-dialog/index.tsx +76 -90
- package/components/overlays/alert-dialog/pending-demo.tsx +3 -1
- package/components/overlays/command/index.tsx +28 -59
- package/components/overlays/context-menu/examples.mdx +58 -4
- package/components/overlays/context-menu/index.tsx +77 -221
- package/components/overlays/dialog/examples.mdx +8 -31
- package/components/overlays/dialog/index.tsx +81 -261
- package/components/overlays/dropdown/dropdown-search.tsx +33 -98
- package/components/overlays/dropdown/examples.mdx +77 -363
- package/components/overlays/dropdown/index.tsx +114 -1010
- package/components/overlays/dropdown/menu-item.tsx +98 -382
- package/components/overlays/dropdown/menu-popup.tsx +294 -0
- package/components/overlays/dropdown/panel-state.ts +176 -0
- package/components/overlays/dropdown/submenu.tsx +170 -0
- package/components/overlays/popover/anchored-demo.tsx +22 -13
- package/components/overlays/popover/examples.mdx +16 -65
- package/components/overlays/popover/index.tsx +93 -137
- package/components/overlays/preview-card/examples.mdx +4 -4
- package/components/overlays/preview-card/index.tsx +48 -103
- package/components/overlays/sheet/examples.mdx +0 -12
- package/components/overlays/sheet/index.tsx +44 -129
- package/components/overlays/toast/examples.mdx +33 -25
- package/components/overlays/toast/index.tsx +56 -203
- package/components/overlays/toast/manager.ts +63 -119
- package/components/overlays/tooltip/examples.mdx +6 -12
- package/components/overlays/tooltip/index.tsx +124 -264
- package/components/progress/index.tsx +24 -30
- package/components/progress/progress.css +6 -28
- package/components/progress/step-demo.tsx +2 -0
- package/components/table/context.ts +49 -0
- package/components/table/examples.mdx +40 -72
- package/components/table/head.tsx +105 -0
- package/components/table/index.tsx +73 -458
- package/components/table/parts.tsx +188 -0
- package/components/table/sort-demo.tsx +21 -30
- package/dist/base.css +141 -122
- package/dist/blocks/sidebar-app/index.d.ts +10 -2
- package/dist/blocks/sidebar-app/index.js +49 -40
- package/dist/components/AI/input-message/index.d.ts +22 -19
- package/dist/components/AI/input-message/index.js +30 -23
- package/dist/components/AI/thinking-indicator/index.d.ts +2 -0
- package/dist/components/AI/thinking-indicator/index.js +10 -9
- package/dist/components/accordion/index.d.ts +52 -85
- package/dist/components/accordion/index.js +25 -19
- package/dist/components/avatar/index.d.ts +10 -10
- package/dist/components/avatar/index.js +9 -8
- package/dist/components/badge/index.d.ts +11 -18
- package/dist/components/badge/index.js +9 -9
- package/dist/components/badge/variants.d.ts +2 -9
- package/dist/components/badge/variants.js +3 -5
- package/dist/components/button/index.d.ts +36 -60
- package/dist/components/button/index.js +12 -9
- package/dist/components/button/variants.d.ts +3 -34
- package/dist/components/button/variants.js +2 -4
- package/dist/components/card/index.d.ts +163 -108
- package/dist/components/card/index.js +30 -21
- package/dist/components/copy/index.d.ts +10 -41
- package/dist/components/copy/index.js +18 -15
- package/dist/components/inputs/checkbox/index.d.ts +25 -25
- package/dist/components/inputs/checkbox/index.js +22 -18
- package/dist/components/inputs/color-picker/index.d.ts +65 -53
- package/dist/components/inputs/color-picker/index.js +35 -29
- package/dist/components/inputs/combobox/index.d.ts +147 -152
- package/dist/components/inputs/combobox/index.js +31 -29
- package/dist/components/inputs/date-time/calendar/index.d.ts +18 -24
- package/dist/components/inputs/date-time/calendar/index.js +17 -15
- package/dist/components/inputs/date-time/date-picker/index.d.ts +52 -96
- package/dist/components/inputs/date-time/date-picker/index.js +42 -35
- package/dist/components/inputs/date-time/date-range-picker/index.d.ts +48 -108
- package/dist/components/inputs/date-time/date-range-picker/index.js +40 -35
- package/dist/components/inputs/date-time/duration-picker/index.d.ts +21 -67
- package/dist/components/inputs/date-time/duration-picker/index.js +39 -33
- package/dist/components/inputs/date-time/month-picker/index.d.ts +18 -61
- package/dist/components/inputs/date-time/month-picker/index.js +38 -32
- package/dist/components/inputs/date-time/time-picker/index.d.ts +18 -59
- package/dist/components/inputs/date-time/time-picker/index.js +39 -33
- package/dist/components/inputs/field/index.d.ts +37 -41
- package/dist/components/inputs/field/index.js +13 -14
- package/dist/components/inputs/file-dropzone/index.d.ts +32 -25
- package/dist/components/inputs/file-dropzone/index.js +18 -15
- package/dist/components/inputs/file-dropzone/variants.js +1 -1
- package/dist/components/inputs/input/index.d.ts +48 -50
- package/dist/components/inputs/input/index.js +14 -12
- package/dist/components/inputs/label/index.d.ts +12 -10
- package/dist/components/inputs/label/index.js +5 -4
- package/dist/components/inputs/number-input/index.d.ts +31 -23
- package/dist/components/inputs/number-input/index.js +16 -14
- package/dist/components/inputs/radio/index.d.ts +20 -16
- package/dist/components/inputs/radio/index.js +20 -16
- package/dist/components/inputs/search/index.d.ts +12 -5
- package/dist/components/inputs/search/index.js +33 -26
- package/dist/components/inputs/select/index.d.ts +88 -99
- package/dist/components/inputs/select/index.js +32 -29
- package/dist/components/inputs/slider/index.d.ts +26 -48
- package/dist/components/inputs/slider/index.js +9 -10
- package/dist/components/inputs/switch/index.d.ts +12 -6
- package/dist/components/inputs/switch/index.js +17 -15
- package/dist/components/inputs/textarea/index.d.ts +12 -22
- package/dist/components/inputs/textarea/index.js +12 -9
- package/dist/components/navigation/navigation-menu/index.d.ts +112 -83
- package/dist/components/navigation/navigation-menu/index.js +31 -27
- package/dist/components/navigation/pagination/index.d.ts +25 -38
- package/dist/components/navigation/pagination/index.js +27 -34
- package/dist/components/navigation/sidebar/index.d.ts +236 -230
- package/dist/components/navigation/sidebar/index.js +59 -55
- package/dist/components/navigation/tabs/index.d.ts +62 -45
- package/dist/components/navigation/tabs/index.js +23 -17
- package/dist/components/overlays/alert-dialog/index.d.ts +71 -106
- package/dist/components/overlays/alert-dialog/index.js +24 -19
- package/dist/components/overlays/command/index.d.ts +40 -31
- package/dist/components/overlays/command/index.js +31 -25
- package/dist/components/overlays/context-menu/index.d.ts +70 -84
- package/dist/components/overlays/context-menu/index.js +35 -31
- package/dist/components/overlays/dialog/index.d.ts +82 -98
- package/dist/components/overlays/dialog/index.js +23 -20
- package/dist/components/overlays/dropdown/index.d.ts +191 -357
- package/dist/components/overlays/dropdown/index.js +35 -41
- package/dist/components/overlays/popover/index.d.ts +81 -52
- package/dist/components/overlays/popover/index.js +17 -13
- package/dist/components/overlays/preview-card/index.d.ts +52 -26
- package/dist/components/overlays/preview-card/index.js +16 -12
- package/dist/components/overlays/sheet/index.d.ts +41 -45
- package/dist/components/overlays/sheet/index.js +24 -19
- package/dist/components/overlays/toast/index.d.ts +73 -183
- package/dist/components/overlays/toast/index.js +20 -21
- package/dist/components/overlays/tooltip/index.d.ts +80 -118
- package/dist/components/overlays/tooltip/index.js +14 -12
- package/dist/components/progress/index.d.ts +10 -11
- package/dist/components/progress/index.js +7 -6
- package/dist/components/table/index.d.ts +72 -71
- package/dist/components/table/index.js +18 -16
- package/dist/index.d.ts +2575 -3149
- package/dist/index.js +186 -202
- package/dist/lib/date-locale.d.ts +6 -13
- package/dist/lib/date-locale.js +5 -11
- package/dist/lib/date-mask.d.ts +41 -0
- package/dist/lib/date-mask.js +20 -0
- package/dist/lib/field-box.d.ts +114 -0
- package/dist/lib/field-box.js +18 -0
- package/dist/lib/field-classes.d.ts +15 -119
- package/dist/lib/field-classes.js +4 -21
- package/dist/lib/fluid-hover-highlight.d.ts +3 -25
- package/dist/lib/fluid-hover-highlight.js +8 -13
- package/dist/lib/focus-ring.d.ts +16 -10
- package/dist/lib/focus-ring.js +6 -6
- package/dist/lib/goo-indicator.js +6 -5
- package/dist/lib/icon-context.d.ts +2 -8
- package/dist/lib/icon-context.js +2 -6
- package/dist/lib/merge-refs.d.ts +10 -0
- package/dist/lib/merge-refs.js +8 -0
- package/dist/lib/morph-layers.d.ts +12 -6
- package/dist/lib/morph-layers.js +7 -6
- package/dist/lib/morph-part.js +3 -3
- package/dist/lib/overlay.d.ts +113 -0
- package/dist/lib/overlay.js +21 -0
- package/dist/lib/popup-rows.d.ts +101 -0
- package/dist/lib/popup-rows.js +25 -0
- package/dist/lib/popup-surface.d.ts +92 -0
- package/dist/lib/popup-surface.js +17 -0
- package/dist/lib/popup.d.ts +17 -1
- package/dist/lib/popup.js +4 -1
- package/dist/lib/rect.d.ts +16 -0
- package/dist/lib/rect.js +12 -0
- package/dist/lib/reduced-motion.js +1 -1
- package/dist/lib/row-group.d.ts +100 -0
- package/dist/lib/row-group.js +12 -0
- package/dist/lib/row-index.d.ts +12 -7
- package/dist/lib/row-index.js +4 -2
- package/dist/lib/scroll-column.d.ts +1 -5
- package/dist/lib/scroll-column.js +13 -12
- package/dist/lib/shape-classes.d.ts +16 -0
- package/dist/lib/shape-classes.js +6 -0
- package/dist/lib/shape-context.d.ts +2 -9
- package/dist/lib/shape-context.js +3 -7
- package/dist/lib/size-context.d.ts +1 -2
- package/dist/lib/size-context.js +2 -7
- package/dist/lib/size-scale.js +1 -1
- package/dist/lib/slot.d.ts +31 -26
- package/dist/lib/slot.js +9 -9
- package/dist/lib/spinner-glyph.d.ts +7 -0
- package/dist/lib/spinner-glyph.js +7 -0
- package/dist/lib/springs.d.ts +5 -1
- package/dist/lib/springs.js +4 -2
- package/dist/lib/surface-classes.js +1 -1
- package/dist/lib/surface-context.d.ts +3 -1
- package/dist/lib/surface-context.js +3 -1
- package/dist/lib/use-autosize-textarea.d.ts +16 -0
- package/dist/lib/use-autosize-textarea.js +7 -0
- package/dist/lib/use-controllable-state.d.ts +15 -1
- package/dist/lib/use-controllable-state.js +1 -1
- package/dist/lib/use-fluid-hover.d.ts +1 -49
- package/dist/lib/use-fluid-hover.js +1 -7
- package/dist/lib/use-is-mobile.js +1 -1
- package/dist/lib/use-iso-layout-effect.d.ts +7 -0
- package/dist/lib/use-iso-layout-effect.js +6 -0
- package/dist/lib/use-keyboard-nav-gate.js +3 -2
- package/dist/lib/use-merge-split.js +7 -6
- package/dist/lib/use-morph.d.ts +13 -7
- package/dist/lib/use-morph.js +4 -3
- package/dist/lib/use-touch-primary.js +1 -1
- package/dist/lib/utils.js +1 -1
- package/dist/lib/weight-label.d.ts +26 -0
- package/dist/lib/weight-label.js +7 -0
- package/dist/preset.d.ts +4 -8
- package/dist/preset.js +8 -8
- package/dist/primitives/code/index.js +8 -8
- package/dist/primitives/craft/index.d.ts +1 -1
- package/dist/primitives/craft/index.js +13 -12
- package/dist/primitives/fluid-hover/index.d.ts +13 -14
- package/dist/primitives/fluid-hover/index.js +13 -10
- package/dist/primitives/morph/index.d.ts +1 -1
- package/dist/primitives/morph/index.js +20 -16
- package/dist/primitives/motion/index.d.ts +2 -0
- package/dist/primitives/motion/index.js +14 -11
- package/dist/primitives/scroll-area/index.d.ts +5 -4
- package/dist/primitives/scroll-area/index.js +5 -5
- package/dist/primitives/separator/index.d.ts +12 -11
- package/dist/primitives/separator/index.js +2 -2
- package/dist/primitives/sizes/index.d.ts +17 -4
- package/dist/primitives/sizes/index.js +7 -4
- package/dist/primitives/skeleton/index.d.ts +8 -8
- package/dist/primitives/skeleton/index.js +7 -6
- package/dist/primitives/surface/index.d.ts +12 -25
- package/dist/primitives/surface/index.js +8 -6
- package/dist/shared/{components-yxmxn2jp.js → components-07g2gbjy.js} +30 -75
- package/dist/shared/components-099sdasz.js +552 -0
- package/dist/shared/{components-bsqynhaj.js → components-0h3f5jae.js} +49 -51
- package/dist/shared/{components-wbbckbw8.js → components-0mrhj88d.js} +13 -12
- package/dist/shared/{components-0h78g3b5.js → components-0p2na0cp.js} +19 -47
- package/dist/shared/components-1a7cr7vh.js +40 -0
- package/dist/shared/components-1axxc3tk.js +334 -0
- package/dist/shared/components-1hc3xv0y.js +381 -0
- package/dist/shared/{components-gyt7my41.js → components-1jxw899c.js} +94 -84
- package/dist/shared/{components-jqpefjsn.js → components-1nv9q3s8.js} +24 -44
- package/dist/shared/components-1p3k62x2.js +137 -0
- package/dist/shared/{components-kz5q11pp.js → components-2xmke84n.js} +12 -4
- package/dist/shared/{components-c7rwx0ap.js → components-346ged8v.js} +24 -3
- package/dist/shared/{components-4j3t39dd.js → components-34brwmgp.js} +12 -11
- package/dist/shared/components-38wa9nx5.js +19 -0
- package/dist/shared/components-3hgk57s0.js +27 -0
- package/dist/shared/{components-px2zm7dc.js → components-3js2vgds.js} +13 -6
- package/dist/shared/{components-ctqmge8t.js → components-3m4rqrqm.js} +10 -3
- package/dist/shared/{components-3ey0hzpb.js → components-45r18egt.js} +11 -1
- package/dist/shared/components-50rh4ggz.js +54 -0
- package/dist/shared/components-5atrr490.js +99 -0
- package/dist/shared/components-5f3tq4qb.js +70 -0
- package/dist/shared/{components-dc5q749x.js → components-5vyaexsj.js} +16 -17
- package/dist/shared/{components-pwayrkw9.js → components-5ynncdpn.js} +5 -4
- package/dist/shared/{components-1e64t8aj.js → components-62mg6pab.js} +232 -93
- package/dist/shared/{components-drxrtnp2.js → components-6f5pyzb2.js} +8 -0
- package/dist/shared/{components-868v7scv.js → components-6xfhc5qm.js} +104 -169
- package/dist/shared/{components-yhgq0qxx.js → components-7c4a0egq.js} +20 -12
- package/dist/shared/components-7fqnqbh0.js +79 -0
- package/dist/shared/components-7fsy0jxg.js +443 -0
- package/dist/shared/{components-p0fm0bab.js → components-7t3pz7v7.js} +496 -526
- package/dist/shared/components-85epgxwf.js +620 -0
- package/dist/shared/{components-wknae3m4.js → components-86vvx0c8.js} +75 -121
- package/dist/shared/{components-wgtjt2af.js → components-88ktjdg0.js} +30 -27
- package/dist/shared/{components-ft3zdc79.js → components-88r046aa.js} +6 -6
- package/dist/shared/{components-xd3emmy4.js → components-8hfrd2fk.js} +1462 -1464
- package/dist/shared/components-8sazy704.js +146 -0
- package/dist/shared/{components-rrbpmfx4.js → components-8wp8d8q1.js} +8 -0
- package/dist/shared/{components-rtadhd9j.js → components-9ybenn5v.js} +16 -16
- package/dist/shared/components-amsc86fb.js +293 -0
- package/dist/shared/{components-9as3rf68.js → components-az04rmng.js} +12 -6
- package/dist/shared/components-bdkm2jzy.js +34 -0
- package/dist/shared/{components-xjkdvnbg.js → components-be3wggg1.js} +54 -48
- package/dist/shared/components-bkwjvvkh.js +18 -0
- package/dist/shared/{components-vf45j12c.js → components-ceyn28cf.js} +7 -0
- package/dist/shared/{components-3h92d94m.js → components-cy5z8zxy.js} +1 -2
- package/dist/shared/components-dm86y7b3.js +105 -0
- package/dist/shared/{components-c9yr4ed1.js → components-ejn6tvbw.js} +8 -6
- package/dist/shared/{components-34txk9rj.js → components-ew4wq7mj.js} +7 -0
- package/dist/shared/{components-svkt577j.js → components-f75y4gn8.js} +53 -70
- package/dist/shared/components-f9adtfq8.js +34 -0
- package/dist/shared/{components-2a7hcand.js → components-gbsdhmrv.js} +48 -83
- package/dist/shared/{components-9sttq78t.js → components-gc5zky2w.js} +54 -59
- package/dist/shared/{components-bae8sbjx.js → components-gkdx1787.js} +12 -6
- package/dist/shared/{components-124epb7f.js → components-grxgqa75.js} +3 -7
- package/dist/shared/components-gw0wd7gd.js +986 -0
- package/dist/shared/components-j4z3rtw2.js +179 -0
- package/dist/shared/{components-t5pk5nmc.js → components-j8tcbm8y.js} +927 -953
- package/dist/shared/components-jm91mjm1.js +297 -0
- package/dist/shared/{components-b94t6qtj.js → components-jtfptckj.js} +44 -39
- package/dist/shared/components-jx9qb4z8.js +63 -0
- package/dist/shared/components-k785rge6.js +336 -0
- package/dist/shared/{components-r8eqs7gz.js → components-k81x1aea.js} +10 -6
- package/dist/shared/{components-qx27excf.js → components-kn5c7652.js} +11 -13
- package/dist/shared/components-mse06t0x.js +31 -0
- package/dist/shared/{components-cet3jpa0.js → components-n7e31ct4.js} +71 -49
- package/dist/shared/components-nskr4hwg.js +1008 -0
- package/dist/shared/components-nv5m3gcv.js +37 -0
- package/dist/shared/components-nwa2a9tq.js +27 -0
- package/dist/shared/{components-f7h57m6t.js → components-p0x8ren6.js} +3 -1
- package/dist/shared/{components-2krsc300.js → components-p0z99d5b.js} +67 -92
- package/dist/shared/{components-b1e239g3.js → components-pa43g2r2.js} +15 -4
- package/dist/shared/{components-m06yq8wk.js → components-pedbt2dc.js} +35 -49
- package/dist/shared/components-pva1wj1r.js +27 -0
- package/dist/shared/components-q4wyd06h.js +382 -0
- package/dist/shared/{components-71nbt03m.js → components-qrpdtvxa.js} +12 -45
- package/dist/shared/components-r33dxr5j.js +91 -0
- package/dist/shared/{components-005jt2nz.js → components-re8p99fj.js} +53 -179
- package/dist/shared/components-s217vq1n.js +35 -0
- package/dist/shared/{components-vc864c51.js → components-sesrjvcc.js} +7 -6
- package/dist/shared/{components-qh1cvj6p.js → components-skn189mp.js} +29 -36
- package/dist/shared/{components-tz4gaf1v.js → components-tcyz2tdn.js} +9 -1
- package/dist/shared/components-tjxy84s9.js +53 -0
- package/dist/shared/components-tnj6mkhg.js +89 -0
- package/dist/shared/{components-de99ykt7.js → components-tz0axc0f.js} +1 -0
- package/dist/shared/components-v2j3jx89.js +7 -0
- package/dist/shared/components-vcte8p75.js +71 -0
- package/dist/shared/{components-c74gf16d.js → components-vgzerqt0.js} +34 -47
- package/dist/shared/components-vp6vzsee.js +30 -0
- package/dist/shared/components-vpkh6j83.js +42 -0
- package/dist/shared/{components-4nck8acq.js → components-wgd1nebp.js} +21 -14
- package/dist/shared/{components-pt5ftm4p.js → components-wrbw67f6.js} +10 -3
- package/dist/shared/{components-tz1fv35x.js → components-wwd093xg.js} +1 -0
- package/dist/shared/components-wyfmhtw9.js +61 -0
- package/dist/shared/{components-d3shbwqq.js → components-xpw8dzb0.js} +16 -23
- package/dist/shared/{components-mattt5jp.js → components-xzcgr3gy.js} +62 -60
- package/dist/shared/{components-jcnjay5g.js → components-ycx2kxeq.js} +9 -1
- package/dist/shared/components-zbzx62pg.js +1771 -0
- package/dist/shared/{components-dtca4s6b.js → components-zf0nnvvg.js} +67 -147
- package/dist/shared/{components-h83az0bz.js → components-znspksk0.js} +9 -1
- package/dist/shared/components-zpatc9x3.js +78 -0
- package/dist/styles.css +218 -235
- package/dist/tailwind.css +20 -8
- package/dist/tokens.css +53 -68
- package/index.ts +16 -2
- package/lib/date-locale.ts +12 -149
- package/lib/date-mask.ts +146 -0
- package/lib/field-box.ts +117 -0
- package/lib/field-classes.ts +85 -100
- package/lib/fluid-hover-highlight.tsx +12 -57
- package/lib/focus-ring.tsx +25 -22
- package/lib/goo-indicator.tsx +2 -0
- package/lib/icon-context.tsx +23 -75
- package/lib/merge-refs.ts +29 -0
- package/lib/morph-layers.tsx +3 -1
- package/lib/morph-part.tsx +5 -3
- package/lib/overlay.tsx +118 -0
- package/lib/popup-rows.tsx +149 -0
- package/lib/popup-surface.tsx +52 -0
- package/lib/popup.ts +10 -9
- package/lib/rect.ts +48 -0
- package/lib/reduced-motion.ts +2 -0
- package/lib/row-group.tsx +113 -0
- package/lib/row-index.tsx +27 -10
- package/lib/scroll-column.tsx +26 -53
- package/lib/shape-classes.ts +56 -0
- package/lib/shape-context.tsx +10 -79
- package/lib/size-context.tsx +8 -21
- package/lib/size-scale.ts +3 -9
- package/lib/slot.tsx +124 -0
- package/lib/spinner-glyph.tsx +27 -0
- package/lib/springs.ts +8 -9
- package/lib/surface-classes.ts +3 -8
- package/lib/surface-context.tsx +10 -5
- package/lib/use-autosize-textarea.ts +64 -0
- package/lib/use-controllable-state.ts +30 -15
- package/lib/use-fluid-hover.ts +9 -11
- package/lib/use-is-mobile.ts +5 -5
- package/lib/use-iso-layout-effect.ts +14 -0
- package/lib/use-keyboard-nav-gate.ts +5 -6
- package/lib/use-merge-split.tsx +5 -15
- package/lib/use-morph.ts +34 -76
- package/lib/use-touch-primary.tsx +5 -5
- package/lib/utils.ts +4 -11
- package/lib/weight-label.tsx +69 -0
- package/package.json +57 -194
- package/primitives/code/index.tsx +4 -2
- package/primitives/craft/demos.tsx +4 -2
- package/primitives/craft/examples.mdx +32 -34
- package/primitives/craft/index.tsx +3 -0
- package/primitives/fluid-hover/examples.mdx +1 -1
- package/primitives/fluid-hover/index.tsx +33 -68
- package/primitives/morph/examples.mdx +16 -19
- package/primitives/morph/index.tsx +5 -3
- package/primitives/motion/examples.mdx +3 -3
- package/primitives/motion/index.tsx +6 -22
- package/primitives/scroll-area/examples.mdx +4 -4
- package/primitives/scroll-area/index.tsx +16 -41
- package/primitives/separator/examples.mdx +2 -2
- package/primitives/separator/index.tsx +15 -14
- package/primitives/sizes/examples.mdx +1 -1
- package/primitives/sizes/index.tsx +28 -42
- package/primitives/skeleton/examples.mdx +6 -6
- package/primitives/skeleton/index.tsx +24 -10
- package/primitives/skeleton/skeleton.css +8 -3
- package/primitives/surface/examples.mdx +11 -11
- package/primitives/surface/index.tsx +15 -40
- package/primitives/surface/surface.css +1 -1
- package/DESIGN.md +0 -623
- package/components/inputs/select/variants.ts +0 -32
- package/components/navigation/sidebar/sidebar-core.tsx +0 -1408
- package/components/navigation/sidebar/sidebar-menu.tsx +0 -1495
- package/components/navigation/sidebar/variants.ts +0 -55
- package/components/navigation/tabs-subtle/examples.mdx +0 -49
- package/components/navigation/tabs-subtle/index.tsx +0 -512
- package/components/overlays/dropdown/menu-parts.tsx +0 -725
- package/components/overlays/toast/global-demo.tsx +0 -72
- package/dist/components/inputs/color-picker/variants.d.ts +0 -61
- package/dist/components/inputs/color-picker/variants.js +0 -28
- package/dist/components/inputs/select/variants.d.ts +0 -5
- package/dist/components/inputs/select/variants.js +0 -6
- package/dist/components/navigation/sidebar/variants.d.ts +0 -25
- package/dist/components/navigation/sidebar/variants.js +0 -28
- package/dist/components/navigation/tabs-subtle/index.d.ts +0 -73
- package/dist/components/navigation/tabs-subtle/index.js +0 -24
- package/dist/docs/index.d.ts +0 -83
- package/dist/docs/index.js +0 -288
- package/dist/docs/vite.d.ts +0 -31
- package/dist/docs/vite.js +0 -45
- package/dist/lib/field-variants.d.ts +0 -47
- package/dist/lib/field-variants.js +0 -26
- package/dist/lib/inert.d.ts +0 -9
- package/dist/lib/inert.js +0 -8
- package/dist/lib/row-order.d.ts +0 -28
- package/dist/lib/row-order.js +0 -10
- package/dist/lib/shape-radius.d.ts +0 -19
- package/dist/lib/shape-radius.js +0 -6
- package/dist/shared/components-01w9qcfa.js +0 -277
- package/dist/shared/components-26snnbs9.js +0 -322
- package/dist/shared/components-2qbqqpgq.js +0 -1545
- package/dist/shared/components-303jf96s.js +0 -1478
- package/dist/shared/components-4vfm04wq.js +0 -82
- package/dist/shared/components-54nq988h.js +0 -123
- package/dist/shared/components-7qx17na9.js +0 -300
- package/dist/shared/components-7s7pykk5.js +0 -281
- package/dist/shared/components-8jrk5eye.js +0 -448
- package/dist/shared/components-91zw3d9f.js +0 -136
- package/dist/shared/components-9jmjnkqd.js +0 -503
- package/dist/shared/components-adkarj8n.js +0 -35
- package/dist/shared/components-c5w5zk0s.js +0 -218
- package/dist/shared/components-cnead5qm.js +0 -185
- package/dist/shared/components-czdvj1a8.js +0 -266
- package/dist/shared/components-dcc02hs2.js +0 -31
- package/dist/shared/components-dhgk6mbt.js +0 -16
- package/dist/shared/components-g3eafs70.js +0 -337
- package/dist/shared/components-gx4h5rbb.js +0 -40
- package/dist/shared/components-h6p86be3.js +0 -19
- package/dist/shared/components-hdzrqqpx.js +0 -55
- package/dist/shared/components-hgv6tygd.js +0 -986
- package/dist/shared/components-krtx3m5b.js +0 -84
- package/dist/shared/components-kswxnm3h.js +0 -24
- package/dist/shared/components-mhza2wdn.js +0 -482
- package/dist/shared/components-mrbaxt8q.js +0 -62
- package/dist/shared/components-pv1dyrtn.js +0 -678
- package/dist/shared/components-s8yqk2dc.js +0 -124
- package/dist/shared/components-syynwm1r.js +0 -114
- package/dist/shared/components-tv7b8tet.js +0 -271
- package/dist/shared/components-w2jqa6hx.js +0 -404
- package/dist/shared/components-xdqmt6ed.js +0 -20
- package/dist/shared/components-y0kfy2g4.js +0 -578
- package/dist/shared/components-z3v0n0de.js +0 -11
- package/dist/shared/components-z8fedth5.js +0 -305
- package/dist/shared/components-zkk3fmw8.js +0 -150
- package/dist/tokens/colors.css +0 -230
- package/dist/tokens/motion.css +0 -40
- package/dist/tokens/radius.css +0 -10
- package/dist/tokens/spacing.css +0 -9
- package/dist/tokens/typography.css +0 -119
- package/docs/chrome.css +0 -120
- package/docs/chrome.tsx +0 -283
- package/docs/index.ts +0 -9
- package/docs/vite.ts +0 -85
- package/lib/field-variants.ts +0 -117
- package/lib/inert.ts +0 -22
- package/lib/row-order.tsx +0 -126
- package/lib/shape-radius.ts +0 -67
- package/lib/slot.ts +0 -115
- package/preset.ts +0 -199
|
@@ -1,875 +1,642 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
|
|
2
3
|
import {
|
|
3
4
|
useControllableState2
|
|
4
|
-
} from "./components-
|
|
5
|
+
} from "./components-wwd093xg.js";
|
|
5
6
|
import {
|
|
6
7
|
cn2
|
|
7
|
-
} from "./components-
|
|
8
|
+
} from "./components-ycx2kxeq.js";
|
|
8
9
|
import {
|
|
9
10
|
useShape2
|
|
10
|
-
} from "./components-
|
|
11
|
+
} from "./components-qrpdtvxa.js";
|
|
11
12
|
import {
|
|
12
13
|
ScrollArea2
|
|
13
|
-
} from "./components-
|
|
14
|
+
} from "./components-3m4rqrqm.js";
|
|
15
|
+
import {
|
|
16
|
+
mergeRefs2,
|
|
17
|
+
useMergeRefs2
|
|
18
|
+
} from "./components-bkwjvvkh.js";
|
|
19
|
+
import {
|
|
20
|
+
useReduceMotion2
|
|
21
|
+
} from "./components-tz0axc0f.js";
|
|
14
22
|
import {
|
|
15
23
|
spring2,
|
|
16
24
|
exitFallbackMs2
|
|
17
|
-
} from "./components-
|
|
25
|
+
} from "./components-45r18egt.js";
|
|
18
26
|
import {
|
|
19
27
|
surfaceClasses2
|
|
20
|
-
} from "./components-
|
|
28
|
+
} from "./components-ceyn28cf.js";
|
|
21
29
|
import {
|
|
22
|
-
|
|
30
|
+
useLift2,
|
|
23
31
|
SurfaceProvider2
|
|
24
|
-
} from "./components-
|
|
32
|
+
} from "./components-nwa2a9tq.js";
|
|
25
33
|
import {
|
|
26
34
|
useIcon2
|
|
27
|
-
} from "./components-
|
|
35
|
+
} from "./components-1nv9q3s8.js";
|
|
28
36
|
import {
|
|
29
37
|
useSizeVariant2,
|
|
30
38
|
useSize2
|
|
31
|
-
} from "./components-
|
|
39
|
+
} from "./components-znspksk0.js";
|
|
40
|
+
import {
|
|
41
|
+
resolveSlotTemplate2,
|
|
42
|
+
slotElement2
|
|
43
|
+
} from "./components-7fqnqbh0.js";
|
|
32
44
|
import {
|
|
33
45
|
Button2
|
|
34
|
-
} from "./components-
|
|
46
|
+
} from "./components-gc5zky2w.js";
|
|
35
47
|
import {
|
|
36
48
|
Sheet2
|
|
37
|
-
} from "./components-
|
|
49
|
+
} from "./components-gbsdhmrv.js";
|
|
38
50
|
import {
|
|
39
|
-
|
|
40
|
-
} from "./components-
|
|
51
|
+
GooIndicator2
|
|
52
|
+
} from "./components-5ynncdpn.js";
|
|
41
53
|
import {
|
|
42
|
-
|
|
43
|
-
} from "./components-
|
|
54
|
+
FluidHoverHighlight2
|
|
55
|
+
} from "./components-5vyaexsj.js";
|
|
44
56
|
import {
|
|
45
|
-
|
|
46
|
-
} from "./components-
|
|
57
|
+
FocusRing2
|
|
58
|
+
} from "./components-0mrhj88d.js";
|
|
47
59
|
import {
|
|
48
|
-
|
|
49
|
-
} from "./components-
|
|
60
|
+
useFluidHover2
|
|
61
|
+
} from "./components-7c4a0egq.js";
|
|
50
62
|
import {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
SIDEBAR_COOKIE_MAX_AGE2,
|
|
54
|
-
SIDEBAR_WIDTH2,
|
|
55
|
-
SIDEBAR_WIDTH_MOBILE2,
|
|
56
|
-
SIDEBAR_KEYBOARD_SHORTCUT2,
|
|
57
|
-
SIDEBAR_KEYBOARD_SHORTCUT_RIGHT2,
|
|
58
|
-
SIDEBAR_MIN_WIDTH2,
|
|
59
|
-
SIDEBAR_MAX_WIDTH2,
|
|
60
|
-
SIDEBAR_COLLAPSE_SLOP2,
|
|
61
|
-
SIDEBAR_HOVER_STRIP2,
|
|
62
|
-
SIDEBAR_HOVER_TRIGGER_GAP2
|
|
63
|
-
} from "./components-kswxnm3h.js";
|
|
63
|
+
useIsoLayoutEffect2
|
|
64
|
+
} from "./components-v2j3jx89.js";
|
|
64
65
|
import {
|
|
65
|
-
|
|
66
|
-
} from "./components-
|
|
66
|
+
WeightLabel2
|
|
67
|
+
} from "./components-vp6vzsee.js";
|
|
67
68
|
import {
|
|
68
|
-
|
|
69
|
-
} from "./components-
|
|
69
|
+
SizeScope2
|
|
70
|
+
} from "./components-1a7cr7vh.js";
|
|
70
71
|
import {
|
|
71
|
-
|
|
72
|
-
} from "./components-
|
|
72
|
+
fieldVariants2
|
|
73
|
+
} from "./components-grxgqa75.js";
|
|
74
|
+
import {
|
|
75
|
+
useIsMobile2
|
|
76
|
+
} from "./components-8wp8d8q1.js";
|
|
73
77
|
import {
|
|
74
|
-
|
|
75
|
-
} from "./components-
|
|
78
|
+
Tooltip2
|
|
79
|
+
} from "./components-p0z99d5b.js";
|
|
76
80
|
|
|
77
81
|
// components/navigation/sidebar/index.tsx
|
|
78
82
|
import {
|
|
79
|
-
forwardRef as
|
|
80
|
-
useEffect as
|
|
81
|
-
useMemo as
|
|
83
|
+
forwardRef as forwardRef10,
|
|
84
|
+
useEffect as useEffect6,
|
|
85
|
+
useMemo as useMemo5
|
|
82
86
|
} from "react";
|
|
83
87
|
|
|
84
|
-
// components/navigation/sidebar/
|
|
85
|
-
import {
|
|
88
|
+
// components/navigation/sidebar/menu-scope.tsx
|
|
89
|
+
import { AnimatePresence, motion } from "motion/react";
|
|
86
90
|
import {
|
|
87
|
-
Children,
|
|
88
|
-
cloneElement,
|
|
89
91
|
createContext,
|
|
90
|
-
forwardRef,
|
|
91
|
-
isValidElement,
|
|
92
92
|
useCallback,
|
|
93
|
-
useContext,
|
|
94
|
-
useEffect,
|
|
95
|
-
useId,
|
|
96
|
-
useLayoutEffect,
|
|
97
93
|
useMemo,
|
|
98
94
|
useRef,
|
|
99
95
|
useState
|
|
100
96
|
} from "react";
|
|
101
97
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
98
|
+
/*!
|
|
99
|
+
* Ported from Fluid Functionalism — github.com/mickadesign/fluid-functionalism
|
|
100
|
+
* `registry/default/sidebar-menu.tsx` @ b3587bdbd83fc66c2a6aae3817ffb856cb09260b
|
|
101
|
+
* MIT License © 2026 Micka Touillaud — fluidfunctionalism.com (notice: LICENSE.fluid-functionalism)
|
|
102
|
+
* Local changes: see PORTING.md.
|
|
103
|
+
*/
|
|
104
|
+
var MenuScopeContext = createContext(null);
|
|
105
|
+
var SidebarSelection2 = createContext(null);
|
|
106
|
+
var MenuItemContext = createContext(null);
|
|
107
|
+
var MenuActionsClusterContext = createContext(false);
|
|
108
|
+
function rowHidden(el) {
|
|
109
|
+
return el.closest('[data-sidebar="menu-sub"][data-state="closed"]') !== null;
|
|
109
110
|
}
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
111
|
+
var DISABLED_CONTROL = ':disabled, [aria-disabled="true"]';
|
|
112
|
+
function rowDisabled(el) {
|
|
113
|
+
return el.matches(DISABLED_CONTROL) || el.querySelector(`:scope > [data-sidebar="menu-button"]:is(${DISABLED_CONTROL}), :scope > [data-sidebar="menu-sub-button"]:is(${DISABLED_CONTROL})`) !== null;
|
|
114
|
+
}
|
|
115
|
+
function rowSkipped(el) {
|
|
116
|
+
return rowHidden(el) || rowDisabled(el);
|
|
117
|
+
}
|
|
118
|
+
var overlayGroupSeq = 0;
|
|
119
|
+
var overlayGroupIds = new WeakMap;
|
|
120
|
+
function overlayGroupId(el) {
|
|
121
|
+
let id = overlayGroupIds.get(el);
|
|
122
|
+
if (id === undefined) {
|
|
123
|
+
id = ++overlayGroupSeq;
|
|
124
|
+
overlayGroupIds.set(el, id);
|
|
124
125
|
}
|
|
125
|
-
return
|
|
126
|
+
return id;
|
|
126
127
|
}
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
const
|
|
143
|
-
const
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
128
|
+
function byDomOrder(a, b) {
|
|
129
|
+
return a.compareDocumentPosition(b) & Node.DOCUMENT_POSITION_FOLLOWING ? -1 : 1;
|
|
130
|
+
}
|
|
131
|
+
function sameElements(a, b) {
|
|
132
|
+
return a.length === b.length && a.every((el, i) => el === b[i]);
|
|
133
|
+
}
|
|
134
|
+
var ROW_BUTTON = '[data-sidebar="menu-button"], [data-sidebar="menu-sub-button"]';
|
|
135
|
+
var ROW_BASE_PAD = 8;
|
|
136
|
+
var ROW_SLOT = 24;
|
|
137
|
+
var ROW_GAP = 4;
|
|
138
|
+
var ROW_BADGE_INSET = 8;
|
|
139
|
+
var ROW_ACTION_INSET = 6;
|
|
140
|
+
function rowGutter(actionCount, hasBadge) {
|
|
141
|
+
if (!actionCount && !hasBadge)
|
|
142
|
+
return ROW_BASE_PAD;
|
|
143
|
+
const actionsWidth = actionCount ? actionCount * ROW_SLOT + (actionCount - 1) * ROW_GAP : 0;
|
|
144
|
+
const runWidth = (hasBadge ? ROW_SLOT : 0) + actionsWidth + (hasBadge && actionCount ? ROW_GAP : 0);
|
|
145
|
+
return (hasBadge ? ROW_BADGE_INSET : ROW_ACTION_INSET) + runWidth + ROW_GAP;
|
|
146
|
+
}
|
|
147
|
+
function gutterVars(item) {
|
|
148
|
+
const hover = rowGutter(item?.actionCount ?? 0, item?.hasBadge ?? false);
|
|
149
|
+
const rest = item?.actionsShowOnHover ? rowGutter(0, item.hasBadge) : hover;
|
|
150
|
+
return { "--row-gutter": `${rest}px`, "--row-gutter-hover": `${hover}px` };
|
|
151
|
+
}
|
|
152
|
+
function useMenuScope(containerRef, { focusRing = true } = {}) {
|
|
153
|
+
const { activeIndex, setActiveIndex, itemRects, isMeasured, sessionRef, handlers, registerItem } = useFluidHover2(containerRef, { isItemDisabled: rowSkipped });
|
|
154
|
+
const rowsRef = useRef(new Set);
|
|
155
|
+
const rowButtonsRef = useRef(new Map);
|
|
156
|
+
const activeMapRef = useRef(new Map);
|
|
157
|
+
const [orderedRows, setOrderedRows] = useState([]);
|
|
158
|
+
const orderedRowsRef = useRef(orderedRows);
|
|
159
|
+
orderedRowsRef.current = orderedRows;
|
|
160
|
+
const registeredCountRef = useRef(0);
|
|
161
|
+
const [activeRows, setActiveRows] = useState([]);
|
|
162
|
+
const [focusedRowEl, setFocusedRowEl] = useState(null);
|
|
163
|
+
const recomputeActive = useCallback(() => {
|
|
164
|
+
const next = orderedRowsRef.current.filter((el) => activeMapRef.current.get(el) && !rowSkipped(el));
|
|
165
|
+
setActiveRows((prev) => sameElements(prev, next) ? prev : next);
|
|
156
166
|
}, []);
|
|
157
|
-
const
|
|
158
|
-
const
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
if (persist) {
|
|
173
|
-
document.cookie = `${SIDEBAR_COOKIE_NAME2}=${next}; path=/; max-age=${SIDEBAR_COOKIE_MAX_AGE2}`;
|
|
174
|
-
}
|
|
175
|
-
}, [onOpenChange, persist]);
|
|
176
|
-
const toggleSidebar = useCallback(() => {
|
|
177
|
-
if (isMobile)
|
|
178
|
-
setOpenMobile((prev) => !prev);
|
|
179
|
-
else
|
|
180
|
-
setOpen((prev) => !prev);
|
|
181
|
-
}, [isMobile, setOpen]);
|
|
182
|
-
const [hoverOpen, setHoverOpen] = useState(false);
|
|
183
|
-
useEffect(() => {
|
|
184
|
-
if (open || !openOnHover)
|
|
185
|
-
setHoverOpen(false);
|
|
186
|
-
}, [open, openOnHover]);
|
|
187
|
-
const shellRef = useRef(null);
|
|
188
|
-
const triggers = useRef(new Set);
|
|
189
|
-
const registerTrigger = useCallback((node) => {
|
|
190
|
-
triggers.current.add(node);
|
|
167
|
+
const rowButton = useCallback((row) => rowButtonsRef.current.get(row) ?? row.querySelector(':scope > [data-sidebar="menu-button"], :scope > [data-sidebar="menu-sub-button"]'), []);
|
|
168
|
+
const syncRows = useCallback(() => {
|
|
169
|
+
const sorted = [...rowsRef.current].sort(byDomOrder);
|
|
170
|
+
orderedRowsRef.current = sorted;
|
|
171
|
+
setOrderedRows((prev) => sameElements(prev, sorted) ? prev : sorted);
|
|
172
|
+
for (const [i, el] of sorted.entries())
|
|
173
|
+
registerItem(i, rowButton(el) ?? el);
|
|
174
|
+
for (let i = sorted.length;i < registeredCountRef.current; i++)
|
|
175
|
+
registerItem(i, null);
|
|
176
|
+
registeredCountRef.current = sorted.length;
|
|
177
|
+
recomputeActive();
|
|
178
|
+
}, [registerItem, recomputeActive, rowButton]);
|
|
179
|
+
const registerRow = useCallback((el) => {
|
|
180
|
+
rowsRef.current.add(el);
|
|
181
|
+
syncRows();
|
|
191
182
|
return () => {
|
|
192
|
-
|
|
183
|
+
rowsRef.current.delete(el);
|
|
184
|
+
rowButtonsRef.current.delete(el);
|
|
185
|
+
activeMapRef.current.delete(el);
|
|
186
|
+
syncRows();
|
|
193
187
|
};
|
|
194
|
-
}, []);
|
|
195
|
-
|
|
196
|
-
if (
|
|
188
|
+
}, [syncRows]);
|
|
189
|
+
const setRowButton = useCallback((row, button) => {
|
|
190
|
+
if (button)
|
|
191
|
+
rowButtonsRef.current.set(row, button);
|
|
192
|
+
else
|
|
193
|
+
rowButtonsRef.current.delete(row);
|
|
194
|
+
syncRows();
|
|
195
|
+
}, [syncRows]);
|
|
196
|
+
const setRowActive = useCallback((row, active) => {
|
|
197
|
+
activeMapRef.current.set(row, active);
|
|
198
|
+
recomputeActive();
|
|
199
|
+
}, [recomputeActive]);
|
|
200
|
+
const refreshVisibility = useCallback(() => {
|
|
201
|
+
recomputeActive();
|
|
202
|
+
setActiveIndex((prev) => {
|
|
203
|
+
const row = prev !== null ? orderedRowsRef.current[prev] : undefined;
|
|
204
|
+
return row && rowSkipped(row) ? null : prev;
|
|
205
|
+
});
|
|
206
|
+
}, [recomputeActive, setActiveIndex]);
|
|
207
|
+
const overlayRect = useCallback((row) => {
|
|
208
|
+
if (!row)
|
|
209
|
+
return null;
|
|
210
|
+
const idx = orderedRowsRef.current.indexOf(row);
|
|
211
|
+
const rect = idx === -1 ? null : itemRects[idx];
|
|
212
|
+
if (!rect)
|
|
213
|
+
return null;
|
|
214
|
+
return { ...rect, height: Math.min(rect.height, rowButton(row)?.offsetHeight ?? 32) };
|
|
215
|
+
}, [itemRects, rowButton]);
|
|
216
|
+
const popupOpen = useCallback(() => {
|
|
217
|
+
const container = containerRef.current;
|
|
218
|
+
if (!container)
|
|
219
|
+
return false;
|
|
220
|
+
const root = container.closest('[data-slot="sidebar-wrapper"]') ?? container;
|
|
221
|
+
return !!root.querySelector('[data-sidebar="menu-button"][data-popup-open], [data-sidebar="menu-action"][data-popup-open]');
|
|
222
|
+
}, [containerRef]);
|
|
223
|
+
const onMouseMove = useCallback((e) => {
|
|
224
|
+
if (popupOpen())
|
|
197
225
|
return;
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
if (!inHoverZone(event, side, wrapperRef.current, shellRef.current, triggers.current)) {
|
|
204
|
-
armed = true;
|
|
205
|
-
if (hoverOpen)
|
|
206
|
-
close ??= setTimeout(() => setHoverOpen(false), 300);
|
|
207
|
-
return;
|
|
208
|
-
}
|
|
209
|
-
clearTimeout(close);
|
|
210
|
-
close = undefined;
|
|
211
|
-
if (armed)
|
|
212
|
-
setHoverOpen(true);
|
|
213
|
-
};
|
|
214
|
-
document.addEventListener("pointermove", onPointerMove);
|
|
215
|
-
return () => {
|
|
216
|
-
document.removeEventListener("pointermove", onPointerMove);
|
|
217
|
-
clearTimeout(close);
|
|
218
|
-
};
|
|
219
|
-
}, [openOnHover, open, isMobile, isResizing, hoverOpen, side]);
|
|
220
|
-
useEffect(() => {
|
|
221
|
-
if (shortcut == null)
|
|
226
|
+
handlers.onMouseMove(e);
|
|
227
|
+
}, [popupOpen, handlers]);
|
|
228
|
+
const onFocus = useCallback((e) => {
|
|
229
|
+
const target = e.target;
|
|
230
|
+
if (!target.closest(ROW_BUTTON))
|
|
222
231
|
return;
|
|
223
|
-
const
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
}, [
|
|
232
|
+
const row = target.closest('[data-sidebar="menu-item"],[data-sidebar="menu-sub-item"]');
|
|
233
|
+
if (!row)
|
|
234
|
+
return;
|
|
235
|
+
const idx = orderedRowsRef.current.indexOf(row);
|
|
236
|
+
if (idx === -1)
|
|
237
|
+
return;
|
|
238
|
+
setActiveIndex(idx);
|
|
239
|
+
setFocusedRowEl(target.matches(":focus-visible") ? row : null);
|
|
240
|
+
}, [setActiveIndex]);
|
|
241
|
+
const onBlur = useCallback((e) => {
|
|
242
|
+
if (containerRef.current?.contains(e.relatedTarget))
|
|
243
|
+
return;
|
|
244
|
+
setFocusedRowEl(null);
|
|
245
|
+
setActiveIndex(null);
|
|
246
|
+
}, [containerRef, setActiveIndex]);
|
|
247
|
+
const onKeyDown = useCallback((e) => {
|
|
248
|
+
if (!["ArrowDown", "ArrowUp", "ArrowRight", "ArrowLeft", "Home", "End"].includes(e.key))
|
|
249
|
+
return;
|
|
250
|
+
const container = containerRef.current;
|
|
251
|
+
if (!container)
|
|
252
|
+
return;
|
|
253
|
+
const items = Array.from(container.querySelectorAll(ROW_BUTTON)).filter((el) => !rowHidden(el));
|
|
254
|
+
const at = items.indexOf(e.target);
|
|
255
|
+
if (at === -1)
|
|
256
|
+
return;
|
|
257
|
+
e.preventDefault();
|
|
258
|
+
e.stopPropagation();
|
|
259
|
+
if (e.key === "Home")
|
|
260
|
+
items[0]?.focus();
|
|
261
|
+
else if (e.key === "End")
|
|
262
|
+
items[items.length - 1]?.focus();
|
|
263
|
+
else {
|
|
264
|
+
const next = ["ArrowDown", "ArrowRight"].includes(e.key) ? (at + 1) % items.length : (at - 1 + items.length) % items.length;
|
|
265
|
+
items[next]?.focus();
|
|
266
|
+
}
|
|
267
|
+
}, [containerRef]);
|
|
268
|
+
const hoveredRowEl = activeIndex !== null ? orderedRows[activeIndex] ?? null : null;
|
|
259
269
|
const value = useMemo(() => ({
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
value,
|
|
300
|
-
children: /* @__PURE__ */ jsx("div", {
|
|
301
|
-
ref: (node) => {
|
|
302
|
-
wrapperRef.current = node;
|
|
303
|
-
if (typeof ref === "function")
|
|
304
|
-
ref(node);
|
|
305
|
-
else if (ref)
|
|
306
|
-
ref.current = node;
|
|
307
|
-
},
|
|
308
|
-
"data-slot": "sidebar-wrapper",
|
|
309
|
-
className: cn2("group/sidebar-wrapper relative flex min-h-svh w-full", className),
|
|
310
|
-
style: {
|
|
311
|
-
"--sidebar-width": width,
|
|
312
|
-
"--sidebar-width-mobile": widthMobile,
|
|
313
|
-
...style
|
|
314
|
-
},
|
|
315
|
-
...props,
|
|
316
|
-
children
|
|
317
|
-
})
|
|
270
|
+
registerRow,
|
|
271
|
+
setRowButton,
|
|
272
|
+
setRowActive,
|
|
273
|
+
hoveredRowEl,
|
|
274
|
+
activeRows,
|
|
275
|
+
firstRowEl: orderedRows[0] ?? null,
|
|
276
|
+
hasActive: activeRows.length > 0,
|
|
277
|
+
refreshVisibility
|
|
278
|
+
}), [registerRow, setRowButton, setRowActive, hoveredRowEl, activeRows, orderedRows, refreshVisibility]);
|
|
279
|
+
const shape = useShape2();
|
|
280
|
+
const rowLevel = useCallback((row) => row.closest('[data-sidebar="menu-sub"]') ?? containerRef.current, [containerRef]);
|
|
281
|
+
const prevTargetsRef = useRef({ hover: null, focus: null, actives: new Map });
|
|
282
|
+
const levelOccurrence = new Map;
|
|
283
|
+
const levelFirstActive = new Map;
|
|
284
|
+
const activeRects = [];
|
|
285
|
+
for (const row of activeRows) {
|
|
286
|
+
const level = rowLevel(row);
|
|
287
|
+
if (!level)
|
|
288
|
+
continue;
|
|
289
|
+
const levelId = overlayGroupId(level);
|
|
290
|
+
const occurrence = levelOccurrence.get(levelId) ?? 0;
|
|
291
|
+
levelOccurrence.set(levelId, occurrence + 1);
|
|
292
|
+
if (!levelFirstActive.has(levelId))
|
|
293
|
+
levelFirstActive.set(levelId, row);
|
|
294
|
+
const rect = overlayRect(row);
|
|
295
|
+
const key = `${levelId}:${occurrence}`;
|
|
296
|
+
if (rect)
|
|
297
|
+
activeRects.push({ key, rect, row, rowChanged: prevTargetsRef.current.actives.get(key) !== row });
|
|
298
|
+
}
|
|
299
|
+
const hoverRect = overlayRect(hoveredRowEl);
|
|
300
|
+
const focusRect = focusRing ? overlayRect(focusedRowEl) : null;
|
|
301
|
+
const hoverRowChanged = prevTargetsRef.current.hover !== hoveredRowEl;
|
|
302
|
+
const focusRowChanged = prevTargetsRef.current.focus !== focusedRowEl;
|
|
303
|
+
useIsoLayoutEffect2(() => {
|
|
304
|
+
prevTargetsRef.current = {
|
|
305
|
+
hover: hoveredRowEl,
|
|
306
|
+
focus: focusedRowEl,
|
|
307
|
+
actives: new Map(activeRects.map(({ key, row }) => [key, row]))
|
|
308
|
+
};
|
|
318
309
|
});
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
310
|
+
const hoveredLevel = hoveredRowEl ? rowLevel(hoveredRowEl) : null;
|
|
311
|
+
const hoverAnchorRow = (hoveredLevel ? levelFirstActive.get(overlayGroupId(hoveredLevel)) : undefined) ?? levelFirstActive.values().next().value;
|
|
312
|
+
const hoverAnchorRect = hoverAnchorRow ? overlayRect(hoverAnchorRow) : null;
|
|
313
|
+
const overlays = isMeasured ? /* @__PURE__ */ jsxs(Fragment, {
|
|
314
|
+
children: [
|
|
315
|
+
/* @__PURE__ */ jsx(AnimatePresence, {
|
|
316
|
+
children: activeRects.map(({ key, rect, rowChanged }) => /* @__PURE__ */ jsx(motion.div, {
|
|
317
|
+
className: "pointer-events-none absolute top-0 left-0",
|
|
318
|
+
initial: false,
|
|
319
|
+
animate: { opacity: 1 },
|
|
320
|
+
exit: { opacity: 0, transition: spring2.moderate.exit },
|
|
321
|
+
children: /* @__PURE__ */ jsx(GooIndicator2, {
|
|
322
|
+
rect,
|
|
323
|
+
className: cn2("bg-active", shape.bg),
|
|
324
|
+
transition: rowChanged ? spring2.moderate : false
|
|
325
|
+
})
|
|
326
|
+
}, key))
|
|
327
|
+
}),
|
|
328
|
+
/* @__PURE__ */ jsx(FluidHoverHighlight2, {
|
|
329
|
+
rect: hoverRect,
|
|
330
|
+
session: sessionRef.current,
|
|
331
|
+
from: hoverAnchorRect,
|
|
332
|
+
className: shape.bg,
|
|
333
|
+
transition: hoverRowChanged ? undefined : false
|
|
334
|
+
}),
|
|
335
|
+
/* @__PURE__ */ jsx(FocusRing2, {
|
|
336
|
+
rect: focusRect,
|
|
337
|
+
instant: !focusRowChanged
|
|
338
|
+
})
|
|
339
|
+
]
|
|
340
|
+
}) : null;
|
|
341
|
+
return {
|
|
342
|
+
value,
|
|
343
|
+
containerProps: {
|
|
344
|
+
onMouseEnter: handlers.onMouseEnter,
|
|
345
|
+
onMouseMove,
|
|
346
|
+
onMouseLeave: handlers.onMouseLeave,
|
|
347
|
+
onClick: handlers.onClick,
|
|
348
|
+
onFocus,
|
|
349
|
+
onBlur,
|
|
350
|
+
onPointerDown: () => setFocusedRowEl(null),
|
|
351
|
+
onKeyDown
|
|
352
|
+
},
|
|
353
|
+
overlays
|
|
329
354
|
};
|
|
330
355
|
}
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
356
|
+
|
|
357
|
+
// components/navigation/sidebar/sidebar-context.tsx
|
|
358
|
+
import { createContext as createContext2, useContext } from "react";
|
|
359
|
+
/*!
|
|
360
|
+
* Ported from Fluid Functionalism — github.com/mickadesign/fluid-functionalism
|
|
361
|
+
* `registry/default/sidebar-core.tsx` @ b3587bdbd83fc66c2a6aae3817ffb856cb09260b
|
|
362
|
+
* MIT License © 2026 Micka Touillaud — fluidfunctionalism.com (notice: LICENSE.fluid-functionalism)
|
|
363
|
+
* Local changes: see PORTING.md.
|
|
364
|
+
*/
|
|
365
|
+
var SIDEBAR_COOKIE_NAME2 = "sidebar_state";
|
|
366
|
+
var SIDEBAR_COOKIE_MAX_AGE2 = 60 * 60 * 24 * 7;
|
|
367
|
+
var SIDEBAR_WIDTH2 = "16rem";
|
|
368
|
+
var SIDEBAR_WIDTH_MOBILE2 = "18rem";
|
|
369
|
+
var SIDEBAR_KEYBOARD_SHORTCUT2 = "[";
|
|
370
|
+
var SIDEBAR_KEYBOARD_SHORTCUT_RIGHT2 = "]";
|
|
371
|
+
var SIDEBAR_MIN_WIDTH2 = 160;
|
|
372
|
+
var SIDEBAR_MAX_WIDTH2 = 360;
|
|
373
|
+
var SidebarContext = createContext2(null);
|
|
374
|
+
function useSidebar2() {
|
|
375
|
+
const ctx = useContext(SidebarContext);
|
|
376
|
+
if (!ctx)
|
|
377
|
+
throw new Error("useSidebar must be used within a SidebarProvider");
|
|
378
|
+
return ctx;
|
|
345
379
|
}
|
|
346
|
-
function
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
380
|
+
function defaultShortcut(side) {
|
|
381
|
+
return side === "right" ? SIDEBAR_KEYBOARD_SHORTCUT_RIGHT2 : SIDEBAR_KEYBOARD_SHORTCUT2;
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
// components/navigation/sidebar/sidebar-group.tsx
|
|
385
|
+
import { motion as motion2 } from "motion/react";
|
|
386
|
+
import {
|
|
387
|
+
Children as Children2,
|
|
388
|
+
createContext as createContext3,
|
|
389
|
+
forwardRef,
|
|
390
|
+
isValidElement,
|
|
391
|
+
useContext as useContext2,
|
|
392
|
+
useEffect,
|
|
393
|
+
useId,
|
|
394
|
+
useMemo as useMemo2,
|
|
395
|
+
useState as useState3
|
|
396
|
+
} from "react";
|
|
397
|
+
|
|
398
|
+
// components/navigation/sidebar/row-label.tsx
|
|
399
|
+
import { Children } from "react";
|
|
400
|
+
import { jsx as jsx2, jsxs as jsxs2, Fragment as Fragment2 } from "react/jsx-runtime";
|
|
401
|
+
/*!
|
|
402
|
+
* Ported from Fluid Functionalism — github.com/mickadesign/fluid-functionalism
|
|
403
|
+
* `registry/default/sidebar-menu.tsx` @ b3587bdbd83fc66c2a6aae3817ffb856cb09260b
|
|
404
|
+
* MIT License © 2026 Micka Touillaud — fluidfunctionalism.com (notice: LICENSE.fluid-functionalism)
|
|
405
|
+
* Local changes: see PORTING.md.
|
|
406
|
+
*/
|
|
407
|
+
function splitLabel(content) {
|
|
408
|
+
const nodes = Children.toArray(content);
|
|
409
|
+
let end = 0;
|
|
410
|
+
while (end < nodes.length && (typeof nodes[end] === "string" || typeof nodes[end] === "number"))
|
|
411
|
+
end++;
|
|
412
|
+
return [nodes.slice(0, end).join(""), nodes.slice(end)];
|
|
413
|
+
}
|
|
414
|
+
function MenuRowLabel({
|
|
415
|
+
content,
|
|
416
|
+
lit,
|
|
417
|
+
emphasized,
|
|
418
|
+
textClass
|
|
419
|
+
}) {
|
|
420
|
+
const [label, rest] = splitLabel(content);
|
|
421
|
+
if (!label) {
|
|
422
|
+
return /* @__PURE__ */ jsx2("span", {
|
|
423
|
+
className: cn2("flex min-w-0 flex-1 items-center gap-2 transition-colors duration-fast", lit ? "text-foreground" : "text-muted-foreground", textClass),
|
|
351
424
|
children: content
|
|
352
425
|
});
|
|
353
426
|
}
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
merged[key] = (...args) => {
|
|
368
|
-
theirs(...args);
|
|
369
|
-
ours(...args);
|
|
370
|
-
};
|
|
371
|
-
}
|
|
372
|
-
}
|
|
373
|
-
const templateRef = templateProps.ref ?? template.ref;
|
|
374
|
-
merged.ref = composeRefs(props.ref, templateRef);
|
|
375
|
-
return cloneElement(template, merged, content);
|
|
427
|
+
return /* @__PURE__ */ jsxs2(Fragment2, {
|
|
428
|
+
children: [
|
|
429
|
+
/* @__PURE__ */ jsx2(WeightLabel2, {
|
|
430
|
+
emphasized,
|
|
431
|
+
lit,
|
|
432
|
+
trim: true,
|
|
433
|
+
truncate: "line",
|
|
434
|
+
className: cn2("text-left", textClass),
|
|
435
|
+
children: label
|
|
436
|
+
}),
|
|
437
|
+
rest
|
|
438
|
+
]
|
|
439
|
+
});
|
|
376
440
|
}
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
const
|
|
388
|
-
const
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
const prevOpenRef = useRef(open);
|
|
393
|
-
const openFlipped = prevOpenRef.current !== open;
|
|
394
|
-
useEffect(() => {
|
|
395
|
-
const flipped = prevOpenRef.current !== open;
|
|
396
|
-
prevOpenRef.current = open;
|
|
397
|
-
if (!isResizing) {
|
|
398
|
-
setDragFlip(false);
|
|
399
|
-
return;
|
|
400
|
-
}
|
|
401
|
-
if (!flipped)
|
|
441
|
+
|
|
442
|
+
// components/navigation/sidebar/use-measured-collapse.ts
|
|
443
|
+
import { useRef as useRef2, useState as useState2 } from "react";
|
|
444
|
+
/*!
|
|
445
|
+
* Ported from Fluid Functionalism — github.com/mickadesign/fluid-functionalism
|
|
446
|
+
* `registry/default/sidebar-core.tsx`, `sidebar-menu.tsx` @ b3587bdbd83fc66c2a6aae3817ffb856cb09260b
|
|
447
|
+
* MIT License © 2026 Micka Touillaud — fluidfunctionalism.com (notice: LICENSE.fluid-functionalism)
|
|
448
|
+
* Local changes: see PORTING.md.
|
|
449
|
+
*/
|
|
450
|
+
function useMeasuredCollapse(open, enabled = true) {
|
|
451
|
+
const contentRef = useRef2(null);
|
|
452
|
+
const [height, setHeight] = useState2(null);
|
|
453
|
+
useIsoLayoutEffect2(() => {
|
|
454
|
+
const el = contentRef.current;
|
|
455
|
+
if (!enabled || !el || typeof ResizeObserver === "undefined")
|
|
402
456
|
return;
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
className: cn2("peer shrink-0 sticky top-0 h-svh overflow-hidden", side === "right" && "order-last", variant === "inset" && "[--scroll-divider-inset:8px]", BREAKPOINT_FADE_BASE, BREAKPOINT_HIDDEN[mobileBreakpoint], !BREAKPOINT_HIDDEN[mobileBreakpoint] && isMobile && "hidden", className),
|
|
422
|
-
initial: false,
|
|
423
|
-
animate: { width: open ? width : "0rem" },
|
|
424
|
-
transition: widthTransition,
|
|
425
|
-
...props,
|
|
426
|
-
children: /* @__PURE__ */ jsxs(motion.div, {
|
|
427
|
-
className: cn2("absolute inset-y-0 flex h-full flex-col", side === "left" ? "left-0" : "right-0", variant === "floating" && "p-2", variant === "inset" && "py-2"),
|
|
428
|
-
style: { width },
|
|
457
|
+
const measure = () => setHeight(el.offsetHeight);
|
|
458
|
+
measure();
|
|
459
|
+
const observer = new ResizeObserver(measure);
|
|
460
|
+
observer.observe(el);
|
|
461
|
+
return () => observer.disconnect();
|
|
462
|
+
}, [enabled]);
|
|
463
|
+
const prevOpen = useRef2(open);
|
|
464
|
+
const toggling = useRef2(false);
|
|
465
|
+
if (prevOpen.current !== open) {
|
|
466
|
+
prevOpen.current = open;
|
|
467
|
+
toggling.current = true;
|
|
468
|
+
}
|
|
469
|
+
const measured = height !== null;
|
|
470
|
+
const transition = toggling.current ? open ? spring2.moderate : spring2.moderate.exit : { duration: 0 };
|
|
471
|
+
return {
|
|
472
|
+
contentRef,
|
|
473
|
+
measured,
|
|
474
|
+
motion: {
|
|
429
475
|
initial: false,
|
|
430
|
-
animate: {
|
|
431
|
-
transition
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
children: /* @__PURE__ */ jsx(SurfaceProvider2, {
|
|
438
|
-
value: floatingLevel,
|
|
439
|
-
children
|
|
440
|
-
})
|
|
441
|
-
}) : /* @__PURE__ */ jsx("div", {
|
|
442
|
-
"data-sidebar": "sidebar",
|
|
443
|
-
className: cn2("flex h-full w-full min-h-0 flex-col", bordered && variant === "sidebar" && (side === "left" ? "border-r border-border" : "border-l border-border")),
|
|
444
|
-
children
|
|
445
|
-
}),
|
|
446
|
-
rail && /* @__PURE__ */ jsx(SidebarRail2, {
|
|
447
|
-
tooltipOpen: railTooltipOpen,
|
|
448
|
-
className: cn2(variant === "floating" && (side === "left" ? "right-1 after:right-[3.5px]" : "left-1 after:left-[3.5px]"), variant !== "sidebar" && "after:inset-y-2 after:[mask-image:linear-gradient(to_bottom,transparent_var(--rail-fade-start),black_var(--rail-fade-end),black_calc(100%-var(--rail-fade-end)),transparent_calc(100%-var(--rail-fade-start)))]"),
|
|
449
|
-
style: variant !== "sidebar" ? {
|
|
450
|
-
"--rail-fade-start": `${shape.bgRadius >= 20 ? 24 : 12}px`,
|
|
451
|
-
"--rail-fade-end": `${(shape.bgRadius >= 20 ? 24 : 12) + 24}px`
|
|
452
|
-
} : undefined
|
|
453
|
-
})
|
|
454
|
-
]
|
|
455
|
-
})
|
|
456
|
-
});
|
|
457
|
-
});
|
|
458
|
-
SidebarShell.displayName = "SidebarShell";
|
|
459
|
-
function ShortcutKbd({ children }) {
|
|
460
|
-
return /* @__PURE__ */ jsx("kbd", {
|
|
461
|
-
className: "-my-1 flex h-4 min-w-4 items-center justify-center rounded border border-background/30 px-1 font-sans text-micro-compact text-background/80",
|
|
462
|
-
children
|
|
463
|
-
});
|
|
464
|
-
}
|
|
465
|
-
function useShortcutKey() {
|
|
466
|
-
const { side, shortcut } = useSidebar2();
|
|
467
|
-
return shortcut ?? (side === "right" ? SIDEBAR_KEYBOARD_SHORTCUT_RIGHT2 : SIDEBAR_KEYBOARD_SHORTCUT2);
|
|
476
|
+
animate: measured ? { height: open ? height : 0, opacity: open ? 1 : 0 } : { opacity: open ? 1 : 0 },
|
|
477
|
+
transition
|
|
478
|
+
},
|
|
479
|
+
settle: () => {
|
|
480
|
+
toggling.current = false;
|
|
481
|
+
}
|
|
482
|
+
};
|
|
468
483
|
}
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
484
|
+
|
|
485
|
+
// components/navigation/sidebar/sidebar-group.tsx
|
|
486
|
+
import { jsx as jsx3, jsxs as jsxs3, Fragment as Fragment3 } from "react/jsx-runtime";
|
|
487
|
+
/*!
|
|
488
|
+
* Ported from Fluid Functionalism — github.com/mickadesign/fluid-functionalism
|
|
489
|
+
* `registry/default/sidebar-core.tsx` @ b3587bdbd83fc66c2a6aae3817ffb856cb09260b
|
|
490
|
+
* MIT License © 2026 Micka Touillaud — fluidfunctionalism.com (notice: LICENSE.fluid-functionalism)
|
|
491
|
+
* Local changes: see PORTING.md.
|
|
492
|
+
*/
|
|
493
|
+
var SidebarGroupContext = createContext3(null);
|
|
494
|
+
var isHeaderAction = (node) => isValidElement(node) && (node.type === SidebarGroupAction2 || node.type === SidebarGroupActions2);
|
|
495
|
+
var actionCount = (node) => isValidElement(node) && node.type === SidebarGroupActions2 ? Children2.count(node.props.children) : 1;
|
|
496
|
+
var SidebarGroup2 = forwardRef(({ className, collapsible = false, open: openProp, defaultOpen = true, onOpenChange, children, ...props }, ref) => {
|
|
497
|
+
const [open, setOpen] = useControllableState2(openProp, defaultOpen, onOpenChange);
|
|
498
|
+
const contentId = useId();
|
|
499
|
+
const fold = useMeasuredCollapse(open, collapsible);
|
|
500
|
+
const [settled, setSettled] = useState3(open);
|
|
501
|
+
useEffect(() => {
|
|
502
|
+
if (!open)
|
|
503
|
+
setSettled(false);
|
|
504
|
+
}, [open]);
|
|
505
|
+
let inner = children;
|
|
506
|
+
let actionsCount = 0;
|
|
507
|
+
const kids = Children2.toArray(children);
|
|
508
|
+
const labelIdx = collapsible ? kids.findIndex((k) => isValidElement(k) && k.type === SidebarGroupLabel2) : -1;
|
|
509
|
+
if (labelIdx !== -1) {
|
|
510
|
+
const tail = kids.slice(labelIdx + 1);
|
|
511
|
+
const headerActions = tail.filter(isHeaderAction);
|
|
512
|
+
actionsCount = headerActions.reduce((n, k) => n + actionCount(k), 0);
|
|
513
|
+
inner = /* @__PURE__ */ jsxs3(Fragment3, {
|
|
483
514
|
children: [
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
515
|
+
kids.slice(0, labelIdx),
|
|
516
|
+
/* @__PURE__ */ jsxs3("div", {
|
|
517
|
+
className: "group/group-header w-full",
|
|
518
|
+
children: [
|
|
519
|
+
kids[labelIdx],
|
|
520
|
+
headerActions
|
|
521
|
+
]
|
|
487
522
|
}),
|
|
488
|
-
/* @__PURE__ */
|
|
489
|
-
|
|
523
|
+
/* @__PURE__ */ jsx3(motion2.div, {
|
|
524
|
+
id: contentId,
|
|
525
|
+
"aria-hidden": open ? undefined : true,
|
|
526
|
+
className: cn2(open && settled ? "overflow-visible" : "overflow-hidden", !fold.measured && !open && "h-0"),
|
|
527
|
+
...fold.motion,
|
|
528
|
+
onAnimationComplete: () => {
|
|
529
|
+
fold.settle();
|
|
530
|
+
if (open)
|
|
531
|
+
setSettled(true);
|
|
532
|
+
},
|
|
533
|
+
children: /* @__PURE__ */ jsx3("div", {
|
|
534
|
+
ref: fold.contentRef,
|
|
535
|
+
className: "flex w-full min-w-0 flex-col",
|
|
536
|
+
...open ? {} : { inert: "" },
|
|
537
|
+
children: tail.filter((k) => !isHeaderAction(k))
|
|
538
|
+
})
|
|
490
539
|
})
|
|
491
540
|
]
|
|
492
|
-
})
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
"aria-label": hoverMode ? label : "Toggle Sidebar",
|
|
505
|
-
onClick: (event) => {
|
|
506
|
-
onClick?.(event);
|
|
507
|
-
toggleSidebar();
|
|
508
|
-
},
|
|
509
|
-
...props,
|
|
510
|
-
children: children ?? /* @__PURE__ */ jsx(TriggerIcon, {})
|
|
511
|
-
})
|
|
512
|
-
});
|
|
513
|
-
});
|
|
514
|
-
SidebarTrigger2.displayName = "SidebarTrigger";
|
|
515
|
-
var SidebarRail2 = forwardRef(({ className, tooltipOpen, ...props }, ref) => {
|
|
516
|
-
const { toggleSidebar, open, setOpen, setHoverOpen, setWidth, side, setIsResizing } = useSidebar2();
|
|
517
|
-
const shortcutKey = useShortcutKey();
|
|
518
|
-
const railRef = useRef(null);
|
|
519
|
-
const dragRef = useRef(null);
|
|
520
|
-
const [dragging, setDragging] = useState(false);
|
|
521
|
-
const onPointerDown = (event) => {
|
|
522
|
-
const panel = railRef.current?.closest('[data-slot="sidebar"]');
|
|
523
|
-
if (!panel)
|
|
524
|
-
return;
|
|
525
|
-
dragRef.current = {
|
|
526
|
-
startX: event.clientX,
|
|
527
|
-
startWidth: panel.offsetWidth,
|
|
528
|
-
moved: false,
|
|
529
|
-
collapsed: false,
|
|
530
|
-
kept: open
|
|
531
|
-
};
|
|
532
|
-
event.currentTarget.setPointerCapture(event.pointerId);
|
|
533
|
-
};
|
|
534
|
-
const onPointerMove = (event) => {
|
|
535
|
-
const drag = dragRef.current;
|
|
536
|
-
if (!drag)
|
|
537
|
-
return;
|
|
538
|
-
const dx = event.clientX - drag.startX;
|
|
539
|
-
if (!drag.moved && Math.abs(dx) < 4)
|
|
540
|
-
return;
|
|
541
|
-
if (!drag.moved) {
|
|
542
|
-
drag.moved = true;
|
|
543
|
-
setDragging(true);
|
|
544
|
-
setIsResizing(true);
|
|
545
|
-
}
|
|
546
|
-
const delta = side === "left" ? dx : -dx;
|
|
547
|
-
const raw = drag.startWidth + delta;
|
|
548
|
-
if (raw < SIDEBAR_MIN_WIDTH2 - SIDEBAR_COLLAPSE_SLOP2) {
|
|
549
|
-
if (!drag.collapsed) {
|
|
550
|
-
drag.collapsed = true;
|
|
551
|
-
setWidth(`${SIDEBAR_MIN_WIDTH2}px`);
|
|
552
|
-
(drag.kept ? setOpen : setHoverOpen)(false);
|
|
553
|
-
}
|
|
554
|
-
return;
|
|
555
|
-
}
|
|
556
|
-
if (drag.collapsed) {
|
|
557
|
-
drag.collapsed = false;
|
|
558
|
-
(drag.kept ? setOpen : setHoverOpen)(true);
|
|
559
|
-
}
|
|
560
|
-
const next = Math.max(SIDEBAR_MIN_WIDTH2, Math.min(SIDEBAR_MAX_WIDTH2, raw));
|
|
561
|
-
setWidth(`${next}px`);
|
|
562
|
-
};
|
|
563
|
-
const onPointerUp = (event) => {
|
|
564
|
-
const drag = dragRef.current;
|
|
565
|
-
dragRef.current = null;
|
|
566
|
-
event.currentTarget.releasePointerCapture(event.pointerId);
|
|
567
|
-
setDragging(false);
|
|
568
|
-
setIsResizing(false);
|
|
569
|
-
if (drag && !drag.moved) {
|
|
570
|
-
if (drag.kept)
|
|
571
|
-
toggleSidebar();
|
|
572
|
-
else
|
|
573
|
-
setHoverOpen(false);
|
|
574
|
-
}
|
|
575
|
-
};
|
|
576
|
-
const onPointerCancel = () => {
|
|
577
|
-
dragRef.current = null;
|
|
578
|
-
setDragging(false);
|
|
579
|
-
setIsResizing(false);
|
|
580
|
-
};
|
|
581
|
-
return /* @__PURE__ */ jsx(Tooltip2, {
|
|
582
|
-
side: side === "left" ? "right" : "left",
|
|
583
|
-
sideOffset: 8,
|
|
584
|
-
followCursor: "y",
|
|
585
|
-
forceOpen: dragging ? false : tooltipOpen,
|
|
586
|
-
content: /* @__PURE__ */ jsxs("span", {
|
|
587
|
-
className: "flex flex-col items-start gap-2",
|
|
588
|
-
children: [
|
|
589
|
-
/* @__PURE__ */ jsxs("span", {
|
|
590
|
-
className: "[text-box:trim-both_cap_alphabetic]",
|
|
591
|
-
children: [
|
|
592
|
-
/* @__PURE__ */ jsx("span", {
|
|
593
|
-
className: "weight-semibold",
|
|
594
|
-
children: "Drag"
|
|
595
|
-
}),
|
|
596
|
-
" to resize"
|
|
597
|
-
]
|
|
598
|
-
}),
|
|
599
|
-
/* @__PURE__ */ jsxs("span", {
|
|
600
|
-
className: "flex items-center gap-1.5",
|
|
601
|
-
children: [
|
|
602
|
-
/* @__PURE__ */ jsxs("span", {
|
|
603
|
-
className: "[text-box:trim-both_cap_alphabetic]",
|
|
604
|
-
children: [
|
|
605
|
-
/* @__PURE__ */ jsx("span", {
|
|
606
|
-
className: "weight-semibold",
|
|
607
|
-
children: "Click"
|
|
608
|
-
}),
|
|
609
|
-
" to collapse"
|
|
610
|
-
]
|
|
611
|
-
}),
|
|
612
|
-
/* @__PURE__ */ jsx(ShortcutKbd, {
|
|
613
|
-
children: shortcutKey
|
|
614
|
-
})
|
|
615
|
-
]
|
|
616
|
-
})
|
|
617
|
-
]
|
|
618
|
-
}),
|
|
619
|
-
children: /* @__PURE__ */ jsx("button", {
|
|
620
|
-
ref: (node) => {
|
|
621
|
-
railRef.current = node;
|
|
622
|
-
if (typeof ref === "function")
|
|
623
|
-
ref(node);
|
|
624
|
-
else if (ref)
|
|
625
|
-
ref.current = node;
|
|
626
|
-
},
|
|
627
|
-
type: "button",
|
|
628
|
-
"data-sidebar": "rail",
|
|
629
|
-
"aria-label": "Resize or collapse sidebar",
|
|
630
|
-
tabIndex: -1,
|
|
631
|
-
onPointerDown,
|
|
632
|
-
onPointerMove,
|
|
633
|
-
onPointerUp,
|
|
634
|
-
onPointerCancel,
|
|
635
|
-
className: cn2("absolute inset-y-0 z-20 w-2 cursor-col-resize touch-none outline-none", side === "left" ? "right-0" : "left-0", "after:absolute after:inset-y-0 after:w-px after:bg-transparent hover:after:bg-foreground/25 after:transition-colors after:duration-fast", tooltipOpen && "after:bg-foreground/25", side === "left" ? "after:right-0" : "after:left-0", className),
|
|
636
|
-
...props
|
|
637
|
-
})
|
|
638
|
-
});
|
|
639
|
-
});
|
|
640
|
-
SidebarRail2.displayName = "SidebarRail";
|
|
641
|
-
var SidebarInset2 = forwardRef(({ className, ...props }, ref) => {
|
|
642
|
-
const shape = useShape2();
|
|
643
|
-
return /* @__PURE__ */ jsx("main", {
|
|
644
|
-
ref,
|
|
645
|
-
"data-slot": "sidebar-inset",
|
|
646
|
-
className: cn2("relative flex min-h-0 w-full min-w-0 flex-1 flex-col bg-background", "peer-data-[variant=inset]:m-2 peer-data-[variant=inset]:peer-data-[side=left]:ml-0 peer-data-[variant=inset]:peer-data-[side=right]:mr-0", "peer-data-[variant=inset]:peer-data-[state=collapsed]:peer-data-[side=left]:ml-2 peer-data-[variant=inset]:peer-data-[state=collapsed]:peer-data-[side=right]:mr-2", "transition-[margin] duration-fast", shape.bgRadius >= 20 ? "peer-data-[variant=inset]:rounded-3xl" : "peer-data-[variant=inset]:rounded-xl", "peer-data-[variant=inset]:bg-surface-2 peer-data-[variant=inset]:shadow-surface-2", className),
|
|
647
|
-
...props
|
|
648
|
-
});
|
|
649
|
-
});
|
|
650
|
-
SidebarInset2.displayName = "SidebarInset";
|
|
651
|
-
var SidebarInput2 = forwardRef(({ className, ...props }, ref) => {
|
|
652
|
-
const shape = useShape2();
|
|
653
|
-
const size = useSize2();
|
|
654
|
-
return /* @__PURE__ */ jsx("input", {
|
|
655
|
-
ref,
|
|
656
|
-
"data-sidebar": "input",
|
|
657
|
-
className: cn2(fieldVariants2(), "w-full px-3 text-foreground placeholder:text-muted-foreground outline-none", "focus-visible:ring-focus-ring", size.variant === "compact" ? "h-7" : "h-8", size.text, shape.input, className),
|
|
658
|
-
...props
|
|
659
|
-
});
|
|
660
|
-
});
|
|
661
|
-
SidebarInput2.displayName = "SidebarInput";
|
|
662
|
-
var SidebarHeader2 = forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", {
|
|
663
|
-
ref,
|
|
664
|
-
"data-sidebar": "header",
|
|
665
|
-
className: cn2("flex shrink-0 flex-col gap-2 p-2", className),
|
|
666
|
-
...props
|
|
667
|
-
}));
|
|
668
|
-
SidebarHeader2.displayName = "SidebarHeader";
|
|
669
|
-
var SidebarFooter2 = forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", {
|
|
670
|
-
ref,
|
|
671
|
-
"data-sidebar": "footer",
|
|
672
|
-
className: cn2("mt-auto flex shrink-0 flex-col gap-2 p-2", className),
|
|
673
|
-
...props
|
|
674
|
-
}));
|
|
675
|
-
SidebarFooter2.displayName = "SidebarFooter";
|
|
676
|
-
var SidebarSeparator2 = forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", {
|
|
677
|
-
ref,
|
|
678
|
-
"data-sidebar": "separator",
|
|
679
|
-
role: "separator",
|
|
680
|
-
"aria-orientation": "horizontal",
|
|
681
|
-
className: cn2("mx-2 h-px shrink-0 bg-border", className),
|
|
682
|
-
...props
|
|
683
|
-
}));
|
|
684
|
-
SidebarSeparator2.displayName = "SidebarSeparator";
|
|
685
|
-
var useIsoLayoutEffect = typeof window !== "undefined" ? useLayoutEffect : useEffect;
|
|
686
|
-
var SidebarGroupContext = createContext(null);
|
|
687
|
-
var SidebarGroup2 = forwardRef(({ className, collapsible = false, open: openProp, defaultOpen = true, onOpenChange, children, ...props }, ref) => {
|
|
688
|
-
const [uncontrolledOpen, setUncontrolledOpen] = useState(defaultOpen);
|
|
689
|
-
const open = openProp ?? uncontrolledOpen;
|
|
690
|
-
const contentId = useId();
|
|
691
|
-
const toggle = useCallback(() => {
|
|
692
|
-
const next = !(openProp ?? uncontrolledOpen);
|
|
693
|
-
setUncontrolledOpen(next);
|
|
694
|
-
onOpenChange?.(next);
|
|
695
|
-
}, [openProp, uncontrolledOpen, onOpenChange]);
|
|
696
|
-
const contentRef = useRef(null);
|
|
697
|
-
const [contentHeight, setContentHeight] = useState(null);
|
|
698
|
-
useIsoLayoutEffect(() => {
|
|
699
|
-
if (!collapsible)
|
|
700
|
-
return;
|
|
701
|
-
const el = contentRef.current;
|
|
702
|
-
if (!el || typeof ResizeObserver === "undefined")
|
|
703
|
-
return;
|
|
704
|
-
const measure = () => setContentHeight(el.offsetHeight);
|
|
705
|
-
measure();
|
|
706
|
-
const ro = new ResizeObserver(measure);
|
|
707
|
-
ro.observe(el);
|
|
708
|
-
return () => ro.disconnect();
|
|
709
|
-
}, [collapsible]);
|
|
710
|
-
const measured = contentHeight !== null;
|
|
711
|
-
const [settled, setSettled] = useState(open);
|
|
712
|
-
useEffect(() => {
|
|
713
|
-
if (!open)
|
|
714
|
-
setSettled(false);
|
|
715
|
-
}, [open]);
|
|
716
|
-
const prevOpenRef = useRef(open);
|
|
717
|
-
const togglingRef = useRef(false);
|
|
718
|
-
if (prevOpenRef.current !== open) {
|
|
719
|
-
prevOpenRef.current = open;
|
|
720
|
-
togglingRef.current = true;
|
|
721
|
-
}
|
|
722
|
-
const isHeaderAction = (k) => isValidElement(k) && (k.type === SidebarGroupAction2 || k.type === SidebarGroupActions2);
|
|
723
|
-
let inner = children;
|
|
724
|
-
let actionsCount = 0;
|
|
725
|
-
if (collapsible) {
|
|
726
|
-
const kids = Children.toArray(children);
|
|
727
|
-
const labelIdx = kids.findIndex((k) => isValidElement(k) && k.type === SidebarGroupLabel2);
|
|
728
|
-
if (labelIdx !== -1) {
|
|
729
|
-
const tail = kids.slice(labelIdx + 1);
|
|
730
|
-
const headerActions = tail.filter(isHeaderAction);
|
|
731
|
-
const rest = tail.filter((k) => !isHeaderAction(k));
|
|
732
|
-
actionsCount = headerActions.reduce((n, k) => n + (isValidElement(k) && k.type === SidebarGroupActions2 ? Children.count(k.props.children) : 1), 0);
|
|
733
|
-
inner = /* @__PURE__ */ jsxs(Fragment, {
|
|
734
|
-
children: [
|
|
735
|
-
kids.slice(0, labelIdx),
|
|
736
|
-
/* @__PURE__ */ jsxs("div", {
|
|
737
|
-
className: "group/group-header w-full",
|
|
738
|
-
children: [
|
|
739
|
-
kids[labelIdx],
|
|
740
|
-
headerActions
|
|
741
|
-
]
|
|
742
|
-
}),
|
|
743
|
-
/* @__PURE__ */ jsx(motion.div, {
|
|
744
|
-
id: contentId,
|
|
745
|
-
"aria-hidden": open ? undefined : true,
|
|
746
|
-
className: cn2(open && settled ? "overflow-visible" : "overflow-hidden", !measured && !open && "h-0"),
|
|
747
|
-
initial: false,
|
|
748
|
-
animate: measured ? { height: open ? contentHeight : 0, opacity: open ? 1 : 0 } : { opacity: open ? 1 : 0 },
|
|
749
|
-
transition: togglingRef.current ? open ? spring2.moderate : spring2.moderate.exit : { duration: 0 },
|
|
750
|
-
onAnimationComplete: () => {
|
|
751
|
-
togglingRef.current = false;
|
|
752
|
-
if (open)
|
|
753
|
-
setSettled(true);
|
|
754
|
-
},
|
|
755
|
-
children: /* @__PURE__ */ jsx("div", {
|
|
756
|
-
ref: contentRef,
|
|
757
|
-
className: "flex w-full min-w-0 flex-col",
|
|
758
|
-
...inertProps2(!open),
|
|
759
|
-
children: rest
|
|
760
|
-
})
|
|
761
|
-
})
|
|
762
|
-
]
|
|
763
|
-
});
|
|
764
|
-
}
|
|
765
|
-
}
|
|
766
|
-
const ctx = useMemo(() => ({ open, toggle, contentId, actionsCount }), [open, toggle, contentId, actionsCount]);
|
|
767
|
-
return /* @__PURE__ */ jsx("div", {
|
|
768
|
-
ref,
|
|
769
|
-
"data-sidebar": "group",
|
|
770
|
-
"data-state": collapsible ? open ? "open" : "closed" : undefined,
|
|
771
|
-
className: cn2("relative flex w-full min-w-0 flex-col p-2", className),
|
|
772
|
-
...props,
|
|
773
|
-
children: /* @__PURE__ */ jsx(SidebarGroupContext.Provider, {
|
|
774
|
-
value: collapsible ? ctx : null,
|
|
775
|
-
children: inner
|
|
541
|
+
});
|
|
542
|
+
}
|
|
543
|
+
const ctx = useMemo2(() => ({ open, toggle: () => setOpen((prev) => !prev), contentId, actionsCount }), [open, setOpen, contentId, actionsCount]);
|
|
544
|
+
return /* @__PURE__ */ jsx3("div", {
|
|
545
|
+
ref,
|
|
546
|
+
"data-sidebar": "group",
|
|
547
|
+
"data-state": collapsible ? open ? "open" : "closed" : undefined,
|
|
548
|
+
className: cn2("relative flex w-full min-w-0 flex-col p-2", className),
|
|
549
|
+
...props,
|
|
550
|
+
children: /* @__PURE__ */ jsx3(SidebarGroupContext.Provider, {
|
|
551
|
+
value: collapsible ? ctx : null,
|
|
552
|
+
children: inner
|
|
776
553
|
})
|
|
777
554
|
});
|
|
778
555
|
});
|
|
779
556
|
SidebarGroup2.displayName = "SidebarGroup";
|
|
780
557
|
var SidebarGroupLabel2 = forwardRef(({ className, render, asChild, children, ...props }, ref) => {
|
|
781
|
-
const
|
|
782
|
-
const
|
|
783
|
-
const group = useContext(SidebarGroupContext);
|
|
558
|
+
const size = useSize2();
|
|
559
|
+
const group = useContext2(SidebarGroupContext);
|
|
784
560
|
const shape = useShape2();
|
|
785
561
|
const ChevronRightIcon = useIcon2("chevron-right");
|
|
786
|
-
const { template, content } =
|
|
787
|
-
const
|
|
788
|
-
|
|
789
|
-
while (textEnd < nodes.length && (typeof nodes[textEnd] === "string" || typeof nodes[textEnd] === "number")) {
|
|
790
|
-
textEnd++;
|
|
791
|
-
}
|
|
792
|
-
const leadingText = nodes.slice(0, textEnd).join("");
|
|
793
|
-
const labelContent = leadingText ? /* @__PURE__ */ jsxs(Fragment, {
|
|
562
|
+
const { template, content } = resolveSlotTemplate2(render, asChild, children);
|
|
563
|
+
const [text, rest] = splitLabel(content);
|
|
564
|
+
const label = text ? /* @__PURE__ */ jsxs3(Fragment3, {
|
|
794
565
|
children: [
|
|
795
|
-
/* @__PURE__ */
|
|
566
|
+
/* @__PURE__ */ jsx3("span", {
|
|
796
567
|
className: "min-w-0 truncate",
|
|
797
|
-
children:
|
|
568
|
+
children: text
|
|
798
569
|
}),
|
|
799
|
-
|
|
570
|
+
rest
|
|
800
571
|
]
|
|
801
572
|
}) : content;
|
|
802
|
-
|
|
803
|
-
|
|
573
|
+
const textClass = size.variant === "compact" ? "text-caption-compact" : "text-caption";
|
|
574
|
+
if (!group) {
|
|
575
|
+
return slotElement2(template, "div", {
|
|
804
576
|
ref,
|
|
805
|
-
type: template ? undefined : "button",
|
|
806
577
|
"data-sidebar": "group-label",
|
|
807
|
-
"
|
|
808
|
-
"aria-controls": group.contentId,
|
|
809
|
-
onClick: group.toggle,
|
|
810
|
-
style: group.actionsCount > 0 ? { "--group-actions-pad": `${group.actionsCount * 28 + 6}px` } : undefined,
|
|
811
|
-
className: cn2("flex h-8 w-full shrink-0 cursor-pointer select-none items-center gap-2 px-2 text-left text-muted-foreground/70 outline-none", "transition-colors duration-fast hover:text-muted-foreground", group.actionsCount > 0 && "pr-[var(--group-actions-pad)]", "focus-visible:ring-1 focus-visible:ring-focus-ring", shape.item, sizeVariant === "compact" ? "text-caption-compact" : "text-caption", className),
|
|
578
|
+
className: cn2("flex h-8 shrink-0 items-center gap-2 px-2 text-muted-foreground/70 outline-none", textClass, className),
|
|
812
579
|
...props
|
|
813
|
-
},
|
|
814
|
-
children: [
|
|
815
|
-
labelContent,
|
|
816
|
-
/* @__PURE__ */ jsx("span", {
|
|
817
|
-
className: cn2("ml-auto flex h-6 shrink-0 items-center justify-center overflow-hidden", group.open ? "w-0 opacity-0 group-hover/group-header:w-6 group-hover/group-header:opacity-100 group-focus-within/group-header:w-6 group-focus-within/group-header:opacity-100 group-has-[[data-sidebar=group-action]:is([data-state=open],[data-popup-open],[aria-expanded=true])]/group-header:w-6 group-has-[[data-sidebar=group-action]:is([data-state=open],[data-popup-open],[aria-expanded=true])]/group-header:opacity-100 pointer-coarse:w-6 pointer-coarse:opacity-100" : "w-6 opacity-100"),
|
|
818
|
-
children: /* @__PURE__ */ jsx(motion.span, {
|
|
819
|
-
className: "inline-flex",
|
|
820
|
-
animate: { rotate: group.open ? 90 : 0 },
|
|
821
|
-
transition: spring2.fast,
|
|
822
|
-
children: /* @__PURE__ */ jsx(ChevronRightIcon, {
|
|
823
|
-
size: sizeClasses.icon,
|
|
824
|
-
strokeWidth: 1.5,
|
|
825
|
-
className: "shrink-0"
|
|
826
|
-
})
|
|
827
|
-
})
|
|
828
|
-
})
|
|
829
|
-
]
|
|
830
|
-
}));
|
|
580
|
+
}, label);
|
|
831
581
|
}
|
|
832
|
-
return
|
|
582
|
+
return slotElement2(template, "button", {
|
|
833
583
|
ref,
|
|
584
|
+
type: template ? undefined : "button",
|
|
834
585
|
"data-sidebar": "group-label",
|
|
835
|
-
|
|
586
|
+
"aria-expanded": group.open,
|
|
587
|
+
"aria-controls": group.contentId,
|
|
588
|
+
onClick: group.toggle,
|
|
589
|
+
style: group.actionsCount > 0 ? { "--group-actions-pad": `${group.actionsCount * 28 + 6}px` } : undefined,
|
|
590
|
+
className: cn2("flex h-8 w-full shrink-0 cursor-pointer select-none items-center gap-2 px-2 text-left text-muted-foreground/70 outline-none", "transition-colors duration-fast hover:text-muted-foreground", group.actionsCount > 0 && "pr-[var(--group-actions-pad)]", "focus-visible:ring-1 focus-visible:ring-focus-ring", shape.item, textClass, className),
|
|
836
591
|
...props
|
|
837
|
-
},
|
|
592
|
+
}, /* @__PURE__ */ jsxs3(Fragment3, {
|
|
593
|
+
children: [
|
|
594
|
+
label,
|
|
595
|
+
/* @__PURE__ */ jsx3("span", {
|
|
596
|
+
className: cn2("ml-auto flex h-6 shrink-0 items-center justify-center overflow-hidden", group.open ? "w-0 opacity-0 group-hover/group-header:w-6 group-hover/group-header:opacity-100 group-focus-within/group-header:w-6 group-focus-within/group-header:opacity-100 group-has-[[data-sidebar=group-action]:is([data-popup-open],[aria-expanded=true])]/group-header:w-6 group-has-[[data-sidebar=group-action]:is([data-popup-open],[aria-expanded=true])]/group-header:opacity-100 pointer-coarse:w-6 pointer-coarse:opacity-100" : "w-6 opacity-100"),
|
|
597
|
+
children: /* @__PURE__ */ jsx3(motion2.span, {
|
|
598
|
+
className: "inline-flex",
|
|
599
|
+
animate: { rotate: group.open ? 90 : 0 },
|
|
600
|
+
transition: spring2.fast,
|
|
601
|
+
children: /* @__PURE__ */ jsx3(ChevronRightIcon, {
|
|
602
|
+
size: size.icon,
|
|
603
|
+
strokeWidth: 1.5,
|
|
604
|
+
className: "shrink-0"
|
|
605
|
+
})
|
|
606
|
+
})
|
|
607
|
+
})
|
|
608
|
+
]
|
|
609
|
+
}));
|
|
838
610
|
});
|
|
839
611
|
SidebarGroupLabel2.displayName = "SidebarGroupLabel";
|
|
840
|
-
var GroupActionsContext =
|
|
841
|
-
var SidebarGroupAction2 = forwardRef(({ className, render, asChild, children, ...props }, ref) => {
|
|
612
|
+
var GroupActionsContext = createContext3(false);
|
|
613
|
+
var SidebarGroupAction2 = forwardRef(({ className, render, asChild, children, style, ...props }, ref) => {
|
|
842
614
|
const shape = useShape2();
|
|
843
|
-
const
|
|
844
|
-
const inCluster =
|
|
845
|
-
const { template, content } =
|
|
846
|
-
return
|
|
615
|
+
const size = useSize2();
|
|
616
|
+
const inCluster = useContext2(GroupActionsContext);
|
|
617
|
+
const { template, content } = resolveSlotTemplate2(render, asChild, children);
|
|
618
|
+
return slotElement2(template, "button", {
|
|
847
619
|
ref,
|
|
848
620
|
type: template ? undefined : "button",
|
|
849
621
|
"data-sidebar": "group-action",
|
|
850
|
-
className: cn2(inCluster ? "relative
|
|
622
|
+
className: cn2(inCluster ? "relative" : "absolute right-3.5 top-3", "flex size-6 items-center justify-center text-muted-foreground outline-none", "hover:bg-hover hover:text-foreground transition-colors duration-fast", "focus-visible:ring-1 focus-visible:ring-focus-ring", "[&_svg]:size-[var(--icon-size)] [&_svg]:shrink-0 [&_svg]:stroke-[1.5] [&_svg]:transition-[stroke-width] [&_svg]:duration-fast hover:[&_svg]:stroke-[2]", shape.item, className),
|
|
851
623
|
...props,
|
|
852
|
-
style: {
|
|
853
|
-
...{ "--icon-size": `${sizeClasses.icon}px` },
|
|
854
|
-
...props.style ?? {}
|
|
855
|
-
}
|
|
624
|
+
style: { "--icon-size": `${size.icon}px`, ...style }
|
|
856
625
|
}, content);
|
|
857
626
|
});
|
|
858
627
|
SidebarGroupAction2.displayName = "SidebarGroupAction";
|
|
859
|
-
var SidebarGroupActions2 = forwardRef(({ className, children, ...props }, ref) => {
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
});
|
|
870
|
-
});
|
|
628
|
+
var SidebarGroupActions2 = forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsx3("div", {
|
|
629
|
+
ref,
|
|
630
|
+
"data-sidebar": "group-actions",
|
|
631
|
+
className: cn2("absolute right-3.5 top-2 z-10 flex h-8 items-center gap-1", className),
|
|
632
|
+
...props,
|
|
633
|
+
children: /* @__PURE__ */ jsx3(GroupActionsContext.Provider, {
|
|
634
|
+
value: true,
|
|
635
|
+
children
|
|
636
|
+
})
|
|
637
|
+
}));
|
|
871
638
|
SidebarGroupActions2.displayName = "SidebarGroupActions";
|
|
872
|
-
var SidebarGroupContent2 = forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
639
|
+
var SidebarGroupContent2 = forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx3("div", {
|
|
873
640
|
ref,
|
|
874
641
|
"data-sidebar": "group-content",
|
|
875
642
|
className: cn2("w-full", className),
|
|
@@ -877,310 +644,290 @@ var SidebarGroupContent2 = forwardRef(({ className, ...props }, ref) => /* @__PU
|
|
|
877
644
|
}));
|
|
878
645
|
SidebarGroupContent2.displayName = "SidebarGroupContent";
|
|
879
646
|
|
|
880
|
-
// components/navigation/sidebar/sidebar-menu.tsx
|
|
881
|
-
import { AnimatePresence, motion as motion2 } from "motion/react";
|
|
647
|
+
// components/navigation/sidebar/sidebar-menu-actions.tsx
|
|
882
648
|
import {
|
|
883
|
-
Children as
|
|
884
|
-
createContext as createContext2,
|
|
649
|
+
Children as Children3,
|
|
885
650
|
forwardRef as forwardRef2,
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
useEffect as useEffect2,
|
|
889
|
-
useId as useId2,
|
|
890
|
-
useLayoutEffect as useLayoutEffect2,
|
|
891
|
-
useMemo as useMemo2,
|
|
892
|
-
useRef as useRef2,
|
|
893
|
-
useState as useState2
|
|
651
|
+
useContext as useContext3,
|
|
652
|
+
useId as useId2
|
|
894
653
|
} from "react";
|
|
895
|
-
import { jsx as
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
}
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
var overlayGroupSeq = 0;
|
|
912
|
-
var overlayGroupIds = new WeakMap;
|
|
913
|
-
function overlayGroupId(el) {
|
|
914
|
-
let id = overlayGroupIds.get(el);
|
|
915
|
-
if (id === undefined) {
|
|
916
|
-
id = ++overlayGroupSeq;
|
|
917
|
-
overlayGroupIds.set(el, id);
|
|
918
|
-
}
|
|
919
|
-
return id;
|
|
920
|
-
}
|
|
921
|
-
function byDomOrder(a, b) {
|
|
922
|
-
return a.compareDocumentPosition(b) & Node.DOCUMENT_POSITION_FOLLOWING ? -1 : 1;
|
|
923
|
-
}
|
|
924
|
-
function sameElements(a, b) {
|
|
925
|
-
return a.length === b.length && a.every((el, i) => el === b[i]);
|
|
926
|
-
}
|
|
927
|
-
function useMenuScope(containerRef, { focusRing = true } = {}) {
|
|
928
|
-
const { activeIndex, setActiveIndex, itemRects, isMeasured, sessionRef, handlers, registerItem } = useFluidHover2(containerRef, { isItemDisabled: rowSkipped });
|
|
929
|
-
const rowsRef = useRef2(new Set);
|
|
930
|
-
const rowButtonsRef = useRef2(new Map);
|
|
931
|
-
const activeMapRef = useRef2(new Map);
|
|
932
|
-
const [orderedRows, setOrderedRows] = useState2([]);
|
|
933
|
-
const orderedRowsRef = useRef2(orderedRows);
|
|
934
|
-
orderedRowsRef.current = orderedRows;
|
|
935
|
-
const registeredCountRef = useRef2(0);
|
|
936
|
-
const [activeRows, setActiveRows] = useState2([]);
|
|
937
|
-
const [focusedRowEl, setFocusedRowEl] = useState2(null);
|
|
938
|
-
const recomputeActive = useCallback2(() => {
|
|
939
|
-
const next = orderedRowsRef.current.filter((el) => activeMapRef.current.get(el) && !rowSkipped(el));
|
|
940
|
-
setActiveRows((prev) => sameElements(prev, next) ? prev : next);
|
|
941
|
-
}, []);
|
|
942
|
-
const rowButton = useCallback2((row) => rowButtonsRef.current.get(row) ?? row.querySelector(':scope > [data-sidebar="menu-button"], :scope > [data-sidebar="menu-sub-button"]'), []);
|
|
943
|
-
const syncRows = useCallback2(() => {
|
|
944
|
-
const sorted = [...rowsRef.current].sort(byDomOrder);
|
|
945
|
-
orderedRowsRef.current = sorted;
|
|
946
|
-
setOrderedRows((prev) => sameElements(prev, sorted) ? prev : sorted);
|
|
947
|
-
sorted.forEach((el, i) => registerItem(i, rowButton(el) ?? el));
|
|
948
|
-
for (let i = sorted.length;i < registeredCountRef.current; i++) {
|
|
949
|
-
registerItem(i, null);
|
|
950
|
-
}
|
|
951
|
-
registeredCountRef.current = sorted.length;
|
|
952
|
-
recomputeActive();
|
|
953
|
-
}, [registerItem, recomputeActive, rowButton]);
|
|
954
|
-
const registerRow = useCallback2((el) => {
|
|
955
|
-
rowsRef.current.add(el);
|
|
956
|
-
syncRows();
|
|
957
|
-
return () => {
|
|
958
|
-
rowsRef.current.delete(el);
|
|
959
|
-
rowButtonsRef.current.delete(el);
|
|
960
|
-
activeMapRef.current.delete(el);
|
|
961
|
-
syncRows();
|
|
962
|
-
};
|
|
963
|
-
}, [syncRows]);
|
|
964
|
-
const setRowButton = useCallback2((row, button) => {
|
|
965
|
-
if (button)
|
|
966
|
-
rowButtonsRef.current.set(row, button);
|
|
967
|
-
else
|
|
968
|
-
rowButtonsRef.current.delete(row);
|
|
969
|
-
syncRows();
|
|
970
|
-
}, [syncRows]);
|
|
971
|
-
const setRowActive = useCallback2((row, active) => {
|
|
972
|
-
activeMapRef.current.set(row, active);
|
|
973
|
-
recomputeActive();
|
|
974
|
-
}, [recomputeActive]);
|
|
975
|
-
const refreshVisibility = useCallback2(() => {
|
|
976
|
-
recomputeActive();
|
|
977
|
-
setActiveIndex((prev) => {
|
|
978
|
-
const row = prev !== null ? orderedRowsRef.current[prev] : undefined;
|
|
979
|
-
return row && rowSkipped(row) ? null : prev;
|
|
980
|
-
});
|
|
981
|
-
}, [recomputeActive, setActiveIndex]);
|
|
982
|
-
const overlayRect = useCallback2((row) => {
|
|
983
|
-
if (!row)
|
|
984
|
-
return null;
|
|
985
|
-
const idx = orderedRowsRef.current.indexOf(row);
|
|
986
|
-
const rect = idx === -1 ? null : itemRects[idx];
|
|
987
|
-
if (!rect)
|
|
988
|
-
return null;
|
|
989
|
-
const height = Math.min(rect.height, rowButton(row)?.offsetHeight ?? 48);
|
|
990
|
-
return { ...rect, height };
|
|
991
|
-
}, [itemRects, rowButton]);
|
|
992
|
-
const popupOpen = useCallback2(() => {
|
|
993
|
-
const container = containerRef.current;
|
|
994
|
-
if (!container)
|
|
995
|
-
return false;
|
|
996
|
-
const root = container.closest('[data-slot="sidebar-wrapper"]') ?? container;
|
|
997
|
-
return !!root.querySelector('[data-sidebar="menu-button"][data-state="open"], [data-sidebar="menu-button"][data-popup-open], [data-sidebar="menu-action"][data-state="open"], [data-sidebar="menu-action"][data-popup-open]');
|
|
998
|
-
}, [containerRef]);
|
|
999
|
-
const onMouseMove = useCallback2((e) => {
|
|
1000
|
-
if (popupOpen())
|
|
1001
|
-
return;
|
|
1002
|
-
handlers.onMouseMove(e);
|
|
1003
|
-
}, [popupOpen, handlers]);
|
|
1004
|
-
const onFocus = useCallback2((e) => {
|
|
1005
|
-
const target = e.target;
|
|
1006
|
-
if (!target.closest('[data-sidebar="menu-button"],[data-sidebar="menu-sub-button"]'))
|
|
1007
|
-
return;
|
|
1008
|
-
const row = target.closest('[data-sidebar="menu-item"],[data-sidebar="menu-sub-item"]');
|
|
1009
|
-
if (!row)
|
|
1010
|
-
return;
|
|
1011
|
-
const idx = orderedRowsRef.current.indexOf(row);
|
|
1012
|
-
if (idx === -1)
|
|
1013
|
-
return;
|
|
1014
|
-
setActiveIndex(idx);
|
|
1015
|
-
setFocusedRowEl(target.matches(":focus-visible") ? row : null);
|
|
1016
|
-
}, [setActiveIndex]);
|
|
1017
|
-
const onPointerDown = useCallback2(() => {
|
|
1018
|
-
setFocusedRowEl(null);
|
|
1019
|
-
}, []);
|
|
1020
|
-
const onBlur = useCallback2((e) => {
|
|
1021
|
-
if (containerRef.current?.contains(e.relatedTarget))
|
|
1022
|
-
return;
|
|
1023
|
-
setFocusedRowEl(null);
|
|
1024
|
-
setActiveIndex(null);
|
|
1025
|
-
}, [containerRef, setActiveIndex]);
|
|
1026
|
-
const onKeyDown = useCallback2((e) => {
|
|
1027
|
-
if (!["ArrowDown", "ArrowUp", "ArrowRight", "ArrowLeft", "Home", "End"].includes(e.key))
|
|
1028
|
-
return;
|
|
1029
|
-
const container = containerRef.current;
|
|
1030
|
-
if (!container)
|
|
1031
|
-
return;
|
|
1032
|
-
const items = Array.from(container.querySelectorAll('[data-sidebar="menu-button"], [data-sidebar="menu-sub-button"]')).filter((el) => !el.closest('[data-sidebar="menu-sub"][data-state="closed"]'));
|
|
1033
|
-
const currentIdx = items.indexOf(e.target);
|
|
1034
|
-
if (currentIdx === -1)
|
|
654
|
+
import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
655
|
+
/*!
|
|
656
|
+
* Ported from Fluid Functionalism — github.com/mickadesign/fluid-functionalism
|
|
657
|
+
* `registry/default/sidebar-menu.tsx` @ b3587bdbd83fc66c2a6aae3817ffb856cb09260b
|
|
658
|
+
* MIT License © 2026 Micka Touillaud — fluidfunctionalism.com (notice: LICENSE.fluid-functionalism)
|
|
659
|
+
* Local changes: see PORTING.md.
|
|
660
|
+
*/
|
|
661
|
+
var SidebarMenuAction2 = forwardRef2(({ className, showOnHover = false, render, asChild, children, onClick, style, ...props }, ref) => {
|
|
662
|
+
const shape = useShape2();
|
|
663
|
+
const size = useSize2();
|
|
664
|
+
const item = useContext3(MenuItemContext);
|
|
665
|
+
const inCluster = useContext3(MenuActionsClusterContext);
|
|
666
|
+
const { template, content } = resolveSlotTemplate2(render, asChild, children);
|
|
667
|
+
const setActions = item?.setActions;
|
|
668
|
+
useIsoLayoutEffect2(() => {
|
|
669
|
+
if (inCluster || !setActions)
|
|
1035
670
|
return;
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
671
|
+
setActions(1, showOnHover);
|
|
672
|
+
return () => setActions(0, false);
|
|
673
|
+
}, [inCluster, setActions, showOnHover]);
|
|
674
|
+
return slotElement2(template, "button", {
|
|
675
|
+
ref,
|
|
676
|
+
type: template ? undefined : "button",
|
|
677
|
+
"data-sidebar": "menu-action",
|
|
678
|
+
"data-show-on-hover": showOnHover ? "" : undefined,
|
|
679
|
+
className: cn2("flex size-6 items-center justify-center text-muted-foreground outline-none", inCluster ? "relative shrink-0" : "absolute right-1.5 z-10", !inCluster && (item?.isSubRow ? "group-has-[>[data-sidebar=menu-badge]]/menu-sub-item:right-8.5" : "group-has-[>[data-sidebar=menu-badge]]/menu-item:right-8.5"), !inCluster && (item?.isSubRow || size.variant === "compact" ? "top-0.5" : "top-1"), "hover:bg-hover hover:text-foreground transition-[color,background-color,opacity] duration-fast", "focus-visible:ring-1 focus-visible:ring-focus-ring", "[&_svg]:size-[var(--icon-size)] [&_svg]:shrink-0 [&_svg]:stroke-[1.5] [&_svg]:transition-[stroke-width] [&_svg]:duration-fast hover:[&_svg]:stroke-[2]", shape.item, !inCluster && showOnHover && (item?.isSubRow ? "opacity-0 group-hover/menu-sub-item:opacity-100 group-focus-within/menu-sub-item:opacity-100 data-[popup-open]:opacity-100 aria-expanded:opacity-100" : "opacity-0 peer-hover/menu-button:opacity-100 peer-focus-visible/menu-button:opacity-100 hover:opacity-100 focus-visible:opacity-100 data-[popup-open]:opacity-100 aria-expanded:opacity-100"), className),
|
|
680
|
+
onClick: (event) => {
|
|
681
|
+
event.stopPropagation();
|
|
682
|
+
onClick?.(event);
|
|
683
|
+
},
|
|
684
|
+
...props,
|
|
685
|
+
style: { "--icon-size": `${size.icon}px`, ...style }
|
|
686
|
+
}, content);
|
|
687
|
+
});
|
|
688
|
+
SidebarMenuAction2.displayName = "SidebarMenuAction";
|
|
689
|
+
var SidebarMenuActions2 = forwardRef2(({ className, showOnHover = false, children, ...props }, ref) => {
|
|
690
|
+
const item = useContext3(MenuItemContext);
|
|
691
|
+
const size = useSize2();
|
|
692
|
+
const count = Children3.count(children);
|
|
693
|
+
const setActions = item?.setActions;
|
|
694
|
+
useIsoLayoutEffect2(() => {
|
|
695
|
+
setActions?.(count, showOnHover);
|
|
696
|
+
return () => setActions?.(0, false);
|
|
697
|
+
}, [setActions, count, showOnHover]);
|
|
698
|
+
return /* @__PURE__ */ jsx4("div", {
|
|
699
|
+
ref,
|
|
700
|
+
"data-sidebar": "menu-actions",
|
|
701
|
+
className: cn2("absolute right-1.5 z-10 flex items-center gap-1", item?.isSubRow ? "group-has-[>[data-sidebar=menu-badge]]/menu-sub-item:right-8.5" : "group-has-[>[data-sidebar=menu-badge]]/menu-item:right-8.5", item?.isSubRow || size.variant === "compact" ? "top-0.5" : "top-1", showOnHover && (item?.isSubRow ? "opacity-0 transition-opacity duration-fast group-hover/menu-sub-item:opacity-100 group-focus-within/menu-sub-item:opacity-100 has-[[data-popup-open]]:opacity-100" : "opacity-0 transition-opacity duration-fast peer-hover/menu-button:opacity-100 peer-focus-visible/menu-button:opacity-100 hover:opacity-100 focus-within:opacity-100 has-[[data-popup-open]]:opacity-100"), className),
|
|
702
|
+
...props,
|
|
703
|
+
children: /* @__PURE__ */ jsx4(MenuActionsClusterContext.Provider, {
|
|
704
|
+
value: true,
|
|
705
|
+
children
|
|
706
|
+
})
|
|
707
|
+
});
|
|
708
|
+
});
|
|
709
|
+
SidebarMenuActions2.displayName = "SidebarMenuActions";
|
|
710
|
+
var SidebarMenuBadge2 = forwardRef2(({ className, ...props }, ref) => {
|
|
711
|
+
const item = useContext3(MenuItemContext);
|
|
712
|
+
const size = useSize2();
|
|
713
|
+
const lit = item?.isActiveRow ?? false;
|
|
714
|
+
const setHasBadge = item?.setHasBadge;
|
|
715
|
+
useIsoLayoutEffect2(() => {
|
|
716
|
+
setHasBadge?.(true);
|
|
717
|
+
return () => setHasBadge?.(false);
|
|
718
|
+
}, [setHasBadge]);
|
|
719
|
+
return /* @__PURE__ */ jsx4("div", {
|
|
720
|
+
ref,
|
|
721
|
+
"data-sidebar": "menu-badge",
|
|
722
|
+
className: cn2("pointer-events-none absolute right-2 z-10 flex h-5 min-w-5 items-center justify-center px-1 tabular-nums", size.variant === "compact" ? "top-1 text-micro-compact" : "top-1.5 text-micro", "transition-[color,font-variation-settings] duration-fast", lit ? "text-foreground weight-semibold" : "text-muted-foreground weight-normal", className),
|
|
723
|
+
...props
|
|
724
|
+
});
|
|
725
|
+
});
|
|
726
|
+
SidebarMenuBadge2.displayName = "SidebarMenuBadge";
|
|
727
|
+
var SKELETON_WIDTHS = ["62%", "74%", "55%", "82%", "68%"];
|
|
728
|
+
var SidebarMenuSkeleton2 = forwardRef2(({ className, showIcon = false, ...props }, ref) => {
|
|
729
|
+
const size = useSize2();
|
|
730
|
+
const id = useId2();
|
|
731
|
+
let sum = 0;
|
|
732
|
+
for (let i = 0;i < id.length; i++)
|
|
733
|
+
sum += id.charCodeAt(i);
|
|
734
|
+
return /* @__PURE__ */ jsxs4("div", {
|
|
735
|
+
ref,
|
|
736
|
+
"data-sidebar": "menu-skeleton",
|
|
737
|
+
className: cn2("flex items-center gap-2 px-2", size.variant === "compact" ? "h-7" : "h-8", className),
|
|
738
|
+
...props,
|
|
739
|
+
children: [
|
|
740
|
+
showIcon && /* @__PURE__ */ jsx4("div", {
|
|
741
|
+
"data-sidebar": "menu-skeleton-icon",
|
|
742
|
+
className: "size-4 shrink-0 animate-pulse rounded-md bg-hover"
|
|
743
|
+
}),
|
|
744
|
+
/* @__PURE__ */ jsx4("div", {
|
|
745
|
+
"data-sidebar": "menu-skeleton-text",
|
|
746
|
+
className: "h-4 flex-1 animate-pulse rounded-md bg-hover",
|
|
747
|
+
style: { maxWidth: SKELETON_WIDTHS[sum % SKELETON_WIDTHS.length] }
|
|
748
|
+
})
|
|
749
|
+
]
|
|
750
|
+
});
|
|
751
|
+
});
|
|
752
|
+
SidebarMenuSkeleton2.displayName = "SidebarMenuSkeleton";
|
|
753
|
+
|
|
754
|
+
// components/navigation/sidebar/sidebar-menu-button.tsx
|
|
755
|
+
import { cva } from "class-variance-authority";
|
|
756
|
+
import { motion as motion3 } from "motion/react";
|
|
757
|
+
import {
|
|
758
|
+
forwardRef as forwardRef3,
|
|
759
|
+
useContext as useContext4,
|
|
760
|
+
useRef as useRef3
|
|
761
|
+
} from "react";
|
|
762
|
+
import { jsx as jsx5, jsxs as jsxs5, Fragment as Fragment4 } from "react/jsx-runtime";
|
|
763
|
+
/*!
|
|
764
|
+
* Ported from Fluid Functionalism — github.com/mickadesign/fluid-functionalism
|
|
765
|
+
* `registry/default/sidebar-menu.tsx` @ b3587bdbd83fc66c2a6aae3817ffb856cb09260b
|
|
766
|
+
* MIT License © 2026 Micka Touillaud — fluidfunctionalism.com (notice: LICENSE.fluid-functionalism)
|
|
767
|
+
* Local changes: see PORTING.md.
|
|
768
|
+
*/
|
|
769
|
+
var sidebarMenuButtonVariants2 = cva("peer/menu-button relative z-10 flex w-full cursor-pointer select-none items-center gap-2 pl-2 text-left outline-none disabled:opacity-50 disabled:pointer-events-none transition-[padding] duration-fast pr-[var(--row-gutter)] group-hover/menu-item:pr-[var(--row-gutter-hover)] group-focus-within/menu-item:pr-[var(--row-gutter-hover)] group-hover/menu-sub-item:pr-[var(--row-gutter-hover)] group-focus-within/menu-sub-item:pr-[var(--row-gutter-hover)] group-has-[[data-sidebar=menu-action]:is([data-popup-open],[aria-expanded=true])]/menu-item:pr-[var(--row-gutter-hover)] group-has-[[data-sidebar=menu-action]:is([data-popup-open],[aria-expanded=true])]/menu-sub-item:pr-[var(--row-gutter-hover)]", {
|
|
770
|
+
variants: {
|
|
771
|
+
variant: {
|
|
772
|
+
default: "",
|
|
773
|
+
outline: "border border-border bg-background"
|
|
1045
774
|
}
|
|
1046
|
-
},
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
775
|
+
},
|
|
776
|
+
defaultVariants: { variant: "default" }
|
|
777
|
+
});
|
|
778
|
+
var SidebarMenuButton2 = forwardRef3(({
|
|
779
|
+
isActive = false,
|
|
780
|
+
size,
|
|
781
|
+
variant,
|
|
782
|
+
icon: Icon,
|
|
783
|
+
status,
|
|
784
|
+
dot,
|
|
785
|
+
value,
|
|
786
|
+
render,
|
|
787
|
+
asChild,
|
|
788
|
+
className,
|
|
789
|
+
style,
|
|
790
|
+
onClick,
|
|
791
|
+
children,
|
|
792
|
+
...props
|
|
793
|
+
}, ref) => {
|
|
794
|
+
const scope = useContext4(MenuScopeContext);
|
|
795
|
+
const item = useContext4(MenuItemContext);
|
|
796
|
+
const selection = useContext4(SidebarSelection2);
|
|
1058
797
|
const shape = useShape2();
|
|
1059
|
-
const
|
|
1060
|
-
const
|
|
1061
|
-
const
|
|
1062
|
-
const
|
|
1063
|
-
const
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
if (!level)
|
|
1067
|
-
continue;
|
|
1068
|
-
const levelId = overlayGroupId(level);
|
|
1069
|
-
const occurrence = levelOccurrence.get(levelId) ?? 0;
|
|
1070
|
-
levelOccurrence.set(levelId, occurrence + 1);
|
|
1071
|
-
if (!levelFirstActive.has(levelId))
|
|
1072
|
-
levelFirstActive.set(levelId, row);
|
|
1073
|
-
const rect = overlayRect(row);
|
|
1074
|
-
if (rect)
|
|
1075
|
-
activeRects.push({
|
|
1076
|
-
key: `${levelId}:${occurrence}`,
|
|
1077
|
-
rect,
|
|
1078
|
-
row,
|
|
1079
|
-
rowChanged: prevTargetsRef.current.actives.get(`${levelId}:${occurrence}`) !== row
|
|
1080
|
-
});
|
|
1081
|
-
}
|
|
1082
|
-
const hoverRect = overlayRect(hoveredRowEl);
|
|
1083
|
-
const focusRect = focusRing ? overlayRect(focusedRowEl) : null;
|
|
1084
|
-
const hoverRowChanged = prevTargetsRef.current.hover !== hoveredRowEl;
|
|
1085
|
-
const focusRowChanged = prevTargetsRef.current.focus !== focusedRowEl;
|
|
798
|
+
const sizeClasses = useSize2(size);
|
|
799
|
+
const buttonRef = useRef3(null);
|
|
800
|
+
const ChevronRightIcon = useIcon2("chevron-right");
|
|
801
|
+
const subOpen = item?.subOpen;
|
|
802
|
+
const collapsible = subOpen !== undefined;
|
|
803
|
+
const effectiveActive = isActive || (value === undefined ? status === "active" : selection?.value === value);
|
|
804
|
+
const setActive = item?.setActive;
|
|
1086
805
|
useIsoLayoutEffect2(() => {
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
const
|
|
1096
|
-
const
|
|
806
|
+
setActive?.(effectiveActive);
|
|
807
|
+
return () => setActive?.(false);
|
|
808
|
+
}, [effectiveActive, setActive]);
|
|
809
|
+
const setButtonEl = item?.setButtonEl;
|
|
810
|
+
useIsoLayoutEffect2(() => {
|
|
811
|
+
setButtonEl?.(buttonRef.current);
|
|
812
|
+
return () => setButtonEl?.(null);
|
|
813
|
+
}, [setButtonEl]);
|
|
814
|
+
const resolvedDot = dot ?? (status ? status === "idle" ? "ring" : "filled" : undefined);
|
|
815
|
+
const lit = effectiveActive || (item?.isHovered ?? false);
|
|
816
|
+
const row = item?.rowRef.current ?? null;
|
|
817
|
+
const tabIdx = effectiveActive ? 0 : scope?.hasActive ? -1 : row !== null && row === scope?.firstRowEl ? 0 : -1;
|
|
818
|
+
const { template, content } = resolveSlotTemplate2(render, asChild, children);
|
|
819
|
+
const inner = /* @__PURE__ */ jsxs5(Fragment4, {
|
|
1097
820
|
children: [
|
|
1098
|
-
/* @__PURE__ */
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
animate: { opacity: 1 },
|
|
1103
|
-
exit: { opacity: 0, transition: spring2.moderate.exit },
|
|
1104
|
-
children: /* @__PURE__ */ jsx2(GooIndicator2, {
|
|
1105
|
-
rect,
|
|
1106
|
-
className: cn2("bg-active", shape.bg),
|
|
1107
|
-
transition: rowChanged ? spring2.moderate : false
|
|
1108
|
-
})
|
|
1109
|
-
}, key))
|
|
821
|
+
Icon && /* @__PURE__ */ jsx5(Icon, {
|
|
822
|
+
size: sizeClasses.icon,
|
|
823
|
+
strokeWidth: lit ? 2 : 1.5,
|
|
824
|
+
className: cn2("shrink-0 transition-[color,stroke-width] duration-fast", lit ? "text-foreground" : "text-muted-foreground")
|
|
1110
825
|
}),
|
|
1111
|
-
/* @__PURE__ */
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
826
|
+
!Icon && resolvedDot && /* @__PURE__ */ jsx5("span", {
|
|
827
|
+
className: "flex shrink-0 items-center justify-center",
|
|
828
|
+
style: { width: sizeClasses.icon, height: sizeClasses.icon },
|
|
829
|
+
children: /* @__PURE__ */ jsx5("span", {
|
|
830
|
+
className: cn2("size-2 rounded-full transition-colors duration-fast", resolvedDot === "filled" ? lit ? "bg-foreground/60" : "bg-muted-foreground/50" : lit ? "border border-foreground/60" : "border border-muted-foreground/50")
|
|
831
|
+
})
|
|
1117
832
|
}),
|
|
1118
|
-
/* @__PURE__ */
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
833
|
+
/* @__PURE__ */ jsx5(MenuRowLabel, {
|
|
834
|
+
content,
|
|
835
|
+
lit,
|
|
836
|
+
emphasized: effectiveActive,
|
|
837
|
+
textClass: sizeClasses.text
|
|
838
|
+
}),
|
|
839
|
+
status === "unread" && /* @__PURE__ */ jsx5("span", {
|
|
840
|
+
className: "sr-only",
|
|
841
|
+
children: ", unread"
|
|
842
|
+
}),
|
|
843
|
+
collapsible && /* @__PURE__ */ jsx5("span", {
|
|
844
|
+
className: "ml-auto -mr-0.5 flex size-6 shrink-0 items-center justify-center",
|
|
845
|
+
children: /* @__PURE__ */ jsx5(motion3.span, {
|
|
846
|
+
className: "inline-flex",
|
|
847
|
+
animate: { rotate: subOpen ? 90 : 0 },
|
|
848
|
+
transition: spring2.fast,
|
|
849
|
+
children: /* @__PURE__ */ jsx5(ChevronRightIcon, {
|
|
850
|
+
size: sizeClasses.icon,
|
|
851
|
+
strokeWidth: 1.5,
|
|
852
|
+
className: cn2("text-muted-foreground transition-opacity duration-fast", subOpen ? "opacity-0 group-hover/parent-row:opacity-100 group-focus-within/parent-row:opacity-100" : "opacity-100")
|
|
853
|
+
})
|
|
1130
854
|
})
|
|
1131
855
|
})
|
|
1132
856
|
]
|
|
1133
|
-
})
|
|
1134
|
-
return {
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
857
|
+
});
|
|
858
|
+
return slotElement2(template, "button", {
|
|
859
|
+
ref: mergeRefs2(buttonRef, ref),
|
|
860
|
+
type: template ? undefined : "button",
|
|
861
|
+
"data-sidebar": "menu-button",
|
|
862
|
+
"data-size": sizeClasses.variant,
|
|
863
|
+
"data-active": effectiveActive ? "true" : undefined,
|
|
864
|
+
"data-status": status,
|
|
865
|
+
"aria-current": effectiveActive ? "page" : undefined,
|
|
866
|
+
"aria-expanded": subOpen,
|
|
867
|
+
tabIndex: tabIdx,
|
|
868
|
+
className: cn2(sidebarMenuButtonVariants2({ variant }), sizeClasses.variant === "compact" ? "h-7" : "h-8", shape.item, collapsible && "group/parent-row", className),
|
|
869
|
+
onClick: (event) => {
|
|
870
|
+
onClick?.(event);
|
|
871
|
+
if (collapsible)
|
|
872
|
+
item?.toggleSub();
|
|
873
|
+
else if (value !== undefined)
|
|
874
|
+
selection?.select(value);
|
|
1145
875
|
},
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
876
|
+
...props,
|
|
877
|
+
style: {
|
|
878
|
+
...gutterVars(item),
|
|
879
|
+
...collapsible && { "--row-gutter": "var(--row-gutter-hover)" },
|
|
880
|
+
...style
|
|
881
|
+
}
|
|
882
|
+
}, inner);
|
|
883
|
+
});
|
|
884
|
+
SidebarMenuButton2.displayName = "SidebarMenuButton";
|
|
885
|
+
|
|
886
|
+
// components/navigation/sidebar/sidebar-menu-item.tsx
|
|
887
|
+
import {
|
|
888
|
+
forwardRef as forwardRef4,
|
|
889
|
+
useCallback as useCallback2,
|
|
890
|
+
useContext as useContext5,
|
|
891
|
+
useMemo as useMemo3,
|
|
892
|
+
useRef as useRef4,
|
|
893
|
+
useState as useState4
|
|
894
|
+
} from "react";
|
|
895
|
+
import { jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
896
|
+
/*!
|
|
897
|
+
* Ported from Fluid Functionalism — github.com/mickadesign/fluid-functionalism
|
|
898
|
+
* `registry/default/sidebar-menu.tsx` @ b3587bdbd83fc66c2a6aae3817ffb856cb09260b
|
|
899
|
+
* MIT License © 2026 Micka Touillaud — fluidfunctionalism.com (notice: LICENSE.fluid-functionalism)
|
|
900
|
+
* Local changes: see PORTING.md.
|
|
901
|
+
*/
|
|
902
|
+
var SidebarMenu2 = forwardRef4(({ className, size, focusRing, children, ...props }, ref) => {
|
|
903
|
+
const containerRef = useRef4(null);
|
|
1151
904
|
const { value, containerProps, overlays } = useMenuScope(containerRef, { focusRing });
|
|
1152
|
-
const
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
children
|
|
1169
|
-
]
|
|
905
|
+
const list = useMergeRefs2(containerRef, ref);
|
|
906
|
+
return /* @__PURE__ */ jsx6(SizeScope2, {
|
|
907
|
+
size,
|
|
908
|
+
children: /* @__PURE__ */ jsx6(MenuScopeContext.Provider, {
|
|
909
|
+
value,
|
|
910
|
+
children: /* @__PURE__ */ jsxs6("ul", {
|
|
911
|
+
ref: list,
|
|
912
|
+
"data-sidebar": "menu",
|
|
913
|
+
className: cn2("relative flex w-full min-w-0 flex-col select-none", className),
|
|
914
|
+
...containerProps,
|
|
915
|
+
...props,
|
|
916
|
+
children: [
|
|
917
|
+
overlays,
|
|
918
|
+
children
|
|
919
|
+
]
|
|
920
|
+
})
|
|
1170
921
|
})
|
|
1171
922
|
});
|
|
1172
|
-
return size ? /* @__PURE__ */ jsx2(SizeProvider2, {
|
|
1173
|
-
size,
|
|
1174
|
-
children: content
|
|
1175
|
-
}) : content;
|
|
1176
923
|
});
|
|
1177
924
|
SidebarMenu2.displayName = "SidebarMenu";
|
|
1178
|
-
function useMenuRow(rowRef, isSubRow
|
|
1179
|
-
const scope =
|
|
925
|
+
function useMenuRow(rowRef, isSubRow, sub) {
|
|
926
|
+
const scope = useContext5(MenuScopeContext);
|
|
1180
927
|
const registerRow = scope?.registerRow;
|
|
1181
928
|
const setRowButton = scope?.setRowButton;
|
|
1182
929
|
const setRowActive = scope?.setRowActive;
|
|
1183
|
-
const activeFlagRef =
|
|
930
|
+
const activeFlagRef = useRef4(false);
|
|
1184
931
|
useIsoLayoutEffect2(() => {
|
|
1185
932
|
const el = rowRef.current;
|
|
1186
933
|
if (!el || !registerRow)
|
|
@@ -1203,17 +950,13 @@ function useMenuRow(rowRef, isSubRow = false, sub) {
|
|
|
1203
950
|
}, [setRowButton, rowRef]);
|
|
1204
951
|
const isHovered = rowRef.current !== null && scope?.hoveredRowEl === rowRef.current;
|
|
1205
952
|
const isActiveRow = rowRef.current !== null && (scope?.activeRows.includes(rowRef.current) ?? false);
|
|
1206
|
-
const [trailing, setTrailing] =
|
|
1207
|
-
actionCount: 0,
|
|
1208
|
-
actionsShowOnHover: false,
|
|
1209
|
-
hasBadge: false
|
|
1210
|
-
});
|
|
953
|
+
const [trailing, setTrailing] = useState4({ actionCount: 0, actionsShowOnHover: false, hasBadge: false });
|
|
1211
954
|
const setActions = useCallback2((count, showOnHover) => setTrailing((prev) => prev.actionCount === count && prev.actionsShowOnHover === showOnHover ? prev : { ...prev, actionCount: count, actionsShowOnHover: showOnHover }), []);
|
|
1212
955
|
const setHasBadge = useCallback2((hasBadge) => setTrailing((prev) => prev.hasBadge === hasBadge ? prev : { ...prev, hasBadge }), []);
|
|
1213
956
|
const [open, setOpen] = useControllableState2(sub?.open, sub?.defaultOpen ?? false, sub?.onOpenChange);
|
|
1214
957
|
const subOpen = sub?.collapsible ? open : undefined;
|
|
1215
958
|
const toggleSub = useCallback2(() => setOpen((prev) => !prev), [setOpen]);
|
|
1216
|
-
return
|
|
959
|
+
return useMemo3(() => ({
|
|
1217
960
|
rowRef,
|
|
1218
961
|
attachRow,
|
|
1219
962
|
isHovered,
|
|
@@ -1241,34 +984,14 @@ function useMenuRow(rowRef, isSubRow = false, sub) {
|
|
|
1241
984
|
toggleSub
|
|
1242
985
|
]);
|
|
1243
986
|
}
|
|
1244
|
-
var
|
|
1245
|
-
|
|
1246
|
-
var ROW_GAP = 4;
|
|
1247
|
-
var ROW_BADGE_INSET = 8;
|
|
1248
|
-
var ROW_ACTION_INSET = 6;
|
|
1249
|
-
function rowGutter(actionCount, hasBadge) {
|
|
1250
|
-
if (!actionCount && !hasBadge)
|
|
1251
|
-
return ROW_BASE_PAD;
|
|
1252
|
-
const actionsWidth = actionCount ? actionCount * ROW_SLOT + (actionCount - 1) * ROW_GAP : 0;
|
|
1253
|
-
const runWidth = (hasBadge ? ROW_SLOT : 0) + actionsWidth + (hasBadge && actionCount ? ROW_GAP : 0);
|
|
1254
|
-
const inset = hasBadge ? ROW_BADGE_INSET : ROW_ACTION_INSET;
|
|
1255
|
-
return inset + runWidth + ROW_GAP;
|
|
1256
|
-
}
|
|
1257
|
-
var SidebarMenuItem2 = forwardRef2(({ collapsible, open, defaultOpen, onOpenChange, className, children, ...props }, ref) => {
|
|
1258
|
-
const rowRef = useRef2(null);
|
|
987
|
+
var SidebarMenuItem2 = forwardRef4(({ collapsible, open, defaultOpen, onOpenChange, className, children, ...props }, ref) => {
|
|
988
|
+
const rowRef = useRef4(null);
|
|
1259
989
|
const item = useMenuRow(rowRef, false, { collapsible, open, defaultOpen, onOpenChange });
|
|
1260
|
-
const
|
|
1261
|
-
|
|
1262
|
-
attachRow(node);
|
|
1263
|
-
if (typeof ref === "function")
|
|
1264
|
-
ref(node);
|
|
1265
|
-
else if (ref)
|
|
1266
|
-
ref.current = node;
|
|
1267
|
-
}, [attachRow, ref]);
|
|
1268
|
-
return /* @__PURE__ */ jsx2(MenuItemContext.Provider, {
|
|
990
|
+
const row = useMergeRefs2(item.attachRow, ref);
|
|
991
|
+
return /* @__PURE__ */ jsx6(MenuItemContext.Provider, {
|
|
1269
992
|
value: item,
|
|
1270
|
-
children: /* @__PURE__ */
|
|
1271
|
-
ref:
|
|
993
|
+
children: /* @__PURE__ */ jsx6("li", {
|
|
994
|
+
ref: row,
|
|
1272
995
|
"data-sidebar": "menu-item",
|
|
1273
996
|
className: cn2("group/menu-item relative", className),
|
|
1274
997
|
...props,
|
|
@@ -1277,21 +1000,14 @@ var SidebarMenuItem2 = forwardRef2(({ collapsible, open, defaultOpen, onOpenChan
|
|
|
1277
1000
|
});
|
|
1278
1001
|
});
|
|
1279
1002
|
SidebarMenuItem2.displayName = "SidebarMenuItem";
|
|
1280
|
-
var SidebarMenuSubItem2 =
|
|
1281
|
-
const rowRef =
|
|
1003
|
+
var SidebarMenuSubItem2 = forwardRef4(({ className, children, ...props }, ref) => {
|
|
1004
|
+
const rowRef = useRef4(null);
|
|
1282
1005
|
const item = useMenuRow(rowRef, true);
|
|
1283
|
-
const
|
|
1284
|
-
|
|
1285
|
-
attachRow(node);
|
|
1286
|
-
if (typeof ref === "function")
|
|
1287
|
-
ref(node);
|
|
1288
|
-
else if (ref)
|
|
1289
|
-
ref.current = node;
|
|
1290
|
-
}, [attachRow, ref]);
|
|
1291
|
-
return /* @__PURE__ */ jsx2(MenuItemContext.Provider, {
|
|
1006
|
+
const row = useMergeRefs2(item.attachRow, ref);
|
|
1007
|
+
return /* @__PURE__ */ jsx6(MenuItemContext.Provider, {
|
|
1292
1008
|
value: item,
|
|
1293
|
-
children: /* @__PURE__ */
|
|
1294
|
-
ref:
|
|
1009
|
+
children: /* @__PURE__ */ jsx6("li", {
|
|
1010
|
+
ref: row,
|
|
1295
1011
|
"data-sidebar": "menu-sub-item",
|
|
1296
1012
|
className: cn2("group/menu-sub-item relative", className),
|
|
1297
1013
|
...props,
|
|
@@ -1300,403 +1016,685 @@ var SidebarMenuSubItem2 = forwardRef2(({ className, children, ...props }, ref) =
|
|
|
1300
1016
|
});
|
|
1301
1017
|
});
|
|
1302
1018
|
SidebarMenuSubItem2.displayName = "SidebarMenuSubItem";
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1019
|
+
|
|
1020
|
+
// components/navigation/sidebar/sidebar-menu-sub.tsx
|
|
1021
|
+
import { motion as motion4 } from "motion/react";
|
|
1022
|
+
import {
|
|
1023
|
+
forwardRef as forwardRef5,
|
|
1024
|
+
useContext as useContext6,
|
|
1025
|
+
useRef as useRef5
|
|
1026
|
+
} from "react";
|
|
1027
|
+
import { jsx as jsx7, jsxs as jsxs7, Fragment as Fragment5 } from "react/jsx-runtime";
|
|
1028
|
+
/*!
|
|
1029
|
+
* Ported from Fluid Functionalism — github.com/mickadesign/fluid-functionalism
|
|
1030
|
+
* `registry/default/sidebar-menu.tsx` @ b3587bdbd83fc66c2a6aae3817ffb856cb09260b
|
|
1031
|
+
* MIT License © 2026 Micka Touillaud — fluidfunctionalism.com (notice: LICENSE.fluid-functionalism)
|
|
1032
|
+
* Local changes: see PORTING.md.
|
|
1033
|
+
*/
|
|
1034
|
+
var SidebarMenuSub2 = forwardRef5(({ className, open: openProp, children, ...props }, ref) => {
|
|
1035
|
+
const row = useContext6(MenuItemContext);
|
|
1036
|
+
const open = openProp ?? row?.subOpen ?? true;
|
|
1037
|
+
const refreshVisibility = useContext6(MenuScopeContext)?.refreshVisibility;
|
|
1038
|
+
useIsoLayoutEffect2(() => {
|
|
1039
|
+
refreshVisibility?.();
|
|
1040
|
+
}, [open, refreshVisibility]);
|
|
1041
|
+
const fold = useMeasuredCollapse(open);
|
|
1042
|
+
const list = useMergeRefs2(fold.contentRef, ref);
|
|
1043
|
+
return /* @__PURE__ */ jsx7(motion4.div, {
|
|
1044
|
+
"data-slot": "sidebar-menu-sub-wrapper",
|
|
1045
|
+
className: cn2("overflow-hidden", !fold.measured && !open && "h-0"),
|
|
1046
|
+
...fold.motion,
|
|
1047
|
+
onAnimationComplete: fold.settle,
|
|
1048
|
+
children: /* @__PURE__ */ jsx7("ul", {
|
|
1049
|
+
ref: list,
|
|
1050
|
+
"data-sidebar": "menu-sub",
|
|
1051
|
+
"data-state": open ? "open" : "closed",
|
|
1052
|
+
"aria-hidden": open ? undefined : true,
|
|
1053
|
+
...open ? {} : { inert: "" },
|
|
1054
|
+
className: cn2("relative ml-[15px] flex min-w-0 flex-col border-l border-border pl-2 select-none", className),
|
|
1055
|
+
...props,
|
|
1056
|
+
children
|
|
1057
|
+
})
|
|
1342
1058
|
});
|
|
1343
|
-
}
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1059
|
+
});
|
|
1060
|
+
SidebarMenuSub2.displayName = "SidebarMenuSub";
|
|
1061
|
+
var SidebarMenuSubButton2 = forwardRef5(({
|
|
1062
|
+
isActive: isActiveProp = false,
|
|
1063
|
+
size,
|
|
1348
1064
|
icon: Icon,
|
|
1349
|
-
status,
|
|
1350
|
-
dot,
|
|
1351
1065
|
value,
|
|
1352
1066
|
render,
|
|
1353
1067
|
asChild,
|
|
1354
1068
|
className,
|
|
1355
|
-
style,
|
|
1356
1069
|
onClick,
|
|
1357
1070
|
children,
|
|
1358
1071
|
...props
|
|
1359
1072
|
}, ref) => {
|
|
1360
|
-
const
|
|
1361
|
-
const
|
|
1362
|
-
const
|
|
1073
|
+
const item = useContext6(MenuItemContext);
|
|
1074
|
+
const selection = useContext6(SidebarSelection2);
|
|
1075
|
+
const isActive = isActiveProp || value !== undefined && selection?.value === value;
|
|
1363
1076
|
const shape = useShape2();
|
|
1364
|
-
const sizeClasses = useSize2();
|
|
1365
|
-
const buttonRef =
|
|
1366
|
-
const ChevronRightIcon = useIcon2("chevron-right");
|
|
1367
|
-
const subOpen = item?.subOpen;
|
|
1368
|
-
const collapsible = subOpen !== undefined;
|
|
1369
|
-
const effectiveActive = isActive || (value === undefined ? status === "active" : selection?.value === value);
|
|
1077
|
+
const sizeClasses = useSize2(size);
|
|
1078
|
+
const buttonRef = useRef5(null);
|
|
1370
1079
|
const setActive = item?.setActive;
|
|
1371
1080
|
useIsoLayoutEffect2(() => {
|
|
1372
|
-
setActive?.(
|
|
1081
|
+
setActive?.(isActive);
|
|
1373
1082
|
return () => setActive?.(false);
|
|
1374
|
-
}, [
|
|
1083
|
+
}, [isActive, setActive]);
|
|
1375
1084
|
const setButtonEl = item?.setButtonEl;
|
|
1376
1085
|
useIsoLayoutEffect2(() => {
|
|
1377
1086
|
setButtonEl?.(buttonRef.current);
|
|
1378
|
-
return () => setButtonEl?.(null);
|
|
1379
|
-
}, [setButtonEl]);
|
|
1380
|
-
const
|
|
1381
|
-
const
|
|
1382
|
-
const
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
"
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
const { template, content } = resolveSlotTemplate(render, asChild, children);
|
|
1393
|
-
const inner = /* @__PURE__ */ jsxs2(Fragment2, {
|
|
1394
|
-
children: [
|
|
1395
|
-
Icon && /* @__PURE__ */ jsx2(Icon, {
|
|
1396
|
-
size: sizeClasses.icon,
|
|
1397
|
-
strokeWidth: lit ? 2 : 1.5,
|
|
1398
|
-
className: cn2("shrink-0 transition-[color,stroke-width] duration-fast", lit ? "text-foreground" : "text-muted-foreground")
|
|
1399
|
-
}),
|
|
1400
|
-
!Icon && resolvedDot && /* @__PURE__ */ jsx2("span", {
|
|
1401
|
-
className: "flex shrink-0 items-center justify-center",
|
|
1402
|
-
style: { width: sizeClasses.icon, height: sizeClasses.icon },
|
|
1403
|
-
children: /* @__PURE__ */ jsx2("span", {
|
|
1404
|
-
className: cn2("size-2 rounded-full transition-colors duration-fast", resolvedDot === "filled" ? lit ? "bg-foreground/60" : "bg-muted-foreground/50" : lit ? "border border-foreground/60" : "border border-muted-foreground/50")
|
|
1405
|
-
})
|
|
1406
|
-
}),
|
|
1407
|
-
/* @__PURE__ */ jsx2(MenuRowLabel, {
|
|
1408
|
-
content,
|
|
1409
|
-
lit,
|
|
1410
|
-
emphasized: effectiveActive,
|
|
1411
|
-
textClass
|
|
1412
|
-
}),
|
|
1413
|
-
status === "unread" && /* @__PURE__ */ jsx2("span", {
|
|
1414
|
-
className: "sr-only",
|
|
1415
|
-
children: ", unread"
|
|
1416
|
-
}),
|
|
1417
|
-
collapsible && /* @__PURE__ */ jsx2("span", {
|
|
1418
|
-
className: "ml-auto -mr-0.5 flex size-6 shrink-0 items-center justify-center",
|
|
1419
|
-
children: /* @__PURE__ */ jsx2(motion2.span, {
|
|
1420
|
-
className: "inline-flex",
|
|
1421
|
-
animate: { rotate: subOpen ? 90 : 0 },
|
|
1422
|
-
transition: spring2.fast,
|
|
1423
|
-
children: /* @__PURE__ */ jsx2(ChevronRightIcon, {
|
|
1424
|
-
size: sizeClasses.icon,
|
|
1425
|
-
strokeWidth: 1.5,
|
|
1426
|
-
className: cn2("text-muted-foreground transition-opacity duration-fast", subOpen ? "opacity-0 group-hover/parent-row:opacity-100 group-focus-within/parent-row:opacity-100" : "opacity-100")
|
|
1427
|
-
})
|
|
1428
|
-
})
|
|
1429
|
-
})
|
|
1430
|
-
]
|
|
1431
|
-
});
|
|
1432
|
-
return slotElement(template, "button", {
|
|
1433
|
-
ref: (node) => {
|
|
1434
|
-
buttonRef.current = node;
|
|
1435
|
-
if (typeof ref === "function")
|
|
1436
|
-
ref(node);
|
|
1437
|
-
else if (ref)
|
|
1438
|
-
ref.current = node;
|
|
1439
|
-
},
|
|
1440
|
-
type: template ? undefined : "button",
|
|
1441
|
-
"data-sidebar": "menu-button",
|
|
1442
|
-
"data-size": size,
|
|
1443
|
-
"data-active": effectiveActive ? "true" : undefined,
|
|
1444
|
-
"data-status": status,
|
|
1445
|
-
"aria-current": effectiveActive ? "page" : undefined,
|
|
1446
|
-
"aria-expanded": subOpen,
|
|
1447
|
-
tabIndex: tabIdx,
|
|
1448
|
-
className: cn2(sidebarMenuButtonVariants2({ variant }), heightClass, shape.item, collapsible && "group/parent-row", className),
|
|
1087
|
+
return () => setButtonEl?.(null);
|
|
1088
|
+
}, [setButtonEl]);
|
|
1089
|
+
const lit = isActive || (item?.isHovered ?? false);
|
|
1090
|
+
const { template, content } = resolveSlotTemplate2(render, asChild, children);
|
|
1091
|
+
const asButton = !template && value !== undefined && props.href === undefined;
|
|
1092
|
+
return slotElement2(template, asButton ? "button" : "a", {
|
|
1093
|
+
type: asButton ? "button" : undefined,
|
|
1094
|
+
ref: mergeRefs2(buttonRef, ref),
|
|
1095
|
+
"data-sidebar": "menu-sub-button",
|
|
1096
|
+
"data-size": sizeClasses.variant,
|
|
1097
|
+
"data-active": isActive ? "true" : undefined,
|
|
1098
|
+
"aria-current": isActive ? "page" : undefined,
|
|
1099
|
+
tabIndex: isActive ? 0 : -1,
|
|
1100
|
+
className: cn2("relative z-10 flex w-full cursor-pointer select-none items-center gap-2 pl-2 text-left outline-none", "transition-[padding] duration-fast pr-[var(--row-gutter)] group-hover/menu-sub-item:pr-[var(--row-gutter-hover)] group-focus-within/menu-sub-item:pr-[var(--row-gutter-hover)] group-has-[[data-sidebar=menu-action]:is([data-popup-open],[aria-expanded=true])]/menu-sub-item:pr-[var(--row-gutter-hover)]", sizeClasses.variant === "compact" ? "h-6" : "h-7", shape.item, className),
|
|
1449
1101
|
onClick: (event) => {
|
|
1450
1102
|
onClick?.(event);
|
|
1451
|
-
if (
|
|
1452
|
-
item?.toggleSub();
|
|
1453
|
-
else if (value !== undefined)
|
|
1103
|
+
if (value !== undefined)
|
|
1454
1104
|
selection?.select(value);
|
|
1455
1105
|
},
|
|
1456
1106
|
...props,
|
|
1457
|
-
style: {
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1107
|
+
style: { ...gutterVars(item), ...props.style }
|
|
1108
|
+
}, /* @__PURE__ */ jsxs7(Fragment5, {
|
|
1109
|
+
children: [
|
|
1110
|
+
Icon && /* @__PURE__ */ jsx7(Icon, {
|
|
1111
|
+
size: sizeClasses.icon,
|
|
1112
|
+
strokeWidth: lit ? 2 : 1.5,
|
|
1113
|
+
className: cn2("shrink-0 transition-[color,stroke-width] duration-fast", lit ? "text-foreground" : "text-muted-foreground")
|
|
1114
|
+
}),
|
|
1115
|
+
/* @__PURE__ */ jsx7(MenuRowLabel, {
|
|
1116
|
+
content,
|
|
1117
|
+
lit,
|
|
1118
|
+
emphasized: isActive,
|
|
1119
|
+
textClass: sizeClasses.text
|
|
1120
|
+
})
|
|
1121
|
+
]
|
|
1122
|
+
}));
|
|
1463
1123
|
});
|
|
1464
|
-
|
|
1465
|
-
|
|
1124
|
+
SidebarMenuSubButton2.displayName = "SidebarMenuSubButton";
|
|
1125
|
+
|
|
1126
|
+
// components/navigation/sidebar/sidebar-parts.tsx
|
|
1127
|
+
import { forwardRef as forwardRef6 } from "react";
|
|
1128
|
+
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
1129
|
+
/*!
|
|
1130
|
+
* Ported from Fluid Functionalism — github.com/mickadesign/fluid-functionalism
|
|
1131
|
+
* `registry/default/sidebar-core.tsx` @ b3587bdbd83fc66c2a6aae3817ffb856cb09260b
|
|
1132
|
+
* MIT License © 2026 Micka Touillaud — fluidfunctionalism.com (notice: LICENSE.fluid-functionalism)
|
|
1133
|
+
* Local changes: see PORTING.md.
|
|
1134
|
+
*/
|
|
1135
|
+
var SidebarInset2 = forwardRef6(({ className, ...props }, ref) => {
|
|
1466
1136
|
const shape = useShape2();
|
|
1467
|
-
|
|
1468
|
-
const item = useContext2(MenuItemContext);
|
|
1469
|
-
const inCluster = useContext2(MenuActionsClusterContext);
|
|
1470
|
-
const { template, content } = resolveSlotTemplate(render, asChild, children);
|
|
1471
|
-
const setActions = item?.setActions;
|
|
1472
|
-
useIsoLayoutEffect2(() => {
|
|
1473
|
-
if (inCluster || !setActions)
|
|
1474
|
-
return;
|
|
1475
|
-
setActions(1, showOnHover);
|
|
1476
|
-
return () => setActions(0, false);
|
|
1477
|
-
}, [inCluster, setActions, showOnHover]);
|
|
1478
|
-
return slotElement(template, "button", {
|
|
1137
|
+
return /* @__PURE__ */ jsx8("main", {
|
|
1479
1138
|
ref,
|
|
1480
|
-
|
|
1481
|
-
"data-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
onClick: (event) => {
|
|
1485
|
-
event.stopPropagation();
|
|
1486
|
-
onClick?.(event);
|
|
1487
|
-
},
|
|
1488
|
-
...props,
|
|
1489
|
-
style: { ...{ "--icon-size": `${sizeClasses.icon}px` }, ...props.style ?? {} }
|
|
1490
|
-
}, content);
|
|
1139
|
+
"data-slot": "sidebar-inset",
|
|
1140
|
+
className: cn2("relative flex min-h-0 w-full min-w-0 flex-1 flex-col bg-background", "peer-data-[variant=inset]:m-2 peer-data-[variant=inset]:peer-data-[side=left]:ml-0 peer-data-[variant=inset]:peer-data-[side=right]:mr-0", "peer-data-[variant=inset]:peer-data-[state=collapsed]:peer-data-[side=left]:ml-2 peer-data-[variant=inset]:peer-data-[state=collapsed]:peer-data-[side=right]:mr-2", "transition-[margin] duration-fast", shape.bgRadius >= 20 ? "peer-data-[variant=inset]:rounded-3xl" : "peer-data-[variant=inset]:rounded-xl", "peer-data-[variant=inset]:bg-surface-2 peer-data-[variant=inset]:shadow-surface-2", className),
|
|
1141
|
+
...props
|
|
1142
|
+
});
|
|
1491
1143
|
});
|
|
1492
|
-
|
|
1493
|
-
var
|
|
1494
|
-
const
|
|
1495
|
-
const
|
|
1496
|
-
|
|
1497
|
-
const setActions = item?.setActions;
|
|
1498
|
-
useIsoLayoutEffect2(() => {
|
|
1499
|
-
setActions?.(count, showOnHover);
|
|
1500
|
-
return () => setActions?.(0, false);
|
|
1501
|
-
}, [setActions, count, showOnHover]);
|
|
1502
|
-
return /* @__PURE__ */ jsx2("div", {
|
|
1144
|
+
SidebarInset2.displayName = "SidebarInset";
|
|
1145
|
+
var SidebarInput2 = forwardRef6(({ className, ...props }, ref) => {
|
|
1146
|
+
const shape = useShape2();
|
|
1147
|
+
const size = useSize2();
|
|
1148
|
+
return /* @__PURE__ */ jsx8("input", {
|
|
1503
1149
|
ref,
|
|
1504
|
-
"data-sidebar": "
|
|
1505
|
-
className: cn2("
|
|
1506
|
-
...props
|
|
1507
|
-
|
|
1508
|
-
|
|
1150
|
+
"data-sidebar": "input",
|
|
1151
|
+
className: cn2(fieldVariants2(), "w-full px-3 text-foreground placeholder:text-muted-foreground outline-none", "focus-visible:ring-focus-ring", size.variant === "compact" ? "h-7" : "h-8", size.text, shape.input, className),
|
|
1152
|
+
...props
|
|
1153
|
+
});
|
|
1154
|
+
});
|
|
1155
|
+
SidebarInput2.displayName = "SidebarInput";
|
|
1156
|
+
var SidebarHeader2 = forwardRef6(({ className, ...props }, ref) => /* @__PURE__ */ jsx8("div", {
|
|
1157
|
+
ref,
|
|
1158
|
+
"data-sidebar": "header",
|
|
1159
|
+
className: cn2("flex shrink-0 flex-col gap-2 p-2", className),
|
|
1160
|
+
...props
|
|
1161
|
+
}));
|
|
1162
|
+
SidebarHeader2.displayName = "SidebarHeader";
|
|
1163
|
+
var SidebarFooter2 = forwardRef6(({ className, ...props }, ref) => /* @__PURE__ */ jsx8("div", {
|
|
1164
|
+
ref,
|
|
1165
|
+
"data-sidebar": "footer",
|
|
1166
|
+
className: cn2("mt-auto flex shrink-0 flex-col gap-2 p-2", className),
|
|
1167
|
+
...props
|
|
1168
|
+
}));
|
|
1169
|
+
SidebarFooter2.displayName = "SidebarFooter";
|
|
1170
|
+
var SidebarSeparator2 = forwardRef6(({ className, ...props }, ref) => /* @__PURE__ */ jsx8("div", {
|
|
1171
|
+
ref,
|
|
1172
|
+
"data-sidebar": "separator",
|
|
1173
|
+
role: "separator",
|
|
1174
|
+
"aria-orientation": "horizontal",
|
|
1175
|
+
className: cn2("mx-2 h-px shrink-0 bg-border", className),
|
|
1176
|
+
...props
|
|
1177
|
+
}));
|
|
1178
|
+
SidebarSeparator2.displayName = "SidebarSeparator";
|
|
1179
|
+
|
|
1180
|
+
// components/navigation/sidebar/sidebar-provider.tsx
|
|
1181
|
+
import {
|
|
1182
|
+
forwardRef as forwardRef7,
|
|
1183
|
+
useCallback as useCallback3,
|
|
1184
|
+
useEffect as useEffect3,
|
|
1185
|
+
useMemo as useMemo4,
|
|
1186
|
+
useRef as useRef7,
|
|
1187
|
+
useState as useState5
|
|
1188
|
+
} from "react";
|
|
1189
|
+
|
|
1190
|
+
// components/navigation/sidebar/sidebar-shortcut.tsx
|
|
1191
|
+
import { useEffect as useEffect2, useRef as useRef6 } from "react";
|
|
1192
|
+
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
1193
|
+
/*!
|
|
1194
|
+
* Ported from Fluid Functionalism — github.com/mickadesign/fluid-functionalism
|
|
1195
|
+
* `registry/default/sidebar-core.tsx` @ b3587bdbd83fc66c2a6aae3817ffb856cb09260b
|
|
1196
|
+
* MIT License © 2026 Micka Touillaud — fluidfunctionalism.com (notice: LICENSE.fluid-functionalism)
|
|
1197
|
+
* Local changes: see PORTING.md.
|
|
1198
|
+
*/
|
|
1199
|
+
var mounted = [];
|
|
1200
|
+
var outermost = (list) => list.filter((p) => !list.some((o) => o !== p && o.el.contains(p.el)));
|
|
1201
|
+
function answering(target, key) {
|
|
1202
|
+
const own = mounted.filter((p) => p.key === key);
|
|
1203
|
+
const wrapped = own.filter((p) => target.contains(p.el));
|
|
1204
|
+
if (wrapped.length === 0) {
|
|
1205
|
+
const holding = own.filter((p) => p.el.contains(target));
|
|
1206
|
+
const innermost = holding.find((p) => !holding.some((o) => o !== p && p.el.contains(o.el)));
|
|
1207
|
+
if (innermost)
|
|
1208
|
+
return innermost.el;
|
|
1209
|
+
}
|
|
1210
|
+
const candidates = outermost(wrapped.length > 0 ? wrapped : own);
|
|
1211
|
+
return (candidates.find((p) => p.scope === "page") ?? candidates[0])?.el;
|
|
1212
|
+
}
|
|
1213
|
+
function useSidebarShortcut(root, shortcut, scope, toggle) {
|
|
1214
|
+
const key = shortcut?.toLowerCase() ?? null;
|
|
1215
|
+
const entry = useRef6(null);
|
|
1216
|
+
useEffect2(() => {
|
|
1217
|
+
const el = root.current;
|
|
1218
|
+
if (!el)
|
|
1219
|
+
return;
|
|
1220
|
+
const self = { el, key, scope };
|
|
1221
|
+
entry.current = self;
|
|
1222
|
+
mounted.push(self);
|
|
1223
|
+
return () => {
|
|
1224
|
+
mounted.splice(mounted.indexOf(self), 1);
|
|
1225
|
+
};
|
|
1226
|
+
}, [root, key, scope]);
|
|
1227
|
+
useEffect2(() => {
|
|
1228
|
+
if (key == null)
|
|
1229
|
+
return;
|
|
1230
|
+
const onKeyDown = (event) => {
|
|
1231
|
+
if (event.key.toLowerCase() !== key)
|
|
1232
|
+
return;
|
|
1233
|
+
if (event.metaKey || event.ctrlKey || event.altKey)
|
|
1234
|
+
return;
|
|
1235
|
+
const target = event.target;
|
|
1236
|
+
if (target.closest("input, textarea, select") || target.isContentEditable)
|
|
1237
|
+
return;
|
|
1238
|
+
if (answering(target, key) !== entry.current?.el)
|
|
1239
|
+
return;
|
|
1240
|
+
event.preventDefault();
|
|
1241
|
+
toggle();
|
|
1242
|
+
};
|
|
1243
|
+
window.addEventListener("keydown", onKeyDown);
|
|
1244
|
+
return () => window.removeEventListener("keydown", onKeyDown);
|
|
1245
|
+
}, [key, toggle]);
|
|
1246
|
+
}
|
|
1247
|
+
function useShortcutKey() {
|
|
1248
|
+
const { side, shortcut } = useSidebar2();
|
|
1249
|
+
return shortcut ?? defaultShortcut(side);
|
|
1250
|
+
}
|
|
1251
|
+
function ShortcutKbd({ children }) {
|
|
1252
|
+
return /* @__PURE__ */ jsx9("kbd", {
|
|
1253
|
+
className: "-my-1 flex h-4 min-w-4 items-center justify-center rounded border border-background/30 px-1 font-sans text-micro-compact text-background/80",
|
|
1254
|
+
children
|
|
1255
|
+
});
|
|
1256
|
+
}
|
|
1257
|
+
|
|
1258
|
+
// components/navigation/sidebar/sidebar-provider.tsx
|
|
1259
|
+
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
1260
|
+
/*!
|
|
1261
|
+
* Ported from Fluid Functionalism — github.com/mickadesign/fluid-functionalism
|
|
1262
|
+
* `registry/default/sidebar-core.tsx` @ b3587bdbd83fc66c2a6aae3817ffb856cb09260b
|
|
1263
|
+
* MIT License © 2026 Micka Touillaud — fluidfunctionalism.com (notice: LICENSE.fluid-functionalism)
|
|
1264
|
+
* Local changes: see PORTING.md.
|
|
1265
|
+
*/
|
|
1266
|
+
var HOVER_STRIP = 12;
|
|
1267
|
+
var HOVER_TRIGGER_GAP = 24;
|
|
1268
|
+
function inHoverZone(event, side, frame, shell, triggers) {
|
|
1269
|
+
if (!frame || !shell)
|
|
1270
|
+
return false;
|
|
1271
|
+
const bounds = frame.getBoundingClientRect();
|
|
1272
|
+
if (event.clientY < bounds.top || event.clientY > bounds.bottom)
|
|
1273
|
+
return false;
|
|
1274
|
+
const box = shell.getBoundingClientRect();
|
|
1275
|
+
const inner = side === "left" ? box.right : box.left;
|
|
1276
|
+
let reach = HOVER_STRIP;
|
|
1277
|
+
for (const trigger of triggers) {
|
|
1278
|
+
const button = trigger.getBoundingClientRect();
|
|
1279
|
+
const gap = side === "left" ? button.left - inner : inner - button.right;
|
|
1280
|
+
if (gap >= 0 && gap <= HOVER_TRIGGER_GAP)
|
|
1281
|
+
reach = Math.max(reach, gap + button.width);
|
|
1282
|
+
}
|
|
1283
|
+
return side === "left" ? event.clientX >= bounds.left && event.clientX < inner + reach : event.clientX <= bounds.right && event.clientX > inner - reach;
|
|
1284
|
+
}
|
|
1285
|
+
var SidebarProvider2 = forwardRef7(({
|
|
1286
|
+
defaultOpen = true,
|
|
1287
|
+
open: openProp,
|
|
1288
|
+
onOpenChange,
|
|
1289
|
+
persist = true,
|
|
1290
|
+
shortcut: shortcutProp,
|
|
1291
|
+
shortcutScope = "nearest",
|
|
1292
|
+
mobileBreakpoint = 768,
|
|
1293
|
+
openOnHover = false,
|
|
1294
|
+
width: widthProp = SIDEBAR_WIDTH2,
|
|
1295
|
+
widthMobile = SIDEBAR_WIDTH_MOBILE2,
|
|
1296
|
+
className,
|
|
1297
|
+
style,
|
|
1298
|
+
children,
|
|
1299
|
+
...props
|
|
1300
|
+
}, ref) => {
|
|
1301
|
+
const isMobile = useIsMobile2(mobileBreakpoint);
|
|
1302
|
+
const [openMobile, setOpenMobile] = useState5(false);
|
|
1303
|
+
const [side, setSide] = useState5("left");
|
|
1304
|
+
const wrapperRef = useRef7(null);
|
|
1305
|
+
const wrapper = useMergeRefs2(wrapperRef, ref);
|
|
1306
|
+
const registerSide = useCallback3((next) => setSide(next), []);
|
|
1307
|
+
const [width, setWidth] = useState5(widthProp);
|
|
1308
|
+
useEffect3(() => setWidth(widthProp), [widthProp]);
|
|
1309
|
+
const [isResizing, setIsResizing] = useState5(false);
|
|
1310
|
+
const shortcut = shortcutProp === undefined ? defaultShortcut(side) : shortcutProp;
|
|
1311
|
+
const [open, setOpenState] = useControllableState2(openProp, defaultOpen, onOpenChange);
|
|
1312
|
+
const persistRef = useRef7(persist);
|
|
1313
|
+
persistRef.current = persist;
|
|
1314
|
+
const setOpen = useCallback3((value) => setOpenState((prev) => {
|
|
1315
|
+
const next = typeof value === "function" ? value(prev) : value;
|
|
1316
|
+
if (persistRef.current) {
|
|
1317
|
+
document.cookie = `${SIDEBAR_COOKIE_NAME2}=${next}; path=/; max-age=${SIDEBAR_COOKIE_MAX_AGE2}`;
|
|
1318
|
+
}
|
|
1319
|
+
return next;
|
|
1320
|
+
}), [setOpenState]);
|
|
1321
|
+
const toggleSidebar = useCallback3(() => {
|
|
1322
|
+
if (isMobile)
|
|
1323
|
+
setOpenMobile((prev) => !prev);
|
|
1324
|
+
else
|
|
1325
|
+
setOpen((prev) => !prev);
|
|
1326
|
+
}, [isMobile, setOpen]);
|
|
1327
|
+
useSidebarShortcut(wrapperRef, shortcut, shortcutScope, toggleSidebar);
|
|
1328
|
+
const [hoverOpen, setHoverOpen] = useState5(false);
|
|
1329
|
+
useEffect3(() => {
|
|
1330
|
+
if (open || !openOnHover)
|
|
1331
|
+
setHoverOpen(false);
|
|
1332
|
+
}, [open, openOnHover]);
|
|
1333
|
+
const shellRef = useRef7(null);
|
|
1334
|
+
const triggers = useRef7(new Set);
|
|
1335
|
+
const registerTrigger = useCallback3((node) => {
|
|
1336
|
+
triggers.current.add(node);
|
|
1337
|
+
return () => {
|
|
1338
|
+
triggers.current.delete(node);
|
|
1339
|
+
};
|
|
1340
|
+
}, []);
|
|
1341
|
+
useEffect3(() => {
|
|
1342
|
+
if (!openOnHover || open || isMobile || isResizing)
|
|
1343
|
+
return;
|
|
1344
|
+
let armed = false;
|
|
1345
|
+
let close;
|
|
1346
|
+
const onPointerMove = (event) => {
|
|
1347
|
+
if (event.pointerType !== "mouse")
|
|
1348
|
+
return;
|
|
1349
|
+
if (!inHoverZone(event, side, wrapperRef.current, shellRef.current, triggers.current)) {
|
|
1350
|
+
armed = true;
|
|
1351
|
+
if (hoverOpen)
|
|
1352
|
+
close ??= setTimeout(() => setHoverOpen(false), 300);
|
|
1353
|
+
return;
|
|
1354
|
+
}
|
|
1355
|
+
clearTimeout(close);
|
|
1356
|
+
close = undefined;
|
|
1357
|
+
if (armed)
|
|
1358
|
+
setHoverOpen(true);
|
|
1359
|
+
};
|
|
1360
|
+
document.addEventListener("pointermove", onPointerMove);
|
|
1361
|
+
return () => {
|
|
1362
|
+
document.removeEventListener("pointermove", onPointerMove);
|
|
1363
|
+
clearTimeout(close);
|
|
1364
|
+
};
|
|
1365
|
+
}, [openOnHover, open, isMobile, isResizing, hoverOpen, side]);
|
|
1366
|
+
const value = useMemo4(() => ({
|
|
1367
|
+
state: open || hoverOpen ? "expanded" : "collapsed",
|
|
1368
|
+
open,
|
|
1369
|
+
setOpen,
|
|
1370
|
+
openMobile,
|
|
1371
|
+
setOpenMobile,
|
|
1372
|
+
isMobile,
|
|
1373
|
+
toggleSidebar,
|
|
1374
|
+
width,
|
|
1375
|
+
setWidth,
|
|
1376
|
+
widthMobile,
|
|
1377
|
+
mobileBreakpoint,
|
|
1378
|
+
side,
|
|
1379
|
+
registerSide,
|
|
1380
|
+
shortcut,
|
|
1381
|
+
openOnHover,
|
|
1382
|
+
hoverOpen,
|
|
1383
|
+
setHoverOpen,
|
|
1384
|
+
shellRef,
|
|
1385
|
+
registerTrigger,
|
|
1386
|
+
isResizing,
|
|
1387
|
+
setIsResizing
|
|
1388
|
+
}), [
|
|
1389
|
+
open,
|
|
1390
|
+
setOpen,
|
|
1391
|
+
openMobile,
|
|
1392
|
+
isMobile,
|
|
1393
|
+
toggleSidebar,
|
|
1394
|
+
width,
|
|
1395
|
+
widthMobile,
|
|
1396
|
+
mobileBreakpoint,
|
|
1397
|
+
side,
|
|
1398
|
+
registerSide,
|
|
1399
|
+
shortcut,
|
|
1400
|
+
openOnHover,
|
|
1401
|
+
hoverOpen,
|
|
1402
|
+
registerTrigger,
|
|
1403
|
+
isResizing
|
|
1404
|
+
]);
|
|
1405
|
+
return /* @__PURE__ */ jsx10(SidebarContext.Provider, {
|
|
1406
|
+
value,
|
|
1407
|
+
children: /* @__PURE__ */ jsx10("div", {
|
|
1408
|
+
ref: wrapper,
|
|
1409
|
+
"data-slot": "sidebar-wrapper",
|
|
1410
|
+
className: cn2("group/sidebar-wrapper relative flex min-h-svh w-full", className),
|
|
1411
|
+
style: { "--sidebar-width": width, "--sidebar-width-mobile": widthMobile, ...style },
|
|
1412
|
+
...props,
|
|
1509
1413
|
children
|
|
1510
1414
|
})
|
|
1511
1415
|
});
|
|
1512
1416
|
});
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
});
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
const
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1417
|
+
SidebarProvider2.displayName = "SidebarProvider";
|
|
1418
|
+
|
|
1419
|
+
// components/navigation/sidebar/sidebar-rail.tsx
|
|
1420
|
+
import { forwardRef as forwardRef8, useEffect as useEffect4, useRef as useRef8, useState as useState6 } from "react";
|
|
1421
|
+
import { jsx as jsx11, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1422
|
+
/*!
|
|
1423
|
+
* Ported from Fluid Functionalism — github.com/mickadesign/fluid-functionalism
|
|
1424
|
+
* `registry/default/sidebar-core.tsx` @ b3587bdbd83fc66c2a6aae3817ffb856cb09260b
|
|
1425
|
+
* MIT License © 2026 Micka Touillaud — fluidfunctionalism.com (notice: LICENSE.fluid-functionalism)
|
|
1426
|
+
* Local changes: see PORTING.md.
|
|
1427
|
+
*/
|
|
1428
|
+
var COLLAPSE_SLOP = 56;
|
|
1429
|
+
var SidebarTrigger2 = forwardRef8(({ onClick, size, children, ...props }, ref) => {
|
|
1430
|
+
const { toggleSidebar, open, openMobile, isMobile, side, openOnHover, registerTrigger } = useSidebar2();
|
|
1431
|
+
const shortcutKey = useShortcutKey();
|
|
1432
|
+
const hoverMode = openOnHover && !isMobile;
|
|
1433
|
+
const TriggerIcon = useIcon2(`panel-${side}${hoverMode && !open ? "-dashed" : ""}`);
|
|
1434
|
+
const iconSize = useSizeVariant2() === "compact" ? "icon-compact" : "icon";
|
|
1435
|
+
const collapsed = isMobile ? !openMobile : !open;
|
|
1436
|
+
const label = hoverMode ? open ? "Show sidebar on hover" : "Keep sidebar open" : collapsed ? "Expand sidebar" : "Collapse sidebar";
|
|
1437
|
+
const node = useRef8(null);
|
|
1438
|
+
useEffect4(() => node.current ? registerTrigger(node.current) : undefined, [registerTrigger]);
|
|
1439
|
+
return /* @__PURE__ */ jsx11(Tooltip2, {
|
|
1440
|
+
side: "bottom",
|
|
1441
|
+
content: /* @__PURE__ */ jsxs8("span", {
|
|
1442
|
+
className: "flex items-center gap-1.5",
|
|
1443
|
+
children: [
|
|
1444
|
+
/* @__PURE__ */ jsx11("span", {
|
|
1445
|
+
className: "text-trim",
|
|
1446
|
+
children: label
|
|
1447
|
+
}),
|
|
1448
|
+
/* @__PURE__ */ jsx11(ShortcutKbd, {
|
|
1449
|
+
children: shortcutKey
|
|
1450
|
+
})
|
|
1451
|
+
]
|
|
1452
|
+
}),
|
|
1453
|
+
children: /* @__PURE__ */ jsx11(Button2, {
|
|
1454
|
+
ref: mergeRefs2(node, ref),
|
|
1455
|
+
variant: "ghost",
|
|
1456
|
+
size: size ?? iconSize,
|
|
1457
|
+
"data-sidebar": "trigger",
|
|
1458
|
+
"aria-label": hoverMode ? label : "Toggle Sidebar",
|
|
1459
|
+
onClick: (event) => {
|
|
1460
|
+
onClick?.(event);
|
|
1461
|
+
toggleSidebar();
|
|
1462
|
+
},
|
|
1463
|
+
...props,
|
|
1464
|
+
children: children ?? /* @__PURE__ */ jsx11(TriggerIcon, {})
|
|
1465
|
+
})
|
|
1466
|
+
});
|
|
1467
|
+
});
|
|
1468
|
+
SidebarTrigger2.displayName = "SidebarTrigger";
|
|
1469
|
+
var SidebarRail2 = forwardRef8(({ className, tooltipOpen, ...props }, ref) => {
|
|
1470
|
+
const { toggleSidebar, open, setOpen, setHoverOpen, setWidth, side, setIsResizing } = useSidebar2();
|
|
1471
|
+
const shortcutKey = useShortcutKey();
|
|
1472
|
+
const railRef = useRef8(null);
|
|
1473
|
+
const dragRef = useRef8(null);
|
|
1474
|
+
const [dragging, setDragging] = useState6(false);
|
|
1475
|
+
const onPointerDown = (event) => {
|
|
1476
|
+
const panel = railRef.current?.closest('[data-slot="sidebar"]');
|
|
1477
|
+
if (!panel)
|
|
1478
|
+
return;
|
|
1479
|
+
dragRef.current = {
|
|
1480
|
+
startX: event.clientX,
|
|
1481
|
+
startWidth: panel.offsetWidth,
|
|
1482
|
+
moved: false,
|
|
1483
|
+
collapsed: false,
|
|
1484
|
+
kept: open
|
|
1485
|
+
};
|
|
1486
|
+
event.currentTarget.setPointerCapture(event.pointerId);
|
|
1487
|
+
};
|
|
1488
|
+
const onPointerMove = (event) => {
|
|
1489
|
+
const drag = dragRef.current;
|
|
1490
|
+
if (!drag)
|
|
1491
|
+
return;
|
|
1492
|
+
const dx = event.clientX - drag.startX;
|
|
1493
|
+
if (!drag.moved && Math.abs(dx) < 4)
|
|
1494
|
+
return;
|
|
1495
|
+
if (!drag.moved) {
|
|
1496
|
+
drag.moved = true;
|
|
1497
|
+
setDragging(true);
|
|
1498
|
+
setIsResizing(true);
|
|
1499
|
+
}
|
|
1500
|
+
const raw = drag.startWidth + (side === "left" ? dx : -dx);
|
|
1501
|
+
if (raw < SIDEBAR_MIN_WIDTH2 - COLLAPSE_SLOP) {
|
|
1502
|
+
if (!drag.collapsed) {
|
|
1503
|
+
drag.collapsed = true;
|
|
1504
|
+
setWidth(`${SIDEBAR_MIN_WIDTH2}px`);
|
|
1505
|
+
(drag.kept ? setOpen : setHoverOpen)(false);
|
|
1506
|
+
}
|
|
1507
|
+
return;
|
|
1508
|
+
}
|
|
1509
|
+
if (drag.collapsed) {
|
|
1510
|
+
drag.collapsed = false;
|
|
1511
|
+
(drag.kept ? setOpen : setHoverOpen)(true);
|
|
1512
|
+
}
|
|
1513
|
+
setWidth(`${Math.max(SIDEBAR_MIN_WIDTH2, Math.min(SIDEBAR_MAX_WIDTH2, raw))}px`);
|
|
1514
|
+
};
|
|
1515
|
+
const onPointerUp = (event) => {
|
|
1516
|
+
const drag = dragRef.current;
|
|
1517
|
+
dragRef.current = null;
|
|
1518
|
+
event.currentTarget.releasePointerCapture(event.pointerId);
|
|
1519
|
+
setDragging(false);
|
|
1520
|
+
setIsResizing(false);
|
|
1521
|
+
if (drag && !drag.moved) {
|
|
1522
|
+
if (drag.kept)
|
|
1523
|
+
toggleSidebar();
|
|
1524
|
+
else
|
|
1525
|
+
setHoverOpen(false);
|
|
1526
|
+
}
|
|
1527
|
+
};
|
|
1528
|
+
const onPointerCancel = () => {
|
|
1529
|
+
dragRef.current = null;
|
|
1530
|
+
setDragging(false);
|
|
1531
|
+
setIsResizing(false);
|
|
1532
|
+
};
|
|
1533
|
+
return /* @__PURE__ */ jsx11(Tooltip2, {
|
|
1534
|
+
side: side === "left" ? "right" : "left",
|
|
1535
|
+
sideOffset: 8,
|
|
1536
|
+
followCursor: "y",
|
|
1537
|
+
open: dragging ? false : tooltipOpen,
|
|
1538
|
+
content: /* @__PURE__ */ jsxs8("span", {
|
|
1539
|
+
className: "flex flex-col items-start gap-2",
|
|
1540
|
+
children: [
|
|
1541
|
+
/* @__PURE__ */ jsxs8("span", {
|
|
1542
|
+
className: "text-trim",
|
|
1543
|
+
children: [
|
|
1544
|
+
/* @__PURE__ */ jsx11("span", {
|
|
1545
|
+
className: "weight-semibold",
|
|
1546
|
+
children: "Drag"
|
|
1547
|
+
}),
|
|
1548
|
+
" to resize"
|
|
1549
|
+
]
|
|
1550
|
+
}),
|
|
1551
|
+
/* @__PURE__ */ jsxs8("span", {
|
|
1552
|
+
className: "flex items-center gap-1.5",
|
|
1553
|
+
children: [
|
|
1554
|
+
/* @__PURE__ */ jsxs8("span", {
|
|
1555
|
+
className: "text-trim",
|
|
1556
|
+
children: [
|
|
1557
|
+
/* @__PURE__ */ jsx11("span", {
|
|
1558
|
+
className: "weight-semibold",
|
|
1559
|
+
children: "Click"
|
|
1560
|
+
}),
|
|
1561
|
+
" to collapse"
|
|
1562
|
+
]
|
|
1563
|
+
}),
|
|
1564
|
+
/* @__PURE__ */ jsx11(ShortcutKbd, {
|
|
1565
|
+
children: shortcutKey
|
|
1566
|
+
})
|
|
1567
|
+
]
|
|
1568
|
+
})
|
|
1569
|
+
]
|
|
1570
|
+
}),
|
|
1571
|
+
children: /* @__PURE__ */ jsx11("button", {
|
|
1572
|
+
ref: mergeRefs2(railRef, ref),
|
|
1573
|
+
type: "button",
|
|
1574
|
+
"data-sidebar": "rail",
|
|
1575
|
+
"aria-label": "Resize or collapse sidebar",
|
|
1576
|
+
tabIndex: -1,
|
|
1577
|
+
onPointerDown,
|
|
1578
|
+
onPointerMove,
|
|
1579
|
+
onPointerUp,
|
|
1580
|
+
onPointerCancel,
|
|
1581
|
+
className: cn2("absolute inset-y-0 z-20 w-2 cursor-col-resize touch-none outline-none", side === "left" ? "right-0" : "left-0", "after:absolute after:inset-y-0 after:w-px after:bg-transparent hover:after:bg-foreground/25 after:transition-colors after:duration-fast", tooltipOpen && "after:bg-foreground/25", side === "left" ? "after:right-0" : "after:left-0", className),
|
|
1582
|
+
...props
|
|
1583
|
+
})
|
|
1555
1584
|
});
|
|
1556
1585
|
});
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
const
|
|
1579
|
-
const prevOpenRef =
|
|
1580
|
-
const
|
|
1581
|
-
|
|
1586
|
+
SidebarRail2.displayName = "SidebarRail";
|
|
1587
|
+
|
|
1588
|
+
// components/navigation/sidebar/sidebar-shell.tsx
|
|
1589
|
+
import { motion as motion5 } from "motion/react";
|
|
1590
|
+
import { forwardRef as forwardRef9, useEffect as useEffect5, useRef as useRef9, useState as useState7 } from "react";
|
|
1591
|
+
import { jsx as jsx12, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1592
|
+
/*!
|
|
1593
|
+
* Ported from Fluid Functionalism — github.com/mickadesign/fluid-functionalism
|
|
1594
|
+
* `registry/default/sidebar-core.tsx` @ b3587bdbd83fc66c2a6aae3817ffb856cb09260b
|
|
1595
|
+
* MIT License © 2026 Micka Touillaud — fluidfunctionalism.com (notice: LICENSE.fluid-functionalism)
|
|
1596
|
+
* Local changes: see PORTING.md.
|
|
1597
|
+
*/
|
|
1598
|
+
var BREAKPOINT_FADE_BASE = "transition-[opacity,display] ease-out [transition-behavior:allow-discrete] motion-reduce:transition-none";
|
|
1599
|
+
var BREAKPOINT_HIDDEN = {
|
|
1600
|
+
640: "max-sm:hidden max-sm:opacity-0 max-sm:duration-moderate sm:duration-slow sm:starting:opacity-0",
|
|
1601
|
+
768: "max-md:hidden max-md:opacity-0 max-md:duration-moderate md:duration-slow md:starting:opacity-0",
|
|
1602
|
+
1024: "max-lg:hidden max-lg:opacity-0 max-lg:duration-moderate lg:duration-slow lg:starting:opacity-0",
|
|
1603
|
+
1280: "max-xl:hidden max-xl:opacity-0 max-xl:duration-moderate xl:duration-slow xl:starting:opacity-0"
|
|
1604
|
+
};
|
|
1605
|
+
function useWidthTransition(open, isResizing) {
|
|
1606
|
+
const reduceMotion = useReduceMotion2();
|
|
1607
|
+
const [dragFlip, setDragFlip] = useState7(false);
|
|
1608
|
+
const prevOpenRef = useRef9(open);
|
|
1609
|
+
const openFlipped = prevOpenRef.current !== open;
|
|
1610
|
+
useEffect5(() => {
|
|
1611
|
+
const flipped = prevOpenRef.current !== open;
|
|
1582
1612
|
prevOpenRef.current = open;
|
|
1583
|
-
|
|
1613
|
+
if (!isResizing) {
|
|
1614
|
+
setDragFlip(false);
|
|
1615
|
+
return;
|
|
1616
|
+
}
|
|
1617
|
+
if (!flipped)
|
|
1618
|
+
return;
|
|
1619
|
+
setDragFlip(true);
|
|
1620
|
+
const id = setTimeout(() => setDragFlip(false), exitFallbackMs2(spring2.moderate));
|
|
1621
|
+
return () => clearTimeout(id);
|
|
1622
|
+
}, [open, isResizing]);
|
|
1623
|
+
if (reduceMotion)
|
|
1624
|
+
return { duration: 0 };
|
|
1625
|
+
if (isResizing) {
|
|
1626
|
+
if (!openFlipped && !dragFlip)
|
|
1627
|
+
return { duration: 0 };
|
|
1628
|
+
return open ? spring2.moderate : spring2.moderate.exit;
|
|
1584
1629
|
}
|
|
1585
|
-
return
|
|
1586
|
-
|
|
1587
|
-
|
|
1630
|
+
return open ? spring2.slow : spring2.slow.exit;
|
|
1631
|
+
}
|
|
1632
|
+
var SidebarShell = forwardRef9(({ side, variant, bordered = true, rail = true, railTooltipOpen, className, children, ...props }, ref) => {
|
|
1633
|
+
const { open: kept, hoverOpen, width, mobileBreakpoint, isMobile, isResizing, shellRef } = useSidebar2();
|
|
1634
|
+
const open = kept || hoverOpen;
|
|
1635
|
+
const shape = useShape2();
|
|
1636
|
+
const floatingLevel = useLift2(1);
|
|
1637
|
+
const transition = useWidthTransition(open, isResizing);
|
|
1638
|
+
const shell = useMergeRefs2(shellRef, ref);
|
|
1639
|
+
const fade = shape.bgRadius >= 20 ? 24 : 12;
|
|
1640
|
+
return /* @__PURE__ */ jsx12(motion5.div, {
|
|
1641
|
+
ref: shell,
|
|
1642
|
+
"data-slot": "sidebar",
|
|
1643
|
+
"data-state": open ? "expanded" : "collapsed",
|
|
1644
|
+
"data-collapsible": open ? "" : "offcanvas",
|
|
1645
|
+
"data-variant": variant,
|
|
1646
|
+
"data-side": side,
|
|
1647
|
+
className: cn2("peer shrink-0 sticky top-0 h-svh overflow-hidden", side === "right" && "order-last", variant === "inset" && "[--scroll-divider-inset:8px]", BREAKPOINT_FADE_BASE, BREAKPOINT_HIDDEN[mobileBreakpoint], !BREAKPOINT_HIDDEN[mobileBreakpoint] && isMobile && "hidden", className),
|
|
1588
1648
|
initial: false,
|
|
1589
|
-
animate:
|
|
1590
|
-
transition
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1649
|
+
animate: { width: open ? width : "0rem" },
|
|
1650
|
+
transition,
|
|
1651
|
+
...props,
|
|
1652
|
+
children: /* @__PURE__ */ jsxs9(motion5.div, {
|
|
1653
|
+
className: cn2("absolute inset-y-0 flex h-full flex-col", side === "left" ? "left-0" : "right-0", variant === "floating" && "p-2", variant === "inset" && "py-2"),
|
|
1654
|
+
style: { width },
|
|
1655
|
+
initial: false,
|
|
1656
|
+
animate: { x: open ? "0%" : side === "left" ? "-100%" : "100%" },
|
|
1657
|
+
transition,
|
|
1658
|
+
...open || isResizing ? {} : { inert: "" },
|
|
1659
|
+
children: [
|
|
1660
|
+
variant === "floating" ? /* @__PURE__ */ jsx12("div", {
|
|
1661
|
+
"data-sidebar": "sidebar",
|
|
1662
|
+
className: cn2("flex h-full w-full min-h-0 flex-col", shape.container, surfaceClasses2(floatingLevel, 3)),
|
|
1663
|
+
children: /* @__PURE__ */ jsx12(SurfaceProvider2, {
|
|
1664
|
+
value: floatingLevel,
|
|
1665
|
+
children
|
|
1666
|
+
})
|
|
1667
|
+
}) : /* @__PURE__ */ jsx12("div", {
|
|
1668
|
+
"data-sidebar": "sidebar",
|
|
1669
|
+
className: cn2("flex h-full w-full min-h-0 flex-col", bordered && variant === "sidebar" && (side === "left" ? "border-r border-border" : "border-l border-border")),
|
|
1670
|
+
children
|
|
1671
|
+
}),
|
|
1672
|
+
rail && /* @__PURE__ */ jsx12(SidebarRail2, {
|
|
1673
|
+
tooltipOpen: railTooltipOpen,
|
|
1674
|
+
className: cn2(variant === "floating" && (side === "left" ? "right-1 after:right-[3.5px]" : "left-1 after:left-[3.5px]"), variant !== "sidebar" && "after:inset-y-2 after:[mask-image:linear-gradient(to_bottom,transparent_var(--rail-fade-start),black_var(--rail-fade-end),black_calc(100%-var(--rail-fade-end)),transparent_calc(100%-var(--rail-fade-start)))]"),
|
|
1675
|
+
style: variant !== "sidebar" ? { "--rail-fade-start": `${fade}px`, "--rail-fade-end": `${fade + 24}px` } : undefined
|
|
1676
|
+
})
|
|
1677
|
+
]
|
|
1609
1678
|
})
|
|
1610
1679
|
});
|
|
1611
1680
|
});
|
|
1612
|
-
|
|
1613
|
-
var SidebarMenuSubButton2 = forwardRef2(({
|
|
1614
|
-
isActive: isActiveProp = false,
|
|
1615
|
-
size = "md",
|
|
1616
|
-
icon: Icon,
|
|
1617
|
-
value,
|
|
1618
|
-
render,
|
|
1619
|
-
asChild,
|
|
1620
|
-
className,
|
|
1621
|
-
onClick,
|
|
1622
|
-
children,
|
|
1623
|
-
...props
|
|
1624
|
-
}, ref) => {
|
|
1625
|
-
const item = useContext2(MenuItemContext);
|
|
1626
|
-
const selection = useContext2(SidebarSelection2);
|
|
1627
|
-
const isActive = isActiveProp || value !== undefined && selection?.value === value;
|
|
1628
|
-
const shape = useShape2();
|
|
1629
|
-
const sizeClasses = useSize2();
|
|
1630
|
-
const buttonRef = useRef2(null);
|
|
1631
|
-
const setActive = item?.setActive;
|
|
1632
|
-
useIsoLayoutEffect2(() => {
|
|
1633
|
-
setActive?.(isActive);
|
|
1634
|
-
return () => setActive?.(false);
|
|
1635
|
-
}, [isActive, setActive]);
|
|
1636
|
-
const setButtonEl = item?.setButtonEl;
|
|
1637
|
-
useIsoLayoutEffect2(() => {
|
|
1638
|
-
setButtonEl?.(buttonRef.current);
|
|
1639
|
-
return () => setButtonEl?.(null);
|
|
1640
|
-
}, [setButtonEl]);
|
|
1641
|
-
const lit = isActive || (item?.isHovered ?? false);
|
|
1642
|
-
const tabIdx = isActive ? 0 : -1;
|
|
1643
|
-
const gutterHover = rowGutter(item?.actionCount ?? 0, item?.hasBadge ?? false);
|
|
1644
|
-
const gutterRest = item?.actionsShowOnHover ? rowGutter(0, item?.hasBadge ?? false) : gutterHover;
|
|
1645
|
-
const gutterVars = {
|
|
1646
|
-
"--row-gutter": `${gutterRest}px`,
|
|
1647
|
-
"--row-gutter-hover": `${gutterHover}px`
|
|
1648
|
-
};
|
|
1649
|
-
const { template, content } = resolveSlotTemplate(render, asChild, children);
|
|
1650
|
-
const asButton = !template && value !== undefined && props.href === undefined;
|
|
1651
|
-
return slotElement(template, asButton ? "button" : "a", {
|
|
1652
|
-
type: asButton ? "button" : undefined,
|
|
1653
|
-
ref: (node) => {
|
|
1654
|
-
buttonRef.current = node;
|
|
1655
|
-
if (typeof ref === "function")
|
|
1656
|
-
ref(node);
|
|
1657
|
-
else if (ref)
|
|
1658
|
-
ref.current = node;
|
|
1659
|
-
},
|
|
1660
|
-
"data-sidebar": "menu-sub-button",
|
|
1661
|
-
"data-size": size,
|
|
1662
|
-
"data-active": isActive ? "true" : undefined,
|
|
1663
|
-
"aria-current": isActive ? "page" : undefined,
|
|
1664
|
-
tabIndex: tabIdx,
|
|
1665
|
-
className: cn2("relative z-10 flex w-full cursor-pointer select-none items-center gap-2 pl-2 text-left outline-none", "transition-[padding] duration-fast pr-[var(--row-gutter)] group-hover/menu-sub-item:pr-[var(--row-gutter-hover)] group-focus-within/menu-sub-item:pr-[var(--row-gutter-hover)] group-has-[[data-sidebar=menu-action]:is([data-state=open],[data-popup-open],[aria-expanded=true])]/menu-sub-item:pr-[var(--row-gutter-hover)]", size === "sm" ? "h-6" : sizeClasses.variant === "compact" ? "h-6" : "h-7", shape.item, className),
|
|
1666
|
-
onClick: (event) => {
|
|
1667
|
-
onClick?.(event);
|
|
1668
|
-
if (value !== undefined)
|
|
1669
|
-
selection?.select(value);
|
|
1670
|
-
},
|
|
1671
|
-
...props,
|
|
1672
|
-
style: { ...gutterVars, ...props.style ?? {} }
|
|
1673
|
-
}, /* @__PURE__ */ jsxs2(Fragment2, {
|
|
1674
|
-
children: [
|
|
1675
|
-
Icon && /* @__PURE__ */ jsx2(Icon, {
|
|
1676
|
-
size: sizeClasses.icon,
|
|
1677
|
-
strokeWidth: lit ? 2 : 1.5,
|
|
1678
|
-
className: cn2("shrink-0 transition-[color,stroke-width] duration-fast", lit ? "text-foreground" : "text-muted-foreground")
|
|
1679
|
-
}),
|
|
1680
|
-
/* @__PURE__ */ jsx2(MenuRowLabel, {
|
|
1681
|
-
content,
|
|
1682
|
-
lit,
|
|
1683
|
-
emphasized: isActive,
|
|
1684
|
-
textClass: size === "sm" ? "text-body-compact" : sizeClasses.text
|
|
1685
|
-
})
|
|
1686
|
-
]
|
|
1687
|
-
}));
|
|
1688
|
-
});
|
|
1689
|
-
SidebarMenuSubButton2.displayName = "SidebarMenuSubButton";
|
|
1681
|
+
SidebarShell.displayName = "SidebarShell";
|
|
1690
1682
|
|
|
1691
1683
|
// components/navigation/sidebar/index.tsx
|
|
1692
|
-
import { jsx as
|
|
1684
|
+
import { jsx as jsx13, jsxs as jsxs10, Fragment as Fragment6 } from "react/jsx-runtime";
|
|
1685
|
+
/*!
|
|
1686
|
+
* Ported from Fluid Functionalism — github.com/mickadesign/fluid-functionalism
|
|
1687
|
+
* `registry/base/sidebar.tsx` @ b3587bdbd83fc66c2a6aae3817ffb856cb09260b
|
|
1688
|
+
* MIT License © 2026 Micka Touillaud — fluidfunctionalism.com (notice: LICENSE.fluid-functionalism)
|
|
1689
|
+
* Local changes: see PORTING.md.
|
|
1690
|
+
*/
|
|
1693
1691
|
function SidebarSheet({ side, children }) {
|
|
1694
1692
|
const { openMobile, setOpenMobile, widthMobile } = useSidebar2();
|
|
1695
|
-
return /* @__PURE__ */
|
|
1693
|
+
return /* @__PURE__ */ jsx13(Sheet2, {
|
|
1696
1694
|
side,
|
|
1697
1695
|
open: openMobile,
|
|
1698
1696
|
onOpenChange: setOpenMobile,
|
|
1699
|
-
children: /* @__PURE__ */
|
|
1697
|
+
children: /* @__PURE__ */ jsx13(Sheet2.Content, {
|
|
1700
1698
|
"aria-label": "Sidebar",
|
|
1701
1699
|
"data-sidebar": "sidebar",
|
|
1702
1700
|
"data-mobile": "true",
|
|
@@ -1708,7 +1706,7 @@ function SidebarSheet({ side, children }) {
|
|
|
1708
1706
|
})
|
|
1709
1707
|
});
|
|
1710
1708
|
}
|
|
1711
|
-
var Sidebar2 =
|
|
1709
|
+
var Sidebar2 = forwardRef10(({
|
|
1712
1710
|
side = "left",
|
|
1713
1711
|
variant = "sidebar",
|
|
1714
1712
|
collapsible = "offcanvas",
|
|
@@ -1725,14 +1723,14 @@ var Sidebar2 = forwardRef3(({
|
|
|
1725
1723
|
}, ref) => {
|
|
1726
1724
|
const { isMobile, width, registerSide } = useSidebar2();
|
|
1727
1725
|
const [value, setValue] = useControllableState2(valueProp, defaultValue, onValueChange);
|
|
1728
|
-
const selection =
|
|
1729
|
-
const children = /* @__PURE__ */
|
|
1726
|
+
const selection = useMemo5(() => ({ value, select: setValue }), [value, setValue]);
|
|
1727
|
+
const children = /* @__PURE__ */ jsx13(SidebarSelection2.Provider, {
|
|
1730
1728
|
value: selection,
|
|
1731
1729
|
children: parts
|
|
1732
1730
|
});
|
|
1733
|
-
|
|
1731
|
+
useEffect6(() => registerSide(side), [side, registerSide]);
|
|
1734
1732
|
if (collapsible === "none") {
|
|
1735
|
-
return /* @__PURE__ */
|
|
1733
|
+
return /* @__PURE__ */ jsx13("div", {
|
|
1736
1734
|
ref,
|
|
1737
1735
|
"data-slot": "sidebar",
|
|
1738
1736
|
"data-variant": variant,
|
|
@@ -1740,20 +1738,20 @@ var Sidebar2 = forwardRef3(({
|
|
|
1740
1738
|
className: cn2("peer sticky top-0 flex h-svh shrink-0 flex-col", side === "right" && "order-last", className),
|
|
1741
1739
|
style: { width, ...style },
|
|
1742
1740
|
...props,
|
|
1743
|
-
children: /* @__PURE__ */
|
|
1741
|
+
children: /* @__PURE__ */ jsx13("div", {
|
|
1744
1742
|
"data-sidebar": "sidebar",
|
|
1745
1743
|
className: cn2("flex h-full w-full min-h-0 flex-col", bordered && variant === "sidebar" && (side === "left" ? "border-r border-border" : "border-l border-border")),
|
|
1746
1744
|
children
|
|
1747
1745
|
})
|
|
1748
1746
|
});
|
|
1749
1747
|
}
|
|
1750
|
-
return /* @__PURE__ */
|
|
1748
|
+
return /* @__PURE__ */ jsxs10(Fragment6, {
|
|
1751
1749
|
children: [
|
|
1752
|
-
isMobile && /* @__PURE__ */
|
|
1750
|
+
isMobile && /* @__PURE__ */ jsx13(SidebarSheet, {
|
|
1753
1751
|
side,
|
|
1754
1752
|
children
|
|
1755
1753
|
}),
|
|
1756
|
-
/* @__PURE__ */
|
|
1754
|
+
/* @__PURE__ */ jsx13(SidebarShell, {
|
|
1757
1755
|
ref,
|
|
1758
1756
|
side,
|
|
1759
1757
|
variant,
|
|
@@ -1769,12 +1767,12 @@ var Sidebar2 = forwardRef3(({
|
|
|
1769
1767
|
});
|
|
1770
1768
|
});
|
|
1771
1769
|
Sidebar2.displayName = "Sidebar";
|
|
1772
|
-
var SidebarContent2 =
|
|
1770
|
+
var SidebarContent2 = forwardRef10(({ className, viewportClassName, children, ...props }, ref) => {
|
|
1773
1771
|
const { isMobile } = useSidebar2();
|
|
1774
1772
|
if (isMobile) {
|
|
1775
|
-
return /* @__PURE__ */
|
|
1773
|
+
return /* @__PURE__ */ jsx13("div", {
|
|
1776
1774
|
className: "scroll-divider [--scroll-divider-inset:8px] flex min-h-0 w-full flex-1 flex-col",
|
|
1777
|
-
children: /* @__PURE__ */
|
|
1775
|
+
children: /* @__PURE__ */ jsx13("div", {
|
|
1778
1776
|
ref,
|
|
1779
1777
|
"data-sidebar": "content",
|
|
1780
1778
|
className: cn2("scroll-fade flex min-h-0 w-full flex-1 flex-col overflow-y-auto", className),
|
|
@@ -1783,10 +1781,10 @@ var SidebarContent2 = forwardRef3(({ className, viewportClassName, children, ...
|
|
|
1783
1781
|
})
|
|
1784
1782
|
});
|
|
1785
1783
|
}
|
|
1786
|
-
return /* @__PURE__ */
|
|
1784
|
+
return /* @__PURE__ */ jsx13(ScrollArea2, {
|
|
1787
1785
|
className: cn2("scroll-divider min-h-0 w-full flex-1", className),
|
|
1788
1786
|
viewportClassName: cn2("scroll-fade [&>div]:!block [&>div]:!min-w-0", viewportClassName),
|
|
1789
|
-
children: /* @__PURE__ */
|
|
1787
|
+
children: /* @__PURE__ */ jsx13("div", {
|
|
1790
1788
|
ref,
|
|
1791
1789
|
"data-sidebar": "content",
|
|
1792
1790
|
className: "flex w-full min-w-0 flex-col",
|
|
@@ -1824,4 +1822,4 @@ Object.assign(Sidebar2, {
|
|
|
1824
1822
|
});
|
|
1825
1823
|
var sidebar_default = Sidebar2;
|
|
1826
1824
|
|
|
1827
|
-
export {
|
|
1825
|
+
export { SidebarSelection2, SIDEBAR_COOKIE_NAME2, SIDEBAR_COOKIE_MAX_AGE2, SIDEBAR_WIDTH2, SIDEBAR_WIDTH_MOBILE2, SIDEBAR_KEYBOARD_SHORTCUT2, SIDEBAR_KEYBOARD_SHORTCUT_RIGHT2, SIDEBAR_MIN_WIDTH2, SIDEBAR_MAX_WIDTH2, useSidebar2, SidebarGroup2, SidebarGroupLabel2, SidebarGroupAction2, SidebarGroupActions2, SidebarGroupContent2, SidebarMenuAction2, SidebarMenuActions2, SidebarMenuBadge2, SidebarMenuSkeleton2, sidebarMenuButtonVariants2, SidebarMenuButton2, SidebarMenu2, SidebarMenuItem2, SidebarMenuSubItem2, SidebarMenuSub2, SidebarMenuSubButton2, SidebarInset2, SidebarInput2, SidebarHeader2, SidebarFooter2, SidebarSeparator2, SidebarProvider2, SidebarTrigger2, SidebarRail2, Sidebar2, SidebarContent2, sidebar_default };
|