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