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

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,1379 +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 [classBase8, 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", classBase8, 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 "@heswell/salt-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/ErrorBoundary.jsx
75
- import React2 from "react";
76
- import { Fragment as Fragment2, jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
77
- var ErrorBoundary = 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(error2, errorInfo);
87
- }
88
- render() {
89
- if (this.state.errorMessage) {
90
- return /* @__PURE__ */ jsxs2(Fragment2, { children: [
91
- /* @__PURE__ */ jsx3("h1", { children: "Something went wrong." }),
92
- /* @__PURE__ */ jsx3("p", { children: this.state.errorMessage })
93
- ] });
94
- }
95
- return this.props.children;
96
- }
97
- };
98
-
99
- // src/feature/Loader.tsx
100
- import { jsx as jsx4 } from "react/jsx-runtime";
101
- var Loader = () => /* @__PURE__ */ jsx4("div", { className: "hwLoader", children: "loading" });
102
-
103
- // src/feature/Feature.tsx
104
- import { jsx as jsx5 } from "react/jsx-runtime";
105
- var componentsMap = /* @__PURE__ */ new Map();
106
- var useCachedFeature = (url) => {
107
- useEffect2(
108
- () => () => {
109
- componentsMap.delete(url);
110
- },
111
- [url]
112
- );
113
- if (!componentsMap.has(url)) {
114
- componentsMap.set(
115
- url,
116
- React3.lazy(() => import(
117
- /* @vite-ignore */
118
- url
119
- ))
120
- );
121
- }
122
- return componentsMap.get(url);
123
- };
124
- function RawFeature({
125
- url,
126
- css,
127
- params,
128
- ...props
129
- }) {
130
- console.log("Feature render", { css, url, props });
131
- useEffect2(() => {
132
- console.log("%cFeature mount", "color: green;");
133
- return () => {
134
- console.log("%cFeature unmount", "color:red;");
135
- };
136
- }, []);
137
- if (css) {
138
- import(
139
- /* @vite-ignore */
140
- css
141
- ).then(
142
- (cssModule) => {
143
- console.log("%cInject Styles", "color: blue;font-weight: bold");
144
- document.adoptedStyleSheets = [
145
- ...document.adoptedStyleSheets,
146
- cssModule.default
147
- ];
148
- }
149
- );
150
- }
151
- const LazyFeature = useCachedFeature(url);
152
- return /* @__PURE__ */ jsx5(ErrorBoundary, { children: /* @__PURE__ */ jsx5(Suspense, { fallback: /* @__PURE__ */ jsx5(Loader, {}), children: /* @__PURE__ */ jsx5(LazyFeature, { ...props, ...params }) }) });
153
- }
154
- var Feature = React3.memo(RawFeature);
155
- Feature.displayName = "Feature";
156
- registerComponent("Feature", Feature, "view");
157
-
158
- // src/login/LoginPanel.tsx
159
- import { useState as useState2 } from "react";
160
- import { Button } from "@salt-ds/core";
161
- import { FormField, Input } from "@heswell/salt-lab";
162
- import { jsx as jsx6, jsxs as jsxs3 } from "react/jsx-runtime";
163
- var classBase2 = "vuuLoginPanel";
164
- var LoginPanel = ({
165
- requirePassword = true,
166
- onSubmit
167
- }) => {
168
- const [username, setUserName] = useState2("");
169
- const [password, setPassword] = useState2("");
170
- const login = () => {
171
- onSubmit(username, password);
172
- };
173
- const handleUsername = (_event, value) => {
174
- setUserName(value);
175
- };
176
- const handlePassword = (_event, value) => {
177
- setPassword(value);
178
- };
179
- const dataIsValid = username.trim() !== "" && (requirePassword === false || password.trim() !== "");
180
- return /* @__PURE__ */ jsxs3("div", { className: classBase2, children: [
181
- /* @__PURE__ */ jsx6(FormField, { label: "Username", style: { width: 200 }, children: /* @__PURE__ */ jsx6(Input, { value: username, id: "text-username", onChange: handleUsername }) }),
182
- requirePassword ? /* @__PURE__ */ jsx6(FormField, { label: "Password", style: { width: 200 }, children: /* @__PURE__ */ jsx6(
183
- Input,
184
- {
185
- type: "password",
186
- value: password,
187
- id: "text-password",
188
- onChange: handlePassword
189
- }
190
- ) }) : null,
191
- /* @__PURE__ */ jsx6(
192
- Button,
193
- {
194
- className: `${classBase2}-login`,
195
- disabled: !dataIsValid,
196
- onClick: login,
197
- variant: "cta",
198
- children: "Login"
199
- }
200
- )
201
- ] });
202
- };
203
-
204
- // src/login/login-utils.ts
205
- import { getCookieValue } from "@vuu-ui/vuu-utils";
206
- var getAuthModeFromCookies = () => {
207
- const mode = getCookieValue("vuu-auth-mode");
208
- return mode != null ? mode : "";
209
- };
210
- var getAuthDetailsFromCookies = () => {
211
- const username = getCookieValue("vuu-username");
212
- const token = getCookieValue("vuu-auth-token");
213
- return [username, token];
214
- };
215
- var getDefaultLoginUrl = () => {
216
- const authMode = getAuthModeFromCookies();
217
- return authMode === "login" ? "login.html" : "demo.html";
218
- };
219
- var redirectToLogin = (loginUrl = getDefaultLoginUrl()) => {
220
- window.location.href = loginUrl;
221
- };
222
- var logout = (loginUrl) => {
223
- document.cookie = "vuu-username= ; expires = Thu, 01 Jan 1970 00:00:00 GMT";
224
- document.cookie = "vuu-auth-token= ; expires = Thu, 01 Jan 1970 00:00:00 GMT";
225
- redirectToLogin(loginUrl);
226
- };
227
-
228
- // src/session-editing-form/SessionEditingForm.tsx
229
- import {
230
- useCallback as useCallback2,
231
- useEffect as useEffect3,
232
- useMemo,
233
- useRef,
234
- useState as useState3
235
- } from "react";
236
- import cx3 from "classnames";
237
- import { useIdMemo } from "@salt-ds/core";
238
- import { Button as Button2 } from "@salt-ds/core";
239
- import {
240
- hasAction,
241
- isErrorResponse,
242
- RemoteDataSource
243
- } from "@vuu-ui/vuu-data";
244
- import {
245
- buildColumnMap,
246
- isValidNumber,
247
- shallowEquals
248
- } from "@vuu-ui/vuu-utils";
249
- import { jsx as jsx7, jsxs as jsxs4 } from "react/jsx-runtime";
250
- var classBase3 = "vuuSessionEditingForm";
251
- var getField = (fields, name) => {
252
- const field = fields.find((f) => f.name === name);
253
- if (field) {
254
- return field;
255
- } else {
256
- throw Error(`SessionEditingForm, no field '${name}' found`);
257
- }
258
- };
259
- var getFieldNameAndValue = (evt) => {
260
- const {
261
- dataset: { field },
262
- value
263
- } = evt.target;
264
- if (field === void 0) {
265
- throw Error("SessionEditingForm, form field has no field name");
266
- }
267
- return [field, value];
268
- };
269
- var Status = {
270
- uninitialised: 0,
271
- unchanged: 1,
272
- changed: 2,
273
- invalid: 3
274
- };
275
- function getTypedValue(value, type, throwIfUndefined = false) {
276
- switch (type) {
277
- case "int":
278
- case "long": {
279
- const typedValue = parseInt(value, 10);
280
- if (isValidNumber(typedValue)) {
281
- return typedValue;
282
- } else if (throwIfUndefined) {
283
- throw Error("SessionEditingForm getTypedValue");
284
- } else {
285
- return void 0;
286
- }
287
- }
288
- case "double": {
289
- const typedValue = parseFloat(value);
290
- if (isValidNumber(typedValue)) {
291
- return typedValue;
292
- }
293
- return void 0;
294
- }
295
- case "boolean":
296
- return value === "true" ? true : false;
297
- default:
298
- return value;
299
- }
300
- }
301
- var getDataSource = (dataSource, schema) => {
302
- if (dataSource) {
303
- return dataSource;
304
- } else if (schema) {
305
- return new RemoteDataSource({
306
- bufferSize: 0,
307
- table: schema.table,
308
- columns: schema.columns.map((col) => col.name)
309
- });
310
- } else {
311
- throw Error(
312
- "SessionEditingForm: either a DataSource or a TableSchema must be provided"
313
- );
314
- }
315
- };
316
- var SessionEditingForm = ({
317
- className,
318
- config: { fields, key: keyField },
319
- dataSource: dataSourceProp,
320
- id: idProp,
321
- onClose,
322
- schema,
323
- ...htmlAttributes
324
- }) => {
325
- const [values, setValues] = useState3();
326
- const [errorMessage, setErrorMessage] = useState3("");
327
- const formContentRef = useRef(null);
328
- const initialDataRef = useRef();
329
- const dataStatusRef = useRef(Status.uninitialised);
330
- const dataSource = useMemo(() => {
331
- const applyServerData = (data) => {
332
- if (columnMap) {
333
- const values2 = {};
334
- for (const column of dataSource.columns) {
335
- values2[column] = data[columnMap[column]];
336
- }
337
- if (dataStatusRef.current === Status.uninitialised) {
338
- dataStatusRef.current = Status.unchanged;
339
- initialDataRef.current = values2;
340
- }
341
- setValues(values2);
342
- }
343
- };
344
- const ds = getDataSource(dataSourceProp, schema);
345
- const columnMap = buildColumnMap(ds.columns);
346
- ds.subscribe({ range: { from: 0, to: 5 } }, (message) => {
347
- if (message.type === "viewport-update" && message.rows) {
348
- if (dataStatusRef.current === Status.uninitialised) {
349
- applyServerData(message.rows[0]);
350
- } else {
351
- console.log("what do we do with server updates");
352
- }
353
- }
354
- });
355
- return ds;
356
- }, [dataSourceProp, schema]);
357
- const id = useIdMemo(idProp);
358
- const handleChange = useCallback2(
359
- (evt) => {
360
- const [field, value] = getFieldNameAndValue(evt);
361
- const { type } = getField(fields, field);
362
- const typedValue = getTypedValue(value, type);
363
- setValues((values2 = {}) => {
364
- const newValues = {
365
- ...values2,
366
- [field]: typedValue
367
- };
368
- const notUpdated = shallowEquals(newValues, initialDataRef.current);
369
- dataStatusRef.current = notUpdated ? Status.unchanged : typedValue !== void 0 ? Status.changed : Status.invalid;
370
- return newValues;
371
- });
372
- },
373
- [fields]
374
- );
375
- const handleBlur = useCallback2(
376
- (evt) => {
377
- const [field, value] = getFieldNameAndValue(evt);
378
- const { type } = getField(fields, field);
379
- const rowKey = values == null ? void 0 : values[keyField];
380
- const typedValue = getTypedValue(value, type, true);
381
- if (typeof rowKey === "string") {
382
- dataSource.menuRpcCall({
383
- rowKey,
384
- field,
385
- value: typedValue,
386
- type: "VP_EDIT_CELL_RPC"
387
- });
388
- }
389
- },
390
- [dataSource, fields, keyField, values]
391
- );
392
- const applyAction = useCallback2(
393
- (action) => {
394
- if (typeof action === "object" && action !== null) {
395
- if ("type" in action && action.type === "CLOSE_DIALOG_ACTION") {
396
- onClose();
397
- }
398
- }
399
- },
400
- [onClose]
401
- );
402
- const handleSubmit = useCallback2(async () => {
403
- const response = await dataSource.menuRpcCall({
404
- type: "VP_EDIT_SUBMIT_FORM_RPC"
405
- });
406
- if (isErrorResponse(response)) {
407
- setErrorMessage(response.error);
408
- } else if (hasAction(response)) {
409
- applyAction(response.action);
410
- }
411
- }, [applyAction, dataSource]);
412
- const handleKeyDown = useCallback2(
413
- (evt) => {
414
- if (evt.key === "Enter" && dataStatusRef.current === Status.changed) {
415
- handleSubmit();
416
- }
417
- },
418
- [handleSubmit]
419
- );
420
- const handleCancel = useCallback2(() => {
421
- onClose();
422
- }, [onClose]);
423
- const getFormControl = (field) => {
424
- var _a;
425
- const value = String((_a = values == null ? void 0 : values[field.name]) != null ? _a : "");
426
- if (field.readonly || field.name === keyField) {
427
- return /* @__PURE__ */ jsx7("div", { className: `${classBase3}-fieldValue vuuReadOnly`, children: value });
428
- } else {
429
- return /* @__PURE__ */ jsx7(
430
- "input",
431
- {
432
- className: `${classBase3}-fieldValue`,
433
- "data-field": field.name,
434
- onBlur: handleBlur,
435
- onChange: handleChange,
436
- type: "text",
437
- value,
438
- id: `${id}-input-${field.name}`
439
- }
440
- );
441
- }
442
- };
443
- useEffect3(() => {
444
- if (formContentRef.current) {
445
- const firstInput = formContentRef.current.querySelector(
446
- "input"
447
- );
448
- if (firstInput) {
449
- setTimeout(() => {
450
- firstInput.focus();
451
- firstInput.select();
452
- }, 100);
453
- }
454
- }
455
- }, []);
456
- useEffect3(() => {
457
- return () => {
458
- if (dataSource) {
459
- dataSource.unsubscribe();
460
- }
461
- };
462
- }, [dataSource]);
463
- const isDirty = dataStatusRef.current === Status.changed;
464
- return /* @__PURE__ */ jsxs4("div", { ...htmlAttributes, className: cx3(classBase3, className), children: [
465
- errorMessage ? /* @__PURE__ */ jsx7(
466
- "div",
467
- {
468
- className: `${classBase3}-errorBanner`,
469
- "data-icon": "error",
470
- title: errorMessage,
471
- children: "Error, edit(s) not saved"
472
- }
473
- ) : void 0,
474
- /* @__PURE__ */ jsx7(
475
- "div",
476
- {
477
- className: `${classBase3}-content`,
478
- ref: formContentRef,
479
- onKeyDown: handleKeyDown,
480
- children: fields.map((field) => {
481
- var _a;
482
- return /* @__PURE__ */ jsxs4("div", { className: `${classBase3}-field`, children: [
483
- /* @__PURE__ */ jsx7(
484
- "label",
485
- {
486
- className: cx3(`${classBase3}-fieldLabel`, {
487
- [`${classBase3}-required`]: field.required
488
- }),
489
- htmlFor: `${id}-input-${field.name}`,
490
- children: (_a = field == null ? void 0 : field.label) != null ? _a : field.description
491
- }
492
- ),
493
- getFormControl(field)
494
- ] }, field.name);
495
- })
496
- }
497
- ),
498
- /* @__PURE__ */ jsxs4("div", { className: `${classBase3}-buttonbar salt-theme salt-density-high`, children: [
499
- /* @__PURE__ */ jsx7(
500
- Button2,
501
- {
502
- type: "submit",
503
- variant: "cta",
504
- disabled: !isDirty,
505
- onClick: handleSubmit,
506
- children: "Submit"
507
- }
508
- ),
509
- /* @__PURE__ */ jsx7(Button2, { variant: "secondary", onClick: handleCancel, children: "Cancel" })
510
- ] })
511
- ] });
512
- };
513
-
514
- // src/shell.tsx
515
- import { connectToServer } from "@vuu-ui/vuu-data";
516
- import cx9 from "classnames";
517
- import {
518
- useCallback as useCallback10,
519
- useEffect as useEffect6,
520
- useRef as useRef4
521
- } from "react";
522
-
523
- // src/layout-config/use-layout-config.ts
524
- import { useCallback as useCallback3, useEffect as useEffect4, useState as useState4 } from "react";
525
-
526
- // src/layout-config/local-config.ts
527
- var loadLocalConfig = (saveUrl, user, id = "latest") => new Promise((resolve, reject) => {
528
- console.log(
529
- `load local config at ${saveUrl} for user ${user.username}, id ${id}`
530
- );
531
- const data = localStorage.getItem(saveUrl);
532
- if (data) {
533
- const layout = JSON.parse(data);
534
- resolve(layout);
535
- } else {
536
- reject();
537
- }
538
- });
539
- var saveLocalConfig = (saveUrl, user, data) => new Promise((resolve, reject) => {
540
- try {
541
- localStorage.setItem(saveUrl, JSON.stringify(data));
542
- resolve(void 0);
543
- } catch {
544
- reject();
545
- }
546
- });
547
-
548
- // src/layout-config/remote-config.ts
549
- var loadRemoteConfig = (saveUrl, user, id = "latest") => new Promise((resolve, reject) => {
550
- fetch(`${saveUrl}/${user.username}/${id}`, {}).then((response) => {
551
- if (response.ok) {
552
- resolve(response.json());
553
- } else {
554
- reject(void 0);
555
- }
556
- }).catch(() => {
557
- reject(void 0);
558
- });
559
- });
560
- var saveRemoteConfig = (saveUrl, user, data) => new Promise((resolve, reject) => {
561
- fetch(`${saveUrl}/${user.username}`, {
562
- method: "POST",
563
- headers: {
564
- "Content-Type": "application/json"
565
- },
566
- body: JSON.stringify(data)
567
- }).then((response) => {
568
- if (response.ok) {
569
- resolve(void 0);
570
- } else {
571
- reject();
572
- }
573
- });
574
- });
575
-
576
- // src/layout-config/use-layout-config.ts
577
- var useLayoutConfig = ({
578
- saveLocation,
579
- saveUrl = "api/vui",
580
- user,
581
- defaultLayout
582
- }) => {
583
- const [layout, _setLayout] = useState4(defaultLayout);
584
- const usingRemote = saveLocation === "remote";
585
- const loadConfig = usingRemote ? loadRemoteConfig : loadLocalConfig;
586
- const saveConfig = usingRemote ? saveRemoteConfig : saveLocalConfig;
587
- const load = useCallback3(
588
- async (id = "latest") => {
589
- try {
590
- const layout2 = await loadConfig(saveUrl, user, id);
591
- _setLayout(layout2);
592
- } catch {
593
- _setLayout(defaultLayout);
594
- }
595
- },
596
- [defaultLayout, loadConfig, saveUrl, user]
597
- );
598
- useEffect4(() => {
599
- load();
600
- }, [load]);
601
- const saveData = useCallback3(
602
- (data) => {
603
- saveConfig(saveUrl, user, data);
604
- },
605
- [saveConfig, saveUrl, user]
606
- );
607
- const loadLayoutById = useCallback3((id) => load(id), [load]);
608
- return [layout, saveData, loadLayoutById];
609
- };
610
-
611
- // src/shell.tsx
612
- import { DraggableLayout as DraggableLayout3, LayoutProvider } from "@vuu-ui/vuu-layout";
613
-
614
- // src/app-header/AppHeader.tsx
615
- import { useCallback as useCallback6 } from "react";
616
-
617
- // src/user-profile/UserProfile.tsx
618
- import { Button as Button4 } from "@salt-ds/core";
619
- import { DropdownBase } from "@heswell/salt-lab";
620
- import { UserSolidIcon } from "@salt-ds/icons";
621
-
622
- // src/user-profile/UserPanel.tsx
623
- import { formatDate } from "@vuu-ui/vuu-utils";
624
- import { List, ListItem } from "@heswell/salt-lab";
625
- import { Button as Button3 } from "@salt-ds/core";
626
- import { ExportIcon } from "@salt-ds/icons";
627
- import {
628
- forwardRef,
629
- useCallback as useCallback4,
630
- useEffect as useEffect5,
631
- useState as useState5
632
- } from "react";
633
-
634
- // src/get-layout-history.ts
635
- var getLayoutHistory = async (user) => {
636
- const history = await fetch(`api/vui/${user.username}`, {}).then((response) => {
637
- return response.ok ? response.json() : null;
638
- }).catch(() => {
639
- console.log("error getting history");
640
- });
641
- return history;
642
- };
643
-
644
- // src/user-profile/UserPanel.tsx
645
- import { jsx as jsx8, jsxs as jsxs5 } from "react/jsx-runtime";
646
- var byLastUpdate = ({ lastUpdate: l1 }, { lastUpdate: l2 }) => {
647
- return l2 === l1 ? 0 : l2 < l1 ? -1 : 1;
648
- };
649
- var HistoryListItem = (props) => {
650
- return /* @__PURE__ */ jsx8(ListItem, { ...props });
651
- };
652
- var UserPanel = forwardRef(function UserPanel2({ loginUrl, onNavigate, user, layoutId = "latest" }, forwardedRef) {
653
- const [history, setHistory] = useState5([]);
654
- useEffect5(() => {
655
- async function getHistory() {
656
- const history2 = await getLayoutHistory(user);
657
- const sortedHistory = history2.filter((item) => item.id !== "latest").sort(byLastUpdate).map(({ id, lastUpdate }) => ({
658
- lastUpdate,
659
- id,
660
- label: `Saved at ${formatDate(new Date(lastUpdate), "kk:mm:ss")}`
661
- }));
662
- console.log({ sortedHistory });
663
- setHistory(sortedHistory);
664
- }
665
- getHistory();
666
- }, [user]);
667
- const handleHisorySelected = useCallback4(
668
- (evt, selected2) => {
669
- if (selected2) {
670
- onNavigate(selected2.id);
671
- }
672
- },
673
- [onNavigate]
674
- );
675
- const handleLogout = useCallback4(() => {
676
- logout(loginUrl);
677
- }, [loginUrl]);
678
- const selected = history.length === 0 ? null : layoutId === "latest" ? history[0] : history.find((i) => i.id === layoutId);
679
- return /* @__PURE__ */ jsxs5("div", { className: "vuuUserPanel", ref: forwardedRef, children: [
680
- /* @__PURE__ */ jsx8(
681
- List,
682
- {
683
- ListItem: HistoryListItem,
684
- className: "vuuUserPanel-history",
685
- onSelect: handleHisorySelected,
686
- selected,
687
- source: history
688
- }
689
- ),
690
- /* @__PURE__ */ jsx8("div", { className: "vuuUserPanel-buttonBar", children: /* @__PURE__ */ jsxs5(Button3, { "aria-label": "logout", onClick: handleLogout, children: [
691
- /* @__PURE__ */ jsx8(ExportIcon, {}),
692
- " Logout"
693
- ] }) })
694
- ] });
695
- });
696
-
697
- // src/user-profile/UserProfile.tsx
698
- import { jsx as jsx9, jsxs as jsxs6 } from "react/jsx-runtime";
699
- var UserProfile = ({
700
- layoutId,
701
- loginUrl,
702
- onNavigate,
703
- user
704
- }) => {
705
- const handleNavigate = (id) => {
706
- onNavigate(id);
707
- };
708
- return /* @__PURE__ */ jsxs6(DropdownBase, { className: "vuuUserProfile", placement: "bottom-end", children: [
709
- /* @__PURE__ */ jsx9(Button4, { variant: "secondary", children: /* @__PURE__ */ jsx9(UserSolidIcon, {}) }),
710
- /* @__PURE__ */ jsx9(
711
- UserPanel,
712
- {
713
- layoutId,
714
- loginUrl,
715
- onNavigate: handleNavigate,
716
- user
717
- }
718
- )
719
- ] });
720
- };
721
-
722
- // src/theme-switch/ThemeSwitch.tsx
723
- import {
724
- ToggleButton,
725
- ToggleButtonGroup
726
- } from "@heswell/salt-lab";
727
- import cx4 from "classnames";
728
- import { useControlled } from "@salt-ds/core";
729
- import { useCallback as useCallback5 } from "react";
730
- import { jsx as jsx10, jsxs as jsxs7 } from "react/jsx-runtime";
731
- var classBase4 = "vuuThemeSwitch";
732
- var modes = ["light", "dark"];
733
- var ThemeSwitch = ({
734
- className: classNameProp,
735
- defaultMode: defaultModeProp,
736
- mode: modeProp,
737
- onChange,
738
- ...htmlAttributes
739
- }) => {
740
- const [mode, setMode] = useControlled({
741
- controlled: modeProp,
742
- default: defaultModeProp != null ? defaultModeProp : "light",
743
- name: "ThemeSwitch",
744
- state: "mode"
745
- });
746
- const selectedIndex = modes.indexOf(mode);
747
- const handleChangeSecondary = useCallback5(
748
- (_evt, index) => {
749
- const mode2 = modes[index];
750
- setMode(mode2);
751
- onChange(mode2);
752
- },
753
- [onChange, setMode]
754
- );
755
- const className = cx4(classBase4, classNameProp);
756
- return /* @__PURE__ */ jsxs7(
757
- ToggleButtonGroup,
758
- {
759
- className,
760
- ...htmlAttributes,
761
- onChange: handleChangeSecondary,
762
- selectedIndex,
763
- children: [
764
- /* @__PURE__ */ jsx10(
765
- ToggleButton,
766
- {
767
- "aria-label": "alert",
768
- tooltipText: "Light Theme",
769
- "data-icon": "light"
770
- }
771
- ),
772
- /* @__PURE__ */ jsx10(
773
- ToggleButton,
774
- {
775
- "aria-label": "home",
776
- tooltipText: "Dark Theme",
777
- "data-icon": "dark"
778
- }
779
- )
780
- ]
781
- }
782
- );
783
- };
784
-
785
- // src/app-header/AppHeader.tsx
786
- import cx5 from "classnames";
787
- import { jsx as jsx11, jsxs as jsxs8 } from "react/jsx-runtime";
788
- var classBase5 = "vuuAppHeader";
789
- var AppHeader = ({
790
- className: classNameProp,
791
- layoutId,
792
- loginUrl,
793
- onNavigate,
794
- onSwitchTheme,
795
- themeMode = "light",
796
- user,
797
- ...htmlAttributes
798
- }) => {
799
- const className = cx5(classBase5, classNameProp);
800
- const handleSwitchTheme = useCallback6(
801
- (mode) => onSwitchTheme == null ? void 0 : onSwitchTheme(mode),
802
- [onSwitchTheme]
803
- );
804
- return /* @__PURE__ */ jsxs8("header", { className, ...htmlAttributes, children: [
805
- /* @__PURE__ */ jsx11(ThemeSwitch, { defaultMode: themeMode, onChange: handleSwitchTheme }),
806
- /* @__PURE__ */ jsx11(
807
- UserProfile,
808
- {
809
- layoutId,
810
- loginUrl,
811
- onNavigate,
812
- user
813
- }
814
- )
815
- ] });
816
- };
817
-
818
- // src/theme-provider/ThemeProvider.tsx
819
- import {
820
- createContext,
821
- isValidElement,
822
- cloneElement,
823
- useContext
824
- } from "react";
825
- import cx6 from "classnames";
826
- import { jsx as jsx12 } from "react/jsx-runtime";
827
- var DEFAULT_DENSITY2 = "medium";
828
- var DEFAULT_THEME = "salt-theme";
829
- var DEFAULT_THEME_MODE = "light";
830
- var ThemeContext = createContext({
831
- density: "high",
832
- theme: "salt",
833
- themeMode: "light"
834
- });
835
- var DEFAULT_THEME_ATTRIBUTES = [
836
- "salt",
837
- "salt-density-high",
838
- "light"
839
- ];
840
- var useThemeAttributes = () => {
841
- const context = useContext(ThemeContext);
842
- if (context) {
843
- return [
844
- `${context.theme}-theme`,
845
- `salt-density-${context.density}`,
846
- context.themeMode
847
- ];
848
- }
849
- return DEFAULT_THEME_ATTRIBUTES;
850
- };
851
- var createThemedChildren = (children, theme, themeMode, density) => {
852
- var _a;
853
- console.log("create themed children");
854
- if (isValidElement(children)) {
855
- return cloneElement(children, {
856
- className: cx6(
857
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
858
- (_a = children.props) == null ? void 0 : _a.className,
859
- `${theme}-theme`,
860
- `${theme}-density-${density}`
861
- ),
862
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
863
- // @ts-expect-error
864
- "data-mode": themeMode
865
- });
866
- } else {
867
- console.warn(
868
- `
1
+ import tt,{useEffect as ot,useState as nt}from"react";import rt from"classnames";import{Fragment as at,jsx as st,jsxs as se}from"react/jsx-runtime";var Xo=({connectionStatus:e,className:t,element:o="span",...n})=>{let[r,a]=nt("vuuConnectingStatus");ot(()=>{switch(e){case"connected":case"reconnected":a("vuuActiveStatus");break;case"connecting":a("vuuConnectingStatus");break;case"disconnected":a("vuuDisconnectedStatus");break;default:break}},[e]);let i=tt.createElement(o,{...n,className:rt("vuuStatus vuuIcon",r,t)});return st(at,{children:se("div",{className:"vuuStatus-container salt-theme",children:[i,se("div",{className:"vuuStatus-text",children:["Status: ",e.toUpperCase()]})]})})};import{Dropdown as it}from"@heswell/salt-lab";import{useCallback as lt}from"react";import ut from"classnames";import{jsx as pt}from"react/jsx-runtime";var ct="vuuDensitySwitch",mt=["high","medium","low","touch"],dt="high",ln=({className:e,defaultDensity:t=dt,onChange:o})=>{let n=lt((a,i)=>{o(i)},[o]),r=ut(ct,e);return pt(it,{className:r,source:mt,defaultSelected:t,onSelectionChange:n})};import ue,{Suspense as Ct,useEffect as ce}from"react";import{registerComponent as vt}from"@vuu-ui/vuu-layout";import ft from"react";import{Fragment as ht,jsx as ie,jsxs as gt}from"react/jsx-runtime";var U=class extends ft.Component{constructor(t){super(t),this.state={errorMessage:null}}static getDerivedStateFromError(t){return{errorMessage:t.message}}componentDidCatch(t,o){console.log(t,o)}render(){return this.state.errorMessage?gt(ht,{children:[ie("h1",{children:"Something went wrong."}),ie("p",{children:this.state.errorMessage})]}):this.props.children}};import{jsx as yt}from"react/jsx-runtime";var le=()=>yt("div",{className:"hwLoader",children:"loading"});import{jsx as I}from"react/jsx-runtime";var V=new Map,Lt=e=>(ce(()=>()=>{V.delete(e)},[e]),V.has(e)||V.set(e,ue.lazy(()=>import(e))),V.get(e));function xt({url:e,css:t,params:o,...n}){console.log("Feature render",{css:t,url:e,props:n}),ce(()=>(console.log("%cFeature mount","color: green;"),()=>{console.log("%cFeature unmount","color:red;")}),[]),t&&import(t).then(a=>{console.log("%cInject Styles","color: blue;font-weight: bold"),document.adoptedStyleSheets=[...document.adoptedStyleSheets,a.default]});let r=Lt(e);return I(U,{children:I(Ct,{fallback:I(le,{}),children:I(r,{...n,...o})})})}var me=ue.memo(xt);me.displayName="Feature";vt("Feature",me,"view");import{useState as de}from"react";import{Button as Tt}from"@salt-ds/core";import{FormField as pe,Input as fe}from"@heswell/salt-lab";import{jsx as R,jsxs as St}from"react/jsx-runtime";var he="vuuLoginPanel",kn=({requirePassword:e=!0,onSubmit:t})=>{let[o,n]=de(""),[r,a]=de(""),i=()=>{t(o,r)},p=(f,d)=>{n(d)},l=(f,d)=>{a(d)},u=o.trim()!==""&&(e===!1||r.trim()!=="");return St("div",{className:he,children:[R(pe,{label:"Username",style:{width:200},children:R(fe,{value:o,id:"text-username",onChange:p})}),e?R(pe,{label:"Password",style:{width:200},children:R(fe,{type:"password",value:r,id:"text-password",onChange:l})}):null,R(Tt,{className:`${he}-login`,disabled:!u,onClick:i,variant:"cta",children:"Login"})]})};import{getCookieValue as Z}from"@vuu-ui/vuu-utils";var bt=()=>{let e=Z("vuu-auth-mode");return e!=null?e:""},An=()=>{let e=Z("vuu-username"),t=Z("vuu-auth-token");return[e,t]},Nt=()=>bt()==="login"?"login.html":"demo.html",wt=(e=Nt())=>{window.location.href=e},ge=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",wt(e)};import{useCallback as M,useEffect as ye,useMemo as Et,useRef as q,useState as Ce}from"react";import ve from"classnames";import{useIdMemo as Dt}from"@salt-ds/core";import{Button as Le}from"@salt-ds/core";import{hasAction as Pt,isErrorResponse as Mt,RemoteDataSource as Ht}from"@vuu-ui/vuu-data";import{buildColumnMap as Rt,isValidNumber as xe,shallowEquals as Ft}from"@vuu-ui/vuu-utils";import{jsx as D,jsxs as Y}from"react/jsx-runtime";var S="vuuSessionEditingForm",Te=(e,t)=>{let o=e.find(n=>n.name===t);if(o)return o;throw Error(`SessionEditingForm, no field '${t}' found`)},Se=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]},b={uninitialised:0,unchanged:1,changed:2,invalid:3};function be(e,t,o=!1){switch(t){case"int":case"long":{let n=parseInt(e,10);if(xe(n))return n;if(o)throw Error("SessionEditingForm getTypedValue");return}case"double":{let n=parseFloat(e);return xe(n)?n:void 0}case"boolean":return e==="true";default:return e}}var kt=(e,t)=>{if(e)return e;if(t)return new Ht({bufferSize:0,table:t.table,columns:t.columns.map(o=>o.name)});throw Error("SessionEditingForm: either a DataSource or a TableSchema must be provided")},nr=({className:e,config:{fields:t,key:o},dataSource:n,id:r,onClose:a,schema:i,...p})=>{let[l,u]=Ce(),[f,d]=Ce(""),m=q(null),C=q(),h=q(b.uninitialised),y=Et(()=>{let s=x=>{if(L){let T={};for(let P of y.columns)T[P]=x[L[P]];h.current===b.uninitialised&&(h.current=b.unchanged,C.current=T),u(T)}},g=kt(n,i),L=Rt(g.columns);return g.subscribe({range:{from:0,to:5}},x=>{x.type==="viewport-update"&&x.rows&&(h.current===b.uninitialised?s(x.rows[0]):console.log("what do we do with server updates"))}),g},[n,i]),F=Dt(r),_=M(s=>{let[g,L]=Se(s),{type:x}=Te(t,g),T=be(L,x);u((P={})=>{let ae={...P,[g]:T},et=Ft(ae,C.current);return h.current=et?b.unchanged:T!==void 0?b.changed:b.invalid,ae})},[t]),O=M(s=>{let[g,L]=Se(s),{type:x}=Te(t,g),T=l==null?void 0:l[o],P=be(L,x,!0);typeof T=="string"&&y.menuRpcCall({rowKey:T,field:g,value:P,type:"VP_EDIT_CELL_RPC"})},[y,t,o,l]),k=M(s=>{typeof s=="object"&&s!==null&&"type"in s&&s.type==="CLOSE_DIALOG_ACTION"&&a()},[a]),H=M(async()=>{let s=await y.menuRpcCall({type:"VP_EDIT_SUBMIT_FORM_RPC"});Mt(s)?d(s.error):Pt(s)&&k(s.action)},[k,y]),J=M(s=>{s.key==="Enter"&&h.current===b.changed&&H()},[H]),z=M(()=>{a()},[a]),G=s=>{var L;let g=String((L=l==null?void 0:l[s.name])!=null?L:"");return s.readonly||s.name===o?D("div",{className:`${S}-fieldValue vuuReadOnly`,children:g}):D("input",{className:`${S}-fieldValue`,"data-field":s.name,onBlur:O,onChange:_,type:"text",value:g,id:`${F}-input-${s.name}`})};ye(()=>{if(m.current){let s=m.current.querySelector("input");s&&setTimeout(()=>{s.focus(),s.select()},100)}},[]),ye(()=>()=>{y&&y.unsubscribe()},[y]);let E=h.current===b.changed;return Y("div",{...p,className:ve(S,e),children:[f?D("div",{className:`${S}-errorBanner`,"data-icon":"error",title:f,children:"Error, edit(s) not saved"}):void 0,D("div",{className:`${S}-content`,ref:m,onKeyDown:J,children:t.map(s=>{var g;return Y("div",{className:`${S}-field`,children:[D("label",{className:ve(`${S}-fieldLabel`,{[`${S}-required`]:s.required}),htmlFor:`${F}-input-${s.name}`,children:(g=s==null?void 0:s.label)!=null?g:s.description}),G(s)]},s.name)})}),Y("div",{className:`${S}-buttonbar salt-theme salt-density-high`,children:[D(Le,{type:"submit",variant:"cta",disabled:!E,onClick:H,children:"Submit"}),D(Le,{variant:"secondary",onClick:z,children:"Cancel"})]})]})};import{connectToServer as Uo}from"@vuu-ui/vuu-data";import Vo from"classnames";import{useCallback as ee,useEffect as Io,useRef as je}from"react";import{useCallback as K,useEffect as Ut,useState as Vt}from"react";var Ne=(e,t,o="latest")=>new Promise((n,r)=>{console.log(`load local config at ${e} for user ${t.username}, id ${o}`);let a=localStorage.getItem(e);if(a){let i=JSON.parse(a);n(i)}else r()}),we=(e,t,o)=>new Promise((n,r)=>{try{localStorage.setItem(e,JSON.stringify(o)),n(void 0)}catch{r()}});var Ee=(e,t,o="latest")=>new Promise((n,r)=>{fetch(`${e}/${t.username}/${o}`,{}).then(a=>{a.ok?n(a.json()):r(void 0)}).catch(()=>{r(void 0)})}),De=(e,t,o)=>new Promise((n,r)=>{fetch(`${e}/${t.username}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(o)}).then(a=>{a.ok?n(void 0):r()})});var Pe=({saveLocation:e,saveUrl:t="api/vui",user:o,defaultLayout:n})=>{let[r,a]=Vt(n),i=e==="remote",p=i?Ee:Ne,l=i?De:we,u=K(async(m="latest")=>{try{let C=await p(t,o,m);a(C)}catch{a(n)}},[n,p,t,o]);Ut(()=>{u()},[u]);let f=K(m=>{l(t,o,m)},[l,t,o]),d=K(m=>u(m),[u]);return[r,f,d]};import{DraggableLayout as Ao,LayoutProvider as $o}from"@vuu-ui/vuu-layout";import{useCallback as no}from"react";import{Button as qt}from"@salt-ds/core";import{DropdownBase as Yt}from"@heswell/salt-lab";import{UserSolidIcon as Kt}from"@salt-ds/icons";import{formatDate as It}from"@vuu-ui/vuu-utils";import{List as At,ListItem as $t}from"@heswell/salt-lab";import{Button as Bt}from"@salt-ds/core";import{ExportIcon as _t}from"@salt-ds/icons";import{forwardRef as Ot,useCallback as He,useEffect as Jt,useState as zt}from"react";var Me=async e=>await fetch(`api/vui/${e.username}`,{}).then(o=>o.ok?o.json():null).catch(()=>{console.log("error getting history")});import{jsx as A,jsxs as Re}from"react/jsx-runtime";var Gt=({lastUpdate:e},{lastUpdate:t})=>t===e?0:t<e?-1:1,Zt=e=>A($t,{...e}),Fe=Ot(function({loginUrl:t,onNavigate:o,user:n,layoutId:r="latest"},a){let[i,p]=zt([]);Jt(()=>{async function d(){let C=(await Me(n)).filter(h=>h.id!=="latest").sort(Gt).map(({id:h,lastUpdate:y})=>({lastUpdate:y,id:h,label:`Saved at ${It(new Date(y),"kk:mm:ss")}`}));console.log({sortedHistory:C}),p(C)}d()},[n]);let l=He((d,m)=>{m&&o(m.id)},[o]),u=He(()=>{ge(t)},[t]),f=i.length===0?null:r==="latest"?i[0]:i.find(d=>d.id===r);return Re("div",{className:"vuuUserPanel",ref:a,children:[A(At,{ListItem:Zt,className:"vuuUserPanel-history",onSelect:l,selected:f,source:i}),A("div",{className:"vuuUserPanel-buttonBar",children:Re(Bt,{"aria-label":"logout",onClick:u,children:[A(_t,{})," Logout"]})})]})});import{jsx as W,jsxs as Wt}from"react/jsx-runtime";var ke=({layoutId:e,loginUrl:t,onNavigate:o,user:n})=>Wt(Yt,{className:"vuuUserProfile",placement:"bottom-end",children:[W(qt,{variant:"secondary",children:W(Kt,{})}),W(Fe,{layoutId:e,loginUrl:t,onNavigate:a=>{o(a)},user:n})]});import{ToggleButton as Ue,ToggleButtonGroup as Qt}from"@heswell/salt-lab";import Xt from"classnames";import{useControlled as jt}from"@salt-ds/core";import{useCallback as eo}from"react";import{jsx as Ie,jsxs as oo}from"react/jsx-runtime";var to="vuuThemeSwitch",Ve=["light","dark"],Ae=({className:e,defaultMode:t,mode:o,onChange:n,...r})=>{let[a,i]=jt({controlled:o,default:t!=null?t:"light",name:"ThemeSwitch",state:"mode"}),p=Ve.indexOf(a),l=eo((f,d)=>{let m=Ve[d];i(m),n(m)},[n,i]),u=Xt(to,e);return oo(Qt,{className:u,...r,onChange:l,selectedIndex:p,children:[Ie(Ue,{"aria-label":"alert",tooltipText:"Light Theme","data-icon":"light"}),Ie(Ue,{"aria-label":"home",tooltipText:"Dark Theme","data-icon":"dark"})]})};import ro from"classnames";import{jsx as $e,jsxs as so}from"react/jsx-runtime";var ao="vuuAppHeader",Be=({className:e,layoutId:t,loginUrl:o,onNavigate:n,onSwitchTheme:r,themeMode:a="light",user:i,...p})=>{let l=ro(ao,e),u=no(f=>r==null?void 0:r(f),[r]);return so("header",{className:l,...p,children:[$e(Ae,{defaultMode:a,onChange:u}),$e(ke,{layoutId:t,loginUrl:o,onNavigate:n,user:i})]})};import{createContext as io,isValidElement as lo,cloneElement as uo,useContext as _e}from"react";import co from"classnames";import{jsx as yo}from"react/jsx-runtime";var mo="medium",po="salt-theme",fo="light",Q=io({density:"high",theme:"salt",themeMode:"light"}),ho=["salt","salt-density-high","light"],Oe=()=>{let e=_e(Q);return e?[`${e.theme}-theme`,`salt-density-${e.density}`,e.themeMode]:ho},go=(e,t,o,n)=>{var r;return console.log("create themed children"),lo(e)?uo(e,{className:co((r=e.props)==null?void 0:r.className,`${t}-theme`,`${t}-density-${n}`),"data-mode":o}):(console.warn(`
869
2
  ThemeProvider can only apply CSS classes for theming to a single nested child element of the ThemeProvider.
870
- Wrap elements with a single container`
871
- );
872
- return children;
873
- }
874
- };
875
- var ThemeProvider = ({
876
- applyThemeClasses = false,
877
- children,
878
- theme: themeProp,
879
- themeMode: themeModeProp,
880
- density: densityProp
881
- }) => {
882
- var _a, _b, _c;
883
- const {
884
- density: inheritedDensity,
885
- themeMode: inheritedThemeMode,
886
- theme: inheritedTheme
887
- } = useContext(ThemeContext);
888
- const density = (_a = densityProp != null ? densityProp : inheritedDensity) != null ? _a : DEFAULT_DENSITY2;
889
- const themeMode = (_b = themeModeProp != null ? themeModeProp : inheritedThemeMode) != null ? _b : DEFAULT_THEME_MODE;
890
- const theme = (_c = themeProp != null ? themeProp : inheritedTheme) != null ? _c : DEFAULT_THEME;
891
- const themedChildren = applyThemeClasses ? createThemedChildren(children, theme, themeMode, density) : children;
892
- return /* @__PURE__ */ jsx12(ThemeContext.Provider, { value: { themeMode, density, theme }, children: themedChildren });
893
- };
894
- ThemeProvider.displayName = "ThemeProvider";
895
-
896
- // src/shell.tsx
897
- import { logger } from "@vuu-ui/vuu-utils";
898
-
899
- // src/shell-layouts/useFullHeightLeftPanel.tsx
900
- import { DraggableLayout, Flexbox } from "@vuu-ui/vuu-layout";
901
-
902
- // src/shell-layouts/context-panel/ContextPanel.tsx
903
- import { Button as Button5 } from "@salt-ds/core";
904
- import cx7 from "classnames";
905
- import { useCallback as useCallback7 } from "react";
906
- import { useLayoutProviderDispatch } from "@vuu-ui/vuu-layout";
907
- import { jsx as jsx13, jsxs as jsxs9 } from "react/jsx-runtime";
908
- var classBase6 = "vuuContextPanel";
909
- var ContextPanel = ({
910
- className: classNameProp,
911
- expanded = false,
912
- overlay = false,
913
- title
914
- }) => {
915
- const dispatchLayoutAction = useLayoutProviderDispatch();
916
- const handleClose = useCallback7(() => {
917
- dispatchLayoutAction({
918
- path: "#context-panel",
919
- propName: "expanded",
920
- propValue: false,
921
- type: "set-prop"
922
- });
923
- }, [dispatchLayoutAction]);
924
- const className = cx7(classBase6, classNameProp, {
925
- [`${classBase6}-expanded`]: expanded,
926
- [`${classBase6}-inline`]: overlay !== true,
927
- [`${classBase6}-overlay`]: overlay
928
- });
929
- return /* @__PURE__ */ jsx13("div", { className: cx7(classBase6, className), children: /* @__PURE__ */ jsx13("div", { className: `${classBase6}-inner`, children: /* @__PURE__ */ jsxs9("div", { className: `${classBase6}-header`, children: [
930
- /* @__PURE__ */ jsx13("h2", { className: `${classBase6}-title`, children: title }),
931
- /* @__PURE__ */ jsx13(
932
- Button5,
933
- {
934
- className: `${classBase6}-close`,
935
- "data-icon": "close",
936
- onClick: handleClose,
937
- variant: "secondary"
938
- }
939
- )
940
- ] }) }) });
941
- };
942
-
943
- // src/left-nav/LeftNav.tsx
944
- import { Action, useLayoutProviderDispatch as useLayoutProviderDispatch2 } from "@vuu-ui/vuu-layout";
945
- import cx8 from "classnames";
946
- import { useCallback as useCallback8, useRef as useRef2 } from "react";
947
- import { jsx as jsx14, jsxs as jsxs10 } from "react/jsx-runtime";
948
- var classBase7 = "vuuLeftNav";
949
- var LeftNav = ({
950
- "data-path": path,
951
- onResize,
952
- open = true,
953
- ...htmlAttributes
954
- }) => {
955
- const dispatch = useLayoutProviderDispatch2();
956
- const openRef = useRef2(open);
957
- const toggleSize = useCallback8(() => {
958
- openRef.current = !openRef.current;
959
- dispatch({
960
- type: Action.LAYOUT_RESIZE,
961
- path,
962
- size: openRef.current ? 240 : 80
963
- });
964
- }, [dispatch, path]);
965
- return /* @__PURE__ */ jsxs10("div", { ...htmlAttributes, className: classBase7, children: [
966
- /* @__PURE__ */ jsxs10("div", { className: "vuuLeftNav-logo", children: [
967
- /* @__PURE__ */ jsxs10(
968
- "svg",
969
- {
970
- width: "44",
971
- height: "45",
972
- viewBox: "0 0 44 45",
973
- fill: "none",
974
- xmlns: "http://www.w3.org/2000/svg",
975
- children: [
976
- /* @__PURE__ */ jsxs10("g", { clipPath: "url(#clip0_217_6990)", children: [
977
- /* @__PURE__ */ jsx14(
978
- "path",
979
- {
980
- d: "M39.8642 15.5509L35.9196 7.58974L34.3369 6.85464L24.6235 22.0825L39.1628 30.618L42.3152 25.6347L39.8642 15.5509Z",
981
- fill: "url(#paint0_linear_217_6990)"
982
- }
983
- ),
984
- /* @__PURE__ */ jsx14(
985
- "path",
986
- {
987
- 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",
988
- fill: "url(#paint1_linear_217_6990)"
989
- }
990
- ),
991
- /* @__PURE__ */ jsx14(
992
- "path",
993
- {
994
- 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",
995
- fill: "#F37880"
996
- }
997
- ),
998
- /* @__PURE__ */ jsxs10("g", { opacity: "0.86", children: [
999
- /* @__PURE__ */ jsx14(
1000
- "path",
1001
- {
1002
- 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",
1003
- fill: "white"
1004
- }
1005
- ),
1006
- /* @__PURE__ */ jsx14(
1007
- "path",
1008
- {
1009
- 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",
1010
- fill: "white"
1011
- }
1012
- ),
1013
- /* @__PURE__ */ jsx14(
1014
- "path",
1015
- {
1016
- 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",
1017
- fill: "white"
1018
- }
1019
- )
1020
- ] })
1021
- ] }),
1022
- /* @__PURE__ */ jsxs10("defs", { children: [
1023
- /* @__PURE__ */ jsxs10(
1024
- "linearGradient",
1025
- {
1026
- id: "paint0_linear_217_6990",
1027
- x1: "24.6235",
1028
- y1: "18.7363",
1029
- x2: "42.3152",
1030
- y2: "18.7363",
1031
- gradientUnits: "userSpaceOnUse",
1032
- children: [
1033
- /* @__PURE__ */ jsx14("stop", { stopColor: "#4906A5" }),
1034
- /* @__PURE__ */ jsx14("stop", { offset: "1", stopColor: "#D3423A" })
1035
- ]
1036
- }
1037
- ),
1038
- /* @__PURE__ */ jsxs10(
1039
- "linearGradient",
1040
- {
1041
- id: "paint1_linear_217_6990",
1042
- x1: "-2.35794e-05",
1043
- y1: "22.5009",
1044
- x2: "42.7186",
1045
- y2: "22.5009",
1046
- gradientUnits: "userSpaceOnUse",
1047
- children: [
1048
- /* @__PURE__ */ jsx14("stop", { stopColor: "#7C06A5" }),
1049
- /* @__PURE__ */ jsx14("stop", { offset: "1", stopColor: "#D3423A" })
1050
- ]
1051
- }
1052
- ),
1053
- /* @__PURE__ */ jsx14("clipPath", { id: "clip0_217_6990", children: /* @__PURE__ */ jsx14("rect", { width: "44", height: "45", fill: "white" }) })
1054
- ] })
1055
- ]
1056
- }
1057
- ),
1058
- " "
1059
- ] }),
1060
- /* @__PURE__ */ jsx14("div", { className: `${classBase7}-main`, children: /* @__PURE__ */ jsxs10("ul", { className: `${classBase7}-menu`, children: [
1061
- /* @__PURE__ */ jsx14(
1062
- "li",
1063
- {
1064
- className: cx8(
1065
- `${classBase7}-menuitem`,
1066
- `${classBase7}-menuitem-active`
1067
- ),
1068
- "data-icon": "demo",
1069
- children: /* @__PURE__ */ jsx14("span", { className: `${classBase7}-menuitem-label`, children: "DEMO" })
1070
- }
1071
- ),
1072
- /* @__PURE__ */ jsx14("li", { className: `${classBase7}-menuitem`, "data-icon": "tables", children: /* @__PURE__ */ jsx14("span", { className: `${classBase7}-menuitem-label`, children: "VUU TABLES" }) }),
1073
- /* @__PURE__ */ jsx14("li", { className: `${classBase7}-menuitem`, "data-icon": "templates", children: /* @__PURE__ */ jsx14("span", { className: `${classBase7}-menuitem-label`, children: "LAYOUT TEMPLATES" }) }),
1074
- /* @__PURE__ */ jsx14("li", { className: `${classBase7}-menuitem`, "data-icon": "layouts", children: /* @__PURE__ */ jsx14("span", { className: `${classBase7}-menuitem-label`, children: "MY LAYOUTS" }) })
1075
- ] }) }),
1076
- /* @__PURE__ */ jsx14("div", { className: "vuuLeftNav-buttonBar", children: /* @__PURE__ */ jsx14(
1077
- "button",
1078
- {
1079
- className: cx8("vuuLeftNav-toggleButton", {
1080
- "vuuLeftNav-toggleButton-open": openRef.current,
1081
- "vuuLeftNav-toggleButton-closed": !openRef.current
1082
- }),
1083
- "data-icon": openRef.current ? "chevron-left" : "chevron-right",
1084
- onClick: toggleSize
1085
- }
1086
- ) })
1087
- ] });
1088
- };
1089
-
1090
- // src/shell-layouts/useFullHeightLeftPanel.tsx
1091
- import { jsx as jsx15, jsxs as jsxs11 } from "react/jsx-runtime";
1092
- var useFullHeightLeftPanel = ({
1093
- appHeader
1094
- }) => {
1095
- return /* @__PURE__ */ jsxs11(
1096
- Flexbox,
1097
- {
1098
- className: "App",
1099
- style: {
1100
- flexDirection: "row",
1101
- height: "100%",
1102
- width: "100%"
1103
- },
1104
- children: [
1105
- /* @__PURE__ */ jsx15(
1106
- LeftNav,
1107
- {
1108
- style: {
1109
- width: 240
1110
- }
1111
- }
1112
- ),
1113
- /* @__PURE__ */ jsxs11(
1114
- Flexbox,
1115
- {
1116
- className: "vuuShell-content",
1117
- style: {
1118
- flexDirection: "column",
1119
- flex: 1,
1120
- padding: 8
1121
- },
1122
- children: [
1123
- appHeader,
1124
- /* @__PURE__ */ jsx15(DraggableLayout, { dropTarget: true, style: { flex: 1 } }, "main-content")
1125
- ]
1126
- }
1127
- ),
1128
- /* @__PURE__ */ jsx15(
1129
- ContextPanel,
1130
- {
1131
- id: "context-panel",
1132
- overlay: true,
1133
- title: "Column Settings"
1134
- }
1135
- )
1136
- ]
1137
- }
1138
- );
1139
- };
1140
-
1141
- // src/shell-layouts/useInlayLeftPanel.tsx
1142
- import {
1143
- DockLayout,
1144
- DraggableLayout as DraggableLayout2,
1145
- Drawer,
1146
- Flexbox as Flexbox2,
1147
- View
1148
- } from "@vuu-ui/vuu-layout";
1149
- import { useCallback as useCallback9, useRef as useRef3, useState as useState6 } from "react";
1150
- import { jsx as jsx16, jsxs as jsxs12 } from "react/jsx-runtime";
1151
- var useInlayLeftPanel = ({
1152
- appHeader,
1153
- leftSidePanel
1154
- }) => {
1155
- const paletteView = useRef3(null);
1156
- const [open, setOpen] = useState6(true);
1157
- const handleDrawerClick = useCallback9(
1158
- (e) => {
1159
- var _a;
1160
- const target = e.target;
1161
- if (!((_a = paletteView.current) == null ? void 0 : _a.contains(target))) {
1162
- setOpen(!open);
1163
- }
1164
- },
1165
- [open]
1166
- );
1167
- const getDrawers = useCallback9(
1168
- (leftSidePanel2) => {
1169
- const drawers = [];
1170
- drawers.push(
1171
- /* @__PURE__ */ jsx16(
1172
- Drawer,
1173
- {
1174
- onClick: handleDrawerClick,
1175
- open,
1176
- position: "left",
1177
- inline: true,
1178
- peekaboo: true,
1179
- sizeOpen: 200,
1180
- toggleButton: "end",
1181
- children: /* @__PURE__ */ jsx16(
1182
- View,
1183
- {
1184
- className: "vuuShell-palette",
1185
- id: "vw-app-palette",
1186
- ref: paletteView,
1187
- style: { height: "100%" },
1188
- children: leftSidePanel2
1189
- },
1190
- "app-palette"
1191
- )
1192
- },
1193
- "left-panel"
1194
- )
1195
- );
1196
- return drawers;
1197
- },
1198
- [handleDrawerClick, open]
1199
- );
1200
- return /* @__PURE__ */ jsxs12(
1201
- Flexbox2,
1202
- {
1203
- className: "App",
1204
- style: { flexDirection: "column", height: "100%", width: "100%" },
1205
- children: [
1206
- appHeader,
1207
- /* @__PURE__ */ jsx16(DockLayout, { style: { flex: 1 }, children: getDrawers(leftSidePanel).concat(
1208
- /* @__PURE__ */ jsx16(
1209
- DraggableLayout2,
1210
- {
1211
- dropTarget: true,
1212
- style: { width: "100%", height: "100%" }
1213
- },
1214
- "main-content"
1215
- )
1216
- ) })
1217
- ]
1218
- }
1219
- );
1220
- };
1221
-
1222
- // src/shell-layouts/useShellLayout.ts
1223
- var useShellLayout = ({
1224
- leftSidePanelLayout = "inlay",
1225
- ...props
1226
- }) => {
1227
- const useLayoutHook = leftSidePanelLayout === "inlay" ? useInlayLeftPanel : useFullHeightLeftPanel;
1228
- return useLayoutHook(props);
1229
- };
1230
-
1231
- // src/shell.tsx
1232
- import { jsx as jsx17, jsxs as jsxs13 } from "react/jsx-runtime";
1233
- var { error } = logger("Shell");
1234
- var warningLayout = {
1235
- type: "View",
1236
- props: {
1237
- style: { height: "calc(100% - 6px)" }
1238
- },
1239
- children: [
1240
- {
1241
- props: {
1242
- className: "vuuShell-warningPlaceholder"
1243
- },
1244
- type: "Placeholder"
1245
- }
1246
- ]
1247
- };
1248
- var Shell = ({
1249
- children,
1250
- className: classNameProp,
1251
- defaultLayout = warningLayout,
1252
- leftSidePanel,
1253
- leftSidePanelLayout,
1254
- loginUrl,
1255
- saveLocation = "remote",
1256
- saveUrl,
1257
- serverUrl,
1258
- user,
1259
- ...htmlAttributes
1260
- }) => {
1261
- const rootRef = useRef4(null);
1262
- const layoutId = useRef4("latest");
1263
- const [layout, saveLayoutConfig, loadLayoutById] = useLayoutConfig({
1264
- defaultLayout,
1265
- saveLocation,
1266
- user
1267
- });
1268
- const handleLayoutChange = useCallback10(
1269
- (layout2) => {
1270
- try {
1271
- saveLayoutConfig(layout2);
1272
- } catch {
1273
- error == null ? void 0 : error("Failed to save layout");
1274
- }
1275
- },
1276
- [saveLayoutConfig]
1277
- );
1278
- const handleSwitchTheme = useCallback10((mode) => {
1279
- if (rootRef.current) {
1280
- rootRef.current.dataset.mode = mode;
1281
- }
1282
- }, []);
1283
- const handleNavigate = useCallback10(
1284
- (id) => {
1285
- layoutId.current = id;
1286
- loadLayoutById(id);
1287
- },
1288
- [loadLayoutById]
1289
- );
1290
- useEffect6(() => {
1291
- if (serverUrl && user.token) {
1292
- connectToServer({
1293
- authToken: user.token,
1294
- url: serverUrl,
1295
- username: user.username
1296
- });
1297
- }
1298
- }, [serverUrl, user.token, user.username]);
1299
- const [themeClass, densityClass, dataMode] = useThemeAttributes();
1300
- const className = cx9("vuuShell", classNameProp, themeClass, densityClass);
1301
- const shellLayout = useShellLayout({
1302
- leftSidePanelLayout,
1303
- appHeader: /* @__PURE__ */ jsx17(
1304
- AppHeader,
1305
- {
1306
- layoutId: layoutId.current,
1307
- loginUrl,
1308
- user,
1309
- onNavigate: handleNavigate,
1310
- onSwitchTheme: handleSwitchTheme
1311
- }
1312
- ),
1313
- leftSidePanel
1314
- });
1315
- return (
1316
- // ShellContext TBD
1317
- /* @__PURE__ */ jsxs13(ThemeProvider, { children: [
1318
- /* @__PURE__ */ jsx17(LayoutProvider, { layout, onLayoutChange: handleLayoutChange, children: /* @__PURE__ */ jsx17(
1319
- DraggableLayout3,
1320
- {
1321
- className,
1322
- "data-mode": dataMode,
1323
- ref: rootRef,
1324
- ...htmlAttributes,
1325
- children: shellLayout
1326
- }
1327
- ) }),
1328
- children
1329
- ] })
1330
- );
1331
- };
1332
-
1333
- // src/ShellContextProvider.tsx
1334
- import { createContext as createContext2, useContext as useContext2 } from "react";
1335
- import { jsx as jsx18 } from "react/jsx-runtime";
1336
- var defaultConfig = {};
1337
- var ShellContext = createContext2(defaultConfig);
1338
- var Provider = ({
1339
- children,
1340
- context,
1341
- inheritedContext
1342
- }) => {
1343
- const mergedContext = {
1344
- ...inheritedContext,
1345
- ...context
1346
- };
1347
- return /* @__PURE__ */ jsx18(ShellContext.Provider, { value: mergedContext, children });
1348
- };
1349
- var ShellContextProvider = ({
1350
- children,
1351
- value
1352
- }) => {
1353
- return /* @__PURE__ */ jsx18(ShellContext.Consumer, { children: (context) => /* @__PURE__ */ jsx18(Provider, { context: value, inheritedContext: context, children }) });
1354
- };
1355
- var useShellContext = () => {
1356
- return useContext2(ShellContext);
1357
- };
1358
- export {
1359
- ConnectionStatusIcon,
1360
- DEFAULT_DENSITY2 as DEFAULT_DENSITY,
1361
- DEFAULT_THEME,
1362
- DEFAULT_THEME_MODE,
1363
- DensitySwitch,
1364
- Feature,
1365
- LoginPanel,
1366
- SessionEditingForm,
1367
- Shell,
1368
- ShellContextProvider,
1369
- ThemeContext,
1370
- ThemeProvider,
1371
- ThemeSwitch,
1372
- getAuthDetailsFromCookies,
1373
- getAuthModeFromCookies,
1374
- logout,
1375
- redirectToLogin,
1376
- useShellContext,
1377
- useThemeAttributes
1378
- };
3
+ Wrap elements with a single container`),e)},X=({applyThemeClasses:e=!1,children:t,theme:o,themeMode:n,density:r})=>{var m,C,h;let{density:a,themeMode:i,theme:p}=_e(Q),l=(m=r!=null?r:a)!=null?m:mo,u=(C=n!=null?n:i)!=null?C:fo,f=(h=o!=null?o:p)!=null?h:po,d=e?go(t,f,u,l):t;return yo(Q.Provider,{value:{themeMode:u,density:l,theme:f},children:d})};X.displayName="ThemeProvider";import{logger as Bo}from"@vuu-ui/vuu-utils";import{DraggableLayout as wo,Flexbox as qe}from"@vuu-ui/vuu-layout";import{Button as Co}from"@salt-ds/core";import Je from"classnames";import{useCallback as vo}from"react";import{useLayoutProviderDispatch as Lo}from"@vuu-ui/vuu-layout";import{jsx as $,jsxs as xo}from"react/jsx-runtime";var N="vuuContextPanel",ze=({className:e,expanded:t=!1,overlay:o=!1,title:n})=>{let r=Lo(),a=vo(()=>{r({path:"#context-panel",propName:"expanded",propValue:!1,type:"set-prop"})},[r]),i=Je(N,e,{[`${N}-expanded`]:t,[`${N}-inline`]:o!==!0,[`${N}-overlay`]:o});return $("div",{className:Je(N,i),children:$("div",{className:`${N}-inner`,children:xo("div",{className:`${N}-header`,children:[$("h2",{className:`${N}-title`,children:n}),$(Co,{className:`${N}-close`,"data-icon":"close",onClick:a,variant:"secondary"})]})})})};import{Action as To,useLayoutProviderDispatch as So}from"@vuu-ui/vuu-layout";import Ge from"classnames";import{useCallback as bo,useRef as No}from"react";import{jsx as c,jsxs as w}from"react/jsx-runtime";var v="vuuLeftNav",Ze=({"data-path":e,onResize:t,open:o=!0,...n})=>{let r=So(),a=No(o),i=bo(()=>{a.current=!a.current,r({type:To.LAYOUT_RESIZE,path:e,size:a.current?240:80})},[r,e]);return w("div",{...n,className:v,children:[w("div",{className:"vuuLeftNav-logo",children:[w("svg",{width:"44",height:"45",viewBox:"0 0 44 45",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[w("g",{clipPath:"url(#clip0_217_6990)",children:[c("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)"}),c("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)"}),c("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"}),w("g",{opacity:"0.86",children:[c("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"}),c("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"}),c("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"})]})]}),w("defs",{children:[w("linearGradient",{id:"paint0_linear_217_6990",x1:"24.6235",y1:"18.7363",x2:"42.3152",y2:"18.7363",gradientUnits:"userSpaceOnUse",children:[c("stop",{stopColor:"#4906A5"}),c("stop",{offset:"1",stopColor:"#D3423A"})]}),w("linearGradient",{id:"paint1_linear_217_6990",x1:"-2.35794e-05",y1:"22.5009",x2:"42.7186",y2:"22.5009",gradientUnits:"userSpaceOnUse",children:[c("stop",{stopColor:"#7C06A5"}),c("stop",{offset:"1",stopColor:"#D3423A"})]}),c("clipPath",{id:"clip0_217_6990",children:c("rect",{width:"44",height:"45",fill:"white"})})]})]})," "]}),c("div",{className:`${v}-main`,children:w("ul",{className:`${v}-menu`,children:[c("li",{className:Ge(`${v}-menuitem`,`${v}-menuitem-active`),"data-icon":"demo",children:c("span",{className:`${v}-menuitem-label`,children:"DEMO"})}),c("li",{className:`${v}-menuitem`,"data-icon":"tables",children:c("span",{className:`${v}-menuitem-label`,children:"VUU TABLES"})}),c("li",{className:`${v}-menuitem`,"data-icon":"templates",children:c("span",{className:`${v}-menuitem-label`,children:"LAYOUT TEMPLATES"})}),c("li",{className:`${v}-menuitem`,"data-icon":"layouts",children:c("span",{className:`${v}-menuitem-label`,children:"MY LAYOUTS"})})]})}),c("div",{className:"vuuLeftNav-buttonBar",children:c("button",{className:Ge("vuuLeftNav-toggleButton",{"vuuLeftNav-toggleButton-open":a.current,"vuuLeftNav-toggleButton-closed":!a.current}),"data-icon":a.current?"chevron-left":"chevron-right",onClick:i})})]})};import{jsx as j,jsxs as Ye}from"react/jsx-runtime";var Ke=({appHeader:e})=>Ye(qe,{className:"App",style:{flexDirection:"row",height:"100%",width:"100%"},children:[j(Ze,{style:{width:240}}),Ye(qe,{className:"vuuShell-content",style:{flexDirection:"column",flex:1,padding:8},children:[e,j(wo,{dropTarget:!0,style:{flex:1}},"main-content")]}),j(ze,{id:"context-panel",overlay:!0,title:"Column Settings"})]});import{DockLayout as Eo,DraggableLayout as Do,Drawer as Po,Flexbox as Mo,View as Ho}from"@vuu-ui/vuu-layout";import{useCallback as We,useRef as Ro,useState as Fo}from"react";import{jsx as B,jsxs as ko}from"react/jsx-runtime";var Qe=({appHeader:e,leftSidePanel:t})=>{let o=Ro(null),[n,r]=Fo(!0),a=We(p=>{var u;let l=p.target;(u=o.current)!=null&&u.contains(l)||r(!n)},[n]),i=We(p=>{let l=[];return l.push(B(Po,{onClick:a,open:n,position:"left",inline:!0,peekaboo:!0,sizeOpen:200,toggleButton:"end",children:B(Ho,{className:"vuuShell-palette",id:"vw-app-palette",ref:o,style:{height:"100%"},children:p},"app-palette")},"left-panel")),l},[a,n]);return ko(Mo,{className:"App",style:{flexDirection:"column",height:"100%",width:"100%"},children:[e,B(Eo,{style:{flex:1},children:i(t).concat(B(Do,{dropTarget:!0,style:{width:"100%",height:"100%"}},"main-content"))})]})};var Xe=({leftSidePanelLayout:e="inlay",...t})=>(e==="inlay"?Qe:Ke)(t);import{jsx as oe,jsxs as Oo}from"react/jsx-runtime";var{error:te}=Bo("Shell"),_o={type:"View",props:{style:{height:"calc(100% - 6px)"}},children:[{props:{className:"vuuShell-warningPlaceholder"},type:"Placeholder"}]},bs=({children:e,className:t,defaultLayout:o=_o,leftSidePanel:n,leftSidePanelLayout:r,loginUrl:a,saveLocation:i="remote",saveUrl:p,serverUrl:l,user:u,...f})=>{let d=je(null),m=je("latest"),[C,h,y]=Pe({defaultLayout:o,saveLocation:i,user:u}),F=ee(E=>{try{h(E)}catch{te==null||te("Failed to save layout")}},[h]),_=ee(E=>{d.current&&(d.current.dataset.mode=E)},[]),O=ee(E=>{m.current=E,y(E)},[y]);Io(()=>{l&&u.token&&Uo({authToken:u.token,url:l,username:u.username})},[l,u.token,u.username]);let[k,H,J]=Oe(),z=Vo("vuuShell",t,k,H),G=Xe({leftSidePanelLayout:r,appHeader:oe(Be,{layoutId:m.current,loginUrl:a,user:u,onNavigate:O,onSwitchTheme:_}),leftSidePanel:n});return Oo(X,{children:[oe($o,{layout:C,onLayoutChange:F,children:oe(Ao,{className:z,"data-mode":J,ref:d,...f,children:G})}),e]})};import{createContext as Jo,useContext as zo}from"react";import{jsx as ne}from"react/jsx-runtime";var Go={},re=Jo(Go),Zo=({children:e,context:t,inheritedContext:o})=>{let n={...o,...t};return ne(re.Provider,{value:n,children:e})},Ms=({children:e,value:t})=>ne(re.Consumer,{children:o=>ne(Zo,{context:t,inheritedContext:o,children:e})}),Hs=()=>zo(re);export{Xo as ConnectionStatusIcon,mo as DEFAULT_DENSITY,po as DEFAULT_THEME,fo as DEFAULT_THEME_MODE,ln as DensitySwitch,me as Feature,kn as LoginPanel,nr as SessionEditingForm,bs as Shell,Ms as ShellContextProvider,Q as ThemeContext,X as ThemeProvider,Ae as ThemeSwitch,An as getAuthDetailsFromCookies,bt as getAuthModeFromCookies,ge as logout,wt as redirectToLogin,Hs as useShellContext,Oe as useThemeAttributes};
1379
4
  //# sourceMappingURL=index.js.map