@hitachivantara/uikit-react-lab 5.40.7 → 5.41.0

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 (32) hide show
  1. package/dist/cjs/Blade/Blade.cjs +8 -8
  2. package/dist/cjs/Blades/Blades.cjs +6 -6
  3. package/dist/cjs/Dashboard/Dashboard.cjs +5 -5
  4. package/dist/cjs/Flow/DroppableFlow.cjs +12 -12
  5. package/dist/cjs/Flow/FlowContext/FlowContext.cjs +4 -4
  6. package/dist/cjs/Flow/FlowContext/NodeMetaContext.cjs +8 -8
  7. package/dist/cjs/Flow/Node/Node.cjs +2 -2
  8. package/dist/cjs/Flow/Node/Parameters/Select.cjs +2 -2
  9. package/dist/cjs/Flow/Node/utils.cjs +2 -2
  10. package/dist/cjs/Flow/Sidebar/Sidebar.cjs +5 -5
  11. package/dist/cjs/Flow/Sidebar/SidebarGroup/SidebarGroup.cjs +3 -3
  12. package/dist/cjs/Flow/Sidebar/SidebarGroup/SidebarGroupItem/DraggableSidebarGroupItem.cjs +2 -2
  13. package/dist/cjs/Flow/Sidebar/SidebarGroup/SidebarGroupItem/SidebarGroupItem.cjs +2 -2
  14. package/dist/cjs/Flow/hooks/useFlowContext.cjs +2 -2
  15. package/dist/cjs/Flow/hooks/useFlowNode.cjs +11 -11
  16. package/dist/cjs/Flow/hooks/useNode.cjs +11 -11
  17. package/dist/cjs/Wizard/Wizard.cjs +9 -10
  18. package/dist/cjs/Wizard/WizardActions/WizardActions.cjs +8 -8
  19. package/dist/cjs/Wizard/WizardContainer/WizardContainer.cjs +1 -4
  20. package/dist/cjs/Wizard/WizardContent/WizardContent.cjs +24 -30
  21. package/dist/cjs/Wizard/WizardContext/WizardContext.cjs +2 -2
  22. package/dist/cjs/Wizard/WizardTitle/WizardTitle.cjs +14 -17
  23. package/dist/esm/Wizard/Wizard.js +2 -3
  24. package/dist/esm/Wizard/Wizard.js.map +1 -1
  25. package/dist/esm/Wizard/WizardContainer/WizardContainer.js +1 -4
  26. package/dist/esm/Wizard/WizardContainer/WizardContainer.js.map +1 -1
  27. package/dist/esm/Wizard/WizardContent/WizardContent.js +14 -18
  28. package/dist/esm/Wizard/WizardContent/WizardContent.js.map +1 -1
  29. package/dist/esm/Wizard/WizardTitle/WizardTitle.js +9 -12
  30. package/dist/esm/Wizard/WizardTitle/WizardTitle.js.map +1 -1
  31. package/dist/types/index.d.ts +3 -4
  32. package/package.json +6 -6
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const jsxRuntime = require("react/jsx-runtime");
4
- const React = require("react");
4
+ const react = require("react");
5
5
  const uikitReactCore = require("@hitachivantara/uikit-react-core");
6
6
  const Blade_styles = require("./Blade.styles.cjs");
