@xyo-network/react-appbar 2.77.0-rc.1 → 2.77.1

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