this.gui 1.3.40 → 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/dist/init/index.html +27 -0
- package/dist/init/package-lock.json +5779 -0
- package/dist/init/package.json +24 -0
- package/dist/init/src/App.tsx +40 -0
- package/dist/init/src/index.css +16 -0
- package/dist/init/src/main.tsx +13 -0
- package/dist/init/src/router/DerivableRouter.tsx +36 -0
- package/dist/init/tsconfig.json +17 -0
- package/dist/init/vite.config.ts +11 -0
- package/package.json +5 -3
- 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,110 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Box, Typography, IconButton } from "@/gui/components/atoms";
|
|
3
|
+
import { useGuiTheme } from "@/gui/hooks";
|
|
4
|
+
// Try importing CloseIcon from MUI; fallback to a local SVG if missing
|
|
5
|
+
let CloseIcon: any;
|
|
6
|
+
try {
|
|
7
|
+
// @ts-ignore
|
|
8
|
+
CloseIcon = require("@mui/icons-material/Close").default;
|
|
9
|
+
} catch {
|
|
10
|
+
CloseIcon = () => (
|
|
11
|
+
<svg width="24" height="24" viewBox="0 0 24 24" fill="none">
|
|
12
|
+
<path d="M6 6L18 18M6 18L18 6" stroke="currentColor" strokeWidth="2" strokeLinecap="round" />
|
|
13
|
+
</svg>
|
|
14
|
+
);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
interface ModalProps {
|
|
18
|
+
open: boolean;
|
|
19
|
+
title?: string;
|
|
20
|
+
onClose: () => void;
|
|
21
|
+
children?: React.ReactNode;
|
|
22
|
+
width?: number | string;
|
|
23
|
+
height?: number | string;
|
|
24
|
+
blurBackground?: boolean;
|
|
25
|
+
xyz?: { x?: number; y?: number; z?: number };
|
|
26
|
+
insets?: { top?: number; right?: number; bottom?: number; left?: number };
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const Modal: React.FC<ModalProps> = ({
|
|
30
|
+
open,
|
|
31
|
+
title,
|
|
32
|
+
onClose,
|
|
33
|
+
children,
|
|
34
|
+
width = 400,
|
|
35
|
+
height = "auto",
|
|
36
|
+
blurBackground = true,
|
|
37
|
+
xyz,
|
|
38
|
+
insets,
|
|
39
|
+
}) => {
|
|
40
|
+
const theme = useGuiTheme();
|
|
41
|
+
const zIndex = (theme as any)?.zIndex?.modal ?? (theme as any)?.zIndex?.drawer ?? 1300;
|
|
42
|
+
|
|
43
|
+
if (!open) return null;
|
|
44
|
+
|
|
45
|
+
return (
|
|
46
|
+
<Box
|
|
47
|
+
sx={{
|
|
48
|
+
position: "fixed",
|
|
49
|
+
top: 0,
|
|
50
|
+
left: 0,
|
|
51
|
+
width: "100vw",
|
|
52
|
+
height: "100vh",
|
|
53
|
+
bgcolor: blurBackground ? "rgba(0,0,0,0.35)" : "rgba(0,0,0,0.6)",
|
|
54
|
+
backdropFilter: blurBackground ? "blur(8px)" : "none",
|
|
55
|
+
display: "flex",
|
|
56
|
+
justifyContent: "center",
|
|
57
|
+
alignItems: "center",
|
|
58
|
+
p: 2,
|
|
59
|
+
pt: `calc(16px + ${Number(insets?.top ?? 0)}px)`,
|
|
60
|
+
pr: `calc(16px + ${Number(insets?.right ?? 0)}px)`,
|
|
61
|
+
pb: `calc(16px + ${Number(insets?.bottom ?? 0)}px)`,
|
|
62
|
+
pl: `calc(16px + ${Number(insets?.left ?? 0)}px)`,
|
|
63
|
+
boxSizing: "border-box",
|
|
64
|
+
zIndex,
|
|
65
|
+
}}
|
|
66
|
+
onClick={onClose}
|
|
67
|
+
>
|
|
68
|
+
<Box
|
|
69
|
+
sx={{
|
|
70
|
+
width,
|
|
71
|
+
height,
|
|
72
|
+
bgcolor: "background.paper",
|
|
73
|
+
color: "text.primary",
|
|
74
|
+
borderRadius: 4,
|
|
75
|
+
border: "1px solid",
|
|
76
|
+
borderColor: "divider",
|
|
77
|
+
boxShadow: 8,
|
|
78
|
+
p: 3,
|
|
79
|
+
animation: "fadeIn 0.2s ease",
|
|
80
|
+
position: "relative",
|
|
81
|
+
transform: `translate3d(${xyz?.x || 0}px, ${xyz?.y || 0}px, ${xyz?.z || 0}px)`,
|
|
82
|
+
transformStyle: "preserve-3d",
|
|
83
|
+
}}
|
|
84
|
+
onClick={(e) => e.stopPropagation()}
|
|
85
|
+
>
|
|
86
|
+
{title && (
|
|
87
|
+
<Typography variant="h6" sx={{ mb: 2, fontWeight: 600 }}>
|
|
88
|
+
{title}
|
|
89
|
+
</Typography>
|
|
90
|
+
)}
|
|
91
|
+
<IconButton
|
|
92
|
+
onClick={onClose}
|
|
93
|
+
sx={{
|
|
94
|
+
position: "absolute",
|
|
95
|
+
top: 8,
|
|
96
|
+
right: 8,
|
|
97
|
+
color: "text.secondary",
|
|
98
|
+
"&:hover": { color: "text.primary" },
|
|
99
|
+
}}
|
|
100
|
+
>
|
|
101
|
+
<CloseIcon />
|
|
102
|
+
</IconButton>
|
|
103
|
+
|
|
104
|
+
<Box>{children}</Box>
|
|
105
|
+
</Box>
|
|
106
|
+
</Box>
|
|
107
|
+
);
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
export default Modal;
|
|
@@ -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 ModalProps {
|
|
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 { Hero } from '@/gui/components/molecules/Hero/Hero';
|
|
2
|
+
import { InsetsProvider } from '@/gui/contexts/InsetsContext';
|
|
3
|
+
import Layout from '@/gui/Theme/Layout/Layout/Layout';
|
|
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
|
+
<Hero
|
|
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
|
+
</Hero>
|
|
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
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import ThemeModeToggle from './ThemeModeToggle';
|
|
2
|
+
import { ThemeModeToggleResolverSpec } from './ThemeModeToggle.types';
|
|
3
|
+
/**
|
|
4
|
+
* Resolver for ThemeModeToggle
|
|
5
|
+
* ----------------------------
|
|
6
|
+
* Allows you to render the ThemeModeToggle from a plain JSON/config object.
|
|
7
|
+
*
|
|
8
|
+
* Minimal accepted shape:
|
|
9
|
+
* {
|
|
10
|
+
* "type": "ThemeModeToggle",
|
|
11
|
+
* "props": {
|
|
12
|
+
* "variant": "minimal" | "switchMinimal" | "switchWithLabel",
|
|
13
|
+
* "show": "icons" | "label" | "both",
|
|
14
|
+
* "id": "optional-id",
|
|
15
|
+
* "className": "optional-class",
|
|
16
|
+
* "data-testid": "test-id",
|
|
17
|
+
* // Optional granular styling
|
|
18
|
+
* "sx": { root styles },
|
|
19
|
+
* "iconSx": { icons styles },
|
|
20
|
+
* "switchSx": { switch styles (variant='switch') },
|
|
21
|
+
* "labelSx": { label Typography styles }
|
|
22
|
+
* }
|
|
23
|
+
* }
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
export function resolveThemeModeToggle(p: ThemeModeToggleResolverSpec = {}) {
|
|
27
|
+
const {
|
|
28
|
+
variant = 'minimal',
|
|
29
|
+
show = 'icons',
|
|
30
|
+
id,
|
|
31
|
+
className,
|
|
32
|
+
['data-testid']: dataTestId,
|
|
33
|
+
sx,
|
|
34
|
+
iconSx,
|
|
35
|
+
switchSx,
|
|
36
|
+
labelSx,
|
|
37
|
+
switchSize,
|
|
38
|
+
iconSize,
|
|
39
|
+
} = p;
|
|
40
|
+
|
|
41
|
+
return (
|
|
42
|
+
<ThemeModeToggle
|
|
43
|
+
variant={variant}
|
|
44
|
+
show={show}
|
|
45
|
+
id={id}
|
|
46
|
+
className={className}
|
|
47
|
+
data-testid={dataTestId}
|
|
48
|
+
sx={sx}
|
|
49
|
+
iconSx={iconSx}
|
|
50
|
+
switchSx={switchSx}
|
|
51
|
+
labelSx={labelSx}
|
|
52
|
+
switchSize={switchSize}
|
|
53
|
+
iconSize={iconSize}
|
|
54
|
+
/>
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export default resolveThemeModeToggle;
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import ThemeModeToggle from './ThemeModeToggle';
|
|
3
|
+
|
|
4
|
+
// ======================= Meta =======================
|
|
5
|
+
const meta: Meta<typeof ThemeModeToggle> = {
|
|
6
|
+
title: 'Theme/ThemeModeToggle',
|
|
7
|
+
component: ThemeModeToggle,
|
|
8
|
+
tags: ['autodocs'],
|
|
9
|
+
decorators: [
|
|
10
|
+
(Story) => (
|
|
11
|
+
<div style={{ padding: 24, minHeight: 160, display: 'flex', justifyContent: 'center', alignItems: 'center' }}>
|
|
12
|
+
<Story />
|
|
13
|
+
</div>
|
|
14
|
+
),
|
|
15
|
+
],
|
|
16
|
+
parameters: {
|
|
17
|
+
docs: {
|
|
18
|
+
description: {
|
|
19
|
+
component: `
|
|
20
|
+
The **ThemeModeToggle** is a theme control molecule that allows users to toggle between **light**, **dark**, and optionally **system** themes in a UI.
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
## What it does
|
|
24
|
+
ThemeModeToggle provides a way to change the global color mode of the app via UI toggles. It connects with \`useThemeMode\` from This.GUI, so any updates reflect instantly in your theme context.
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
## Visual Variants
|
|
28
|
+
This component supports multiple visual representations depending on how much context or control you want to show the user:
|
|
29
|
+
|
|
30
|
+
- **minimal**: Just a clickable icon (uses IconButton).
|
|
31
|
+
- **switchMinimal**: Shows a switch with sun/moon icons.
|
|
32
|
+
- **switchWithLabel**: Shows the switch, icons, and a label that updates dynamically between "Light" and "Dark".
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
## Props
|
|
36
|
+
- \`variant?: 'minimal' | 'switchMinimal' | 'switchWithLabel'\`
|
|
37
|
+
- Determines the UI structure.
|
|
38
|
+
- \`show?: 'icons' | 'label' | 'both'\`
|
|
39
|
+
- For \`variant="minimal"\` only. Controls whether to show icon, label or both.
|
|
40
|
+
- \`switchSize?: 'small' | 'medium'\` — size of the MUI Switch.
|
|
41
|
+
- \`iconSize?: 'small' | 'medium' | 'large'\` — size of the icons.
|
|
42
|
+
- \`sx\`, \`iconSx\`, \`switchSx\`, \`labelSx\` — MUI system styling overrides.
|
|
43
|
+
- \`id\`, \`className\`, \`data-testid\` — standard element props.
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
## Internal Logic
|
|
47
|
+
- Uses \`useThemeContext()\` to read current mode (\`light\` or \`dark\`) and the \`toggleMode()\` handler.
|
|
48
|
+
- Dynamically determines whether current mode is \`light\` or not to drive the state of the UI (like whether switch is \`checked\` or not).
|
|
49
|
+
- Automatically updates \`labelText\` based on the mode.
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
## Usage Examples
|
|
53
|
+
|
|
54
|
+
### Basic usage in React:
|
|
55
|
+
~~~tsx
|
|
56
|
+
<ThemeModeToggle variant="minimal" />
|
|
57
|
+
<ThemeModeToggle variant="switchMinimal" />
|
|
58
|
+
<ThemeModeToggle variant="switchWithLabel" />
|
|
59
|
+
~~~
|
|
60
|
+
|
|
61
|
+
### Declarative JSON usage:
|
|
62
|
+
~~~json
|
|
63
|
+
{
|
|
64
|
+
"type": "ThemeModeToggle",
|
|
65
|
+
"props": {
|
|
66
|
+
"variant": "switchWithLabel",
|
|
67
|
+
"iconSize": "medium",
|
|
68
|
+
"switchSize": "small",
|
|
69
|
+
"sx": { "ml": 2 }
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
~~~
|
|
73
|
+
|
|
74
|
+
---
|
|
75
|
+
## Design Notes
|
|
76
|
+
This component is designed to be:
|
|
77
|
+
- **Declarative-first**: usable directly from This.GUI config structures.
|
|
78
|
+
- **Minimal footprint**: all styling is optional and overrideable.
|
|
79
|
+
- **Context-integrated**: updates global theme state through context, not local component state.
|
|
80
|
+
|
|
81
|
+
Ideal for UIs where users are expected to switch theme modes or where accessible, theme-aware interfaces are critical.
|
|
82
|
+
`,
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
argTypes: {
|
|
87
|
+
variant: {
|
|
88
|
+
control: { type: 'radio' },
|
|
89
|
+
options: ['minimal', 'switch'],
|
|
90
|
+
},
|
|
91
|
+
sx: {
|
|
92
|
+
control: 'object',
|
|
93
|
+
description: 'MUI system style overrides.',
|
|
94
|
+
},
|
|
95
|
+
show: {
|
|
96
|
+
control: { type: 'radio' },
|
|
97
|
+
options: ['icons', 'label', 'both'],
|
|
98
|
+
description: 'Controls whether to show icons, label, or both.',
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
args: {
|
|
102
|
+
variant: 'minimal',
|
|
103
|
+
sx: {},
|
|
104
|
+
},
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
export default meta;
|
|
108
|
+
type Story = StoryObj<typeof ThemeModeToggle>;
|
|
109
|
+
|
|
110
|
+
// ======================= Stories =======================
|
|
111
|
+
|
|
112
|
+
export const Playground: Story = {
|
|
113
|
+
render: (args) => <ThemeModeToggle {...args} />,
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
export const Variants: Story = {
|
|
117
|
+
render: () => (
|
|
118
|
+
<div style={{ display: 'flex', gap: 24, flexDirection: 'column' }}>
|
|
119
|
+
<div>
|
|
120
|
+
<h4>minimal (icon only)</h4>
|
|
121
|
+
<ThemeModeToggle variant="minimal" />
|
|
122
|
+
</div>
|
|
123
|
+
<div>
|
|
124
|
+
<h4>switchMinimal (switch with icons)</h4>
|
|
125
|
+
<ThemeModeToggle variant="switchMinimal" show="icons" />
|
|
126
|
+
</div>
|
|
127
|
+
<div>
|
|
128
|
+
<h4>switchWithLabel (switch with icons + label)</h4>
|
|
129
|
+
<ThemeModeToggle variant="switchWithLabel" show="both" />
|
|
130
|
+
</div>
|
|
131
|
+
</div>
|
|
132
|
+
),
|
|
133
|
+
};
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { IconButton, Switch } from '@/gui/components/atoms';
|
|
3
|
+
import Icon from '@/gui/Theme/Icon/Icon';
|
|
4
|
+
import { useThemeContext } from '@/gui/Theme';
|
|
5
|
+
import { Typography, Box } from '@/gui/components/atoms';
|
|
6
|
+
import type { ThemeModeToggleProps } from './ThemeModeToggle.types';
|
|
7
|
+
|
|
8
|
+
const ThemeModeToggle: React.FC<ThemeModeToggleProps> = ({
|
|
9
|
+
variant = 'minimal',
|
|
10
|
+
show = 'icons',
|
|
11
|
+
switchSize = 'medium',
|
|
12
|
+
iconSize = 'medium',
|
|
13
|
+
sx,
|
|
14
|
+
iconSx,
|
|
15
|
+
switchSx,
|
|
16
|
+
labelSx,
|
|
17
|
+
id,
|
|
18
|
+
className,
|
|
19
|
+
['data-testid']: dataTestId,
|
|
20
|
+
}) => {
|
|
21
|
+
const { mode, toggleMode } = useThemeContext();
|
|
22
|
+
const isLight = mode === 'light';
|
|
23
|
+
const labelText = isLight ? 'Light' : 'Dark';
|
|
24
|
+
const iconFontSize = {
|
|
25
|
+
small: '1rem',
|
|
26
|
+
medium: '1.5rem',
|
|
27
|
+
large: '2rem',
|
|
28
|
+
}[iconSize];
|
|
29
|
+
|
|
30
|
+
const handleToggle = () => {
|
|
31
|
+
toggleMode();
|
|
32
|
+
};
|
|
33
|
+
if (variant === 'switchMinimal' || variant === 'switchWithLabel') {
|
|
34
|
+
return (
|
|
35
|
+
<Box
|
|
36
|
+
id={id}
|
|
37
|
+
display="flex"
|
|
38
|
+
alignItems="center"
|
|
39
|
+
sx={sx ? ([{ cursor: 'pointer' }, sx] as any) : ({ cursor: 'pointer' } as any)}
|
|
40
|
+
className={className}
|
|
41
|
+
data-testid={dataTestId}
|
|
42
|
+
>
|
|
43
|
+
{/* Always show icons for both switch variants */}
|
|
44
|
+
<Icon
|
|
45
|
+
name="light_mode"
|
|
46
|
+
iconColor={isLight ? 'primary' : 'disabled'}
|
|
47
|
+
fontSize={iconFontSize}
|
|
48
|
+
/>
|
|
49
|
+
<Switch
|
|
50
|
+
checked={!isLight}
|
|
51
|
+
onChange={handleToggle}
|
|
52
|
+
color="primary"
|
|
53
|
+
size={switchSize}
|
|
54
|
+
inputProps={{ 'aria-label': 'toggle theme mode' }}
|
|
55
|
+
sx={switchSx}
|
|
56
|
+
/>
|
|
57
|
+
<Icon
|
|
58
|
+
name="dark_mode"
|
|
59
|
+
iconColor={!isLight ? 'primary' : 'disabled'}
|
|
60
|
+
fontSize={iconFontSize}
|
|
61
|
+
/>
|
|
62
|
+
{variant === 'switchWithLabel' && (
|
|
63
|
+
<Typography
|
|
64
|
+
sx={
|
|
65
|
+
labelSx
|
|
66
|
+
? ([{ ml: 1 }, labelSx] as any)
|
|
67
|
+
: ({ ml: 1 } as any)
|
|
68
|
+
}
|
|
69
|
+
>
|
|
70
|
+
{labelText}
|
|
71
|
+
</Typography>
|
|
72
|
+
)}
|
|
73
|
+
</Box>
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// variant === 'minimal'
|
|
78
|
+
return (
|
|
79
|
+
<IconButton id={id} onClick={handleToggle} color="inherit" aria-label="toggle theme mode" size={iconSize} className={className} data-testid={dataTestId} sx={sx}>
|
|
80
|
+
{show !== 'label' &&
|
|
81
|
+
(isLight ? (
|
|
82
|
+
<Icon name="light_mode" iconColor="primary" fontSize={iconFontSize} />
|
|
83
|
+
) : (
|
|
84
|
+
<Icon name="dark_mode" iconColor="primary" fontSize={iconFontSize} />
|
|
85
|
+
))}
|
|
86
|
+
{(show === 'label' || show === 'both') && (
|
|
87
|
+
<Typography
|
|
88
|
+
sx={
|
|
89
|
+
labelSx
|
|
90
|
+
? ([{ ml: show === 'both' ? 1 : 0 }, labelSx] as any)
|
|
91
|
+
: ({ ml: show === 'both' ? 1 : 0 } as any)
|
|
92
|
+
}
|
|
93
|
+
>
|
|
94
|
+
{labelText}
|
|
95
|
+
</Typography>
|
|
96
|
+
)}
|
|
97
|
+
</IconButton>
|
|
98
|
+
);
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
export default ThemeModeToggle;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { SxProps, Theme } from '@mui/material/styles';
|
|
2
|
+
export type ThemeModeToggleProps = {
|
|
3
|
+
variant?: 'minimal' | 'switchMinimal' | 'switchWithLabel';
|
|
4
|
+
show?: 'icons' | 'label' | 'both';
|
|
5
|
+
id?: string;
|
|
6
|
+
className?: string;
|
|
7
|
+
['data-testid']?: string;
|
|
8
|
+
sx?: SxProps<Theme>;
|
|
9
|
+
iconSx?: SxProps<Theme>;
|
|
10
|
+
switchSx?: SxProps<Theme>;
|
|
11
|
+
labelSx?: SxProps<Theme>;
|
|
12
|
+
switchSize?: 'small' | 'medium';
|
|
13
|
+
iconSize?: 'small' | 'medium' | 'large';
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export type ThemeModeToggleResolverSpec = {
|
|
17
|
+
type?: 'ThemeModeToggle';
|
|
18
|
+
variant?: 'minimal' | 'switchMinimal' | 'switchWithLabel';
|
|
19
|
+
show?: 'icons' | 'label' | 'both';
|
|
20
|
+
id?: string;
|
|
21
|
+
className?: string;
|
|
22
|
+
['data-testid']?: string;
|
|
23
|
+
sx?: SxProps<Theme>;
|
|
24
|
+
iconSx?: SxProps<Theme>;
|
|
25
|
+
switchSx?: SxProps<Theme>;
|
|
26
|
+
labelSx?: SxProps<Theme>;
|
|
27
|
+
switchSize?: 'small' | 'medium';
|
|
28
|
+
iconSize?: 'small' | 'medium' | 'large';
|
|
29
|
+
};
|