this.gui 1.3.41 → 1.3.42
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +3 -2
- package/src/GUI.tsx +46 -0
- package/src/QRouter/QRegistry.tsx +53 -0
- package/src/QRouter/QRouter.stories.tsx +31 -0
- package/src/QRouter/QRouter.tsx +57 -0
- package/src/gui/Theme/GuiProvider.tsx +111 -0
- package/src/gui/Theme/Icon/Icon.resolver.tsx +29 -0
- package/src/gui/Theme/Icon/Icon.tsx +43 -0
- package/src/gui/Theme/Layout/Content/Content.resolver.tsx +0 -0
- package/src/gui/Theme/Layout/Content/Content.stories.tsx +88 -0
- package/src/gui/Theme/Layout/Content/Content.tsx +53 -0
- package/src/gui/Theme/Layout/Content/Content.types.tsx +40 -0
- package/src/gui/Theme/Layout/Footer/Footer.resolver.tsx +45 -0
- package/src/gui/Theme/Layout/Footer/Footer.stories.tsx +205 -0
- package/src/gui/Theme/Layout/Footer/Footer.tsx +337 -0
- package/src/gui/Theme/Layout/Footer/Footer.types.ts +40 -0
- package/src/gui/Theme/Layout/Layout/Layout.resolver.tsx +37 -0
- package/src/gui/Theme/Layout/Layout/Layout.stories.tsx +289 -0
- package/src/gui/Theme/Layout/Layout/Layout.tsx +117 -0
- package/src/gui/Theme/Layout/Layout/Layout.types.ts +57 -0
- package/src/gui/Theme/Layout/Layout/useLayoutBreakpoints.ts +9 -0
- package/src/gui/Theme/Layout/Namespace/Namespace.stories.tsx +105 -0
- package/src/gui/Theme/Layout/Namespace/Namespace.tsx +26 -0
- package/src/gui/Theme/Layout/Sidebars/LeftSidebar/LeftSidebar.resolver.tsx +87 -0
- package/src/gui/Theme/Layout/Sidebars/LeftSidebar/LeftSidebar.stories.tsx +199 -0
- package/src/gui/Theme/Layout/Sidebars/LeftSidebar/LeftSidebar.tsx +311 -0
- package/src/gui/Theme/Layout/Sidebars/LeftSidebar/LeftSidebar.types.ts +41 -0
- package/src/gui/Theme/Layout/Sidebars/LeftSidebar/SidebarToggleButton.tsx +53 -0
- package/src/gui/Theme/Layout/Sidebars/LeftSidebar/components/LeftSidebarAction/LeftSidebarAction.resolver.tsx +19 -0
- package/src/gui/Theme/Layout/Sidebars/LeftSidebar/components/LeftSidebarAction/LeftSidebarAction.tsx +107 -0
- package/src/gui/Theme/Layout/Sidebars/LeftSidebar/components/LeftSidebarLink/LeftSidebarLink.resolver.tsx +0 -0
- package/src/gui/Theme/Layout/Sidebars/LeftSidebar/components/LeftSidebarLink/LeftSidebarLink.tsx +134 -0
- package/src/gui/Theme/Layout/Sidebars/LeftSidebar/components/LeftSidebarLink/LeftSidebarLink.types.ts +15 -0
- package/src/gui/Theme/Layout/Sidebars/LeftSidebar/components/LeftSidebarMenu/LeftSidebarMenu.tsx +142 -0
- package/src/gui/Theme/Layout/Sidebars/LeftSidebar/components/LeftSidebarToggleButton/LeftSidebarToggleButton.tsx +23 -0
- package/src/gui/Theme/Layout/Sidebars/RightSidebar/RightSidebar.resolver.tsx +35 -0
- package/src/gui/Theme/Layout/Sidebars/RightSidebar/RightSidebar.stories.tsx +239 -0
- package/src/gui/Theme/Layout/Sidebars/RightSidebar/RightSidebar.tsx +319 -0
- package/src/gui/Theme/Layout/Sidebars/RightSidebar/RightSidebar.types.ts +17 -0
- package/src/gui/Theme/Layout/Sidebars/RightSidebar/components/RightSidebarAction/RightSidebarAction.tsx +102 -0
- package/src/gui/Theme/Layout/Sidebars/RightSidebar/components/RightSidebarLink/RightSidebarLink.tsx +132 -0
- package/src/gui/Theme/Layout/Sidebars/RightSidebar/components/RightSidebarMenu/RightSidebarMenu.tsx +140 -0
- package/src/gui/Theme/Layout/Sidebars/RightSidebar/components/RightSidebarToggleButton/RightSidebarToggleButton.tsx +22 -0
- package/src/gui/Theme/Layout/StickyOptions/StickyOptionsTop.stories.tsx +469 -0
- package/src/gui/Theme/Layout/StickyOptions/StickyOptionsTop.tsx +489 -0
- package/src/gui/Theme/Layout/TopBar/TopBar.resolver.tsx +86 -0
- package/src/gui/Theme/Layout/TopBar/TopBar.stories.tsx +350 -0
- package/src/gui/Theme/Layout/TopBar/TopBar.tsx +292 -0
- package/src/gui/Theme/Layout/TopBar/TopBar.types.ts +39 -0
- package/src/gui/Theme/Layout/TopBar/components/TopBarAction/TopBarAction.stories.tsx +83 -0
- package/src/gui/Theme/Layout/TopBar/components/TopBarAction/TopBarAction.tsx +18 -0
- package/src/gui/Theme/Layout/TopBar/components/TopBarAction/TopBarAction.types.ts +4 -0
- package/src/gui/Theme/Layout/TopBar/components/TopBarLink/TopBarLink.stories.tsx +189 -0
- package/src/gui/Theme/Layout/TopBar/components/TopBarLink/TopBarLink.tsx +30 -0
- package/src/gui/Theme/Layout/TopBar/components/TopBarLink/TopBarLink.types.ts +9 -0
- package/src/gui/Theme/Layout/TopBar/components/TopBarMenu/TopBarMenu.resolver.tsx +14 -0
- package/src/gui/Theme/Layout/TopBar/components/TopBarMenu/TopBarMenu.stories.tsx +56 -0
- package/src/gui/Theme/Layout/TopBar/components/TopBarMenu/TopBarMenu.tsx +123 -0
- package/src/gui/Theme/Layout/TopBar/components/TopBarMenu/TopBarMenu.types.ts +44 -0
- package/src/gui/Theme/catalog/CherryByte/CherryByte.png +0 -0
- package/src/gui/Theme/catalog/CherryByte/dark.tokens.ts +47 -0
- package/src/gui/Theme/catalog/CherryByte/light.tokens.ts +47 -0
- package/src/gui/Theme/catalog/CherryByte/manifest.ts +24 -0
- package/src/gui/Theme/catalog/GhostShell/dark.tokens.ts +43 -0
- package/src/gui/Theme/catalog/GhostShell/ghost.png +0 -0
- package/src/gui/Theme/catalog/GhostShell/light.tokens.ts +39 -0
- package/src/gui/Theme/catalog/GhostShell/manifest.ts +24 -0
- package/src/gui/Theme/catalog/LunaHex/LunaHex.png +0 -0
- package/src/gui/Theme/catalog/LunaHex/dark.tokens.ts +34 -0
- package/src/gui/Theme/catalog/LunaHex/light.tokens.ts +74 -0
- package/src/gui/Theme/catalog/LunaHex/manifest.ts +24 -0
- package/src/gui/Theme/catalog/MUI/MUI.png +0 -0
- package/src/gui/Theme/catalog/MUI/dark.tokens.ts +58 -0
- package/src/gui/Theme/catalog/MUI/light.tokens.ts +74 -0
- package/src/gui/Theme/catalog/MUI/manifest.ts +24 -0
- package/src/gui/Theme/catalog/PrinceOfDarkness/dark.tokens.ts +48 -0
- package/src/gui/Theme/catalog/PrinceOfDarkness/light.tokens.ts +47 -0
- package/src/gui/Theme/catalog/PrinceOfDarkness/manifest.ts +24 -0
- package/src/gui/Theme/catalog/PrinceOfDarkness/prince.png +0 -0
- package/src/gui/Theme/catalog/PrinceOfDarkness/princeOfDarkness.png +0 -0
- package/src/gui/Theme/catalog/Seafoam/dark.tokens.ts +49 -0
- package/src/gui/Theme/catalog/Seafoam/light.tokens.ts +47 -0
- package/src/gui/Theme/catalog/Seafoam/manifest.ts +24 -0
- package/src/gui/Theme/catalog/Seafoam/seaFoam.png +0 -0
- package/src/gui/Theme/catalog/neurons/dark.tokens.ts +58 -0
- package/src/gui/Theme/catalog/neurons/light.tokens.ts +74 -0
- package/src/gui/Theme/catalog/neurons/manifest.ts +24 -0
- package/src/gui/Theme/catalog/neurons/neurons.me.png +0 -0
- package/src/gui/Theme/fromTokens.ts +272 -0
- package/src/gui/Theme/gui.css +31 -0
- package/src/gui/Theme/index.ts +17 -0
- package/src/gui/Theme/styles/buildShadows.ts +83 -0
- package/src/gui/Theme/styles/theme.tokens.ts +108 -0
- package/src/gui/Theme/utils/catalog.ts +61 -0
- package/src/gui/Theme/utils/persistence.ts +66 -0
- package/src/gui/Theme/utils/themeUtils.ts +34 -0
- package/src/gui/components/atoms/AppBar/AppBar.resolver.tsx +46 -0
- package/src/gui/components/atoms/AppBar/AppBar.stories.tsx +251 -0
- package/src/gui/components/atoms/AppBar/AppBar.tsx +107 -0
- package/src/gui/components/atoms/AppBar/AppBar.types.ts +28 -0
- package/src/gui/components/atoms/Avatar/Avatar.resolver.tsx +61 -0
- package/src/gui/components/atoms/Avatar/Avatar.stories.tsx +36 -0
- package/src/gui/components/atoms/Avatar/Avatar.tsx +14 -0
- package/src/gui/components/atoms/Box/Box.resolver.tsx +171 -0
- package/src/gui/components/atoms/Box/Box.stories.tsx +263 -0
- package/src/gui/components/atoms/Box/Box.tsx +15 -0
- package/src/gui/components/atoms/Button/Button.resolver.tsx +103 -0
- package/src/gui/components/atoms/Button/Button.stories.tsx +219 -0
- package/src/gui/components/atoms/Button/Button.tsx +40 -0
- package/src/gui/components/atoms/Card/Card.resolver.tsx +63 -0
- package/src/gui/components/atoms/Card/Card.stories.tsx +54 -0
- package/src/gui/components/atoms/Card/Card.tsx +13 -0
- package/src/gui/components/atoms/CardActions/CardActions.resolver.tsx +59 -0
- package/src/gui/components/atoms/CardActions/CardActions.stories.tsx +32 -0
- package/src/gui/components/atoms/CardActions/CardActions.tsx +14 -0
- package/src/gui/components/atoms/CardContent/CardContent.resolver.tsx +60 -0
- package/src/gui/components/atoms/CardContent/CardContent.stories.tsx +34 -0
- package/src/gui/components/atoms/CardContent/CardContent.tsx +13 -0
- package/src/gui/components/atoms/CardHeader/CardHeader.resolver.tsx +68 -0
- package/src/gui/components/atoms/CardHeader/CardHeader.stories.tsx +40 -0
- package/src/gui/components/atoms/CardHeader/CardHeader.tsx +12 -0
- package/src/gui/components/atoms/Collapse/Collapse.resolver.tsx +85 -0
- package/src/gui/components/atoms/Collapse/Collapse.stories.tsx +130 -0
- package/src/gui/components/atoms/Collapse/Collapse.tsx +17 -0
- package/src/gui/components/atoms/Divider/Divider.resolver.tsx +95 -0
- package/src/gui/components/atoms/Divider/Divider.stories.tsx +108 -0
- package/src/gui/components/atoms/Divider/Divider.tsx +14 -0
- package/src/gui/components/atoms/Drawer/Drawer.resolver.tsx +116 -0
- package/src/gui/components/atoms/Drawer/Drawer.stories.tsx +223 -0
- package/src/gui/components/atoms/Drawer/Drawer.tsx +25 -0
- package/src/gui/components/atoms/Grid/Grid.resolver.tsx +33 -0
- package/src/gui/components/atoms/Grid/Grid.stories.tsx +136 -0
- package/src/gui/components/atoms/Grid/Grid.tsx +15 -0
- package/src/gui/components/atoms/Grid/Grid.types.ts +9 -0
- package/src/gui/components/atoms/IconButton/IconButton.resolver.tsx +137 -0
- package/src/gui/components/atoms/IconButton/IconButton.stories.tsx +134 -0
- package/src/gui/components/atoms/IconButton/IconButton.tsx +22 -0
- package/src/gui/components/atoms/Link/Link.resolver.tsx +74 -0
- package/src/gui/components/atoms/Link/Link.stories.tsx +157 -0
- package/src/gui/components/atoms/Link/Link.tsx +36 -0
- package/src/gui/components/atoms/List/List.resolver.tsx +94 -0
- package/src/gui/components/atoms/List/List.stories.tsx +137 -0
- package/src/gui/components/atoms/List/List.tsx +20 -0
- package/src/gui/components/atoms/ListItem/ListItem.resolver.tsx +88 -0
- package/src/gui/components/atoms/ListItem/ListItem.stories.tsx +151 -0
- package/src/gui/components/atoms/ListItem/ListItem.tsx +19 -0
- package/src/gui/components/atoms/ListItemButton/ListItemButton.resolver.tsx +214 -0
- package/src/gui/components/atoms/ListItemButton/ListItemButton.stories.tsx +155 -0
- package/src/gui/components/atoms/ListItemButton/ListItemButton.tsx +15 -0
- package/src/gui/components/atoms/ListItemIcon/ListItemIcon.resolver.tsx +102 -0
- package/src/gui/components/atoms/ListItemIcon/ListItemIcon.stories.tsx +132 -0
- package/src/gui/components/atoms/ListItemIcon/ListItemIcon.tsx +11 -0
- package/src/gui/components/atoms/ListItemText/ListItemText.resolver.tsx +112 -0
- package/src/gui/components/atoms/ListItemText/ListItemText.stories.tsx +156 -0
- package/src/gui/components/atoms/ListItemText/ListItemText.tsx +15 -0
- package/src/gui/components/atoms/Menu/Menu.resolver.tsx +112 -0
- package/src/gui/components/atoms/Menu/Menu.stories.tsx +162 -0
- package/src/gui/components/atoms/Menu/Menu.tsx +17 -0
- package/src/gui/components/atoms/MenuItem/MenuItem.resolver.tsx +183 -0
- package/src/gui/components/atoms/MenuItem/MenuItem.stories.tsx +134 -0
- package/src/gui/components/atoms/MenuItem/MenuItem.tsx +14 -0
- package/src/gui/components/atoms/Paper/Paper.resolver.tsx +98 -0
- package/src/gui/components/atoms/Paper/Paper.stories.tsx +184 -0
- package/src/gui/components/atoms/Paper/Paper.tsx +15 -0
- package/src/gui/components/atoms/Section/Section.resolver.tsx +10 -0
- package/src/gui/components/atoms/Section/Section.stories.tsx +189 -0
- package/src/gui/components/atoms/Section/Section.tsx +76 -0
- package/src/gui/components/atoms/Section/Section.types.tsx +24 -0
- package/src/gui/components/atoms/Stack/Stack.resolver.tsx +94 -0
- package/src/gui/components/atoms/Stack/Stack.stories.tsx +160 -0
- package/src/gui/components/atoms/Stack/Stack.tsx +15 -0
- package/src/gui/components/atoms/Surface/Surface.resolver.tsx +37 -0
- package/src/gui/components/atoms/Surface/Surface.tsx +49 -0
- package/src/gui/components/atoms/Surface/Surface.types.ts +20 -0
- package/src/gui/components/atoms/Switch/Switch.resolver.tsx +53 -0
- package/src/gui/components/atoms/Switch/Switch.stories.tsx +236 -0
- package/src/gui/components/atoms/Switch/Switch.tsx +22 -0
- package/src/gui/components/atoms/Table/Body/TableBody.tsx +7 -0
- package/src/gui/components/atoms/Table/Cell/TableCell.tsx +18 -0
- package/src/gui/components/atoms/Table/Head/TableHead.tsx +9 -0
- package/src/gui/components/atoms/Table/Row/TableRow.tsx +20 -0
- package/src/gui/components/atoms/Table/Table.resolver.tsx +77 -0
- package/src/gui/components/atoms/Table/Table.stories.tsx +173 -0
- package/src/gui/components/atoms/Table/Table.tsx +20 -0
- package/src/gui/components/atoms/TextField/TextField.stories.tsx +25 -0
- package/src/gui/components/atoms/TextField/TextField.tsx +15 -0
- package/src/gui/components/atoms/Toolbar/Toolbar.resolver.tsx +60 -0
- package/src/gui/components/atoms/Toolbar/Toolbar.stories.tsx +155 -0
- package/src/gui/components/atoms/Toolbar/Toolbar.tsx +16 -0
- package/src/gui/components/atoms/Tooltip/Tooltip.resolver.tsx +142 -0
- package/src/gui/components/atoms/Tooltip/Tooltip.stories.tsx +117 -0
- package/src/gui/components/atoms/Tooltip/Tooltip.tsx +70 -0
- package/src/gui/components/atoms/Typography/Typography.resolver.tsx +158 -0
- package/src/gui/components/atoms/Typography/Typography.stories.tsx +222 -0
- package/src/gui/components/atoms/Typography/Typography.tsx +27 -0
- package/src/gui/components/atoms/Window/Nodes/node.ts +0 -0
- package/src/gui/components/atoms/Window/code/block/node.tsx +0 -0
- package/src/gui/components/atoms/Window/code/hugging.face.api.ts +11 -0
- package/src/gui/components/atoms/Window/connectors/index.ts +19 -0
- package/src/gui/components/atoms/Window/window.stories.tsx +20 -0
- package/src/gui/components/atoms/Window/window.tsx +636 -0
- package/src/gui/components/atoms/atoms.tsx +151 -0
- package/src/gui/components/atoms/index.ts +2 -0
- package/src/gui/components/generics/Cards/Gridme.jsx +52 -0
- package/src/gui/components/generics/Cards/LilBox.jsx +65 -0
- package/src/gui/components/generics/Cards/ModuleCard.jsx +106 -0
- package/src/gui/components/generics/Chats/FullChatBot.jsx +223 -0
- package/src/gui/components/generics/Code/CodeBlock.jsx +33 -0
- package/src/gui/components/generics/EmojiCursor/EmojiCursor.stories.tsx +153 -0
- package/src/gui/components/generics/EmojiCursor/EmojiCursor.tsx +23 -0
- package/src/gui/components/generics/Feedback/Callout.jsx +92 -0
- package/src/gui/components/generics/Layout/GridX.jsx +29 -0
- package/src/gui/components/generics/Layout/Hero2.jsx +132 -0
- package/src/gui/components/generics/Layout/PageContainer.jsx +29 -0
- package/src/gui/components/generics/Layout/PageDivider.jsx +20 -0
- package/src/gui/components/generics/Layout/Section.jsx +43 -0
- package/src/gui/components/generics/Layout/SectionHeader.jsx +21 -0
- package/src/gui/components/generics/Media/Img.jsx +58 -0
- package/src/gui/components/generics/Media/VideoEmbed.jsx +51 -0
- package/src/gui/components/generics/Organization/TableOfContents.jsx +51 -0
- package/src/gui/components/generics/Organization/Tabs.jsx +45 -0
- package/src/gui/components/generics/Text/TextList.jsx +41 -0
- package/src/gui/components/generics/Text/TextParagraph.jsx +28 -0
- package/src/gui/components/generics/Text/TextQuote.jsx +23 -0
- package/src/gui/components/generics/Text/TextTitle.jsx +44 -0
- package/src/gui/components/molecules/Dialog/Dialog.stories.tsx +18 -0
- package/src/gui/components/molecules/Dialog/Dialog.tsx +5 -0
- package/src/gui/components/molecules/Hero/Hero.stories.tsx +140 -0
- package/src/gui/components/molecules/Hero/Hero.tsx +152 -0
- package/src/gui/components/molecules/Hero/Hero.types.tsx +18 -0
- package/src/gui/components/molecules/Modal/Modal.resolver.tsx +38 -0
- package/src/gui/components/molecules/Modal/Modal.stories.tsx +82 -0
- package/src/gui/components/molecules/Modal/Modal.tsx +110 -0
- package/src/gui/components/molecules/Modal/Modal.types.ts +29 -0
- package/src/gui/components/molecules/Page/Page.stories.tsx +135 -0
- package/src/gui/components/molecules/Page/Page.tsx +94 -0
- package/src/gui/components/molecules/Theme/ThemeModeToggle/ThemeModeToggle.resolver.tsx +58 -0
- package/src/gui/components/molecules/Theme/ThemeModeToggle/ThemeModeToggle.stories.tsx +133 -0
- package/src/gui/components/molecules/Theme/ThemeModeToggle/ThemeModeToggle.tsx +101 -0
- package/src/gui/components/molecules/Theme/ThemeModeToggle/ThemeModeToggle.types.ts +29 -0
- package/src/gui/components/molecules/Theme/ThemesCatalog/ThemesCatalog.resolver.tsx +15 -0
- package/src/gui/components/molecules/Theme/ThemesCatalog/ThemesCatalog.stories.tsx +88 -0
- package/src/gui/components/molecules/Theme/ThemesCatalog/ThemesCatalog.tsx +167 -0
- package/src/gui/components/molecules/Theme/ThemesCatalog/ThemesCatalog.types.ts +34 -0
- package/src/gui/components/molecules/molecules.ts +49 -0
- package/src/gui/components/organisms/Blockchain/Blocks/BlocksTable.tsx +119 -0
- package/src/gui/components/organisms/Blockchain/Usernames/Identities.stories.tsx +20 -0
- package/src/gui/components/organisms/Blockchain/Usernames/QR.tsx +566 -0
- package/src/gui/components/organisms/Blockchain/Usernames/Usernames.tsx +448 -0
- package/src/gui/components/organisms/Blockchain/Usernames/identities.tsx +710 -0
- package/src/gui/components/organisms/Blockchain/blockchain.stories.tsx +17 -0
- package/src/gui/components/organisms/Blockchain/blockchain.tsx +368 -0
- package/src/gui/components/organisms/Blockchain/scripts/connection.ts +82 -0
- package/src/gui/components/organisms/Blockchain/scripts/match_face.ts +143 -0
- package/src/gui/components/organisms/HighLighter/HighLighter.stories.tsx +168 -0
- package/src/gui/components/organisms/HighLighter/HighLighter.tsx +420 -0
- package/src/gui/components/organisms/HighLighter/HighLightsDrawer.tsx +197 -0
- package/src/gui/components/organisms/IdentityNoise/FaceRecognition/FaceRecognition.stories.tsx +312 -0
- package/src/gui/components/organisms/IdentityNoise/FaceRecognition/FaceRecognition.tsx +765 -0
- package/src/gui/components/organisms/IdentityNoise/FaceRecognition/modules/useFaceCameraPermission.ts +70 -0
- package/src/gui/components/organisms/IdentityNoise/FaceRecognition/modules/useFaceLandmarker.ts +106 -0
- package/src/gui/components/organisms/IdentityNoise/FaceRecognition/modules/useFaceOverlay.ts +489 -0
- package/src/gui/components/organisms/IdentityNoise/FaceRecognition/modules/useFaceTemplate.ts +32 -0
- package/src/gui/components/organisms/IdentityNoise/FaceRecognition/modules/useFaceTemplateBurst.ts +178 -0
- package/src/gui/components/organisms/IdentityNoise/FaceRecognition/modules/verifyTemplate.ts +136 -0
- package/src/gui/components/organisms/IdentityNoise/IdentityNoise.tsx +403 -0
- package/src/gui/components/organisms/IdentityNoise/IndentityNoise.stories.tsx +15 -0
- package/src/gui/components/organisms/IdentityNoise/Noise/Noise.stories.tsx +206 -0
- package/src/gui/components/organisms/IdentityNoise/Noise/Noise.tsx +394 -0
- package/src/gui/components/organisms/IdentityNoise/Triad/QR.tsx +566 -0
- package/src/gui/components/organisms/IdentityNoise/Triad/Tiad.stories.tsx +6 -0
- package/src/gui/components/organisms/IdentityNoise/Triad/Triad.tsx +917 -0
- package/src/gui/components/organisms/IdentityNoise/Triad/handleCleak.ts +0 -0
- package/src/gui/components/organisms/IdentityNoise/Triad/identity.ts +31 -0
- package/src/gui/components/organisms/IdentityNoise/Triad/me/fundamentals/vectors/vectors.tsx +252 -0
- package/src/gui/components/organisms/IdentityNoise/Triad/me/me.stories.tsx +314 -0
- package/src/gui/components/organisms/IdentityNoise/Triad/me/me.tsx +0 -0
- package/src/gui/components/organisms/organisms.ts +15 -0
- package/src/gui/contexts/InsetsContext.tsx +40 -0
- package/src/gui/contexts/LeftSidebarContext.tsx +20 -0
- package/src/gui/contexts/RightSidebarContext.tsx +25 -0
- package/src/gui/contexts/ThemeContext.ts +34 -0
- package/src/gui/contexts/index.ts +4 -0
- package/src/gui/hooks/index.ts +11 -0
- package/src/gui/hooks/resolveColorToken.ts +39 -0
- package/src/gui/hooks/useCodeGen.ts +12 -0
- package/src/gui/hooks/useGuiMediaQuery.ts +18 -0
- package/src/gui/hooks/useGuiTheme.ts +18 -0
- package/src/gui/hooks/useInsets.ts +26 -0
- package/src/gui/hooks/useIsMobile.ts +13 -0
- package/src/gui/hooks/useIsTouchDevice.ts +25 -0
- package/src/gui/hooks/useLeftSidebar.ts +10 -0
- package/src/gui/hooks/useRightSidebar.ts +12 -0
- package/src/gui/hooks/useViewportKey.ts +19 -0
- package/src/gui/hooks/useViewportProp.ts +17 -0
- package/src/gui/registry/GuiRegistry.ts +19 -0
- package/src/gui/registry/factory.ts +12 -0
- package/src/gui/registry/index.ts +3 -0
- package/src/gui/registry/types.ts +6 -0
- package/src/gui/utils/nodeID.ts +11 -0
- package/src/registry/GuiRegistry.ts +19 -0
- package/src/stories/01.Home.mdx +22 -0
- package/src/stories/02.Understanding.This.GUI.mdx +149 -0
- package/src/stories/Theme/Palette.stories.tsx +86 -0
- package/src/stories/Theme/ThemeViewer.stories.tsx +91 -0
- package/src/stories/Theme/Typography.stories.jsx +211 -0
- package/src/stories/assets/this.GUI.png +0 -0
- package/src/types/gui.d.ts +67 -0
- package/src/types/theme.d.ts +191 -0
- package/src/types/viewport.ts +132 -0
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import IconButton from './IconButton';
|
|
3
|
+
import Icon from '@/gui/Theme/Icon/Icon';
|
|
4
|
+
const meta: Meta<typeof IconButton> = {
|
|
5
|
+
title: 'Atoms/Forms & Inputs/IconButton',
|
|
6
|
+
component: IconButton,
|
|
7
|
+
tags: ['autodocs'],
|
|
8
|
+
decorators: [
|
|
9
|
+
(Story) => (
|
|
10
|
+
<div style={{ padding: 16, minHeight: 200 }}>
|
|
11
|
+
<Story />
|
|
12
|
+
</div>
|
|
13
|
+
),
|
|
14
|
+
],
|
|
15
|
+
parameters: {
|
|
16
|
+
docs: {
|
|
17
|
+
description: {
|
|
18
|
+
component: `
|
|
19
|
+
The **IconButton** atom is a thin wrapper around MUI's \`MuiIconButton\`, staying faithful to its API and polymorphism (\`component\`).
|
|
20
|
+
|
|
21
|
+
In **declarative** mode (resolver), you can pass an \`icon\` token (e.g., \`"lucide:menu"\`, \`"mui:Close"\`) and it will render through the Icon registry. You can also style the icon with \`iconSx\` while using \`sx\` for the button root.
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
## React usage
|
|
25
|
+
~~~jsx
|
|
26
|
+
<IconButton color="primary" size="medium" aria-label="open menu">
|
|
27
|
+
<Icon name="lucide:menu" />
|
|
28
|
+
</IconButton>
|
|
29
|
+
~~~
|
|
30
|
+
|
|
31
|
+
## Declarative JSON / Resolver
|
|
32
|
+
~~~json
|
|
33
|
+
{
|
|
34
|
+
"type": "IconButton",
|
|
35
|
+
"props": {
|
|
36
|
+
"color": "primary",
|
|
37
|
+
"size": "medium",
|
|
38
|
+
"icon": "lucide:menu",
|
|
39
|
+
"sx": { "border": "1px solid", "borderColor": "divider" },
|
|
40
|
+
"iconSx": { "opacity": 0.9 }
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
~~~
|
|
44
|
+
`,
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
controls: {
|
|
48
|
+
exclude: ['component', 'children'],
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
argTypes: {
|
|
52
|
+
color: {
|
|
53
|
+
control: { type: 'select' },
|
|
54
|
+
options: ['inherit', 'default', 'primary', 'secondary', 'success', 'error', 'info', 'warning'],
|
|
55
|
+
},
|
|
56
|
+
size: {
|
|
57
|
+
control: { type: 'radio' },
|
|
58
|
+
options: ['small', 'medium', 'large'],
|
|
59
|
+
},
|
|
60
|
+
edge: {
|
|
61
|
+
control: { type: 'radio' },
|
|
62
|
+
options: ['start', 'end', false],
|
|
63
|
+
},
|
|
64
|
+
disabled: { control: 'boolean' },
|
|
65
|
+
sx: { control: 'object' },
|
|
66
|
+
},
|
|
67
|
+
args: {
|
|
68
|
+
color: 'default',
|
|
69
|
+
size: 'medium',
|
|
70
|
+
edge: false,
|
|
71
|
+
disabled: false,
|
|
72
|
+
sx: {},
|
|
73
|
+
children: undefined,
|
|
74
|
+
},
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
export default meta;
|
|
78
|
+
type Story = StoryObj<typeof IconButton>;
|
|
79
|
+
export const Playground: Story = {
|
|
80
|
+
render: (args) => (
|
|
81
|
+
<IconButton {...args} aria-label="menu">
|
|
82
|
+
<Icon name="lucide:menu" />
|
|
83
|
+
</IconButton>
|
|
84
|
+
),
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
export const Colors: Story = {
|
|
88
|
+
render: () => (
|
|
89
|
+
<div style={{ display: 'flex', gap: 12, alignItems: 'center', flexWrap: 'wrap' }}>
|
|
90
|
+
{(['default', 'primary', 'secondary', 'success', 'info', 'warning', 'error'] as const).map((c) => (
|
|
91
|
+
<IconButton key={c} color={c} aria-label={c}>
|
|
92
|
+
<Icon name="mui:Favorite" />
|
|
93
|
+
</IconButton>
|
|
94
|
+
))}
|
|
95
|
+
</div>
|
|
96
|
+
),
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
export const Sizes: Story = {
|
|
100
|
+
render: () => (
|
|
101
|
+
<div style={{ display: 'flex', gap: 12, alignItems: 'center' }}>
|
|
102
|
+
<IconButton size="small" aria-label="small">
|
|
103
|
+
<Icon name="lucide:bell" />
|
|
104
|
+
</IconButton>
|
|
105
|
+
<IconButton size="medium" aria-label="medium">
|
|
106
|
+
<Icon name="lucide:bell" />
|
|
107
|
+
</IconButton>
|
|
108
|
+
<IconButton size="large" aria-label="large">
|
|
109
|
+
<Icon name="lucide:bell" />
|
|
110
|
+
</IconButton>
|
|
111
|
+
</div>
|
|
112
|
+
),
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
export const WithEdge: Story = {
|
|
116
|
+
render: () => (
|
|
117
|
+
<div style={{ display: 'flex', gap: 12, alignItems: 'center' }}>
|
|
118
|
+
<IconButton edge="start" aria-label="start">
|
|
119
|
+
<Icon name="lucide:chevron-left" />
|
|
120
|
+
</IconButton>
|
|
121
|
+
<IconButton edge="end" aria-label="end">
|
|
122
|
+
<Icon name="lucide:chevron-right" />
|
|
123
|
+
</IconButton>
|
|
124
|
+
</div>
|
|
125
|
+
),
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
export const WithSx: Story = {
|
|
129
|
+
render: () => (
|
|
130
|
+
<IconButton sx={{ border: '1px solid', borderColor: 'divider' }} aria-label="styled">
|
|
131
|
+
<Icon name="mui:Close" />
|
|
132
|
+
</IconButton>
|
|
133
|
+
),
|
|
134
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This.GUI — IconButton
|
|
3
|
+
* ----------------------------------------
|
|
4
|
+
* Thin wrapper around MUI’s IconButton.
|
|
5
|
+
*
|
|
6
|
+
* Fidelity:
|
|
7
|
+
* - Directly re-exports MUI’s IconButton so all typing and props remain intact.
|
|
8
|
+
* - Preserves polymorphism (`component` prop) via OverridableComponent.
|
|
9
|
+
* - Supports granular styling via the standard `sx` prop (MUI System).
|
|
10
|
+
*
|
|
11
|
+
* Why wrap?
|
|
12
|
+
* - Consistency with This.GUI’s atom pattern (every MUI primitive wrapped).
|
|
13
|
+
* - Provides a clean declarative/resolver entry point.
|
|
14
|
+
*/
|
|
15
|
+
import * as React from 'react';
|
|
16
|
+
import MuiIconButton from '@mui/material/IconButton';
|
|
17
|
+
import type { OverridableComponent } from '@mui/material/OverridableComponent';
|
|
18
|
+
import type { IconButtonTypeMap } from '@mui/material/IconButton';
|
|
19
|
+
const IconButton = MuiIconButton as OverridableComponent<IconButtonTypeMap<{}, 'button'>>;
|
|
20
|
+
export type IconButtonProps = React.ComponentProps<typeof IconButton>;
|
|
21
|
+
(IconButton as any).displayName = 'Gui.IconButton';
|
|
22
|
+
export default IconButton;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
// src/gui/atoms/Link/Link.resolver.tsx
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import type { RegistryEntry } from '@/gui/registry/types';
|
|
4
|
+
import Link, { LinkProps as GuiLinkProps } from './Link';
|
|
5
|
+
import type { SxProps, Theme } from '@mui/material/styles';
|
|
6
|
+
import { ensureNodeId } from '@/gui/utils/nodeID';
|
|
7
|
+
import { useInRouterContext } from 'react-router-dom';
|
|
8
|
+
|
|
9
|
+
/** Declarative spec for Link (JSON-friendly) */
|
|
10
|
+
type LinkSpec = {
|
|
11
|
+
type: 'Link';
|
|
12
|
+
props?: {
|
|
13
|
+
label?: React.ReactNode; // convenience: text content
|
|
14
|
+
children?: React.ReactNode; // explicit children (wins over label)
|
|
15
|
+
href?: string; // external
|
|
16
|
+
to?: string; // internal (react-router)
|
|
17
|
+
external?: boolean; // force anchor + target/rel
|
|
18
|
+
underline?: 'none' | 'hover' | 'always';
|
|
19
|
+
// pass-through styling/attrs
|
|
20
|
+
sx?: SxProps<Theme>;
|
|
21
|
+
className?: string;
|
|
22
|
+
id?: string;
|
|
23
|
+
target?: string;
|
|
24
|
+
rel?: string;
|
|
25
|
+
color?: GuiLinkProps['color'];
|
|
26
|
+
variant?: GuiLinkProps['variant'];
|
|
27
|
+
// ...cualquier otro prop permitido por tu Link
|
|
28
|
+
'data-testid'?: string;
|
|
29
|
+
ariaLabel?: string;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
const LinkResolver: RegistryEntry = {
|
|
34
|
+
type: 'Link',
|
|
35
|
+
resolve(spec: LinkSpec) {
|
|
36
|
+
const p = spec.props ?? {};
|
|
37
|
+
const nodeId = ensureNodeId('link', p.id as string | undefined);
|
|
38
|
+
const hasRouter = useInRouterContext();
|
|
39
|
+
|
|
40
|
+
// Routing / destino
|
|
41
|
+
const routingProps: Partial<GuiLinkProps> =
|
|
42
|
+
p.external
|
|
43
|
+
? {
|
|
44
|
+
href: p.href,
|
|
45
|
+
...(p.target ? { target: p.target } : { target: '_blank' }),
|
|
46
|
+
...(p.rel ? { rel: p.rel } : { rel: 'noopener noreferrer' }),
|
|
47
|
+
}
|
|
48
|
+
: p.to && hasRouter
|
|
49
|
+
? { to: p.to }
|
|
50
|
+
: p.href
|
|
51
|
+
? { href: p.href }
|
|
52
|
+
: {};
|
|
53
|
+
|
|
54
|
+
const children = p.children ?? p.label ?? null;
|
|
55
|
+
|
|
56
|
+
return (
|
|
57
|
+
<Link
|
|
58
|
+
underline={p.underline ?? 'hover'}
|
|
59
|
+
color={p.color}
|
|
60
|
+
variant={p.variant}
|
|
61
|
+
sx={p.sx}
|
|
62
|
+
className={p.className}
|
|
63
|
+
id={nodeId}
|
|
64
|
+
data-testid={p['data-testid']}
|
|
65
|
+
{...(p.ariaLabel ? { 'aria-label': p.ariaLabel } : {})}
|
|
66
|
+
{...routingProps}
|
|
67
|
+
>
|
|
68
|
+
{children}
|
|
69
|
+
</Link>
|
|
70
|
+
);
|
|
71
|
+
},
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
export default LinkResolver;
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { Link, Button } from '@/gui/components/atoms';
|
|
3
|
+
// ======================= Meta =======================
|
|
4
|
+
const meta: Meta<typeof Link> = {
|
|
5
|
+
title: 'Atoms/Navigation/Link',
|
|
6
|
+
component: Link,
|
|
7
|
+
tags: ['autodocs'],
|
|
8
|
+
decorators: [
|
|
9
|
+
(Story) => (
|
|
10
|
+
<div style={{ padding: 16, minHeight: 240 }}>
|
|
11
|
+
<Story />
|
|
12
|
+
</div>
|
|
13
|
+
),
|
|
14
|
+
],
|
|
15
|
+
parameters: {
|
|
16
|
+
docs: {
|
|
17
|
+
description: {
|
|
18
|
+
component: `
|
|
19
|
+
The **Link** primitive is a thin wrapper over MUI's \`MuiLink\` that supports **both** external links (\`href\`) and internal routing (\`to\`) using **react-router-dom**. It integrates with **This.GUI** theming via \`GuiProvider\`.
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
## Features
|
|
23
|
+
- External links with \`href\` (renders an anchor).
|
|
24
|
+
- Internal navigation with \`to\` (renders a RouterLink under the hood).
|
|
25
|
+
- Works seamlessly as a child or as a render target for other primitives (e.g. \`<Button component={Link} to="/docs"/>\`).
|
|
26
|
+
- Inherits typography and color from the theme tokens.
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
## Key Props
|
|
30
|
+
- \`href?: string\` — external URL.
|
|
31
|
+
- \`to?: string | LocationDescriptor\` — internal route (react-router-dom).
|
|
32
|
+
- \`underline?: 'none' | 'hover' | 'always'\` — underline behavior.
|
|
33
|
+
- \`color?: 'primary' | 'secondary' | 'inherit' | 'textPrimary' | 'textSecondary' | 'error' | 'info' | 'success' | 'warning'\`.
|
|
34
|
+
|
|
35
|
+
> Note: \`to\` and \`href\` are demonstrated in dedicated stories rather than Storybook controls.
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
## Basic Usage
|
|
39
|
+
~~~jsx
|
|
40
|
+
import { Link } from '@/gui/primitives';
|
|
41
|
+
|
|
42
|
+
<Link href="https://neurons.me" target="_blank" rel="noreferrer">Visit neurons.me</Link>
|
|
43
|
+
~~~
|
|
44
|
+
|
|
45
|
+
## Internal Routing
|
|
46
|
+
~~~jsx
|
|
47
|
+
import { Link } from '@/gui/primitives';
|
|
48
|
+
|
|
49
|
+
<Link to="/docs">Go to docs</Link>
|
|
50
|
+
~~~
|
|
51
|
+
|
|
52
|
+
## As render target for Button
|
|
53
|
+
~~~jsx
|
|
54
|
+
import { Button, Link } from '@/gui/primitives';
|
|
55
|
+
|
|
56
|
+
<Button component={Link} to="/docs">Docs</Button>
|
|
57
|
+
~~~
|
|
58
|
+
|
|
59
|
+
## Declarative JSON / Config usage
|
|
60
|
+
~~~json
|
|
61
|
+
{
|
|
62
|
+
"type": "Link",
|
|
63
|
+
"props": {
|
|
64
|
+
"to": "/docs",
|
|
65
|
+
"children": "Go to docs"
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
~~~
|
|
69
|
+
|
|
70
|
+
Another example with an external URL:
|
|
71
|
+
~~~json
|
|
72
|
+
{
|
|
73
|
+
"type": "Link",
|
|
74
|
+
"props": {
|
|
75
|
+
"href": "https://neurons.me",
|
|
76
|
+
"target": "_blank",
|
|
77
|
+
"rel": "noreferrer",
|
|
78
|
+
"children": "Visit neurons.me"
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
~~~
|
|
82
|
+
`,
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
argTypes: {
|
|
87
|
+
underline: {
|
|
88
|
+
control: { type: 'radio' },
|
|
89
|
+
options: ['none', 'hover', 'always'],
|
|
90
|
+
},
|
|
91
|
+
color: {
|
|
92
|
+
control: { type: 'select' },
|
|
93
|
+
options: ['primary', 'secondary', 'inherit', 'textPrimary', 'textSecondary', 'error', 'info', 'success', 'warning'],
|
|
94
|
+
},
|
|
95
|
+
// Do not expose component/to/href as controls — they are shown in dedicated stories
|
|
96
|
+
component: { table: { disable: true } },
|
|
97
|
+
},
|
|
98
|
+
args: {
|
|
99
|
+
underline: 'hover',
|
|
100
|
+
color: 'primary',
|
|
101
|
+
children: 'Example link',
|
|
102
|
+
},
|
|
103
|
+
};
|
|
104
|
+
export default meta;
|
|
105
|
+
|
|
106
|
+
type Story = StoryObj<typeof Link>;
|
|
107
|
+
|
|
108
|
+
// ======================= Stories =======================
|
|
109
|
+
export const Playground: Story = {};
|
|
110
|
+
|
|
111
|
+
export const ExternalHref: Story = {
|
|
112
|
+
name: 'External (href)',
|
|
113
|
+
render: () => (
|
|
114
|
+
<Link href="https://neurons.me" target="_blank" rel="noreferrer">
|
|
115
|
+
Visit neurons.me
|
|
116
|
+
</Link>
|
|
117
|
+
),
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
export const InternalTo: Story = {
|
|
121
|
+
name: 'Internal (to)',
|
|
122
|
+
render: () => <Link to="/docs">Go to docs</Link>,
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
export const Colors: Story = {
|
|
126
|
+
render: (args) => {
|
|
127
|
+
const colors: Array<any> = ['primary', 'secondary', 'success', 'info', 'warning', 'error'];
|
|
128
|
+
return (
|
|
129
|
+
<div style={{ display: 'flex', gap: 12, flexWrap: 'wrap' }}>
|
|
130
|
+
{colors.map((c) => (
|
|
131
|
+
<Link key={c} {...args} color={c} href="#">
|
|
132
|
+
{c[0].toUpperCase() + c.slice(1)}
|
|
133
|
+
</Link>
|
|
134
|
+
))}
|
|
135
|
+
</div>
|
|
136
|
+
);
|
|
137
|
+
},
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
export const UnderlineVariants: Story = {
|
|
141
|
+
render: (args) => (
|
|
142
|
+
<div style={{ display: 'flex', gap: 12, flexWrap: 'wrap' }}>
|
|
143
|
+
<Link {...args} underline="none" href="#">None</Link>
|
|
144
|
+
<Link {...args} underline="hover" href="#">Hover</Link>
|
|
145
|
+
<Link {...args} underline="always" href="#">Always</Link>
|
|
146
|
+
</div>
|
|
147
|
+
),
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
export const AsButtonTarget: Story = {
|
|
151
|
+
name: 'As Button component',
|
|
152
|
+
render: () => (
|
|
153
|
+
<Button component={Link} to="/docs">
|
|
154
|
+
Docs via Link
|
|
155
|
+
</Button>
|
|
156
|
+
),
|
|
157
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import React, { forwardRef, Suspense } from 'react';
|
|
2
|
+
import { Link as MuiLink, LinkProps as MuiLinkProps } from '@mui/material';
|
|
3
|
+
import { useInRouterContext } from 'react-router-dom';
|
|
4
|
+
import type { LinkProps as RouterLinkProps } from 'react-router-dom';
|
|
5
|
+
|
|
6
|
+
type GuiLinkProps = MuiLinkProps & { to?: RouterLinkProps['to'] };
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Safe Link wrapper for MUI + React Router
|
|
10
|
+
*/
|
|
11
|
+
const Link = forwardRef<HTMLAnchorElement, GuiLinkProps>(function Link(props, ref) {
|
|
12
|
+
const { to, ...rest } = props;
|
|
13
|
+
const inRouterContext = useInRouterContext();
|
|
14
|
+
|
|
15
|
+
if (!to) return <MuiLink ref={ref} {...rest} />;
|
|
16
|
+
|
|
17
|
+
if (!inRouterContext) {
|
|
18
|
+
const href = typeof to === 'string' ? to : undefined;
|
|
19
|
+
return <MuiLink href={href} ref={ref} {...rest} />;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// ✅ Lazy load RouterLink only inside router context
|
|
23
|
+
const RouterLink = React.lazy(async () => {
|
|
24
|
+
const mod = await import('react-router-dom');
|
|
25
|
+
return { default: mod.Link };
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
return (
|
|
29
|
+
<Suspense fallback={<MuiLink ref={ref} {...rest} />}>
|
|
30
|
+
<MuiLink component={RouterLink} to={to} ref={ref} {...rest} />
|
|
31
|
+
</Suspense>
|
|
32
|
+
);
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
export default Link;
|
|
36
|
+
export type { GuiLinkProps as LinkProps };
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
// src/gui/atoms/List/List.resolver.tsx
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import List from './List';
|
|
4
|
+
import ListSubheader from '@mui/material/ListSubheader';
|
|
5
|
+
import type { RegistryEntry, ResolveCtx } from '@/gui/registry/types';
|
|
6
|
+
import type { SxProps, Theme } from '@mui/material/styles';
|
|
7
|
+
import { ensureNodeId } from '@/gui/utils/nodeID';
|
|
8
|
+
/**
|
|
9
|
+
* Declarative resolver for List
|
|
10
|
+
*
|
|
11
|
+
* Fidelity
|
|
12
|
+
* - Forwards MUI props faithfully (dense, disablePadding, subheader, etc.).
|
|
13
|
+
* - Supports polymorphism via `component` (and alias `as`).
|
|
14
|
+
* - Provides **granular styling** via `sx` (root) and optional `subheaderSx`.
|
|
15
|
+
* - Generates a stable id via `ensureNodeId`.
|
|
16
|
+
*
|
|
17
|
+
* Sugar
|
|
18
|
+
* - `subheaderText`: if provided (and `subheader` not provided), we render
|
|
19
|
+
* a `<ListSubheader />` with that text. You can style it via `subheaderSx`.
|
|
20
|
+
*
|
|
21
|
+
* Note: Routing props (`href`, `to`, `external`) are not handled at the List level.
|
|
22
|
+
*/
|
|
23
|
+
export type ListSpec = {
|
|
24
|
+
type: 'List';
|
|
25
|
+
props?: {
|
|
26
|
+
children?: React.ReactNode;
|
|
27
|
+
// Polymorphism
|
|
28
|
+
component?: any;
|
|
29
|
+
as?: any; // alias of component
|
|
30
|
+
// MUI props (subset; others passthrough)
|
|
31
|
+
dense?: boolean;
|
|
32
|
+
disablePadding?: boolean;
|
|
33
|
+
subheader?: React.ReactNode;
|
|
34
|
+
// Sugar
|
|
35
|
+
subheaderText?: React.ReactNode;
|
|
36
|
+
subheaderSx?: SxProps<Theme>;
|
|
37
|
+
// Styling
|
|
38
|
+
sx?: SxProps<Theme>; // root styles
|
|
39
|
+
className?: string;
|
|
40
|
+
id?: string;
|
|
41
|
+
'data-testid'?: string;
|
|
42
|
+
// Arbitrary passthrough
|
|
43
|
+
[key: string]: any;
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
const ListResolver: RegistryEntry = {
|
|
48
|
+
type: 'List',
|
|
49
|
+
resolve(spec: ListSpec, _ctx?: ResolveCtx) {
|
|
50
|
+
const p = spec.props ?? {};
|
|
51
|
+
const id = ensureNodeId('list', p.id);
|
|
52
|
+
const component = p.component ?? p.as;
|
|
53
|
+
const {
|
|
54
|
+
children,
|
|
55
|
+
subheader,
|
|
56
|
+
subheaderText,
|
|
57
|
+
subheaderSx,
|
|
58
|
+
// strip resolver-only alias
|
|
59
|
+
as: _as,
|
|
60
|
+
// passthrough rest (dense, disablePadding, sx, etc.)
|
|
61
|
+
...rest
|
|
62
|
+
} = p;
|
|
63
|
+
const effectiveSubheader =
|
|
64
|
+
subheader != null
|
|
65
|
+
? subheader
|
|
66
|
+
: subheaderText != null
|
|
67
|
+
? (
|
|
68
|
+
<ListSubheader component="div" sx={subheaderSx}>
|
|
69
|
+
{subheaderText}
|
|
70
|
+
</ListSubheader>
|
|
71
|
+
)
|
|
72
|
+
: undefined;
|
|
73
|
+
|
|
74
|
+
const rootProps: any = {
|
|
75
|
+
...rest,
|
|
76
|
+
sx: p.sx,
|
|
77
|
+
className: p.className,
|
|
78
|
+
id,
|
|
79
|
+
'data-testid': p['data-testid'],
|
|
80
|
+
subheader: effectiveSubheader,
|
|
81
|
+
};
|
|
82
|
+
if (component !== undefined) {
|
|
83
|
+
rootProps.component = component;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
return (
|
|
87
|
+
<List {...rootProps}>
|
|
88
|
+
{children}
|
|
89
|
+
</List>
|
|
90
|
+
);
|
|
91
|
+
},
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
export default ListResolver;
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
3
|
+
import List from './List';
|
|
4
|
+
import ListItem from '../ListItem/ListItem';
|
|
5
|
+
import ListItemIcon from '@/gui/atoms/ListItemIcon/ListItemIcon';
|
|
6
|
+
import ListItemText from '@/gui/atoms/ListItemText/ListItemText';
|
|
7
|
+
import Icon from '@/gui/Theme/Icon/Icon';
|
|
8
|
+
import ListSubheader from '@mui/material/ListSubheader';
|
|
9
|
+
|
|
10
|
+
const meta: Meta<typeof List> = {
|
|
11
|
+
title: 'Atoms/Organization/List',
|
|
12
|
+
component: List,
|
|
13
|
+
tags: ['autodocs'],
|
|
14
|
+
decorators: [
|
|
15
|
+
(Story) => (
|
|
16
|
+
<div style={{ padding: 16, minHeight: 260, maxWidth: 560 }}>
|
|
17
|
+
<Story />
|
|
18
|
+
</div>
|
|
19
|
+
),
|
|
20
|
+
],
|
|
21
|
+
parameters: {
|
|
22
|
+
docs: {
|
|
23
|
+
description: {
|
|
24
|
+
component: `
|
|
25
|
+
The **List** atom is a thin wrapper around MUI's \`MuiList\`, staying faithful to its API and polymorphism.
|
|
26
|
+
|
|
27
|
+
In **declarative** mode (resolver), it forwards MUI props and supports granular styling via \`sx\`.
|
|
28
|
+
It also provides sugar: \`subheaderText\` (and \`subheaderSx\`) to easily render a \`<ListSubheader/>\` when you don't pass \`subheader\` explicitly.
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
## React usage
|
|
32
|
+
~~~jsx
|
|
33
|
+
<List dense subheader={<li />}> // arbitrary subheader (from MUI API)
|
|
34
|
+
<ListItem>
|
|
35
|
+
<ListItemIcon>
|
|
36
|
+
<Icon name="lucide:inbox" />
|
|
37
|
+
</ListItemIcon>
|
|
38
|
+
<ListItemText primary="Inbox" />
|
|
39
|
+
</ListItem>
|
|
40
|
+
</List>
|
|
41
|
+
~~~
|
|
42
|
+
|
|
43
|
+
## Declarative JSON / Resolver
|
|
44
|
+
~~~json
|
|
45
|
+
{
|
|
46
|
+
"type": "List",
|
|
47
|
+
"props": {
|
|
48
|
+
"dense": true,
|
|
49
|
+
"disablePadding": false,
|
|
50
|
+
"subheaderText": "Shortcuts",
|
|
51
|
+
"subheaderSx": { "fontWeight": 600 },
|
|
52
|
+
"sx": { "bgcolor": "background.paper", "borderRadius": 8 }
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
~~~
|
|
56
|
+
*Note:* \`subheaderText\`/\`subheaderSx\` are **resolver-only** sugar; they are not MUI props.
|
|
57
|
+
`,
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
controls: {
|
|
61
|
+
exclude: ['component', 'children', 'subheader'],
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
argTypes: {
|
|
65
|
+
dense: { control: 'boolean' },
|
|
66
|
+
disablePadding: { control: 'boolean' },
|
|
67
|
+
sx: { control: 'object', table: { category: 'Style' } },
|
|
68
|
+
},
|
|
69
|
+
args: {
|
|
70
|
+
dense: false,
|
|
71
|
+
disablePadding: false,
|
|
72
|
+
sx: { bgcolor: 'background.paper', borderRadius: 1, border: '1px solid', borderColor: 'divider' },
|
|
73
|
+
},
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
export default meta;
|
|
77
|
+
|
|
78
|
+
type Story = StoryObj<typeof List>;
|
|
79
|
+
|
|
80
|
+
const SampleRows: React.FC = () => (
|
|
81
|
+
<>
|
|
82
|
+
<ListItem>
|
|
83
|
+
<ListItemIcon>
|
|
84
|
+
<Icon name="lucide:inbox" />
|
|
85
|
+
</ListItemIcon>
|
|
86
|
+
<ListItemText primary="Inbox" />
|
|
87
|
+
</ListItem>
|
|
88
|
+
<ListItem>
|
|
89
|
+
<ListItemIcon>
|
|
90
|
+
<Icon name="lucide:send" />
|
|
91
|
+
</ListItemIcon>
|
|
92
|
+
<ListItemText primary="Sent" />
|
|
93
|
+
</ListItem>
|
|
94
|
+
<ListItem>
|
|
95
|
+
<ListItemIcon>
|
|
96
|
+
<Icon name="lucide:star" />
|
|
97
|
+
</ListItemIcon>
|
|
98
|
+
<ListItemText primary="Starred" />
|
|
99
|
+
</ListItem>
|
|
100
|
+
</>
|
|
101
|
+
);
|
|
102
|
+
|
|
103
|
+
// ======================= Stories =======================
|
|
104
|
+
export const Playground: Story = {
|
|
105
|
+
render: (args) => (
|
|
106
|
+
<List {...args}>
|
|
107
|
+
<SampleRows />
|
|
108
|
+
</List>
|
|
109
|
+
),
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
export const WithSubheader: Story = {
|
|
113
|
+
name: 'With subheader (MUI prop)',
|
|
114
|
+
render: () => (
|
|
115
|
+
<List subheader={<ListSubheader component="div" sx={{ fontWeight: 600 }}>Shortcuts</ListSubheader>}>
|
|
116
|
+
<SampleRows />
|
|
117
|
+
</List>
|
|
118
|
+
),
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
export const DenseAndNoPadding: Story = {
|
|
122
|
+
args: { dense: true, disablePadding: true },
|
|
123
|
+
render: (args) => (
|
|
124
|
+
<List {...args}>
|
|
125
|
+
<SampleRows />
|
|
126
|
+
</List>
|
|
127
|
+
),
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
export const StyledWithSx: Story = {
|
|
131
|
+
args: { sx: { bgcolor: 'background.paper', borderRadius: 2, boxShadow: 1 } },
|
|
132
|
+
render: (args) => (
|
|
133
|
+
<List {...args}>
|
|
134
|
+
<SampleRows />
|
|
135
|
+
</List>
|
|
136
|
+
),
|
|
137
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This.GUI — List
|
|
3
|
+
* Thin wrapper around MUI’s List that preserves MUI props & typing.
|
|
4
|
+
*
|
|
5
|
+
* Fidelity
|
|
6
|
+
* - We directly re-export MUI’s component so all behavior/typing remain intact.
|
|
7
|
+
* - Granular styling is supported via the standard `sx` prop (MUI System).
|
|
8
|
+
*
|
|
9
|
+
* Why wrap it?
|
|
10
|
+
* - Consistency with This.GUI’s atom pattern (each atom in its own module).
|
|
11
|
+
* - Provides a clean surface for a resolver (declarative mode) without
|
|
12
|
+
* altering React usage.
|
|
13
|
+
*/
|
|
14
|
+
import * as React from 'react';
|
|
15
|
+
import MuiList from '@mui/material/List';
|
|
16
|
+
const List = MuiList;
|
|
17
|
+
export type ListProps = React.ComponentProps<typeof List>;
|
|
18
|
+
// Helpful display name in React DevTools
|
|
19
|
+
(List as any).displayName = 'Gui.List';
|
|
20
|
+
export default List;
|