@vuu-ui/vuu-shell 2.1.19-beta.1 → 2.1.19-beta.2

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.
Files changed (64) hide show
  1. package/package.json +15 -16
  2. package/src/ShellContextProvider.js +20 -0
  3. package/src/app-header/AppHeader.css.js +21 -0
  4. package/src/app-header/AppHeader.js +97 -0
  5. package/src/app-header/index.js +1 -0
  6. package/src/application-provider/ApplicationContext.js +9 -0
  7. package/src/application-provider/ApplicationProvider.js +77 -0
  8. package/src/application-provider/index.js +1 -0
  9. package/src/feature/Feature.js +37 -0
  10. package/src/feature/FeatureErrorBoundary.js +33 -0
  11. package/src/feature/Loader.js +5 -0
  12. package/src/feature/index.js +1 -0
  13. package/src/feature-and-layout-provider/FeatureAndLayoutProvider.js +42 -0
  14. package/src/feature-and-layout-provider/index.js +1 -0
  15. package/src/feature-list/FeatureList.css.js +62 -0
  16. package/src/feature-list/FeatureList.js +128 -0
  17. package/src/feature-list/index.js +1 -0
  18. package/src/get-layout-history.js +7 -0
  19. package/src/index.js +14 -0
  20. package/src/left-nav/LeftNav.css.js +177 -0
  21. package/src/left-nav/LeftNav.js +193 -0
  22. package/src/left-nav/index.js +1 -0
  23. package/src/login/LoginPanel.css.js +72 -0
  24. package/src/login/LoginPanel.js +124 -0
  25. package/src/login/VuuLogo.js +108 -0
  26. package/src/persistence-manager/LocalPersistenceManager.js +156 -0
  27. package/src/persistence-manager/PersistenceManager.js +0 -0
  28. package/src/persistence-manager/PersistenceProvider.js +14 -0
  29. package/src/persistence-manager/RemotePersistenceManager.js +123 -0
  30. package/src/persistence-manager/StaticPersistenceManager.js +53 -0
  31. package/src/persistence-manager/index.js +5 -0
  32. package/src/shell-layout-templates/context-panel/ContextPanel.css.js +66 -0
  33. package/src/shell-layout-templates/context-panel/ContextPanel.js +92 -0
  34. package/src/shell-layout-templates/context-panel/index.js +1 -0
  35. package/src/shell-layout-templates/full-height-left-panel/useFullHeightLeftPanel.js +44 -0
  36. package/src/shell-layout-templates/index.js +3 -0
  37. package/src/shell-layout-templates/inlay-left-panel/useInlayLeftPanel.js +68 -0
  38. package/src/shell-layout-templates/left-main-tabs/useLeftMainTabs.js +32 -0
  39. package/src/shell-layout-templates/side-panel/SidePanel.css.js +9 -0
  40. package/src/shell-layout-templates/side-panel/SidePanel.js +31 -0
  41. package/src/shell-layout-templates/side-panel/index.js +1 -0
  42. package/src/shell-layout-templates/simple-content-pane/useSimpleContentPane.js +38 -0
  43. package/src/shell-layout-templates/useShellLayout.js +15 -0
  44. package/src/shell.css.js +59 -0
  45. package/src/shell.js +108 -0
  46. package/src/theme-switch/ThemeSwitch.css.js +34 -0
  47. package/src/theme-switch/ThemeSwitch.js +50 -0
  48. package/src/theme-switch/index.js +1 -0
  49. package/src/user-settings/SettingsForm.css.js +10 -0
  50. package/src/user-settings/SettingsForm.js +141 -0
  51. package/src/user-settings/UserSettingsPanel.css.js +9 -0
  52. package/src/user-settings/UserSettingsPanel.js +29 -0
  53. package/src/user-settings/index.js +2 -0
  54. package/src/workspace-management/LayoutList.css.js +74 -0
  55. package/src/workspace-management/LayoutList.js +130 -0
  56. package/src/workspace-management/LayoutTile.css.js +31 -0
  57. package/src/workspace-management/LayoutTile.js +41 -0
  58. package/src/workspace-management/SaveLayoutPanel.css.js +123 -0
  59. package/src/workspace-management/SaveLayoutPanel.js +141 -0
  60. package/src/workspace-management/WorkspaceProvider.js +209 -0
  61. package/src/workspace-management/defaultWorkspaceJSON.js +88 -0
  62. package/src/workspace-management/index.js +5 -0
  63. package/src/workspace-management/screenshot-utils.js +13 -0
  64. package/src/workspace-management/useWorkspaceContextMenuItems.js +58 -0
