this.gui 1.3.24 → 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 +1 -2
- 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,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This.GUI — Collapse
|
|
3
|
+
* Thin wrapper around MUI’s Collapse that preserves props & typing.
|
|
4
|
+
*
|
|
5
|
+
* Fidelity
|
|
6
|
+
* - Directly re-exports MUI’s component so behavior/typing remain intact.
|
|
7
|
+
* - No custom logic; consumers keep using it exactly like MUI.
|
|
8
|
+
*
|
|
9
|
+
* Styling / Granular control
|
|
10
|
+
* - Supports MUI System styling via props exposed by MUI (e.g. `sx` on slots where applicable).
|
|
11
|
+
*/
|
|
12
|
+
import * as React from 'react';
|
|
13
|
+
import MuiCollapse from '@mui/material/Collapse';
|
|
14
|
+
const Collapse = MuiCollapse;
|
|
15
|
+
export type CollapseProps = React.ComponentProps<typeof Collapse>;
|
|
16
|
+
(Collapse as any).displayName = 'Gui.Collapse';
|
|
17
|
+
export default Collapse;
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { Divider } from '@/gui/components/atoms';
|
|
3
|
+
import type { SxProps, Theme } from '@mui/material/styles';
|
|
4
|
+
import type { RegistryEntry, ResolveCtx } from '@/registry/types';
|
|
5
|
+
import { ensureNodeId } from '@/gui/utils/nodeID';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* DividerResolver — declarative adapter for MUI Divider
|
|
9
|
+
*
|
|
10
|
+
* Fidelity
|
|
11
|
+
* - Forwards MUI props faithfully (orientation, flexItem, light, variant, textAlign, etc.).
|
|
12
|
+
* - Supports polymorphism via `component` (and alias `as`) when compatible with MUI Divider.
|
|
13
|
+
* - Granular styling via `sx` on the root Divider.
|
|
14
|
+
*
|
|
15
|
+
* Sugar
|
|
16
|
+
* - `text`: convenience for inline content (maps to children). If both `children` and `text`
|
|
17
|
+
* are provided, `children` takes precedence.
|
|
18
|
+
*
|
|
19
|
+
* JSON example:
|
|
20
|
+
* {
|
|
21
|
+
* "type": "Divider",
|
|
22
|
+
* "props": {
|
|
23
|
+
* "orientation": "vertical",
|
|
24
|
+
* "flexItem": true,
|
|
25
|
+
* "text": "OR",
|
|
26
|
+
* "sx": { "borderColor": "primary.main" }
|
|
27
|
+
* }
|
|
28
|
+
* }
|
|
29
|
+
*/
|
|
30
|
+
export type DividerSpec = {
|
|
31
|
+
type: 'Divider';
|
|
32
|
+
props?: {
|
|
33
|
+
// Content
|
|
34
|
+
children?: React.ReactNode;
|
|
35
|
+
text?: React.ReactNode; // convenience alias for children
|
|
36
|
+
|
|
37
|
+
// Polymorphism
|
|
38
|
+
component?: React.ElementType | string;
|
|
39
|
+
as?: React.ElementType | string; // alias for component
|
|
40
|
+
|
|
41
|
+
// Common MUI Divider props (subset; passthrough handles the rest)
|
|
42
|
+
orientation?: 'horizontal' | 'vertical';
|
|
43
|
+
flexItem?: boolean;
|
|
44
|
+
light?: boolean;
|
|
45
|
+
variant?: 'fullWidth' | 'inset' | 'middle';
|
|
46
|
+
textAlign?: 'center' | 'left' | 'right';
|
|
47
|
+
|
|
48
|
+
// Styling & misc
|
|
49
|
+
sx?: SxProps<Theme>;
|
|
50
|
+
className?: string;
|
|
51
|
+
id?: string;
|
|
52
|
+
'data-testid'?: string;
|
|
53
|
+
|
|
54
|
+
// Arbitrary passthrough
|
|
55
|
+
[key: string]: any;
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
const DividerResolver: RegistryEntry = {
|
|
60
|
+
type: 'Divider',
|
|
61
|
+
resolve(spec: DividerSpec, _ctx?: ResolveCtx) {
|
|
62
|
+
const p = spec.props ?? {};
|
|
63
|
+
// Extract and sanitize resolver-only fields so they don't leak to DOM
|
|
64
|
+
const {
|
|
65
|
+
children,
|
|
66
|
+
text,
|
|
67
|
+
as: _as,
|
|
68
|
+
component: _component,
|
|
69
|
+
sx,
|
|
70
|
+
className,
|
|
71
|
+
id,
|
|
72
|
+
'data-testid': dataTestId,
|
|
73
|
+
...rest
|
|
74
|
+
} = p;
|
|
75
|
+
|
|
76
|
+
const component = (_component ?? _as) as React.ElementType | string | undefined;
|
|
77
|
+
const content = children ?? text ?? undefined;
|
|
78
|
+
const dividerId = ensureNodeId('divider', id);
|
|
79
|
+
|
|
80
|
+
return (
|
|
81
|
+
<Divider
|
|
82
|
+
{...(component ? { component } : {})}
|
|
83
|
+
sx={sx}
|
|
84
|
+
className={className}
|
|
85
|
+
id={dividerId}
|
|
86
|
+
data-testid={dataTestId}
|
|
87
|
+
{...rest}
|
|
88
|
+
>
|
|
89
|
+
{content}
|
|
90
|
+
</Divider>
|
|
91
|
+
);
|
|
92
|
+
},
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
export default DividerResolver;
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { Divider, Box, Typography, Stack } from '@/gui/components/atoms';
|
|
3
|
+
|
|
4
|
+
const meta: Meta<typeof Divider> = {
|
|
5
|
+
title: 'Atoms/Content/Divider',
|
|
6
|
+
component: Divider,
|
|
7
|
+
tags: ['autodocs'],
|
|
8
|
+
parameters: {
|
|
9
|
+
docs: {
|
|
10
|
+
description: {
|
|
11
|
+
component:
|
|
12
|
+
'The Divider component is a thin wrapper over MUI\'s `MuiDivider`. It preserves all props and allows styling via the `sx` prop.',
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
argTypes: {
|
|
17
|
+
orientation: {
|
|
18
|
+
control: { type: 'radio' },
|
|
19
|
+
options: ['horizontal', 'vertical'],
|
|
20
|
+
description: 'The divider orientation.',
|
|
21
|
+
},
|
|
22
|
+
variant: {
|
|
23
|
+
control: { type: 'radio' },
|
|
24
|
+
options: ['fullWidth', 'inset', 'middle'],
|
|
25
|
+
description: 'The variant to use.',
|
|
26
|
+
},
|
|
27
|
+
flexItem: {
|
|
28
|
+
control: { type: 'boolean' },
|
|
29
|
+
description: 'If true, the divider is a flex item.',
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
args: {
|
|
33
|
+
orientation: 'horizontal',
|
|
34
|
+
variant: 'fullWidth',
|
|
35
|
+
flexItem: false,
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export default meta;
|
|
40
|
+
type Story = StoryObj<typeof Divider>;
|
|
41
|
+
|
|
42
|
+
export const Playground: Story = {
|
|
43
|
+
render: (args) => (
|
|
44
|
+
<Stack spacing={2} sx={{ width: 300 }}>
|
|
45
|
+
<Typography>Item One</Typography>
|
|
46
|
+
<Divider {...args} />
|
|
47
|
+
<Typography>Item Two</Typography>
|
|
48
|
+
<Divider {...args} />
|
|
49
|
+
<Typography>Item Three</Typography>
|
|
50
|
+
</Stack>
|
|
51
|
+
),
|
|
52
|
+
parameters: {
|
|
53
|
+
docs: {
|
|
54
|
+
description: {
|
|
55
|
+
story: 'Demonstrates the Divider component with customizable props in a vertical stack.',
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
export const VerticalDivider: Story = {
|
|
62
|
+
render: () => (
|
|
63
|
+
<Stack direction="row" spacing={2} alignItems="center" sx={{ height: 100 }}>
|
|
64
|
+
<Typography>Left</Typography>
|
|
65
|
+
<Divider orientation="vertical" flexItem />
|
|
66
|
+
<Typography>Right</Typography>
|
|
67
|
+
</Stack>
|
|
68
|
+
),
|
|
69
|
+
parameters: {
|
|
70
|
+
docs: {
|
|
71
|
+
description: {
|
|
72
|
+
story: 'Shows a vertical divider between two items in a horizontal stack.',
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
export const InsetDivider: Story = {
|
|
79
|
+
render: () => (
|
|
80
|
+
<Stack spacing={2} sx={{ width: 300 }}>
|
|
81
|
+
<Typography>First</Typography>
|
|
82
|
+
<Divider variant="inset" />
|
|
83
|
+
<Typography>Second</Typography>
|
|
84
|
+
</Stack>
|
|
85
|
+
),
|
|
86
|
+
parameters: {
|
|
87
|
+
docs: {
|
|
88
|
+
description: {
|
|
89
|
+
story: 'Demonstrates the inset variant of the Divider between text items.',
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
export const TextDivider: Story = {
|
|
96
|
+
render: () => (
|
|
97
|
+
<Box sx={{ width: 300 }}>
|
|
98
|
+
<Divider>Text Content</Divider>
|
|
99
|
+
</Box>
|
|
100
|
+
),
|
|
101
|
+
parameters: {
|
|
102
|
+
docs: {
|
|
103
|
+
description: {
|
|
104
|
+
story: 'Shows a divider with text content in the middle.',
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
},
|
|
108
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import MuiDivider from '@mui/material/Divider';
|
|
3
|
+
/**
|
|
4
|
+
* This.GUI — Divider (atom)
|
|
5
|
+
* Thin wrapper around MUI's Divider. Keeps the API stable under our namespace
|
|
6
|
+
* while preserving all props, including `sx`.
|
|
7
|
+
*/
|
|
8
|
+
export type DividerProps = React.ComponentProps<typeof MuiDivider>;
|
|
9
|
+
const Divider = React.forwardRef<HTMLHRElement, DividerProps>(function Divider(props, ref) {
|
|
10
|
+
return <MuiDivider ref={ref} {...props} />;
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
(Divider as any).displayName = 'Divider';
|
|
14
|
+
export default Divider;
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
// src/gui/atoms/Drawer/Drawer.resolver.tsx
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { Drawer } from '@/gui/components/atoms';
|
|
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
|
+
/**
|
|
9
|
+
* Declarative resolver for Drawer
|
|
10
|
+
*
|
|
11
|
+
* Goals
|
|
12
|
+
* - Stay faithful to MUI props.
|
|
13
|
+
* - Add ergonomic sugar for JSON-driven UIs (width → PaperProps.sx.width, paperSx merge, content alias, keepMounted).
|
|
14
|
+
* - Keep types helpful (SxProps<Theme> where relevant).
|
|
15
|
+
*
|
|
16
|
+
* Notes
|
|
17
|
+
* - We deliberately DO NOT update layout insets here. That responsibility belongs to higher-level layout components.
|
|
18
|
+
*/
|
|
19
|
+
type DrawerSpec = {
|
|
20
|
+
type: 'Drawer';
|
|
21
|
+
props?: {
|
|
22
|
+
// Behavior & placement
|
|
23
|
+
variant?: 'temporary' | 'persistent' | 'permanent';
|
|
24
|
+
anchor?: 'left' | 'right' | 'top' | 'bottom';
|
|
25
|
+
open?: boolean; // if omitted in declarative JSON, default to false
|
|
26
|
+
/**
|
|
27
|
+
* Accept either MUI's full signature or a simple no-arg callback for declarative specs.
|
|
28
|
+
* In runtime, if a no-arg function is provided, we wrap it into MUI's signature.
|
|
29
|
+
*/
|
|
30
|
+
onClose?: ((event: object, reason: 'backdropClick' | 'escapeKeyDown') => void) | (() => void);
|
|
31
|
+
|
|
32
|
+
// Styling
|
|
33
|
+
width?: number; // shortcut → merged into PaperProps.sx.width
|
|
34
|
+
sx?: SxProps<Theme>; // root sx
|
|
35
|
+
PaperProps?: any; // will be merged; sx merged with width/paperSx
|
|
36
|
+
paperSx?: SxProps<Theme>; // optional convenience to add to Paper sx
|
|
37
|
+
|
|
38
|
+
// Container/Portal & Modal behavior (temporary/persistent)
|
|
39
|
+
container?: Element | (() => Element) | null;
|
|
40
|
+
ModalProps?: any;
|
|
41
|
+
keepMounted?: boolean; // shorthand → ModalProps.keepMounted = true
|
|
42
|
+
|
|
43
|
+
// Content
|
|
44
|
+
children?: React.ReactNode;
|
|
45
|
+
content?: React.ReactNode;
|
|
46
|
+
|
|
47
|
+
// Misc
|
|
48
|
+
id?: string;
|
|
49
|
+
className?: string;
|
|
50
|
+
'data-testid'?: string;
|
|
51
|
+
|
|
52
|
+
// passthrough
|
|
53
|
+
[key: string]: any;
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
const DrawerResolver: RegistryEntry = {
|
|
58
|
+
type: 'Drawer',
|
|
59
|
+
resolve(spec: DrawerSpec) {
|
|
60
|
+
const p = spec.props ?? {};
|
|
61
|
+
|
|
62
|
+
// Merge Paper sx with `width` and optional `paperSx`
|
|
63
|
+
const mergedPaperSx = {
|
|
64
|
+
...(typeof p.width === 'number' ? { width: p.width } : {}),
|
|
65
|
+
...(p.paperSx ?? {}),
|
|
66
|
+
...(p.PaperProps?.sx ?? {}),
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
const PaperProps = {
|
|
70
|
+
...(p.PaperProps ?? {}),
|
|
71
|
+
...(Object.keys(mergedPaperSx).length ? { sx: mergedPaperSx } : {}),
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
// ModalProps (support keepMounted shorthand and preserve provided values)
|
|
75
|
+
const ModalProps =
|
|
76
|
+
p.keepMounted != null
|
|
77
|
+
? { ...(p.ModalProps ?? {}), keepMounted: p.keepMounted }
|
|
78
|
+
: p.ModalProps;
|
|
79
|
+
|
|
80
|
+
// Normalize onClose: support no-arg functions from declarative JSON
|
|
81
|
+
let onCloseProp: ((event: object, reason: 'backdropClick' | 'escapeKeyDown') => void) | undefined;
|
|
82
|
+
if (typeof p.onClose === 'function') {
|
|
83
|
+
onCloseProp = (event: object, reason: 'backdropClick' | 'escapeKeyDown') => {
|
|
84
|
+
// If the provided function expects no arguments (JSON sugar), just call it.
|
|
85
|
+
if ((p.onClose as Function).length === 0) {
|
|
86
|
+
(p.onClose as () => void)();
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
// Otherwise, forward MUI's (event, reason)
|
|
90
|
+
(p.onClose as (event: object, reason: 'backdropClick' | 'escapeKeyDown') => void)(event, reason);
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
const children = p.children ?? p.content ?? null;
|
|
95
|
+
|
|
96
|
+
return (
|
|
97
|
+
<Drawer
|
|
98
|
+
variant={p.variant ?? 'temporary'}
|
|
99
|
+
anchor={p.anchor ?? 'left'}
|
|
100
|
+
open={p.open ?? false}
|
|
101
|
+
onClose={onCloseProp}
|
|
102
|
+
PaperProps={PaperProps}
|
|
103
|
+
ModalProps={ModalProps}
|
|
104
|
+
container={p.container}
|
|
105
|
+
sx={p.sx}
|
|
106
|
+
id={ensureNodeId('drawer', p.id)}
|
|
107
|
+
className={p.className}
|
|
108
|
+
data-testid={p['data-testid']}
|
|
109
|
+
>
|
|
110
|
+
{children}
|
|
111
|
+
</Drawer>
|
|
112
|
+
);
|
|
113
|
+
},
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
export default DrawerResolver;
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
3
|
+
import { Drawer, Box, Button, Typography } from '@/gui/components/atoms';
|
|
4
|
+
// ======================= Meta =======================
|
|
5
|
+
const meta: Meta<typeof Drawer> = {
|
|
6
|
+
title: 'Atoms/Containers/Drawer',
|
|
7
|
+
component: Drawer,
|
|
8
|
+
tags: ['autodocs'],
|
|
9
|
+
decorators: [
|
|
10
|
+
(Story) => (
|
|
11
|
+
<div style={{ padding: 16, minHeight: 320 }}>
|
|
12
|
+
<Story />
|
|
13
|
+
</div>
|
|
14
|
+
),
|
|
15
|
+
],
|
|
16
|
+
parameters: {
|
|
17
|
+
docs: {
|
|
18
|
+
description: {
|
|
19
|
+
component: `
|
|
20
|
+
The **Drawer** primitive is a thin wrapper over MUI's \`MuiDrawer\`. It preserves all of MUI's props and behavior, while keeping the import surface stable via \`@/gui/primitives\`.
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
## Features
|
|
24
|
+
- Variants: \`temporary\`, \`persistent\`, \`permanent\`.
|
|
25
|
+
- Anchors: \`left\`, \`right\`, \`top\`, \`bottom\`.
|
|
26
|
+
- Works with This.GUI theme (via \`GuiProvider\`).
|
|
27
|
+
- Accepts \`sx\` and \`PaperProps\` for styling the surface.
|
|
28
|
+
|
|
29
|
+
> Note: For \`temporary\` drawers, you control visibility with the \`open\` prop and \`onClose\`.
|
|
30
|
+
> For \`permanent\` drawers, \`open\` is ignored by MUI; the drawer is always visible.
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
## Basic usage
|
|
34
|
+
~~~tsx
|
|
35
|
+
import { Drawer } from '@/gui/primitives';
|
|
36
|
+
|
|
37
|
+
<Drawer anchor="left" variant="temporary" open={open} onClose={() => setOpen(false)}>
|
|
38
|
+
<div style={{ width: 260, padding: 16 }}>Content</div>
|
|
39
|
+
</Drawer>
|
|
40
|
+
~~~
|
|
41
|
+
|
|
42
|
+
## Permanent sidebar
|
|
43
|
+
~~~tsx
|
|
44
|
+
<Drawer anchor="left" variant="permanent" PaperProps={{ sx: { width: 260 } }}>
|
|
45
|
+
<div style={{ width: 260, padding: 16 }}>Navigation</div>
|
|
46
|
+
</Drawer>
|
|
47
|
+
~~~
|
|
48
|
+
|
|
49
|
+
## Declarative JSON / Config
|
|
50
|
+
~~~json
|
|
51
|
+
{
|
|
52
|
+
"type": "Drawer",
|
|
53
|
+
"props": {
|
|
54
|
+
"variant": "temporary",
|
|
55
|
+
"anchor": "right",
|
|
56
|
+
"PaperProps": { "sx": { "width": 300 } },
|
|
57
|
+
"children": "<YourMenu />"
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
~~~
|
|
61
|
+
|
|
62
|
+
When used via your registry/resolver, the object above is resolved into a live Drawer with the provided props.
|
|
63
|
+
`,
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
argTypes: {
|
|
68
|
+
variant: {
|
|
69
|
+
control: { type: 'radio' },
|
|
70
|
+
options: ['temporary', 'persistent', 'permanent'],
|
|
71
|
+
},
|
|
72
|
+
anchor: {
|
|
73
|
+
control: { type: 'radio' },
|
|
74
|
+
options: ['left', 'right', 'top', 'bottom'],
|
|
75
|
+
},
|
|
76
|
+
open: {
|
|
77
|
+
control: { type: 'boolean' },
|
|
78
|
+
description: 'Only relevant for temporary/persistent variants.',
|
|
79
|
+
},
|
|
80
|
+
// Not useful as a control in SB; better shown in examples
|
|
81
|
+
container: { table: { disable: true } },
|
|
82
|
+
},
|
|
83
|
+
args: {
|
|
84
|
+
variant: 'temporary',
|
|
85
|
+
anchor: 'left',
|
|
86
|
+
open: false,
|
|
87
|
+
},
|
|
88
|
+
};
|
|
89
|
+
export default meta;
|
|
90
|
+
|
|
91
|
+
type Story = StoryObj<typeof Drawer>;
|
|
92
|
+
|
|
93
|
+
// ======================= Helpers =======================
|
|
94
|
+
const DemoList = ({ label = 'Menu' }: { label?: string }) => (
|
|
95
|
+
<Box sx={{ width: 260, p: 2 }}>
|
|
96
|
+
<Typography variant="subtitle1" sx={{ mb: 1.5 }}>{label}</Typography>
|
|
97
|
+
<ul style={{ margin: 0, paddingLeft: 16, lineHeight: 1.9 }}>
|
|
98
|
+
<li><a href="#">Item one</a></li>
|
|
99
|
+
<li><a href="#">Item two</a></li>
|
|
100
|
+
<li><a href="#">Item three</a></li>
|
|
101
|
+
</ul>
|
|
102
|
+
</Box>
|
|
103
|
+
);
|
|
104
|
+
|
|
105
|
+
// ======================= Stories =======================
|
|
106
|
+
|
|
107
|
+
export const Playground: Story = {
|
|
108
|
+
render: (args) => (
|
|
109
|
+
<>
|
|
110
|
+
<Typography variant="body1" sx={{ mb: 1 }}>
|
|
111
|
+
Toggle <strong>open</strong> in controls (temporary/persistent).
|
|
112
|
+
</Typography>
|
|
113
|
+
<Drawer {...args}>
|
|
114
|
+
<DemoList />
|
|
115
|
+
</Drawer>
|
|
116
|
+
</>
|
|
117
|
+
),
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
export const TemporaryWithToggle: Story = {
|
|
121
|
+
name: 'Temporary (with toggle button)',
|
|
122
|
+
render: () => {
|
|
123
|
+
const [open, setOpen] = React.useState(false);
|
|
124
|
+
return (
|
|
125
|
+
<>
|
|
126
|
+
<Button variant="contained" color="primary" onClick={() => setOpen(true)}>
|
|
127
|
+
Open drawer
|
|
128
|
+
</Button>
|
|
129
|
+
<Drawer
|
|
130
|
+
anchor="left"
|
|
131
|
+
variant="temporary"
|
|
132
|
+
open={open}
|
|
133
|
+
onClose={() => setOpen(false)}
|
|
134
|
+
ModalProps={{ keepMounted: true }}
|
|
135
|
+
>
|
|
136
|
+
<DemoList label="Temporary drawer" />
|
|
137
|
+
</Drawer>
|
|
138
|
+
</>
|
|
139
|
+
);
|
|
140
|
+
},
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
export const PermanentLeft: Story = {
|
|
144
|
+
name: 'Permanent (left)',
|
|
145
|
+
render: () => (
|
|
146
|
+
<div style={{ display: 'flex', minHeight: 320 }}>
|
|
147
|
+
<Drawer
|
|
148
|
+
anchor="left"
|
|
149
|
+
variant="permanent"
|
|
150
|
+
PaperProps={{ sx: { width: 240, position: 'relative' } }}
|
|
151
|
+
>
|
|
152
|
+
<DemoList label="Permanent left" />
|
|
153
|
+
</Drawer>
|
|
154
|
+
<Box sx={{ flex: 1, p: 2 }}>
|
|
155
|
+
<Typography variant="h6" sx={{ mb: 1 }}>Content area</Typography>
|
|
156
|
+
<Typography variant="body2">
|
|
157
|
+
The permanent drawer is always visible and does not use the <code>open</code> prop.
|
|
158
|
+
</Typography>
|
|
159
|
+
</Box>
|
|
160
|
+
</div>
|
|
161
|
+
),
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
export const RightAnchorTemporary: Story = {
|
|
165
|
+
name: 'Temporary (right anchor)',
|
|
166
|
+
render: () => {
|
|
167
|
+
const [open, setOpen] = React.useState(false);
|
|
168
|
+
return (
|
|
169
|
+
<>
|
|
170
|
+
<Button variant="outlined" onClick={() => setOpen(true)}>
|
|
171
|
+
Open right drawer
|
|
172
|
+
</Button>
|
|
173
|
+
<Drawer
|
|
174
|
+
anchor="right"
|
|
175
|
+
variant="temporary"
|
|
176
|
+
open={open}
|
|
177
|
+
onClose={() => setOpen(false)}
|
|
178
|
+
PaperProps={{ sx: { width: 300 } }}
|
|
179
|
+
>
|
|
180
|
+
<DemoList label="Right side" />
|
|
181
|
+
</Drawer>
|
|
182
|
+
</>
|
|
183
|
+
);
|
|
184
|
+
},
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
export const TopAndBottom: Story = {
|
|
188
|
+
name: 'Top & bottom anchors',
|
|
189
|
+
render: () => {
|
|
190
|
+
const [openTop, setOpenTop] = React.useState(false);
|
|
191
|
+
const [openBottom, setOpenBottom] = React.useState(false);
|
|
192
|
+
return (
|
|
193
|
+
<>
|
|
194
|
+
<div style={{ display: 'flex', gap: 12, marginBottom: 12 }}>
|
|
195
|
+
<Button variant="outlined" onClick={() => setOpenTop(true)}>Open top</Button>
|
|
196
|
+
<Button variant="outlined" onClick={() => setOpenBottom(true)}>Open bottom</Button>
|
|
197
|
+
</div>
|
|
198
|
+
<Drawer
|
|
199
|
+
anchor="top"
|
|
200
|
+
variant="temporary"
|
|
201
|
+
open={openTop}
|
|
202
|
+
onClose={() => setOpenTop(false)}
|
|
203
|
+
PaperProps={{ sx: { height: 200 } }}
|
|
204
|
+
>
|
|
205
|
+
<Box sx={{ p: 2 }}>
|
|
206
|
+
<Typography variant="subtitle1">Top drawer</Typography>
|
|
207
|
+
</Box>
|
|
208
|
+
</Drawer>
|
|
209
|
+
<Drawer
|
|
210
|
+
anchor="bottom"
|
|
211
|
+
variant="temporary"
|
|
212
|
+
open={openBottom}
|
|
213
|
+
onClose={() => setOpenBottom(false)}
|
|
214
|
+
PaperProps={{ sx: { height: 200 } }}
|
|
215
|
+
>
|
|
216
|
+
<Box sx={{ p: 2 }}>
|
|
217
|
+
<Typography variant="subtitle1">Bottom drawer</Typography>
|
|
218
|
+
</Box>
|
|
219
|
+
</Drawer>
|
|
220
|
+
</>
|
|
221
|
+
);
|
|
222
|
+
},
|
|
223
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import MuiDrawer from '@mui/material/Drawer';
|
|
3
|
+
export type DrawerProps = React.ComponentProps<typeof MuiDrawer>;
|
|
4
|
+
/**
|
|
5
|
+
* `Drawer` is a wrapper around MUI's `Drawer` component.
|
|
6
|
+
*
|
|
7
|
+
* It provides a consistent drawer interface for side navigation or temporary content containers.
|
|
8
|
+
* All props from MUI's `Drawer` are forwarded via `DrawerProps`, ensuring type safety and
|
|
9
|
+
* autocomplete support.
|
|
10
|
+
*
|
|
11
|
+
* This component also uses `React.forwardRef` to support ref forwarding for advanced use cases
|
|
12
|
+
* like controlling the drawer programmatically or integrating with custom animations.
|
|
13
|
+
*
|
|
14
|
+
* Example usage:
|
|
15
|
+
* ```tsx
|
|
16
|
+
* <Drawer anchor="left" open={open} onClose={handleClose}>
|
|
17
|
+
* <List>...</List>
|
|
18
|
+
* </Drawer>
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
export const Drawer = React.forwardRef<HTMLDivElement, DrawerProps>(function Drawer(props, ref) {
|
|
22
|
+
return <MuiDrawer ref={ref} {...props} />;
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
export default Drawer;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { RegistryEntry, ResolveCtx } from '@/registry/types';
|
|
2
|
+
import { ensureNodeId } from '@/gui/utils/nodeID';
|
|
3
|
+
import Grid from './Grid';
|
|
4
|
+
import type { GridResolverSpec } from './Grid.types';
|
|
5
|
+
|
|
6
|
+
const GridResolver: RegistryEntry = {
|
|
7
|
+
type: 'Grid',
|
|
8
|
+
resolve(spec: GridResolverSpec, _ctx?: ResolveCtx) {
|
|
9
|
+
const p = spec.props ?? {};
|
|
10
|
+
const {
|
|
11
|
+
children,
|
|
12
|
+
id,
|
|
13
|
+
className,
|
|
14
|
+
sx,
|
|
15
|
+
...rest
|
|
16
|
+
} = p;
|
|
17
|
+
|
|
18
|
+
const gridId = ensureNodeId('grid', id);
|
|
19
|
+
|
|
20
|
+
return (
|
|
21
|
+
<Grid
|
|
22
|
+
id={gridId}
|
|
23
|
+
className={className}
|
|
24
|
+
sx={sx}
|
|
25
|
+
{...rest}
|
|
26
|
+
>
|
|
27
|
+
{children}
|
|
28
|
+
</Grid>
|
|
29
|
+
);
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export default GridResolver;
|