@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/esm/index.js CHANGED
@@ -3,7 +3,7 @@ import React, { useEffect, useState } from "react";
3
3
  import cx from "classnames";
4
4
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
5
5
  var ConnectionStatusIcon = ({ connectionStatus, className, element = "span", ...props }) => {
6
- const [classBase6, setClassBase] = useState("vuuConnectingStatus");
6
+ const [classBase8, setClassBase] = useState("vuuConnectingStatus");
7
7
  useEffect(() => {
8
8
  switch (connectionStatus) {
9
9
  case "connected":
@@ -24,7 +24,7 @@ var ConnectionStatusIcon = ({ connectionStatus, className, element = "span", ...
24
24
  element,
25
25
  {
26
26
  ...props,
27
- className: cx("vuuStatus vuuIcon", classBase6, className)
27
+ className: cx("vuuStatus vuuIcon", classBase8, className)
28
28
  }
29
29
  );
30
30
  return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs("div", { className: "vuuStatus-container salt-theme", children: [
@@ -47,11 +47,14 @@ var DEFAULT_DENSITY = "high";
47
47
  var DensitySwitch = ({
48
48
  className: classNameProp,
49
49
  defaultDensity = DEFAULT_DENSITY,
50
- onDensityChange
50
+ onChange
51
51
  }) => {
52
- const handleSelectionChange = useCallback((_event, selectedItem) => {
53
- onDensityChange(selectedItem);
54
- }, [onDensityChange]);
52
+ const handleSelectionChange = useCallback(
53
+ (_event, selectedItem) => {
54
+ onChange(selectedItem);
55
+ },
56
+ [onChange]
57
+ );
55
58
  const className = cx2(classBase, classNameProp);
56
59
  return /* @__PURE__ */ jsx2(
57
60
  Dropdown,
@@ -223,6 +226,7 @@ import cx3 from "classnames";
223
226
  import { useIdMemo } from "@salt-ds/core";
224
227
  import { Button as Button2 } from "@salt-ds/core";
225
228
  import {
229
+ hasAction,
226
230
  isErrorResponse,
227
231
  RemoteDataSource
228
232
  } from "@vuu-ui/vuu-data";
@@ -361,9 +365,6 @@ var SessionEditingForm = ({
361
365
  (evt) => {
362
366
  const [field, value] = getFieldNameAndValue(evt);
363
367
  const { type } = getField(fields, field);
364
- console.log("BLUR", {
365
- keyField
366
- });
367
368
  const rowKey = values == null ? void 0 : values[keyField];
368
369
  const typedValue = getTypedValue(value, type, true);
369
370
  if (typeof rowKey === "string") {
@@ -377,14 +378,26 @@ var SessionEditingForm = ({
377
378
  },
378
379
  [dataSource, fields, keyField, values]
379
380
  );
381
+ const applyAction = useCallback2(
382
+ (action) => {
383
+ if (typeof action === "object" && action !== null) {
384
+ if ("type" in action && action.type === "CLOSE_DIALOG_ACTION") {
385
+ onClose();
386
+ }
387
+ }
388
+ },
389
+ [onClose]
390
+ );
380
391
  const handleSubmit = useCallback2(async () => {
381
392
  const response = await dataSource.menuRpcCall({
382
393
  type: "VP_EDIT_SUBMIT_FORM_RPC"
383
394
  });
384
395
  if (isErrorResponse(response)) {
385
396
  setErrorMessage(response.error);
397
+ } else if (hasAction(response)) {
398
+ applyAction(response.action);
386
399
  }
387
- }, [dataSource]);
400
+ }, [applyAction, dataSource]);
388
401
  const handleKeyDown = useCallback2(
389
402
  (evt) => {
390
403
  if (evt.key === "Enter" && dataStatusRef.current === Status.changed) {
@@ -424,12 +437,18 @@ var SessionEditingForm = ({
424
437
  if (firstInput) {
425
438
  setTimeout(() => {
426
439
  firstInput.focus();
427
- console.log("select item");
428
440
  firstInput.select();
429
441
  }, 100);
430
442
  }
431
443
  }
432
444
  }, []);
445
+ useEffect3(() => {
446
+ return () => {
447
+ if (dataSource) {
448
+ dataSource.unsubscribe();
449
+ }
450
+ };
451
+ }, [dataSource]);
433
452
  const isDirty = dataStatusRef.current === Status.changed;
434
453
  return /* @__PURE__ */ jsxs4("div", { ...htmlAttributes, className: cx3(classBase3, className), children: [
435
454
  errorMessage ? /* @__PURE__ */ jsx7(
@@ -483,40 +502,13 @@ var SessionEditingForm = ({
483
502
 
484
503
  // src/shell.tsx
485
504
  import { connectToServer } from "@vuu-ui/vuu-data";
486
- import cx6 from "classnames";
505
+ import cx9 from "classnames";
487
506
  import {
488
- useCallback as useCallback7,
507
+ useCallback as useCallback10,
489
508
  useEffect as useEffect6,
490
- useRef as useRef2,
491
- useState as useState6
509
+ useRef as useRef4
492
510
  } from "react";
493
511
 
494
- // src/ShellContextProvider.tsx
495
- import { createContext, useContext } from "react";
496
- import { jsx as jsx8 } from "react/jsx-runtime";
497
- var defaultConfig = {};
498
- var ShellContext = createContext(defaultConfig);
499
- var Provider = ({
500
- children,
501
- context,
502
- inheritedContext
503
- }) => {
504
- const mergedContext = {
505
- ...inheritedContext,
506
- ...context
507
- };
508
- return /* @__PURE__ */ jsx8(ShellContext.Provider, { value: mergedContext, children });
509
- };
510
- var ShellContextProvider = ({
511
- children,
512
- value
513
- }) => {
514
- return /* @__PURE__ */ jsx8(ShellContext.Consumer, { children: (context) => /* @__PURE__ */ jsx8(Provider, { context: value, inheritedContext: context, children }) });
515
- };
516
- var useShellContext = () => {
517
- return useContext(ShellContext);
518
- };
519
-
520
512
  // src/layout-config/use-layout-config.ts
521
513
  import { useCallback as useCallback3, useEffect as useEffect4, useState as useState4 } from "react";
522
514
 
@@ -581,16 +573,13 @@ var useLayoutConfig = ({
581
573
  const usingRemote = saveLocation === "remote";
582
574
  const loadConfig = usingRemote ? loadRemoteConfig : loadLocalConfig;
583
575
  const saveConfig = usingRemote ? saveRemoteConfig : saveLocalConfig;
584
- const setLayout = (layout2) => {
585
- _setLayout(layout2);
586
- };
587
576
  const load = useCallback3(
588
577
  async (id = "latest") => {
589
578
  try {
590
579
  const layout2 = await loadConfig(saveUrl, user, id);
591
- setLayout(layout2);
580
+ _setLayout(layout2);
592
581
  } catch {
593
- setLayout(defaultLayout);
582
+ _setLayout(defaultLayout);
594
583
  }
595
584
  },
596
585
  [defaultLayout, loadConfig, saveUrl, user]
@@ -604,24 +593,12 @@ var useLayoutConfig = ({
604
593
  },
605
594
  [saveConfig, saveUrl, user]
606
595
  );
607
- const loadLayoutById = useCallback3(
608
- (id) => {
609
- load(id);
610
- },
611
- [load]
612
- );
596
+ const loadLayoutById = useCallback3((id) => load(id), [load]);
613
597
  return [layout, saveData, loadLayoutById];
614
598
  };
615
599
 
616
600
  // src/shell.tsx
617
- import {
618
- DockLayout,
619
- DraggableLayout,
620
- Drawer,
621
- Flexbox,
622
- LayoutProvider,
623
- View
624
- } from "@vuu-ui/vuu-layout";
601
+ import { DraggableLayout as DraggableLayout3, LayoutProvider } from "@vuu-ui/vuu-layout";
625
602
 
626
603
  // src/app-header/AppHeader.tsx
627
604
  import { useCallback as useCallback6 } from "react";
@@ -654,12 +631,12 @@ var getLayoutHistory = async (user) => {
654
631
  };
655
632
 
656
633
  // src/user-profile/UserPanel.tsx
657
- import { jsx as jsx9, jsxs as jsxs5 } from "react/jsx-runtime";
634
+ import { jsx as jsx8, jsxs as jsxs5 } from "react/jsx-runtime";
658
635
  var byLastUpdate = ({ lastUpdate: l1 }, { lastUpdate: l2 }) => {
659
636
  return l2 === l1 ? 0 : l2 < l1 ? -1 : 1;
660
637
  };
661
638
  var HistoryListItem = (props) => {
662
- return /* @__PURE__ */ jsx9(ListItem, { ...props });
639
+ return /* @__PURE__ */ jsx8(ListItem, { ...props });
663
640
  };
664
641
  var UserPanel = forwardRef(function UserPanel2({ loginUrl, onNavigate, user, layoutId = "latest" }, forwardedRef) {
665
642
  const [history, setHistory] = useState5([]);
@@ -689,7 +666,7 @@ var UserPanel = forwardRef(function UserPanel2({ loginUrl, onNavigate, user, lay
689
666
  }, [loginUrl]);
690
667
  const selected = history.length === 0 ? null : layoutId === "latest" ? history[0] : history.find((i) => i.id === layoutId);
691
668
  return /* @__PURE__ */ jsxs5("div", { className: "vuuUserPanel", ref: forwardedRef, children: [
692
- /* @__PURE__ */ jsx9(
669
+ /* @__PURE__ */ jsx8(
693
670
  List,
694
671
  {
695
672
  ListItem: HistoryListItem,
@@ -699,15 +676,15 @@ var UserPanel = forwardRef(function UserPanel2({ loginUrl, onNavigate, user, lay
699
676
  source: history
700
677
  }
701
678
  ),
702
- /* @__PURE__ */ jsx9("div", { className: "vuuUserPanel-buttonBar", children: /* @__PURE__ */ jsxs5(Button3, { "aria-label": "logout", onClick: handleLogout, children: [
703
- /* @__PURE__ */ jsx9(ExportIcon, {}),
679
+ /* @__PURE__ */ jsx8("div", { className: "vuuUserPanel-buttonBar", children: /* @__PURE__ */ jsxs5(Button3, { "aria-label": "logout", onClick: handleLogout, children: [
680
+ /* @__PURE__ */ jsx8(ExportIcon, {}),
704
681
  " Logout"
705
682
  ] }) })
706
683
  ] });
707
684
  });
708
685
 
709
686
  // src/user-profile/UserProfile.tsx
710
- import { jsx as jsx10, jsxs as jsxs6 } from "react/jsx-runtime";
687
+ import { jsx as jsx9, jsxs as jsxs6 } from "react/jsx-runtime";
711
688
  var UserProfile = ({
712
689
  layoutId,
713
690
  loginUrl,
@@ -718,8 +695,8 @@ var UserProfile = ({
718
695
  onNavigate(id);
719
696
  };
720
697
  return /* @__PURE__ */ jsxs6(DropdownBase, { className: "vuuUserProfile", placement: "bottom-end", children: [
721
- /* @__PURE__ */ jsx10(Button4, { variant: "secondary", children: /* @__PURE__ */ jsx10(UserSolidIcon, {}) }),
722
- /* @__PURE__ */ jsx10(
698
+ /* @__PURE__ */ jsx9(Button4, { variant: "secondary", children: /* @__PURE__ */ jsx9(UserSolidIcon, {}) }),
699
+ /* @__PURE__ */ jsx9(
723
700
  UserPanel,
724
701
  {
725
702
  layoutId,
@@ -739,7 +716,7 @@ import {
739
716
  import cx4 from "classnames";
740
717
  import { useControlled } from "@salt-ds/core";
741
718
  import { useCallback as useCallback5 } from "react";
742
- import { jsx as jsx11, jsxs as jsxs7 } from "react/jsx-runtime";
719
+ import { jsx as jsx10, jsxs as jsxs7 } from "react/jsx-runtime";
743
720
  var classBase4 = "vuuThemeSwitch";
744
721
  var modes = ["light", "dark"];
745
722
  var ThemeSwitch = ({
@@ -773,7 +750,7 @@ var ThemeSwitch = ({
773
750
  onChange: handleChangeSecondary,
774
751
  selectedIndex,
775
752
  children: [
776
- /* @__PURE__ */ jsx11(
753
+ /* @__PURE__ */ jsx10(
777
754
  ToggleButton,
778
755
  {
779
756
  "aria-label": "alert",
@@ -781,7 +758,7 @@ var ThemeSwitch = ({
781
758
  "data-icon": "light"
782
759
  }
783
760
  ),
784
- /* @__PURE__ */ jsx11(
761
+ /* @__PURE__ */ jsx10(
785
762
  ToggleButton,
786
763
  {
787
764
  "aria-label": "home",
@@ -796,7 +773,7 @@ var ThemeSwitch = ({
796
773
 
797
774
  // src/app-header/AppHeader.tsx
798
775
  import cx5 from "classnames";
799
- import { jsx as jsx12, jsxs as jsxs8 } from "react/jsx-runtime";
776
+ import { jsx as jsx11, jsxs as jsxs8 } from "react/jsx-runtime";
800
777
  var classBase5 = "vuuAppHeader";
801
778
  var AppHeader = ({
802
779
  className: classNameProp,
@@ -814,8 +791,8 @@ var AppHeader = ({
814
791
  [onSwitchTheme]
815
792
  );
816
793
  return /* @__PURE__ */ jsxs8("header", { className, ...htmlAttributes, children: [
817
- /* @__PURE__ */ jsx12(ThemeSwitch, { defaultMode: themeMode, onChange: handleSwitchTheme }),
818
- /* @__PURE__ */ jsx12(
794
+ /* @__PURE__ */ jsx11(ThemeSwitch, { defaultMode: themeMode, onChange: handleSwitchTheme }),
795
+ /* @__PURE__ */ jsx11(
819
796
  UserProfile,
820
797
  {
821
798
  layoutId,
@@ -827,9 +804,421 @@ var AppHeader = ({
827
804
  ] });
828
805
  };
829
806
 
807
+ // src/theme-provider/ThemeProvider.tsx
808
+ import {
809
+ createContext,
810
+ isValidElement,
811
+ cloneElement,
812
+ useContext
813
+ } from "react";
814
+ import cx6 from "classnames";
815
+ import { jsx as jsx12 } from "react/jsx-runtime";
816
+ var DEFAULT_DENSITY2 = "medium";
817
+ var DEFAULT_THEME = "salt-theme";
818
+ var DEFAULT_THEME_MODE = "light";
819
+ var ThemeContext = createContext({
820
+ density: "high",
821
+ theme: "salt",
822
+ themeMode: "light"
823
+ });
824
+ var DEFAULT_THEME_ATTRIBUTES = [
825
+ "salt",
826
+ "salt-density-high",
827
+ "light"
828
+ ];
829
+ var useThemeAttributes = () => {
830
+ const context = useContext(ThemeContext);
831
+ if (context) {
832
+ return [
833
+ `${context.theme}-theme`,
834
+ `salt-density-${context.density}`,
835
+ context.themeMode
836
+ ];
837
+ }
838
+ return DEFAULT_THEME_ATTRIBUTES;
839
+ };
840
+ var createThemedChildren = (children, theme, themeMode, density) => {
841
+ var _a;
842
+ console.log("create themed children");
843
+ if (isValidElement(children)) {
844
+ return cloneElement(children, {
845
+ className: cx6(
846
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
847
+ (_a = children.props) == null ? void 0 : _a.className,
848
+ `${theme}-theme`,
849
+ `${theme}-density-${density}`
850
+ ),
851
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
852
+ // @ts-expect-error
853
+ "data-mode": themeMode
854
+ });
855
+ } else {
856
+ console.warn(
857
+ `
858
+ ThemeProvider can only apply CSS classes for theming to a single nested child element of the ThemeProvider.
859
+ Wrap elements with a single container`
860
+ );
861
+ return children;
862
+ }
863
+ };
864
+ var ThemeProvider = ({
865
+ applyThemeClasses = false,
866
+ children,
867
+ theme: themeProp,
868
+ themeMode: themeModeProp,
869
+ density: densityProp
870
+ }) => {
871
+ var _a, _b, _c;
872
+ const {
873
+ density: inheritedDensity,
874
+ themeMode: inheritedThemeMode,
875
+ theme: inheritedTheme
876
+ } = useContext(ThemeContext);
877
+ const density = (_a = densityProp != null ? densityProp : inheritedDensity) != null ? _a : DEFAULT_DENSITY2;
878
+ const themeMode = (_b = themeModeProp != null ? themeModeProp : inheritedThemeMode) != null ? _b : DEFAULT_THEME_MODE;
879
+ const theme = (_c = themeProp != null ? themeProp : inheritedTheme) != null ? _c : DEFAULT_THEME;
880
+ const themedChildren = applyThemeClasses ? createThemedChildren(children, theme, themeMode, density) : children;
881
+ return /* @__PURE__ */ jsx12(ThemeContext.Provider, { value: { themeMode, density, theme }, children: themedChildren });
882
+ };
883
+ ThemeProvider.displayName = "ThemeProvider";
884
+
830
885
  // src/shell.tsx
831
886
  import { logger } from "@vuu-ui/vuu-utils";
887
+
888
+ // src/shell-layouts/useFullHeightLeftPanel.tsx
889
+ import { DraggableLayout, Flexbox } from "@vuu-ui/vuu-layout";
890
+
891
+ // src/shell-layouts/context-panel/ContextPanel.tsx
892
+ import { Button as Button5 } from "@salt-ds/core";
893
+ import cx7 from "classnames";
894
+ import { useCallback as useCallback7 } from "react";
895
+ import { useLayoutProviderDispatch } from "@vuu-ui/vuu-layout";
832
896
  import { jsx as jsx13, jsxs as jsxs9 } from "react/jsx-runtime";
897
+ var classBase6 = "vuuContextPanel";
898
+ var ContextPanel = ({
899
+ className: classNameProp,
900
+ expanded = false,
901
+ overlay = false,
902
+ title
903
+ }) => {
904
+ const dispatchLayoutAction = useLayoutProviderDispatch();
905
+ const handleClose = useCallback7(() => {
906
+ dispatchLayoutAction({
907
+ path: "#context-panel",
908
+ propName: "expanded",
909
+ propValue: false,
910
+ type: "set-prop"
911
+ });
912
+ }, [dispatchLayoutAction]);
913
+ const className = cx7(classBase6, classNameProp, {
914
+ [`${classBase6}-expanded`]: expanded,
915
+ [`${classBase6}-inline`]: overlay !== true,
916
+ [`${classBase6}-overlay`]: overlay
917
+ });
918
+ return /* @__PURE__ */ jsx13("div", { className: cx7(classBase6, className), children: /* @__PURE__ */ jsx13("div", { className: `${classBase6}-inner`, children: /* @__PURE__ */ jsxs9("div", { className: `${classBase6}-header`, children: [
919
+ /* @__PURE__ */ jsx13("h2", { className: `${classBase6}-title`, children: title }),
920
+ /* @__PURE__ */ jsx13(
921
+ Button5,
922
+ {
923
+ className: `${classBase6}-close`,
924
+ "data-icon": "close",
925
+ onClick: handleClose,
926
+ variant: "secondary"
927
+ }
928
+ )
929
+ ] }) }) });
930
+ };
931
+
932
+ // src/left-nav/LeftNav.tsx
933
+ import { Action, useLayoutProviderDispatch as useLayoutProviderDispatch2 } from "@vuu-ui/vuu-layout";
934
+ import cx8 from "classnames";
935
+ import { useCallback as useCallback8, useRef as useRef2 } from "react";
936
+ import { jsx as jsx14, jsxs as jsxs10 } from "react/jsx-runtime";
937
+ var classBase7 = "vuuLeftNav";
938
+ var LeftNav = ({
939
+ "data-path": path,
940
+ onResize,
941
+ open = true,
942
+ ...htmlAttributes
943
+ }) => {
944
+ const dispatch = useLayoutProviderDispatch2();
945
+ const openRef = useRef2(open);
946
+ const toggleSize = useCallback8(() => {
947
+ openRef.current = !openRef.current;
948
+ dispatch({
949
+ type: Action.LAYOUT_RESIZE,
950
+ path,
951
+ size: openRef.current ? 240 : 80
952
+ });
953
+ }, [dispatch, path]);
954
+ return /* @__PURE__ */ jsxs10("div", { ...htmlAttributes, className: classBase7, children: [
955
+ /* @__PURE__ */ jsxs10("div", { className: "vuuLeftNav-logo", children: [
956
+ /* @__PURE__ */ jsxs10(
957
+ "svg",
958
+ {
959
+ width: "44",
960
+ height: "45",
961
+ viewBox: "0 0 44 45",
962
+ fill: "none",
963
+ xmlns: "http://www.w3.org/2000/svg",
964
+ children: [
965
+ /* @__PURE__ */ jsxs10("g", { clipPath: "url(#clip0_217_6990)", children: [
966
+ /* @__PURE__ */ jsx14(
967
+ "path",
968
+ {
969
+ d: "M39.8642 15.5509L35.9196 7.58974L34.3369 6.85464L24.6235 22.0825L39.1628 30.618L42.3152 25.6347L39.8642 15.5509Z",
970
+ fill: "url(#paint0_linear_217_6990)"
971
+ }
972
+ ),
973
+ /* @__PURE__ */ jsx14(
974
+ "path",
975
+ {
976
+ 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",
977
+ fill: "url(#paint1_linear_217_6990)"
978
+ }
979
+ ),
980
+ /* @__PURE__ */ jsx14(
981
+ "path",
982
+ {
983
+ 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",
984
+ fill: "#F37880"
985
+ }
986
+ ),
987
+ /* @__PURE__ */ jsxs10("g", { opacity: "0.86", children: [
988
+ /* @__PURE__ */ jsx14(
989
+ "path",
990
+ {
991
+ 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",
992
+ fill: "white"
993
+ }
994
+ ),
995
+ /* @__PURE__ */ jsx14(
996
+ "path",
997
+ {
998
+ 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",
999
+ fill: "white"
1000
+ }
1001
+ ),
1002
+ /* @__PURE__ */ jsx14(
1003
+ "path",
1004
+ {
1005
+ 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",
1006
+ fill: "white"
1007
+ }
1008
+ )
1009
+ ] })
1010
+ ] }),
1011
+ /* @__PURE__ */ jsxs10("defs", { children: [
1012
+ /* @__PURE__ */ jsxs10(
1013
+ "linearGradient",
1014
+ {
1015
+ id: "paint0_linear_217_6990",
1016
+ x1: "24.6235",
1017
+ y1: "18.7363",
1018
+ x2: "42.3152",
1019
+ y2: "18.7363",
1020
+ gradientUnits: "userSpaceOnUse",
1021
+ children: [
1022
+ /* @__PURE__ */ jsx14("stop", { stopColor: "#4906A5" }),
1023
+ /* @__PURE__ */ jsx14("stop", { offset: "1", stopColor: "#D3423A" })
1024
+ ]
1025
+ }
1026
+ ),
1027
+ /* @__PURE__ */ jsxs10(
1028
+ "linearGradient",
1029
+ {
1030
+ id: "paint1_linear_217_6990",
1031
+ x1: "-2.35794e-05",
1032
+ y1: "22.5009",
1033
+ x2: "42.7186",
1034
+ y2: "22.5009",
1035
+ gradientUnits: "userSpaceOnUse",
1036
+ children: [
1037
+ /* @__PURE__ */ jsx14("stop", { stopColor: "#7C06A5" }),
1038
+ /* @__PURE__ */ jsx14("stop", { offset: "1", stopColor: "#D3423A" })
1039
+ ]
1040
+ }
1041
+ ),
1042
+ /* @__PURE__ */ jsx14("clipPath", { id: "clip0_217_6990", children: /* @__PURE__ */ jsx14("rect", { width: "44", height: "45", fill: "white" }) })
1043
+ ] })
1044
+ ]
1045
+ }
1046
+ ),
1047
+ " "
1048
+ ] }),
1049
+ /* @__PURE__ */ jsx14("div", { className: `${classBase7}-main`, children: /* @__PURE__ */ jsxs10("ul", { className: `${classBase7}-menu`, children: [
1050
+ /* @__PURE__ */ jsx14(
1051
+ "li",
1052
+ {
1053
+ className: cx8(
1054
+ `${classBase7}-menuitem`,
1055
+ `${classBase7}-menuitem-active`
1056
+ ),
1057
+ "data-icon": "demo",
1058
+ children: /* @__PURE__ */ jsx14("span", { className: `${classBase7}-menuitem-label`, children: "DEMO" })
1059
+ }
1060
+ ),
1061
+ /* @__PURE__ */ jsx14("li", { className: `${classBase7}-menuitem`, "data-icon": "tables", children: /* @__PURE__ */ jsx14("span", { className: `${classBase7}-menuitem-label`, children: "VUU TABLES" }) }),
1062
+ /* @__PURE__ */ jsx14("li", { className: `${classBase7}-menuitem`, "data-icon": "templates", children: /* @__PURE__ */ jsx14("span", { className: `${classBase7}-menuitem-label`, children: "LAYOUT TEMPLATES" }) }),
1063
+ /* @__PURE__ */ jsx14("li", { className: `${classBase7}-menuitem`, "data-icon": "layouts", children: /* @__PURE__ */ jsx14("span", { className: `${classBase7}-menuitem-label`, children: "MY LAYOUTS" }) })
1064
+ ] }) }),
1065
+ /* @__PURE__ */ jsx14("div", { className: "vuuLeftNav-buttonBar", children: /* @__PURE__ */ jsx14(
1066
+ "button",
1067
+ {
1068
+ className: cx8("vuuLeftNav-toggleButton", {
1069
+ "vuuLeftNav-toggleButton-open": openRef.current,
1070
+ "vuuLeftNav-toggleButton-closed": !openRef.current
1071
+ }),
1072
+ "data-icon": openRef.current ? "chevron-left" : "chevron-right",
1073
+ onClick: toggleSize
1074
+ }
1075
+ ) })
1076
+ ] });
1077
+ };
1078
+
1079
+ // src/shell-layouts/useFullHeightLeftPanel.tsx
1080
+ import { jsx as jsx15, jsxs as jsxs11 } from "react/jsx-runtime";
1081
+ var useFullHeightLeftPanel = ({
1082
+ appHeader
1083
+ }) => {
1084
+ return /* @__PURE__ */ jsxs11(
1085
+ Flexbox,
1086
+ {
1087
+ className: "App",
1088
+ style: {
1089
+ flexDirection: "row",
1090
+ height: "100%",
1091
+ width: "100%"
1092
+ },
1093
+ children: [
1094
+ /* @__PURE__ */ jsx15(
1095
+ LeftNav,
1096
+ {
1097
+ style: {
1098
+ width: 240
1099
+ }
1100
+ }
1101
+ ),
1102
+ /* @__PURE__ */ jsxs11(
1103
+ Flexbox,
1104
+ {
1105
+ className: "vuuShell-content",
1106
+ style: {
1107
+ flexDirection: "column",
1108
+ flex: 1,
1109
+ padding: 8
1110
+ },
1111
+ children: [
1112
+ appHeader,
1113
+ /* @__PURE__ */ jsx15(DraggableLayout, { dropTarget: true, style: { flex: 1 } }, "main-content")
1114
+ ]
1115
+ }
1116
+ ),
1117
+ /* @__PURE__ */ jsx15(
1118
+ ContextPanel,
1119
+ {
1120
+ id: "context-panel",
1121
+ overlay: true,
1122
+ title: "Column Settings"
1123
+ }
1124
+ )
1125
+ ]
1126
+ }
1127
+ );
1128
+ };
1129
+
1130
+ // src/shell-layouts/useInlayLeftPanel.tsx
1131
+ import {
1132
+ DockLayout,
1133
+ DraggableLayout as DraggableLayout2,
1134
+ Drawer,
1135
+ Flexbox as Flexbox2,
1136
+ View
1137
+ } from "@vuu-ui/vuu-layout";
1138
+ import { useCallback as useCallback9, useRef as useRef3, useState as useState6 } from "react";
1139
+ import { jsx as jsx16, jsxs as jsxs12 } from "react/jsx-runtime";
1140
+ var useInlayLeftPanel = ({
1141
+ appHeader,
1142
+ leftSidePanel
1143
+ }) => {
1144
+ const paletteView = useRef3(null);
1145
+ const [open, setOpen] = useState6(true);
1146
+ const handleDrawerClick = useCallback9(
1147
+ (e) => {
1148
+ var _a;
1149
+ const target = e.target;
1150
+ if (!((_a = paletteView.current) == null ? void 0 : _a.contains(target))) {
1151
+ setOpen(!open);
1152
+ }
1153
+ },
1154
+ [open]
1155
+ );
1156
+ const getDrawers = useCallback9(
1157
+ (leftSidePanel2) => {
1158
+ const drawers = [];
1159
+ drawers.push(
1160
+ /* @__PURE__ */ jsx16(
1161
+ Drawer,
1162
+ {
1163
+ onClick: handleDrawerClick,
1164
+ open,
1165
+ position: "left",
1166
+ inline: true,
1167
+ peekaboo: true,
1168
+ sizeOpen: 200,
1169
+ toggleButton: "end",
1170
+ children: /* @__PURE__ */ jsx16(
1171
+ View,
1172
+ {
1173
+ className: "vuuShell-palette",
1174
+ id: "vw-app-palette",
1175
+ ref: paletteView,
1176
+ style: { height: "100%" },
1177
+ children: leftSidePanel2
1178
+ },
1179
+ "app-palette"
1180
+ )
1181
+ },
1182
+ "left-panel"
1183
+ )
1184
+ );
1185
+ return drawers;
1186
+ },
1187
+ [handleDrawerClick, open]
1188
+ );
1189
+ return /* @__PURE__ */ jsxs12(
1190
+ Flexbox2,
1191
+ {
1192
+ className: "App",
1193
+ style: { flexDirection: "column", height: "100%", width: "100%" },
1194
+ children: [
1195
+ appHeader,
1196
+ /* @__PURE__ */ jsx16(DockLayout, { style: { flex: 1 }, children: getDrawers(leftSidePanel).concat(
1197
+ /* @__PURE__ */ jsx16(
1198
+ DraggableLayout2,
1199
+ {
1200
+ dropTarget: true,
1201
+ style: { width: "100%", height: "100%" }
1202
+ },
1203
+ "main-content"
1204
+ )
1205
+ ) })
1206
+ ]
1207
+ }
1208
+ );
1209
+ };
1210
+
1211
+ // src/shell-layouts/useShellLayout.ts
1212
+ var useShellLayout = ({
1213
+ leftSidePanelLayout = "inlay",
1214
+ ...props
1215
+ }) => {
1216
+ const useLayoutHook = leftSidePanelLayout === "inlay" ? useInlayLeftPanel : useFullHeightLeftPanel;
1217
+ return useLayoutHook(props);
1218
+ };
1219
+
1220
+ // src/shell.tsx
1221
+ import { jsx as jsx17, jsxs as jsxs13 } from "react/jsx-runtime";
833
1222
  var { error } = logger("Shell");
834
1223
  var warningLayout = {
835
1224
  type: "View",
@@ -850,6 +1239,7 @@ var Shell = ({
850
1239
  className: classNameProp,
851
1240
  defaultLayout = warningLayout,
852
1241
  leftSidePanel,
1242
+ leftSidePanelLayout,
853
1243
  loginUrl,
854
1244
  saveLocation = "remote",
855
1245
  saveUrl,
@@ -857,16 +1247,14 @@ var Shell = ({
857
1247
  user,
858
1248
  ...htmlAttributes
859
1249
  }) => {
860
- const rootRef = useRef2(null);
861
- const paletteView = useRef2(null);
862
- const [open, setOpen] = useState6(false);
863
- const layoutId = useRef2("latest");
1250
+ const rootRef = useRef4(null);
1251
+ const layoutId = useRef4("latest");
864
1252
  const [layout, saveLayoutConfig, loadLayoutById] = useLayoutConfig({
865
1253
  defaultLayout,
866
1254
  saveLocation,
867
1255
  user
868
1256
  });
869
- const handleLayoutChange = useCallback7(
1257
+ const handleLayoutChange = useCallback10(
870
1258
  (layout2) => {
871
1259
  try {
872
1260
  saveLayoutConfig(layout2);
@@ -876,19 +1264,12 @@ var Shell = ({
876
1264
  },
877
1265
  [saveLayoutConfig]
878
1266
  );
879
- const handleSwitchTheme = useCallback7((mode) => {
1267
+ const handleSwitchTheme = useCallback10((mode) => {
880
1268
  if (rootRef.current) {
881
1269
  rootRef.current.dataset.mode = mode;
882
1270
  }
883
1271
  }, []);
884
- const handleDrawerClick = (e) => {
885
- var _a;
886
- const target = e.target;
887
- if (!((_a = paletteView.current) == null ? void 0 : _a.contains(target))) {
888
- setOpen(!open);
889
- }
890
- };
891
- const handleNavigate = useCallback7(
1272
+ const handleNavigate = useCallback10(
892
1273
  (id) => {
893
1274
  layoutId.current = id;
894
1275
  loadLayoutById(id);
@@ -904,83 +1285,33 @@ var Shell = ({
904
1285
  });
905
1286
  }
906
1287
  }, [serverUrl, user.token, user.username]);
907
- const getDrawers = () => {
908
- const drawers = [];
909
- if (leftSidePanel) {
910
- drawers.push(
911
- /* @__PURE__ */ jsx13(
912
- Drawer,
913
- {
914
- onClick: handleDrawerClick,
915
- open,
916
- position: "left",
917
- inline: true,
918
- peekaboo: true,
919
- sizeOpen: 200,
920
- toggleButton: "end",
921
- children: /* @__PURE__ */ jsx13(
922
- View,
923
- {
924
- className: "vuuShell-palette",
925
- id: "vw-app-palette",
926
- ref: paletteView,
927
- style: { height: "100%" },
928
- children: leftSidePanel
929
- },
930
- "app-palette"
931
- )
932
- },
933
- "left-panel"
934
- )
935
- );
936
- }
937
- return drawers;
938
- };
939
- const className = cx6(
940
- "vuuShell",
941
- classNameProp,
942
- "salt-theme",
943
- "salt-density-high"
944
- );
1288
+ const [themeClass, densityClass, dataMode] = useThemeAttributes();
1289
+ const className = cx9("vuuShell", classNameProp, themeClass, densityClass);
1290
+ const shellLayout = useShellLayout({
1291
+ leftSidePanelLayout,
1292
+ appHeader: /* @__PURE__ */ jsx17(
1293
+ AppHeader,
1294
+ {
1295
+ layoutId: layoutId.current,
1296
+ loginUrl,
1297
+ user,
1298
+ onNavigate: handleNavigate,
1299
+ onSwitchTheme: handleSwitchTheme
1300
+ }
1301
+ ),
1302
+ leftSidePanel
1303
+ });
945
1304
  return (
946
1305
  // ShellContext TBD
947
- /* @__PURE__ */ jsxs9(ShellContextProvider, { value: void 0, children: [
948
- /* @__PURE__ */ jsx13(LayoutProvider, { layout, onLayoutChange: handleLayoutChange, children: /* @__PURE__ */ jsx13(
949
- DraggableLayout,
1306
+ /* @__PURE__ */ jsxs13(ThemeProvider, { children: [
1307
+ /* @__PURE__ */ jsx17(LayoutProvider, { layout, onLayoutChange: handleLayoutChange, children: /* @__PURE__ */ jsx17(
1308
+ DraggableLayout3,
950
1309
  {
951
1310
  className,
952
- "data-mode": "light",
1311
+ "data-mode": dataMode,
953
1312
  ref: rootRef,
954
1313
  ...htmlAttributes,
955
- children: /* @__PURE__ */ jsxs9(
956
- Flexbox,
957
- {
958
- className: "App",
959
- style: { flexDirection: "column", height: "100%", width: "100%" },
960
- children: [
961
- /* @__PURE__ */ jsx13(
962
- AppHeader,
963
- {
964
- layoutId: layoutId.current,
965
- loginUrl,
966
- user,
967
- onNavigate: handleNavigate,
968
- onSwitchTheme: handleSwitchTheme
969
- }
970
- ),
971
- /* @__PURE__ */ jsx13(DockLayout, { style: { flex: 1 }, children: getDrawers().concat(
972
- /* @__PURE__ */ jsx13(
973
- DraggableLayout,
974
- {
975
- dropTarget: true,
976
- style: { width: "100%", height: "100%" }
977
- },
978
- "main-content"
979
- )
980
- ) })
981
- ]
982
- }
983
- )
1314
+ children: shellLayout
984
1315
  }
985
1316
  ) }),
986
1317
  children
@@ -988,70 +1319,31 @@ var Shell = ({
988
1319
  );
989
1320
  };
990
1321
 
991
- // src/theme-provider/ThemeProvider.tsx
992
- import {
993
- createContext as createContext2,
994
- isValidElement,
995
- cloneElement,
996
- useContext as useContext2
997
- } from "react";
998
- import cx7 from "classnames";
999
- import { jsx as jsx14 } from "react/jsx-runtime";
1000
- var DEFAULT_DENSITY2 = "medium";
1001
- var DEFAULT_THEME = "salt-theme";
1002
- var DEFAULT_THEME_MODE = "light";
1003
- var ThemeContext = createContext2({
1004
- density: "high",
1005
- theme: "salt-theme",
1006
- themeMode: "light"
1007
- });
1008
- var createThemedChildren = (children, theme, themeMode, density) => {
1009
- var _a;
1010
- if (isValidElement(children)) {
1011
- return cloneElement(children, {
1012
- className: cx7(
1013
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
1014
- (_a = children.props) == null ? void 0 : _a.className,
1015
- theme,
1016
- `salt-density-${density}`
1017
- ),
1018
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
1019
- // @ts-expect-error
1020
- "data-mode": themeMode
1021
- });
1022
- } else {
1023
- console.warn(
1024
- `
1025
- ThemeProvider can only apply CSS classes for theming to a single nested child element of the ThemeProvider.
1026
- Wrap elements with a single container`
1027
- );
1028
- return children;
1029
- }
1322
+ // src/ShellContextProvider.tsx
1323
+ import { createContext as createContext2, useContext as useContext2 } from "react";
1324
+ import { jsx as jsx18 } from "react/jsx-runtime";
1325
+ var defaultConfig = {};
1326
+ var ShellContext = createContext2(defaultConfig);
1327
+ var Provider = ({
1328
+ children,
1329
+ context,
1330
+ inheritedContext
1331
+ }) => {
1332
+ const mergedContext = {
1333
+ ...inheritedContext,
1334
+ ...context
1335
+ };
1336
+ return /* @__PURE__ */ jsx18(ShellContext.Provider, { value: mergedContext, children });
1030
1337
  };
1031
- var ThemeProvider = ({
1338
+ var ShellContextProvider = ({
1032
1339
  children,
1033
- theme: themeProp,
1034
- themeMode: themeModeProp,
1035
- density: densityProp
1340
+ value
1036
1341
  }) => {
1037
- var _a, _b, _c;
1038
- const {
1039
- density: inheritedDensity,
1040
- themeMode: inheritedThemeMode,
1041
- theme: inheritedTheme
1042
- } = useContext2(ThemeContext);
1043
- const density = (_a = densityProp != null ? densityProp : inheritedDensity) != null ? _a : DEFAULT_DENSITY2;
1044
- const themeMode = (_b = themeModeProp != null ? themeModeProp : inheritedThemeMode) != null ? _b : DEFAULT_THEME_MODE;
1045
- const theme = (_c = themeProp != null ? themeProp : inheritedTheme) != null ? _c : DEFAULT_THEME;
1046
- const themedChildren = createThemedChildren(
1047
- children,
1048
- theme,
1049
- themeMode,
1050
- density
1051
- );
1052
- return /* @__PURE__ */ jsx14(ThemeContext.Provider, { value: { themeMode, density, theme }, children: themedChildren });
1342
+ return /* @__PURE__ */ jsx18(ShellContext.Consumer, { children: (context) => /* @__PURE__ */ jsx18(Provider, { context: value, inheritedContext: context, children }) });
1343
+ };
1344
+ var useShellContext = () => {
1345
+ return useContext2(ShellContext);
1053
1346
  };
1054
- ThemeProvider.displayName = "ThemeProvider";
1055
1347
  export {
1056
1348
  ConnectionStatusIcon,
1057
1349
  DEFAULT_DENSITY2 as DEFAULT_DENSITY,
@@ -1069,6 +1361,7 @@ export {
1069
1361
  getAuthDetailsFromCookies,
1070
1362
  logout,
1071
1363
  redirectToLogin,
1072
- useShellContext
1364
+ useShellContext,
1365
+ useThemeAttributes
1073
1366
  };
1074
1367
  //# sourceMappingURL=index.js.map