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,63 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { SxProps, Theme } from '@mui/material/styles';
|
|
3
|
+
import type { RegistryEntry, ResolveCtx } from '@/registry/types';
|
|
4
|
+
import { ensureNodeId } from '@/gui/utils/nodeID';
|
|
5
|
+
import Card from './Card';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Declarative resolver for Card
|
|
9
|
+
* -----------------------------
|
|
10
|
+
* - Faithfully wraps MUI's Card.
|
|
11
|
+
* - Supports standard props like `variant`, `elevation`, `sx`, etc.
|
|
12
|
+
* - `children` maps directly to content inside the Card.
|
|
13
|
+
* - Supports polymorphic `component` prop and alias `as`.
|
|
14
|
+
*/
|
|
15
|
+
export type CardSpec = {
|
|
16
|
+
type: 'Card';
|
|
17
|
+
props?: {
|
|
18
|
+
children?: React.ReactNode;
|
|
19
|
+
variant?: 'elevation' | 'outlined';
|
|
20
|
+
raised?: boolean;
|
|
21
|
+
elevation?: number;
|
|
22
|
+
sx?: SxProps<Theme>;
|
|
23
|
+
className?: string;
|
|
24
|
+
id?: string;
|
|
25
|
+
'data-testid'?: string;
|
|
26
|
+
component?: React.ElementType;
|
|
27
|
+
as?: React.ElementType;
|
|
28
|
+
[key: string]: any;
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
const CardResolver: RegistryEntry = {
|
|
33
|
+
type: 'Card',
|
|
34
|
+
resolve(spec: CardSpec, _ctx?: ResolveCtx) {
|
|
35
|
+
const p = spec.props ?? {};
|
|
36
|
+
const {
|
|
37
|
+
children,
|
|
38
|
+
id,
|
|
39
|
+
className,
|
|
40
|
+
sx,
|
|
41
|
+
component,
|
|
42
|
+
as,
|
|
43
|
+
...rest
|
|
44
|
+
} = p;
|
|
45
|
+
|
|
46
|
+
const resolvedComponent = component ?? as;
|
|
47
|
+
const cardId = ensureNodeId('card', id);
|
|
48
|
+
|
|
49
|
+
return (
|
|
50
|
+
<Card
|
|
51
|
+
{...(resolvedComponent ? { component: resolvedComponent } : {})}
|
|
52
|
+
id={cardId}
|
|
53
|
+
className={className}
|
|
54
|
+
sx={sx}
|
|
55
|
+
{...rest}
|
|
56
|
+
>
|
|
57
|
+
{children}
|
|
58
|
+
</Card>
|
|
59
|
+
);
|
|
60
|
+
},
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
export default CardResolver;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import Card from './Card';
|
|
3
|
+
import Typography from '@mui/material/Typography';
|
|
4
|
+
|
|
5
|
+
const meta: Meta<typeof Card> = {
|
|
6
|
+
title: 'Atoms/Organization/Card/Card',
|
|
7
|
+
component: Card,
|
|
8
|
+
tags: ['autodocs'],
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export default meta;
|
|
12
|
+
type Story = StoryObj<typeof Card>;
|
|
13
|
+
|
|
14
|
+
export const BasicCard: Story = {
|
|
15
|
+
render: () => (
|
|
16
|
+
<Card sx={{ p: 2 }}>
|
|
17
|
+
<Typography variant="h6" gutterBottom>
|
|
18
|
+
Basic Card
|
|
19
|
+
</Typography>
|
|
20
|
+
<Typography variant="body2">
|
|
21
|
+
This is a simple card using the GUI Card atom. It supports all typical MUI props.
|
|
22
|
+
</Typography>
|
|
23
|
+
</Card>
|
|
24
|
+
),
|
|
25
|
+
name: 'Basic Card',
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export const OutlinedCard: Story = {
|
|
29
|
+
render: () => (
|
|
30
|
+
<Card variant="outlined" sx={{ p: 2 }}>
|
|
31
|
+
<Typography variant="h6" gutterBottom>
|
|
32
|
+
Outlined Card
|
|
33
|
+
</Typography>
|
|
34
|
+
<Typography variant="body2">
|
|
35
|
+
This card uses the `variant="outlined"` prop for a border style.
|
|
36
|
+
</Typography>
|
|
37
|
+
</Card>
|
|
38
|
+
),
|
|
39
|
+
name: 'Outlined Card',
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export const RaisedCard: Story = {
|
|
43
|
+
render: () => (
|
|
44
|
+
<Card raised sx={{ p: 2 }}>
|
|
45
|
+
<Typography variant="h6" gutterBottom>
|
|
46
|
+
Raised Card
|
|
47
|
+
</Typography>
|
|
48
|
+
<Typography variant="body2">
|
|
49
|
+
Raised cards use elevation to create visual depth.
|
|
50
|
+
</Typography>
|
|
51
|
+
</Card>
|
|
52
|
+
),
|
|
53
|
+
name: 'Raised Card',
|
|
54
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import MuiCard from '@mui/material/Card';
|
|
3
|
+
/**
|
|
4
|
+
* This.GUI — Card (atom)
|
|
5
|
+
* Wrapper around MUI’s Card that preserves props & typing.
|
|
6
|
+
*
|
|
7
|
+
* - Full support for MUI’s props and styling (`sx`, `elevation`, `variant`, etc.).
|
|
8
|
+
* - No behavior changes; designed to keep consistent with the This.GUI atom model.
|
|
9
|
+
*/
|
|
10
|
+
const Card = MuiCard;
|
|
11
|
+
export type CardProps = React.ComponentProps<typeof Card>;
|
|
12
|
+
(Card as any).displayName = 'Gui.Card';
|
|
13
|
+
export default Card;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { RegistryEntry, ResolveCtx } from '@/registry/types';
|
|
3
|
+
import type { SxProps, Theme } from '@mui/material/styles';
|
|
4
|
+
import { ensureNodeId } from '@/gui/utils/nodeID';
|
|
5
|
+
import CardActions from './CardActions';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Declarative resolver for CardActions
|
|
9
|
+
*
|
|
10
|
+
* - Preserves MUI fidelity: `disableSpacing`, `sx`, and any pass-through props.
|
|
11
|
+
* - Supports polymorphism via `component` or `as`.
|
|
12
|
+
* - Accepts children and standard layout styling.
|
|
13
|
+
*/
|
|
14
|
+
export type CardActionsSpec = {
|
|
15
|
+
type: 'CardActions';
|
|
16
|
+
props?: {
|
|
17
|
+
children?: React.ReactNode;
|
|
18
|
+
disableSpacing?: boolean;
|
|
19
|
+
sx?: SxProps<Theme>;
|
|
20
|
+
className?: string;
|
|
21
|
+
id?: string;
|
|
22
|
+
'data-testid'?: string;
|
|
23
|
+
component?: React.ElementType;
|
|
24
|
+
as?: React.ElementType;
|
|
25
|
+
[key: string]: any;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
const CardActionsResolver: RegistryEntry = {
|
|
30
|
+
type: 'CardActions',
|
|
31
|
+
resolve(spec: CardActionsSpec, _ctx?: ResolveCtx) {
|
|
32
|
+
const p = spec.props ?? {};
|
|
33
|
+
const {
|
|
34
|
+
children,
|
|
35
|
+
sx,
|
|
36
|
+
className,
|
|
37
|
+
id,
|
|
38
|
+
component,
|
|
39
|
+
as,
|
|
40
|
+
...rest
|
|
41
|
+
} = p;
|
|
42
|
+
const resolvedComponent = component ?? as;
|
|
43
|
+
const actionsId = ensureNodeId('cardActions', id);
|
|
44
|
+
return (
|
|
45
|
+
<CardActions
|
|
46
|
+
sx={sx}
|
|
47
|
+
className={className}
|
|
48
|
+
id={actionsId}
|
|
49
|
+
data-testid={p['data-testid']}
|
|
50
|
+
{...(resolvedComponent ? { component: resolvedComponent } : {})}
|
|
51
|
+
{...rest}
|
|
52
|
+
>
|
|
53
|
+
{children}
|
|
54
|
+
</CardActions>
|
|
55
|
+
);
|
|
56
|
+
},
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
export default CardActionsResolver;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import CardActions from './CardActions';
|
|
3
|
+
import Button from '@/gui/components/atoms/Button/Button';
|
|
4
|
+
|
|
5
|
+
const meta: Meta<typeof CardActions> = {
|
|
6
|
+
title: 'Atoms/Organization/Card/CardActions',
|
|
7
|
+
component: CardActions,
|
|
8
|
+
tags: ['autodocs'],
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export default meta;
|
|
12
|
+
type Story = StoryObj<typeof CardActions>;
|
|
13
|
+
|
|
14
|
+
export const BasicActions: Story = {
|
|
15
|
+
render: () => (
|
|
16
|
+
<CardActions>
|
|
17
|
+
<Button>Cancel</Button>
|
|
18
|
+
<Button variant="contained" color="primary">Submit</Button>
|
|
19
|
+
</CardActions>
|
|
20
|
+
),
|
|
21
|
+
name: 'Basic Actions',
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export const WithSpacingDisabled: Story = {
|
|
25
|
+
render: () => (
|
|
26
|
+
<CardActions disableSpacing>
|
|
27
|
+
<Button>Back</Button>
|
|
28
|
+
<Button variant="outlined">Next</Button>
|
|
29
|
+
</CardActions>
|
|
30
|
+
),
|
|
31
|
+
name: 'Actions without spacing',
|
|
32
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import MuiCardActions from '@mui/material/CardActions';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* This.GUI — CardActions (atom)
|
|
6
|
+
* Thin wrapper around MUI’s CardActions.
|
|
7
|
+
*
|
|
8
|
+
* - Preserves all props from MUI.
|
|
9
|
+
* - Supports polymorphism, `sx`, layout spacing, and children.
|
|
10
|
+
*/
|
|
11
|
+
const CardActions = MuiCardActions;
|
|
12
|
+
export type CardActionsProps = React.ComponentProps<typeof CardActions>;
|
|
13
|
+
(CardActions as any).displayName = 'Gui.CardActions';
|
|
14
|
+
export default CardActions;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { RegistryEntry, ResolveCtx } from '@/registry/types';
|
|
3
|
+
import type { SxProps, Theme } from '@mui/material/styles';
|
|
4
|
+
import { ensureNodeId } from '@/gui/utils/nodeID';
|
|
5
|
+
import CardContent from './CardContent';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Declarative resolver for CardContent
|
|
9
|
+
*
|
|
10
|
+
* Maps JSON-friendly specs into a GUI-compatible CardContent wrapper.
|
|
11
|
+
* - Passes through `children`, `sx`, `className`, `id`, and `component`/`as`.
|
|
12
|
+
* - Allows custom styling and polymorphic rendering.
|
|
13
|
+
*/
|
|
14
|
+
export type CardContentSpec = {
|
|
15
|
+
type: 'CardContent';
|
|
16
|
+
props?: {
|
|
17
|
+
children?: React.ReactNode;
|
|
18
|
+
sx?: SxProps<Theme>;
|
|
19
|
+
className?: string;
|
|
20
|
+
id?: string;
|
|
21
|
+
'data-testid'?: string;
|
|
22
|
+
component?: React.ElementType;
|
|
23
|
+
as?: React.ElementType;
|
|
24
|
+
[key: string]: any;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
const CardContentResolver: RegistryEntry = {
|
|
29
|
+
type: 'CardContent',
|
|
30
|
+
resolve(spec: CardContentSpec, _ctx?: ResolveCtx) {
|
|
31
|
+
const p = spec.props ?? {};
|
|
32
|
+
const {
|
|
33
|
+
children,
|
|
34
|
+
sx,
|
|
35
|
+
className,
|
|
36
|
+
id,
|
|
37
|
+
component,
|
|
38
|
+
as,
|
|
39
|
+
...rest
|
|
40
|
+
} = p;
|
|
41
|
+
|
|
42
|
+
const contentId = ensureNodeId('cardContent', id);
|
|
43
|
+
const resolvedComponent = component ?? as;
|
|
44
|
+
|
|
45
|
+
return (
|
|
46
|
+
<CardContent
|
|
47
|
+
sx={sx}
|
|
48
|
+
className={className}
|
|
49
|
+
id={contentId}
|
|
50
|
+
data-testid={p['data-testid']}
|
|
51
|
+
{...(resolvedComponent ? { component: resolvedComponent } : {})}
|
|
52
|
+
{...rest}
|
|
53
|
+
>
|
|
54
|
+
{children}
|
|
55
|
+
</CardContent>
|
|
56
|
+
);
|
|
57
|
+
},
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
export default CardContentResolver;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import CardContent from './CardContent';
|
|
3
|
+
import Typography from '@mui/material/Typography';
|
|
4
|
+
const meta: Meta<typeof CardContent> = {
|
|
5
|
+
title: 'Atoms/Organization/Card/CardContent',
|
|
6
|
+
component: CardContent,
|
|
7
|
+
tags: ['autodocs'],
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export default meta;
|
|
11
|
+
type Story = StoryObj<typeof CardContent>;
|
|
12
|
+
|
|
13
|
+
export const BasicContent: Story = {
|
|
14
|
+
render: () => (
|
|
15
|
+
<CardContent>
|
|
16
|
+
<Typography variant="body1">
|
|
17
|
+
This is the main content area inside a card. You can place any children here.
|
|
18
|
+
</Typography>
|
|
19
|
+
</CardContent>
|
|
20
|
+
),
|
|
21
|
+
name: 'Basic CardContent',
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export const WithPaddingAndText: Story = {
|
|
25
|
+
render: () => (
|
|
26
|
+
<CardContent sx={{ p: 4 }}>
|
|
27
|
+
<Typography variant="h6">Custom Padding</Typography>
|
|
28
|
+
<Typography variant="body2">
|
|
29
|
+
This CardContent component has extra padding applied via the `sx` prop.
|
|
30
|
+
</Typography>
|
|
31
|
+
</CardContent>
|
|
32
|
+
),
|
|
33
|
+
name: 'CardContent with sx',
|
|
34
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import MuiCardContent from '@mui/material/CardContent';
|
|
3
|
+
/**
|
|
4
|
+
* This.GUI — CardContent (atom)
|
|
5
|
+
* Thin wrapper around MUI’s CardContent component.
|
|
6
|
+
*
|
|
7
|
+
* - Preserves props and typing directly from MUI.
|
|
8
|
+
* - Allows styling via `sx`, polymorphism via `component`, and content via `children`.
|
|
9
|
+
*/
|
|
10
|
+
const CardContent = MuiCardContent;
|
|
11
|
+
export type CardContentProps = React.ComponentProps<typeof CardContent>;
|
|
12
|
+
(CardContent as any).displayName = 'Gui.CardContent';
|
|
13
|
+
export default CardContent;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { RegistryEntry, ResolveCtx } from '@/registry/types';
|
|
3
|
+
import type { SxProps, Theme } from '@mui/material/styles';
|
|
4
|
+
import { ensureNodeId } from '@/gui/utils/nodeID';
|
|
5
|
+
import CardHeader from './CardHeader';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Declarative resolver for CardHeader
|
|
9
|
+
*
|
|
10
|
+
* Purpose:
|
|
11
|
+
* - Enables JSON-based rendering of card headers with title, subheader, and actions.
|
|
12
|
+
* - Supports polymorphism (`component` or `as`) and typical MUI props.
|
|
13
|
+
*/
|
|
14
|
+
export type CardHeaderSpec = {
|
|
15
|
+
type: 'CardHeader';
|
|
16
|
+
props?: {
|
|
17
|
+
title?: React.ReactNode;
|
|
18
|
+
subheader?: React.ReactNode;
|
|
19
|
+
action?: React.ReactNode;
|
|
20
|
+
avatar?: React.ReactNode;
|
|
21
|
+
component?: React.ElementType;
|
|
22
|
+
as?: React.ElementType;
|
|
23
|
+
sx?: SxProps<Theme>;
|
|
24
|
+
className?: string;
|
|
25
|
+
id?: string;
|
|
26
|
+
'data-testid'?: string;
|
|
27
|
+
[key: string]: any;
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const CardHeaderResolver: RegistryEntry = {
|
|
32
|
+
type: 'CardHeader',
|
|
33
|
+
resolve(spec: CardHeaderSpec, _ctx?: ResolveCtx) {
|
|
34
|
+
const p = spec.props ?? {};
|
|
35
|
+
const {
|
|
36
|
+
id,
|
|
37
|
+
component,
|
|
38
|
+
as,
|
|
39
|
+
sx,
|
|
40
|
+
className,
|
|
41
|
+
title,
|
|
42
|
+
subheader,
|
|
43
|
+
action,
|
|
44
|
+
avatar,
|
|
45
|
+
...rest
|
|
46
|
+
} = p;
|
|
47
|
+
|
|
48
|
+
const headerId = ensureNodeId('cardHeader', id);
|
|
49
|
+
const resolvedComponent = component ?? as;
|
|
50
|
+
|
|
51
|
+
return (
|
|
52
|
+
<CardHeader
|
|
53
|
+
title={title}
|
|
54
|
+
subheader={subheader}
|
|
55
|
+
action={action}
|
|
56
|
+
avatar={avatar}
|
|
57
|
+
sx={sx}
|
|
58
|
+
className={className}
|
|
59
|
+
id={headerId}
|
|
60
|
+
data-testid={p['data-testid']}
|
|
61
|
+
{...(resolvedComponent ? { component: resolvedComponent } : {})}
|
|
62
|
+
{...rest}
|
|
63
|
+
/>
|
|
64
|
+
);
|
|
65
|
+
},
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
export default CardHeaderResolver;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import CardHeader from './CardHeader';
|
|
3
|
+
import Avatar from '@mui/material/Avatar';
|
|
4
|
+
import IconButton from '@mui/material/IconButton';
|
|
5
|
+
import Icon from '@/gui/Theme/Icon/Icon';
|
|
6
|
+
|
|
7
|
+
const meta: Meta<typeof CardHeader> = {
|
|
8
|
+
title: 'Atoms/Organization/Card/CardHeader',
|
|
9
|
+
component: CardHeader,
|
|
10
|
+
tags: ['autodocs'],
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export default meta;
|
|
14
|
+
type Story = StoryObj<typeof CardHeader>;
|
|
15
|
+
|
|
16
|
+
export const BasicHeader: Story = {
|
|
17
|
+
render: () => (
|
|
18
|
+
<CardHeader
|
|
19
|
+
title="Card Title"
|
|
20
|
+
subheader="September 20, 2025"
|
|
21
|
+
/>
|
|
22
|
+
),
|
|
23
|
+
name: 'Basic Header',
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export const WithAvatarAndAction: Story = {
|
|
27
|
+
render: () => (
|
|
28
|
+
<CardHeader
|
|
29
|
+
avatar={<Avatar aria-label="recipe">R</Avatar>}
|
|
30
|
+
action={
|
|
31
|
+
<IconButton aria-label="settings">
|
|
32
|
+
<Icon name="more_vert" />
|
|
33
|
+
</IconButton>
|
|
34
|
+
}
|
|
35
|
+
title="Shrimp and Chorizo Paella"
|
|
36
|
+
subheader="September 20, 2025"
|
|
37
|
+
/>
|
|
38
|
+
),
|
|
39
|
+
name: 'Header with Avatar and Action',
|
|
40
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import MuiCardHeader from '@mui/material/CardHeader';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* This.GUI — CardHeader (atom)
|
|
6
|
+
* Thin wrapper around MUI’s CardHeader that preserves props & typing.
|
|
7
|
+
* Useful for defining title, subheader, and action areas in cards with consistent API.
|
|
8
|
+
*/
|
|
9
|
+
const CardHeader = MuiCardHeader;
|
|
10
|
+
export type CardHeaderProps = React.ComponentProps<typeof CardHeader>;
|
|
11
|
+
(CardHeader as any).displayName = 'Gui.CardHeader';
|
|
12
|
+
export default CardHeader;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
// src/gui/atoms/Collapse/Collapse.resolver.tsx
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import Collapse from './Collapse';
|
|
4
|
+
import type { RegistryEntry, ResolveCtx } from '@/registry/types';
|
|
5
|
+
import type { SxProps, Theme } from '@mui/material/styles';
|
|
6
|
+
import type { TransitionProps } from '@mui/material/transitions';
|
|
7
|
+
import { ensureNodeId } from '@/gui/utils/nodeID';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Declarative resolver for Collapse
|
|
11
|
+
* ---------------------------------
|
|
12
|
+
* Fidelity
|
|
13
|
+
* - Forwards MUI props faithfully (in, orientation, collapsedSize, timeout, easing, unmountOnExit, etc.).
|
|
14
|
+
* - Supports polymorphism via `component` (and alias `as`).
|
|
15
|
+
* - Provides granular styling through `sx` on the root.
|
|
16
|
+
*
|
|
17
|
+
* Usage (declarative JSON):
|
|
18
|
+
* {
|
|
19
|
+
* "type": "Collapse",
|
|
20
|
+
* "props": {
|
|
21
|
+
* "in": true,
|
|
22
|
+
* "orientation": "vertical",
|
|
23
|
+
* "sx": { "border": "1px dashed", "borderColor": "divider" }
|
|
24
|
+
* }
|
|
25
|
+
* }
|
|
26
|
+
*/
|
|
27
|
+
export type CollapseSpec = {
|
|
28
|
+
type: 'Collapse';
|
|
29
|
+
props?: {
|
|
30
|
+
children?: React.ReactNode;
|
|
31
|
+
|
|
32
|
+
// Note: MUI Collapse's `component` must be a React component (not a string tag) due to Transition typing.
|
|
33
|
+
component?: React.ElementType<TransitionProps>;
|
|
34
|
+
as?: any; // alias of component
|
|
35
|
+
|
|
36
|
+
// Core MUI props (subset; others passthrough)
|
|
37
|
+
in?: boolean;
|
|
38
|
+
orientation?: 'vertical' | 'horizontal';
|
|
39
|
+
collapsedSize?: number | string;
|
|
40
|
+
timeout?: 'auto' | number | { appear?: number; enter?: number; exit?: number };
|
|
41
|
+
easing?: string | { enter?: string; exit?: string };
|
|
42
|
+
unmountOnExit?: boolean;
|
|
43
|
+
mountOnEnter?: boolean;
|
|
44
|
+
appear?: boolean;
|
|
45
|
+
|
|
46
|
+
// Styling
|
|
47
|
+
sx?: SxProps<Theme>;
|
|
48
|
+
className?: string;
|
|
49
|
+
id?: string;
|
|
50
|
+
'data-testid'?: string;
|
|
51
|
+
|
|
52
|
+
// Arbitrary passthrough
|
|
53
|
+
[key: string]: any;
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
const CollapseResolver: RegistryEntry = {
|
|
58
|
+
type: 'Collapse',
|
|
59
|
+
resolve(spec: CollapseSpec, _ctx?: ResolveCtx) {
|
|
60
|
+
const p = spec.props ?? {};
|
|
61
|
+
const { children, as: _as, component: _component, ...rest } = p;
|
|
62
|
+
// Collapse's `component` must be a React component (not a string tag), otherwise TS will error.
|
|
63
|
+
const rawComponent = _component ?? _as;
|
|
64
|
+
const component = (typeof rawComponent === 'string'
|
|
65
|
+
? undefined
|
|
66
|
+
: (rawComponent as React.ElementType<TransitionProps>)) as React.ElementType<TransitionProps> | undefined;
|
|
67
|
+
|
|
68
|
+
// Guarantee a stable, prefixed id for editor tooling
|
|
69
|
+
const collapseId = ensureNodeId('collapse', p.id);
|
|
70
|
+
return (
|
|
71
|
+
<Collapse
|
|
72
|
+
{...(component ? { component: component as React.ElementType<TransitionProps> } : {})}
|
|
73
|
+
sx={p.sx}
|
|
74
|
+
className={p.className}
|
|
75
|
+
id={collapseId}
|
|
76
|
+
data-testid={p['data-testid']}
|
|
77
|
+
{...rest}
|
|
78
|
+
>
|
|
79
|
+
{children}
|
|
80
|
+
</Collapse>
|
|
81
|
+
);
|
|
82
|
+
},
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
export default CollapseResolver;
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
3
|
+
import Collapse from './Collapse';
|
|
4
|
+
|
|
5
|
+
const meta: Meta<typeof Collapse> = {
|
|
6
|
+
title: 'Atoms/Content/Collapse',
|
|
7
|
+
component: Collapse,
|
|
8
|
+
tags: ['autodocs'],
|
|
9
|
+
decorators: [
|
|
10
|
+
(Story) => (
|
|
11
|
+
<div style={{ padding: 16, minHeight: 220 }}>
|
|
12
|
+
<Story />
|
|
13
|
+
</div>
|
|
14
|
+
),
|
|
15
|
+
],
|
|
16
|
+
parameters: {
|
|
17
|
+
docs: {
|
|
18
|
+
description: {
|
|
19
|
+
component: `
|
|
20
|
+
The **Collapse** atom is a thin wrapper around MUI's \`MuiCollapse\`, staying faithful to its API and polymorphism.
|
|
21
|
+
|
|
22
|
+
In **declarative** mode (resolver), it forwards MUI props as-is and supports granular styling via \`sx\` on the root.
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
## React usage
|
|
26
|
+
~~~jsx
|
|
27
|
+
const [open, setOpen] = React.useState(true);
|
|
28
|
+
|
|
29
|
+
<Collapse in={open}>
|
|
30
|
+
<div style={{ padding: 12, border: '1px solid var(--mui-palette-divider)', borderRadius: 8 }}>
|
|
31
|
+
Collapsible content
|
|
32
|
+
</div>
|
|
33
|
+
</Collapse>
|
|
34
|
+
~~~
|
|
35
|
+
|
|
36
|
+
## Declarative JSON / Resolver
|
|
37
|
+
~~~json
|
|
38
|
+
{
|
|
39
|
+
"type": "Collapse",
|
|
40
|
+
"props": {
|
|
41
|
+
"in": true,
|
|
42
|
+
"orientation": "vertical",
|
|
43
|
+
"sx": { "border": "1px dashed", "borderColor": "divider", "p": 1 }
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
~~~
|
|
47
|
+
`,
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
controls: {
|
|
51
|
+
exclude: ['component', 'children', 'as', 'timeout', 'easing'],
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
argTypes: {
|
|
55
|
+
in: { control: 'boolean', description: 'Show/Hide content' },
|
|
56
|
+
orientation: { control: { type: 'radio' }, options: ['vertical', 'horizontal'] },
|
|
57
|
+
collapsedSize: { control: 'text', description: 'number or CSS size' },
|
|
58
|
+
unmountOnExit: { control: 'boolean' },
|
|
59
|
+
mountOnEnter: { control: 'boolean' },
|
|
60
|
+
appear: { control: 'boolean' },
|
|
61
|
+
sx: { control: 'object' },
|
|
62
|
+
},
|
|
63
|
+
args: {
|
|
64
|
+
in: true,
|
|
65
|
+
orientation: 'vertical',
|
|
66
|
+
collapsedSize: 0,
|
|
67
|
+
unmountOnExit: false,
|
|
68
|
+
mountOnEnter: false,
|
|
69
|
+
appear: false,
|
|
70
|
+
sx: {},
|
|
71
|
+
children: undefined,
|
|
72
|
+
},
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
export default meta;
|
|
76
|
+
|
|
77
|
+
type Story = StoryObj<typeof Collapse>;
|
|
78
|
+
|
|
79
|
+
const DemoBlock: React.FC<{ label?: string } & React.HTMLAttributes<HTMLDivElement>> = ({ label = 'Collapsible content', ...rest }) => (
|
|
80
|
+
<div
|
|
81
|
+
{...rest}
|
|
82
|
+
style={{
|
|
83
|
+
padding: 12,
|
|
84
|
+
border: '1px solid var(--mui-palette-divider)',
|
|
85
|
+
borderRadius: 8,
|
|
86
|
+
background: 'var(--mui-palette-background-paper)',
|
|
87
|
+
...rest.style,
|
|
88
|
+
}}
|
|
89
|
+
>
|
|
90
|
+
{label}
|
|
91
|
+
</div>
|
|
92
|
+
);
|
|
93
|
+
|
|
94
|
+
// ======================= Stories =======================
|
|
95
|
+
export const Playground: Story = {
|
|
96
|
+
render: (args) => <Collapse {...args}><DemoBlock /></Collapse>,
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
export const Horizontal: Story = {
|
|
100
|
+
args: { orientation: 'horizontal', in: true, collapsedSize: 0 },
|
|
101
|
+
render: (args) => (
|
|
102
|
+
<div style={{ display: 'flex', alignItems: 'center', gap: 8 }}>
|
|
103
|
+
<Collapse {...args}>
|
|
104
|
+
<DemoBlock label="Horizontal content" style={{ width: 240 }} />
|
|
105
|
+
</Collapse>
|
|
106
|
+
<span style={{ opacity: 0.7, fontSize: 12 }}>(Try toggling the \"in\" control)</span>
|
|
107
|
+
</div>
|
|
108
|
+
),
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
export const WithSx: Story = {
|
|
112
|
+
args: { sx: { border: '1px dashed', borderColor: 'divider', p: 1 } },
|
|
113
|
+
render: (args) => (
|
|
114
|
+
<Collapse {...args}>
|
|
115
|
+
<DemoBlock label="Styled via sx on Collapse" />
|
|
116
|
+
</Collapse>
|
|
117
|
+
),
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
export const UnmountOnExit: Story = {
|
|
121
|
+
args: { unmountOnExit: true, in: false },
|
|
122
|
+
render: (args) => (
|
|
123
|
+
<div>
|
|
124
|
+
<p style={{ margin: 0, opacity: 0.75 }}>Content is removed from the DOM when closed.</p>
|
|
125
|
+
<Collapse {...args}>
|
|
126
|
+
<DemoBlock label="Unmounts when closed" />
|
|
127
|
+
</Collapse>
|
|
128
|
+
</div>
|
|
129
|
+
),
|
|
130
|
+
};
|