@vuu-ui/vuu-shell 0.7.6-debug → 0.8.0-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 +520 -226
- package/cjs/index.js.map +4 -4
- package/esm/index.js +513 -220
- package/esm/index.js.map +4 -4
- package/index.css +148 -1
- package/index.css.map +3 -3
- package/package.json +4 -4
- package/types/density-switch/DensitySwitch.d.ts +2 -2
- package/types/left-nav/LeftNav.d.ts +9 -0
- package/types/left-nav/index.d.ts +1 -0
- package/types/login/login-utils.d.ts +1 -1
- package/types/session-editing-form/SessionEditingForm.d.ts +2 -2
- package/types/shell-layouts/context-panel/ContextPanel.d.ts +10 -0
- package/types/shell-layouts/context-panel/index.d.ts +1 -0
- package/types/shell-layouts/index.d.ts +1 -0
- package/types/shell-layouts/useFullHeightLeftPanel.d.ts +4 -0
- package/types/shell-layouts/useInlayLeftPanel.d.ts +5 -0
- package/types/shell-layouts/useShellLayout.d.ts +7 -0
- package/types/shell.d.ts +3 -2
- package/types/theme-provider/ThemeProvider.d.ts +6 -4
- package/LICENSE +0 -201
package/cjs/index.js
CHANGED
|
@@ -46,7 +46,8 @@ __export(src_exports, {
|
|
|
46
46
|
getAuthDetailsFromCookies: () => getAuthDetailsFromCookies,
|
|
47
47
|
logout: () => logout,
|
|
48
48
|
redirectToLogin: () => redirectToLogin,
|
|
49
|
-
useShellContext: () => useShellContext
|
|
49
|
+
useShellContext: () => useShellContext,
|
|
50
|
+
useThemeAttributes: () => useThemeAttributes
|
|
50
51
|
});
|
|
51
52
|
module.exports = __toCommonJS(src_exports);
|
|
52
53
|
|
|
@@ -55,7 +56,7 @@ var import_react = __toESM(require("react"));
|
|
|
55
56
|
var import_classnames = __toESM(require("classnames"));
|
|
56
57
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
57
58
|
var ConnectionStatusIcon = ({ connectionStatus, className, element = "span", ...props }) => {
|
|
58
|
-
const [
|
|
59
|
+
const [classBase8, setClassBase] = (0, import_react.useState)("vuuConnectingStatus");
|
|
59
60
|
(0, import_react.useEffect)(() => {
|
|
60
61
|
switch (connectionStatus) {
|
|
61
62
|
case "connected":
|
|
@@ -76,7 +77,7 @@ var ConnectionStatusIcon = ({ connectionStatus, className, element = "span", ...
|
|
|
76
77
|
element,
|
|
77
78
|
{
|
|
78
79
|
...props,
|
|
79
|
-
className: (0, import_classnames.default)("vuuStatus vuuIcon",
|
|
80
|
+
className: (0, import_classnames.default)("vuuStatus vuuIcon", classBase8, className)
|
|
80
81
|
}
|
|
81
82
|
);
|
|
82
83
|
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: [
|
|
@@ -99,11 +100,14 @@ var DEFAULT_DENSITY = "high";
|
|
|
99
100
|
var DensitySwitch = ({
|
|
100
101
|
className: classNameProp,
|
|
101
102
|
defaultDensity = DEFAULT_DENSITY,
|
|
102
|
-
|
|
103
|
+
onChange
|
|
103
104
|
}) => {
|
|
104
|
-
const handleSelectionChange = (0, import_react2.useCallback)(
|
|
105
|
-
|
|
106
|
-
|
|
105
|
+
const handleSelectionChange = (0, import_react2.useCallback)(
|
|
106
|
+
(_event, selectedItem) => {
|
|
107
|
+
onChange(selectedItem);
|
|
108
|
+
},
|
|
109
|
+
[onChange]
|
|
110
|
+
);
|
|
107
111
|
const className = (0, import_classnames2.default)(classBase, classNameProp);
|
|
108
112
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
109
113
|
import_salt_lab.Dropdown,
|
|
@@ -400,9 +404,6 @@ var SessionEditingForm = ({
|
|
|
400
404
|
(evt) => {
|
|
401
405
|
const [field, value] = getFieldNameAndValue(evt);
|
|
402
406
|
const { type } = getField(fields, field);
|
|
403
|
-
console.log("BLUR", {
|
|
404
|
-
keyField
|
|
405
|
-
});
|
|
406
407
|
const rowKey = values == null ? void 0 : values[keyField];
|
|
407
408
|
const typedValue = getTypedValue(value, type, true);
|
|
408
409
|
if (typeof rowKey === "string") {
|
|
@@ -416,14 +417,26 @@ var SessionEditingForm = ({
|
|
|
416
417
|
},
|
|
417
418
|
[dataSource, fields, keyField, values]
|
|
418
419
|
);
|
|
420
|
+
const applyAction = (0, import_react6.useCallback)(
|
|
421
|
+
(action) => {
|
|
422
|
+
if (typeof action === "object" && action !== null) {
|
|
423
|
+
if ("type" in action && action.type === "CLOSE_DIALOG_ACTION") {
|
|
424
|
+
onClose();
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
},
|
|
428
|
+
[onClose]
|
|
429
|
+
);
|
|
419
430
|
const handleSubmit = (0, import_react6.useCallback)(async () => {
|
|
420
431
|
const response = await dataSource.menuRpcCall({
|
|
421
432
|
type: "VP_EDIT_SUBMIT_FORM_RPC"
|
|
422
433
|
});
|
|
423
434
|
if ((0, import_vuu_data.isErrorResponse)(response)) {
|
|
424
435
|
setErrorMessage(response.error);
|
|
436
|
+
} else if ((0, import_vuu_data.hasAction)(response)) {
|
|
437
|
+
applyAction(response.action);
|
|
425
438
|
}
|
|
426
|
-
}, [dataSource]);
|
|
439
|
+
}, [applyAction, dataSource]);
|
|
427
440
|
const handleKeyDown = (0, import_react6.useCallback)(
|
|
428
441
|
(evt) => {
|
|
429
442
|
if (evt.key === "Enter" && dataStatusRef.current === Status.changed) {
|
|
@@ -463,12 +476,18 @@ var SessionEditingForm = ({
|
|
|
463
476
|
if (firstInput) {
|
|
464
477
|
setTimeout(() => {
|
|
465
478
|
firstInput.focus();
|
|
466
|
-
console.log("select item");
|
|
467
479
|
firstInput.select();
|
|
468
480
|
}, 100);
|
|
469
481
|
}
|
|
470
482
|
}
|
|
471
483
|
}, []);
|
|
484
|
+
(0, import_react6.useEffect)(() => {
|
|
485
|
+
return () => {
|
|
486
|
+
if (dataSource) {
|
|
487
|
+
dataSource.unsubscribe();
|
|
488
|
+
}
|
|
489
|
+
};
|
|
490
|
+
}, [dataSource]);
|
|
472
491
|
const isDirty = dataStatusRef.current === Status.changed;
|
|
473
492
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { ...htmlAttributes, className: (0, import_classnames3.default)(classBase3, className), children: [
|
|
474
493
|
errorMessage ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
@@ -522,37 +541,11 @@ var SessionEditingForm = ({
|
|
|
522
541
|
|
|
523
542
|
// src/shell.tsx
|
|
524
543
|
var import_vuu_data2 = require("@vuu-ui/vuu-data");
|
|
525
|
-
var
|
|
526
|
-
var
|
|
527
|
-
|
|
528
|
-
// src/ShellContextProvider.tsx
|
|
529
|
-
var import_react7 = require("react");
|
|
530
|
-
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
531
|
-
var defaultConfig = {};
|
|
532
|
-
var ShellContext = (0, import_react7.createContext)(defaultConfig);
|
|
533
|
-
var Provider = ({
|
|
534
|
-
children,
|
|
535
|
-
context,
|
|
536
|
-
inheritedContext
|
|
537
|
-
}) => {
|
|
538
|
-
const mergedContext = {
|
|
539
|
-
...inheritedContext,
|
|
540
|
-
...context
|
|
541
|
-
};
|
|
542
|
-
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(ShellContext.Provider, { value: mergedContext, children });
|
|
543
|
-
};
|
|
544
|
-
var ShellContextProvider = ({
|
|
545
|
-
children,
|
|
546
|
-
value
|
|
547
|
-
}) => {
|
|
548
|
-
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(ShellContext.Consumer, { children: (context) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Provider, { context: value, inheritedContext: context, children }) });
|
|
549
|
-
};
|
|
550
|
-
var useShellContext = () => {
|
|
551
|
-
return (0, import_react7.useContext)(ShellContext);
|
|
552
|
-
};
|
|
544
|
+
var import_classnames9 = __toESM(require("classnames"));
|
|
545
|
+
var import_react15 = require("react");
|
|
553
546
|
|
|
554
547
|
// src/layout-config/use-layout-config.ts
|
|
555
|
-
var
|
|
548
|
+
var import_react7 = require("react");
|
|
556
549
|
|
|
557
550
|
// src/layout-config/local-config.ts
|
|
558
551
|
var loadLocalConfig = (saveUrl, user, id = "latest") => new Promise((resolve, reject) => {
|
|
@@ -611,47 +604,39 @@ var useLayoutConfig = ({
|
|
|
611
604
|
user,
|
|
612
605
|
defaultLayout
|
|
613
606
|
}) => {
|
|
614
|
-
const [layout, _setLayout] = (0,
|
|
607
|
+
const [layout, _setLayout] = (0, import_react7.useState)(defaultLayout);
|
|
615
608
|
const usingRemote = saveLocation === "remote";
|
|
616
609
|
const loadConfig = usingRemote ? loadRemoteConfig : loadLocalConfig;
|
|
617
610
|
const saveConfig = usingRemote ? saveRemoteConfig : saveLocalConfig;
|
|
618
|
-
const
|
|
619
|
-
_setLayout(layout2);
|
|
620
|
-
};
|
|
621
|
-
const load = (0, import_react8.useCallback)(
|
|
611
|
+
const load = (0, import_react7.useCallback)(
|
|
622
612
|
async (id = "latest") => {
|
|
623
613
|
try {
|
|
624
614
|
const layout2 = await loadConfig(saveUrl, user, id);
|
|
625
|
-
|
|
615
|
+
_setLayout(layout2);
|
|
626
616
|
} catch {
|
|
627
|
-
|
|
617
|
+
_setLayout(defaultLayout);
|
|
628
618
|
}
|
|
629
619
|
},
|
|
630
620
|
[defaultLayout, loadConfig, saveUrl, user]
|
|
631
621
|
);
|
|
632
|
-
(0,
|
|
622
|
+
(0, import_react7.useEffect)(() => {
|
|
633
623
|
load();
|
|
634
624
|
}, [load]);
|
|
635
|
-
const saveData = (0,
|
|
625
|
+
const saveData = (0, import_react7.useCallback)(
|
|
636
626
|
(data) => {
|
|
637
627
|
saveConfig(saveUrl, user, data);
|
|
638
628
|
},
|
|
639
629
|
[saveConfig, saveUrl, user]
|
|
640
630
|
);
|
|
641
|
-
const loadLayoutById = (0,
|
|
642
|
-
(id) => {
|
|
643
|
-
load(id);
|
|
644
|
-
},
|
|
645
|
-
[load]
|
|
646
|
-
);
|
|
631
|
+
const loadLayoutById = (0, import_react7.useCallback)((id) => load(id), [load]);
|
|
647
632
|
return [layout, saveData, loadLayoutById];
|
|
648
633
|
};
|
|
649
634
|
|
|
650
635
|
// src/shell.tsx
|
|
651
|
-
var
|
|
636
|
+
var import_vuu_layout6 = require("@vuu-ui/vuu-layout");
|
|
652
637
|
|
|
653
638
|
// src/app-header/AppHeader.tsx
|
|
654
|
-
var
|
|
639
|
+
var import_react10 = require("react");
|
|
655
640
|
|
|
656
641
|
// src/user-profile/UserProfile.tsx
|
|
657
642
|
var import_core5 = require("@salt-ds/core");
|
|
@@ -663,7 +648,7 @@ var import_vuu_utils3 = require("@vuu-ui/vuu-utils");
|
|
|
663
648
|
var import_salt_lab3 = require("@heswell/salt-lab");
|
|
664
649
|
var import_core4 = require("@salt-ds/core");
|
|
665
650
|
var import_icons = require("@salt-ds/icons");
|
|
666
|
-
var
|
|
651
|
+
var import_react8 = require("react");
|
|
667
652
|
|
|
668
653
|
// src/get-layout-history.ts
|
|
669
654
|
var getLayoutHistory = async (user) => {
|
|
@@ -676,16 +661,16 @@ var getLayoutHistory = async (user) => {
|
|
|
676
661
|
};
|
|
677
662
|
|
|
678
663
|
// src/user-profile/UserPanel.tsx
|
|
679
|
-
var
|
|
664
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
680
665
|
var byLastUpdate = ({ lastUpdate: l1 }, { lastUpdate: l2 }) => {
|
|
681
666
|
return l2 === l1 ? 0 : l2 < l1 ? -1 : 1;
|
|
682
667
|
};
|
|
683
668
|
var HistoryListItem = (props) => {
|
|
684
|
-
return /* @__PURE__ */ (0,
|
|
669
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_salt_lab3.ListItem, { ...props });
|
|
685
670
|
};
|
|
686
|
-
var UserPanel = (0,
|
|
687
|
-
const [history, setHistory] = (0,
|
|
688
|
-
(0,
|
|
671
|
+
var UserPanel = (0, import_react8.forwardRef)(function UserPanel2({ loginUrl, onNavigate, user, layoutId = "latest" }, forwardedRef) {
|
|
672
|
+
const [history, setHistory] = (0, import_react8.useState)([]);
|
|
673
|
+
(0, import_react8.useEffect)(() => {
|
|
689
674
|
async function getHistory() {
|
|
690
675
|
const history2 = await getLayoutHistory(user);
|
|
691
676
|
const sortedHistory = history2.filter((item) => item.id !== "latest").sort(byLastUpdate).map(({ id, lastUpdate }) => ({
|
|
@@ -698,7 +683,7 @@ var UserPanel = (0, import_react9.forwardRef)(function UserPanel2({ loginUrl, on
|
|
|
698
683
|
}
|
|
699
684
|
getHistory();
|
|
700
685
|
}, [user]);
|
|
701
|
-
const handleHisorySelected = (0,
|
|
686
|
+
const handleHisorySelected = (0, import_react8.useCallback)(
|
|
702
687
|
(evt, selected2) => {
|
|
703
688
|
if (selected2) {
|
|
704
689
|
onNavigate(selected2.id);
|
|
@@ -706,12 +691,12 @@ var UserPanel = (0, import_react9.forwardRef)(function UserPanel2({ loginUrl, on
|
|
|
706
691
|
},
|
|
707
692
|
[onNavigate]
|
|
708
693
|
);
|
|
709
|
-
const handleLogout = (0,
|
|
694
|
+
const handleLogout = (0, import_react8.useCallback)(() => {
|
|
710
695
|
logout(loginUrl);
|
|
711
696
|
}, [loginUrl]);
|
|
712
697
|
const selected = history.length === 0 ? null : layoutId === "latest" ? history[0] : history.find((i) => i.id === layoutId);
|
|
713
|
-
return /* @__PURE__ */ (0,
|
|
714
|
-
/* @__PURE__ */ (0,
|
|
698
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "vuuUserPanel", ref: forwardedRef, children: [
|
|
699
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
715
700
|
import_salt_lab3.List,
|
|
716
701
|
{
|
|
717
702
|
ListItem: HistoryListItem,
|
|
@@ -721,15 +706,15 @@ var UserPanel = (0, import_react9.forwardRef)(function UserPanel2({ loginUrl, on
|
|
|
721
706
|
source: history
|
|
722
707
|
}
|
|
723
708
|
),
|
|
724
|
-
/* @__PURE__ */ (0,
|
|
725
|
-
/* @__PURE__ */ (0,
|
|
709
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "vuuUserPanel-buttonBar", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_core4.Button, { "aria-label": "logout", onClick: handleLogout, children: [
|
|
710
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_icons.ExportIcon, {}),
|
|
726
711
|
" Logout"
|
|
727
712
|
] }) })
|
|
728
713
|
] });
|
|
729
714
|
});
|
|
730
715
|
|
|
731
716
|
// src/user-profile/UserProfile.tsx
|
|
732
|
-
var
|
|
717
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
733
718
|
var UserProfile = ({
|
|
734
719
|
layoutId,
|
|
735
720
|
loginUrl,
|
|
@@ -739,9 +724,9 @@ var UserProfile = ({
|
|
|
739
724
|
const handleNavigate = (id) => {
|
|
740
725
|
onNavigate(id);
|
|
741
726
|
};
|
|
742
|
-
return /* @__PURE__ */ (0,
|
|
743
|
-
/* @__PURE__ */ (0,
|
|
744
|
-
/* @__PURE__ */ (0,
|
|
727
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_salt_lab4.DropdownBase, { className: "vuuUserProfile", placement: "bottom-end", children: [
|
|
728
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_core5.Button, { variant: "secondary", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_icons2.UserSolidIcon, {}) }),
|
|
729
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
745
730
|
UserPanel,
|
|
746
731
|
{
|
|
747
732
|
layoutId,
|
|
@@ -757,8 +742,8 @@ var UserProfile = ({
|
|
|
757
742
|
var import_salt_lab5 = require("@heswell/salt-lab");
|
|
758
743
|
var import_classnames4 = __toESM(require("classnames"));
|
|
759
744
|
var import_core6 = require("@salt-ds/core");
|
|
760
|
-
var
|
|
761
|
-
var
|
|
745
|
+
var import_react9 = require("react");
|
|
746
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
762
747
|
var classBase4 = "vuuThemeSwitch";
|
|
763
748
|
var modes = ["light", "dark"];
|
|
764
749
|
var ThemeSwitch = ({
|
|
@@ -775,7 +760,7 @@ var ThemeSwitch = ({
|
|
|
775
760
|
state: "mode"
|
|
776
761
|
});
|
|
777
762
|
const selectedIndex = modes.indexOf(mode);
|
|
778
|
-
const handleChangeSecondary = (0,
|
|
763
|
+
const handleChangeSecondary = (0, import_react9.useCallback)(
|
|
779
764
|
(_evt, index) => {
|
|
780
765
|
const mode2 = modes[index];
|
|
781
766
|
setMode(mode2);
|
|
@@ -784,7 +769,7 @@ var ThemeSwitch = ({
|
|
|
784
769
|
[onChange, setMode]
|
|
785
770
|
);
|
|
786
771
|
const className = (0, import_classnames4.default)(classBase4, classNameProp);
|
|
787
|
-
return /* @__PURE__ */ (0,
|
|
772
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
788
773
|
import_salt_lab5.ToggleButtonGroup,
|
|
789
774
|
{
|
|
790
775
|
className,
|
|
@@ -792,7 +777,7 @@ var ThemeSwitch = ({
|
|
|
792
777
|
onChange: handleChangeSecondary,
|
|
793
778
|
selectedIndex,
|
|
794
779
|
children: [
|
|
795
|
-
/* @__PURE__ */ (0,
|
|
780
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
796
781
|
import_salt_lab5.ToggleButton,
|
|
797
782
|
{
|
|
798
783
|
"aria-label": "alert",
|
|
@@ -800,7 +785,7 @@ var ThemeSwitch = ({
|
|
|
800
785
|
"data-icon": "light"
|
|
801
786
|
}
|
|
802
787
|
),
|
|
803
|
-
/* @__PURE__ */ (0,
|
|
788
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
804
789
|
import_salt_lab5.ToggleButton,
|
|
805
790
|
{
|
|
806
791
|
"aria-label": "home",
|
|
@@ -815,7 +800,7 @@ var ThemeSwitch = ({
|
|
|
815
800
|
|
|
816
801
|
// src/app-header/AppHeader.tsx
|
|
817
802
|
var import_classnames5 = __toESM(require("classnames"));
|
|
818
|
-
var
|
|
803
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
819
804
|
var classBase5 = "vuuAppHeader";
|
|
820
805
|
var AppHeader = ({
|
|
821
806
|
className: classNameProp,
|
|
@@ -828,13 +813,13 @@ var AppHeader = ({
|
|
|
828
813
|
...htmlAttributes
|
|
829
814
|
}) => {
|
|
830
815
|
const className = (0, import_classnames5.default)(classBase5, classNameProp);
|
|
831
|
-
const handleSwitchTheme = (0,
|
|
816
|
+
const handleSwitchTheme = (0, import_react10.useCallback)(
|
|
832
817
|
(mode) => onSwitchTheme == null ? void 0 : onSwitchTheme(mode),
|
|
833
818
|
[onSwitchTheme]
|
|
834
819
|
);
|
|
835
|
-
return /* @__PURE__ */ (0,
|
|
836
|
-
/* @__PURE__ */ (0,
|
|
837
|
-
/* @__PURE__ */ (0,
|
|
820
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("header", { className, ...htmlAttributes, children: [
|
|
821
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(ThemeSwitch, { defaultMode: themeMode, onChange: handleSwitchTheme }),
|
|
822
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
838
823
|
UserProfile,
|
|
839
824
|
{
|
|
840
825
|
layoutId,
|
|
@@ -846,9 +831,410 @@ var AppHeader = ({
|
|
|
846
831
|
] });
|
|
847
832
|
};
|
|
848
833
|
|
|
834
|
+
// src/theme-provider/ThemeProvider.tsx
|
|
835
|
+
var import_react11 = require("react");
|
|
836
|
+
var import_classnames6 = __toESM(require("classnames"));
|
|
837
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
838
|
+
var DEFAULT_DENSITY2 = "medium";
|
|
839
|
+
var DEFAULT_THEME = "salt-theme";
|
|
840
|
+
var DEFAULT_THEME_MODE = "light";
|
|
841
|
+
var ThemeContext = (0, import_react11.createContext)({
|
|
842
|
+
density: "high",
|
|
843
|
+
theme: "salt",
|
|
844
|
+
themeMode: "light"
|
|
845
|
+
});
|
|
846
|
+
var DEFAULT_THEME_ATTRIBUTES = [
|
|
847
|
+
"salt",
|
|
848
|
+
"salt-density-high",
|
|
849
|
+
"light"
|
|
850
|
+
];
|
|
851
|
+
var useThemeAttributes = () => {
|
|
852
|
+
const context = (0, import_react11.useContext)(ThemeContext);
|
|
853
|
+
if (context) {
|
|
854
|
+
return [
|
|
855
|
+
`${context.theme}-theme`,
|
|
856
|
+
`salt-density-${context.density}`,
|
|
857
|
+
context.themeMode
|
|
858
|
+
];
|
|
859
|
+
}
|
|
860
|
+
return DEFAULT_THEME_ATTRIBUTES;
|
|
861
|
+
};
|
|
862
|
+
var createThemedChildren = (children, theme, themeMode, density) => {
|
|
863
|
+
var _a;
|
|
864
|
+
console.log("create themed children");
|
|
865
|
+
if ((0, import_react11.isValidElement)(children)) {
|
|
866
|
+
return (0, import_react11.cloneElement)(children, {
|
|
867
|
+
className: (0, import_classnames6.default)(
|
|
868
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
869
|
+
(_a = children.props) == null ? void 0 : _a.className,
|
|
870
|
+
`${theme}-theme`,
|
|
871
|
+
`${theme}-density-${density}`
|
|
872
|
+
),
|
|
873
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
874
|
+
// @ts-expect-error
|
|
875
|
+
"data-mode": themeMode
|
|
876
|
+
});
|
|
877
|
+
} else {
|
|
878
|
+
console.warn(
|
|
879
|
+
`
|
|
880
|
+
ThemeProvider can only apply CSS classes for theming to a single nested child element of the ThemeProvider.
|
|
881
|
+
Wrap elements with a single container`
|
|
882
|
+
);
|
|
883
|
+
return children;
|
|
884
|
+
}
|
|
885
|
+
};
|
|
886
|
+
var ThemeProvider = ({
|
|
887
|
+
applyThemeClasses = false,
|
|
888
|
+
children,
|
|
889
|
+
theme: themeProp,
|
|
890
|
+
themeMode: themeModeProp,
|
|
891
|
+
density: densityProp
|
|
892
|
+
}) => {
|
|
893
|
+
var _a, _b, _c;
|
|
894
|
+
const {
|
|
895
|
+
density: inheritedDensity,
|
|
896
|
+
themeMode: inheritedThemeMode,
|
|
897
|
+
theme: inheritedTheme
|
|
898
|
+
} = (0, import_react11.useContext)(ThemeContext);
|
|
899
|
+
const density = (_a = densityProp != null ? densityProp : inheritedDensity) != null ? _a : DEFAULT_DENSITY2;
|
|
900
|
+
const themeMode = (_b = themeModeProp != null ? themeModeProp : inheritedThemeMode) != null ? _b : DEFAULT_THEME_MODE;
|
|
901
|
+
const theme = (_c = themeProp != null ? themeProp : inheritedTheme) != null ? _c : DEFAULT_THEME;
|
|
902
|
+
const themedChildren = applyThemeClasses ? createThemedChildren(children, theme, themeMode, density) : children;
|
|
903
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ThemeContext.Provider, { value: { themeMode, density, theme }, children: themedChildren });
|
|
904
|
+
};
|
|
905
|
+
ThemeProvider.displayName = "ThemeProvider";
|
|
906
|
+
|
|
849
907
|
// src/shell.tsx
|
|
850
908
|
var import_vuu_utils4 = require("@vuu-ui/vuu-utils");
|
|
909
|
+
|
|
910
|
+
// src/shell-layouts/useFullHeightLeftPanel.tsx
|
|
911
|
+
var import_vuu_layout4 = require("@vuu-ui/vuu-layout");
|
|
912
|
+
|
|
913
|
+
// src/shell-layouts/context-panel/ContextPanel.tsx
|
|
914
|
+
var import_core7 = require("@salt-ds/core");
|
|
915
|
+
var import_classnames7 = __toESM(require("classnames"));
|
|
916
|
+
var import_react12 = require("react");
|
|
917
|
+
var import_vuu_layout2 = require("@vuu-ui/vuu-layout");
|
|
851
918
|
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
919
|
+
var classBase6 = "vuuContextPanel";
|
|
920
|
+
var ContextPanel = ({
|
|
921
|
+
className: classNameProp,
|
|
922
|
+
expanded = false,
|
|
923
|
+
overlay = false,
|
|
924
|
+
title
|
|
925
|
+
}) => {
|
|
926
|
+
const dispatchLayoutAction = (0, import_vuu_layout2.useLayoutProviderDispatch)();
|
|
927
|
+
const handleClose = (0, import_react12.useCallback)(() => {
|
|
928
|
+
dispatchLayoutAction({
|
|
929
|
+
path: "#context-panel",
|
|
930
|
+
propName: "expanded",
|
|
931
|
+
propValue: false,
|
|
932
|
+
type: "set-prop"
|
|
933
|
+
});
|
|
934
|
+
}, [dispatchLayoutAction]);
|
|
935
|
+
const className = (0, import_classnames7.default)(classBase6, classNameProp, {
|
|
936
|
+
[`${classBase6}-expanded`]: expanded,
|
|
937
|
+
[`${classBase6}-inline`]: overlay !== true,
|
|
938
|
+
[`${classBase6}-overlay`]: overlay
|
|
939
|
+
});
|
|
940
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: (0, import_classnames7.default)(classBase6, className), children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: `${classBase6}-inner`, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: `${classBase6}-header`, children: [
|
|
941
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("h2", { className: `${classBase6}-title`, children: title }),
|
|
942
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
943
|
+
import_core7.Button,
|
|
944
|
+
{
|
|
945
|
+
className: `${classBase6}-close`,
|
|
946
|
+
"data-icon": "close",
|
|
947
|
+
onClick: handleClose,
|
|
948
|
+
variant: "secondary"
|
|
949
|
+
}
|
|
950
|
+
)
|
|
951
|
+
] }) }) });
|
|
952
|
+
};
|
|
953
|
+
|
|
954
|
+
// src/left-nav/LeftNav.tsx
|
|
955
|
+
var import_vuu_layout3 = require("@vuu-ui/vuu-layout");
|
|
956
|
+
var import_classnames8 = __toESM(require("classnames"));
|
|
957
|
+
var import_react13 = require("react");
|
|
958
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
959
|
+
var classBase7 = "vuuLeftNav";
|
|
960
|
+
var LeftNav = ({
|
|
961
|
+
"data-path": path,
|
|
962
|
+
onResize,
|
|
963
|
+
open = true,
|
|
964
|
+
...htmlAttributes
|
|
965
|
+
}) => {
|
|
966
|
+
const dispatch = (0, import_vuu_layout3.useLayoutProviderDispatch)();
|
|
967
|
+
const openRef = (0, import_react13.useRef)(open);
|
|
968
|
+
const toggleSize = (0, import_react13.useCallback)(() => {
|
|
969
|
+
openRef.current = !openRef.current;
|
|
970
|
+
dispatch({
|
|
971
|
+
type: import_vuu_layout3.Action.LAYOUT_RESIZE,
|
|
972
|
+
path,
|
|
973
|
+
size: openRef.current ? 240 : 80
|
|
974
|
+
});
|
|
975
|
+
}, [dispatch, path]);
|
|
976
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { ...htmlAttributes, className: classBase7, children: [
|
|
977
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "vuuLeftNav-logo", children: [
|
|
978
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
979
|
+
"svg",
|
|
980
|
+
{
|
|
981
|
+
width: "44",
|
|
982
|
+
height: "45",
|
|
983
|
+
viewBox: "0 0 44 45",
|
|
984
|
+
fill: "none",
|
|
985
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
986
|
+
children: [
|
|
987
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("g", { clipPath: "url(#clip0_217_6990)", children: [
|
|
988
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
989
|
+
"path",
|
|
990
|
+
{
|
|
991
|
+
d: "M39.8642 15.5509L35.9196 7.58974L34.3369 6.85464L24.6235 22.0825L39.1628 30.618L42.3152 25.6347L39.8642 15.5509Z",
|
|
992
|
+
fill: "url(#paint0_linear_217_6990)"
|
|
993
|
+
}
|
|
994
|
+
),
|
|
995
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
996
|
+
"path",
|
|
997
|
+
{
|
|
998
|
+
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",
|
|
999
|
+
fill: "url(#paint1_linear_217_6990)"
|
|
1000
|
+
}
|
|
1001
|
+
),
|
|
1002
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1003
|
+
"path",
|
|
1004
|
+
{
|
|
1005
|
+
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",
|
|
1006
|
+
fill: "#F37880"
|
|
1007
|
+
}
|
|
1008
|
+
),
|
|
1009
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("g", { opacity: "0.86", children: [
|
|
1010
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1011
|
+
"path",
|
|
1012
|
+
{
|
|
1013
|
+
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",
|
|
1014
|
+
fill: "white"
|
|
1015
|
+
}
|
|
1016
|
+
),
|
|
1017
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1018
|
+
"path",
|
|
1019
|
+
{
|
|
1020
|
+
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",
|
|
1021
|
+
fill: "white"
|
|
1022
|
+
}
|
|
1023
|
+
),
|
|
1024
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1025
|
+
"path",
|
|
1026
|
+
{
|
|
1027
|
+
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",
|
|
1028
|
+
fill: "white"
|
|
1029
|
+
}
|
|
1030
|
+
)
|
|
1031
|
+
] })
|
|
1032
|
+
] }),
|
|
1033
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("defs", { children: [
|
|
1034
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
1035
|
+
"linearGradient",
|
|
1036
|
+
{
|
|
1037
|
+
id: "paint0_linear_217_6990",
|
|
1038
|
+
x1: "24.6235",
|
|
1039
|
+
y1: "18.7363",
|
|
1040
|
+
x2: "42.3152",
|
|
1041
|
+
y2: "18.7363",
|
|
1042
|
+
gradientUnits: "userSpaceOnUse",
|
|
1043
|
+
children: [
|
|
1044
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("stop", { stopColor: "#4906A5" }),
|
|
1045
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("stop", { offset: "1", stopColor: "#D3423A" })
|
|
1046
|
+
]
|
|
1047
|
+
}
|
|
1048
|
+
),
|
|
1049
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
1050
|
+
"linearGradient",
|
|
1051
|
+
{
|
|
1052
|
+
id: "paint1_linear_217_6990",
|
|
1053
|
+
x1: "-2.35794e-05",
|
|
1054
|
+
y1: "22.5009",
|
|
1055
|
+
x2: "42.7186",
|
|
1056
|
+
y2: "22.5009",
|
|
1057
|
+
gradientUnits: "userSpaceOnUse",
|
|
1058
|
+
children: [
|
|
1059
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("stop", { stopColor: "#7C06A5" }),
|
|
1060
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("stop", { offset: "1", stopColor: "#D3423A" })
|
|
1061
|
+
]
|
|
1062
|
+
}
|
|
1063
|
+
),
|
|
1064
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("clipPath", { id: "clip0_217_6990", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("rect", { width: "44", height: "45", fill: "white" }) })
|
|
1065
|
+
] })
|
|
1066
|
+
]
|
|
1067
|
+
}
|
|
1068
|
+
),
|
|
1069
|
+
" "
|
|
1070
|
+
] }),
|
|
1071
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: `${classBase7}-main`, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("ul", { className: `${classBase7}-menu`, children: [
|
|
1072
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1073
|
+
"li",
|
|
1074
|
+
{
|
|
1075
|
+
className: (0, import_classnames8.default)(
|
|
1076
|
+
`${classBase7}-menuitem`,
|
|
1077
|
+
`${classBase7}-menuitem-active`
|
|
1078
|
+
),
|
|
1079
|
+
"data-icon": "demo",
|
|
1080
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: `${classBase7}-menuitem-label`, children: "DEMO" })
|
|
1081
|
+
}
|
|
1082
|
+
),
|
|
1083
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("li", { className: `${classBase7}-menuitem`, "data-icon": "tables", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: `${classBase7}-menuitem-label`, children: "VUU TABLES" }) }),
|
|
1084
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("li", { className: `${classBase7}-menuitem`, "data-icon": "templates", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: `${classBase7}-menuitem-label`, children: "LAYOUT TEMPLATES" }) }),
|
|
1085
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("li", { className: `${classBase7}-menuitem`, "data-icon": "layouts", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: `${classBase7}-menuitem-label`, children: "MY LAYOUTS" }) })
|
|
1086
|
+
] }) }),
|
|
1087
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "vuuLeftNav-buttonBar", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1088
|
+
"button",
|
|
1089
|
+
{
|
|
1090
|
+
className: (0, import_classnames8.default)("vuuLeftNav-toggleButton", {
|
|
1091
|
+
"vuuLeftNav-toggleButton-open": openRef.current,
|
|
1092
|
+
"vuuLeftNav-toggleButton-closed": !openRef.current
|
|
1093
|
+
}),
|
|
1094
|
+
"data-icon": openRef.current ? "chevron-left" : "chevron-right",
|
|
1095
|
+
onClick: toggleSize
|
|
1096
|
+
}
|
|
1097
|
+
) })
|
|
1098
|
+
] });
|
|
1099
|
+
};
|
|
1100
|
+
|
|
1101
|
+
// src/shell-layouts/useFullHeightLeftPanel.tsx
|
|
1102
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
1103
|
+
var useFullHeightLeftPanel = ({
|
|
1104
|
+
appHeader
|
|
1105
|
+
}) => {
|
|
1106
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
1107
|
+
import_vuu_layout4.Flexbox,
|
|
1108
|
+
{
|
|
1109
|
+
className: "App",
|
|
1110
|
+
style: {
|
|
1111
|
+
flexDirection: "row",
|
|
1112
|
+
height: "100%",
|
|
1113
|
+
width: "100%"
|
|
1114
|
+
},
|
|
1115
|
+
children: [
|
|
1116
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
1117
|
+
LeftNav,
|
|
1118
|
+
{
|
|
1119
|
+
style: {
|
|
1120
|
+
width: 240
|
|
1121
|
+
}
|
|
1122
|
+
}
|
|
1123
|
+
),
|
|
1124
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
1125
|
+
import_vuu_layout4.Flexbox,
|
|
1126
|
+
{
|
|
1127
|
+
className: "vuuShell-content",
|
|
1128
|
+
style: {
|
|
1129
|
+
flexDirection: "column",
|
|
1130
|
+
flex: 1,
|
|
1131
|
+
padding: 8
|
|
1132
|
+
},
|
|
1133
|
+
children: [
|
|
1134
|
+
appHeader,
|
|
1135
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_vuu_layout4.DraggableLayout, { dropTarget: true, style: { flex: 1 } }, "main-content")
|
|
1136
|
+
]
|
|
1137
|
+
}
|
|
1138
|
+
),
|
|
1139
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
1140
|
+
ContextPanel,
|
|
1141
|
+
{
|
|
1142
|
+
id: "context-panel",
|
|
1143
|
+
overlay: true,
|
|
1144
|
+
title: "Column Settings"
|
|
1145
|
+
}
|
|
1146
|
+
)
|
|
1147
|
+
]
|
|
1148
|
+
}
|
|
1149
|
+
);
|
|
1150
|
+
};
|
|
1151
|
+
|
|
1152
|
+
// src/shell-layouts/useInlayLeftPanel.tsx
|
|
1153
|
+
var import_vuu_layout5 = require("@vuu-ui/vuu-layout");
|
|
1154
|
+
var import_react14 = require("react");
|
|
1155
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
1156
|
+
var useInlayLeftPanel = ({
|
|
1157
|
+
appHeader,
|
|
1158
|
+
leftSidePanel
|
|
1159
|
+
}) => {
|
|
1160
|
+
const paletteView = (0, import_react14.useRef)(null);
|
|
1161
|
+
const [open, setOpen] = (0, import_react14.useState)(true);
|
|
1162
|
+
const handleDrawerClick = (0, import_react14.useCallback)(
|
|
1163
|
+
(e) => {
|
|
1164
|
+
var _a;
|
|
1165
|
+
const target = e.target;
|
|
1166
|
+
if (!((_a = paletteView.current) == null ? void 0 : _a.contains(target))) {
|
|
1167
|
+
setOpen(!open);
|
|
1168
|
+
}
|
|
1169
|
+
},
|
|
1170
|
+
[open]
|
|
1171
|
+
);
|
|
1172
|
+
const getDrawers = (0, import_react14.useCallback)(
|
|
1173
|
+
(leftSidePanel2) => {
|
|
1174
|
+
const drawers = [];
|
|
1175
|
+
drawers.push(
|
|
1176
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1177
|
+
import_vuu_layout5.Drawer,
|
|
1178
|
+
{
|
|
1179
|
+
onClick: handleDrawerClick,
|
|
1180
|
+
open,
|
|
1181
|
+
position: "left",
|
|
1182
|
+
inline: true,
|
|
1183
|
+
peekaboo: true,
|
|
1184
|
+
sizeOpen: 200,
|
|
1185
|
+
toggleButton: "end",
|
|
1186
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1187
|
+
import_vuu_layout5.View,
|
|
1188
|
+
{
|
|
1189
|
+
className: "vuuShell-palette",
|
|
1190
|
+
id: "vw-app-palette",
|
|
1191
|
+
ref: paletteView,
|
|
1192
|
+
style: { height: "100%" },
|
|
1193
|
+
children: leftSidePanel2
|
|
1194
|
+
},
|
|
1195
|
+
"app-palette"
|
|
1196
|
+
)
|
|
1197
|
+
},
|
|
1198
|
+
"left-panel"
|
|
1199
|
+
)
|
|
1200
|
+
);
|
|
1201
|
+
return drawers;
|
|
1202
|
+
},
|
|
1203
|
+
[handleDrawerClick, open]
|
|
1204
|
+
);
|
|
1205
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
1206
|
+
import_vuu_layout5.Flexbox,
|
|
1207
|
+
{
|
|
1208
|
+
className: "App",
|
|
1209
|
+
style: { flexDirection: "column", height: "100%", width: "100%" },
|
|
1210
|
+
children: [
|
|
1211
|
+
appHeader,
|
|
1212
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_vuu_layout5.DockLayout, { style: { flex: 1 }, children: getDrawers(leftSidePanel).concat(
|
|
1213
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1214
|
+
import_vuu_layout5.DraggableLayout,
|
|
1215
|
+
{
|
|
1216
|
+
dropTarget: true,
|
|
1217
|
+
style: { width: "100%", height: "100%" }
|
|
1218
|
+
},
|
|
1219
|
+
"main-content"
|
|
1220
|
+
)
|
|
1221
|
+
) })
|
|
1222
|
+
]
|
|
1223
|
+
}
|
|
1224
|
+
);
|
|
1225
|
+
};
|
|
1226
|
+
|
|
1227
|
+
// src/shell-layouts/useShellLayout.ts
|
|
1228
|
+
var useShellLayout = ({
|
|
1229
|
+
leftSidePanelLayout = "inlay",
|
|
1230
|
+
...props
|
|
1231
|
+
}) => {
|
|
1232
|
+
const useLayoutHook = leftSidePanelLayout === "inlay" ? useInlayLeftPanel : useFullHeightLeftPanel;
|
|
1233
|
+
return useLayoutHook(props);
|
|
1234
|
+
};
|
|
1235
|
+
|
|
1236
|
+
// src/shell.tsx
|
|
1237
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
852
1238
|
var { error } = (0, import_vuu_utils4.logger)("Shell");
|
|
853
1239
|
var warningLayout = {
|
|
854
1240
|
type: "View",
|
|
@@ -869,6 +1255,7 @@ var Shell = ({
|
|
|
869
1255
|
className: classNameProp,
|
|
870
1256
|
defaultLayout = warningLayout,
|
|
871
1257
|
leftSidePanel,
|
|
1258
|
+
leftSidePanelLayout,
|
|
872
1259
|
loginUrl,
|
|
873
1260
|
saveLocation = "remote",
|
|
874
1261
|
saveUrl,
|
|
@@ -876,16 +1263,14 @@ var Shell = ({
|
|
|
876
1263
|
user,
|
|
877
1264
|
...htmlAttributes
|
|
878
1265
|
}) => {
|
|
879
|
-
const rootRef = (0,
|
|
880
|
-
const
|
|
881
|
-
const [open, setOpen] = (0, import_react12.useState)(false);
|
|
882
|
-
const layoutId = (0, import_react12.useRef)("latest");
|
|
1266
|
+
const rootRef = (0, import_react15.useRef)(null);
|
|
1267
|
+
const layoutId = (0, import_react15.useRef)("latest");
|
|
883
1268
|
const [layout, saveLayoutConfig, loadLayoutById] = useLayoutConfig({
|
|
884
1269
|
defaultLayout,
|
|
885
1270
|
saveLocation,
|
|
886
1271
|
user
|
|
887
1272
|
});
|
|
888
|
-
const handleLayoutChange = (0,
|
|
1273
|
+
const handleLayoutChange = (0, import_react15.useCallback)(
|
|
889
1274
|
(layout2) => {
|
|
890
1275
|
try {
|
|
891
1276
|
saveLayoutConfig(layout2);
|
|
@@ -895,26 +1280,19 @@ var Shell = ({
|
|
|
895
1280
|
},
|
|
896
1281
|
[saveLayoutConfig]
|
|
897
1282
|
);
|
|
898
|
-
const handleSwitchTheme = (0,
|
|
1283
|
+
const handleSwitchTheme = (0, import_react15.useCallback)((mode) => {
|
|
899
1284
|
if (rootRef.current) {
|
|
900
1285
|
rootRef.current.dataset.mode = mode;
|
|
901
1286
|
}
|
|
902
1287
|
}, []);
|
|
903
|
-
const
|
|
904
|
-
var _a;
|
|
905
|
-
const target = e.target;
|
|
906
|
-
if (!((_a = paletteView.current) == null ? void 0 : _a.contains(target))) {
|
|
907
|
-
setOpen(!open);
|
|
908
|
-
}
|
|
909
|
-
};
|
|
910
|
-
const handleNavigate = (0, import_react12.useCallback)(
|
|
1288
|
+
const handleNavigate = (0, import_react15.useCallback)(
|
|
911
1289
|
(id) => {
|
|
912
1290
|
layoutId.current = id;
|
|
913
1291
|
loadLayoutById(id);
|
|
914
1292
|
},
|
|
915
1293
|
[loadLayoutById]
|
|
916
1294
|
);
|
|
917
|
-
(0,
|
|
1295
|
+
(0, import_react15.useEffect)(() => {
|
|
918
1296
|
if (serverUrl && user.token) {
|
|
919
1297
|
(0, import_vuu_data2.connectToServer)({
|
|
920
1298
|
authToken: user.token,
|
|
@@ -923,83 +1301,33 @@ var Shell = ({
|
|
|
923
1301
|
});
|
|
924
1302
|
}
|
|
925
1303
|
}, [serverUrl, user.token, user.username]);
|
|
926
|
-
const
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
{
|
|
943
|
-
className: "vuuShell-palette",
|
|
944
|
-
id: "vw-app-palette",
|
|
945
|
-
ref: paletteView,
|
|
946
|
-
style: { height: "100%" },
|
|
947
|
-
children: leftSidePanel
|
|
948
|
-
},
|
|
949
|
-
"app-palette"
|
|
950
|
-
)
|
|
951
|
-
},
|
|
952
|
-
"left-panel"
|
|
953
|
-
)
|
|
954
|
-
);
|
|
955
|
-
}
|
|
956
|
-
return drawers;
|
|
957
|
-
};
|
|
958
|
-
const className = (0, import_classnames6.default)(
|
|
959
|
-
"vuuShell",
|
|
960
|
-
classNameProp,
|
|
961
|
-
"salt-theme",
|
|
962
|
-
"salt-density-high"
|
|
963
|
-
);
|
|
1304
|
+
const [themeClass, densityClass, dataMode] = useThemeAttributes();
|
|
1305
|
+
const className = (0, import_classnames9.default)("vuuShell", classNameProp, themeClass, densityClass);
|
|
1306
|
+
const shellLayout = useShellLayout({
|
|
1307
|
+
leftSidePanelLayout,
|
|
1308
|
+
appHeader: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
1309
|
+
AppHeader,
|
|
1310
|
+
{
|
|
1311
|
+
layoutId: layoutId.current,
|
|
1312
|
+
loginUrl,
|
|
1313
|
+
user,
|
|
1314
|
+
onNavigate: handleNavigate,
|
|
1315
|
+
onSwitchTheme: handleSwitchTheme
|
|
1316
|
+
}
|
|
1317
|
+
),
|
|
1318
|
+
leftSidePanel
|
|
1319
|
+
});
|
|
964
1320
|
return (
|
|
965
1321
|
// ShellContext TBD
|
|
966
|
-
/* @__PURE__ */ (0,
|
|
967
|
-
/* @__PURE__ */ (0,
|
|
968
|
-
|
|
1322
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(ThemeProvider, { children: [
|
|
1323
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_vuu_layout6.LayoutProvider, { layout, onLayoutChange: handleLayoutChange, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
1324
|
+
import_vuu_layout6.DraggableLayout,
|
|
969
1325
|
{
|
|
970
1326
|
className,
|
|
971
|
-
"data-mode":
|
|
1327
|
+
"data-mode": dataMode,
|
|
972
1328
|
ref: rootRef,
|
|
973
1329
|
...htmlAttributes,
|
|
974
|
-
children:
|
|
975
|
-
import_vuu_layout2.Flexbox,
|
|
976
|
-
{
|
|
977
|
-
className: "App",
|
|
978
|
-
style: { flexDirection: "column", height: "100%", width: "100%" },
|
|
979
|
-
children: [
|
|
980
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
981
|
-
AppHeader,
|
|
982
|
-
{
|
|
983
|
-
layoutId: layoutId.current,
|
|
984
|
-
loginUrl,
|
|
985
|
-
user,
|
|
986
|
-
onNavigate: handleNavigate,
|
|
987
|
-
onSwitchTheme: handleSwitchTheme
|
|
988
|
-
}
|
|
989
|
-
),
|
|
990
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_vuu_layout2.DockLayout, { style: { flex: 1 }, children: getDrawers().concat(
|
|
991
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
992
|
-
import_vuu_layout2.DraggableLayout,
|
|
993
|
-
{
|
|
994
|
-
dropTarget: true,
|
|
995
|
-
style: { width: "100%", height: "100%" }
|
|
996
|
-
},
|
|
997
|
-
"main-content"
|
|
998
|
-
)
|
|
999
|
-
) })
|
|
1000
|
-
]
|
|
1001
|
-
}
|
|
1002
|
-
)
|
|
1330
|
+
children: shellLayout
|
|
1003
1331
|
}
|
|
1004
1332
|
) }),
|
|
1005
1333
|
children
|
|
@@ -1007,63 +1335,29 @@ var Shell = ({
|
|
|
1007
1335
|
);
|
|
1008
1336
|
};
|
|
1009
1337
|
|
|
1010
|
-
// src/
|
|
1011
|
-
var
|
|
1012
|
-
var
|
|
1013
|
-
var
|
|
1014
|
-
var
|
|
1015
|
-
var
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
return (0, import_react13.cloneElement)(children, {
|
|
1026
|
-
className: (0, import_classnames7.default)(
|
|
1027
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
1028
|
-
(_a = children.props) == null ? void 0 : _a.className,
|
|
1029
|
-
theme,
|
|
1030
|
-
`salt-density-${density}`
|
|
1031
|
-
),
|
|
1032
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
1033
|
-
// @ts-expect-error
|
|
1034
|
-
"data-mode": themeMode
|
|
1035
|
-
});
|
|
1036
|
-
} else {
|
|
1037
|
-
console.warn(
|
|
1038
|
-
`
|
|
1039
|
-
ThemeProvider can only apply CSS classes for theming to a single nested child element of the ThemeProvider.
|
|
1040
|
-
Wrap elements with a single container`
|
|
1041
|
-
);
|
|
1042
|
-
return children;
|
|
1043
|
-
}
|
|
1338
|
+
// src/ShellContextProvider.tsx
|
|
1339
|
+
var import_react16 = require("react");
|
|
1340
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
1341
|
+
var defaultConfig = {};
|
|
1342
|
+
var ShellContext = (0, import_react16.createContext)(defaultConfig);
|
|
1343
|
+
var Provider = ({
|
|
1344
|
+
children,
|
|
1345
|
+
context,
|
|
1346
|
+
inheritedContext
|
|
1347
|
+
}) => {
|
|
1348
|
+
const mergedContext = {
|
|
1349
|
+
...inheritedContext,
|
|
1350
|
+
...context
|
|
1351
|
+
};
|
|
1352
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(ShellContext.Provider, { value: mergedContext, children });
|
|
1044
1353
|
};
|
|
1045
|
-
var
|
|
1354
|
+
var ShellContextProvider = ({
|
|
1046
1355
|
children,
|
|
1047
|
-
|
|
1048
|
-
themeMode: themeModeProp,
|
|
1049
|
-
density: densityProp
|
|
1356
|
+
value
|
|
1050
1357
|
}) => {
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
theme: inheritedTheme
|
|
1056
|
-
} = (0, import_react13.useContext)(ThemeContext);
|
|
1057
|
-
const density = (_a = densityProp != null ? densityProp : inheritedDensity) != null ? _a : DEFAULT_DENSITY2;
|
|
1058
|
-
const themeMode = (_b = themeModeProp != null ? themeModeProp : inheritedThemeMode) != null ? _b : DEFAULT_THEME_MODE;
|
|
1059
|
-
const theme = (_c = themeProp != null ? themeProp : inheritedTheme) != null ? _c : DEFAULT_THEME;
|
|
1060
|
-
const themedChildren = createThemedChildren(
|
|
1061
|
-
children,
|
|
1062
|
-
theme,
|
|
1063
|
-
themeMode,
|
|
1064
|
-
density
|
|
1065
|
-
);
|
|
1066
|
-
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ThemeContext.Provider, { value: { themeMode, density, theme }, children: themedChildren });
|
|
1358
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(ShellContext.Consumer, { children: (context) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Provider, { context: value, inheritedContext: context, children }) });
|
|
1359
|
+
};
|
|
1360
|
+
var useShellContext = () => {
|
|
1361
|
+
return (0, import_react16.useContext)(ShellContext);
|
|
1067
1362
|
};
|
|
1068
|
-
ThemeProvider.displayName = "ThemeProvider";
|
|
1069
1363
|
//# sourceMappingURL=index.js.map
|