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,88 @@
|
|
|
1
|
+
// src/gui/atoms/ListItem/ListItem.resolver.tsx
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import ListItem from './ListItem';
|
|
4
|
+
import type { RegistryEntry, ResolveCtx } from '@/gui/registry/types';
|
|
5
|
+
import type { SxProps, Theme } from '@mui/material/styles';
|
|
6
|
+
import { ensureNodeId } from '@/gui/utils/nodeID';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Declarative resolver for ListItem
|
|
10
|
+
*
|
|
11
|
+
* Fidelity
|
|
12
|
+
* - Forwards all MUI ListItem props faithfully (alignItems, dense, divider, selected, etc.).
|
|
13
|
+
* - Supports polymorphism via `component` prop (and alias `as`).
|
|
14
|
+
* - Provides **granular styling** via `sx`.
|
|
15
|
+
*
|
|
16
|
+
* Notes
|
|
17
|
+
* - In declarative (JSON/registry) mode, just pass props as object.
|
|
18
|
+
* - If children are provided, they render directly.
|
|
19
|
+
* - We emit a stable editor id under `data-gui-id` (not `id`) to avoid clashing with user-provided DOM ids.
|
|
20
|
+
*/
|
|
21
|
+
export type ListItemSpec = {
|
|
22
|
+
type: 'ListItem';
|
|
23
|
+
props?: {
|
|
24
|
+
children?: React.ReactNode;
|
|
25
|
+
|
|
26
|
+
// Polymorphism
|
|
27
|
+
component?: any;
|
|
28
|
+
as?: any;
|
|
29
|
+
|
|
30
|
+
// MUI props (subset; others passthrough in `...rest`)
|
|
31
|
+
dense?: boolean;
|
|
32
|
+
divider?: boolean;
|
|
33
|
+
disableGutters?: boolean;
|
|
34
|
+
selected?: boolean;
|
|
35
|
+
alignItems?: 'flex-start' | 'center';
|
|
36
|
+
secondaryAction?: React.ReactNode;
|
|
37
|
+
|
|
38
|
+
// Styling
|
|
39
|
+
sx?: SxProps<Theme>;
|
|
40
|
+
className?: string;
|
|
41
|
+
|
|
42
|
+
// Identity & testing
|
|
43
|
+
id?: string;
|
|
44
|
+
'data-testid'?: string;
|
|
45
|
+
'data-gui-id'?: string;
|
|
46
|
+
|
|
47
|
+
// Arbitrary passthrough
|
|
48
|
+
[key: string]: any;
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
const ListItemResolver: RegistryEntry = {
|
|
53
|
+
type: 'ListItem',
|
|
54
|
+
resolve(spec: ListItemSpec, _ctx?: ResolveCtx) {
|
|
55
|
+
const p = spec.props ?? {};
|
|
56
|
+
|
|
57
|
+
// Polymorphic target (avoid passing undefined)
|
|
58
|
+
const component = p.component ?? p.as;
|
|
59
|
+
const rootPolymorphic = component ? { component } : {};
|
|
60
|
+
|
|
61
|
+
// Stable editor id that doesn't clash with user DOM ids
|
|
62
|
+
const guiId = ensureNodeId('list-item', p['data-gui-id']);
|
|
63
|
+
|
|
64
|
+
// Collect props, strip resolver-only keys
|
|
65
|
+
const {
|
|
66
|
+
children,
|
|
67
|
+
as: _as,
|
|
68
|
+
'data-gui-id': _guiIdIn,
|
|
69
|
+
...rest
|
|
70
|
+
} = p;
|
|
71
|
+
|
|
72
|
+
return (
|
|
73
|
+
<ListItem
|
|
74
|
+
{...rootPolymorphic}
|
|
75
|
+
sx={p.sx}
|
|
76
|
+
className={p.className}
|
|
77
|
+
id={p.id}
|
|
78
|
+
data-testid={p['data-testid']}
|
|
79
|
+
data-gui-id={guiId}
|
|
80
|
+
{...rest}
|
|
81
|
+
>
|
|
82
|
+
{children}
|
|
83
|
+
</ListItem>
|
|
84
|
+
);
|
|
85
|
+
},
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
export default ListItemResolver;
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
3
|
+
import ListItem from './ListItem';
|
|
4
|
+
import List from '@mui/material/List';
|
|
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
|
+
const meta: Meta<typeof ListItem> = {
|
|
9
|
+
title: 'Atoms/Organization/ListItem',
|
|
10
|
+
component: ListItem,
|
|
11
|
+
tags: ['autodocs'],
|
|
12
|
+
decorators: [
|
|
13
|
+
(Story) => (
|
|
14
|
+
<div style={{ padding: 16, minHeight: 260, maxWidth: 560 }}>
|
|
15
|
+
<Story />
|
|
16
|
+
</div>
|
|
17
|
+
),
|
|
18
|
+
],
|
|
19
|
+
parameters: {
|
|
20
|
+
docs: {
|
|
21
|
+
description: {
|
|
22
|
+
component: `
|
|
23
|
+
The **ListItem** atom is a thin wrapper around MUI's \`MuiListItem\`, staying faithful to its API and polymorphism.
|
|
24
|
+
In **declarative** mode (resolver), it simply forwards MUI props and allows granular styling via \`sx\`.
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## React usage
|
|
29
|
+
~~~jsx
|
|
30
|
+
<List dense>
|
|
31
|
+
<ListItem divider>
|
|
32
|
+
<ListItemIcon>
|
|
33
|
+
<Icon name="lucide:inbox" />
|
|
34
|
+
</ListItemIcon>
|
|
35
|
+
<ListItemText primary="Inbox" secondary="Messages" />
|
|
36
|
+
</ListItem>
|
|
37
|
+
</List>
|
|
38
|
+
~~~
|
|
39
|
+
|
|
40
|
+
## Declarative JSON / Resolver
|
|
41
|
+
~~~json
|
|
42
|
+
{
|
|
43
|
+
"type": "ListItem",
|
|
44
|
+
"props": {
|
|
45
|
+
"dense": true,
|
|
46
|
+
"divider": true,
|
|
47
|
+
"selected": true,
|
|
48
|
+
"sx": { "py": 1 }
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
~~~
|
|
52
|
+
`,
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
controls: {
|
|
56
|
+
exclude: ['component', 'children'],
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
argTypes: {
|
|
60
|
+
dense: { control: 'boolean' },
|
|
61
|
+
divider: { control: 'boolean' },
|
|
62
|
+
disableGutters: { control: 'boolean' },
|
|
63
|
+
alignItems: { control: { type: 'radio' }, options: ['center', 'flex-start'] },
|
|
64
|
+
sx: { control: 'object' },
|
|
65
|
+
},
|
|
66
|
+
args: {
|
|
67
|
+
dense: false,
|
|
68
|
+
divider: false,
|
|
69
|
+
disableGutters: false,
|
|
70
|
+
alignItems: 'center',
|
|
71
|
+
sx: {},
|
|
72
|
+
children: undefined,
|
|
73
|
+
},
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
export default meta;
|
|
77
|
+
type Story = StoryObj<typeof ListItem>;
|
|
78
|
+
|
|
79
|
+
const DemoList: React.FC<{ children?: React.ReactNode }> = ({ children }) => (
|
|
80
|
+
<List dense sx={{ bgcolor: 'background.paper', borderRadius: 1, overflow: 'hidden', border: '1px solid', borderColor: 'divider' }}>
|
|
81
|
+
{children}
|
|
82
|
+
</List>
|
|
83
|
+
);
|
|
84
|
+
|
|
85
|
+
// ======================= Stories =======================
|
|
86
|
+
export const Playground: Story = {
|
|
87
|
+
render: (args) => (
|
|
88
|
+
<DemoList>
|
|
89
|
+
<ListItem {...args}>
|
|
90
|
+
<ListItemIcon>
|
|
91
|
+
<Icon name="lucide:inbox" />
|
|
92
|
+
</ListItemIcon>
|
|
93
|
+
<ListItemText primary="Inbox" secondary="Messages" />
|
|
94
|
+
</ListItem>
|
|
95
|
+
</DemoList>
|
|
96
|
+
),
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
export const Variants: Story = {
|
|
100
|
+
render: () => (
|
|
101
|
+
<DemoList>
|
|
102
|
+
<ListItem>
|
|
103
|
+
<ListItemIcon>
|
|
104
|
+
<Icon name="lucide:mail" />
|
|
105
|
+
</ListItemIcon>
|
|
106
|
+
<ListItemText primary="Default" secondary="No props" />
|
|
107
|
+
</ListItem>
|
|
108
|
+
<ListItem dense>
|
|
109
|
+
<ListItemIcon>
|
|
110
|
+
<Icon name="lucide:mail" />
|
|
111
|
+
</ListItemIcon>
|
|
112
|
+
<ListItemText primary="Dense" />
|
|
113
|
+
</ListItem>
|
|
114
|
+
<ListItem divider>
|
|
115
|
+
<ListItemIcon>
|
|
116
|
+
<Icon name="lucide:mail" />
|
|
117
|
+
</ListItemIcon>
|
|
118
|
+
<ListItemText primary="With divider" />
|
|
119
|
+
</ListItem>
|
|
120
|
+
<ListItem>
|
|
121
|
+
<ListItemIcon>
|
|
122
|
+
<Icon name="lucide:mail" />
|
|
123
|
+
</ListItemIcon>
|
|
124
|
+
<ListItemText primary="Default (no selected on ListItem)" />
|
|
125
|
+
</ListItem>
|
|
126
|
+
<ListItem alignItems="flex-start">
|
|
127
|
+
<ListItemIcon>
|
|
128
|
+
<Icon name="lucide:mail" />
|
|
129
|
+
</ListItemIcon>
|
|
130
|
+
<ListItemText primary="Align start" secondary="Secondary text that wraps onto multiple lines for demo." />
|
|
131
|
+
</ListItem>
|
|
132
|
+
</DemoList>
|
|
133
|
+
),
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
export const WithSx: Story = {
|
|
137
|
+
render: () => (
|
|
138
|
+
<DemoList>
|
|
139
|
+
<ListItem sx={{ py: 1.25, '&:hover': { bgcolor: 'action.hover' } }}>
|
|
140
|
+
<ListItemIcon sx={{ minWidth: 40 }}>
|
|
141
|
+
<Icon name="lucide:user" />
|
|
142
|
+
</ListItemIcon>
|
|
143
|
+
<ListItemText
|
|
144
|
+
primary="Profile"
|
|
145
|
+
secondary="Account"
|
|
146
|
+
secondaryTypographyProps={{ color: 'text.secondary' }}
|
|
147
|
+
/>
|
|
148
|
+
</ListItem>
|
|
149
|
+
</DemoList>
|
|
150
|
+
),
|
|
151
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This.GUI — ListItem
|
|
3
|
+
* Thin wrapper around MUI’s ListItem that preserves MUI’s props and typing.
|
|
4
|
+
*
|
|
5
|
+
* Fidelity
|
|
6
|
+
* - We directly re-export MUI’s component so all behavior and 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
|
+
* - Enables a clean spot for a resolver (declarative mode) without changing React usage.
|
|
12
|
+
*/
|
|
13
|
+
import * as React from 'react';
|
|
14
|
+
import MuiListItem from '@mui/material/ListItem';
|
|
15
|
+
const ListItem = MuiListItem;
|
|
16
|
+
export type ListItemProps = React.ComponentProps<typeof ListItem>;
|
|
17
|
+
// Useful name in React DevTools
|
|
18
|
+
(ListItem as any).displayName = 'Gui.ListItem';
|
|
19
|
+
export default ListItem;
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
// src/gui/atoms/ListItemButton/ListItemButton.resolver.tsx
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import ListItemButton from './ListItemButton';
|
|
4
|
+
import Link from '@/gui/atoms/Link/Link';
|
|
5
|
+
import Icon from '@/gui/Theme/Icon/Icon';
|
|
6
|
+
// Use our own thin wrappers for consistency & display names
|
|
7
|
+
import ListItemIcon from '@/gui/atoms/ListItemIcon/ListItemIcon';
|
|
8
|
+
import ListItemText from '@/gui/atoms/ListItemText/ListItemText';
|
|
9
|
+
import type { RegistryEntry, ResolveCtx } from '@/gui/registry/types';
|
|
10
|
+
import type { SxProps, Theme } from '@mui/material/styles';
|
|
11
|
+
import Box from '../Box/Box';
|
|
12
|
+
import { ensureNodeId } from '@/gui/utils/nodeID';
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Declarative spec for ListItemButton
|
|
16
|
+
*
|
|
17
|
+
* Goals
|
|
18
|
+
* - Be faithful to MUI's API: forward native props like `selected`, `disabled`, `dense`, `alignItems`, etc.
|
|
19
|
+
* - Preserve polymorphism via MUI's `component` prop (and alias `as`).
|
|
20
|
+
* - Add **declarative sugar** (optional):
|
|
21
|
+
* - `startIcon` / `endIcon`: string token (e.g., "lucide:mail", "mui:settings") or ReactNode
|
|
22
|
+
* - `label` / `secondary`: mapped to `<ListItemText primary/secondary />`
|
|
23
|
+
* - Add **granular styling** for slots:
|
|
24
|
+
* - `sx` → root ListItemButton
|
|
25
|
+
* - `iconSx` → ListItemIcon (leading)
|
|
26
|
+
* - `textSx` → ListItemText
|
|
27
|
+
* - `endIconSx` → trailing icon container
|
|
28
|
+
*
|
|
29
|
+
* Notes
|
|
30
|
+
* - If `children` are provided, they take precedence and render as-is (no sugar applied).
|
|
31
|
+
* - Tokens are normalized (lowercased & trimmed) to avoid missing icons due to casing.
|
|
32
|
+
* - Routing:
|
|
33
|
+
* - If `to` is provided (and no explicit `component`), the resolver will default to This.GUI `Link`.
|
|
34
|
+
* - If `external` is true (and no explicit `component`), it will default to an anchor `'a'` and add safe `target`/`rel`.
|
|
35
|
+
*/
|
|
36
|
+
export type ListItemButtonSpec = {
|
|
37
|
+
type: 'ListItemButton';
|
|
38
|
+
props?: {
|
|
39
|
+
children?: React.ReactNode;
|
|
40
|
+
|
|
41
|
+
// Polymorphism / routing
|
|
42
|
+
component?: any; // 'div' | 'a' | Link | custom
|
|
43
|
+
as?: any; // alias for component
|
|
44
|
+
to?: string; // router target (when component={Link})
|
|
45
|
+
href?: string; // anchor target (when component='a')
|
|
46
|
+
external?: boolean; // force external anchor
|
|
47
|
+
target?: React.HTMLAttributeAnchorTarget;
|
|
48
|
+
rel?: string;
|
|
49
|
+
|
|
50
|
+
// Sugar (optional)
|
|
51
|
+
startIcon?: React.ReactNode | string;
|
|
52
|
+
endIcon?: React.ReactNode | string;
|
|
53
|
+
iconColor?: string; // applies to startIcon/endIcon when tokens
|
|
54
|
+
endIconColor?: string; // override for trailing icon
|
|
55
|
+
size?: number; // icon size (default 20)
|
|
56
|
+
label?: React.ReactNode | string;
|
|
57
|
+
secondary?: React.ReactNode | string;
|
|
58
|
+
|
|
59
|
+
// MUI props (subset; others passthrough)
|
|
60
|
+
selected?: boolean;
|
|
61
|
+
disabled?: boolean;
|
|
62
|
+
dense?: boolean;
|
|
63
|
+
alignItems?: 'flex-start' | 'center';
|
|
64
|
+
divider?: boolean;
|
|
65
|
+
|
|
66
|
+
// Granular styling
|
|
67
|
+
sx?: SxProps<Theme>; // root
|
|
68
|
+
iconSx?: SxProps<Theme>; // leading ListItemIcon
|
|
69
|
+
textSx?: SxProps<Theme>; // ListItemText
|
|
70
|
+
endIconSx?: SxProps<Theme>; // trailing icon container
|
|
71
|
+
|
|
72
|
+
// Slot props passthrough (their own sx can be merged)
|
|
73
|
+
ListItemIconProps?: { sx?: SxProps<Theme>; [k: string]: any };
|
|
74
|
+
ListItemTextProps?: { sx?: SxProps<Theme>; [k: string]: any };
|
|
75
|
+
|
|
76
|
+
// Editor / telemetry
|
|
77
|
+
'data-gui-id'?: string;
|
|
78
|
+
|
|
79
|
+
// Misc DOM
|
|
80
|
+
id?: string;
|
|
81
|
+
className?: string;
|
|
82
|
+
'data-testid'?: string;
|
|
83
|
+
|
|
84
|
+
// Arbitrary passthrough
|
|
85
|
+
[key: string]: any;
|
|
86
|
+
};
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
const normalizeToken = (s: string) => s.trim().toLowerCase();
|
|
90
|
+
|
|
91
|
+
function renderIcon(node: React.ReactNode | string | undefined, color?: string, size = 20) {
|
|
92
|
+
if (!node) return null;
|
|
93
|
+
return typeof node === 'string'
|
|
94
|
+
? (
|
|
95
|
+
<Icon
|
|
96
|
+
name={normalizeToken(node)}
|
|
97
|
+
iconColor={color}
|
|
98
|
+
fontSize={size}
|
|
99
|
+
/>
|
|
100
|
+
)
|
|
101
|
+
: node;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
const ListItemButtonResolver: RegistryEntry = {
|
|
105
|
+
type: 'ListItemButton',
|
|
106
|
+
resolve(spec: ListItemButtonSpec, _ctx?: ResolveCtx) {
|
|
107
|
+
const p = spec.props ?? {};
|
|
108
|
+
|
|
109
|
+
// Generate/ensure a stable gui id (does not override an explicit one)
|
|
110
|
+
const dataGuiId = ensureNodeId('list-item-button', (p as any)['data-gui-id']);
|
|
111
|
+
|
|
112
|
+
// Decide polymorphic target (only pass when defined)
|
|
113
|
+
const decidedComponent = p.component ?? p.as ?? (p.to ? Link : p.external ? 'a' : undefined);
|
|
114
|
+
const componentProp = decidedComponent ? { component: decidedComponent } : undefined;
|
|
115
|
+
|
|
116
|
+
// Routing/anchor props
|
|
117
|
+
const routingProps =
|
|
118
|
+
decidedComponent === 'a' || p.external
|
|
119
|
+
? {
|
|
120
|
+
href: p.href,
|
|
121
|
+
target: p.target ?? (p.external ? '_blank' : undefined),
|
|
122
|
+
rel: p.rel ?? (p.external ? 'noopener noreferrer' : undefined),
|
|
123
|
+
}
|
|
124
|
+
: decidedComponent === Link || (p.to && !p.component)
|
|
125
|
+
? { to: p.to }
|
|
126
|
+
: {};
|
|
127
|
+
|
|
128
|
+
// Destructure and clean resolver-only fields
|
|
129
|
+
const {
|
|
130
|
+
children,
|
|
131
|
+
startIcon,
|
|
132
|
+
endIcon,
|
|
133
|
+
iconColor,
|
|
134
|
+
endIconColor,
|
|
135
|
+
size = 20,
|
|
136
|
+
ListItemIconProps,
|
|
137
|
+
ListItemTextProps,
|
|
138
|
+
iconSx,
|
|
139
|
+
textSx,
|
|
140
|
+
endIconSx,
|
|
141
|
+
|
|
142
|
+
// strip resolver-only aliasing keys so they don't leak to DOM
|
|
143
|
+
as: _as,
|
|
144
|
+
external: _external,
|
|
145
|
+
to: _to,
|
|
146
|
+
href: _href,
|
|
147
|
+
target: _target,
|
|
148
|
+
rel: _rel,
|
|
149
|
+
|
|
150
|
+
// keep rest: native MUI props (selected, dense, disabled, divider, alignItems, sx, etc.)
|
|
151
|
+
...rest
|
|
152
|
+
} = p as any;
|
|
153
|
+
|
|
154
|
+
// If explicit children, render as-is (no sugar)
|
|
155
|
+
if (children != null) {
|
|
156
|
+
return (
|
|
157
|
+
<ListItemButton
|
|
158
|
+
{...componentProp}
|
|
159
|
+
sx={p.sx}
|
|
160
|
+
id={p.id}
|
|
161
|
+
className={p.className}
|
|
162
|
+
data-testid={p['data-testid']}
|
|
163
|
+
data-gui-id={dataGuiId}
|
|
164
|
+
{...routingProps}
|
|
165
|
+
{...rest}
|
|
166
|
+
>
|
|
167
|
+
{children}
|
|
168
|
+
</ListItemButton>
|
|
169
|
+
);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
// Build sugar content
|
|
173
|
+
const leadingIcon = renderIcon(startIcon, iconColor, size);
|
|
174
|
+
const trailingIcon = renderIcon(endIcon, endIconColor ?? iconColor, size);
|
|
175
|
+
const hasText = p.label != null || p.secondary != null;
|
|
176
|
+
|
|
177
|
+
// Merge sx for slot props safely (array merge preserves both)
|
|
178
|
+
const mergedIconSx =
|
|
179
|
+
iconSx != null && ListItemIconProps?.sx != null ? [iconSx, ListItemIconProps.sx] : iconSx ?? ListItemIconProps?.sx;
|
|
180
|
+
const mergedTextSx =
|
|
181
|
+
textSx != null && ListItemTextProps?.sx != null ? [textSx, ListItemTextProps.sx] : textSx ?? ListItemTextProps?.sx;
|
|
182
|
+
|
|
183
|
+
const finalIconProps = leadingIcon
|
|
184
|
+
? (ListItemIconProps ? { ...ListItemIconProps, sx: mergedIconSx } : (mergedIconSx != null ? { sx: mergedIconSx } : undefined))
|
|
185
|
+
: undefined;
|
|
186
|
+
|
|
187
|
+
const finalTextProps = hasText
|
|
188
|
+
? (ListItemTextProps ? { ...ListItemTextProps, sx: mergedTextSx } : (mergedTextSx != null ? { sx: mergedTextSx } : undefined))
|
|
189
|
+
: undefined;
|
|
190
|
+
|
|
191
|
+
return (
|
|
192
|
+
<ListItemButton
|
|
193
|
+
{...componentProp}
|
|
194
|
+
sx={p.sx}
|
|
195
|
+
id={p.id}
|
|
196
|
+
className={p.className}
|
|
197
|
+
data-testid={p['data-testid']}
|
|
198
|
+
data-gui-id={dataGuiId}
|
|
199
|
+
{...routingProps}
|
|
200
|
+
{...rest}
|
|
201
|
+
>
|
|
202
|
+
{leadingIcon ? <ListItemIcon {...finalIconProps}>{leadingIcon}</ListItemIcon> : null}
|
|
203
|
+
{hasText ? <ListItemText primary={p.label} secondary={p.secondary} {...finalTextProps} /> : null}
|
|
204
|
+
{trailingIcon ? (
|
|
205
|
+
<Box sx={[{ marginLeft: 'auto', display: 'inline-flex', alignItems: 'center' }, endIconSx as any]}>
|
|
206
|
+
{trailingIcon}
|
|
207
|
+
</Box>
|
|
208
|
+
) : null}
|
|
209
|
+
</ListItemButton>
|
|
210
|
+
);
|
|
211
|
+
},
|
|
212
|
+
};
|
|
213
|
+
|
|
214
|
+
export default ListItemButtonResolver;
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
3
|
+
import ListItemButton from './ListItemButton';
|
|
4
|
+
import ListItemIcon from '@/gui/atoms/ListItemIcon/ListItemIcon';
|
|
5
|
+
import ListItemText from '@/gui/atoms/ListItemText/ListItemText';
|
|
6
|
+
import Icon from '@/gui/Theme/Icon/Icon';
|
|
7
|
+
import List from '@mui/material/List';
|
|
8
|
+
import ListItem from '@mui/material/ListItem';
|
|
9
|
+
|
|
10
|
+
const meta: Meta<typeof ListItemButton> = {
|
|
11
|
+
title: 'Atoms/Organization/ListItemButton',
|
|
12
|
+
component: ListItemButton,
|
|
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 **ListItemButton** atom is a thin wrapper around MUI's \`MuiListItemButton\`, staying faithful to its API and polymorphism.
|
|
26
|
+
|
|
27
|
+
In **declarative** mode, the resolver adds sugar:
|
|
28
|
+
- \`startIcon\` / \`endIcon\`: token (e.g., \`"lucide:mail"\`, \`"mui:settings"\`) or ReactNode — rendered via the icon registry
|
|
29
|
+
- \`label\` / \`secondary\` → mapped to \`<ListItemText primary/secondary />\`
|
|
30
|
+
- Granular styling:
|
|
31
|
+
- \`sx\` (root), \`iconSx\` (leading \`ListItemIcon\`), \`textSx\` (text), \`endIconSx\` (trailing icon container)
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
## React usage
|
|
35
|
+
~~~jsx
|
|
36
|
+
<List>
|
|
37
|
+
<ListItem disablePadding>
|
|
38
|
+
<ListItemButton selected>
|
|
39
|
+
<ListItemIcon>
|
|
40
|
+
<Icon name="lucide:mail" />
|
|
41
|
+
</ListItemIcon>
|
|
42
|
+
<ListItemText primary="Inbox" secondary="Messages" />
|
|
43
|
+
</ListItemButton>
|
|
44
|
+
</ListItem>
|
|
45
|
+
</List>
|
|
46
|
+
~~~
|
|
47
|
+
|
|
48
|
+
## Declarative JSON / Resolver
|
|
49
|
+
~~~json
|
|
50
|
+
{
|
|
51
|
+
"type": "ListItemButton",
|
|
52
|
+
"props": {
|
|
53
|
+
"startIcon": "lucide:mail",
|
|
54
|
+
"label": "Inbox",
|
|
55
|
+
"secondary": "Messages",
|
|
56
|
+
"sx": { "py": 1 },
|
|
57
|
+
"iconSx": { "minWidth": 36 },
|
|
58
|
+
"textSx": { "my": 0 }
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
~~~
|
|
62
|
+
`,
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
controls: {
|
|
66
|
+
exclude: ['component', 'children'],
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
argTypes: {
|
|
70
|
+
selected: { control: 'boolean' },
|
|
71
|
+
disabled: { control: 'boolean' },
|
|
72
|
+
dense: { control: 'boolean' },
|
|
73
|
+
divider: { control: 'boolean' },
|
|
74
|
+
alignItems: { control: { type: 'radio' }, options: ['center', 'flex-start'] },
|
|
75
|
+
sx: { control: 'object' },
|
|
76
|
+
},
|
|
77
|
+
args: {
|
|
78
|
+
selected: false,
|
|
79
|
+
disabled: false,
|
|
80
|
+
dense: false,
|
|
81
|
+
divider: false,
|
|
82
|
+
alignItems: 'center',
|
|
83
|
+
sx: {},
|
|
84
|
+
children: undefined,
|
|
85
|
+
},
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
export default meta;
|
|
89
|
+
type Story = StoryObj<typeof ListItemButton>;
|
|
90
|
+
|
|
91
|
+
const DemoList: React.FC<{ children?: React.ReactNode }> = ({ children }) => (
|
|
92
|
+
<List dense sx={{ bgcolor: 'background.paper', borderRadius: 1, overflow: 'hidden', border: '1px solid', borderColor: 'divider' }}>
|
|
93
|
+
<ListItem disablePadding>{children}</ListItem>
|
|
94
|
+
</List>
|
|
95
|
+
);
|
|
96
|
+
|
|
97
|
+
// ======================= Stories =======================
|
|
98
|
+
export const Playground: Story = {
|
|
99
|
+
render: (args) => (
|
|
100
|
+
<DemoList>
|
|
101
|
+
<ListItemButton {...args}>
|
|
102
|
+
<ListItemIcon>
|
|
103
|
+
<Icon name="mail" />
|
|
104
|
+
</ListItemIcon>
|
|
105
|
+
<ListItemText primary="Inbox" secondary="Messages" />
|
|
106
|
+
</ListItemButton>
|
|
107
|
+
</DemoList>
|
|
108
|
+
),
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
export const WithTrailingIcon: Story = {
|
|
112
|
+
render: () => (
|
|
113
|
+
<DemoList>
|
|
114
|
+
<ListItemButton>
|
|
115
|
+
<ListItemIcon>
|
|
116
|
+
<Icon name="settings" />
|
|
117
|
+
</ListItemIcon>
|
|
118
|
+
<ListItemText primary="Settings" secondary="Preferences" />
|
|
119
|
+
<span style={{ marginLeft: 'auto', display: 'inline-flex' }}>
|
|
120
|
+
<Icon name="chevron_right" />
|
|
121
|
+
</span>
|
|
122
|
+
</ListItemButton>
|
|
123
|
+
</DemoList>
|
|
124
|
+
),
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
export const AsAnchorLink: Story = {
|
|
128
|
+
render: () => (
|
|
129
|
+
<DemoList>
|
|
130
|
+
<ListItemButton component="a" href="https://neurons.me">
|
|
131
|
+
<ListItemIcon>
|
|
132
|
+
<Icon name="link" />
|
|
133
|
+
</ListItemIcon>
|
|
134
|
+
<ListItemText primary="neurons.me" secondary="External link" />
|
|
135
|
+
</ListItemButton>
|
|
136
|
+
</DemoList>
|
|
137
|
+
),
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
export const WithSx: Story = {
|
|
141
|
+
render: () => (
|
|
142
|
+
<DemoList>
|
|
143
|
+
<ListItemButton sx={{ py: 1.25 }}>
|
|
144
|
+
<ListItemIcon sx={{ minWidth: 40 }}>
|
|
145
|
+
<Icon name="person" />
|
|
146
|
+
</ListItemIcon>
|
|
147
|
+
<ListItemText
|
|
148
|
+
primary="Profile"
|
|
149
|
+
secondary="Account"
|
|
150
|
+
slotProps={{ secondary: { sx: { color: 'text.secondary' } } }}
|
|
151
|
+
/>
|
|
152
|
+
</ListItemButton>
|
|
153
|
+
</DemoList>
|
|
154
|
+
),
|
|
155
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This component is a thin wrapper around MUI’s ListItemButton.
|
|
3
|
+
* It preserves MUI’s props and typing, staying faithful to MUI.
|
|
4
|
+
*
|
|
5
|
+
* Why wrap it?
|
|
6
|
+
* - Consistency with This.GUI’s atom pattern (each atom has its own file).
|
|
7
|
+
* - Supports declarative/resolver usage while keeping all MUI props intact.
|
|
8
|
+
* - Allows granular style control via `sx`.
|
|
9
|
+
*/
|
|
10
|
+
import * as React from 'react';
|
|
11
|
+
import MuiListItemButton from '@mui/material/ListItemButton';
|
|
12
|
+
const ListItemButton = MuiListItemButton;
|
|
13
|
+
export type ListItemButtonProps = React.ComponentProps<typeof ListItemButton>;
|
|
14
|
+
(ListItemButton as any).displayName = 'Gui.ListItemButton';
|
|
15
|
+
export default ListItemButton;
|