package/package.json CHANGED
@@ -1,27 +1,27 @@
1
1
  {
2
- "version": "2.1.19-beta.1",
2
+ "version": "2.1.19-beta.2",
3
3
  "description": "VUU UI Shell",
4
4
  "author": "heswell",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
7
7
  "devDependencies": {
8
- "@vuu-ui/vuu-data-types": "2.1.19-beta.1",
9
- "@vuu-ui/vuu-protocol-types": "2.1.19-beta.1",
10
- "@vuu-ui/vuu-table-types": "2.1.19-beta.1"
8
+ "@vuu-ui/vuu-data-types": "2.1.19-beta.2",
9
+ "@vuu-ui/vuu-protocol-types": "2.1.19-beta.2",
10
+ "@vuu-ui/vuu-table-types": "2.1.19-beta.2"
11
11
  },
12
12
  "dependencies": {
13
13
  "@salt-ds/core": "1.54.1",
14
14
  "@salt-ds/styles": "0.2.1",
15
15
  "@salt-ds/window": "0.1.1",
16
- "@vuu-ui/vuu-context-menu": "2.1.19-beta.1",
17
- "@vuu-ui/vuu-data-react": "2.1.19-beta.1",
18
- "@vuu-ui/vuu-data-remote": "2.1.19-beta.1",
19
- "@vuu-ui/vuu-icons": "2.1.19-beta.1",
20
- "@vuu-ui/vuu-layout": "2.1.19-beta.1",
21
- "@vuu-ui/vuu-notifications": "2.1.19-beta.1",
22
- "@vuu-ui/vuu-table": "2.1.19-beta.1",
23
- "@vuu-ui/vuu-ui-controls": "2.1.19-beta.1",
24
- "@vuu-ui/vuu-utils": "2.1.19-beta.1",
16
+ "@vuu-ui/vuu-context-menu": "2.1.19-beta.2",
17
+ "@vuu-ui/vuu-data-react": "2.1.19-beta.2",
18
+ "@vuu-ui/vuu-data-remote": "2.1.19-beta.2",
19
+ "@vuu-ui/vuu-icons": "2.1.19-beta.2",
20
+ "@vuu-ui/vuu-layout": "2.1.19-beta.2",
21
+ "@vuu-ui/vuu-notifications": "2.1.19-beta.2",
22
+ "@vuu-ui/vuu-table": "2.1.19-beta.2",
23
+ "@vuu-ui/vuu-ui-controls": "2.1.19-beta.2",
24
+ "@vuu-ui/vuu-utils": "2.1.19-beta.2",
25
25
  "html-to-image": "^1.11.11"
26
26
  },
27
27
  "peerDependencies": {
@@ -32,13 +32,12 @@
32
32
  "sideEffects": false,
33
33
  "files": [
34
34
  "README.md",
35
- "esm",
36
- "cjs",
35
+ "src",
37
36
  "/types"
38
37
  ],
39
38
  "exports": {
40
39
  ".": {
41
- "import": "./index.js",
40
+ "import": "./src/index.js",
42
41
  "types": "./types/index.d.ts"
43
42
  }
44
43
  },
@@ -0,0 +1,20 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { ShellContext } from "@vuu-ui/vuu-utils";
3
+ const Provider = ({ children, context, inheritedContext })=>{
4
+ const mergedContext = {
5
+ ...inheritedContext,
6
+ ...context
7
+ };
8
+ return /*#__PURE__*/ jsx(ShellContext.Provider, {
9
+ value: mergedContext,
10
+ children: children
11
+ });
12
+ };
13
+ const ShellContextProvider = ({ children, value })=>/*#__PURE__*/ jsx(ShellContext.Consumer, {
14
+ children: (context)=>/*#__PURE__*/ jsx(Provider, {
15
+ context: value,
16
+ inheritedContext: context,
17
+ children: children
18
+ })
19
+ });
20
+ export { ShellContextProvider };
@@ -0,0 +1,21 @@
1
+ const css = `
2
+ .vuuAppHeader {
3
+ --saltButton-borderRadius: 6px;
4
+ --saltButton-text-color: var(--vuu-color-gray-50);
5
+ --saltButton-padding: 12px;
6
+ --vuuToolbarItem-height: 26px;
7
+ --vuuOverflowContainer-gap: 8px;
8
+ --vuuOverflowContainer-height: var(--vuuAppHeader-height, 42px);
9
+ --vuu-icon-color: var(--vuu-color-gray-45);
10
+ --vuu-icon-size: 16px;
11
+ --vuuToolbar-borderWidth: 1px;
12
+ --vuuToolbar-borderStyle: solid;
13
+ --vuuToolbar-borderColor: var(--salt-separable-primary-borderColor);
14
+ justify-content: flex-end;
15
+ align-items: center;
16
+ display: flex;
17
+ }
18
+
19
+
20
+ `;
21
+ export default css;
@@ -0,0 +1,97 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { Button } from "@salt-ds/core";
3
+ import { useComponentCssInjection } from "@salt-ds/styles";
4
+ import { useWindow } from "@salt-ds/window";
5
+ import { useLayoutOperation } from "@vuu-ui/vuu-layout";
6
+ import { Toolbar } from "@vuu-ui/vuu-ui-controls";
7
+ import clsx from "clsx";
8
+ import { useCallback, useRef } from "react";
9
+ import { usePersistenceManager } from "../persistence-manager/index.js";
10
+ import { NotificationType, useNotifications } from "@vuu-ui/vuu-notifications";
11
+ import { useLogout } from "../application-provider/index.js";
12
+ import AppHeader from "./AppHeader.css";
13
+ const classBase = "vuuAppHeader";
14
+ const AppHeader_AppHeader = ({ className: classNameProp, themeMode: _, ...htmlAttributes })=>{
15
+ const targetWindow = useWindow();
16
+ useComponentCssInjection({
17
+ testId: "vuu-app-header",
18
+ css: AppHeader,
19
+ window: targetWindow
20
+ });
21
+ const persistenceManager = usePersistenceManager();
22
+ const settingsButtonRef = useRef(null);
23
+ const className = clsx(classBase, classNameProp);
24
+ const logout = useLogout();
25
+ const { showComponentInContextPanel } = useLayoutOperation();
26
+ const { showNotification } = useNotifications();
27
+ const handleReset = useCallback(()=>{
28
+ persistenceManager?.clearUserSettings();
29
+ showNotification({
30
+ animationType: "slide-out",
31
+ renderPostRefresh: true,
32
+ type: NotificationType.Toast,
33
+ header: "Success",
34
+ content: "Settings cleared",
35
+ status: "success"
36
+ });
37
+ location.reload();
38
+ }, [
39
+ persistenceManager,
40
+ showNotification
41
+ ]);
42
+ const handleShowSettings = useCallback(()=>{
43
+ showComponentInContextPanel({
44
+ type: "ApplicationSettings"
45
+ }, "Settings", ()=>settingsButtonRef.current?.focus());
46
+ }, [
47
+ showComponentInContextPanel
48
+ ]);
49
+ return /*#__PURE__*/ jsxs(Toolbar, {
50
+ alignItems: "end",
51
+ className: className,
52
+ role: "banner",
53
+ showSeparators: true,
54
+ ...htmlAttributes,
55
+ children: [
56
+ /*#__PURE__*/ jsx(Button, {
57
+ className: `${classBase}-menuItem`,
58
+ appearance: "transparent",
59
+ sentiment: "neutral",
60
+ children: "Help"
61
+ }),
62
+ /*#__PURE__*/ jsxs(Button, {
63
+ appearance: "transparent",
64
+ className: `${classBase}-menuItem`,
65
+ onClick: handleReset,
66
+ sentiment: "neutral",
67
+ children: [
68
+ "Reset ",
69
+ /*#__PURE__*/ jsx("span", {
70
+ "data-icon": "history"
71
+ })
72
+ ]
73
+ }),
74
+ /*#__PURE__*/ jsxs(Button, {
75
+ appearance: "transparent",
76
+ className: `${classBase}-menuItem`,
77
+ onClick: handleShowSettings,
78
+ ref: settingsButtonRef,
79
+ sentiment: "neutral",
80
+ children: [
81
+ "Settings ",
82
+ /*#__PURE__*/ jsx("span", {
83
+ "data-icon": "settings"
84
+ })
85
+ ]
86
+ }),
87
+ /*#__PURE__*/ jsx(Button, {
88
+ appearance: "transparent",
89
+ className: `${classBase}-menuItem`,
90
+ onClick: logout,
91
+ sentiment: "neutral",
92
+ children: "Log out"
93
+ })
94
+ ]
95
+ });
96
+ };
97
+ export { AppHeader_AppHeader as AppHeader };
@@ -0,0 +1 @@
1
+ export * from "./AppHeader.js";
@@ -0,0 +1,9 @@
1
+ import { createContext } from "react";
2
+ const Guest = {
3
+ username: "unknown"
4
+ };
5
+ const ApplicationContext = /*#__PURE__*/ createContext({
6
+ onUserSettingChanged: (propertyName)=>console.warn(`Cannot change setting '${propertyName}'.\nDid you forget to declare an ApplicationProvider ?`),
7
+ user: Guest
8
+ });
9
+ export { ApplicationContext };
@@ -0,0 +1,77 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { SaltProviderNext, useDensity, useTheme } from "@salt-ds/core";
3
+ import { useCallback, useContext, useMemo, useState } from "react";
4
+ import { ApplicationContext } from "./ApplicationContext.js";
5
+ import { usePersistenceManager } from "../persistence-manager/index.js";
6
+ const accentPurple = "purple";
7
+ const getThemeMode = (mode = "light", userSettings)=>{
8
+ const themeMode = userSettings?.themeMode;
9
+ if ("light" === themeMode || "dark" === themeMode) return themeMode;
10
+ return mode;
11
+ };
12
+ const ApplicationProvider = ({ children, density: densityProp, logout, mode, theme, userSettingsSchema: userSettingsSchema, user })=>{
13
+ const { mode: inheritedMode, theme: inheritedTheme } = useTheme();
14
+ const density = useDensity(densityProp);
15
+ const persistenceManager = usePersistenceManager();
16
+ const context = useContext(ApplicationContext);
17
+ const [userSettings, setSettings] = useState();
18
+ useMemo(async ()=>{
19
+ if (persistenceManager) {
20
+ const userSettings = await persistenceManager.getUserSettings();
21
+ setSettings(userSettings);
22
+ } else setSettings({});
23
+ }, [
24
+ persistenceManager
25
+ ]);
26
+ const onUserSettingChanged = useCallback((propertyName, value)=>{
27
+ setSettings((currentSettings)=>{
28
+ const newSettings = {
29
+ ...currentSettings,
30
+ [propertyName]: value
31
+ };
32
+ persistenceManager?.saveUserSettings(newSettings);
33
+ return newSettings;
34
+ });
35
+ }, [
36
+ persistenceManager
37
+ ]);
38
+ return userSettings ? /*#__PURE__*/ jsx(ApplicationContext.Provider, {
39
+ value: {
40
+ ...context,
41
+ logout,
42
+ onUserSettingChanged,
43
+ userSettings,
44
+ userSettingsSchema,
45
+ user: user ?? context.user
46
+ },
47
+ children: /*#__PURE__*/ jsx(SaltProviderNext, {
48
+ accent: accentPurple,
49
+ corner: "rounded",
50
+ theme: theme ?? inheritedTheme ?? "vuu-theme",
51
+ density: density,
52
+ mode: getThemeMode(mode ?? inheritedMode, userSettings),
53
+ children: children
54
+ })
55
+ }) : null;
56
+ };
57
+ const useApplicationUser = ()=>{
58
+ const { user } = useContext(ApplicationContext);
59
+ return user;
60
+ };
61
+ const useApplicationSettings = ()=>{
62
+ const { onUserSettingChanged, userSettings, userSettingsSchema } = useContext(ApplicationContext);
63
+ return {
64
+ onUserSettingChanged,
65
+ userSettings,
66
+ userSettingsSchema
67
+ };
68
+ };
69
+ const useUserSetting = ()=>{
70
+ const { userSettings } = useContext(ApplicationContext);
71
+ return userSettings;
72
+ };
73
+ const useLogout = ()=>{
74
+ const { logout } = useContext(ApplicationContext);
75
+ return logout;
76
+ };
77
+ export { ApplicationProvider, useApplicationSettings, useApplicationUser, useLogout, useUserSetting };
@@ -0,0 +1 @@
1
+ export * from "./ApplicationProvider.js";
@@ -0,0 +1,37 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { importCSS, registerComponent } from "@vuu-ui/vuu-utils";
3
+ import react, { useEffect } from "react";
4
+ import { FeatureErrorBoundary } from "./FeatureErrorBoundary.js";
5
+ const componentsMap = new Map();
6
+ const useCachedFeature = (url)=>{
7
+ useEffect(()=>()=>{
8
+ componentsMap.delete(url);
9
+ }, [
10
+ url
11
+ ]);
12
+ if (!componentsMap.has(url)) componentsMap.set(url, /*#__PURE__*/ react.lazy(()=>import(/* @vite-ignore */ url)));
13
+ const lazyFeature = componentsMap.get(url);
14
+ if (lazyFeature) return lazyFeature;
15
+ throw Error(`Unable to load Lazy Feature at url ${url}`);
16
+ };
17
+ function RawFeature({ url, css, ComponentProps: params, ...props }) {
18
+ if (css) // import(/* @vite-ignore */ css, { assert: { type: "css" } }).then(
19
+ importCSS(css).then((styleSheet)=>{
20
+ document.adoptedStyleSheets = [
21
+ ...document.adoptedStyleSheets,
22
+ styleSheet
23
+ ];
24
+ });
25
+ const LazyFeature = useCachedFeature(url);
26
+ return /*#__PURE__*/ jsx(FeatureErrorBoundary, {
27
+ url: url,
28
+ children: /*#__PURE__*/ jsx(LazyFeature, {
29
+ ...props,
30
+ ...params
31
+ })
32
+ });
33
+ }
34
+ const Feature = /*#__PURE__*/ react.memo(RawFeature);
35
+ Feature.displayName = "Feature";
36
+ registerComponent("Feature", Feature, "view");
37
+ export { Feature };
@@ -0,0 +1,33 @@
1
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
+ import react from "react";
3
+ class FeatureErrorBoundary extends react.Component {
4
+ constructor(props){
5
+ super(props);
6
+ this.state = {
7
+ errorMessage: null
8
+ };
9
+ }
10
+ static getDerivedStateFromError(error) {
11
+ return {
12
+ errorMessage: error.message
13
+ };
14
+ }
15
+ componentDidCatch(error, errorInfo) {
16
+ console.log(`error creating component at ${this.props.url}`);
17
+ console.log(error, errorInfo);
18
+ }
19
+ render() {
20
+ if (this.state.errorMessage) return /*#__PURE__*/ jsxs(Fragment, {
21
+ children: [
22
+ /*#__PURE__*/ jsx("h1", {
23
+ children: "An error occured while creating component."
24
+ }),
25
+ /*#__PURE__*/ jsx("p", {
26
+ children: this.state.errorMessage
27
+ })
28
+ ]
29
+ });
30
+ return this.props.children;
31
+ }
32
+ }
33
+ export { FeatureErrorBoundary };
@@ -0,0 +1,5 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ const Loader = ()=>/*#__PURE__*/ jsx("div", {
3
+ className: "hwLoader"
4
+ });
5
+ export { Loader };
@@ -0,0 +1 @@
1
+ export * from "./Feature.js";
@@ -0,0 +1,42 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { getCustomAndTableFeatures } from "@vuu-ui/vuu-utils";
3
+ import { createContext, useContext, useMemo } from "react";
4
+ import { useVuuTables } from "@vuu-ui/vuu-data-react";
5
+ const NO_FEATURES = [];
6
+ const NO_STATICFEATURES = [];
7
+ const NO_SYSTEMLAYOUTS = [];
8
+ const NO_FEATURES_VUU = {
9
+ dynamicFeatures: NO_FEATURES,
10
+ tableFeatures: NO_FEATURES
11
+ };
12
+ const FeatureContext = /*#__PURE__*/ createContext({
13
+ dynamicFeatures: NO_FEATURES,
14
+ tableFeatures: NO_FEATURES,
15
+ staticFeatures: NO_STATICFEATURES
16
+ });
17
+ const LayoutContext = /*#__PURE__*/ createContext({
18
+ systemLayouts: NO_SYSTEMLAYOUTS
19
+ });
20
+ const FeatureAndLayoutProvider = ({ children, dynamicFeatures: dynamicFeaturesProp = [], staticFeatures, systemLayouts })=>{
21
+ const tableSchemas = useVuuTables();
22
+ const { dynamicFeatures, tableFeatures } = useMemo(()=>tableSchemas ? getCustomAndTableFeatures(dynamicFeaturesProp, tableSchemas) : NO_FEATURES_VUU, [
23
+ dynamicFeaturesProp,
24
+ tableSchemas
25
+ ]);
26
+ return /*#__PURE__*/ jsx(FeatureContext.Provider, {
27
+ value: {
28
+ dynamicFeatures,
29
+ tableFeatures,
30
+ staticFeatures
31
+ },
32
+ children: /*#__PURE__*/ jsx(LayoutContext.Provider, {
33
+ value: {
34
+ systemLayouts
35
+ },
36
+ children: children
37
+ })
38
+ });
39
+ };
40
+ const useFeatures = ()=>useContext(FeatureContext);
41
+ const useLayouts = ()=>useContext(LayoutContext);
42
+ export { FeatureAndLayoutProvider, useFeatures, useLayouts };
@@ -0,0 +1 @@
1
+ export * from "./FeatureAndLayoutProvider.js";
@@ -0,0 +1,62 @@
1
+ const css = `
2
+ .vuuFeatureList {
3
+ --vuuListItem-padding: var(--salt-spacing-200);
4
+ background: var(--vuuFeatureList-background, var(--salt-container-primary-background));
5
+ height: 100%;
6
+ padding: 0 var(--vuuFeatureList-padding, 0);
7
+ flex-direction: column;
8
+ display: flex;
9
+ }
10
+
11
+ .vuuFeatureList-header {
12
+ flex: 0 0 48px;
13
+ align-items: center;
14
+ font-weight: 700;
15
+ line-height: 2;
16
+ display: flex;
17
+ }
18
+
19
+ .vuuFeatureList-content {
20
+ flex-direction: column;
21
+ flex: auto;
22
+ font-size: 12px;
23
+ font-weight: 700;
24
+ display: flex;
25
+ overflow: auto;
26
+ }
27
+
28
+ .vuuFeatureList-standalone {
29
+ margin-top: 24px;
30
+ }
31
+
32
+ .vuuFeatureList-group {
33
+ --vuuMeasuredContainer-flex: 0 0 auto;
34
+ flex-direction: column;
35
+ display: flex;
36
+
37
+ & .vuuFeatureList-groupHeader {
38
+ flex: 0 0 32px;
39
+ padding: 8px 0;
40
+ }
41
+
42
+ & .vuuPalette {
43
+ flex: auto;
44
+ height: auto;
45
+ }
46
+ }
47
+
48
+ .vuuFeatureList-group:first-child {
49
+ margin-top: 12px;
50
+ }
51
+
52
+ .vuuFeatureList-group + .vuuFeatureList-group {
53
+ margin-top: 24px;
54
+ }
55
+
56
+ .vuuFeatureList-itemName {
57
+ font-weight: 700;
58
+ }
59
+
60
+
61
+ `;
62
+ export default css;
@@ -0,0 +1,128 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { Palette, PaletteItem } from "@vuu-ui/vuu-layout";
3
+ import { Icon } from "@vuu-ui/vuu-ui-controls";
4
+ import { featureFromJson, isStaticFeatures } from "@vuu-ui/vuu-utils";
5
+ import { useComponentCssInjection } from "@salt-ds/styles";
6
+ import { useWindow } from "@salt-ds/window";
7
+ import clsx from "clsx";
8
+ import { useMemo } from "react";
9
+ import { Feature } from "../feature/Feature.js";
10
+ import FeatureList from "./FeatureList.css";
11
+ const classBase = "vuuFeatureList";
12
+ const FeatureList_FeatureList = ({ features, title = "VUU TABLES", ...htmlAttributes })=>{
13
+ const targetWindow = useWindow();
14
+ useComponentCssInjection({
15
+ testId: "vuu-feature-list",
16
+ css: FeatureList,
17
+ window: targetWindow
18
+ });
19
+ const content = useMemo(()=>{
20
+ if (isStaticFeatures(features)) return features.map(({ label, type }, idx)=>/*#__PURE__*/ jsxs(PaletteItem, {
21
+ ViewProps: {
22
+ closeable: true,
23
+ header: true,
24
+ resize: "defer",
25
+ resizeable: true
26
+ },
27
+ component: featureFromJson({
28
+ type
29
+ }),
30
+ value: label,
31
+ children: [
32
+ /*#__PURE__*/ jsx(Icon, {
33
+ name: "draggable",
34
+ size: 18
35
+ }),
36
+ /*#__PURE__*/ jsx("span", {
37
+ className: `${classBase}-itemName`,
38
+ children: label
39
+ })
40
+ ]
41
+ }, idx));
42
+ if (Array.isArray(features)) return [
43
+ /*#__PURE__*/ jsx("div", {
44
+ className: `${classBase}-standalone`,
45
+ children: /*#__PURE__*/ jsx(Palette, {
46
+ orientation: "vertical",
47
+ children: features.map(({ ViewProps, ...featureProps }, i)=>/*#__PURE__*/ jsxs(PaletteItem, {
48
+ ViewProps: {
49
+ closeable: true,
50
+ header: true,
51
+ resize: "defer",
52
+ resizeable: true,
53
+ title: featureProps.title,
54
+ ...ViewProps
55
+ },
56
+ component: /*#__PURE__*/ jsx(Feature, {
57
+ ...featureProps
58
+ }),
59
+ value: featureProps.title,
60
+ children: [
61
+ /*#__PURE__*/ jsx(Icon, {
62
+ name: "draggable",
63
+ size: 18
64
+ }),
65
+ /*#__PURE__*/ jsx("span", {
66
+ className: `${classBase}-itemName`,
67
+ children: featureProps.title
68
+ })
69
+ ]
70
+ }, i))
71
+ }, "0")
72
+ }, 0)
73
+ ];
74
+ return Object.entries(features).map(([heading, featureList], index)=>/*#__PURE__*/ jsxs("div", {
75
+ className: `${classBase}-group`,
76
+ children: [
77
+ /*#__PURE__*/ jsx("div", {
78
+ className: `${classBase}-groupHeader`,
79
+ children: heading
80
+ }),
81
+ /*#__PURE__*/ jsx(Palette, {
82
+ orientation: "vertical",
83
+ children: featureList.map(({ ViewProps, ...featureProps }, i)=>/*#__PURE__*/ jsxs(PaletteItem, {
84
+ ViewProps: {
85
+ closeable: true,
86
+ header: true,
87
+ resize: "defer",
88
+ resizeable: true,
89
+ title: featureProps.title,
90
+ ...ViewProps
91
+ },
92
+ component: /*#__PURE__*/ jsx(Feature, {
93
+ ...featureProps
94
+ }),
95
+ value: featureProps.title,
96
+ children: [
97
+ /*#__PURE__*/ jsx(Icon, {
98
+ name: "draggable",
99
+ size: 18
100
+ }),
101
+ /*#__PURE__*/ jsx("span", {
102
+ className: `${classBase}-itemName`,
103
+ children: featureProps.title
104
+ })
105
+ ]
106
+ }, i))
107
+ })
108
+ ]
109
+ }, index));
110
+ }, [
111
+ features
112
+ ]);
113
+ return /*#__PURE__*/ jsxs("div", {
114
+ ...htmlAttributes,
115
+ className: clsx(classBase, "vuuScrollable"),
116
+ children: [
117
+ /*#__PURE__*/ jsx("div", {
118
+ className: `${classBase}-header`,
119
+ children: title
120
+ }),
121
+ /*#__PURE__*/ jsx("div", {
122
+ className: `${classBase}-content`,
123
+ children: content
124
+ })
125
+ ]
126
+ });
127
+ };
128
+ export { FeatureList_FeatureList as FeatureList };
@@ -0,0 +1 @@
1
+ export * from "./FeatureList.js";
@@ -0,0 +1,7 @@
1
+ const getLayoutHistory = async (user)=>{
2
+ const history = await fetch(`api/vui/${user.username}`, {}).then((response)=>response.ok ? response.json() : null).catch(()=>{
3
+ console.log("error getting history");
4
+ });
5
+ return history;
6
+ };
7
+ export { getLayoutHistory };
package/src/index.js ADDED
@@ -0,0 +1,14 @@
1
+ export * from "./application-provider/index.js";
2
+ export * from "./app-header/index.js";
3
+ export * from "./feature/index.js";
4
+ export * from "./feature-and-layout-provider/index.js";
5
+ export * from "./left-nav/index.js";
6
+ export * from "./persistence-manager/index.js";
7
+ export * from "./shell.js";
8
+ export * from "./shell-layout-templates/index.js";
9
+ export * from "./ShellContextProvider.js";
10
+ export * from "./feature-list/index.js";
11
+ export * from "./theme-switch/index.js";
12
+ export * from "./user-settings/index.js";
13
+ export * from "./workspace-management/index.js";
14
+ export { LoginPanel } from "./login/LoginPanel.js";