@xyo-network/react-appbar 2.78.0 → 2.78.2
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/browser/index.cjs +563 -1
- package/dist/browser/index.cjs.map +1 -1
- package/dist/browser/index.js +540 -1
- package/dist/browser/index.js.map +1 -1
- package/dist/neutral/index.cjs +563 -1
- package/dist/neutral/index.cjs.map +1 -1
- package/dist/neutral/index.js +540 -1
- package/dist/neutral/index.js.map +1 -1
- package/dist/node/index.cjs +581 -1
- package/dist/node/index.cjs.map +1 -1
- package/dist/node/index.js +540 -1
- package/dist/node/index.js.map +1 -1
- package/package.json +8 -8
package/dist/node/index.js
CHANGED
@@ -1,2 +1,541 @@
|
|
1
|
-
import{AppBarEx as jo}from"@xylabs/react-appbar";import{Toolbar as xo}from"@mui/material";import{Typography as io,useTheme as po}from"@mui/material";import{FlexRow as ao}from"@xylabs/react-flexbox";import{LinkEx as mo}from"@xylabs/react-link";import{useTheme as no}from"@mui/material";import{jsx as lo}from"react/jsx-runtime";var v=o=>{let r=(no().palette.mode==="dark","https://cdn.xy.company/img/brand/XYO/XYO_icon_white.svg");return lo("img",{src:r,...o})};import{jsx as b,jsxs as co}from"react/jsx-runtime";var M=({to:o="/",version:e=!1,...r})=>{let t=po();return b(mo,{to:o,...r,children:co(ao,{paddingX:"4px",children:[b(v,{height:"40",width:"43"}),e?b(io,{position:"absolute",borderRadius:1,right:6,color:t.palette.getContrastText(t.palette.text.primary),bottom:0,bgcolor:t.palette.text.primary,paddingX:"2px",lineHeight:1,variant:"caption",border:`1px ${t.palette.getContrastText(t.palette.primary.main)} solid`,children:typeof e=="string"?e:"2.1"}):null]})})};import{jsx as B}from"react/jsx-runtime";var E=({logoTo:o="/",version:e=!1,...r})=>B(xo,{...r,children:B(M,{version:e,to:o})});import{Paper as _o,Toolbar as Ko}from"@mui/material";import{FlexRow as Qo}from"@xylabs/react-flexbox";import{DarkModeIconButton as qo}from"@xyo-network/react-app-settings";import{NetworkSelectEx as Jo}from"@xyo-network/react-network";import{useMemo as go}from"react";import{useEffect as k,useState as N}from"react";import{createContextEx as fo}from"@xyo-network/react-shared";var u=fo();import{jsx as uo}from"react/jsx-runtime";var Qe=({defaultCollapse:o=!1,defaultCollapseEnd:e=!1,children:r})=>{let[t,s]=N(o),[n,l]=N(e);return k(()=>{s(o)},[o]),k(()=>{l(e)},[e]),uo(u.Provider,{value:{collapse:t,collapseEnd:n,provided:!0,setCollapse:s,setCollapseEnd:l},children:r})};import{useContextEx as Co}from"@xyo-network/react-shared";var p=()=>Co(u,"Collapsible",!1);var rt=()=>{let{collapse:o,collapseEnd:e,setCollapse:r,setCollapseEnd:t}=p(),s=l=>{r==null||r(i=>l?!1:i),t==null||t(i=>l?!1:i)};return{defaultSiteMenuListItemProps:go(()=>({collapseEnd:e,dense:!0,iconOnly:o,sx:{px:"8px"}}),[o,e]),onMenuItemToggle:s}};import{Menu as No,Settings as Do}from"@mui/icons-material";import{IconButton as Wo,List as Ao,SwipeableDrawer as $o}from"@mui/material";import{FlexRow as zo}from"@xylabs/react-flexbox";import{useEffect as Oo,useState as Uo}from"react";import{ListItemText as Mo,useTheme as Bo}from"@mui/material";import{FlexRow as H}from"@xylabs/react-flexbox";import{LinkEx as Eo}from"@xylabs/react-link";import{useState as X}from"react";import{Tooltip as Po}from"@mui/material";import{FlexCol as yo}from"@xylabs/react-flexbox";import{VscInfo as So}from"react-icons/vsc";import{jsx as C}from"react/jsx-runtime";var D=({title:o,...e})=>C(Po,{title:o,placement:"right",...e,children:C("div",{children:C(yo,{justifyContent:"center",children:C(So,{color:"grey"})})})});import{Typography as bo}from"@mui/material";import{jsx as ho}from"react/jsx-runtime";var W=({icon:o,...e})=>ho(bo,{display:"flex",...e,children:o});import{ListItem as Io}from"@mui/material";import{jsx as To}from"react/jsx-runtime";var A=({iconOnly:o,collapseEnd:e,sx:r,children:t,dense:s,...n})=>To(Io,{sx:{...o?{borderRadius:"50%",display:"inline-flex",flexGrow:0,width:"auto"}:{width:"100%"},...e?{columnGap:0}:{columnGap:1.5},...s?{px:"8px"}:{px:"12px"},...r},...n,children:t});import{Collapse as Lo,List as Ro}from"@mui/material";import{jsx as $}from"react/jsx-runtime";var z=({collapse:o,openSubNav:e,children:r,...t})=>$(Lo,{in:o==!0?!1:e,...t,children:$(Ro,{children:r})});import{IconButton as wo,useTheme as Fo}from"@mui/material";import{VscChevronDown as vo}from"react-icons/vsc";import{jsx as O}from"react/jsx-runtime";var U=({setOpenSubNav:o,openSubNav:e})=>{let r=Fo();return O(wo,{onClick:t=>{t.stopPropagation(),o==null||o(!e)},sx:{marginRight:r.spacing(.5)},children:O(vo,{fontSize:"16px"})})};import{Fragment as ko,jsx as a,jsxs as g}from"react/jsx-runtime";var d=({style:o,icon:e,iconMenuTextSpacing:r,iconOnly:t,onButtonClick:s,primary:n,subNavListItems:l,sx:i,tooltip:c,to:Z,...L})=>{let{dense:R}=L,S=Bo(),{collapse:j}=p(),[w,oo]=X(!1),[eo,F]=X(!1),to=r??S.spacing(1);return g(ko,{children:[g(A,{disableGutters:!0,iconOnly:t,onClick:s,dense:R,sx:{justifyContent:"space-between",...i},style:{whiteSpace:"nowrap",...o},...L,children:[a(Eo,{onMouseEnter:()=>F(!0),onMouseLeave:()=>F(!1),color:"inherit",to:Z,sx:{"& :hover":{cursor:"pointer",textDecoration:"underline"}},children:g(H,{children:[a(W,{icon:e,paddingRight:to,color:eo?"secondary":"inherit"}),a(Mo,{primary:n})]})}),g(H,{style:{marginLeft:S.spacing(1)},children:[l?a(U,{setOpenSubNav:oo,openSubNav:w}):null,c?a(D,{title:c}):null]})]}),l?a(z,{openSubNav:w,collapse:j,children:l==null?void 0:l.map((ro,so)=>a(d,{dense:R,sx:{pl:S.spacing(1)},...ro},so))}):null]})};import{jsx as x,jsxs as Ho}from"react/jsx-runtime";var G=({children:o,onMenuToggle:e,side:r="right",...t})=>{let[s,n]=Uo(!1);return Oo(()=>{e==null||e(s)},[e,s]),Ho(zo,{alignItems:"stretch",...t,children:[x(Wo,{size:"small",color:"inherit",onClick:()=>{n(!s)},children:x(No,{fontSize:"large"})}),x($o,{anchor:r,open:s,onClick:()=>n(!1),onKeyDown:()=>n(!1),onClose:()=>n(!1),onOpen:()=>n(!0),children:o??x(Ao,{children:x(d,{primary:"Settings",icon:x(Do,{}),to:"/settings"})})})]})};import{Collapse as Xo,ListSubheader as Go}from"@mui/material";import{FlexCol as Vo}from"@xylabs/react-flexbox";import{jsx as h,jsxs as Yo}from"react/jsx-runtime";var Jt=({iconMenuTextSpacing:o,listItems:e,showTitle:r=!0,title:t,...s})=>Yo(Vo,{alignItems:"stretch",...s,children:[h(Xo,{in:r,timeout:700,children:h(Go,{children:t})}),e.map((n,l)=>h(d,{iconMenuTextSpacing:o,...n},l))]});import{jsx as f,jsxs as Zo}from"react/jsx-runtime";var V=({children:o,darkModeButton:e=!1,hideNetworkSelect:r,menuItems:t,networkSelectProps:s,onMenuToggle:n,precedingChildren:l,...i})=>Zo(Ko,{...i,children:[l,r?null:f(Qo,{marginX:.5,children:f(_o,{variant:"elevation",children:f(Jo,{fullWidth:!0,...s})})}),o,e?f(qo,{color:"inherit"}):null,t?f(G,{onMenuToggle:n,children:t}):null]});import{jsx as I}from"react/jsx-runtime";var dr=({systemToolbar:o,contextToolbar:e,responsive:r=!0,...t})=>I(jo,{systemToolbar:o??I(V,{}),contextToolbar:e??I(E,{}),position:"sticky",responsive:r,...t});import{Icon as oe,useTheme as ee}from"@mui/material";import{FlexRow as te}from"@xylabs/react-flexbox";import{useState as re}from"react";import{VscArrowSmallLeft as se,VscArrowSmallRight as ne}from"react-icons/vsc";import{jsx as P}from"react/jsx-runtime";var hr=o=>{let{collapse:e,setCollapse:r,setCollapseEnd:t}=p(),[s,n]=re(!1),l=ee();return P(te,{mt:2,py:2,justifyContent:e?"start":"center",...o,children:P(oe,{onClick:()=>{r==null||r(!e),t==null||t(c=>c&&!1)},onMouseEnter:()=>n(!0),onMouseLeave:()=>n(!1),fontSize:"large",sx:{color:s?l.palette.secondary.main:"inherit",cursor:"pointer"},children:e?P(ne,{}):P(se,{})})})};import{Collapse as le,styled as ie,useTheme as pe}from"@mui/material";import{jsx as me}from"react/jsx-runtime";var Fr=({children:o,sx:e,...r})=>{let{collapse:t,setCollapseEnd:s}=p(),n=pe(),l=r.collapsedSize??n.spacing(5);return me(ae,{in:!t,orientation:"horizontal",collapsedSize:l,onExited:()=>s==null?void 0:s(!0),sx:{alignItems:"start",display:"flex",height:"100%",...e},...r,children:o})},ae=ie(le)(()=>({"& .MuiCollapse-wrapperInner":{display:"flex",flexDirection:"column"}}));import{FlexCol as he}from"@xylabs/react-flexbox";import{styled as be}from"@mui/material";var ce=(t=>(t.Left="Left",t.Right="Right",t.WindowShade="WindowShade",t))(ce||{});import{Paper as Ce,useMediaQuery as ge}from"@mui/material";import{FlexCol as K,FlexRow as Pe}from"@xylabs/react-flexbox";import{NetworkSelectEx as ye}from"@xyo-network/react-network";import{Collapse as xe}from"@mui/material";import{FlexCol as de,FlexRow as Y}from"@xylabs/react-flexbox";import{useState as fe}from"react";import{jsx as T,jsxs as ue}from"react/jsx-runtime";var _=({children:o,controlElement:e,systemControlsType:r="WindowShade",...t})=>{let[s,n]=fe(!1),l="vertical";switch(r){case"Left":{l="horizontal";break}}return ue(Y,{className:"controls",...t,children:[T(xe,{in:s,orientation:l,timeout:500,children:T(Y,{bgcolor:"primary.main",className:"control",children:e})}),T(de,{style:{cursor:"pointer"},onClick:()=>n(!s),children:o})]})};import{Fragment as Se,jsx as m}from"react/jsx-runtime";var Q=({visible:o,systemControlsType:e="WindowShade",...r})=>{let t=ge(s=>s.breakpoints.down("sm"));return o||t?m(K,{...r,className:`${r.className} system-controls-type-${e}`,children:m(_,{systemControlsType:e,controlElement:m(Se,{children:m(Pe,{className:"control-wrap",children:m(Ce,{variant:"elevation",elevation:0,children:m(ye,{responsive:!1,className:"network-ex"})})})})})}):m(K,{})};var q=be(Q,{name:"SystemControls",slot:"Root"})(({theme:o})=>({"&":{".toggle":{backgroundColor:o.palette.primary.main},alignItems:"start",zIndex:1},["&.system-controls-type-WindowShade"]:{".control":{borderRadius:"0 0 5px 5px",flexDirection:"row",flexGrow:1,justifyContent:"space-around",padding:`${o.spacing(2)} ${o.spacing(2.5)}`},".controls":{alignItems:"stretch",flexDirection:"column",flexGrow:1},".toggle":{borderRadius:"0 0 5px 5px",padding:`${o.spacing(.5)} ${o.spacing(1)}`},flexDirection:"row",position:"absolute",top:0,width:"100%"},["&.system-controls-type-Left"]:{".control":{alignItems:"start",flexDirection:"column",padding:`${o.spacing(2)} ${o.spacing(2.5)}`},".control-wrap":{marginBottom:`${o.spacing(2)}`},".toggle":{borderRadius:"0 5px 5px 0",padding:`${o.spacing(1)} ${o.spacing(.5)}`,writingMode:"vertical-rl"},flexDirection:"column",left:0,position:"fixed",top:"30vh",width:"auto"}}));import{jsx as J}from"react/jsx-runtime";var jr=o=>J(he,{children:J(q,{...o})});import{Search as Ie}from"@mui/icons-material";import{Paper as Te,TextField as Le}from"@mui/material";import{ButtonEx as Re}from"@xylabs/react-button";import{FlexRow as we}from"@xylabs/react-flexbox";import{useState as Fe}from"react";import{jsx as y,jsxs as ve}from"react/jsx-runtime";var ps=({defaultValue:o,onSearch:e,...r})=>{let[t,s]=Fe();return y(we,{alignItems:"stretch",...r,children:ve(Te,{variant:"elevation",elevation:0,style:{display:"flex",overflow:"hidden",width:"100%"},children:[y(Le,{InputProps:{color:"secondary",style:{borderBottomRightRadius:0,borderTopRightRadius:0,borderWidth:0}},variant:"outlined",size:"small",defaultValue:o,fullWidth:!0,onChange:n=>s(n.target.value),onKeyDown:n=>{n.key==="Enter"&&(e==null||e(t))}}),y(Re,{variant:"contained",style:{borderRadius:0,borderTopLeftRadius:0},color:"secondary",onClick:()=>e==null?void 0:e(t),children:y(Ie,{})})]})})};export{dr as ApplicationAppBar,hr as CollapseToggleFlex,Fr as CollapsibleDrawer,Qe as CollapsibleProvider,E as ContextToolbar,d as MenuListItemContainer,Jt as MenuSection,ps as SearchBar,G as SiteMenu,jr as SystemControls,ce as SystemControlsType,Q as SystemControlsUnstyled,V as SystemToolbar,p as useCollapsible,rt as useMenuItemsShared};
|
1
|
+
// src/components/AppBar/Application.tsx
|
2
|
+
import { AppBarEx } from "@xylabs/react-appbar";
|
3
|
+
|
4
|
+
// src/components/Toolbar/Context/ContextToolbar.tsx
|
5
|
+
import { Toolbar } from "@mui/material";
|
6
|
+
|
7
|
+
// src/components/Toolbar/Context/LogoLinkEx.tsx
|
8
|
+
import { Typography, useTheme as useTheme2 } from "@mui/material";
|
9
|
+
import { FlexRow } from "@xylabs/react-flexbox";
|
10
|
+
import { LinkEx } from "@xylabs/react-link";
|
11
|
+
|
12
|
+
// src/components/Toolbar/Context/Logo.tsx
|
13
|
+
import { useTheme } from "@mui/material";
|
14
|
+
import { jsx } from "react/jsx-runtime";
|
15
|
+
var Logo = (props) => {
|
16
|
+
const theme = useTheme();
|
17
|
+
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";
|
18
|
+
return /* @__PURE__ */ jsx("img", { src: logoUrl, ...props });
|
19
|
+
};
|
20
|
+
|
21
|
+
// src/components/Toolbar/Context/LogoLinkEx.tsx
|
22
|
+
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
23
|
+
var LogoLinkEx = ({ to = "/", version = false, ...props }) => {
|
24
|
+
const theme = useTheme2();
|
25
|
+
return /* @__PURE__ */ jsx2(LinkEx, { to, ...props, children: /* @__PURE__ */ jsxs(FlexRow, { paddingX: "4px", children: [
|
26
|
+
/* @__PURE__ */ jsx2(Logo, { height: "40", width: "43" }),
|
27
|
+
version ? /* @__PURE__ */ jsx2(
|
28
|
+
Typography,
|
29
|
+
{
|
30
|
+
position: "absolute",
|
31
|
+
borderRadius: 1,
|
32
|
+
right: 6,
|
33
|
+
color: theme.palette.getContrastText(theme.palette.text.primary),
|
34
|
+
bottom: 0,
|
35
|
+
bgcolor: theme.palette.text.primary,
|
36
|
+
paddingX: "2px",
|
37
|
+
lineHeight: 1,
|
38
|
+
variant: "caption",
|
39
|
+
border: `1px ${theme.palette.getContrastText(theme.palette.primary.main)} solid`,
|
40
|
+
children: typeof version === "string" ? version : "2.1"
|
41
|
+
}
|
42
|
+
) : null
|
43
|
+
] }) });
|
44
|
+
};
|
45
|
+
|
46
|
+
// src/components/Toolbar/Context/ContextToolbar.tsx
|
47
|
+
import { jsx as jsx3 } from "react/jsx-runtime";
|
48
|
+
var ContextToolbar = ({ logoTo = "/", version = false, ...props }) => {
|
49
|
+
return /* @__PURE__ */ jsx3(Toolbar, { ...props, children: /* @__PURE__ */ jsx3(LogoLinkEx, { version, to: logoTo }) });
|
50
|
+
};
|
51
|
+
|
52
|
+
// src/components/Toolbar/System/SystemToolbar.tsx
|
53
|
+
import { Paper, Toolbar as Toolbar2 } from "@mui/material";
|
54
|
+
import { FlexRow as FlexRow4 } from "@xylabs/react-flexbox";
|
55
|
+
import { DarkModeIconButton } from "@xyo-network/react-app-settings";
|
56
|
+
import { NetworkSelectEx } from "@xyo-network/react-network";
|
57
|
+
|
58
|
+
// src/components/SiteMenu/hooks/useMenuItemsShared.tsx
|
59
|
+
import { useMemo } from "react";
|
60
|
+
|
61
|
+
// src/contexts/Collapsible/provider.tsx
|
62
|
+
import { useEffect, useState } from "react";
|
63
|
+
|
64
|
+
// src/contexts/Collapsible/context.ts
|
65
|
+
import { createContextEx } from "@xyo-network/react-shared";
|
66
|
+
var CollapsibleContext = createContextEx();
|
67
|
+
|
68
|
+
// src/contexts/Collapsible/provider.tsx
|
69
|
+
import { jsx as jsx4 } from "react/jsx-runtime";
|
70
|
+
var CollapsibleProvider = ({ defaultCollapse = false, defaultCollapseEnd = false, children }) => {
|
71
|
+
const [collapse, setCollapse] = useState(defaultCollapse);
|
72
|
+
const [collapseEnd, setCollapseEnd] = useState(defaultCollapseEnd);
|
73
|
+
useEffect(() => {
|
74
|
+
setCollapse(defaultCollapse);
|
75
|
+
}, [defaultCollapse]);
|
76
|
+
useEffect(() => {
|
77
|
+
setCollapseEnd(defaultCollapseEnd);
|
78
|
+
}, [defaultCollapseEnd]);
|
79
|
+
return /* @__PURE__ */ jsx4(CollapsibleContext.Provider, { value: { collapse, collapseEnd, provided: true, setCollapse, setCollapseEnd }, children });
|
80
|
+
};
|
81
|
+
|
82
|
+
// src/contexts/Collapsible/use.tsx
|
83
|
+
import { useContextEx } from "@xyo-network/react-shared";
|
84
|
+
var useCollapsible = () => useContextEx(CollapsibleContext, "Collapsible", false);
|
85
|
+
|
86
|
+
// src/components/SiteMenu/hooks/useMenuItemsShared.tsx
|
87
|
+
var useMenuItemsShared = () => {
|
88
|
+
const { collapse, collapseEnd, setCollapse, setCollapseEnd } = useCollapsible();
|
89
|
+
const onMenuItemToggle = (open) => {
|
90
|
+
setCollapse == null ? void 0 : setCollapse((previous) => open ? false : previous);
|
91
|
+
setCollapseEnd == null ? void 0 : setCollapseEnd((previous) => open ? false : previous);
|
92
|
+
};
|
93
|
+
const defaultSiteMenuListItemProps = useMemo(
|
94
|
+
() => ({
|
95
|
+
collapseEnd,
|
96
|
+
dense: true,
|
97
|
+
iconOnly: collapse,
|
98
|
+
sx: {
|
99
|
+
px: "8px"
|
100
|
+
}
|
101
|
+
}),
|
102
|
+
[collapse, collapseEnd]
|
103
|
+
);
|
104
|
+
return { defaultSiteMenuListItemProps, onMenuItemToggle };
|
105
|
+
};
|
106
|
+
|
107
|
+
// src/components/SiteMenu/Menu.tsx
|
108
|
+
import { Menu as MenuIcon2, Settings as SettingsIcon } from "@mui/icons-material";
|
109
|
+
import { IconButton as IconButton2, List as List2, SwipeableDrawer } from "@mui/material";
|
110
|
+
import { FlexRow as FlexRow3 } from "@xylabs/react-flexbox";
|
111
|
+
import { useEffect as useEffect2, useState as useState3 } from "react";
|
112
|
+
|
113
|
+
// src/components/SiteMenu/MenuListItem/MenuListItemContainer.tsx
|
114
|
+
import { ListItemText, useTheme as useTheme4 } from "@mui/material";
|
115
|
+
import { FlexRow as FlexRow2 } from "@xylabs/react-flexbox";
|
116
|
+
import { LinkEx as LinkEx2 } from "@xylabs/react-link";
|
117
|
+
import { useState as useState2 } from "react";
|
118
|
+
|
119
|
+
// src/components/SiteMenu/MenuListItem/list-item-components/ListItemTooltip.tsx
|
120
|
+
import { Tooltip } from "@mui/material";
|
121
|
+
import { FlexCol } from "@xylabs/react-flexbox";
|
122
|
+
import { VscInfo } from "react-icons/vsc";
|
123
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
124
|
+
var ListItemTooltip = ({ title, ...props }) => {
|
125
|
+
return /* @__PURE__ */ jsx5(Tooltip, { title, placement: "right", ...props, children: /* @__PURE__ */ jsx5("div", { children: /* @__PURE__ */ jsx5(FlexCol, { justifyContent: "center", children: /* @__PURE__ */ jsx5(VscInfo, { color: "grey" }) }) }) });
|
126
|
+
};
|
127
|
+
|
128
|
+
// src/components/SiteMenu/MenuListItem/list-item-components/MenuIcon.tsx
|
129
|
+
import { Typography as Typography2 } from "@mui/material";
|
130
|
+
import { jsx as jsx6 } from "react/jsx-runtime";
|
131
|
+
var MenuIcon = ({ icon, ...props }) => {
|
132
|
+
return /* @__PURE__ */ jsx6(Typography2, { display: "flex", ...props, children: icon });
|
133
|
+
};
|
134
|
+
|
135
|
+
// src/components/SiteMenu/MenuListItem/list-item-components/MenuListItem.tsx
|
136
|
+
import { ListItem } from "@mui/material";
|
137
|
+
import { jsx as jsx7 } from "react/jsx-runtime";
|
138
|
+
var MenuListItem = ({ iconOnly, collapseEnd, sx, children, dense, ...props }) => {
|
139
|
+
const listItemSx = iconOnly ? { borderRadius: "50%", display: "inline-flex", flexGrow: 0, width: "auto" } : { width: "100%" };
|
140
|
+
const spacingSx = collapseEnd ? { columnGap: 0 } : { columnGap: 1.5 };
|
141
|
+
const paddingSx = dense ? { px: "8px" } : { px: "12px" };
|
142
|
+
return /* @__PURE__ */ jsx7(ListItem, { sx: { ...listItemSx, ...spacingSx, ...paddingSx, ...sx }, ...props, children });
|
143
|
+
};
|
144
|
+
|
145
|
+
// src/components/SiteMenu/MenuListItem/sub-nav/SubNavListItemCollapse.tsx
|
146
|
+
import { Collapse, List } from "@mui/material";
|
147
|
+
import { jsx as jsx8 } from "react/jsx-runtime";
|
148
|
+
var SubNavListItemsCollapse = ({ collapse, openSubNav, children, ...props }) => {
|
149
|
+
return /* @__PURE__ */ jsx8(Collapse, { in: collapse == true ? false : openSubNav, ...props, children: /* @__PURE__ */ jsx8(List, { children }) });
|
150
|
+
};
|
151
|
+
|
152
|
+
// src/components/SiteMenu/MenuListItem/sub-nav/SubNavToggleIconButton.tsx
|
153
|
+
import { IconButton, useTheme as useTheme3 } from "@mui/material";
|
154
|
+
import { VscChevronDown } from "react-icons/vsc";
|
155
|
+
import { jsx as jsx9 } from "react/jsx-runtime";
|
156
|
+
var SubNavToggleIconButton = ({ setOpenSubNav, openSubNav }) => {
|
157
|
+
const theme = useTheme3();
|
158
|
+
return /* @__PURE__ */ jsx9(
|
159
|
+
IconButton,
|
160
|
+
{
|
161
|
+
onClick: (event) => {
|
162
|
+
event.stopPropagation();
|
163
|
+
setOpenSubNav == null ? void 0 : setOpenSubNav(!openSubNav);
|
164
|
+
},
|
165
|
+
sx: { marginRight: theme.spacing(0.5) },
|
166
|
+
children: /* @__PURE__ */ jsx9(VscChevronDown, { fontSize: "16px" })
|
167
|
+
}
|
168
|
+
);
|
169
|
+
};
|
170
|
+
|
171
|
+
// src/components/SiteMenu/MenuListItem/MenuListItemContainer.tsx
|
172
|
+
import { Fragment, jsx as jsx10, jsxs as jsxs2 } from "react/jsx-runtime";
|
173
|
+
var MenuListItemContainer = ({
|
174
|
+
style,
|
175
|
+
icon,
|
176
|
+
iconMenuTextSpacing,
|
177
|
+
iconOnly,
|
178
|
+
onButtonClick,
|
179
|
+
primary,
|
180
|
+
subNavListItems,
|
181
|
+
sx,
|
182
|
+
tooltip,
|
183
|
+
to,
|
184
|
+
...props
|
185
|
+
}) => {
|
186
|
+
const { dense } = props;
|
187
|
+
const theme = useTheme4();
|
188
|
+
const { collapse } = useCollapsible();
|
189
|
+
const [openSubNav, setOpenSubNav] = useState2(false);
|
190
|
+
const [hovered, setHovered] = useState2(false);
|
191
|
+
const resolvedIconMenuTextSpacing = iconMenuTextSpacing ?? theme.spacing(1);
|
192
|
+
return /* @__PURE__ */ jsxs2(Fragment, { children: [
|
193
|
+
/* @__PURE__ */ jsxs2(
|
194
|
+
MenuListItem,
|
195
|
+
{
|
196
|
+
disableGutters: true,
|
197
|
+
iconOnly,
|
198
|
+
onClick: onButtonClick,
|
199
|
+
dense,
|
200
|
+
sx: { justifyContent: "space-between", ...sx },
|
201
|
+
style: { whiteSpace: "nowrap", ...style },
|
202
|
+
...props,
|
203
|
+
children: [
|
204
|
+
/* @__PURE__ */ jsx10(
|
205
|
+
LinkEx2,
|
206
|
+
{
|
207
|
+
onMouseEnter: () => setHovered(true),
|
208
|
+
onMouseLeave: () => setHovered(false),
|
209
|
+
color: "inherit",
|
210
|
+
to,
|
211
|
+
sx: {
|
212
|
+
"& :hover": {
|
213
|
+
cursor: "pointer",
|
214
|
+
textDecoration: "underline"
|
215
|
+
}
|
216
|
+
},
|
217
|
+
children: /* @__PURE__ */ jsxs2(FlexRow2, { children: [
|
218
|
+
/* @__PURE__ */ jsx10(MenuIcon, { icon, paddingRight: resolvedIconMenuTextSpacing, color: hovered ? "secondary" : "inherit" }),
|
219
|
+
/* @__PURE__ */ jsx10(ListItemText, { primary })
|
220
|
+
] })
|
221
|
+
}
|
222
|
+
),
|
223
|
+
/* @__PURE__ */ jsxs2(FlexRow2, { style: { marginLeft: theme.spacing(1) }, children: [
|
224
|
+
subNavListItems ? /* @__PURE__ */ jsx10(SubNavToggleIconButton, { setOpenSubNav, openSubNav }) : null,
|
225
|
+
tooltip ? /* @__PURE__ */ jsx10(ListItemTooltip, { title: tooltip }) : null
|
226
|
+
] })
|
227
|
+
]
|
228
|
+
}
|
229
|
+
),
|
230
|
+
subNavListItems ? /* @__PURE__ */ jsx10(SubNavListItemsCollapse, { openSubNav, collapse, children: subNavListItems == null ? void 0 : subNavListItems.map((item, index) => /* @__PURE__ */ jsx10(MenuListItemContainer, { dense, sx: { pl: theme.spacing(1) }, ...item }, index)) }) : null
|
231
|
+
] });
|
232
|
+
};
|
233
|
+
|
234
|
+
// src/components/SiteMenu/Menu.tsx
|
235
|
+
import { jsx as jsx11, jsxs as jsxs3 } from "react/jsx-runtime";
|
236
|
+
var SiteMenu = ({ children, onMenuToggle, side = "right", ...props }) => {
|
237
|
+
const [open, setOpen] = useState3(false);
|
238
|
+
useEffect2(() => {
|
239
|
+
onMenuToggle == null ? void 0 : onMenuToggle(open);
|
240
|
+
}, [onMenuToggle, open]);
|
241
|
+
return /* @__PURE__ */ jsxs3(FlexRow3, { alignItems: "stretch", ...props, children: [
|
242
|
+
/* @__PURE__ */ jsx11(
|
243
|
+
IconButton2,
|
244
|
+
{
|
245
|
+
size: "small",
|
246
|
+
color: "inherit",
|
247
|
+
onClick: () => {
|
248
|
+
setOpen(!open);
|
249
|
+
},
|
250
|
+
children: /* @__PURE__ */ jsx11(MenuIcon2, { fontSize: "large" })
|
251
|
+
}
|
252
|
+
),
|
253
|
+
/* @__PURE__ */ jsx11(
|
254
|
+
SwipeableDrawer,
|
255
|
+
{
|
256
|
+
anchor: side,
|
257
|
+
open,
|
258
|
+
onClick: () => setOpen(false),
|
259
|
+
onKeyDown: () => setOpen(false),
|
260
|
+
onClose: () => setOpen(false),
|
261
|
+
onOpen: () => setOpen(true),
|
262
|
+
children: children ?? /* @__PURE__ */ jsx11(List2, { children: /* @__PURE__ */ jsx11(MenuListItemContainer, { primary: "Settings", icon: /* @__PURE__ */ jsx11(SettingsIcon, {}), to: "/settings" }) })
|
263
|
+
}
|
264
|
+
)
|
265
|
+
] });
|
266
|
+
};
|
267
|
+
|
268
|
+
// src/components/SiteMenu/MenuSection.tsx
|
269
|
+
import { Collapse as Collapse2, ListSubheader } from "@mui/material";
|
270
|
+
import { FlexCol as FlexCol2 } from "@xylabs/react-flexbox";
|
271
|
+
import { jsx as jsx12, jsxs as jsxs4 } from "react/jsx-runtime";
|
272
|
+
var MenuSection = ({ iconMenuTextSpacing, listItems, showTitle = true, title, ...props }) => {
|
273
|
+
return /* @__PURE__ */ jsxs4(FlexCol2, { alignItems: "stretch", ...props, children: [
|
274
|
+
/* @__PURE__ */ jsx12(Collapse2, { in: showTitle, timeout: 700, children: /* @__PURE__ */ jsx12(ListSubheader, { children: title }) }),
|
275
|
+
listItems.map((item, index) => /* @__PURE__ */ jsx12(MenuListItemContainer, { iconMenuTextSpacing, ...item }, index))
|
276
|
+
] });
|
277
|
+
};
|
278
|
+
|
279
|
+
// src/components/Toolbar/System/SystemToolbar.tsx
|
280
|
+
import { jsx as jsx13, jsxs as jsxs5 } from "react/jsx-runtime";
|
281
|
+
var SystemToolbar = ({
|
282
|
+
children,
|
283
|
+
darkModeButton = false,
|
284
|
+
hideNetworkSelect,
|
285
|
+
menuItems,
|
286
|
+
networkSelectProps,
|
287
|
+
onMenuToggle,
|
288
|
+
precedingChildren,
|
289
|
+
...props
|
290
|
+
}) => {
|
291
|
+
return /* @__PURE__ */ jsxs5(Toolbar2, { ...props, children: [
|
292
|
+
precedingChildren,
|
293
|
+
hideNetworkSelect ? null : /* @__PURE__ */ jsx13(FlexRow4, { marginX: 0.5, children: /* @__PURE__ */ jsx13(Paper, { variant: "elevation", children: /* @__PURE__ */ jsx13(NetworkSelectEx, { fullWidth: true, ...networkSelectProps }) }) }),
|
294
|
+
children,
|
295
|
+
darkModeButton ? /* @__PURE__ */ jsx13(DarkModeIconButton, { color: "inherit" }) : null,
|
296
|
+
menuItems ? /* @__PURE__ */ jsx13(SiteMenu, { onMenuToggle, children: menuItems }) : null
|
297
|
+
] });
|
298
|
+
};
|
299
|
+
|
300
|
+
// src/components/AppBar/Application.tsx
|
301
|
+
import { jsx as jsx14 } from "react/jsx-runtime";
|
302
|
+
var ApplicationAppBar = ({ systemToolbar, contextToolbar, responsive = true, ...props }) => {
|
303
|
+
return /* @__PURE__ */ jsx14(
|
304
|
+
AppBarEx,
|
305
|
+
{
|
306
|
+
systemToolbar: systemToolbar ?? /* @__PURE__ */ jsx14(SystemToolbar, {}),
|
307
|
+
contextToolbar: contextToolbar ?? /* @__PURE__ */ jsx14(ContextToolbar, {}),
|
308
|
+
position: "sticky",
|
309
|
+
responsive,
|
310
|
+
...props
|
311
|
+
}
|
312
|
+
);
|
313
|
+
};
|
314
|
+
|
315
|
+
// src/components/CollapsibleDrawer/CollapseToggle.tsx
|
316
|
+
import { Icon, useTheme as useTheme5 } from "@mui/material";
|
317
|
+
import { FlexRow as FlexRow5 } from "@xylabs/react-flexbox";
|
318
|
+
import { useState as useState4 } from "react";
|
319
|
+
import { VscArrowSmallLeft, VscArrowSmallRight } from "react-icons/vsc";
|
320
|
+
import { jsx as jsx15 } from "react/jsx-runtime";
|
321
|
+
var CollapseToggleFlex = (props) => {
|
322
|
+
const { collapse, setCollapse, setCollapseEnd } = useCollapsible();
|
323
|
+
const [hover, setHover] = useState4(false);
|
324
|
+
const theme = useTheme5();
|
325
|
+
const handleCollapseToggle = () => {
|
326
|
+
setCollapse == null ? void 0 : setCollapse(!collapse);
|
327
|
+
setCollapseEnd == null ? void 0 : setCollapseEnd((previous) => previous ? false : previous);
|
328
|
+
};
|
329
|
+
return /* @__PURE__ */ jsx15(FlexRow5, { mt: 2, py: 2, justifyContent: collapse ? "start" : "center", ...props, children: /* @__PURE__ */ jsx15(
|
330
|
+
Icon,
|
331
|
+
{
|
332
|
+
onClick: handleCollapseToggle,
|
333
|
+
onMouseEnter: () => setHover(true),
|
334
|
+
onMouseLeave: () => setHover(false),
|
335
|
+
fontSize: "large",
|
336
|
+
sx: { color: hover ? theme.palette.secondary.main : "inherit", cursor: "pointer" },
|
337
|
+
children: collapse ? /* @__PURE__ */ jsx15(VscArrowSmallRight, {}) : /* @__PURE__ */ jsx15(VscArrowSmallLeft, {})
|
338
|
+
}
|
339
|
+
) });
|
340
|
+
};
|
341
|
+
|
342
|
+
// src/components/CollapsibleDrawer/CollapsibleDrawer.tsx
|
343
|
+
import { Collapse as Collapse3, styled, useTheme as useTheme6 } from "@mui/material";
|
344
|
+
import { jsx as jsx16 } from "react/jsx-runtime";
|
345
|
+
var CollapsibleDrawer = ({ children, sx, ...props }) => {
|
346
|
+
const { collapse, setCollapseEnd } = useCollapsible();
|
347
|
+
const theme = useTheme6();
|
348
|
+
const collapsedSize = props.collapsedSize ?? theme.spacing(5);
|
349
|
+
return /* @__PURE__ */ jsx16(
|
350
|
+
CollapsibleFlexInner,
|
351
|
+
{
|
352
|
+
in: !collapse,
|
353
|
+
orientation: "horizontal",
|
354
|
+
collapsedSize,
|
355
|
+
onExited: () => setCollapseEnd == null ? void 0 : setCollapseEnd(true),
|
356
|
+
sx: {
|
357
|
+
alignItems: "start",
|
358
|
+
display: "flex",
|
359
|
+
height: "100%",
|
360
|
+
...sx
|
361
|
+
},
|
362
|
+
...props,
|
363
|
+
children
|
364
|
+
}
|
365
|
+
);
|
366
|
+
};
|
367
|
+
var CollapsibleFlexInner = styled(Collapse3)(() => ({
|
368
|
+
"& .MuiCollapse-wrapperInner": {
|
369
|
+
display: "flex",
|
370
|
+
flexDirection: "column"
|
371
|
+
}
|
372
|
+
}));
|
373
|
+
|
374
|
+
// src/components/MobileSystemControls/SystemControls.tsx
|
375
|
+
import { FlexCol as FlexCol5 } from "@xylabs/react-flexbox";
|
376
|
+
|
377
|
+
// src/components/MobileSystemControls/SystemControlsRoot.tsx
|
378
|
+
import { styled as styled2 } from "@mui/material";
|
379
|
+
|
380
|
+
// src/components/MobileSystemControls/SystemControlsType.ts
|
381
|
+
var SystemControlsType = /* @__PURE__ */ ((SystemControlsType2) => {
|
382
|
+
SystemControlsType2["Left"] = "Left";
|
383
|
+
SystemControlsType2["Right"] = "Right";
|
384
|
+
SystemControlsType2["WindowShade"] = "WindowShade";
|
385
|
+
return SystemControlsType2;
|
386
|
+
})(SystemControlsType || {});
|
387
|
+
|
388
|
+
// src/components/MobileSystemControls/SystemControlsUnstyled.tsx
|
389
|
+
import { Paper as Paper2, useMediaQuery } from "@mui/material";
|
390
|
+
import { FlexCol as FlexCol4, FlexRow as FlexRow7 } from "@xylabs/react-flexbox";
|
391
|
+
import { NetworkSelectEx as NetworkSelectEx2 } from "@xyo-network/react-network";
|
392
|
+
|
393
|
+
// src/components/MobileSystemControls/controls/SystemControl.tsx
|
394
|
+
import { Collapse as Collapse4 } from "@mui/material";
|
395
|
+
import { FlexCol as FlexCol3, FlexRow as FlexRow6 } from "@xylabs/react-flexbox";
|
396
|
+
import { useState as useState5 } from "react";
|
397
|
+
import { jsx as jsx17, jsxs as jsxs6 } from "react/jsx-runtime";
|
398
|
+
var SystemControl = ({
|
399
|
+
children,
|
400
|
+
controlElement,
|
401
|
+
systemControlsType = "WindowShade" /* WindowShade */,
|
402
|
+
...props
|
403
|
+
}) => {
|
404
|
+
const [toggleControls, setToggleControls] = useState5(false);
|
405
|
+
let orientation = "vertical";
|
406
|
+
switch (systemControlsType) {
|
407
|
+
case "Left" /* Left */: {
|
408
|
+
orientation = "horizontal";
|
409
|
+
break;
|
410
|
+
}
|
411
|
+
}
|
412
|
+
return /* @__PURE__ */ jsxs6(FlexRow6, { className: "controls", ...props, children: [
|
413
|
+
/* @__PURE__ */ jsx17(Collapse4, { in: toggleControls, orientation, timeout: 500, children: /* @__PURE__ */ jsx17(FlexRow6, { bgcolor: "primary.main", className: "control", children: controlElement }) }),
|
414
|
+
/* @__PURE__ */ jsx17(FlexCol3, { style: { cursor: "pointer" }, onClick: () => setToggleControls(!toggleControls), children })
|
415
|
+
] });
|
416
|
+
};
|
417
|
+
|
418
|
+
// src/components/MobileSystemControls/SystemControlsUnstyled.tsx
|
419
|
+
import { Fragment as Fragment2, jsx as jsx18 } from "react/jsx-runtime";
|
420
|
+
var SystemControlsUnstyled = ({
|
421
|
+
visible,
|
422
|
+
systemControlsType = "WindowShade" /* WindowShade */,
|
423
|
+
...props
|
424
|
+
}) => {
|
425
|
+
const isSmall = useMediaQuery((theme) => theme.breakpoints.down("sm"));
|
426
|
+
return visible || isSmall ? /* @__PURE__ */ jsx18(FlexCol4, { ...props, className: `${props.className} system-controls-type-${systemControlsType}`, children: /* @__PURE__ */ jsx18(
|
427
|
+
SystemControl,
|
428
|
+
{
|
429
|
+
systemControlsType,
|
430
|
+
controlElement: /* @__PURE__ */ jsx18(Fragment2, { children: /* @__PURE__ */ jsx18(FlexRow7, { className: "control-wrap", children: /* @__PURE__ */ jsx18(Paper2, { variant: "elevation", elevation: 0, children: /* @__PURE__ */ jsx18(NetworkSelectEx2, { responsive: false, className: "network-ex" }) }) }) })
|
431
|
+
}
|
432
|
+
) }) : /* @__PURE__ */ jsx18(FlexCol4, {});
|
433
|
+
};
|
434
|
+
|
435
|
+
// src/components/MobileSystemControls/SystemControlsRoot.tsx
|
436
|
+
var SystemControlsRoot = styled2(SystemControlsUnstyled, { name: "SystemControls", slot: "Root" })(({ theme }) => ({
|
437
|
+
// shared defaults
|
438
|
+
["&"]: {
|
439
|
+
".toggle": {
|
440
|
+
backgroundColor: theme.palette.primary.main
|
441
|
+
},
|
442
|
+
alignItems: "start",
|
443
|
+
zIndex: 1
|
444
|
+
},
|
445
|
+
// WindowShade System Controls styles
|
446
|
+
[`&.system-controls-type-${"WindowShade" /* WindowShade */}`]: {
|
447
|
+
".control": {
|
448
|
+
borderRadius: "0 0 5px 5px",
|
449
|
+
flexDirection: "row",
|
450
|
+
flexGrow: 1,
|
451
|
+
justifyContent: "space-around",
|
452
|
+
padding: `${theme.spacing(2)} ${theme.spacing(2.5)}`
|
453
|
+
},
|
454
|
+
".controls": {
|
455
|
+
alignItems: "stretch",
|
456
|
+
flexDirection: "column",
|
457
|
+
flexGrow: 1
|
458
|
+
},
|
459
|
+
".toggle": {
|
460
|
+
borderRadius: "0 0 5px 5px",
|
461
|
+
padding: `${theme.spacing(0.5)} ${theme.spacing(1)}`
|
462
|
+
},
|
463
|
+
flexDirection: "row",
|
464
|
+
position: "absolute",
|
465
|
+
top: 0,
|
466
|
+
width: "100%"
|
467
|
+
},
|
468
|
+
// Left System Control styles
|
469
|
+
[`&.system-controls-type-${"Left" /* Left */}`]: {
|
470
|
+
".control": {
|
471
|
+
alignItems: "start",
|
472
|
+
flexDirection: "column",
|
473
|
+
padding: `${theme.spacing(2)} ${theme.spacing(2.5)}`
|
474
|
+
},
|
475
|
+
".control-wrap": {
|
476
|
+
marginBottom: `${theme.spacing(2)}`
|
477
|
+
},
|
478
|
+
".toggle": {
|
479
|
+
borderRadius: "0 5px 5px 0",
|
480
|
+
padding: `${theme.spacing(1)} ${theme.spacing(0.5)}`,
|
481
|
+
writingMode: "vertical-rl"
|
482
|
+
},
|
483
|
+
flexDirection: "column",
|
484
|
+
left: 0,
|
485
|
+
position: "fixed",
|
486
|
+
top: "30vh",
|
487
|
+
width: "auto"
|
488
|
+
}
|
489
|
+
}));
|
490
|
+
|
491
|
+
// src/components/MobileSystemControls/SystemControls.tsx
|
492
|
+
import { jsx as jsx19 } from "react/jsx-runtime";
|
493
|
+
var SystemControls = (props) => {
|
494
|
+
return /* @__PURE__ */ jsx19(FlexCol5, { children: /* @__PURE__ */ jsx19(SystemControlsRoot, { ...props }) });
|
495
|
+
};
|
496
|
+
|
497
|
+
// src/components/SearchBar/SearchBar.tsx
|
498
|
+
import { Search as SearchIcon } from "@mui/icons-material";
|
499
|
+
import { Paper as Paper3, TextField } from "@mui/material";
|
500
|
+
import { ButtonEx } from "@xylabs/react-button";
|
501
|
+
import { FlexRow as FlexRow8 } from "@xylabs/react-flexbox";
|
502
|
+
import { useState as useState6 } from "react";
|
503
|
+
import { jsx as jsx20, jsxs as jsxs7 } from "react/jsx-runtime";
|
504
|
+
var SearchBar = ({ defaultValue, onSearch, ...props }) => {
|
505
|
+
const [term, setTerm] = useState6();
|
506
|
+
return /* @__PURE__ */ jsx20(FlexRow8, { alignItems: "stretch", ...props, children: /* @__PURE__ */ jsxs7(Paper3, { variant: "elevation", elevation: 0, style: { display: "flex", overflow: "hidden", width: "100%" }, children: [
|
507
|
+
/* @__PURE__ */ jsx20(
|
508
|
+
TextField,
|
509
|
+
{
|
510
|
+
InputProps: { color: "secondary", style: { borderBottomRightRadius: 0, borderTopRightRadius: 0, borderWidth: 0 } },
|
511
|
+
variant: "outlined",
|
512
|
+
size: "small",
|
513
|
+
defaultValue,
|
514
|
+
fullWidth: true,
|
515
|
+
onChange: (event) => setTerm(event.target.value),
|
516
|
+
onKeyDown: (event) => {
|
517
|
+
if (event.key === "Enter") onSearch == null ? void 0 : onSearch(term);
|
518
|
+
}
|
519
|
+
}
|
520
|
+
),
|
521
|
+
/* @__PURE__ */ jsx20(ButtonEx, { variant: "contained", style: { borderRadius: 0, borderTopLeftRadius: 0 }, color: "secondary", onClick: () => onSearch == null ? void 0 : onSearch(term), children: /* @__PURE__ */ jsx20(SearchIcon, {}) })
|
522
|
+
] }) });
|
523
|
+
};
|
524
|
+
export {
|
525
|
+
ApplicationAppBar,
|
526
|
+
CollapseToggleFlex,
|
527
|
+
CollapsibleDrawer,
|
528
|
+
CollapsibleProvider,
|
529
|
+
ContextToolbar,
|
530
|
+
MenuListItemContainer,
|
531
|
+
MenuSection,
|
532
|
+
SearchBar,
|
533
|
+
SiteMenu,
|
534
|
+
SystemControls,
|
535
|
+
SystemControlsType,
|
536
|
+
SystemControlsUnstyled,
|
537
|
+
SystemToolbar,
|
538
|
+
useCollapsible,
|
539
|
+
useMenuItemsShared
|
540
|
+
};
|
2
541
|
//# sourceMappingURL=index.js.map
|