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,53 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import Switch from './Switch';
|
|
3
|
+
import { FormControlLabel } from '@mui/material';
|
|
4
|
+
import { SxProps, Theme } from '@mui/material/styles';
|
|
5
|
+
import { ensureNodeId } from '@/gui/utils/nodeID';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Switch.resolver
|
|
9
|
+
* ------------------------------------------------------------
|
|
10
|
+
* Allows declarative usage of the Switch atom. You can pass any
|
|
11
|
+
* MUI Switch prop through, plus optional `label` support. If
|
|
12
|
+
* `label` is provided, we wrap the control in `FormControlLabel`.
|
|
13
|
+
*
|
|
14
|
+
* Examples (JSON-ish):
|
|
15
|
+
* {
|
|
16
|
+
* type: 'Switch',
|
|
17
|
+
* props: { checked: true, color: 'primary', size: 'small' }
|
|
18
|
+
* }
|
|
19
|
+
*
|
|
20
|
+
* {
|
|
21
|
+
* type: 'Switch',
|
|
22
|
+
* props: { label: 'Enable feature', defaultChecked: true }
|
|
23
|
+
* }
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
export type SwitchResolverProps = React.ComponentProps<typeof Switch> & {
|
|
27
|
+
/** Optional text/element label to render alongside the switch */
|
|
28
|
+
label?: React.ReactNode;
|
|
29
|
+
/** Label position when `label` is provided */
|
|
30
|
+
labelPlacement?: 'end' | 'start' | 'top' | 'bottom';
|
|
31
|
+
sx?: SxProps<Theme>;
|
|
32
|
+
guiId?: string;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export default function resolveSwitch(props: SwitchResolverProps) {
|
|
36
|
+
const { label, labelPlacement = 'end', guiId, sx, ...rest } = props || ({} as SwitchResolverProps);
|
|
37
|
+
|
|
38
|
+
const nodeId = ensureNodeId('Switch', guiId);
|
|
39
|
+
|
|
40
|
+
const control = <Switch id={nodeId} sx={sx} {...rest} />;
|
|
41
|
+
|
|
42
|
+
if (label != null) {
|
|
43
|
+
return (
|
|
44
|
+
<FormControlLabel
|
|
45
|
+
control={control}
|
|
46
|
+
label={label}
|
|
47
|
+
labelPlacement={labelPlacement}
|
|
48
|
+
/>
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
return control;
|
|
53
|
+
}
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
// src/gui/atoms/Switch/Switch.stories.tsx
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
4
|
+
import { Box, Stack, Typography, Switch } from '@/gui/components/atoms';
|
|
5
|
+
import { FormControlLabel } from '@mui/material';
|
|
6
|
+
|
|
7
|
+
// ======================= Meta =======================
|
|
8
|
+
const meta: Meta<typeof Switch> = {
|
|
9
|
+
title: 'Atoms/Forms & Inputs/Switch',
|
|
10
|
+
component: Switch,
|
|
11
|
+
tags: ['autodocs'],
|
|
12
|
+
decorators: [
|
|
13
|
+
(Story) => (
|
|
14
|
+
<Box sx={{ p: 2 }}>
|
|
15
|
+
<Story />
|
|
16
|
+
</Box>
|
|
17
|
+
),
|
|
18
|
+
],
|
|
19
|
+
parameters: {
|
|
20
|
+
docs: {
|
|
21
|
+
description: {
|
|
22
|
+
component: `
|
|
23
|
+
**Switch (This.GUI atom)** is a thin wrapper around MUI's \`Switch\`.
|
|
24
|
+
It keeps MUI behavior, styling, and typing, but you import it from \`@/gui/atoms\` to keep your app decoupled from MUI.
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
# Usage
|
|
29
|
+
|
|
30
|
+
## React (imperative)
|
|
31
|
+
~~~tsx
|
|
32
|
+
import { Switch } from '@/gui/atoms';
|
|
33
|
+
|
|
34
|
+
export function Example() {
|
|
35
|
+
const [enabled, setEnabled] = React.useState(false);
|
|
36
|
+
return (
|
|
37
|
+
<Switch
|
|
38
|
+
checked={enabled}
|
|
39
|
+
onChange={(_, v) => setEnabled(v)}
|
|
40
|
+
color="primary"
|
|
41
|
+
size="medium"
|
|
42
|
+
/>
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
~~~
|
|
46
|
+
|
|
47
|
+
With an accessible label (MUI way):
|
|
48
|
+
~~~tsx
|
|
49
|
+
import { FormControlLabel } from '@mui/material';
|
|
50
|
+
|
|
51
|
+
<FormControlLabel control={<Switch defaultChecked />} label="Enable notifications" />
|
|
52
|
+
~~~
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
## Declarative (resolver)
|
|
57
|
+
If you’re rendering via a JSON/registry resolver, you can pass the same props:
|
|
58
|
+
|
|
59
|
+
~~~json
|
|
60
|
+
{
|
|
61
|
+
"type": "Switch",
|
|
62
|
+
"props": {
|
|
63
|
+
"label": "Enable feature",
|
|
64
|
+
"defaultChecked": true,
|
|
65
|
+
"color": "primary",
|
|
66
|
+
"size": "small",
|
|
67
|
+
"id": "feat-toggle",
|
|
68
|
+
"sx": { "ml": 1 }
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
~~~
|
|
72
|
+
|
|
73
|
+
The resolver supports:
|
|
74
|
+
- All native MUI Switch props (\`checked\`, \`defaultChecked\`, \`onChange\`, \`color\`, \`size\`, \`disabled\`, \`edge\`, \`inputProps\`, \`sx\`, etc.).
|
|
75
|
+
- \`label?: ReactNode\` and \`labelPlacement?: 'start' | 'end' | 'top' | 'bottom'\` (wraps in \`FormControlLabel\` when present).
|
|
76
|
+
- \`id\`, \`className\`, \`data-testid\` passthrough for testing and DOM hooks.
|
|
77
|
+
|
|
78
|
+
---
|
|
79
|
+
`,
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
argTypes: {
|
|
84
|
+
checked: {
|
|
85
|
+
control: 'boolean',
|
|
86
|
+
description: 'Controlled state. Use with onChange.',
|
|
87
|
+
table: { category: 'Behavior' },
|
|
88
|
+
},
|
|
89
|
+
defaultChecked: {
|
|
90
|
+
control: 'boolean',
|
|
91
|
+
description: 'Uncontrolled initial state.',
|
|
92
|
+
table: { category: 'Behavior' },
|
|
93
|
+
},
|
|
94
|
+
disabled: {
|
|
95
|
+
control: 'boolean',
|
|
96
|
+
table: { category: 'Behavior' },
|
|
97
|
+
},
|
|
98
|
+
color: {
|
|
99
|
+
control: 'select',
|
|
100
|
+
options: ['primary', 'secondary', 'default'],
|
|
101
|
+
table: { category: 'Appearance' },
|
|
102
|
+
},
|
|
103
|
+
size: {
|
|
104
|
+
control: 'radio',
|
|
105
|
+
options: ['small', 'medium'],
|
|
106
|
+
description: 'Same as MUI Switch (no large by default).',
|
|
107
|
+
table: { category: 'Appearance' },
|
|
108
|
+
},
|
|
109
|
+
edge: {
|
|
110
|
+
control: 'radio',
|
|
111
|
+
options: [false, 'start', 'end'],
|
|
112
|
+
table: { category: 'Appearance' },
|
|
113
|
+
},
|
|
114
|
+
sx: { table: { category: 'Style' } },
|
|
115
|
+
id: { table: { category: 'DOM' } },
|
|
116
|
+
className: { table: { category: 'DOM' } },
|
|
117
|
+
// Not useful to control live in SB
|
|
118
|
+
onChange: { table: { disable: true } },
|
|
119
|
+
inputProps: { table: { disable: true } },
|
|
120
|
+
},
|
|
121
|
+
args: {
|
|
122
|
+
defaultChecked: false,
|
|
123
|
+
color: 'primary',
|
|
124
|
+
size: 'medium',
|
|
125
|
+
edge: false,
|
|
126
|
+
},
|
|
127
|
+
};
|
|
128
|
+
export default meta;
|
|
129
|
+
|
|
130
|
+
type Story = StoryObj<typeof Switch>;
|
|
131
|
+
|
|
132
|
+
// ======================= Stories =======================
|
|
133
|
+
|
|
134
|
+
export const Playground: Story = {
|
|
135
|
+
render: (args) => <Switch {...args} />,
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
export const LabeledVariants: Story = {
|
|
139
|
+
name: 'With label & placement',
|
|
140
|
+
render: () => (
|
|
141
|
+
<Stack spacing={2}>
|
|
142
|
+
<FormControlLabel control={<Switch defaultChecked />} label="End (default)" />
|
|
143
|
+
<FormControlLabel control={<Switch defaultChecked />} label="Start" labelPlacement="start" />
|
|
144
|
+
<FormControlLabel control={<Switch />} label="Top" labelPlacement="top" />
|
|
145
|
+
<FormControlLabel control={<Switch />} label="Bottom" labelPlacement="bottom" />
|
|
146
|
+
</Stack>
|
|
147
|
+
),
|
|
148
|
+
parameters: {
|
|
149
|
+
docs: {
|
|
150
|
+
description: {
|
|
151
|
+
story:
|
|
152
|
+
'When `label` is present, the atom wraps the control with `FormControlLabel`. Use `labelPlacement` to position it.',
|
|
153
|
+
},
|
|
154
|
+
},
|
|
155
|
+
},
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
export const SizesAndColors: Story = {
|
|
159
|
+
name: 'Sizes & colors',
|
|
160
|
+
render: () => (
|
|
161
|
+
<Stack spacing={2}>
|
|
162
|
+
<Stack direction="row" spacing={2} alignItems="center">
|
|
163
|
+
<Typography variant="body2" sx={{ minWidth: 88 }}>small</Typography>
|
|
164
|
+
<Switch size="small" color="default" defaultChecked />
|
|
165
|
+
<Switch size="small" color="primary" defaultChecked />
|
|
166
|
+
<Switch size="small" color="secondary" defaultChecked />
|
|
167
|
+
</Stack>
|
|
168
|
+
<Stack direction="row" spacing={2} alignItems="center">
|
|
169
|
+
<Typography variant="body2" sx={{ minWidth: 88 }}>medium</Typography>
|
|
170
|
+
<Switch size="medium" color="default" defaultChecked />
|
|
171
|
+
<Switch size="medium" color="primary" defaultChecked />
|
|
172
|
+
<Switch size="medium" color="secondary" defaultChecked />
|
|
173
|
+
</Stack>
|
|
174
|
+
</Stack>
|
|
175
|
+
),
|
|
176
|
+
};
|
|
177
|
+
|
|
178
|
+
export const ControlledExample: Story = {
|
|
179
|
+
name: 'Controlled (React state)',
|
|
180
|
+
render: () => {
|
|
181
|
+
const [on, setOn] = React.useState(false);
|
|
182
|
+
return (
|
|
183
|
+
<Stack spacing={1.5}>
|
|
184
|
+
<Typography variant="body2">Value: <b>{on ? 'true' : 'false'}</b></Typography>
|
|
185
|
+
<FormControlLabel
|
|
186
|
+
control={
|
|
187
|
+
<Switch
|
|
188
|
+
checked={on}
|
|
189
|
+
onChange={(_, v) => setOn(v)}
|
|
190
|
+
color={on ? 'primary' : 'secondary'}
|
|
191
|
+
/>
|
|
192
|
+
}
|
|
193
|
+
label="Controlled switch"
|
|
194
|
+
/>
|
|
195
|
+
</Stack>
|
|
196
|
+
);
|
|
197
|
+
},
|
|
198
|
+
parameters: {
|
|
199
|
+
docs: {
|
|
200
|
+
description: {
|
|
201
|
+
story:
|
|
202
|
+
'Classic controlled pattern: bind `checked` and update via `onChange`. You can also change appearance based on state.',
|
|
203
|
+
},
|
|
204
|
+
},
|
|
205
|
+
},
|
|
206
|
+
};
|
|
207
|
+
|
|
208
|
+
export const EdgeAndSx: Story = {
|
|
209
|
+
name: 'Edge & custom sx',
|
|
210
|
+
render: () => (
|
|
211
|
+
<Stack spacing={2}>
|
|
212
|
+
<FormControlLabel control={<Switch edge="start" defaultChecked />} label="Edge start" />
|
|
213
|
+
<FormControlLabel
|
|
214
|
+
control={
|
|
215
|
+
<Switch
|
|
216
|
+
defaultChecked
|
|
217
|
+
sx={{
|
|
218
|
+
'& .MuiSwitch-switchBase.Mui-checked + .MuiSwitch-track': {
|
|
219
|
+
opacity: 0.7,
|
|
220
|
+
},
|
|
221
|
+
}}
|
|
222
|
+
/>
|
|
223
|
+
}
|
|
224
|
+
label="Custom sx"
|
|
225
|
+
/>
|
|
226
|
+
</Stack>
|
|
227
|
+
),
|
|
228
|
+
parameters: {
|
|
229
|
+
docs: {
|
|
230
|
+
description: {
|
|
231
|
+
story:
|
|
232
|
+
'Pass any `sx` overrides exactly as you would with MUI. Useful for fine-grained tuning without creating a new variant.',
|
|
233
|
+
},
|
|
234
|
+
},
|
|
235
|
+
},
|
|
236
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import MuiSwitch from '@mui/material/Switch';
|
|
3
|
+
import type { SwitchProps as MuiSwitchProps } from '@mui/material/Switch';
|
|
4
|
+
/**
|
|
5
|
+
* Switch (This.GUI primitive)
|
|
6
|
+
* ----------------------------------------
|
|
7
|
+
* Thin wrapper over MUI's `Switch`.
|
|
8
|
+
* - Non‑polymorphic (same as MUI): forwards ref to the root element.
|
|
9
|
+
* - Preserves all MUI props (`checked`, `onChange`, `size`, `color`, etc.).
|
|
10
|
+
*
|
|
11
|
+
* Usage:
|
|
12
|
+
* import { Switch } from '@/gui/atoms';
|
|
13
|
+
* <Switch checked={on} onChange={(e) => setOn(e.target.checked)} size="small" />
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
// Re-export MUI's prop types so consumers can import from our surface.
|
|
17
|
+
export type SwitchProps = MuiSwitchProps;
|
|
18
|
+
const Switch = React.forwardRef<HTMLButtonElement, SwitchProps>(function Switch(props, ref) {
|
|
19
|
+
return <MuiSwitch ref={ref} {...props} />;
|
|
20
|
+
});
|
|
21
|
+
export default Switch;
|
|
22
|
+
export type { MuiSwitchProps };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
import React from "react";
|
|
4
|
+
import TextField from "./TextField";
|
|
5
|
+
import { Stack } from "@/gui/components/atoms";
|
|
6
|
+
|
|
7
|
+
export default {
|
|
8
|
+
title: "Atoms/TextField",
|
|
9
|
+
component: TextField,
|
|
10
|
+
parameters: {
|
|
11
|
+
layout: "centered",
|
|
12
|
+
},
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export const Variants = () => (
|
|
16
|
+
<Stack spacing={2} sx={{ width: 400 }}>
|
|
17
|
+
<TextField label="Default" variant="outlined" placeholder="Type something..." />
|
|
18
|
+
<TextField label="Filled" variant="filled" placeholder="Type something..." />
|
|
19
|
+
<TextField label="Standard" variant="standard" placeholder="Type something..." />
|
|
20
|
+
<TextField
|
|
21
|
+
label="Multiline"
|
|
22
|
+
variant="outlined"
|
|
23
|
+
multiline
|
|
24
|
+
rows={4}
|
|
25
|
+
placeholder="Write a long message..."
|
|
26
|
+
/>
|
|
27
|
+
</Stack>
|
|
28
|
+
);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* This.GUI — TextField (polymorphic)
|
|
3
|
+
* Wrapper that keeps MUI's typing, including full prop support.
|
|
4
|
+
* Examples:
|
|
5
|
+
* <TextField label="Name" variant="outlined" />
|
|
6
|
+
* <TextField multiline rows={4} placeholder="Write something..." />
|
|
7
|
+
*/
|
|
8
|
+
import MuiTextField from '@mui/material/TextField';
|
|
9
|
+
import * as React from 'react';
|
|
10
|
+
|
|
11
|
+
// Re-export using MUI's own component type
|
|
12
|
+
const TextField = MuiTextField;
|
|
13
|
+
export type TextFieldProps = React.ComponentProps<typeof TextField>;
|
|
14
|
+
(TextField as any).displayName = 'Gui.TextField';
|
|
15
|
+
export default TextField;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
// src/gui/atoms/Toolbar/Toolbar.resolver.tsx
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import Toolbar from './Toolbar';
|
|
4
|
+
import type { RegistryEntry } from '@/registry/types';
|
|
5
|
+
import type { SxProps, Theme } from '@mui/material/styles';
|
|
6
|
+
import { ensureNodeId } from '@/gui/utils/nodeID';
|
|
7
|
+
|
|
8
|
+
type ToolbarSpec = {
|
|
9
|
+
type: 'Toolbar';
|
|
10
|
+
props?: {
|
|
11
|
+
/** Children content (text or nodes) */
|
|
12
|
+
children?: React.ReactNode;
|
|
13
|
+
|
|
14
|
+
/** MUI props */
|
|
15
|
+
variant?: 'regular' | 'dense';
|
|
16
|
+
disableGutters?: boolean;
|
|
17
|
+
|
|
18
|
+
/** Styling / misc */
|
|
19
|
+
sx?: SxProps<Theme>;
|
|
20
|
+
id?: string;
|
|
21
|
+
className?: string;
|
|
22
|
+
'data-testid'?: string;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* ToolbarResolver
|
|
28
|
+
* - Maps JSON-friendly spec → <Toolbar /> props.
|
|
29
|
+
* - Accepts sx/id/className for styling and test hooks.
|
|
30
|
+
*/
|
|
31
|
+
const ToolbarResolver: RegistryEntry = {
|
|
32
|
+
type: 'Toolbar',
|
|
33
|
+
resolve(spec: ToolbarSpec) {
|
|
34
|
+
const p = spec.props ?? {};
|
|
35
|
+
const {
|
|
36
|
+
children,
|
|
37
|
+
variant,
|
|
38
|
+
disableGutters,
|
|
39
|
+
sx,
|
|
40
|
+
className,
|
|
41
|
+
} = p;
|
|
42
|
+
|
|
43
|
+
const id = ensureNodeId('Toolbar', p.id);
|
|
44
|
+
|
|
45
|
+
return (
|
|
46
|
+
<Toolbar
|
|
47
|
+
variant={variant}
|
|
48
|
+
disableGutters={disableGutters}
|
|
49
|
+
sx={sx}
|
|
50
|
+
id={id}
|
|
51
|
+
className={className}
|
|
52
|
+
data-testid={p['data-testid']}
|
|
53
|
+
>
|
|
54
|
+
{children}
|
|
55
|
+
</Toolbar>
|
|
56
|
+
);
|
|
57
|
+
},
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
export default ToolbarResolver;
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
// Atoms used in the examples
|
|
3
|
+
import { Toolbar, AppBar, Box, IconButton, Typography, Button } from '@/gui/components/atoms';
|
|
4
|
+
import Icon from '@/gui/Theme/Icon/Icon';
|
|
5
|
+
|
|
6
|
+
// ======================= Meta =======================
|
|
7
|
+
const meta: Meta<typeof Toolbar> = {
|
|
8
|
+
title: 'Atoms/Containers/Toolbar',
|
|
9
|
+
component: Toolbar,
|
|
10
|
+
tags: ['autodocs'],
|
|
11
|
+
decorators: [
|
|
12
|
+
(Story) => (
|
|
13
|
+
<div style={{ padding: 16, minHeight: 240 }}>
|
|
14
|
+
<Story />
|
|
15
|
+
</div>
|
|
16
|
+
),
|
|
17
|
+
],
|
|
18
|
+
parameters: {
|
|
19
|
+
docs: {
|
|
20
|
+
description: {
|
|
21
|
+
component: `
|
|
22
|
+
The **Toolbar** atom is a thin wrapper over MUI's \`MuiToolbar\`.
|
|
23
|
+
|
|
24
|
+
> **Not polymorphic.** Unlike \`Button\` or \`Box\`, **Toolbar does not accept** a \`component\` prop in MUI. If you need a different semantic element (e.g. \`<header>\`), wrap it with \`<Box component="header">\`.
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
## Features
|
|
28
|
+
- Density via \`variant\`: \`'regular'\` | \`'dense'\`.
|
|
29
|
+
- Optional gutters removal with \`disableGutters\`.
|
|
30
|
+
- Full **\`sx\`** support for styling.
|
|
31
|
+
- Plays nicely inside **AppBar** and custom layouts.
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
## Key Props
|
|
35
|
+
- \`variant?: 'regular' | 'dense'\`
|
|
36
|
+
- \`disableGutters?: boolean\`
|
|
37
|
+
- \`sx?: SxProps\` — theme-aware styling.
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
## Basic usage
|
|
41
|
+
~~~tsx
|
|
42
|
+
import { Toolbar } from '@/gui/atoms';
|
|
43
|
+
|
|
44
|
+
<Toolbar>
|
|
45
|
+
<span>Left content</span>
|
|
46
|
+
</Toolbar>
|
|
47
|
+
~~~
|
|
48
|
+
|
|
49
|
+
## In an AppBar
|
|
50
|
+
~~~tsx
|
|
51
|
+
import { AppBar, Toolbar, Typography } from '@/gui/atoms';
|
|
52
|
+
|
|
53
|
+
<AppBar position="static">
|
|
54
|
+
<Toolbar>
|
|
55
|
+
<Typography variant="h6">Title</Typography>
|
|
56
|
+
</Toolbar>
|
|
57
|
+
</AppBar>
|
|
58
|
+
~~~
|
|
59
|
+
|
|
60
|
+
## Change semantic element with Box
|
|
61
|
+
~~~tsx
|
|
62
|
+
import { Box, Toolbar } from '@/gui/atoms';
|
|
63
|
+
|
|
64
|
+
<Box component="header">
|
|
65
|
+
<Toolbar variant="dense">Compact header</Toolbar>
|
|
66
|
+
</Box>
|
|
67
|
+
~~~
|
|
68
|
+
`,
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
controls: {
|
|
72
|
+
exclude: ['component']
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
argTypes: {
|
|
76
|
+
variant: {
|
|
77
|
+
control: { type: 'radio' },
|
|
78
|
+
options: ['regular', 'dense'],
|
|
79
|
+
},
|
|
80
|
+
disableGutters: { control: 'boolean' },
|
|
81
|
+
// Toolbar is not polymorphic in MUI, so hide any notion of `component`
|
|
82
|
+
},
|
|
83
|
+
args: {
|
|
84
|
+
variant: 'regular',
|
|
85
|
+
disableGutters: false,
|
|
86
|
+
children: (
|
|
87
|
+
<div style={{ display: 'flex', width: '100%', alignItems: 'center', gap: 12 }}>
|
|
88
|
+
<strong>Toolbar content</strong>
|
|
89
|
+
</div>
|
|
90
|
+
),
|
|
91
|
+
},
|
|
92
|
+
};
|
|
93
|
+
export default meta;
|
|
94
|
+
|
|
95
|
+
type Story = StoryObj<typeof Toolbar>;
|
|
96
|
+
|
|
97
|
+
// ======================= Stories =======================
|
|
98
|
+
export const Playground: Story = {};
|
|
99
|
+
|
|
100
|
+
export const DenseVsRegular: Story = {
|
|
101
|
+
render: () => (
|
|
102
|
+
<div style={{ display: 'grid', gap: 12 }}>
|
|
103
|
+
<Toolbar>
|
|
104
|
+
<Typography variant="body2">Regular Toolbar</Typography>
|
|
105
|
+
</Toolbar>
|
|
106
|
+
<Toolbar variant="dense">
|
|
107
|
+
<Typography variant="body2">Dense Toolbar</Typography>
|
|
108
|
+
</Toolbar>
|
|
109
|
+
</div>
|
|
110
|
+
),
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
export const WithActions: Story = {
|
|
114
|
+
render: () => (
|
|
115
|
+
<Toolbar sx={{ display: 'flex', gap: 8 }}>
|
|
116
|
+
<Typography sx={{ flex: 1 }} variant="h6">Title</Typography>
|
|
117
|
+
<IconButton aria-label="search">
|
|
118
|
+
<Icon name="search" fontSize={20} />
|
|
119
|
+
</IconButton>
|
|
120
|
+
<IconButton aria-label="user">
|
|
121
|
+
<Icon name="person" fontSize={20} />
|
|
122
|
+
</IconButton>
|
|
123
|
+
<Button variant="contained" size="small">Action</Button>
|
|
124
|
+
</Toolbar>
|
|
125
|
+
),
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
export const InAppBar: Story = {
|
|
129
|
+
render: () => (
|
|
130
|
+
<AppBar position="static">
|
|
131
|
+
<Toolbar>
|
|
132
|
+
<Typography variant="h6" sx={{ flex: 1 }}>App Bar + Toolbar</Typography>
|
|
133
|
+
<Button color="inherit" size="small">Login</Button>
|
|
134
|
+
</Toolbar>
|
|
135
|
+
</AppBar>
|
|
136
|
+
),
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
export const WrappedInHeader: Story = {
|
|
140
|
+
render: () => (
|
|
141
|
+
<Box component="header" sx={{ border: '1px solid', borderColor: 'divider' }}>
|
|
142
|
+
<Toolbar variant="dense">
|
|
143
|
+
<Typography variant="body2">Header Toolbar (wrapped by Box)</Typography>
|
|
144
|
+
</Toolbar>
|
|
145
|
+
</Box>
|
|
146
|
+
),
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
export const WithCustomSx: Story = {
|
|
150
|
+
render: () => (
|
|
151
|
+
<Toolbar sx={{ bgcolor: 'background.paper', border: '1px dashed', borderColor: 'divider', borderRadius: 1 }}>
|
|
152
|
+
<Typography variant="body2">Styled with sx</Typography>
|
|
153
|
+
</Toolbar>
|
|
154
|
+
),
|
|
155
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import MuiToolbar from '@mui/material/Toolbar';
|
|
3
|
+
/**
|
|
4
|
+
* This.GUI — Toolbar atom
|
|
5
|
+
* Thin wrapper around MUI's Toolbar so consumers import from "@/gui/atoms"
|
|
6
|
+
* instead of "@mui/material". This keeps the engine swappable.
|
|
7
|
+
*
|
|
8
|
+
* Notes:
|
|
9
|
+
* - We type props from MuiToolbar to preserve its full API (incl. `component`, `sx`, etc.).
|
|
10
|
+
* - Ref is HTMLDivElement, matching the default DOM element Toolbar renders.
|
|
11
|
+
*/
|
|
12
|
+
export type ToolbarProps = React.ComponentProps<typeof MuiToolbar>;
|
|
13
|
+
const Toolbar = React.forwardRef<HTMLDivElement, ToolbarProps>(function Toolbar(props, ref) {
|
|
14
|
+
return <MuiToolbar ref={ref} {...props} />;});
|
|
15
|
+
(Toolbar as any).displayName = 'Gui.Toolbar';
|
|
16
|
+
export default Toolbar;
|