@elabs-ai/components-ui 4.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/LICENSE +21 -0
- package/README.md +78 -0
- package/dist/index.d.ts +4497 -0
- package/dist/index.js +15192 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/cn.d.ts +10 -0
- package/dist/lib/cn.js +20 -0
- package/dist/lib/cn.js.map +1 -0
- package/package.json +106 -0
- package/src/blocks/sidebar-02/app-sidebar.tsx +160 -0
- package/src/blocks/sidebar-02/logo.tsx +18 -0
- package/src/blocks/sidebar-02/nav-main.tsx +13 -0
- package/src/blocks/sidebar-02/nav-notifications.tsx +7 -0
- package/src/blocks/sidebar-02/sidebar-02.stories.tsx +23 -0
- package/src/blocks/sidebar-02/team-switcher.tsx +7 -0
- package/src/blocks/sidebar-04/app-sidebar.tsx +236 -0
- package/src/blocks/sidebar-04/mail-context.tsx +29 -0
- package/src/blocks/sidebar-04/nav-user.tsx +6 -0
- package/src/blocks/sidebar-04/sidebar-04.stories.tsx +150 -0
- package/src/blocks/sidebar-05/app-sidebar.tsx +375 -0
- package/src/blocks/sidebar-05/sidebar-05.stories.tsx +18 -0
- package/src/blocks/sidebar-05/team-switcher.tsx +6 -0
- package/src/blocks-comparison-table.stories.tsx +165 -0
- package/src/components/accordion/accordion.stories.tsx +71 -0
- package/src/components/accordion/accordion.test.tsx +18 -0
- package/src/components/accordion/accordion.tsx +49 -0
- package/src/components/accordion/index.ts +1 -0
- package/src/components/advanced-group/advanced-group.stories.tsx +143 -0
- package/src/components/advanced-group/advanced-group.test.tsx +81 -0
- package/src/components/advanced-group/advanced-group.tsx +111 -0
- package/src/components/advanced-group/index.ts +2 -0
- package/src/components/alert/alert.stories.tsx +156 -0
- package/src/components/alert/alert.test.tsx +57 -0
- package/src/components/alert/alert.tsx +91 -0
- package/src/components/alert/index.ts +8 -0
- package/src/components/alert-dialog/alert-dialog.stories.tsx +73 -0
- package/src/components/alert-dialog/alert-dialog.tsx +104 -0
- package/src/components/alert-dialog/index.ts +12 -0
- package/src/components/app-shell/app-shell.stories.tsx +61 -0
- package/src/components/app-shell/app-shell.tsx +31 -0
- package/src/components/app-shell/index.ts +1 -0
- package/src/components/app-sidebar/app-sidebar.stories.tsx +121 -0
- package/src/components/app-sidebar/app-sidebar.test.tsx +55 -0
- package/src/components/app-sidebar/app-sidebar.tsx +53 -0
- package/src/components/app-sidebar/index.ts +1 -0
- package/src/components/aspect-ratio/aspect-ratio.stories.tsx +46 -0
- package/src/components/aspect-ratio/aspect-ratio.tsx +3 -0
- package/src/components/aspect-ratio/index.ts +1 -0
- package/src/components/attribution-panel/attribution-panel.stories.tsx +83 -0
- package/src/components/attribution-panel/attribution-panel.test.tsx +123 -0
- package/src/components/attribution-panel/attribution-panel.tsx +191 -0
- package/src/components/attribution-panel/attribution-types.ts +44 -0
- package/src/components/attribution-panel/attributions.generated.ts +1422 -0
- package/src/components/attribution-panel/index.ts +3 -0
- package/src/components/avatar/avatar.stories.tsx +45 -0
- package/src/components/avatar/avatar.test.tsx +13 -0
- package/src/components/avatar/avatar.tsx +46 -0
- package/src/components/avatar/index.ts +1 -0
- package/src/components/badge/badge.stories.tsx +44 -0
- package/src/components/badge/badge.test.tsx +10 -0
- package/src/components/badge/badge.tsx +28 -0
- package/src/components/badge/index.ts +1 -0
- package/src/components/bento-grid/bento-grid.stories.tsx +165 -0
- package/src/components/bento-grid/bento-grid.test.tsx +119 -0
- package/src/components/bento-grid/bento-grid.tsx +339 -0
- package/src/components/bento-grid/index.ts +9 -0
- package/src/components/bounded-number/bounded-number.stories.tsx +118 -0
- package/src/components/bounded-number/bounded-number.test.tsx +73 -0
- package/src/components/bounded-number/bounded-number.tsx +110 -0
- package/src/components/bounded-number/index.ts +1 -0
- package/src/components/breadcrumb/breadcrumb.stories.tsx +47 -0
- package/src/components/breadcrumb/breadcrumb.test.tsx +17 -0
- package/src/components/breadcrumb/breadcrumb.tsx +86 -0
- package/src/components/breadcrumb/index.ts +9 -0
- package/src/components/button/button.stories.tsx +70 -0
- package/src/components/button/button.test.tsx +50 -0
- package/src/components/button/button.tsx +63 -0
- package/src/components/button/index.ts +1 -0
- package/src/components/button-group/button-group.stories.tsx +45 -0
- package/src/components/button-group/button-group.tsx +70 -0
- package/src/components/button-group/index.ts +6 -0
- package/src/components/calendar/calendar.stories.tsx +95 -0
- package/src/components/calendar/calendar.test.tsx +140 -0
- package/src/components/calendar/calendar.tsx +70 -0
- package/src/components/calendar/index.ts +1 -0
- package/src/components/card/card.stories.tsx +438 -0
- package/src/components/card/card.test.tsx +153 -0
- package/src/components/card/card.tsx +332 -0
- package/src/components/card/index.ts +13 -0
- package/src/components/carousel/carousel.stories.tsx +102 -0
- package/src/components/carousel/carousel.tsx +225 -0
- package/src/components/carousel/index.ts +8 -0
- package/src/components/change-review/change-review.stories.tsx +288 -0
- package/src/components/change-review/change-review.test.tsx +261 -0
- package/src/components/change-review/change-review.tsx +637 -0
- package/src/components/change-review/index.ts +23 -0
- package/src/components/checkbox/checkbox.stories.tsx +119 -0
- package/src/components/checkbox/checkbox.test.tsx +40 -0
- package/src/components/checkbox/checkbox.tsx +34 -0
- package/src/components/checkbox/index.ts +1 -0
- package/src/components/collapsible/collapsible.stories.tsx +62 -0
- package/src/components/collapsible/collapsible.tsx +22 -0
- package/src/components/collapsible/index.ts +1 -0
- package/src/components/collapsible-panel/index.ts +8 -0
- package/src/components/collapsible-panel/use-collapsible-panel.test.tsx +93 -0
- package/src/components/collapsible-panel/use-collapsible-panel.ts +159 -0
- package/src/components/color-picker/color-picker.stories.tsx +93 -0
- package/src/components/color-picker/color-picker.test.tsx +79 -0
- package/src/components/color-picker/color-picker.tsx +341 -0
- package/src/components/color-picker/index.ts +1 -0
- package/src/components/combobox/combobox.stories.tsx +154 -0
- package/src/components/combobox/combobox.test.tsx +246 -0
- package/src/components/combobox/combobox.tsx +210 -0
- package/src/components/combobox/index.ts +1 -0
- package/src/components/command/command.stories.tsx +371 -0
- package/src/components/command/command.test.tsx +280 -0
- package/src/components/command/command.tsx +301 -0
- package/src/components/command/index.ts +13 -0
- package/src/components/confirm-dialog/confirm-dialog.stories.tsx +183 -0
- package/src/components/confirm-dialog/confirm-dialog.test.tsx +147 -0
- package/src/components/confirm-dialog/confirm-dialog.tsx +146 -0
- package/src/components/confirm-dialog/index.ts +2 -0
- package/src/components/context-menu/context-menu.stories.tsx +70 -0
- package/src/components/context-menu/context-menu.tsx +172 -0
- package/src/components/context-menu/index.ts +16 -0
- package/src/components/copyable-value/copyable-value.stories.tsx +80 -0
- package/src/components/copyable-value/copyable-value.test.tsx +128 -0
- package/src/components/copyable-value/copyable-value.tsx +101 -0
- package/src/components/copyable-value/index.ts +1 -0
- package/src/components/date-picker/date-picker.stories.tsx +42 -0
- package/src/components/date-picker/date-picker.tsx +49 -0
- package/src/components/date-picker/index.ts +1 -0
- package/src/components/date-range-picker/date-range-picker.stories.tsx +151 -0
- package/src/components/date-range-picker/date-range-picker.test.tsx +62 -0
- package/src/components/date-range-picker/date-range-picker.tsx +126 -0
- package/src/components/date-range-picker/index.ts +6 -0
- package/src/components/descriptions/descriptions.stories.tsx +43 -0
- package/src/components/descriptions/descriptions.test.tsx +41 -0
- package/src/components/descriptions/descriptions.tsx +95 -0
- package/src/components/descriptions/index.ts +6 -0
- package/src/components/dialog/dialog.stories.tsx +728 -0
- package/src/components/dialog/dialog.test.tsx +285 -0
- package/src/components/dialog/dialog.tsx +340 -0
- package/src/components/dialog/index.ts +18 -0
- package/src/components/dialog/use-dialog-dismiss-guard.test.tsx +80 -0
- package/src/components/dialog/use-dialog-dismiss-guard.ts +109 -0
- package/src/components/drawer/drawer.stories.tsx +76 -0
- package/src/components/drawer/drawer.tsx +85 -0
- package/src/components/drawer/index.ts +11 -0
- package/src/components/dropdown-menu/dropdown-menu.stories.tsx +176 -0
- package/src/components/dropdown-menu/dropdown-menu.test.tsx +109 -0
- package/src/components/dropdown-menu/dropdown-menu.tsx +179 -0
- package/src/components/dropdown-menu/index.ts +17 -0
- package/src/components/empty-state/empty-state.stories.tsx +54 -0
- package/src/components/empty-state/empty-state.test.tsx +11 -0
- package/src/components/empty-state/empty-state.tsx +30 -0
- package/src/components/empty-state/index.ts +1 -0
- package/src/components/error-state/error-state.stories.tsx +51 -0
- package/src/components/error-state/error-state.tsx +27 -0
- package/src/components/error-state/index.ts +1 -0
- package/src/components/expand-dialog/expand-dialog.stories.tsx +246 -0
- package/src/components/expand-dialog/expand-dialog.test.tsx +185 -0
- package/src/components/expand-dialog/expand-dialog.tsx +387 -0
- package/src/components/expand-dialog/index.ts +11 -0
- package/src/components/field-row/field-row.stories.tsx +114 -0
- package/src/components/field-row/field-row.test.tsx +188 -0
- package/src/components/field-row/field-row.tsx +115 -0
- package/src/components/field-row/index.ts +1 -0
- package/src/components/file-upload/file-upload.stories.tsx +183 -0
- package/src/components/file-upload/file-upload.test.tsx +169 -0
- package/src/components/file-upload/file-upload.tsx +459 -0
- package/src/components/file-upload/index.ts +13 -0
- package/src/components/form/form.stories.tsx +71 -0
- package/src/components/form/form.tsx +141 -0
- package/src/components/form/index.ts +10 -0
- package/src/components/hover-card/hover-card.stories.tsx +57 -0
- package/src/components/hover-card/hover-card.tsx +25 -0
- package/src/components/hover-card/index.ts +1 -0
- package/src/components/icon-button/icon-button.stories.tsx +108 -0
- package/src/components/icon-button/icon-button.test.tsx +93 -0
- package/src/components/icon-button/icon-button.tsx +139 -0
- package/src/components/icon-button/index.ts +1 -0
- package/src/components/input/index.ts +1 -0
- package/src/components/input/input.stories.tsx +44 -0
- package/src/components/input/input.test.tsx +19 -0
- package/src/components/input/input.tsx +26 -0
- package/src/components/input-group/index.ts +11 -0
- package/src/components/input-group/input-group.stories.tsx +87 -0
- package/src/components/input-group/input-group.test.tsx +48 -0
- package/src/components/input-group/input-group.tsx +170 -0
- package/src/components/input-otp/index.ts +1 -0
- package/src/components/input-otp/input-otp.stories.tsx +66 -0
- package/src/components/input-otp/input-otp.tsx +68 -0
- package/src/components/kbd/index.ts +1 -0
- package/src/components/kbd/kbd.stories.tsx +45 -0
- package/src/components/kbd/kbd.tsx +20 -0
- package/src/components/key-value-editor/index.ts +1 -0
- package/src/components/key-value-editor/key-value-editor.stories.tsx +130 -0
- package/src/components/key-value-editor/key-value-editor.test.tsx +231 -0
- package/src/components/key-value-editor/key-value-editor.tsx +263 -0
- package/src/components/label/index.ts +1 -0
- package/src/components/label/label.stories.tsx +35 -0
- package/src/components/label/label.tsx +19 -0
- package/src/components/link-preview/index.ts +2 -0
- package/src/components/link-preview/link-preview.stories.tsx +178 -0
- package/src/components/link-preview/link-preview.test.tsx +123 -0
- package/src/components/link-preview/link-preview.tsx +194 -0
- package/src/components/list-editor/index.ts +1 -0
- package/src/components/list-editor/list-editor.stories.tsx +119 -0
- package/src/components/list-editor/list-editor.test.tsx +96 -0
- package/src/components/list-editor/list-editor.tsx +192 -0
- package/src/components/loading-state/index.ts +1 -0
- package/src/components/loading-state/loading-state.stories.tsx +38 -0
- package/src/components/loading-state/loading-state.tsx +26 -0
- package/src/components/locale-provider/index.ts +8 -0
- package/src/components/locale-provider/locale-provider.stories.tsx +83 -0
- package/src/components/locale-provider/locale-provider.test.tsx +238 -0
- package/src/components/locale-provider/locale-provider.tsx +187 -0
- package/src/components/locale-provider/messages.ts +300 -0
- package/src/components/match-highlight/index.ts +7 -0
- package/src/components/match-highlight/match-highlight.stories.tsx +146 -0
- package/src/components/match-highlight/match-highlight.test.tsx +202 -0
- package/src/components/match-highlight/match-highlight.tsx +145 -0
- package/src/components/mention-input/index.ts +28 -0
- package/src/components/mention-input/mention-input-mirror.stories.tsx +171 -0
- package/src/components/mention-input/mention-input.stories.tsx +463 -0
- package/src/components/mention-input/mention-input.test.tsx +617 -0
- package/src/components/mention-input/mention-input.tsx +1102 -0
- package/src/components/mention-input/mention-value.test.ts +253 -0
- package/src/components/mention-input/mention-value.ts +193 -0
- package/src/components/menubar/index.ts +17 -0
- package/src/components/menubar/menubar.stories.tsx +67 -0
- package/src/components/menubar/menubar.tsx +198 -0
- package/src/components/metric-card/index.ts +1 -0
- package/src/components/metric-card/metric-card.stories.tsx +224 -0
- package/src/components/metric-card/metric-card.test.tsx +198 -0
- package/src/components/metric-card/metric-card.tsx +229 -0
- package/src/components/model-picker/index.ts +11 -0
- package/src/components/model-picker/model-picker-state.ts +85 -0
- package/src/components/model-picker/model-picker.stories.tsx +128 -0
- package/src/components/model-picker/model-picker.test.tsx +241 -0
- package/src/components/model-picker/model-picker.tsx +270 -0
- package/src/components/nav-main/index.ts +1 -0
- package/src/components/nav-main/nav-main.tsx +147 -0
- package/src/components/nav-notifications/index.ts +5 -0
- package/src/components/nav-notifications/nav-notifications.test.tsx +15 -0
- package/src/components/nav-notifications/nav-notifications.tsx +70 -0
- package/src/components/nav-user/index.ts +1 -0
- package/src/components/nav-user/nav-user.test.tsx +29 -0
- package/src/components/nav-user/nav-user.tsx +114 -0
- package/src/components/navigation-menu/index.ts +10 -0
- package/src/components/navigation-menu/navigation-menu.stories.tsx +92 -0
- package/src/components/navigation-menu/navigation-menu.tsx +99 -0
- package/src/components/number-input/index.ts +1 -0
- package/src/components/number-input/number-input.stories.tsx +120 -0
- package/src/components/number-input/number-input.test.tsx +96 -0
- package/src/components/number-input/number-input.tsx +219 -0
- package/src/components/page-shell/index.ts +1 -0
- package/src/components/page-shell/page-shell.stories.tsx +105 -0
- package/src/components/page-shell/page-shell.test.tsx +57 -0
- package/src/components/page-shell/page-shell.tsx +62 -0
- package/src/components/pagination/index.ts +9 -0
- package/src/components/pagination/pagination.stories.tsx +57 -0
- package/src/components/pagination/pagination.tsx +77 -0
- package/src/components/popover/index.ts +1 -0
- package/src/components/popover/popover.stories.tsx +28 -0
- package/src/components/popover/popover.test.tsx +16 -0
- package/src/components/popover/popover.tsx +29 -0
- package/src/components/progress/index.ts +1 -0
- package/src/components/progress/progress.stories.tsx +80 -0
- package/src/components/progress/progress.test.tsx +35 -0
- package/src/components/progress/progress.tsx +50 -0
- package/src/components/radio-group/index.ts +1 -0
- package/src/components/radio-group/radio-group.stories.tsx +75 -0
- package/src/components/radio-group/radio-group.test.tsx +16 -0
- package/src/components/radio-group/radio-group.tsx +33 -0
- package/src/components/rating/index.ts +1 -0
- package/src/components/rating/rating.stories.tsx +111 -0
- package/src/components/rating/rating.test.tsx +41 -0
- package/src/components/rating/rating.tsx +226 -0
- package/src/components/resizable/index.ts +1 -0
- package/src/components/resizable/resizable.stories.tsx +25 -0
- package/src/components/resizable/resizable.tsx +40 -0
- package/src/components/reveal/index.ts +7 -0
- package/src/components/reveal/reveal.stories.tsx +90 -0
- package/src/components/reveal/reveal.test.tsx +43 -0
- package/src/components/reveal/reveal.tsx +95 -0
- package/src/components/revision-timeline/index.ts +10 -0
- package/src/components/revision-timeline/revision-timeline.stories.tsx +785 -0
- package/src/components/revision-timeline/revision-timeline.test.tsx +509 -0
- package/src/components/revision-timeline/revision-timeline.tsx +1107 -0
- package/src/components/scroll-area/index.ts +1 -0
- package/src/components/scroll-area/scroll-area.stories.tsx +45 -0
- package/src/components/scroll-area/scroll-area.tsx +43 -0
- package/src/components/section-header/index.ts +1 -0
- package/src/components/section-header/section-header.stories.tsx +20 -0
- package/src/components/section-header/section-header.tsx +36 -0
- package/src/components/segmented-field/index.ts +5 -0
- package/src/components/segmented-field/segmented-field.stories.tsx +121 -0
- package/src/components/segmented-field/segmented-field.test.tsx +163 -0
- package/src/components/segmented-field/segmented-field.tsx +235 -0
- package/src/components/select/index.ts +10 -0
- package/src/components/select/select.stories.tsx +106 -0
- package/src/components/select/select.test.tsx +98 -0
- package/src/components/select/select.tsx +230 -0
- package/src/components/separator/index.ts +2 -0
- package/src/components/separator/separator.stories.tsx +87 -0
- package/src/components/separator/separator.tsx +51 -0
- package/src/components/sheet/index.ts +12 -0
- package/src/components/sheet/sheet.stories.tsx +65 -0
- package/src/components/sheet/sheet.tsx +109 -0
- package/src/components/sidebar/index.ts +27 -0
- package/src/components/sidebar/sidebar.stories.tsx +69 -0
- package/src/components/sidebar/sidebar.test.tsx +43 -0
- package/src/components/sidebar/sidebar.tsx +688 -0
- package/src/components/skeleton/index.ts +1 -0
- package/src/components/skeleton/skeleton.stories.tsx +28 -0
- package/src/components/skeleton/skeleton.tsx +15 -0
- package/src/components/slider/index.ts +1 -0
- package/src/components/slider/slider.stories.tsx +211 -0
- package/src/components/slider/slider.test.tsx +168 -0
- package/src/components/slider/slider.tsx +136 -0
- package/src/components/slider-number/index.ts +1 -0
- package/src/components/slider-number/slider-number.stories.tsx +123 -0
- package/src/components/slider-number/slider-number.test.tsx +165 -0
- package/src/components/slider-number/slider-number.tsx +191 -0
- package/src/components/sonner/index.ts +1 -0
- package/src/components/sonner/sonner.stories.tsx +124 -0
- package/src/components/sonner/sonner.test.tsx +76 -0
- package/src/components/sonner/sonner.tsx +101 -0
- package/src/components/spinner/index.ts +1 -0
- package/src/components/spinner/spinner.stories.tsx +27 -0
- package/src/components/spinner/spinner.tsx +19 -0
- package/src/components/split-panel/index.ts +1 -0
- package/src/components/split-panel/split-panel.stories.tsx +60 -0
- package/src/components/split-panel/split-panel.test.tsx +38 -0
- package/src/components/split-panel/split-panel.tsx +95 -0
- package/src/components/state-panel/index.ts +1 -0
- package/src/components/state-panel/state-panel.stories.tsx +80 -0
- package/src/components/state-panel/state-panel.test.tsx +64 -0
- package/src/components/state-panel/state-panel.tsx +167 -0
- package/src/components/status-badge/index.ts +18 -0
- package/src/components/status-badge/status-badge.stories.tsx +132 -0
- package/src/components/status-badge/status-badge.test.tsx +189 -0
- package/src/components/status-badge/status-badge.tsx +330 -0
- package/src/components/switch/index.ts +1 -0
- package/src/components/switch/switch.stories.tsx +58 -0
- package/src/components/switch/switch.test.tsx +12 -0
- package/src/components/switch/switch.tsx +29 -0
- package/src/components/table/index.ts +10 -0
- package/src/components/table/table.stories.tsx +53 -0
- package/src/components/table/table.test.tsx +17 -0
- package/src/components/table/table.tsx +106 -0
- package/src/components/tabs/index.ts +1 -0
- package/src/components/tabs/tabs.stories.tsx +267 -0
- package/src/components/tabs/tabs.test.tsx +94 -0
- package/src/components/tabs/tabs.tsx +170 -0
- package/src/components/tag-input/index.ts +1 -0
- package/src/components/tag-input/tag-input.stories.tsx +120 -0
- package/src/components/tag-input/tag-input.test.tsx +97 -0
- package/src/components/tag-input/tag-input.tsx +253 -0
- package/src/components/team-switcher/index.ts +1 -0
- package/src/components/team-switcher/team-switcher.test.tsx +39 -0
- package/src/components/team-switcher/team-switcher.tsx +100 -0
- package/src/components/textarea/index.ts +1 -0
- package/src/components/textarea/textarea.stories.tsx +42 -0
- package/src/components/textarea/textarea.tsx +24 -0
- package/src/components/theme-switcher/index.ts +2 -0
- package/src/components/theme-switcher/theme-switcher.stories.tsx +146 -0
- package/src/components/theme-switcher/theme-switcher.test.tsx +253 -0
- package/src/components/theme-switcher/theme-switcher.tsx +280 -0
- package/src/components/theme-switcher/use-theme-transition.ts +62 -0
- package/src/components/timeline/index.ts +13 -0
- package/src/components/timeline/timeline.stories.tsx +99 -0
- package/src/components/timeline/timeline.test.tsx +196 -0
- package/src/components/timeline/timeline.tsx +188 -0
- package/src/components/toggle/index.ts +1 -0
- package/src/components/toggle/toggle.stories.tsx +116 -0
- package/src/components/toggle/toggle.test.tsx +119 -0
- package/src/components/toggle/toggle.tsx +64 -0
- package/src/components/toggle-group/index.ts +1 -0
- package/src/components/toggle-group/toggle-group.stories.tsx +110 -0
- package/src/components/toggle-group/toggle-group.tsx +59 -0
- package/src/components/toolbar/index.ts +14 -0
- package/src/components/toolbar/toolbar.stories.tsx +126 -0
- package/src/components/toolbar/toolbar.test.tsx +73 -0
- package/src/components/toolbar/toolbar.tsx +177 -0
- package/src/components/tooltip/index.ts +1 -0
- package/src/components/tooltip/tooltip.stories.tsx +67 -0
- package/src/components/tooltip/tooltip.tsx +27 -0
- package/src/components/top-nav/index.ts +1 -0
- package/src/components/top-nav/top-nav.stories.tsx +18 -0
- package/src/components/top-nav/top-nav.tsx +34 -0
- package/src/components/transfer/index.ts +2 -0
- package/src/components/transfer/transfer.stories.tsx +162 -0
- package/src/components/transfer/transfer.test.tsx +177 -0
- package/src/components/transfer/transfer.tsx +481 -0
- package/src/components/tree/index.ts +6 -0
- package/src/components/tree/tree.stories.tsx +618 -0
- package/src/components/tree/tree.test.tsx +699 -0
- package/src/components/tree/tree.tsx +1149 -0
- package/src/components/tree/use-tree-keyboard.ts +314 -0
- package/src/components/tree-select/index.ts +1 -0
- package/src/components/tree-select/tree-select.stories.tsx +127 -0
- package/src/components/tree-select/tree-select.test.tsx +40 -0
- package/src/components/tree-select/tree-select.tsx +137 -0
- package/src/components/typography/index.ts +31 -0
- package/src/components/typography/prose.test.tsx +48 -0
- package/src/components/typography/prose.tsx +194 -0
- package/src/components/typography/typography.stories.tsx +244 -0
- package/src/components/typography/typography.test.tsx +140 -0
- package/src/components/typography/typography.tsx +126 -0
- package/src/components/view-toolbar/index.ts +10 -0
- package/src/components/view-toolbar/view-toolbar.stories.tsx +342 -0
- package/src/components/view-toolbar/view-toolbar.test.tsx +262 -0
- package/src/components/view-toolbar/view-toolbar.tsx +320 -0
- package/src/components/virtual-select/index.ts +2 -0
- package/src/components/virtual-select/use-virtual-listbox.ts +132 -0
- package/src/components/virtual-select/virtual-select.stories.tsx +203 -0
- package/src/components/virtual-select/virtual-select.test.tsx +106 -0
- package/src/components/virtual-select/virtual-select.tsx +361 -0
- package/src/components/wizard/index.ts +12 -0
- package/src/components/wizard/wizard.stories.tsx +148 -0
- package/src/components/wizard/wizard.test.tsx +67 -0
- package/src/components/wizard/wizard.tsx +354 -0
- package/src/decoration.stories.tsx +236 -0
- package/src/index.ts +174 -0
- package/src/lib/cn.test.ts +39 -0
- package/src/lib/cn.ts +31 -0
- package/src/lib/compact-number.ts +61 -0
- package/src/lib/document-address.test.ts +75 -0
- package/src/lib/document-address.ts +265 -0
- package/src/lib/download.ts +93 -0
- package/src/lib/file-icon.test.ts +45 -0
- package/src/lib/file-icon.ts +58 -0
- package/src/lib/file-kind.test.ts +98 -0
- package/src/lib/file-kind.ts +303 -0
- package/src/lib/file-source.test.ts +217 -0
- package/src/lib/file-source.ts +269 -0
- package/src/lib/merge-refs.test.ts +37 -0
- package/src/lib/merge-refs.ts +17 -0
- package/src/lib/streamdown-translations.ts +99 -0
- package/src/lib/use-copy-to-clipboard.ts +75 -0
- package/src/lib/use-mobile.ts +16 -0
- package/src/motion.stories.tsx +266 -0
- package/src/taste-profile.test.tsx +252 -0
- package/src/templates-object-detail-hub.stories.tsx +466 -0
- package/src/templates-screen-states.stories.tsx +306 -0
- package/src/templates-settings.stories.tsx +245 -0
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react-vite";
|
|
2
|
+
import { expect, waitFor } from "storybook/test";
|
|
3
|
+
import { SidebarInset, SidebarProvider } from "@elabs-ai/components-ui";
|
|
4
|
+
import { AppSidebar } from "./app-sidebar";
|
|
5
|
+
import { MailProvider, useMail } from "./mail-context";
|
|
6
|
+
|
|
7
|
+
function MailPreview() {
|
|
8
|
+
const { selectedMail } = useMail();
|
|
9
|
+
if (!selectedMail) {
|
|
10
|
+
return (
|
|
11
|
+
<div className="flex h-full items-center justify-center text-body text-muted-foreground">
|
|
12
|
+
Select an email to preview
|
|
13
|
+
</div>
|
|
14
|
+
);
|
|
15
|
+
}
|
|
16
|
+
return (
|
|
17
|
+
<div className="flex h-full flex-col">
|
|
18
|
+
<div className="border-b p-4">
|
|
19
|
+
<div className="text-title font-semibold">{selectedMail.subject}</div>
|
|
20
|
+
<div className="text-body text-muted-foreground">
|
|
21
|
+
From: {selectedMail.name} ({selectedMail.email})
|
|
22
|
+
</div>
|
|
23
|
+
</div>
|
|
24
|
+
<div className="whitespace-pre-wrap p-4 text-body">{`${selectedMail.teaser}\n\nThis is a sample message body for the selected email.`}</div>
|
|
25
|
+
</div>
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const meta = {
|
|
30
|
+
title: "Layout/App Shell/Mail",
|
|
31
|
+
parameters: { layout: "fullscreen" },
|
|
32
|
+
} satisfies Meta;
|
|
33
|
+
export default meta;
|
|
34
|
+
type Story = StoryObj<typeof meta>;
|
|
35
|
+
|
|
36
|
+
export const Default: Story = {
|
|
37
|
+
render: () => (
|
|
38
|
+
<SidebarProvider>
|
|
39
|
+
<MailProvider>
|
|
40
|
+
<div className="flex h-dvh w-full">
|
|
41
|
+
<AppSidebar />
|
|
42
|
+
<SidebarInset>
|
|
43
|
+
<div className="m-2 flex-1 rounded-xl border">
|
|
44
|
+
<MailPreview />
|
|
45
|
+
</div>
|
|
46
|
+
</SidebarInset>
|
|
47
|
+
</div>
|
|
48
|
+
</MailProvider>
|
|
49
|
+
</SidebarProvider>
|
|
50
|
+
),
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* #397: `layout-app-shell-mail--default` was the worst-measured real screen
|
|
55
|
+
* for the density type dial (10 of 49 scaling text nodes) because
|
|
56
|
+
* `app-sidebar.tsx`'s 8 raw `text‑sm`/`text‑xs`/`text‑base` utilities were
|
|
57
|
+
* immune to `data-density` — see `.claude/rules/styling-and-tokens.md` "Type
|
|
58
|
+
* is a role, not a size". All 8 now read a `text-<role>` utility instead, so
|
|
59
|
+
* every one of these text nodes scales. Two columns pin `data-density` on a
|
|
60
|
+
* plain wrapping div — NOT `<ThemeProvider>`, which writes `data-density` to
|
|
61
|
+
* `document.documentElement` and would race two columns — mirroring
|
|
62
|
+
* `Foundations/Typography → Density scale`'s pattern. Representative sample:
|
|
63
|
+
* one node per converted role class is enough, since every site sharing a
|
|
64
|
+
* role resolves to the identical computed style.
|
|
65
|
+
*/
|
|
66
|
+
export const DensityComparison: Story = {
|
|
67
|
+
name: "Density comparison (#397)",
|
|
68
|
+
parameters: {
|
|
69
|
+
docs: {
|
|
70
|
+
description: {
|
|
71
|
+
story:
|
|
72
|
+
"The 8 raw `text‑sm`/`text‑xs`/`text‑base` sites in `app-sidebar.tsx` " +
|
|
73
|
+
"now read `text-body`/`text-meta`/`text-subtitle`, so they scale with " +
|
|
74
|
+
"`data-density` like the rest of the shell. `text‑sm` → `text-body` " +
|
|
75
|
+
"and `text‑base` → `text-subtitle` are documented no-ops (identical " +
|
|
76
|
+
"size + line-height); `text‑xs` → `text-meta` also adopts " +
|
|
77
|
+
"`font-weight: 500` + `letter-spacing: 0.01em` (a real, deliberate " +
|
|
78
|
+
"shift, not a no-op).",
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
render: () => (
|
|
83
|
+
<div className="flex gap-8">
|
|
84
|
+
{(["compact", "comfortable", "spacious"] as const).map((mode) => (
|
|
85
|
+
<div data-density={mode} data-testid={`density-${mode}`} key={mode}>
|
|
86
|
+
<p className="mb-2 text-caption text-muted-foreground">{mode}</p>
|
|
87
|
+
<div className="flex h-[420px] w-[520px] overflow-hidden rounded-lg border">
|
|
88
|
+
<SidebarProvider>
|
|
89
|
+
<MailProvider>
|
|
90
|
+
<AppSidebar />
|
|
91
|
+
</MailProvider>
|
|
92
|
+
</SidebarProvider>
|
|
93
|
+
</div>
|
|
94
|
+
</div>
|
|
95
|
+
))}
|
|
96
|
+
</div>
|
|
97
|
+
),
|
|
98
|
+
play: async ({ canvasElement }) => {
|
|
99
|
+
const px = (el: Element) => parseFloat(getComputedStyle(el).fontSize);
|
|
100
|
+
const compact = canvasElement.querySelector('[data-testid="density-compact"]');
|
|
101
|
+
const comfortable = canvasElement.querySelector('[data-testid="density-comfortable"]');
|
|
102
|
+
const spacious = canvasElement.querySelector('[data-testid="density-spacious"]');
|
|
103
|
+
expect(compact).not.toBeNull();
|
|
104
|
+
expect(comfortable).not.toBeNull();
|
|
105
|
+
expect(spacious).not.toBeNull();
|
|
106
|
+
|
|
107
|
+
// `text‑xs` → `text-meta` sites ("Enterprise", "Labels", mail date, mail
|
|
108
|
+
// teaser): 11.25px compact / 12px comfortable / 12.75px spacious,
|
|
109
|
+
// matching Gantt's timescale.
|
|
110
|
+
await waitFor(() => {
|
|
111
|
+
expect(compact?.querySelector(".text-meta")).not.toBeNull();
|
|
112
|
+
expect(comfortable?.querySelector(".text-meta")).not.toBeNull();
|
|
113
|
+
expect(spacious?.querySelector(".text-meta")).not.toBeNull();
|
|
114
|
+
});
|
|
115
|
+
const metaCompact = compact?.querySelector(".text-meta") as Element;
|
|
116
|
+
const metaComfortable = comfortable?.querySelector(".text-meta") as Element;
|
|
117
|
+
const metaSpacious = spacious?.querySelector(".text-meta") as Element;
|
|
118
|
+
expect(px(metaComfortable)).toBe(12);
|
|
119
|
+
expect(px(metaCompact)).toBe(11.25);
|
|
120
|
+
expect(px(metaSpacious)).toBe(12.75);
|
|
121
|
+
expect(px(metaCompact)).toBeLessThan(px(metaComfortable));
|
|
122
|
+
expect(px(metaSpacious)).toBeGreaterThan(px(metaComfortable));
|
|
123
|
+
|
|
124
|
+
// `text‑sm` → `text-body` sites ("Acme Inc" wrapper, mail row): a
|
|
125
|
+
// documented visual no-op at `comfortable` (14px, identical to a pre-#397
|
|
126
|
+
// build), still scales at `compact` (13.125px) / `spacious` (14.875px).
|
|
127
|
+
const bodyCompact = compact?.querySelector(".text-body") as Element;
|
|
128
|
+
const bodyComfortable = comfortable?.querySelector(".text-body") as Element;
|
|
129
|
+
const bodySpacious = spacious?.querySelector(".text-body") as Element;
|
|
130
|
+
expect(bodyCompact).not.toBeNull();
|
|
131
|
+
expect(bodyComfortable).not.toBeNull();
|
|
132
|
+
expect(bodySpacious).not.toBeNull();
|
|
133
|
+
expect(px(bodyComfortable)).toBe(14);
|
|
134
|
+
expect(px(bodyCompact)).toBe(13.125);
|
|
135
|
+
expect(px(bodySpacious)).toBe(14.875);
|
|
136
|
+
|
|
137
|
+
// `text‑base` → `text-subtitle` site (the mail-list header title, e.g.
|
|
138
|
+
// "Inbox"): 16px comfortable (identical to a pre-#397 `text‑base` build)
|
|
139
|
+
// / 15px compact / 17px spacious.
|
|
140
|
+
const subtitleCompact = compact?.querySelector(".text-subtitle") as Element;
|
|
141
|
+
const subtitleComfortable = comfortable?.querySelector(".text-subtitle") as Element;
|
|
142
|
+
const subtitleSpacious = spacious?.querySelector(".text-subtitle") as Element;
|
|
143
|
+
expect(subtitleCompact).not.toBeNull();
|
|
144
|
+
expect(subtitleComfortable).not.toBeNull();
|
|
145
|
+
expect(subtitleSpacious).not.toBeNull();
|
|
146
|
+
expect(px(subtitleComfortable)).toBe(16);
|
|
147
|
+
expect(px(subtitleCompact)).toBe(15);
|
|
148
|
+
expect(px(subtitleSpacious)).toBe(17);
|
|
149
|
+
},
|
|
150
|
+
};
|
|
@@ -0,0 +1,375 @@
|
|
|
1
|
+
/** sidebar-05 — double-sided sidebar (copy-owned block). Adapted from blocks.so
|
|
2
|
+
* (ephraim duncan). Icons mapped from @tabler/icons-react to lucide-react. */
|
|
3
|
+
"use client";
|
|
4
|
+
|
|
5
|
+
import type React from "react";
|
|
6
|
+
import { useState } from "react";
|
|
7
|
+
import {
|
|
8
|
+
Activity,
|
|
9
|
+
Archive,
|
|
10
|
+
BarChart3,
|
|
11
|
+
Bell,
|
|
12
|
+
Bug,
|
|
13
|
+
ChevronRight,
|
|
14
|
+
Cloud,
|
|
15
|
+
Database,
|
|
16
|
+
Eye,
|
|
17
|
+
FileText,
|
|
18
|
+
Fingerprint,
|
|
19
|
+
Folder,
|
|
20
|
+
Folders,
|
|
21
|
+
Package2,
|
|
22
|
+
GitCommitHorizontal,
|
|
23
|
+
GitMerge,
|
|
24
|
+
GitPullRequest,
|
|
25
|
+
Globe,
|
|
26
|
+
Hexagon,
|
|
27
|
+
Home,
|
|
28
|
+
Key,
|
|
29
|
+
Lock,
|
|
30
|
+
Package,
|
|
31
|
+
PackageOpen,
|
|
32
|
+
Play,
|
|
33
|
+
Settings,
|
|
34
|
+
ShieldAlert,
|
|
35
|
+
ShieldCheck,
|
|
36
|
+
Sparkles,
|
|
37
|
+
Star,
|
|
38
|
+
Target,
|
|
39
|
+
Terminal,
|
|
40
|
+
User,
|
|
41
|
+
UserPlus,
|
|
42
|
+
Webhook,
|
|
43
|
+
Workflow,
|
|
44
|
+
X,
|
|
45
|
+
} from "lucide-react";
|
|
46
|
+
import {
|
|
47
|
+
NavUser,
|
|
48
|
+
Sidebar,
|
|
49
|
+
SidebarContent,
|
|
50
|
+
SidebarFooter,
|
|
51
|
+
SidebarGroup,
|
|
52
|
+
SidebarGroupContent,
|
|
53
|
+
SidebarHeader,
|
|
54
|
+
SidebarMenu,
|
|
55
|
+
SidebarMenuBadge,
|
|
56
|
+
SidebarMenuButton,
|
|
57
|
+
SidebarMenuItem,
|
|
58
|
+
TeamSwitcher,
|
|
59
|
+
cn,
|
|
60
|
+
} from "@elabs-ai/components-ui";
|
|
61
|
+
|
|
62
|
+
const data = {
|
|
63
|
+
user: { name: "ephraim", email: "ephraim@blocks.so", avatar: "" },
|
|
64
|
+
teams: [
|
|
65
|
+
{ name: "OpenAI", logo: Sparkles, plan: "Enterprise" },
|
|
66
|
+
{ name: "Anthropic", logo: Star, plan: "Pro" },
|
|
67
|
+
{ name: "Google", logo: Globe, plan: "Free" },
|
|
68
|
+
{ name: "Meta", logo: Hexagon, plan: "Free" },
|
|
69
|
+
],
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
interface NavItem {
|
|
73
|
+
id: string;
|
|
74
|
+
label: string;
|
|
75
|
+
icon: React.ComponentType<{ className?: string }>;
|
|
76
|
+
badge?: string;
|
|
77
|
+
hasSubItems?: boolean;
|
|
78
|
+
route?: string;
|
|
79
|
+
subItems?: {
|
|
80
|
+
id: string;
|
|
81
|
+
label: string;
|
|
82
|
+
icon: React.ComponentType<{ className?: string }>;
|
|
83
|
+
description?: string;
|
|
84
|
+
}[];
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
const sidebarItems: NavItem[] = [
|
|
88
|
+
{
|
|
89
|
+
id: "overview",
|
|
90
|
+
label: "Overview",
|
|
91
|
+
icon: Home,
|
|
92
|
+
hasSubItems: true,
|
|
93
|
+
subItems: [
|
|
94
|
+
{
|
|
95
|
+
id: "dashboard",
|
|
96
|
+
label: "Dashboard",
|
|
97
|
+
icon: BarChart3,
|
|
98
|
+
description: "Project overview and activity",
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
id: "activity",
|
|
102
|
+
label: "Activity",
|
|
103
|
+
icon: Activity,
|
|
104
|
+
description: "Recent commits and changes",
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
id: "insights",
|
|
108
|
+
label: "Insights",
|
|
109
|
+
icon: Target,
|
|
110
|
+
description: "Code analytics and metrics",
|
|
111
|
+
},
|
|
112
|
+
],
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
id: "repositories",
|
|
116
|
+
label: "Repositories",
|
|
117
|
+
icon: Folders,
|
|
118
|
+
badge: "12",
|
|
119
|
+
hasSubItems: true,
|
|
120
|
+
subItems: [
|
|
121
|
+
{
|
|
122
|
+
id: "all-repos",
|
|
123
|
+
label: "All Repositories",
|
|
124
|
+
icon: Folder,
|
|
125
|
+
description: "Browse all your repositories",
|
|
126
|
+
},
|
|
127
|
+
{ id: "starred", label: "Starred", icon: Star, description: "Your starred repositories" },
|
|
128
|
+
{ id: "archived", label: "Archived", icon: Archive, description: "Archived repositories" },
|
|
129
|
+
],
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
id: "pull-requests",
|
|
133
|
+
label: "Pull Requests",
|
|
134
|
+
icon: GitPullRequest,
|
|
135
|
+
badge: "3",
|
|
136
|
+
hasSubItems: true,
|
|
137
|
+
subItems: [
|
|
138
|
+
{ id: "open-prs", label: "Open", icon: GitPullRequest, description: "Open pull requests" },
|
|
139
|
+
{
|
|
140
|
+
id: "review",
|
|
141
|
+
label: "Review Requests",
|
|
142
|
+
icon: Eye,
|
|
143
|
+
description: "PRs awaiting your review",
|
|
144
|
+
},
|
|
145
|
+
{ id: "merged", label: "Merged", icon: GitMerge, description: "Recently merged PRs" },
|
|
146
|
+
],
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
id: "issues",
|
|
150
|
+
label: "Issues",
|
|
151
|
+
icon: Bug,
|
|
152
|
+
badge: "7",
|
|
153
|
+
hasSubItems: true,
|
|
154
|
+
subItems: [
|
|
155
|
+
{ id: "open-issues", label: "Open Issues", icon: Bug, description: "Active issues and bugs" },
|
|
156
|
+
{
|
|
157
|
+
id: "assigned",
|
|
158
|
+
label: "Assigned to Me",
|
|
159
|
+
icon: UserPlus,
|
|
160
|
+
description: "Issues assigned to you",
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
id: "created",
|
|
164
|
+
label: "Created by Me",
|
|
165
|
+
icon: GitCommitHorizontal,
|
|
166
|
+
description: "Issues you've created",
|
|
167
|
+
},
|
|
168
|
+
],
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
id: "actions",
|
|
172
|
+
label: "Actions",
|
|
173
|
+
icon: Workflow,
|
|
174
|
+
hasSubItems: true,
|
|
175
|
+
subItems: [
|
|
176
|
+
{
|
|
177
|
+
id: "workflows",
|
|
178
|
+
label: "Workflows",
|
|
179
|
+
icon: Play,
|
|
180
|
+
description: "CI/CD workflows and pipelines",
|
|
181
|
+
},
|
|
182
|
+
{ id: "runners", label: "Runners", icon: Terminal, description: "Self-hosted runners" },
|
|
183
|
+
{ id: "deployments", label: "Deployments", icon: Cloud, description: "Deployment history" },
|
|
184
|
+
],
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
id: "packages",
|
|
188
|
+
label: "Packages",
|
|
189
|
+
icon: Package,
|
|
190
|
+
hasSubItems: true,
|
|
191
|
+
subItems: [
|
|
192
|
+
{
|
|
193
|
+
id: "published",
|
|
194
|
+
label: "Published",
|
|
195
|
+
icon: PackageOpen,
|
|
196
|
+
description: "Your published packages",
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
id: "containers",
|
|
200
|
+
label: "Container Registry",
|
|
201
|
+
icon: Database,
|
|
202
|
+
description: "Docker images and containers",
|
|
203
|
+
},
|
|
204
|
+
{ id: "npm", label: "npm Packages", icon: Package2, description: "Node.js packages" },
|
|
205
|
+
],
|
|
206
|
+
},
|
|
207
|
+
{
|
|
208
|
+
id: "security",
|
|
209
|
+
label: "Security",
|
|
210
|
+
icon: Lock,
|
|
211
|
+
badge: "2",
|
|
212
|
+
hasSubItems: true,
|
|
213
|
+
subItems: [
|
|
214
|
+
{
|
|
215
|
+
id: "alerts",
|
|
216
|
+
label: "Security Alerts",
|
|
217
|
+
icon: ShieldAlert,
|
|
218
|
+
description: "Vulnerability alerts",
|
|
219
|
+
},
|
|
220
|
+
{
|
|
221
|
+
id: "advisories",
|
|
222
|
+
label: "Advisories",
|
|
223
|
+
icon: ShieldCheck,
|
|
224
|
+
description: "Security advisories",
|
|
225
|
+
},
|
|
226
|
+
{ id: "secrets", label: "Secrets", icon: Fingerprint, description: "Repository secrets" },
|
|
227
|
+
],
|
|
228
|
+
},
|
|
229
|
+
{
|
|
230
|
+
id: "settings",
|
|
231
|
+
label: "Settings",
|
|
232
|
+
icon: Settings,
|
|
233
|
+
hasSubItems: true,
|
|
234
|
+
subItems: [
|
|
235
|
+
{ id: "profile", label: "Profile", icon: User, description: "Your profile settings" },
|
|
236
|
+
{
|
|
237
|
+
id: "notifications",
|
|
238
|
+
label: "Notifications",
|
|
239
|
+
icon: Bell,
|
|
240
|
+
description: "Notification preferences",
|
|
241
|
+
},
|
|
242
|
+
{ id: "webhooks", label: "Webhooks", icon: Webhook, description: "Webhook configurations" },
|
|
243
|
+
{ id: "api-keys", label: "API Keys", icon: Key, description: "Personal access tokens" },
|
|
244
|
+
],
|
|
245
|
+
},
|
|
246
|
+
{ id: "docs", label: "Documentation", icon: FileText, hasSubItems: false, route: "/docs" },
|
|
247
|
+
];
|
|
248
|
+
|
|
249
|
+
export function AppSidebar() {
|
|
250
|
+
const [activeItem, setActiveItem] = useState<string | null>("overview");
|
|
251
|
+
const [selectedSubItem, setSelectedSubItem] = useState<string | null>(null);
|
|
252
|
+
const activeItemData = sidebarItems.find((item) => item.id === activeItem);
|
|
253
|
+
|
|
254
|
+
const handleItemClick = (item: NavItem) => {
|
|
255
|
+
if (item.hasSubItems) {
|
|
256
|
+
const isActive = activeItem === item.id;
|
|
257
|
+
setActiveItem(isActive ? null : item.id);
|
|
258
|
+
if (isActive) setSelectedSubItem(null);
|
|
259
|
+
} else {
|
|
260
|
+
setActiveItem(null);
|
|
261
|
+
setSelectedSubItem(null);
|
|
262
|
+
}
|
|
263
|
+
};
|
|
264
|
+
|
|
265
|
+
return (
|
|
266
|
+
<div className="flex h-dvh bg-background">
|
|
267
|
+
<Sidebar side="left" variant="sidebar" collapsible="none" className="w-64 border-e">
|
|
268
|
+
<SidebarHeader>
|
|
269
|
+
<TeamSwitcher teams={data.teams} />
|
|
270
|
+
</SidebarHeader>
|
|
271
|
+
<SidebarContent>
|
|
272
|
+
<SidebarGroup>
|
|
273
|
+
<SidebarGroupContent>
|
|
274
|
+
<SidebarMenu>
|
|
275
|
+
{sidebarItems.map((item) => {
|
|
276
|
+
const Icon = item.icon;
|
|
277
|
+
const isActive = activeItem === item.id;
|
|
278
|
+
const chevron = (
|
|
279
|
+
<ChevronRight
|
|
280
|
+
className={cn(
|
|
281
|
+
"h-4 w-4 shrink-0 transition-transform",
|
|
282
|
+
isActive && "rotate-90",
|
|
283
|
+
)}
|
|
284
|
+
/>
|
|
285
|
+
);
|
|
286
|
+
return (
|
|
287
|
+
<SidebarMenuItem key={item.id}>
|
|
288
|
+
<SidebarMenuButton
|
|
289
|
+
isActive={isActive}
|
|
290
|
+
className="h-10 w-full px-3"
|
|
291
|
+
onClick={() => handleItemClick(item)}
|
|
292
|
+
>
|
|
293
|
+
<div className="flex min-w-0 flex-1 items-center gap-3">
|
|
294
|
+
<Icon className="h-4 w-4 shrink-0" />
|
|
295
|
+
<span className="truncate">{item.label}</span>
|
|
296
|
+
</div>
|
|
297
|
+
<div className="ms-auto flex min-w-fit shrink-0 items-center gap-1">
|
|
298
|
+
{(item.badge || item.hasSubItems) &&
|
|
299
|
+
(item.badge ? (
|
|
300
|
+
<SidebarMenuBadge
|
|
301
|
+
className={cn("min-w-fit", item.hasSubItems && "gap-x-3")}
|
|
302
|
+
>
|
|
303
|
+
{item.badge}
|
|
304
|
+
{item.hasSubItems && chevron}
|
|
305
|
+
</SidebarMenuBadge>
|
|
306
|
+
) : (
|
|
307
|
+
chevron
|
|
308
|
+
))}
|
|
309
|
+
</div>
|
|
310
|
+
</SidebarMenuButton>
|
|
311
|
+
</SidebarMenuItem>
|
|
312
|
+
);
|
|
313
|
+
})}
|
|
314
|
+
</SidebarMenu>
|
|
315
|
+
</SidebarGroupContent>
|
|
316
|
+
</SidebarGroup>
|
|
317
|
+
</SidebarContent>
|
|
318
|
+
<SidebarFooter>
|
|
319
|
+
<NavUser user={data.user} />
|
|
320
|
+
</SidebarFooter>
|
|
321
|
+
</Sidebar>
|
|
322
|
+
|
|
323
|
+
{activeItem && activeItemData?.subItems && (
|
|
324
|
+
<Sidebar
|
|
325
|
+
side="left"
|
|
326
|
+
variant="sidebar"
|
|
327
|
+
collapsible="none"
|
|
328
|
+
className="w-72 animate-in slide-in-from-left-5 border-e duration-base ease-entrance"
|
|
329
|
+
>
|
|
330
|
+
<SidebarHeader className="flex flex-row items-center justify-between border-b px-4">
|
|
331
|
+
<h3 className="font-medium">{activeItemData.label}</h3>
|
|
332
|
+
<button
|
|
333
|
+
onClick={() => setActiveItem(null)}
|
|
334
|
+
className="flex h-6 w-6 items-center justify-center rounded-md p-0 hover:bg-sidebar-accent"
|
|
335
|
+
aria-label="Close panel"
|
|
336
|
+
>
|
|
337
|
+
<X className="h-4 w-4" />
|
|
338
|
+
</button>
|
|
339
|
+
</SidebarHeader>
|
|
340
|
+
<SidebarContent>
|
|
341
|
+
<SidebarGroup>
|
|
342
|
+
<SidebarGroupContent>
|
|
343
|
+
<SidebarMenu>
|
|
344
|
+
{activeItemData.subItems.map((subItem) => {
|
|
345
|
+
const SubIcon = subItem.icon;
|
|
346
|
+
const isSelected = selectedSubItem === subItem.id;
|
|
347
|
+
return (
|
|
348
|
+
<SidebarMenuItem key={subItem.id}>
|
|
349
|
+
<SidebarMenuButton
|
|
350
|
+
isActive={isSelected}
|
|
351
|
+
className="h-auto w-full justify-start gap-3 px-3 py-2"
|
|
352
|
+
onClick={() => setSelectedSubItem(isSelected ? null : subItem.id)}
|
|
353
|
+
>
|
|
354
|
+
<SubIcon className="mt-0.5 h-5 w-5 shrink-0 self-start" />
|
|
355
|
+
<div className="min-w-0 flex-1 text-start">
|
|
356
|
+
<div className="font-medium">{subItem.label}</div>
|
|
357
|
+
{subItem.description && (
|
|
358
|
+
<div className="mt-0.5 text-xs text-muted-foreground">
|
|
359
|
+
{subItem.description}
|
|
360
|
+
</div>
|
|
361
|
+
)}
|
|
362
|
+
</div>
|
|
363
|
+
</SidebarMenuButton>
|
|
364
|
+
</SidebarMenuItem>
|
|
365
|
+
);
|
|
366
|
+
})}
|
|
367
|
+
</SidebarMenu>
|
|
368
|
+
</SidebarGroupContent>
|
|
369
|
+
</SidebarGroup>
|
|
370
|
+
</SidebarContent>
|
|
371
|
+
</Sidebar>
|
|
372
|
+
)}
|
|
373
|
+
</div>
|
|
374
|
+
);
|
|
375
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react-vite";
|
|
2
|
+
import { SidebarProvider } from "@elabs-ai/components-ui";
|
|
3
|
+
import { AppSidebar } from "./app-sidebar";
|
|
4
|
+
|
|
5
|
+
const meta = {
|
|
6
|
+
title: "Layout/App Shell/Double-Sided",
|
|
7
|
+
parameters: { layout: "fullscreen" },
|
|
8
|
+
} satisfies Meta;
|
|
9
|
+
export default meta;
|
|
10
|
+
type Story = StoryObj<typeof meta>;
|
|
11
|
+
|
|
12
|
+
export const Default: Story = {
|
|
13
|
+
render: () => (
|
|
14
|
+
<SidebarProvider>
|
|
15
|
+
<AppSidebar />
|
|
16
|
+
</SidebarProvider>
|
|
17
|
+
),
|
|
18
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* sidebar-05 — team switcher. The shared `TeamSwitcher` nav primitive lives in
|
|
3
|
+
* `@elabs-ai/components-ui` (#99); this block re-exports it rather than forking a local copy
|
|
4
|
+
* (which drifts). The block's `app-sidebar.tsx` already imports it from `@elabs-ai/components-ui`.
|
|
5
|
+
*/
|
|
6
|
+
export { TeamSwitcher } from "@elabs-ai/components-ui";
|