@vuu-ui/vuu-shell 0.8.11-debug → 0.8.12

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/esm/index.js CHANGED
@@ -1,1682 +1,4 @@
1
- // src/connection-status/ConnectionStatusIcon.tsx
2
- import React, { useEffect, useState } from "react";
3
- import cx from "classnames";
4
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
5
- var ConnectionStatusIcon = ({ connectionStatus, className, element = "span", ...props }) => {
6
- const [classBase11, setClassBase] = useState("vuuConnectingStatus");
7
- useEffect(() => {
8
- switch (connectionStatus) {
9
- case "connected":
10
- case "reconnected":
11
- setClassBase("vuuActiveStatus");
12
- break;
13
- case "connecting":
14
- setClassBase("vuuConnectingStatus");
15
- break;
16
- case "disconnected":
17
- setClassBase("vuuDisconnectedStatus");
18
- break;
19
- default:
20
- break;
21
- }
22
- }, [connectionStatus]);
23
- const statusIcon = React.createElement(
24
- element,
25
- {
26
- ...props,
27
- className: cx("vuuStatus vuuIcon", classBase11, className)
28
- }
29
- );
30
- return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs("div", { className: "vuuStatus-container salt-theme", children: [
31
- statusIcon,
32
- /* @__PURE__ */ jsxs("div", { className: "vuuStatus-text", children: [
33
- "Status: ",
34
- connectionStatus.toUpperCase()
35
- ] })
36
- ] }) });
37
- };
38
-
39
- // src/density-switch/DensitySwitch.tsx
40
- import { Dropdown } from "@salt-ds/lab";
41
- import { useCallback } from "react";
42
- import cx2 from "classnames";
43
- import { jsx as jsx2 } from "react/jsx-runtime";
44
- var classBase = "vuuDensitySwitch";
45
- var densities = ["high", "medium", "low", "touch"];
46
- var DEFAULT_DENSITY = "high";
47
- var DensitySwitch = ({
48
- className: classNameProp,
49
- defaultDensity = DEFAULT_DENSITY,
50
- onChange
51
- }) => {
52
- const handleSelectionChange = useCallback(
53
- (_event, selectedItem) => {
54
- onChange(selectedItem);
55
- },
56
- [onChange]
57
- );
58
- const className = cx2(classBase, classNameProp);
59
- return /* @__PURE__ */ jsx2(
60
- Dropdown,
61
- {
62
- className,
63
- source: densities,
64
- defaultSelected: defaultDensity,
65
- onSelectionChange: handleSelectionChange
66
- }
67
- );
68
- };
69
-
70
- // src/feature/Feature.tsx
71
- import React3, { Suspense, useEffect as useEffect2 } from "react";
72
- import { registerComponent } from "@vuu-ui/vuu-layout";
73
-
74
- // src/feature/FeatureErrorBoundary.tsx
75
- import React2 from "react";
76
- import { Fragment as Fragment2, jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
77
- var FeatureErrorBoundary = class extends React2.Component {
78
- constructor(props) {
79
- super(props);
80
- this.state = { errorMessage: null };
81
- }
82
- static getDerivedStateFromError(error2) {
83
- return { errorMessage: error2.message };
84
- }
85
- componentDidCatch(error2, errorInfo) {
86
- console.log(`error creating component at ${this.props.url}`);
87
- console.log(error2, errorInfo);
88
- }
89
- render() {
90
- if (this.state.errorMessage) {
91
- return /* @__PURE__ */ jsxs2(Fragment2, { children: [
92
- /* @__PURE__ */ jsx3("h1", { children: "An error occured while creating component." }),
93
- /* @__PURE__ */ jsx3("p", { children: this.state.errorMessage })
94
- ] });
95
- }
96
- return this.props.children;
97
- }
98
- };
99
-
100
- // src/feature/Loader.tsx
101
- import { jsx as jsx4 } from "react/jsx-runtime";
102
- var Loader = () => /* @__PURE__ */ jsx4("div", { className: "hwLoader", children: "loading" });
103
-
104
- // src/feature/css-module-loader.ts
105
- var importCSS = async (path) => {
106
- const container = new CSSStyleSheet();
107
- return fetch(path).then((x) => x.text()).then((x) => container.replace(x));
108
- };
109
-
110
- // src/feature/Feature.tsx
111
- import { jsx as jsx5 } from "react/jsx-runtime";
112
- var componentsMap = /* @__PURE__ */ new Map();
113
- var useCachedFeature = (url) => {
114
- useEffect2(
115
- () => () => {
116
- componentsMap.delete(url);
117
- },
118
- [url]
119
- );
120
- if (!componentsMap.has(url)) {
121
- componentsMap.set(
122
- url,
123
- React3.lazy(() => import(
124
- /* @vite-ignore */
125
- url
126
- ))
127
- );
128
- }
129
- const lazyFeature = componentsMap.get(url);
130
- if (!lazyFeature) {
131
- throw Error(`Unable to load Lazy Feature at url ${url}`);
132
- } else {
133
- return lazyFeature;
134
- }
135
- };
136
- function RawFeature({
137
- url,
138
- css,
139
- ComponentProps: params,
140
- ...props
141
- }) {
142
- if (css) {
143
- importCSS(css).then((styleSheet) => {
144
- document.adoptedStyleSheets = [
145
- ...document.adoptedStyleSheets,
146
- styleSheet
147
- ];
148
- });
149
- }
150
- const LazyFeature = useCachedFeature(url);
151
- return /* @__PURE__ */ jsx5(FeatureErrorBoundary, { url, children: /* @__PURE__ */ jsx5(Suspense, { fallback: /* @__PURE__ */ jsx5(Loader, {}), children: /* @__PURE__ */ jsx5(LazyFeature, { ...props, ...params }) }) });
152
- }
153
- var Feature = React3.memo(RawFeature);
154
- Feature.displayName = "Feature";
155
- registerComponent("Feature", Feature, "view");
156
-
157
- // src/layout-management/SaveLayoutPanel.tsx
158
- import { useEffect as useEffect3, useState as useState2 } from "react";
159
- import { Input, Button, FormField, FormFieldLabel, Text } from "@salt-ds/core";
160
- import { ComboBox, Checkbox, RadioButton } from "@vuu-ui/vuu-ui-controls";
161
- import { formatDate, takeScreenshot } from "@vuu-ui/vuu-utils";
162
- import { jsx as jsx6, jsxs as jsxs3 } from "react/jsx-runtime";
163
- var classBase2 = "saveLayoutPanel";
164
- var formField = `${classBase2}-formField`;
165
- var groups = ["Group 1", "Group 2", "Group 3", "Group 4", "Group 5"];
166
- var checkboxValues = ["Value 1", "Value 2", "Value 3"];
167
- var radioValues = ["Value 1", "Value 2", "Value 3"];
168
- var SaveLayoutPanel = (props) => {
169
- const { onCancel, onSave, componentId } = props;
170
- const [layoutName, setLayoutName] = useState2("");
171
- const [group, setGroup] = useState2("");
172
- const [checkValues, setCheckValues] = useState2([]);
173
- const [radioValue, setRadioValue] = useState2(radioValues[0]);
174
- const [screenshot, setScreenshot] = useState2();
175
- useEffect3(() => {
176
- if (componentId) {
177
- takeScreenshot(document.getElementById(componentId)).then(
178
- (screenshot2) => setScreenshot(screenshot2)
179
- );
180
- }
181
- }, [componentId]);
182
- const handleSubmit = () => {
183
- onSave({
184
- name: layoutName,
185
- group,
186
- screenshot: screenshot != null ? screenshot : "",
187
- user: "User",
188
- date: formatDate(/* @__PURE__ */ new Date(), "dd.mm.yyyy")
189
- });
190
- };
191
- return /* @__PURE__ */ jsxs3("div", { className: `${classBase2}-panelContainer`, children: [
192
- /* @__PURE__ */ jsxs3("div", { className: `${classBase2}-panelContent`, children: [
193
- /* @__PURE__ */ jsxs3("div", { className: `${classBase2}-formContainer`, children: [
194
- /* @__PURE__ */ jsxs3(FormField, { className: formField, children: [
195
- /* @__PURE__ */ jsx6(FormFieldLabel, { children: "Group" }),
196
- /* @__PURE__ */ jsx6(
197
- ComboBox,
198
- {
199
- source: groups,
200
- allowFreeText: true,
201
- InputProps: {
202
- inputProps: {
203
- className: `${classBase2}-inputText`,
204
- placeholder: "Select Group or Enter New Name",
205
- onChange: (event) => setGroup(event.target.value)
206
- }
207
- },
208
- width: 120,
209
- onSelectionChange: (_, value) => setGroup(value || "")
210
- }
211
- )
212
- ] }),
213
- /* @__PURE__ */ jsxs3(FormField, { className: formField, children: [
214
- /* @__PURE__ */ jsx6(FormFieldLabel, { children: "Layout Name" }),
215
- /* @__PURE__ */ jsx6(
216
- Input,
217
- {
218
- inputProps: {
219
- className: `${classBase2}-inputText`,
220
- placeholder: "Enter Layout Name"
221
- },
222
- onChange: (event) => setLayoutName(event.target.value),
223
- value: layoutName
224
- }
225
- )
226
- ] }),
227
- /* @__PURE__ */ jsxs3(FormField, { className: formField, children: [
228
- /* @__PURE__ */ jsx6(FormFieldLabel, { children: "Some Layout Setting" }),
229
- /* @__PURE__ */ jsx6("div", { className: `${classBase2}-settingsGroup`, children: checkboxValues.map((value, i) => /* @__PURE__ */ jsx6(
230
- Checkbox,
231
- {
232
- onToggle: () => setCheckValues(
233
- (prev) => prev.includes(value) ? prev.filter((entry) => entry !== value) : [...prev, value]
234
- ),
235
- checked: checkValues.includes(value),
236
- label: value
237
- },
238
- i
239
- )) })
240
- ] }),
241
- /* @__PURE__ */ jsxs3(FormField, { className: formField, children: [
242
- /* @__PURE__ */ jsx6(FormFieldLabel, { children: "Some Layout Setting" }),
243
- /* @__PURE__ */ jsx6("div", { className: `${classBase2}-settingsGroup`, children: radioValues.map((value, i) => /* @__PURE__ */ jsx6(
244
- RadioButton,
245
- {
246
- onClick: () => setRadioValue(value),
247
- checked: radioValue === value,
248
- label: value,
249
- groupName: "radioGroup"
250
- },
251
- i
252
- )) })
253
- ] })
254
- ] }),
255
- /* @__PURE__ */ jsx6("div", { className: `${classBase2}-screenshotContainer`, children: screenshot ? /* @__PURE__ */ jsx6(
256
- "img",
257
- {
258
- className: `${classBase2}-screenshot`,
259
- src: screenshot,
260
- alt: "screenshot of current layout"
261
- }
262
- ) : /* @__PURE__ */ jsx6(Text, { className: "screenshot", children: "No screenshot available" }) })
263
- ] }),
264
- /* @__PURE__ */ jsxs3("div", { className: `${classBase2}-buttonsContainer`, children: [
265
- /* @__PURE__ */ jsx6(Button, { className: `${classBase2}-cancelButton`, onClick: onCancel, children: "Cancel" }),
266
- /* @__PURE__ */ jsx6(
267
- Button,
268
- {
269
- className: `${classBase2}-saveButton`,
270
- onClick: handleSubmit,
271
- disabled: layoutName === "" || group === "",
272
- children: "Save"
273
- }
274
- )
275
- ] })
276
- ] });
277
- };
278
-
279
- // src/layout-management/LayoutList.tsx
280
- import { List } from "@vuu-ui/vuu-ui-controls";
281
-
282
- // src/layout-management/useLayoutManager.tsx
283
- import React4, { useState as useState3, useCallback as useCallback2, useContext, useEffect as useEffect4 } from "react";
284
- import {
285
- LocalLayoutPersistenceManager,
286
- resolveJSONPath
287
- } from "@vuu-ui/vuu-layout";
288
- import { defaultLayout } from "@vuu-ui/vuu-layout/";
289
- import { jsx as jsx7 } from "react/jsx-runtime";
290
- var persistenceManager = new LocalLayoutPersistenceManager();
291
- var LayoutManagementContext = React4.createContext({
292
- layoutMetadata: [],
293
- saveLayout: () => {
294
- },
295
- applicationLayout: defaultLayout,
296
- saveApplicationLayout: () => {
297
- },
298
- loadLayoutById: () => defaultLayout
299
- });
300
- var LayoutManagementProvider = (props) => {
301
- const [layoutMetadata, setLayoutMetadata] = useState3([]);
302
- const [applicationLayout, setApplicationLayout] = useState3(defaultLayout);
303
- useEffect4(() => {
304
- persistenceManager.loadMetadata().then((metadata) => {
305
- setLayoutMetadata(metadata);
306
- });
307
- persistenceManager.loadApplicationLayout().then((layout) => {
308
- setApplicationLayout(layout);
309
- });
310
- }, []);
311
- const saveApplicationLayout = useCallback2((layout) => {
312
- setApplicationLayout(layout);
313
- persistenceManager.saveApplicationLayout(layout);
314
- }, []);
315
- const saveLayout = useCallback2(
316
- (metadata) => {
317
- const layoutToSave = resolveJSONPath(
318
- applicationLayout,
319
- "#main-tabs.ACTIVE_CHILD"
320
- );
321
- if (layoutToSave) {
322
- persistenceManager.createLayout(metadata, layoutToSave).then((generatedId) => {
323
- const newMetadata = {
324
- ...metadata,
325
- id: generatedId
326
- };
327
- setLayoutMetadata((prev) => [...prev, newMetadata]);
328
- });
329
- }
330
- },
331
- [applicationLayout]
332
- );
333
- const loadLayoutById = useCallback2((id) => {
334
- persistenceManager.loadLayout(id).then((layoutJson) => {
335
- setApplicationLayout((prev) => ({
336
- ...prev,
337
- children: [...prev.children || [], layoutJson]
338
- }));
339
- });
340
- }, []);
341
- return /* @__PURE__ */ jsx7(
342
- LayoutManagementContext.Provider,
343
- {
344
- value: {
345
- layoutMetadata,
346
- saveLayout,
347
- applicationLayout,
348
- saveApplicationLayout,
349
- loadLayoutById
350
- },
351
- children: props.children
352
- }
353
- );
354
- };
355
- var useLayoutManager = () => useContext(LayoutManagementContext);
356
-
357
- // src/layout-management/LayoutList.tsx
358
- import { Fragment as Fragment3, jsx as jsx8, jsxs as jsxs4 } from "react/jsx-runtime";
359
- var classBase3 = "vuuLayoutList";
360
- var LayoutsList = (props) => {
361
- const { layoutMetadata, loadLayoutById } = useLayoutManager();
362
- const handleLoadLayout = (layoutId) => {
363
- if (layoutId) {
364
- loadLayoutById(layoutId);
365
- }
366
- };
367
- const layoutsByGroup = layoutMetadata.reduce((acc, cur) => {
368
- if (acc[cur.group]) {
369
- return {
370
- ...acc,
371
- [cur.group]: [...acc[cur.group], cur]
372
- };
373
- }
374
- return {
375
- ...acc,
376
- [cur.group]: [cur]
377
- };
378
- }, {});
379
- return /* @__PURE__ */ jsxs4("div", { className: classBase3, ...props, children: [
380
- /* @__PURE__ */ jsx8("div", { className: `${classBase3}-header`, children: "My Layouts" }),
381
- /* @__PURE__ */ jsx8(
382
- List,
383
- {
384
- height: "fit-content",
385
- source: Object.entries(layoutsByGroup),
386
- ListItem: ({ item }) => {
387
- if (!item)
388
- return /* @__PURE__ */ jsx8(Fragment3, {});
389
- const [groupName, layouts] = item;
390
- return /* @__PURE__ */ jsxs4(Fragment3, { children: [
391
- /* @__PURE__ */ jsx8("div", { className: `${classBase3}-groupName`, children: groupName }),
392
- layouts.map((layout) => /* @__PURE__ */ jsxs4(
393
- "div",
394
- {
395
- className: `${classBase3}-layoutContainer`,
396
- onClick: () => handleLoadLayout(layout == null ? void 0 : layout.id),
397
- children: [
398
- /* @__PURE__ */ jsx8(
399
- "img",
400
- {
401
- className: `${classBase3}-screenshot`,
402
- src: layout == null ? void 0 : layout.screenshot
403
- }
404
- ),
405
- /* @__PURE__ */ jsxs4("div", { children: [
406
- /* @__PURE__ */ jsx8("div", { className: `${classBase3}-layoutName`, children: layout == null ? void 0 : layout.name }),
407
- /* @__PURE__ */ jsx8("div", { className: `${classBase3}-layoutDetails`, children: /* @__PURE__ */ jsx8("div", { children: `${layout == null ? void 0 : layout.user}, ${layout == null ? void 0 : layout.date}` }) })
408
- ] })
409
- ]
410
- },
411
- layout == null ? void 0 : layout.id
412
- ))
413
- ] });
414
- }
415
- }
416
- )
417
- ] });
418
- };
419
-
420
- // ../vuu-icons/src/VuuLogo.tsx
421
- import { memo } from "react";
422
- import { jsx as jsx9, jsxs as jsxs5 } from "react/jsx-runtime";
423
- var VuuLogo = memo(() => {
424
- return /* @__PURE__ */ jsxs5(
425
- "svg",
426
- {
427
- width: "44",
428
- height: "45",
429
- viewBox: "0 0 44 45",
430
- fill: "none",
431
- xmlns: "http://www.w3.org/2000/svg",
432
- children: [
433
- /* @__PURE__ */ jsxs5("g", { clipPath: "url(#clip0_217_6990)", children: [
434
- /* @__PURE__ */ jsx9(
435
- "path",
436
- {
437
- d: "M39.8642 15.5509L35.9196 7.58974L34.3369 6.85464L24.6235 22.0825L39.1628 30.618L42.3152 25.6347L39.8642 15.5509Z",
438
- fill: "url(#paint0_linear_217_6990)"
439
- }
440
- ),
441
- /* @__PURE__ */ jsx9(
442
- "path",
443
- {
444
- 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",
445
- fill: "url(#paint1_linear_217_6990)"
446
- }
447
- ),
448
- /* @__PURE__ */ jsx9(
449
- "path",
450
- {
451
- 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",
452
- fill: "#F37880"
453
- }
454
- ),
455
- /* @__PURE__ */ jsxs5("g", { opacity: "0.86", children: [
456
- /* @__PURE__ */ jsx9(
457
- "path",
458
- {
459
- 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",
460
- fill: "white"
461
- }
462
- ),
463
- /* @__PURE__ */ jsx9(
464
- "path",
465
- {
466
- 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",
467
- fill: "white"
468
- }
469
- ),
470
- /* @__PURE__ */ jsx9(
471
- "path",
472
- {
473
- 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",
474
- fill: "white"
475
- }
476
- )
477
- ] })
478
- ] }),
479
- /* @__PURE__ */ jsxs5("defs", { children: [
480
- /* @__PURE__ */ jsxs5(
481
- "linearGradient",
482
- {
483
- id: "paint0_linear_217_6990",
484
- x1: "24.6235",
485
- y1: "18.7363",
486
- x2: "42.3152",
487
- y2: "18.7363",
488
- gradientUnits: "userSpaceOnUse",
489
- children: [
490
- /* @__PURE__ */ jsx9("stop", { stopColor: "#4906A5" }),
491
- /* @__PURE__ */ jsx9("stop", { offset: "1", stopColor: "#D3423A" })
492
- ]
493
- }
494
- ),
495
- /* @__PURE__ */ jsxs5(
496
- "linearGradient",
497
- {
498
- id: "paint1_linear_217_6990",
499
- x1: "-2.35794e-05",
500
- y1: "22.5009",
501
- x2: "42.7186",
502
- y2: "22.5009",
503
- gradientUnits: "userSpaceOnUse",
504
- children: [
505
- /* @__PURE__ */ jsx9("stop", { stopColor: "#7C06A5" }),
506
- /* @__PURE__ */ jsx9("stop", { offset: "1", stopColor: "#D3423A" })
507
- ]
508
- }
509
- ),
510
- /* @__PURE__ */ jsx9("clipPath", { id: "clip0_217_6990", children: /* @__PURE__ */ jsx9("rect", { width: "44", height: "45", fill: "white" }) })
511
- ] })
512
- ]
513
- }
514
- );
515
- });
516
- VuuLogo.displayName = "VuuLogo";
517
-
518
- // src/left-nav/LeftNav.tsx
519
- import { Action, Stack, useLayoutProviderDispatch } from "@vuu-ui/vuu-layout";
520
- import { Tab, Tabstrip } from "@vuu-ui/vuu-ui-controls";
521
- import cx4 from "classnames";
522
- import { useCallback as useCallback3, useState as useState4 } from "react";
523
-
524
- // src/feature-list/FeatureList.tsx
525
- import { Palette, PaletteItem } from "@vuu-ui/vuu-layout";
526
- import { jsx as jsx10, jsxs as jsxs6 } from "react/jsx-runtime";
527
- var classBase4 = "vuuFeatureList";
528
- var FeatureList = ({
529
- features,
530
- title = "VUU TABLES",
531
- ...htmlAttributes
532
- }) => {
533
- const ViewProps = {};
534
- console.log({ features });
535
- return /* @__PURE__ */ jsxs6("div", { ...htmlAttributes, className: classBase4, children: [
536
- /* @__PURE__ */ jsx10("div", { className: `${classBase4}-header`, children: title }),
537
- /* @__PURE__ */ jsx10(Palette, { orientation: "vertical", ViewProps, children: features.map((featureProps, i) => /* @__PURE__ */ jsx10(
538
- PaletteItem,
539
- {
540
- closeable: true,
541
- label: featureProps.title,
542
- resizeable: true,
543
- resize: "defer",
544
- header: true,
545
- children: /* @__PURE__ */ jsx10(Feature, { ...featureProps })
546
- },
547
- i
548
- )) })
549
- ] });
550
- };
551
-
552
- // src/theme-provider/ThemeProvider.tsx
553
- import {
554
- createContext,
555
- isValidElement,
556
- cloneElement,
557
- useContext as useContext2
558
- } from "react";
559
- import cx3 from "classnames";
560
- import { jsx as jsx11 } from "react/jsx-runtime";
561
- var DEFAULT_DENSITY2 = "medium";
562
- var DEFAULT_THEME = "salt-theme";
563
- var DEFAULT_THEME_MODE = "light";
564
- var ThemeContext = createContext({
565
- density: "high",
566
- theme: "vuu",
567
- themeMode: "light"
568
- });
569
- var DEFAULT_THEME_ATTRIBUTES = [
570
- "vuu",
571
- "vuu-density-high",
572
- "light"
573
- ];
574
- var useThemeAttributes = (themeAttributes) => {
575
- const context = useContext2(ThemeContext);
576
- if (themeAttributes) {
577
- return [
578
- themeAttributes.themeClass,
579
- themeAttributes.densityClass,
580
- themeAttributes.dataMode
581
- ];
582
- } else if (context) {
583
- return [
584
- `${context.theme}-theme`,
585
- `${context.theme}-density-${context.density}`,
586
- context.themeMode
587
- ];
588
- }
589
- return DEFAULT_THEME_ATTRIBUTES;
590
- };
591
- var createThemedChildren = (children, theme, themeMode, density) => {
592
- var _a;
593
- if (isValidElement(children)) {
594
- return cloneElement(children, {
595
- className: cx3(
596
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
597
- (_a = children.props) == null ? void 0 : _a.className,
598
- `${theme}-theme`,
599
- `${theme}-density-${density}`
600
- ),
601
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
602
- // @ts-expect-error
603
- "data-mode": themeMode
604
- });
605
- } else {
606
- console.warn(
607
- `
1
+ import xt,{useEffect as bt,useState as Nt}from"react";import Ct from"classnames";import{Fragment as Pt,jsx as Mt,jsxs as Me}from"react/jsx-runtime";var $a=({connectionStatus:e,className:t,element:o="span",...a})=>{let[n,r]=Nt("vuuConnectingStatus");bt(()=>{switch(e){case"connected":case"reconnected":r("vuuActiveStatus");break;case"connecting":r("vuuConnectingStatus");break;case"disconnected":r("vuuDisconnectedStatus");break;default:break}},[e]);let u=xt.createElement(o,{...a,className:Ct("vuuStatus vuuIcon",n,t)});return Mt(Pt,{children:Me("div",{className:"vuuStatus-container salt-theme",children:[u,Me("div",{className:"vuuStatus-text",children:["Status: ",e.toUpperCase()]})]})})};import{Dropdown as Et}from"@salt-ds/lab";import{useCallback as Ft}from"react";import Dt from"classnames";import{jsx as Vt}from"react/jsx-runtime";var wt="vuuDensitySwitch",Ht=["high","medium","low","touch"],kt="high",Ka=({className:e,defaultDensity:t=kt,onChange:o})=>{let a=Ft((r,u)=>{o(u)},[o]),n=Dt(wt,e);return Vt(Et,{className:n,source:Ht,defaultSelected:t,onSelectionChange:a})};import we,{Suspense as $t,useEffect as Bt}from"react";import{registerComponent as Ot}from"@vuu-ui/vuu-layout";import Rt from"react";import{Fragment as It,jsx as Ee,jsxs as At}from"react/jsx-runtime";var W=class extends Rt.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?At(It,{children:[Ee("h1",{children:"An error occured while creating component."}),Ee("p",{children:this.state.errorMessage})]}):this.props.children}};import{jsx as Ut}from"react/jsx-runtime";var Fe=()=>Ut("div",{className:"hwLoader",children:"loading"});var De=async e=>{let t=new CSSStyleSheet;return fetch(e).then(o=>o.text()).then(o=>t.replace(o))};import{jsx as K}from"react/jsx-runtime";var q=new Map,_t=e=>{Bt(()=>()=>{q.delete(e)},[e]),q.has(e)||q.set(e,we.lazy(()=>import(e)));let t=q.get(e);if(t)return t;throw Error(`Unable to load Lazy Feature at url ${e}`)};function Gt({url:e,css:t,ComponentProps:o,...a}){t&&De(t).then(r=>{document.adoptedStyleSheets=[...document.adoptedStyleSheets,r]});let n=_t(e);return K(W,{url:e,children:K($t,{fallback:K(Fe,{}),children:K(n,{...a,...o})})})}var z=we.memo(Gt);z.displayName="Feature";Ot("Feature",z,"view");import{useEffect as Jt,useState as O}from"react";import{Input as Yt,Button as He,FormField as X,FormFieldLabel as Z,Text as Wt}from"@salt-ds/core";import{ComboBox as qt,Checkbox as Kt,RadioButton as zt}from"@vuu-ui/vuu-ui-controls";import{formatDate as Xt,takeScreenshot as Zt}from"@vuu-ui/vuu-utils";import{jsx as L,jsxs as k}from"react/jsx-runtime";var x="saveLayoutPanel",Q=`${x}-formField`,Qt=["Group 1","Group 2","Group 3","Group 4","Group 5"],jt=["Value 1","Value 2","Value 3"],ke=["Value 1","Value 2","Value 3"],Nr=e=>{let{onCancel:t,onSave:o,componentId:a}=e,[n,r]=O(""),[u,d]=O(""),[s,i]=O([]),[l,f]=O(ke[0]),[p,h]=O();Jt(()=>{a&&Zt(document.getElementById(a)).then(m=>h(m))},[a]);let g=()=>{o({name:n,group:u,screenshot:p!=null?p:"",user:"User",date:Xt(new Date,"dd.mm.yyyy")})};return k("div",{className:`${x}-panelContainer`,children:[k("div",{className:`${x}-panelContent`,children:[k("div",{className:`${x}-formContainer`,children:[k(X,{className:Q,children:[L(Z,{children:"Group"}),L(qt,{source:Qt,allowFreeText:!0,InputProps:{inputProps:{className:`${x}-inputText`,placeholder:"Select Group or Enter New Name",onChange:m=>d(m.target.value)}},width:"100%",onSelectionChange:(m,b)=>d(b||"")})]}),k(X,{className:Q,children:[L(Z,{children:"Layout Name"}),L(Yt,{inputProps:{className:`${x}-inputText`,placeholder:"Enter Layout Name"},onChange:m=>r(m.target.value),value:n})]}),k(X,{className:Q,children:[L(Z,{children:"Some Layout Setting"}),L("div",{className:`${x}-settingsGroup`,children:jt.map((m,b)=>L(Kt,{onToggle:()=>i(P=>P.includes(m)?P.filter(R=>R!==m):[...P,m]),checked:s.includes(m),label:m},b))})]}),k(X,{className:Q,children:[L(Z,{children:"Some Layout Setting"}),L("div",{className:`${x}-settingsGroup`,children:ke.map((m,b)=>L(zt,{onClick:()=>f(m),checked:l===m,label:m,groupName:"radioGroup"},b))})]})]}),L("div",{className:`${x}-screenshotContainer`,children:p?L("img",{className:`${x}-screenshot`,src:p,alt:"screenshot of current layout"}):L(Wt,{className:"screenshot",children:"No screenshot available"})})]}),k("div",{className:`${x}-buttonsContainer`,children:[L(He,{className:`${x}-cancelButton`,onClick:t,children:"Cancel"}),L(He,{className:`${x}-saveButton`,onClick:g,disabled:n===""||u==="",children:"Save"})]})]})};import{List as io}from"@vuu-ui/vuu-ui-controls";import eo,{useState as Ve,useCallback as j,useContext as to,useEffect as oo,useRef as ao}from"react";import{LocalLayoutPersistenceManager as ro,resolveJSONPath as no}from"@vuu-ui/vuu-layout";import{defaultLayout as ce}from"@vuu-ui/vuu-layout/";import{jsx as so}from"react/jsx-runtime";var _=new ro,Re=eo.createContext({layoutMetadata:[],saveLayout:()=>{},applicationLayout:ce,saveApplicationLayout:()=>{},loadLayoutById:()=>ce}),wr=e=>{let[t,o]=Ve([]),[,a]=Ve({}),n=ao(ce),r=j((i,l=!0)=>{n.current=i,l&&a({})},[]);oo(()=>{_.loadMetadata().then(i=>{o(i)}),_.loadApplicationLayout().then(i=>{r(i)})},[r]);let u=j(i=>{r(i,!1),_.saveApplicationLayout(i)},[r]),d=j(i=>{let l=no(n.current,"#main-tabs.ACTIVE_CHILD");l&&_.createLayout(i,l).then(f=>{let p={...i,id:f};o(h=>[...h,p])})},[]),s=j(i=>{_.loadLayout(i).then(l=>{var p,h;let{current:f}=n;r({...f,active:(h=(p=f.children)==null?void 0:p.length)!=null?h:0,children:[...f.children||[],l]})})},[r]);return so(Re.Provider,{value:{layoutMetadata:t,saveLayout:d,applicationLayout:n.current,saveApplicationLayout:u,loadLayoutById:s},children:e.children})},ee=()=>to(Re);import{Fragment as Ie,jsx as V,jsxs as te}from"react/jsx-runtime";var I="vuuLayoutList",Ae=e=>{let{layoutMetadata:t,loadLayoutById:o}=ee(),a=r=>{r&&o(r)},n=t.reduce((r,u)=>r[u.group]?{...r,[u.group]:[...r[u.group],u]}:{...r,[u.group]:[u]},{});return te("div",{className:I,...e,children:[V("div",{className:`${I}-header`,children:"My Layouts"}),V(io,{height:"auto",source:Object.entries(n),ListItem:({item:r})=>{if(!r)return V(Ie,{});let[u,d]=r;return te(Ie,{children:[V("div",{className:`${I}-groupName`,children:u}),d.map(s=>te("div",{className:`${I}-layoutContainer`,onClick:()=>a(s==null?void 0:s.id),children:[V("img",{className:`${I}-screenshot`,src:s==null?void 0:s.screenshot}),te("div",{children:[V("div",{className:`${I}-layoutName`,children:s==null?void 0:s.name}),V("div",{className:`${I}-layoutDetails`,children:V("div",{children:`${s==null?void 0:s.user}, ${s==null?void 0:s.date}`})})]})]},s==null?void 0:s.id))]})}})]})};import{VuuLogo as xo}from"@vuu-ui/vuu-icons";import{Action as $e,Stack as bo,useLayoutProviderDispatch as No}from"@vuu-ui/vuu-layout";import{Tab as J,Tabstrip as Co}from"@vuu-ui/vuu-ui-controls";import he from"classnames";import{useCallback as ae,useState as Po}from"react";import{Palette as uo,PaletteItem as lo}from"@vuu-ui/vuu-layout";import{jsx as G,jsxs as co}from"react/jsx-runtime";var me="vuuFeatureList",de=({features:e,title:t="VUU TABLES",...o})=>{let a={},n={height:"100%"};return co("div",{...o,className:me,children:[G("div",{className:`${me}-header`,children:t}),G("div",{className:`${me}-content`,children:G(uo,{orientation:"vertical",ListProps:n,ViewProps:a,children:e.map((r,u)=>G(lo,{closeable:!0,label:r.title,resizeable:!0,resize:"defer",header:!0,children:G(z,{...r})},u))})})]})};import{createContext as mo,isValidElement as po,cloneElement as fo,useContext as Ue}from"react";import ho from"classnames";import{jsx as So}from"react/jsx-runtime";var go="medium",yo="salt-theme",vo="light",pe=mo({density:"high",theme:"vuu",themeMode:"light"}),Lo=["vuu","vuu-density-high","light"],oe=e=>{let t=Ue(pe);return e?[e.themeClass,e.densityClass,e.dataMode]:t?[`${t.theme}-theme`,`${t.theme}-density-${t.density}`,t.themeMode]:Lo},To=(e,t,o,a)=>{var n;return po(e)?fo(e,{className:ho((n=e.props)==null?void 0:n.className,`${t}-theme`,`${t}-density-${a}`),"data-mode":o}):(console.warn(`
608
2
  ThemeProvider can only apply CSS classes for theming to a single nested child element of the ThemeProvider.
609
- Wrap elements with a single container`
610
- );
611
- return children;
612
- }
613
- };
614
- var ThemeProvider = ({
615
- applyThemeClasses = false,
616
- children,
617
- theme: themeProp,
618
- themeMode: themeModeProp,
619
- density: densityProp
620
- }) => {
621
- var _a, _b, _c;
622
- const {
623
- density: inheritedDensity,
624
- themeMode: inheritedThemeMode,
625
- theme: inheritedTheme
626
- } = useContext2(ThemeContext);
627
- const density = (_a = densityProp != null ? densityProp : inheritedDensity) != null ? _a : DEFAULT_DENSITY2;
628
- const themeMode = (_b = themeModeProp != null ? themeModeProp : inheritedThemeMode) != null ? _b : DEFAULT_THEME_MODE;
629
- const theme = (_c = themeProp != null ? themeProp : inheritedTheme) != null ? _c : DEFAULT_THEME;
630
- const themedChildren = applyThemeClasses ? createThemedChildren(children, theme, themeMode, density) : children;
631
- return /* @__PURE__ */ jsx11(ThemeContext.Provider, { value: { themeMode, density, theme }, children: themedChildren });
632
- };
633
- ThemeProvider.displayName = "ThemeProvider";
634
-
635
- // src/left-nav/LeftNav.tsx
636
- import { jsx as jsx12, jsxs as jsxs7 } from "react/jsx-runtime";
637
- var classBase5 = "vuuLeftNav";
638
- var LeftNav = ({
639
- "data-path": path,
640
- features,
641
- onResize,
642
- sizeCollapsed = 80,
643
- sizeContent = 240,
644
- sizeExpanded = 240,
645
- style: styleProp,
646
- tableFeatures,
647
- ...htmlAttributes
648
- }) => {
649
- const dispatch = useLayoutProviderDispatch();
650
- const [navState, setNavState] = useState4({
651
- activeTabIndex: 0,
652
- navStatus: "menu-full"
653
- });
654
- const [themeClass] = useThemeAttributes();
655
- const toggleNavWidth = useCallback3(
656
- (navStatus) => {
657
- switch (navStatus) {
658
- case "menu-icons":
659
- return sizeExpanded;
660
- case "menu-full":
661
- return sizeCollapsed;
662
- case "menu-full-content":
663
- return sizeCollapsed + sizeContent;
664
- case "menu-icons-content":
665
- return sizeExpanded + sizeContent;
666
- }
667
- },
668
- [sizeCollapsed, sizeContent, sizeExpanded]
669
- );
670
- const toggleNavStatus = (navStatus) => {
671
- switch (navStatus) {
672
- case "menu-icons":
673
- return "menu-full";
674
- case "menu-full":
675
- return "menu-icons";
676
- case "menu-full-content":
677
- return "menu-icons-content";
678
- case "menu-icons-content":
679
- return "menu-full-content";
680
- }
681
- };
682
- const getWidthAndStatus = useCallback3(
683
- (navState2, tabIndex) => {
684
- if (tabIndex === 0) {
685
- const newNavState = navState2 === "menu-full-content" ? "menu-full" : navState2 === "menu-icons-content" ? "menu-icons" : navState2;
686
- return newNavState === "menu-icons" ? [sizeCollapsed, newNavState] : [sizeExpanded, newNavState];
687
- } else {
688
- const newNavState = navState2 === "menu-full" ? "menu-full-content" : navState2 === "menu-icons" ? "menu-icons-content" : navState2;
689
- return newNavState === "menu-icons-content" ? [sizeCollapsed + sizeContent, newNavState] : [sizeExpanded + sizeContent, newNavState];
690
- }
691
- },
692
- [sizeCollapsed, sizeContent, sizeExpanded]
693
- );
694
- const handleTabSelection = useCallback3(
695
- (value) => {
696
- const [width, navStatus] = getWidthAndStatus(navState.navStatus, value);
697
- setNavState({
698
- activeTabIndex: value,
699
- navStatus
700
- });
701
- dispatch({
702
- type: Action.LAYOUT_RESIZE,
703
- path,
704
- size: width
705
- });
706
- },
707
- [dispatch, getWidthAndStatus, navState, path]
708
- );
709
- const toggleSize = useCallback3(() => {
710
- const { activeTabIndex, navStatus: currentNavStatus } = navState;
711
- setNavState({
712
- activeTabIndex,
713
- navStatus: toggleNavStatus(currentNavStatus)
714
- });
715
- dispatch({
716
- type: Action.LAYOUT_RESIZE,
717
- path,
718
- size: toggleNavWidth(currentNavStatus)
719
- });
720
- }, [dispatch, navState, path, toggleNavWidth]);
721
- const style = {
722
- ...styleProp,
723
- "--nav-menu-collapsed-width": `${sizeCollapsed}px`,
724
- "--nav-menu-expanded-width": `${sizeExpanded}px`
725
- };
726
- return /* @__PURE__ */ jsxs7(
727
- "div",
728
- {
729
- ...htmlAttributes,
730
- className: cx4(classBase5, `${classBase5}-${navState.navStatus}`),
731
- style,
732
- children: [
733
- /* @__PURE__ */ jsxs7(
734
- "div",
735
- {
736
- className: cx4(`${classBase5}-menu-primary`, themeClass),
737
- "data-mode": "dark",
738
- children: [
739
- /* @__PURE__ */ jsx12("div", { className: "vuuLeftNav-logo", children: /* @__PURE__ */ jsx12(VuuLogo, {}) }),
740
- /* @__PURE__ */ jsx12("div", { className: `${classBase5}-main`, children: /* @__PURE__ */ jsxs7(
741
- Tabstrip,
742
- {
743
- activeTabIndex: navState.activeTabIndex,
744
- animateSelectionThumb: false,
745
- className: `${classBase5}-Tabstrip`,
746
- onActiveChange: handleTabSelection,
747
- orientation: "vertical",
748
- children: [
749
- /* @__PURE__ */ jsx12(Tab, { "data-icon": "demo", label: "DEMO" }),
750
- /* @__PURE__ */ jsx12(Tab, { "data-icon": "features", label: "VUU FEATURES" }),
751
- /* @__PURE__ */ jsx12(Tab, { "data-icon": "tables", label: "VUU TABLES" }),
752
- /* @__PURE__ */ jsx12(Tab, { "data-icon": "templates", label: "LAYOUT TEMPLATES" }),
753
- /* @__PURE__ */ jsx12(Tab, { "data-icon": "layouts", label: "MY LAYOUTS" })
754
- ]
755
- }
756
- ) }),
757
- /* @__PURE__ */ jsx12("div", { className: "vuuLeftNav-buttonBar", children: /* @__PURE__ */ jsx12(
758
- "button",
759
- {
760
- className: cx4("vuuLeftNav-toggleButton", {
761
- "vuuLeftNav-toggleButton-open": navState.navStatus.startsWith("menu-full"),
762
- "vuuLeftNav-toggleButton-closed": navState.navStatus.startsWith("menu-icons")
763
- }),
764
- "data-icon": navState.navStatus.startsWith("menu-full") ? "chevron-left" : "chevron-right",
765
- onClick: toggleSize
766
- }
767
- ) })
768
- ]
769
- }
770
- ),
771
- /* @__PURE__ */ jsxs7(
772
- Stack,
773
- {
774
- active: navState.activeTabIndex - 1,
775
- className: `${classBase5}-menu-secondary`,
776
- showTabs: false,
777
- children: [
778
- /* @__PURE__ */ jsx12(FeatureList, { features, title: "Vuu Features" }),
779
- /* @__PURE__ */ jsx12(FeatureList, { features: tableFeatures, title: "Vuu Tables" }),
780
- /* @__PURE__ */ jsx12("div", { style: { background: "green", height: "100%" }, children: "Layout Templates" }),
781
- /* @__PURE__ */ jsx12("div", { className: "vuuLeftNav-drawer", children: /* @__PURE__ */ jsx12(LayoutsList, {}) })
782
- ]
783
- }
784
- )
785
- ]
786
- }
787
- );
788
- };
789
-
790
- // src/login/LoginPanel.tsx
791
- import { useState as useState5 } from "react";
792
- import { Button as Button2, FormField as FormField2, FormFieldLabel as FormFieldLabel2, Input as Input2 } from "@salt-ds/core";
793
- import { jsx as jsx13, jsxs as jsxs8 } from "react/jsx-runtime";
794
- var classBase6 = "vuuLoginPanel";
795
- var LoginPanel = ({
796
- requirePassword = true,
797
- onSubmit
798
- }) => {
799
- const [username, setUserName] = useState5("");
800
- const [password, setPassword] = useState5("");
801
- const login = () => {
802
- onSubmit(username, password);
803
- };
804
- const handleUsername = (evt) => {
805
- setUserName(evt.target.value);
806
- };
807
- const handlePassword = (evt) => {
808
- setPassword(evt.target.value);
809
- };
810
- const dataIsValid = username.trim() !== "" && (requirePassword === false || password.trim() !== "");
811
- return /* @__PURE__ */ jsxs8("div", { className: classBase6, children: [
812
- /* @__PURE__ */ jsxs8(FormField2, { style: { width: 200 }, children: [
813
- /* @__PURE__ */ jsx13(FormFieldLabel2, { children: "Username" }),
814
- /* @__PURE__ */ jsx13(Input2, { value: username, id: "text-username", onChange: handleUsername })
815
- ] }),
816
- requirePassword ? /* @__PURE__ */ jsxs8(FormField2, { style: { width: 200 }, children: [
817
- /* @__PURE__ */ jsx13(FormFieldLabel2, { children: "Password" }),
818
- /* @__PURE__ */ jsx13(
819
- Input2,
820
- {
821
- inputProps: {
822
- type: "password"
823
- },
824
- value: password,
825
- id: "text-password",
826
- onChange: handlePassword
827
- }
828
- )
829
- ] }) : null,
830
- /* @__PURE__ */ jsx13(
831
- Button2,
832
- {
833
- className: `${classBase6}-login`,
834
- disabled: !dataIsValid,
835
- onClick: login,
836
- variant: "cta",
837
- children: "Login"
838
- }
839
- )
840
- ] });
841
- };
842
-
843
- // src/login/login-utils.ts
844
- import { getCookieValue } from "@vuu-ui/vuu-utils";
845
- var getAuthModeFromCookies = () => {
846
- const mode = getCookieValue("vuu-auth-mode");
847
- return mode != null ? mode : "";
848
- };
849
- var getAuthDetailsFromCookies = () => {
850
- const username = getCookieValue("vuu-username");
851
- const token = getCookieValue("vuu-auth-token");
852
- return [username, token];
853
- };
854
- var getDefaultLoginUrl = () => {
855
- const authMode = getAuthModeFromCookies();
856
- return authMode === "login" ? "login.html" : "demo.html";
857
- };
858
- var redirectToLogin = (loginUrl = getDefaultLoginUrl()) => {
859
- window.location.href = loginUrl;
860
- };
861
- var logout = (loginUrl) => {
862
- document.cookie = "vuu-username= ; expires = Thu, 01 Jan 1970 00:00:00 GMT";
863
- document.cookie = "vuu-auth-token= ; expires = Thu, 01 Jan 1970 00:00:00 GMT";
864
- redirectToLogin(loginUrl);
865
- };
866
-
867
- // src/session-editing-form/SessionEditingForm.tsx
868
- import {
869
- useCallback as useCallback4,
870
- useEffect as useEffect5,
871
- useMemo,
872
- useRef,
873
- useState as useState6
874
- } from "react";
875
- import cx5 from "classnames";
876
- import { useIdMemo } from "@salt-ds/core";
877
- import { Button as Button3 } from "@salt-ds/core";
878
- import {
879
- hasAction,
880
- isErrorResponse,
881
- RemoteDataSource
882
- } from "@vuu-ui/vuu-data";
883
- import {
884
- buildColumnMap,
885
- isValidNumber,
886
- shallowEquals
887
- } from "@vuu-ui/vuu-utils";
888
- import { jsx as jsx14, jsxs as jsxs9 } from "react/jsx-runtime";
889
- var classBase7 = "vuuSessionEditingForm";
890
- var getField = (fields, name) => {
891
- const field = fields.find((f) => f.name === name);
892
- if (field) {
893
- return field;
894
- } else {
895
- throw Error(`SessionEditingForm, no field '${name}' found`);
896
- }
897
- };
898
- var getFieldNameAndValue = (evt) => {
899
- const {
900
- dataset: { field },
901
- value
902
- } = evt.target;
903
- if (field === void 0) {
904
- throw Error("SessionEditingForm, form field has no field name");
905
- }
906
- return [field, value];
907
- };
908
- var Status = {
909
- uninitialised: 0,
910
- unchanged: 1,
911
- changed: 2,
912
- invalid: 3
913
- };
914
- function getTypedValue(value, type, throwIfUndefined = false) {
915
- switch (type) {
916
- case "int":
917
- case "long": {
918
- const typedValue = parseInt(value, 10);
919
- if (isValidNumber(typedValue)) {
920
- return typedValue;
921
- } else if (throwIfUndefined) {
922
- throw Error("SessionEditingForm getTypedValue");
923
- } else {
924
- return void 0;
925
- }
926
- }
927
- case "double": {
928
- const typedValue = parseFloat(value);
929
- if (isValidNumber(typedValue)) {
930
- return typedValue;
931
- }
932
- return void 0;
933
- }
934
- case "boolean":
935
- return value === "true" ? true : false;
936
- default:
937
- return value;
938
- }
939
- }
940
- var getDataSource = (dataSource, schema) => {
941
- if (dataSource) {
942
- return dataSource;
943
- } else if (schema) {
944
- return new RemoteDataSource({
945
- bufferSize: 0,
946
- table: schema.table,
947
- columns: schema.columns.map((col) => col.name)
948
- });
949
- } else {
950
- throw Error(
951
- "SessionEditingForm: either a DataSource or a TableSchema must be provided"
952
- );
953
- }
954
- };
955
- var SessionEditingForm = ({
956
- className,
957
- config: { fields, key: keyField },
958
- dataSource: dataSourceProp,
959
- id: idProp,
960
- onClose,
961
- schema,
962
- ...htmlAttributes
963
- }) => {
964
- const [values, setValues] = useState6();
965
- const [errorMessage, setErrorMessage] = useState6("");
966
- const formContentRef = useRef(null);
967
- const initialDataRef = useRef();
968
- const dataStatusRef = useRef(Status.uninitialised);
969
- const dataSource = useMemo(() => {
970
- const applyServerData = (data) => {
971
- if (columnMap) {
972
- const values2 = {};
973
- for (const column of dataSource.columns) {
974
- values2[column] = data[columnMap[column]];
975
- }
976
- if (dataStatusRef.current === Status.uninitialised) {
977
- dataStatusRef.current = Status.unchanged;
978
- initialDataRef.current = values2;
979
- }
980
- setValues(values2);
981
- }
982
- };
983
- const ds = getDataSource(dataSourceProp, schema);
984
- const columnMap = buildColumnMap(ds.columns);
985
- ds.subscribe({ range: { from: 0, to: 5 } }, (message) => {
986
- if (message.type === "viewport-update" && message.rows) {
987
- if (dataStatusRef.current === Status.uninitialised) {
988
- applyServerData(message.rows[0]);
989
- } else {
990
- console.log("what do we do with server updates");
991
- }
992
- }
993
- });
994
- return ds;
995
- }, [dataSourceProp, schema]);
996
- const id = useIdMemo(idProp);
997
- const handleChange = useCallback4(
998
- (evt) => {
999
- const [field, value] = getFieldNameAndValue(evt);
1000
- const { type } = getField(fields, field);
1001
- const typedValue = getTypedValue(value, type);
1002
- setValues((values2 = {}) => {
1003
- const newValues = {
1004
- ...values2,
1005
- [field]: typedValue
1006
- };
1007
- const notUpdated = shallowEquals(newValues, initialDataRef.current);
1008
- dataStatusRef.current = notUpdated ? Status.unchanged : typedValue !== void 0 ? Status.changed : Status.invalid;
1009
- return newValues;
1010
- });
1011
- },
1012
- [fields]
1013
- );
1014
- const handleBlur = useCallback4(
1015
- (evt) => {
1016
- const [field, value] = getFieldNameAndValue(evt);
1017
- const { type } = getField(fields, field);
1018
- const rowKey = values == null ? void 0 : values[keyField];
1019
- const typedValue = getTypedValue(value, type, true);
1020
- if (typeof rowKey === "string") {
1021
- dataSource.menuRpcCall({
1022
- rowKey,
1023
- field,
1024
- value: typedValue,
1025
- type: "VP_EDIT_CELL_RPC"
1026
- });
1027
- }
1028
- },
1029
- [dataSource, fields, keyField, values]
1030
- );
1031
- const applyAction = useCallback4(
1032
- (action) => {
1033
- if (typeof action === "object" && action !== null) {
1034
- if ("type" in action && action.type === "CLOSE_DIALOG_ACTION") {
1035
- onClose();
1036
- }
1037
- }
1038
- },
1039
- [onClose]
1040
- );
1041
- const handleSubmit = useCallback4(async () => {
1042
- const response = await dataSource.menuRpcCall({
1043
- type: "VP_EDIT_SUBMIT_FORM_RPC"
1044
- });
1045
- if (isErrorResponse(response)) {
1046
- setErrorMessage(response.error);
1047
- } else if (hasAction(response)) {
1048
- applyAction(response.action);
1049
- }
1050
- }, [applyAction, dataSource]);
1051
- const handleKeyDown = useCallback4(
1052
- (evt) => {
1053
- if (evt.key === "Enter" && dataStatusRef.current === Status.changed) {
1054
- handleSubmit();
1055
- }
1056
- },
1057
- [handleSubmit]
1058
- );
1059
- const handleCancel = useCallback4(() => {
1060
- onClose();
1061
- }, [onClose]);
1062
- const getFormControl = (field) => {
1063
- var _a;
1064
- const value = String((_a = values == null ? void 0 : values[field.name]) != null ? _a : "");
1065
- if (field.readonly || field.name === keyField) {
1066
- return /* @__PURE__ */ jsx14("div", { className: `${classBase7}-fieldValue vuuReadOnly`, children: value });
1067
- } else {
1068
- return /* @__PURE__ */ jsx14(
1069
- "input",
1070
- {
1071
- className: `${classBase7}-fieldValue`,
1072
- "data-field": field.name,
1073
- onBlur: handleBlur,
1074
- onChange: handleChange,
1075
- type: "text",
1076
- value,
1077
- id: `${id}-input-${field.name}`
1078
- }
1079
- );
1080
- }
1081
- };
1082
- useEffect5(() => {
1083
- if (formContentRef.current) {
1084
- const firstInput = formContentRef.current.querySelector(
1085
- "input"
1086
- );
1087
- if (firstInput) {
1088
- setTimeout(() => {
1089
- firstInput.focus();
1090
- firstInput.select();
1091
- }, 100);
1092
- }
1093
- }
1094
- }, []);
1095
- useEffect5(() => {
1096
- return () => {
1097
- if (dataSource) {
1098
- dataSource.unsubscribe();
1099
- }
1100
- };
1101
- }, [dataSource]);
1102
- const isDirty = dataStatusRef.current === Status.changed;
1103
- return /* @__PURE__ */ jsxs9("div", { ...htmlAttributes, className: cx5(classBase7, className), children: [
1104
- errorMessage ? /* @__PURE__ */ jsx14(
1105
- "div",
1106
- {
1107
- className: `${classBase7}-errorBanner`,
1108
- "data-icon": "error",
1109
- title: errorMessage,
1110
- children: "Error, edit(s) not saved"
1111
- }
1112
- ) : void 0,
1113
- /* @__PURE__ */ jsx14(
1114
- "div",
1115
- {
1116
- className: `${classBase7}-content`,
1117
- ref: formContentRef,
1118
- onKeyDown: handleKeyDown,
1119
- children: fields.map((field) => {
1120
- var _a;
1121
- return /* @__PURE__ */ jsxs9("div", { className: `${classBase7}-field`, children: [
1122
- /* @__PURE__ */ jsx14(
1123
- "label",
1124
- {
1125
- className: cx5(`${classBase7}-fieldLabel`, {
1126
- [`${classBase7}-required`]: field.required
1127
- }),
1128
- htmlFor: `${id}-input-${field.name}`,
1129
- children: (_a = field == null ? void 0 : field.label) != null ? _a : field.description
1130
- }
1131
- ),
1132
- getFormControl(field)
1133
- ] }, field.name);
1134
- })
1135
- }
1136
- ),
1137
- /* @__PURE__ */ jsxs9("div", { className: `${classBase7}-buttonbar salt-theme salt-density-high`, children: [
1138
- /* @__PURE__ */ jsx14(
1139
- Button3,
1140
- {
1141
- type: "submit",
1142
- variant: "cta",
1143
- disabled: !isDirty,
1144
- onClick: handleSubmit,
1145
- children: "Submit"
1146
- }
1147
- ),
1148
- /* @__PURE__ */ jsx14(Button3, { variant: "secondary", onClick: handleCancel, children: "Cancel" })
1149
- ] })
1150
- ] });
1151
- };
1152
-
1153
- // src/shell.tsx
1154
- import { connectToServer } from "@vuu-ui/vuu-data";
1155
- import cx9 from "classnames";
1156
- import {
1157
- useCallback as useCallback10,
1158
- useEffect as useEffect7,
1159
- useRef as useRef3
1160
- } from "react";
1161
- import {
1162
- DraggableLayout as DraggableLayout3,
1163
- LayoutProvider
1164
- } from "@vuu-ui/vuu-layout";
1165
-
1166
- // src/app-header/AppHeader.tsx
1167
- import { useCallback as useCallback7 } from "react";
1168
-
1169
- // src/user-profile/UserProfile.tsx
1170
- import { Button as Button5 } from "@salt-ds/core";
1171
- import { DropdownBase } from "@salt-ds/lab";
1172
- import { UserSolidIcon } from "@salt-ds/icons";
1173
-
1174
- // src/user-profile/UserPanel.tsx
1175
- import { formatDate as formatDate2 } from "@vuu-ui/vuu-utils";
1176
- import { List as List2, ListItem } from "@salt-ds/lab";
1177
- import { Button as Button4 } from "@salt-ds/core";
1178
- import { ExportIcon } from "@salt-ds/icons";
1179
- import {
1180
- forwardRef,
1181
- useCallback as useCallback5,
1182
- useEffect as useEffect6,
1183
- useState as useState7
1184
- } from "react";
1185
-
1186
- // src/get-layout-history.ts
1187
- var getLayoutHistory = async (user) => {
1188
- const history = await fetch(`api/vui/${user.username}`, {}).then((response) => {
1189
- return response.ok ? response.json() : null;
1190
- }).catch(() => {
1191
- console.log("error getting history");
1192
- });
1193
- return history;
1194
- };
1195
-
1196
- // src/user-profile/UserPanel.tsx
1197
- import { jsx as jsx15, jsxs as jsxs10 } from "react/jsx-runtime";
1198
- var byLastUpdate = ({ lastUpdate: l1 }, { lastUpdate: l2 }) => {
1199
- return l2 === l1 ? 0 : l2 < l1 ? -1 : 1;
1200
- };
1201
- var HistoryListItem = (props) => {
1202
- return /* @__PURE__ */ jsx15(ListItem, { ...props });
1203
- };
1204
- var UserPanel = forwardRef(function UserPanel2({ loginUrl, onNavigate, user, layoutId = "latest" }, forwardedRef) {
1205
- const [history, setHistory] = useState7([]);
1206
- useEffect6(() => {
1207
- async function getHistory() {
1208
- const history2 = await getLayoutHistory(user);
1209
- const sortedHistory = history2.filter((item) => item.id !== "latest").sort(byLastUpdate).map(({ id, lastUpdate }) => ({
1210
- lastUpdate,
1211
- id,
1212
- label: `Saved at ${formatDate2(new Date(lastUpdate), "kk:mm:ss")}`
1213
- }));
1214
- console.log({ sortedHistory });
1215
- setHistory(sortedHistory);
1216
- }
1217
- getHistory();
1218
- }, [user]);
1219
- const handleHisorySelected = useCallback5(
1220
- (evt, selected2) => {
1221
- if (selected2) {
1222
- onNavigate(selected2.id);
1223
- }
1224
- },
1225
- [onNavigate]
1226
- );
1227
- const handleLogout = useCallback5(() => {
1228
- logout(loginUrl);
1229
- }, [loginUrl]);
1230
- const selected = history.length === 0 ? null : layoutId === "latest" ? history[0] : history.find((i) => i.id === layoutId);
1231
- return /* @__PURE__ */ jsxs10("div", { className: "vuuUserPanel", ref: forwardedRef, children: [
1232
- /* @__PURE__ */ jsx15(
1233
- List2,
1234
- {
1235
- ListItem: HistoryListItem,
1236
- className: "vuuUserPanel-history",
1237
- onSelect: handleHisorySelected,
1238
- selected,
1239
- source: history
1240
- }
1241
- ),
1242
- /* @__PURE__ */ jsx15("div", { className: "vuuUserPanel-buttonBar", children: /* @__PURE__ */ jsxs10(Button4, { "aria-label": "logout", onClick: handleLogout, children: [
1243
- /* @__PURE__ */ jsx15(ExportIcon, {}),
1244
- " Logout"
1245
- ] }) })
1246
- ] });
1247
- });
1248
-
1249
- // src/user-profile/UserProfile.tsx
1250
- import { jsx as jsx16, jsxs as jsxs11 } from "react/jsx-runtime";
1251
- var UserProfile = ({
1252
- layoutId,
1253
- loginUrl,
1254
- onNavigate,
1255
- user
1256
- }) => {
1257
- const handleNavigate = (id) => {
1258
- onNavigate(id);
1259
- };
1260
- return /* @__PURE__ */ jsxs11(DropdownBase, { className: "vuuUserProfile", placement: "bottom-end", children: [
1261
- /* @__PURE__ */ jsx16(Button5, { variant: "secondary", children: /* @__PURE__ */ jsx16(UserSolidIcon, {}) }),
1262
- /* @__PURE__ */ jsx16(
1263
- UserPanel,
1264
- {
1265
- layoutId,
1266
- loginUrl,
1267
- onNavigate: handleNavigate,
1268
- user
1269
- }
1270
- )
1271
- ] });
1272
- };
1273
-
1274
- // src/theme-switch/ThemeSwitch.tsx
1275
- import cx6 from "classnames";
1276
- import { ToggleButton, ToggleButtonGroup, useControlled } from "@salt-ds/core";
1277
- import { useCallback as useCallback6 } from "react";
1278
- import { jsx as jsx17, jsxs as jsxs12 } from "react/jsx-runtime";
1279
- var classBase8 = "vuuThemeSwitch";
1280
- var ThemeSwitch = ({
1281
- className: classNameProp,
1282
- defaultMode: defaultModeProp,
1283
- mode: modeProp,
1284
- onChange,
1285
- ...htmlAttributes
1286
- }) => {
1287
- const [mode, setMode] = useControlled({
1288
- controlled: modeProp,
1289
- default: defaultModeProp != null ? defaultModeProp : "light",
1290
- name: "ThemeSwitch",
1291
- state: "mode"
1292
- });
1293
- const handleChangeSecondary = useCallback6(
1294
- (evt) => {
1295
- const { value } = evt.target;
1296
- setMode(value);
1297
- onChange(value);
1298
- },
1299
- [onChange, setMode]
1300
- );
1301
- const className = cx6(classBase8, classNameProp);
1302
- return /* @__PURE__ */ jsxs12(
1303
- ToggleButtonGroup,
1304
- {
1305
- className,
1306
- ...htmlAttributes,
1307
- onChange: handleChangeSecondary,
1308
- value: mode,
1309
- children: [
1310
- /* @__PURE__ */ jsx17(ToggleButton, { "aria-label": "alert", "data-icon": "light", value: "dark" }),
1311
- /* @__PURE__ */ jsx17(ToggleButton, { "aria-label": "home", "data-icon": "dark", value: "light" })
1312
- ]
1313
- }
1314
- );
1315
- };
1316
-
1317
- // src/app-header/AppHeader.tsx
1318
- import cx7 from "classnames";
1319
- import { jsx as jsx18, jsxs as jsxs13 } from "react/jsx-runtime";
1320
- var classBase9 = "vuuAppHeader";
1321
- var AppHeader = ({
1322
- className: classNameProp,
1323
- layoutId,
1324
- loginUrl,
1325
- onNavigate,
1326
- onSwitchTheme,
1327
- themeMode = "light",
1328
- user,
1329
- ...htmlAttributes
1330
- }) => {
1331
- const className = cx7(classBase9, classNameProp);
1332
- const handleSwitchTheme = useCallback7(
1333
- (mode) => onSwitchTheme == null ? void 0 : onSwitchTheme(mode),
1334
- [onSwitchTheme]
1335
- );
1336
- return /* @__PURE__ */ jsxs13("header", { className, ...htmlAttributes, children: [
1337
- /* @__PURE__ */ jsx18(ThemeSwitch, { defaultMode: themeMode, onChange: handleSwitchTheme }),
1338
- /* @__PURE__ */ jsx18(
1339
- UserProfile,
1340
- {
1341
- layoutId,
1342
- loginUrl,
1343
- onNavigate,
1344
- user
1345
- }
1346
- )
1347
- ] });
1348
- };
1349
-
1350
- // src/shell.tsx
1351
- import { logger } from "@vuu-ui/vuu-utils";
1352
-
1353
- // src/shell-layouts/context-panel/ContextPanel.tsx
1354
- import { Button as Button6 } from "@salt-ds/core";
1355
- import cx8 from "classnames";
1356
- import { useCallback as useCallback8, useMemo as useMemo2 } from "react";
1357
- import {
1358
- layoutFromJson,
1359
- useLayoutProviderDispatch as useLayoutProviderDispatch2
1360
- } from "@vuu-ui/vuu-layout";
1361
- import { jsx as jsx19, jsxs as jsxs14 } from "react/jsx-runtime";
1362
- var classBase10 = "vuuContextPanel";
1363
- var ContextPanel = ({
1364
- className: classNameProp,
1365
- expanded = false,
1366
- content: contentProp,
1367
- overlay = false,
1368
- title
1369
- }) => {
1370
- const dispatchLayoutAction = useLayoutProviderDispatch2();
1371
- const handleClose = useCallback8(() => {
1372
- dispatchLayoutAction({
1373
- path: "#context-panel",
1374
- propName: "expanded",
1375
- propValue: false,
1376
- type: "set-prop"
1377
- });
1378
- }, [dispatchLayoutAction]);
1379
- const className = cx8(classBase10, classNameProp, {
1380
- [`${classBase10}-expanded`]: expanded,
1381
- [`${classBase10}-inline`]: overlay !== true,
1382
- [`${classBase10}-overlay`]: overlay
1383
- });
1384
- const content = useMemo2(
1385
- () => contentProp ? layoutFromJson(contentProp, "context-0") : null,
1386
- [contentProp]
1387
- );
1388
- return /* @__PURE__ */ jsx19("div", { className: cx8(classBase10, className), children: /* @__PURE__ */ jsxs14("div", { className: `${classBase10}-inner`, children: [
1389
- /* @__PURE__ */ jsxs14("div", { className: `${classBase10}-header`, children: [
1390
- /* @__PURE__ */ jsx19("h2", { className: `${classBase10}-title`, children: title }),
1391
- /* @__PURE__ */ jsx19(
1392
- Button6,
1393
- {
1394
- className: `${classBase10}-close`,
1395
- "data-icon": "close",
1396
- onClick: handleClose,
1397
- variant: "secondary"
1398
- }
1399
- )
1400
- ] }),
1401
- /* @__PURE__ */ jsx19("div", { className: `${classBase10}-content`, children: content })
1402
- ] }) });
1403
- };
1404
-
1405
- // src/shell-layouts/useFullHeightLeftPanel.tsx
1406
- import { DraggableLayout, Flexbox } from "@vuu-ui/vuu-layout";
1407
- import { jsx as jsx20, jsxs as jsxs15 } from "react/jsx-runtime";
1408
- var useFullHeightLeftPanel = ({
1409
- appHeader,
1410
- leftSidePanel
1411
- }) => {
1412
- return /* @__PURE__ */ jsxs15(
1413
- Flexbox,
1414
- {
1415
- className: "App",
1416
- style: {
1417
- flexDirection: "row",
1418
- height: "100%",
1419
- width: "100%"
1420
- },
1421
- children: [
1422
- leftSidePanel,
1423
- /* @__PURE__ */ jsxs15(
1424
- Flexbox,
1425
- {
1426
- className: "vuuShell-content",
1427
- style: { flex: 1, flexDirection: "column" },
1428
- children: [
1429
- appHeader,
1430
- /* @__PURE__ */ jsx20(DraggableLayout, { dropTarget: true, style: { flex: 1 } }, "main-content")
1431
- ]
1432
- }
1433
- ),
1434
- /* @__PURE__ */ jsx20(
1435
- ContextPanel,
1436
- {
1437
- id: "context-panel",
1438
- overlay: true,
1439
- title: "Column Settings"
1440
- }
1441
- )
1442
- ]
1443
- }
1444
- );
1445
- };
1446
-
1447
- // src/shell-layouts/useInlayLeftPanel.tsx
1448
- import {
1449
- DockLayout,
1450
- DraggableLayout as DraggableLayout2,
1451
- Drawer,
1452
- Flexbox as Flexbox2,
1453
- View
1454
- } from "@vuu-ui/vuu-layout";
1455
- import { useCallback as useCallback9, useRef as useRef2, useState as useState8 } from "react";
1456
- import { jsx as jsx21, jsxs as jsxs16 } from "react/jsx-runtime";
1457
- var useInlayLeftPanel = ({
1458
- appHeader,
1459
- leftSidePanel
1460
- }) => {
1461
- const paletteView = useRef2(null);
1462
- const [open, setOpen] = useState8(true);
1463
- const handleDrawerClick = useCallback9(
1464
- (e) => {
1465
- var _a;
1466
- const target = e.target;
1467
- if (!((_a = paletteView.current) == null ? void 0 : _a.contains(target))) {
1468
- setOpen(!open);
1469
- }
1470
- },
1471
- [open]
1472
- );
1473
- const getDrawers = useCallback9(
1474
- (leftSidePanel2) => {
1475
- const drawers = [];
1476
- drawers.push(
1477
- /* @__PURE__ */ jsx21(
1478
- Drawer,
1479
- {
1480
- onClick: handleDrawerClick,
1481
- open,
1482
- position: "left",
1483
- inline: true,
1484
- peekaboo: true,
1485
- sizeOpen: 200,
1486
- toggleButton: "end",
1487
- children: /* @__PURE__ */ jsx21(
1488
- View,
1489
- {
1490
- className: "vuuShell-palette",
1491
- id: "vw-app-palette",
1492
- ref: paletteView,
1493
- style: { height: "100%" },
1494
- children: leftSidePanel2
1495
- },
1496
- "app-palette"
1497
- )
1498
- },
1499
- "left-panel"
1500
- )
1501
- );
1502
- return drawers;
1503
- },
1504
- [handleDrawerClick, open]
1505
- );
1506
- return /* @__PURE__ */ jsxs16(
1507
- Flexbox2,
1508
- {
1509
- className: "App",
1510
- style: { flexDirection: "column", height: "100%", width: "100%" },
1511
- children: [
1512
- appHeader,
1513
- /* @__PURE__ */ jsx21(DockLayout, { style: { flex: 1 }, children: getDrawers(leftSidePanel).concat(
1514
- /* @__PURE__ */ jsx21(
1515
- DraggableLayout2,
1516
- {
1517
- dropTarget: true,
1518
- style: { width: "100%", height: "100%" }
1519
- },
1520
- "main-content"
1521
- )
1522
- ) })
1523
- ]
1524
- }
1525
- );
1526
- };
1527
-
1528
- // src/shell-layouts/useShellLayout.ts
1529
- var useShellLayout = ({
1530
- leftSidePanelLayout = "inlay",
1531
- ...props
1532
- }) => {
1533
- const useLayoutHook = leftSidePanelLayout === "inlay" ? useInlayLeftPanel : useFullHeightLeftPanel;
1534
- return useLayoutHook(props);
1535
- };
1536
-
1537
- // src/shell.tsx
1538
- import { jsx as jsx22, jsxs as jsxs17 } from "react/jsx-runtime";
1539
- var { error } = logger("Shell");
1540
- var Shell = ({
1541
- LayoutProps,
1542
- children,
1543
- className: classNameProp,
1544
- leftSidePanel,
1545
- leftSidePanelLayout,
1546
- loginUrl,
1547
- saveLocation = "remote",
1548
- saveUrl,
1549
- serverUrl,
1550
- user,
1551
- ...htmlAttributes
1552
- }) => {
1553
- const rootRef = useRef3(null);
1554
- const layoutId = useRef3("latest");
1555
- const { applicationLayout, saveApplicationLayout, loadLayoutById } = useLayoutManager();
1556
- const handleLayoutChange = useCallback10(
1557
- (layout, layoutChangeReason) => {
1558
- try {
1559
- saveApplicationLayout(layout);
1560
- console.log(`handle layout changed ${layoutChangeReason}`);
1561
- } catch {
1562
- error == null ? void 0 : error("Failed to save layout");
1563
- }
1564
- },
1565
- [saveApplicationLayout]
1566
- );
1567
- const handleSwitchTheme = useCallback10((mode) => {
1568
- if (rootRef.current) {
1569
- rootRef.current.dataset.mode = mode;
1570
- }
1571
- }, []);
1572
- const handleNavigate = useCallback10(
1573
- (id) => {
1574
- layoutId.current = id;
1575
- loadLayoutById(id);
1576
- },
1577
- [loadLayoutById]
1578
- );
1579
- useEffect7(() => {
1580
- if (serverUrl && user.token) {
1581
- connectToServer({
1582
- authToken: user.token,
1583
- url: serverUrl,
1584
- username: user.username
1585
- });
1586
- }
1587
- }, [serverUrl, user.token, user.username]);
1588
- const [themeClass, densityClass, dataMode] = useThemeAttributes();
1589
- const className = cx9("vuuShell", classNameProp, themeClass, densityClass);
1590
- const shellLayout = useShellLayout({
1591
- leftSidePanelLayout,
1592
- appHeader: /* @__PURE__ */ jsx22(
1593
- AppHeader,
1594
- {
1595
- layoutId: layoutId.current,
1596
- loginUrl,
1597
- user,
1598
- onNavigate: handleNavigate,
1599
- onSwitchTheme: handleSwitchTheme
1600
- }
1601
- ),
1602
- leftSidePanel
1603
- });
1604
- return /* @__PURE__ */ jsxs17(ThemeProvider, { children: [
1605
- /* @__PURE__ */ jsx22(
1606
- LayoutProvider,
1607
- {
1608
- ...LayoutProps,
1609
- layout: applicationLayout,
1610
- onLayoutChange: handleLayoutChange,
1611
- children: /* @__PURE__ */ jsx22(
1612
- DraggableLayout3,
1613
- {
1614
- className,
1615
- "data-mode": dataMode,
1616
- ref: rootRef,
1617
- ...htmlAttributes,
1618
- children: shellLayout
1619
- }
1620
- )
1621
- }
1622
- ),
1623
- children
1624
- ] });
1625
- };
1626
-
1627
- // src/ShellContextProvider.tsx
1628
- import { createContext as createContext2, useContext as useContext3 } from "react";
1629
- import { jsx as jsx23 } from "react/jsx-runtime";
1630
- var defaultConfig = {};
1631
- var ShellContext = createContext2(defaultConfig);
1632
- var Provider = ({
1633
- children,
1634
- context,
1635
- inheritedContext
1636
- }) => {
1637
- const mergedContext = {
1638
- ...inheritedContext,
1639
- ...context
1640
- };
1641
- return /* @__PURE__ */ jsx23(ShellContext.Provider, { value: mergedContext, children });
1642
- };
1643
- var ShellContextProvider = ({
1644
- children,
1645
- value
1646
- }) => {
1647
- return /* @__PURE__ */ jsx23(ShellContext.Consumer, { children: (context) => /* @__PURE__ */ jsx23(Provider, { context: value, inheritedContext: context, children }) });
1648
- };
1649
- var useShellContext = () => {
1650
- return useContext3(ShellContext);
1651
- };
1652
- export {
1653
- ConnectionStatusIcon,
1654
- ContextPanel,
1655
- DEFAULT_DENSITY2 as DEFAULT_DENSITY,
1656
- DEFAULT_THEME,
1657
- DEFAULT_THEME_MODE,
1658
- DensitySwitch,
1659
- Feature,
1660
- FeatureList,
1661
- LayoutManagementContext,
1662
- LayoutManagementProvider,
1663
- LayoutsList,
1664
- LeftNav,
1665
- LoginPanel,
1666
- SaveLayoutPanel,
1667
- SessionEditingForm,
1668
- Shell,
1669
- ShellContextProvider,
1670
- ThemeContext,
1671
- ThemeProvider,
1672
- ThemeSwitch,
1673
- getAuthDetailsFromCookies,
1674
- getAuthModeFromCookies,
1675
- logout,
1676
- redirectToLogin,
1677
- useLayoutManager,
1678
- useShellContext,
1679
- useShellLayout,
1680
- useThemeAttributes
1681
- };
3
+ Wrap elements with a single container`),e)},fe=({applyThemeClasses:e=!1,children:t,theme:o,themeMode:a,density:n})=>{var p,h,g;let{density:r,themeMode:u,theme:d}=Ue(pe),s=(p=n!=null?n:r)!=null?p:go,i=(h=a!=null?a:u)!=null?h:vo,l=(g=o!=null?o:d)!=null?g:yo,f=e?To(t,l,i,s):t;return So(pe.Provider,{value:{themeMode:i,density:s,theme:l},children:f})};fe.displayName="ThemeProvider";import{jsx as T,jsxs as re}from"react/jsx-runtime";var $="vuuLeftNav",Cn=({"data-path":e,features:t,onResize:o,sizeCollapsed:a=80,sizeContent:n=300,sizeExpanded:r=240,style:u,tableFeatures:d,...s})=>{let i=No(),[l,f]=Po({activeTabIndex:0,navStatus:"menu-full"}),[p]=oe(),h=ae(y=>{switch(y){case"menu-icons":return r;case"menu-full":return a;case"menu-full-content":return a+n;case"menu-icons-content":return r+n}},[a,n,r]),g=y=>{switch(y){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"}},m=ae((y,N)=>{if(N===0){let S=y==="menu-full-content"?"menu-full":y==="menu-icons-content"?"menu-icons":y;return S==="menu-icons"?[a,S]:[r,S]}else{let S=y==="menu-full"?"menu-full-content":y==="menu-icons"?"menu-icons-content":y;return S==="menu-icons-content"?[a+n,S]:[r+n,S]}},[a,n,r]),b=ae(y=>{let[N,S]=m(l.navStatus,y);f({activeTabIndex:y,navStatus:S}),i({type:$e.LAYOUT_RESIZE,path:e,size:N})},[i,m,l,e]),P=ae(()=>{let{activeTabIndex:y,navStatus:N}=l;f({activeTabIndex:y,navStatus:g(N)}),i({type:$e.LAYOUT_RESIZE,path:e,size:h(N)})},[i,l,e,h]),R={...u,"--nav-menu-collapsed-width":`${a}px`,"--nav-menu-expanded-width":`${r}px`,"--nav-menu-content-width":`${n}px`};return re("div",{...s,className:he($,`${$}-${l.navStatus}`),style:R,children:[re("div",{className:he(`${$}-menu-primary`,p),"data-mode":"dark",children:[T("div",{className:"vuuLeftNav-logo",children:T(xo,{})}),T("div",{className:`${$}-main`,children:re(Co,{activeTabIndex:l.activeTabIndex,animateSelectionThumb:!1,className:`${$}-Tabstrip`,onActiveChange:b,orientation:"vertical",children:[T(J,{"data-icon":"demo",label:"DEMO"}),T(J,{"data-icon":"features",label:"VUU FEATURES"}),T(J,{"data-icon":"tables",label:"VUU TABLES"}),T(J,{"data-icon":"templates",label:"LAYOUT TEMPLATES"}),T(J,{"data-icon":"layouts",label:"MY LAYOUTS"})]})}),T("div",{className:"vuuLeftNav-buttonBar",children:T("button",{className:he("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:P})})]}),re(bo,{active:l.activeTabIndex-1,className:`${$}-menu-secondary`,showTabs:!1,children:[T(de,{features:t,title:"VUU FEATURES"}),T(de,{features:d,title:"VUU TABLES"}),T("div",{style:{background:"green",height:"100%"},children:"LAYOUT TEMPLATES"}),T("div",{className:"vuuLeftNav-drawer",children:T(Ae,{})})]})]})};import{useState as Be}from"react";import{Button as Mo,FormField as Oe,FormFieldLabel as _e,Input as Ge}from"@salt-ds/core";import{jsx as Y,jsxs as ge}from"react/jsx-runtime";var Je="vuuLoginPanel",An=({requirePassword:e=!0,onSubmit:t})=>{let[o,a]=Be(""),[n,r]=Be(""),u=()=>{t(o,n)},d=l=>{a(l.target.value)},s=l=>{r(l.target.value)},i=o.trim()!==""&&(e===!1||n.trim()!=="");return ge("div",{className:Je,children:[ge(Oe,{style:{width:200},children:[Y(_e,{children:"Username"}),Y(Ge,{value:o,id:"text-username",onChange:d})]}),e?ge(Oe,{style:{width:200},children:[Y(_e,{children:"Password"}),Y(Ge,{inputProps:{type:"password"},value:n,id:"text-password",onChange:s})]}):null,Y(Mo,{className:`${Je}-login`,disabled:!i,onClick:u,variant:"cta",children:"Login"})]})};import{getCookieValue as ye}from"@vuu-ui/vuu-utils";var Eo=()=>{let e=ye("vuu-auth-mode");return e!=null?e:""},On=()=>{let e=ye("vuu-username"),t=ye("vuu-auth-token");return[e,t]},Fo=()=>Eo()==="login"?"login.html":"demo.html",Do=(e=Fo())=>{window.location.href=e},Ye=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",Do(e)};import{useCallback as B,useEffect as We,useMemo as wo,useRef as ve,useState as qe}from"react";import Ke from"classnames";import{useIdMemo as Ho}from"@salt-ds/core";import{Button as ze}from"@salt-ds/core";import{hasAction as ko,isErrorResponse as Vo,RemoteDataSource as Ro}from"@vuu-ui/vuu-data";import{buildColumnMap as Io,isValidNumber as Xe,shallowEquals as Ao}from"@vuu-ui/vuu-utils";import{jsx as A,jsxs as Le}from"react/jsx-runtime";var D="vuuSessionEditingForm",Ze=(e,t)=>{let o=e.find(a=>a.name===t);if(o)return o;throw Error(`SessionEditingForm, no field '${t}' found`)},Qe=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]},w={uninitialised:0,unchanged:1,changed:2,invalid:3};function je(e,t,o=!1){switch(t){case"int":case"long":{let a=parseInt(e,10);if(Xe(a))return a;if(o)throw Error("SessionEditingForm getTypedValue");return}case"double":{let a=parseFloat(e);return Xe(a)?a:void 0}case"boolean":return e==="true";default:return e}}var Uo=(e,t)=>{if(e)return e;if(t)return new Ro({bufferSize:0,table:t.table,columns:t.columns.map(o=>o.name)});throw Error("SessionEditingForm: either a DataSource or a TableSchema must be provided")},ss=({className:e,config:{fields:t,key:o},dataSource:a,id:n,onClose:r,schema:u,...d})=>{let[s,i]=qe(),[l,f]=qe(""),p=ve(null),h=ve(),g=ve(w.uninitialised),m=wo(()=>{let c=E=>{if(M){let F={};for(let U of m.columns)F[U]=E[M[U]];g.current===w.uninitialised&&(g.current=w.unchanged,h.current=F),i(F)}},v=Uo(a,u),M=Io(v.columns);return v.subscribe({range:{from:0,to:5}},E=>{E.type==="viewport-update"&&E.rows&&(g.current===w.uninitialised?c(E.rows[0]):console.log("what do we do with server updates"))}),v},[a,u]),b=Ho(n),P=B(c=>{let[v,M]=Qe(c),{type:E}=Ze(t,v),F=je(M,E);i((U={})=>{let Pe={...U,[v]:F},St=Ao(Pe,h.current);return g.current=St?w.unchanged:F!==void 0?w.changed:w.invalid,Pe})},[t]),R=B(c=>{let[v,M]=Qe(c),{type:E}=Ze(t,v),F=s==null?void 0:s[o],U=je(M,E,!0);typeof F=="string"&&m.menuRpcCall({rowKey:F,field:v,value:U,type:"VP_EDIT_CELL_RPC"})},[m,t,o,s]),y=B(c=>{typeof c=="object"&&c!==null&&"type"in c&&c.type==="CLOSE_DIALOG_ACTION"&&r()},[r]),N=B(async()=>{let c=await m.menuRpcCall({type:"VP_EDIT_SUBMIT_FORM_RPC"});Vo(c)?f(c.error):ko(c)&&y(c.action)},[y,m]),S=B(c=>{c.key==="Enter"&&g.current===w.changed&&N()},[N]),ue=B(()=>{r()},[r]),le=c=>{var M;let v=String((M=s==null?void 0:s[c.name])!=null?M:"");return c.readonly||c.name===o?A("div",{className:`${D}-fieldValue vuuReadOnly`,children:v}):A("input",{className:`${D}-fieldValue`,"data-field":c.name,onBlur:R,onChange:P,type:"text",value:v,id:`${b}-input-${c.name}`})};We(()=>{if(p.current){let c=p.current.querySelector("input");c&&setTimeout(()=>{c.focus(),c.select()},100)}},[]),We(()=>()=>{m&&m.unsubscribe()},[m]);let H=g.current===w.changed;return Le("div",{...d,className:Ke(D,e),children:[l?A("div",{className:`${D}-errorBanner`,"data-icon":"error",title:l,children:"Error, edit(s) not saved"}):void 0,A("div",{className:`${D}-content`,ref:p,onKeyDown:S,children:t.map(c=>{var v;return Le("div",{className:`${D}-field`,children:[A("label",{className:Ke(`${D}-fieldLabel`,{[`${D}-required`]:c.required}),htmlFor:`${b}-input-${c.name}`,children:(v=c==null?void 0:c.label)!=null?v:c.description}),le(c)]},c.name)})}),Le("div",{className:`${D}-buttonbar salt-theme salt-density-high`,children:[A(ze,{type:"submit",variant:"cta",disabled:!H,onClick:N,children:"Submit"}),A(ze,{variant:"secondary",onClick:ue,children:"Cancel"})]})]})};import{connectToServer as ba}from"@vuu-ui/vuu-data";import Na from"classnames";import{useCallback as Se,useEffect as Ca,useRef as Tt}from"react";import{DraggableLayout as Pa,LayoutProvider as Ma}from"@vuu-ui/vuu-layout";import{useCallback as na}from"react";import{Button as zo}from"@salt-ds/core";import{DropdownBase as Xo}from"@salt-ds/lab";import{UserSolidIcon as Zo}from"@salt-ds/icons";import{formatDate as $o}from"@vuu-ui/vuu-utils";import{List as Bo,ListItem as Oo}from"@salt-ds/lab";import{Button as _o}from"@salt-ds/core";import{ExportIcon as Go}from"@salt-ds/icons";import{forwardRef as Jo,useCallback as tt,useEffect as Yo,useState as Wo}from"react";var et=async e=>await fetch(`api/vui/${e.username}`,{}).then(o=>o.ok?o.json():null).catch(()=>{console.log("error getting history")});import{jsx as ne,jsxs as ot}from"react/jsx-runtime";var qo=({lastUpdate:e},{lastUpdate:t})=>t===e?0:t<e?-1:1,Ko=e=>ne(Oo,{...e}),at=Jo(function({loginUrl:t,onNavigate:o,user:a,layoutId:n="latest"},r){let[u,d]=Wo([]);Yo(()=>{async function f(){let h=(await et(a)).filter(g=>g.id!=="latest").sort(qo).map(({id:g,lastUpdate:m})=>({lastUpdate:m,id:g,label:`Saved at ${$o(new Date(m),"kk:mm:ss")}`}));console.log({sortedHistory:h}),d(h)}f()},[a]);let s=tt((f,p)=>{p&&o(p.id)},[o]),i=tt(()=>{Ye(t)},[t]),l=u.length===0?null:n==="latest"?u[0]:u.find(f=>f.id===n);return ot("div",{className:"vuuUserPanel",ref:r,children:[ne(Bo,{ListItem:Ko,className:"vuuUserPanel-history",onSelect:s,selected:l,source:u}),ne("div",{className:"vuuUserPanel-buttonBar",children:ot(_o,{"aria-label":"logout",onClick:i,children:[ne(Go,{})," Logout"]})})]})});import{jsx as Te,jsxs as Qo}from"react/jsx-runtime";var rt=({layoutId:e,loginUrl:t,onNavigate:o,user:a})=>Qo(Xo,{className:"vuuUserProfile",placement:"bottom-end",children:[Te(zo,{variant:"secondary",children:Te(Zo,{})}),Te(at,{layoutId:e,loginUrl:t,onNavigate:r=>{o(r)},user:a})]});import jo from"classnames";import{ToggleButton as nt,ToggleButtonGroup as ea,useControlled as ta}from"@salt-ds/core";import{useCallback as oa}from"react";import{jsx as st,jsxs as ra}from"react/jsx-runtime";var aa="vuuThemeSwitch",it=({className:e,defaultMode:t,mode:o,onChange:a,...n})=>{let[r,u]=ta({controlled:o,default:t!=null?t:"light",name:"ThemeSwitch",state:"mode"}),d=oa(i=>{let{value:l}=i.target;u(l),a(l)},[a,u]),s=jo(aa,e);return ra(ea,{className:s,...n,onChange:d,value:r,children:[st(nt,{"aria-label":"alert","data-icon":"light",value:"dark"}),st(nt,{"aria-label":"home","data-icon":"dark",value:"light"})]})};import sa from"classnames";import{jsx as ut,jsxs as ua}from"react/jsx-runtime";var ia="vuuAppHeader",lt=({className:e,layoutId:t,loginUrl:o,onNavigate:a,onSwitchTheme:n,themeMode:r="light",user:u,...d})=>{let s=sa(ia,e),i=na(l=>n==null?void 0:n(l),[n]);return ua("header",{className:s,...d,children:[ut(it,{defaultMode:r,onChange:i}),ut(rt,{layoutId:t,loginUrl:o,onNavigate:a,user:u})]})};import{logger as Ea}from"@vuu-ui/vuu-utils";import{Button as la}from"@salt-ds/core";import ct from"classnames";import{useCallback as ca,useMemo as ma}from"react";import{layoutFromJson as da,useLayoutProviderDispatch as pa}from"@vuu-ui/vuu-layout";import{jsx as se,jsxs as mt}from"react/jsx-runtime";var C="vuuContextPanel",dt=({className:e,expanded:t=!1,content:o,overlay:a=!1,title:n})=>{let r=pa(),u=ca(()=>{r({path:"#context-panel",propName:"expanded",propValue:!1,type:"set-prop"})},[r]),d=ct(C,e,{[`${C}-expanded`]:t,[`${C}-inline`]:a!==!0,[`${C}-overlay`]:a}),s=ma(()=>o?da(o,"context-0"):null,[o]);return se("div",{className:ct(C,d),children:mt("div",{className:`${C}-inner`,children:[mt("div",{className:`${C}-header`,children:[se("h2",{className:`${C}-title`,children:n}),se(la,{className:`${C}-close`,"data-icon":"close",onClick:u,variant:"secondary"})]}),se("div",{className:`${C}-content`,children:s})]})})};import{DraggableLayout as fa,Flexbox as pt}from"@vuu-ui/vuu-layout";import{jsx as ft,jsxs as ht}from"react/jsx-runtime";var gt=({appHeader:e,leftSidePanel:t})=>ht(pt,{className:"App",style:{flexDirection:"row",height:"100%",width:"100%"},children:[t,ht(pt,{className:"vuuShell-content",style:{flex:1,flexDirection:"column"},children:[e,ft(fa,{dropTarget:!0,style:{flex:1}},"main-content")]}),ft(dt,{id:"context-panel",overlay:!0,title:"Column Settings"})]});import{DockLayout as ha,DraggableLayout as ga,Drawer as ya,Flexbox as va,View as La}from"@vuu-ui/vuu-layout";import{useCallback as yt,useRef as Ta,useState as Sa}from"react";import{jsx as ie,jsxs as xa}from"react/jsx-runtime";var vt=({appHeader:e,leftSidePanel:t})=>{let o=Ta(null),[a,n]=Sa(!0),r=yt(d=>{var i;let s=d.target;(i=o.current)!=null&&i.contains(s)||n(!a)},[a]),u=yt(d=>{let s=[];return s.push(ie(ya,{onClick:r,open:a,position:"left",inline:!0,peekaboo:!0,sizeOpen:200,toggleButton:"end",children:ie(La,{className:"vuuShell-palette",id:"vw-app-palette",ref:o,style:{height:"100%"},children:d},"app-palette")},"left-panel")),s},[r,a]);return xa(va,{className:"App",style:{flexDirection:"column",height:"100%",width:"100%"},children:[e,ie(ha,{style:{flex:1},children:u(t).concat(ie(ga,{dropTarget:!0,style:{width:"100%",height:"100%"}},"main-content"))})]})};var Lt=({leftSidePanelLayout:e="inlay",...t})=>(e==="inlay"?vt:gt)(t);import{jsx as be,jsxs as Fa}from"react/jsx-runtime";var{error:xe}=Ea("Shell"),eu=({LayoutProps:e,children:t,className:o,leftSidePanel:a,leftSidePanelLayout:n,loginUrl:r,saveLocation:u="remote",saveUrl:d,serverUrl:s,user:i,...l})=>{let f=Tt(null),p=Tt("latest"),{applicationLayout:h,saveApplicationLayout:g,loadLayoutById:m}=ee(),b=Se((H,c)=>{try{g(H)}catch{xe==null||xe("Failed to save layout")}},[g]),P=Se(H=>{f.current&&(f.current.dataset.mode=H)},[]),R=Se(H=>{p.current=H,m(H)},[m]);Ca(()=>{s&&i.token&&ba({authToken:i.token,url:s,username:i.username})},[s,i.token,i.username]);let[y,N,S]=oe(),ue=Na("vuuShell",o,y,N),le=Lt({leftSidePanelLayout:n,appHeader:be(lt,{layoutId:p.current,loginUrl:r,user:i,onNavigate:R,onSwitchTheme:P}),leftSidePanel:a});return Fa(fe,{children:[be(Ma,{...e,layout:h,onLayoutChange:b,children:be(Pa,{className:ue,"data-mode":S,ref:f,...l,children:le})}),t]})};var au=e=>e==="*",ru=e=>typeof e=="object"&&typeof e.module=="string"&&typeof e.table=="string";import{createContext as Da,useContext as wa}from"react";import{jsx as Ne}from"react/jsx-runtime";var Ha={},Ce=Da(Ha),ka=({children:e,context:t,inheritedContext:o})=>{let a={...o,...t};return Ne(Ce.Provider,{value:a,children:e})},lu=({children:e,value:t})=>Ne(Ce.Consumer,{children:o=>Ne(ka,{context:t,inheritedContext:o,children:e})}),cu=()=>wa(Ce);export{$a as ConnectionStatusIcon,dt as ContextPanel,go as DEFAULT_DENSITY,yo as DEFAULT_THEME,vo as DEFAULT_THEME_MODE,Ka as DensitySwitch,z as Feature,de as FeatureList,Re as LayoutManagementContext,wr as LayoutManagementProvider,Ae as LayoutsList,Cn as LeftNav,An as LoginPanel,Nr as SaveLayoutPanel,ss as SessionEditingForm,eu as Shell,lu as ShellContextProvider,pe as ThemeContext,fe as ThemeProvider,it as ThemeSwitch,On as getAuthDetailsFromCookies,Eo as getAuthModeFromCookies,ru as isTableSchema,au as isWildcardSchema,Ye as logout,Do as redirectToLogin,ee as useLayoutManager,cu as useShellContext,Lt as useShellLayout,oe as useThemeAttributes};
1682
4
  //# sourceMappingURL=index.js.map