@vuu-ui/vuu-layout 4.0.0-alpha.8 → 4.0.0-beta.1

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 (101) hide show
  1. package/README.md +18 -1
  2. package/package.json +16 -15
  3. package/src/placeholder/LayoutStartPanel.css.js +1 -1
  4. package/src/tools/config-wrapper/ConfigWrapper.js +1 -2
  5. package/types/dock-layout/DockLayout.d.ts +1 -1
  6. package/types/dock-layout/Drawer.d.ts +1 -1
  7. package/types/drag-drop/BoxModel.d.ts +3 -3
  8. package/types/flexbox/Flexbox.d.ts +4 -0
  9. package/types/flexbox/FlexboxLayout.d.ts +1 -1
  10. package/types/flexbox/Splitter.d.ts +1 -1
  11. package/types/layout-header/ActionButton.d.ts +1 -1
  12. package/types/layout-header/Header.d.ts +1 -1
  13. package/types/layout-provider/LayoutProvider.d.ts +1 -1
  14. package/types/palette/Palette.d.ts +2 -2
  15. package/types/placeholder/LayoutStartPanel.d.ts +1 -1
  16. package/types/placeholder/Placeholder.d.ts +1 -1
  17. package/types/responsive/overflowUtils.d.ts +2 -2
  18. package/types/stack/StackLayout.d.ts +1 -2
  19. package/types/tabs/TabPanel.d.ts +1 -1
  20. package/types/tools/config-wrapper/ConfigWrapper.d.ts +1 -2
  21. package/types/tools/devtools-box/layout-configurator.d.ts +1 -1
  22. package/types/tools/devtools-tree/layout-tree-viewer.d.ts +1 -2
  23. package/src/tools/devtools-box/layout-configurator.js +0 -293
  24. package/src/tools/devtools-tree/layout-tree-viewer.js +0 -40
  25. package/types/src/Component.d.ts +0 -6
  26. package/types/src/LayoutContainer.d.ts +0 -6
  27. package/types/src/debug.d.ts +0 -2
  28. package/types/src/dock-layout/DockLayout.d.ts +0 -7
  29. package/types/src/dock-layout/Drawer.d.ts +0 -17
  30. package/types/src/dock-layout/index.d.ts +0 -2
  31. package/types/src/drag-drop/BoxModel.d.ts +0 -143
  32. package/types/src/drag-drop/DragState.d.ts +0 -46
  33. package/types/src/drag-drop/Draggable.d.ts +0 -24
  34. package/types/src/drag-drop/DropTarget.d.ts +0 -60
  35. package/types/src/drag-drop/DropTargetRenderer.d.ts +0 -17
  36. package/types/src/drag-drop/dragDropTypes.d.ts +0 -51
  37. package/types/src/drag-drop/index.d.ts +0 -3
  38. package/types/src/flexbox/Flexbox.d.ts +0 -3
  39. package/types/src/flexbox/FlexboxLayout.d.ts +0 -5
  40. package/types/src/flexbox/Splitter.d.ts +0 -12
  41. package/types/src/flexbox/flexbox-utils.d.ts +0 -12
  42. package/types/src/flexbox/flexboxTypes.d.ts +0 -52
  43. package/types/src/flexbox/index.d.ts +0 -2
  44. package/types/src/flexbox/useSplitterResizing.d.ts +0 -2
  45. package/types/src/index.d.ts +0 -20
  46. package/types/src/layout-action.d.ts +0 -19
  47. package/types/src/layout-header/ActionButton.d.ts +0 -8
  48. package/types/src/layout-header/Header.d.ts +0 -15
  49. package/types/src/layout-header/index.d.ts +0 -1
  50. package/types/src/layout-header/useHeader.d.ts +0 -20
  51. package/types/src/layout-provider/LayoutProvider.d.ts +0 -20
  52. package/types/src/layout-provider/LayoutProviderContext.d.ts +0 -15
  53. package/types/src/layout-provider/index.d.ts +0 -2
  54. package/types/src/layout-provider/useLayoutDragDrop.d.ts +0 -4
  55. package/types/src/layout-reducer/flexUtils.d.ts +0 -22
  56. package/types/src/layout-reducer/index.d.ts +0 -4
  57. package/types/src/layout-reducer/insert-layout-element.d.ts +0 -8
  58. package/types/src/layout-reducer/layout-reducer.d.ts +0 -3
  59. package/types/src/layout-reducer/layoutTypes.d.ts +0 -135
  60. package/types/src/layout-reducer/layoutUtils.d.ts +0 -44
  61. package/types/src/layout-reducer/move-layout-element.d.ts +0 -3
  62. package/types/src/layout-reducer/remove-layout-element.d.ts +0 -3
  63. package/types/src/layout-reducer/replace-layout-element.d.ts +0 -6
  64. package/types/src/layout-reducer/resize-flex-children.d.ts +0 -4
  65. package/types/src/layout-reducer/wrap-layout-element.d.ts +0 -9
  66. package/types/src/layout-view/View.d.ts +0 -10
  67. package/types/src/layout-view/useView.d.ts +0 -20
  68. package/types/src/layout-view/useViewBroadcastChannel.d.ts +0 -7
  69. package/types/src/layout-view/useViewResize.d.ts +0 -7
  70. package/types/src/layout-view/viewTypes.d.ts +0 -48
  71. package/types/src/layout-view-actions/ViewContext.d.ts +0 -35
  72. package/types/src/layout-view-actions/useViewActionDispatcher.d.ts +0 -4
  73. package/types/src/layout-view-actions/useViewContributions.d.ts +0 -9
  74. package/types/src/palette/Palette.d.ts +0 -21
  75. package/types/src/palette/index.d.ts +0 -1
  76. package/types/src/placeholder/LayoutStartPanel.d.ts +0 -5
  77. package/types/src/placeholder/Placeholder.d.ts +0 -16
  78. package/types/src/placeholder/index.d.ts +0 -1
  79. package/types/src/responsive/index.d.ts +0 -2
  80. package/types/src/responsive/measureMinimumNodeSize.d.ts +0 -1
  81. package/types/src/responsive/overflowUtils.d.ts +0 -2
  82. package/types/src/responsive/useResizeObserver.d.ts +0 -13
  83. package/types/src/responsive/utils.d.ts +0 -6
  84. package/types/src/stack/Stack.d.ts +0 -3
  85. package/types/src/stack/StackLayout.d.ts +0 -6
  86. package/types/src/stack/index.d.ts +0 -3
  87. package/types/src/stack/stackTypes.d.ts +0 -24
  88. package/types/src/tabs/TabPanel.d.ts +0 -7
  89. package/types/src/tabs/index.d.ts +0 -1
  90. package/types/src/tools/config-wrapper/ConfigWrapper.d.ts +0 -2
  91. package/types/src/tools/config-wrapper/index.d.ts +0 -1
  92. package/types/src/tools/devtools-box/layout-configurator.d.ts +0 -31
  93. package/types/src/tools/devtools-tree/layout-tree-viewer.d.ts +0 -6
  94. package/types/src/tools/index.d.ts +0 -3
  95. package/types/src/use-persistent-state.d.ts +0 -8
  96. package/types/src/utils/index.d.ts +0 -5
  97. package/types/src/utils/pathUtils.d.ts +0 -31
  98. package/types/src/utils/propUtils.d.ts +0 -5
  99. package/types/src/utils/refUtils.d.ts +0 -2
  100. package/types/src/utils/styleUtils.d.ts +0 -3
  101. package/types/src/utils/typeOf.d.ts +0 -5
