this.gui 1.3.41 → 1.3.42
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/package.json +3 -2
- package/src/GUI.tsx +46 -0
- package/src/QRouter/QRegistry.tsx +53 -0
- package/src/QRouter/QRouter.stories.tsx +31 -0
- package/src/QRouter/QRouter.tsx +57 -0
- package/src/gui/Theme/GuiProvider.tsx +111 -0
- package/src/gui/Theme/Icon/Icon.resolver.tsx +29 -0
- package/src/gui/Theme/Icon/Icon.tsx +43 -0
- package/src/gui/Theme/Layout/Content/Content.resolver.tsx +0 -0
- package/src/gui/Theme/Layout/Content/Content.stories.tsx +88 -0
- package/src/gui/Theme/Layout/Content/Content.tsx +53 -0
- package/src/gui/Theme/Layout/Content/Content.types.tsx +40 -0
- package/src/gui/Theme/Layout/Footer/Footer.resolver.tsx +45 -0
- package/src/gui/Theme/Layout/Footer/Footer.stories.tsx +205 -0
- package/src/gui/Theme/Layout/Footer/Footer.tsx +337 -0
- package/src/gui/Theme/Layout/Footer/Footer.types.ts +40 -0
- package/src/gui/Theme/Layout/Layout/Layout.resolver.tsx +37 -0
- package/src/gui/Theme/Layout/Layout/Layout.stories.tsx +289 -0
- package/src/gui/Theme/Layout/Layout/Layout.tsx +117 -0
- package/src/gui/Theme/Layout/Layout/Layout.types.ts +57 -0
- package/src/gui/Theme/Layout/Layout/useLayoutBreakpoints.ts +9 -0
- package/src/gui/Theme/Layout/Namespace/Namespace.stories.tsx +105 -0
- package/src/gui/Theme/Layout/Namespace/Namespace.tsx +26 -0
- package/src/gui/Theme/Layout/Sidebars/LeftSidebar/LeftSidebar.resolver.tsx +87 -0
- package/src/gui/Theme/Layout/Sidebars/LeftSidebar/LeftSidebar.stories.tsx +199 -0
- package/src/gui/Theme/Layout/Sidebars/LeftSidebar/LeftSidebar.tsx +311 -0
- package/src/gui/Theme/Layout/Sidebars/LeftSidebar/LeftSidebar.types.ts +41 -0
- package/src/gui/Theme/Layout/Sidebars/LeftSidebar/SidebarToggleButton.tsx +53 -0
- package/src/gui/Theme/Layout/Sidebars/LeftSidebar/components/LeftSidebarAction/LeftSidebarAction.resolver.tsx +19 -0
- package/src/gui/Theme/Layout/Sidebars/LeftSidebar/components/LeftSidebarAction/LeftSidebarAction.tsx +107 -0
- package/src/gui/Theme/Layout/Sidebars/LeftSidebar/components/LeftSidebarLink/LeftSidebarLink.resolver.tsx +0 -0
- package/src/gui/Theme/Layout/Sidebars/LeftSidebar/components/LeftSidebarLink/LeftSidebarLink.tsx +134 -0
- package/src/gui/Theme/Layout/Sidebars/LeftSidebar/components/LeftSidebarLink/LeftSidebarLink.types.ts +15 -0
- package/src/gui/Theme/Layout/Sidebars/LeftSidebar/components/LeftSidebarMenu/LeftSidebarMenu.tsx +142 -0
- package/src/gui/Theme/Layout/Sidebars/LeftSidebar/components/LeftSidebarToggleButton/LeftSidebarToggleButton.tsx +23 -0
- package/src/gui/Theme/Layout/Sidebars/RightSidebar/RightSidebar.resolver.tsx +35 -0
- package/src/gui/Theme/Layout/Sidebars/RightSidebar/RightSidebar.stories.tsx +239 -0
- package/src/gui/Theme/Layout/Sidebars/RightSidebar/RightSidebar.tsx +319 -0
- package/src/gui/Theme/Layout/Sidebars/RightSidebar/RightSidebar.types.ts +17 -0
- package/src/gui/Theme/Layout/Sidebars/RightSidebar/components/RightSidebarAction/RightSidebarAction.tsx +102 -0
- package/src/gui/Theme/Layout/Sidebars/RightSidebar/components/RightSidebarLink/RightSidebarLink.tsx +132 -0
- package/src/gui/Theme/Layout/Sidebars/RightSidebar/components/RightSidebarMenu/RightSidebarMenu.tsx +140 -0
- package/src/gui/Theme/Layout/Sidebars/RightSidebar/components/RightSidebarToggleButton/RightSidebarToggleButton.tsx +22 -0
- package/src/gui/Theme/Layout/StickyOptions/StickyOptionsTop.stories.tsx +469 -0
- package/src/gui/Theme/Layout/StickyOptions/StickyOptionsTop.tsx +489 -0
- package/src/gui/Theme/Layout/TopBar/TopBar.resolver.tsx +86 -0
- package/src/gui/Theme/Layout/TopBar/TopBar.stories.tsx +350 -0
- package/src/gui/Theme/Layout/TopBar/TopBar.tsx +292 -0
- package/src/gui/Theme/Layout/TopBar/TopBar.types.ts +39 -0
- package/src/gui/Theme/Layout/TopBar/components/TopBarAction/TopBarAction.stories.tsx +83 -0
- package/src/gui/Theme/Layout/TopBar/components/TopBarAction/TopBarAction.tsx +18 -0
- package/src/gui/Theme/Layout/TopBar/components/TopBarAction/TopBarAction.types.ts +4 -0
- package/src/gui/Theme/Layout/TopBar/components/TopBarLink/TopBarLink.stories.tsx +189 -0
- package/src/gui/Theme/Layout/TopBar/components/TopBarLink/TopBarLink.tsx +30 -0
- package/src/gui/Theme/Layout/TopBar/components/TopBarLink/TopBarLink.types.ts +9 -0
- package/src/gui/Theme/Layout/TopBar/components/TopBarMenu/TopBarMenu.resolver.tsx +14 -0
- package/src/gui/Theme/Layout/TopBar/components/TopBarMenu/TopBarMenu.stories.tsx +56 -0
- package/src/gui/Theme/Layout/TopBar/components/TopBarMenu/TopBarMenu.tsx +123 -0
- package/src/gui/Theme/Layout/TopBar/components/TopBarMenu/TopBarMenu.types.ts +44 -0
- package/src/gui/Theme/catalog/CherryByte/CherryByte.png +0 -0
- package/src/gui/Theme/catalog/CherryByte/dark.tokens.ts +47 -0
- package/src/gui/Theme/catalog/CherryByte/light.tokens.ts +47 -0
- package/src/gui/Theme/catalog/CherryByte/manifest.ts +24 -0
- package/src/gui/Theme/catalog/GhostShell/dark.tokens.ts +43 -0
- package/src/gui/Theme/catalog/GhostShell/ghost.png +0 -0
- package/src/gui/Theme/catalog/GhostShell/light.tokens.ts +39 -0
- package/src/gui/Theme/catalog/GhostShell/manifest.ts +24 -0
- package/src/gui/Theme/catalog/LunaHex/LunaHex.png +0 -0
- package/src/gui/Theme/catalog/LunaHex/dark.tokens.ts +34 -0
- package/src/gui/Theme/catalog/LunaHex/light.tokens.ts +74 -0
- package/src/gui/Theme/catalog/LunaHex/manifest.ts +24 -0
- package/src/gui/Theme/catalog/MUI/MUI.png +0 -0
- package/src/gui/Theme/catalog/MUI/dark.tokens.ts +58 -0
- package/src/gui/Theme/catalog/MUI/light.tokens.ts +74 -0
- package/src/gui/Theme/catalog/MUI/manifest.ts +24 -0
- package/src/gui/Theme/catalog/PrinceOfDarkness/dark.tokens.ts +48 -0
- package/src/gui/Theme/catalog/PrinceOfDarkness/light.tokens.ts +47 -0
- package/src/gui/Theme/catalog/PrinceOfDarkness/manifest.ts +24 -0
- package/src/gui/Theme/catalog/PrinceOfDarkness/prince.png +0 -0
- package/src/gui/Theme/catalog/PrinceOfDarkness/princeOfDarkness.png +0 -0
- package/src/gui/Theme/catalog/Seafoam/dark.tokens.ts +49 -0
- package/src/gui/Theme/catalog/Seafoam/light.tokens.ts +47 -0
- package/src/gui/Theme/catalog/Seafoam/manifest.ts +24 -0
- package/src/gui/Theme/catalog/Seafoam/seaFoam.png +0 -0
- package/src/gui/Theme/catalog/neurons/dark.tokens.ts +58 -0
- package/src/gui/Theme/catalog/neurons/light.tokens.ts +74 -0
- package/src/gui/Theme/catalog/neurons/manifest.ts +24 -0
- package/src/gui/Theme/catalog/neurons/neurons.me.png +0 -0
- package/src/gui/Theme/fromTokens.ts +272 -0
- package/src/gui/Theme/gui.css +31 -0
- package/src/gui/Theme/index.ts +17 -0
- package/src/gui/Theme/styles/buildShadows.ts +83 -0
- package/src/gui/Theme/styles/theme.tokens.ts +108 -0
- package/src/gui/Theme/utils/catalog.ts +61 -0
- package/src/gui/Theme/utils/persistence.ts +66 -0
- package/src/gui/Theme/utils/themeUtils.ts +34 -0
- package/src/gui/components/atoms/AppBar/AppBar.resolver.tsx +46 -0
- package/src/gui/components/atoms/AppBar/AppBar.stories.tsx +251 -0
- package/src/gui/components/atoms/AppBar/AppBar.tsx +107 -0
- package/src/gui/components/atoms/AppBar/AppBar.types.ts +28 -0
- package/src/gui/components/atoms/Avatar/Avatar.resolver.tsx +61 -0
- package/src/gui/components/atoms/Avatar/Avatar.stories.tsx +36 -0
- package/src/gui/components/atoms/Avatar/Avatar.tsx +14 -0
- package/src/gui/components/atoms/Box/Box.resolver.tsx +171 -0
- package/src/gui/components/atoms/Box/Box.stories.tsx +263 -0
- package/src/gui/components/atoms/Box/Box.tsx +15 -0
- package/src/gui/components/atoms/Button/Button.resolver.tsx +103 -0
- package/src/gui/components/atoms/Button/Button.stories.tsx +219 -0
- package/src/gui/components/atoms/Button/Button.tsx +40 -0
- package/src/gui/components/atoms/Card/Card.resolver.tsx +63 -0
- package/src/gui/components/atoms/Card/Card.stories.tsx +54 -0
- package/src/gui/components/atoms/Card/Card.tsx +13 -0
- package/src/gui/components/atoms/CardActions/CardActions.resolver.tsx +59 -0
- package/src/gui/components/atoms/CardActions/CardActions.stories.tsx +32 -0
- package/src/gui/components/atoms/CardActions/CardActions.tsx +14 -0
- package/src/gui/components/atoms/CardContent/CardContent.resolver.tsx +60 -0
- package/src/gui/components/atoms/CardContent/CardContent.stories.tsx +34 -0
- package/src/gui/components/atoms/CardContent/CardContent.tsx +13 -0
- package/src/gui/components/atoms/CardHeader/CardHeader.resolver.tsx +68 -0
- package/src/gui/components/atoms/CardHeader/CardHeader.stories.tsx +40 -0
- package/src/gui/components/atoms/CardHeader/CardHeader.tsx +12 -0
- package/src/gui/components/atoms/Collapse/Collapse.resolver.tsx +85 -0
- package/src/gui/components/atoms/Collapse/Collapse.stories.tsx +130 -0
- package/src/gui/components/atoms/Collapse/Collapse.tsx +17 -0
- package/src/gui/components/atoms/Divider/Divider.resolver.tsx +95 -0
- package/src/gui/components/atoms/Divider/Divider.stories.tsx +108 -0
- package/src/gui/components/atoms/Divider/Divider.tsx +14 -0
- package/src/gui/components/atoms/Drawer/Drawer.resolver.tsx +116 -0
- package/src/gui/components/atoms/Drawer/Drawer.stories.tsx +223 -0
- package/src/gui/components/atoms/Drawer/Drawer.tsx +25 -0
- package/src/gui/components/atoms/Grid/Grid.resolver.tsx +33 -0
- package/src/gui/components/atoms/Grid/Grid.stories.tsx +136 -0
- package/src/gui/components/atoms/Grid/Grid.tsx +15 -0
- package/src/gui/components/atoms/Grid/Grid.types.ts +9 -0
- package/src/gui/components/atoms/IconButton/IconButton.resolver.tsx +137 -0
- package/src/gui/components/atoms/IconButton/IconButton.stories.tsx +134 -0
- package/src/gui/components/atoms/IconButton/IconButton.tsx +22 -0
- package/src/gui/components/atoms/Link/Link.resolver.tsx +74 -0
- package/src/gui/components/atoms/Link/Link.stories.tsx +157 -0
- package/src/gui/components/atoms/Link/Link.tsx +36 -0
- package/src/gui/components/atoms/List/List.resolver.tsx +94 -0
- package/src/gui/components/atoms/List/List.stories.tsx +137 -0
- package/src/gui/components/atoms/List/List.tsx +20 -0
- package/src/gui/components/atoms/ListItem/ListItem.resolver.tsx +88 -0
- package/src/gui/components/atoms/ListItem/ListItem.stories.tsx +151 -0
- package/src/gui/components/atoms/ListItem/ListItem.tsx +19 -0
- package/src/gui/components/atoms/ListItemButton/ListItemButton.resolver.tsx +214 -0
- package/src/gui/components/atoms/ListItemButton/ListItemButton.stories.tsx +155 -0
- package/src/gui/components/atoms/ListItemButton/ListItemButton.tsx +15 -0
- package/src/gui/components/atoms/ListItemIcon/ListItemIcon.resolver.tsx +102 -0
- package/src/gui/components/atoms/ListItemIcon/ListItemIcon.stories.tsx +132 -0
- package/src/gui/components/atoms/ListItemIcon/ListItemIcon.tsx +11 -0
- package/src/gui/components/atoms/ListItemText/ListItemText.resolver.tsx +112 -0
- package/src/gui/components/atoms/ListItemText/ListItemText.stories.tsx +156 -0
- package/src/gui/components/atoms/ListItemText/ListItemText.tsx +15 -0
- package/src/gui/components/atoms/Menu/Menu.resolver.tsx +112 -0
- package/src/gui/components/atoms/Menu/Menu.stories.tsx +162 -0
- package/src/gui/components/atoms/Menu/Menu.tsx +17 -0
- package/src/gui/components/atoms/MenuItem/MenuItem.resolver.tsx +183 -0
- package/src/gui/components/atoms/MenuItem/MenuItem.stories.tsx +134 -0
- package/src/gui/components/atoms/MenuItem/MenuItem.tsx +14 -0
- package/src/gui/components/atoms/Paper/Paper.resolver.tsx +98 -0
- package/src/gui/components/atoms/Paper/Paper.stories.tsx +184 -0
- package/src/gui/components/atoms/Paper/Paper.tsx +15 -0
- package/src/gui/components/atoms/Section/Section.resolver.tsx +10 -0
- package/src/gui/components/atoms/Section/Section.stories.tsx +189 -0
- package/src/gui/components/atoms/Section/Section.tsx +76 -0
- package/src/gui/components/atoms/Section/Section.types.tsx +24 -0
- package/src/gui/components/atoms/Stack/Stack.resolver.tsx +94 -0
- package/src/gui/components/atoms/Stack/Stack.stories.tsx +160 -0
- package/src/gui/components/atoms/Stack/Stack.tsx +15 -0
- package/src/gui/components/atoms/Surface/Surface.resolver.tsx +37 -0
- package/src/gui/components/atoms/Surface/Surface.tsx +49 -0
- package/src/gui/components/atoms/Surface/Surface.types.ts +20 -0
- package/src/gui/components/atoms/Switch/Switch.resolver.tsx +53 -0
- package/src/gui/components/atoms/Switch/Switch.stories.tsx +236 -0
- package/src/gui/components/atoms/Switch/Switch.tsx +22 -0
- package/src/gui/components/atoms/Table/Body/TableBody.tsx +7 -0
- package/src/gui/components/atoms/Table/Cell/TableCell.tsx +18 -0
- package/src/gui/components/atoms/Table/Head/TableHead.tsx +9 -0
- package/src/gui/components/atoms/Table/Row/TableRow.tsx +20 -0
- package/src/gui/components/atoms/Table/Table.resolver.tsx +77 -0
- package/src/gui/components/atoms/Table/Table.stories.tsx +173 -0
- package/src/gui/components/atoms/Table/Table.tsx +20 -0
- package/src/gui/components/atoms/TextField/TextField.stories.tsx +25 -0
- package/src/gui/components/atoms/TextField/TextField.tsx +15 -0
- package/src/gui/components/atoms/Toolbar/Toolbar.resolver.tsx +60 -0
- package/src/gui/components/atoms/Toolbar/Toolbar.stories.tsx +155 -0
- package/src/gui/components/atoms/Toolbar/Toolbar.tsx +16 -0
- package/src/gui/components/atoms/Tooltip/Tooltip.resolver.tsx +142 -0
- package/src/gui/components/atoms/Tooltip/Tooltip.stories.tsx +117 -0
- package/src/gui/components/atoms/Tooltip/Tooltip.tsx +70 -0
- package/src/gui/components/atoms/Typography/Typography.resolver.tsx +158 -0
- package/src/gui/components/atoms/Typography/Typography.stories.tsx +222 -0
- package/src/gui/components/atoms/Typography/Typography.tsx +27 -0
- package/src/gui/components/atoms/Window/Nodes/node.ts +0 -0
- package/src/gui/components/atoms/Window/code/block/node.tsx +0 -0
- package/src/gui/components/atoms/Window/code/hugging.face.api.ts +11 -0
- package/src/gui/components/atoms/Window/connectors/index.ts +19 -0
- package/src/gui/components/atoms/Window/window.stories.tsx +20 -0
- package/src/gui/components/atoms/Window/window.tsx +636 -0
- package/src/gui/components/atoms/atoms.tsx +151 -0
- package/src/gui/components/atoms/index.ts +2 -0
- package/src/gui/components/generics/Cards/Gridme.jsx +52 -0
- package/src/gui/components/generics/Cards/LilBox.jsx +65 -0
- package/src/gui/components/generics/Cards/ModuleCard.jsx +106 -0
- package/src/gui/components/generics/Chats/FullChatBot.jsx +223 -0
- package/src/gui/components/generics/Code/CodeBlock.jsx +33 -0
- package/src/gui/components/generics/EmojiCursor/EmojiCursor.stories.tsx +153 -0
- package/src/gui/components/generics/EmojiCursor/EmojiCursor.tsx +23 -0
- package/src/gui/components/generics/Feedback/Callout.jsx +92 -0
- package/src/gui/components/generics/Layout/GridX.jsx +29 -0
- package/src/gui/components/generics/Layout/Hero2.jsx +132 -0
- package/src/gui/components/generics/Layout/PageContainer.jsx +29 -0
- package/src/gui/components/generics/Layout/PageDivider.jsx +20 -0
- package/src/gui/components/generics/Layout/Section.jsx +43 -0
- package/src/gui/components/generics/Layout/SectionHeader.jsx +21 -0
- package/src/gui/components/generics/Media/Img.jsx +58 -0
- package/src/gui/components/generics/Media/VideoEmbed.jsx +51 -0
- package/src/gui/components/generics/Organization/TableOfContents.jsx +51 -0
- package/src/gui/components/generics/Organization/Tabs.jsx +45 -0
- package/src/gui/components/generics/Text/TextList.jsx +41 -0
- package/src/gui/components/generics/Text/TextParagraph.jsx +28 -0
- package/src/gui/components/generics/Text/TextQuote.jsx +23 -0
- package/src/gui/components/generics/Text/TextTitle.jsx +44 -0
- package/src/gui/components/molecules/Dialog/Dialog.stories.tsx +18 -0
- package/src/gui/components/molecules/Dialog/Dialog.tsx +5 -0
- package/src/gui/components/molecules/Hero/Hero.stories.tsx +140 -0
- package/src/gui/components/molecules/Hero/Hero.tsx +152 -0
- package/src/gui/components/molecules/Hero/Hero.types.tsx +18 -0
- package/src/gui/components/molecules/Modal/Modal.resolver.tsx +38 -0
- package/src/gui/components/molecules/Modal/Modal.stories.tsx +82 -0
- package/src/gui/components/molecules/Modal/Modal.tsx +110 -0
- package/src/gui/components/molecules/Modal/Modal.types.ts +29 -0
- package/src/gui/components/molecules/Page/Page.stories.tsx +135 -0
- package/src/gui/components/molecules/Page/Page.tsx +94 -0
- package/src/gui/components/molecules/Theme/ThemeModeToggle/ThemeModeToggle.resolver.tsx +58 -0
- package/src/gui/components/molecules/Theme/ThemeModeToggle/ThemeModeToggle.stories.tsx +133 -0
- package/src/gui/components/molecules/Theme/ThemeModeToggle/ThemeModeToggle.tsx +101 -0
- package/src/gui/components/molecules/Theme/ThemeModeToggle/ThemeModeToggle.types.ts +29 -0
- package/src/gui/components/molecules/Theme/ThemesCatalog/ThemesCatalog.resolver.tsx +15 -0
- package/src/gui/components/molecules/Theme/ThemesCatalog/ThemesCatalog.stories.tsx +88 -0
- package/src/gui/components/molecules/Theme/ThemesCatalog/ThemesCatalog.tsx +167 -0
- package/src/gui/components/molecules/Theme/ThemesCatalog/ThemesCatalog.types.ts +34 -0
- package/src/gui/components/molecules/molecules.ts +49 -0
- package/src/gui/components/organisms/Blockchain/Blocks/BlocksTable.tsx +119 -0
- package/src/gui/components/organisms/Blockchain/Usernames/Identities.stories.tsx +20 -0
- package/src/gui/components/organisms/Blockchain/Usernames/QR.tsx +566 -0
- package/src/gui/components/organisms/Blockchain/Usernames/Usernames.tsx +448 -0
- package/src/gui/components/organisms/Blockchain/Usernames/identities.tsx +710 -0
- package/src/gui/components/organisms/Blockchain/blockchain.stories.tsx +17 -0
- package/src/gui/components/organisms/Blockchain/blockchain.tsx +368 -0
- package/src/gui/components/organisms/Blockchain/scripts/connection.ts +82 -0
- package/src/gui/components/organisms/Blockchain/scripts/match_face.ts +143 -0
- package/src/gui/components/organisms/HighLighter/HighLighter.stories.tsx +168 -0
- package/src/gui/components/organisms/HighLighter/HighLighter.tsx +420 -0
- package/src/gui/components/organisms/HighLighter/HighLightsDrawer.tsx +197 -0
- package/src/gui/components/organisms/IdentityNoise/FaceRecognition/FaceRecognition.stories.tsx +312 -0
- package/src/gui/components/organisms/IdentityNoise/FaceRecognition/FaceRecognition.tsx +765 -0
- package/src/gui/components/organisms/IdentityNoise/FaceRecognition/modules/useFaceCameraPermission.ts +70 -0
- package/src/gui/components/organisms/IdentityNoise/FaceRecognition/modules/useFaceLandmarker.ts +106 -0
- package/src/gui/components/organisms/IdentityNoise/FaceRecognition/modules/useFaceOverlay.ts +489 -0
- package/src/gui/components/organisms/IdentityNoise/FaceRecognition/modules/useFaceTemplate.ts +32 -0
- package/src/gui/components/organisms/IdentityNoise/FaceRecognition/modules/useFaceTemplateBurst.ts +178 -0
- package/src/gui/components/organisms/IdentityNoise/FaceRecognition/modules/verifyTemplate.ts +136 -0
- package/src/gui/components/organisms/IdentityNoise/IdentityNoise.tsx +403 -0
- package/src/gui/components/organisms/IdentityNoise/IndentityNoise.stories.tsx +15 -0
- package/src/gui/components/organisms/IdentityNoise/Noise/Noise.stories.tsx +206 -0
- package/src/gui/components/organisms/IdentityNoise/Noise/Noise.tsx +394 -0
- package/src/gui/components/organisms/IdentityNoise/Triad/QR.tsx +566 -0
- package/src/gui/components/organisms/IdentityNoise/Triad/Tiad.stories.tsx +6 -0
- package/src/gui/components/organisms/IdentityNoise/Triad/Triad.tsx +917 -0
- package/src/gui/components/organisms/IdentityNoise/Triad/handleCleak.ts +0 -0
- package/src/gui/components/organisms/IdentityNoise/Triad/identity.ts +31 -0
- package/src/gui/components/organisms/IdentityNoise/Triad/me/fundamentals/vectors/vectors.tsx +252 -0
- package/src/gui/components/organisms/IdentityNoise/Triad/me/me.stories.tsx +314 -0
- package/src/gui/components/organisms/IdentityNoise/Triad/me/me.tsx +0 -0
- package/src/gui/components/organisms/organisms.ts +15 -0
- package/src/gui/contexts/InsetsContext.tsx +40 -0
- package/src/gui/contexts/LeftSidebarContext.tsx +20 -0
- package/src/gui/contexts/RightSidebarContext.tsx +25 -0
- package/src/gui/contexts/ThemeContext.ts +34 -0
- package/src/gui/contexts/index.ts +4 -0
- package/src/gui/hooks/index.ts +11 -0
- package/src/gui/hooks/resolveColorToken.ts +39 -0
- package/src/gui/hooks/useCodeGen.ts +12 -0
- package/src/gui/hooks/useGuiMediaQuery.ts +18 -0
- package/src/gui/hooks/useGuiTheme.ts +18 -0
- package/src/gui/hooks/useInsets.ts +26 -0
- package/src/gui/hooks/useIsMobile.ts +13 -0
- package/src/gui/hooks/useIsTouchDevice.ts +25 -0
- package/src/gui/hooks/useLeftSidebar.ts +10 -0
- package/src/gui/hooks/useRightSidebar.ts +12 -0
- package/src/gui/hooks/useViewportKey.ts +19 -0
- package/src/gui/hooks/useViewportProp.ts +17 -0
- package/src/gui/registry/GuiRegistry.ts +19 -0
- package/src/gui/registry/factory.ts +12 -0
- package/src/gui/registry/index.ts +3 -0
- package/src/gui/registry/types.ts +6 -0
- package/src/gui/utils/nodeID.ts +11 -0
- package/src/registry/GuiRegistry.ts +19 -0
- package/src/stories/01.Home.mdx +22 -0
- package/src/stories/02.Understanding.This.GUI.mdx +149 -0
- package/src/stories/Theme/Palette.stories.tsx +86 -0
- package/src/stories/Theme/ThemeViewer.stories.tsx +91 -0
- package/src/stories/Theme/Typography.stories.jsx +211 -0
- package/src/stories/assets/this.GUI.png +0 -0
- package/src/types/gui.d.ts +67 -0
- package/src/types/theme.d.ts +191 -0
- package/src/types/viewport.ts +132 -0
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
import { StoryFn } from "@storybook/react";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import Layout from "@/gui/Theme/Layout/Layout/Layout";
|
|
4
|
+
import ThemeModeToggle from "@/gui/components/molecules/Theme/ThemeModeToggle/ThemeModeToggle";
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
title: "Layout/Sidebars/LeftSidebar",
|
|
8
|
+
component: Layout,
|
|
9
|
+
tags: ['autodocs'],
|
|
10
|
+
parameters: {
|
|
11
|
+
docs: {
|
|
12
|
+
description: {
|
|
13
|
+
component:
|
|
14
|
+
`The **LeftSidebar** component provides the navigation rail for ResponsiveUI layouts. It keeps content aligned with other structural elements (TopBar, RightSidebar) while offering a consistent spot for primary navigation and quick actions.
|
|
15
|
+
---
|
|
16
|
+
## Features
|
|
17
|
+
- **Rail-first layout:** Starts in rail view by default to maximize canvas space while keeping icons reachable.
|
|
18
|
+
- **Expanded navigation:** Users can switch to an expanded width for descriptive labels and nested menus.
|
|
19
|
+
- **Mobile overlay:** On compact viewports it becomes a temporary drawer that overlays content and releases the left inset.
|
|
20
|
+
- **Footer actions:** Optional \`footerElements\` allow secondary actions (e.g. settings, help) that stay pinned to the bottom.
|
|
21
|
+
- **Inset sync:** Updates \`theme.layout.insets.left\` so surrounding layouts and the TopBar shift automatically.
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
## Layout Variants
|
|
25
|
+
- \`rail\`: 72px icon rail, best for dense productivity layouts.
|
|
26
|
+
- \`expanded\`: 264px panel with labels and nested menu support.
|
|
27
|
+
- \`mobile\`: Drawer that covers the screen content and is controlled by a floating toggle button.
|
|
28
|
+
The sidebar transitions between these modes automatically based on breakpoints, but you can also set them manually via \`useLeftSidebar()\`.
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
## Props
|
|
32
|
+
- \`elements: LeftSidebarElement[]\` — Main navigation items. Supports \`link\`, \`menu\`, and \`action\` types.
|
|
33
|
+
- \`footerElements?: LeftSidebarElement[]\` — Optional persistent actions rendered in the footer.
|
|
34
|
+
- \`initialView?: 'rail' | 'expanded' | 'mobile'\` — Starting layout; defaults to \`rail\`.
|
|
35
|
+
- \`className?, ...rest\` — Standard layout props forwarded to the root container.
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
## Declarative usage
|
|
39
|
+
~~~tsx
|
|
40
|
+
import LeftSidebar from '@/gui/Layouts/ResponsiveUI/Sidebars/LeftSidebar/LeftSidebar';
|
|
41
|
+
|
|
42
|
+
<LeftSidebar
|
|
43
|
+
initialView="rail"
|
|
44
|
+
elements={[
|
|
45
|
+
{ type: 'link', props: { label: 'Dashboard', icon: 'dashboard' } },
|
|
46
|
+
{ type: 'link', props: { label: 'Analytics', icon: 'bar_chart' } },
|
|
47
|
+
{
|
|
48
|
+
type: 'menu',
|
|
49
|
+
props: {
|
|
50
|
+
label: 'Projects',
|
|
51
|
+
icon: 'folder',
|
|
52
|
+
items: [
|
|
53
|
+
{ label: 'Active', icon: 'task' },
|
|
54
|
+
{ label: 'Archive', icon: 'inventory_2' },
|
|
55
|
+
],
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
]}
|
|
59
|
+
footerElements={[
|
|
60
|
+
{ type: 'link', props: { label: 'Settings', icon: 'settings' } },
|
|
61
|
+
{ type: 'action', props: { label: 'Sign out', icon: 'logout' } },
|
|
62
|
+
]}
|
|
63
|
+
/>;
|
|
64
|
+
~~~
|
|
65
|
+
|
|
66
|
+
---
|
|
67
|
+
## React usage
|
|
68
|
+
Wrap your layout with \`LeftSidebarProvider\` and consume \`useLeftSidebar()\` to control the view programmatically:
|
|
69
|
+
~~~tsx
|
|
70
|
+
import { LeftSidebarProvider } from '@/gui/contexts';
|
|
71
|
+
import LeftSidebar from '@/gui/Layouts/ResponsiveUI/Sidebars/LeftSidebar/LeftSidebar';
|
|
72
|
+
import { useLeftSidebar } from '@/gui/hooks';
|
|
73
|
+
|
|
74
|
+
const navItems = [
|
|
75
|
+
{ type: 'link', props: { label: 'Dashboard', icon: 'dashboard' } },
|
|
76
|
+
{ type: 'link', props: { label: 'Billing', icon: 'receipt_long' } },
|
|
77
|
+
];
|
|
78
|
+
|
|
79
|
+
function Shell() {
|
|
80
|
+
const { view, setView } = useLeftSidebar();
|
|
81
|
+
return (
|
|
82
|
+
<>
|
|
83
|
+
<button onClick={() => setView(view === 'expanded' ? 'rail' : 'expanded')}>
|
|
84
|
+
Toggle mode
|
|
85
|
+
</button>
|
|
86
|
+
<LeftSidebar elements={navItems} />
|
|
87
|
+
</>
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export function AppShell() {
|
|
92
|
+
return (
|
|
93
|
+
<LeftSidebarProvider>
|
|
94
|
+
<Shell />
|
|
95
|
+
</LeftSidebarProvider>
|
|
96
|
+
);
|
|
97
|
+
}
|
|
98
|
+
~~~
|
|
99
|
+
|
|
100
|
+
---
|
|
101
|
+
## Notes
|
|
102
|
+
- Mobile mode is triggered automatically below the \`sm\` breakpoint; the floating toggle re-opens the drawer.
|
|
103
|
+
- The sidebar updates the global inset each time the view changes, keeping the TopBar and page content aligned.
|
|
104
|
+
- Combine with the \`TopBar\` story to see how the two components cooperate in responsive layouts.
|
|
105
|
+
`,
|
|
106
|
+
},
|
|
107
|
+
},
|
|
108
|
+
},
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
const Template: StoryFn<React.ComponentProps<typeof Layout>> = (args) => (
|
|
112
|
+
<Layout {...args} />
|
|
113
|
+
);
|
|
114
|
+
|
|
115
|
+
export const Default = Template.bind({});
|
|
116
|
+
Default.args = {
|
|
117
|
+
topBarConfig: {
|
|
118
|
+
title: "My Application",
|
|
119
|
+
elementsRight: [
|
|
120
|
+
{ type: "link", props: { label: "Profile", icon: "account_circle" } },
|
|
121
|
+
{
|
|
122
|
+
type: "action",
|
|
123
|
+
props: {
|
|
124
|
+
element: <ThemeModeToggle variant="minimal" show="icons" iconSize="small" />,
|
|
125
|
+
},
|
|
126
|
+
},
|
|
127
|
+
{ type: "action", props: { label: "Logout", icon: "logout", iconColor: "var(--gui-error)" } },
|
|
128
|
+
],
|
|
129
|
+
},
|
|
130
|
+
leftSidebarConfig: {
|
|
131
|
+
elements: [
|
|
132
|
+
{ type: "link", props: { label: "Dashboard", icon: "dashboard", iconColor: "var(--gui-primary)" } },
|
|
133
|
+
{ type: "link", props: { label: "Analytics", icon: "bar_chart", iconColor: "var(--gui-secondary)" } },
|
|
134
|
+
{
|
|
135
|
+
type: "menu",
|
|
136
|
+
props: {
|
|
137
|
+
label: "Projects",
|
|
138
|
+
icon: "folder",
|
|
139
|
+
iconColor: "var(--gui-warning)",
|
|
140
|
+
items: [
|
|
141
|
+
{ label: "Project A", icon: "work", iconColor: "var(--gui-success)" },
|
|
142
|
+
{ label: "Project B", icon: "assignment", iconColor: "var(--gui-info)" },
|
|
143
|
+
],
|
|
144
|
+
},
|
|
145
|
+
},
|
|
146
|
+
{ type: "action", props: { label: "Logout", icon: "logout", iconColor: "var(--gui-error)", action: "handleLogout" } },
|
|
147
|
+
],
|
|
148
|
+
},
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
export const WithoutTopBar = Template.bind({});
|
|
152
|
+
WithoutTopBar.args = {
|
|
153
|
+
leftSidebarConfig: {
|
|
154
|
+
elements: [
|
|
155
|
+
{ type: "link", props: { label: "Dashboard", icon: "dashboard", iconColor: "var(--gui-primary)" } },
|
|
156
|
+
{ type: "link", props: { label: "Analytics", icon: "bar_chart", iconColor: "var(--gui-secondary)" } },
|
|
157
|
+
{
|
|
158
|
+
type: "menu",
|
|
159
|
+
props: {
|
|
160
|
+
label: "Projects",
|
|
161
|
+
icon: "folder",
|
|
162
|
+
iconColor: "var(--gui-warning)",
|
|
163
|
+
items: [
|
|
164
|
+
{ label: "Project A", icon: "work", iconColor: "var(--gui-success)" },
|
|
165
|
+
{ label: "Project B", icon: "assignment", iconColor: "var(--gui-info)" },
|
|
166
|
+
],
|
|
167
|
+
},
|
|
168
|
+
},
|
|
169
|
+
{ type: "action", props: { label: "Logout", icon: "logout", iconColor: "var(--gui-error)", action: "handleLogout" } },
|
|
170
|
+
],
|
|
171
|
+
},
|
|
172
|
+
};
|
|
173
|
+
|
|
174
|
+
export const WithFooter = Template.bind({});
|
|
175
|
+
WithFooter.args = {
|
|
176
|
+
leftSidebarConfig: {
|
|
177
|
+
elements: [
|
|
178
|
+
{ type: "link", props: { label: "Dashboard", icon: "dashboard", iconColor: "var(--gui-primary)" } },
|
|
179
|
+
{ type: "link", props: { label: "Analytics", icon: "bar_chart", iconColor: "var(--gui-secondary)" } },
|
|
180
|
+
{
|
|
181
|
+
type: "menu",
|
|
182
|
+
props: {
|
|
183
|
+
label: "Projects",
|
|
184
|
+
icon: "folder",
|
|
185
|
+
iconColor: "var(--gui-warning)",
|
|
186
|
+
items: [
|
|
187
|
+
{ label: "Project A", icon: "work", iconColor: "var(--gui-success)" },
|
|
188
|
+
{ label: "Project B", icon: "assignment", iconColor: "var(--gui-info)" },
|
|
189
|
+
],
|
|
190
|
+
},
|
|
191
|
+
},
|
|
192
|
+
{ type: "action", props: { label: "Logout", icon: "logout", iconColor: "var(--gui-error)", action: "handleLogout" } },
|
|
193
|
+
],
|
|
194
|
+
footerElements: [
|
|
195
|
+
{ type: "link", props: { label: "Settings", icon: "settings", iconColor: "var(--gui-primary)" } },
|
|
196
|
+
{ type: "action", props: { label: "Help", icon: "help", iconColor: "var(--gui-success)" } },
|
|
197
|
+
],
|
|
198
|
+
},
|
|
199
|
+
};
|
|
@@ -0,0 +1,311 @@
|
|
|
1
|
+
// LeftSidebar.tsx
|
|
2
|
+
import clsx from 'clsx';
|
|
3
|
+
import { useEffect, useState, useRef } from 'react';
|
|
4
|
+
import IconButton from '@mui/material/IconButton';
|
|
5
|
+
import Icon from '@/gui/Theme/Icon/Icon';
|
|
6
|
+
import { LeftSidebarElement } from './LeftSidebar.types';
|
|
7
|
+
import LeftSidebarLink from './components/LeftSidebarLink/LeftSidebarLink';
|
|
8
|
+
import LeftSidebarMenu from './components/LeftSidebarMenu/LeftSidebarMenu';
|
|
9
|
+
import LeftSidebarAction from './components/LeftSidebarAction/LeftSidebarAction';
|
|
10
|
+
import LeftSidebarToggleButton from './components/LeftSidebarToggleButton/LeftSidebarToggleButton';
|
|
11
|
+
import { useLeftSidebar, useGuiTheme, useGuiMediaQuery, useUpdateInsets, useInsets } from '@/gui/hooks';
|
|
12
|
+
import { Box, Drawer } from '@/gui/components/atoms';
|
|
13
|
+
import type { LeftSidebarView } from '@/gui/contexts';
|
|
14
|
+
|
|
15
|
+
const LeftSidebar = ({
|
|
16
|
+
elements = [],
|
|
17
|
+
className,
|
|
18
|
+
initialView = 'rail',
|
|
19
|
+
footerElements = [],
|
|
20
|
+
}: {
|
|
21
|
+
elements: LeftSidebarElement[];
|
|
22
|
+
className?: string;
|
|
23
|
+
initialView?: LeftSidebarView;
|
|
24
|
+
footerElements?: LeftSidebarElement[];
|
|
25
|
+
}) => {
|
|
26
|
+
const { view, setView } = useLeftSidebar();
|
|
27
|
+
const theme = useGuiTheme();
|
|
28
|
+
const isMobile = useGuiMediaQuery(theme.breakpoints.down('sm'));
|
|
29
|
+
const [mobileOpen, setMobileOpen] = useState(false);
|
|
30
|
+
const [lastNonMobileView, setLastNonMobileView] = useState<LeftSidebarView>(view === 'mobile' ? 'expanded' : view);
|
|
31
|
+
const setInsets = useUpdateInsets();
|
|
32
|
+
const insets = useInsets();
|
|
33
|
+
const navInset = Math.max(0, Number(insets?.nav ?? insets?.top ?? 0));
|
|
34
|
+
const headerHeight = navInset > 0 ? navInset : 48;
|
|
35
|
+
const toggleOffset = (navInset > 0 ? navInset : 0) + 12;
|
|
36
|
+
const hasFooterElements = Array.isArray(footerElements) && footerElements.length > 0;
|
|
37
|
+
const initialViewApplied = useRef(false);
|
|
38
|
+
|
|
39
|
+
useEffect(() => {
|
|
40
|
+
if (typeof setInsets !== 'function') return;
|
|
41
|
+
const desired = view === 'expanded' ? 220 : view === 'rail' ? 72 : 0;
|
|
42
|
+
setInsets({ left: desired });
|
|
43
|
+
return () => setInsets({ left: 0 });
|
|
44
|
+
}, [setInsets, view]);
|
|
45
|
+
|
|
46
|
+
useEffect(() => {
|
|
47
|
+
initialViewApplied.current = false;
|
|
48
|
+
}, [initialView]);
|
|
49
|
+
|
|
50
|
+
useEffect(() => {
|
|
51
|
+
if (initialViewApplied.current) return;
|
|
52
|
+
if (initialView !== 'mobile') {
|
|
53
|
+
if (lastNonMobileView !== initialView) setLastNonMobileView(initialView);
|
|
54
|
+
if (!isMobile && view !== initialView) {
|
|
55
|
+
setView(initialView);
|
|
56
|
+
}
|
|
57
|
+
} else if (view !== 'mobile') {
|
|
58
|
+
setView('mobile');
|
|
59
|
+
}
|
|
60
|
+
initialViewApplied.current = true;
|
|
61
|
+
}, [initialView, isMobile, lastNonMobileView, setView, view]);
|
|
62
|
+
|
|
63
|
+
useEffect(() => {
|
|
64
|
+
if (view === 'expanded' || view === 'rail') {
|
|
65
|
+
setLastNonMobileView(view);
|
|
66
|
+
}
|
|
67
|
+
}, [view]);
|
|
68
|
+
|
|
69
|
+
useEffect(() => {
|
|
70
|
+
if (isMobile && view !== 'mobile') {
|
|
71
|
+
setView('mobile');
|
|
72
|
+
} else if (!isMobile && view === 'mobile') {
|
|
73
|
+
setView(lastNonMobileView);
|
|
74
|
+
}
|
|
75
|
+
}, [isMobile, lastNonMobileView, setView, view]);
|
|
76
|
+
|
|
77
|
+
useEffect(() => {
|
|
78
|
+
if (view !== 'mobile' && mobileOpen) {
|
|
79
|
+
setMobileOpen(false);
|
|
80
|
+
}
|
|
81
|
+
}, [mobileOpen, view]);
|
|
82
|
+
|
|
83
|
+
const renderElements = () =>
|
|
84
|
+
elements.map((el, idx) => {
|
|
85
|
+
if (el.type === 'link') return <LeftSidebarLink key={idx} view={view} {...el.props} />;
|
|
86
|
+
if (el.type === 'menu') return <LeftSidebarMenu key={idx} view={view} {...el.props} />;
|
|
87
|
+
if (el.type === 'action') return <LeftSidebarAction key={idx} view={view} {...el.props} />;
|
|
88
|
+
return null;
|
|
89
|
+
});
|
|
90
|
+
const renderFooterItems = () =>
|
|
91
|
+
footerElements.map((el, idx) => {
|
|
92
|
+
if (el.type === 'link') return <LeftSidebarLink key={`footer-link-${idx}`} view={view} {...el.props} />;
|
|
93
|
+
if (el.type === 'menu') return <LeftSidebarMenu key={`footer-menu-${idx}`} view={view} {...el.props} />;
|
|
94
|
+
if (el.type === 'action') return <LeftSidebarAction key={`footer-action-${idx}`} view={view} {...el.props} />;
|
|
95
|
+
return null;
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
if (view === 'rail') {
|
|
99
|
+
return (
|
|
100
|
+
<Box
|
|
101
|
+
component="aside"
|
|
102
|
+
className={clsx('LeftSidebar', className)}
|
|
103
|
+
sx={{
|
|
104
|
+
position: 'fixed',
|
|
105
|
+
top: 0,
|
|
106
|
+
left: 0,
|
|
107
|
+
bottom: 0,
|
|
108
|
+
height: '100vh',
|
|
109
|
+
display: 'flex',
|
|
110
|
+
flexDirection: 'column',
|
|
111
|
+
width: '72px',
|
|
112
|
+
overflow: 'visible',
|
|
113
|
+
borderRight: '1px solid',
|
|
114
|
+
borderColor: 'divider',
|
|
115
|
+
'--gui-rail-width': '72px',
|
|
116
|
+
zIndex: (theme) => theme.zIndex.drawer + 2,
|
|
117
|
+
backgroundColor: 'background.nav',
|
|
118
|
+
}}
|
|
119
|
+
>
|
|
120
|
+
<Box
|
|
121
|
+
component="header"
|
|
122
|
+
sx={{
|
|
123
|
+
flexShrink: 0,
|
|
124
|
+
borderBottom: '1px solid',
|
|
125
|
+
borderColor: 'divider',
|
|
126
|
+
height: `${headerHeight}px`,
|
|
127
|
+
display: 'flex',
|
|
128
|
+
alignItems: 'center',
|
|
129
|
+
justifyContent: 'flex-end',
|
|
130
|
+
px: 1.5,
|
|
131
|
+
py: 0,
|
|
132
|
+
gap: 1.25,
|
|
133
|
+
}}
|
|
134
|
+
>
|
|
135
|
+
<LeftSidebarToggleButton
|
|
136
|
+
expanded={view === ('expanded' as any)}
|
|
137
|
+
onToggle={() => setView(view === 'rail' ? 'expanded' : 'rail')}
|
|
138
|
+
/>
|
|
139
|
+
</Box>
|
|
140
|
+
<Box sx={{ flexGrow: 1, overflowY: 'auto' }}>{renderElements()}</Box>
|
|
141
|
+
{hasFooterElements && (
|
|
142
|
+
<Box
|
|
143
|
+
component="footer"
|
|
144
|
+
sx={{
|
|
145
|
+
flexShrink: 0,
|
|
146
|
+
px: 1,
|
|
147
|
+
py: 1.5,
|
|
148
|
+
borderColor: 'divider',
|
|
149
|
+
display: 'flex',
|
|
150
|
+
flexDirection: 'column',
|
|
151
|
+
gap: 0.5,
|
|
152
|
+
}}
|
|
153
|
+
>
|
|
154
|
+
{renderFooterItems()}
|
|
155
|
+
</Box>
|
|
156
|
+
)}
|
|
157
|
+
</Box>
|
|
158
|
+
);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
if (view === 'mobile') {
|
|
162
|
+
return (
|
|
163
|
+
<>
|
|
164
|
+
<Box
|
|
165
|
+
sx={{
|
|
166
|
+
position: 'fixed',
|
|
167
|
+
top: `${toggleOffset}px`,
|
|
168
|
+
left: 0,
|
|
169
|
+
zIndex: ((theme as any)?.zIndex?.drawer ?? 1200) + 1,
|
|
170
|
+
display: mobileOpen ? 'none' : 'flex',
|
|
171
|
+
}}
|
|
172
|
+
>
|
|
173
|
+
<IconButton
|
|
174
|
+
aria-label="Abrir navegación"
|
|
175
|
+
onClick={() => setMobileOpen(true)}
|
|
176
|
+
sx={{
|
|
177
|
+
borderRadius: '0 16px 16px 0',
|
|
178
|
+
border: '1px solid',
|
|
179
|
+
borderColor: 'divider',
|
|
180
|
+
bgcolor: 'background.paper',
|
|
181
|
+
color: 'text.secondary',
|
|
182
|
+
boxShadow: 3,
|
|
183
|
+
'&:hover': {
|
|
184
|
+
bgcolor: 'background.nav',
|
|
185
|
+
color: 'text.primary',
|
|
186
|
+
},
|
|
187
|
+
}}
|
|
188
|
+
>
|
|
189
|
+
<Icon name="menu" />
|
|
190
|
+
</IconButton>
|
|
191
|
+
</Box>
|
|
192
|
+
<Drawer
|
|
193
|
+
anchor="left"
|
|
194
|
+
open={mobileOpen}
|
|
195
|
+
onClose={() => setMobileOpen(false)}
|
|
196
|
+
variant="temporary"
|
|
197
|
+
ModalProps={{ keepMounted: true }}
|
|
198
|
+
sx={{
|
|
199
|
+
'& .MuiDrawer-paper': {
|
|
200
|
+
width: 220,
|
|
201
|
+
top: `${navInset}px`,
|
|
202
|
+
height: `calc(100vh - ${navInset}px)`,
|
|
203
|
+
display: 'flex',
|
|
204
|
+
flexDirection: 'column',
|
|
205
|
+
borderRight: '1px solid',
|
|
206
|
+
borderColor: 'divider',
|
|
207
|
+
},
|
|
208
|
+
}}
|
|
209
|
+
>
|
|
210
|
+
<Box
|
|
211
|
+
component="header"
|
|
212
|
+
sx={{
|
|
213
|
+
flexShrink: 0,
|
|
214
|
+
borderBottom: '1px solid',
|
|
215
|
+
borderColor: 'divider',
|
|
216
|
+
height: `${headerHeight}px`,
|
|
217
|
+
display: 'flex',
|
|
218
|
+
alignItems: 'center',
|
|
219
|
+
justifyContent: 'flex-end',
|
|
220
|
+
px: 1.5,
|
|
221
|
+
gap: 1.25,
|
|
222
|
+
}}
|
|
223
|
+
>
|
|
224
|
+
<LeftSidebarToggleButton expanded onToggle={() => setMobileOpen(false)} />
|
|
225
|
+
</Box>
|
|
226
|
+
<Box sx={{ flexGrow: 1, overflowY: 'auto' }}>{renderElements()}</Box>
|
|
227
|
+
{hasFooterElements && (
|
|
228
|
+
<Box
|
|
229
|
+
component="footer"
|
|
230
|
+
sx={{
|
|
231
|
+
flexShrink: 0,
|
|
232
|
+
px: 1.5,
|
|
233
|
+
py: 1.5,
|
|
234
|
+
borderColor: 'divider',
|
|
235
|
+
display: 'flex',
|
|
236
|
+
flexDirection: 'column',
|
|
237
|
+
gap: 0.75,
|
|
238
|
+
}}
|
|
239
|
+
>
|
|
240
|
+
{renderFooterItems()}
|
|
241
|
+
</Box>
|
|
242
|
+
)}
|
|
243
|
+
</Drawer>
|
|
244
|
+
</>
|
|
245
|
+
);
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
// Default to 'expanded' view
|
|
249
|
+
return (
|
|
250
|
+
<Box
|
|
251
|
+
component="aside"
|
|
252
|
+
className={clsx('LeftSidebar', className)}
|
|
253
|
+
sx={{
|
|
254
|
+
position: 'fixed',
|
|
255
|
+
top: 0,
|
|
256
|
+
left: 0,
|
|
257
|
+
bottom: 0,
|
|
258
|
+
height: '100vh',
|
|
259
|
+
display: 'flex',
|
|
260
|
+
flexDirection: 'column',
|
|
261
|
+
width: '220px',
|
|
262
|
+
overflow: 'visible',
|
|
263
|
+
borderRight: '1px solid',
|
|
264
|
+
borderColor: 'divider',
|
|
265
|
+
'--gui-expanded-width': '220px',
|
|
266
|
+
backgroundColor: 'background.nav',
|
|
267
|
+
zIndex: (theme) => theme.zIndex.drawer + 2,
|
|
268
|
+
}}
|
|
269
|
+
>
|
|
270
|
+
<Box
|
|
271
|
+
component="header"
|
|
272
|
+
sx={{
|
|
273
|
+
flexShrink: 0,
|
|
274
|
+
borderBottom: '1px solid',
|
|
275
|
+
borderColor: 'divider',
|
|
276
|
+
height: `${headerHeight}px`,
|
|
277
|
+
display: 'flex',
|
|
278
|
+
alignItems: 'center',
|
|
279
|
+
justifyContent: 'flex-end',
|
|
280
|
+
px: 1.5,
|
|
281
|
+
py: 0,
|
|
282
|
+
gap: 1.25,
|
|
283
|
+
}}
|
|
284
|
+
>
|
|
285
|
+
<LeftSidebarToggleButton
|
|
286
|
+
expanded={view === ('expanded' as any)}
|
|
287
|
+
onToggle={() => setView(view === 'expanded' ? 'rail' : 'expanded')}
|
|
288
|
+
/>
|
|
289
|
+
</Box>
|
|
290
|
+
<Box sx={{ flexGrow: 1, overflowY: 'auto' }}>{renderElements()}</Box>
|
|
291
|
+
{hasFooterElements && (
|
|
292
|
+
<Box
|
|
293
|
+
component="footer"
|
|
294
|
+
sx={{
|
|
295
|
+
flexShrink: 0,
|
|
296
|
+
px: 1.5,
|
|
297
|
+
py: 1.5,
|
|
298
|
+
borderColor: 'divider',
|
|
299
|
+
display: 'flex',
|
|
300
|
+
flexDirection: 'column',
|
|
301
|
+
gap: 0.75,
|
|
302
|
+
}}
|
|
303
|
+
>
|
|
304
|
+
{renderFooterItems()}
|
|
305
|
+
</Box>
|
|
306
|
+
)}
|
|
307
|
+
</Box>
|
|
308
|
+
);
|
|
309
|
+
};
|
|
310
|
+
|
|
311
|
+
export default LeftSidebar;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { LeftSidebarView } from '@/gui/contexts';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
export type LeftSidebarMode = 'rail' | 'expanded' | 'mobile';
|
|
4
|
+
|
|
5
|
+
export type LeftSidebarProps = {
|
|
6
|
+
open?: boolean; // used in mobile
|
|
7
|
+
mode?: LeftSidebarMode;
|
|
8
|
+
onClose?: () => void;
|
|
9
|
+
items?: any[];
|
|
10
|
+
children?: ReactNode;
|
|
11
|
+
brand?: ReactNode;
|
|
12
|
+
footer?: ReactNode;
|
|
13
|
+
footerElements?: LeftSidebarElement[];
|
|
14
|
+
style?: React.CSSProperties;
|
|
15
|
+
className?: string;
|
|
16
|
+
enableCollapse?: boolean;
|
|
17
|
+
defaultExpanded?: boolean;
|
|
18
|
+
expandButton?: ReactNode;
|
|
19
|
+
drawerLinks?: any[];
|
|
20
|
+
collapsedWidth?: number;
|
|
21
|
+
expandedWidth?: number;
|
|
22
|
+
expanded?: boolean;
|
|
23
|
+
id?: string;
|
|
24
|
+
shouldShowToggle?: boolean;
|
|
25
|
+
railMode?: boolean;
|
|
26
|
+
toggleLocation?: 'sidebar' | 'topbar' | 'none';
|
|
27
|
+
header?: ReactNode;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export type LeftSidebarElement =
|
|
31
|
+
| { type: 'link'; props: Record<string, any> }
|
|
32
|
+
| { type: 'menu'; props: Record<string, any> }
|
|
33
|
+
| { type: 'action'; props: Record<string, any> };
|
|
34
|
+
|
|
35
|
+
export type SidebarMode = LeftSidebarMode;
|
|
36
|
+
export type SidebarSection = {
|
|
37
|
+
title?: string;
|
|
38
|
+
items: any[];
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export type SidebarToggleHandler = () => void;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Box, IconButton } from '@mui/material';
|
|
3
|
+
import { SxProps, Theme } from '@mui/material/styles';
|
|
4
|
+
import Icon from '@/themes/Icon/Icon';
|
|
5
|
+
|
|
6
|
+
export interface SidebarToggleButtonProps {
|
|
7
|
+
expanded: boolean;
|
|
8
|
+
onToggle: () => void;
|
|
9
|
+
collapsedWidth?: number;
|
|
10
|
+
style?: React.CSSProperties;
|
|
11
|
+
location?: 'topbar' | 'sidebar' | 'none';
|
|
12
|
+
sx?: SxProps<Theme>;
|
|
13
|
+
forceRender?: boolean;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const SidebarToggleButton: React.FC<SidebarToggleButtonProps> = ({
|
|
17
|
+
expanded,
|
|
18
|
+
onToggle,
|
|
19
|
+
collapsedWidth = 72,
|
|
20
|
+
style,
|
|
21
|
+
location,
|
|
22
|
+
sx,
|
|
23
|
+
}) => {
|
|
24
|
+
const [locationState, setLocation] = React.useState<'topbar' | 'sidebar' | 'none'>(location ?? 'none');
|
|
25
|
+
|
|
26
|
+
React.useEffect(() => {
|
|
27
|
+
if (location) {
|
|
28
|
+
setLocation(location);
|
|
29
|
+
}
|
|
30
|
+
}, [location]);
|
|
31
|
+
|
|
32
|
+
if (locationState === 'none') return null;
|
|
33
|
+
|
|
34
|
+
return (
|
|
35
|
+
<Box
|
|
36
|
+
sx={{
|
|
37
|
+
...(locationState === 'topbar'
|
|
38
|
+
? { display: 'flex', alignItems: 'center', justifyContent: 'center', px: 1 }
|
|
39
|
+
: { width: collapsedWidth, display: 'flex', justifyContent: 'center', py: 1 }),
|
|
40
|
+
...sx,
|
|
41
|
+
}}
|
|
42
|
+
style={style}
|
|
43
|
+
>
|
|
44
|
+
<IconButton size="small" onClick={onToggle} aria-label={expanded ? 'Collapse sidebar' : 'Expand sidebar'}>
|
|
45
|
+
<span className="material-symbols-rounded" style={{ fontSize: 20 }}>
|
|
46
|
+
{expanded ? 'chevron_left' : 'chevron_right'}
|
|
47
|
+
</span>
|
|
48
|
+
</IconButton>
|
|
49
|
+
</Box>
|
|
50
|
+
);
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
export default SidebarToggleButton;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export default function resolveLeftSidebarAction({
|
|
2
|
+
action,
|
|
3
|
+
context,
|
|
4
|
+
}: {
|
|
5
|
+
action: string | (() => any);
|
|
6
|
+
context?: any;
|
|
7
|
+
}) {
|
|
8
|
+
try {
|
|
9
|
+
if (typeof action === 'function') return action();
|
|
10
|
+
if (typeof action === 'string') {
|
|
11
|
+
const fn = (window as any)[action];
|
|
12
|
+
if (typeof fn === 'function') return fn(context);
|
|
13
|
+
console.warn(`LeftSidebarAction: No global function found for "${action}"`);
|
|
14
|
+
}
|
|
15
|
+
} catch (err) {
|
|
16
|
+
console.error(`Error executing LeftSidebarAction for "${action}":`, err);
|
|
17
|
+
}
|
|
18
|
+
return undefined;
|
|
19
|
+
}
|