@vuu-ui/vuu-shell 0.6.24-debug → 0.6.25-debug
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/index.js +171 -88
- package/cjs/index.js.map +4 -4
- package/esm/index.js +160 -77
- package/esm/index.js.map +4 -4
- package/index.css +60 -0
- package/index.css.map +3 -3
- package/package.json +4 -4
- package/types/app-header/AppHeader.d.ts +4 -1
- package/types/connection-status/ConnectionStatusIcon.d.ts +11 -0
- package/types/connection-status/index.d.ts +1 -0
- package/types/density-switch/DensitySwitch.d.ts +8 -0
- package/types/density-switch/index.d.ts +1 -0
- package/types/index.d.ts +1 -0
package/cjs/index.js
CHANGED
|
@@ -30,6 +30,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
30
30
|
// src/index.ts
|
|
31
31
|
var src_exports = {};
|
|
32
32
|
__export(src_exports, {
|
|
33
|
+
ConnectionStatusIcon: () => ConnectionStatusIcon,
|
|
33
34
|
Feature: () => Feature,
|
|
34
35
|
LoginPanel: () => LoginPanel,
|
|
35
36
|
Shell: () => Shell,
|
|
@@ -42,14 +43,52 @@ __export(src_exports, {
|
|
|
42
43
|
});
|
|
43
44
|
module.exports = __toCommonJS(src_exports);
|
|
44
45
|
|
|
46
|
+
// src/connection-status/ConnectionStatusIcon.tsx
|
|
47
|
+
var import_react = __toESM(require("react"));
|
|
48
|
+
var import_classnames = __toESM(require("classnames"));
|
|
49
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
50
|
+
var ConnectionStatusIcon = ({ connectionStatus, className, element = "span", ...props }) => {
|
|
51
|
+
const [classBase5, setClassBase] = (0, import_react.useState)("vuuConnectingStatus");
|
|
52
|
+
(0, import_react.useEffect)(() => {
|
|
53
|
+
switch (connectionStatus) {
|
|
54
|
+
case "connected":
|
|
55
|
+
case "reconnected":
|
|
56
|
+
setClassBase("vuuActiveStatus");
|
|
57
|
+
break;
|
|
58
|
+
case "connecting":
|
|
59
|
+
setClassBase("vuuConnectingStatus");
|
|
60
|
+
break;
|
|
61
|
+
case "disconnected":
|
|
62
|
+
setClassBase("vuuDisconnectedStatus");
|
|
63
|
+
break;
|
|
64
|
+
default:
|
|
65
|
+
break;
|
|
66
|
+
}
|
|
67
|
+
}, [connectionStatus]);
|
|
68
|
+
const statusIcon = import_react.default.createElement(
|
|
69
|
+
element,
|
|
70
|
+
{
|
|
71
|
+
...props,
|
|
72
|
+
className: (0, import_classnames.default)("vuuStatus vuuIcon", classBase5, className)
|
|
73
|
+
}
|
|
74
|
+
);
|
|
75
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "vuuStatus-container salt-theme", children: [
|
|
76
|
+
statusIcon,
|
|
77
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "vuuStatus-text", children: [
|
|
78
|
+
"Status: ",
|
|
79
|
+
connectionStatus.toUpperCase()
|
|
80
|
+
] })
|
|
81
|
+
] }) });
|
|
82
|
+
};
|
|
83
|
+
|
|
45
84
|
// src/feature/Feature.tsx
|
|
46
|
-
var
|
|
85
|
+
var import_react3 = __toESM(require("react"));
|
|
47
86
|
var import_vuu_layout = require("@vuu-ui/vuu-layout");
|
|
48
87
|
|
|
49
88
|
// src/feature/ErrorBoundary.jsx
|
|
50
|
-
var
|
|
51
|
-
var
|
|
52
|
-
var ErrorBoundary = class extends
|
|
89
|
+
var import_react2 = __toESM(require("react"));
|
|
90
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
91
|
+
var ErrorBoundary = class extends import_react2.default.Component {
|
|
53
92
|
constructor(props) {
|
|
54
93
|
super(props);
|
|
55
94
|
this.state = { errorMessage: null };
|
|
@@ -62,9 +101,9 @@ var ErrorBoundary = class extends import_react.default.Component {
|
|
|
62
101
|
}
|
|
63
102
|
render() {
|
|
64
103
|
if (this.state.errorMessage) {
|
|
65
|
-
return /* @__PURE__ */ (0,
|
|
66
|
-
/* @__PURE__ */ (0,
|
|
67
|
-
/* @__PURE__ */ (0,
|
|
104
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
|
|
105
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("h1", { children: "Something went wrong." }),
|
|
106
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { children: this.state.errorMessage })
|
|
68
107
|
] });
|
|
69
108
|
}
|
|
70
109
|
return this.props.children;
|
|
@@ -72,8 +111,8 @@ var ErrorBoundary = class extends import_react.default.Component {
|
|
|
72
111
|
};
|
|
73
112
|
|
|
74
113
|
// src/feature/Loader.tsx
|
|
75
|
-
var
|
|
76
|
-
var Loader = () => /* @__PURE__ */ (0,
|
|
114
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
115
|
+
var Loader = () => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "hwLoader", children: "loading" });
|
|
77
116
|
|
|
78
117
|
// src/feature/css-module-loader.ts
|
|
79
118
|
var importCSS = async (path) => {
|
|
@@ -82,7 +121,7 @@ var importCSS = async (path) => {
|
|
|
82
121
|
};
|
|
83
122
|
|
|
84
123
|
// src/feature/Feature.tsx
|
|
85
|
-
var
|
|
124
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
86
125
|
function RawFeature({
|
|
87
126
|
url,
|
|
88
127
|
css,
|
|
@@ -97,25 +136,25 @@ function RawFeature({
|
|
|
97
136
|
];
|
|
98
137
|
});
|
|
99
138
|
}
|
|
100
|
-
const LazyFeature =
|
|
139
|
+
const LazyFeature = import_react3.default.lazy(() => import(
|
|
101
140
|
/* @vite-ignore */
|
|
102
141
|
url
|
|
103
142
|
));
|
|
104
|
-
return /* @__PURE__ */ (0,
|
|
143
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ErrorBoundary, { children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react3.Suspense, { fallback: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Loader, {}), children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(LazyFeature, { ...props, ...params }) }) });
|
|
105
144
|
}
|
|
106
|
-
var Feature =
|
|
145
|
+
var Feature = import_react3.default.memo(RawFeature);
|
|
107
146
|
Feature.displayName = "Feature";
|
|
108
147
|
(0, import_vuu_layout.registerComponent)("Feature", Feature, "view");
|
|
109
148
|
|
|
110
149
|
// src/login/LoginPanel.tsx
|
|
111
|
-
var
|
|
150
|
+
var import_react4 = require("react");
|
|
112
151
|
var import_core = require("@salt-ds/core");
|
|
113
152
|
var import_salt_lab = require("@heswell/salt-lab");
|
|
114
|
-
var
|
|
153
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
115
154
|
var classBase = "vuuLoginPanel";
|
|
116
155
|
var LoginPanel = ({ onSubmit }) => {
|
|
117
|
-
const [username, setUserName] = (0,
|
|
118
|
-
const [password, setPassword] = (0,
|
|
156
|
+
const [username, setUserName] = (0, import_react4.useState)("");
|
|
157
|
+
const [password, setPassword] = (0, import_react4.useState)("");
|
|
119
158
|
const login = () => {
|
|
120
159
|
onSubmit(username, password);
|
|
121
160
|
};
|
|
@@ -126,9 +165,9 @@ var LoginPanel = ({ onSubmit }) => {
|
|
|
126
165
|
setPassword(value);
|
|
127
166
|
};
|
|
128
167
|
const dataIsValid = username.trim() !== "" && password.trim() !== "";
|
|
129
|
-
return /* @__PURE__ */ (0,
|
|
130
|
-
/* @__PURE__ */ (0,
|
|
131
|
-
/* @__PURE__ */ (0,
|
|
168
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: classBase, children: [
|
|
169
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_salt_lab.FormField, { label: "Username", style: { width: 200 }, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_salt_lab.Input, { value: username, id: "text-username", onChange: handleUsername }) }),
|
|
170
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_salt_lab.FormField, { label: "Password", style: { width: 200 }, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
132
171
|
import_salt_lab.Input,
|
|
133
172
|
{
|
|
134
173
|
type: "password",
|
|
@@ -137,7 +176,7 @@ var LoginPanel = ({ onSubmit }) => {
|
|
|
137
176
|
onChange: handlePassword
|
|
138
177
|
}
|
|
139
178
|
) }),
|
|
140
|
-
/* @__PURE__ */ (0,
|
|
179
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
141
180
|
import_core.Button,
|
|
142
181
|
{
|
|
143
182
|
className: `${classBase}-login`,
|
|
@@ -168,16 +207,16 @@ var logout = (loginUrl) => {
|
|
|
168
207
|
|
|
169
208
|
// src/shell.tsx
|
|
170
209
|
var import_vuu_data = require("@vuu-ui/vuu-data");
|
|
171
|
-
var
|
|
210
|
+
var import_react11 = require("react");
|
|
172
211
|
|
|
173
212
|
// src/use-layout-config.js
|
|
174
|
-
var
|
|
213
|
+
var import_react5 = require("react");
|
|
175
214
|
var useLayoutConfig = (user, defaultLayout) => {
|
|
176
|
-
const [layout, _setLayout] = (0,
|
|
215
|
+
const [layout, _setLayout] = (0, import_react5.useState)(defaultLayout);
|
|
177
216
|
const setLayout = (layout2) => {
|
|
178
217
|
_setLayout(layout2);
|
|
179
218
|
};
|
|
180
|
-
const load = (0,
|
|
219
|
+
const load = (0, import_react5.useCallback)(
|
|
181
220
|
async (id = "latest") => {
|
|
182
221
|
fetch(`api/vui/${user.username}/${id}`, {}).then((response) => {
|
|
183
222
|
return response.ok ? response.json() : defaultLayout;
|
|
@@ -187,10 +226,10 @@ var useLayoutConfig = (user, defaultLayout) => {
|
|
|
187
226
|
},
|
|
188
227
|
[defaultLayout, user.username]
|
|
189
228
|
);
|
|
190
|
-
(0,
|
|
229
|
+
(0, import_react5.useEffect)(() => {
|
|
191
230
|
load();
|
|
192
231
|
}, [load]);
|
|
193
|
-
const saveData = (0,
|
|
232
|
+
const saveData = (0, import_react5.useCallback)(
|
|
194
233
|
(data) => {
|
|
195
234
|
fetch(`api/vui/${user.username}`, {
|
|
196
235
|
method: "POST",
|
|
@@ -204,7 +243,7 @@ var useLayoutConfig = (user, defaultLayout) => {
|
|
|
204
243
|
},
|
|
205
244
|
[defaultLayout, user]
|
|
206
245
|
);
|
|
207
|
-
const loadLayoutById = (0,
|
|
246
|
+
const loadLayoutById = (0, import_react5.useCallback)(
|
|
208
247
|
(id) => {
|
|
209
248
|
load(id);
|
|
210
249
|
},
|
|
@@ -215,10 +254,10 @@ var useLayoutConfig = (user, defaultLayout) => {
|
|
|
215
254
|
var use_layout_config_default = useLayoutConfig;
|
|
216
255
|
|
|
217
256
|
// src/ShellContextProvider.tsx
|
|
218
|
-
var
|
|
219
|
-
var
|
|
257
|
+
var import_react6 = require("react");
|
|
258
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
220
259
|
var defaultConfig = {};
|
|
221
|
-
var ShellContext = (0,
|
|
260
|
+
var ShellContext = (0, import_react6.createContext)(defaultConfig);
|
|
222
261
|
var Provider = ({
|
|
223
262
|
children,
|
|
224
263
|
context,
|
|
@@ -228,24 +267,24 @@ var Provider = ({
|
|
|
228
267
|
...inheritedContext,
|
|
229
268
|
...context
|
|
230
269
|
};
|
|
231
|
-
return /* @__PURE__ */ (0,
|
|
270
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(ShellContext.Provider, { value: mergedContext, children });
|
|
232
271
|
};
|
|
233
272
|
var ShellContextProvider = ({
|
|
234
273
|
children,
|
|
235
274
|
value
|
|
236
275
|
}) => {
|
|
237
|
-
return /* @__PURE__ */ (0,
|
|
276
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(ShellContext.Consumer, { children: (context) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Provider, { context: value, inheritedContext: context, children }) });
|
|
238
277
|
};
|
|
239
278
|
var useShellContext = () => {
|
|
240
|
-
return (0,
|
|
279
|
+
return (0, import_react6.useContext)(ShellContext);
|
|
241
280
|
};
|
|
242
281
|
|
|
243
282
|
// src/shell.tsx
|
|
244
|
-
var
|
|
283
|
+
var import_classnames5 = __toESM(require("classnames"));
|
|
245
284
|
var import_vuu_layout2 = require("@vuu-ui/vuu-layout");
|
|
246
285
|
|
|
247
286
|
// src/app-header/AppHeader.tsx
|
|
248
|
-
var
|
|
287
|
+
var import_react10 = require("react");
|
|
249
288
|
|
|
250
289
|
// src/user-profile/UserProfile.tsx
|
|
251
290
|
var import_core3 = require("@salt-ds/core");
|
|
@@ -257,7 +296,7 @@ var import_vuu_utils2 = require("@vuu-ui/vuu-utils");
|
|
|
257
296
|
var import_salt_lab2 = require("@heswell/salt-lab");
|
|
258
297
|
var import_core2 = require("@salt-ds/core");
|
|
259
298
|
var import_icons = require("@salt-ds/icons");
|
|
260
|
-
var
|
|
299
|
+
var import_react7 = require("react");
|
|
261
300
|
|
|
262
301
|
// src/get-layout-history.ts
|
|
263
302
|
var getLayoutHistory = async (user) => {
|
|
@@ -270,16 +309,16 @@ var getLayoutHistory = async (user) => {
|
|
|
270
309
|
};
|
|
271
310
|
|
|
272
311
|
// src/user-profile/UserPanel.tsx
|
|
273
|
-
var
|
|
312
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
274
313
|
var byLastUpdate = ({ lastUpdate: l1 }, { lastUpdate: l2 }) => {
|
|
275
314
|
return l2 === l1 ? 0 : l2 < l1 ? -1 : 1;
|
|
276
315
|
};
|
|
277
316
|
var HistoryListItem = (props) => {
|
|
278
|
-
return /* @__PURE__ */ (0,
|
|
317
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_salt_lab2.ListItem, { ...props });
|
|
279
318
|
};
|
|
280
|
-
var UserPanel = (0,
|
|
281
|
-
const [history, setHistory] = (0,
|
|
282
|
-
(0,
|
|
319
|
+
var UserPanel = (0, import_react7.forwardRef)(function UserPanel2({ loginUrl, onNavigate, user, layoutId = "latest" }, forwardedRef) {
|
|
320
|
+
const [history, setHistory] = (0, import_react7.useState)([]);
|
|
321
|
+
(0, import_react7.useEffect)(() => {
|
|
283
322
|
async function getHistory() {
|
|
284
323
|
const history2 = await getLayoutHistory(user);
|
|
285
324
|
const sortedHistory = history2.filter((item) => item.id !== "latest").sort(byLastUpdate).map(({ id, lastUpdate }) => ({
|
|
@@ -292,7 +331,7 @@ var UserPanel = (0, import_react6.forwardRef)(function UserPanel2({ loginUrl, on
|
|
|
292
331
|
}
|
|
293
332
|
getHistory();
|
|
294
333
|
}, [user]);
|
|
295
|
-
const handleHisorySelected = (0,
|
|
334
|
+
const handleHisorySelected = (0, import_react7.useCallback)(
|
|
296
335
|
(evt, selected2) => {
|
|
297
336
|
if (selected2) {
|
|
298
337
|
onNavigate(selected2.id);
|
|
@@ -300,12 +339,12 @@ var UserPanel = (0, import_react6.forwardRef)(function UserPanel2({ loginUrl, on
|
|
|
300
339
|
},
|
|
301
340
|
[onNavigate]
|
|
302
341
|
);
|
|
303
|
-
const handleLogout = (0,
|
|
342
|
+
const handleLogout = (0, import_react7.useCallback)(() => {
|
|
304
343
|
logout(loginUrl);
|
|
305
344
|
}, [loginUrl]);
|
|
306
345
|
const selected = history.length === 0 ? null : layoutId === "latest" ? history[0] : history.find((i) => i.id === layoutId);
|
|
307
|
-
return /* @__PURE__ */ (0,
|
|
308
|
-
/* @__PURE__ */ (0,
|
|
346
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "vuuUserPanel", ref: forwardedRef, children: [
|
|
347
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
309
348
|
import_salt_lab2.List,
|
|
310
349
|
{
|
|
311
350
|
ListItem: HistoryListItem,
|
|
@@ -315,15 +354,15 @@ var UserPanel = (0, import_react6.forwardRef)(function UserPanel2({ loginUrl, on
|
|
|
315
354
|
source: history
|
|
316
355
|
}
|
|
317
356
|
),
|
|
318
|
-
/* @__PURE__ */ (0,
|
|
319
|
-
/* @__PURE__ */ (0,
|
|
357
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "vuuUserPanel-buttonBar", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_core2.Button, { "aria-label": "logout", onClick: handleLogout, children: [
|
|
358
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_icons.ExportIcon, {}),
|
|
320
359
|
" Logout"
|
|
321
360
|
] }) })
|
|
322
361
|
] });
|
|
323
362
|
});
|
|
324
363
|
|
|
325
364
|
// src/user-profile/UserProfile.tsx
|
|
326
|
-
var
|
|
365
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
327
366
|
var UserProfile = ({
|
|
328
367
|
layoutId,
|
|
329
368
|
loginUrl,
|
|
@@ -333,9 +372,9 @@ var UserProfile = ({
|
|
|
333
372
|
const handleNavigate = (id) => {
|
|
334
373
|
onNavigate(id);
|
|
335
374
|
};
|
|
336
|
-
return /* @__PURE__ */ (0,
|
|
337
|
-
/* @__PURE__ */ (0,
|
|
338
|
-
/* @__PURE__ */ (0,
|
|
375
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_salt_lab3.DropdownBase, { className: "vuuUserProfile", placement: "bottom-end", children: [
|
|
376
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_core3.Button, { variant: "secondary", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_icons2.UserSolidIcon, {}) }),
|
|
377
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
339
378
|
UserPanel,
|
|
340
379
|
{
|
|
341
380
|
layoutId,
|
|
@@ -349,10 +388,10 @@ var UserProfile = ({
|
|
|
349
388
|
|
|
350
389
|
// src/theme-switch/ThemeSwitch.tsx
|
|
351
390
|
var import_salt_lab4 = require("@heswell/salt-lab");
|
|
352
|
-
var
|
|
391
|
+
var import_classnames2 = __toESM(require("classnames"));
|
|
353
392
|
var import_core4 = require("@salt-ds/core");
|
|
354
|
-
var
|
|
355
|
-
var
|
|
393
|
+
var import_react8 = require("react");
|
|
394
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
356
395
|
var classBase2 = "vuuThemeSwitch";
|
|
357
396
|
var modes = ["light", "dark"];
|
|
358
397
|
var ThemeSwitch = ({
|
|
@@ -369,7 +408,7 @@ var ThemeSwitch = ({
|
|
|
369
408
|
state: "mode"
|
|
370
409
|
});
|
|
371
410
|
const selectedIndex = modes.indexOf(mode);
|
|
372
|
-
const handleChangeSecondary = (0,
|
|
411
|
+
const handleChangeSecondary = (0, import_react8.useCallback)(
|
|
373
412
|
(_evt, index) => {
|
|
374
413
|
const mode2 = modes[index];
|
|
375
414
|
setMode(mode2);
|
|
@@ -377,8 +416,8 @@ var ThemeSwitch = ({
|
|
|
377
416
|
},
|
|
378
417
|
[onChange, setMode]
|
|
379
418
|
);
|
|
380
|
-
const className = (0,
|
|
381
|
-
return /* @__PURE__ */ (0,
|
|
419
|
+
const className = (0, import_classnames2.default)(classBase2, classNameProp);
|
|
420
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
382
421
|
import_salt_lab4.ToggleButtonGroup,
|
|
383
422
|
{
|
|
384
423
|
className,
|
|
@@ -386,7 +425,7 @@ var ThemeSwitch = ({
|
|
|
386
425
|
onChange: handleChangeSecondary,
|
|
387
426
|
selectedIndex,
|
|
388
427
|
children: [
|
|
389
|
-
/* @__PURE__ */ (0,
|
|
428
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
390
429
|
import_salt_lab4.ToggleButton,
|
|
391
430
|
{
|
|
392
431
|
"aria-label": "alert",
|
|
@@ -394,7 +433,7 @@ var ThemeSwitch = ({
|
|
|
394
433
|
"data-icon": "light"
|
|
395
434
|
}
|
|
396
435
|
),
|
|
397
|
-
/* @__PURE__ */ (0,
|
|
436
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
398
437
|
import_salt_lab4.ToggleButton,
|
|
399
438
|
{
|
|
400
439
|
"aria-label": "home",
|
|
@@ -408,9 +447,39 @@ var ThemeSwitch = ({
|
|
|
408
447
|
};
|
|
409
448
|
|
|
410
449
|
// src/app-header/AppHeader.tsx
|
|
411
|
-
var
|
|
412
|
-
|
|
413
|
-
|
|
450
|
+
var import_classnames4 = __toESM(require("classnames"));
|
|
451
|
+
|
|
452
|
+
// src/density-switch/DensitySwitch.tsx
|
|
453
|
+
var import_salt_lab5 = require("@heswell/salt-lab");
|
|
454
|
+
var import_core5 = require("@salt-ds/core");
|
|
455
|
+
var import_react9 = require("react");
|
|
456
|
+
var import_classnames3 = __toESM(require("classnames"));
|
|
457
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
458
|
+
var classBase3 = "vuuDensitySwitch";
|
|
459
|
+
var densities = ["high", "medium", "low", "touch"];
|
|
460
|
+
var DensitySwitch = ({
|
|
461
|
+
className: classNameProp,
|
|
462
|
+
defaultDensity = import_core5.DEFAULT_DENSITY,
|
|
463
|
+
onDensityChange
|
|
464
|
+
}) => {
|
|
465
|
+
const handleSelectionChange = (0, import_react9.useCallback)((_event, selectedItem) => {
|
|
466
|
+
onDensityChange(selectedItem);
|
|
467
|
+
}, [onDensityChange]);
|
|
468
|
+
const className = (0, import_classnames3.default)(classBase3, classNameProp);
|
|
469
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
470
|
+
import_salt_lab5.Dropdown,
|
|
471
|
+
{
|
|
472
|
+
className,
|
|
473
|
+
source: densities,
|
|
474
|
+
defaultSelected: defaultDensity,
|
|
475
|
+
onSelectionChange: handleSelectionChange
|
|
476
|
+
}
|
|
477
|
+
);
|
|
478
|
+
};
|
|
479
|
+
|
|
480
|
+
// src/app-header/AppHeader.tsx
|
|
481
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
482
|
+
var classBase4 = "vuuAppHeader";
|
|
414
483
|
var AppHeader = ({
|
|
415
484
|
className: classNameProp,
|
|
416
485
|
layoutId,
|
|
@@ -418,17 +487,24 @@ var AppHeader = ({
|
|
|
418
487
|
onNavigate,
|
|
419
488
|
onSwitchTheme,
|
|
420
489
|
themeMode = "light",
|
|
490
|
+
onDensitySwitch,
|
|
491
|
+
density = "medium",
|
|
421
492
|
user,
|
|
422
493
|
...htmlAttributes
|
|
423
494
|
}) => {
|
|
424
|
-
const className = (0,
|
|
425
|
-
const handleSwitchTheme = (0,
|
|
495
|
+
const className = (0, import_classnames4.default)(classBase4, classNameProp, `salt-density-${density}`);
|
|
496
|
+
const handleSwitchTheme = (0, import_react10.useCallback)(
|
|
426
497
|
(mode) => onSwitchTheme == null ? void 0 : onSwitchTheme(mode),
|
|
427
498
|
[onSwitchTheme]
|
|
428
499
|
);
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
500
|
+
const handleDensitySwitch = (0, import_react10.useCallback)(
|
|
501
|
+
(density2) => onDensitySwitch == null ? void 0 : onDensitySwitch(density2),
|
|
502
|
+
[onDensitySwitch]
|
|
503
|
+
);
|
|
504
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("header", { className, ...htmlAttributes, children: [
|
|
505
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(ThemeSwitch, { defaultMode: themeMode, onChange: handleSwitchTheme }),
|
|
506
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(DensitySwitch, { defaultDensity: density, onDensityChange: handleDensitySwitch }),
|
|
507
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
432
508
|
UserProfile,
|
|
433
509
|
{
|
|
434
510
|
layoutId,
|
|
@@ -441,7 +517,7 @@ var AppHeader = ({
|
|
|
441
517
|
};
|
|
442
518
|
|
|
443
519
|
// src/shell.tsx
|
|
444
|
-
var
|
|
520
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
445
521
|
var warningLayout = {
|
|
446
522
|
type: "View",
|
|
447
523
|
props: {
|
|
@@ -466,26 +542,32 @@ var Shell = ({
|
|
|
466
542
|
user,
|
|
467
543
|
...htmlAttributes
|
|
468
544
|
}) => {
|
|
469
|
-
const rootRef = (0,
|
|
470
|
-
const [density] = (0,
|
|
471
|
-
const paletteView = (0,
|
|
472
|
-
const [open, setOpen] = (0,
|
|
473
|
-
const layoutId = (0,
|
|
545
|
+
const rootRef = (0, import_react11.useRef)(null);
|
|
546
|
+
const [density, setDensity] = (0, import_react11.useState)("medium");
|
|
547
|
+
const paletteView = (0, import_react11.useRef)(null);
|
|
548
|
+
const [open, setOpen] = (0, import_react11.useState)(false);
|
|
549
|
+
const layoutId = (0, import_react11.useRef)("latest");
|
|
474
550
|
const [layout, setLayoutConfig, loadLayoutById] = use_layout_config_default(
|
|
475
551
|
user,
|
|
476
552
|
defaultLayout
|
|
477
553
|
);
|
|
478
|
-
const handleLayoutChange = (0,
|
|
554
|
+
const handleLayoutChange = (0, import_react11.useCallback)(
|
|
479
555
|
(layout2) => {
|
|
480
556
|
setLayoutConfig(layout2);
|
|
481
557
|
},
|
|
482
558
|
[setLayoutConfig]
|
|
483
559
|
);
|
|
484
|
-
const handleSwitchTheme = (0,
|
|
560
|
+
const handleSwitchTheme = (0, import_react11.useCallback)((mode) => {
|
|
485
561
|
if (rootRef.current) {
|
|
486
562
|
rootRef.current.dataset.mode = mode;
|
|
487
563
|
}
|
|
488
564
|
}, []);
|
|
565
|
+
const handleDensitySwitch = (0, import_react11.useCallback)(
|
|
566
|
+
(density2) => {
|
|
567
|
+
setDensity(density2);
|
|
568
|
+
},
|
|
569
|
+
[setDensity]
|
|
570
|
+
);
|
|
489
571
|
const handleDrawerClick = (e) => {
|
|
490
572
|
var _a;
|
|
491
573
|
const target = e.target;
|
|
@@ -493,14 +575,14 @@ var Shell = ({
|
|
|
493
575
|
setOpen(!open);
|
|
494
576
|
}
|
|
495
577
|
};
|
|
496
|
-
const handleNavigate = (0,
|
|
578
|
+
const handleNavigate = (0, import_react11.useCallback)(
|
|
497
579
|
(id) => {
|
|
498
580
|
layoutId.current = id;
|
|
499
581
|
loadLayoutById(id);
|
|
500
582
|
},
|
|
501
583
|
[loadLayoutById]
|
|
502
584
|
);
|
|
503
|
-
(0,
|
|
585
|
+
(0, import_react11.useEffect)(() => {
|
|
504
586
|
if (serverUrl && user.token) {
|
|
505
587
|
(0, import_vuu_data.connectToServer)(serverUrl, user.token);
|
|
506
588
|
}
|
|
@@ -509,7 +591,7 @@ var Shell = ({
|
|
|
509
591
|
const drawers = [];
|
|
510
592
|
if (leftSidePanel) {
|
|
511
593
|
drawers.push(
|
|
512
|
-
/* @__PURE__ */ (0,
|
|
594
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
513
595
|
import_vuu_layout2.Drawer,
|
|
514
596
|
{
|
|
515
597
|
onClick: handleDrawerClick,
|
|
@@ -519,7 +601,7 @@ var Shell = ({
|
|
|
519
601
|
peekaboo: true,
|
|
520
602
|
sizeOpen: 200,
|
|
521
603
|
toggleButton: "end",
|
|
522
|
-
children: /* @__PURE__ */ (0,
|
|
604
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
523
605
|
import_vuu_layout2.View,
|
|
524
606
|
{
|
|
525
607
|
className: "vuuShell-palette",
|
|
@@ -537,7 +619,7 @@ var Shell = ({
|
|
|
537
619
|
}
|
|
538
620
|
return drawers;
|
|
539
621
|
};
|
|
540
|
-
const className = (0,
|
|
622
|
+
const className = (0, import_classnames5.default)(
|
|
541
623
|
"vuuShell",
|
|
542
624
|
classNameProp,
|
|
543
625
|
"salt-theme",
|
|
@@ -545,32 +627,33 @@ var Shell = ({
|
|
|
545
627
|
);
|
|
546
628
|
return (
|
|
547
629
|
// ShellContext TBD
|
|
548
|
-
/* @__PURE__ */ (0,
|
|
549
|
-
/* @__PURE__ */ (0,
|
|
630
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(ShellContextProvider, { value: void 0, children: [
|
|
631
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_vuu_layout2.LayoutProvider, { layout, onLayoutChange: handleLayoutChange, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
550
632
|
import_vuu_layout2.DraggableLayout,
|
|
551
633
|
{
|
|
552
634
|
className,
|
|
553
635
|
"data-mode": "light",
|
|
554
636
|
ref: rootRef,
|
|
555
637
|
...htmlAttributes,
|
|
556
|
-
children: /* @__PURE__ */ (0,
|
|
638
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
557
639
|
import_vuu_layout2.Flexbox,
|
|
558
640
|
{
|
|
559
641
|
className: "App",
|
|
560
642
|
style: { flexDirection: "column", height: "100%", width: "100%" },
|
|
561
643
|
children: [
|
|
562
|
-
/* @__PURE__ */ (0,
|
|
644
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
563
645
|
AppHeader,
|
|
564
646
|
{
|
|
565
647
|
layoutId: layoutId.current,
|
|
566
648
|
loginUrl,
|
|
567
649
|
user,
|
|
568
650
|
onNavigate: handleNavigate,
|
|
569
|
-
onSwitchTheme: handleSwitchTheme
|
|
651
|
+
onSwitchTheme: handleSwitchTheme,
|
|
652
|
+
onDensitySwitch: handleDensitySwitch
|
|
570
653
|
}
|
|
571
654
|
),
|
|
572
|
-
/* @__PURE__ */ (0,
|
|
573
|
-
/* @__PURE__ */ (0,
|
|
655
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_vuu_layout2.Chest, { style: { flex: 1 }, children: getDrawers().concat(
|
|
656
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
574
657
|
import_vuu_layout2.DraggableLayout,
|
|
575
658
|
{
|
|
576
659
|
dropTarget: true,
|