this.gui 1.3.22 → 1.3.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/this-gui.es.js +0 -1
- package/dist/this-gui.umd.js +65 -65
- package/index.ts +3 -2
- package/init/index.html +4 -5
- package/init/package-lock.json +2 -2
- package/init/package.json +1 -1
- package/init/src/App.tsx +24 -0
- package/init/src/index.css +16 -0
- package/init/src/main.tsx +14 -0
- package/init/src/router/DerivableRouter.tsx +36 -0
- package/package.json +1 -1
- package/src/GUI.tsx +15 -0
- package/src/components/generics/Cards/Gridme.jsx +52 -0
- package/src/components/generics/Cards/LilBox.jsx +65 -0
- package/src/components/generics/Cards/ModuleCard.jsx +106 -0
- package/src/components/generics/Chats/FullChatBot.jsx +223 -0
- package/src/components/generics/Code/CodeBlock.jsx +33 -0
- package/src/components/generics/Feedback/Callout.jsx +92 -0
- package/src/components/generics/Layout/GridX.jsx +29 -0
- package/src/components/generics/Layout/Hero2.jsx +132 -0
- package/src/components/generics/Layout/PageContainer.jsx +29 -0
- package/src/components/generics/Layout/PageDivider.jsx +20 -0
- package/src/components/generics/Layout/Section.jsx +43 -0
- package/src/components/generics/Layout/SectionHeader.jsx +21 -0
- package/src/components/generics/Media/Img.jsx +58 -0
- package/src/components/generics/Media/VideoEmbed.jsx +51 -0
- package/src/components/generics/Organization/TableOfContents.jsx +51 -0
- package/src/components/generics/Organization/Tabs.jsx +45 -0
- package/src/components/generics/Text/TextList.jsx +41 -0
- package/src/components/generics/Text/TextParagraph.jsx +28 -0
- package/src/components/generics/Text/TextQuote.jsx +23 -0
- package/src/components/generics/Text/TextTitle.jsx +44 -0
- package/src/gui/Layouts/ResponsiveUI/Content/Content.resolver.tsx +0 -0
- package/src/gui/Layouts/ResponsiveUI/Content/Content.stories.tsx +88 -0
- package/src/gui/Layouts/ResponsiveUI/Content/Content.tsx +53 -0
- package/src/gui/Layouts/ResponsiveUI/Content/Content.types.tsx +40 -0
- package/src/gui/Layouts/ResponsiveUI/Footer/Footer.resolver.tsx +45 -0
- package/src/gui/Layouts/ResponsiveUI/Footer/Footer.stories.tsx +209 -0
- package/src/gui/Layouts/ResponsiveUI/Footer/Footer.tsx +337 -0
- package/src/gui/Layouts/ResponsiveUI/Footer/Footer.types.ts +40 -0
- package/src/gui/Layouts/ResponsiveUI/Layout/Layout.resolver.tsx +37 -0
- package/src/gui/Layouts/ResponsiveUI/Layout/Layout.stories.tsx +290 -0
- package/src/gui/Layouts/ResponsiveUI/Layout/Layout.tsx +112 -0
- package/src/gui/Layouts/ResponsiveUI/Layout/Layout.types.ts +56 -0
- package/src/gui/Layouts/ResponsiveUI/Layout/useLayoutBreakpoints.ts +9 -0
- package/src/gui/Layouts/ResponsiveUI/Sidebars/LeftSidebar/LeftSidebar.resolver.tsx +87 -0
- package/src/gui/Layouts/ResponsiveUI/Sidebars/LeftSidebar/LeftSidebar.stories.tsx +199 -0
- package/src/gui/Layouts/ResponsiveUI/Sidebars/LeftSidebar/LeftSidebar.tsx +311 -0
- package/src/gui/Layouts/ResponsiveUI/Sidebars/LeftSidebar/LeftSidebar.types.ts +41 -0
- package/src/gui/Layouts/ResponsiveUI/Sidebars/LeftSidebar/SidebarToggleButton.tsx +53 -0
- package/src/gui/Layouts/ResponsiveUI/Sidebars/LeftSidebar/components/LeftSidebarAction/LeftSidebarAction.resolver.tsx +19 -0
- package/src/gui/Layouts/ResponsiveUI/Sidebars/LeftSidebar/components/LeftSidebarAction/LeftSidebarAction.tsx +107 -0
- package/src/gui/Layouts/ResponsiveUI/Sidebars/LeftSidebar/components/LeftSidebarLink/LeftSidebarLink.resolver.tsx +0 -0
- package/src/gui/Layouts/ResponsiveUI/Sidebars/LeftSidebar/components/LeftSidebarLink/LeftSidebarLink.tsx +122 -0
- package/src/gui/Layouts/ResponsiveUI/Sidebars/LeftSidebar/components/LeftSidebarLink/LeftSidebarLink.types.ts +13 -0
- package/src/gui/Layouts/ResponsiveUI/Sidebars/LeftSidebar/components/LeftSidebarMenu/LeftSidebarMenu.tsx +142 -0
- package/src/gui/Layouts/ResponsiveUI/Sidebars/LeftSidebar/components/LeftSidebarToggleButton/LeftSidebarToggleButton.tsx +23 -0
- package/src/gui/Layouts/ResponsiveUI/Sidebars/RightSidebar/RightSidebar.resolver.tsx +35 -0
- package/src/gui/Layouts/ResponsiveUI/Sidebars/RightSidebar/RightSidebar.stories.tsx +240 -0
- package/src/gui/Layouts/ResponsiveUI/Sidebars/RightSidebar/RightSidebar.tsx +319 -0
- package/src/gui/Layouts/ResponsiveUI/Sidebars/RightSidebar/RightSidebar.types.ts +17 -0
- package/src/gui/Layouts/ResponsiveUI/Sidebars/RightSidebar/components/RightSidebarAction/RightSidebarAction.tsx +102 -0
- package/src/gui/Layouts/ResponsiveUI/Sidebars/RightSidebar/components/RightSidebarLink/RightSidebarLink.tsx +132 -0
- package/src/gui/Layouts/ResponsiveUI/Sidebars/RightSidebar/components/RightSidebarMenu/RightSidebarMenu.tsx +140 -0
- package/src/gui/Layouts/ResponsiveUI/Sidebars/RightSidebar/components/RightSidebarToggleButton/RightSidebarToggleButton.tsx +22 -0
- package/src/gui/Layouts/ResponsiveUI/StickyOptions/StickyOptionsTop.stories.tsx +469 -0
- package/src/gui/Layouts/ResponsiveUI/StickyOptions/StickyOptionsTop.tsx +489 -0
- package/src/gui/Layouts/ResponsiveUI/TopBar/TopBar.resolver.tsx +86 -0
- package/src/gui/Layouts/ResponsiveUI/TopBar/TopBar.stories.tsx +350 -0
- package/src/gui/Layouts/ResponsiveUI/TopBar/TopBar.tsx +281 -0
- package/src/gui/Layouts/ResponsiveUI/TopBar/TopBar.types.ts +39 -0
- package/src/gui/Layouts/ResponsiveUI/TopBar/components/TopBarAction/TopBarAction.stories.tsx +83 -0
- package/src/gui/Layouts/ResponsiveUI/TopBar/components/TopBarAction/TopBarAction.tsx +18 -0
- package/src/gui/Layouts/ResponsiveUI/TopBar/components/TopBarAction/TopBarAction.types.ts +4 -0
- package/src/gui/Layouts/ResponsiveUI/TopBar/components/TopBarLink/TopBarLink.stories.tsx +189 -0
- package/src/gui/Layouts/ResponsiveUI/TopBar/components/TopBarLink/TopBarLink.tsx +30 -0
- package/src/gui/Layouts/ResponsiveUI/TopBar/components/TopBarLink/TopBarLink.types.ts +9 -0
- package/src/gui/Layouts/ResponsiveUI/TopBar/components/TopBarMenu/TopBarMenu.resolver.tsx +14 -0
- package/src/gui/Layouts/ResponsiveUI/TopBar/components/TopBarMenu/TopBarMenu.stories.tsx +56 -0
- package/src/gui/Layouts/ResponsiveUI/TopBar/components/TopBarMenu/TopBarMenu.tsx +123 -0
- package/src/gui/Layouts/ResponsiveUI/TopBar/components/TopBarMenu/TopBarMenu.types.ts +44 -0
- package/src/gui/Theme/GuiProvider.tsx +125 -0
- package/src/gui/Theme/Icon/Icon.resolver.tsx +29 -0
- package/src/gui/Theme/Icon/Icon.tsx +43 -0
- package/src/gui/Theme/catalog/CherryByte/CherryByte.png +0 -0
- package/src/gui/Theme/catalog/CherryByte/dark.tokens.ts +47 -0
- package/src/gui/Theme/catalog/CherryByte/light.tokens.ts +47 -0
- package/src/gui/Theme/catalog/CherryByte/manifest.ts +24 -0
- package/src/gui/Theme/catalog/GhostShell/dark.tokens.ts +43 -0
- package/src/gui/Theme/catalog/GhostShell/ghost.png +0 -0
- package/src/gui/Theme/catalog/GhostShell/light.tokens.ts +39 -0
- package/src/gui/Theme/catalog/GhostShell/manifest.ts +24 -0
- package/src/gui/Theme/catalog/LunaHex/LunaHex.png +0 -0
- package/src/gui/Theme/catalog/LunaHex/dark.tokens.ts +34 -0
- package/src/gui/Theme/catalog/LunaHex/light.tokens.ts +74 -0
- package/src/gui/Theme/catalog/LunaHex/manifest.ts +24 -0
- package/src/gui/Theme/catalog/MUI/MUI.png +0 -0
- package/src/gui/Theme/catalog/MUI/dark.tokens.ts +58 -0
- package/src/gui/Theme/catalog/MUI/light.tokens.ts +74 -0
- package/src/gui/Theme/catalog/MUI/manifest.ts +24 -0
- package/src/gui/Theme/catalog/PrinceOfDarkness/dark.tokens.ts +48 -0
- package/src/gui/Theme/catalog/PrinceOfDarkness/light.tokens.ts +47 -0
- package/src/gui/Theme/catalog/PrinceOfDarkness/manifest.ts +24 -0
- package/src/gui/Theme/catalog/PrinceOfDarkness/prince.png +0 -0
- package/src/gui/Theme/catalog/PrinceOfDarkness/princeOfDarkness.png +0 -0
- package/src/gui/Theme/catalog/Seafoam/dark.tokens.ts +49 -0
- package/src/gui/Theme/catalog/Seafoam/light.tokens.ts +47 -0
- package/src/gui/Theme/catalog/Seafoam/manifest.ts +24 -0
- package/src/gui/Theme/catalog/Seafoam/seaFoam.png +0 -0
- package/src/gui/Theme/catalog/neurons/dark.tokens.ts +58 -0
- package/src/gui/Theme/catalog/neurons/light.tokens.ts +74 -0
- package/src/gui/Theme/catalog/neurons/manifest.ts +24 -0
- package/src/gui/Theme/catalog/neurons/neurons.me.png +0 -0
- package/src/gui/Theme/fromTokens.ts +273 -0
- package/src/gui/Theme/gui.css +31 -0
- package/src/gui/Theme/index.ts +17 -0
- package/src/gui/Theme/styles/buildShadows.ts +83 -0
- package/src/gui/Theme/styles/theme.tokens.ts +108 -0
- package/src/gui/Theme/utils/catalog.ts +61 -0
- package/src/gui/Theme/utils/persistence.ts +66 -0
- package/src/gui/Theme/utils/themeUtils.ts +34 -0
- package/src/gui/apis/codegen.api.ts +38 -0
- package/src/gui/components/atoms/AppBar/AppBar.resolver.tsx +41 -0
- package/src/gui/components/atoms/AppBar/AppBar.stories.tsx +225 -0
- package/src/gui/components/atoms/AppBar/AppBar.tsx +8 -0
- package/src/gui/components/atoms/AppBar/AppBar.types.ts +28 -0
- package/src/gui/components/atoms/Avatar/Avatar.resolver.tsx +61 -0
- package/src/gui/components/atoms/Avatar/Avatar.stories.tsx +36 -0
- package/src/gui/components/atoms/Avatar/Avatar.tsx +14 -0
- package/src/gui/components/atoms/Box/Box.resolver.tsx +171 -0
- package/src/gui/components/atoms/Box/Box.stories.tsx +263 -0
- package/src/gui/components/atoms/Box/Box.tsx +15 -0
- package/src/gui/components/atoms/Button/Button.resolver.tsx +103 -0
- package/src/gui/components/atoms/Button/Button.stories.tsx +219 -0
- package/src/gui/components/atoms/Button/Button.tsx +40 -0
- package/src/gui/components/atoms/Card/Card.resolver.tsx +63 -0
- package/src/gui/components/atoms/Card/Card.stories.tsx +54 -0
- package/src/gui/components/atoms/Card/Card.tsx +13 -0
- package/src/gui/components/atoms/CardActions/CardActions.resolver.tsx +59 -0
- package/src/gui/components/atoms/CardActions/CardActions.stories.tsx +32 -0
- package/src/gui/components/atoms/CardActions/CardActions.tsx +14 -0
- package/src/gui/components/atoms/CardContent/CardContent.resolver.tsx +60 -0
- package/src/gui/components/atoms/CardContent/CardContent.stories.tsx +34 -0
- package/src/gui/components/atoms/CardContent/CardContent.tsx +13 -0
- package/src/gui/components/atoms/CardHeader/CardHeader.resolver.tsx +68 -0
- package/src/gui/components/atoms/CardHeader/CardHeader.stories.tsx +40 -0
- package/src/gui/components/atoms/CardHeader/CardHeader.tsx +12 -0
- package/src/gui/components/atoms/Collapse/Collapse.resolver.tsx +85 -0
- package/src/gui/components/atoms/Collapse/Collapse.stories.tsx +130 -0
- package/src/gui/components/atoms/Collapse/Collapse.tsx +17 -0
- package/src/gui/components/atoms/Divider/Divider.resolver.tsx +95 -0
- package/src/gui/components/atoms/Divider/Divider.stories.tsx +108 -0
- package/src/gui/components/atoms/Divider/Divider.tsx +14 -0
- package/src/gui/components/atoms/Drawer/Drawer.resolver.tsx +116 -0
- package/src/gui/components/atoms/Drawer/Drawer.stories.tsx +223 -0
- package/src/gui/components/atoms/Drawer/Drawer.tsx +25 -0
- package/src/gui/components/atoms/Grid/Grid.resolver.tsx +33 -0
- package/src/gui/components/atoms/Grid/Grid.stories.tsx +136 -0
- package/src/gui/components/atoms/Grid/Grid.tsx +15 -0
- package/src/gui/components/atoms/Grid/Grid.types.ts +9 -0
- package/src/gui/components/atoms/IconButton/IconButton.resolver.tsx +137 -0
- package/src/gui/components/atoms/IconButton/IconButton.stories.tsx +134 -0
- package/src/gui/components/atoms/IconButton/IconButton.tsx +22 -0
- package/src/gui/components/atoms/Link/Link.resolver.tsx +74 -0
- package/src/gui/components/atoms/Link/Link.stories.tsx +157 -0
- package/src/gui/components/atoms/Link/Link.tsx +36 -0
- package/src/gui/components/atoms/List/List.resolver.tsx +94 -0
- package/src/gui/components/atoms/List/List.stories.tsx +137 -0
- package/src/gui/components/atoms/List/List.tsx +20 -0
- package/src/gui/components/atoms/ListItem/ListItem.resolver.tsx +88 -0
- package/src/gui/components/atoms/ListItem/ListItem.stories.tsx +151 -0
- package/src/gui/components/atoms/ListItem/ListItem.tsx +19 -0
- package/src/gui/components/atoms/ListItemButton/ListItemButton.resolver.tsx +214 -0
- package/src/gui/components/atoms/ListItemButton/ListItemButton.stories.tsx +155 -0
- package/src/gui/components/atoms/ListItemButton/ListItemButton.tsx +15 -0
- package/src/gui/components/atoms/ListItemIcon/ListItemIcon.resolver.tsx +102 -0
- package/src/gui/components/atoms/ListItemIcon/ListItemIcon.stories.tsx +132 -0
- package/src/gui/components/atoms/ListItemIcon/ListItemIcon.tsx +11 -0
- package/src/gui/components/atoms/ListItemText/ListItemText.resolver.tsx +112 -0
- package/src/gui/components/atoms/ListItemText/ListItemText.stories.tsx +156 -0
- package/src/gui/components/atoms/ListItemText/ListItemText.tsx +15 -0
- package/src/gui/components/atoms/Menu/Menu.resolver.tsx +112 -0
- package/src/gui/components/atoms/Menu/Menu.stories.tsx +162 -0
- package/src/gui/components/atoms/Menu/Menu.tsx +17 -0
- package/src/gui/components/atoms/MenuItem/MenuItem.resolver.tsx +183 -0
- package/src/gui/components/atoms/MenuItem/MenuItem.stories.tsx +134 -0
- package/src/gui/components/atoms/MenuItem/MenuItem.tsx +14 -0
- package/src/gui/components/atoms/Paper/Paper.resolver.tsx +98 -0
- package/src/gui/components/atoms/Paper/Paper.stories.tsx +184 -0
- package/src/gui/components/atoms/Paper/Paper.tsx +15 -0
- package/src/gui/components/atoms/Section/Section.resolver.tsx +10 -0
- package/src/gui/components/atoms/Section/Section.stories.tsx +189 -0
- package/src/gui/components/atoms/Section/Section.tsx +76 -0
- package/src/gui/components/atoms/Section/Section.types.tsx +24 -0
- package/src/gui/components/atoms/Stack/Stack.resolver.tsx +94 -0
- package/src/gui/components/atoms/Stack/Stack.stories.tsx +160 -0
- package/src/gui/components/atoms/Stack/Stack.tsx +15 -0
- package/src/gui/components/atoms/Surface/Surface.resolver.tsx +37 -0
- package/src/gui/components/atoms/Surface/Surface.tsx +49 -0
- package/src/gui/components/atoms/Surface/Surface.types.ts +20 -0
- package/src/gui/components/atoms/Switch/Switch.resolver.tsx +53 -0
- package/src/gui/components/atoms/Switch/Switch.stories.tsx +236 -0
- package/src/gui/components/atoms/Switch/Switch.tsx +22 -0
- package/src/gui/components/atoms/TextField/TextField.stories.tsx +28 -0
- package/src/gui/components/atoms/TextField/TextField.tsx +15 -0
- package/src/gui/components/atoms/Toolbar/Toolbar.resolver.tsx +60 -0
- package/src/gui/components/atoms/Toolbar/Toolbar.stories.tsx +155 -0
- package/src/gui/components/atoms/Toolbar/Toolbar.tsx +16 -0
- package/src/gui/components/atoms/Tooltip/Tooltip.resolver.tsx +142 -0
- package/src/gui/components/atoms/Tooltip/Tooltip.stories.tsx +117 -0
- package/src/gui/components/atoms/Tooltip/Tooltip.tsx +70 -0
- package/src/gui/components/atoms/Typography/Typography.resolver.tsx +158 -0
- package/src/gui/components/atoms/Typography/Typography.stories.tsx +222 -0
- package/src/gui/components/atoms/Typography/Typography.tsx +27 -0
- package/src/gui/components/atoms.tsx +138 -0
- package/src/gui/components/molecules/Dialog/Dialog.stories.tsx +18 -0
- package/src/gui/components/molecules/Dialog/Dialog.tsx +5 -0
- package/src/gui/components/molecules/HeroSection/HeroSection.stories.tsx +141 -0
- package/src/gui/components/molecules/HeroSection/HeroSection.tsx +152 -0
- package/src/gui/components/molecules/HeroSection/HeroSection.types.tsx +18 -0
- package/src/gui/components/molecules/ModalBox/ModalBox.resolver.tsx +38 -0
- package/src/gui/components/molecules/ModalBox/ModalBox.stories.tsx +82 -0
- package/src/gui/components/molecules/ModalBox/ModalBox.tsx +106 -0
- package/src/gui/components/molecules/ModalBox/ModalBox.types.ts +29 -0
- package/src/gui/components/molecules/Page/Page.stories.tsx +135 -0
- package/src/gui/components/molecules/Page/Page.tsx +94 -0
- package/src/gui/components/molecules/Theme/ThemeModeToggle/ThemeModeToggle.resolver.tsx +58 -0
- package/src/gui/components/molecules/Theme/ThemeModeToggle/ThemeModeToggle.stories.tsx +133 -0
- package/src/gui/components/molecules/Theme/ThemeModeToggle/ThemeModeToggle.tsx +101 -0
- package/src/gui/components/molecules/Theme/ThemeModeToggle/ThemeModeToggle.types.ts +29 -0
- package/src/gui/components/molecules/Theme/ThemesCatalog/ThemesCatalog.resolver.tsx +15 -0
- package/src/gui/components/molecules/Theme/ThemesCatalog/ThemesCatalog.stories.tsx +88 -0
- package/src/gui/components/molecules/Theme/ThemesCatalog/ThemesCatalog.tsx +167 -0
- package/src/gui/components/molecules/Theme/ThemesCatalog/ThemesCatalog.types.ts +34 -0
- package/src/gui/components/organism/ChatGPTInterface/ChatGPTInterface.stories.tsx +17 -0
- package/src/gui/components/organism/ChatGPTInterface/ChatGPTInterface.tsx +71 -0
- package/src/gui/components/organism/RootDomain/RootDomain.stories.tsx +31 -0
- package/src/gui/components/organism/RootDomain/RootDomain.tsx +100 -0
- package/src/gui/components/organism/RootDomain/staticServices.ts +66 -0
- package/src/gui/components/window/Nodes/node.ts +0 -0
- package/src/gui/components/window/code/block/node.tsx +0 -0
- package/src/gui/components/window/code/hugging.face.api.ts +11 -0
- package/src/gui/components/window/connectors/index.ts +19 -0
- package/src/gui/components/window/window.stories.tsx +20 -0
- package/src/gui/components/window/window.tsx +633 -0
- package/src/gui/contexts/InsetsContext.tsx +38 -0
- package/src/gui/contexts/LeftSidebarContext.tsx +20 -0
- package/src/gui/contexts/RightSidebarContext.tsx +25 -0
- package/src/gui/contexts/ThemeContext.ts +34 -0
- package/src/gui/contexts/index.ts +4 -0
- package/src/gui/hooks/index.ts +11 -0
- package/src/gui/hooks/resolveColorToken.ts +39 -0
- package/src/gui/hooks/useCodeGen.ts +12 -0
- package/src/gui/hooks/useGuiMediaQuery.ts +18 -0
- package/src/gui/hooks/useGuiTheme.ts +18 -0
- package/src/gui/hooks/useInsets.ts +26 -0
- package/src/gui/hooks/useIsMobile.ts +13 -0
- package/src/gui/hooks/useIsTouchDevice.ts +25 -0
- package/src/gui/hooks/useLeftSidebar.ts +10 -0
- package/src/gui/hooks/useRightSidebar.ts +12 -0
- package/src/gui/hooks/useViewportKey.ts +19 -0
- package/src/gui/hooks/useViewportProp.ts +17 -0
- package/src/gui/me/Logic.tsx +31 -0
- package/src/gui/me/Me.stories.tsx +8 -0
- package/src/gui/me/Me.tsx +197 -0
- package/src/gui/me/fundamentals/verbs/verbs.tsx +94 -0
- package/src/gui/me/modificators/Adjectives.ts +0 -0
- package/src/gui/me/modificators/Adverbs.ts +0 -0
- package/src/gui/me/modificators/Complements.ts +27 -0
- package/src/gui/me/utils/Context.tsx +14 -0
- package/src/gui/me/utils/hooks/useMe.js +37 -0
- package/src/gui/utils/nodeID.ts +11 -0
- package/src/registry/GuiRegistry.ts +19 -0
- package/src/registry/factory.ts +12 -0
- package/src/registry/index.ts +3 -0
- package/src/registry/types.ts +6 -0
- package/src/stories/01.Home.mdx +22 -0
- package/src/stories/02.Understanding.This.GUI.mdx +149 -0
- package/src/stories/Theme/Palette.stories.tsx +86 -0
- package/src/stories/Theme/ThemeViewer.stories.tsx +91 -0
- package/src/stories/Theme/Typography.stories.jsx +211 -0
- package/src/types/gui.d.ts +67 -0
- package/src/types/theme.d.ts +191 -0
- package/src/types/viewport.ts +132 -0
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { Box, Collapse, Typography } from '@/gui/components/atoms';
|
|
3
|
+
import Icon from '@/gui/Theme/Icon/Icon';
|
|
4
|
+
|
|
5
|
+
type RightSidebarMenuItem = {
|
|
6
|
+
label?: string;
|
|
7
|
+
icon?: string;
|
|
8
|
+
iconColor?: string;
|
|
9
|
+
onClick?: () => void;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
type RightSidebarMenuProps = {
|
|
13
|
+
label?: string;
|
|
14
|
+
icon?: string;
|
|
15
|
+
iconColor?: string;
|
|
16
|
+
items?: RightSidebarMenuItem[];
|
|
17
|
+
view?: 'rail' | 'expanded' | 'mobile';
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
const RightSidebarMenu: React.FC<RightSidebarMenuProps> = ({ label, icon, iconColor, items, view }) => {
|
|
21
|
+
const [open, setOpen] = useState(false);
|
|
22
|
+
const [anchorTop, setAnchorTop] = useState<number | null>(null);
|
|
23
|
+
const isRail = view === 'rail';
|
|
24
|
+
|
|
25
|
+
return (
|
|
26
|
+
<Box
|
|
27
|
+
onMouseEnter={(e) => {
|
|
28
|
+
if (isRail) {
|
|
29
|
+
const rect = (e.currentTarget as HTMLElement).getBoundingClientRect();
|
|
30
|
+
setAnchorTop(rect.top);
|
|
31
|
+
setOpen(true);
|
|
32
|
+
}
|
|
33
|
+
}}
|
|
34
|
+
onMouseLeave={() => {
|
|
35
|
+
if (isRail) {
|
|
36
|
+
setOpen(false);
|
|
37
|
+
setAnchorTop(null);
|
|
38
|
+
}
|
|
39
|
+
}}
|
|
40
|
+
sx={{
|
|
41
|
+
display: 'flex',
|
|
42
|
+
flexDirection: 'column',
|
|
43
|
+
alignItems: 'flex-start',
|
|
44
|
+
p: 1.123,
|
|
45
|
+
backgroundColor: 'transparent',
|
|
46
|
+
cursor: 'pointer',
|
|
47
|
+
borderRadius: 1,
|
|
48
|
+
color: 'text.primary',
|
|
49
|
+
'&:hover': { backgroundColor: 'action.hover' },
|
|
50
|
+
position: 'relative',
|
|
51
|
+
}}
|
|
52
|
+
onClick={() => !isRail && setOpen((prev) => !prev)}
|
|
53
|
+
>
|
|
54
|
+
<Box
|
|
55
|
+
sx={{
|
|
56
|
+
display: 'flex',
|
|
57
|
+
gap: 1.5,
|
|
58
|
+
justifyContent: isRail ? 'center' : 'flex-start',
|
|
59
|
+
alignItems: 'center',
|
|
60
|
+
width: '100%',
|
|
61
|
+
textAlign: isRail ? 'center' : 'left',
|
|
62
|
+
px: isRail ? 0 : 1.23,
|
|
63
|
+
}}
|
|
64
|
+
>
|
|
65
|
+
<Icon name={icon ?? ''} iconColor={iconColor} />
|
|
66
|
+
{view !== 'rail' && <Typography variant="body2">{label}</Typography>}
|
|
67
|
+
{!isRail && <Icon name={open ? 'expand_less' : 'expand_more'} />}
|
|
68
|
+
</Box>
|
|
69
|
+
|
|
70
|
+
{isRail ? (
|
|
71
|
+
open && (
|
|
72
|
+
<Box
|
|
73
|
+
sx={{
|
|
74
|
+
position: 'fixed',
|
|
75
|
+
right: 'var(--gui-rail-width, 72px)',
|
|
76
|
+
top: anchorTop ?? 0,
|
|
77
|
+
backgroundColor: 'background.paper',
|
|
78
|
+
color: 'text.primary',
|
|
79
|
+
borderRadius: 1,
|
|
80
|
+
boxShadow: 3,
|
|
81
|
+
zIndex: 1300,
|
|
82
|
+
border: '1px solid',
|
|
83
|
+
borderColor: 'divider',
|
|
84
|
+
minWidth: 180,
|
|
85
|
+
maxHeight: '80vh',
|
|
86
|
+
overflowY: 'auto',
|
|
87
|
+
py: 1,
|
|
88
|
+
}}
|
|
89
|
+
>
|
|
90
|
+
{(items ?? []).map((item, idx) => (
|
|
91
|
+
<Box
|
|
92
|
+
key={idx}
|
|
93
|
+
onClick={item.onClick}
|
|
94
|
+
sx={{
|
|
95
|
+
display: 'flex',
|
|
96
|
+
alignItems: 'center',
|
|
97
|
+
px: 2,
|
|
98
|
+
py: 0.75,
|
|
99
|
+
gap: 1.5,
|
|
100
|
+
cursor: 'pointer',
|
|
101
|
+
borderRadius: 1,
|
|
102
|
+
color: 'text.primary',
|
|
103
|
+
'&:hover': { backgroundColor: 'action.hover' },
|
|
104
|
+
}}
|
|
105
|
+
>
|
|
106
|
+
<Icon name={item.icon ?? ''} iconColor={item.iconColor} />
|
|
107
|
+
<Typography variant="body2">{item.label}</Typography>
|
|
108
|
+
</Box>
|
|
109
|
+
))}
|
|
110
|
+
</Box>
|
|
111
|
+
)
|
|
112
|
+
) : (
|
|
113
|
+
<Collapse in={open}>
|
|
114
|
+
{(items ?? []).map((item, idx) => (
|
|
115
|
+
<Box
|
|
116
|
+
key={idx}
|
|
117
|
+
onClick={item.onClick}
|
|
118
|
+
sx={{
|
|
119
|
+
display: 'flex',
|
|
120
|
+
alignItems: 'center',
|
|
121
|
+
px: 2,
|
|
122
|
+
py: 0.75,
|
|
123
|
+
gap: 1.123,
|
|
124
|
+
cursor: 'pointer',
|
|
125
|
+
borderRadius: 1,
|
|
126
|
+
color: 'text.primary',
|
|
127
|
+
'&:hover': { backgroundColor: 'action.hover' },
|
|
128
|
+
}}
|
|
129
|
+
>
|
|
130
|
+
<Icon name={item.icon ?? ''} iconColor={item.iconColor} />
|
|
131
|
+
<Typography variant="body2">{item.label}</Typography>
|
|
132
|
+
</Box>
|
|
133
|
+
))}
|
|
134
|
+
</Collapse>
|
|
135
|
+
)}
|
|
136
|
+
</Box>
|
|
137
|
+
);
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
export default RightSidebarMenu;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import IconButton from '@mui/material/IconButton';
|
|
3
|
+
import Icon from '@/gui/Theme/Icon/Icon';
|
|
4
|
+
|
|
5
|
+
type RightSidebarToggleButtonProps = {
|
|
6
|
+
expanded: boolean;
|
|
7
|
+
onToggle: () => void;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
const RightSidebarToggleButton: React.FC<RightSidebarToggleButtonProps> = ({ expanded, onToggle }) => {
|
|
11
|
+
return (
|
|
12
|
+
<IconButton
|
|
13
|
+
aria-label="Toggle right sidebar"
|
|
14
|
+
onClick={onToggle}
|
|
15
|
+
sx={{ margin: 1 }}
|
|
16
|
+
>
|
|
17
|
+
<Icon name={expanded ? 'chevron_right' : 'chevron_left'} />
|
|
18
|
+
</IconButton>
|
|
19
|
+
);
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export default RightSidebarToggleButton;
|
|
@@ -0,0 +1,469 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import Box from '@/gui/components/atoms/Box/Box';
|
|
3
|
+
import Paper from '@/gui/components/atoms/Paper/Paper';
|
|
4
|
+
import Typography from '@/gui/components/atoms/Typography/Typography';
|
|
5
|
+
import StickyOptionsTop from './StickyOptionsTop';
|
|
6
|
+
import Icon from '@/gui/Theme/Icon/Icon';
|
|
7
|
+
import NavBar from '../TopBar/TopBar';
|
|
8
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
9
|
+
|
|
10
|
+
const meta: Meta<typeof StickyOptionsTop> = {
|
|
11
|
+
title: 'Layouts/ResponsiveUI/StickyOptions/StickyOptionsTop',
|
|
12
|
+
component: StickyOptionsTop,
|
|
13
|
+
tags: ['autodocs'],
|
|
14
|
+
parameters: {
|
|
15
|
+
layout: 'fullscreen',
|
|
16
|
+
docs: {
|
|
17
|
+
description: {
|
|
18
|
+
component: `
|
|
19
|
+
### StickyOptionsTop — Quick actions bar
|
|
20
|
+
|
|
21
|
+
**StickyOptionsTop** renders a compact, theme‑aware quick‑actions bar that sits just **under the NavBar** and automatically respects permanent drawer insets (left/right) as well as the runtime **nav height** provided by your \`CustomThemeProvider\`.
|
|
22
|
+
|
|
23
|
+
It supports both **declarative icons** (e.g. \`"mui:Settings"\`, \`"lucide:camera"\`) via the project icon registry and **direct React nodes**, collapses nicely on small screens, and can optionally hide while scrolling.
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
#### ✨ What it does
|
|
28
|
+
|
|
29
|
+
- **Positions itself** relative to your layout:
|
|
30
|
+
- Uses \`theme.layout.insets.nav\` (kept in sync by your \`NavBar\`) to sit below the app bar.
|
|
31
|
+
- Uses \`theme.layout.insets.left/right\` (kept in sync by permanent drawers) to center within the remaining space.
|
|
32
|
+
- **Layout modes**:
|
|
33
|
+
- \`"sticky"\` (default): scrolls with content and sticks below the NavBar.
|
|
34
|
+
- \`"fixed"\`: pinned to the viewport; also honors insets and the nav height.
|
|
35
|
+
- **Mobile behavior**:
|
|
36
|
+
- Can render a slim “pill” with labels or an icon‑only compact layout.
|
|
37
|
+
- **Theme aware**:
|
|
38
|
+
- Uses MUI palette and custom tokens; icons can inherit color or use palette keys (e.g. \`primary\`, \`info\`) or raw CSS colors.
|
|
39
|
+
|
|
40
|
+
> **Default spacing:** the bar keeps a small gap below the NavBar via \`topOffset: "0.25rem"\`.
|
|
41
|
+
> Override with \`positioning.topOffset\`.
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
## Props
|
|
46
|
+
|
|
47
|
+
All props are optional unless noted.
|
|
48
|
+
|
|
49
|
+
### \`items: Array<Item>\`
|
|
50
|
+
Each item can be either **declarative** (icon string) or a **ReactNode**.
|
|
51
|
+
|
|
52
|
+
\`\`\`ts
|
|
53
|
+
type Item = {
|
|
54
|
+
icon: React.ReactNode | string; // e.g. "mui:Settings" | "lucide:bolt" | <Icon .../>
|
|
55
|
+
label?: string; // button text (omit to render icon-only)
|
|
56
|
+
href?: string; // if present, renders an anchor
|
|
57
|
+
iconColor?: string; // palette key ("primary", "info") or CSS color ("#ff9800")
|
|
58
|
+
variant?: 'primary' | 'neutral' // styling accent (default: 'neutral')
|
|
59
|
+
trackId?: string; // optional analytics id
|
|
60
|
+
ariaLabel?: string; // accessibility label when label is omitted
|
|
61
|
+
}
|
|
62
|
+
\`\`\`
|
|
63
|
+
|
|
64
|
+
### \`mobileVariant: 'auto' | 'fab' | 'inline'\`
|
|
65
|
+
- **auto** (default): chooses best layout for the viewport width.
|
|
66
|
+
- **fab**: renders up to 3 circular icon buttons (compact, mobile‑style).
|
|
67
|
+
- **inline**: keeps the pill‑style bar inline on mobile.
|
|
68
|
+
|
|
69
|
+
### \`dense: boolean\`
|
|
70
|
+
Compacts paddings/heights.
|
|
71
|
+
|
|
72
|
+
### \`positioning: { ... }\`
|
|
73
|
+
Controls how and where the bar is placed.
|
|
74
|
+
|
|
75
|
+
\`\`\`ts
|
|
76
|
+
type Positioning = {
|
|
77
|
+
mode?: 'sticky' | 'fixed'; // default: 'sticky'
|
|
78
|
+
topOffset?: number | string; // gap below the navbar; default: "0.25rem"
|
|
79
|
+
maxWidth?: number | string; // max width of the pill; default: 800
|
|
80
|
+
reserveSpace?: boolean; // if true, inserts a spacer to push content by bar height+offset
|
|
81
|
+
}
|
|
82
|
+
\`\`\`
|
|
83
|
+
|
|
84
|
+
**How placement works**
|
|
85
|
+
- Reads \`theme.layout.insets.nav\` to compute \`top\`.
|
|
86
|
+
- If a navbar is present (\`nav > 0\`), bar sits at \`nav + topOffset\`.
|
|
87
|
+
Without a navbar, it uses page top (no extra gap).
|
|
88
|
+
- In \`"fixed"\` mode, the bar is pinned and uses \`theme.layout.insets.left/right\` as **viewport paddings**.
|
|
89
|
+
- In \`"sticky"\` mode, the bar participates in normal layout flow and sticks when reaching the computed \`top\`.
|
|
90
|
+
|
|
91
|
+
### \`behavior: { ... }\`
|
|
92
|
+
Optional scroll/visibility tuning.
|
|
93
|
+
|
|
94
|
+
\`\`\`ts
|
|
95
|
+
type Behavior = {
|
|
96
|
+
hideOnScrollDown?: boolean; // default: false
|
|
97
|
+
iconOnlyOnMobile?: boolean; // render icons-only on small screens
|
|
98
|
+
mobileBreakpoint?: number; // default: 768
|
|
99
|
+
hideThreshold?: number; // px scrolled down before hiding; default: 36
|
|
100
|
+
showThreshold?: number; // px scrolled up before showing again; default: 12
|
|
101
|
+
topGuard?: number; // do not hide when near top; default: 20
|
|
102
|
+
}
|
|
103
|
+
\`\`\`
|
|
104
|
+
|
|
105
|
+
### \`theme: { ... }\`
|
|
106
|
+
Visual tuning with sensible defaults.
|
|
107
|
+
|
|
108
|
+
\`\`\`ts
|
|
109
|
+
type ThemeOpts = {
|
|
110
|
+
elevation?: number; // shadow depth; default: 28
|
|
111
|
+
blur?: number; // backdrop blur in px; default: 9
|
|
112
|
+
contrastMode?: 'auto'|'light'|'dark'; // (reserved for future)
|
|
113
|
+
}
|
|
114
|
+
\`\`\`
|
|
115
|
+
|
|
116
|
+
### \`visibility: { ... }\`
|
|
117
|
+
Route‑aware gating (simple client‑side checks).
|
|
118
|
+
|
|
119
|
+
\`\`\`ts
|
|
120
|
+
type Visibility = {
|
|
121
|
+
enabled?: boolean; // default: true
|
|
122
|
+
includeRoutes?: string[] | null; // only show on these prefixes
|
|
123
|
+
excludeRoutes?: string[] | null; // hide on these prefixes
|
|
124
|
+
}
|
|
125
|
+
\`\`\`
|
|
126
|
+
|
|
127
|
+
### \`i18n: { ... }\`
|
|
128
|
+
Optional translation hook.
|
|
129
|
+
|
|
130
|
+
\`\`\`ts
|
|
131
|
+
type I18n = {
|
|
132
|
+
useI18n?: boolean; // default: false
|
|
133
|
+
t?: (s: string) => string; // translate labels if provided
|
|
134
|
+
}
|
|
135
|
+
\`\`\`
|
|
136
|
+
|
|
137
|
+
---
|
|
138
|
+
|
|
139
|
+
## Theming & Insets
|
|
140
|
+
|
|
141
|
+
- The component **does not** manage insets itself. It reads them from \`theme.layout.insets\` which is kept in sync by your layout:
|
|
142
|
+
- \`NavBar\` reports its real height through \`theme.updateInsets({ nav })\`.
|
|
143
|
+
- \`LeftDrawer\` / \`RightDrawer\` report their widths through \`theme.updateInsets({ left/right })\`.
|
|
144
|
+
- For non‑MUI consumers, \`CustomThemeProvider\` also mirrors the values into CSS variables:
|
|
145
|
+
- \`--gui-inset-left\`, \`--gui-inset-right\`, and \`--gui-nav-height\`.
|
|
146
|
+
|
|
147
|
+
---
|
|
148
|
+
|
|
149
|
+
## Accessibility
|
|
150
|
+
|
|
151
|
+
- When rendering icon‑only actions, provide \`ariaLabel\` so the intent is announced by screen readers.
|
|
152
|
+
- Links include proper \`rel\` attributes when \`target="_blank"\`.
|
|
153
|
+
|
|
154
|
+
---
|
|
155
|
+
|
|
156
|
+
## Analytics
|
|
157
|
+
|
|
158
|
+
- When items have \`trackId\`, the component dispatches a DOM event:
|
|
159
|
+
\`window.dispatchEvent(new CustomEvent('stickyoptions:click', { detail: { trackId, label } }))\`.
|
|
160
|
+
|
|
161
|
+
---
|
|
162
|
+
|
|
163
|
+
## Defaults (quick reference)
|
|
164
|
+
|
|
165
|
+
- \`mobileVariant\`: \`"auto"\`
|
|
166
|
+
- \`dense\`: \`false\`
|
|
167
|
+
- \`positioning.mode\`: \`"sticky"\`
|
|
168
|
+
- \`positioning.topOffset\`: \`"0.25rem"\`
|
|
169
|
+
- \`positioning.maxWidth\`: \`800\`
|
|
170
|
+
- \`positioning.reserveSpace\`: \`false\`
|
|
171
|
+
- \`behavior.hideOnScrollDown\`: \`false\`
|
|
172
|
+
- \`behavior.mobileBreakpoint\`: \`768\`
|
|
173
|
+
- \`theme.elevation\`: \`28\`
|
|
174
|
+
- \`theme.blur\`: \`9\`
|
|
175
|
+
- \`visibility.enabled\`: \`true\`
|
|
176
|
+
|
|
177
|
+
---
|
|
178
|
+
|
|
179
|
+
## Usage
|
|
180
|
+
|
|
181
|
+
**Declarative icons**
|
|
182
|
+
\`\`\`jsx
|
|
183
|
+
<StickyOptionsTop
|
|
184
|
+
items={[
|
|
185
|
+
{ icon: 'mui:BarChart', label: 'Stats', href: '/stats', iconColor: 'primary' },
|
|
186
|
+
{ icon: 'lucide:bolt', label: 'Power', href: '/power', iconColor: '#ff9800' },
|
|
187
|
+
{ icon: 'mui:Help', label: 'Help', href: 'https://help.example.com' },
|
|
188
|
+
]}
|
|
189
|
+
/>
|
|
190
|
+
\`\`\`
|
|
191
|
+
|
|
192
|
+
**With NavBar (sticky mode)**
|
|
193
|
+
\`\`\`jsx
|
|
194
|
+
<NavBar title="Demo" />
|
|
195
|
+
<Box sx={(theme) => ({ pt: \`\${theme?.layout?.insets?.nav ?? 0}px\` })}>
|
|
196
|
+
<StickyOptionsTop items={items} />
|
|
197
|
+
{/* page content */}
|
|
198
|
+
</Box>
|
|
199
|
+
\`\`\`
|
|
200
|
+
|
|
201
|
+
**Pinned to viewport (fixed mode)**
|
|
202
|
+
\`\`\`jsx
|
|
203
|
+
<StickyOptionsTop
|
|
204
|
+
items={items}
|
|
205
|
+
positioning={{ mode: 'fixed', topOffset: '0.25rem' }}
|
|
206
|
+
/>
|
|
207
|
+
\`\`\`
|
|
208
|
+
`,
|
|
209
|
+
},
|
|
210
|
+
},
|
|
211
|
+
},
|
|
212
|
+
argTypes: {
|
|
213
|
+
items: {
|
|
214
|
+
control: 'object',
|
|
215
|
+
description:
|
|
216
|
+
'List of actions. Each item: { icon, label, href, iconColor?, variant? }',
|
|
217
|
+
},
|
|
218
|
+
mobileVersion: {
|
|
219
|
+
control: { type: 'inline-radio' },
|
|
220
|
+
options: ['pill', 'icons'],
|
|
221
|
+
description:
|
|
222
|
+
'Mobile layout. "pill" shows a pill bar with text; "icons" shows a compact icon-only bar.',
|
|
223
|
+
},
|
|
224
|
+
positioning: {
|
|
225
|
+
control: { type: 'object' },
|
|
226
|
+
description: 'Positioning config. Accepts `{ mode: "sticky" | "fixed" }`. Default is `{ mode: "sticky" }`.'
|
|
227
|
+
},
|
|
228
|
+
},
|
|
229
|
+
};
|
|
230
|
+
|
|
231
|
+
export default meta;
|
|
232
|
+
|
|
233
|
+
// Helpers ------------------------------------------------------------
|
|
234
|
+
|
|
235
|
+
type ItemType = {
|
|
236
|
+
icon: React.ReactNode | string;
|
|
237
|
+
label?: string;
|
|
238
|
+
href?: string;
|
|
239
|
+
iconColor?: string;
|
|
240
|
+
};
|
|
241
|
+
|
|
242
|
+
const ITEMS_BASE: ItemType[] = [
|
|
243
|
+
{ icon: <Icon name="Settings" />, label: 'Settings', href: '/settings' },
|
|
244
|
+
{ icon: <Icon name="camera" />, label: 'Capture', href: '/capture' },
|
|
245
|
+
{ icon: <Icon name="Help" />, label: 'Help', href: 'https://help.neurons.me' },
|
|
246
|
+
];
|
|
247
|
+
|
|
248
|
+
const ITEMS_BASE_MOBILE: ItemType[] = [
|
|
249
|
+
{ icon: <Icon name="Settings" />, href: '/settings' },
|
|
250
|
+
{ icon: <Icon name="camera" />, href: '/capture' },
|
|
251
|
+
{ icon: <Icon name="Help" />, href: 'https://help.neurons.me' },
|
|
252
|
+
];
|
|
253
|
+
|
|
254
|
+
const ITEMS_WITH_COLORS: ItemType[] = [
|
|
255
|
+
{ icon: <Icon name="BarChart" iconColor="primary" />, label: 'Stats', href: '/stats' },
|
|
256
|
+
{ icon: <Icon name="bolt" iconColor="#ff9800" />, label: 'Power', href: '/power' },
|
|
257
|
+
{ icon: <Icon name="Insights" iconColor="info" />, label: 'Insights', href: '/insights' },
|
|
258
|
+
{ icon: <Icon name="settings" />, label: 'Config', href: '/config' },
|
|
259
|
+
];
|
|
260
|
+
|
|
261
|
+
const ITEMS_WITH_COLORS_MOBILE: ItemType[] = [
|
|
262
|
+
{ icon: <Icon name="BarChart" iconColor="primary" />, href: '/stats' },
|
|
263
|
+
{ icon: <Icon name="bolt" iconColor="#ff9800" />, href: '/power' },
|
|
264
|
+
{ icon: <Icon name="Insights" iconColor="info" />, href: '/insights' },
|
|
265
|
+
{ icon: <Icon name="settings" />, href: '/config' },
|
|
266
|
+
];
|
|
267
|
+
|
|
268
|
+
const ITEMS_REACT_NODES: ItemType[] = [
|
|
269
|
+
{
|
|
270
|
+
icon: <Icon name="AttachMoney" iconColor="#43a047" />,
|
|
271
|
+
label: 'Billing',
|
|
272
|
+
href: '/billing',
|
|
273
|
+
},
|
|
274
|
+
{
|
|
275
|
+
icon: <Icon name="message-circle" iconColor="#1976d2" />,
|
|
276
|
+
label: 'Support',
|
|
277
|
+
href: '/support',
|
|
278
|
+
},
|
|
279
|
+
{
|
|
280
|
+
icon: <Icon name="CalendarMonth" />,
|
|
281
|
+
label: 'Calendar',
|
|
282
|
+
href: '/calendar',
|
|
283
|
+
},
|
|
284
|
+
];
|
|
285
|
+
|
|
286
|
+
// Example container to simulate page content
|
|
287
|
+
const PageScaffold: React.FC<{ children: React.ReactNode }> = ({ children }) => (
|
|
288
|
+
<Box sx={{ minHeight: '100vh', bgcolor: 'background.default', color: 'text.primary' }}>
|
|
289
|
+
{children}
|
|
290
|
+
<Box sx={{ px: 3, py: 2 }}>
|
|
291
|
+
<Paper variant="outlined" sx={{ p: 2 }}>
|
|
292
|
+
<Typography variant="subtitle1" sx={{ fontWeight: 700, mb: 1 }}>
|
|
293
|
+
Demo content
|
|
294
|
+
</Typography>
|
|
295
|
+
<Typography variant="body2" sx={{ color: 'text.secondary' }}>
|
|
296
|
+
This card is just to simulate page content.
|
|
297
|
+
The *sticky* bar is center aligned and respects the insets of permanent drawers.
|
|
298
|
+
</Typography>
|
|
299
|
+
</Paper>
|
|
300
|
+
</Box>
|
|
301
|
+
</Box>
|
|
302
|
+
);
|
|
303
|
+
|
|
304
|
+
// Stories ------------------------------------------------------------
|
|
305
|
+
|
|
306
|
+
export const Default: StoryObj<typeof StickyOptionsTop> = {
|
|
307
|
+
args: {
|
|
308
|
+
items: ITEMS_BASE,
|
|
309
|
+
mobileVersion: 'pill',
|
|
310
|
+
},
|
|
311
|
+
render: (args) => (
|
|
312
|
+
<PageScaffold>
|
|
313
|
+
<StickyOptionsTop {...args} />
|
|
314
|
+
</PageScaffold>
|
|
315
|
+
),
|
|
316
|
+
parameters: {
|
|
317
|
+
docs: {
|
|
318
|
+
description: {
|
|
319
|
+
story:
|
|
320
|
+
'Basic usage with **declarative** icons. Without `iconColor`, icons react automatically to the theme (light/dark).',
|
|
321
|
+
},
|
|
322
|
+
},
|
|
323
|
+
},
|
|
324
|
+
};
|
|
325
|
+
|
|
326
|
+
export const WithIconColors: StoryObj<typeof StickyOptionsTop> = {
|
|
327
|
+
args: {
|
|
328
|
+
items: ITEMS_WITH_COLORS,
|
|
329
|
+
mobileVersion: 'pill',
|
|
330
|
+
},
|
|
331
|
+
render: (args) => (
|
|
332
|
+
<PageScaffold>
|
|
333
|
+
<StickyOptionsTop {...args} />
|
|
334
|
+
</PageScaffold>
|
|
335
|
+
),
|
|
336
|
+
parameters: {
|
|
337
|
+
docs: {
|
|
338
|
+
description: {
|
|
339
|
+
story:
|
|
340
|
+
'Declarative icons with `iconColor`. Accepts palette keys (`primary`, `info`, etc.) or any CSS color (`#ff9800`).',
|
|
341
|
+
},
|
|
342
|
+
},
|
|
343
|
+
},
|
|
344
|
+
};
|
|
345
|
+
|
|
346
|
+
export const ReactIconNodes: StoryObj<typeof StickyOptionsTop> = {
|
|
347
|
+
args: {
|
|
348
|
+
items: ITEMS_REACT_NODES,
|
|
349
|
+
mobileVersion: 'pill',
|
|
350
|
+
},
|
|
351
|
+
render: (args) => (
|
|
352
|
+
<PageScaffold>
|
|
353
|
+
<StickyOptionsTop {...args} />
|
|
354
|
+
</PageScaffold>
|
|
355
|
+
),
|
|
356
|
+
parameters: {
|
|
357
|
+
docs: {
|
|
358
|
+
description: {
|
|
359
|
+
story:
|
|
360
|
+
'**ReactNode** mode: you can pass icon components directly. If you do not define an explicit color, the icon will follow the theme.',
|
|
361
|
+
},
|
|
362
|
+
},
|
|
363
|
+
},
|
|
364
|
+
};
|
|
365
|
+
|
|
366
|
+
export const DenseCompact: StoryObj<typeof StickyOptionsTop> = {
|
|
367
|
+
args: {
|
|
368
|
+
items: ITEMS_BASE,
|
|
369
|
+
mobileVersion: 'pill',
|
|
370
|
+
},
|
|
371
|
+
render: (args) => (
|
|
372
|
+
<PageScaffold>
|
|
373
|
+
<StickyOptionsTop {...args} />
|
|
374
|
+
</PageScaffold>
|
|
375
|
+
),
|
|
376
|
+
parameters: {
|
|
377
|
+
docs: {
|
|
378
|
+
description: {
|
|
379
|
+
story:
|
|
380
|
+
'**Compact** variant with less padding. Useful when vertical space is limited or there are many actions.',
|
|
381
|
+
},
|
|
382
|
+
},
|
|
383
|
+
},
|
|
384
|
+
};
|
|
385
|
+
|
|
386
|
+
export const MobileFAB: StoryObj<typeof StickyOptionsTop> = {
|
|
387
|
+
name: 'Mobile — FAB',
|
|
388
|
+
args: {
|
|
389
|
+
items: ITEMS_WITH_COLORS_MOBILE,
|
|
390
|
+
mobileVersion: 'icons',
|
|
391
|
+
},
|
|
392
|
+
render: (args) => (
|
|
393
|
+
// Simple simulation of mobile viewport (max width) to avoid dependency on viewport addon
|
|
394
|
+
<Box sx={{ width: 390, mx: 'auto', border: '1px solid', borderColor: 'divider', borderRadius: 2, overflow: 'hidden' }}>
|
|
395
|
+
<PageScaffold>
|
|
396
|
+
<StickyOptionsTop {...args} />
|
|
397
|
+
<Box sx={{ p: 2 }}>
|
|
398
|
+
<Typography variant="body2" sx={{ color: 'text.secondary' }}>
|
|
399
|
+
Simulated **mobile** view (~390px). In \`mobileVariant="fab"\`, the component renders
|
|
400
|
+
a floating button with access to actions.
|
|
401
|
+
</Typography>
|
|
402
|
+
</Box>
|
|
403
|
+
</PageScaffold>
|
|
404
|
+
</Box>
|
|
405
|
+
),
|
|
406
|
+
parameters: {
|
|
407
|
+
docs: {
|
|
408
|
+
description: {
|
|
409
|
+
story:
|
|
410
|
+
'Forcing \`mobileVariant="fab"\` and simulating a narrow viewport to visualize mobile behavior without requiring addons.',
|
|
411
|
+
},
|
|
412
|
+
},
|
|
413
|
+
},
|
|
414
|
+
};
|
|
415
|
+
|
|
416
|
+
export const MobileInline: StoryObj<typeof StickyOptionsTop> = {
|
|
417
|
+
name: 'Mobile — Inline',
|
|
418
|
+
args: {
|
|
419
|
+
items: ITEMS_BASE_MOBILE,
|
|
420
|
+
mobileVersion: 'pill',
|
|
421
|
+
},
|
|
422
|
+
render: (args) => (
|
|
423
|
+
<Box sx={{ width: 390, mx: 'auto', border: '1px solid', borderColor: 'divider', borderRadius: 2, overflow: 'hidden' }}>
|
|
424
|
+
<PageScaffold>
|
|
425
|
+
<StickyOptionsTop {...args} />
|
|
426
|
+
<Box sx={{ p: 2 }}>
|
|
427
|
+
<Typography variant="body2" sx={{ color: 'text.secondary' }}>
|
|
428
|
+
Simulated **mobile** view (~390px). With \`mobileVariant="inline"\`, the bar stays
|
|
429
|
+
inline at the top.
|
|
430
|
+
</Typography>
|
|
431
|
+
</Box>
|
|
432
|
+
</PageScaffold>
|
|
433
|
+
</Box>
|
|
434
|
+
),
|
|
435
|
+
parameters: {
|
|
436
|
+
docs: {
|
|
437
|
+
description: {
|
|
438
|
+
story:
|
|
439
|
+
'Mobile behavior keeping the bar inline (no FAB).',
|
|
440
|
+
},
|
|
441
|
+
},
|
|
442
|
+
},
|
|
443
|
+
};
|
|
444
|
+
|
|
445
|
+
export const WithNavBar: StoryObj<typeof StickyOptionsTop> = {
|
|
446
|
+
args: {
|
|
447
|
+
items: ITEMS_WITH_COLORS,
|
|
448
|
+
mobileVersion: 'pill',
|
|
449
|
+
},
|
|
450
|
+
render: (args) => (
|
|
451
|
+
<PageScaffold>
|
|
452
|
+
<NavBar title="Demo App" />
|
|
453
|
+
<Box sx={(theme) => ({ pt: `${theme?.layout?.insets?.nav ?? 0}px` })}>
|
|
454
|
+
<StickyOptionsTop {...args} />
|
|
455
|
+
<Box sx={{ p: 2 }}>
|
|
456
|
+
{"Lorem ipsum dolor sit amet, consectetur adipiscing elit. ".repeat(100)}
|
|
457
|
+
</Box>
|
|
458
|
+
</Box>
|
|
459
|
+
</PageScaffold>
|
|
460
|
+
),
|
|
461
|
+
parameters: {
|
|
462
|
+
docs: {
|
|
463
|
+
description: {
|
|
464
|
+
story:
|
|
465
|
+
'Example with **NavBar** mounted. The sticky options bar now respects the nav inset (height of the AppBar) automatically.',
|
|
466
|
+
},
|
|
467
|
+
},
|
|
468
|
+
},
|
|
469
|
+
};
|