7
7
  const HvBlade = (props) => {
@@ -27,7 +27,7 @@ const HvBlade = (props) => {
27
27
  expanded,
28
28
  Boolean(defaultExpanded)
29
29
  );
30
- const handleAction = React.useCallback(
30
+ const handleAction = react.useCallback(
31
31
  (event) => {
32
32
  if (!disabled) {
33
33
  onChange?.(event, !isExpanded);
@@ -38,7 +38,7 @@ const HvBlade = (props) => {
38
38
  },
39
39
  [disabled, onChange, isExpanded, setIsExpanded]
40
40
  );
41
- const handleClick = React.useCallback(
41
+ const handleClick = react.useCallback(
42
42
  (event) => {
43
43
  handleAction(event);
44
44
  event.preventDefault();
@@ -46,7 +46,7 @@ const HvBlade = (props) => {
46
46
  },
47
47
  [handleAction]
48
48
  );
49
- const handleKeyDown = React.useCallback(
49
+ const handleKeyDown = react.useCallback(
50
50
  (event) => {
51
51
  let isEventHandled = false;
52
52
  const { key } = event;
@@ -71,7 +71,7 @@ const HvBlade = (props) => {
71
71
  const id = uikitReactCore.useUniqueId(idProp);
72
72
  const bladeHeaderId = uikitReactCore.setId(id, "button");
73
73
  const bladeContainerId = uikitReactCore.setId(id, "container");
74
- const bladeHeader = React.useMemo(() => {
74
+ const bladeHeader = react.useMemo(() => {
75
75
  const buttonLabel = typeof label === "function" ? label(isExpanded) : label;
76
76
  const bladeButton = /* @__PURE__ */ jsxRuntime.jsx(
77
77
  uikitReactCore.HvTypography,
@@ -122,9 +122,9 @@ const HvBlade = (props) => {
122
122
  label,
123
123
  labelVariant
124
124
  ]);
125
- const bladeRef = React.useRef(null);
126
- const [maxWidth, setMaxWidth] = React.useState(void 0);
127
- React.useEffect(() => {
125
+ const bladeRef = react.useRef(null);
126
+ const [maxWidth, setMaxWidth] = react.useState(void 0);
127
+ react.useEffect(() => {
128
128
  if (bladeRef.current) {
129
129
  const resizeObserver = new ResizeObserver((entries) => {
130
130
  setMaxWidth(entries[0].target.clientWidth);
@@ -1,11 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const jsxRuntime = require("react/jsx-runtime");
4
- const React = require("react");
4
+ const react = require("react");
5
5
  const uikitReactCore = require("@hitachivantara/uikit-react-core");
6
6
  const Blades_styles = require("./Blades.styles.cjs");
7
7
  function getExpandedBlades(defaultExpanded, children, atMostOneExpanded, atLeastOneExpanded) {
8
- const childrenArray = React.Children.toArray(children);
8
+ const childrenArray = react.Children.toArray(children);
9
9
  const expandedBlades = defaultExpanded ?? childrenArray.map((child, i) => {
10
10
  const childIsControlled = child?.props?.expanded !== void 0;
11
11
  const childIsExpanded = childIsControlled ? child?.props?.expanded : child?.props?.defaultExpanded;
@@ -44,7 +44,7 @@ const HvBlades = (props) => {
44
44
  atLeastOneExpanded
45
45
  )
46
46
  );
47
- const onChildChangeInterceptor = React.useCallback(
47
+ const onChildChangeInterceptor = react.useCallback(
48
48
  (index, childOnChange, event, isExpanded) => {
49
49
  const newValue = [];
50
50
  if (atMostOneExpanded) {
@@ -68,10 +68,10 @@ const HvBlades = (props) => {
68
68
  },
69
69
  [onChange, expanded, setExpanded, atMostOneExpanded, atLeastOneExpanded]
70
70
  );
71
- const modifiedChildren = React.useMemo(() => {
72
- return React.Children.map(children, (child, i) => {
71
+ const modifiedChildren = react.useMemo(() => {
72
+ return react.Children.map(children, (child, i) => {
73
73
  const childIsExpanded = expanded.includes(i);
74
- return React.cloneElement(child, {
74
+ return react.cloneElement(child, {
75
75
  expanded: childIsExpanded,
76
76
  fullWidth: child?.props?.fullWidth ?? fullWidthBlades,
77
77
  buttonProps: {
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const jsxRuntime = require("react/jsx-runtime");
4
- const React = require("react");
4
+ const react = require("react");
5
5
  const reactGridLayout = require("react-grid-layout");
6
- const react = require("@emotion/react");
6
+ const react$1 = require("@emotion/react");
7
7
  const uikitReactCore = require("@hitachivantara/uikit-react-core");
8
8
  const Dashboard_styles = require("./Dashboard.styles.cjs");
9
9
  const GridLayout = reactGridLayout.WidthProvider(reactGridLayout.Responsive);
@@ -26,12 +26,12 @@ const HvDashboard = (props) => {
26
26
  } = uikitReactCore.useDefaultProps("HvDashboard", props);
27
27
  const { classes, cx } = Dashboard_styles.useClasses(classesProp);
28
28
  const { activeTheme } = uikitReactCore.useTheme();
29
- const layouts = React.useMemo(() => {
29
+ const layouts = react.useMemo(() => {
30
30
  if (layoutsProp) return layoutsProp;
31
31
  if (!layout) return {};
32
32
  return { xs: layout, sm: layout, md: layout, lg: layout, xl: layout };
33
33
  }, [layoutsProp, layout]);
34
- const cols = React.useMemo(() => {
34
+ const cols = react.useMemo(() => {
35
35
  if (!colsProp) return defaultCols;
36
36
  if (typeof colsProp === "number") {
37
37
  return {
@@ -45,7 +45,7 @@ const HvDashboard = (props) => {
45
45
  return colsProp;
46
46
  }, [colsProp]);
47
47
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
48
- /* @__PURE__ */ jsxRuntime.jsx(react.Global, { styles: Dashboard_styles.gridStyles }),
48
+ /* @__PURE__ */ jsxRuntime.jsx(react$1.Global, { styles: Dashboard_styles.gridStyles }),
49
49
  /* @__PURE__ */ jsxRuntime.jsx(
50
50
  GridLayout,
51
51
  {
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const jsxRuntime = require("react/jsx-runtime");
4
- const React = require("react");
4
+ const react = require("react");
5
5
  const core = require("@dnd-kit/core");
6
- const react = require("@emotion/react");
6
+ const react$1 = require("@emotion/react");
7
7
  const ReactFlow = require("reactflow");
8
8
  const uid = require("uid");
9
9
  const uikitReactCore = require("@hitachivantara/uikit-react-core");
@@ -72,10 +72,10 @@ const HvDroppableFlow = ({
72
72
  const { classes, cx } = Flow_styles.useClasses(classesProp);
73
73
  const elementId = uikitReactCore.useUniqueId(id);
74
74
  const reactFlowInstance = useFlowInstance.useFlowInstance();
75
- const [nodes, setNodes] = React.useState(initialNodes);
76
- const [edges, setEdges] = React.useState(initialEdges);
77
- const nodesRef = React.useRef(initialNodes);
78
- const edgesRef = React.useRef(initialEdges);
75
+ const [nodes, setNodes] = react.useState(initialNodes);
76
+ const [edges, setEdges] = react.useState(initialEdges);
77
+ const nodesRef = react.useRef(initialNodes);
78
+ const edgesRef = react.useRef(initialEdges);
79
79
  const updateNodes = (nds) => {
80
80
  setNodes(nds);
81
81
  nodesRef.current = nds;
@@ -87,7 +87,7 @@ const HvDroppableFlow = ({
87
87
  const { setNodeRef } = core.useDroppable({
88
88
  id: elementId
89
89
  });
90
- const handleDragEnd = React.useCallback(
90
+ const handleDragEnd = react.useCallback(
91
91
  (event) => {
92
92
  if (event.over?.id !== elementId) return;
93
93
  const hvFlow = event.active.data.current?.hvFlow;
@@ -120,7 +120,7 @@ const HvDroppableFlow = ({
120
120
  core.useDndMonitor({
121
121
  onDragEnd: handleDragEnd
122
122
  });
123
- const handleFlowChange = React.useCallback(
123
+ const handleFlowChange = react.useCallback(
124
124
  (nds, eds) => {
125
125
  const isDragging = nds.find((node) => node.dragging);
126
126
  if (!isDragging) {
@@ -129,7 +129,7 @@ const HvDroppableFlow = ({
129
129
  },
130
130
  [onFlowChange]
131
131
  );
132
- const handleConnect = React.useCallback(
132
+ const handleConnect = react.useCallback(
133
133
  (connection) => {
134
134
  const eds = ReactFlow.addEdge(connection, edgesRef.current);
135
135
  updateEdges(eds);
@@ -138,7 +138,7 @@ const HvDroppableFlow = ({
138
138
  },
139
139
  [handleFlowChange, onConnectProp]
140
140
  );
141
- const handleNodesChange = React.useCallback(
141
+ const handleNodesChange = react.useCallback(
142
142
  (changes) => {
143
143
  const nds = ReactFlow.applyNodeChanges(changes, nodesRef.current);
144
144
  updateNodes(nds);
@@ -147,7 +147,7 @@ const HvDroppableFlow = ({
147
147
  },
148
148
  [handleFlowChange, onNodesChangeProp]
149
149
  );
150
- const handleEdgesChange = React.useCallback(
150
+ const handleEdgesChange = react.useCallback(
151
151
  (changes) => {
152
152
  const eds = ReactFlow.applyEdgeChanges(changes, edgesRef.current);
153
153
  updateEdges(eds);
@@ -171,7 +171,7 @@ const HvDroppableFlow = ({
171
171
  ...defaultEdgeOptionsProp
172
172
  };
173
173
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
174
- /* @__PURE__ */ jsxRuntime.jsx(react.Global, { styles: base.flowStyles }),
174
+ /* @__PURE__ */ jsxRuntime.jsx(react$1.Global, { styles: base.flowStyles }),
175
175
  /* @__PURE__ */ jsxRuntime.jsx(
176
176
  "div",
177
177
  {
@@ -1,16 +1,16 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const jsxRuntime = require("react/jsx-runtime");
4
- const React = require("react");
4
+ const react = require("react");
5
5
  const NodeMetaContext = require("./NodeMetaContext.cjs");
6
- const HvFlowContext = React.createContext({});
6
+ const HvFlowContext = react.createContext({});
7
7
  const HvFlowProvider = ({
8
8
  nodeGroups,
9
9
  defaultActions,
10
10
  children
11
11
  }) => {
12
- const [expandedNodeGroups, setExpandedNodeGroups] = React.useState([]);
13
- const value = React.useMemo(
12
+ const [expandedNodeGroups, setExpandedNodeGroups] = react.useState([]);
13
+ const value = react.useMemo(
14
14
  () => ({
15
15
  nodeGroups,
16
16
  defaultActions,
@@ -1,22 +1,22 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const jsxRuntime = require("react/jsx-runtime");
4
- const React = require("react");
5
- const HvFlowNodeMetaContext = React.createContext(void 0);
4
+ const react = require("react");
5
+ const HvFlowNodeMetaContext = react.createContext(void 0);
6
6
  const HvFlowNodeMetaProvider = ({
7
7
  children
8
8
  }) => {
9
- const registryRef = React.useRef({});
10
- const registerNode = React.useCallback((id, nodeInfo) => {
9
+ const registryRef = react.useRef({});
10
+ const registerNode = react.useCallback((id, nodeInfo) => {
11
11
  registryRef.current[id] = nodeInfo;
12
12
  }, []);
13
- const unregisterNode = React.useCallback((id) => {
13
+ const unregisterNode = react.useCallback((id) => {
14
14
  delete registryRef.current[id];
15
15
  }, []);
16
- const getRegistry = React.useCallback(() => {
16
+ const getRegistry = react.useCallback(() => {
17
17
  return registryRef.current;
18
18
  }, []);
19
- const value = React.useMemo(
19
+ const value = react.useMemo(
20
20
  () => ({
21
21
  registerNode,
22
22
  unregisterNode,
@@ -27,7 +27,7 @@ const HvFlowNodeMetaProvider = ({
27
27
  return /* @__PURE__ */ jsxRuntime.jsx(HvFlowNodeMetaContext.Provider, { value, children });
28
28
  };
29
29
  function useNodeMetaRegistry() {
30
- const context = React.useContext(HvFlowNodeMetaContext);
30
+ const context = react.useContext(HvFlowNodeMetaContext);
31
31
  if (context === void 0) {
32
32
  throw new Error(
33
33
  "useNodeRegistry must be used within a HvFlowNodeMetaProvider"
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const jsxRuntime = require("react/jsx-runtime");
4
- const React = require("react");
4
+ const react = require("react");
5
5
  const uikitReactCore = require("@hitachivantara/uikit-react-core");
6
6
  const uikitReactIcons = require("@hitachivantara/uikit-react-icons");
7
7
  const BaseNode = require("./BaseNode.cjs");
@@ -39,7 +39,7 @@ const HvFlowNode = ({
39
39
  ...props
40
40
  }) => {
41
41
  const { classes } = Node_styles.useClasses(classesProp);
42
- const [showParams, setShowParams] = React.useState(expanded);
42
+ const [showParams, setShowParams] = react.useState(expanded);
43
43
  const { nodeGroups, defaultActions } = useFlowContext.useFlowContext();
44
44
  const labels = uikitReactCore.useLabels(DEFAULT_LABELS, labelsProps);
45
45
  const node = useFlowNode.useFlowNode();
@@ -1,13 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
3
  const jsxRuntime = require("react/jsx-runtime");
4
- const React = require("react");
4
+ const react = require("react");
5
5
  const uikitReactCore = require("@hitachivantara/uikit-react-core");
6
6
  const useFlowNode = require("../../hooks/useFlowNode.cjs");
7
7
  const Select = ({ param, data }) => {
8
8
  const { id, label, multiple = false, options } = param;
9
9
  const { setNodeData } = useFlowNode.useFlowNodeUtils();
10
- const [opts, setOpts] = React.useState(
10
+ const [opts, setOpts] = react.useState(
11
11
  data[id] ? Array.isArray(data[id]) ? data[id] : [data[id]] : void 0
12
12
  );
13
13
  const handleChange = (item) => {
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const React = require("react");
3
+ const react = require("react");
4
4
  const isInputGroup = (input) => {
5
5
  return "inputs" in input;
6
6
  };
@@ -16,7 +16,7 @@ const isConnected = (id, type, handleId, edges) => {
16
16
  }
17
17
  return false;
18
18
  };
19
- const renderedIcon = (actionIcon) => React.isValidElement(actionIcon) ? actionIcon : actionIcon?.();
19
+ const renderedIcon = (actionIcon) => react.isValidElement(actionIcon) ? actionIcon : actionIcon?.();
20
20
  const identifyHandles = (handles) => {
21
21
  let idx = 0;
22
22
  return handles?.map(
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const jsxRuntime = require("react/jsx-runtime");
4
- const React = require("react");
4
+ const react = require("react");
5
5
  const core = require("@dnd-kit/core");
6
6
  const modifiers = require("@dnd-kit/modifiers");
7
7
  const uikitReactCore = require("@hitachivantara/uikit-react-core");
@@ -31,8 +31,8 @@ const HvFlowSidebar = ({
31
31
  }) => {
32
32
  const { classes } = Sidebar_styles.useClasses(classesProp);
33
33
  const { nodeGroups, setExpandedNodeGroups } = useFlowContext.useFlowContext();
34
- const [filterValue, setFilterValue] = React.useState("");
35
- const [draggingLabel, setDraggingLabel] = React.useState();
34
+ const [filterValue, setFilterValue] = react.useState("");
35
+ const [draggingLabel, setDraggingLabel] = react.useState();
36
36
  const labels = uikitReactCore.useLabels(DEFAULT_LABELS, labelsProps);
37
37
  const drawerElementId = uikitReactCore.useUniqueId(id);
38
38
  const groupsElementId = uikitReactCore.useUniqueId();
@@ -49,7 +49,7 @@ const HvFlowSidebar = ({
49
49
  onDragEnd: handleDragEnd,
50
50
  onDragStart: handleDragStart
51
51
  });
52
- const filteredGroups = React.useMemo(() => {
52
+ const filteredGroups = react.useMemo(() => {
53
53
  if (!filterValue || !nodeGroups) return nodeGroups || {};
54
54
  return filterValue ? Object.entries(nodeGroups).reduce(
55
55
  (acc, [groupId, group]) => {
@@ -68,7 +68,7 @@ const HvFlowSidebar = ({
68
68
  {}
69
69
  ) : nodeGroups;
70
70
  }, [filterValue, nodeGroups]);
71
- React.useEffect(() => {
71
+ react.useEffect(() => {
72
72
  setExpandedNodeGroups?.(filterValue ? Object.keys(filteredGroups) : []);
73
73
  }, [filterValue, filteredGroups, setExpandedNodeGroups]);
74
74
  return /* @__PURE__ */ jsxRuntime.jsxs(
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const jsxRuntime = require("react/jsx-runtime");
4
- const React = require("react");
4
+ const react = require("react");
5
5
  const uikitReactCore = require("@hitachivantara/uikit-react-core");
6
6
  const uikitReactIcons = require("@hitachivantara/uikit-react-icons");
7
7
  const uikitStyles = require("@hitachivantara/uikit-styles");
@@ -21,11 +21,11 @@ const HvFlowSidebarGroup = ({
21
21
  }) => {
22
22
  const { classes, cx, css } = SidebarGroup_styles.useClasses(classesProp);
23
23
  const { expandedNodeGroups, setExpandedNodeGroups } = useFlowContext.useFlowContext();
24
- const opened = React.useMemo(
24
+ const opened = react.useMemo(
25
25
  () => !!expandedNodeGroups?.find((group) => group === id),
26
26
  [expandedNodeGroups, id]
27
27
  );
28
- const handleClick = React.useCallback(() => {
28
+ const handleClick = react.useCallback(() => {
29
29
  setExpandedNodeGroups?.(
30
30
  (prev) => opened ? prev.filter((group) => id !== group) : [...prev, id]
31
31
  );
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const jsxRuntime = require("react/jsx-runtime");
4
- const React = require("react");
4
+ const react = require("react");
5
5
  const core = require("@dnd-kit/core");
6
6
  const utils = require("@mui/material/utils");
7
7
  const uikitReactCore = require("@hitachivantara/uikit-react-core");
@@ -13,7 +13,7 @@ const HvFlowDraggableSidebarGroupItem = ({
13
13
  data,
14
14
  ...others
15
15
  }) => {
16
- const itemRef = React.useRef(null);
16
+ const itemRef = react.useRef(null);
17
17
  const id = uikitReactCore.useUniqueId(idProp);
18
18
  const { attributes, listeners, setNodeRef, isDragging, transform } = core.useDraggable({
19
19
  id,
@@ -1,11 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const jsxRuntime = require("react/jsx-runtime");
4
- const React = require("react");
4
+ const react = require("react");
5
5
  const uikitReactCore = require("@hitachivantara/uikit-react-core");
6
6
  const uikitReactIcons = require("@hitachivantara/uikit-react-icons");
7
7
  const SidebarGroupItem_styles = require("./SidebarGroupItem.styles.cjs");
8
- const HvFlowSidebarGroupItem = React.forwardRef((props, ref) => {
8
+ const HvFlowSidebarGroupItem = react.forwardRef((props, ref) => {
9
9
  const {
10
10
  label,
11
11
  isDragging,
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const React = require("react");
3
+ const react = require("react");
4
4
  const FlowContext = require("../FlowContext/FlowContext.cjs");
5
- const useFlowContext = () => React.useContext(FlowContext.HvFlowContext);
5
+ const useFlowContext = () => react.useContext(FlowContext.HvFlowContext);
6
6
  exports.useFlowContext = useFlowContext;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const React = require("react");
3
+ const react = require("react");
4
4
  const ReactFlow = require("reactflow");
5
5
  const shallow = require("zustand/shallow");
6
6
  const useFlowInstance = require("./useFlowInstance.cjs");
@@ -15,7 +15,7 @@ function relativePosition(positionA, positionB) {
15
15
  }
16
16
  function useFlowNode(id) {
17
17
  const nodeId = useNodeId.useNodeId(id);
18
- const nodeSelector = React.useCallback(
18
+ const nodeSelector = react.useCallback(
19
19
  (state) => state.getNodes().find((n) => n.id === nodeId),
20
20
  [nodeId]
21
21
  );
@@ -23,7 +23,7 @@ function useFlowNode(id) {
23
23
  }
24
24
  function useFlowNodeInputEdges(id) {
25
25
  const nodeId = useNodeId.useNodeId(id);
26
- const inputEdgesSelector = React.useCallback(
26
+ const inputEdgesSelector = react.useCallback(
27
27
  (state) => state.edges.filter((e) => e.target === nodeId),
28
28
  [nodeId]
29
29
  );
@@ -31,7 +31,7 @@ function useFlowNodeInputEdges(id) {
31
31
  }
32
32
  function useFlowNodeOutputEdges(id) {
33
33
  const nodeId = useNodeId.useNodeId(id);
34
- const outputEdgesSelector = React.useCallback(
34
+ const outputEdgesSelector = react.useCallback(
35
35
  (state) => state.edges.filter((e) => e.source === nodeId),
36
36
  [nodeId]
37
37
  );
@@ -39,7 +39,7 @@ function useFlowNodeOutputEdges(id) {
39
39
  }
40
40
  function useFlowNodeEdges(id) {
41
41
  const nodeId = useNodeId.useNodeId(id);
42
- const edgesSelector = React.useCallback(
42
+ const edgesSelector = react.useCallback(
43
43
  (state) => state.edges.filter(
44
44
  (e) => e.source === nodeId || e.target === nodeId
45
45
  ),
@@ -49,7 +49,7 @@ function useFlowNodeEdges(id) {
49
49
  }
50
50
  function useFlowNodeParents(id) {
51
51
  const inputEdges = useFlowNodeInputEdges(id);
52
- const parentNodesSelector = React.useCallback(
52
+ const parentNodesSelector = react.useCallback(
53
53
  (state) => {
54
54
  return inputEdges.map((e) => state.getNodes().find((n) => n.id === e.source)).filter((n) => n !== null);
55
55
  },
@@ -61,7 +61,7 @@ function useFlowInputNodes(id) {
61
61
  const nodeId = useNodeId.useNodeId(id);
62
62
  const nodes = ReactFlow.useNodes();
63
63
  const edges = ReactFlow.useEdges();
64
- return React.useMemo(() => {
64
+ return react.useMemo(() => {
65
65
  return edges.filter((e) => e.target === nodeId).map((e) => nodes.find((n) => n.id === e.source)).filter((n) => n !== null);
66
66
  }, [edges, nodeId, nodes]);
67
67
  }
@@ -69,14 +69,14 @@ function useFlowOutputNodes(id) {
69
69
  const nodeId = useNodeId.useNodeId(id);
70
70
  const nodes = ReactFlow.useNodes();
71
71
  const edges = ReactFlow.useEdges();
72
- return React.useMemo(() => {
72
+ return react.useMemo(() => {
73
73
  return edges.filter((e) => e.source === nodeId).map((e) => nodes.find((n) => n.id === e.target)).filter((n) => n !== null);
74
74
  }, [edges, nodeId, nodes]);
75
75
  }
76
76
  function useFlowNodeUtils(id) {
77
77
  const nodeId = useNodeId.useNodeId(id);
78
78
  const reactFlowInstance = useFlowInstance.useFlowInstance();
79
- const setNodeData = React.useCallback(
79
+ const setNodeData = react.useCallback(
80
80
  (setNewData) => {
81
81
  if (!nodeId) return;
82
82
  reactFlowInstance.setNodes((nodes) => {
@@ -90,7 +90,7 @@ function useFlowNodeUtils(id) {
90
90
  },
91
91
  [nodeId, reactFlowInstance]
92
92
  );
93
- const setNodeParent = React.useCallback(
93
+ const setNodeParent = react.useCallback(
94
94
  (node, extent) => {
95
95
  if (!nodeId) return;
96
96
  reactFlowInstance.setNodes((nodes) => {
@@ -109,7 +109,7 @@ function useFlowNodeUtils(id) {
109
109
  },
110
110
  [nodeId, reactFlowInstance]
111
111
  );
112
- return React.useMemo(
112
+ return react.useMemo(
113
113
  () => ({
114
114
  setNodeData,
115
115
  setNodeParent
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const jsxRuntime = require("react/jsx-runtime");
4
- const React = require("react");
4
+ const react = require("react");
5
5
  const uid = require("uid");
6
6
  const uikitReactCore = require("@hitachivantara/uikit-react-core");
7
7
  const uikitReactIcons = require("@hitachivantara/uikit-react-icons");
@@ -31,9 +31,9 @@ function useHvNode(props) {
31
31
  } = props;
32
32
  const { registerNode, unregisterNode } = NodeMetaContext.useNodeMetaRegistry();
33
33
  const labels = uikitReactCore.useLabels(DEFAULT_LABELS, labelsProps);
34
- const inputs = React.useMemo(() => utils.identifyHandles(inputsProp), [inputsProp]);
34
+ const inputs = react.useMemo(() => utils.identifyHandles(inputsProp), [inputsProp]);
35
35
  const inputEdges = useFlowNode.useFlowNodeInputEdges();
36
- const outputs = React.useMemo(() => utils.identifyHandles(outputsProp), [outputsProp]);
36
+ const outputs = react.useMemo(() => utils.identifyHandles(outputsProp), [outputsProp]);
37
37
  const outputEdges = useFlowNode.useFlowNodeOutputEdges();
38
38
  const { nodeGroups } = useFlowContext.useFlowContext();
39
39
  const intersections = useFlowNode.useFlowNodeIntersections();
@@ -44,13 +44,13 @@ function useHvNode(props) {
44
44
  const title = titleProp || nodeGroup?.label;
45
45
  const icon = iconProp || nodeGroup?.icon;
46
46
  const color = uikitStyles.getColor(colorProp || nodeGroup?.color);
47
- const iconColor = React.isValidElement(icon) ? uikitStyles.getColor(icon.props.color || "base_dark") : uikitStyles.getColor("base_dark");
47
+ const iconColor = react.isValidElement(icon) ? uikitStyles.getColor(icon.props.color || "base_dark") : uikitStyles.getColor("base_dark");
48
48
  const subtitle = subtitleProp || node?.data.nodeLabel;
49
- const [showActions, setShowActions] = React.useState(false);
50
- const toggleShowActions = React.useCallback(() => {
49
+ const [showActions, setShowActions] = react.useState(false);
50
+ const toggleShowActions = react.useCallback(() => {
51
51
  setShowActions(!showActions);
52
52
  }, [showActions]);
53
- const getNodeToolbarProps = React.useCallback(
53
+ const getNodeToolbarProps = react.useCallback(
54
54
  () => ({
55
55
  offset: 0,
56
56
  isVisible: showActions,
@@ -58,7 +58,7 @@ function useHvNode(props) {
58
58
  }),
59
59
  [nodeToolbarProps, showActions]
60
60
  );
61
- const nodeActions = React.useMemo(
61
+ const nodeActions = react.useMemo(
62
62
  () => nodeActionsProp || [
63
63
  { id: "delete", label: labels?.deleteActionLabel, icon: /* @__PURE__ */ jsxRuntime.jsx(uikitReactIcons.Delete, {}) },
64
64
  {
@@ -69,7 +69,7 @@ function useHvNode(props) {
69
69
  ],
70
70
  [labels?.deleteActionLabel, labels?.duplicateActionLabel, nodeActionsProp]
71
71
  );
72
- React.useEffect(() => {
72
+ react.useEffect(() => {
73
73
  registerNode(id, {
74
74
  label: title || "",
75
75
  inputs,
@@ -77,7 +77,7 @@ function useHvNode(props) {
77
77
  });
78
78
  return () => unregisterNode(id);
79
79
  }, [id, title, inputs, outputs, registerNode, unregisterNode]);
80
- const handleDefaultAction = React.useCallback(
80
+ const handleDefaultAction = react.useCallback(
81
81
  (action) => {
82
82
  if (!node) return;
83
83
  if (action.callback) {
@@ -106,7 +106,7 @@ function useHvNode(props) {
106
106
  },
107
107
  [node, reactFlowInstance]
108
108
  );
109
- return React.useMemo(
109
+ return react.useMemo(
110
110
  () => ({
111
111
  // state
112
112
  id,
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const jsxRuntime = require("react/jsx-runtime");
4
- const React = require("react");
4
+ const react = require("react");
5
5
  const Wizard_styles = require("./Wizard.styles.cjs");
6
6
  const WizardContext = require("./WizardContext/WizardContext.cjs");
7
7
  const WizardContainer = require("./WizardContainer/WizardContainer.cjs");
@@ -32,11 +32,11 @@ const HvWizard = ({
32
32
  classes: classesProp,
33
33
  ...others
34
34
  }) => {
35
- const { classes } = Wizard_styles.useClasses(classesProp);
36
- const [context, setContext] = React.useState({});
37
- const [summary, setSummary] = React.useState(false);
38
- const [tab, setTab] = React.useState(0);
39
- const handleClose = React.useCallback(
35
+ const { classes, cx } = Wizard_styles.useClasses(classesProp);
36
+ const [context, setContext] = react.useState({});
37
+ const [summary, setSummary] = react.useState(false);
38
+ const [tab, setTab] = react.useState(0);
39
+ const handleClose = react.useCallback(
40
40
  (evt, reason) => {
41
41
  if (reason !== "backdropClick") {
42
42
  onClose?.(evt, reason);
@@ -44,7 +44,7 @@ const HvWizard = ({
44
44
  },
45
45
  [onClose]
46
46
  );
47
- React.useEffect(() => {
47
+ react.useEffect(() => {
48
48
  return () => {
49
49
  if (!open) {
50
50
  setContext(
@@ -60,15 +60,14 @@ const HvWizard = ({
60
60
  }
61
61
  };
62
62
  }, [open]);
63
- const value = React.useMemo(
63
+ const value = react.useMemo(
64
64
  () => ({ context, setContext, summary, setSummary, tab, setTab }),
65
65
  [context, setContext, summary, setSummary, tab, setTab]
66
66
  );
67
67
  return /* @__PURE__ */ jsxRuntime.jsx(WizardContext.default.Provider, { value, children: /* @__PURE__ */ jsxRuntime.jsxs(
68
68
  WizardContainer.HvWizardContainer,
69
69
  {
70
- className,
71
- classes: { root: classes.root },
70
+ className: cx(classes.root, className),
72
71
  handleClose,
73
72
  open,
74
73
  ...others,
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const jsxRuntime = require("react/jsx-runtime");
4
- const React = require("react");
4
+ const react = require("react");
5
5
  const uikitReactCore = require("@hitachivantara/uikit-react-core");
6
6
  const uikitReactIcons = require("@hitachivantara/uikit-react-icons");
7
7
  const WizardActions_styles = require("./WizardActions.styles.cjs");
@@ -23,10 +23,10 @@ const HvWizardActions = ({
23
23
  handleBeforePrevious
24
24
  }) => {
25
25
  const { classes, css, cx } = WizardActions_styles.useClasses(classesProp);
26
- const { context, setContext, tab, setTab } = React.useContext(WizardContext.default);
27
- const [pages, setPages] = React.useState(0);
28
- const [canSubmit, setCanSubmit] = React.useState(false);
29
- React.useEffect(() => {
26
+ const { context, setContext, tab, setTab } = react.useContext(WizardContext.default);
27
+ const [pages, setPages] = react.useState(0);
28
+ const [canSubmit, setCanSubmit] = react.useState(false);
29
+ react.useEffect(() => {
30
30
  const contextEntries = Object.entries(context);
31
31
  if (contextEntries.length) {
32
32
  setPages(contextEntries.length);
@@ -40,7 +40,7 @@ const HvWizardActions = ({
40
40
  }, [context, canSubmit, setCanSubmit, setPages]);
41
41
  const lastPage = pages - 1;
42
42
  const isLastPage = tab >= lastPage;
43
- const handleSkip = React.useCallback(() => {
43
+ const handleSkip = react.useCallback(() => {
44
44
  setContext(
45
45
  (c) => Object.entries(c).reduce((acc, [key, child]) => {
46
46
  acc[+key] = {
@@ -52,11 +52,11 @@ const HvWizardActions = ({
52
52
  );
53
53
  setTab(lastPage);
54
54
  }, [setTab, lastPage, setContext]);
55
- const handleSubmitInternal = React.useCallback(
55
+ const handleSubmitInternal = react.useCallback(
56
56
  () => handleSubmit(context),
57
57
  [handleSubmit, context]
58
58
  );
59
- const nextDisabled = React.useMemo(() => {
59
+ const nextDisabled = react.useMemo(() => {
60
60
  if (loading) return true;
61
61
  return !skippable && !context?.[tab]?.valid;
62
62
  }, [context, loading, skippable, tab]);
@@ -6,10 +6,8 @@ const WizardContainer_styles = require("./WizardContainer.styles.cjs");
6
6
  const HvWizardContainer = (props) => {
7
7
  const {
8
8
  classes: classesProp,
9
- className,
10
9
  children,
11
10
  handleClose,
12
- open,
13
11
  ...others
14
12
  } = uikitReactCore.useDefaultProps("HvWizardContainer", props);
15
13
  const { classes } = WizardContainer_styles.useClasses(classesProp);
@@ -17,11 +15,10 @@ const HvWizardContainer = (props) => {
17
15
  uikitReactCore.HvDialog,
18
16
  {
19
17
  classes: {
18
+ root: classes.root,
20
19
  closeButton: classes.closeButton,
21
20
  paper: classes.paper
22
21
  },
23
- className: classes.root,
24
- open,
25
22
  onClose: handleClose,
26
23
  maxWidth: "lg",
27
24
  ...others,
@@ -1,13 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const jsxRuntime = require("react/jsx-runtime");
4
- const React = require("react");
4
+ const react = require("react");
5
5
  const usehooksTs = require("usehooks-ts");
6
6
  const uikitReactCore = require("@hitachivantara/uikit-react-core");
7
7
  const WizardContent_styles = require("./WizardContent.styles.cjs");
8
8
  const WizardContext = require("../WizardContext/WizardContext.cjs");
9
- const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
10
- const React__default = /* @__PURE__ */ _interopDefault(React);
11
9
  const DRAWER_PERCENTAGE = 0.3;
12
10
  const DRAWER_MIN_WIDTH = 280;
13
11
  const HvWizardContent = ({
@@ -18,24 +16,15 @@ const HvWizardContent = ({
18
16
  summaryContent
19
17
  }) => {
20
18
  const { classes, cx } = WizardContent_styles.useClasses(classesProp);
21
- const { context, setContext, summary, tab } = React.useContext(WizardContext.default);
22
- const arrayChildren = React__default.default.Children.toArray(children);
23
- const initialContext = arrayChildren.reduce(
24
- (acc, child, index) => {
25
- const invalid = "mustValidate" in child.props && child.props.mustValidate === true ? false : null;
26
- const valid = invalid ?? (index === 0 || null);
27
- acc[index] = { ...child.props, form: {}, valid, touched: index === 0 };
28
- return acc;
29
- },
30
- {}
31
- );
32
- const summaryRef = React.useRef();
33
- const resizedRef = React.useRef({ height: 0, width: 0 });
19
+ const { context, setContext, summary, tab } = react.useContext(WizardContext.default);
20
+ const arrayChildren = react.Children.toArray(children);
21
+ const summaryRef = react.useRef();
22
+ const resizedRef = react.useRef({ height: 0, width: 0 });
34
23
  const [containerRef, sizes] = usehooksTs.useElementSize();
35
- const [summaryHeight, setSummaryHeight] = React.useState(0);
36
- const [summaryWidth, setSummaryWidth] = React.useState(0);
37
- const [summaryLeft, setSummaryLeft] = React.useState(0);
38
- const updateSummaryMeasures = React.useCallback(({ height = 0, width = 0 }) => {
24
+ const [summaryHeight, setSummaryHeight] = react.useState(0);
25
+ const [summaryWidth, setSummaryWidth] = react.useState(0);
26
+ const [summaryLeft, setSummaryLeft] = react.useState(0);
27
+ const updateSummaryMeasures = react.useCallback(({ height = 0, width = 0 }) => {
39
28
  const drawerWidth = width * DRAWER_PERCENTAGE;
40
29
  setSummaryHeight(height);
41
30
  setSummaryWidth(Math.max(drawerWidth, DRAWER_MIN_WIDTH));
@@ -45,7 +34,7 @@ const HvWizardContent = ({
45
34
  width
46
35
  };
47
36
  }, []);
48
- React.useEffect(() => {
37
+ react.useEffect(() => {
49
38
  const pageHeight = summaryRef.current?.getBoundingClientRect?.()?.height;
50
39
  if (summary && sizes.height !== resizedRef.current.height || sizes.width !== resizedRef.current.width) {
51
40
  updateSummaryMeasures(sizes);
@@ -57,10 +46,19 @@ const HvWizardContent = ({
57
46
  });
58
47
  }
59
48
  }, [tab, sizes, summary, updateSummaryMeasures]);
60
- React.useEffect(() => {
49
+ react.useEffect(() => {
50
+ const initialContext = arrayChildren.reduce(
51
+ (acc, child, index) => {
52
+ const invalid = "mustValidate" in child.props && child.props.mustValidate === true ? false : null;
53
+ const valid = invalid ?? (index === 0 || null);
54
+ acc[index] = { ...child.props, form: {}, valid, touched: index === 0 };
55
+ return acc;
56
+ },
57
+ {}
58
+ );
61
59
  setContext(initialContext);
62
60
  }, []);
63
- React.useEffect(() => {
61
+ react.useEffect(() => {
64
62
  if (tab && !context[tab]?.touched) {
65
63
  setContext(
66
64
  (oldContext) => Object.entries(oldContext).reduce(
@@ -109,13 +107,9 @@ const HvWizardContent = ({
109
107
  [classes.fixedHeight]: fixedHeight
110
108
  }),
111
109
  indentContent: true,
112
- children: React__default.default.Children.map(arrayChildren, (child, index) => {
113
- if (index === tab) {
114
- return React__default.default.cloneElement(child, {
115
- tab
116
- });
117
- }
118
- return null;
110
+ children: react.Children.map(arrayChildren, (child, index) => {
111
+ if (index !== tab) return null;
112
+ return react.cloneElement(child, { tab });
119
113
  })
120
114
  }
121
115
  ) })
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
- const React = require("react");
4
- const HvWizardContext = React.createContext({
3
+ const react = require("react");
4
+ const HvWizardContext = react.createContext({
5
5
  context: {},
6
6
  setContext: () => {
7
7
  },
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const jsxRuntime = require("react/jsx-runtime");
4
- const React = require("react");
4
+ const react = require("react");
5
5
  const uikitReactCore = require("@hitachivantara/uikit-react-core");
6
6
  const uikitReactIcons = require("@hitachivantara/uikit-react-icons");
7
7
  const WizardTitle_styles = require("./WizardTitle.styles.cjs");
@@ -23,10 +23,10 @@ const HvWizardTitle = ({
23
23
  classes: classesProp,
24
24
  customStep = {}
25
25
  }) => {
26
- const { context, setSummary, tab, setTab } = React.useContext(WizardContext.default);
26
+ const { context, setSummary, tab, setTab } = react.useContext(WizardContext.default);
27
27
  const { classes } = WizardTitle_styles.useClasses(classesProp);
28
- const [steps, setSteps] = React.useState([]);
29
- React.useEffect(() => {
28
+ const [steps, setSteps] = react.useState([]);
29
+ react.useEffect(() => {
30
30
  return () => {
31
31
  setSummary(false);
32
32
  };
@@ -34,20 +34,17 @@ const HvWizardTitle = ({
34
34
  const toggleSummary = () => {
35
35
  setSummary((prevValue) => !prevValue);
36
36
  };
37
- React.useEffect(() => {
37
+ react.useEffect(() => {
38
38
  const contextArray = Object.entries(context);
39
- if (contextArray.length) {
40
- const updatedSteps = contextArray.map(
41
- ([, childState], index) => {
42
- return {
43
- title: childState?.name ?? `${index + 1}`,
44
- state: switchTabState(childState, tab, index),
45
- onClick: () => setTab(index)
46
- };
47
- }
48
- );
49
- setSteps(updatedSteps);
50
- }
39
+ if (!contextArray.length) return;
40
+ const updatedSteps = contextArray.map(
41
+ ([, childState], index) => ({
42
+ title: childState?.["data-title"] ?? childState?.name ?? `${index + 1}`,
43
+ state: switchTabState(childState, tab, index),
44
+ onClick: () => setTab(index)
45
+ })
46
+ );
47
+ setSteps(updatedSteps);
51
48
  }, [context, tab, setTab]);
52
49
  return /* @__PURE__ */ jsxRuntime.jsx(
53
50
  uikitReactCore.HvDialogTitle,
@@ -31,7 +31,7 @@ const HvWizard = ({
31
31
  classes: classesProp,
32
32
  ...others
33
33
  }) => {
34
- const { classes } = useClasses(classesProp);
34
+ const { classes, cx } = useClasses(classesProp);
35
35
  const [context, setContext] = useState({});
36
36
  const [summary, setSummary] = useState(false);
37
37
  const [tab, setTab] = useState(0);
@@ -66,8 +66,7 @@ const HvWizard = ({
66
66
  return /* @__PURE__ */ jsx(HvWizardContext.Provider, { value, children: /* @__PURE__ */ jsxs(
67
67
  HvWizardContainer,
68
68
  {
69
- className,
70
- classes: { root: classes.root },
69
+ className: cx(classes.root, className),
71
70
  handleClose,
72
71
  open,
73
72
  ...others,
@@ -1 +1 @@
1
- {"version":3,"file":"Wizard.js","sources":["../../../src/Wizard/Wizard.tsx"],"sourcesContent":["import { useCallback, useEffect, useMemo, useState } from \"react\";\nimport {\n ExtractNames,\n HvBaseProps,\n HvDialogProps,\n} from \"@hitachivantara/uikit-react-core\";\n\nimport { HvStepNavigationProps } from \"../StepNavigation\";\nimport { staticClasses, useClasses } from \"./Wizard.styles\";\nimport { HvWizardActions, HvWizardActionsProps } from \"./WizardActions\";\nimport { HvWizardContainer } from \"./WizardContainer\";\nimport { HvWizardContent } from \"./WizardContent\";\nimport { HvWizardContext, HvWizardTabs } from \"./WizardContext\";\nimport { HvWizardTitle, HvWizardTitleProps } from \"./WizardTitle\";\n\nexport { staticClasses as wizardClasses };\n\nexport type HvWizardClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvWizardProps\n extends HvBaseProps,\n Pick<HvDialogProps, \"maxWidth\" | \"fullWidth\"> {\n /** Current state of the Wizard. */\n open: boolean;\n /** Function executed on close. */\n onClose: (\n event: React.MouseEvent<HTMLButtonElement> | {},\n reason?: \"escapeKeyDown\" | \"backdropClick\",\n ) => void;\n /** Function executed on submit. */\n handleSubmit: (context: HvWizardTabs) => void;\n /** Title for the wizard. */\n title?: string;\n /** An object containing all the labels for the wizard. */\n labels?: HvWizardActionsProps[\"labels\"] & HvWizardTitleProps[\"labels\"];\n /** Shows the summary button. */\n hasSummary?: boolean;\n /** The content of the summary. */\n summaryContent?: React.ReactNode;\n /** Enables the skip button. */\n skippable?: boolean;\n /** Forces minimum height to the component. */\n fixedHeight?: boolean;\n /** Whether the loading animation is shown. */\n loading?: boolean;\n /** Custom object to define type, size and width of the StepNavigation component */\n customStep?: Pick<HvStepNavigationProps, \"type\" | \"stepSize\" | \"width\">;\n /** A Jss Object used to override or extend the styles applied to the empty state Wizard. */\n classes?: HvWizardClasses;\n}\n\nexport const HvWizard = ({\n className,\n children,\n onClose,\n handleSubmit,\n title,\n open,\n skippable = true,\n loading = false,\n hasSummary = false,\n summaryContent,\n labels = {\n cancel: \"Cancel\",\n next: \"Next\",\n previous: \"Previous\",\n skip: \"Skip\",\n submit: \"Submit\",\n summary: \"Summary\",\n },\n fixedHeight = false,\n customStep,\n classes: classesProp,\n ...others\n}: HvWizardProps) => {\n const { classes } = useClasses(classesProp);\n\n const [context, setContext] = useState<HvWizardTabs>({});\n const [summary, setSummary] = useState(false);\n const [tab, setTab] = useState(0);\n\n const handleClose = useCallback(\n (\n evt: React.MouseEvent<HTMLButtonElement> | {},\n reason?: \"backdropClick\" | \"escapeKeyDown\",\n ) => {\n if (reason !== \"backdropClick\") {\n onClose?.(evt, reason);\n }\n },\n [onClose],\n );\n\n // on unmount\n useEffect(() => {\n return () => {\n if (!open) {\n setContext((c) =>\n Object.entries(c).reduce<HvWizardTabs>((acc, [key, child]) => {\n acc[+key] = {\n ...child,\n touched: false,\n };\n return acc;\n }, {}),\n );\n setTab(0);\n }\n };\n }, [open]);\n\n const value = useMemo(\n () => ({ context, setContext, summary, setSummary, tab, setTab }),\n [context, setContext, summary, setSummary, tab, setTab],\n );\n\n return (\n <HvWizardContext.Provider value={value}>\n <HvWizardContainer\n className={className}\n classes={{ root: classes.root }}\n handleClose={handleClose}\n open={open}\n {...others}\n >\n <HvWizardTitle\n title={title}\n hasSummary={hasSummary}\n labels={labels}\n customStep={customStep}\n />\n <HvWizardContent\n loading={loading}\n fixedHeight={fixedHeight}\n summaryContent={summaryContent}\n >\n {children}\n </HvWizardContent>\n <HvWizardActions\n loading={loading}\n skippable={skippable}\n labels={labels}\n handleClose={handleClose}\n handleSubmit={handleSubmit}\n />\n </HvWizardContainer>\n </HvWizardContext.Provider>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;AAmDO,MAAM,WAAW,CAAC;AAAA,EACvB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,YAAY;AAAA,EACZ,UAAU;AAAA,EACV,aAAa;AAAA,EACb;AAAA,EACA,SAAS;AAAA,IACP,QAAQ;AAAA,IACR,MAAM;AAAA,IACN,UAAU;AAAA,IACV,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,SAAS;AAAA,EACX;AAAA,EACA,cAAc;AAAA,EACd;AAAA,EACA,SAAS;AAAA,EACT,GAAG;AACL,MAAqB;AACnB,QAAM,EAAE,QAAA,IAAY,WAAW,WAAW;AAE1C,QAAM,CAAC,SAAS,UAAU,IAAI,SAAuB,CAAE,CAAA;AACvD,QAAM,CAAC,SAAS,UAAU,IAAI,SAAS,KAAK;AAC5C,QAAM,CAAC,KAAK,MAAM,IAAI,SAAS,CAAC;AAEhC,QAAM,cAAc;AAAA,IAClB,CACE,KACA,WACG;AACH,UAAI,WAAW,iBAAiB;AAC9B,kBAAU,KAAK,MAAM;AAAA,MACvB;AAAA,IACF;AAAA,IACA,CAAC,OAAO;AAAA,EAAA;AAIV,YAAU,MAAM;AACd,WAAO,MAAM;AACX,UAAI,CAAC,MAAM;AACT;AAAA,UAAW,CAAC,MACV,OAAO,QAAQ,CAAC,EAAE,OAAqB,CAAC,KAAK,CAAC,KAAK,KAAK,MAAM;AACxD,gBAAA,CAAC,GAAG,IAAI;AAAA,cACV,GAAG;AAAA,cACH,SAAS;AAAA,YAAA;AAEJ,mBAAA;AAAA,UACT,GAAG,EAAE;AAAA,QAAA;AAEP,eAAO,CAAC;AAAA,MACV;AAAA,IAAA;AAAA,EACF,GACC,CAAC,IAAI,CAAC;AAET,QAAM,QAAQ;AAAA,IACZ,OAAO,EAAE,SAAS,YAAY,SAAS,YAAY,KAAK;IACxD,CAAC,SAAS,YAAY,SAAS,YAAY,KAAK,MAAM;AAAA,EAAA;AAGxD,SACG,oBAAA,gBAAgB,UAAhB,EAAyB,OACxB,UAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC;AAAA,MACA,SAAS,EAAE,MAAM,QAAQ,KAAK;AAAA,MAC9B;AAAA,MACA;AAAA,MACC,GAAG;AAAA,MAEJ,UAAA;AAAA,QAAA;AAAA,UAAC;AAAA,UAAA;AAAA,YACC;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,UAAA;AAAA,QACF;AAAA,QACA;AAAA,UAAC;AAAA,UAAA;AAAA,YACC;AAAA,YACA;AAAA,YACA;AAAA,YAEC;AAAA,UAAA;AAAA,QACH;AAAA,QACA;AAAA,UAAC;AAAA,UAAA;AAAA,YACC;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,UAAA;AAAA,QACF;AAAA,MAAA;AAAA,IAAA;AAAA,EAEJ,EAAA,CAAA;AAEJ;"}
1
+ {"version":3,"file":"Wizard.js","sources":["../../../src/Wizard/Wizard.tsx"],"sourcesContent":["import { useCallback, useEffect, useMemo, useState } from \"react\";\nimport {\n ExtractNames,\n HvBaseProps,\n HvDialogProps,\n} from \"@hitachivantara/uikit-react-core\";\n\nimport { HvStepNavigationProps } from \"../StepNavigation\";\nimport { staticClasses, useClasses } from \"./Wizard.styles\";\nimport { HvWizardActions, HvWizardActionsProps } from \"./WizardActions\";\nimport { HvWizardContainer } from \"./WizardContainer\";\nimport { HvWizardContent } from \"./WizardContent\";\nimport { HvWizardContext, HvWizardTabs } from \"./WizardContext\";\nimport { HvWizardTitle, HvWizardTitleProps } from \"./WizardTitle\";\n\nexport { staticClasses as wizardClasses };\n\nexport type HvWizardClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvWizardProps\n extends HvBaseProps,\n Pick<HvDialogProps, \"maxWidth\" | \"fullWidth\"> {\n /** Current state of the Wizard. */\n open: boolean;\n /** Function executed on close. */\n onClose: (\n event: React.MouseEvent<HTMLButtonElement> | {},\n reason?: \"escapeKeyDown\" | \"backdropClick\",\n ) => void;\n /** Function executed on submit. */\n handleSubmit: (context: HvWizardTabs) => void;\n /** Title for the wizard. */\n title?: string;\n /** An object containing all the labels for the wizard. */\n labels?: HvWizardActionsProps[\"labels\"] & HvWizardTitleProps[\"labels\"];\n /** Shows the summary button. */\n hasSummary?: boolean;\n /** The content of the summary. */\n summaryContent?: React.ReactNode;\n /** Enables the skip button. */\n skippable?: boolean;\n /** Forces minimum height to the component. */\n fixedHeight?: boolean;\n /** Whether the loading animation is shown. */\n loading?: boolean;\n /** Custom object to define type, size and width of the StepNavigation component */\n customStep?: Pick<HvStepNavigationProps, \"type\" | \"stepSize\" | \"width\">;\n /** A Jss Object used to override or extend the styles applied to the empty state Wizard. */\n classes?: HvWizardClasses;\n}\n\nexport const HvWizard = ({\n className,\n children,\n onClose,\n handleSubmit,\n title,\n open,\n skippable = true,\n loading = false,\n hasSummary = false,\n summaryContent,\n labels = {\n cancel: \"Cancel\",\n next: \"Next\",\n previous: \"Previous\",\n skip: \"Skip\",\n submit: \"Submit\",\n summary: \"Summary\",\n },\n fixedHeight = false,\n customStep,\n classes: classesProp,\n ...others\n}: HvWizardProps) => {\n const { classes, cx } = useClasses(classesProp);\n\n const [context, setContext] = useState<HvWizardTabs>({});\n const [summary, setSummary] = useState(false);\n const [tab, setTab] = useState(0);\n\n const handleClose = useCallback(\n (\n evt: React.MouseEvent<HTMLButtonElement> | {},\n reason?: \"backdropClick\" | \"escapeKeyDown\",\n ) => {\n if (reason !== \"backdropClick\") {\n onClose?.(evt, reason);\n }\n },\n [onClose],\n );\n\n // on unmount\n useEffect(() => {\n return () => {\n if (!open) {\n setContext((c) =>\n Object.entries(c).reduce<HvWizardTabs>((acc, [key, child]) => {\n acc[+key] = {\n ...child,\n touched: false,\n };\n return acc;\n }, {}),\n );\n setTab(0);\n }\n };\n }, [open]);\n\n const value = useMemo(\n () => ({ context, setContext, summary, setSummary, tab, setTab }),\n [context, setContext, summary, setSummary, tab, setTab],\n );\n\n return (\n <HvWizardContext.Provider value={value}>\n <HvWizardContainer\n className={cx(classes.root, className)}\n handleClose={handleClose}\n open={open}\n {...others}\n >\n <HvWizardTitle\n title={title}\n hasSummary={hasSummary}\n labels={labels}\n customStep={customStep}\n />\n <HvWizardContent\n loading={loading}\n fixedHeight={fixedHeight}\n summaryContent={summaryContent}\n >\n {children}\n </HvWizardContent>\n <HvWizardActions\n loading={loading}\n skippable={skippable}\n labels={labels}\n handleClose={handleClose}\n handleSubmit={handleSubmit}\n />\n </HvWizardContainer>\n </HvWizardContext.Provider>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;AAmDO,MAAM,WAAW,CAAC;AAAA,EACvB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,YAAY;AAAA,EACZ,UAAU;AAAA,EACV,aAAa;AAAA,EACb;AAAA,EACA,SAAS;AAAA,IACP,QAAQ;AAAA,IACR,MAAM;AAAA,IACN,UAAU;AAAA,IACV,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,SAAS;AAAA,EACX;AAAA,EACA,cAAc;AAAA,EACd;AAAA,EACA,SAA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AEC;AAAA,UAAA;AAAA,QACH;AAAA,QACA;AAAA,UAAC;AAAA,UAAA;AAAA,YACC;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,UAAA;AAAA,QACF;AAAA,MAAA;AAAA,IAAA;AAAA,EAEJ,EAAA,CAAA;AAEJ;"}
@@ -5,10 +5,8 @@ import { staticClasses } from "./WizardContainer.styles.js";
5
5
  const HvWizardContainer = (props) => {
6
6
  const {
7
7
  classes: classesProp,
8
- className,
9
8
  children,
10
9
  handleClose,
11
- open,
12
10
  ...others
13
11
  } = useDefaultProps("HvWizardContainer", props);
14
12
  const { classes } = useClasses(classesProp);
@@ -16,11 +14,10 @@ const HvWizardContainer = (props) => {
16
14
  HvDialog,
17
15
  {
18
16
  classes: {
17
+ root: classes.root,
19
18
  closeButton: classes.closeButton,
20
19
  paper: classes.paper
21
20
  },
22
- className: classes.root,
23
- open,
24
21
  onClose: handleClose,
25
22
  maxWidth: "lg",
26
23
  ...others,
@@ -1 +1 @@
1
- {"version":3,"file":"WizardContainer.js","sources":["../../../../src/Wizard/WizardContainer/WizardContainer.tsx"],"sourcesContent":["import {\n ExtractNames,\n HvBaseProps,\n HvDialog,\n HvDialogProps,\n useDefaultProps,\n} from \"@hitachivantara/uikit-react-core\";\n\nimport { staticClasses, useClasses } from \"./WizardContainer.styles\";\n\nexport { staticClasses as wizardContainerClasses };\n\nexport type HvWizardContainerClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvWizardContainerProps\n extends Omit<HvBaseProps, \"onClose\">,\n Pick<HvDialogProps, \"maxWidth\" | \"fullWidth\"> {\n /** Current state of the Wizard. */\n open: boolean;\n /** Function executed on close. */\n handleClose: HvDialogProps[\"onClose\"];\n /** A Jss Object used to override or extend the styles applied to the empty state Wizard. */\n classes?: HvWizardContainerClasses;\n}\n\nexport const HvWizardContainer = (props: HvWizardContainerProps) => {\n const {\n classes: classesProp,\n className,\n children,\n handleClose,\n open,\n ...others\n } = useDefaultProps(\"HvWizardContainer\", props);\n const { classes } = useClasses(classesProp);\n\n return (\n <HvDialog\n classes={{\n closeButton: classes.closeButton,\n paper: classes.paper,\n }}\n className={classes.root}\n open={open}\n onClose={handleClose}\n maxWidth=\"lg\"\n {...others}\n >\n {children}\n </HvDialog>\n );\n};\n"],"names":[],"mappings":";;;;AAyBa,MAAA,oBAAoB,CAAC,UAAkC;AAC5D,QAAA;AAAA,IACJ,SAAS;AAAA,IACT;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,GAAG;AAAA,EAAA,IACD,gBAAgB,qBAAqB,KAAK;AAC9C,QAAM,EAAE,QAAA,IAAY,WAAW,WAAW;AAGxC,SAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,SAAS;AAAA,QACP,aAAa,QAAQ;AAAA,QACrB,OAAO,QAAQ;AAAA,MACjB;AAAA,MACA,WAAW,QAAQ;AAAA,MACnB;AAAA,MACA,SAAS;AAAA,MACT,UAAS;AAAA,MACR,GAAG;AAAA,MAEH;AAAA,IAAA;AAAA,EAAA;AAGP;"}
1
+ {"version":3,"file":"WizardContainer.js","sources":["../../../../src/Wizard/WizardContainer/WizardContainer.tsx"],"sourcesContent":["import {\n ExtractNames,\n HvBaseProps,\n HvDialog,\n HvDialogProps,\n useDefaultProps,\n} from \"@hitachivantara/uikit-react-core\";\n\nimport { staticClasses, useClasses } from \"./WizardContainer.styles\";\n\nexport { staticClasses as wizardContainerClasses };\n\nexport type HvWizardContainerClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvWizardContainerProps\n extends Omit<HvBaseProps, \"onClose\">,\n Pick<HvDialogProps, \"maxWidth\" | \"fullWidth\"> {\n /** Current state of the Wizard. */\n open: boolean;\n /** Function executed on close. */\n handleClose: HvDialogProps[\"onClose\"];\n /** A Jss Object used to override or extend the styles applied to the empty state Wizard. */\n classes?: HvWizardContainerClasses;\n}\n\nexport const HvWizardContainer = (props: HvWizardContainerProps) => {\n const {\n classes: classesProp,\n children,\n handleClose,\n ...others\n } = useDefaultProps(\"HvWizardContainer\", props);\n const { classes } = useClasses(classesProp);\n\n return (\n <HvDialog\n classes={{\n root: classes.root,\n closeButton: classes.closeButton,\n paper: classes.paper,\n }}\n onClose={handleClose}\n maxWidth=\"lg\"\n {...others}\n >\n {children}\n </HvDialog>\n );\n};\n"],"names":[],"mappings":";;;;AAyBa,MAAA,oBAAoB,CAAC,UAAkC;AAC5D,QAAA;AAAA,IACJ,SAAS;AAAA,IACT;AAAA,IACA;AAAA,IACA,GAAG;AAAA,EAAA,IACD,gBAAgB,qBAAqB,KAAK;AAC9C,QAAM,EAAE,QAAA,IAAY,WAAW,WAAW;AAGxC,SAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,SAAS;AAAA,QACP,MAAM,QAAQ;AAAA,QACd,aAAa,QAAQ;AAAA,QACrB,OAAO,QAAQ;AAAA,MACjB;AAAA,MACA,SAAS;AAAA,MACT,UAAS;AAAA,MACR,GAAG;AAAA,MAEH;AAAA,IAAA;AAAA,EAAA;AAGP;"}
@@ -1,5 +1,5 @@
1
1
  import { jsxs, jsx } from "react/jsx-runtime";
2
- import React, { useContext, useRef, useState, useCallback, useEffect } from "react";
2
+ import { useContext, Children, useRef, useState, useCallback, useEffect, cloneElement } from "react";
3
3
  import { useElementSize } from "usehooks-ts";
4
4
  import { HvLoadingContainer, HvDialogContent } from "@hitachivantara/uikit-react-core";
5
5
  import { useClasses } from "./WizardContent.styles.js";
@@ -16,16 +16,7 @@ const HvWizardContent = ({
16
16
  }) => {
17
17
  const { classes, cx } = useClasses(classesProp);
18
18
  const { context, setContext, summary, tab } = useContext(HvWizardContext);
19
- const arrayChildren = React.Children.toArray(children);
20
- const initialContext = arrayChildren.reduce(
21
- (acc, child, index) => {
22
- const invalid = "mustValidate" in child.props && child.props.mustValidate === true ? false : null;
23
- const valid = invalid ?? (index === 0 || null);
24
- acc[index] = { ...child.props, form: {}, valid, touched: index === 0 };
25
- return acc;
26
- },
27
- {}
28
- );
19
+ const arrayChildren = Children.toArray(children);
29
20
  const summaryRef = useRef();
30
21
  const resizedRef = useRef({ height: 0, width: 0 });
31
22
  const [containerRef, sizes] = useElementSize();
@@ -55,6 +46,15 @@ const HvWizardContent = ({
55
46
  }
56
47
  }, [tab, sizes, summary, updateSummaryMeasures]);
57
48
  useEffect(() => {
49
+ const initialContext = arrayChildren.reduce(
50
+ (acc, child, index) => {
51
+ const invalid = "mustValidate" in child.props && child.props.mustValidate === true ? false : null;
52
+ const valid = invalid ?? (index === 0 || null);
53
+ acc[index] = { ...child.props, form: {}, valid, touched: index === 0 };
54
+ return acc;
55
+ },
56
+ {}
57
+ );
58
58
  setContext(initialContext);
59
59
  }, []);
60
60
  useEffect(() => {
@@ -106,13 +106,9 @@ const HvWizardContent = ({
106
106
  [classes.fixedHeight]: fixedHeight
107
107
  }),
108
108
  indentContent: true,
109
- children: React.Children.map(arrayChildren, (child, index) => {
110
- if (index === tab) {
111
- return React.cloneElement(child, {
112
- tab
113
- });
114
- }
115
- return null;
109
+ children: Children.map(arrayChildren, (child, index) => {
110
+ if (index !== tab) return null;
111
+ return cloneElement(child, { tab });
116
112
  })
117
113
  }
118
114
  ) })
@@ -1 +1 @@
1
- {"version":3,"file":"WizardContent.js","sources":["../../../../src/Wizard/WizardContent/WizardContent.tsx"],"sourcesContent":["import React, {\n useCallback,\n useContext,\n useEffect,\n useRef,\n useState,\n} from \"react\";\nimport { useElementSize } from \"usehooks-ts\";\nimport {\n ExtractNames,\n HvBaseProps,\n HvDialogContent,\n HvLoadingContainer,\n} from \"@hitachivantara/uikit-react-core\";\n\nimport { HvWizardContext, HvWizardTabs } from \"../WizardContext\";\nimport { staticClasses, useClasses } from \"./WizardContent.styles\";\n\nexport { staticClasses as wizardContentClasses };\n\nexport type HvWizardContentClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvWizardContentProps extends HvBaseProps {\n /** Forces minimum height to the component. */\n fixedHeight?: boolean;\n /** Whether the loading animation is shown. */\n loading?: boolean;\n /** The content of the summary. */\n summaryContent?: React.ReactNode;\n /** A Jss Object used to override or extend the styles applied to the empty state Wizard. */\n classes?: HvWizardContentClasses;\n}\n\ntype ChildElement = React.ReactElement<HvWizardTabs>;\n\nconst DRAWER_PERCENTAGE = 0.3;\nconst DRAWER_MIN_WIDTH = 280;\n\nexport const HvWizardContent = ({\n classes: classesProp,\n fixedHeight = false,\n loading = false,\n children,\n summaryContent,\n}: HvWizardContentProps) => {\n const { classes, cx } = useClasses(classesProp);\n\n const { context, setContext, summary, tab } = useContext(HvWizardContext);\n\n const arrayChildren = React.Children.toArray(children) as ChildElement[];\n\n const initialContext = arrayChildren.reduce<HvWizardTabs>(\n (acc, child, index) => {\n const invalid =\n \"mustValidate\" in child.props && child.props.mustValidate === true\n ? false\n : null;\n const valid = invalid ?? (index === 0 || null);\n acc[index] = { ...child.props, form: {}, valid, touched: index === 0 };\n return acc;\n },\n {},\n );\n\n const summaryRef = useRef<HTMLElement>();\n const resizedRef = useRef({ height: 0, width: 0 });\n const [containerRef, sizes] = useElementSize();\n\n const [summaryHeight, setSummaryHeight] = useState(0);\n const [summaryWidth, setSummaryWidth] = useState(0);\n const [summaryLeft, setSummaryLeft] = useState(0);\n\n const updateSummaryMeasures = useCallback(({ height = 0, width = 0 }) => {\n const drawerWidth = width * DRAWER_PERCENTAGE;\n setSummaryHeight(height);\n setSummaryWidth(Math.max(drawerWidth, DRAWER_MIN_WIDTH));\n setSummaryLeft(width - Math.max(drawerWidth, DRAWER_MIN_WIDTH));\n\n resizedRef.current = {\n height,\n width,\n };\n }, []);\n\n useEffect(() => {\n const pageHeight = summaryRef.current?.getBoundingClientRect?.()?.height;\n if (\n (summary && sizes.height !== resizedRef.current.height) ||\n sizes.width !== resizedRef.current.width\n ) {\n updateSummaryMeasures(sizes);\n }\n\n if (pageHeight && sizes.height !== pageHeight) {\n updateSummaryMeasures({\n width: sizes.width,\n height: pageHeight,\n });\n }\n }, [tab, sizes, summary, updateSummaryMeasures]);\n\n useEffect(() => {\n setContext(initialContext);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n useEffect(() => {\n if (tab && !context[tab]?.touched) {\n setContext((oldContext) =>\n Object.entries(oldContext).reduce<HvWizardTabs>(\n (acc, [key, childState]) => {\n acc[Number(key)] =\n +key <= tab\n ? {\n ...childState,\n touched: true,\n valid: childState?.valid ?? true,\n }\n : childState;\n return acc;\n },\n {},\n ),\n );\n }\n }, [tab, context, setContext]);\n\n const translateX = summaryWidth ? summaryWidth + 10 : 450;\n\n return (\n <div\n className={classes.summaryRef}\n ref={(el) => {\n containerRef(el);\n if (el) {\n summaryRef.current = el;\n }\n }}\n >\n {summary !== null && (\n <div className={classes.summarySticky}>\n <div\n className={classes.summaryContainer}\n style={{\n left: summaryLeft,\n width: summaryWidth,\n height: summaryHeight,\n transform: `translate(${summary ? 0 : translateX}px, 0)`,\n }}\n >\n {summaryContent}\n </div>\n </div>\n )}\n <HvLoadingContainer hidden={!loading}>\n <HvDialogContent\n className={cx(classes.contentContainer, {\n [classes.fixedHeight]: fixedHeight,\n })}\n indentContent\n >\n {React.Children.map(arrayChildren, (child, index) => {\n if (index === tab) {\n return React.cloneElement(child as React.ReactElement, {\n tab,\n });\n }\n return null;\n })}\n </HvDialogContent>\n </HvLoadingContainer>\n </div>\n );\n};\n"],"names":[],"mappings":";;;;;;;AAmCA,MAAM,oBAAoB;AAC1B,MAAM,mBAAmB;AAElB,MAAM,kBAAkB,CAAC;AAAA,EAC9B,SAAS;AAAA,EACT,cAAc;AAAA,EACd,UAAU;AAAA,EACV;AAAA,EACA;AACF,MAA4B;AAC1B,QAAM,EAAE,SAAS,GAAG,IAAI,WAAW,WAAW;AAE9C,QAAM,EAAE,SAAS,YAAY,SAAS,QAAQ,WAAW,eAAe;AAExE,QAAM,gBAAgB,MAAM,SAAS,QAAQ,QAAQ;AAErD,QAAM,iBAAiB,cAAc;AAAA,IACnC,CAAC,KAAK,OAAO,UAAU;AACf,YAAA,UACJ,kBAAkB,MAAM,SAAS,MA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cACH;AACO,qBAAA;AAAA,YAAA,CACR;AAAA,UAAA;AAAA,QAAA,GAEL;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGN;"}
1
+ {"version":3,"file":"WizardContent.js","sources":["../../../../src/Wizard/WizardContent/WizardContent.tsx"],"sourcesContent":["import {\n Children,\n cloneElement,\n useCallback,\n useContext,\n useEffect,\n useRef,\n useState,\n} from \"react\";\nimport { useElementSize } from \"usehooks-ts\";\nimport {\n ExtractNames,\n HvBaseProps,\n HvDialogContent,\n HvLoadingContainer,\n} from \"@hitachivantara/uikit-react-core\";\n\nimport { HvWizardContext, HvWizardTabs } from \"../WizardContext\";\nimport { staticClasses, useClasses } from \"./WizardContent.styles\";\n\nexport { staticClasses as wizardContentClasses };\n\nexport type HvWizardContentClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvWizardContentProps extends HvBaseProps {\n /** Forces minimum height to the component. */\n fixedHeight?: boolean;\n /** Whether the loading animation is shown. */\n loading?: boolean;\n /** The content of the summary. */\n summaryContent?: React.ReactNode;\n /** A Jss Object used to override or extend the styles applied to the empty state Wizard. */\n classes?: HvWizardContentClasses;\n}\n\ntype ChildElement = React.ReactElement<HvWizardTabs>;\n\nconst DRAWER_PERCENTAGE = 0.3;\nconst DRAWER_MIN_WIDTH = 280;\n\nexport const HvWizardContent = ({\n classes: classesProp,\n fixedHeight = false,\n loading = false,\n children,\n summaryContent,\n}: HvWizardContentProps) => {\n const { classes, cx } = useClasses(classesProp);\n\n const { context, setContext, summary, tab } = useContext(HvWizardContext);\n\n const arrayChildren = Children.toArray(children) as ChildElement[];\n\n const summaryRef = useRef<HTMLElement>();\n const resizedRef = useRef({ height: 0, width: 0 });\n const [containerRef, sizes] = useElementSize();\n\n const [summaryHeight, setSummaryHeight] = useState(0);\n const [summaryWidth, setSummaryWidth] = useState(0);\n const [summaryLeft, setSummaryLeft] = useState(0);\n\n const updateSummaryMeasures = useCallback(({ height = 0, width = 0 }) => {\n const drawerWidth = width * DRAWER_PERCENTAGE;\n setSummaryHeight(height);\n setSummaryWidth(Math.max(drawerWidth, DRAWER_MIN_WIDTH));\n setSummaryLeft(width - Math.max(drawerWidth, DRAWER_MIN_WIDTH));\n\n resizedRef.current = {\n height,\n width,\n };\n }, []);\n\n useEffect(() => {\n const pageHeight = summaryRef.current?.getBoundingClientRect?.()?.height;\n if (\n (summary && sizes.height !== resizedRef.current.height) ||\n sizes.width !== resizedRef.current.width\n ) {\n updateSummaryMeasures(sizes);\n }\n\n if (pageHeight && sizes.height !== pageHeight) {\n updateSummaryMeasures({\n width: sizes.width,\n height: pageHeight,\n });\n }\n }, [tab, sizes, summary, updateSummaryMeasures]);\n\n useEffect(() => {\n const initialContext = arrayChildren.reduce<HvWizardTabs>(\n (acc, child, index) => {\n const invalid =\n \"mustValidate\" in child.props && child.props.mustValidate === true\n ? false\n : null;\n const valid = invalid ?? (index === 0 || null);\n acc[index] = { ...child.props, form: {}, valid, touched: index === 0 };\n return acc;\n },\n {},\n );\n\n setContext(initialContext);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n useEffect(() => {\n if (tab && !context[tab]?.touched) {\n setContext((oldContext) =>\n Object.entries(oldContext).reduce<HvWizardTabs>(\n (acc, [key, childState]) => {\n acc[Number(key)] =\n +key <= tab\n ? {\n ...childState,\n touched: true,\n valid: childState?.valid ?? true,\n }\n : childState;\n return acc;\n },\n {},\n ),\n );\n }\n }, [tab, context, setContext]);\n\n const translateX = summaryWidth ? summaryWidth + 10 : 450;\n\n return (\n <div\n className={classes.summaryRef}\n ref={(el) => {\n containerRef(el);\n if (el) {\n summaryRef.current = el;\n }\n }}\n >\n {summary !== null && (\n <div className={classes.summarySticky}>\n <div\n className={classes.summaryContainer}\n style={{\n left: summaryLeft,\n width: summaryWidth,\n height: summaryHeight,\n transform: `translate(${summary ? 0 : translateX}px, 0)`,\n }}\n >\n {summaryContent}\n </div>\n </div>\n )}\n <HvLoadingContainer hidden={!loading}>\n <HvDialogContent\n className={cx(classes.contentContainer, {\n [classes.fixedHeight]: fixedHeight,\n })}\n indentContent\n >\n {Children.map(arrayChildren, (child, index) => {\n if (index !== tab) return null;\n return cloneElement(child as React.ReactElement, { tab });\n })}\n </HvDialogContent>\n </HvLoadingContainer>\n </div>\n );\n};\n"],"names":[],"mappings":";;;;;;;AAqCA,MAAM,oBAAoB;AAC1B,MAAM,mBAAmB;AAElB,MAAM,kBAAkB,CAAC;AAAA,EAC9B,SAAS;AAAA,EACT,cAAc;AAAA,EACd,UAAU;AAAA,EACV;AAAA,EACA;AACF,MAA4B;AAC1B,QAAM,EAAE,SAAS,GAAG,IAAI,WAAW,WAAW;AAE9C,QAAM,EAAE,SAAS,YAAY,SAAS,QAAQ,WAAW,eAAe;AAElE,QAAA,gBAAgB,SAAS,QAAQ,QAAQ;AAE/C,QAAM,aAAa;AACnB,QAAM,aAAa,OAAO,EAAE,QAAQ,GAAG,OAAO,GAAG;AACjD,QAAM,CAAC,cAAc,KAAK,IAAI,eAAe;AAE7C,QAAM,CAAC,eAAe,gBAAgB,IAAI,SAAS,CAAC;AACpD,QAAM,CAAC,cAAc,eAAe,IAAI,SAAS,CAAC;AAClD,QAAM,CAAC,aAAa,cAAc,IAAI,SAAS,CAAC;AAE1C,QAAA,wBAAwB,YAAY,CAAC,EAAE,SAAS,GAAG,QAAQ,QAAQ;AACvE,UAAM,cAAc,QAAQ;AAC5B,qBAAiB,MAAM;AACvB,oBAAgB,KAAK,IAAI,aAAa,gBAAgB,CAAC;AACvD,mBAAe,QAAQ,KAAK,IAAI,aAAa,gBAAgB,CAAC;AAE9D,eAAW,UAAU;AAAA,MACnB;AAAA,MACA;AAAA,IAAA;AAAA,EAEJ,GAAG,CAAE,CAAA;AAEL,YAAU,MAAM;AACd,UAAM,aAAa,WAAW,SAAS,wBAAA,GAA2B;AAE/D,QAAA,WAAW,MAAM,WAAW,WAAW,QAAQ,UAChD,MAAM,UAAU,WAAW,QAAQ,OACnC;AACA,4BAAsB,KAAK;AAAA,IAC7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AAI,EAAA,WAAW,QAAQ,eACtB,UAAA;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,WAAW,QAAQ;AAAA,YACnB,OAAO;AAAA,cACL,MAAM;AAAA,cACN,OAAO;AAAA,cACP,QAAQ;AAAA,cACR,WAAW,aAAa,UAAU,IAAI,UAAU;AAAA,YAClD;AAAA,YAEC,UAAA;AAAA,UAAA;AAAA,QAAA,GAEL;AAAA,QAED,oBAAA,oBAAA,EAAmB,QAAQ,CAAC,SAC3B,UAAA;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,WAAW,GAAG,QAAQ,kBAAkB;AAAA,cACtC,CAAC,QAAQ,WAAW,GAAG;AAAA,YAAA,CACxB;AAAA,YACD,eAAa;AAAA,YAEZ,UAAS,SAAA,IAAI,eAAe,CAAC,OAAO,UAAU;AACzC,kBAAA,UAAU,IAAY,QAAA;AAC1B,qBAAO,aAAa,OAA6B,EAAE,IAAK,CAAA;AAAA,YAAA,CACzD;AAAA,UAAA;AAAA,QAAA,GAEL;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGN;"}
@@ -35,18 +35,15 @@ const HvWizardTitle = ({
35
35
  };
36
36
  useEffect(() => {
37
37
  const contextArray = Object.entries(context);
38
- if (contextArray.length) {
39
- const updatedSteps = contextArray.map(
40
- ([, childState], index) => {
41
- return {
42
- title: childState?.name ?? `${index + 1}`,
43
- state: switchTabState(childState, tab, index),
44
- onClick: () => setTab(index)
45
- };
46
- }
47
- );
48
- setSteps(updatedSteps);
49
- }
38
+ if (!contextArray.length) return;
39
+ const updatedSteps = contextArray.map(
40
+ ([, childState], index) => ({
41
+ title: childState?.["data-title"] ?? childState?.name ?? `${index + 1}`,
42
+ state: switchTabState(childState, tab, index),
43
+ onClick: () => setTab(index)
44
+ })
45
+ );
46
+ setSteps(updatedSteps);
50
47
  }, [context, tab, setTab]);
51
48
  return /* @__PURE__ */ jsx(
52
49
  HvDialogTitle,
@@ -1 +1 @@
1
- {"version":3,"file":"WizardTitle.js","sources":["../../../../src/Wizard/WizardTitle/WizardTitle.tsx"],"sourcesContent":["import { useContext, useEffect, useState } from \"react\";\nimport {\n ExtractNames,\n HvBaseProps,\n HvButton,\n HvDialogTitle,\n HvTypography,\n} from \"@hitachivantara/uikit-react-core\";\nimport { Report } from \"@hitachivantara/uikit-react-icons\";\n\nimport { HvStepNavigation, HvStepNavigationProps } from \"../../StepNavigation\";\nimport { HvStepProps } from \"../../StepNavigation/DefaultNavigation\";\nimport { HvWizardContext, HvWizardTab } from \"../WizardContext\";\nimport { staticClasses, useClasses } from \"./WizardTitle.styles\";\n\nexport { staticClasses as wizardTitleClasses };\n\nexport type HvWizardTitleClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvWizardTitleProps extends HvBaseProps {\n /** Title for the wizard. */\n title?: string;\n /** Shows the summary button. */\n hasSummary?: boolean;\n /** An object containing all the labels for the wizard header. */\n labels?: {\n /** Summary button label. */\n summary?: string;\n };\n /** Custom object to define type, size and width of the StepNavigation component */\n customStep?: Pick<HvStepNavigationProps, \"type\" | \"stepSize\" | \"width\">;\n /** A Jss Object used to override or extend the styles applied to the empty state Wizard. */\n classes?: HvWizardTitleClasses;\n}\n\nconst switchTabState = (\n state: HvWizardTab | undefined,\n currentTab: number,\n index: number,\n) => {\n if (state?.loading) return \"Pending\";\n if (index === currentTab) return \"Current\";\n if (state?.valid) return \"Completed\";\n if (state?.disabled) return \"Disabled\";\n if (state?.valid === null) return \"Enabled\";\n if (state?.touched && state?.valid === false) return \"Failed\";\n return \"Enabled\";\n};\n\nexport const HvWizardTitle = ({\n title,\n hasSummary = false,\n labels = {},\n classes: classesProp,\n customStep = {},\n}: HvWizardTitleProps) => {\n const { context, setSummary, tab, setTab } = useContext(HvWizardContext);\n\n const { classes } = useClasses(classesProp);\n\n const [steps, setSteps] = useState<HvStepProps[]>([]);\n\n useEffect(() => {\n return () => {\n setSummary(false);\n };\n }, [setSummary]);\n\n const toggleSummary = () => {\n setSummary((prevValue) => !prevValue);\n };\n\n useEffect(() => {\n const contextArray = Object.entries(context);\n\n if (contextArray.length) {\n const updatedSteps: HvStepProps[] = contextArray.map(\n ([, childState], index) => {\n return {\n title: childState?.name ?? `${index + 1}`,\n state: switchTabState(childState, tab, index),\n onClick: () => setTab(index),\n };\n },\n );\n\n setSteps(updatedSteps);\n }\n }, [context, tab, setTab]);\n\n return (\n <HvDialogTitle\n className={classes.headerContainer}\n classes={{\n messageContainer: classes.messageContainer,\n }}\n >\n <div className={classes.titleContainer}>\n {title && (\n <HvTypography variant=\"title3\" component=\"h3\">\n {title}\n </HvTypography>\n )}\n {!!steps.length && (\n <HvStepNavigation\n className={classes.stepContainer}\n steps={steps}\n type=\"Default\"\n stepSize=\"xs\"\n width={{\n xs: 200,\n sm: 350,\n md: 600,\n lg: 800,\n xl: 1000,\n }}\n {...customStep}\n />\n )}\n {hasSummary && (\n <HvButton\n variant=\"secondarySubtle\"\n className={classes.buttonWidth}\n classes={{\n root: classes.rootSummaryButton,\n }}\n onClick={toggleSummary}\n startIcon={<Report />}\n >\n {`${labels.summary ?? \"Summary\"}`}\n </HvButton>\n )}\n </div>\n </HvDialogTitle>\n );\n};\n"],"names":[],"mappings":";;;;;;;;AAmCA,MAAM,iBAAiB,CACrB,OACA,YACA,UACG;AACC,MAAA,OAAO,QAAgB,QAAA;AACvB,MAAA,UAAU,WAAmB,QAAA;AAC7B,MAAA,OAAO,MAAc,QAAA;AACrB,MAAA,OAAO,SAAiB,QAAA;AACxB,MAAA,OAAO,UAAU,KAAa,QAAA;AAClC,MAAI,OAAO,WAAW,OAAO,UAAU,MAAc,QAAA;AAC9C,SAAA;AACT;AAEO,MAAM,gBAAgB,CAAC;AAAA,EAC5B;AAAA,EACA,aAAa;AAAA,EACb,SAAS,CAAC;AAAA,EACV,SAAS;AAAA,EACT,aAAa,CAAC;AAChB,MAA0B;AACxB,QAAM,EAAE,SAAS,YAAY,KAAK,WAAW,WAAW,eAAe;AAEvE,QAAM,EAAE,QAAA,IAAY,WAAW,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C,SAAQ;AAAA,YACR,WAAW,QAAQ;AAAA,YACnB,SAAS;AAAA,cACP,MAAM,QAAQ;AAAA,YAChB;AAAA,YACA,SAAS;AAAA,YACT,+BAAY,QAAO,EAAA;AAAA,YAElB,UAAA,GAAG,OAAO,WAAW,SAAS;AAAA,UAAA;AAAA,QACjC;AAAA,MAAA,GAEJ;AAAA,IAAA;AAAA,EAAA;AAGN;"}
1
+ {"version":3,"file":"WizardTitle.js","sources":["../../../../src/Wizard/WizardTitle/WizardTitle.tsx"],"sourcesContent":["import { useContext, useEffect, useState } from \"react\";\nimport {\n ExtractNames,\n HvBaseProps,\n HvButton,\n HvDialogTitle,\n HvTypography,\n} from \"@hitachivantara/uikit-react-core\";\nimport { Report } from \"@hitachivantara/uikit-react-icons\";\n\nimport { HvStepNavigation, HvStepNavigationProps } from \"../../StepNavigation\";\nimport { HvStepProps } from \"../../StepNavigation/DefaultNavigation\";\nimport { HvWizardContext, HvWizardTab } from \"../WizardContext\";\nimport { staticClasses, useClasses } from \"./WizardTitle.styles\";\n\nexport { staticClasses as wizardTitleClasses };\n\nexport type HvWizardTitleClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvWizardTitleProps extends HvBaseProps {\n /** Title for the wizard. */\n title?: string;\n /** Shows the summary button. */\n hasSummary?: boolean;\n /** An object containing all the labels for the wizard header. */\n labels?: {\n /** Summary button label. */\n summary?: string;\n };\n /** Custom object to define type, size and width of the StepNavigation component */\n customStep?: Pick<HvStepNavigationProps, \"type\" | \"stepSize\" | \"width\">;\n /** A Jss Object used to override or extend the styles applied to the empty state Wizard. */\n classes?: HvWizardTitleClasses;\n}\n\nconst switchTabState = (\n state: HvWizardTab | undefined,\n currentTab: number,\n index: number,\n) => {\n if (state?.loading) return \"Pending\";\n if (index === currentTab) return \"Current\";\n if (state?.valid) return \"Completed\";\n if (state?.disabled) return \"Disabled\";\n if (state?.valid === null) return \"Enabled\";\n if (state?.touched && state?.valid === false) return \"Failed\";\n return \"Enabled\";\n};\n\nexport const HvWizardTitle = ({\n title,\n hasSummary = false,\n labels = {},\n classes: classesProp,\n customStep = {},\n}: HvWizardTitleProps) => {\n const { context, setSummary, tab, setTab } = useContext(HvWizardContext);\n\n const { classes } = useClasses(classesProp);\n\n const [steps, setSteps] = useState<HvStepProps[]>([]);\n\n useEffect(() => {\n return () => {\n setSummary(false);\n };\n }, [setSummary]);\n\n const toggleSummary = () => {\n setSummary((prevValue) => !prevValue);\n };\n\n useEffect(() => {\n const contextArray = Object.entries(context);\n\n if (!contextArray.length) return;\n\n const updatedSteps = contextArray.map<HvStepProps>(\n ([, childState], index) => ({\n title: childState?.[\"data-title\"] ?? childState?.name ?? `${index + 1}`,\n state: switchTabState(childState, tab, index),\n onClick: () => setTab(index),\n }),\n );\n\n setSteps(updatedSteps);\n }, [context, tab, setTab]);\n\n return (\n <HvDialogTitle\n className={classes.headerContainer}\n classes={{\n messageContainer: classes.messageContainer,\n }}\n >\n <div className={classes.titleContainer}>\n {title && (\n <HvTypography variant=\"title3\" component=\"h3\">\n {title}\n </HvTypography>\n )}\n {!!steps.length && (\n <HvStepNavigation\n className={classes.stepContainer}\n steps={steps}\n type=\"Default\"\n stepSize=\"xs\"\n width={{\n xs: 200,\n sm: 350,\n md: 600,\n lg: 800,\n xl: 1000,\n }}\n {...customStep}\n />\n )}\n {hasSummary && (\n <HvButton\n variant=\"secondarySubtle\"\n className={classes.buttonWidth}\n classes={{\n root: classes.rootSummaryButton,\n }}\n onClick={toggleSummary}\n startIcon={<Report />}\n >\n {`${labels.summary ?? \"Summary\"}`}\n </HvButton>\n )}\n </div>\n </HvDialogTitle>\n );\n};\n"],"names":[],"mappings":";;;;;;;;AAmCA,MAAM,iBAAiB,CACrB,OACA,YACA,UACG;AACC,MAAA,OAAO,QAAgB,QAAA;AACvB,MAAA,UAAU,WAAmB,QAAA;AAC7B,MAAA,OAAO,MAAc,QAAA;AACrB,MAAA,OAAO,SAAiB,QAAA;AACxB,MAAA,OAAO,UAAU,KAAa,QAA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,UAAA;AAAA,YACC,WAAW,QAAQ;AAAA,YACnB;AAAA,YACA,MAAK;AAAA,YACL,UAAS;AAAA,YACT,OAAO;AAAA,cACL,IAAI;AAAA,cACJ,IAAI;AAAA,cACJ,IAAI;AAAA,cACJ,IAAI;AAAA,cACJ,IAAI;AAAA,YACN;AAAA,YACC,GAAG;AAAA,UAAA;AAAA,QACN;AAAA,QAED,cACC;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,SAAQ;AAAA,YACR,WAAW,QAAQ;AAAA,YACnB,SAAS;AAAA,cACP,MAAM,QAAQ;AAAA,YAChB;AAAA,YACA,SAAS;AAAA,YACT,+BAAY,QAAO,EAAA;AAAA,YAElB,UAAA,GAAG,OAAO,WAAW,SAAS;AAAA,UAAA;AAAA,QACjC;AAAA,MAAA,GAEJ;AAAA,IAAA;AAAA,EAAA;AAGN;"}
@@ -8,7 +8,6 @@ import { Context } from 'react';
8
8
  import { ControlProps } from 'reactflow';
9
9
  import { CoordinateExtent } from 'reactflow';
10
10
  import { CSSProperties } from 'react';
11
- import { default as default_2 } from 'react';
12
11
  import { Dispatch } from 'react';
13
12
  import { DndContextProps } from '@dnd-kit/core';
14
13
  import { DragEndEvent } from '@dnd-kit/core';
@@ -822,7 +821,7 @@ export declare interface HvWizardContentProps extends HvBaseProps {
822
821
  /** Whether the loading animation is shown. */
823
822
  loading?: boolean;
824
823
  /** The content of the summary. */
825
- summaryContent?: default_2.ReactNode;
824
+ summaryContent?: React.ReactNode;
826
825
  /** A Jss Object used to override or extend the styles applied to the empty state Wizard. */
827
826
  classes?: HvWizardContentClasses;
828
827
  }
@@ -1208,6 +1207,7 @@ export declare function useHvNode(props: HvUseNodeParams): {
1208
1207
  suppressContentEditableWarning?: boolean | undefined;
1209
1208
  suppressHydrationWarning?: boolean | undefined;
1210
1209
  accessKey?: string | undefined;
1210
+ autoCapitalize?: (string & {}) | "none" | "off" | "on" | "sentences" | "words" | "characters" | undefined;
1211
1211
  autoFocus?: boolean | undefined;
1212
1212
  className?: string | undefined;
1213
1213
  contentEditable?: "inherit" | (boolean | "false" | "true") | "plaintext-only" | undefined;
@@ -1238,7 +1238,6 @@ export declare function useHvNode(props: HvUseNodeParams): {
1238
1238
  rev?: string | undefined;
1239
1239
  typeof?: string | undefined;
1240
1240
  vocab?: string | undefined;
1241
- autoCapitalize?: string | undefined;
1242
1241
  autoCorrect?: string | undefined;
1243
1242
  autoSave?: string | undefined;
1244
1243
  color?: string | undefined;
@@ -1249,7 +1248,7 @@ export declare function useHvNode(props: HvUseNodeParams): {
1249
1248
  itemRef?: string | undefined;
1250
1249
  results?: number | undefined;
1251
1250
  security?: string | undefined;
1252
- unselectable?: "on" | "off" | undefined;
1251
+ unselectable?: "off" | "on" | undefined;
1253
1252
  inputMode?: "none" | "text" | "search" | "email" | "tel" | "url" | "numeric" | "decimal" | undefined;
1254
1253
  is?: string | undefined;
1255
1254
  children?: ReactNode;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hitachivantara/uikit-react-lab",
3
- "version": "5.40.7",
3
+ "version": "5.41.0",
4
4
  "private": false,
5
5
  "author": "Hitachi Vantara UI Kit Team",
6
6
  "description": "Contributed React components for the NEXT UI Kit.",
@@ -33,10 +33,10 @@
33
33
  "@dnd-kit/core": "^6.1.0",
34
34
  "@dnd-kit/modifiers": "^6.0.1",
35
35
  "@emotion/css": "^11.11.0",
36
- "@hitachivantara/uikit-react-core": "^5.74.0",
37
- "@hitachivantara/uikit-react-icons": "^5.12.2",
38
- "@hitachivantara/uikit-react-utils": "^0.2.7",
39
- "@hitachivantara/uikit-styles": "^5.34.2",
36
+ "@hitachivantara/uikit-react-core": "^5.76.0",
37
+ "@hitachivantara/uikit-react-icons": "^5.12.3",
38
+ "@hitachivantara/uikit-react-utils": "^0.2.8",
39
+ "@hitachivantara/uikit-styles": "^5.35.0",
40
40
  "@mui/base": "^5.0.0-beta.40",
41
41
  "@types/react-grid-layout": "^1.3.5",
42
42
  "react-grid-layout": "^1.4.4",
@@ -52,7 +52,7 @@
52
52
  "access": "public",
53
53
  "directory": "package"
54
54
  },
55
- "gitHead": "ebde08a1ca68acb95e6d98d5c9b310eee919fed5",
55
+ "gitHead": "dc2be087e44b98c1d1dd9e0b3f4a19b4e7dafcb2",
56
56
  "exports": {
57
57
  ".": {
58
58
  "types": "./dist/types/index.d.ts",