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,152 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Box, useTheme } from '@mui/material';
|
|
3
|
+
import type { HeroSectionProps } from './HeroSection.types';
|
|
4
|
+
|
|
5
|
+
function resolveBlurRadius(theme: any, blur?: 'none'|'light'|'medium'|'heavy'|'all'): string {
|
|
6
|
+
if (!blur || blur === 'none') return '0px';
|
|
7
|
+
const fromTheme = theme?.custom?.blurRadius?.[blur];
|
|
8
|
+
return fromTheme ?? '0px';
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function resolveOverlayColor(
|
|
12
|
+
theme: any,
|
|
13
|
+
blur?: 'none' | 'light' | 'medium' | 'heavy' | 'all',
|
|
14
|
+
customColor?: string,
|
|
15
|
+
overlayColor?: string
|
|
16
|
+
): string {
|
|
17
|
+
const paletteBlur = blur ? theme?.palette?.blur?.[blur] : undefined;
|
|
18
|
+
|
|
19
|
+
const resolved =
|
|
20
|
+
customColor
|
|
21
|
+
? customColor
|
|
22
|
+
: paletteBlur?.$value
|
|
23
|
+
? paletteBlur.$value
|
|
24
|
+
: typeof paletteBlur === 'string'
|
|
25
|
+
? paletteBlur
|
|
26
|
+
: overlayColor || 'transparent';
|
|
27
|
+
|
|
28
|
+
console.log('resolveOverlayColor inputs:', { blur, customColor, overlayColor, paletteBlur });
|
|
29
|
+
console.log('resolveOverlayColor resolved:', resolved);
|
|
30
|
+
|
|
31
|
+
return resolved;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function resolveMediaFilter(blurRadius: string, blur?: 'none'|'light'|'medium'|'heavy'|'all'): string | undefined {
|
|
35
|
+
if (!blur || blur === 'none') return 'none';
|
|
36
|
+
return blur === 'all' ? 'saturate(1.05) brightness(0.96)' : 'none';
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export const HeroSection: React.FC<HeroSectionProps> = ({
|
|
40
|
+
backgroundSrc,
|
|
41
|
+
backgroundType = 'image',
|
|
42
|
+
overlayColor,
|
|
43
|
+
children,
|
|
44
|
+
height = '100vh',
|
|
45
|
+
padding = 4,
|
|
46
|
+
blur,
|
|
47
|
+
customColor,
|
|
48
|
+
}) => {
|
|
49
|
+
const theme = useTheme();
|
|
50
|
+
|
|
51
|
+
//console.log('theme.palette.blur:', theme.palette.blur);
|
|
52
|
+
//console.log('theme.custom.blurRadius:', theme.custom.blurRadius);
|
|
53
|
+
//console.log(theme.palette.blur);
|
|
54
|
+
const blurRadius = resolveBlurRadius(theme, blur);
|
|
55
|
+
const overlayBg = resolveOverlayColor(theme, blur, customColor, overlayColor);
|
|
56
|
+
const mediaFilter = resolveMediaFilter(blurRadius, blur);
|
|
57
|
+
|
|
58
|
+
return (
|
|
59
|
+
<Box
|
|
60
|
+
component="section"
|
|
61
|
+
sx={{
|
|
62
|
+
position: 'fixed',
|
|
63
|
+
top: 0,
|
|
64
|
+
left: 0,
|
|
65
|
+
width: '100vw',
|
|
66
|
+
height,
|
|
67
|
+
margin: 0,
|
|
68
|
+
padding: 0,
|
|
69
|
+
overflow: 'hidden',
|
|
70
|
+
display: 'flex',
|
|
71
|
+
alignItems: 'center',
|
|
72
|
+
justifyContent: 'center',
|
|
73
|
+
boxSizing: 'border-box',
|
|
74
|
+
zIndex: 0,
|
|
75
|
+
backgroundColor: 'transparent',
|
|
76
|
+
}}
|
|
77
|
+
>
|
|
78
|
+
{backgroundSrc && (
|
|
79
|
+
<>
|
|
80
|
+
{backgroundType === 'video' ? (
|
|
81
|
+
<Box
|
|
82
|
+
component="video"
|
|
83
|
+
src={backgroundSrc}
|
|
84
|
+
autoPlay
|
|
85
|
+
muted
|
|
86
|
+
loop
|
|
87
|
+
playsInline
|
|
88
|
+
sx={{
|
|
89
|
+
position: 'absolute',
|
|
90
|
+
top: 0,
|
|
91
|
+
left: 0,
|
|
92
|
+
width: '100%',
|
|
93
|
+
height: '100%',
|
|
94
|
+
objectFit: 'cover',
|
|
95
|
+
zIndex: 0,
|
|
96
|
+
filter: mediaFilter,
|
|
97
|
+
willChange: 'transform, filter',
|
|
98
|
+
transform: 'translateZ(0)',
|
|
99
|
+
}}
|
|
100
|
+
/>
|
|
101
|
+
) : (
|
|
102
|
+
<Box
|
|
103
|
+
component="img"
|
|
104
|
+
src={backgroundSrc}
|
|
105
|
+
alt=""
|
|
106
|
+
sx={{
|
|
107
|
+
position: 'absolute',
|
|
108
|
+
top: 0,
|
|
109
|
+
left: 0,
|
|
110
|
+
width: '100%',
|
|
111
|
+
height: '100%',
|
|
112
|
+
objectFit: 'cover',
|
|
113
|
+
zIndex: 0,
|
|
114
|
+
filter: mediaFilter,
|
|
115
|
+
willChange: 'transform, filter',
|
|
116
|
+
transform: 'translateZ(0)',
|
|
117
|
+
}}
|
|
118
|
+
/>
|
|
119
|
+
)}
|
|
120
|
+
|
|
121
|
+
{/* Overlay Layer */}
|
|
122
|
+
<Box
|
|
123
|
+
sx={{
|
|
124
|
+
position: 'absolute',
|
|
125
|
+
top: 0,
|
|
126
|
+
left: 0,
|
|
127
|
+
width: '100%',
|
|
128
|
+
height: '100%',
|
|
129
|
+
backgroundColor: overlayBg,
|
|
130
|
+
// backdropFilter: blur ? `blur(${blurRadius})` : undefined,
|
|
131
|
+
// WebkitBackdropFilter: blur ? `blur(${blurRadius})` : undefined,
|
|
132
|
+
zIndex: 2,
|
|
133
|
+
transition: 'opacity 0.4s ease',
|
|
134
|
+
}}
|
|
135
|
+
/>
|
|
136
|
+
</>
|
|
137
|
+
)}
|
|
138
|
+
|
|
139
|
+
<Box
|
|
140
|
+
sx={{
|
|
141
|
+
position: 'relative',
|
|
142
|
+
zIndex: 3,
|
|
143
|
+
textAlign: 'center',
|
|
144
|
+
color: 'text.primary',
|
|
145
|
+
px: padding,
|
|
146
|
+
}}
|
|
147
|
+
>
|
|
148
|
+
{children}
|
|
149
|
+
</Box>
|
|
150
|
+
</Box>
|
|
151
|
+
);
|
|
152
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export interface HeroSectionProps {
|
|
2
|
+
/** Imagen, video o GIF de fondo */
|
|
3
|
+
backgroundSrc?: string;
|
|
4
|
+
/** Tipo de medio: 'image' | 'video' | 'gif' */
|
|
5
|
+
backgroundType?: 'image' | 'video' | 'gif';
|
|
6
|
+
/** Color del overlay (default: theme.palette.background.default) */
|
|
7
|
+
overlayColor?: string;
|
|
8
|
+
/** Contenido principal (texto, botones, etc.) */
|
|
9
|
+
children?: React.ReactNode;
|
|
10
|
+
/** Altura opcional (por defecto: 100vh) */
|
|
11
|
+
height?: string | number;
|
|
12
|
+
/** Padding interno (por defecto: responsive según theme.spacing) */
|
|
13
|
+
padding?: number | string;
|
|
14
|
+
/** Nivel de desenfoque: 'none' | 'light' | 'medium' | 'heavy' | 'all' */
|
|
15
|
+
blur?: 'none' | 'light' | 'medium' | 'heavy' | 'all';
|
|
16
|
+
/** Color personalizado del overlay (anula overlayColor si se define) */
|
|
17
|
+
customColor?: string;
|
|
18
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { RegistryEntry } from '@/registry/types';
|
|
3
|
+
import { ensureNodeId } from '@/gui/utils/nodeID';
|
|
4
|
+
import ModalBox from './ModalBox';
|
|
5
|
+
import type { ModalBoxProps } from './ModalBox.types.ts';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* ModalBoxResolver
|
|
9
|
+
* - Declaratively maps a JSON-friendly spec to <ModalBox /> props.
|
|
10
|
+
* - Supports declarative 3D position via xyz prop.
|
|
11
|
+
* - Keeps it registry-compatible for GUI schema systems.
|
|
12
|
+
*/
|
|
13
|
+
const ModalBoxResolver: RegistryEntry = {
|
|
14
|
+
type: 'ModalBox',
|
|
15
|
+
resolve(spec: any) {
|
|
16
|
+
const p: ModalBoxProps = spec.props ?? {};
|
|
17
|
+
const rootProps: any = {
|
|
18
|
+
open: p.open ?? false,
|
|
19
|
+
title: p.title ?? '',
|
|
20
|
+
onClose: p.onClose ?? (() => {}),
|
|
21
|
+
width: p.width ?? 'auto',
|
|
22
|
+
height: p.height ?? 'auto',
|
|
23
|
+
blurBackground: p.blurBackground ?? true,
|
|
24
|
+
xyz: p.xyz,
|
|
25
|
+
id: ensureNodeId('modalbox', p.id),
|
|
26
|
+
className: p.className,
|
|
27
|
+
'data-testid': p['data-testid'],
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
return (
|
|
31
|
+
<ModalBox {...rootProps}>
|
|
32
|
+
{p.children}
|
|
33
|
+
</ModalBox>
|
|
34
|
+
);
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export default ModalBoxResolver;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import React, { useState } from "react";
|
|
3
|
+
import ModalBox from "./ModalBox";
|
|
4
|
+
import { Button } from "@mui/material";
|
|
5
|
+
|
|
6
|
+
const meta: Meta<typeof ModalBox> = {
|
|
7
|
+
title: "Molecules/Display/ModalBox",
|
|
8
|
+
component: ModalBox,
|
|
9
|
+
tags: ["autodocs"],
|
|
10
|
+
decorators: [
|
|
11
|
+
(Story) => (
|
|
12
|
+
<div style={{ height: "100vh", overflow: "hidden" }}>
|
|
13
|
+
<Story />
|
|
14
|
+
</div>
|
|
15
|
+
),
|
|
16
|
+
],
|
|
17
|
+
parameters: {
|
|
18
|
+
docs: {
|
|
19
|
+
description: {
|
|
20
|
+
component: `
|
|
21
|
+
**ModalBox** is a flexible, theme-aware modal container with optional background blur and 3D placement support via \`xyz\` props.
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
## Features
|
|
25
|
+
- Supports background blur overlay for visual depth.
|
|
26
|
+
- Centered responsive layout with dynamic width and height.
|
|
27
|
+
- Declarative 3D placement via \`xyz: [x, y, z]\`.
|
|
28
|
+
- Works with any child components (forms, dialogs, previews, etc.).
|
|
29
|
+
- Compatible with GUI registry and schema resolvers.
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
## Props
|
|
33
|
+
- \`open\`: Boolean that controls visibility.
|
|
34
|
+
- \`title\`: Optional modal header title.
|
|
35
|
+
- \`onClose\`: Function triggered when closing.
|
|
36
|
+
- \`width\`, \`height\`: Custom modal dimensions.
|
|
37
|
+
- \`blurBackground\`: Enables or disables background blur.
|
|
38
|
+
- \`xyz\`: 3D position array for spatial positioning.
|
|
39
|
+
- \`children\`: Modal content.
|
|
40
|
+
`,
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
};
|
|
45
|
+
export default meta;
|
|
46
|
+
type Story = StoryObj<typeof ModalBox>;
|
|
47
|
+
|
|
48
|
+
export const Default: Story = {
|
|
49
|
+
render: (args) => {
|
|
50
|
+
const [open, setOpen] = useState(true); // force open for debugging
|
|
51
|
+
console.log("ModalBox render", { open, args });
|
|
52
|
+
|
|
53
|
+
return (
|
|
54
|
+
<div
|
|
55
|
+
style={{
|
|
56
|
+
position: "relative",
|
|
57
|
+
height: "100vh",
|
|
58
|
+
background: "rgba(0,0,0,0.2)",
|
|
59
|
+
display: "flex",
|
|
60
|
+
alignItems: "center",
|
|
61
|
+
justifyContent: "center",
|
|
62
|
+
}}
|
|
63
|
+
>
|
|
64
|
+
<ModalBox
|
|
65
|
+
{...args}
|
|
66
|
+
open={open}
|
|
67
|
+
onClose={() => setOpen(false)}
|
|
68
|
+
title={args.title || "Modal Title"}
|
|
69
|
+
>
|
|
70
|
+
<p style={{ color: "#fff" }}>This is an example modal content.</p>
|
|
71
|
+
<p style={{ color: "#ccc" }}>If you see this text, the modal is visible.</p>
|
|
72
|
+
</ModalBox>
|
|
73
|
+
</div>
|
|
74
|
+
);
|
|
75
|
+
},
|
|
76
|
+
args: {
|
|
77
|
+
title: "Example Modal",
|
|
78
|
+
blurBackground: true,
|
|
79
|
+
width: 400,
|
|
80
|
+
height: "auto",
|
|
81
|
+
},
|
|
82
|
+
};
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Box, Typography, IconButton } from "@mui/material";
|
|
3
|
+
// Try importing CloseIcon from MUI; fallback to a local SVG if missing
|
|
4
|
+
let CloseIcon: any;
|
|
5
|
+
try {
|
|
6
|
+
// @ts-ignore
|
|
7
|
+
CloseIcon = require("@mui/icons-material/Close").default;
|
|
8
|
+
} catch {
|
|
9
|
+
CloseIcon = () => (
|
|
10
|
+
<svg width="24" height="24" viewBox="0 0 24 24" fill="none">
|
|
11
|
+
<path d="M6 6L18 18M6 18L18 6" stroke="#000" strokeWidth="2" strokeLinecap="round" />
|
|
12
|
+
</svg>
|
|
13
|
+
);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
interface ModalBoxProps {
|
|
17
|
+
open: boolean;
|
|
18
|
+
title?: string;
|
|
19
|
+
onClose: () => void;
|
|
20
|
+
children?: React.ReactNode;
|
|
21
|
+
width?: number | string;
|
|
22
|
+
height?: number | string;
|
|
23
|
+
blurBackground?: boolean;
|
|
24
|
+
xyz?: { x?: number; y?: number; z?: number };
|
|
25
|
+
insets?: { top?: number; right?: number; bottom?: number; left?: number };
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const ModalBox: React.FC<ModalBoxProps> = ({
|
|
29
|
+
open,
|
|
30
|
+
title,
|
|
31
|
+
onClose,
|
|
32
|
+
children,
|
|
33
|
+
width = 400,
|
|
34
|
+
height = "auto",
|
|
35
|
+
blurBackground = true,
|
|
36
|
+
xyz,
|
|
37
|
+
insets,
|
|
38
|
+
}) => {
|
|
39
|
+
if (!open) return null;
|
|
40
|
+
|
|
41
|
+
return (
|
|
42
|
+
<Box
|
|
43
|
+
sx={{
|
|
44
|
+
position: "fixed",
|
|
45
|
+
top: 0,
|
|
46
|
+
left: 0,
|
|
47
|
+
width: "100vw",
|
|
48
|
+
height: "100vh",
|
|
49
|
+
background: blurBackground
|
|
50
|
+
? "rgba(0,0,0,0.4)"
|
|
51
|
+
: "rgba(0,0,0,0.7)",
|
|
52
|
+
backdropFilter: blurBackground ? "blur(6px)" : "none",
|
|
53
|
+
display: "flex",
|
|
54
|
+
justifyContent: "center",
|
|
55
|
+
alignItems: "center",
|
|
56
|
+
zIndex: 9999,
|
|
57
|
+
}}
|
|
58
|
+
onClick={onClose}
|
|
59
|
+
>
|
|
60
|
+
<Box
|
|
61
|
+
sx={{
|
|
62
|
+
width,
|
|
63
|
+
height,
|
|
64
|
+
background: "rgba(255,255,255,0.9)",
|
|
65
|
+
borderRadius: 4,
|
|
66
|
+
boxShadow: "0 0 30px rgba(0,0,0,0.3)",
|
|
67
|
+
position: "absolute",
|
|
68
|
+
padding: 3,
|
|
69
|
+
color: "#222",
|
|
70
|
+
backdropFilter: "blur(8px)",
|
|
71
|
+
animation: "fadeIn 0.25s ease",
|
|
72
|
+
top: insets?.top ?? "50%",
|
|
73
|
+
left: insets?.left ?? "50%",
|
|
74
|
+
right: insets?.right,
|
|
75
|
+
bottom: insets?.bottom,
|
|
76
|
+
transform: `translate(-50%, -50%) ${
|
|
77
|
+
xyz ? `translate3d(${xyz.x || 0}px, ${xyz.y || 0}px, ${xyz.z || 0}px)` : ""
|
|
78
|
+
}`,
|
|
79
|
+
transformStyle: "preserve-3d",
|
|
80
|
+
}}
|
|
81
|
+
onClick={(e) => e.stopPropagation()}
|
|
82
|
+
>
|
|
83
|
+
{title && (
|
|
84
|
+
<Typography variant="h6" sx={{ mb: 2, fontWeight: 600 }}>
|
|
85
|
+
{title}
|
|
86
|
+
</Typography>
|
|
87
|
+
)}
|
|
88
|
+
<IconButton
|
|
89
|
+
onClick={onClose}
|
|
90
|
+
sx={{
|
|
91
|
+
position: "absolute",
|
|
92
|
+
top: 8,
|
|
93
|
+
right: 8,
|
|
94
|
+
color: "#333",
|
|
95
|
+
}}
|
|
96
|
+
>
|
|
97
|
+
<CloseIcon />
|
|
98
|
+
</IconButton>
|
|
99
|
+
|
|
100
|
+
<Box>{children}</Box>
|
|
101
|
+
</Box>
|
|
102
|
+
</Box>
|
|
103
|
+
);
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
export default ModalBox;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ModalBoxProps
|
|
3
|
+
* Declarative prop types for the ModalBox component.
|
|
4
|
+
* Supports basic modal behavior and 3D positioning.
|
|
5
|
+
*/
|
|
6
|
+
export interface ModalBoxProps {
|
|
7
|
+
/** Controls whether the modal is open or closed */
|
|
8
|
+
open: boolean;
|
|
9
|
+
/** Optional title to display in the modal header */
|
|
10
|
+
title?: string;
|
|
11
|
+
/** Handler to call when the modal should close */
|
|
12
|
+
onClose?: () => void;
|
|
13
|
+
/** Modal width (e.g., '400px', '60%', etc.) */
|
|
14
|
+
width?: string | number;
|
|
15
|
+
/** Modal height (e.g., 'auto', '80vh', etc.) */
|
|
16
|
+
height?: string | number;
|
|
17
|
+
/** Applies a background blur effect when true */
|
|
18
|
+
blurBackground?: boolean;
|
|
19
|
+
/** Optional 3D position vector for experimental modal placement */
|
|
20
|
+
xyz?: [number, number, number];
|
|
21
|
+
/** Additional className for styling */
|
|
22
|
+
className?: string;
|
|
23
|
+
/** Optional ID for targeting and registry mapping */
|
|
24
|
+
id?: string;
|
|
25
|
+
/** Optional test ID for automated testing */
|
|
26
|
+
['data-testid']?: string;
|
|
27
|
+
/** Modal content */
|
|
28
|
+
children?: React.ReactNode;
|
|
29
|
+
}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import Layout from '@/gui/Layouts/ResponsiveUI/Layout/Layout';
|
|
2
|
+
import { HeroSection } from '@/gui/components/molecules/HeroSection/HeroSection';
|
|
3
|
+
import { InsetsProvider } from '@/gui/contexts/InsetsContext';
|
|
4
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
5
|
+
import Page from './Page';
|
|
6
|
+
|
|
7
|
+
const meta: Meta<typeof Page> = {
|
|
8
|
+
title: 'Molecules/Content/Page',
|
|
9
|
+
component: Page,
|
|
10
|
+
tags: ['autodocs'],
|
|
11
|
+
parameters: {
|
|
12
|
+
docs: {
|
|
13
|
+
description: {
|
|
14
|
+
component: `
|
|
15
|
+
**Page** is a layout container used to render content inside a layout or route.
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
## Features
|
|
19
|
+
- Acts as a flexible container for layout content.
|
|
20
|
+
- Supports padding, background color, and custom \`sx\` overrides.
|
|
21
|
+
- Centers and spaces content using responsive defaults.
|
|
22
|
+
- Works seamlessly inside \`Layout\` components.
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
## Props
|
|
26
|
+
- \`children\`: React nodes to render within the page.
|
|
27
|
+
- \`padding\`: Number or string for inner spacing.
|
|
28
|
+
- \`background\`: Background color or gradient.
|
|
29
|
+
- \`sx\`: MUI style overrides.
|
|
30
|
+
- \`insets\`: Optional positioning insets (top, right, bottom, left) for dynamic positioning.
|
|
31
|
+
`,
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
export default meta;
|
|
37
|
+
|
|
38
|
+
type Story = StoryObj<typeof Page>;
|
|
39
|
+
|
|
40
|
+
export const Default: Story = {
|
|
41
|
+
args: {
|
|
42
|
+
children: (
|
|
43
|
+
<div style={{ textAlign: 'center', fontSize: '1.5rem', marginTop: '40vh' }}>
|
|
44
|
+
This is a default Page.
|
|
45
|
+
</div>
|
|
46
|
+
),
|
|
47
|
+
},
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export const WithPadding: Story = {
|
|
51
|
+
args: {
|
|
52
|
+
padding: 6,
|
|
53
|
+
children: (
|
|
54
|
+
<div style={{ textAlign: 'center', fontSize: '1.5rem' }}>
|
|
55
|
+
Page with custom padding (6)
|
|
56
|
+
</div>
|
|
57
|
+
),
|
|
58
|
+
},
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
export const WithBackground: Story = {
|
|
62
|
+
args: {
|
|
63
|
+
background: 'linear-gradient(135deg, #00bcd4, #006064)',
|
|
64
|
+
children: (
|
|
65
|
+
<div style={{ color: 'white', fontSize: '1.5rem', textAlign: 'center', marginTop: '40vh' }}>
|
|
66
|
+
Page with gradient background
|
|
67
|
+
</div>
|
|
68
|
+
),
|
|
69
|
+
},
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
export const CustomSx: Story = {
|
|
73
|
+
args: {
|
|
74
|
+
sx: {
|
|
75
|
+
border: '2px dashed #29b6f6',
|
|
76
|
+
borderRadius: '16px',
|
|
77
|
+
backgroundColor: '#e3f2fd',
|
|
78
|
+
},
|
|
79
|
+
children: (
|
|
80
|
+
<div style={{ textAlign: 'center', fontSize: '1.5rem', marginTop: '40vh' }}>
|
|
81
|
+
Page with custom sx styles
|
|
82
|
+
</div>
|
|
83
|
+
),
|
|
84
|
+
},
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
export const InsetsAwarePage: Story = {
|
|
88
|
+
render: (args) => (
|
|
89
|
+
<InsetsProvider>
|
|
90
|
+
<Page {...args}>
|
|
91
|
+
<div style={{ textAlign: 'center', fontSize: '1.5rem', marginTop: '40vh' }}>
|
|
92
|
+
Page with padding that adapts to layout insets.
|
|
93
|
+
</div>
|
|
94
|
+
</Page>
|
|
95
|
+
</InsetsProvider>
|
|
96
|
+
),
|
|
97
|
+
args: {
|
|
98
|
+
background: "rgba(0, 188, 212, 0.15)",
|
|
99
|
+
padding: 24,
|
|
100
|
+
insetsAware: true,
|
|
101
|
+
},
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
export const LayoutWithPageAndHero: Story = {
|
|
105
|
+
render: () => (
|
|
106
|
+
<InsetsProvider>
|
|
107
|
+
<Layout
|
|
108
|
+
topBarConfig={{ title: 'Neuroverse Layout' }}
|
|
109
|
+
leftSidebarConfig={{ initialView: 'menu' }}
|
|
110
|
+
rightSidebarConfig={{ initialView: 'chat' }}
|
|
111
|
+
>
|
|
112
|
+
<Page background="linear-gradient(135deg, #0a192f, #172a45)" padding={4}>
|
|
113
|
+
<HeroSection
|
|
114
|
+
backgroundSrc="https://images.unsplash.com/photo-1522202195463-8f34a5fa1d15"
|
|
115
|
+
backgroundType="image"
|
|
116
|
+
overlayColor="rgba(10, 25, 47, 0.6)"
|
|
117
|
+
blur="light"
|
|
118
|
+
>
|
|
119
|
+
<div
|
|
120
|
+
style={{
|
|
121
|
+
color: 'white',
|
|
122
|
+
fontSize: '2rem',
|
|
123
|
+
fontWeight: 600,
|
|
124
|
+
textAlign: 'center',
|
|
125
|
+
marginTop: '40vh',
|
|
126
|
+
}}
|
|
127
|
+
>
|
|
128
|
+
Layout with TopBar, LeftSidebar and a HeroSection inside Page
|
|
129
|
+
</div>
|
|
130
|
+
</HeroSection>
|
|
131
|
+
</Page>
|
|
132
|
+
</Layout>
|
|
133
|
+
</InsetsProvider>
|
|
134
|
+
),
|
|
135
|
+
};
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
// Page.tsx
|
|
2
|
+
import React, { useMemo } from 'react';
|
|
3
|
+
import { Box } from '@/gui/components/atoms';
|
|
4
|
+
import { useInsetsContext } from '@/gui/contexts/InsetsContext';
|
|
5
|
+
import { useGuiTheme } from '@/gui/hooks';
|
|
6
|
+
export interface PageProps {
|
|
7
|
+
children?: React.ReactNode;
|
|
8
|
+
padding?: number | string;
|
|
9
|
+
background?: string;
|
|
10
|
+
sx?: any;
|
|
11
|
+
insetsAware?: boolean;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Page
|
|
15
|
+
* ----------
|
|
16
|
+
* A flexible container for rendering page-level content within layouts.
|
|
17
|
+
* Typically used inside Layout components or Routes.
|
|
18
|
+
*
|
|
19
|
+
* Features:
|
|
20
|
+
* - Applies consistent padding and layout structure.
|
|
21
|
+
* - Supports background color/image and custom sx overrides.
|
|
22
|
+
* - Fully responsive by default.
|
|
23
|
+
*/
|
|
24
|
+
export default function Page({
|
|
25
|
+
children,
|
|
26
|
+
padding = 3,
|
|
27
|
+
background = 'transparent',
|
|
28
|
+
sx = {},
|
|
29
|
+
insetsAware = true,
|
|
30
|
+
}: PageProps) {
|
|
31
|
+
useInsetsContext();
|
|
32
|
+
const theme = useGuiTheme();
|
|
33
|
+
|
|
34
|
+
const resolvedPadding = useMemo(() => {
|
|
35
|
+
if (typeof padding === 'number') {
|
|
36
|
+
if (padding <= 10 && typeof theme.spacing === 'function') {
|
|
37
|
+
return theme.spacing(padding);
|
|
38
|
+
}
|
|
39
|
+
return `${padding}px`;
|
|
40
|
+
}
|
|
41
|
+
return padding ?? '0px';
|
|
42
|
+
}, [padding, theme]);
|
|
43
|
+
|
|
44
|
+
const isUniformPadding =
|
|
45
|
+
typeof resolvedPadding === 'string' && resolvedPadding.trim().split(/\s+/).length === 1;
|
|
46
|
+
|
|
47
|
+
const basePadding = isUniformPadding ? resolvedPadding : undefined;
|
|
48
|
+
const topCalc =
|
|
49
|
+
insetsAware && basePadding
|
|
50
|
+
? `calc(${basePadding} + var(--gui-inset-top, 0px))`
|
|
51
|
+
: undefined;
|
|
52
|
+
const bottomCalc =
|
|
53
|
+
insetsAware && basePadding
|
|
54
|
+
? `calc(${basePadding} + var(--gui-inset-bottom, 0px))`
|
|
55
|
+
: undefined;
|
|
56
|
+
const leftCalc =
|
|
57
|
+
insetsAware && basePadding
|
|
58
|
+
? `calc(${basePadding} + var(--gui-inset-left, 0px))`
|
|
59
|
+
: undefined;
|
|
60
|
+
const rightCalc =
|
|
61
|
+
insetsAware && basePadding
|
|
62
|
+
? `calc(${basePadding} + var(--gui-inset-right, 0px))`
|
|
63
|
+
: undefined;
|
|
64
|
+
|
|
65
|
+
return (
|
|
66
|
+
<Box
|
|
67
|
+
id="page-container"
|
|
68
|
+
sx={{
|
|
69
|
+
flex: 1,
|
|
70
|
+
flexGrow: 1,
|
|
71
|
+
width: '100%',
|
|
72
|
+
minHeight: '100%',
|
|
73
|
+
display: 'flex',
|
|
74
|
+
flexDirection: 'column',
|
|
75
|
+
overflowY: 'auto',
|
|
76
|
+
overflowX: 'hidden',
|
|
77
|
+
padding: resolvedPadding,
|
|
78
|
+
background,
|
|
79
|
+
boxSizing: 'border-box',
|
|
80
|
+
...(insetsAware &&
|
|
81
|
+
basePadding && {
|
|
82
|
+
padding: 0,
|
|
83
|
+
paddingTop: topCalc,
|
|
84
|
+
paddingBottom: bottomCalc,
|
|
85
|
+
paddingLeft: leftCalc,
|
|
86
|
+
paddingRight: rightCalc,
|
|
87
|
+
}),
|
|
88
|
+
...sx,
|
|
89
|
+
}}
|
|
90
|
+
>
|
|
91
|
+
{children}
|
|
92
|
+
</Box>
|
|
93
|
+
);
|
|
94
|
+
}
|