@vuu-ui/vuu-shell 0.8.10-debug → 0.8.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/cjs/index.js CHANGED
@@ -1,1762 +1,4 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
-
30
- // src/index.ts
31
- var src_exports = {};
32
- __export(src_exports, {
33
- ConnectionStatusIcon: () => ConnectionStatusIcon,
34
- ContextPanel: () => ContextPanel,
35
- DEFAULT_DENSITY: () => DEFAULT_DENSITY2,
36
- DEFAULT_THEME: () => DEFAULT_THEME,
37
- DEFAULT_THEME_MODE: () => DEFAULT_THEME_MODE,
38
- DensitySwitch: () => DensitySwitch,
39
- Feature: () => Feature,
40
- FeatureList: () => FeatureList,
41
- LayoutManagementContext: () => LayoutManagementContext,
42
- LayoutManagementProvider: () => LayoutManagementProvider,
43
- LayoutsList: () => LayoutsList,
44
- LeftNav: () => LeftNav,
45
- LoginPanel: () => LoginPanel,
46
- SaveLayoutPanel: () => SaveLayoutPanel,
47
- SessionEditingForm: () => SessionEditingForm,
48
- Shell: () => Shell,
49
- ShellContextProvider: () => ShellContextProvider,
50
- ThemeContext: () => ThemeContext,
51
- ThemeProvider: () => ThemeProvider,
52
- ThemeSwitch: () => ThemeSwitch,
53
- getAuthDetailsFromCookies: () => getAuthDetailsFromCookies,
54
- getAuthModeFromCookies: () => getAuthModeFromCookies,
55
- logout: () => logout,
56
- redirectToLogin: () => redirectToLogin,
57
- useLayoutConfig: () => useLayoutConfig,
58
- useLayoutManager: () => useLayoutManager,
59
- useShellContext: () => useShellContext,
60
- useShellLayout: () => useShellLayout,
61
- useThemeAttributes: () => useThemeAttributes
62
- });
63
- module.exports = __toCommonJS(src_exports);
64
-
65
- // src/connection-status/ConnectionStatusIcon.tsx
66
- var import_react = __toESM(require("react"));
67
- var import_classnames = __toESM(require("classnames"));
68
- var import_jsx_runtime = require("react/jsx-runtime");
69
- var ConnectionStatusIcon = ({ connectionStatus, className, element = "span", ...props }) => {
70
- const [classBase11, setClassBase] = (0, import_react.useState)("vuuConnectingStatus");
71
- (0, import_react.useEffect)(() => {
72
- switch (connectionStatus) {
73
- case "connected":
74
- case "reconnected":
75
- setClassBase("vuuActiveStatus");
76
- break;
77
- case "connecting":
78
- setClassBase("vuuConnectingStatus");
79
- break;
80
- case "disconnected":
81
- setClassBase("vuuDisconnectedStatus");
82
- break;
83
- default:
84
- break;
85
- }
86
- }, [connectionStatus]);
87
- const statusIcon = import_react.default.createElement(
88
- element,
89
- {
90
- ...props,
91
- className: (0, import_classnames.default)("vuuStatus vuuIcon", classBase11, className)
92
- }
93
- );
94
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "vuuStatus-container salt-theme", children: [
95
- statusIcon,
96
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "vuuStatus-text", children: [
97
- "Status: ",
98
- connectionStatus.toUpperCase()
99
- ] })
100
- ] }) });
101
- };
102
-
103
- // src/density-switch/DensitySwitch.tsx
104
- var import_lab = require("@salt-ds/lab");
105
- var import_react2 = require("react");
106
- var import_classnames2 = __toESM(require("classnames"));
107
- var import_jsx_runtime2 = require("react/jsx-runtime");
108
- var classBase = "vuuDensitySwitch";
109
- var densities = ["high", "medium", "low", "touch"];
110
- var DEFAULT_DENSITY = "high";
111
- var DensitySwitch = ({
112
- className: classNameProp,
113
- defaultDensity = DEFAULT_DENSITY,
114
- onChange
115
- }) => {
116
- const handleSelectionChange = (0, import_react2.useCallback)(
117
- (_event, selectedItem) => {
118
- onChange(selectedItem);
119
- },
120
- [onChange]
121
- );
122
- const className = (0, import_classnames2.default)(classBase, classNameProp);
123
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
124
- import_lab.Dropdown,
125
- {
126
- className,
127
- source: densities,
128
- defaultSelected: defaultDensity,
129
- onSelectionChange: handleSelectionChange
130
- }
131
- );
132
- };
133
-
134
- // src/feature/Feature.tsx
135
- var import_react4 = __toESM(require("react"));
136
- var import_vuu_layout = require("@vuu-ui/vuu-layout");
137
-
138
- // src/feature/FeatureErrorBoundary.tsx
139
- var import_react3 = __toESM(require("react"));
140
- var import_jsx_runtime3 = require("react/jsx-runtime");
141
- var FeatureErrorBoundary = class extends import_react3.default.Component {
142
- constructor(props) {
143
- super(props);
144
- this.state = { errorMessage: null };
145
- }
146
- static getDerivedStateFromError(error2) {
147
- return { errorMessage: error2.message };
148
- }
149
- componentDidCatch(error2, errorInfo) {
150
- console.log(`error creating component at ${this.props.url}`);
151
- console.log(error2, errorInfo);
152
- }
153
- render() {
154
- if (this.state.errorMessage) {
155
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
156
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("h1", { children: "An error occured while creating component." }),
157
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { children: this.state.errorMessage })
158
- ] });
159
- }
160
- return this.props.children;
161
- }
162
- };
163
-
164
- // src/feature/Loader.tsx
165
- var import_jsx_runtime4 = require("react/jsx-runtime");
166
- var Loader = () => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "hwLoader", children: "loading" });
167
-
168
- // src/feature/css-module-loader.ts
169
- var importCSS = async (path) => {
170
- const container = new CSSStyleSheet();
171
- return fetch(path).then((x) => x.text()).then((x) => container.replace(x));
172
- };
173
-
174
- // src/feature/Feature.tsx
175
- var import_jsx_runtime5 = require("react/jsx-runtime");
176
- var componentsMap = /* @__PURE__ */ new Map();
177
- var useCachedFeature = (url) => {
178
- (0, import_react4.useEffect)(
179
- () => () => {
180
- componentsMap.delete(url);
181
- },
182
- [url]
183
- );
184
- if (!componentsMap.has(url)) {
185
- componentsMap.set(
186
- url,
187
- import_react4.default.lazy(() => import(
188
- /* @vite-ignore */
189
- url
190
- ))
191
- );
192
- }
193
- const lazyFeature = componentsMap.get(url);
194
- if (!lazyFeature) {
195
- throw Error(`Unable to load Lazy Feature at url ${url}`);
196
- } else {
197
- return lazyFeature;
198
- }
199
- };
200
- function RawFeature({
201
- url,
202
- css,
203
- ComponentProps: params,
204
- ...props
205
- }) {
206
- if (css) {
207
- importCSS(css).then((styleSheet) => {
208
- document.adoptedStyleSheets = [
209
- ...document.adoptedStyleSheets,
210
- styleSheet
211
- ];
212
- });
213
- }
214
- const LazyFeature = useCachedFeature(url);
215
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(FeatureErrorBoundary, { url, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react4.Suspense, { fallback: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Loader, {}), children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(LazyFeature, { ...props, ...params }) }) });
216
- }
217
- var Feature = import_react4.default.memo(RawFeature);
218
- Feature.displayName = "Feature";
219
- (0, import_vuu_layout.registerComponent)("Feature", Feature, "view");
220
-
221
- // src/layout-config/use-layout-config.ts
222
- var import_react5 = require("react");
223
-
224
- // src/layout-config/local-config.ts
225
- var import_vuu_layout2 = require("@vuu-ui/vuu-layout");
226
- var loadLocalConfig = (saveUrl, user, id = "latest") => new Promise((resolve, reject) => {
227
- console.log(
228
- `load local config at ${saveUrl} for user ${user == null ? void 0 : user.username}, id ${id}`
229
- );
230
- const data = localStorage.getItem(saveUrl);
231
- if (data) {
232
- const layout = JSON.parse(data);
233
- resolve(layout);
234
- } else {
235
- reject();
236
- }
237
- });
238
- var saveLocalConfig = (saveUrl, user, data) => new Promise((resolve, reject) => {
239
- try {
240
- const layoutJson = (0, import_vuu_layout2.resolveJSONPath)(data, "#main-tabs.ACTIVE_CHILD");
241
- console.log(layoutJson);
242
- localStorage.setItem(saveUrl, JSON.stringify(data));
243
- resolve(void 0);
244
- } catch {
245
- reject();
246
- }
247
- });
248
-
249
- // src/layout-config/remote-config.ts
250
- var loadRemoteConfig = (saveUrl, user, id = "latest") => new Promise((resolve, reject) => {
251
- if (user === void 0) {
252
- throw Error("user mustb be provided to load remote config");
253
- }
254
- fetch(`${saveUrl}/${user.username}/${id}`, {}).then((response) => {
255
- if (response.ok) {
256
- resolve(response.json());
257
- } else {
258
- reject(void 0);
259
- }
260
- }).catch(() => {
261
- reject(void 0);
262
- });
263
- });
264
- var saveRemoteConfig = (saveUrl, user, data) => new Promise((resolve, reject) => {
265
- if (user === void 0) {
266
- throw Error("user mustb be provided to load remote config");
267
- }
268
- fetch(`${saveUrl}/${user.username}`, {
269
- method: "POST",
270
- headers: {
271
- "Content-Type": "application/json"
272
- },
273
- body: JSON.stringify(data)
274
- }).then((response) => {
275
- if (response.ok) {
276
- resolve(void 0);
277
- } else {
278
- reject();
279
- }
280
- });
281
- });
282
-
283
- // src/layout-config/use-layout-config.ts
284
- var FALLBACK_LAYOUT = { type: "Placeholder" };
285
- var useLayoutConfig = ({
286
- saveLocation,
287
- saveUrl = "api/vui",
288
- user,
289
- // TODO this should be an error panel
290
- defaultLayout = FALLBACK_LAYOUT
291
- }) => {
292
- const [layout, _setLayout] = (0, import_react5.useState)(defaultLayout);
293
- const usingRemote = saveLocation === "remote";
294
- const loadConfig = usingRemote ? loadRemoteConfig : loadLocalConfig;
295
- const saveConfig = usingRemote ? saveRemoteConfig : saveLocalConfig;
296
- const load = (0, import_react5.useCallback)(
297
- async (id = "latest") => {
298
- try {
299
- const layout2 = await loadConfig(saveUrl, user, id);
300
- _setLayout(layout2);
301
- } catch {
302
- _setLayout(defaultLayout);
303
- }
304
- },
305
- [defaultLayout, loadConfig, saveUrl, user]
306
- );
307
- (0, import_react5.useEffect)(() => {
308
- load();
309
- }, [load]);
310
- const saveData = (0, import_react5.useCallback)(
311
- (data) => {
312
- saveConfig(saveUrl, user, data);
313
- },
314
- [saveConfig, saveUrl, user]
315
- );
316
- const loadLayoutById = (0, import_react5.useCallback)((id) => load(id), [load]);
317
- return [layout, saveData, loadLayoutById];
318
- };
319
-
320
- // src/layout-management/SaveLayoutPanel.tsx
321
- var import_react6 = require("react");
322
- var import_core = require("@salt-ds/core");
323
- var import_vuu_ui_controls = require("@vuu-ui/vuu-ui-controls");
324
- var import_vuu_utils = require("@vuu-ui/vuu-utils");
325
- var import_jsx_runtime6 = require("react/jsx-runtime");
326
- var classBase2 = "saveLayoutPanel";
327
- var formField = `${classBase2}-formField`;
328
- var groups = ["Group 1", "Group 2", "Group 3", "Group 4", "Group 5"];
329
- var checkboxValues = ["Value 1", "Value 2", "Value 3"];
330
- var radioValues = ["Value 1", "Value 2", "Value 3"];
331
- var SaveLayoutPanel = (props) => {
332
- const { onCancel, onSave, componentId } = props;
333
- const [layoutName, setLayoutName] = (0, import_react6.useState)("");
334
- const [group, setGroup] = (0, import_react6.useState)("");
335
- const [checkValues, setCheckValues] = (0, import_react6.useState)([]);
336
- const [radioValue, setRadioValue] = (0, import_react6.useState)(radioValues[0]);
337
- const [screenshot, setScreenshot] = (0, import_react6.useState)();
338
- (0, import_react6.useEffect)(() => {
339
- if (componentId) {
340
- (0, import_vuu_utils.takeScreenshot)(document.getElementById(componentId)).then(
341
- (screenshot2) => setScreenshot(screenshot2)
342
- );
343
- }
344
- }, []);
345
- const handleSubmit = () => {
346
- onSave({
347
- name: layoutName,
348
- group,
349
- screenshot: screenshot != null ? screenshot : "",
350
- user: "User",
351
- date: (0, import_vuu_utils.formatDate)(/* @__PURE__ */ new Date(), "dd.mm.yyyy")
352
- });
353
- };
354
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: `${classBase2}-panelContainer`, children: [
355
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: `${classBase2}-panelContent`, children: [
356
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: `${classBase2}-formContainer`, children: [
357
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_core.FormField, { className: formField, children: [
358
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_core.FormFieldLabel, { children: "Group" }),
359
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
360
- import_vuu_ui_controls.ComboBox,
361
- {
362
- ListProps: {
363
- style: {
364
- zIndex: 1e4,
365
- border: "1px solid #777C94",
366
- borderRadius: 10,
367
- boxSizing: "border-box"
368
- }
369
- },
370
- source: groups,
371
- allowFreeText: true,
372
- InputProps: {
373
- inputProps: {
374
- className: `${classBase2}-inputText`,
375
- placeholder: "Select Group or Enter New Name",
376
- onChange: (event) => setGroup(event.target.value)
377
- }
378
- },
379
- width: 120,
380
- onSelectionChange: (_, value) => setGroup(value || "")
381
- }
382
- )
383
- ] }),
384
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_core.FormField, { className: formField, children: [
385
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_core.FormFieldLabel, { children: "Layout Name" }),
386
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
387
- import_core.Input,
388
- {
389
- inputProps: {
390
- className: `${classBase2}-inputText`,
391
- placeholder: "Enter Layout Name"
392
- },
393
- onChange: (event) => setLayoutName(event.target.value),
394
- value: layoutName
395
- }
396
- )
397
- ] }),
398
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_core.FormField, { className: formField, children: [
399
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_core.FormFieldLabel, { children: "Some Layout Setting" }),
400
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: `${classBase2}-settingsGroup`, children: checkboxValues.map((value, i) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
401
- import_vuu_ui_controls.Checkbox,
402
- {
403
- onToggle: () => setCheckValues(
404
- (prev) => prev.includes(value) ? prev.filter((entry) => entry !== value) : [...prev, value]
405
- ),
406
- checked: checkValues.includes(value),
407
- label: value
408
- },
409
- i
410
- )) })
411
- ] }),
412
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_core.FormField, { className: formField, children: [
413
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_core.FormFieldLabel, { children: "Some Layout Setting" }),
414
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: `${classBase2}-settingsGroup`, children: radioValues.map((value, i) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
415
- import_vuu_ui_controls.RadioButton,
416
- {
417
- onClick: () => setRadioValue(value),
418
- checked: radioValue === value,
419
- label: value,
420
- groupName: "radioGroup"
421
- },
422
- i
423
- )) })
424
- ] })
425
- ] }),
426
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: `${classBase2}-screenshotContainer`, children: screenshot ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
427
- "img",
428
- {
429
- className: `${classBase2}-screenshot`,
430
- src: screenshot,
431
- alt: "screenshot of current layout"
432
- }
433
- ) : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_core.Text, { className: "screenshot", children: "No screenshot available" }) })
434
- ] }),
435
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: `${classBase2}-buttonsContainer`, children: [
436
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_core.Button, { className: `${classBase2}-cancelButton`, onClick: onCancel, children: "Cancel" }),
437
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
438
- import_core.Button,
439
- {
440
- className: `${classBase2}-saveButton`,
441
- onClick: handleSubmit,
442
- disabled: layoutName === "" || group === "",
443
- children: "Save"
444
- }
445
- )
446
- ] })
447
- ] });
448
- };
449
-
450
- // src/layout-management/LayoutList.tsx
451
- var import_vuu_ui_controls2 = require("@vuu-ui/vuu-ui-controls");
452
-
453
- // src/layout-management/useLayoutManager.tsx
454
- var import_react7 = __toESM(require("react"));
455
- var import_vuu_filters = require("@vuu-ui/vuu-filters");
456
- var import_vuu_utils2 = require("@vuu-ui/vuu-utils");
457
- var import_jsx_runtime7 = require("react/jsx-runtime");
458
- var LayoutManagementContext = import_react7.default.createContext({ layouts: [], saveLayout: () => {
459
- } });
460
- var LayoutManagementProvider = (props) => {
461
- const [layouts, setLayouts] = (0, import_react7.useState)([]);
462
- (0, import_react7.useEffect)(() => {
463
- const layouts2 = (0, import_vuu_filters.getLocalEntity)("layouts");
464
- setLayouts(layouts2 || []);
465
- }, []);
466
- (0, import_react7.useEffect)(() => {
467
- (0, import_vuu_filters.saveLocalEntity)("layouts", layouts);
468
- }, [layouts]);
469
- const saveLayout = (0, import_react7.useCallback)((metadata) => {
470
- const json = (0, import_vuu_filters.getLocalEntity)("api/vui");
471
- if (json) {
472
- setLayouts((prev) => [
473
- ...prev,
474
- {
475
- metadata: {
476
- ...metadata,
477
- id: (0, import_vuu_utils2.getUniqueId)()
478
- },
479
- json
480
- }
481
- ]);
482
- }
483
- }, []);
484
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(LayoutManagementContext.Provider, { value: { layouts, saveLayout }, children: props.children });
485
- };
486
- var useLayoutManager = () => (0, import_react7.useContext)(LayoutManagementContext);
487
-
488
- // src/layout-management/LayoutList.tsx
489
- var import_jsx_runtime8 = require("react/jsx-runtime");
490
- var classBase3 = "vuuLayoutList";
491
- var LayoutsList = (props) => {
492
- const { layouts } = useLayoutManager();
493
- const layoutMetadata = layouts.map((layout) => layout.metadata);
494
- const handleLoadLayout = (layoutId) => {
495
- console.log("loading layout with id", layoutId);
496
- console.log(
497
- "json:",
498
- layouts.find((layout) => layout.metadata.id === layoutId)
499
- );
500
- };
501
- const layoutsByGroup = layoutMetadata.reduce((acc, cur) => {
502
- if (acc[cur.group]) {
503
- return {
504
- ...acc,
505
- [cur.group]: [...acc[cur.group], cur]
506
- };
507
- }
508
- return {
509
- ...acc,
510
- [cur.group]: [cur]
511
- };
512
- }, {});
513
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: classBase3, ...props, children: [
514
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: `${classBase3}-header`, children: "My Layouts" }),
515
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
516
- import_vuu_ui_controls2.List,
517
- {
518
- height: "fit-content",
519
- source: Object.entries(layoutsByGroup),
520
- ListItem: ({ item }) => /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
521
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: `${classBase3}-groupName`, children: item == null ? void 0 : item[0] }),
522
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
523
- import_vuu_ui_controls2.List,
524
- {
525
- height: "fit-content",
526
- source: item == null ? void 0 : item[1],
527
- ListItem: ({ item: layout }) => /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
528
- "div",
529
- {
530
- className: `${classBase3}-layoutContainer`,
531
- onClick: () => handleLoadLayout(layout == null ? void 0 : layout.id),
532
- children: [
533
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
534
- "img",
535
- {
536
- className: `${classBase3}-screenshot`,
537
- src: layout == null ? void 0 : layout.screenshot
538
- }
539
- ),
540
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { children: [
541
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: `${classBase3}-layoutName`, children: layout == null ? void 0 : layout.name }),
542
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: `${classBase3}-layoutDetails`, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { children: `${layout == null ? void 0 : layout.user}, ${layout == null ? void 0 : layout.date}` }) })
543
- ] })
544
- ]
545
- },
546
- layout == null ? void 0 : layout.id
547
- )
548
- }
549
- )
550
- ] })
551
- }
552
- )
553
- ] });
554
- };
555
-
556
- // ../vuu-icons/src/VuuLogo.tsx
557
- var import_react8 = require("react");
558
- var import_jsx_runtime9 = require("react/jsx-runtime");
559
- var VuuLogo = (0, import_react8.memo)(() => {
560
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
561
- "svg",
562
- {
563
- width: "44",
564
- height: "45",
565
- viewBox: "0 0 44 45",
566
- fill: "none",
567
- xmlns: "http://www.w3.org/2000/svg",
568
- children: [
569
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("g", { clipPath: "url(#clip0_217_6990)", children: [
570
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
571
- "path",
572
- {
573
- d: "M39.8642 15.5509L35.9196 7.58974L34.3369 6.85464L24.6235 22.0825L39.1628 30.618L42.3152 25.6347L39.8642 15.5509Z",
574
- fill: "url(#paint0_linear_217_6990)"
575
- }
576
- ),
577
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
578
- "path",
579
- {
580
- d: "M42.6246 24.8716C41.9199 25.9157 40.9625 26.824 39.767 27.4905C38.424 28.2396 36.9563 28.597 35.5081 28.597C32.7541 28.597 30.0715 27.3094 28.4466 24.9855L15.772 3.90967L15.7655 3.9206C13.3615 0.137431 8.25372 -1.13143 4.24754 1.10507C0.178173 3.37435 -1.20852 8.39359 1.14854 12.3125L18.3445 40.9095C19.1108 42.1846 20.1816 43.1834 21.4144 43.8764C21.4241 43.8826 21.4338 43.8889 21.4435 43.8951C21.4484 43.8982 21.4549 43.9013 21.4597 43.9045C22.0332 44.2228 22.6423 44.471 23.2725 44.6536C23.3194 44.6677 23.368 44.6817 23.415 44.6942C23.6418 44.7551 23.8702 44.8097 24.1019 44.8534C24.1456 44.8612 24.1894 44.8659 24.2331 44.8737C24.4194 44.9049 24.6073 44.9314 24.7952 44.9501C24.8698 44.9579 24.9443 44.9658 25.0188 44.9704C25.2342 44.9876 25.4497 44.9985 25.6668 45.0001C25.6781 45.0001 25.6895 45.0001 25.6992 45.0001C25.7024 45.0001 25.704 45.0001 25.7073 45.0001C25.7105 45.0001 25.7121 45.0001 25.7154 45.0001C25.9503 45.0001 26.1868 44.9876 26.4217 44.9689C26.4751 44.9642 26.5286 44.9595 26.5837 44.9533C26.8137 44.9299 27.0438 44.9002 27.2738 44.8596C27.277 44.8596 27.2803 44.8596 27.2835 44.8596C27.5362 44.8144 27.7889 44.7551 28.0384 44.6864C28.0546 44.6817 28.0692 44.677 28.0854 44.6723C28.4483 44.5709 28.8063 44.4445 29.1594 44.2931C29.1659 44.29 29.174 44.2868 29.1805 44.2837C29.4494 44.1682 29.7151 44.0418 29.9759 43.8967C30.24 43.75 30.491 43.5908 30.7308 43.4206C30.9398 43.2739 31.1407 43.1179 31.3367 42.9524C31.5748 42.7495 31.8 42.5373 32.009 42.3141C32.1661 42.1471 32.3168 41.9723 32.4609 41.7913C32.5079 41.732 32.5517 41.6711 32.5954 41.6118C32.6942 41.4807 32.7882 41.3465 32.8789 41.2091C32.9259 41.1373 32.9728 41.0671 33.0182 40.9953C33.036 40.9672 33.0555 40.9407 33.0717 40.9126L42.7153 24.8763H42.6214L42.6246 24.8716Z",
581
- fill: "url(#paint1_linear_217_6990)"
582
- }
583
- ),
584
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
585
- "path",
586
- {
587
- d: "M42.8402 16.4218L42.1112 15.2232L38.9636 9.58433L37.504 7.19644C37.2286 6.56123 36.579 6.11331 35.8176 6.11331C34.8083 6.11331 33.9919 6.90147 33.9919 7.87223C33.9919 8.20154 34.0907 8.50432 34.2543 8.76808L34.2349 8.78056L39.9048 18.0808C40.5884 19.2186 40.7715 20.5437 40.4199 21.8141C40.0684 23.0845 39.226 24.1458 38.045 24.806C37.2675 25.2398 36.3846 25.4693 35.4936 25.4693C33.6727 25.4693 31.9766 24.5281 31.0662 23.0143L22.9161 9.63271H22.9323L19.4899 3.90958L19.4834 3.92051C19.4235 3.8253 19.3538 3.73947 19.2907 3.64738L19.1935 3.48663C19.1935 3.48663 19.1854 3.49131 19.1821 3.49443C17.5654 1.27666 14.9799 0.0390178 12.3118 0.00936427V0H7.91199V0.02185C10.9851 -0.184164 14.0582 1.23296 15.7656 3.92051L15.7721 3.90958L28.4451 24.987C30.0699 27.3093 32.7542 28.5985 35.5066 28.5985C36.9548 28.5985 38.4225 28.2426 39.7655 27.4919C40.961 26.8255 41.9168 25.9156 42.6231 24.8731H42.717L42.6846 24.9261C43.1366 24.2347 43.4833 23.4731 43.7068 22.6615C44.2916 20.5452 43.9871 18.3352 42.8369 16.4234L42.8402 16.4218Z",
588
- fill: "#F37880"
589
- }
590
- ),
591
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("g", { opacity: "0.86", children: [
592
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
593
- "path",
594
- {
595
- d: "M34.2332 8.78212L39.9031 18.0824C40.5868 19.2202 40.7698 20.5452 40.4183 21.8156C40.2044 22.5897 39.8059 23.2858 39.2616 23.8617C39.9744 23.2343 40.4879 22.4243 40.7423 21.5035C41.0938 20.2331 40.9107 18.908 40.2271 17.7703L34.5572 8.46998L34.5767 8.4575C34.413 8.19374 34.3142 7.89096 34.3142 7.56165C34.3142 7.15586 34.4584 6.78285 34.6982 6.48476C34.2672 6.80626 33.9902 7.30881 33.9902 7.87379C33.9902 8.2031 34.0891 8.50588 34.2527 8.76964L34.2332 8.78212Z",
596
- fill: "white"
597
- }
598
- ),
599
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
600
- "path",
601
- {
602
- d: "M42.6917 24.9169L42.6863 24.9256C42.6863 24.9256 42.6899 24.9187 42.6935 24.9152C42.6935 24.9152 42.6935 24.9152 42.6935 24.9169H42.6917Z",
603
- fill: "white"
604
- }
605
- ),
606
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
607
- "path",
608
- {
609
- d: "M40.0911 27.1798C38.7481 27.9289 37.2804 28.2863 35.8322 28.2863C33.0782 28.2863 30.3955 26.9988 28.7707 24.6749L16.0961 3.59744L16.0896 3.60837C14.9281 1.78077 13.1364 0.543128 11.1422 0H7.91199V0.02185C10.9851 -0.184164 14.0582 1.23296 15.7656 3.92051L15.7721 3.90958L28.4451 24.987C30.0699 27.3093 32.7542 28.5985 35.5066 28.5985C36.9548 28.5985 38.4225 28.2426 39.7655 27.4919C40.4815 27.0924 41.1084 26.6055 41.6511 26.0561C41.1862 26.479 40.6662 26.8583 40.0894 27.1798H40.0911Z",
610
- fill: "white"
611
- }
612
- )
613
- ] })
614
- ] }),
615
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("defs", { children: [
616
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
617
- "linearGradient",
618
- {
619
- id: "paint0_linear_217_6990",
620
- x1: "24.6235",
621
- y1: "18.7363",
622
- x2: "42.3152",
623
- y2: "18.7363",
624
- gradientUnits: "userSpaceOnUse",
625
- children: [
626
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("stop", { stopColor: "#4906A5" }),
627
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("stop", { offset: "1", stopColor: "#D3423A" })
628
- ]
629
- }
630
- ),
631
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
632
- "linearGradient",
633
- {
634
- id: "paint1_linear_217_6990",
635
- x1: "-2.35794e-05",
636
- y1: "22.5009",
637
- x2: "42.7186",
638
- y2: "22.5009",
639
- gradientUnits: "userSpaceOnUse",
640
- children: [
641
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("stop", { stopColor: "#7C06A5" }),
642
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("stop", { offset: "1", stopColor: "#D3423A" })
643
- ]
644
- }
645
- ),
646
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("clipPath", { id: "clip0_217_6990", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("rect", { width: "44", height: "45", fill: "white" }) })
647
- ] })
648
- ]
649
- }
650
- );
651
- });
652
- VuuLogo.displayName = "VuuLogo";
653
-
654
- // src/left-nav/LeftNav.tsx
655
- var import_vuu_layout4 = require("@vuu-ui/vuu-layout");
656
- var import_vuu_ui_controls3 = require("@vuu-ui/vuu-ui-controls");
657
- var import_classnames4 = __toESM(require("classnames"));
658
- var import_react10 = require("react");
659
-
660
- // src/feature-list/FeatureList.tsx
661
- var import_vuu_layout3 = require("@vuu-ui/vuu-layout");
662
- var import_jsx_runtime10 = require("react/jsx-runtime");
663
- var classBase4 = "vuuFeatureList";
664
- var FeatureList = ({
665
- features,
666
- title = "VUU TABLES",
667
- ...htmlAttributes
668
- }) => {
669
- const ViewProps = {};
670
- console.log({ features });
671
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { ...htmlAttributes, className: classBase4, children: [
672
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: `${classBase4}-header`, children: title }),
673
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_vuu_layout3.Palette, { orientation: "vertical", ViewProps, children: features.map((featureProps, i) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
674
- import_vuu_layout3.PaletteItem,
675
- {
676
- closeable: true,
677
- label: featureProps.title,
678
- resizeable: true,
679
- resize: "defer",
680
- header: true,
681
- children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Feature, { ...featureProps })
682
- },
683
- i
684
- )) })
685
- ] });
686
- };
687
-
688
- // src/theme-provider/ThemeProvider.tsx
689
- var import_react9 = require("react");
690
- var import_classnames3 = __toESM(require("classnames"));
691
- var import_jsx_runtime11 = require("react/jsx-runtime");
692
- var DEFAULT_DENSITY2 = "medium";
693
- var DEFAULT_THEME = "salt-theme";
694
- var DEFAULT_THEME_MODE = "light";
695
- var ThemeContext = (0, import_react9.createContext)({
696
- density: "high",
697
- theme: "vuu",
698
- themeMode: "light"
699
- });
700
- var DEFAULT_THEME_ATTRIBUTES = [
701
- "vuu",
702
- "vuu-density-high",
703
- "light"
704
- ];
705
- var useThemeAttributes = () => {
706
- const context = (0, import_react9.useContext)(ThemeContext);
707
- if (context) {
708
- return [
709
- `${context.theme}-theme`,
710
- `${context.theme}-density-${context.density}`,
711
- context.themeMode
712
- ];
713
- }
714
- return DEFAULT_THEME_ATTRIBUTES;
715
- };
716
- var createThemedChildren = (children, theme, themeMode, density) => {
717
- var _a;
718
- if ((0, import_react9.isValidElement)(children)) {
719
- return (0, import_react9.cloneElement)(children, {
720
- className: (0, import_classnames3.default)(
721
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
722
- (_a = children.props) == null ? void 0 : _a.className,
723
- `${theme}-theme`,
724
- `${theme}-density-${density}`
725
- ),
726
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
727
- // @ts-expect-error
728
- "data-mode": themeMode
729
- });
730
- } else {
731
- console.warn(
732
- `
1
+ "use strict";var so=Object.create;var Te=Object.defineProperty;var io=Object.getOwnPropertyDescriptor;var lo=Object.getOwnPropertyNames;var uo=Object.getPrototypeOf,co=Object.prototype.hasOwnProperty;var mo=(e,t)=>{for(var o in t)Te(e,o,{get:t[o],enumerable:!0})},st=(e,t,o,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of lo(t))!co.call(e,a)&&a!==o&&Te(e,a,{get:()=>t[a],enumerable:!(r=io(t,a))||r.enumerable});return e};var E=(e,t,o)=>(o=e!=null?so(uo(e)):{},st(t||!e||!e.__esModule?Te(o,"default",{value:e,enumerable:!0}):o,e)),po=e=>st(Te({},"__esModule",{value:!0}),e);var Go={};mo(Go,{ConnectionStatusIcon:()=>fo,ContextPanel:()=>tt,DEFAULT_DENSITY:()=>wt,DEFAULT_THEME:()=>Mt,DEFAULT_THEME_MODE:()=>Ft,DensitySwitch:()=>vo,Feature:()=>ye,FeatureList:()=>Me,LayoutManagementContext:()=>Ge,LayoutManagementProvider:()=>No,LayoutsList:()=>qe,LeftNav:()=>wo,LoginPanel:()=>Mo,SaveLayoutPanel:()=>bo,SessionEditingForm:()=>Vo,Shell:()=>Ao,ShellContextProvider:()=>_o,ThemeContext:()=>Fe,ThemeProvider:()=>De,ThemeSwitch:()=>je,getAuthDetailsFromCookies:()=>Fo,getAuthModeFromCookies:()=>Vt,logout:()=>Ke,redirectToLogin:()=>kt,useLayoutConfig:()=>Je,useLayoutManager:()=>Ye,useShellContext:()=>Jo,useShellLayout:()=>ot,useThemeAttributes:()=>Le});module.exports=po(Go);var ue=E(require("react")),it=E(require("classnames"));var X=require("react/jsx-runtime"),fo=({connectionStatus:e,className:t,element:o="span",...r})=>{let[a,n]=(0,ue.useState)("vuuConnectingStatus");(0,ue.useEffect)(()=>{switch(e){case"connected":case"reconnected":n("vuuActiveStatus");break;case"connecting":n("vuuConnectingStatus");break;case"disconnected":n("vuuDisconnectedStatus");break;default:break}},[e]);let s=ue.default.createElement(o,{...r,className:(0,it.default)("vuuStatus vuuIcon",a,t)});return(0,X.jsx)(X.Fragment,{children:(0,X.jsxs)("div",{className:"vuuStatus-container salt-theme",children:[s,(0,X.jsxs)("div",{className:"vuuStatus-text",children:["Status: ",e.toUpperCase()]})]})})};var lt=require("@salt-ds/lab"),ut=require("react"),ct=E(require("classnames")),mt=require("react/jsx-runtime"),ho="vuuDensitySwitch",go=["high","medium","low","touch"],yo="high",vo=({className:e,defaultDensity:t=yo,onChange:o})=>{let r=(0,ut.useCallback)((n,s)=>{o(s)},[o]),a=(0,ct.default)(ho,e);return(0,mt.jsx)(lt.Dropdown,{className:a,source:go,defaultSelected:t,onSelectionChange:r})};var j=E(require("react")),gt=require("@vuu-ui/vuu-layout");var dt=E(require("react")),Q=require("react/jsx-runtime"),be=class extends dt.default.Component{constructor(t){super(t),this.state={errorMessage:null}}static getDerivedStateFromError(t){return{errorMessage:t.message}}componentDidCatch(t,o){console.log(`error creating component at ${this.props.url}`),console.log(t,o)}render(){return this.state.errorMessage?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)("h1",{children:"An error occured while creating component."}),(0,Q.jsx)("p",{children:this.state.errorMessage})]}):this.props.children}};var ft=require("react/jsx-runtime"),pt=()=>(0,ft.jsx)("div",{className:"hwLoader",children:"loading"});var ht=async e=>{let t=new CSSStyleSheet;return fetch(e).then(o=>o.text()).then(o=>t.replace(o))};var ge=require("react/jsx-runtime"),Ne=new Map,Lo=e=>{(0,j.useEffect)(()=>()=>{Ne.delete(e)},[e]),Ne.has(e)||Ne.set(e,j.default.lazy(()=>import(e)));let t=Ne.get(e);if(t)return t;throw Error(`Unable to load Lazy Feature at url ${e}`)};function Co({url:e,css:t,ComponentProps:o,...r}){t&&ht(t).then(n=>{document.adoptedStyleSheets=[...document.adoptedStyleSheets,n]});let a=Lo(e);return(0,ge.jsx)(be,{url:e,children:(0,ge.jsx)(j.Suspense,{fallback:(0,ge.jsx)(pt,{}),children:(0,ge.jsx)(a,{...r,...o})})})}var ye=j.default.memo(Co);ye.displayName="Feature";(0,gt.registerComponent)("Feature",ye,"view");var Y=require("react");var yt=require("@vuu-ui/vuu-layout"),vt=(e,t,o="latest")=>new Promise((r,a)=>{console.log(`load local config at ${e} for user ${t==null?void 0:t.username}, id ${o}`);let n=localStorage.getItem(e);if(n){let s=JSON.parse(n);r(s)}else a()}),Lt=(e,t,o)=>new Promise((r,a)=>{try{let n=(0,yt.resolveJSONPath)(o,"#main-tabs.ACTIVE_CHILD");console.log(n),localStorage.setItem(e,JSON.stringify(o)),r(void 0)}catch{a()}});var Ct=(e,t,o="latest")=>new Promise((r,a)=>{if(t===void 0)throw Error("user mustb be provided to load remote config");fetch(`${e}/${t.username}/${o}`,{}).then(n=>{n.ok?r(n.json()):a(void 0)}).catch(()=>{a(void 0)})}),St=(e,t,o)=>new Promise((r,a)=>{if(t===void 0)throw Error("user mustb be provided to load remote config");fetch(`${e}/${t.username}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(o)}).then(n=>{n.ok?r(void 0):a()})});var So={type:"Placeholder"},Je=({saveLocation:e,saveUrl:t="api/vui",user:o,defaultLayout:r=So})=>{let[a,n]=(0,Y.useState)(r),s=e==="remote",p=s?Ct:vt,u=s?St:Lt,m=(0,Y.useCallback)(async(d="latest")=>{try{let C=await p(t,o,d);n(C)}catch{n(r)}},[r,p,t,o]);(0,Y.useEffect)(()=>{m()},[m]);let l=(0,Y.useCallback)(d=>{u(t,o,d)},[u,t,o]),S=(0,Y.useCallback)(d=>m(d),[m]);return[a,l,S]};var Z=require("react"),T=require("@salt-ds/core"),ce=require("@vuu-ui/vuu-ui-controls"),Ee=require("@vuu-ui/vuu-utils");var f=require("react/jsx-runtime"),w="saveLayoutPanel",Pe=`${w}-formField`,xo=["Group 1","Group 2","Group 3","Group 4","Group 5"],To=["Value 1","Value 2","Value 3"],xt=["Value 1","Value 2","Value 3"],bo=e=>{let{onCancel:t,onSave:o,componentId:r}=e,[a,n]=(0,Z.useState)(""),[s,p]=(0,Z.useState)(""),[u,m]=(0,Z.useState)([]),[l,S]=(0,Z.useState)(xt[0]),[d,C]=(0,Z.useState)();(0,Z.useEffect)(()=>{r&&(0,Ee.takeScreenshot)(document.getElementById(r)).then(c=>C(c))},[]);let v=()=>{o({name:a,group:s,screenshot:d!=null?d:"",user:"User",date:(0,Ee.formatDate)(new Date,"dd.mm.yyyy")})};return(0,f.jsxs)("div",{className:`${w}-panelContainer`,children:[(0,f.jsxs)("div",{className:`${w}-panelContent`,children:[(0,f.jsxs)("div",{className:`${w}-formContainer`,children:[(0,f.jsxs)(T.FormField,{className:Pe,children:[(0,f.jsx)(T.FormFieldLabel,{children:"Group"}),(0,f.jsx)(ce.ComboBox,{ListProps:{style:{zIndex:1e4,border:"1px solid #777C94",borderRadius:10,boxSizing:"border-box"}},source:xo,allowFreeText:!0,InputProps:{inputProps:{className:`${w}-inputText`,placeholder:"Select Group or Enter New Name",onChange:c=>p(c.target.value)}},width:120,onSelectionChange:(c,N)=>p(N||"")})]}),(0,f.jsxs)(T.FormField,{className:Pe,children:[(0,f.jsx)(T.FormFieldLabel,{children:"Layout Name"}),(0,f.jsx)(T.Input,{inputProps:{className:`${w}-inputText`,placeholder:"Enter Layout Name"},onChange:c=>n(c.target.value),value:a})]}),(0,f.jsxs)(T.FormField,{className:Pe,children:[(0,f.jsx)(T.FormFieldLabel,{children:"Some Layout Setting"}),(0,f.jsx)("div",{className:`${w}-settingsGroup`,children:To.map((c,N)=>(0,f.jsx)(ce.Checkbox,{onToggle:()=>m(I=>I.includes(c)?I.filter(K=>K!==c):[...I,c]),checked:u.includes(c),label:c},N))})]}),(0,f.jsxs)(T.FormField,{className:Pe,children:[(0,f.jsx)(T.FormFieldLabel,{children:"Some Layout Setting"}),(0,f.jsx)("div",{className:`${w}-settingsGroup`,children:xt.map((c,N)=>(0,f.jsx)(ce.RadioButton,{onClick:()=>S(c),checked:l===c,label:c,groupName:"radioGroup"},N))})]})]}),(0,f.jsx)("div",{className:`${w}-screenshotContainer`,children:d?(0,f.jsx)("img",{className:`${w}-screenshot`,src:d,alt:"screenshot of current layout"}):(0,f.jsx)(T.Text,{className:"screenshot",children:"No screenshot available"})})]}),(0,f.jsxs)("div",{className:`${w}-buttonsContainer`,children:[(0,f.jsx)(T.Button,{className:`${w}-cancelButton`,onClick:t,children:"Cancel"}),(0,f.jsx)(T.Button,{className:`${w}-saveButton`,onClick:v,disabled:a===""||s==="",children:"Save"})]})]})};var Ze=require("@vuu-ui/vuu-ui-controls");var D=E(require("react")),ve=require("@vuu-ui/vuu-filters"),Tt=require("@vuu-ui/vuu-utils"),bt=require("react/jsx-runtime"),Ge=D.default.createContext({layouts:[],saveLayout:()=>{}}),No=e=>{let[t,o]=(0,D.useState)([]);(0,D.useEffect)(()=>{let a=(0,ve.getLocalEntity)("layouts");o(a||[])},[]),(0,D.useEffect)(()=>{(0,ve.saveLocalEntity)("layouts",t)},[t]);let r=(0,D.useCallback)(a=>{let n=(0,ve.getLocalEntity)("api/vui");n&&o(s=>[...s,{metadata:{...a,id:(0,Tt.getUniqueId)()},json:n}])},[]);return(0,bt.jsx)(Ge.Provider,{value:{layouts:t,saveLayout:r},children:e.children})},Ye=()=>(0,D.useContext)(Ge);var b=require("react/jsx-runtime"),ee="vuuLayoutList",qe=e=>{let{layouts:t}=Ye(),o=t.map(n=>n.metadata),r=n=>{console.log("loading layout with id",n),console.log("json:",t.find(s=>s.metadata.id===n))},a=o.reduce((n,s)=>n[s.group]?{...n,[s.group]:[...n[s.group],s]}:{...n,[s.group]:[s]},{});return(0,b.jsxs)("div",{className:ee,...e,children:[(0,b.jsx)("div",{className:`${ee}-header`,children:"My Layouts"}),(0,b.jsx)(Ze.List,{height:"fit-content",source:Object.entries(a),ListItem:({item:n})=>(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("div",{className:`${ee}-groupName`,children:n==null?void 0:n[0]}),(0,b.jsx)(Ze.List,{height:"fit-content",source:n==null?void 0:n[1],ListItem:({item:s})=>(0,b.jsxs)("div",{className:`${ee}-layoutContainer`,onClick:()=>r(s==null?void 0:s.id),children:[(0,b.jsx)("img",{className:`${ee}-screenshot`,src:s==null?void 0:s.screenshot}),(0,b.jsxs)("div",{children:[(0,b.jsx)("div",{className:`${ee}-layoutName`,children:s==null?void 0:s.name}),(0,b.jsx)("div",{className:`${ee}-layoutDetails`,children:(0,b.jsx)("div",{children:`${s==null?void 0:s.user}, ${s==null?void 0:s.date}`})})]})]},s==null?void 0:s.id)})]})})]})};var Nt=require("react"),y=require("react/jsx-runtime"),ze=(0,Nt.memo)(()=>(0,y.jsxs)("svg",{width:"44",height:"45",viewBox:"0 0 44 45",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,y.jsxs)("g",{clipPath:"url(#clip0_217_6990)",children:[(0,y.jsx)("path",{d:"M39.8642 15.5509L35.9196 7.58974L34.3369 6.85464L24.6235 22.0825L39.1628 30.618L42.3152 25.6347L39.8642 15.5509Z",fill:"url(#paint0_linear_217_6990)"}),(0,y.jsx)("path",{d:"M42.6246 24.8716C41.9199 25.9157 40.9625 26.824 39.767 27.4905C38.424 28.2396 36.9563 28.597 35.5081 28.597C32.7541 28.597 30.0715 27.3094 28.4466 24.9855L15.772 3.90967L15.7655 3.9206C13.3615 0.137431 8.25372 -1.13143 4.24754 1.10507C0.178173 3.37435 -1.20852 8.39359 1.14854 12.3125L18.3445 40.9095C19.1108 42.1846 20.1816 43.1834 21.4144 43.8764C21.4241 43.8826 21.4338 43.8889 21.4435 43.8951C21.4484 43.8982 21.4549 43.9013 21.4597 43.9045C22.0332 44.2228 22.6423 44.471 23.2725 44.6536C23.3194 44.6677 23.368 44.6817 23.415 44.6942C23.6418 44.7551 23.8702 44.8097 24.1019 44.8534C24.1456 44.8612 24.1894 44.8659 24.2331 44.8737C24.4194 44.9049 24.6073 44.9314 24.7952 44.9501C24.8698 44.9579 24.9443 44.9658 25.0188 44.9704C25.2342 44.9876 25.4497 44.9985 25.6668 45.0001C25.6781 45.0001 25.6895 45.0001 25.6992 45.0001C25.7024 45.0001 25.704 45.0001 25.7073 45.0001C25.7105 45.0001 25.7121 45.0001 25.7154 45.0001C25.9503 45.0001 26.1868 44.9876 26.4217 44.9689C26.4751 44.9642 26.5286 44.9595 26.5837 44.9533C26.8137 44.9299 27.0438 44.9002 27.2738 44.8596C27.277 44.8596 27.2803 44.8596 27.2835 44.8596C27.5362 44.8144 27.7889 44.7551 28.0384 44.6864C28.0546 44.6817 28.0692 44.677 28.0854 44.6723C28.4483 44.5709 28.8063 44.4445 29.1594 44.2931C29.1659 44.29 29.174 44.2868 29.1805 44.2837C29.4494 44.1682 29.7151 44.0418 29.9759 43.8967C30.24 43.75 30.491 43.5908 30.7308 43.4206C30.9398 43.2739 31.1407 43.1179 31.3367 42.9524C31.5748 42.7495 31.8 42.5373 32.009 42.3141C32.1661 42.1471 32.3168 41.9723 32.4609 41.7913C32.5079 41.732 32.5517 41.6711 32.5954 41.6118C32.6942 41.4807 32.7882 41.3465 32.8789 41.2091C32.9259 41.1373 32.9728 41.0671 33.0182 40.9953C33.036 40.9672 33.0555 40.9407 33.0717 40.9126L42.7153 24.8763H42.6214L42.6246 24.8716Z",fill:"url(#paint1_linear_217_6990)"}),(0,y.jsx)("path",{d:"M42.8402 16.4218L42.1112 15.2232L38.9636 9.58433L37.504 7.19644C37.2286 6.56123 36.579 6.11331 35.8176 6.11331C34.8083 6.11331 33.9919 6.90147 33.9919 7.87223C33.9919 8.20154 34.0907 8.50432 34.2543 8.76808L34.2349 8.78056L39.9048 18.0808C40.5884 19.2186 40.7715 20.5437 40.4199 21.8141C40.0684 23.0845 39.226 24.1458 38.045 24.806C37.2675 25.2398 36.3846 25.4693 35.4936 25.4693C33.6727 25.4693 31.9766 24.5281 31.0662 23.0143L22.9161 9.63271H22.9323L19.4899 3.90958L19.4834 3.92051C19.4235 3.8253 19.3538 3.73947 19.2907 3.64738L19.1935 3.48663C19.1935 3.48663 19.1854 3.49131 19.1821 3.49443C17.5654 1.27666 14.9799 0.0390178 12.3118 0.00936427V0H7.91199V0.02185C10.9851 -0.184164 14.0582 1.23296 15.7656 3.92051L15.7721 3.90958L28.4451 24.987C30.0699 27.3093 32.7542 28.5985 35.5066 28.5985C36.9548 28.5985 38.4225 28.2426 39.7655 27.4919C40.961 26.8255 41.9168 25.9156 42.6231 24.8731H42.717L42.6846 24.9261C43.1366 24.2347 43.4833 23.4731 43.7068 22.6615C44.2916 20.5452 43.9871 18.3352 42.8369 16.4234L42.8402 16.4218Z",fill:"#F37880"}),(0,y.jsxs)("g",{opacity:"0.86",children:[(0,y.jsx)("path",{d:"M34.2332 8.78212L39.9031 18.0824C40.5868 19.2202 40.7698 20.5452 40.4183 21.8156C40.2044 22.5897 39.8059 23.2858 39.2616 23.8617C39.9744 23.2343 40.4879 22.4243 40.7423 21.5035C41.0938 20.2331 40.9107 18.908 40.2271 17.7703L34.5572 8.46998L34.5767 8.4575C34.413 8.19374 34.3142 7.89096 34.3142 7.56165C34.3142 7.15586 34.4584 6.78285 34.6982 6.48476C34.2672 6.80626 33.9902 7.30881 33.9902 7.87379C33.9902 8.2031 34.0891 8.50588 34.2527 8.76964L34.2332 8.78212Z",fill:"white"}),(0,y.jsx)("path",{d:"M42.6917 24.9169L42.6863 24.9256C42.6863 24.9256 42.6899 24.9187 42.6935 24.9152C42.6935 24.9152 42.6935 24.9152 42.6935 24.9169H42.6917Z",fill:"white"}),(0,y.jsx)("path",{d:"M40.0911 27.1798C38.7481 27.9289 37.2804 28.2863 35.8322 28.2863C33.0782 28.2863 30.3955 26.9988 28.7707 24.6749L16.0961 3.59744L16.0896 3.60837C14.9281 1.78077 13.1364 0.543128 11.1422 0H7.91199V0.02185C10.9851 -0.184164 14.0582 1.23296 15.7656 3.92051L15.7721 3.90958L28.4451 24.987C30.0699 27.3093 32.7542 28.5985 35.5066 28.5985C36.9548 28.5985 38.4225 28.2426 39.7655 27.4919C40.4815 27.0924 41.1084 26.6055 41.6511 26.0561C41.1862 26.479 40.6662 26.8583 40.0894 27.1798H40.0911Z",fill:"white"})]})]}),(0,y.jsxs)("defs",{children:[(0,y.jsxs)("linearGradient",{id:"paint0_linear_217_6990",x1:"24.6235",y1:"18.7363",x2:"42.3152",y2:"18.7363",gradientUnits:"userSpaceOnUse",children:[(0,y.jsx)("stop",{stopColor:"#4906A5"}),(0,y.jsx)("stop",{offset:"1",stopColor:"#D3423A"})]}),(0,y.jsxs)("linearGradient",{id:"paint1_linear_217_6990",x1:"-2.35794e-05",y1:"22.5009",x2:"42.7186",y2:"22.5009",gradientUnits:"userSpaceOnUse",children:[(0,y.jsx)("stop",{stopColor:"#7C06A5"}),(0,y.jsx)("stop",{offset:"1",stopColor:"#D3423A"})]}),(0,y.jsx)("clipPath",{id:"clip0_217_6990",children:(0,y.jsx)("rect",{width:"44",height:"45",fill:"white"})})]})]}));ze.displayName="VuuLogo";var re=require("@vuu-ui/vuu-layout"),q=require("@vuu-ui/vuu-ui-controls"),He=E(require("classnames"));var oe=require("react");var we=require("@vuu-ui/vuu-layout");var te=require("react/jsx-runtime"),Pt="vuuFeatureList",Me=({features:e,title:t="VUU TABLES",...o})=>{let r={};return console.log({features:e}),(0,te.jsxs)("div",{...o,className:Pt,children:[(0,te.jsx)("div",{className:`${Pt}-header`,children:t}),(0,te.jsx)(we.Palette,{orientation:"vertical",ViewProps:r,children:e.map((a,n)=>(0,te.jsx)(we.PaletteItem,{closeable:!0,label:a.title,resizeable:!0,resize:"defer",header:!0,children:(0,te.jsx)(ye,{...a})},n))})]})};var B=require("react"),Et=E(require("classnames")),Dt=require("react/jsx-runtime"),wt="medium",Mt="salt-theme",Ft="light",Fe=(0,B.createContext)({density:"high",theme:"vuu",themeMode:"light"}),Po=["vuu","vuu-density-high","light"],Le=()=>{let e=(0,B.useContext)(Fe);return e?[`${e.theme}-theme`,`${e.theme}-density-${e.density}`,e.themeMode]:Po},Eo=(e,t,o,r)=>{var a;return(0,B.isValidElement)(e)?(0,B.cloneElement)(e,{className:(0,Et.default)((a=e.props)==null?void 0:a.className,`${t}-theme`,`${t}-density-${r}`),"data-mode":o}):(console.warn(`
733
2
  ThemeProvider can only apply CSS classes for theming to a single nested child element of the ThemeProvider.
734
- Wrap elements with a single container`
735
- );
736
- return children;
737
- }
738
- };
739
- var ThemeProvider = ({
740
- applyThemeClasses = false,
741
- children,
742
- theme: themeProp,
743
- themeMode: themeModeProp,
744
- density: densityProp
745
- }) => {
746
- var _a, _b, _c;
747
- const {
748
- density: inheritedDensity,
749
- themeMode: inheritedThemeMode,
750
- theme: inheritedTheme
751
- } = (0, import_react9.useContext)(ThemeContext);
752
- const density = (_a = densityProp != null ? densityProp : inheritedDensity) != null ? _a : DEFAULT_DENSITY2;
753
- const themeMode = (_b = themeModeProp != null ? themeModeProp : inheritedThemeMode) != null ? _b : DEFAULT_THEME_MODE;
754
- const theme = (_c = themeProp != null ? themeProp : inheritedTheme) != null ? _c : DEFAULT_THEME;
755
- const themedChildren = applyThemeClasses ? createThemedChildren(children, theme, themeMode, density) : children;
756
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(ThemeContext.Provider, { value: { themeMode, density, theme }, children: themedChildren });
757
- };
758
- ThemeProvider.displayName = "ThemeProvider";
759
-
760
- // src/left-nav/LeftNav.tsx
761
- var import_jsx_runtime12 = require("react/jsx-runtime");
762
- var classBase5 = "vuuLeftNav";
763
- var LeftNav = ({
764
- "data-path": path,
765
- features,
766
- onResize,
767
- sizeCollapsed = 80,
768
- sizeContent = 240,
769
- sizeExpanded = 240,
770
- style: styleProp,
771
- tableFeatures,
772
- ...htmlAttributes
773
- }) => {
774
- const dispatch = (0, import_vuu_layout4.useLayoutProviderDispatch)();
775
- const [navState, setNavState] = (0, import_react10.useState)({
776
- activeTabIndex: 0,
777
- navStatus: "menu-full"
778
- });
779
- const [themeClass] = useThemeAttributes();
780
- const toggleNavWidth = (0, import_react10.useCallback)(
781
- (navStatus) => {
782
- switch (navStatus) {
783
- case "menu-icons":
784
- return sizeExpanded;
785
- case "menu-full":
786
- return sizeCollapsed;
787
- case "menu-full-content":
788
- return sizeCollapsed + sizeContent;
789
- case "menu-icons-content":
790
- return sizeExpanded + sizeContent;
791
- }
792
- },
793
- [sizeCollapsed, sizeContent, sizeExpanded]
794
- );
795
- const toggleNavStatus = (navStatus) => {
796
- switch (navStatus) {
797
- case "menu-icons":
798
- return "menu-full";
799
- case "menu-full":
800
- return "menu-icons";
801
- case "menu-full-content":
802
- return "menu-icons-content";
803
- case "menu-icons-content":
804
- return "menu-full-content";
805
- }
806
- };
807
- const getWidthAndStatus = (0, import_react10.useCallback)(
808
- (navState2, tabIndex) => {
809
- if (tabIndex === 0) {
810
- const newNavState = navState2 === "menu-full-content" ? "menu-full" : navState2 === "menu-icons-content" ? "menu-icons" : navState2;
811
- return newNavState === "menu-icons" ? [sizeCollapsed, newNavState] : [sizeExpanded, newNavState];
812
- } else {
813
- const newNavState = navState2 === "menu-full" ? "menu-full-content" : navState2 === "menu-icons" ? "menu-icons-content" : navState2;
814
- return newNavState === "menu-icons-content" ? [sizeCollapsed + sizeContent, newNavState] : [sizeExpanded + sizeContent, newNavState];
815
- }
816
- },
817
- [sizeCollapsed, sizeContent, sizeExpanded]
818
- );
819
- const handleTabSelection = (0, import_react10.useCallback)(
820
- (value) => {
821
- const [width, navStatus] = getWidthAndStatus(navState.navStatus, value);
822
- setNavState({
823
- activeTabIndex: value,
824
- navStatus
825
- });
826
- dispatch({
827
- type: import_vuu_layout4.Action.LAYOUT_RESIZE,
828
- path,
829
- size: width
830
- });
831
- },
832
- [dispatch, getWidthAndStatus, navState, path]
833
- );
834
- const toggleSize = (0, import_react10.useCallback)(() => {
835
- const { activeTabIndex, navStatus: currentNavStatus } = navState;
836
- setNavState({
837
- activeTabIndex,
838
- navStatus: toggleNavStatus(currentNavStatus)
839
- });
840
- dispatch({
841
- type: import_vuu_layout4.Action.LAYOUT_RESIZE,
842
- path,
843
- size: toggleNavWidth(currentNavStatus)
844
- });
845
- }, [dispatch, navState, path, toggleNavWidth]);
846
- const style = {
847
- ...styleProp,
848
- "--nav-menu-collapsed-width": `${sizeCollapsed}px`,
849
- "--nav-menu-expanded-width": `${sizeExpanded}px`
850
- };
851
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
852
- "div",
853
- {
854
- ...htmlAttributes,
855
- className: (0, import_classnames4.default)(classBase5, `${classBase5}-${navState.navStatus}`),
856
- style,
857
- children: [
858
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
859
- "div",
860
- {
861
- className: (0, import_classnames4.default)(`${classBase5}-menu-primary`, themeClass),
862
- "data-mode": "dark",
863
- children: [
864
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "vuuLeftNav-logo", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(VuuLogo, {}) }),
865
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: `${classBase5}-main`, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
866
- import_vuu_ui_controls3.Tabstrip,
867
- {
868
- activeTabIndex: navState.activeTabIndex,
869
- animateSelectionThumb: false,
870
- className: `${classBase5}-Tabstrip`,
871
- onActiveChange: handleTabSelection,
872
- orientation: "vertical",
873
- children: [
874
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_vuu_ui_controls3.Tab, { "data-icon": "demo", label: "DEMO" }),
875
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_vuu_ui_controls3.Tab, { "data-icon": "features", label: "VUU FEATURES" }),
876
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_vuu_ui_controls3.Tab, { "data-icon": "tables", label: "VUU TABLES" }),
877
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_vuu_ui_controls3.Tab, { "data-icon": "templates", label: "LAYOUT TEMPLATES" }),
878
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_vuu_ui_controls3.Tab, { "data-icon": "layouts", label: "MY LAYOUTS" })
879
- ]
880
- }
881
- ) }),
882
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "vuuLeftNav-buttonBar", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
883
- "button",
884
- {
885
- className: (0, import_classnames4.default)("vuuLeftNav-toggleButton", {
886
- "vuuLeftNav-toggleButton-open": navState.navStatus.startsWith("menu-full"),
887
- "vuuLeftNav-toggleButton-closed": navState.navStatus.startsWith("menu-icons")
888
- }),
889
- "data-icon": navState.navStatus.startsWith("menu-full") ? "chevron-left" : "chevron-right",
890
- onClick: toggleSize
891
- }
892
- ) })
893
- ]
894
- }
895
- ),
896
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
897
- import_vuu_layout4.Stack,
898
- {
899
- active: navState.activeTabIndex - 1,
900
- className: `${classBase5}-menu-secondary`,
901
- showTabs: false,
902
- children: [
903
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(FeatureList, { features, title: "Vuu Features" }),
904
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(FeatureList, { features: tableFeatures, title: "Vuu Tables" }),
905
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { style: { background: "green", height: "100%" }, children: "Layout Templates" }),
906
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "vuuLeftNav-drawer", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(LayoutsList, {}) })
907
- ]
908
- }
909
- )
910
- ]
911
- }
912
- );
913
- };
914
-
915
- // src/login/LoginPanel.tsx
916
- var import_react11 = require("react");
917
- var import_core2 = require("@salt-ds/core");
918
- var import_jsx_runtime13 = require("react/jsx-runtime");
919
- var classBase6 = "vuuLoginPanel";
920
- var LoginPanel = ({
921
- requirePassword = true,
922
- onSubmit
923
- }) => {
924
- const [username, setUserName] = (0, import_react11.useState)("");
925
- const [password, setPassword] = (0, import_react11.useState)("");
926
- const login = () => {
927
- onSubmit(username, password);
928
- };
929
- const handleUsername = (evt) => {
930
- setUserName(evt.target.value);
931
- };
932
- const handlePassword = (evt) => {
933
- setPassword(evt.target.value);
934
- };
935
- const dataIsValid = username.trim() !== "" && (requirePassword === false || password.trim() !== "");
936
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: classBase6, children: [
937
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_core2.FormField, { style: { width: 200 }, children: [
938
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_core2.FormFieldLabel, { children: "Username" }),
939
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_core2.Input, { value: username, id: "text-username", onChange: handleUsername })
940
- ] }),
941
- requirePassword ? /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_core2.FormField, { style: { width: 200 }, children: [
942
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_core2.FormFieldLabel, { children: "Password" }),
943
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
944
- import_core2.Input,
945
- {
946
- inputProps: {
947
- type: "password"
948
- },
949
- value: password,
950
- id: "text-password",
951
- onChange: handlePassword
952
- }
953
- )
954
- ] }) : null,
955
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
956
- import_core2.Button,
957
- {
958
- className: `${classBase6}-login`,
959
- disabled: !dataIsValid,
960
- onClick: login,
961
- variant: "cta",
962
- children: "Login"
963
- }
964
- )
965
- ] });
966
- };
967
-
968
- // src/login/login-utils.ts
969
- var import_vuu_utils3 = require("@vuu-ui/vuu-utils");
970
- var getAuthModeFromCookies = () => {
971
- const mode = (0, import_vuu_utils3.getCookieValue)("vuu-auth-mode");
972
- return mode != null ? mode : "";
973
- };
974
- var getAuthDetailsFromCookies = () => {
975
- const username = (0, import_vuu_utils3.getCookieValue)("vuu-username");
976
- const token = (0, import_vuu_utils3.getCookieValue)("vuu-auth-token");
977
- return [username, token];
978
- };
979
- var getDefaultLoginUrl = () => {
980
- const authMode = getAuthModeFromCookies();
981
- return authMode === "login" ? "login.html" : "demo.html";
982
- };
983
- var redirectToLogin = (loginUrl = getDefaultLoginUrl()) => {
984
- window.location.href = loginUrl;
985
- };
986
- var logout = (loginUrl) => {
987
- document.cookie = "vuu-username= ; expires = Thu, 01 Jan 1970 00:00:00 GMT";
988
- document.cookie = "vuu-auth-token= ; expires = Thu, 01 Jan 1970 00:00:00 GMT";
989
- redirectToLogin(loginUrl);
990
- };
991
-
992
- // src/session-editing-form/SessionEditingForm.tsx
993
- var import_react12 = require("react");
994
- var import_classnames5 = __toESM(require("classnames"));
995
- var import_core3 = require("@salt-ds/core");
996
- var import_core4 = require("@salt-ds/core");
997
- var import_vuu_data = require("@vuu-ui/vuu-data");
998
- var import_vuu_utils4 = require("@vuu-ui/vuu-utils");
999
- var import_jsx_runtime14 = require("react/jsx-runtime");
1000
- var classBase7 = "vuuSessionEditingForm";
1001
- var getField = (fields, name) => {
1002
- const field = fields.find((f) => f.name === name);
1003
- if (field) {
1004
- return field;
1005
- } else {
1006
- throw Error(`SessionEditingForm, no field '${name}' found`);
1007
- }
1008
- };
1009
- var getFieldNameAndValue = (evt) => {
1010
- const {
1011
- dataset: { field },
1012
- value
1013
- } = evt.target;
1014
- if (field === void 0) {
1015
- throw Error("SessionEditingForm, form field has no field name");
1016
- }
1017
- return [field, value];
1018
- };
1019
- var Status = {
1020
- uninitialised: 0,
1021
- unchanged: 1,
1022
- changed: 2,
1023
- invalid: 3
1024
- };
1025
- function getTypedValue(value, type, throwIfUndefined = false) {
1026
- switch (type) {
1027
- case "int":
1028
- case "long": {
1029
- const typedValue = parseInt(value, 10);
1030
- if ((0, import_vuu_utils4.isValidNumber)(typedValue)) {
1031
- return typedValue;
1032
- } else if (throwIfUndefined) {
1033
- throw Error("SessionEditingForm getTypedValue");
1034
- } else {
1035
- return void 0;
1036
- }
1037
- }
1038
- case "double": {
1039
- const typedValue = parseFloat(value);
1040
- if ((0, import_vuu_utils4.isValidNumber)(typedValue)) {
1041
- return typedValue;
1042
- }
1043
- return void 0;
1044
- }
1045
- case "boolean":
1046
- return value === "true" ? true : false;
1047
- default:
1048
- return value;
1049
- }
1050
- }
1051
- var getDataSource = (dataSource, schema) => {
1052
- if (dataSource) {
1053
- return dataSource;
1054
- } else if (schema) {
1055
- return new import_vuu_data.RemoteDataSource({
1056
- bufferSize: 0,
1057
- table: schema.table,
1058
- columns: schema.columns.map((col) => col.name)
1059
- });
1060
- } else {
1061
- throw Error(
1062
- "SessionEditingForm: either a DataSource or a TableSchema must be provided"
1063
- );
1064
- }
1065
- };
1066
- var SessionEditingForm = ({
1067
- className,
1068
- config: { fields, key: keyField },
1069
- dataSource: dataSourceProp,
1070
- id: idProp,
1071
- onClose,
1072
- schema,
1073
- ...htmlAttributes
1074
- }) => {
1075
- const [values, setValues] = (0, import_react12.useState)();
1076
- const [errorMessage, setErrorMessage] = (0, import_react12.useState)("");
1077
- const formContentRef = (0, import_react12.useRef)(null);
1078
- const initialDataRef = (0, import_react12.useRef)();
1079
- const dataStatusRef = (0, import_react12.useRef)(Status.uninitialised);
1080
- const dataSource = (0, import_react12.useMemo)(() => {
1081
- const applyServerData = (data) => {
1082
- if (columnMap) {
1083
- const values2 = {};
1084
- for (const column of dataSource.columns) {
1085
- values2[column] = data[columnMap[column]];
1086
- }
1087
- if (dataStatusRef.current === Status.uninitialised) {
1088
- dataStatusRef.current = Status.unchanged;
1089
- initialDataRef.current = values2;
1090
- }
1091
- setValues(values2);
1092
- }
1093
- };
1094
- const ds = getDataSource(dataSourceProp, schema);
1095
- const columnMap = (0, import_vuu_utils4.buildColumnMap)(ds.columns);
1096
- ds.subscribe({ range: { from: 0, to: 5 } }, (message) => {
1097
- if (message.type === "viewport-update" && message.rows) {
1098
- if (dataStatusRef.current === Status.uninitialised) {
1099
- applyServerData(message.rows[0]);
1100
- } else {
1101
- console.log("what do we do with server updates");
1102
- }
1103
- }
1104
- });
1105
- return ds;
1106
- }, [dataSourceProp, schema]);
1107
- const id = (0, import_core3.useIdMemo)(idProp);
1108
- const handleChange = (0, import_react12.useCallback)(
1109
- (evt) => {
1110
- const [field, value] = getFieldNameAndValue(evt);
1111
- const { type } = getField(fields, field);
1112
- const typedValue = getTypedValue(value, type);
1113
- setValues((values2 = {}) => {
1114
- const newValues = {
1115
- ...values2,
1116
- [field]: typedValue
1117
- };
1118
- const notUpdated = (0, import_vuu_utils4.shallowEquals)(newValues, initialDataRef.current);
1119
- dataStatusRef.current = notUpdated ? Status.unchanged : typedValue !== void 0 ? Status.changed : Status.invalid;
1120
- return newValues;
1121
- });
1122
- },
1123
- [fields]
1124
- );
1125
- const handleBlur = (0, import_react12.useCallback)(
1126
- (evt) => {
1127
- const [field, value] = getFieldNameAndValue(evt);
1128
- const { type } = getField(fields, field);
1129
- const rowKey = values == null ? void 0 : values[keyField];
1130
- const typedValue = getTypedValue(value, type, true);
1131
- if (typeof rowKey === "string") {
1132
- dataSource.menuRpcCall({
1133
- rowKey,
1134
- field,
1135
- value: typedValue,
1136
- type: "VP_EDIT_CELL_RPC"
1137
- });
1138
- }
1139
- },
1140
- [dataSource, fields, keyField, values]
1141
- );
1142
- const applyAction = (0, import_react12.useCallback)(
1143
- (action) => {
1144
- if (typeof action === "object" && action !== null) {
1145
- if ("type" in action && action.type === "CLOSE_DIALOG_ACTION") {
1146
- onClose();
1147
- }
1148
- }
1149
- },
1150
- [onClose]
1151
- );
1152
- const handleSubmit = (0, import_react12.useCallback)(async () => {
1153
- const response = await dataSource.menuRpcCall({
1154
- type: "VP_EDIT_SUBMIT_FORM_RPC"
1155
- });
1156
- if ((0, import_vuu_data.isErrorResponse)(response)) {
1157
- setErrorMessage(response.error);
1158
- } else if ((0, import_vuu_data.hasAction)(response)) {
1159
- applyAction(response.action);
1160
- }
1161
- }, [applyAction, dataSource]);
1162
- const handleKeyDown = (0, import_react12.useCallback)(
1163
- (evt) => {
1164
- if (evt.key === "Enter" && dataStatusRef.current === Status.changed) {
1165
- handleSubmit();
1166
- }
1167
- },
1168
- [handleSubmit]
1169
- );
1170
- const handleCancel = (0, import_react12.useCallback)(() => {
1171
- onClose();
1172
- }, [onClose]);
1173
- const getFormControl = (field) => {
1174
- var _a;
1175
- const value = String((_a = values == null ? void 0 : values[field.name]) != null ? _a : "");
1176
- if (field.readonly || field.name === keyField) {
1177
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: `${classBase7}-fieldValue vuuReadOnly`, children: value });
1178
- } else {
1179
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1180
- "input",
1181
- {
1182
- className: `${classBase7}-fieldValue`,
1183
- "data-field": field.name,
1184
- onBlur: handleBlur,
1185
- onChange: handleChange,
1186
- type: "text",
1187
- value,
1188
- id: `${id}-input-${field.name}`
1189
- }
1190
- );
1191
- }
1192
- };
1193
- (0, import_react12.useEffect)(() => {
1194
- if (formContentRef.current) {
1195
- const firstInput = formContentRef.current.querySelector(
1196
- "input"
1197
- );
1198
- if (firstInput) {
1199
- setTimeout(() => {
1200
- firstInput.focus();
1201
- firstInput.select();
1202
- }, 100);
1203
- }
1204
- }
1205
- }, []);
1206
- (0, import_react12.useEffect)(() => {
1207
- return () => {
1208
- if (dataSource) {
1209
- dataSource.unsubscribe();
1210
- }
1211
- };
1212
- }, [dataSource]);
1213
- const isDirty = dataStatusRef.current === Status.changed;
1214
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { ...htmlAttributes, className: (0, import_classnames5.default)(classBase7, className), children: [
1215
- errorMessage ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1216
- "div",
1217
- {
1218
- className: `${classBase7}-errorBanner`,
1219
- "data-icon": "error",
1220
- title: errorMessage,
1221
- children: "Error, edit(s) not saved"
1222
- }
1223
- ) : void 0,
1224
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1225
- "div",
1226
- {
1227
- className: `${classBase7}-content`,
1228
- ref: formContentRef,
1229
- onKeyDown: handleKeyDown,
1230
- children: fields.map((field) => {
1231
- var _a;
1232
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: `${classBase7}-field`, children: [
1233
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1234
- "label",
1235
- {
1236
- className: (0, import_classnames5.default)(`${classBase7}-fieldLabel`, {
1237
- [`${classBase7}-required`]: field.required
1238
- }),
1239
- htmlFor: `${id}-input-${field.name}`,
1240
- children: (_a = field == null ? void 0 : field.label) != null ? _a : field.description
1241
- }
1242
- ),
1243
- getFormControl(field)
1244
- ] }, field.name);
1245
- })
1246
- }
1247
- ),
1248
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: `${classBase7}-buttonbar salt-theme salt-density-high`, children: [
1249
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1250
- import_core4.Button,
1251
- {
1252
- type: "submit",
1253
- variant: "cta",
1254
- disabled: !isDirty,
1255
- onClick: handleSubmit,
1256
- children: "Submit"
1257
- }
1258
- ),
1259
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_core4.Button, { variant: "secondary", onClick: handleCancel, children: "Cancel" })
1260
- ] })
1261
- ] });
1262
- };
1263
-
1264
- // src/shell.tsx
1265
- var import_vuu_data2 = require("@vuu-ui/vuu-data");
1266
- var import_classnames9 = __toESM(require("classnames"));
1267
- var import_react18 = require("react");
1268
- var import_vuu_layout8 = require("@vuu-ui/vuu-layout");
1269
-
1270
- // src/app-header/AppHeader.tsx
1271
- var import_react15 = require("react");
1272
-
1273
- // src/user-profile/UserProfile.tsx
1274
- var import_core6 = require("@salt-ds/core");
1275
- var import_lab3 = require("@salt-ds/lab");
1276
- var import_icons2 = require("@salt-ds/icons");
1277
-
1278
- // src/user-profile/UserPanel.tsx
1279
- var import_vuu_utils5 = require("@vuu-ui/vuu-utils");
1280
- var import_lab2 = require("@salt-ds/lab");
1281
- var import_core5 = require("@salt-ds/core");
1282
- var import_icons = require("@salt-ds/icons");
1283
- var import_react13 = require("react");
1284
-
1285
- // src/get-layout-history.ts
1286
- var getLayoutHistory = async (user) => {
1287
- const history = await fetch(`api/vui/${user.username}`, {}).then((response) => {
1288
- return response.ok ? response.json() : null;
1289
- }).catch(() => {
1290
- console.log("error getting history");
1291
- });
1292
- return history;
1293
- };
1294
-
1295
- // src/user-profile/UserPanel.tsx
1296
- var import_jsx_runtime15 = require("react/jsx-runtime");
1297
- var byLastUpdate = ({ lastUpdate: l1 }, { lastUpdate: l2 }) => {
1298
- return l2 === l1 ? 0 : l2 < l1 ? -1 : 1;
1299
- };
1300
- var HistoryListItem = (props) => {
1301
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_lab2.ListItem, { ...props });
1302
- };
1303
- var UserPanel = (0, import_react13.forwardRef)(function UserPanel2({ loginUrl, onNavigate, user, layoutId = "latest" }, forwardedRef) {
1304
- const [history, setHistory] = (0, import_react13.useState)([]);
1305
- (0, import_react13.useEffect)(() => {
1306
- async function getHistory() {
1307
- const history2 = await getLayoutHistory(user);
1308
- const sortedHistory = history2.filter((item) => item.id !== "latest").sort(byLastUpdate).map(({ id, lastUpdate }) => ({
1309
- lastUpdate,
1310
- id,
1311
- label: `Saved at ${(0, import_vuu_utils5.formatDate)(new Date(lastUpdate), "kk:mm:ss")}`
1312
- }));
1313
- console.log({ sortedHistory });
1314
- setHistory(sortedHistory);
1315
- }
1316
- getHistory();
1317
- }, [user]);
1318
- const handleHisorySelected = (0, import_react13.useCallback)(
1319
- (evt, selected2) => {
1320
- if (selected2) {
1321
- onNavigate(selected2.id);
1322
- }
1323
- },
1324
- [onNavigate]
1325
- );
1326
- const handleLogout = (0, import_react13.useCallback)(() => {
1327
- logout(loginUrl);
1328
- }, [loginUrl]);
1329
- const selected = history.length === 0 ? null : layoutId === "latest" ? history[0] : history.find((i) => i.id === layoutId);
1330
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "vuuUserPanel", ref: forwardedRef, children: [
1331
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1332
- import_lab2.List,
1333
- {
1334
- ListItem: HistoryListItem,
1335
- className: "vuuUserPanel-history",
1336
- onSelect: handleHisorySelected,
1337
- selected,
1338
- source: history
1339
- }
1340
- ),
1341
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "vuuUserPanel-buttonBar", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_core5.Button, { "aria-label": "logout", onClick: handleLogout, children: [
1342
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_icons.ExportIcon, {}),
1343
- " Logout"
1344
- ] }) })
1345
- ] });
1346
- });
1347
-
1348
- // src/user-profile/UserProfile.tsx
1349
- var import_jsx_runtime16 = require("react/jsx-runtime");
1350
- var UserProfile = ({
1351
- layoutId,
1352
- loginUrl,
1353
- onNavigate,
1354
- user
1355
- }) => {
1356
- const handleNavigate = (id) => {
1357
- onNavigate(id);
1358
- };
1359
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_lab3.DropdownBase, { className: "vuuUserProfile", placement: "bottom-end", children: [
1360
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_core6.Button, { variant: "secondary", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_icons2.UserSolidIcon, {}) }),
1361
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
1362
- UserPanel,
1363
- {
1364
- layoutId,
1365
- loginUrl,
1366
- onNavigate: handleNavigate,
1367
- user
1368
- }
1369
- )
1370
- ] });
1371
- };
1372
-
1373
- // src/theme-switch/ThemeSwitch.tsx
1374
- var import_classnames6 = __toESM(require("classnames"));
1375
- var import_core7 = require("@salt-ds/core");
1376
- var import_react14 = require("react");
1377
- var import_jsx_runtime17 = require("react/jsx-runtime");
1378
- var classBase8 = "vuuThemeSwitch";
1379
- var ThemeSwitch = ({
1380
- className: classNameProp,
1381
- defaultMode: defaultModeProp,
1382
- mode: modeProp,
1383
- onChange,
1384
- ...htmlAttributes
1385
- }) => {
1386
- const [mode, setMode] = (0, import_core7.useControlled)({
1387
- controlled: modeProp,
1388
- default: defaultModeProp != null ? defaultModeProp : "light",
1389
- name: "ThemeSwitch",
1390
- state: "mode"
1391
- });
1392
- const handleChangeSecondary = (0, import_react14.useCallback)(
1393
- (evt) => {
1394
- const { value } = evt.target;
1395
- setMode(value);
1396
- onChange(value);
1397
- },
1398
- [onChange, setMode]
1399
- );
1400
- const className = (0, import_classnames6.default)(classBase8, classNameProp);
1401
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
1402
- import_core7.ToggleButtonGroup,
1403
- {
1404
- className,
1405
- ...htmlAttributes,
1406
- onChange: handleChangeSecondary,
1407
- value: mode,
1408
- children: [
1409
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_core7.ToggleButton, { "aria-label": "alert", "data-icon": "light", value: "dark" }),
1410
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_core7.ToggleButton, { "aria-label": "home", "data-icon": "dark", value: "light" })
1411
- ]
1412
- }
1413
- );
1414
- };
1415
-
1416
- // src/app-header/AppHeader.tsx
1417
- var import_classnames7 = __toESM(require("classnames"));
1418
- var import_jsx_runtime18 = require("react/jsx-runtime");
1419
- var classBase9 = "vuuAppHeader";
1420
- var AppHeader = ({
1421
- className: classNameProp,
1422
- layoutId,
1423
- loginUrl,
1424
- onNavigate,
1425
- onSwitchTheme,
1426
- themeMode = "light",
1427
- user,
1428
- ...htmlAttributes
1429
- }) => {
1430
- const className = (0, import_classnames7.default)(classBase9, classNameProp);
1431
- const handleSwitchTheme = (0, import_react15.useCallback)(
1432
- (mode) => onSwitchTheme == null ? void 0 : onSwitchTheme(mode),
1433
- [onSwitchTheme]
1434
- );
1435
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("header", { className, ...htmlAttributes, children: [
1436
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(ThemeSwitch, { defaultMode: themeMode, onChange: handleSwitchTheme }),
1437
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1438
- UserProfile,
1439
- {
1440
- layoutId,
1441
- loginUrl,
1442
- onNavigate,
1443
- user
1444
- }
1445
- )
1446
- ] });
1447
- };
1448
-
1449
- // src/shell.tsx
1450
- var import_vuu_utils6 = require("@vuu-ui/vuu-utils");
1451
-
1452
- // src/shell-layouts/context-panel/ContextPanel.tsx
1453
- var import_core8 = require("@salt-ds/core");
1454
- var import_classnames8 = __toESM(require("classnames"));
1455
- var import_react16 = require("react");
1456
- var import_vuu_layout5 = require("@vuu-ui/vuu-layout");
1457
- var import_jsx_runtime19 = require("react/jsx-runtime");
1458
- var classBase10 = "vuuContextPanel";
1459
- var ContextPanel = ({
1460
- className: classNameProp,
1461
- expanded = false,
1462
- content: contentProp,
1463
- overlay = false,
1464
- title
1465
- }) => {
1466
- const dispatchLayoutAction = (0, import_vuu_layout5.useLayoutProviderDispatch)();
1467
- const handleClose = (0, import_react16.useCallback)(() => {
1468
- dispatchLayoutAction({
1469
- path: "#context-panel",
1470
- propName: "expanded",
1471
- propValue: false,
1472
- type: "set-prop"
1473
- });
1474
- }, [dispatchLayoutAction]);
1475
- const className = (0, import_classnames8.default)(classBase10, classNameProp, {
1476
- [`${classBase10}-expanded`]: expanded,
1477
- [`${classBase10}-inline`]: overlay !== true,
1478
- [`${classBase10}-overlay`]: overlay
1479
- });
1480
- const content = (0, import_react16.useMemo)(
1481
- () => contentProp ? (0, import_vuu_layout5.layoutFromJson)(contentProp, "context-0") : null,
1482
- [contentProp]
1483
- );
1484
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: (0, import_classnames8.default)(classBase10, className), children: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: `${classBase10}-inner`, children: [
1485
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: `${classBase10}-header`, children: [
1486
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("h2", { className: `${classBase10}-title`, children: title }),
1487
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
1488
- import_core8.Button,
1489
- {
1490
- className: `${classBase10}-close`,
1491
- "data-icon": "close",
1492
- onClick: handleClose,
1493
- variant: "secondary"
1494
- }
1495
- )
1496
- ] }),
1497
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: `${classBase10}-content`, children: content })
1498
- ] }) });
1499
- };
1500
-
1501
- // src/shell-layouts/useFullHeightLeftPanel.tsx
1502
- var import_vuu_layout6 = require("@vuu-ui/vuu-layout");
1503
- var import_jsx_runtime20 = require("react/jsx-runtime");
1504
- var useFullHeightLeftPanel = ({
1505
- appHeader,
1506
- leftSidePanel
1507
- }) => {
1508
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
1509
- import_vuu_layout6.Flexbox,
1510
- {
1511
- className: "App",
1512
- style: {
1513
- flexDirection: "row",
1514
- height: "100%",
1515
- width: "100%"
1516
- },
1517
- children: [
1518
- leftSidePanel,
1519
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
1520
- import_vuu_layout6.Flexbox,
1521
- {
1522
- className: "vuuShell-content",
1523
- style: { flex: 1, flexDirection: "column" },
1524
- children: [
1525
- appHeader,
1526
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_vuu_layout6.DraggableLayout, { dropTarget: true, style: { flex: 1 } }, "main-content")
1527
- ]
1528
- }
1529
- ),
1530
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
1531
- ContextPanel,
1532
- {
1533
- id: "context-panel",
1534
- overlay: true,
1535
- title: "Column Settings"
1536
- }
1537
- )
1538
- ]
1539
- }
1540
- );
1541
- };
1542
-
1543
- // src/shell-layouts/useInlayLeftPanel.tsx
1544
- var import_vuu_layout7 = require("@vuu-ui/vuu-layout");
1545
- var import_react17 = require("react");
1546
- var import_jsx_runtime21 = require("react/jsx-runtime");
1547
- var useInlayLeftPanel = ({
1548
- appHeader,
1549
- leftSidePanel
1550
- }) => {
1551
- const paletteView = (0, import_react17.useRef)(null);
1552
- const [open, setOpen] = (0, import_react17.useState)(true);
1553
- const handleDrawerClick = (0, import_react17.useCallback)(
1554
- (e) => {
1555
- var _a;
1556
- const target = e.target;
1557
- if (!((_a = paletteView.current) == null ? void 0 : _a.contains(target))) {
1558
- setOpen(!open);
1559
- }
1560
- },
1561
- [open]
1562
- );
1563
- const getDrawers = (0, import_react17.useCallback)(
1564
- (leftSidePanel2) => {
1565
- const drawers = [];
1566
- drawers.push(
1567
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
1568
- import_vuu_layout7.Drawer,
1569
- {
1570
- onClick: handleDrawerClick,
1571
- open,
1572
- position: "left",
1573
- inline: true,
1574
- peekaboo: true,
1575
- sizeOpen: 200,
1576
- toggleButton: "end",
1577
- children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
1578
- import_vuu_layout7.View,
1579
- {
1580
- className: "vuuShell-palette",
1581
- id: "vw-app-palette",
1582
- ref: paletteView,
1583
- style: { height: "100%" },
1584
- children: leftSidePanel2
1585
- },
1586
- "app-palette"
1587
- )
1588
- },
1589
- "left-panel"
1590
- )
1591
- );
1592
- return drawers;
1593
- },
1594
- [handleDrawerClick, open]
1595
- );
1596
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
1597
- import_vuu_layout7.Flexbox,
1598
- {
1599
- className: "App",
1600
- style: { flexDirection: "column", height: "100%", width: "100%" },
1601
- children: [
1602
- appHeader,
1603
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_vuu_layout7.DockLayout, { style: { flex: 1 }, children: getDrawers(leftSidePanel).concat(
1604
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
1605
- import_vuu_layout7.DraggableLayout,
1606
- {
1607
- dropTarget: true,
1608
- style: { width: "100%", height: "100%" }
1609
- },
1610
- "main-content"
1611
- )
1612
- ) })
1613
- ]
1614
- }
1615
- );
1616
- };
1617
-
1618
- // src/shell-layouts/useShellLayout.ts
1619
- var useShellLayout = ({
1620
- leftSidePanelLayout = "inlay",
1621
- ...props
1622
- }) => {
1623
- const useLayoutHook = leftSidePanelLayout === "inlay" ? useInlayLeftPanel : useFullHeightLeftPanel;
1624
- return useLayoutHook(props);
1625
- };
1626
-
1627
- // src/shell.tsx
1628
- var import_jsx_runtime22 = require("react/jsx-runtime");
1629
- var { error } = (0, import_vuu_utils6.logger)("Shell");
1630
- var warningLayout = {
1631
- type: "View",
1632
- props: {
1633
- style: { height: "calc(100% - 6px)" }
1634
- },
1635
- children: [
1636
- {
1637
- props: {
1638
- className: "vuuShell-warningPlaceholder"
1639
- },
1640
- type: "Placeholder"
1641
- }
1642
- ]
1643
- };
1644
- var Shell = ({
1645
- LayoutProps,
1646
- children,
1647
- className: classNameProp,
1648
- defaultLayout = warningLayout,
1649
- leftSidePanel,
1650
- leftSidePanelLayout,
1651
- loginUrl,
1652
- saveLocation = "remote",
1653
- saveUrl,
1654
- serverUrl,
1655
- user,
1656
- ...htmlAttributes
1657
- }) => {
1658
- const rootRef = (0, import_react18.useRef)(null);
1659
- const layoutId = (0, import_react18.useRef)("latest");
1660
- const [layout, saveLayoutConfig, loadLayoutById] = useLayoutConfig({
1661
- defaultLayout,
1662
- saveLocation,
1663
- saveUrl,
1664
- user
1665
- });
1666
- const handleLayoutChange = (0, import_react18.useCallback)(
1667
- (layout2, layoutChangeReason) => {
1668
- try {
1669
- console.log(`handle layout changed ${layoutChangeReason}`);
1670
- saveLayoutConfig(layout2);
1671
- } catch {
1672
- error == null ? void 0 : error("Failed to save layout");
1673
- }
1674
- },
1675
- [saveLayoutConfig]
1676
- );
1677
- const handleSwitchTheme = (0, import_react18.useCallback)((mode) => {
1678
- if (rootRef.current) {
1679
- rootRef.current.dataset.mode = mode;
1680
- }
1681
- }, []);
1682
- const handleNavigate = (0, import_react18.useCallback)(
1683
- (id) => {
1684
- layoutId.current = id;
1685
- loadLayoutById(id);
1686
- },
1687
- [loadLayoutById]
1688
- );
1689
- (0, import_react18.useEffect)(() => {
1690
- if (serverUrl && user.token) {
1691
- (0, import_vuu_data2.connectToServer)({
1692
- authToken: user.token,
1693
- url: serverUrl,
1694
- username: user.username
1695
- });
1696
- }
1697
- }, [serverUrl, user.token, user.username]);
1698
- const [themeClass, densityClass, dataMode] = useThemeAttributes();
1699
- const className = (0, import_classnames9.default)("vuuShell", classNameProp, themeClass, densityClass);
1700
- const shellLayout = useShellLayout({
1701
- leftSidePanelLayout,
1702
- appHeader: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
1703
- AppHeader,
1704
- {
1705
- layoutId: layoutId.current,
1706
- loginUrl,
1707
- user,
1708
- onNavigate: handleNavigate,
1709
- onSwitchTheme: handleSwitchTheme
1710
- }
1711
- ),
1712
- leftSidePanel
1713
- });
1714
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(ThemeProvider, { children: [
1715
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
1716
- import_vuu_layout8.LayoutProvider,
1717
- {
1718
- ...LayoutProps,
1719
- layout,
1720
- onLayoutChange: handleLayoutChange,
1721
- children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
1722
- import_vuu_layout8.DraggableLayout,
1723
- {
1724
- className,
1725
- "data-mode": dataMode,
1726
- ref: rootRef,
1727
- ...htmlAttributes,
1728
- children: shellLayout
1729
- }
1730
- )
1731
- }
1732
- ),
1733
- children
1734
- ] });
1735
- };
1736
-
1737
- // src/ShellContextProvider.tsx
1738
- var import_react19 = require("react");
1739
- var import_jsx_runtime23 = require("react/jsx-runtime");
1740
- var defaultConfig = {};
1741
- var ShellContext = (0, import_react19.createContext)(defaultConfig);
1742
- var Provider = ({
1743
- children,
1744
- context,
1745
- inheritedContext
1746
- }) => {
1747
- const mergedContext = {
1748
- ...inheritedContext,
1749
- ...context
1750
- };
1751
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ShellContext.Provider, { value: mergedContext, children });
1752
- };
1753
- var ShellContextProvider = ({
1754
- children,
1755
- value
1756
- }) => {
1757
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ShellContext.Consumer, { children: (context) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Provider, { context: value, inheritedContext: context, children }) });
1758
- };
1759
- var useShellContext = () => {
1760
- return (0, import_react19.useContext)(ShellContext);
1761
- };
3
+ Wrap elements with a single container`),e)},De=({applyThemeClasses:e=!1,children:t,theme:o,themeMode:r,density:a})=>{var d,C,v;let{density:n,themeMode:s,theme:p}=(0,B.useContext)(Fe),u=(d=a!=null?a:n)!=null?d:wt,m=(C=r!=null?r:s)!=null?C:Ft,l=(v=o!=null?o:p)!=null?v:Mt,S=e?Eo(t,l,m,u):t;return(0,Dt.jsx)(Fe.Provider,{value:{themeMode:m,density:u,theme:l},children:S})};De.displayName="ThemeProvider";var h=require("react/jsx-runtime"),me="vuuLeftNav",wo=({"data-path":e,features:t,onResize:o,sizeCollapsed:r=80,sizeContent:a=240,sizeExpanded:n=240,style:s,tableFeatures:p,...u})=>{let m=(0,re.useLayoutProviderDispatch)(),[l,S]=(0,oe.useState)({activeTabIndex:0,navStatus:"menu-full"}),[d]=Le(),C=(0,oe.useCallback)(g=>{switch(g){case"menu-icons":return n;case"menu-full":return r;case"menu-full-content":return r+a;case"menu-icons-content":return n+a}},[r,a,n]),v=g=>{switch(g){case"menu-icons":return"menu-full";case"menu-full":return"menu-icons";case"menu-full-content":return"menu-icons-content";case"menu-icons-content":return"menu-full-content"}},c=(0,oe.useCallback)((g,M)=>{if(M===0){let P=g==="menu-full-content"?"menu-full":g==="menu-icons-content"?"menu-icons":g;return P==="menu-icons"?[r,P]:[n,P]}else{let P=g==="menu-full"?"menu-full-content":g==="menu-icons"?"menu-icons-content":g;return P==="menu-icons-content"?[r+a,P]:[n+a,P]}},[r,a,n]),N=(0,oe.useCallback)(g=>{let[M,P]=c(l.navStatus,g);S({activeTabIndex:g,navStatus:P}),m({type:re.Action.LAYOUT_RESIZE,path:e,size:M})},[m,c,l,e]),I=(0,oe.useCallback)(()=>{let{activeTabIndex:g,navStatus:M}=l;S({activeTabIndex:g,navStatus:v(M)}),m({type:re.Action.LAYOUT_RESIZE,path:e,size:C(M)})},[m,l,e,C]),K={...s,"--nav-menu-collapsed-width":`${r}px`,"--nav-menu-expanded-width":`${n}px`};return(0,h.jsxs)("div",{...u,className:(0,He.default)(me,`${me}-${l.navStatus}`),style:K,children:[(0,h.jsxs)("div",{className:(0,He.default)(`${me}-menu-primary`,d),"data-mode":"dark",children:[(0,h.jsx)("div",{className:"vuuLeftNav-logo",children:(0,h.jsx)(ze,{})}),(0,h.jsx)("div",{className:`${me}-main`,children:(0,h.jsxs)(q.Tabstrip,{activeTabIndex:l.activeTabIndex,animateSelectionThumb:!1,className:`${me}-Tabstrip`,onActiveChange:N,orientation:"vertical",children:[(0,h.jsx)(q.Tab,{"data-icon":"demo",label:"DEMO"}),(0,h.jsx)(q.Tab,{"data-icon":"features",label:"VUU FEATURES"}),(0,h.jsx)(q.Tab,{"data-icon":"tables",label:"VUU TABLES"}),(0,h.jsx)(q.Tab,{"data-icon":"templates",label:"LAYOUT TEMPLATES"}),(0,h.jsx)(q.Tab,{"data-icon":"layouts",label:"MY LAYOUTS"})]})}),(0,h.jsx)("div",{className:"vuuLeftNav-buttonBar",children:(0,h.jsx)("button",{className:(0,He.default)("vuuLeftNav-toggleButton",{"vuuLeftNav-toggleButton-open":l.navStatus.startsWith("menu-full"),"vuuLeftNav-toggleButton-closed":l.navStatus.startsWith("menu-icons")}),"data-icon":l.navStatus.startsWith("menu-full")?"chevron-left":"chevron-right",onClick:I})})]}),(0,h.jsxs)(re.Stack,{active:l.activeTabIndex-1,className:`${me}-menu-secondary`,showTabs:!1,children:[(0,h.jsx)(Me,{features:t,title:"Vuu Features"}),(0,h.jsx)(Me,{features:p,title:"Vuu Tables"}),(0,h.jsx)("div",{style:{background:"green",height:"100%"},children:"Layout Templates"}),(0,h.jsx)("div",{className:"vuuLeftNav-drawer",children:(0,h.jsx)(qe,{})})]})]})};var We=require("react"),H=require("@salt-ds/core");var V=require("react/jsx-runtime"),Ht="vuuLoginPanel",Mo=({requirePassword:e=!0,onSubmit:t})=>{let[o,r]=(0,We.useState)(""),[a,n]=(0,We.useState)(""),s=()=>{t(o,a)},p=l=>{r(l.target.value)},u=l=>{n(l.target.value)},m=o.trim()!==""&&(e===!1||a.trim()!=="");return(0,V.jsxs)("div",{className:Ht,children:[(0,V.jsxs)(H.FormField,{style:{width:200},children:[(0,V.jsx)(H.FormFieldLabel,{children:"Username"}),(0,V.jsx)(H.Input,{value:o,id:"text-username",onChange:p})]}),e?(0,V.jsxs)(H.FormField,{style:{width:200},children:[(0,V.jsx)(H.FormFieldLabel,{children:"Password"}),(0,V.jsx)(H.Input,{inputProps:{type:"password"},value:a,id:"text-password",onChange:u})]}):null,(0,V.jsx)(H.Button,{className:`${Ht}-login`,disabled:!m,onClick:s,variant:"cta",children:"Login"})]})};var Ve=require("@vuu-ui/vuu-utils"),Vt=()=>{let e=(0,Ve.getCookieValue)("vuu-auth-mode");return e!=null?e:""},Fo=()=>{let e=(0,Ve.getCookieValue)("vuu-username"),t=(0,Ve.getCookieValue)("vuu-auth-token");return[e,t]},Do=()=>Vt()==="login"?"login.html":"demo.html",kt=(e=Do())=>{window.location.href=e},Ke=e=>{document.cookie="vuu-username= ; expires = Thu, 01 Jan 1970 00:00:00 GMT",document.cookie="vuu-auth-token= ; expires = Thu, 01 Jan 1970 00:00:00 GMT",kt(e)};var L=require("react"),Xe=E(require("classnames")),$t=require("@salt-ds/core"),Qe=require("@salt-ds/core"),de=require("@vuu-ui/vuu-data"),ne=require("@vuu-ui/vuu-utils");var F=require("react/jsx-runtime"),O="vuuSessionEditingForm",Rt=(e,t)=>{let o=e.find(r=>r.name===t);if(o)return o;throw Error(`SessionEditingForm, no field '${t}' found`)},It=e=>{let{dataset:{field:t},value:o}=e.target;if(t===void 0)throw Error("SessionEditingForm, form field has no field name");return[t,o]},_={uninitialised:0,unchanged:1,changed:2,invalid:3};function Ut(e,t,o=!1){switch(t){case"int":case"long":{let r=parseInt(e,10);if((0,ne.isValidNumber)(r))return r;if(o)throw Error("SessionEditingForm getTypedValue");return}case"double":{let r=parseFloat(e);return(0,ne.isValidNumber)(r)?r:void 0}case"boolean":return e==="true";default:return e}}var Ho=(e,t)=>{if(e)return e;if(t)return new de.RemoteDataSource({bufferSize:0,table:t.table,columns:t.columns.map(o=>o.name)});throw Error("SessionEditingForm: either a DataSource or a TableSchema must be provided")},Vo=({className:e,config:{fields:t,key:o},dataSource:r,id:a,onClose:n,schema:s,...p})=>{let[u,m]=(0,L.useState)(),[l,S]=(0,L.useState)(""),d=(0,L.useRef)(null),C=(0,L.useRef)(),v=(0,L.useRef)(_.uninitialised),c=(0,L.useMemo)(()=>{let i=$=>{if(U){let A={};for(let le of c.columns)A[le]=$[U[le]];v.current===_.uninitialised&&(v.current=_.unchanged,C.current=A),m(A)}},x=Ho(r,s),U=(0,ne.buildColumnMap)(x.columns);return x.subscribe({range:{from:0,to:5}},$=>{$.type==="viewport-update"&&$.rows&&(v.current===_.uninitialised?i($.rows[0]):console.log("what do we do with server updates"))}),x},[r,s]),N=(0,$t.useIdMemo)(a),I=(0,L.useCallback)(i=>{let[x,U]=It(i),{type:$}=Rt(t,x),A=Ut(U,$);m((le={})=>{let at={...le,[x]:A},ao=(0,ne.shallowEquals)(at,C.current);return v.current=ao?_.unchanged:A!==void 0?_.changed:_.invalid,at})},[t]),K=(0,L.useCallback)(i=>{let[x,U]=It(i),{type:$}=Rt(t,x),A=u==null?void 0:u[o],le=Ut(U,$,!0);typeof A=="string"&&c.menuRpcCall({rowKey:A,field:x,value:le,type:"VP_EDIT_CELL_RPC"})},[c,t,o,u]),g=(0,L.useCallback)(i=>{typeof i=="object"&&i!==null&&"type"in i&&i.type==="CLOSE_DIALOG_ACTION"&&n()},[n]),M=(0,L.useCallback)(async()=>{let i=await c.menuRpcCall({type:"VP_EDIT_SUBMIT_FORM_RPC"});(0,de.isErrorResponse)(i)?S(i.error):(0,de.hasAction)(i)&&g(i.action)},[g,c]),P=(0,L.useCallback)(i=>{i.key==="Enter"&&v.current===_.changed&&M()},[M]),Be=(0,L.useCallback)(()=>{n()},[n]),Oe=i=>{var U;let x=String((U=u==null?void 0:u[i.name])!=null?U:"");return i.readonly||i.name===o?(0,F.jsx)("div",{className:`${O}-fieldValue vuuReadOnly`,children:x}):(0,F.jsx)("input",{className:`${O}-fieldValue`,"data-field":i.name,onBlur:K,onChange:I,type:"text",value:x,id:`${N}-input-${i.name}`})};(0,L.useEffect)(()=>{if(d.current){let i=d.current.querySelector("input");i&&setTimeout(()=>{i.focus(),i.select()},100)}},[]),(0,L.useEffect)(()=>()=>{c&&c.unsubscribe()},[c]);let _e=v.current===_.changed;return(0,F.jsxs)("div",{...p,className:(0,Xe.default)(O,e),children:[l?(0,F.jsx)("div",{className:`${O}-errorBanner`,"data-icon":"error",title:l,children:"Error, edit(s) not saved"}):void 0,(0,F.jsx)("div",{className:`${O}-content`,ref:d,onKeyDown:P,children:t.map(i=>{var x;return(0,F.jsxs)("div",{className:`${O}-field`,children:[(0,F.jsx)("label",{className:(0,Xe.default)(`${O}-fieldLabel`,{[`${O}-required`]:i.required}),htmlFor:`${N}-input-${i.name}`,children:(x=i==null?void 0:i.label)!=null?x:i.description}),Oe(i)]},i.name)})}),(0,F.jsxs)("div",{className:`${O}-buttonbar salt-theme salt-density-high`,children:[(0,F.jsx)(Qe.Button,{type:"submit",variant:"cta",disabled:!_e,onClick:M,children:"Submit"}),(0,F.jsx)(Qe.Button,{variant:"secondary",onClick:Be,children:"Cancel"})]})]})};var oo=require("@vuu-ui/vuu-data"),ro=E(require("classnames")),G=require("react");var Ue=require("@vuu-ui/vuu-layout");var Kt=require("react");var Gt=require("@salt-ds/core"),Yt=require("@salt-ds/lab"),Zt=require("@salt-ds/icons");var Bt=require("@vuu-ui/vuu-utils"),ke=require("@salt-ds/lab"),Ot=require("@salt-ds/core"),_t=require("@salt-ds/icons"),J=require("react");var At=async e=>await fetch(`api/vui/${e.username}`,{}).then(o=>o.ok?o.json():null).catch(()=>{console.log("error getting history")});var z=require("react/jsx-runtime"),ko=({lastUpdate:e},{lastUpdate:t})=>t===e?0:t<e?-1:1,Ro=e=>(0,z.jsx)(ke.ListItem,{...e}),Jt=(0,J.forwardRef)(function({loginUrl:t,onNavigate:o,user:r,layoutId:a="latest"},n){let[s,p]=(0,J.useState)([]);(0,J.useEffect)(()=>{async function S(){let C=(await At(r)).filter(v=>v.id!=="latest").sort(ko).map(({id:v,lastUpdate:c})=>({lastUpdate:c,id:v,label:`Saved at ${(0,Bt.formatDate)(new Date(c),"kk:mm:ss")}`}));console.log({sortedHistory:C}),p(C)}S()},[r]);let u=(0,J.useCallback)((S,d)=>{d&&o(d.id)},[o]),m=(0,J.useCallback)(()=>{Ke(t)},[t]),l=s.length===0?null:a==="latest"?s[0]:s.find(S=>S.id===a);return(0,z.jsxs)("div",{className:"vuuUserPanel",ref:n,children:[(0,z.jsx)(ke.List,{ListItem:Ro,className:"vuuUserPanel-history",onSelect:u,selected:l,source:s}),(0,z.jsx)("div",{className:"vuuUserPanel-buttonBar",children:(0,z.jsxs)(Ot.Button,{"aria-label":"logout",onClick:m,children:[(0,z.jsx)(_t.ExportIcon,{})," Logout"]})})]})});var pe=require("react/jsx-runtime"),qt=({layoutId:e,loginUrl:t,onNavigate:o,user:r})=>(0,pe.jsxs)(Yt.DropdownBase,{className:"vuuUserProfile",placement:"bottom-end",children:[(0,pe.jsx)(Gt.Button,{variant:"secondary",children:(0,pe.jsx)(Zt.UserSolidIcon,{})}),(0,pe.jsx)(Jt,{layoutId:e,loginUrl:t,onNavigate:n=>{o(n)},user:r})]});var zt=E(require("classnames")),ae=require("@salt-ds/core"),Wt=require("react");var Ce=require("react/jsx-runtime"),Io="vuuThemeSwitch",je=({className:e,defaultMode:t,mode:o,onChange:r,...a})=>{let[n,s]=(0,ae.useControlled)({controlled:o,default:t!=null?t:"light",name:"ThemeSwitch",state:"mode"}),p=(0,Wt.useCallback)(m=>{let{value:l}=m.target;s(l),r(l)},[r,s]),u=(0,zt.default)(Io,e);return(0,Ce.jsxs)(ae.ToggleButtonGroup,{className:u,...a,onChange:p,value:n,children:[(0,Ce.jsx)(ae.ToggleButton,{"aria-label":"alert","data-icon":"light",value:"dark"}),(0,Ce.jsx)(ae.ToggleButton,{"aria-label":"home","data-icon":"dark",value:"light"})]})};var Xt=E(require("classnames"));var Se=require("react/jsx-runtime"),Uo="vuuAppHeader",Qt=({className:e,layoutId:t,loginUrl:o,onNavigate:r,onSwitchTheme:a,themeMode:n="light",user:s,...p})=>{let u=(0,Xt.default)(Uo,e),m=(0,Kt.useCallback)(l=>a==null?void 0:a(l),[a]);return(0,Se.jsxs)("header",{className:u,...p,children:[(0,Se.jsx)(je,{defaultMode:n,onChange:m}),(0,Se.jsx)(qt,{layoutId:t,loginUrl:o,onNavigate:r,user:s})]})};var no=require("@vuu-ui/vuu-utils");var jt=require("@salt-ds/core"),et=E(require("classnames")),Re=require("react"),Ie=require("@vuu-ui/vuu-layout");var W=require("react/jsx-runtime"),k="vuuContextPanel",tt=({className:e,expanded:t=!1,content:o,overlay:r=!1,title:a})=>{let n=(0,Ie.useLayoutProviderDispatch)(),s=(0,Re.useCallback)(()=>{n({path:"#context-panel",propName:"expanded",propValue:!1,type:"set-prop"})},[n]),p=(0,et.default)(k,e,{[`${k}-expanded`]:t,[`${k}-inline`]:r!==!0,[`${k}-overlay`]:r}),u=(0,Re.useMemo)(()=>o?(0,Ie.layoutFromJson)(o,"context-0"):null,[o]);return(0,W.jsx)("div",{className:(0,et.default)(k,p),children:(0,W.jsxs)("div",{className:`${k}-inner`,children:[(0,W.jsxs)("div",{className:`${k}-header`,children:[(0,W.jsx)("h2",{className:`${k}-title`,children:a}),(0,W.jsx)(jt.Button,{className:`${k}-close`,"data-icon":"close",onClick:s,variant:"secondary"})]}),(0,W.jsx)("div",{className:`${k}-content`,children:u})]})})};var xe=require("@vuu-ui/vuu-layout");var fe=require("react/jsx-runtime"),eo=({appHeader:e,leftSidePanel:t})=>(0,fe.jsxs)(xe.Flexbox,{className:"App",style:{flexDirection:"row",height:"100%",width:"100%"},children:[t,(0,fe.jsxs)(xe.Flexbox,{className:"vuuShell-content",style:{flex:1,flexDirection:"column"},children:[e,(0,fe.jsx)(xe.DraggableLayout,{dropTarget:!0,style:{flex:1}},"main-content")]}),(0,fe.jsx)(tt,{id:"context-panel",overlay:!0,title:"Column Settings"})]});var R=require("@vuu-ui/vuu-layout"),ie=require("react"),se=require("react/jsx-runtime"),to=({appHeader:e,leftSidePanel:t})=>{let o=(0,ie.useRef)(null),[r,a]=(0,ie.useState)(!0),n=(0,ie.useCallback)(p=>{var m;let u=p.target;(m=o.current)!=null&&m.contains(u)||a(!r)},[r]),s=(0,ie.useCallback)(p=>{let u=[];return u.push((0,se.jsx)(R.Drawer,{onClick:n,open:r,position:"left",inline:!0,peekaboo:!0,sizeOpen:200,toggleButton:"end",children:(0,se.jsx)(R.View,{className:"vuuShell-palette",id:"vw-app-palette",ref:o,style:{height:"100%"},children:p},"app-palette")},"left-panel")),u},[n,r]);return(0,se.jsxs)(R.Flexbox,{className:"App",style:{flexDirection:"column",height:"100%",width:"100%"},children:[e,(0,se.jsx)(R.DockLayout,{style:{flex:1},children:s(t).concat((0,se.jsx)(R.DraggableLayout,{dropTarget:!0,style:{width:"100%",height:"100%"}},"main-content"))})]})};var ot=({leftSidePanelLayout:e="inlay",...t})=>(e==="inlay"?to:eo)(t);var he=require("react/jsx-runtime"),{error:rt}=(0,no.logger)("Shell"),$o={type:"View",props:{style:{height:"calc(100% - 6px)"}},children:[{props:{className:"vuuShell-warningPlaceholder"},type:"Placeholder"}]},Ao=({LayoutProps:e,children:t,className:o,defaultLayout:r=$o,leftSidePanel:a,leftSidePanelLayout:n,loginUrl:s,saveLocation:p="remote",saveUrl:u,serverUrl:m,user:l,...S})=>{let d=(0,G.useRef)(null),C=(0,G.useRef)("latest"),[v,c,N]=Je({defaultLayout:r,saveLocation:p,saveUrl:u,user:l}),I=(0,G.useCallback)((i,x)=>{try{console.log(`handle layout changed ${x}`),c(i)}catch{rt==null||rt("Failed to save layout")}},[c]),K=(0,G.useCallback)(i=>{d.current&&(d.current.dataset.mode=i)},[]),g=(0,G.useCallback)(i=>{C.current=i,N(i)},[N]);(0,G.useEffect)(()=>{m&&l.token&&(0,oo.connectToServer)({authToken:l.token,url:m,username:l.username})},[m,l.token,l.username]);let[M,P,Be]=Le(),Oe=(0,ro.default)("vuuShell",o,M,P),_e=ot({leftSidePanelLayout:n,appHeader:(0,he.jsx)(Qt,{layoutId:C.current,loginUrl:s,user:l,onNavigate:g,onSwitchTheme:K}),leftSidePanel:a});return(0,he.jsxs)(De,{children:[(0,he.jsx)(Ue.LayoutProvider,{...e,layout:v,onLayoutChange:I,children:(0,he.jsx)(Ue.DraggableLayout,{className:Oe,"data-mode":Be,ref:d,...S,children:_e})}),t]})};var Ae=require("react"),$e=require("react/jsx-runtime"),Bo={},nt=(0,Ae.createContext)(Bo),Oo=({children:e,context:t,inheritedContext:o})=>{let r={...o,...t};return(0,$e.jsx)(nt.Provider,{value:r,children:e})},_o=({children:e,value:t})=>(0,$e.jsx)(nt.Consumer,{children:o=>(0,$e.jsx)(Oo,{context:t,inheritedContext:o,children:e})}),Jo=()=>(0,Ae.useContext)(nt);
1762
4
  //# sourceMappingURL=index.js.map