@devxcrew/react-ui 0.0.0-stage → 0.1.7
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 +85 -2
- package/package.json +105 -4
- package/src/blocks/agent-chat-workspace/agent-chat-workspace.tsx +162 -0
- package/src/blocks/agent-chat-workspace/index.ts +2 -0
- package/src/blocks/agent-provider-settings/agent-provider-settings.tsx +183 -0
- package/src/blocks/agent-provider-settings/index.ts +2 -0
- package/src/blocks/agent-task-workspace/agent-task-workspace.tsx +48 -0
- package/src/blocks/agent-task-workspace/index.ts +2 -0
- package/src/blocks/analysis-context/analysis-context.tsx +6 -0
- package/src/blocks/analysis-context/index.ts +1 -0
- package/src/blocks/app-header/app-header.tsx +159 -0
- package/src/blocks/app-header/index.ts +2 -0
- package/src/blocks/archived-chat-workspace/archived-chat-workspace.tsx +29 -0
- package/src/blocks/archived-chat-workspace/index.ts +2 -0
- package/src/blocks/auth/README.md +32 -0
- package/src/blocks/auth/admin-login-page.tsx +15 -0
- package/src/blocks/auth/admin-password-forgot-page.tsx +5 -0
- package/src/blocks/auth/auth-page-layout.tsx +90 -0
- package/src/blocks/auth/client-login-page.tsx +20 -0
- package/src/blocks/auth/client-password-forgot-page.tsx +5 -0
- package/src/blocks/auth/identity-management-desk.tsx +530 -0
- package/src/blocks/auth/index.ts +12 -0
- package/src/blocks/auth/login-page.tsx +206 -0
- package/src/blocks/auth/password-forgot-page.tsx +60 -0
- package/src/blocks/auth/portal-pages.tsx +32 -0
- package/src/blocks/auth/privileged-desk.tsx +55 -0
- package/src/blocks/auth/register-page.tsx +117 -0
- package/src/blocks/auth/session-boundary.tsx +296 -0
- package/src/blocks/auth/super-admin-login-page.tsx +15 -0
- package/src/blocks/auth/super-admin-password-forgot-page.tsx +5 -0
- package/src/blocks/blog/blog-card.tsx +156 -0
- package/src/blocks/blog/blog-reader.tsx +175 -0
- package/src/blocks/blog/blog-types.ts +47 -0
- package/src/blocks/blog/index.ts +3 -0
- package/src/blocks/chat-composer/chat-composer.tsx +140 -0
- package/src/blocks/chat-composer/index.ts +1 -0
- package/src/blocks/chat-history/chat-history.tsx +59 -0
- package/src/blocks/chat-history/index.ts +1 -0
- package/src/blocks/chat-response-progress/chat-response-progress.tsx +34 -0
- package/src/blocks/chat-response-progress/index.ts +2 -0
- package/src/blocks/chat-runtime-controls/chat-runtime-controls.tsx +56 -0
- package/src/blocks/chat-runtime-controls/index.ts +2 -0
- package/src/blocks/chat-runtime-trace/chat-runtime-trace.tsx +71 -0
- package/src/blocks/chat-runtime-trace/index.ts +2 -0
- package/src/blocks/codex-connection-settings/codex-connection-settings.tsx +42 -0
- package/src/blocks/codex-connection-settings/index.ts +1 -0
- package/src/blocks/dropzone/dropzone-file-item.tsx +113 -0
- package/src/blocks/dropzone/dropzone-types.ts +32 -0
- package/src/blocks/dropzone/dropzone.tsx +216 -0
- package/src/blocks/dropzone/index.ts +3 -0
- package/src/blocks/ecommerce/cart/cart-drawer.tsx +228 -0
- package/src/blocks/ecommerce/cart/cart-types.ts +27 -0
- package/src/blocks/ecommerce/cart/index.ts +2 -0
- package/src/blocks/ecommerce/categories/categories-types.ts +23 -0
- package/src/blocks/ecommerce/categories/category-showcase.tsx +125 -0
- package/src/blocks/ecommerce/categories/index.ts +2 -0
- package/src/blocks/ecommerce/checkout/checkout-types.ts +48 -0
- package/src/blocks/ecommerce/checkout/checkout-wizard.tsx +468 -0
- package/src/blocks/ecommerce/checkout/index.ts +2 -0
- package/src/blocks/ecommerce/comparison/comparison-types.ts +28 -0
- package/src/blocks/ecommerce/comparison/index.ts +2 -0
- package/src/blocks/ecommerce/comparison/product-comparison.tsx +174 -0
- package/src/blocks/ecommerce/coupon-wallet/coupon-wallet-types.ts +21 -0
- package/src/blocks/ecommerce/coupon-wallet/coupon-wallet.tsx +154 -0
- package/src/blocks/ecommerce/coupon-wallet/index.ts +2 -0
- package/src/blocks/ecommerce/delivery-tracker/delivery-tracker-types.ts +20 -0
- package/src/blocks/ecommerce/delivery-tracker/delivery-tracker.tsx +169 -0
- package/src/blocks/ecommerce/delivery-tracker/index.ts +2 -0
- package/src/blocks/ecommerce/index.ts +12 -0
- package/src/blocks/ecommerce/payment-methods/index.ts +2 -0
- package/src/blocks/ecommerce/payment-methods/payment-method-selector.tsx +224 -0
- package/src/blocks/ecommerce/payment-methods/payment-methods-types.ts +21 -0
- package/src/blocks/ecommerce/price-history/index.ts +2 -0
- package/src/blocks/ecommerce/price-history/price-history-chart.tsx +217 -0
- package/src/blocks/ecommerce/price-history/price-history-types.ts +16 -0
- package/src/blocks/ecommerce/reviews/index.ts +2 -0
- package/src/blocks/ecommerce/reviews/reviews-section.tsx +309 -0
- package/src/blocks/ecommerce/reviews/reviews-types.ts +26 -0
- package/src/blocks/ecommerce/wishlist/index.ts +2 -0
- package/src/blocks/ecommerce/wishlist/wishlist-grid.tsx +149 -0
- package/src/blocks/ecommerce/wishlist/wishlist-types.ts +19 -0
- package/src/blocks/execution-status/README.md +25 -0
- package/src/blocks/execution-status/execution-status.tsx +135 -0
- package/src/blocks/execution-status/index.ts +2 -0
- package/src/blocks/file-tree/file-icons.tsx +84 -0
- package/src/blocks/file-tree/file-tree-node.tsx +158 -0
- package/src/blocks/file-tree/file-tree-types.ts +33 -0
- package/src/blocks/file-tree/file-tree.tsx +163 -0
- package/src/blocks/file-tree/index.ts +5 -0
- package/src/blocks/filter-builder/filter-builder.tsx +169 -0
- package/src/blocks/filter-builder/filter-row.tsx +164 -0
- package/src/blocks/filter-builder/filter-types.ts +61 -0
- package/src/blocks/filter-builder/index.ts +12 -0
- package/src/blocks/footer/footer-types.ts +35 -0
- package/src/blocks/footer/index.ts +2 -0
- package/src/blocks/footer/site-footer.tsx +212 -0
- package/src/blocks/form/form-block.tsx +113 -0
- package/src/blocks/form/form-lookup-field.tsx +60 -0
- package/src/blocks/form/index.ts +4 -0
- package/src/blocks/handover-stack/handover-stack.tsx +41 -0
- package/src/blocks/handover-stack/index.ts +1 -0
- package/src/blocks/idea-handover/idea-handover-readiness.ts +41 -0
- package/src/blocks/idea-handover/idea-handover-workspace.tsx +150 -0
- package/src/blocks/idea-handover/index.ts +4 -0
- package/src/blocks/kanban/index.ts +11 -0
- package/src/blocks/kanban/kanban-board.tsx +146 -0
- package/src/blocks/kanban/kanban-card.tsx +149 -0
- package/src/blocks/kanban/kanban-column.tsx +102 -0
- package/src/blocks/kanban/kanban-types.ts +38 -0
- package/src/blocks/loader/global-loader.tsx +90 -0
- package/src/blocks/loader/index.ts +1 -0
- package/src/blocks/mascot/README.md +21 -0
- package/src/blocks/mascot/index.ts +2 -0
- package/src/blocks/mascot/mascot.tsx +202 -0
- package/src/blocks/master-list/README.md +21 -0
- package/src/blocks/master-list/index.ts +12 -0
- package/src/blocks/master-list/master-form.tsx +157 -0
- package/src/blocks/master-list/master-list-desk.tsx +370 -0
- package/src/blocks/master-list/master-list.tsx +189 -0
- package/src/blocks/master-list/types.ts +18 -0
- package/src/blocks/mermaid-preview/index.ts +1 -0
- package/src/blocks/mermaid-preview/mermaid-preview.tsx +164 -0
- package/src/blocks/notifications/README.md +7 -0
- package/src/blocks/notifications/index.ts +1 -0
- package/src/blocks/notifications/notification-center-page.tsx +73 -0
- package/src/blocks/pricing/index.ts +7 -0
- package/src/blocks/pricing/pricing-table.tsx +173 -0
- package/src/blocks/pricing/pricing-types.ts +34 -0
- package/src/blocks/product-card/index.ts +2 -0
- package/src/blocks/product-card/product-card-types.ts +35 -0
- package/src/blocks/product-card/product-card.tsx +183 -0
- package/src/blocks/table/data-table-block.tsx +313 -0
- package/src/blocks/table/data-table-filter-menu.tsx +48 -0
- package/src/blocks/table/data-table-icon-menu-trigger.tsx +44 -0
- package/src/blocks/table/data-table-menu-content.tsx +32 -0
- package/src/blocks/table/data-table-pagination.tsx +149 -0
- package/src/blocks/table/data-table-row-actions.tsx +53 -0
- package/src/blocks/table/data-table-status.tsx +42 -0
- package/src/blocks/table/data-table-toolbar.tsx +124 -0
- package/src/blocks/table/data-table-totals.tsx +31 -0
- package/src/blocks/table/index.ts +13 -0
- package/src/blocks/workspace/index.ts +19 -0
- package/src/blocks/workspace/workspace-action-card.tsx +73 -0
- package/src/blocks/workspace/workspace-application-header.tsx +67 -0
- package/src/blocks/workspace/workspace-entity-card.tsx +48 -0
- package/src/blocks/workspace/workspace-health-summary.tsx +15 -0
- package/src/blocks/workspace/workspace-metric-card.tsx +97 -0
- package/src/blocks/workspace/workspace-page-header.tsx +43 -0
- package/src/blocks/workspace/workspace-publish-status.tsx +15 -0
- package/src/blocks/workspace/workspace-route-checklist.tsx +28 -0
- package/src/blocks/workspace/workspace-runtime-status.tsx +48 -0
- package/src/blocks/workspace/workspace-section-card.tsx +42 -0
- package/src/components/accordion.tsx +65 -0
- package/src/components/alert-dialog.tsx +160 -0
- package/src/components/alert.tsx +68 -0
- package/src/components/aspect-ratio.tsx +22 -0
- package/src/components/attachment.tsx +195 -0
- package/src/components/avatar.tsx +90 -0
- package/src/components/badge.tsx +55 -0
- package/src/components/breadcrumb.tsx +100 -0
- package/src/components/bubble.tsx +123 -0
- package/src/components/button-group.tsx +79 -0
- package/src/components/button.tsx +71 -0
- package/src/components/calendar.tsx +185 -0
- package/src/components/card.tsx +100 -0
- package/src/components/carousel.tsx +229 -0
- package/src/components/chart.tsx +338 -0
- package/src/components/checkbox.tsx +27 -0
- package/src/components/collapsible.tsx +15 -0
- package/src/components/combobox.tsx +269 -0
- package/src/components/command.tsx +181 -0
- package/src/components/compact-model-switcher.tsx +128 -0
- package/src/components/context-menu.tsx +244 -0
- package/src/components/dialog.tsx +138 -0
- package/src/components/direction.tsx +1 -0
- package/src/components/drawer.tsx +208 -0
- package/src/components/dropdown-menu.tsx +257 -0
- package/src/components/empty.tsx +93 -0
- package/src/components/field.tsx +232 -0
- package/src/components/hover-card.tsx +45 -0
- package/src/components/input-group.tsx +146 -0
- package/src/components/input-otp.tsx +83 -0
- package/src/components/input.tsx +19 -0
- package/src/components/item.tsx +188 -0
- package/src/components/kbd.tsx +26 -0
- package/src/components/label.tsx +17 -0
- package/src/components/markdown-content.tsx +113 -0
- package/src/components/marker.tsx +67 -0
- package/src/components/menubar.tsx +267 -0
- package/src/components/message-scroller.tsx +91 -0
- package/src/components/message.tsx +84 -0
- package/src/components/native-select.tsx +54 -0
- package/src/components/navigation-menu.tsx +160 -0
- package/src/components/pagination.tsx +118 -0
- package/src/components/popover.tsx +74 -0
- package/src/components/progress.tsx +82 -0
- package/src/components/questionnaire.tsx +150 -0
- package/src/components/radio-group.tsx +35 -0
- package/src/components/resizable.tsx +41 -0
- package/src/components/rich-text-editor.tsx +604 -0
- package/src/components/scroll-area.tsx +47 -0
- package/src/components/select.tsx +189 -0
- package/src/components/separator.tsx +18 -0
- package/src/components/sheet.tsx +125 -0
- package/src/components/sidebar.tsx +693 -0
- package/src/components/skeleton.tsx +13 -0
- package/src/components/slider.tsx +51 -0
- package/src/components/sonner.tsx +45 -0
- package/src/components/sparkline.tsx +231 -0
- package/src/components/spinner.tsx +20 -0
- package/src/components/status-badge.tsx +114 -0
- package/src/components/switch.tsx +31 -0
- package/src/components/table.tsx +91 -0
- package/src/components/tabs.tsx +72 -0
- package/src/components/textarea.tsx +17 -0
- package/src/components/toast.tsx +222 -0
- package/src/components/toggle-group.tsx +85 -0
- package/src/components/toggle.tsx +42 -0
- package/src/components/tooltip.tsx +53 -0
- package/src/design-system/README.md +55 -0
- package/src/design-system/action-intents.ts +21 -0
- package/src/design-system/agent-manifest.ts +83 -0
- package/src/design-system/block-registry.ts +272 -0
- package/src/design-system/component-registry.ts +142 -0
- package/src/design-system/contracts.ts +69 -0
- package/src/design-system/defaults.ts +3 -0
- package/src/design-system/index.ts +29 -0
- package/src/design-system/mcp-server.ts +156 -0
- package/src/design-system/page-registry.ts +74 -0
- package/src/design-system/selection.ts +67 -0
- package/src/design-system/template-registry.ts +33 -0
- package/src/features/interface-topology/index.ts +14 -0
- package/src/features/interface-topology/interface-topology.types.ts +40 -0
- package/src/features/interface-topology/topology-control.tsx +18 -0
- package/src/features/interface-topology/topology-inspector.tsx +228 -0
- package/src/features/interface-topology/topology-marker.tsx +47 -0
- package/src/features/interface-topology/topology-region.tsx +44 -0
- package/src/features/interface-topology/use-interface-topology.ts +178 -0
- package/src/hooks/use-mobile.ts +19 -0
- package/src/hooks/use-scroll-follow.ts +22 -0
- package/src/index.ts +11 -0
- package/src/layouts/README.md +65 -0
- package/src/layouts/agent-workspace/agent-activity-rail.tsx +101 -0
- package/src/layouts/agent-workspace/agent-workspace.tsx +27 -0
- package/src/layouts/agent-workspace/agent-workspace.types.ts +28 -0
- package/src/layouts/agent-workspace/index.ts +7 -0
- package/src/layouts/blog-header/blog-header-types.ts +25 -0
- package/src/layouts/blog-header/blog-header.tsx +172 -0
- package/src/layouts/blog-header/index.ts +2 -0
- package/src/layouts/documentation-workspace/README.md +8 -0
- package/src/layouts/documentation-workspace/documentation-workspace.tsx +34 -0
- package/src/layouts/documentation-workspace/index.ts +1 -0
- package/src/layouts/ecommerce-header/ecommerce-actions.tsx +89 -0
- package/src/layouts/ecommerce-header/ecommerce-announcement.tsx +43 -0
- package/src/layouts/ecommerce-header/ecommerce-drawer.tsx +97 -0
- package/src/layouts/ecommerce-header/ecommerce-header-types.ts +59 -0
- package/src/layouts/ecommerce-header/ecommerce-header.tsx +47 -0
- package/src/layouts/ecommerce-header/ecommerce-navigation.tsx +98 -0
- package/src/layouts/ecommerce-header/ecommerce-search.tsx +86 -0
- package/src/layouts/ecommerce-header/index.ts +2 -0
- package/src/layouts/main-workspace/index.ts +28 -0
- package/src/layouts/mdi/index.ts +1 -0
- package/src/layouts/mdi/mdi.tsx +20 -0
- package/src/layouts/mdi-main/index.ts +27 -0
- package/src/layouts/mdi-main/mdi-app-catalog.generated.ts +159 -0
- package/src/layouts/mdi-main/mdi-app-catalog.ts +76 -0
- package/src/layouts/mdi-main/mdi-app-switcher.tsx +107 -0
- package/src/layouts/mdi-main/mdi-feature-settings.tsx +135 -0
- package/src/layouts/mdi-main/mdi-global-search.tsx +192 -0
- package/src/layouts/mdi-main/mdi-main.tsx +241 -0
- package/src/layouts/mdi-main/mdi-notifications-menu.tsx +197 -0
- package/src/layouts/mdi-main/mdi-profile-menu.tsx +79 -0
- package/src/layouts/mdi-main/mdi-sidebar-navigation.tsx +226 -0
- package/src/layouts/mdi-main/mdi-sidebar.tsx +110 -0
- package/src/layouts/mdi-main/mdi-status-bar.tsx +26 -0
- package/src/layouts/mdi-main/mdi-top-menu-control.ts +4 -0
- package/src/layouts/mdi-main/mdi-top-menu.tsx +117 -0
- package/src/layouts/mdi-main/mdi-topology.tsx +297 -0
- package/src/layouts/mdi-main/mdi-tweak-panel.tsx +104 -0
- package/src/layouts/mdi-main/mdi-types.ts +131 -0
- package/src/layouts/mdi-main/use-mdi-features.ts +36 -0
- package/src/layouts/mdi-main/use-mdi-sidebar-state.ts +59 -0
- package/src/layouts/site-header/announcement-bar.tsx +55 -0
- package/src/layouts/site-header/category-strip.tsx +41 -0
- package/src/layouts/site-header/index.ts +16 -0
- package/src/layouts/site-header/main-navbar.tsx +179 -0
- package/src/layouts/site-header/mobile-drawer.tsx +140 -0
- package/src/layouts/site-header/site-header-types.ts +63 -0
- package/src/layouts/site-header/site-header.tsx +58 -0
- package/src/lib/random-id.ts +19 -0
- package/src/lib/utils.ts +6 -0
- package/src/providers/pdf-provider.ts +137 -0
- package/src/styles/globals.css +374 -0
- package/src/templates/README.md +12 -0
- package/src/templates/dashboard-01/components/app-sidebar.tsx +177 -0
- package/src/templates/dashboard-01/components/chart-area-interactive.tsx +276 -0
- package/src/templates/dashboard-01/components/data-table-cell-viewer.tsx +213 -0
- package/src/templates/dashboard-01/components/data-table.tsx +577 -0
- package/src/templates/dashboard-01/components/nav-documents.tsx +79 -0
- package/src/templates/dashboard-01/components/nav-main.tsx +55 -0
- package/src/templates/dashboard-01/components/nav-secondary.tsx +39 -0
- package/src/templates/dashboard-01/components/nav-user.tsx +97 -0
- package/src/templates/dashboard-01/components/section-cards.tsx +99 -0
- package/src/templates/dashboard-01/components/site-header.tsx +14 -0
- package/src/templates/dashboard-01/data.json +614 -0
- package/src/templates/dashboard-01/index.ts +7 -0
- package/src/templates/documentation-sidebar/app-sidebar.tsx +95 -0
- package/src/templates/documentation-sidebar/index.ts +2 -0
- package/src/templates/sidebar-07/components/app-sidebar.tsx +175 -0
- package/src/templates/sidebar-07/components/nav-main.tsx +64 -0
- package/src/templates/sidebar-07/components/nav-projects.tsx +79 -0
- package/src/templates/sidebar-07/components/nav-user.tsx +105 -0
- package/src/templates/sidebar-07/components/team-switcher.tsx +94 -0
- package/src/templates/sidebar-07/index.ts +1 -0
- package/src/templates/ui-page/index.ts +7 -0
- package/src/templates/ui-page/ui-browser-frame.tsx +27 -0
- package/src/templates/ui-page/ui-template-code.tsx +48 -0
- package/src/templates/ui-page/ui-template-header.tsx +87 -0
- package/src/templates/ui-page/ui-template-navigation.tsx +60 -0
- package/src/templates/ui-page/ui-template-page.tsx +97 -0
- package/src/theme/index.ts +12 -0
- package/src/theme/theme-config.ts +30 -0
- package/src/theme/theme-provider.tsx +142 -0
- package/src/theme/theme-selector.tsx +75 -0
- package/src/tokens/index.ts +15 -0
- package/src/vite-env.d.ts +3 -0
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
import { ChevronRightIcon, LayoutDashboardIcon } from 'lucide-react'
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
Collapsible,
|
|
5
|
+
CollapsibleContent,
|
|
6
|
+
CollapsibleTrigger,
|
|
7
|
+
} from '@devxcrew/react-ui/components/collapsible'
|
|
8
|
+
import {
|
|
9
|
+
SidebarGroup,
|
|
10
|
+
SidebarGroupContent,
|
|
11
|
+
SidebarGroupLabel,
|
|
12
|
+
SidebarMenu,
|
|
13
|
+
SidebarMenuBadge,
|
|
14
|
+
SidebarMenuButton,
|
|
15
|
+
SidebarMenuItem,
|
|
16
|
+
SidebarMenuSub,
|
|
17
|
+
SidebarMenuSubButton,
|
|
18
|
+
SidebarMenuSubItem,
|
|
19
|
+
} from '@devxcrew/react-ui/components/sidebar'
|
|
20
|
+
import { cn } from '@devxcrew/react-ui/lib/utils'
|
|
21
|
+
|
|
22
|
+
import type { MdiNavigationItem, MdiNavigationSection } from './mdi-types'
|
|
23
|
+
import { usePersistentOpenState } from './use-mdi-sidebar-state'
|
|
24
|
+
|
|
25
|
+
export function NavigationSection({
|
|
26
|
+
section,
|
|
27
|
+
stateKey,
|
|
28
|
+
}: {
|
|
29
|
+
section: MdiNavigationSection
|
|
30
|
+
stateKey?: string
|
|
31
|
+
}) {
|
|
32
|
+
const hasActiveItem = section.items.some(hasActiveNavigationItem)
|
|
33
|
+
const [open, setOpen] = usePersistentOpenState(stateKey, section.defaultOpen ?? hasActiveItem)
|
|
34
|
+
const SectionIcon = section.icon ?? LayoutDashboardIcon
|
|
35
|
+
|
|
36
|
+
if (!section.label) {
|
|
37
|
+
return (
|
|
38
|
+
<SidebarGroup>
|
|
39
|
+
<SidebarGroupContent>
|
|
40
|
+
<NavigationItems items={section.items} stateKey={stateKey} />
|
|
41
|
+
</SidebarGroupContent>
|
|
42
|
+
</SidebarGroup>
|
|
43
|
+
)
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
return (
|
|
47
|
+
<Collapsible open={open} onOpenChange={setOpen} className="group/navigation-section">
|
|
48
|
+
<SidebarGroup className="px-2 py-0.5">
|
|
49
|
+
<SidebarGroupLabel
|
|
50
|
+
render={
|
|
51
|
+
<CollapsibleTrigger className="h-9 w-full cursor-pointer gap-2 rounded-md px-2.5 text-sm font-medium text-sidebar-foreground transition-colors hover:bg-sidebar-accent hover:text-sidebar-accent-foreground" />
|
|
52
|
+
}
|
|
53
|
+
>
|
|
54
|
+
<SectionIcon className="size-4" />
|
|
55
|
+
<span>{section.label}</span>
|
|
56
|
+
<ChevronRightIcon className="ml-auto size-4 transition-transform duration-300 ease-[cubic-bezier(0.22,1,0.36,1)] group-data-open/navigation-section:rotate-90 motion-reduce:transition-none" />
|
|
57
|
+
</SidebarGroupLabel>
|
|
58
|
+
<CollapsibleContent className="h-0 overflow-hidden opacity-0 transition-[height,opacity] duration-300 ease-[cubic-bezier(0.22,1,0.36,1)] data-open:h-[var(--collapsible-panel-height)] data-open:opacity-100 motion-reduce:transition-none">
|
|
59
|
+
<SidebarGroupContent className="ml-5 w-auto border-l border-sidebar-border/80 py-1 pr-1 pl-2.5">
|
|
60
|
+
<NavigationItems compact items={section.items} stateKey={stateKey} />
|
|
61
|
+
</SidebarGroupContent>
|
|
62
|
+
</CollapsibleContent>
|
|
63
|
+
</SidebarGroup>
|
|
64
|
+
</Collapsible>
|
|
65
|
+
)
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function NavigationItems({
|
|
69
|
+
compact = false,
|
|
70
|
+
items,
|
|
71
|
+
stateKey,
|
|
72
|
+
}: {
|
|
73
|
+
compact?: boolean
|
|
74
|
+
items: MdiNavigationItem[]
|
|
75
|
+
stateKey?: string
|
|
76
|
+
}) {
|
|
77
|
+
return (
|
|
78
|
+
<SidebarMenu>
|
|
79
|
+
{items.map((item) => (
|
|
80
|
+
<NavigationItem
|
|
81
|
+
compact={compact}
|
|
82
|
+
item={item}
|
|
83
|
+
key={`${item.label}-${item.href ?? 'group'}`}
|
|
84
|
+
stateKey={stateKey ? `${stateKey}:item:${item.label}` : undefined}
|
|
85
|
+
/>
|
|
86
|
+
))}
|
|
87
|
+
</SidebarMenu>
|
|
88
|
+
)
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
function NavigationItem({
|
|
92
|
+
compact,
|
|
93
|
+
item,
|
|
94
|
+
stateKey,
|
|
95
|
+
}: {
|
|
96
|
+
compact: boolean
|
|
97
|
+
item: MdiNavigationItem
|
|
98
|
+
stateKey?: string
|
|
99
|
+
}) {
|
|
100
|
+
const children = item.children ?? []
|
|
101
|
+
if (children.length === 0) {
|
|
102
|
+
return (
|
|
103
|
+
<SidebarMenuItem>
|
|
104
|
+
<NavigationButton compact={compact} item={item} />
|
|
105
|
+
{item.badge !== undefined ? <SidebarMenuBadge>{item.badge}</SidebarMenuBadge> : null}
|
|
106
|
+
</SidebarMenuItem>
|
|
107
|
+
)
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
return <NavigationBranch compact={compact} item={item} stateKey={stateKey} />
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
function NavigationBranch({
|
|
114
|
+
compact,
|
|
115
|
+
item,
|
|
116
|
+
nested = false,
|
|
117
|
+
stateKey,
|
|
118
|
+
}: {
|
|
119
|
+
compact: boolean
|
|
120
|
+
item: MdiNavigationItem
|
|
121
|
+
nested?: boolean
|
|
122
|
+
stateKey?: string
|
|
123
|
+
}) {
|
|
124
|
+
const children = item.children ?? []
|
|
125
|
+
const containsActive = children.some(hasActiveNavigationItem)
|
|
126
|
+
const [open, setOpen] = usePersistentOpenState(stateKey, item.defaultOpen ?? containsActive)
|
|
127
|
+
const Icon = item.icon
|
|
128
|
+
|
|
129
|
+
const content = (
|
|
130
|
+
<Collapsible open={open} onOpenChange={setOpen} className="group/navigation-branch">
|
|
131
|
+
<CollapsibleTrigger
|
|
132
|
+
className={cn(
|
|
133
|
+
'flex h-8 w-full cursor-pointer items-center gap-2 rounded-md px-2 text-left text-sm text-sidebar-foreground transition-colors hover:bg-sidebar-accent hover:text-sidebar-accent-foreground',
|
|
134
|
+
compact && 'px-2',
|
|
135
|
+
)}
|
|
136
|
+
>
|
|
137
|
+
{Icon ? <Icon className="size-4 shrink-0" /> : <span className="size-4 shrink-0" />}
|
|
138
|
+
<span className="min-w-0 flex-1 truncate font-medium">{item.label}</span>
|
|
139
|
+
<ChevronRightIcon className="size-3.5 shrink-0 transition-transform duration-200 group-data-open/navigation-branch:rotate-90 motion-reduce:transition-none" />
|
|
140
|
+
</CollapsibleTrigger>
|
|
141
|
+
<CollapsibleContent className="h-0 overflow-hidden opacity-0 transition-[height,opacity] duration-200 ease-out data-open:h-[var(--collapsible-panel-height)] data-open:opacity-100 motion-reduce:transition-none">
|
|
142
|
+
<SidebarMenuSub className="my-1 mr-0 ml-3.5">
|
|
143
|
+
{children.map((child) => (
|
|
144
|
+
<SidebarMenuSubItem key={`${child.label}-${child.href ?? 'group'}`}>
|
|
145
|
+
<NavigationSubtree
|
|
146
|
+
item={child}
|
|
147
|
+
stateKey={stateKey ? `${stateKey}:child:${child.label}` : undefined}
|
|
148
|
+
/>
|
|
149
|
+
</SidebarMenuSubItem>
|
|
150
|
+
))}
|
|
151
|
+
</SidebarMenuSub>
|
|
152
|
+
</CollapsibleContent>
|
|
153
|
+
</Collapsible>
|
|
154
|
+
)
|
|
155
|
+
|
|
156
|
+
return nested ? content : <SidebarMenuItem>{content}</SidebarMenuItem>
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
function NavigationSubtree({ item, stateKey }: { item: MdiNavigationItem; stateKey?: string }) {
|
|
160
|
+
const children = item.children ?? []
|
|
161
|
+
if (children.length === 0) return <NavigationSubButton item={item} />
|
|
162
|
+
|
|
163
|
+
return <NavigationBranch compact item={item} nested stateKey={stateKey} />
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
function NavigationSubButton({ item }: { item: MdiNavigationItem }) {
|
|
167
|
+
const Icon = item.icon
|
|
168
|
+
const content = (
|
|
169
|
+
<>
|
|
170
|
+
{Icon ? <Icon /> : <span className="size-4 shrink-0" />}
|
|
171
|
+
<span>{item.label}</span>
|
|
172
|
+
</>
|
|
173
|
+
)
|
|
174
|
+
|
|
175
|
+
return item.href ? (
|
|
176
|
+
<SidebarMenuSubButton
|
|
177
|
+
isActive={item.active}
|
|
178
|
+
render={<a href={item.href} />}
|
|
179
|
+
onClick={item.onSelect}
|
|
180
|
+
>
|
|
181
|
+
{content}
|
|
182
|
+
</SidebarMenuSubButton>
|
|
183
|
+
) : (
|
|
184
|
+
<SidebarMenuSubButton
|
|
185
|
+
isActive={item.active}
|
|
186
|
+
render={<button type="button" />}
|
|
187
|
+
onClick={item.onSelect}
|
|
188
|
+
>
|
|
189
|
+
{content}
|
|
190
|
+
</SidebarMenuSubButton>
|
|
191
|
+
)
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
function hasActiveNavigationItem(item: MdiNavigationItem): boolean {
|
|
195
|
+
return item.active === true || item.children?.some(hasActiveNavigationItem) === true
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
function NavigationButton({ compact, item }: { compact: boolean; item: MdiNavigationItem }) {
|
|
199
|
+
const Icon = item.icon
|
|
200
|
+
const content = (
|
|
201
|
+
<>
|
|
202
|
+
{Icon ? <Icon /> : <span className="size-4 shrink-0" />}
|
|
203
|
+
<span>{item.label}</span>
|
|
204
|
+
</>
|
|
205
|
+
)
|
|
206
|
+
|
|
207
|
+
return item.href ? (
|
|
208
|
+
<SidebarMenuButton
|
|
209
|
+
className={compact ? 'h-8 px-2' : undefined}
|
|
210
|
+
isActive={item.active}
|
|
211
|
+
render={<a href={item.href} />}
|
|
212
|
+
onClick={item.onSelect}
|
|
213
|
+
>
|
|
214
|
+
{content}
|
|
215
|
+
</SidebarMenuButton>
|
|
216
|
+
) : (
|
|
217
|
+
<SidebarMenuButton
|
|
218
|
+
className={compact ? 'h-8 px-2' : undefined}
|
|
219
|
+
isActive={item.active}
|
|
220
|
+
render={<button type="button" />}
|
|
221
|
+
onClick={item.onSelect}
|
|
222
|
+
>
|
|
223
|
+
{content}
|
|
224
|
+
</SidebarMenuButton>
|
|
225
|
+
)
|
|
226
|
+
}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { PlusIcon, Settings2Icon } from "lucide-react";
|
|
2
|
+
import type { ReactNode } from "react";
|
|
3
|
+
|
|
4
|
+
import { Button } from "@devxcrew/react-ui/components/button";
|
|
5
|
+
import {
|
|
6
|
+
Sidebar,
|
|
7
|
+
SidebarContent,
|
|
8
|
+
SidebarFooter,
|
|
9
|
+
SidebarGroup,
|
|
10
|
+
SidebarMenu,
|
|
11
|
+
SidebarMenuButton,
|
|
12
|
+
SidebarMenuItem,
|
|
13
|
+
SidebarRail,
|
|
14
|
+
} from "@devxcrew/react-ui/components/sidebar";
|
|
15
|
+
import { cn } from "@devxcrew/react-ui/lib/utils";
|
|
16
|
+
import { TopologyMarker, TopologyRegion } from "../../features/interface-topology";
|
|
17
|
+
|
|
18
|
+
import { NavigationSection } from "./mdi-sidebar-navigation";
|
|
19
|
+
import type { MdiNavigationSection, MdiPrimaryAction } from "./mdi-types";
|
|
20
|
+
import { useMdiTopology } from "./mdi-topology";
|
|
21
|
+
import { usePersistentScrollPosition } from "./use-mdi-sidebar-state";
|
|
22
|
+
|
|
23
|
+
type MdiSidebarProps = {
|
|
24
|
+
navigation: MdiNavigationSection[];
|
|
25
|
+
onOpenFeatures: () => void;
|
|
26
|
+
primaryAction?: MdiPrimaryAction | null;
|
|
27
|
+
sidebarContent?: ReactNode;
|
|
28
|
+
sidebarContentClassName?: string;
|
|
29
|
+
sidebarFooter?: ReactNode | null;
|
|
30
|
+
sidebarFooterClassName?: string;
|
|
31
|
+
stateKey?: string;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export function MdiSidebar({
|
|
35
|
+
navigation,
|
|
36
|
+
onOpenFeatures,
|
|
37
|
+
primaryAction,
|
|
38
|
+
sidebarContent,
|
|
39
|
+
sidebarContentClassName,
|
|
40
|
+
sidebarFooter,
|
|
41
|
+
sidebarFooterClassName,
|
|
42
|
+
stateKey,
|
|
43
|
+
}: MdiSidebarProps) {
|
|
44
|
+
const topology = useMdiTopology();
|
|
45
|
+
const PrimaryActionIcon = primaryAction?.icon ?? PlusIcon;
|
|
46
|
+
const scrollPosition = usePersistentScrollPosition(stateKey ? `${stateKey}:scroll-position` : undefined);
|
|
47
|
+
|
|
48
|
+
return (
|
|
49
|
+
<Sidebar
|
|
50
|
+
className="absolute h-full data-[ito-highlighted=true]:ring-2 data-[ito-highlighted=true]:ring-inset data-[ito-highlighted=true]:ring-violet-700"
|
|
51
|
+
collapsible="offcanvas"
|
|
52
|
+
{...topology.regionProps("02")}
|
|
53
|
+
>
|
|
54
|
+
<TopologyMarker id="02" topology={topology} />
|
|
55
|
+
<SidebarContent
|
|
56
|
+
className={cn("scrollbar-gutter-stable scrollbar-slim pt-0", sidebarContentClassName)}
|
|
57
|
+
{...scrollPosition}
|
|
58
|
+
>
|
|
59
|
+
{primaryAction ? (
|
|
60
|
+
<TopologyRegion as={SidebarGroup} className="px-3 pt-3" id="02.2" topology={topology}>
|
|
61
|
+
<Button className="w-full justify-start" variant="secondary" onClick={primaryAction.onSelect}>
|
|
62
|
+
<PrimaryActionIcon />
|
|
63
|
+
{primaryAction.label}
|
|
64
|
+
</Button>
|
|
65
|
+
</TopologyRegion>
|
|
66
|
+
) : null}
|
|
67
|
+
{sidebarContent !== undefined ? (
|
|
68
|
+
sidebarContent
|
|
69
|
+
) : (
|
|
70
|
+
<TopologyRegion as="div" className="min-h-0 flex-1" id="02.3" topology={topology}>
|
|
71
|
+
{navigation.map((section, index) => (
|
|
72
|
+
<NavigationSection
|
|
73
|
+
key={section.label ?? index}
|
|
74
|
+
section={section}
|
|
75
|
+
stateKey={stateKey ? `${stateKey}:section:${section.label ?? index}` : undefined}
|
|
76
|
+
/>
|
|
77
|
+
))}
|
|
78
|
+
</TopologyRegion>
|
|
79
|
+
)}
|
|
80
|
+
</SidebarContent>
|
|
81
|
+
{sidebarFooter === undefined ? (
|
|
82
|
+
<TopologyRegion
|
|
83
|
+
as={SidebarFooter}
|
|
84
|
+
className={cn("border-t p-3", sidebarFooterClassName)}
|
|
85
|
+
id="02.4"
|
|
86
|
+
topology={topology}
|
|
87
|
+
>
|
|
88
|
+
<SidebarMenu>
|
|
89
|
+
<SidebarMenuItem>
|
|
90
|
+
<SidebarMenuButton render={<button type="button" />} onClick={onOpenFeatures}>
|
|
91
|
+
<Settings2Icon />
|
|
92
|
+
<span>Settings</span>
|
|
93
|
+
</SidebarMenuButton>
|
|
94
|
+
</SidebarMenuItem>
|
|
95
|
+
</SidebarMenu>
|
|
96
|
+
</TopologyRegion>
|
|
97
|
+
) : sidebarFooter === null ? null : (
|
|
98
|
+
<SidebarFooter className={cn("border-t p-3", sidebarFooterClassName)}>{sidebarFooter}</SidebarFooter>
|
|
99
|
+
)}
|
|
100
|
+
<TopologyRegion
|
|
101
|
+
as="div"
|
|
102
|
+
className="pointer-events-none absolute inset-y-0 right-0 w-4 [&>[data-ito-marker]]:left-auto [&>[data-ito-marker]]:right-2 [&>[data-ito-marker]]:top-20"
|
|
103
|
+
id="02.5"
|
|
104
|
+
topology={topology}
|
|
105
|
+
>
|
|
106
|
+
<SidebarRail className="pointer-events-auto" />
|
|
107
|
+
</TopologyRegion>
|
|
108
|
+
</Sidebar>
|
|
109
|
+
);
|
|
110
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Separator } from '@devxcrew/react-ui/components/separator'
|
|
2
|
+
import type { ReactNode } from 'react'
|
|
3
|
+
import { TopologyMarker } from '../../features/interface-topology'
|
|
4
|
+
import { useMdiTopology } from './mdi-topology'
|
|
5
|
+
|
|
6
|
+
type MdiStatusBarProps = {
|
|
7
|
+
statusLabel: string
|
|
8
|
+
statusEnd?: ReactNode
|
|
9
|
+
workspaceTitle: string
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export function MdiStatusBar({ statusEnd, statusLabel, workspaceTitle }: MdiStatusBarProps) {
|
|
13
|
+
const topology = useMdiTopology()
|
|
14
|
+
return (
|
|
15
|
+
<footer
|
|
16
|
+
className="relative flex h-7 shrink-0 items-center border-t bg-muted/30 px-3 text-xs text-muted-foreground data-[ito-highlighted=true]:ring-2 data-[ito-highlighted=true]:ring-inset data-[ito-highlighted=true]:ring-violet-700"
|
|
17
|
+
{...topology.regionProps('04')}
|
|
18
|
+
>
|
|
19
|
+
<TopologyMarker id="04" topology={topology} />
|
|
20
|
+
<span>{statusLabel}</span>
|
|
21
|
+
<Separator orientation="vertical" className="mx-2 h-3" />
|
|
22
|
+
<span className="truncate">{workspaceTitle}</span>
|
|
23
|
+
{statusEnd ? <span className="ml-auto shrink-0">{statusEnd}</span> : null}
|
|
24
|
+
</footer>
|
|
25
|
+
)
|
|
26
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export const mdiTopMenuSurfaceClassName =
|
|
2
|
+
'border border-border/80 bg-background text-foreground shadow-sm transition-colors hover:bg-muted/60 focus-visible:ring-2 focus-visible:ring-ring'
|
|
3
|
+
|
|
4
|
+
export const mdiTopMenuButtonClassName = `${mdiTopMenuSurfaceClassName} relative size-10 rounded-full p-0`
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { MenuIcon, type LucideIcon } from 'lucide-react'
|
|
2
|
+
|
|
3
|
+
import { Button } from '@devxcrew/react-ui/components/button'
|
|
4
|
+
import { useSidebar } from '@devxcrew/react-ui/components/sidebar'
|
|
5
|
+
import { TopologyMarker, TopologyRegion } from '../../features/interface-topology'
|
|
6
|
+
|
|
7
|
+
import { MdiAppSwitcher } from './mdi-app-switcher'
|
|
8
|
+
import { MdiGlobalSearch } from './mdi-global-search'
|
|
9
|
+
import { MdiNotificationsMenu } from './mdi-notifications-menu'
|
|
10
|
+
import { MdiProfileMenu } from './mdi-profile-menu'
|
|
11
|
+
import { useMdiTopology } from './mdi-topology'
|
|
12
|
+
import type {
|
|
13
|
+
MdiAppItem,
|
|
14
|
+
MdiFeatures,
|
|
15
|
+
MdiNavigationSection,
|
|
16
|
+
MdiNotification,
|
|
17
|
+
MdiUser,
|
|
18
|
+
} from './mdi-types'
|
|
19
|
+
|
|
20
|
+
type MdiTopMenuProps = {
|
|
21
|
+
applicationIcon: LucideIcon
|
|
22
|
+
applicationLogoUrl?: string
|
|
23
|
+
applicationName: string
|
|
24
|
+
apps: MdiAppItem[]
|
|
25
|
+
features: MdiFeatures
|
|
26
|
+
notificationCount: number
|
|
27
|
+
notifications: readonly MdiNotification[]
|
|
28
|
+
navigation: MdiNavigationSection[]
|
|
29
|
+
searchPlaceholder: string
|
|
30
|
+
searchValue?: string
|
|
31
|
+
user: MdiUser
|
|
32
|
+
onSearchChange?: (value: string) => void
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export function MdiTopMenu({
|
|
36
|
+
applicationIcon: ApplicationIcon,
|
|
37
|
+
applicationLogoUrl,
|
|
38
|
+
applicationName,
|
|
39
|
+
apps,
|
|
40
|
+
features,
|
|
41
|
+
notificationCount,
|
|
42
|
+
notifications,
|
|
43
|
+
navigation,
|
|
44
|
+
searchPlaceholder,
|
|
45
|
+
searchValue,
|
|
46
|
+
user,
|
|
47
|
+
onSearchChange,
|
|
48
|
+
}: MdiTopMenuProps) {
|
|
49
|
+
const { toggleSidebar } = useSidebar()
|
|
50
|
+
const topology = useMdiTopology()
|
|
51
|
+
|
|
52
|
+
return (
|
|
53
|
+
<header
|
|
54
|
+
className="relative flex h-14 shrink-0 items-center border-t-4 border-t-emerald-50 border-b border-b-border bg-background shadow-sm data-[ito-highlighted=true]:ring-2 data-[ito-highlighted=true]:ring-inset data-[ito-highlighted=true]:ring-violet-700"
|
|
55
|
+
{...topology.regionProps('01')}
|
|
56
|
+
>
|
|
57
|
+
<TopologyMarker id="01" topology={topology} />
|
|
58
|
+
<TopologyRegion
|
|
59
|
+
as="div"
|
|
60
|
+
className="grid h-full w-14 shrink-0 place-items-center border-r"
|
|
61
|
+
id="01.1"
|
|
62
|
+
topology={topology}
|
|
63
|
+
>
|
|
64
|
+
<Button
|
|
65
|
+
variant="ghost"
|
|
66
|
+
size="icon-sm"
|
|
67
|
+
onClick={toggleSidebar}
|
|
68
|
+
aria-label="Toggle application navigation"
|
|
69
|
+
>
|
|
70
|
+
<MenuIcon />
|
|
71
|
+
</Button>
|
|
72
|
+
</TopologyRegion>
|
|
73
|
+
<div className="flex min-w-0 flex-1 items-center gap-5 px-5">
|
|
74
|
+
<TopologyRegion
|
|
75
|
+
as="div"
|
|
76
|
+
className="flex w-24 shrink-0 items-center gap-2 text-sm font-semibold"
|
|
77
|
+
id="01.2"
|
|
78
|
+
topology={topology}
|
|
79
|
+
>
|
|
80
|
+
{applicationLogoUrl ? (
|
|
81
|
+
<img alt="" className="size-7 shrink-0 object-contain" src={applicationLogoUrl} />
|
|
82
|
+
) : (
|
|
83
|
+
<ApplicationIcon className="size-4" />
|
|
84
|
+
)}
|
|
85
|
+
<span className="truncate">{applicationName}</span>
|
|
86
|
+
</TopologyRegion>
|
|
87
|
+
<div className="ml-auto flex shrink-0 items-center gap-2">
|
|
88
|
+
<TopologyRegion as="div" id="01.3" topology={topology}>
|
|
89
|
+
<MdiGlobalSearch
|
|
90
|
+
applicationName={applicationName}
|
|
91
|
+
apps={apps}
|
|
92
|
+
navigation={navigation}
|
|
93
|
+
onSearchChange={onSearchChange}
|
|
94
|
+
placeholder={searchPlaceholder}
|
|
95
|
+
value={searchValue}
|
|
96
|
+
/>
|
|
97
|
+
</TopologyRegion>
|
|
98
|
+
{features.notifications ? (
|
|
99
|
+
<TopologyRegion as="div" id="01.4" topology={topology}>
|
|
100
|
+
<MdiNotificationsMenu count={notificationCount} notifications={notifications} />
|
|
101
|
+
</TopologyRegion>
|
|
102
|
+
) : null}
|
|
103
|
+
{features.appSwitcher ? (
|
|
104
|
+
<TopologyRegion as="div" id="01.5" topology={topology}>
|
|
105
|
+
<MdiAppSwitcher apps={apps} />
|
|
106
|
+
</TopologyRegion>
|
|
107
|
+
) : null}
|
|
108
|
+
{features.profileMenu ? (
|
|
109
|
+
<TopologyRegion as="div" id="01.6" topology={topology}>
|
|
110
|
+
<MdiProfileMenu user={user} />
|
|
111
|
+
</TopologyRegion>
|
|
112
|
+
) : null}
|
|
113
|
+
</div>
|
|
114
|
+
</div>
|
|
115
|
+
</header>
|
|
116
|
+
)
|
|
117
|
+
}
|