this.gui 1.3.22 → 1.3.26
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/dist/this-gui.es.js +0 -1
- package/dist/this-gui.umd.js +65 -65
- package/index.ts +3 -2
- package/init/index.html +4 -5
- package/init/package-lock.json +2 -2
- package/init/package.json +1 -1
- package/init/src/App.tsx +24 -0
- package/init/src/index.css +16 -0
- package/init/src/main.tsx +14 -0
- package/init/src/router/DerivableRouter.tsx +36 -0
- package/package.json +1 -1
- package/src/GUI.tsx +15 -0
- package/src/components/generics/Cards/Gridme.jsx +52 -0
- package/src/components/generics/Cards/LilBox.jsx +65 -0
- package/src/components/generics/Cards/ModuleCard.jsx +106 -0
- package/src/components/generics/Chats/FullChatBot.jsx +223 -0
- package/src/components/generics/Code/CodeBlock.jsx +33 -0
- package/src/components/generics/Feedback/Callout.jsx +92 -0
- package/src/components/generics/Layout/GridX.jsx +29 -0
- package/src/components/generics/Layout/Hero2.jsx +132 -0
- package/src/components/generics/Layout/PageContainer.jsx +29 -0
- package/src/components/generics/Layout/PageDivider.jsx +20 -0
- package/src/components/generics/Layout/Section.jsx +43 -0
- package/src/components/generics/Layout/SectionHeader.jsx +21 -0
- package/src/components/generics/Media/Img.jsx +58 -0
- package/src/components/generics/Media/VideoEmbed.jsx +51 -0
- package/src/components/generics/Organization/TableOfContents.jsx +51 -0
- package/src/components/generics/Organization/Tabs.jsx +45 -0
- package/src/components/generics/Text/TextList.jsx +41 -0
- package/src/components/generics/Text/TextParagraph.jsx +28 -0
- package/src/components/generics/Text/TextQuote.jsx +23 -0
- package/src/components/generics/Text/TextTitle.jsx +44 -0
- package/src/gui/Layouts/ResponsiveUI/Content/Content.resolver.tsx +0 -0
- package/src/gui/Layouts/ResponsiveUI/Content/Content.stories.tsx +88 -0
- package/src/gui/Layouts/ResponsiveUI/Content/Content.tsx +53 -0
- package/src/gui/Layouts/ResponsiveUI/Content/Content.types.tsx +40 -0
- package/src/gui/Layouts/ResponsiveUI/Footer/Footer.resolver.tsx +45 -0
- package/src/gui/Layouts/ResponsiveUI/Footer/Footer.stories.tsx +209 -0
- package/src/gui/Layouts/ResponsiveUI/Footer/Footer.tsx +337 -0
- package/src/gui/Layouts/ResponsiveUI/Footer/Footer.types.ts +40 -0
- package/src/gui/Layouts/ResponsiveUI/Layout/Layout.resolver.tsx +37 -0
- package/src/gui/Layouts/ResponsiveUI/Layout/Layout.stories.tsx +290 -0
- package/src/gui/Layouts/ResponsiveUI/Layout/Layout.tsx +112 -0
- package/src/gui/Layouts/ResponsiveUI/Layout/Layout.types.ts +56 -0
- package/src/gui/Layouts/ResponsiveUI/Layout/useLayoutBreakpoints.ts +9 -0
- package/src/gui/Layouts/ResponsiveUI/Sidebars/LeftSidebar/LeftSidebar.resolver.tsx +87 -0
- package/src/gui/Layouts/ResponsiveUI/Sidebars/LeftSidebar/LeftSidebar.stories.tsx +199 -0
- package/src/gui/Layouts/ResponsiveUI/Sidebars/LeftSidebar/LeftSidebar.tsx +311 -0
- package/src/gui/Layouts/ResponsiveUI/Sidebars/LeftSidebar/LeftSidebar.types.ts +41 -0
- package/src/gui/Layouts/ResponsiveUI/Sidebars/LeftSidebar/SidebarToggleButton.tsx +53 -0
- package/src/gui/Layouts/ResponsiveUI/Sidebars/LeftSidebar/components/LeftSidebarAction/LeftSidebarAction.resolver.tsx +19 -0
- package/src/gui/Layouts/ResponsiveUI/Sidebars/LeftSidebar/components/LeftSidebarAction/LeftSidebarAction.tsx +107 -0
- package/src/gui/Layouts/ResponsiveUI/Sidebars/LeftSidebar/components/LeftSidebarLink/LeftSidebarLink.resolver.tsx +0 -0
- package/src/gui/Layouts/ResponsiveUI/Sidebars/LeftSidebar/components/LeftSidebarLink/LeftSidebarLink.tsx +122 -0
- package/src/gui/Layouts/ResponsiveUI/Sidebars/LeftSidebar/components/LeftSidebarLink/LeftSidebarLink.types.ts +13 -0
- package/src/gui/Layouts/ResponsiveUI/Sidebars/LeftSidebar/components/LeftSidebarMenu/LeftSidebarMenu.tsx +142 -0
- package/src/gui/Layouts/ResponsiveUI/Sidebars/LeftSidebar/components/LeftSidebarToggleButton/LeftSidebarToggleButton.tsx +23 -0
- package/src/gui/Layouts/ResponsiveUI/Sidebars/RightSidebar/RightSidebar.resolver.tsx +35 -0
- package/src/gui/Layouts/ResponsiveUI/Sidebars/RightSidebar/RightSidebar.stories.tsx +240 -0
- package/src/gui/Layouts/ResponsiveUI/Sidebars/RightSidebar/RightSidebar.tsx +319 -0
- package/src/gui/Layouts/ResponsiveUI/Sidebars/RightSidebar/RightSidebar.types.ts +17 -0
- package/src/gui/Layouts/ResponsiveUI/Sidebars/RightSidebar/components/RightSidebarAction/RightSidebarAction.tsx +102 -0
- package/src/gui/Layouts/ResponsiveUI/Sidebars/RightSidebar/components/RightSidebarLink/RightSidebarLink.tsx +132 -0
- package/src/gui/Layouts/ResponsiveUI/Sidebars/RightSidebar/components/RightSidebarMenu/RightSidebarMenu.tsx +140 -0
- package/src/gui/Layouts/ResponsiveUI/Sidebars/RightSidebar/components/RightSidebarToggleButton/RightSidebarToggleButton.tsx +22 -0
- package/src/gui/Layouts/ResponsiveUI/StickyOptions/StickyOptionsTop.stories.tsx +469 -0
- package/src/gui/Layouts/ResponsiveUI/StickyOptions/StickyOptionsTop.tsx +489 -0
- package/src/gui/Layouts/ResponsiveUI/TopBar/TopBar.resolver.tsx +86 -0
- package/src/gui/Layouts/ResponsiveUI/TopBar/TopBar.stories.tsx +350 -0
- package/src/gui/Layouts/ResponsiveUI/TopBar/TopBar.tsx +281 -0
- package/src/gui/Layouts/ResponsiveUI/TopBar/TopBar.types.ts +39 -0
- package/src/gui/Layouts/ResponsiveUI/TopBar/components/TopBarAction/TopBarAction.stories.tsx +83 -0
- package/src/gui/Layouts/ResponsiveUI/TopBar/components/TopBarAction/TopBarAction.tsx +18 -0
- package/src/gui/Layouts/ResponsiveUI/TopBar/components/TopBarAction/TopBarAction.types.ts +4 -0
- package/src/gui/Layouts/ResponsiveUI/TopBar/components/TopBarLink/TopBarLink.stories.tsx +189 -0
- package/src/gui/Layouts/ResponsiveUI/TopBar/components/TopBarLink/TopBarLink.tsx +30 -0
- package/src/gui/Layouts/ResponsiveUI/TopBar/components/TopBarLink/TopBarLink.types.ts +9 -0
- package/src/gui/Layouts/ResponsiveUI/TopBar/components/TopBarMenu/TopBarMenu.resolver.tsx +14 -0
- package/src/gui/Layouts/ResponsiveUI/TopBar/components/TopBarMenu/TopBarMenu.stories.tsx +56 -0
- package/src/gui/Layouts/ResponsiveUI/TopBar/components/TopBarMenu/TopBarMenu.tsx +123 -0
- package/src/gui/Layouts/ResponsiveUI/TopBar/components/TopBarMenu/TopBarMenu.types.ts +44 -0
- package/src/gui/Theme/GuiProvider.tsx +125 -0
- package/src/gui/Theme/Icon/Icon.resolver.tsx +29 -0
- package/src/gui/Theme/Icon/Icon.tsx +43 -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 +273 -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/apis/codegen.api.ts +38 -0
- package/src/gui/components/atoms/AppBar/AppBar.resolver.tsx +41 -0
- package/src/gui/components/atoms/AppBar/AppBar.stories.tsx +225 -0
- package/src/gui/components/atoms/AppBar/AppBar.tsx +8 -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/TextField/TextField.stories.tsx +28 -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.tsx +138 -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/HeroSection/HeroSection.stories.tsx +141 -0
- package/src/gui/components/molecules/HeroSection/HeroSection.tsx +152 -0
- package/src/gui/components/molecules/HeroSection/HeroSection.types.tsx +18 -0
- package/src/gui/components/molecules/ModalBox/ModalBox.resolver.tsx +38 -0
- package/src/gui/components/molecules/ModalBox/ModalBox.stories.tsx +82 -0
- package/src/gui/components/molecules/ModalBox/ModalBox.tsx +106 -0
- package/src/gui/components/molecules/ModalBox/ModalBox.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/organism/ChatGPTInterface/ChatGPTInterface.stories.tsx +17 -0
- package/src/gui/components/organism/ChatGPTInterface/ChatGPTInterface.tsx +71 -0
- package/src/gui/components/organism/RootDomain/RootDomain.stories.tsx +31 -0
- package/src/gui/components/organism/RootDomain/RootDomain.tsx +100 -0
- package/src/gui/components/organism/RootDomain/staticServices.ts +66 -0
- package/src/gui/components/window/Nodes/node.ts +0 -0
- package/src/gui/components/window/code/block/node.tsx +0 -0
- package/src/gui/components/window/code/hugging.face.api.ts +11 -0
- package/src/gui/components/window/connectors/index.ts +19 -0
- package/src/gui/components/window/window.stories.tsx +20 -0
- package/src/gui/components/window/window.tsx +633 -0
- package/src/gui/contexts/InsetsContext.tsx +38 -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/me/Logic.tsx +31 -0
- package/src/gui/me/Me.stories.tsx +8 -0
- package/src/gui/me/Me.tsx +197 -0
- package/src/gui/me/fundamentals/verbs/verbs.tsx +94 -0
- package/src/gui/me/modificators/Adjectives.ts +0 -0
- package/src/gui/me/modificators/Adverbs.ts +0 -0
- package/src/gui/me/modificators/Complements.ts +27 -0
- package/src/gui/me/utils/Context.tsx +14 -0
- package/src/gui/me/utils/hooks/useMe.js +37 -0
- package/src/gui/utils/nodeID.ts +11 -0
- package/src/registry/GuiRegistry.ts +19 -0
- package/src/registry/factory.ts +12 -0
- package/src/registry/index.ts +3 -0
- package/src/registry/types.ts +6 -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/types/gui.d.ts +67 -0
- package/src/types/theme.d.ts +191 -0
- package/src/types/viewport.ts +132 -0
|
@@ -0,0 +1,337 @@
|
|
|
1
|
+
import { useEffect, useMemo, useRef } from 'react';
|
|
2
|
+
import { AppBar, Box, Toolbar, Typography, Avatar, Tooltip } from '@/gui/components/atoms';
|
|
3
|
+
import { Link as RouterLink } from 'react-router-dom';
|
|
4
|
+
import Icon from '@/gui/Theme/Icon/Icon';
|
|
5
|
+
import { useGuiTheme, useGuiMediaQuery, useInsets, useUpdateInsets } from '@/gui/hooks';
|
|
6
|
+
import type { FooterProps, FooterElement } from './Footer.types';
|
|
7
|
+
import type { FooterLinkProps, FooterActionProps } from './Footer.types';
|
|
8
|
+
import type { SxProps, Theme } from '@mui/material/styles';
|
|
9
|
+
|
|
10
|
+
const sxN = (...parts: Array<SxProps<Theme> | undefined>): SxProps<Theme> =>
|
|
11
|
+
(parts.filter(Boolean) as unknown) as SxProps<Theme>;
|
|
12
|
+
|
|
13
|
+
type FooterLinkRenderProps = FooterLinkProps & {
|
|
14
|
+
showLabel: boolean;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
type FooterActionRenderProps = FooterActionProps & {
|
|
18
|
+
showLabel: boolean;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const FooterLink = ({
|
|
22
|
+
label,
|
|
23
|
+
icon,
|
|
24
|
+
iconColor,
|
|
25
|
+
href,
|
|
26
|
+
external,
|
|
27
|
+
onClick,
|
|
28
|
+
showLabel,
|
|
29
|
+
}: FooterLinkRenderProps) => {
|
|
30
|
+
const content = (
|
|
31
|
+
<Box
|
|
32
|
+
sx={{
|
|
33
|
+
display: 'flex',
|
|
34
|
+
alignItems: 'center',
|
|
35
|
+
gap: showLabel ? 1 : 0,
|
|
36
|
+
color: 'inherit',
|
|
37
|
+
textDecoration: 'none',
|
|
38
|
+
px: showLabel ? 1.5 : 0.75,
|
|
39
|
+
py: 0.75,
|
|
40
|
+
borderRadius: 1,
|
|
41
|
+
transition: 'background-color 0.2s ease, color 0.2s ease',
|
|
42
|
+
'&:hover': {
|
|
43
|
+
backgroundColor: 'action.hover',
|
|
44
|
+
},
|
|
45
|
+
}}
|
|
46
|
+
>
|
|
47
|
+
{icon && <Icon name={icon} iconColor={iconColor} />}
|
|
48
|
+
{showLabel && label && (
|
|
49
|
+
<Typography variant="body2" sx={{ fontWeight: 500 }}>
|
|
50
|
+
{label}
|
|
51
|
+
</Typography>
|
|
52
|
+
)}
|
|
53
|
+
</Box>
|
|
54
|
+
);
|
|
55
|
+
|
|
56
|
+
const wrappedContent =
|
|
57
|
+
!showLabel && label ? (
|
|
58
|
+
<Tooltip title={label} placement="top">
|
|
59
|
+
<span style={{ display: 'inline-flex' }}>{content}</span>
|
|
60
|
+
</Tooltip>
|
|
61
|
+
) : (
|
|
62
|
+
content
|
|
63
|
+
);
|
|
64
|
+
|
|
65
|
+
const commonProps = {
|
|
66
|
+
onClick,
|
|
67
|
+
style: { color: 'inherit' },
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
if (href) {
|
|
71
|
+
const component = href.startsWith('http')
|
|
72
|
+
? 'a'
|
|
73
|
+
: RouterLink;
|
|
74
|
+
return (
|
|
75
|
+
<Box
|
|
76
|
+
component={component as any}
|
|
77
|
+
to={!href.startsWith('http') ? href : undefined}
|
|
78
|
+
href={href.startsWith('http') ? href : undefined}
|
|
79
|
+
target={external ? '_blank' : undefined}
|
|
80
|
+
rel={external ? 'noopener noreferrer' : undefined}
|
|
81
|
+
sx={{ display: 'inline-flex' }}
|
|
82
|
+
{...commonProps}
|
|
83
|
+
>
|
|
84
|
+
{wrappedContent}
|
|
85
|
+
</Box>
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
return (
|
|
90
|
+
<Box component="button" type="button" sx={{ display: 'inline-flex', background: 'none', border: 'none', p: 0 }} {...commonProps}>
|
|
91
|
+
{wrappedContent}
|
|
92
|
+
</Box>
|
|
93
|
+
);
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
const FooterAction = ({
|
|
97
|
+
label,
|
|
98
|
+
icon,
|
|
99
|
+
iconColor,
|
|
100
|
+
onClick,
|
|
101
|
+
element,
|
|
102
|
+
showLabel,
|
|
103
|
+
}: FooterActionRenderProps) => {
|
|
104
|
+
if (element) {
|
|
105
|
+
return <Box sx={{ display: 'inline-flex', alignItems: 'center' }}>{element}</Box>;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
const content = (
|
|
109
|
+
<Box
|
|
110
|
+
sx={{
|
|
111
|
+
display: 'flex',
|
|
112
|
+
alignItems: 'center',
|
|
113
|
+
gap: showLabel ? 1 : 0,
|
|
114
|
+
px: showLabel ? 1.5 : 0.75,
|
|
115
|
+
py: 0.75,
|
|
116
|
+
borderRadius: 1,
|
|
117
|
+
transition: 'background-color 0.2s ease',
|
|
118
|
+
'&:hover': { backgroundColor: 'action.hover' },
|
|
119
|
+
color: 'inherit',
|
|
120
|
+
}}
|
|
121
|
+
onClick={onClick}
|
|
122
|
+
role="button"
|
|
123
|
+
>
|
|
124
|
+
{icon && <Icon name={icon} iconColor={iconColor} />}
|
|
125
|
+
{showLabel && label && (
|
|
126
|
+
<Typography variant="body2" sx={{ fontWeight: 500 }}>
|
|
127
|
+
{label}
|
|
128
|
+
</Typography>
|
|
129
|
+
)}
|
|
130
|
+
</Box>
|
|
131
|
+
);
|
|
132
|
+
|
|
133
|
+
if (!showLabel && label) {
|
|
134
|
+
return (
|
|
135
|
+
<Tooltip title={label} placement="top">
|
|
136
|
+
<span style={{ display: 'inline-flex' }}>{content}</span>
|
|
137
|
+
</Tooltip>
|
|
138
|
+
);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
return content;
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
function renderFooterElement(el: FooterElement, showLabel: boolean, key: string | number) {
|
|
145
|
+
if (el.type === 'link') return <FooterLink key={key} {...el.props} showLabel={showLabel} />;
|
|
146
|
+
if (el.type === 'action') return <FooterAction key={key} {...el.props} showLabel={showLabel} />;
|
|
147
|
+
return null;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
export default function Footer(props: FooterProps) {
|
|
151
|
+
const {
|
|
152
|
+
brandLabel = '',
|
|
153
|
+
brandLogo = '',
|
|
154
|
+
brandHref = '/',
|
|
155
|
+
brandAvatarFallback,
|
|
156
|
+
leftElements = [],
|
|
157
|
+
centerElements = [],
|
|
158
|
+
rightElements = [],
|
|
159
|
+
position = 'static',
|
|
160
|
+
elevation = 0,
|
|
161
|
+
className,
|
|
162
|
+
id,
|
|
163
|
+
sx,
|
|
164
|
+
appBarSx,
|
|
165
|
+
sectionSx,
|
|
166
|
+
'data-testid': dataTestId,
|
|
167
|
+
} = props;
|
|
168
|
+
|
|
169
|
+
const theme = useGuiTheme();
|
|
170
|
+
const isMobile = useGuiMediaQuery(theme.breakpoints.down('sm'));
|
|
171
|
+
const isTablet = useGuiMediaQuery(theme.breakpoints.between('sm', 'md'));
|
|
172
|
+
const isDesktop = useGuiMediaQuery(theme.breakpoints.up('md'));
|
|
173
|
+
const showLabels = isDesktop;
|
|
174
|
+
const showBrandLabel = !isMobile;
|
|
175
|
+
|
|
176
|
+
const insets = useInsets();
|
|
177
|
+
const updateInsets = useUpdateInsets();
|
|
178
|
+
const toolbarRef = useRef<HTMLDivElement | null>(null);
|
|
179
|
+
const appBarRef = useRef<HTMLDivElement | null>(null);
|
|
180
|
+
|
|
181
|
+
const insetLeft = Math.max(0, Number(insets?.left ?? 0));
|
|
182
|
+
const insetRight = Math.max(0, Number(insets?.right ?? 0));
|
|
183
|
+
const horizontalInset = insetLeft + insetRight;
|
|
184
|
+
|
|
185
|
+
const brandVisual = useMemo(() => {
|
|
186
|
+
if (brandLogo) {
|
|
187
|
+
return <Box component="img" src={brandLogo} alt={brandLabel ? `${brandLabel} logo` : 'Footer logo'} sx={{ height: 24 }} />;
|
|
188
|
+
}
|
|
189
|
+
const fallback = brandAvatarFallback || brandLabel?.trim().charAt(0)?.toUpperCase() || '?';
|
|
190
|
+
return <Avatar sx={{ width: 28, height: 28, fontSize: '0.875rem' }}>{fallback}</Avatar>;
|
|
191
|
+
}, [brandAvatarFallback, brandLabel, brandLogo]);
|
|
192
|
+
|
|
193
|
+
useEffect(() => {
|
|
194
|
+
if (typeof updateInsets !== 'function') return;
|
|
195
|
+
const measure = () => {
|
|
196
|
+
const target = appBarRef.current ?? toolbarRef.current;
|
|
197
|
+
const h = target?.offsetHeight ?? 56;
|
|
198
|
+
updateInsets({ bottom: position === 'fixed' || position === 'sticky' ? h : 0 });
|
|
199
|
+
};
|
|
200
|
+
measure();
|
|
201
|
+
|
|
202
|
+
let ro: ResizeObserver | undefined;
|
|
203
|
+
if (typeof ResizeObserver !== 'undefined') {
|
|
204
|
+
const target = appBarRef.current ?? toolbarRef.current;
|
|
205
|
+
if (target) {
|
|
206
|
+
ro = new ResizeObserver(() => measure());
|
|
207
|
+
ro.observe(target);
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
return () => {
|
|
212
|
+
if (ro) ro.disconnect();
|
|
213
|
+
updateInsets({ bottom: 0 });
|
|
214
|
+
};
|
|
215
|
+
}, [position, updateInsets, isMobile, isTablet]);
|
|
216
|
+
|
|
217
|
+
const isFixed = position === 'fixed' || position === 'sticky';
|
|
218
|
+
const baseAppBarSx = {
|
|
219
|
+
top: 'auto',
|
|
220
|
+
bottom: 0,
|
|
221
|
+
backgroundColor: theme.palette.background.paper ?? theme.palette.grey[900],
|
|
222
|
+
borderTop: '1px solid',
|
|
223
|
+
borderColor: theme.palette.divider,
|
|
224
|
+
minHeight: 56,
|
|
225
|
+
zIndex: (theme.zIndex?.appBar ?? 1100) - 1,
|
|
226
|
+
boxShadow: 'none',
|
|
227
|
+
...(isFixed
|
|
228
|
+
? {
|
|
229
|
+
position: 'fixed',
|
|
230
|
+
left: `${insetLeft}px`,
|
|
231
|
+
right: `${insetRight}px`,
|
|
232
|
+
width: `calc(100% - ${horizontalInset}px)`,
|
|
233
|
+
transition: 'left 0.3s ease, right 0.3s ease, width 0.3s ease',
|
|
234
|
+
}
|
|
235
|
+
: {
|
|
236
|
+
position: 'static',
|
|
237
|
+
left: `${insetLeft}px`,
|
|
238
|
+
right: `${insetRight}px`,
|
|
239
|
+
width: `calc(100% - ${horizontalInset}px)`,
|
|
240
|
+
transition: 'margin-left 0.3s ease, margin-right 0.3s ease, width 0.3s ease',
|
|
241
|
+
}),
|
|
242
|
+
} as const;
|
|
243
|
+
|
|
244
|
+
const flowAppBarSx = !isFixed
|
|
245
|
+
? ({
|
|
246
|
+
ml: `${insetLeft}px`,
|
|
247
|
+
mr: `${insetRight}px`,
|
|
248
|
+
width: `calc(100% - ${horizontalInset}px)`,
|
|
249
|
+
transition: 'margin-left 0.3s ease, margin-right 0.3s ease, width 0.3s ease',
|
|
250
|
+
} as SxProps<Theme>)
|
|
251
|
+
: undefined;
|
|
252
|
+
|
|
253
|
+
return (
|
|
254
|
+
<AppBar
|
|
255
|
+
ref={appBarRef}
|
|
256
|
+
id={id}
|
|
257
|
+
className={className}
|
|
258
|
+
data-testid={dataTestId}
|
|
259
|
+
position={position}
|
|
260
|
+
elevation={elevation}
|
|
261
|
+
sx={sxN(baseAppBarSx as SxProps<Theme>, flowAppBarSx, sx, appBarSx)}
|
|
262
|
+
>
|
|
263
|
+
<Toolbar
|
|
264
|
+
ref={toolbarRef}
|
|
265
|
+
variant="dense"
|
|
266
|
+
disableGutters
|
|
267
|
+
sx={sxN(
|
|
268
|
+
{
|
|
269
|
+
minHeight: 56,
|
|
270
|
+
px: 1.5,
|
|
271
|
+
py: 1,
|
|
272
|
+
display: 'flex',
|
|
273
|
+
alignItems: 'center',
|
|
274
|
+
justifyContent: 'space-between',
|
|
275
|
+
gap: 1.5,
|
|
276
|
+
},
|
|
277
|
+
sectionSx
|
|
278
|
+
)}
|
|
279
|
+
>
|
|
280
|
+
<Box
|
|
281
|
+
sx={{
|
|
282
|
+
display: 'flex',
|
|
283
|
+
alignItems: 'center',
|
|
284
|
+
gap: showLabels ? 1 : 0.5,
|
|
285
|
+
color: 'text.secondary',
|
|
286
|
+
flexShrink: 0,
|
|
287
|
+
}}
|
|
288
|
+
>
|
|
289
|
+
{leftElements.map((el, idx) => renderFooterElement(el, showLabels, `left-${idx}`))}
|
|
290
|
+
</Box>
|
|
291
|
+
|
|
292
|
+
<Box
|
|
293
|
+
sx={{
|
|
294
|
+
display: 'flex',
|
|
295
|
+
alignItems: 'center',
|
|
296
|
+
gap: showLabels ? 1 : 0.5,
|
|
297
|
+
flex: 1,
|
|
298
|
+
justifyContent: 'center',
|
|
299
|
+
color: 'text.secondary',
|
|
300
|
+
}}
|
|
301
|
+
>
|
|
302
|
+
{centerElements.map((el, idx) => renderFooterElement(el, showLabels, `center-${idx}`))}
|
|
303
|
+
</Box>
|
|
304
|
+
|
|
305
|
+
<Box
|
|
306
|
+
sx={{
|
|
307
|
+
display: 'flex',
|
|
308
|
+
alignItems: 'center',
|
|
309
|
+
gap: showLabels ? 1 : 0.75,
|
|
310
|
+
color: 'text.secondary',
|
|
311
|
+
flexShrink: 0,
|
|
312
|
+
}}
|
|
313
|
+
>
|
|
314
|
+
{rightElements.map((el, idx) => renderFooterElement(el, showLabels, `right-${idx}`))}
|
|
315
|
+
<Box
|
|
316
|
+
sx={{
|
|
317
|
+
display: 'flex',
|
|
318
|
+
alignItems: 'center',
|
|
319
|
+
gap: showBrandLabel ? 1 : 0.75,
|
|
320
|
+
textDecoration: 'none',
|
|
321
|
+
color: 'inherit',
|
|
322
|
+
}}
|
|
323
|
+
component={brandHref ? RouterLink : 'div'}
|
|
324
|
+
to={brandHref ? brandHref : undefined}
|
|
325
|
+
>
|
|
326
|
+
{brandVisual}
|
|
327
|
+
{showBrandLabel && brandLabel && (
|
|
328
|
+
<Typography variant="body2" sx={{ fontWeight: 600 }}>
|
|
329
|
+
{brandLabel}
|
|
330
|
+
</Typography>
|
|
331
|
+
)}
|
|
332
|
+
</Box>
|
|
333
|
+
</Box>
|
|
334
|
+
</Toolbar>
|
|
335
|
+
</AppBar>
|
|
336
|
+
);
|
|
337
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
|
|
3
|
+
export type FooterLinkProps = {
|
|
4
|
+
label?: string;
|
|
5
|
+
href?: string;
|
|
6
|
+
icon?: string;
|
|
7
|
+
iconColor?: string;
|
|
8
|
+
external?: boolean;
|
|
9
|
+
onClick?: () => void;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export type FooterActionProps = {
|
|
13
|
+
label?: string;
|
|
14
|
+
icon?: string;
|
|
15
|
+
iconColor?: string;
|
|
16
|
+
onClick?: () => void;
|
|
17
|
+
element?: React.ReactNode;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export type FooterElement =
|
|
21
|
+
| { type: 'link'; props: FooterLinkProps }
|
|
22
|
+
| { type: 'action'; props: FooterActionProps };
|
|
23
|
+
|
|
24
|
+
export type FooterProps = {
|
|
25
|
+
brandLabel?: string;
|
|
26
|
+
brandLogo?: string;
|
|
27
|
+
brandHref?: string;
|
|
28
|
+
brandAvatarFallback?: string;
|
|
29
|
+
leftElements?: FooterElement[];
|
|
30
|
+
centerElements?: FooterElement[];
|
|
31
|
+
rightElements?: FooterElement[];
|
|
32
|
+
position?: 'static' | 'fixed' | 'sticky';
|
|
33
|
+
elevation?: number;
|
|
34
|
+
className?: string;
|
|
35
|
+
id?: string;
|
|
36
|
+
'data-testid'?: string;
|
|
37
|
+
sx?: any;
|
|
38
|
+
appBarSx?: any;
|
|
39
|
+
sectionSx?: any;
|
|
40
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import Layout from './Layout';
|
|
3
|
+
import type { RegistryEntry } from '@/registry/types';
|
|
4
|
+
import type { LayoutSpec } from './Layout.types';
|
|
5
|
+
/**
|
|
6
|
+
* The LayoutResolver dynamically constructs a responsive layout
|
|
7
|
+
* using declarative JSON configuration.
|
|
8
|
+
*
|
|
9
|
+
* It resolves topBar, sidebars, footer, and content sections
|
|
10
|
+
* by passing their configs into the Layout component.
|
|
11
|
+
*/
|
|
12
|
+
const LayoutResolver: RegistryEntry = {
|
|
13
|
+
type: 'Layout',
|
|
14
|
+
resolve(spec: LayoutSpec) {
|
|
15
|
+
const props = spec.props ?? {};
|
|
16
|
+
const contentSections = spec.Content ?? [];
|
|
17
|
+
return (
|
|
18
|
+
<Layout
|
|
19
|
+
{...props}
|
|
20
|
+
>
|
|
21
|
+
{contentSections.map((section, index) => (
|
|
22
|
+
<React.Fragment key={index}>
|
|
23
|
+
{Array.isArray(section.children)
|
|
24
|
+
? section.children.map((child, i) => (
|
|
25
|
+
<div key={`${index}-${i}`} {...(child.props ?? {})}>
|
|
26
|
+
{child.type}
|
|
27
|
+
</div>
|
|
28
|
+
))
|
|
29
|
+
: null}
|
|
30
|
+
</React.Fragment>
|
|
31
|
+
))}
|
|
32
|
+
</Layout>
|
|
33
|
+
);
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export default LayoutResolver;
|
|
@@ -0,0 +1,290 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { Meta, StoryFn, StoryObj } from "@storybook/react";
|
|
3
|
+
import Layout from "./Layout";
|
|
4
|
+
import Page from '@/gui/components/molecules/Page/Page';
|
|
5
|
+
import ThemeModeToggle from "@/gui/components/molecules/Theme/ThemeModeToggle/ThemeModeToggle";
|
|
6
|
+
|
|
7
|
+
const meta: Meta<typeof Layout> = {
|
|
8
|
+
title: "Layouts/ResponsiveUI/Layout",
|
|
9
|
+
component: Layout,
|
|
10
|
+
tags: ["autodocs"],
|
|
11
|
+
parameters: {
|
|
12
|
+
docs: {
|
|
13
|
+
description: {
|
|
14
|
+
component: `
|
|
15
|
+
The **Layout** component wires the responsive shell used across This.GUI demos. It coordinates the TopBar, left/right sidebars, and Footer so their insets remain in sync while your application content renders inside.
|
|
16
|
+
---
|
|
17
|
+
## Features
|
|
18
|
+
- **Context wiring** – wraps children with the required providers (LeftSidebar, RightSidebar) so hooks and insets work automatically.
|
|
19
|
+
- **Composable regions** – optional \`topBarConfig\`, \`leftSidebarConfig\`, \`rightSidebarConfig\`, and \`footerConfig\` let you enable only what you need.
|
|
20
|
+
- **Inset aware** – whenever a sidebar expands or collapses, the layout updates theme insets so the TopBar/Footer and main content stay aligned.
|
|
21
|
+
- **Story-friendly** – serves as an orchestration helper in Storybook; in production you can lift the same pattern to your app shell.
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
## Declarative usage
|
|
25
|
+
~~~json
|
|
26
|
+
{
|
|
27
|
+
"type": "Layout",
|
|
28
|
+
"props": {
|
|
29
|
+
"topBarConfig": {
|
|
30
|
+
"title": "Workspace",
|
|
31
|
+
"elementsRight": [
|
|
32
|
+
{
|
|
33
|
+
"type": "action",
|
|
34
|
+
"props": {
|
|
35
|
+
"element": "ThemeModeToggle"
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
]
|
|
39
|
+
},
|
|
40
|
+
"leftSidebarConfig": {
|
|
41
|
+
"elements": [
|
|
42
|
+
{
|
|
43
|
+
"type": "link",
|
|
44
|
+
"props": {
|
|
45
|
+
"label": "Dashboard",
|
|
46
|
+
"icon": "dashboard"
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"type": "menu",
|
|
51
|
+
"props": {
|
|
52
|
+
"label": "Projects",
|
|
53
|
+
"icon": "folder",
|
|
54
|
+
"items": [
|
|
55
|
+
{
|
|
56
|
+
"label": "Project A",
|
|
57
|
+
"icon": "work"
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
"label": "Project B",
|
|
61
|
+
"icon": "assignment"
|
|
62
|
+
}
|
|
63
|
+
]
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
]
|
|
67
|
+
},
|
|
68
|
+
"footerConfig": {
|
|
69
|
+
"brandLabel": "Neuroverse",
|
|
70
|
+
"centerElements": [
|
|
71
|
+
{
|
|
72
|
+
"type": "link",
|
|
73
|
+
"props": {
|
|
74
|
+
"label": "Docs",
|
|
75
|
+
"href": "/docs",
|
|
76
|
+
"icon": "menu_book"
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
]
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
"Content": [
|
|
83
|
+
{
|
|
84
|
+
"children": [
|
|
85
|
+
{
|
|
86
|
+
"type": "Section",
|
|
87
|
+
"props": {
|
|
88
|
+
"title": "Overview"
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
"type": "Card",
|
|
93
|
+
"props": {
|
|
94
|
+
"title": "AI Metrics"
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
]
|
|
98
|
+
}
|
|
99
|
+
]
|
|
100
|
+
}
|
|
101
|
+
~~~
|
|
102
|
+
|
|
103
|
+
---
|
|
104
|
+
## React usage
|
|
105
|
+
Use the layout as a shell around your routes or dashboard pages. Pass config objects when you need a region; use \`false\` to omit it.
|
|
106
|
+
~~~tsx
|
|
107
|
+
function DashboardPage() {
|
|
108
|
+
return (
|
|
109
|
+
<Layout
|
|
110
|
+
topBarConfig={{
|
|
111
|
+
title: "Analytics",
|
|
112
|
+
elementsRight: [
|
|
113
|
+
{ type: "action", props: { element: <ThemeModeToggle variant="minimal" /> } },
|
|
114
|
+
],
|
|
115
|
+
}}
|
|
116
|
+
leftSidebarConfig={{
|
|
117
|
+
elements: [
|
|
118
|
+
{ type: "link", props: { label: "Overview", icon: "home" } },
|
|
119
|
+
{ type: "link", props: { label: "Reports", icon: "insights" } },
|
|
120
|
+
],
|
|
121
|
+
}}
|
|
122
|
+
rightSidebarConfig={{
|
|
123
|
+
elements: [
|
|
124
|
+
{ type: "link", props: { label: "Alerts", icon: "notifications" } },
|
|
125
|
+
],
|
|
126
|
+
}}
|
|
127
|
+
>
|
|
128
|
+
<Outlet />
|
|
129
|
+
</Layout>
|
|
130
|
+
);
|
|
131
|
+
}
|
|
132
|
+
~~~
|
|
133
|
+
|
|
134
|
+
---
|
|
135
|
+
## Notes
|
|
136
|
+
- Config objects mirror the props of the individual components (TopBar, LeftSidebar, RightSidebar, Footer). Anything you can pass there can be forwarded through the layout.
|
|
137
|
+
- Set a config to \`false\` (or omit it) to exclude that region entirely.
|
|
138
|
+
- Children render in document order beneath any enabled sidebars/top bar – for sticky layouts remember to add padding or section containers as shown below.
|
|
139
|
+
`,
|
|
140
|
+
},
|
|
141
|
+
},
|
|
142
|
+
},
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
export default meta;
|
|
146
|
+
|
|
147
|
+
const Template: StoryFn<React.ComponentProps<typeof Layout>> = (args) => (
|
|
148
|
+
<Layout {...args}>
|
|
149
|
+
<div
|
|
150
|
+
style={{
|
|
151
|
+
minHeight: "120vh",
|
|
152
|
+
padding: "72px 24px 120px",
|
|
153
|
+
display: "flex",
|
|
154
|
+
flexDirection: "column",
|
|
155
|
+
gap: 16,
|
|
156
|
+
}}
|
|
157
|
+
>
|
|
158
|
+
<h2>Responsive Layout Demo</h2>
|
|
159
|
+
<p>
|
|
160
|
+
Resize the viewport or toggle sidebars to observe how insets are coordinated.
|
|
161
|
+
The content block is intentionally tall to show how fixed bars interact with scrolling.
|
|
162
|
+
</p>
|
|
163
|
+
</div>
|
|
164
|
+
</Layout>
|
|
165
|
+
);
|
|
166
|
+
|
|
167
|
+
type Story = StoryObj<typeof Layout>;
|
|
168
|
+
|
|
169
|
+
export const TopOnly: Story = {
|
|
170
|
+
render: Template,
|
|
171
|
+
args: {
|
|
172
|
+
topBarConfig: {
|
|
173
|
+
title: "Neuroverse",
|
|
174
|
+
elementsRight: [
|
|
175
|
+
{
|
|
176
|
+
type: "action",
|
|
177
|
+
props: {
|
|
178
|
+
element: <ThemeModeToggle variant="minimal" show="icons" iconSize="small" />,
|
|
179
|
+
},
|
|
180
|
+
},
|
|
181
|
+
],
|
|
182
|
+
},
|
|
183
|
+
leftSidebarConfig: false,
|
|
184
|
+
rightSidebarConfig: false,
|
|
185
|
+
footerConfig: false,
|
|
186
|
+
},
|
|
187
|
+
};
|
|
188
|
+
|
|
189
|
+
export const TopWithLeftSidebar: Story = {
|
|
190
|
+
render: Template,
|
|
191
|
+
args: {
|
|
192
|
+
...TopOnly.args,
|
|
193
|
+
leftSidebarConfig: {
|
|
194
|
+
elements: [
|
|
195
|
+
{ type: "link", props: { label: "Overview", icon: "dashboard" } },
|
|
196
|
+
{
|
|
197
|
+
type: "menu",
|
|
198
|
+
props: {
|
|
199
|
+
label: "Projects",
|
|
200
|
+
icon: "folder",
|
|
201
|
+
items: [
|
|
202
|
+
{ label: "Project Alpha", icon: "work" },
|
|
203
|
+
{ label: "Project Beta", icon: "assignment" },
|
|
204
|
+
],
|
|
205
|
+
},
|
|
206
|
+
},
|
|
207
|
+
],
|
|
208
|
+
footerElements: [
|
|
209
|
+
{ type: "link", props: { label: "Settings", icon: "settings" } },
|
|
210
|
+
],
|
|
211
|
+
},
|
|
212
|
+
},
|
|
213
|
+
};
|
|
214
|
+
|
|
215
|
+
export const TopWithLeftAndRight: Story = {
|
|
216
|
+
render: Template,
|
|
217
|
+
args: {
|
|
218
|
+
...TopWithLeftSidebar.args,
|
|
219
|
+
rightSidebarConfig: {
|
|
220
|
+
elements: [
|
|
221
|
+
{ type: "link", props: { label: "Activity", icon: "history" } },
|
|
222
|
+
{ type: "action", props: { label: "Export", icon: "download" } },
|
|
223
|
+
],
|
|
224
|
+
},
|
|
225
|
+
},
|
|
226
|
+
};
|
|
227
|
+
|
|
228
|
+
export const FullShellWithFooter: Story = {
|
|
229
|
+
render: Template,
|
|
230
|
+
args: {
|
|
231
|
+
...TopWithLeftAndRight.args,
|
|
232
|
+
footerConfig: {
|
|
233
|
+
brandLabel: "Neuroverse",
|
|
234
|
+
brandLogo: "https://neurons.me/neurons.me.png",
|
|
235
|
+
centerElements: [
|
|
236
|
+
{ type: "link", props: { label: "Docs", href: "/docs", icon: "menu_book", iconColor: "var(--gui-primary)" } },
|
|
237
|
+
{ type: "link", props: { label: "API", href: "/api", icon: "code", iconColor: "var(--gui-secondary)" } },
|
|
238
|
+
],
|
|
239
|
+
rightElements: [
|
|
240
|
+
{ type: "link", props: { label: "Community", href: "https://community.neuroverse.ai", icon: "forum", iconColor: "var(--gui-info)", external: true } },
|
|
241
|
+
{ type: "link", props: { label: "GitHub", href: "https://github.com", icon: "code", iconColor: "var(--gui-warning)", external: true } },
|
|
242
|
+
],
|
|
243
|
+
position: "fixed",
|
|
244
|
+
},
|
|
245
|
+
},
|
|
246
|
+
};
|
|
247
|
+
|
|
248
|
+
export const ContentOnly: Story = {
|
|
249
|
+
render: Template,
|
|
250
|
+
args: {
|
|
251
|
+
topBarConfig: false,
|
|
252
|
+
leftSidebarConfig: false,
|
|
253
|
+
rightSidebarConfig: false,
|
|
254
|
+
footerConfig: false,
|
|
255
|
+
},
|
|
256
|
+
};
|
|
257
|
+
|
|
258
|
+
|
|
259
|
+
export const LayoutWithPage: Story = {
|
|
260
|
+
render: () => (
|
|
261
|
+
<Layout
|
|
262
|
+
topBarConfig={{ title: 'Neuroverse Workspace' }}
|
|
263
|
+
leftSidebarConfig={{
|
|
264
|
+
elements: [
|
|
265
|
+
{ type: 'link', props: { label: 'Home', icon: 'home' } },
|
|
266
|
+
{ type: 'link', props: { label: 'Analytics', icon: 'insights' } },
|
|
267
|
+
],
|
|
268
|
+
}}
|
|
269
|
+
rightSidebarConfig={{
|
|
270
|
+
elements: [
|
|
271
|
+
{ type: 'link', props: { label: 'Chat', icon: 'chat' } },
|
|
272
|
+
],
|
|
273
|
+
}}
|
|
274
|
+
footerConfig={{
|
|
275
|
+
brandLabel: 'Neuroverse',
|
|
276
|
+
centerElements: [
|
|
277
|
+
{ type: 'link', props: { label: 'Docs', icon: 'menu_book' } },
|
|
278
|
+
],
|
|
279
|
+
}}
|
|
280
|
+
>
|
|
281
|
+
<Page background="linear-gradient(135deg, #0a192f, #172a45)" padding={4}>
|
|
282
|
+
<h2 style={{ color: 'white', marginBottom: 16 }}>Page inside Layout</h2>
|
|
283
|
+
<p style={{ color: 'white', maxWidth: 600 }}>
|
|
284
|
+
This example shows how a Page component can be used inside the responsive Layout,
|
|
285
|
+
automatically adapting to inset updates from the TopBar, sidebars, and Footer.
|
|
286
|
+
</p>
|
|
287
|
+
</Page>
|
|
288
|
+
</Layout>
|
|
289
|
+
),
|
|
290
|
+
};
|