this.gui 1.0.17 → 1.1.0
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/.storybook/main.js +40 -0
- package/.storybook/manager-head.html +13 -0
- package/.storybook/manager.js +15 -0
- package/.storybook/preview.tsx +54 -0
- package/.storybook/vitest.setup.js +6 -0
- package/.storybook/withLayout.tsx +18 -0
- package/README.md +1 -220
- package/dist/GUI.png +0 -0
- package/dist/GUI2.png +0 -0
- package/dist/favicon.ico +0 -0
- package/dist/this-gui.es.js +108493 -4976
- package/dist/this-gui.umd.js +239 -44
- package/dist/this.GUI.png +0 -0
- package/nodes/overall approach.md +93 -0
- package/notes/Proyect.md +109 -0
- package/package.json +71 -53
- package/public/GUI.png +0 -0
- package/public/GUI2.png +0 -0
- package/public/favicon.ico +0 -0
- package/public/this.GUI.png +0 -0
- package/src/components/generics/Cards/Gridme.jsx +52 -0
- package/src/components/generics/Cards/LilBox.jsx +65 -0
- package/src/components/generics/Cards/ModuleCard.jsx +106 -0
- package/src/components/generics/Chats/FullChatBot.jsx +223 -0
- package/src/components/generics/Code/CodeBlock.jsx +33 -0
- package/src/components/generics/Feedback/Callout.jsx +92 -0
- package/src/components/generics/Layout/GridX.jsx +29 -0
- package/src/components/generics/Layout/Hero2.jsx +132 -0
- package/src/components/generics/Layout/PageContainer.jsx +29 -0
- package/src/components/generics/Layout/PageDivider.jsx +20 -0
- package/src/components/generics/Layout/Section.jsx +43 -0
- package/src/components/generics/Layout/SectionHeader.jsx +21 -0
- package/src/components/generics/Media/Img.jsx +58 -0
- package/src/components/generics/Media/VideoEmbed.jsx +51 -0
- package/src/components/generics/Organization/TableOfContents.jsx +51 -0
- package/src/components/generics/Organization/Tabs.jsx +45 -0
- package/src/components/generics/Text/TextList.jsx +41 -0
- package/src/components/generics/Text/TextParagraph.jsx +28 -0
- package/src/components/generics/Text/TextQuote.jsx +23 -0
- package/src/components/generics/Text/TextTitle.jsx +44 -0
- package/src/components/this.me/MeActive.jsx +24 -0
- package/src/components/this.me/MeFloating.jsx +183 -0
- package/src/components/this.me/MeInactive.jsx +21 -0
- package/src/components/this.me/MeListUs.jsx +40 -0
- package/src/components/this.me/MeState.jsx +25 -0
- package/src/components/this.me/hooks/useMe.js +43 -0
- package/src/context/GuiProvider.tsx +243 -0
- package/src/gui/atoms/AppBar/AppBar.resolver.tsx +77 -0
- package/src/gui/atoms/AppBar/AppBar.stories.tsx +232 -0
- package/src/gui/atoms/AppBar/AppBar.tsx +10 -0
- package/src/gui/atoms/Box/Box.resolver.tsx +171 -0
- package/src/gui/atoms/Box/Box.stories.tsx +271 -0
- package/src/gui/atoms/Box/Box.tsx +15 -0
- package/src/gui/atoms/Button/Button.resolver.tsx +98 -0
- package/src/gui/atoms/Button/Button.stories.tsx +225 -0
- package/src/gui/atoms/Button/Button.tsx +40 -0
- package/src/gui/atoms/Collapse/Collapse.resolver.tsx +85 -0
- package/src/gui/atoms/Collapse/Collapse.stories.tsx +136 -0
- package/src/gui/atoms/Collapse/Collapse.tsx +17 -0
- package/src/gui/atoms/Divider/Divider.resolver.tsx +95 -0
- package/src/gui/atoms/Divider/Divider.stories.tsx +109 -0
- package/src/gui/atoms/Divider/Divider.tsx +14 -0
- package/src/gui/atoms/Drawer/Drawer.resolver.tsx +116 -0
- package/src/gui/atoms/Drawer/Drawer.stories.tsx +229 -0
- package/src/gui/atoms/Drawer/Drawer.tsx +8 -0
- package/src/gui/atoms/IconButton/IconButton.resolver.tsx +135 -0
- package/src/gui/atoms/IconButton/IconButton.stories.tsx +141 -0
- package/src/gui/atoms/IconButton/IconButton.tsx +22 -0
- package/src/gui/atoms/Link/Link.resolver.tsx +75 -0
- package/src/gui/atoms/Link/Link.stories.tsx +164 -0
- package/src/gui/atoms/Link/Link.tsx +14 -0
- package/src/gui/atoms/List/List.resolver.tsx +95 -0
- package/src/gui/atoms/List/List.stories.tsx +143 -0
- package/src/gui/atoms/List/List.tsx +20 -0
- package/src/gui/atoms/ListItem/ListItem.resolver.tsx +88 -0
- package/src/gui/atoms/ListItem/ListItem.stories.tsx +157 -0
- package/src/gui/atoms/ListItem/ListItem.tsx +19 -0
- package/src/gui/atoms/ListItemButton/ListItemButton.resolver.tsx +208 -0
- package/src/gui/atoms/ListItemButton/ListItemButton.stories.tsx +161 -0
- package/src/gui/atoms/ListItemButton/ListItemButton.tsx +15 -0
- package/src/gui/atoms/ListItemIcon/ListItemIcon.resolver.tsx +102 -0
- package/src/gui/atoms/ListItemIcon/ListItemIcon.stories.tsx +135 -0
- package/src/gui/atoms/ListItemIcon/ListItemIcon.tsx +11 -0
- package/src/gui/atoms/ListItemText/ListItemText.resolver.tsx +112 -0
- package/src/gui/atoms/ListItemText/ListItemText.stories.tsx +162 -0
- package/src/gui/atoms/ListItemText/ListItemText.tsx +15 -0
- package/src/gui/atoms/Menu/Menu.resolver.tsx +112 -0
- package/src/gui/atoms/Menu/Menu.stories.tsx +168 -0
- package/src/gui/atoms/Menu/Menu.tsx +17 -0
- package/src/gui/atoms/MenuItem/MenuItem.resolver.tsx +183 -0
- package/src/gui/atoms/MenuItem/MenuItem.stories.tsx +138 -0
- package/src/gui/atoms/MenuItem/MenuItem.tsx +14 -0
- package/src/gui/atoms/Paper/Paper.resolver.tsx +98 -0
- package/src/gui/atoms/Paper/Paper.stories.tsx +191 -0
- package/src/gui/atoms/Paper/Paper.tsx +17 -0
- package/src/gui/atoms/Stack/Stack.resolver.tsx +94 -0
- package/src/gui/atoms/Stack/Stack.stories.tsx +166 -0
- package/src/gui/atoms/Stack/Stack.tsx +15 -0
- package/src/gui/atoms/Switch/Switch.resolver.tsx +53 -0
- package/src/gui/atoms/Switch/Switch.stories.tsx +242 -0
- package/src/gui/atoms/Switch/Switch.tsx +22 -0
- package/src/gui/atoms/Toolbar/Toolbar.resolver.tsx +60 -0
- package/src/gui/atoms/Toolbar/Toolbar.stories.tsx +163 -0
- package/src/gui/atoms/Toolbar/Toolbar.tsx +16 -0
- package/src/gui/atoms/Tooltip/Tooltip.resolver.tsx +142 -0
- package/src/gui/atoms/Tooltip/Tooltip.stories.tsx +118 -0
- package/src/gui/atoms/Tooltip/Tooltip.tsx +78 -0
- package/src/gui/atoms/Typography/Typography.resolver.tsx +158 -0
- package/src/gui/atoms/Typography/Typography.stories.tsx +228 -0
- package/src/gui/atoms/Typography/Typography.tsx +27 -0
- package/src/gui/atoms.tsx +129 -0
- package/src/gui/index.ts +69 -0
- package/src/gui/molecules/AppBars/Footer/Footer.resolver.tsx +104 -0
- package/src/gui/molecules/AppBars/Footer/Footer.stories.tsx +499 -0
- package/src/gui/molecules/AppBars/Footer/Footer.tsx +307 -0
- package/src/gui/molecules/AppBars/LeftSidebar/LeftSidebar.resolver.tsx +75 -0
- package/src/gui/molecules/AppBars/LeftSidebar/LeftSidebar.stories.tsx +61 -0
- package/src/gui/molecules/AppBars/LeftSidebar/LeftSidebar.tsx +511 -0
- package/src/gui/molecules/AppBars/LeftSidebar/SidebarToggleButton.tsx +51 -0
- package/src/gui/molecules/AppBars/RightSidebar/RightSidebar.resolver.tsx +97 -0
- package/src/gui/molecules/AppBars/RightSidebar/RightSidebar.stories.tsx +294 -0
- package/src/gui/molecules/AppBars/RightSidebar/RightSidebar.tsx +295 -0
- package/src/gui/molecules/AppBars/StickyOptions/StickyOptionsTop.stories.tsx +480 -0
- package/src/gui/molecules/AppBars/StickyOptions/StickyOptionsTop.tsx +484 -0
- package/src/gui/molecules/AppBars/TopBar/TopBar.resolver.tsx +84 -0
- package/src/gui/molecules/AppBars/TopBar/TopBar.stories.tsx +297 -0
- package/src/gui/molecules/AppBars/TopBar/TopBar.tsx +299 -0
- package/src/gui/molecules/Utilities/ThemeModeToggle/ThemeModeToggle.resolver.tsx +72 -0
- package/src/gui/molecules/Utilities/ThemeModeToggle/ThemeModeToggle.stories.tsx +154 -0
- package/src/gui/molecules/Utilities/ThemeModeToggle/ThemeModeToggle.tsx +100 -0
- package/src/gui/molecules/Utilities/ThemeSelector.jsx +281 -0
- package/src/gui/utils/nodeID.ts +8 -0
- package/src/index.js +111 -0
- package/src/registry/GuiRegistry.ts +19 -0
- package/src/registry/factory.ts +12 -0
- package/src/registry/index.ts +3 -0
- package/src/registry/types.ts +6 -0
- package/src/stories/01.Home.mdx +22 -0
- package/src/stories/02.Understanding.This.GUI.md +149 -0
- package/src/stories/03.Themes.mdx +235 -0
- package/src/stories/04.GuiProvider.md +126 -0
- package/src/stories/04.GuiProvider.mdx +129 -0
- package/src/stories/Theme/BreakPointsAndGrids.stories.jsx +185 -0
- package/src/stories/Theme/Colors.stories.jsx +245 -0
- package/src/stories/Theme/Icons.stories.jsx +313 -0
- package/src/stories/Theme/Motion.stories.jsx +206 -0
- package/src/stories/Theme/ShadowAndElevation.stories.jsx +95 -0
- package/src/stories/Theme/SpacingAndRadius.stories.jsx +129 -0
- package/src/stories/Theme/Typography.stories.jsx +211 -0
- package/src/stories/assets/this.GUI.png +0 -0
- package/src/templates/BrowserExtension.jsx +56 -0
- package/src/templates/Layout.tsx +36 -0
- package/src/templates/Minimal.jsx +123 -0
- package/src/templates/Shell/Shell.jsx +107 -0
- package/src/themes/fromTokens.ts +352 -0
- package/src/themes/icons/Icon.tsx +137 -0
- package/src/themes/icons/packs/Lucide.ts +72 -0
- package/src/themes/icons/packs/Material.ts +87 -0
- package/src/themes/icons/registry.tsx +178 -0
- package/src/themes/index.js +116 -0
- package/src/themes/theme.d.ts +116 -0
- package/src/themes/tokens/global.tokens.json +107 -0
- package/src/themes/tokens/neurons/dark.tokens.json +45 -0
- package/src/themes/tokens/neurons/light.tokens.json +51 -0
- package/src/themes/tokens/neurons/manifest.json +23 -0
- package/src/types/theme.d.ts +32 -0
- package/src/types/viewport.ts +132 -0
- package/tsconfig.json +24 -0
- package/vite.config.js +74 -0
- package/dist/style.css +0 -1
- package/src/App.jsx +0 -63
- package/src/MdxProvider.jsx +0 -20
- package/src/Page.jsx +0 -28
- package/src/SiteBuilder.jsx +0 -39
- package/src/example.json +0 -43
- package/src/index.mdx +0 -164
- package/src/main.jsx +0 -15
- package/src/scripts/ComponentRegistry.js +0 -70
- package/src/scripts/logASCIIArt.js +0 -12
- package/src/scripts/postinstall.js +0 -100
- package/src/scripts/renderComponents.js +0 -11
- package/src/stories/Atoms/Alert/Alert.css +0 -211
- package/src/stories/Atoms/Alert/Alert.jsx +0 -56
- package/src/stories/Atoms/Alert/Alert.stories.jsx +0 -167
- package/src/stories/Atoms/Audio/Audio.css +0 -259
- package/src/stories/Atoms/Audio/Audio.jsx +0 -216
- package/src/stories/Atoms/Audio/Audio.stories.jsx +0 -191
- package/src/stories/Atoms/Badge/Badge.css +0 -249
- package/src/stories/Atoms/Badge/Badge.jsx +0 -54
- package/src/stories/Atoms/Badge/Badge.stories.jsx +0 -121
- package/src/stories/Atoms/Button/Button.css +0 -131
- package/src/stories/Atoms/Button/Button.jsx +0 -47
- package/src/stories/Atoms/Button/Button.stories.jsx +0 -184
- package/src/stories/Atoms/Caption/Caption.css +0 -169
- package/src/stories/Atoms/Caption/Caption.jsx +0 -72
- package/src/stories/Atoms/Caption/Caption.stories.jsx +0 -207
- package/src/stories/Atoms/Checkbox/Checkbox.css +0 -182
- package/src/stories/Atoms/Checkbox/Checkbox.jsx +0 -83
- package/src/stories/Atoms/Checkbox/Checkbox.stories.jsx +0 -112
- package/src/stories/Atoms/Container/Container.css +0 -89
- package/src/stories/Atoms/Container/Container.jsx +0 -54
- package/src/stories/Atoms/Container/Container.stories.jsx +0 -104
- package/src/stories/Atoms/Divider/Divider.css +0 -147
- package/src/stories/Atoms/Divider/Divider.jsx +0 -62
- package/src/stories/Atoms/Divider/Divider.stories.jsx +0 -105
- package/src/stories/Atoms/Grid/Grid.css +0 -160
- package/src/stories/Atoms/Grid/Grid.jsx +0 -43
- package/src/stories/Atoms/Grid/Grid.stories.jsx +0 -84
- package/src/stories/Atoms/Heading/Heading.css +0 -112
- package/src/stories/Atoms/Heading/Heading.jsx +0 -69
- package/src/stories/Atoms/Heading/Heading.stories.jsx +0 -130
- package/src/stories/Atoms/Icon/Icon.css +0 -240
- package/src/stories/Atoms/Icon/Icon.jsx +0 -80
- package/src/stories/Atoms/Icon/Icon.stories.jsx +0 -177
- package/src/stories/Atoms/Image/Image.css +0 -245
- package/src/stories/Atoms/Image/Image.jsx +0 -175
- package/src/stories/Atoms/Image/Image.stories.jsx +0 -332
- package/src/stories/Atoms/Label/Label.css +0 -171
- package/src/stories/Atoms/Label/Label.jsx +0 -71
- package/src/stories/Atoms/Label/Label.stories.jsx +0 -180
- package/src/stories/Atoms/Link/Link.css +0 -71
- package/src/stories/Atoms/Link/Link.jsx +0 -82
- package/src/stories/Atoms/Link/Link.stories.jsx +0 -153
- package/src/stories/Atoms/Loader/Loader.css +0 -106
- package/src/stories/Atoms/Loader/Loader.jsx +0 -58
- package/src/stories/Atoms/Loader/Loader.stories.jsx +0 -99
- package/src/stories/Atoms/Logo/Logo.css +0 -94
- package/src/stories/Atoms/Logo/Logo.jsx +0 -53
- package/src/stories/Atoms/Logo/Logo.stories.jsx +0 -120
- package/src/stories/Atoms/Paragraph/Paragraph.css +0 -180
- package/src/stories/Atoms/Paragraph/Paragraph.jsx +0 -77
- package/src/stories/Atoms/Paragraph/Paragraph.stories.jsx +0 -143
- package/src/stories/Atoms/ProgressBar/ProgressBar.css +0 -127
- package/src/stories/Atoms/ProgressBar/ProgressBar.jsx +0 -40
- package/src/stories/Atoms/ProgressBar/ProgressBar.stories.jsx +0 -86
- package/src/stories/Atoms/RadioButton/RadioButton.css +0 -130
- package/src/stories/Atoms/RadioButton/RadioButton.jsx +0 -87
- package/src/stories/Atoms/RadioButton/RadioButton.stories.jsx +0 -113
- package/src/stories/Atoms/Range/Range.css +0 -169
- package/src/stories/Atoms/Range/Range.jsx +0 -87
- package/src/stories/Atoms/Range/Range.stories.jsx +0 -110
- package/src/stories/Atoms/Section/Section.css +0 -268
- package/src/stories/Atoms/Section/Section.jsx +0 -63
- package/src/stories/Atoms/Section/Section.stories.jsx +0 -46
- package/src/stories/Atoms/Select/Select.css +0 -87
- package/src/stories/Atoms/Select/Select.jsx +0 -73
- package/src/stories/Atoms/Select/Select.stories.jsx +0 -109
- package/src/stories/Atoms/Slider/Slider.css +0 -90
- package/src/stories/Atoms/Slider/Slider.jsx +0 -129
- package/src/stories/Atoms/Slider/Slider.stories.jsx +0 -90
- package/src/stories/Atoms/Snackbar/Snackbar.css +0 -313
- package/src/stories/Atoms/Snackbar/Snackbar.jsx +0 -72
- package/src/stories/Atoms/Snackbar/Snackbar.stories.jsx +0 -78
- package/src/stories/Atoms/Spacer/Spacer.css +0 -114
- package/src/stories/Atoms/Spacer/Spacer.jsx +0 -35
- package/src/stories/Atoms/Spacer/Spacer.stories.jsx +0 -61
- package/src/stories/Atoms/Spinner/Spinner.css +0 -110
- package/src/stories/Atoms/Spinner/Spinner.jsx +0 -65
- package/src/stories/Atoms/Spinner/Spinner.stories.jsx +0 -58
- package/src/stories/Atoms/Tag/Tag.css +0 -112
- package/src/stories/Atoms/Tag/Tag.jsx +0 -75
- package/src/stories/Atoms/Tag/Tag.stories.jsx +0 -67
- package/src/stories/Atoms/TextArea/TextArea.css +0 -99
- package/src/stories/Atoms/TextArea/TextArea.jsx +0 -118
- package/src/stories/Atoms/TextArea/TextArea.stories.jsx +0 -36
- package/src/stories/Atoms/TextInput/TextInput.css +0 -102
- package/src/stories/Atoms/TextInput/TextInput.jsx +0 -133
- package/src/stories/Atoms/TextInput/TextInput.stories.jsx +0 -69
- package/src/stories/Atoms/Toggle/Toggle.css +0 -118
- package/src/stories/Atoms/Toggle/Toggle.jsx +0 -69
- package/src/stories/Atoms/Toggle/Toggle.stories.jsx +0 -35
- package/src/stories/Atoms/Tooltip/Tooltip.css +0 -383
- package/src/stories/Atoms/Tooltip/Tooltip.jsx +0 -46
- package/src/stories/Atoms/Tooltip/Tooltip.stories.jsx +0 -52
- package/src/stories/Atoms/Video/Video.css +0 -39
- package/src/stories/Atoms/Video/Video.jsx +0 -78
- package/src/stories/Atoms/Video/Video.stories.jsx +0 -41
- package/src/stories/Atoms/index.js +0 -72
- package/src/stories/Atoms/meta_Atoms.js +0 -51
- package/src/stories/Components.js +0 -198
- package/src/stories/Getting Started.mdx +0 -239
- package/src/stories/Layouts/Accordion/Accordion.css +0 -293
- package/src/stories/Layouts/Accordion/Accordion.jsx +0 -74
- package/src/stories/Layouts/Accordion/Accordion.stories.jsx +0 -39
- package/src/stories/Layouts/Flexbox/Flexbox.css +0 -16
- package/src/stories/Layouts/Flexbox/Flexbox.jsx +0 -11
- package/src/stories/Layouts/Flexbox/Flexbox.stories.jsx +0 -28
- package/src/stories/Layouts/Footer/Footer.css +0 -16
- package/src/stories/Layouts/Footer/Footer.jsx +0 -31
- package/src/stories/Layouts/Footer/Footer.stories.jsx +0 -28
- package/src/stories/Layouts/Header/Header.css +0 -16
- package/src/stories/Layouts/Header/Header.jsx +0 -31
- package/src/stories/Layouts/Header/Header.stories.jsx +0 -28
- package/src/stories/Layouts/HeroBanner/HeroBanner.css +0 -16
- package/src/stories/Layouts/HeroBanner/HeroBanner.jsx +0 -31
- package/src/stories/Layouts/HeroBanner/HeroBanner.stories.jsx +0 -28
- package/src/stories/Layouts/HeroImageVideo/HeroImageVideo.css +0 -16
- package/src/stories/Layouts/HeroImageVideo/HeroImageVideo.jsx +0 -31
- package/src/stories/Layouts/HeroImageVideo/HeroImageVideo.stories.jsx +0 -28
- package/src/stories/Layouts/Pagination/Pagination.css +0 -16
- package/src/stories/Layouts/Pagination/Pagination.jsx +0 -31
- package/src/stories/Layouts/Pagination/Pagination.stories.jsx +0 -28
- package/src/stories/Layouts/Sidebar/Sidebar.css +0 -16
- package/src/stories/Layouts/Sidebar/Sidebar.jsx +0 -71
- package/src/stories/Layouts/Sidebar/Sidebar.stories.jsx +0 -28
- package/src/stories/Layouts/Tabs/Tabs.css +0 -16
- package/src/stories/Layouts/Tabs/Tabs.jsx +0 -31
- package/src/stories/Layouts/Tabs/Tabs.stories.jsx +0 -28
- package/src/stories/Layouts/index.js +0 -25
- package/src/stories/Layouts/meta_Layouts.js +0 -28
- package/src/stories/MDX.mdx +0 -118
- package/src/stories/Miscellaneous/Miscellaneous.js +0 -24
- package/src/stories/Molecules/Accordion/Accordion.css +0 -4
- package/src/stories/Molecules/Accordion/Accordion.jsx +0 -25
- package/src/stories/Molecules/Accordion/Accordion.stories.jsx +0 -20
- package/src/stories/Molecules/AudioPlayer/AudioPlayer.css +0 -97
- package/src/stories/Molecules/AudioPlayer/AudioPlayer.jsx +0 -244
- package/src/stories/Molecules/AudioPlayer/AudioPlayer.stories.jsx +0 -55
- package/src/stories/Molecules/AvatarWithName/AvatarWithName.css +0 -130
- package/src/stories/Molecules/AvatarWithName/AvatarWithName.jsx +0 -80
- package/src/stories/Molecules/AvatarWithName/AvatarWithName.stories.jsx +0 -20
- package/src/stories/Molecules/Breadcrumbs/Breadcrumbs.css +0 -147
- package/src/stories/Molecules/Breadcrumbs/Breadcrumbs.jsx +0 -51
- package/src/stories/Molecules/Breadcrumbs/Breadcrumbs.stories.jsx +0 -36
- package/src/stories/Molecules/ButtonGroup/ButtonGroup.css +0 -465
- package/src/stories/Molecules/ButtonGroup/ButtonGroup.jsx +0 -47
- package/src/stories/Molecules/ButtonGroup/ButtonGroup.stories.jsx +0 -44
- package/src/stories/Molecules/Card/Card.css +0 -41
- package/src/stories/Molecules/Card/Card.jsx +0 -92
- package/src/stories/Molecules/Card/Card.stories.jsx +0 -34
- package/src/stories/Molecules/ComparisonTable/ComparisonTable.css +0 -35
- package/src/stories/Molecules/ComparisonTable/ComparisonTable.jsx +0 -104
- package/src/stories/Molecules/ComparisonTable/ComparisonTable.stories.jsx +0 -81
- package/src/stories/Molecules/DataTable/DataTable.css +0 -4
- package/src/stories/Molecules/DataTable/DataTable.jsx +0 -25
- package/src/stories/Molecules/DataTable/DataTable.stories.jsx +0 -20
- package/src/stories/Molecules/Dropdown/Dropdown.css +0 -192
- package/src/stories/Molecules/Dropdown/Dropdown.jsx +0 -96
- package/src/stories/Molecules/Dropdown/Dropdown.stories.jsx +0 -45
- package/src/stories/Molecules/FileUpload/FileUpload.css +0 -4
- package/src/stories/Molecules/FileUpload/FileUpload.jsx +0 -25
- package/src/stories/Molecules/FileUpload/FileUpload.stories.jsx +0 -20
- package/src/stories/Molecules/FormField/FormField.css +0 -4
- package/src/stories/Molecules/FormField/FormField.jsx +0 -25
- package/src/stories/Molecules/FormField/FormField.stories.jsx +0 -20
- package/src/stories/Molecules/Header/Header.css +0 -35
- package/src/stories/Molecules/Header/Header.jsx +0 -76
- package/src/stories/Molecules/Header/Header.stories.jsx +0 -28
- package/src/stories/Molecules/IconButton/IconButton.css +0 -4
- package/src/stories/Molecules/IconButton/IconButton.jsx +0 -25
- package/src/stories/Molecules/IconButton/IconButton.stories.jsx +0 -20
- package/src/stories/Molecules/ImageWithCaption/ImageWithCaption.css +0 -4
- package/src/stories/Molecules/ImageWithCaption/ImageWithCaption.jsx +0 -25
- package/src/stories/Molecules/ImageWithCaption/ImageWithCaption.stories.jsx +0 -20
- package/src/stories/Molecules/InputGroup/InputGroup.css +0 -4
- package/src/stories/Molecules/InputGroup/InputGroup.jsx +0 -25
- package/src/stories/Molecules/InputGroup/InputGroup.stories.jsx +0 -20
- package/src/stories/Molecules/InputWithLabel/InputWithLabel.css +0 -4
- package/src/stories/Molecules/InputWithLabel/InputWithLabel.jsx +0 -25
- package/src/stories/Molecules/InputWithLabel/InputWithLabel.stories.jsx +0 -20
- package/src/stories/Molecules/List/List.css +0 -4
- package/src/stories/Molecules/List/List.jsx +0 -25
- package/src/stories/Molecules/List/List.stories.jsx +0 -20
- package/src/stories/Molecules/MediaCard/MediaCard.css +0 -4
- package/src/stories/Molecules/MediaCard/MediaCard.jsx +0 -25
- package/src/stories/Molecules/MediaCard/MediaCard.stories.jsx +0 -20
- package/src/stories/Molecules/Modal/Modal.css +0 -4
- package/src/stories/Molecules/Modal/Modal.jsx +0 -25
- package/src/stories/Molecules/Modal/Modal.stories.jsx +0 -20
- package/src/stories/Molecules/Navbar/Navbar.css +0 -91
- package/src/stories/Molecules/Navbar/Navbar.jsx +0 -82
- package/src/stories/Molecules/Navbar/Navbar.stories.jsx +0 -70
- package/src/stories/Molecules/Notification/Notification.css +0 -4
- package/src/stories/Molecules/Notification/Notification.jsx +0 -25
- package/src/stories/Molecules/Notification/Notification.stories.jsx +0 -20
- package/src/stories/Molecules/PricingTable/PricingTable.css +0 -4
- package/src/stories/Molecules/PricingTable/PricingTable.jsx +0 -25
- package/src/stories/Molecules/PricingTable/PricingTable.stories.jsx +0 -20
- package/src/stories/Molecules/SearchBar/SearchBar.css +0 -69
- package/src/stories/Molecules/SearchBar/SearchBar.jsx +0 -73
- package/src/stories/Molecules/SearchBar/SearchBar.stories.jsx +0 -29
- package/src/stories/Molecules/SelectTheme/SelectTheme.css +0 -25
- package/src/stories/Molecules/SelectTheme/SelectTheme.jsx +0 -22
- package/src/stories/Molecules/SelectTheme/SelectTheme.stories.jsx +0 -24
- package/src/stories/Molecules/Sidebar/Sidebar.css +0 -67
- package/src/stories/Molecules/Sidebar/Sidebar.jsx +0 -80
- package/src/stories/Molecules/Sidebar/Sidebar.stories.jsx +0 -35
- package/src/stories/Molecules/VideoWithDescription/VideoWithDescription.css +0 -4
- package/src/stories/Molecules/VideoWithDescription/VideoWithDescription.jsx +0 -25
- package/src/stories/Molecules/VideoWithDescription/VideoWithDescription.stories.jsx +0 -20
- package/src/stories/Molecules/index.js +0 -58
- package/src/stories/Molecules/meta_Molecules.js +0 -47
- package/src/stories/Organisms/Profile/UserFriends/UserFriends.context.jsx +0 -15
- package/src/stories/Organisms/Profile/UserFriends/UserFriends.css +0 -4
- package/src/stories/Organisms/Profile/UserFriends/UserFriends.jsx +0 -13
- package/src/stories/Organisms/Profile/UserFriends/UserFriends.stories.jsx +0 -26
- package/src/stories/Organisms/Profile/UserPosts/UserPosts.context.jsx +0 -15
- package/src/stories/Organisms/Profile/UserPosts/UserPosts.css +0 -4
- package/src/stories/Organisms/Profile/UserPosts/UserPosts.jsx +0 -13
- package/src/stories/Organisms/Profile/UserPosts/UserPosts.stories.jsx +0 -26
- package/src/stories/Organisms/Profile/UserProfile/UserProfile.context.jsx +0 -15
- package/src/stories/Organisms/Profile/UserProfile/UserProfile.css +0 -4
- package/src/stories/Organisms/Profile/UserProfile/UserProfile.jsx +0 -13
- package/src/stories/Organisms/Profile/UserProfile/UserProfile.stories.jsx +0 -26
- package/src/stories/Organisms/meta_Organisms.js +0 -39
- package/src/stories/Pages/Page/Page.css +0 -69
- package/src/stories/Pages/Page/Page.jsx +0 -69
- package/src/stories/Pages/Page/Page.stories.js +0 -26
- package/src/stories/Pages/Page/Pages.js +0 -31
- package/src/stories/Templates/AdminDashboard/AdminDashboard.css +0 -7
- package/src/stories/Templates/AdminDashboard/AdminDashboard.jsx +0 -24
- package/src/stories/Templates/AdminDashboard/AdminDashboard.stories.jsx +0 -20
- package/src/stories/Templates/CallToAction/CallToAction.css +0 -7
- package/src/stories/Templates/CallToAction/CallToAction.jsx +0 -24
- package/src/stories/Templates/CallToAction/CallToAction.stories.jsx +0 -20
- package/src/stories/Templates/FeaturesList/FeaturesList.css +0 -7
- package/src/stories/Templates/FeaturesList/FeaturesList.jsx +0 -24
- package/src/stories/Templates/FeaturesList/FeaturesList.stories.jsx +0 -20
- package/src/stories/Templates/FormSection/FormSection.css +0 -7
- package/src/stories/Templates/FormSection/FormSection.jsx +0 -24
- package/src/stories/Templates/FormSection/FormSection.stories.jsx +0 -20
- package/src/stories/Templates/HeroSection/HeroSection.css +0 -7
- package/src/stories/Templates/HeroSection/HeroSection.jsx +0 -24
- package/src/stories/Templates/HeroSection/HeroSection.stories.jsx +0 -20
- package/src/stories/Templates/LocationInfo/LocationInfo.css +0 -7
- package/src/stories/Templates/LocationInfo/LocationInfo.jsx +0 -24
- package/src/stories/Templates/LocationInfo/LocationInfo.stories.jsx +0 -20
- package/src/stories/Templates/ProductPage/ProductPage.css +0 -7
- package/src/stories/Templates/ProductPage/ProductPage.jsx +0 -24
- package/src/stories/Templates/ProductPage/ProductPage.stories.jsx +0 -20
- package/src/stories/Templates/RegistrationPage/RegistrationPage.css +0 -7
- package/src/stories/Templates/RegistrationPage/RegistrationPage.jsx +0 -24
- package/src/stories/Templates/RegistrationPage/RegistrationPage.stories.jsx +0 -20
- package/src/stories/Templates/ShoppingCart/ShoppingCart.css +0 -7
- package/src/stories/Templates/ShoppingCart/ShoppingCart.jsx +0 -24
- package/src/stories/Templates/ShoppingCart/ShoppingCart.stories.jsx +0 -20
- package/src/stories/Templates/SidebarTopNav/SidebarTopNav.css +0 -7
- package/src/stories/Templates/SidebarTopNav/SidebarTopNav.jsx +0 -24
- package/src/stories/Templates/SidebarTopNav/SidebarTopNav.stories.jsx +0 -20
- package/src/stories/Templates/SignInPage/SignInPage.css +0 -7
- package/src/stories/Templates/SignInPage/SignInPage.jsx +0 -24
- package/src/stories/Templates/SignInPage/SignInPage.stories.jsx +0 -20
- package/src/stories/Templates/SocialMediaLinks/SocialMediaLinks.css +0 -7
- package/src/stories/Templates/SocialMediaLinks/SocialMediaLinks.jsx +0 -24
- package/src/stories/Templates/SocialMediaLinks/SocialMediaLinks.stories.jsx +0 -20
- package/src/stories/Templates/Testimonials/Testimonials.css +0 -7
- package/src/stories/Templates/Testimonials/Testimonials.jsx +0 -24
- package/src/stories/Templates/Testimonials/Testimonials.stories.jsx +0 -20
- package/src/stories/Templates/index.js +0 -33
- package/src/stories/Templates/meta_Templates.js +0 -29
- package/src/stories/assets/accessibility.png +0 -0
- package/src/stories/assets/accessibility.svg +0 -1
- package/src/stories/assets/addon-library.png +0 -0
- package/src/stories/assets/assets.png +0 -0
- package/src/stories/assets/avif-test-image.avif +0 -0
- package/src/stories/assets/context.png +0 -0
- package/src/stories/assets/discord.svg +0 -1
- package/src/stories/assets/docs.png +0 -0
- package/src/stories/assets/figma-plugin.png +0 -0
- package/src/stories/assets/github.svg +0 -1
- package/src/stories/assets/logo.png +0 -0
- package/src/stories/assets/logo.svg +0 -106
- package/src/stories/assets/share.png +0 -0
- package/src/stories/assets/styling.png +0 -0
- package/src/stories/assets/test.svg +0 -3
- package/src/stories/assets/testing.png +0 -0
- package/src/stories/assets/theming.png +0 -0
- package/src/stories/assets/tutorials.svg +0 -1
- package/src/stories/assets/youtube.svg +0 -1
- package/src/themes/README_Styles.md +0 -301
- package/src/themes/ThemeProvider.jsx +0 -61
- package/src/themes/styles/github/dark.css +0 -0
- package/src/themes/styles/github/light.css +0 -0
- package/src/themes/styles/neurons/dark.css +0 -247
- package/src/themes/styles/neurons/light.css +0 -280
- /package/{src/themes/styles/dracula/dark.css → .storybook/preview-head.html} +0 -0
- /package/src/{themes/styles/dracula/light.css → components/this.me/MeCard.jsx} +0 -0
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
3
|
+
import Menu from './Menu';
|
|
4
|
+
import { MemoryRouter } from 'react-router-dom';
|
|
5
|
+
import GuiProvider from '@/context/GuiProvider';
|
|
6
|
+
import Button from '@mui/material/Button';
|
|
7
|
+
import MenuItem from '@mui/material/MenuItem';
|
|
8
|
+
|
|
9
|
+
const meta: Meta<typeof Menu> = {
|
|
10
|
+
title: 'Atoms/Menu',
|
|
11
|
+
component: Menu,
|
|
12
|
+
tags: ['autodocs'],
|
|
13
|
+
decorators: [
|
|
14
|
+
(Story) => (
|
|
15
|
+
<MemoryRouter>
|
|
16
|
+
<GuiProvider>
|
|
17
|
+
<div style={{ padding: 16, minHeight: 260 }}>
|
|
18
|
+
<Story />
|
|
19
|
+
</div>
|
|
20
|
+
</GuiProvider>
|
|
21
|
+
</MemoryRouter>
|
|
22
|
+
),
|
|
23
|
+
],
|
|
24
|
+
parameters: {
|
|
25
|
+
docs: {
|
|
26
|
+
description: {
|
|
27
|
+
component: `
|
|
28
|
+
The **Menu** atom is a thin wrapper around MUI's \`MuiMenu\`. It supports **granular styling** via:
|
|
29
|
+
- \`sx\` — root popover/menu container
|
|
30
|
+
- \`paperSx\` — Paper slot
|
|
31
|
+
- \`listSx\` — MenuList slot
|
|
32
|
+
|
|
33
|
+
You can also pass \`PaperProps\` and \`MenuListProps\`; their \`sx\` are **merged** with \`paperSx\`/\`listSx\`.
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
## Basic usage
|
|
37
|
+
~~~jsx
|
|
38
|
+
const [anchorEl, setAnchorEl] = React.useState<null | HTMLElement>(null);
|
|
39
|
+
const open = Boolean(anchorEl);
|
|
40
|
+
|
|
41
|
+
<Button onClick={(e) => setAnchorEl(e.currentTarget)}>Open menu</Button>
|
|
42
|
+
<Menu open={open} anchorEl={anchorEl} onClose={() => setAnchorEl(null)}>
|
|
43
|
+
<MenuItem onClick={() => setAnchorEl(null)}>Profile</MenuItem>
|
|
44
|
+
<MenuItem onClick={() => setAnchorEl(null)}>Settings</MenuItem>
|
|
45
|
+
</Menu>
|
|
46
|
+
~~~
|
|
47
|
+
|
|
48
|
+
## Granular styling
|
|
49
|
+
~~~jsx
|
|
50
|
+
<Menu
|
|
51
|
+
open={open}
|
|
52
|
+
anchorEl={anchorEl}
|
|
53
|
+
onClose={handleClose}
|
|
54
|
+
sx={{ mt: 1 }}
|
|
55
|
+
paperSx={{ borderRadius: 10 }}
|
|
56
|
+
listSx={{ py: 0.5 }}
|
|
57
|
+
PaperProps={{ elevation: 3 }}
|
|
58
|
+
/>
|
|
59
|
+
~~~
|
|
60
|
+
|
|
61
|
+
## Declarative JSON / Resolver
|
|
62
|
+
~~~json
|
|
63
|
+
{
|
|
64
|
+
"type": "Menu",
|
|
65
|
+
"props": {
|
|
66
|
+
"open": true,
|
|
67
|
+
"sx": { "mt": 1 },
|
|
68
|
+
"paperSx": { "borderRadius": 10 },
|
|
69
|
+
"listSx": { "py": 0.5 },
|
|
70
|
+
"PaperProps": { "elevation": 3 },
|
|
71
|
+
"children": [
|
|
72
|
+
{ "type": "MenuItem", "props": { "children": "Profile" } },
|
|
73
|
+
{ "type": "MenuItem", "props": { "children": "Settings" } }
|
|
74
|
+
]
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
~~~
|
|
78
|
+
|
|
79
|
+
*Note:* \`anchorEl\` is a runtime element reference and is typically provided by the renderer/context in declarative mode.
|
|
80
|
+
`,
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
controls: {
|
|
84
|
+
exclude: ['anchorEl', 'PaperProps', 'MenuListProps'],
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
argTypes: {
|
|
88
|
+
open: { control: 'boolean' },
|
|
89
|
+
keepMounted: { control: 'boolean' },
|
|
90
|
+
variant: { control: { type: 'radio' }, options: ['menu', 'selectedMenu'] },
|
|
91
|
+
elevation: { control: { type: 'number', min: 0, max: 24, step: 1 } },
|
|
92
|
+
sx: { control: 'object' },
|
|
93
|
+
},
|
|
94
|
+
args: {
|
|
95
|
+
open: false, // controlled within each story with local state
|
|
96
|
+
keepMounted: false,
|
|
97
|
+
variant: 'menu',
|
|
98
|
+
elevation: 1,
|
|
99
|
+
sx: {},
|
|
100
|
+
children: undefined,
|
|
101
|
+
},
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
export default meta;
|
|
105
|
+
type Story = StoryObj<typeof Menu>;
|
|
106
|
+
|
|
107
|
+
// Reusable demo component that owns anchor state but forwards args
|
|
108
|
+
const DemoMenu: React.FC<React.ComponentProps<typeof Menu>> = (props) => {
|
|
109
|
+
const [anchorEl, setAnchorEl] = React.useState<null | HTMLElement>(null);
|
|
110
|
+
const open = Boolean(anchorEl);
|
|
111
|
+
const handleOpen = (e: React.MouseEvent<HTMLButtonElement>) => setAnchorEl(e.currentTarget);
|
|
112
|
+
const handleClose = () => setAnchorEl(null);
|
|
113
|
+
return (
|
|
114
|
+
<>
|
|
115
|
+
<Button variant="outlined" onClick={handleOpen} data-testid="open-menu">
|
|
116
|
+
Open Menu
|
|
117
|
+
</Button>
|
|
118
|
+
<Menu
|
|
119
|
+
{...props}
|
|
120
|
+
open={open}
|
|
121
|
+
anchorEl={anchorEl}
|
|
122
|
+
onClose={handleClose}
|
|
123
|
+
onClick={handleClose}
|
|
124
|
+
>
|
|
125
|
+
{props.children ?? (
|
|
126
|
+
<>
|
|
127
|
+
<MenuItem onClick={handleClose}>Profile</MenuItem>
|
|
128
|
+
<MenuItem onClick={handleClose}>My account</MenuItem>
|
|
129
|
+
<MenuItem onClick={handleClose}>Logout</MenuItem>
|
|
130
|
+
</>
|
|
131
|
+
)}
|
|
132
|
+
</Menu>
|
|
133
|
+
</>
|
|
134
|
+
);
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
// ======================= Stories =======================
|
|
138
|
+
export const Playground: Story = {
|
|
139
|
+
render: (args) => <DemoMenu {...args} />,
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
export const WithPaperAndListSx: Story = {
|
|
143
|
+
args: {
|
|
144
|
+
sx: { mt: 1 },
|
|
145
|
+
},
|
|
146
|
+
render: (args) => (
|
|
147
|
+
<DemoMenu
|
|
148
|
+
{...args}
|
|
149
|
+
PaperProps={{ elevation: 2, sx: { borderRadius: 2 } }}
|
|
150
|
+
MenuListProps={{ sx: { py: 0.5 } }}
|
|
151
|
+
/>
|
|
152
|
+
),
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
export const KeepMounted: Story = {
|
|
156
|
+
args: { keepMounted: true },
|
|
157
|
+
render: (args) => <DemoMenu {...args} />,
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
export const CustomOrigins: Story = {
|
|
161
|
+
args: {
|
|
162
|
+
sx: { mt: 1 },
|
|
163
|
+
// Showcase custom anchor/transform origins
|
|
164
|
+
anchorOrigin: { vertical: 'bottom', horizontal: 'left' },
|
|
165
|
+
transformOrigin: { vertical: 'top', horizontal: 'left' },
|
|
166
|
+
},
|
|
167
|
+
render: (args) => <DemoMenu {...args} />,
|
|
168
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* This.GUI — Menu
|
|
3
|
+
* Thin wrapper that preserves MUI's own typing and API.
|
|
4
|
+
* Examples:
|
|
5
|
+
* <Menu open={open} onClose={handleClose} anchorEl={anchorEl}>
|
|
6
|
+
* {children}
|
|
7
|
+
* </Menu>
|
|
8
|
+
*/
|
|
9
|
+
import MuiMenu from '@mui/material/Menu';
|
|
10
|
+
import * as React from 'react';
|
|
11
|
+
|
|
12
|
+
// Re-export using MUI's own component type to keep full typing
|
|
13
|
+
const Menu = MuiMenu;
|
|
14
|
+
export type MenuProps = React.ComponentProps<typeof Menu>;
|
|
15
|
+
|
|
16
|
+
(Menu as any).displayName = 'Gui.Menu';
|
|
17
|
+
export default Menu;
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
// src/gui/atoms/MenuItem/MenuItem.resolver.tsx
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import MenuItem from './MenuItem';
|
|
4
|
+
import Link from '../Link/Link';
|
|
5
|
+
import Icon from '@/themes/icons/Icon';
|
|
6
|
+
import ListItemIcon from '@mui/material/ListItemIcon';
|
|
7
|
+
import ListItemText from '@mui/material/ListItemText';
|
|
8
|
+
import type { RegistryEntry, ResolveCtx } from '@/registry/types';
|
|
9
|
+
import type { SxProps, Theme } from '@mui/material/styles';
|
|
10
|
+
import type { ListItemIconProps as MuiListItemIconProps } from '@mui/material/ListItemIcon';
|
|
11
|
+
import type { ListItemTextProps as MuiListItemTextProps } from '@mui/material/ListItemText';
|
|
12
|
+
import { ensureNodeId } from '@/gui/utils/nodeID';
|
|
13
|
+
|
|
14
|
+
// Merge sx parts into a single SxProps (filters out undefined)
|
|
15
|
+
const sxJoin = (...parts: Array<SxProps<Theme> | undefined>): SxProps<Theme> =>
|
|
16
|
+
(parts.filter(Boolean) as unknown) as SxProps<Theme>;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Declarative spec for MenuItem
|
|
20
|
+
*
|
|
21
|
+
* Notes
|
|
22
|
+
* - Wraps MUI's MenuItem (supports `component` polymorphism).
|
|
23
|
+
* - Declarative sugar:
|
|
24
|
+
* - `label` / `secondary` map to `<ListItemText primary/secondary />`
|
|
25
|
+
* - `startIcon` accepts a token (e.g., "mui:Settings", "lucide:mail") or a React node
|
|
26
|
+
* - Granular styling:
|
|
27
|
+
* - `sx` (root MenuItem)
|
|
28
|
+
* - `iconSx` (ListItemIcon)
|
|
29
|
+
* - `textSx` (ListItemText)
|
|
30
|
+
* - Slot props passthrough:
|
|
31
|
+
* - `ListItemIconProps`, `ListItemTextProps` (their `sx` are merged with iconSx/textSx)
|
|
32
|
+
*/
|
|
33
|
+
export type MenuItemSpec = {
|
|
34
|
+
type: 'MenuItem';
|
|
35
|
+
props?: {
|
|
36
|
+
children?: React.ReactNode;
|
|
37
|
+
|
|
38
|
+
// Polymorphism / routing
|
|
39
|
+
component?: any; // 'li' | 'a' | Link | custom
|
|
40
|
+
as?: any; // alias for component
|
|
41
|
+
to?: string; // router target (when component={Link})
|
|
42
|
+
href?: string; // anchor target (when component='a')
|
|
43
|
+
external?: boolean; // force external anchor
|
|
44
|
+
target?: React.HTMLAttributeAnchorTarget;
|
|
45
|
+
rel?: string;
|
|
46
|
+
|
|
47
|
+
// Sugar
|
|
48
|
+
label?: React.ReactNode | string;
|
|
49
|
+
secondary?: React.ReactNode | string;
|
|
50
|
+
startIcon?: React.ReactNode | string;
|
|
51
|
+
iconColor?: string;
|
|
52
|
+
|
|
53
|
+
// Core MenuItem props (subset; others passthrough)
|
|
54
|
+
dense?: boolean;
|
|
55
|
+
disabled?: boolean;
|
|
56
|
+
divider?: boolean;
|
|
57
|
+
selected?: boolean;
|
|
58
|
+
autoFocus?: boolean;
|
|
59
|
+
|
|
60
|
+
// Granular styling
|
|
61
|
+
sx?: SxProps<Theme>; // root
|
|
62
|
+
iconSx?: SxProps<Theme>; // ListItemIcon
|
|
63
|
+
textSx?: SxProps<Theme>; // ListItemText
|
|
64
|
+
|
|
65
|
+
// Slot props passthrough
|
|
66
|
+
ListItemIconProps?: MuiListItemIconProps;
|
|
67
|
+
ListItemTextProps?: MuiListItemTextProps;
|
|
68
|
+
|
|
69
|
+
// Misc
|
|
70
|
+
id?: string;
|
|
71
|
+
className?: string;
|
|
72
|
+
'data-testid'?: string;
|
|
73
|
+
'data-gui-id'?: string;
|
|
74
|
+
|
|
75
|
+
// Allow arbitrary passthrough
|
|
76
|
+
[key: string]: any;
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
function renderDeclarativeIcon(node: React.ReactNode | string | undefined, iconColor?: string) {
|
|
81
|
+
if (!node) return null;
|
|
82
|
+
if (typeof node === 'string') return <Icon name={node} iconColor={iconColor} size={20} />;
|
|
83
|
+
return node;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
function coerceComponent(comp: any) {
|
|
87
|
+
// allow declarative string token "Link" to map to our Link component
|
|
88
|
+
if (comp === 'Link') return Link;
|
|
89
|
+
return comp;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
const MenuItemResolver: RegistryEntry = {
|
|
93
|
+
type: 'MenuItem',
|
|
94
|
+
resolve(spec: MenuItemSpec, _ctx?: ResolveCtx) {
|
|
95
|
+
const p = spec.props ?? {};
|
|
96
|
+
|
|
97
|
+
const providedDataGuiId = p['data-gui-id'];
|
|
98
|
+
|
|
99
|
+
// Decide polymorphic target
|
|
100
|
+
const component = coerceComponent(p.component ?? p.as ?? (p.to ? Link : p.external ? 'a' : undefined));
|
|
101
|
+
|
|
102
|
+
// Routing/anchor props
|
|
103
|
+
const routingProps =
|
|
104
|
+
component === 'a' || p.external
|
|
105
|
+
? {
|
|
106
|
+
href: p.href,
|
|
107
|
+
target: p.target ?? (p.external ? '_blank' : undefined),
|
|
108
|
+
rel: p.rel ?? (p.external ? 'noopener noreferrer' : undefined),
|
|
109
|
+
}
|
|
110
|
+
: component === Link || (p.to && !p.component)
|
|
111
|
+
? { to: p.to }
|
|
112
|
+
: {};
|
|
113
|
+
|
|
114
|
+
const {
|
|
115
|
+
children,
|
|
116
|
+
label,
|
|
117
|
+
secondary,
|
|
118
|
+
startIcon,
|
|
119
|
+
iconColor,
|
|
120
|
+
ListItemIconProps,
|
|
121
|
+
ListItemTextProps,
|
|
122
|
+
// strip resolver-only keys
|
|
123
|
+
as: _as,
|
|
124
|
+
external: _external,
|
|
125
|
+
to: _to,
|
|
126
|
+
href: _href,
|
|
127
|
+
target: _target,
|
|
128
|
+
rel: _rel,
|
|
129
|
+
'data-gui-id': _dataGuiId,
|
|
130
|
+
...rest
|
|
131
|
+
} = p;
|
|
132
|
+
|
|
133
|
+
const iconNode = renderDeclarativeIcon(startIcon, iconColor);
|
|
134
|
+
const hasTextBlock = label != null || secondary != null;
|
|
135
|
+
|
|
136
|
+
// Merge sx for ListItemIcon/Text if provided both via shorthand and slot props
|
|
137
|
+
const mergedIconSx = (p.iconSx || ListItemIconProps?.sx)
|
|
138
|
+
? sxJoin(p.iconSx, ListItemIconProps?.sx as SxProps<Theme>)
|
|
139
|
+
: undefined;
|
|
140
|
+
|
|
141
|
+
const mergedTextSx = (p.textSx || ListItemTextProps?.sx)
|
|
142
|
+
? sxJoin(p.textSx, ListItemTextProps?.sx as SxProps<Theme>)
|
|
143
|
+
: undefined;
|
|
144
|
+
|
|
145
|
+
const finalIconProps: MuiListItemIconProps | undefined = iconNode
|
|
146
|
+
? {
|
|
147
|
+
...(ListItemIconProps || {}),
|
|
148
|
+
...(mergedIconSx ? { sx: mergedIconSx } : {}),
|
|
149
|
+
}
|
|
150
|
+
: undefined;
|
|
151
|
+
|
|
152
|
+
const finalTextProps: MuiListItemTextProps | undefined = hasTextBlock
|
|
153
|
+
? {
|
|
154
|
+
...(ListItemTextProps || {}),
|
|
155
|
+
...(mergedTextSx ? { sx: mergedTextSx } : {}),
|
|
156
|
+
}
|
|
157
|
+
: undefined;
|
|
158
|
+
|
|
159
|
+
const dataGuiId = ensureNodeId('menu-item', providedDataGuiId);
|
|
160
|
+
|
|
161
|
+
return (
|
|
162
|
+
<MenuItem
|
|
163
|
+
component={component}
|
|
164
|
+
sx={p.sx}
|
|
165
|
+
id={p.id}
|
|
166
|
+
className={p.className}
|
|
167
|
+
data-testid={p['data-testid']}
|
|
168
|
+
data-gui-id={dataGuiId}
|
|
169
|
+
{...routingProps}
|
|
170
|
+
{...rest}
|
|
171
|
+
>
|
|
172
|
+
{iconNode ? <ListItemIcon {...finalIconProps}>{iconNode}</ListItemIcon> : null}
|
|
173
|
+
{hasTextBlock ? (
|
|
174
|
+
<ListItemText primary={label} secondary={secondary} {...finalTextProps} />
|
|
175
|
+
) : (
|
|
176
|
+
children
|
|
177
|
+
)}
|
|
178
|
+
</MenuItem>
|
|
179
|
+
);
|
|
180
|
+
},
|
|
181
|
+
};
|
|
182
|
+
|
|
183
|
+
export default MenuItemResolver;
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
3
|
+
import MenuItem from './MenuItem';
|
|
4
|
+
import Menu from '../Menu/Menu';
|
|
5
|
+
import Button from '@mui/material/Button';
|
|
6
|
+
import { MemoryRouter } from 'react-router-dom';
|
|
7
|
+
import GuiProvider from '@/context/GuiProvider';
|
|
8
|
+
const meta: Meta<typeof MenuItem> = {
|
|
9
|
+
title: 'Atoms/MenuItem',
|
|
10
|
+
component: MenuItem,
|
|
11
|
+
tags: ['autodocs'],
|
|
12
|
+
decorators: [
|
|
13
|
+
(Story) => (
|
|
14
|
+
<MemoryRouter>
|
|
15
|
+
<GuiProvider>
|
|
16
|
+
<div style={{ padding: 16, minHeight: 260 }}>
|
|
17
|
+
<Story />
|
|
18
|
+
</div>
|
|
19
|
+
</GuiProvider>
|
|
20
|
+
</MemoryRouter>
|
|
21
|
+
),
|
|
22
|
+
],
|
|
23
|
+
parameters: {
|
|
24
|
+
docs: {
|
|
25
|
+
description: {
|
|
26
|
+
component: `
|
|
27
|
+
The **MenuItem** atom is a thin wrapper around MUI's \`MuiMenuItem\`.
|
|
28
|
+
|
|
29
|
+
In **declarative** mode (registry), the resolver supports:
|
|
30
|
+
- \`label\` / \`secondary\` → maps to \`<ListItemText primary/secondary />\`
|
|
31
|
+
- \`startIcon\` → token (e.g., \`"mui:Settings"\`, \`"lucide:mail"\`) or React node → renders inside \`<ListItemIcon />\`
|
|
32
|
+
- Granular styling via:
|
|
33
|
+
- \`sx\` (root)
|
|
34
|
+
- \`iconSx\` (ListItemIcon)
|
|
35
|
+
- \`textSx\` (ListItemText)
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
## Declarative JSON / Resolver
|
|
39
|
+
~~~json
|
|
40
|
+
{
|
|
41
|
+
"type": "MenuItem",
|
|
42
|
+
"props": {
|
|
43
|
+
"startIcon": "mui:Settings",
|
|
44
|
+
"label": "Settings",
|
|
45
|
+
"secondary": "Manage your preferences",
|
|
46
|
+
"sx": { "py": 1 },
|
|
47
|
+
"iconSx": { "minWidth": 36 },
|
|
48
|
+
"textSx": { "my": 0 }
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
~~~
|
|
52
|
+
`,
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
controls: {
|
|
56
|
+
exclude: ['component'],
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
argTypes: {
|
|
60
|
+
dense: { control: 'boolean' },
|
|
61
|
+
divider: { control: 'boolean' },
|
|
62
|
+
disabled: { control: 'boolean' },
|
|
63
|
+
selected: { control: 'boolean' },
|
|
64
|
+
sx: { control: 'object' },
|
|
65
|
+
},
|
|
66
|
+
args: {
|
|
67
|
+
dense: false,
|
|
68
|
+
divider: false,
|
|
69
|
+
disabled: false,
|
|
70
|
+
selected: false,
|
|
71
|
+
sx: {},
|
|
72
|
+
children: 'Menu item',
|
|
73
|
+
},
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
export default meta;
|
|
77
|
+
type Story = StoryObj<typeof MenuItem>;
|
|
78
|
+
|
|
79
|
+
// Reusable demo wrapper that controls open/close
|
|
80
|
+
const DemoMenu: React.FC<{ children?: React.ReactNode }> = ({ children }) => {
|
|
81
|
+
const [anchorEl, setAnchorEl] = React.useState<null | HTMLElement>(null);
|
|
82
|
+
const open = Boolean(anchorEl);
|
|
83
|
+
const handleOpen = (e: React.MouseEvent<HTMLButtonElement>) => setAnchorEl(e.currentTarget);
|
|
84
|
+
const handleClose = () => setAnchorEl(null);
|
|
85
|
+
return (
|
|
86
|
+
<>
|
|
87
|
+
<Button variant="outlined" onClick={handleOpen} data-testid="open-menu">
|
|
88
|
+
Open Menu
|
|
89
|
+
</Button>
|
|
90
|
+
<Menu open={open} anchorEl={anchorEl} onClose={handleClose} onClick={handleClose}>
|
|
91
|
+
{children ?? (
|
|
92
|
+
<>
|
|
93
|
+
<MenuItem onClick={handleClose}>Profile</MenuItem>
|
|
94
|
+
<MenuItem onClick={handleClose} selected dense>
|
|
95
|
+
Settings
|
|
96
|
+
</MenuItem>
|
|
97
|
+
<MenuItem onClick={handleClose} disabled>
|
|
98
|
+
Disabled
|
|
99
|
+
</MenuItem>
|
|
100
|
+
</>
|
|
101
|
+
)}
|
|
102
|
+
</Menu>
|
|
103
|
+
</>
|
|
104
|
+
);
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
// ======================= Stories =======================
|
|
108
|
+
export const Playground: Story = {
|
|
109
|
+
render: (args) => (
|
|
110
|
+
<DemoMenu>
|
|
111
|
+
<MenuItem {...args} />
|
|
112
|
+
</DemoMenu>
|
|
113
|
+
),
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
export const States: Story = {
|
|
117
|
+
render: () => (
|
|
118
|
+
<DemoMenu>
|
|
119
|
+
<MenuItem>Default</MenuItem>
|
|
120
|
+
<MenuItem selected>Selected</MenuItem>
|
|
121
|
+
<MenuItem disabled>Disabled</MenuItem>
|
|
122
|
+
<MenuItem dense>Dense</MenuItem>
|
|
123
|
+
</DemoMenu>
|
|
124
|
+
),
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
export const WithCustomChildren: Story = {
|
|
128
|
+
render: () => (
|
|
129
|
+
<DemoMenu>
|
|
130
|
+
<MenuItem>
|
|
131
|
+
<strong>Custom node as children</strong>
|
|
132
|
+
</MenuItem>
|
|
133
|
+
<MenuItem>
|
|
134
|
+
<span style={{ opacity: 0.75 }}>With inline styling</span>
|
|
135
|
+
</MenuItem>
|
|
136
|
+
</DemoMenu>
|
|
137
|
+
),
|
|
138
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* This.GUI — MenuItem
|
|
3
|
+
* Thin wrapper that preserves MUI's own typing and API.
|
|
4
|
+
* Examples:
|
|
5
|
+
* <MenuItem onClick={...}>Profile</MenuItem>
|
|
6
|
+
* <MenuItem selected dense>Settings</MenuItem>
|
|
7
|
+
*/
|
|
8
|
+
import MuiMenuItem from '@mui/material/MenuItem';
|
|
9
|
+
import * as React from 'react';
|
|
10
|
+
// Re-export using MUI's own component type to keep full typing
|
|
11
|
+
const MenuItem = MuiMenuItem;
|
|
12
|
+
export type MenuItemProps = React.ComponentProps<typeof MenuItem>;
|
|
13
|
+
(MenuItem as any).displayName = 'Gui.MenuItem';
|
|
14
|
+
export default MenuItem;
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
// src/gui/atoms/Paper/Paper.resolver.tsx
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import Paper from './Paper';
|
|
4
|
+
import Link from '../Link/Link';
|
|
5
|
+
import type { RegistryEntry, ResolveCtx } from '@/registry/types';
|
|
6
|
+
import { ensureNodeId } from '@/gui/utils/nodeID';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Declarative spec for Paper (polymorphic container)
|
|
10
|
+
*
|
|
11
|
+
* Notes
|
|
12
|
+
* - You can choose the rendered element via `component` (e.g. 'div', 'section', 'a')
|
|
13
|
+
* - If `to` is provided (and no explicit component), the resolver will default to This.GUI `Link`.
|
|
14
|
+
* - If `external` is true (and no explicit component), it will default to an anchor (`'a'`) and apply
|
|
15
|
+
* safe `target`/`rel` defaults.
|
|
16
|
+
* - Supports `sx` and arbitrary system props passthrough.
|
|
17
|
+
*/
|
|
18
|
+
export type PaperSpec = {
|
|
19
|
+
type: 'Paper';
|
|
20
|
+
props?: {
|
|
21
|
+
children?: React.ReactNode;
|
|
22
|
+
|
|
23
|
+
// Polymorphism / routing
|
|
24
|
+
component?: any; // 'div' | 'section' | 'article' | 'a' | Link | custom
|
|
25
|
+
as?: any; // alias for component
|
|
26
|
+
to?: string; // router target (when component={Link})
|
|
27
|
+
href?: string; // anchor target (when component='a')
|
|
28
|
+
external?: boolean; // force external anchor
|
|
29
|
+
target?: React.HTMLAttributeAnchorTarget;
|
|
30
|
+
rel?: string;
|
|
31
|
+
|
|
32
|
+
// MUI Paper core props (subset; rest is passthrough)
|
|
33
|
+
elevation?: number;
|
|
34
|
+
square?: boolean;
|
|
35
|
+
variant?: 'elevation' | 'outlined';
|
|
36
|
+
|
|
37
|
+
// Styling & misc
|
|
38
|
+
sx?: any;
|
|
39
|
+
className?: string;
|
|
40
|
+
id?: string;
|
|
41
|
+
'data-testid'?: string;
|
|
42
|
+
|
|
43
|
+
// Allow system props / arbitrary passthrough (p, m, display, etc.)
|
|
44
|
+
[key: string]: any;
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
const PaperResolver: RegistryEntry = {
|
|
49
|
+
type: 'Paper',
|
|
50
|
+
resolve(spec: PaperSpec, _ctx?: ResolveCtx) {
|
|
51
|
+
const p = spec.props ?? {};
|
|
52
|
+
const nodeId = ensureNodeId('Paper', p.id);
|
|
53
|
+
|
|
54
|
+
// Decide polymorphic target
|
|
55
|
+
const component = p.component ?? p.as ?? (p.to ? Link : p.external ? 'a' : undefined);
|
|
56
|
+
|
|
57
|
+
// Routing/anchor props
|
|
58
|
+
const routingProps =
|
|
59
|
+
component === 'a' || p.external
|
|
60
|
+
? {
|
|
61
|
+
href: p.href,
|
|
62
|
+
target: p.target ?? (p.external ? '_blank' : undefined),
|
|
63
|
+
rel: p.rel ?? (p.external ? 'noopener noreferrer' : undefined),
|
|
64
|
+
}
|
|
65
|
+
: component === Link || (p.to && !p.component)
|
|
66
|
+
? { to: p.to }
|
|
67
|
+
: {};
|
|
68
|
+
|
|
69
|
+
// Collect common props and avoid leaking resolver-only keys
|
|
70
|
+
const {
|
|
71
|
+
children,
|
|
72
|
+
// remove resolver-only keys so they don't end up as DOM attributes
|
|
73
|
+
as: _as,
|
|
74
|
+
external: _external,
|
|
75
|
+
to: _to,
|
|
76
|
+
href: _href,
|
|
77
|
+
target: _target,
|
|
78
|
+
rel: _rel,
|
|
79
|
+
...rest
|
|
80
|
+
} = p;
|
|
81
|
+
|
|
82
|
+
return (
|
|
83
|
+
<Paper
|
|
84
|
+
component={component}
|
|
85
|
+
sx={p.sx}
|
|
86
|
+
id={nodeId}
|
|
87
|
+
className={p.className}
|
|
88
|
+
data-testid={p['data-testid']}
|
|
89
|
+
{...routingProps}
|
|
90
|
+
{...rest}
|
|
91
|
+
>
|
|
92
|
+
{children}
|
|
93
|
+
</Paper>
|
|
94
|
+
);
|
|
95
|
+
},
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
export default PaperResolver;
|