package/README.md CHANGED
@@ -1 +1,18 @@
1
- This is a regular package
1
+ # @vuu-ui/vuu-layout
2
+
3
+ > **Deprecated:** this package is deprecated and will be removed in a future release.
4
+ >
5
+ > If you are using `Flexbox` with `resizeable` children to create a pair of panes
6
+ > separated by a draggable splitter, use `SplitPane` from `@vuu-ui/vuu-ui-controls`
7
+ > instead. `SplitPane` follows the API of the Salt `FlexLayout` component, with Salt
8
+ > `FlexItem` components as children:
9
+ >
10
+ > ```tsx
11
+ > import { FlexItem } from "@salt-ds/core";
12
+ > import { SplitPane } from "@vuu-ui/vuu-ui-controls";
13
+ >
14
+ > <SplitPane direction="row" onSplitterMoved={([size1, size2]) => {}}>
15
+ > <FlexItem basis="200px">Left</FlexItem>
16
+ > <FlexItem grow={1}>Right</FlexItem>
17
+ > </SplitPane>;
18
+ > ```
package/package.json CHANGED
@@ -1,8 +1,7 @@
1
1
  {
2
- "version": "4.0.0-alpha.8",
2
+ "version": "4.0.0-beta.1",
3
3
  "description": "VUU Layout Components",
4
4
  "main": "./src/index.js",
5
- "type": "module",
6
5
  "author": "heswell",
7
6
  "license": "Apache-2.0",
8
7
  "scripts": {
@@ -12,20 +11,20 @@
12
11
  },
13
12
  "types": "types/index.d.ts",
14
13
  "devDependencies": {
15
- "@vuu-ui/vuu-data-types": "4.0.0-alpha.8",
16
- "@vuu-ui/vuu-filter-types": "4.0.0-alpha.8"
14
+ "@vuu-ui/vuu-data-types": "4.0.0-beta.1",
15
+ "@vuu-ui/vuu-filter-types": "4.0.0-beta.1"
17
16
  },
18
17
  "dependencies": {
19
- "@salt-ds/core": "1.67.0",
20
- "@salt-ds/styles": "0.2.1",
21
- "@salt-ds/window": "0.1.1",
22
- "@vuu-ui/vuu-data-react": "4.0.0-alpha.8",
23
- "@vuu-ui/vuu-datatable": "4.0.0-alpha.8",
24
- "@vuu-ui/vuu-filters": "4.0.0-alpha.8",
25
- "@vuu-ui/vuu-popups": "4.0.0-alpha.8",
26
- "@vuu-ui/vuu-table": "4.0.0-alpha.8",
27
- "@vuu-ui/vuu-ui-controls": "4.0.0-alpha.8",
28
- "@vuu-ui/vuu-utils": "4.0.0-alpha.8"
18
+ "@salt-ds/core": "1.72.0",
19
+ "@salt-ds/styles": "0.4.1",
20
+ "@salt-ds/window": "0.1.2",
21
+ "@vuu-ui/vuu-data-react": "4.0.0-beta.1",
22
+ "@vuu-ui/vuu-datatable": "4.0.0-beta.1",
23
+ "@vuu-ui/vuu-filters": "4.0.0-beta.1",
24
+ "@vuu-ui/vuu-popups": "4.0.0-beta.1",
25
+ "@vuu-ui/vuu-table": "4.0.0-beta.1",
26
+ "@vuu-ui/vuu-ui-controls": "4.0.0-beta.1",
27
+ "@vuu-ui/vuu-utils": "4.0.0-beta.1"
29
28
  },
30
29
  "peerDependencies": {
31
30
  "clsx": "^2.0.0",
@@ -41,9 +40,11 @@
41
40
  "exports": {
42
41
  ".": {
43
42
  "import": "./src/index.js",
43
+ "default": "./src/index.js",
44
44
  "types": "./types/index.d.ts"
45
45
  }
46
46
  },
47
47
  "module": "./src/index.js",
48
- "name": "@vuu-ui/vuu-layout"
48
+ "name": "@vuu-ui/vuu-layout",
49
+ "type": "module"
49
50
  }
@@ -9,7 +9,7 @@ const css = `
9
9
  }
10
10
 
11
11
  .vuuLayoutStartPanel-title {
12
- color: var(--vuu-color-gray-80);
12
+ color: var(--salt-color-gray-800);
13
13
  text-align: center;
14
14
  font-size: 28px;
15
15
  line-height: 1.5;
@@ -1,7 +1,6 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import react, { useState } from "react";
3
- import { LayoutConfigurator } from "../devtools-box/layout-configurator.js";
4
- import { LayoutTreeViewer } from "../devtools-tree/layout-tree-viewer.js";
3
+ import { LayoutConfigurator, LayoutTreeViewer } from "../index.js";
5
4
  import { followPathToComponent } from "../../index.js";
6
5
  const ConfigWrapper = ({ children })=>{
7
6
  const designMode = false;
@@ -1,6 +1,6 @@
1
1
  import { HTMLAttributes } from "react";
2
2
  export type DockLayoutProps = HTMLAttributes<HTMLDivElement>;
3
- declare function DockLayout(props: DockLayoutProps): import("react").JSX.Element;
3
+ declare function DockLayout(props: DockLayoutProps): import("react/jsx-runtime").JSX.Element;
4
4
  declare namespace DockLayout {
5
5
  var displayName: string;
6
6
  }
@@ -10,7 +10,7 @@ export interface DrawerProps extends HTMLAttributes<HTMLDivElement> {
10
10
  sizeClosed?: number;
11
11
  toggleButton?: "start" | "end";
12
12
  }
13
- declare function Drawer({ children, className: classNameProp, clickToOpen, defaultOpen, sizeOpen, sizeClosed, style: styleProp, open: openProp, position, inline, onClick, peekaboo, toggleButton, ...props }: DrawerProps): import("react").JSX.Element;
13
+ declare function Drawer({ children, className: classNameProp, clickToOpen, defaultOpen, sizeOpen, sizeClosed, style: styleProp, open: openProp, position, inline, onClick, peekaboo, toggleButton, ...props }: DrawerProps): import("react/jsx-runtime").JSX.Element;
14
14
  declare namespace Drawer {
15
15
  var displayName: string;
16
16
  }
@@ -1,6 +1,6 @@
1
- import type { ReactElement } from "react";
2
- import { type LayoutModel } from "@vuu-ui/vuu-utils";
3
- import type { DragDropRect, DropPos, RelativePosition } from "./dragDropTypes";
1
+ import { ReactElement } from "react";
2
+ import { LayoutModel } from "@vuu-ui/vuu-utils";
3
+ import { DragDropRect, DropPos, RelativePosition } from "./dragDropTypes";
4
4
  export declare const positionValues: {
5
5
  north: number;
6
6
  east: number;
@@ -1,3 +1,7 @@
1
1
  import { FlexboxProps } from "./flexboxTypes";
2
+ /**
3
+ * @deprecated vuu-layout is deprecated. For two panes separated by a
4
+ * draggable splitter, use `SplitPane` from `@vuu-ui/vuu-ui-controls`.
5
+ */
2
6
  declare const Flexbox: import("react").ForwardRefExoticComponent<FlexboxProps & import("react").RefAttributes<HTMLDivElement>>;
3
7
  export default Flexbox;
@@ -1,5 +1,5 @@
1
1
  import { FlexboxLayoutProps } from "./flexboxTypes";
2
- export declare function FlexboxLayout(props: FlexboxLayoutProps): import("react").JSX.Element;
2
+ export declare function FlexboxLayout(props: FlexboxLayoutProps): import("react/jsx-runtime").JSX.Element;
3
3
  export declare namespace FlexboxLayout {
4
4
  var displayName: string;
5
5
  }
@@ -9,4 +9,4 @@ export interface SplitterProps extends Omit<HTMLAttributes<HTMLDivElement>, "onD
9
9
  onDrag: SplitterDragHandler;
10
10
  onDragEnd: SplitterDragEndHandler;
11
11
  }
12
- export declare const Splitter: React.MemoExoticComponent<({ column, index, onDrag, onDragEnd, onDragStart, style, }: SplitterProps) => React.JSX.Element>;
12
+ export declare const Splitter: React.MemoExoticComponent<({ column, index, onDrag, onDragEnd, onDragStart, style, }: SplitterProps) => import("react/jsx-runtime").JSX.Element>;
@@ -4,5 +4,5 @@ export interface ActionButtonProps extends Omit<HTMLAttributes<HTMLButtonElement
4
4
  iconName?: string;
5
5
  onClick: (evt: MouseEvent, actionId: "maximize" | "minimize" | "restore" | "tearout") => void;
6
6
  }
7
- declare const ActionButton: ({ actionId, className, iconName, onClick, ...props }: ActionButtonProps) => import("react").JSX.Element;
7
+ declare const ActionButton: ({ actionId, className, iconName, onClick, ...props }: ActionButtonProps) => import("react/jsx-runtime").JSX.Element;
8
8
  export default ActionButton;
@@ -12,4 +12,4 @@ export interface HeaderProps extends HTMLAttributes<HTMLDivElement> {
12
12
  orientation?: "horizontal" | "vertical";
13
13
  tearOut?: boolean;
14
14
  }
15
- export declare const Header: ({ allowRename, className: classNameProp, contributions, collapsed, closeable, onCollapse, onEditTitle, onExpand, orientation: orientationProp, style, title, }: HeaderProps) => import("react").JSX.Element;
15
+ export declare const Header: ({ allowRename, className: classNameProp, contributions, collapsed, closeable, onCollapse, onEditTitle, onExpand, orientation: orientationProp, style, title, }: HeaderProps) => import("react/jsx-runtime").JSX.Element;
@@ -8,7 +8,7 @@ export interface LayoutProviderProps {
8
8
  workspaceJSON?: LayoutJSON | LayoutJSON[];
9
9
  onLayoutChange?: LayoutChangeHandler;
10
10
  }
11
- export declare const LayoutProviderVersion: () => import("react").JSX.Element;
11
+ export declare const LayoutProviderVersion: () => import("react/jsx-runtime").JSX.Element;
12
12
  export declare const LayoutProvider: (props: LayoutProviderProps) => ReactElement;
13
13
  export declare const useLayoutProviderDispatch: () => LayoutProviderDispatch;
14
14
  export declare const useLayoutOperation: () => {
@@ -10,7 +10,7 @@ export interface PaletteItemProps extends OptionProps {
10
10
  component: ReactElement;
11
11
  idx?: number;
12
12
  }
13
- export declare const PaletteItem: import("react").MemoExoticComponent<({ className, component, idx, key, value, ViewProps, ...props }: PaletteItemProps) => import("react").JSX.Element>;
13
+ export declare const PaletteItem: import("react").MemoExoticComponent<({ className, component, idx, key, value, ViewProps, ...props }: PaletteItemProps) => import("react/jsx-runtime").JSX.Element>;
14
14
  export interface PaletteProps extends Omit<HTMLAttributes<HTMLDivElement>, "onDragStart" | "onDrop" | "onSelect"> {
15
15
  ListBoxProps?: Partial<ListBoxProps>;
16
16
  ViewProps?: Partial<ViewProps>;
@@ -18,4 +18,4 @@ export interface PaletteProps extends Omit<HTMLAttributes<HTMLDivElement>, "onDr
18
18
  orientation: "horizontal" | "vertical";
19
19
  selection?: string;
20
20
  }
21
- export declare const Palette: ({ ListBoxProps, ViewProps, children, className, orientation, ...props }: PaletteProps) => import("react").JSX.Element;
21
+ export declare const Palette: ({ ListBoxProps, ViewProps, children, className, orientation, ...props }: PaletteProps) => import("react/jsx-runtime").JSX.Element;
@@ -2,4 +2,4 @@ import { HTMLAttributes } from "react";
2
2
  export interface LayoutStartPanelProps extends HTMLAttributes<HTMLDivElement> {
3
3
  label?: string;
4
4
  }
5
- export declare const LayoutStartPanel: (htmlAttributes: LayoutStartPanelProps) => import("react").JSX.Element | null;
5
+ export declare const LayoutStartPanel: (htmlAttributes: LayoutStartPanelProps) => import("react/jsx-runtime").JSX.Element | null;
@@ -10,7 +10,7 @@ export interface PlaceholderProps extends ViewProps {
10
10
  */
11
11
  shim?: boolean;
12
12
  }
13
- export declare function Placeholder({ className: classNameProp, showStartMenu, ...viewProps }: PlaceholderProps): import("react").JSX.Element;
13
+ export declare function Placeholder({ className: classNameProp, showStartMenu, ...viewProps }: PlaceholderProps): import("react/jsx-runtime").JSX.Element;
14
14
  export declare namespace Placeholder {
15
15
  var displayName: string;
16
16
  }
@@ -1,2 +1,2 @@
1
- export function getOverflowedItems(containerRef: any, height?: number): any[][];
2
- export function findFirstOverflow(elements: any, height: any): number;
1
+ export declare const getOverflowedItems: (containerRef: any, height?: number) => any[][];
2
+ export declare const findFirstOverflow: (elements: any, height: any) => number;
@@ -1,6 +1,5 @@
1
- import React from "react";
2
1
  import { StackProps } from "./stackTypes";
3
- export declare function StackLayout(props: StackProps): React.JSX.Element;
2
+ export declare function StackLayout(props: StackProps): import("react/jsx-runtime").JSX.Element;
4
3
  export declare namespace StackLayout {
5
4
  var displayName: string;
6
5
  }
@@ -3,5 +3,5 @@ import './TabPanel.css';
3
3
  export interface TabPanelProps extends HTMLAttributes<HTMLDivElement> {
4
4
  ariaLabelledBy: string;
5
5
  }
6
- declare const TabPanel: ({ ariaLabelledBy, children, id }: TabPanelProps) => import("react").JSX.Element;
6
+ declare const TabPanel: ({ ariaLabelledBy, children, id }: TabPanelProps) => import("react/jsx-runtime").JSX.Element;
7
7
  export default TabPanel;
@@ -1,2 +1 @@
1
- import React from "react";
2
- export declare const ConfigWrapper: ({ children }: any) => React.JSX.Element;
1
+ export declare const ConfigWrapper: ({ children }: any) => import("react/jsx-runtime").JSX.Element;
@@ -27,5 +27,5 @@ export declare const LayoutConfigurator: ({ height, managedStyle, onChange, styl
27
27
  onChange: any;
28
28
  style: any;
29
29
  width: any;
30
- }) => import("react").JSX.Element;
30
+ }) => import("react/jsx-runtime").JSX.Element;
31
31
  export declare function XXXnormalizeStyles(layoutStyle?: {}, visualStyle?: {}): {};
@@ -1,6 +1,5 @@
1
- import React from "react";
2
1
  export declare const LayoutTreeViewer: ({ layout, onSelect: _, style }: {
3
2
  layout: any;
4
3
  onSelect: any;
5
4
  style: any;
6
- }) => React.JSX.Element;
5
+ }) => import("react/jsx-runtime").JSX.Element;
@@ -1,293 +0,0 @@
1
- import { jsx, jsxs } from "react/jsx-runtime";
2
- import { FormField, Input } from "@salt-ds/core";
3
- import { useComponentCssInjection } from "@salt-ds/styles";
4
- import { useWindow } from "@salt-ds/window";
5
- import layout_configurator from "./layout-configurator.css";
6
- const NO_STYLE = {};
7
- const DIMENSIONS = {
8
- margin: {
9
- top: "marginTop",
10
- right: "marginRight",
11
- bottom: "marginBottom",
12
- left: "marginLeft"
13
- },
14
- border: {
15
- top: "borderTopWidth",
16
- right: "borderRightWidth",
17
- bottom: "borderBottomWidth",
18
- left: "borderLeftWidth"
19
- },
20
- padding: {
21
- top: "paddingTop",
22
- right: "paddingRight",
23
- bottom: "paddingBottom",
24
- left: "paddingLeft"
25
- }
26
- };
27
- const LayoutBox = ({ feature, children, style, onChange })=>/*#__PURE__*/ jsxs("div", {
28
- className: `LayoutBox layout-${feature} layout-outer`,
29
- children: [
30
- /*#__PURE__*/ jsxs("div", {
31
- className: "layout-top",
32
- children: [
33
- /*#__PURE__*/ jsx("span", {
34
- className: "layout-title",
35
- children: feature
36
- }),
37
- /*#__PURE__*/ jsx(FormField, {
38
- className: "layout-input",
39
- style: {
40
- width: 30
41
- },
42
- children: /*#__PURE__*/ jsx(Input, {
43
- value: style.top,
44
- onChange: (evt, value)=>onChange(feature, "top", value)
45
- })
46
- })
47
- ]
48
- }),
49
- /*#__PURE__*/ jsxs("div", {
50
- className: "layout-inner",
51
- children: [
52
- /*#__PURE__*/ jsx("div", {
53
- className: "layout-left",
54
- children: /*#__PURE__*/ jsx(FormField, {
55
- className: "layout-input",
56
- style: {
57
- width: 30
58
- },
59
- children: /*#__PURE__*/ jsx(Input, {
60
- value: style.left,
61
- onChange: (evt, value)=>onChange(feature, "left", value)
62
- })
63
- })
64
- }),
65
- children,
66
- /*#__PURE__*/ jsx("div", {
67
- className: "layout-right",
68
- children: /*#__PURE__*/ jsx(FormField, {
69
- className: "layout-input",
70
- style: {
71
- width: 30
72
- },
73
- children: /*#__PURE__*/ jsx(Input, {
74
- value: style.right,
75
- onChange: (evt, value)=>onChange(feature, "right", value)
76
- })
77
- })
78
- })
79
- ]
80
- }),
81
- /*#__PURE__*/ jsx("div", {
82
- className: "layout-bottom",
83
- children: /*#__PURE__*/ jsx(FormField, {
84
- className: "layout-input",
85
- style: {
86
- width: 30
87
- },
88
- children: /*#__PURE__*/ jsx(Input, {
89
- value: style.bottom,
90
- onChange: (evt, value)=>onChange(feature, "bottom", value)
91
- })
92
- })
93
- })
94
- ]
95
- });
96
- const MARGIN_STYLES = {
97
- margin: true,
98
- marginTop: true,
99
- marginRight: true,
100
- marginBottom: true,
101
- marginLeft: true
102
- };
103
- const PADDING_STYLES = {
104
- padding: true,
105
- paddingTop: true,
106
- paddingRight: true,
107
- paddingBottom: true,
108
- paddingLeft: true
109
- };
110
- const BORDER_STYLES = {
111
- border: true,
112
- borderColor: true,
113
- borderWidth: true,
114
- borderTopWidth: true,
115
- borderRightWidth: true,
116
- borderBottomWidth: true,
117
- borderLeftWidth: true
118
- };
119
- const CSS_DIGIT = "(\\d+)(?:px)?";
120
- const CSS_MEASURE = `^(?:${CSS_DIGIT}(?:\\s${CSS_DIGIT}(?:\\s${CSS_DIGIT}(?:\\s${CSS_DIGIT})?)?)?)$`;
121
- const CSS_REX = new RegExp(CSS_MEASURE);
122
- const BORDER_REX = /^(?:(\d+)(?:px)\ssolid\s([a-zA-Z,0-9().]+))$/;
123
- const LayoutConfigurator = ({ height, managedStyle, onChange, style, width })=>{
124
- const targetWindow = useWindow();
125
- useComponentCssInjection({
126
- testId: "vuu-layout-configurator",
127
- css: layout_configurator,
128
- window: targetWindow
129
- });
130
- const state = normalizeStyle(managedStyle);
131
- const handleChange = (feature, dimension, strValue)=>{
132
- const value = parseInt(strValue || "0", 10);
133
- const property = DIMENSIONS[feature][dimension];
134
- onChange(property, value);
135
- };
136
- const { marginTop: mt = 0, marginRight: mr = 0, marginBottom: mb = 0, marginLeft: ml = 0 } = state;
137
- const { borderTopWidth: bt = 0, borderRightWidth: br = 0, borderBottomWidth: bb = 0, borderLeftWidth: bl = 0 } = state;
138
- const { paddingTop: pt = 0, paddingRight: pr = 0, paddingBottom: pb = 0, paddingLeft: pl = 0 } = state;
139
- return /*#__PURE__*/ jsx("div", {
140
- className: "LayoutConfigurator",
141
- style: {
142
- width,
143
- height,
144
- ...style
145
- },
146
- children: /*#__PURE__*/ jsx(LayoutBox, {
147
- feature: "margin",
148
- style: {
149
- top: mt,
150
- right: mr,
151
- bottom: mb,
152
- left: ml
153
- },
154
- onChange: handleChange,
155
- children: /*#__PURE__*/ jsx(LayoutBox, {
156
- feature: "border",
157
- style: {
158
- top: bt,
159
- right: br,
160
- bottom: bb,
161
- left: bl
162
- },
163
- onChange: handleChange,
164
- children: /*#__PURE__*/ jsx(LayoutBox, {
165
- feature: "padding",
166
- style: {
167
- top: pt,
168
- right: pr,
169
- bottom: pb,
170
- left: pl
171
- },
172
- onChange: handleChange,
173
- children: /*#__PURE__*/ jsx("div", {
174
- className: "layout-content"
175
- })
176
- })
177
- })
178
- })
179
- });
180
- };
181
- function XXXnormalizeStyles(layoutStyle = NO_STYLE, visualStyle = NO_STYLE) {
182
- const { margin, marginTop, marginRight, marginBottom, marginLeft, padding, paddingTop, paddingRight, paddingBottom, paddingLeft, ...style } = layoutStyle;
183
- if ("number" == typeof margin) style.marginTop = style.marginRight = style.marginBottom = style.marginLeft = margin;
184
- else if ("string" == typeof margin) {
185
- const match = CSS_REX.exec(margin);
186
- if (null === match) console.error(`Invalid css value for margin '${margin}'`);
187
- else {
188
- const [, pos1, pos2, pos3, pos4] = match;
189
- const pos123 = pos1 && pos2 && pos3;
190
- if (pos123 && pos4) {
191
- style.marginTop = parseInt(pos1, 10);
192
- style.marginRight = parseInt(pos2, 10);
193
- style.marginBottom = parseInt(pos3, 10);
194
- style.marginLeft = parseInt(pos4, 10);
195
- } else if (pos123) {
196
- style.marginTop = parseInt(pos1, 10);
197
- style.marginRight = style.marginLeft = parseInt(pos2, 10);
198
- style.marginBottom = parseInt(pos3, 10);
199
- } else if (pos1 && pos2) {
200
- style.marginTop = style.marginBottom = parseInt(pos1, 10);
201
- style.marginRight = style.marginLeft = parseInt(pos2, 10);
202
- } else style.marginTop = style.marginRight = style.marginBottom = style.marginLeft = parseInt(pos1, 10);
203
- }
204
- }
205
- if ("number" == typeof marginTop) style.marginTop = marginTop;
206
- if ("number" == typeof marginRight) style.marginRight = marginRight;
207
- if ("number" == typeof marginBottom) style.marginBottom = marginBottom;
208
- if ("number" == typeof marginLeft) style.marginLeft = marginLeft;
209
- if ("number" == typeof padding) style.paddingTop = style.paddingRight = style.paddingBottom = style.paddingLeft = padding;
210
- else if ("string" == typeof padding) {
211
- const match = CSS_REX.exec(padding);
212
- if (null === match) console.error(`Invalid css value for padding '${padding}'`);
213
- else {
214
- const [, pos1, pos2, pos3, pos4] = match;
215
- const pos123 = pos1 && pos2 && pos3;
216
- if (pos123 && pos4) {
217
- style.paddingTop = parseInt(pos1, 10);
218
- style.paddingRight = parseInt(pos2, 10);
219
- style.paddingBottom = parseInt(pos3, 10);
220
- style.paddingLeft = parseInt(pos4, 10);
221
- } else if (pos123) {
222
- style.paddingTop = parseInt(pos1, 10);
223
- style.paddingRight = style.paddingLeft = parseInt(pos2, 10);
224
- style.paddingBottom = parseInt(pos3, 10);
225
- } else if (pos1 && pos2) {
226
- style.paddingTop = style.paddingBottom = parseInt(pos1, 10);
227
- style.paddingRight = style.paddingLeft = parseInt(pos2, 10);
228
- } else style.paddingTop = style.paddingRight = style.paddingBottom = style.paddinggLeft = parseInt(pos1, 10);
229
- }
230
- }
231
- if ("number" == typeof paddingTop) style.paddingTop = paddingTop;
232
- if ("number" == typeof paddingRight) style.paddingRight = paddingRight;
233
- if ("number" == typeof paddingBottom) style.paddingBottom = paddingBottom;
234
- if ("number" == typeof paddingLeft) style.paddingLeft = paddingLeft;
235
- return normalizeStyle(style);
236
- }
237
- function normalizeStyle(managedStyle = NO_STYLE) {
238
- const style = {
239
- ...managedStyle
240
- };
241
- let match;
242
- let { border, borderWidth, borderTopWidth, borderRightWidth, borderBottomWidth, borderLeftWidth, borderColor, margin, marginTop, marginRight, marginBottom, marginLeft, padding, paddingTop, paddingRight, paddingBottom, paddingLeft, ...rest } = style;
243
- let marginStyles = {};
244
- let paddingStyles = {};
245
- if ("number" == typeof margin) {
246
- style.marginTop = style.marginRight = style.marginBottom = style.marginLeft = margin;
247
- marginStyles = {
248
- marginTop: margin,
249
- marginRight: margin,
250
- marginBottom: margin,
251
- marginLeft: margin
252
- };
253
- }
254
- if ("number" == typeof padding) {
255
- style.paddingTop = style.paddingRight = style.paddingBottom = style.paddingLeft = padding;
256
- paddingStyles = {
257
- paddingTop: padding,
258
- paddingRight: padding,
259
- paddingBottom: padding,
260
- paddingLeft: padding
261
- };
262
- }
263
- if (!border && !borderWidth && !borderTopWidth && !borderRightWidth && !borderBottomWidth && !borderLeftWidth) return style;
264
- {
265
- if ("string" == typeof border && (match = BORDER_REX.exec(border))) {
266
- [, borderWidth, borderColor] = match;
267
- borderWidth = parseInt(borderWidth, 10);
268
- }
269
- if (borderWidth) {
270
- borderTopWidth = void 0 === borderTopWidth ? borderWidth : borderTopWidth;
271
- borderRightWidth = void 0 === borderRightWidth ? borderWidth : borderRightWidth;
272
- borderBottomWidth = void 0 === borderBottomWidth ? borderWidth : borderBottomWidth;
273
- borderLeftWidth = void 0 === borderLeftWidth ? borderWidth : borderLeftWidth;
274
- }
275
- borderColor = borderColor || "black";
276
- const boxShadow = `
277
- ${borderColor} ${borderLeftWidth || 0}px ${borderTopWidth || 0}px 0 0 inset,
278
- ${borderColor} ${-borderRightWidth || 0}px ${-borderBottomWidth || 0}px 0 0 inset`;
279
- return {
280
- ...rest,
281
- ...marginStyles,
282
- ...paddingStyles,
283
- borderTopWidth,
284
- borderRightWidth,
285
- borderBottomWidth,
286
- borderLeftWidth,
287
- borderColor,
288
- borderStyle: "solid",
289
- boxShadow
290
- };
291
- }
292
- }
293
- export { BORDER_STYLES, LayoutConfigurator, MARGIN_STYLES, PADDING_STYLES, XXXnormalizeStyles };
@@ -1,40 +0,0 @@
1
- import { jsx } from "react/jsx-runtime";
2
- import react from "react";
3
- import clsx from "clsx";
4
- import { useComponentCssInjection } from "@salt-ds/styles";
5
- import { useWindow } from "@salt-ds/window";
6
- import { typeOf } from "../../utils/index.js";
7
- import layout_tree_viewer from "./layout-tree-viewer.css";
8
- import { TreeTable } from "@vuu-ui/vuu-datatable";
9
- const classBaseTree = "hwLayoutTreeViewer";
10
- const toTreeJson = (component, path = "0")=>({
11
- label: typeOf(component),
12
- path,
13
- childNodes: react.Children.map(component.props.children, (child, i)=>toTreeJson(child, path ? `${path}.${i}` : `${i}`))
14
- });
15
- const LayoutTreeViewer = ({ layout, onSelect: _, style })=>{
16
- const targetWindow = useWindow();
17
- useComponentCssInjection({
18
- testId: "vuu-layout-tree-viewer",
19
- css: layout_tree_viewer,
20
- window: targetWindow
21
- });
22
- const treeJson = [
23
- toTreeJson(layout)
24
- ];
25
- const handleSelection = (row)=>{
26
- console.log({
27
- row
28
- });
29
- };
30
- return /*#__PURE__*/ jsx("div", {
31
- className: clsx(classBaseTree),
32
- style: style,
33
- children: /*#__PURE__*/ jsx(TreeTable, {
34
- source: treeJson,
35
- selectionModel: "single",
36
- onSelect: handleSelection
37
- })
38
- });
39
- };
40
- export { LayoutTreeViewer };
@@ -1,6 +0,0 @@
1
- import React, { HTMLAttributes } from "react";
2
- export interface ComponentProps extends HTMLAttributes<HTMLDivElement> {
3
- resizeable?: boolean;
4
- }
5
- declare const Component: React.FunctionComponent<ComponentProps>;
6
- export default Component;
@@ -1,6 +0,0 @@
1
- import { HTMLAttributes } from "react";
2
- export interface LayoutContainerProps extends HTMLAttributes<HTMLDivElement> {
3
- dropTarget?: boolean;
4
- resizeable?: boolean;
5
- }
6
- export declare const LayoutContainer: import("react").ForwardRefExoticComponent<LayoutContainerProps & import("react").RefAttributes<HTMLDivElement>>;
@@ -1,2 +0,0 @@
1
- import { ReactElement } from "react";
2
- export declare const tree: (el: ReactElement, depth?: number) => string;
@@ -1,7 +0,0 @@
1
- import { HTMLAttributes } from "react";
2
- export type DockLayoutProps = HTMLAttributes<HTMLDivElement>;
3
- declare function DockLayout(props: DockLayoutProps): import("react").JSX.Element;
4
- declare namespace DockLayout {
5
- var displayName: string;
6
- }
7
- export default DockLayout;
@@ -1,17 +0,0 @@
1
- import { HTMLAttributes } from "react";
2
- export interface DrawerProps extends HTMLAttributes<HTMLDivElement> {
3
- clickToOpen?: boolean;
4
- defaultOpen?: boolean;
5
- inline?: boolean;
6
- open?: boolean;
7
- peekaboo?: boolean;
8
- position?: "left" | "right" | "top" | "bottom";
9
- sizeOpen?: number;
10
- sizeClosed?: number;
11
- toggleButton?: "start" | "end";
12
- }
13
- declare function Drawer({ children, className: classNameProp, clickToOpen, defaultOpen, sizeOpen, sizeClosed, style: styleProp, open: openProp, position, inline, onClick, peekaboo, toggleButton, ...props }: DrawerProps): import("react").JSX.Element;
14
- declare namespace Drawer {
15
- var displayName: string;
16
- }
17
- export default Drawer;
@@ -1,2 +0,0 @@
1
- export { default as DockLayout } from "./DockLayout";
2
- export { default as Drawer } from "./Drawer";