@xyo-network/react-appbar 2.64.0 → 2.64.1
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/browser/components/AppBar/Application.js +252 -6
- package/dist/browser/components/AppBar/Application.js.map +1 -1
- package/dist/browser/components/AppBar/index.js +264 -1
- package/dist/browser/components/AppBar/index.js.map +1 -1
- package/dist/browser/components/CollapsibleDrawer/CollapseToggle.js +13 -3
- package/dist/browser/components/CollapsibleDrawer/CollapseToggle.js.map +1 -1
- package/dist/browser/components/CollapsibleDrawer/CollapsibleDrawer.js +14 -4
- package/dist/browser/components/CollapsibleDrawer/CollapsibleDrawer.js.map +1 -1
- package/dist/browser/components/CollapsibleDrawer/index.js +72 -2
- package/dist/browser/components/CollapsibleDrawer/index.js.map +1 -1
- package/dist/browser/components/CollapsibleDrawer/storyExampleMenuData.js +4 -3
- package/dist/browser/components/CollapsibleDrawer/storyExampleMenuData.js.map +1 -1
- package/dist/browser/components/MobileSystemControls/SystemControls.js +117 -5
- package/dist/browser/components/MobileSystemControls/SystemControls.js.map +1 -1
- package/dist/browser/components/MobileSystemControls/SystemControlsRoot.js +57 -5
- package/dist/browser/components/MobileSystemControls/SystemControlsRoot.js.map +1 -1
- package/dist/browser/components/MobileSystemControls/SystemControlsType.js +1 -0
- package/dist/browser/components/MobileSystemControls/SystemControlsType.js.map +1 -1
- package/dist/browser/components/MobileSystemControls/SystemControlsUnstyled.js +35 -9
- package/dist/browser/components/MobileSystemControls/SystemControlsUnstyled.js.map +1 -1
- package/dist/browser/components/MobileSystemControls/controls/SystemControl.js +5 -5
- package/dist/browser/components/MobileSystemControls/controls/SystemControl.js.map +1 -1
- package/dist/browser/components/MobileSystemControls/controls/SystemControlText.js +3 -2
- package/dist/browser/components/MobileSystemControls/controls/SystemControlText.js.map +1 -1
- package/dist/browser/components/MobileSystemControls/controls/index.js +36 -2
- package/dist/browser/components/MobileSystemControls/controls/index.js.map +1 -1
- package/dist/browser/components/MobileSystemControls/index.js +131 -3
- package/dist/browser/components/MobileSystemControls/index.js.map +1 -1
- package/dist/browser/components/SearchBar/SearchBar.js +3 -2
- package/dist/browser/components/SearchBar/SearchBar.js.map +1 -1
- package/dist/browser/components/SearchBar/index.js +31 -1
- package/dist/browser/components/SearchBar/index.js.map +1 -1
- package/dist/browser/components/SiteMenu/Menu.js +144 -13
- package/dist/browser/components/SiteMenu/Menu.js.map +1 -1
- package/dist/browser/components/SiteMenu/MenuListItem/MenuListItemContainer.js +73 -13
- package/dist/browser/components/SiteMenu/MenuListItem/MenuListItemContainer.js.map +1 -1
- package/dist/browser/components/SiteMenu/MenuListItem/index.js +131 -1
- package/dist/browser/components/SiteMenu/MenuListItem/index.js.map +1 -1
- package/dist/browser/components/SiteMenu/MenuListItem/list-item-components/ListItemTooltip.js +3 -2
- package/dist/browser/components/SiteMenu/MenuListItem/list-item-components/ListItemTooltip.js.map +1 -1
- package/dist/browser/components/SiteMenu/MenuListItem/list-item-components/MenuIcon.js +3 -2
- package/dist/browser/components/SiteMenu/MenuListItem/list-item-components/MenuIcon.js.map +1 -1
- package/dist/browser/components/SiteMenu/MenuListItem/list-item-components/MenuListItem.js +3 -2
- package/dist/browser/components/SiteMenu/MenuListItem/list-item-components/MenuListItem.js.map +1 -1
- package/dist/browser/components/SiteMenu/MenuListItem/list-item-components/index.js +30 -3
- package/dist/browser/components/SiteMenu/MenuListItem/list-item-components/index.js.map +1 -1
- package/dist/browser/components/SiteMenu/MenuListItem/sub-nav/SubNavListItemCollapse.js +3 -2
- package/dist/browser/components/SiteMenu/MenuListItem/sub-nav/SubNavListItemCollapse.js.map +1 -1
- package/dist/browser/components/SiteMenu/MenuListItem/sub-nav/SubNavToggleIconButton.js +3 -2
- package/dist/browser/components/SiteMenu/MenuListItem/sub-nav/SubNavToggleIconButton.js.map +1 -1
- package/dist/browser/components/SiteMenu/MenuListItem/sub-nav/index.js +29 -2
- package/dist/browser/components/SiteMenu/MenuListItem/sub-nav/index.js.map +1 -1
- package/dist/browser/components/SiteMenu/MenuSection.js +138 -7
- package/dist/browser/components/SiteMenu/MenuSection.js.map +1 -1
- package/dist/browser/components/SiteMenu/hooks/index.js +34 -1
- package/dist/browser/components/SiteMenu/hooks/index.js.map +1 -1
- package/dist/browser/components/SiteMenu/hooks/useMenuItemsShared.js +12 -2
- package/dist/browser/components/SiteMenu/hooks/useMenuItemsShared.js.map +1 -1
- package/dist/browser/components/SiteMenu/index.js +209 -5
- package/dist/browser/components/SiteMenu/index.js.map +1 -1
- package/dist/browser/components/SiteMenu/lib/index.js +0 -2
- package/dist/browser/components/SiteMenu/lib/index.js.map +1 -1
- package/dist/browser/components/Toolbar/Context/ContextToolbar.js +45 -4
- package/dist/browser/components/Toolbar/Context/ContextToolbar.js.map +1 -1
- package/dist/browser/components/Toolbar/Context/Logo.js +3 -2
- package/dist/browser/components/Toolbar/Context/Logo.js.map +1 -1
- package/dist/browser/components/Toolbar/Context/LogoLinkEx.js +18 -7
- package/dist/browser/components/Toolbar/Context/LogoLinkEx.js.map +1 -1
- package/dist/browser/components/Toolbar/Context/index.js +50 -1
- package/dist/browser/components/Toolbar/Context/index.js.map +1 -1
- package/dist/browser/components/Toolbar/System/SystemToolbar.js +179 -8
- package/dist/browser/components/Toolbar/System/SystemToolbar.js.map +1 -1
- package/dist/browser/components/Toolbar/System/index.js +198 -1
- package/dist/browser/components/Toolbar/System/index.js.map +1 -1
- package/dist/browser/components/Toolbar/index.js +247 -2
- package/dist/browser/components/Toolbar/index.js.map +1 -1
- package/dist/browser/components/index.js +526 -6
- package/dist/browser/components/index.js.map +1 -1
- package/dist/browser/contexts/Collapsible/context.js +2 -1
- package/dist/browser/contexts/Collapsible/context.js.map +1 -1
- package/dist/browser/contexts/Collapsible/index.js +28 -3
- package/dist/browser/contexts/Collapsible/index.js.map +1 -1
- package/dist/browser/contexts/Collapsible/provider.js +9 -3
- package/dist/browser/contexts/Collapsible/provider.js.map +1 -1
- package/dist/browser/contexts/Collapsible/use.js +8 -2
- package/dist/browser/contexts/Collapsible/use.js.map +1 -1
- package/dist/browser/contexts/index.js +28 -1
- package/dist/browser/contexts/index.js.map +1 -1
- package/dist/browser/index.js +545 -2
- package/dist/browser/index.js.map +1 -1
- package/dist/docs.json +91 -91
- package/package.json +13 -13
@@ -1,13 +1,24 @@
|
|
1
|
-
|
2
|
-
import { Typography, useTheme } from "@mui/material";
|
1
|
+
// src/components/Toolbar/Context/LogoLinkEx.tsx
|
2
|
+
import { Typography, useTheme as useTheme2 } from "@mui/material";
|
3
3
|
import { FlexRow } from "@xylabs/react-flexbox";
|
4
4
|
import { LinkEx } from "@xylabs/react-link";
|
5
|
-
|
6
|
-
|
5
|
+
|
6
|
+
// src/components/Toolbar/Context/Logo.tsx
|
7
|
+
import { useTheme } from "@mui/material";
|
8
|
+
import { jsx } from "react/jsx-runtime";
|
9
|
+
var Logo = (props) => {
|
7
10
|
const theme = useTheme();
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
+
const logoUrl = theme.palette.mode === "dark" ? "https://cdn.xy.company/img/brand/XYO/XYO_icon_white.svg" : "https://cdn.xy.company/img/brand/XYO/XYO_icon_white.svg";
|
12
|
+
return /* @__PURE__ */ jsx("img", { src: logoUrl, ...props });
|
13
|
+
};
|
14
|
+
|
15
|
+
// src/components/Toolbar/Context/LogoLinkEx.tsx
|
16
|
+
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
17
|
+
var LogoLinkEx = ({ to = "/", version = false, ...props }) => {
|
18
|
+
const theme = useTheme2();
|
19
|
+
return /* @__PURE__ */ jsx2(LinkEx, { to, ...props, children: /* @__PURE__ */ jsxs(FlexRow, { paddingX: "4px", children: [
|
20
|
+
/* @__PURE__ */ jsx2(Logo, { height: "40", width: "43" }),
|
21
|
+
version ? /* @__PURE__ */ jsx2(
|
11
22
|
Typography,
|
12
23
|
{
|
13
24
|
position: "absolute",
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../../../src/components/Toolbar/Context/LogoLinkEx.tsx"],"sourcesContent":["import { Typography, useTheme } from '@mui/material'\nimport { FlexRow } from '@xylabs/react-flexbox'\nimport { LinkEx, LinkExProps } from '@xylabs/react-link'\n\nimport { Logo } from './Logo'\n\nexport interface LogoLinkExProps extends LinkExProps {\n version?: boolean | string\n}\n\nexport const LogoLinkEx: React.FC<LogoLinkExProps> = ({ to = '/', version = false, ...props }) => {\n const theme = useTheme()\n return (\n <LinkEx to={to} {...props}>\n <FlexRow paddingX=\"4px\">\n <Logo height=\"40\" width=\"43\" />\n {version ? (\n <Typography\n position=\"absolute\"\n borderRadius={1}\n right={6}\n color={theme.palette.getContrastText(theme.palette.text.primary)}\n bottom={0}\n bgcolor={theme.palette.text.primary}\n paddingX=\"2px\"\n lineHeight={1}\n variant=\"caption\"\n border={`1px ${theme.palette.getContrastText(theme.palette.primary.main)} solid`}\n >\n {typeof version === 'string' ? version : '2.1'}\n </Typography>\n ) : null}\n </FlexRow>\n </LinkEx>\n )\n}\n"],"mappings":"
|
1
|
+
{"version":3,"sources":["../../../../../src/components/Toolbar/Context/LogoLinkEx.tsx","../../../../../src/components/Toolbar/Context/Logo.tsx"],"sourcesContent":["import { Typography, useTheme } from '@mui/material'\nimport { FlexRow } from '@xylabs/react-flexbox'\nimport { LinkEx, LinkExProps } from '@xylabs/react-link'\n\nimport { Logo } from './Logo'\n\nexport interface LogoLinkExProps extends LinkExProps {\n version?: boolean | string\n}\n\nexport const LogoLinkEx: React.FC<LogoLinkExProps> = ({ to = '/', version = false, ...props }) => {\n const theme = useTheme()\n return (\n <LinkEx to={to} {...props}>\n <FlexRow paddingX=\"4px\">\n <Logo height=\"40\" width=\"43\" />\n {version ? (\n <Typography\n position=\"absolute\"\n borderRadius={1}\n right={6}\n color={theme.palette.getContrastText(theme.palette.text.primary)}\n bottom={0}\n bgcolor={theme.palette.text.primary}\n paddingX=\"2px\"\n lineHeight={1}\n variant=\"caption\"\n border={`1px ${theme.palette.getContrastText(theme.palette.primary.main)} solid`}\n >\n {typeof version === 'string' ? version : '2.1'}\n </Typography>\n ) : null}\n </FlexRow>\n </LinkEx>\n )\n}\n","import { useTheme } from '@mui/material'\n\nexport const Logo: React.FC<React.DetailedHTMLProps<React.ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>> = (props) => {\n const theme = useTheme()\n const logoUrl =\n theme.palette.mode === 'dark'\n ? 'https://cdn.xy.company/img/brand/XYO/XYO_icon_white.svg'\n : 'https://cdn.xy.company/img/brand/XYO/XYO_icon_white.svg'\n return <img src={logoUrl} {...props} />\n}\n"],"mappings":";AAAA,SAAS,YAAY,YAAAA,iBAAgB;AACrC,SAAS,eAAe;AACxB,SAAS,cAA2B;;;ACFpC,SAAS,gBAAgB;AAQhB;AANF,IAAM,OAAuG,CAAC,UAAU;AAC7H,QAAM,QAAQ,SAAS;AACvB,QAAM,UACJ,MAAM,QAAQ,SAAS,SACnB,4DACA;AACN,SAAO,oBAAC,SAAI,KAAK,SAAU,GAAG,OAAO;AACvC;;;ADKM,SACE,OAAAC,MADF;AAJC,IAAM,aAAwC,CAAC,EAAE,KAAK,KAAK,UAAU,OAAO,GAAG,MAAM,MAAM;AAChG,QAAM,QAAQC,UAAS;AACvB,SACE,gBAAAD,KAAC,UAAO,IAAS,GAAG,OAClB,+BAAC,WAAQ,UAAS,OAChB;AAAA,oBAAAA,KAAC,QAAK,QAAO,MAAK,OAAM,MAAK;AAAA,IAC5B,UACC,gBAAAA;AAAA,MAAC;AAAA;AAAA,QACC,UAAS;AAAA,QACT,cAAc;AAAA,QACd,OAAO;AAAA,QACP,OAAO,MAAM,QAAQ,gBAAgB,MAAM,QAAQ,KAAK,OAAO;AAAA,QAC/D,QAAQ;AAAA,QACR,SAAS,MAAM,QAAQ,KAAK;AAAA,QAC5B,UAAS;AAAA,QACT,YAAY;AAAA,QACZ,SAAQ;AAAA,QACR,QAAQ,OAAO,MAAM,QAAQ,gBAAgB,MAAM,QAAQ,QAAQ,IAAI,CAAC;AAAA,QAEvE,iBAAO,YAAY,WAAW,UAAU;AAAA;AAAA,IAC3C,IACE;AAAA,KACN,GACF;AAEJ;","names":["useTheme","jsx","useTheme"]}
|
@@ -1,2 +1,51 @@
|
|
1
|
-
|
1
|
+
// src/components/Toolbar/Context/ContextToolbar.tsx
|
2
|
+
import { Toolbar } from "@mui/material";
|
3
|
+
|
4
|
+
// src/components/Toolbar/Context/LogoLinkEx.tsx
|
5
|
+
import { Typography, useTheme as useTheme2 } from "@mui/material";
|
6
|
+
import { FlexRow } from "@xylabs/react-flexbox";
|
7
|
+
import { LinkEx } from "@xylabs/react-link";
|
8
|
+
|
9
|
+
// src/components/Toolbar/Context/Logo.tsx
|
10
|
+
import { useTheme } from "@mui/material";
|
11
|
+
import { jsx } from "react/jsx-runtime";
|
12
|
+
var Logo = (props) => {
|
13
|
+
const theme = useTheme();
|
14
|
+
const logoUrl = theme.palette.mode === "dark" ? "https://cdn.xy.company/img/brand/XYO/XYO_icon_white.svg" : "https://cdn.xy.company/img/brand/XYO/XYO_icon_white.svg";
|
15
|
+
return /* @__PURE__ */ jsx("img", { src: logoUrl, ...props });
|
16
|
+
};
|
17
|
+
|
18
|
+
// src/components/Toolbar/Context/LogoLinkEx.tsx
|
19
|
+
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
20
|
+
var LogoLinkEx = ({ to = "/", version = false, ...props }) => {
|
21
|
+
const theme = useTheme2();
|
22
|
+
return /* @__PURE__ */ jsx2(LinkEx, { to, ...props, children: /* @__PURE__ */ jsxs(FlexRow, { paddingX: "4px", children: [
|
23
|
+
/* @__PURE__ */ jsx2(Logo, { height: "40", width: "43" }),
|
24
|
+
version ? /* @__PURE__ */ jsx2(
|
25
|
+
Typography,
|
26
|
+
{
|
27
|
+
position: "absolute",
|
28
|
+
borderRadius: 1,
|
29
|
+
right: 6,
|
30
|
+
color: theme.palette.getContrastText(theme.palette.text.primary),
|
31
|
+
bottom: 0,
|
32
|
+
bgcolor: theme.palette.text.primary,
|
33
|
+
paddingX: "2px",
|
34
|
+
lineHeight: 1,
|
35
|
+
variant: "caption",
|
36
|
+
border: `1px ${theme.palette.getContrastText(theme.palette.primary.main)} solid`,
|
37
|
+
children: typeof version === "string" ? version : "2.1"
|
38
|
+
}
|
39
|
+
) : null
|
40
|
+
] }) });
|
41
|
+
};
|
42
|
+
|
43
|
+
// src/components/Toolbar/Context/ContextToolbar.tsx
|
44
|
+
import { jsx as jsx3 } from "react/jsx-runtime";
|
45
|
+
var ContextToolbar = ({ logoTo = "/", version = false, ...props }) => {
|
46
|
+
return /* @__PURE__ */ jsx3(Toolbar, { ...props, children: /* @__PURE__ */ jsx3(LogoLinkEx, { version, to: logoTo }) });
|
47
|
+
};
|
48
|
+
export {
|
49
|
+
ContextToolbar
|
50
|
+
};
|
2
51
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../../../src/components/Toolbar/Context/
|
1
|
+
{"version":3,"sources":["../../../../../src/components/Toolbar/Context/ContextToolbar.tsx","../../../../../src/components/Toolbar/Context/LogoLinkEx.tsx","../../../../../src/components/Toolbar/Context/Logo.tsx"],"sourcesContent":["import { Toolbar, ToolbarProps } from '@mui/material'\nimport { To } from 'react-router-dom'\n\nimport { LogoLinkEx } from './LogoLinkEx'\n\nexport interface ContextToolbarProps extends ToolbarProps {\n logoTo?: To\n version?: boolean\n}\n\nexport const ContextToolbar: React.FC<ContextToolbarProps> = ({ logoTo = '/', version = false, ...props }) => {\n return (\n <Toolbar {...props}>\n <LogoLinkEx version={version} to={logoTo} />\n </Toolbar>\n )\n}\n","import { Typography, useTheme } from '@mui/material'\nimport { FlexRow } from '@xylabs/react-flexbox'\nimport { LinkEx, LinkExProps } from '@xylabs/react-link'\n\nimport { Logo } from './Logo'\n\nexport interface LogoLinkExProps extends LinkExProps {\n version?: boolean | string\n}\n\nexport const LogoLinkEx: React.FC<LogoLinkExProps> = ({ to = '/', version = false, ...props }) => {\n const theme = useTheme()\n return (\n <LinkEx to={to} {...props}>\n <FlexRow paddingX=\"4px\">\n <Logo height=\"40\" width=\"43\" />\n {version ? (\n <Typography\n position=\"absolute\"\n borderRadius={1}\n right={6}\n color={theme.palette.getContrastText(theme.palette.text.primary)}\n bottom={0}\n bgcolor={theme.palette.text.primary}\n paddingX=\"2px\"\n lineHeight={1}\n variant=\"caption\"\n border={`1px ${theme.palette.getContrastText(theme.palette.primary.main)} solid`}\n >\n {typeof version === 'string' ? version : '2.1'}\n </Typography>\n ) : null}\n </FlexRow>\n </LinkEx>\n )\n}\n","import { useTheme } from '@mui/material'\n\nexport const Logo: React.FC<React.DetailedHTMLProps<React.ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>> = (props) => {\n const theme = useTheme()\n const logoUrl =\n theme.palette.mode === 'dark'\n ? 'https://cdn.xy.company/img/brand/XYO/XYO_icon_white.svg'\n : 'https://cdn.xy.company/img/brand/XYO/XYO_icon_white.svg'\n return <img src={logoUrl} {...props} />\n}\n"],"mappings":";AAAA,SAAS,eAA6B;;;ACAtC,SAAS,YAAY,YAAAA,iBAAgB;AACrC,SAAS,eAAe;AACxB,SAAS,cAA2B;;;ACFpC,SAAS,gBAAgB;AAQhB;AANF,IAAM,OAAuG,CAAC,UAAU;AAC7H,QAAM,QAAQ,SAAS;AACvB,QAAM,UACJ,MAAM,QAAQ,SAAS,SACnB,4DACA;AACN,SAAO,oBAAC,SAAI,KAAK,SAAU,GAAG,OAAO;AACvC;;;ADKM,SACE,OAAAC,MADF;AAJC,IAAM,aAAwC,CAAC,EAAE,KAAK,KAAK,UAAU,OAAO,GAAG,MAAM,MAAM;AAChG,QAAM,QAAQC,UAAS;AACvB,SACE,gBAAAD,KAAC,UAAO,IAAS,GAAG,OAClB,+BAAC,WAAQ,UAAS,OAChB;AAAA,oBAAAA,KAAC,QAAK,QAAO,MAAK,OAAM,MAAK;AAAA,IAC5B,UACC,gBAAAA;AAAA,MAAC;AAAA;AAAA,QACC,UAAS;AAAA,QACT,cAAc;AAAA,QACd,OAAO;AAAA,QACP,OAAO,MAAM,QAAQ,gBAAgB,MAAM,QAAQ,KAAK,OAAO;AAAA,QAC/D,QAAQ;AAAA,QACR,SAAS,MAAM,QAAQ,KAAK;AAAA,QAC5B,UAAS;AAAA,QACT,YAAY;AAAA,QACZ,SAAQ;AAAA,QACR,QAAQ,OAAO,MAAM,QAAQ,gBAAgB,MAAM,QAAQ,QAAQ,IAAI,CAAC;AAAA,QAEvE,iBAAO,YAAY,WAAW,UAAU;AAAA;AAAA,IAC3C,IACE;AAAA,KACN,GACF;AAEJ;;;ADtBM,gBAAAE,YAAA;AAHC,IAAM,iBAAgD,CAAC,EAAE,SAAS,KAAK,UAAU,OAAO,GAAG,MAAM,MAAM;AAC5G,SACE,gBAAAA,KAAC,WAAS,GAAG,OACX,0BAAAA,KAAC,cAAW,SAAkB,IAAI,QAAQ,GAC5C;AAEJ;","names":["useTheme","jsx","useTheme","jsx"]}
|
@@ -1,10 +1,181 @@
|
|
1
|
-
|
1
|
+
// src/components/Toolbar/System/SystemToolbar.tsx
|
2
2
|
import { Paper, Toolbar } from "@mui/material";
|
3
|
-
import { FlexRow } from "@xylabs/react-flexbox";
|
3
|
+
import { FlexRow as FlexRow3 } from "@xylabs/react-flexbox";
|
4
4
|
import { DarkModeIconButton } from "@xyo-network/react-app-settings";
|
5
5
|
import { NetworkSelectEx } from "@xyo-network/react-network";
|
6
|
-
|
7
|
-
|
6
|
+
|
7
|
+
// src/contexts/Collapsible/context.ts
|
8
|
+
import { createContextEx } from "@xyo-network/react-shared";
|
9
|
+
var CollapsibleContext = createContextEx();
|
10
|
+
|
11
|
+
// src/contexts/Collapsible/use.tsx
|
12
|
+
import { useContextEx } from "@xyo-network/react-shared";
|
13
|
+
var useCollapsible = () => useContextEx(CollapsibleContext, "Collapsible", false);
|
14
|
+
|
15
|
+
// src/components/SiteMenu/Menu.tsx
|
16
|
+
import { Menu as MenuIcon2, Settings as SettingsIcon } from "@mui/icons-material";
|
17
|
+
import { IconButton as IconButton2, List as List2, SwipeableDrawer } from "@mui/material";
|
18
|
+
import { FlexRow as FlexRow2 } from "@xylabs/react-flexbox";
|
19
|
+
import { useEffect, useState as useState2 } from "react";
|
20
|
+
|
21
|
+
// src/components/SiteMenu/MenuListItem/MenuListItemContainer.tsx
|
22
|
+
import { ListItemText, useTheme as useTheme2 } from "@mui/material";
|
23
|
+
import { FlexRow } from "@xylabs/react-flexbox";
|
24
|
+
import { LinkEx } from "@xylabs/react-link";
|
25
|
+
import { useState } from "react";
|
26
|
+
|
27
|
+
// src/components/SiteMenu/MenuListItem/list-item-components/ListItemTooltip.tsx
|
28
|
+
import { Tooltip } from "@mui/material";
|
29
|
+
import { FlexCol } from "@xylabs/react-flexbox";
|
30
|
+
import { VscInfo } from "react-icons/vsc/index.js";
|
31
|
+
import { jsx } from "react/jsx-runtime";
|
32
|
+
var ListItemTooltip = ({ title, ...props }) => {
|
33
|
+
return /* @__PURE__ */ jsx(Tooltip, { title, placement: "right", ...props, children: /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(FlexCol, { justifyContent: "center", children: /* @__PURE__ */ jsx(VscInfo, { color: "grey" }) }) }) });
|
34
|
+
};
|
35
|
+
|
36
|
+
// src/components/SiteMenu/MenuListItem/list-item-components/MenuIcon.tsx
|
37
|
+
import { Typography } from "@mui/material";
|
38
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
39
|
+
var MenuIcon = ({ icon, ...props }) => {
|
40
|
+
return /* @__PURE__ */ jsx2(Typography, { display: "flex", ...props, children: icon });
|
41
|
+
};
|
42
|
+
|
43
|
+
// src/components/SiteMenu/MenuListItem/list-item-components/MenuListItem.tsx
|
44
|
+
import { ListItem } from "@mui/material";
|
45
|
+
import { jsx as jsx3 } from "react/jsx-runtime";
|
46
|
+
var MenuListItem = ({ iconOnly, collapseEnd, sx, children, dense, ...props }) => {
|
47
|
+
const listItemSx = iconOnly ? { borderRadius: "50%", display: "inline-flex", flexGrow: 0, width: "auto" } : { width: "100%" };
|
48
|
+
const spacingSx = collapseEnd ? { columnGap: 0 } : { columnGap: 1.5 };
|
49
|
+
const paddingSx = dense ? { px: "8px" } : { px: "12px" };
|
50
|
+
return /* @__PURE__ */ jsx3(ListItem, { sx: { ...listItemSx, ...spacingSx, ...paddingSx, ...sx }, ...props, children });
|
51
|
+
};
|
52
|
+
|
53
|
+
// src/components/SiteMenu/MenuListItem/sub-nav/SubNavListItemCollapse.tsx
|
54
|
+
import { Collapse, List } from "@mui/material";
|
55
|
+
import { jsx as jsx4 } from "react/jsx-runtime";
|
56
|
+
var SubNavListItemsCollapse = ({ collapse, openSubNav, children, ...props }) => {
|
57
|
+
return /* @__PURE__ */ jsx4(Collapse, { in: collapse == true ? false : openSubNav, ...props, children: /* @__PURE__ */ jsx4(List, { children }) });
|
58
|
+
};
|
59
|
+
|
60
|
+
// src/components/SiteMenu/MenuListItem/sub-nav/SubNavToggleIconButton.tsx
|
61
|
+
import { IconButton, useTheme } from "@mui/material";
|
62
|
+
import { VscChevronDown } from "react-icons/vsc/index.js";
|
63
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
64
|
+
var SubNavToggleIconButton = ({ setOpenSubNav, openSubNav }) => {
|
65
|
+
const theme = useTheme();
|
66
|
+
return /* @__PURE__ */ jsx5(
|
67
|
+
IconButton,
|
68
|
+
{
|
69
|
+
onClick: (event) => {
|
70
|
+
event.stopPropagation();
|
71
|
+
setOpenSubNav?.(!openSubNav);
|
72
|
+
},
|
73
|
+
sx: { marginRight: theme.spacing(0.5) },
|
74
|
+
children: /* @__PURE__ */ jsx5(VscChevronDown, { fontSize: "16px" })
|
75
|
+
}
|
76
|
+
);
|
77
|
+
};
|
78
|
+
|
79
|
+
// src/components/SiteMenu/MenuListItem/MenuListItemContainer.tsx
|
80
|
+
import { Fragment, jsx as jsx6, jsxs } from "react/jsx-runtime";
|
81
|
+
var MenuListItemContainer = ({
|
82
|
+
style,
|
83
|
+
icon,
|
84
|
+
iconMenuTextSpacing,
|
85
|
+
iconOnly,
|
86
|
+
onButtonClick,
|
87
|
+
primary,
|
88
|
+
subNavListItems,
|
89
|
+
sx,
|
90
|
+
tooltip,
|
91
|
+
to,
|
92
|
+
...props
|
93
|
+
}) => {
|
94
|
+
const { dense } = props;
|
95
|
+
const theme = useTheme2();
|
96
|
+
const { collapse } = useCollapsible();
|
97
|
+
const [openSubNav, setOpenSubNav] = useState(false);
|
98
|
+
const [hovered, setHovered] = useState(false);
|
99
|
+
const resolvedIconMenuTextSpacing = iconMenuTextSpacing ? iconMenuTextSpacing : theme.spacing(1);
|
100
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
101
|
+
/* @__PURE__ */ jsxs(
|
102
|
+
MenuListItem,
|
103
|
+
{
|
104
|
+
disableGutters: true,
|
105
|
+
iconOnly,
|
106
|
+
onClick: onButtonClick,
|
107
|
+
dense,
|
108
|
+
sx: { justifyContent: "space-between", ...sx },
|
109
|
+
style: { whiteSpace: "nowrap", ...style },
|
110
|
+
...props,
|
111
|
+
children: [
|
112
|
+
/* @__PURE__ */ jsx6(
|
113
|
+
LinkEx,
|
114
|
+
{
|
115
|
+
onMouseEnter: () => setHovered(true),
|
116
|
+
onMouseLeave: () => setHovered(false),
|
117
|
+
color: "inherit",
|
118
|
+
to,
|
119
|
+
sx: {
|
120
|
+
"& :hover": {
|
121
|
+
cursor: "pointer",
|
122
|
+
textDecoration: "underline"
|
123
|
+
}
|
124
|
+
},
|
125
|
+
children: /* @__PURE__ */ jsxs(FlexRow, { children: [
|
126
|
+
/* @__PURE__ */ jsx6(MenuIcon, { icon, paddingRight: resolvedIconMenuTextSpacing, color: hovered ? "secondary" : "inherit" }),
|
127
|
+
/* @__PURE__ */ jsx6(ListItemText, { primary })
|
128
|
+
] })
|
129
|
+
}
|
130
|
+
),
|
131
|
+
/* @__PURE__ */ jsxs(FlexRow, { style: { marginLeft: theme.spacing(1) }, children: [
|
132
|
+
subNavListItems ? /* @__PURE__ */ jsx6(SubNavToggleIconButton, { setOpenSubNav, openSubNav }) : null,
|
133
|
+
tooltip ? /* @__PURE__ */ jsx6(ListItemTooltip, { title: tooltip }) : null
|
134
|
+
] })
|
135
|
+
]
|
136
|
+
}
|
137
|
+
),
|
138
|
+
subNavListItems ? /* @__PURE__ */ jsx6(SubNavListItemsCollapse, { openSubNav, collapse, children: subNavListItems?.map((item, index) => /* @__PURE__ */ jsx6(MenuListItemContainer, { dense, sx: { pl: theme.spacing(1) }, ...item }, index)) }) : null
|
139
|
+
] });
|
140
|
+
};
|
141
|
+
|
142
|
+
// src/components/SiteMenu/Menu.tsx
|
143
|
+
import { jsx as jsx7, jsxs as jsxs2 } from "react/jsx-runtime";
|
144
|
+
var SiteMenu = ({ children, onMenuToggle, side = "right", ...props }) => {
|
145
|
+
const [open, setOpen] = useState2(false);
|
146
|
+
useEffect(() => {
|
147
|
+
onMenuToggle?.(open);
|
148
|
+
}, [onMenuToggle, open]);
|
149
|
+
return /* @__PURE__ */ jsxs2(FlexRow2, { alignItems: "stretch", ...props, children: [
|
150
|
+
/* @__PURE__ */ jsx7(
|
151
|
+
IconButton2,
|
152
|
+
{
|
153
|
+
size: "small",
|
154
|
+
color: "inherit",
|
155
|
+
onClick: () => {
|
156
|
+
setOpen(!open);
|
157
|
+
},
|
158
|
+
children: /* @__PURE__ */ jsx7(MenuIcon2, { fontSize: "large" })
|
159
|
+
}
|
160
|
+
),
|
161
|
+
/* @__PURE__ */ jsx7(
|
162
|
+
SwipeableDrawer,
|
163
|
+
{
|
164
|
+
anchor: side,
|
165
|
+
open,
|
166
|
+
onClick: () => setOpen(false),
|
167
|
+
onKeyDown: () => setOpen(false),
|
168
|
+
onClose: () => setOpen(false),
|
169
|
+
onOpen: () => setOpen(true),
|
170
|
+
children: children ?? /* @__PURE__ */ jsx7(List2, { children: /* @__PURE__ */ jsx7(MenuListItemContainer, { primary: "Settings", icon: /* @__PURE__ */ jsx7(SettingsIcon, {}), to: "/settings" }) })
|
171
|
+
}
|
172
|
+
)
|
173
|
+
] });
|
174
|
+
};
|
175
|
+
|
176
|
+
// src/components/Toolbar/System/SystemToolbar.tsx
|
177
|
+
import { jsx as jsx8, jsxs as jsxs3 } from "react/jsx-runtime";
|
178
|
+
var SystemToolbar = ({
|
8
179
|
children,
|
9
180
|
darkModeButton = false,
|
10
181
|
hideNetworkSelect,
|
@@ -14,12 +185,12 @@ const SystemToolbar = ({
|
|
14
185
|
precedingChildren,
|
15
186
|
...props
|
16
187
|
}) => {
|
17
|
-
return /* @__PURE__ */
|
188
|
+
return /* @__PURE__ */ jsxs3(Toolbar, { ...props, children: [
|
18
189
|
precedingChildren,
|
19
|
-
hideNetworkSelect ? null : /* @__PURE__ */
|
190
|
+
hideNetworkSelect ? null : /* @__PURE__ */ jsx8(FlexRow3, { marginX: 0.5, children: /* @__PURE__ */ jsx8(Paper, { variant: "elevation", children: /* @__PURE__ */ jsx8(NetworkSelectEx, { fullWidth: true, ...networkSelectProps }) }) }),
|
20
191
|
children,
|
21
|
-
darkModeButton ? /* @__PURE__ */
|
22
|
-
menuItems ? /* @__PURE__ */
|
192
|
+
darkModeButton ? /* @__PURE__ */ jsx8(DarkModeIconButton, { color: "inherit" }) : null,
|
193
|
+
menuItems ? /* @__PURE__ */ jsx8(SiteMenu, { onMenuToggle, children: menuItems }) : null
|
23
194
|
] });
|
24
195
|
};
|
25
196
|
export {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../../../src/components/Toolbar/System/SystemToolbar.tsx"],"sourcesContent":["import { Paper, Toolbar, ToolbarProps } from '@mui/material'\nimport { FlexRow } from '@xylabs/react-flexbox'\nimport { DarkModeIconButton } from '@xyo-network/react-app-settings'\nimport { NetworkSelectEx, NetworkSelectExProps } from '@xyo-network/react-network'\nimport { ReactNode } from 'react'\n\nimport { SiteMenu, SiteMenuProps } from '../../SiteMenu'\n\nexport interface SystemToolbarProps extends ToolbarProps {\n darkModeButton?: boolean\n developerMode?: boolean\n hideNetworkSelect?: boolean\n menuItems?: ReactNode\n networkSelectProps?: NetworkSelectExProps\n onMenuToggle?: SiteMenuProps['onMenuToggle']\n precedingChildren?: ReactNode\n}\n\nexport const SystemToolbar: React.FC<SystemToolbarProps> = ({\n children,\n darkModeButton = false,\n hideNetworkSelect,\n menuItems,\n networkSelectProps,\n onMenuToggle,\n precedingChildren,\n ...props\n}) => {\n return (\n <Toolbar {...props}>\n {precedingChildren}\n {hideNetworkSelect ? null : (\n <FlexRow marginX={0.5}>\n <Paper variant=\"elevation\">\n <NetworkSelectEx fullWidth {...networkSelectProps} />\n </Paper>\n </FlexRow>\n )}\n {children}\n {darkModeButton ? <DarkModeIconButton color=\"inherit\" /> : null}\n {menuItems ? <SiteMenu onMenuToggle={onMenuToggle}>{menuItems}</SiteMenu> : null}\n </Toolbar>\n )\n}\n"],"mappings":"AA6BI,SAKQ,KALR;AA7BJ,SAAS,OAAO,eAA6B;AAC7C,SAAS,eAAe;AACxB,SAAS,0BAA0B;AACnC,SAAS,uBAA6C;AAGtD,SAAS,gBAA+B;AAYjC,MAAM,gBAA8C,CAAC;AAAA,EAC1D;AAAA,EACA,iBAAiB;AAAA,EACjB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAM;AACJ,SACE,qBAAC,WAAS,GAAG,OACV;AAAA;AAAA,IACA,oBAAoB,OACnB,oBAAC,WAAQ,SAAS,KAChB,8BAAC,SAAM,SAAQ,aACb,8BAAC,mBAAgB,WAAS,MAAE,GAAG,oBAAoB,GACrD,GACF;AAAA,IAED;AAAA,IACA,iBAAiB,oBAAC,sBAAmB,OAAM,WAAU,IAAK;AAAA,IAC1D,YAAY,oBAAC,YAAS,cAA6B,qBAAU,IAAc;AAAA,KAC9E;AAEJ;","names":[]}
|
1
|
+
{"version":3,"sources":["../../../../../src/components/Toolbar/System/SystemToolbar.tsx","../../../../../src/contexts/Collapsible/context.ts","../../../../../src/contexts/Collapsible/use.tsx","../../../../../src/components/SiteMenu/Menu.tsx","../../../../../src/components/SiteMenu/MenuListItem/MenuListItemContainer.tsx","../../../../../src/components/SiteMenu/MenuListItem/list-item-components/ListItemTooltip.tsx","../../../../../src/components/SiteMenu/MenuListItem/list-item-components/MenuIcon.tsx","../../../../../src/components/SiteMenu/MenuListItem/list-item-components/MenuListItem.tsx","../../../../../src/components/SiteMenu/MenuListItem/sub-nav/SubNavListItemCollapse.tsx","../../../../../src/components/SiteMenu/MenuListItem/sub-nav/SubNavToggleIconButton.tsx"],"sourcesContent":["import { Paper, Toolbar, ToolbarProps } from '@mui/material'\nimport { FlexRow } from '@xylabs/react-flexbox'\nimport { DarkModeIconButton } from '@xyo-network/react-app-settings'\nimport { NetworkSelectEx, NetworkSelectExProps } from '@xyo-network/react-network'\nimport { ReactNode } from 'react'\n\nimport { SiteMenu, SiteMenuProps } from '../../SiteMenu'\n\nexport interface SystemToolbarProps extends ToolbarProps {\n darkModeButton?: boolean\n developerMode?: boolean\n hideNetworkSelect?: boolean\n menuItems?: ReactNode\n networkSelectProps?: NetworkSelectExProps\n onMenuToggle?: SiteMenuProps['onMenuToggle']\n precedingChildren?: ReactNode\n}\n\nexport const SystemToolbar: React.FC<SystemToolbarProps> = ({\n children,\n darkModeButton = false,\n hideNetworkSelect,\n menuItems,\n networkSelectProps,\n onMenuToggle,\n precedingChildren,\n ...props\n}) => {\n return (\n <Toolbar {...props}>\n {precedingChildren}\n {hideNetworkSelect ? null : (\n <FlexRow marginX={0.5}>\n <Paper variant=\"elevation\">\n <NetworkSelectEx fullWidth {...networkSelectProps} />\n </Paper>\n </FlexRow>\n )}\n {children}\n {darkModeButton ? <DarkModeIconButton color=\"inherit\" /> : null}\n {menuItems ? <SiteMenu onMenuToggle={onMenuToggle}>{menuItems}</SiteMenu> : null}\n </Toolbar>\n )\n}\n","import { createContextEx } from '@xyo-network/react-shared'\n\nimport { CollapsibleState } from './State'\n\nexport const CollapsibleContext = createContextEx<CollapsibleState>()\n","import { useContextEx } from '@xyo-network/react-shared'\n\nimport { CollapsibleContext } from './context'\n\nexport const useCollapsible = () => useContextEx(CollapsibleContext, 'Collapsible', false)\n","import { Menu as MenuIcon, Settings as SettingsIcon } from '@mui/icons-material'\nimport { IconButton, List, SwipeableDrawer } from '@mui/material'\nimport { FlexBoxProps, FlexRow } from '@xylabs/react-flexbox'\nimport { useEffect, useState } from 'react'\n\nimport { MenuListItemContainer } from './MenuListItem'\n\nexport interface SiteMenuProps extends FlexBoxProps {\n hideSettingsMenuItem?: boolean\n onMenuToggle?: (state?: boolean) => void\n side?: 'left' | 'right' | 'top' | 'bottom'\n}\n\nexport const SiteMenu: React.FC<SiteMenuProps> = ({ children, onMenuToggle, side = 'right', ...props }) => {\n const [open, setOpen] = useState(false)\n\n useEffect(() => {\n onMenuToggle?.(open)\n }, [onMenuToggle, open])\n\n return (\n <FlexRow alignItems=\"stretch\" {...props}>\n <IconButton\n size=\"small\"\n color=\"inherit\"\n onClick={() => {\n setOpen(!open)\n }}\n >\n <MenuIcon fontSize=\"large\" />\n </IconButton>\n <SwipeableDrawer\n anchor={side}\n open={open}\n onClick={() => setOpen(false)}\n onKeyDown={() => setOpen(false)}\n onClose={() => setOpen(false)}\n onOpen={() => setOpen(true)}\n >\n {children ?? (\n <List>\n <MenuListItemContainer primary=\"Settings\" icon={<SettingsIcon />} to=\"/settings\" />\n </List>\n )}\n </SwipeableDrawer>\n </FlexRow>\n )\n}\n","import { ListItemProps, ListItemText, useTheme } from '@mui/material'\nimport { FlexRow } from '@xylabs/react-flexbox'\nimport { LinkEx } from '@xylabs/react-link'\nimport { useState } from 'react'\n\nimport { useCollapsible } from '../../../contexts'\nimport { MenuListItemBase, NavListItemProps } from '../lib'\nimport { ListItemTooltip, MenuIcon, MenuListItem } from './list-item-components'\nimport { SubNavListItemsCollapse, SubNavToggleIconButton } from './sub-nav'\n\nexport interface MenuListItemProps extends NavListItemProps, MenuListItemBase, ListItemProps {\n iconMenuTextSpacing?: string\n iconOnly?: boolean\n subNavListItems?: NavListItemProps[]\n subNavOpen?: boolean\n}\n\nexport const MenuListItemContainer: React.FC<MenuListItemProps> = ({\n style,\n icon,\n iconMenuTextSpacing,\n iconOnly,\n onButtonClick,\n primary,\n subNavListItems,\n sx,\n tooltip,\n to,\n ...props\n}) => {\n const { dense } = props\n const theme = useTheme()\n const { collapse } = useCollapsible()\n const [openSubNav, setOpenSubNav] = useState(false)\n const [hovered, setHovered] = useState(false)\n const resolvedIconMenuTextSpacing = iconMenuTextSpacing ? iconMenuTextSpacing : theme.spacing(1)\n\n return (\n <>\n <MenuListItem\n disableGutters\n iconOnly={iconOnly}\n onClick={onButtonClick}\n dense={dense}\n sx={{ justifyContent: 'space-between', ...sx }}\n style={{ whiteSpace: 'nowrap', ...style }}\n {...props}\n >\n <LinkEx\n onMouseEnter={() => setHovered(true)}\n onMouseLeave={() => setHovered(false)}\n color=\"inherit\"\n to={to}\n sx={{\n '& :hover': {\n cursor: 'pointer',\n textDecoration: 'underline',\n },\n }}\n >\n <FlexRow>\n <MenuIcon icon={icon} paddingRight={resolvedIconMenuTextSpacing} color={hovered ? 'secondary' : 'inherit'} />\n <ListItemText primary={primary} />\n </FlexRow>\n </LinkEx>\n <FlexRow style={{ marginLeft: theme.spacing(1) }}>\n {subNavListItems ? <SubNavToggleIconButton setOpenSubNav={setOpenSubNav} openSubNav={openSubNav} /> : null}\n {tooltip ? <ListItemTooltip title={tooltip} /> : null}\n </FlexRow>\n </MenuListItem>\n {subNavListItems ? (\n <SubNavListItemsCollapse openSubNav={openSubNav} collapse={collapse}>\n {subNavListItems?.map((item, index) => <MenuListItemContainer dense={dense} sx={{ pl: theme.spacing(1) }} key={index} {...item} />)}\n </SubNavListItemsCollapse>\n ) : null}\n </>\n )\n}\n","import { Tooltip, TooltipProps } from '@mui/material'\nimport { FlexCol } from '@xylabs/react-flexbox'\n// eslint-disable-next-line import/no-internal-modules\nimport { VscInfo } from 'react-icons/vsc/index.js'\n\nexport interface ListItemTooltipProps extends Omit<TooltipProps, 'children'> {\n title: string\n}\n\nexport const ListItemTooltip: React.FC<ListItemTooltipProps> = ({ title, ...props }) => {\n return (\n <Tooltip title={title} placement=\"right\" {...props}>\n {/* Needs div so it can work, the hovering doesn't work with a FlexCol */}\n <div>\n <FlexCol justifyContent=\"center\">\n <VscInfo color=\"grey\" />\n </FlexCol>\n </div>\n </Tooltip>\n )\n}\n","import { Typography, TypographyProps } from '@mui/material'\nimport { ReactNode } from 'react'\n\nexport interface MenuIconProps extends TypographyProps {\n icon?: ReactNode\n}\n\nexport const MenuIcon: React.FC<MenuIconProps> = ({ icon, ...props }) => {\n return (\n <Typography display=\"flex\" {...props}>\n {icon}\n </Typography>\n )\n}\n","import { ListItem, ListItemProps } from '@mui/material'\n\nimport { MenuListItemBase } from '../../lib'\n\nexport interface ListItemExProps extends MenuListItemBase, ListItemProps {}\n\nexport const MenuListItem: React.FC<ListItemExProps> = ({ iconOnly, collapseEnd, sx, children, dense, ...props }) => {\n const listItemSx = iconOnly ? { borderRadius: '50%', display: 'inline-flex', flexGrow: 0, width: 'auto' } : { width: '100%' }\n // wait till collapseEnds to remove the spacing between items\n const spacingSx = collapseEnd ? { columnGap: 0 } : { columnGap: 1.5 }\n // adjusts to the paddingY value which does NOT scale along the theme.spacing\n const paddingSx = dense ? { px: '8px' } : { px: '12px' }\n return (\n <ListItem sx={{ ...listItemSx, ...spacingSx, ...paddingSx, ...sx }} {...props}>\n {children}\n </ListItem>\n )\n}\n","import { Collapse, CollapseProps, List } from '@mui/material'\nimport { WithChildren } from '@xylabs/react-shared'\n\nimport { NavListItemProps } from '../../lib'\n\nexport interface SubNavListItemsCollapseProps extends WithChildren, CollapseProps {\n collapse?: boolean\n openSubNav?: boolean\n subNavListItems?: NavListItemProps[]\n}\n\nexport const SubNavListItemsCollapse: React.FC<SubNavListItemsCollapseProps> = ({ collapse, openSubNav, children, ...props }) => {\n return (\n <Collapse in={collapse == true ? false : openSubNav} {...props}>\n <List>{children}</List>\n </Collapse>\n )\n}\n","import { IconButton, IconButtonProps, useTheme } from '@mui/material'\nimport { Dispatch, SetStateAction, SyntheticEvent } from 'react'\n// eslint-disable-next-line import/no-internal-modules\nimport { VscChevronDown } from 'react-icons/vsc/index.js'\n\nexport interface SubNavToggleIconButtonProps extends IconButtonProps {\n openSubNav?: boolean\n setOpenSubNav?: Dispatch<SetStateAction<boolean>>\n}\n\nexport const SubNavToggleIconButton: React.FC<SubNavToggleIconButtonProps> = ({ setOpenSubNav, openSubNav }) => {\n const theme = useTheme()\n return (\n <IconButton\n onClick={(event: SyntheticEvent) => {\n event.stopPropagation()\n setOpenSubNav?.(!openSubNav)\n }}\n sx={{ marginRight: theme.spacing(0.5) }}\n >\n <VscChevronDown fontSize=\"16px\" />\n </IconButton>\n )\n}\n"],"mappings":";AAAA,SAAS,OAAO,eAA6B;AAC7C,SAAS,WAAAA,gBAAe;AACxB,SAAS,0BAA0B;AACnC,SAAS,uBAA6C;;;ACHtD,SAAS,uBAAuB;AAIzB,IAAM,qBAAqB,gBAAkC;;;ACJpE,SAAS,oBAAoB;AAItB,IAAM,iBAAiB,MAAM,aAAa,oBAAoB,eAAe,KAAK;;;ACJzF,SAAS,QAAQC,WAAU,YAAY,oBAAoB;AAC3D,SAAS,cAAAC,aAAY,QAAAC,OAAM,uBAAuB;AAClD,SAAuB,WAAAC,gBAAe;AACtC,SAAS,WAAW,YAAAC,iBAAgB;;;ACHpC,SAAwB,cAAc,YAAAC,iBAAgB;AACtD,SAAS,eAAe;AACxB,SAAS,cAAc;AACvB,SAAS,gBAAgB;;;ACHzB,SAAS,eAA6B;AACtC,SAAS,eAAe;AAExB,SAAS,eAAe;AAYd;AANH,IAAM,kBAAkD,CAAC,EAAE,OAAO,GAAG,MAAM,MAAM;AACtF,SACE,oBAAC,WAAQ,OAAc,WAAU,SAAS,GAAG,OAE3C,8BAAC,SACC,8BAAC,WAAQ,gBAAe,UACtB,8BAAC,WAAQ,OAAM,QAAO,GACxB,GACF,GACF;AAEJ;;;ACpBA,SAAS,kBAAmC;AASxC,gBAAAC,YAAA;AAFG,IAAM,WAAoC,CAAC,EAAE,MAAM,GAAG,MAAM,MAAM;AACvE,SAC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A,EACA,iBAAiB;AAAA,EACjB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAM;AACJ,SACE,gBAAAA,MAAC,WAAS,GAAG,OACV;AAAA;AAAA,IACA,oBAAoB,OACnB,gBAAAD,KAACE,UAAA,EAAQ,SAAS,KAChB,0BAAAF,KAAC,SAAM,SAAQ,aACb,0BAAAA,KAAC,mBAAgB,WAAS,MAAE,GAAG,oBAAoB,GACrD,GACF;AAAA,IAED;AAAA,IACA,iBAAiB,gBAAAA,KAAC,sBAAmB,OAAM,WAAU,IAAK;AAAA,IAC1D,YAAY,gBAAAA,KAAC,YAAS,cAA6B,qBAAU,IAAc;AAAA,KAC9E;AAEJ;","names":["FlexRow","MenuIcon","IconButton","List","FlexRow","useState","useTheme","jsx","jsx","jsx","jsx","jsx","useTheme","jsx","jsxs","useState","FlexRow","IconButton","MenuIcon","List","jsx","jsxs","FlexRow"]}
|
@@ -1,2 +1,199 @@
|
|
1
|
-
|
1
|
+
// src/components/Toolbar/System/SystemToolbar.tsx
|
2
|
+
import { Paper, Toolbar } from "@mui/material";
|
3
|
+
import { FlexRow as FlexRow3 } from "@xylabs/react-flexbox";
|
4
|
+
import { DarkModeIconButton } from "@xyo-network/react-app-settings";
|
5
|
+
import { NetworkSelectEx } from "@xyo-network/react-network";
|
6
|
+
|
7
|
+
// src/contexts/Collapsible/context.ts
|
8
|
+
import { createContextEx } from "@xyo-network/react-shared";
|
9
|
+
var CollapsibleContext = createContextEx();
|
10
|
+
|
11
|
+
// src/contexts/Collapsible/use.tsx
|
12
|
+
import { useContextEx } from "@xyo-network/react-shared";
|
13
|
+
var useCollapsible = () => useContextEx(CollapsibleContext, "Collapsible", false);
|
14
|
+
|
15
|
+
// src/components/SiteMenu/Menu.tsx
|
16
|
+
import { Menu as MenuIcon2, Settings as SettingsIcon } from "@mui/icons-material";
|
17
|
+
import { IconButton as IconButton2, List as List2, SwipeableDrawer } from "@mui/material";
|
18
|
+
import { FlexRow as FlexRow2 } from "@xylabs/react-flexbox";
|
19
|
+
import { useEffect, useState as useState2 } from "react";
|
20
|
+
|
21
|
+
// src/components/SiteMenu/MenuListItem/MenuListItemContainer.tsx
|
22
|
+
import { ListItemText, useTheme as useTheme2 } from "@mui/material";
|
23
|
+
import { FlexRow } from "@xylabs/react-flexbox";
|
24
|
+
import { LinkEx } from "@xylabs/react-link";
|
25
|
+
import { useState } from "react";
|
26
|
+
|
27
|
+
// src/components/SiteMenu/MenuListItem/list-item-components/ListItemTooltip.tsx
|
28
|
+
import { Tooltip } from "@mui/material";
|
29
|
+
import { FlexCol } from "@xylabs/react-flexbox";
|
30
|
+
import { VscInfo } from "react-icons/vsc/index.js";
|
31
|
+
import { jsx } from "react/jsx-runtime";
|
32
|
+
var ListItemTooltip = ({ title, ...props }) => {
|
33
|
+
return /* @__PURE__ */ jsx(Tooltip, { title, placement: "right", ...props, children: /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(FlexCol, { justifyContent: "center", children: /* @__PURE__ */ jsx(VscInfo, { color: "grey" }) }) }) });
|
34
|
+
};
|
35
|
+
|
36
|
+
// src/components/SiteMenu/MenuListItem/list-item-components/MenuIcon.tsx
|
37
|
+
import { Typography } from "@mui/material";
|
38
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
39
|
+
var MenuIcon = ({ icon, ...props }) => {
|
40
|
+
return /* @__PURE__ */ jsx2(Typography, { display: "flex", ...props, children: icon });
|
41
|
+
};
|
42
|
+
|
43
|
+
// src/components/SiteMenu/MenuListItem/list-item-components/MenuListItem.tsx
|
44
|
+
import { ListItem } from "@mui/material";
|
45
|
+
import { jsx as jsx3 } from "react/jsx-runtime";
|
46
|
+
var MenuListItem = ({ iconOnly, collapseEnd, sx, children, dense, ...props }) => {
|
47
|
+
const listItemSx = iconOnly ? { borderRadius: "50%", display: "inline-flex", flexGrow: 0, width: "auto" } : { width: "100%" };
|
48
|
+
const spacingSx = collapseEnd ? { columnGap: 0 } : { columnGap: 1.5 };
|
49
|
+
const paddingSx = dense ? { px: "8px" } : { px: "12px" };
|
50
|
+
return /* @__PURE__ */ jsx3(ListItem, { sx: { ...listItemSx, ...spacingSx, ...paddingSx, ...sx }, ...props, children });
|
51
|
+
};
|
52
|
+
|
53
|
+
// src/components/SiteMenu/MenuListItem/sub-nav/SubNavListItemCollapse.tsx
|
54
|
+
import { Collapse, List } from "@mui/material";
|
55
|
+
import { jsx as jsx4 } from "react/jsx-runtime";
|
56
|
+
var SubNavListItemsCollapse = ({ collapse, openSubNav, children, ...props }) => {
|
57
|
+
return /* @__PURE__ */ jsx4(Collapse, { in: collapse == true ? false : openSubNav, ...props, children: /* @__PURE__ */ jsx4(List, { children }) });
|
58
|
+
};
|
59
|
+
|
60
|
+
// src/components/SiteMenu/MenuListItem/sub-nav/SubNavToggleIconButton.tsx
|
61
|
+
import { IconButton, useTheme } from "@mui/material";
|
62
|
+
import { VscChevronDown } from "react-icons/vsc/index.js";
|
63
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
64
|
+
var SubNavToggleIconButton = ({ setOpenSubNav, openSubNav }) => {
|
65
|
+
const theme = useTheme();
|
66
|
+
return /* @__PURE__ */ jsx5(
|
67
|
+
IconButton,
|
68
|
+
{
|
69
|
+
onClick: (event) => {
|
70
|
+
event.stopPropagation();
|
71
|
+
setOpenSubNav?.(!openSubNav);
|
72
|
+
},
|
73
|
+
sx: { marginRight: theme.spacing(0.5) },
|
74
|
+
children: /* @__PURE__ */ jsx5(VscChevronDown, { fontSize: "16px" })
|
75
|
+
}
|
76
|
+
);
|
77
|
+
};
|
78
|
+
|
79
|
+
// src/components/SiteMenu/MenuListItem/MenuListItemContainer.tsx
|
80
|
+
import { Fragment, jsx as jsx6, jsxs } from "react/jsx-runtime";
|
81
|
+
var MenuListItemContainer = ({
|
82
|
+
style,
|
83
|
+
icon,
|
84
|
+
iconMenuTextSpacing,
|
85
|
+
iconOnly,
|
86
|
+
onButtonClick,
|
87
|
+
primary,
|
88
|
+
subNavListItems,
|
89
|
+
sx,
|
90
|
+
tooltip,
|
91
|
+
to,
|
92
|
+
...props
|
93
|
+
}) => {
|
94
|
+
const { dense } = props;
|
95
|
+
const theme = useTheme2();
|
96
|
+
const { collapse } = useCollapsible();
|
97
|
+
const [openSubNav, setOpenSubNav] = useState(false);
|
98
|
+
const [hovered, setHovered] = useState(false);
|
99
|
+
const resolvedIconMenuTextSpacing = iconMenuTextSpacing ? iconMenuTextSpacing : theme.spacing(1);
|
100
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
101
|
+
/* @__PURE__ */ jsxs(
|
102
|
+
MenuListItem,
|
103
|
+
{
|
104
|
+
disableGutters: true,
|
105
|
+
iconOnly,
|
106
|
+
onClick: onButtonClick,
|
107
|
+
dense,
|
108
|
+
sx: { justifyContent: "space-between", ...sx },
|
109
|
+
style: { whiteSpace: "nowrap", ...style },
|
110
|
+
...props,
|
111
|
+
children: [
|
112
|
+
/* @__PURE__ */ jsx6(
|
113
|
+
LinkEx,
|
114
|
+
{
|
115
|
+
onMouseEnter: () => setHovered(true),
|
116
|
+
onMouseLeave: () => setHovered(false),
|
117
|
+
color: "inherit",
|
118
|
+
to,
|
119
|
+
sx: {
|
120
|
+
"& :hover": {
|
121
|
+
cursor: "pointer",
|
122
|
+
textDecoration: "underline"
|
123
|
+
}
|
124
|
+
},
|
125
|
+
children: /* @__PURE__ */ jsxs(FlexRow, { children: [
|
126
|
+
/* @__PURE__ */ jsx6(MenuIcon, { icon, paddingRight: resolvedIconMenuTextSpacing, color: hovered ? "secondary" : "inherit" }),
|
127
|
+
/* @__PURE__ */ jsx6(ListItemText, { primary })
|
128
|
+
] })
|
129
|
+
}
|
130
|
+
),
|
131
|
+
/* @__PURE__ */ jsxs(FlexRow, { style: { marginLeft: theme.spacing(1) }, children: [
|
132
|
+
subNavListItems ? /* @__PURE__ */ jsx6(SubNavToggleIconButton, { setOpenSubNav, openSubNav }) : null,
|
133
|
+
tooltip ? /* @__PURE__ */ jsx6(ListItemTooltip, { title: tooltip }) : null
|
134
|
+
] })
|
135
|
+
]
|
136
|
+
}
|
137
|
+
),
|
138
|
+
subNavListItems ? /* @__PURE__ */ jsx6(SubNavListItemsCollapse, { openSubNav, collapse, children: subNavListItems?.map((item, index) => /* @__PURE__ */ jsx6(MenuListItemContainer, { dense, sx: { pl: theme.spacing(1) }, ...item }, index)) }) : null
|
139
|
+
] });
|
140
|
+
};
|
141
|
+
|
142
|
+
// src/components/SiteMenu/Menu.tsx
|
143
|
+
import { jsx as jsx7, jsxs as jsxs2 } from "react/jsx-runtime";
|
144
|
+
var SiteMenu = ({ children, onMenuToggle, side = "right", ...props }) => {
|
145
|
+
const [open, setOpen] = useState2(false);
|
146
|
+
useEffect(() => {
|
147
|
+
onMenuToggle?.(open);
|
148
|
+
}, [onMenuToggle, open]);
|
149
|
+
return /* @__PURE__ */ jsxs2(FlexRow2, { alignItems: "stretch", ...props, children: [
|
150
|
+
/* @__PURE__ */ jsx7(
|
151
|
+
IconButton2,
|
152
|
+
{
|
153
|
+
size: "small",
|
154
|
+
color: "inherit",
|
155
|
+
onClick: () => {
|
156
|
+
setOpen(!open);
|
157
|
+
},
|
158
|
+
children: /* @__PURE__ */ jsx7(MenuIcon2, { fontSize: "large" })
|
159
|
+
}
|
160
|
+
),
|
161
|
+
/* @__PURE__ */ jsx7(
|
162
|
+
SwipeableDrawer,
|
163
|
+
{
|
164
|
+
anchor: side,
|
165
|
+
open,
|
166
|
+
onClick: () => setOpen(false),
|
167
|
+
onKeyDown: () => setOpen(false),
|
168
|
+
onClose: () => setOpen(false),
|
169
|
+
onOpen: () => setOpen(true),
|
170
|
+
children: children ?? /* @__PURE__ */ jsx7(List2, { children: /* @__PURE__ */ jsx7(MenuListItemContainer, { primary: "Settings", icon: /* @__PURE__ */ jsx7(SettingsIcon, {}), to: "/settings" }) })
|
171
|
+
}
|
172
|
+
)
|
173
|
+
] });
|
174
|
+
};
|
175
|
+
|
176
|
+
// src/components/Toolbar/System/SystemToolbar.tsx
|
177
|
+
import { jsx as jsx8, jsxs as jsxs3 } from "react/jsx-runtime";
|
178
|
+
var SystemToolbar = ({
|
179
|
+
children,
|
180
|
+
darkModeButton = false,
|
181
|
+
hideNetworkSelect,
|
182
|
+
menuItems,
|
183
|
+
networkSelectProps,
|
184
|
+
onMenuToggle,
|
185
|
+
precedingChildren,
|
186
|
+
...props
|
187
|
+
}) => {
|
188
|
+
return /* @__PURE__ */ jsxs3(Toolbar, { ...props, children: [
|
189
|
+
precedingChildren,
|
190
|
+
hideNetworkSelect ? null : /* @__PURE__ */ jsx8(FlexRow3, { marginX: 0.5, children: /* @__PURE__ */ jsx8(Paper, { variant: "elevation", children: /* @__PURE__ */ jsx8(NetworkSelectEx, { fullWidth: true, ...networkSelectProps }) }) }),
|
191
|
+
children,
|
192
|
+
darkModeButton ? /* @__PURE__ */ jsx8(DarkModeIconButton, { color: "inherit" }) : null,
|
193
|
+
menuItems ? /* @__PURE__ */ jsx8(SiteMenu, { onMenuToggle, children: menuItems }) : null
|
194
|
+
] });
|
195
|
+
};
|
196
|
+
export {
|
197
|
+
SystemToolbar
|
198
|
+
};
|
2
199
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../../../src/components/Toolbar/System/index.ts"],"sourcesContent":["export * from './SystemToolbar'\n"],"mappings":"AAAA,cAAc;","names":[]}
|
1
|
+
{"version":3,"sources":["../../../../../src/components/Toolbar/System/SystemToolbar.tsx","../../../../../src/contexts/Collapsible/context.ts","../../../../../src/contexts/Collapsible/use.tsx","../../../../../src/components/SiteMenu/Menu.tsx","../../../../../src/components/SiteMenu/MenuListItem/MenuListItemContainer.tsx","../../../../../src/components/SiteMenu/MenuListItem/list-item-components/ListItemTooltip.tsx","../../../../../src/components/SiteMenu/MenuListItem/list-item-components/MenuIcon.tsx","../../../../../src/components/SiteMenu/MenuListItem/list-item-components/MenuListItem.tsx","../../../../../src/components/SiteMenu/MenuListItem/sub-nav/SubNavListItemCollapse.tsx","../../../../../src/components/SiteMenu/MenuListItem/sub-nav/SubNavToggleIconButton.tsx"],"sourcesContent":["import { Paper, Toolbar, ToolbarProps } from '@mui/material'\nimport { FlexRow } from '@xylabs/react-flexbox'\nimport { DarkModeIconButton } from '@xyo-network/react-app-settings'\nimport { NetworkSelectEx, NetworkSelectExProps } from '@xyo-network/react-network'\nimport { ReactNode } from 'react'\n\nimport { SiteMenu, SiteMenuProps } from '../../SiteMenu'\n\nexport interface SystemToolbarProps extends ToolbarProps {\n darkModeButton?: boolean\n developerMode?: boolean\n hideNetworkSelect?: boolean\n menuItems?: ReactNode\n networkSelectProps?: NetworkSelectExProps\n onMenuToggle?: SiteMenuProps['onMenuToggle']\n precedingChildren?: ReactNode\n}\n\nexport const SystemToolbar: React.FC<SystemToolbarProps> = ({\n children,\n darkModeButton = false,\n hideNetworkSelect,\n menuItems,\n networkSelectProps,\n onMenuToggle,\n precedingChildren,\n ...props\n}) => {\n return (\n <Toolbar {...props}>\n {precedingChildren}\n {hideNetworkSelect ? null : (\n <FlexRow marginX={0.5}>\n <Paper variant=\"elevation\">\n <NetworkSelectEx fullWidth {...networkSelectProps} />\n </Paper>\n </FlexRow>\n )}\n {children}\n {darkModeButton ? <DarkModeIconButton color=\"inherit\" /> : null}\n {menuItems ? <SiteMenu onMenuToggle={onMenuToggle}>{menuItems}</SiteMenu> : null}\n </Toolbar>\n )\n}\n","import { createContextEx } from '@xyo-network/react-shared'\n\nimport { CollapsibleState } from './State'\n\nexport const CollapsibleContext = createContextEx<CollapsibleState>()\n","import { useContextEx } from '@xyo-network/react-shared'\n\nimport { CollapsibleContext } from './context'\n\nexport const useCollapsible = () => useContextEx(CollapsibleContext, 'Collapsible', false)\n","import { Menu as MenuIcon, Settings as SettingsIcon } from '@mui/icons-material'\nimport { IconButton, List, SwipeableDrawer } from '@mui/material'\nimport { FlexBoxProps, FlexRow } from '@xylabs/react-flexbox'\nimport { useEffect, useState } from 'react'\n\nimport { MenuListItemContainer } from './MenuListItem'\n\nexport interface SiteMenuProps extends FlexBoxProps {\n hideSettingsMenuItem?: boolean\n onMenuToggle?: (state?: boolean) => void\n side?: 'left' | 'right' | 'top' | 'bottom'\n}\n\nexport const SiteMenu: React.FC<SiteMenuProps> = ({ children, onMenuToggle, side = 'right', ...props }) => {\n const [open, setOpen] = useState(false)\n\n useEffect(() => {\n onMenuToggle?.(open)\n }, [onMenuToggle, open])\n\n return (\n <FlexRow alignItems=\"stretch\" {...props}>\n <IconButton\n size=\"small\"\n color=\"inherit\"\n onClick={() => {\n setOpen(!open)\n }}\n >\n <MenuIcon fontSize=\"large\" />\n </IconButton>\n <SwipeableDrawer\n anchor={side}\n open={open}\n onClick={() => setOpen(false)}\n onKeyDown={() => setOpen(false)}\n onClose={() => setOpen(false)}\n onOpen={() => setOpen(true)}\n >\n {children ?? (\n <List>\n <MenuListItemContainer primary=\"Settings\" icon={<SettingsIcon />} to=\"/settings\" />\n </List>\n )}\n </SwipeableDrawer>\n </FlexRow>\n )\n}\n","import { ListItemProps, ListItemText, useTheme } from '@mui/material'\nimport { FlexRow } from '@xylabs/react-flexbox'\nimport { LinkEx } from '@xylabs/react-link'\nimport { useState } from 'react'\n\nimport { useCollapsible } from '../../../contexts'\nimport { MenuListItemBase, NavListItemProps } from '../lib'\nimport { ListItemTooltip, MenuIcon, MenuListItem } from './list-item-components'\nimport { SubNavListItemsCollapse, SubNavToggleIconButton } from './sub-nav'\n\nexport interface MenuListItemProps extends NavListItemProps, MenuListItemBase, ListItemProps {\n iconMenuTextSpacing?: string\n iconOnly?: boolean\n subNavListItems?: NavListItemProps[]\n subNavOpen?: boolean\n}\n\nexport const MenuListItemContainer: React.FC<MenuListItemProps> = ({\n style,\n icon,\n iconMenuTextSpacing,\n iconOnly,\n onButtonClick,\n primary,\n subNavListItems,\n sx,\n tooltip,\n to,\n ...props\n}) => {\n const { dense } = props\n const theme = useTheme()\n const { collapse } = useCollapsible()\n const [openSubNav, setOpenSubNav] = useState(false)\n const [hovered, setHovered] = useState(false)\n const resolvedIconMenuTextSpacing = iconMenuTextSpacing ? iconMenuTextSpacing : theme.spacing(1)\n\n return (\n <>\n <MenuListItem\n disableGutters\n iconOnly={iconOnly}\n onClick={onButtonClick}\n dense={dense}\n sx={{ justifyContent: 'space-between', ...sx }}\n style={{ whiteSpace: 'nowrap', ...style }}\n {...props}\n >\n <LinkEx\n onMouseEnter={() => setHovered(true)}\n onMouseLeave={() => setHovered(false)}\n color=\"inherit\"\n to={to}\n sx={{\n '& :hover': {\n cursor: 'pointer',\n textDecoration: 'underline',\n },\n }}\n >\n <FlexRow>\n <MenuIcon icon={icon} paddingRight={resolvedIconMenuTextSpacing} color={hovered ? 'secondary' : 'inherit'} />\n <ListItemText primary={primary} />\n </FlexRow>\n </LinkEx>\n <FlexRow style={{ marginLeft: theme.spacing(1) }}>\n {subNavListItems ? <SubNavToggleIconButton setOpenSubNav={setOpenSubNav} openSubNav={openSubNav} /> : null}\n {tooltip ? <ListItemTooltip title={tooltip} /> : null}\n </FlexRow>\n </MenuListItem>\n {subNavListItems ? (\n <SubNavListItemsCollapse openSubNav={openSubNav} collapse={collapse}>\n {subNavListItems?.map((item, index) => <MenuListItemContainer dense={dense} sx={{ pl: theme.spacing(1) }} key={index} {...item} />)}\n </SubNavListItemsCollapse>\n ) : null}\n </>\n )\n}\n","import { Tooltip, TooltipProps } from '@mui/material'\nimport { FlexCol } from '@xylabs/react-flexbox'\n// eslint-disable-next-line import/no-internal-modules\nimport { VscInfo } from 'react-icons/vsc/index.js'\n\nexport interface ListItemTooltipProps extends Omit<TooltipProps, 'children'> {\n title: string\n}\n\nexport const ListItemTooltip: React.FC<ListItemTooltipProps> = ({ title, ...props }) => {\n return (\n <Tooltip title={title} placement=\"right\" {...props}>\n {/* Needs div so it can work, the hovering doesn't work with a FlexCol */}\n <div>\n <FlexCol justifyContent=\"center\">\n <VscInfo color=\"grey\" />\n </FlexCol>\n </div>\n </Tooltip>\n )\n}\n","import { Typography, TypographyProps } from '@mui/material'\nimport { ReactNode } from 'react'\n\nexport interface MenuIconProps extends TypographyProps {\n icon?: ReactNode\n}\n\nexport const MenuIcon: React.FC<MenuIconProps> = ({ icon, ...props }) => {\n return (\n <Typography display=\"flex\" {...props}>\n {icon}\n </Typography>\n )\n}\n","import { ListItem, ListItemProps } from '@mui/material'\n\nimport { MenuListItemBase } from '../../lib'\n\nexport interface ListItemExProps extends MenuListItemBase, ListItemProps {}\n\nexport const MenuListItem: React.FC<ListItemExProps> = ({ iconOnly, collapseEnd, sx, children, dense, ...props }) => {\n const listItemSx = iconOnly ? { borderRadius: '50%', display: 'inline-flex', flexGrow: 0, width: 'auto' } : { width: '100%' }\n // wait till collapseEnds to remove the spacing between items\n const spacingSx = collapseEnd ? { columnGap: 0 } : { columnGap: 1.5 }\n // adjusts to the paddingY value which does NOT scale along the theme.spacing\n const paddingSx = dense ? { px: '8px' } : { px: '12px' }\n return (\n <ListItem sx={{ ...listItemSx, ...spacingSx, ...paddingSx, ...sx }} {...props}>\n {children}\n </ListItem>\n )\n}\n","import { Collapse, CollapseProps, List } from '@mui/material'\nimport { WithChildren } from '@xylabs/react-shared'\n\nimport { NavListItemProps } from '../../lib'\n\nexport interface SubNavListItemsCollapseProps extends WithChildren, CollapseProps {\n collapse?: boolean\n openSubNav?: boolean\n subNavListItems?: NavListItemProps[]\n}\n\nexport const SubNavListItemsCollapse: React.FC<SubNavListItemsCollapseProps> = ({ collapse, openSubNav, children, ...props }) => {\n return (\n <Collapse in={collapse == true ? false : openSubNav} {...props}>\n <List>{children}</List>\n </Collapse>\n )\n}\n","import { IconButton, IconButtonProps, useTheme } from '@mui/material'\nimport { Dispatch, SetStateAction, SyntheticEvent } from 'react'\n// eslint-disable-next-line import/no-internal-modules\nimport { VscChevronDown } from 'react-icons/vsc/index.js'\n\nexport interface SubNavToggleIconButtonProps extends IconButtonProps {\n openSubNav?: boolean\n setOpenSubNav?: Dispatch<SetStateAction<boolean>>\n}\n\nexport const SubNavToggleIconButton: React.FC<SubNavToggleIconButtonProps> = ({ setOpenSubNav, openSubNav }) => {\n const theme = useTheme()\n return (\n <IconButton\n onClick={(event: SyntheticEvent) => {\n event.stopPropagation()\n setOpenSubNav?.(!openSubNav)\n }}\n sx={{ marginRight: theme.spacing(0.5) }}\n >\n <VscChevronDown fontSize=\"16px\" />\n </IconButton>\n )\n}\n"],"mappings":";AAAA,SAAS,OAAO,eAA6B;AAC7C,SAAS,WAAAA,gBAAe;AACxB,SAAS,0BAA0B;AACnC,SAAS,uBAA6C;;;ACHtD,SAAS,uBAAuB;AAIzB,IAAM,qBAAqB,gBAAkC;;;ACJpE,SAAS,oBAAoB;AAItB,IAAM,iBAAiB,MAAM,aAAa,oBAAoB,eAAe,KAAK;;;ACJzF,SAAS,QAAQC,WAAU,YAAY,oBAAoB;AAC3D,SAAS,cAAAC,aAAY,QAAAC,OAAM,uBAAuB;AAClD,SAAuB,WAAAC,gBAAe;AACtC,SAAS,WAAW,YAAAC,iBAAgB;;;ACHpC,SAAwB,cAAc,YAAAC,iBAAgB;AACtD,SAAS,eAAe;AACxB,SAAS,cAAc;AACvB,SAAS,gBAAgB;;;ACHzB,SAAS,eAA6B;AACtC,SAAS,eAAe;AAExB,SAAS,eAAe;AAYd;AANH,IAAM,kBAAkD,CAAC,EAAE,OAAO,GAAG,MAAM,MAAM;AACtF,SACE,oBAAC,WAAQ,OAAc,WAAU,SAAS,GAAG,OAE3C,8BAAC,SACC,8BAAC,WAAQ,gBAAe,UACtB,8BAAC,WAAQ,OAAM,QAAO,GACxB,GACF,GACF;AAEJ;;;ACpBA,SAAS,kBAAmC;AASxC,gBAAAC,YAAA;AAFG,IAAM,WAAoC,CAAC,EAAE,MAAM,GAAG,MAAM,MAAM;AACvE,SACE,gBAAAA,KAAC,cAAW,SAAQ,QAAQ,GAAG,OAC5B,gBACH;AAEJ;;;ACbA,SAAS,gBAA+B;AAapC,gBAAAC,YAAA;AAPG,IAAM,eAA0C,CAAC,EAAE,U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;AAAA;AAAA,IACA,oBAAoB,OACnB,gBAAAD,KAACE,UAAA,EAAQ,SAAS,KAChB,0BAAAF,KAAC,SAAM,SAAQ,aACb,0BAAAA,KAAC,mBAAgB,WAAS,MAAE,GAAG,oBAAoB,GACrD,GACF;AAAA,IAED;AAAA,IACA,iBAAiB,gBAAAA,KAAC,sBAAmB,OAAM,WAAU,IAAK;AAAA,IAC1D,YAAY,gBAAAA,KAAC,YAAS,cAA6B,qBAAU,IAAc;AAAA,KAC9E;AAEJ;","names":["FlexRow","MenuIcon","IconButton","List","FlexRow","useState","useTheme","jsx","jsx","jsx","jsx","jsx","useTheme","jsx","jsxs","useState","FlexRow","IconButton","MenuIcon","List","jsx","jsxs","FlexRow"]}
|