@hitachivantara/uikit-react-lab 4.0.4 → 4.1.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.
- package/dist/StepNavigation/StepNavigation.d.ts +12 -10
- package/dist/Wizard/Wizard.d.ts +4 -0
- package/dist/Wizard/Wizard.js +18 -6
- package/dist/Wizard/Wizard.js.map +1 -1
- package/dist/Wizard/WizardContent/WizardContent.d.ts +4 -0
- package/dist/Wizard/WizardContent/WizardContent.js +76 -8
- package/dist/Wizard/WizardContent/WizardContent.js.map +1 -1
- package/dist/Wizard/WizardContent/styles.js +16 -2
- package/dist/Wizard/WizardContent/styles.js.map +1 -1
- package/dist/Wizard/WizardContext/WizardContext.d.ts +4 -6
- package/dist/Wizard/WizardTitle/WizardTitle.js +15 -1
- package/dist/Wizard/WizardTitle/WizardTitle.js.map +1 -1
- package/dist/legacy/StepNavigation/StepNavigation.d.ts +12 -10
- package/dist/legacy/Wizard/Wizard.d.ts +4 -0
- package/dist/legacy/Wizard/Wizard.js +18 -6
- package/dist/legacy/Wizard/Wizard.js.map +1 -1
- package/dist/legacy/Wizard/WizardContent/WizardContent.d.ts +4 -0
- package/dist/legacy/Wizard/WizardContent/WizardContent.js +77 -8
- package/dist/legacy/Wizard/WizardContent/WizardContent.js.map +1 -1
- package/dist/legacy/Wizard/WizardContent/styles.js +16 -2
- package/dist/legacy/Wizard/WizardContent/styles.js.map +1 -1
- package/dist/legacy/Wizard/WizardContext/WizardContext.d.ts +4 -6
- package/dist/legacy/Wizard/WizardTitle/WizardTitle.js +15 -1
- package/dist/legacy/Wizard/WizardTitle/WizardTitle.js.map +1 -1
- package/dist/modern/StepNavigation/StepNavigation.d.ts +12 -10
- package/dist/modern/Wizard/Wizard.d.ts +4 -0
- package/dist/modern/Wizard/Wizard.js +12 -3
- package/dist/modern/Wizard/Wizard.js.map +1 -1
- package/dist/modern/Wizard/WizardContent/WizardContent.d.ts +4 -0
- package/dist/modern/Wizard/WizardContent/WizardContent.js +65 -8
- package/dist/modern/Wizard/WizardContent/WizardContent.js.map +1 -1
- package/dist/modern/Wizard/WizardContent/styles.js +16 -2
- package/dist/modern/Wizard/WizardContent/styles.js.map +1 -1
- package/dist/modern/Wizard/WizardContext/WizardContext.d.ts +4 -6
- package/dist/modern/Wizard/WizardTitle/WizardTitle.js +13 -1
- package/dist/modern/Wizard/WizardTitle/WizardTitle.js.map +1 -1
- package/package.json +5 -4
|
@@ -16,16 +16,18 @@ export type HvStepNavigationProps = StandardProps<
|
|
|
16
16
|
/**
|
|
17
17
|
* Steps to show on the component.
|
|
18
18
|
*/
|
|
19
|
-
steps: Array<
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
19
|
+
steps: Array<
|
|
20
|
+
Pick<HvStepProps, "state" | "title" | "onClick" | "className" | "disabled"> & {
|
|
21
|
+
/**
|
|
22
|
+
* Class names to override styles on the separator component after the step.
|
|
23
|
+
*/
|
|
24
|
+
separatorClassName?: string;
|
|
25
|
+
/**
|
|
26
|
+
* Class names to override styles on the title component above the step.
|
|
27
|
+
*/
|
|
28
|
+
titleClassName?: string;
|
|
29
|
+
}
|
|
30
|
+
>;
|
|
29
31
|
/**
|
|
30
32
|
* Sets one of the standard sizes of the steps.
|
|
31
33
|
*/
|
package/dist/Wizard/Wizard.d.ts
CHANGED
package/dist/Wizard/Wizard.js
CHANGED
|
@@ -25,7 +25,7 @@ var _WizardContent = _interopRequireDefault(require("./WizardContent"));
|
|
|
25
25
|
var _WizardActions = _interopRequireDefault(require("./WizardActions"));
|
|
26
26
|
var _styles2 = _interopRequireDefault(require("./styles"));
|
|
27
27
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
28
|
-
var _excluded = ["className", "children", "onClose", "handleSubmit", "title", "open", "skippable", "loading", "hasSummary", "labels", "fixedHeight", "customStep"];
|
|
28
|
+
var _excluded = ["className", "children", "onClose", "handleSubmit", "title", "open", "skippable", "loading", "hasSummary", "summaryContent", "labels", "fixedHeight", "customStep"];
|
|
29
29
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
30
30
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
31
31
|
var HvWizard = function HvWizard(_ref) {
|
|
@@ -41,6 +41,7 @@ var HvWizard = function HvWizard(_ref) {
|
|
|
41
41
|
loading = _ref$loading === void 0 ? false : _ref$loading,
|
|
42
42
|
_ref$hasSummary = _ref.hasSummary,
|
|
43
43
|
hasSummary = _ref$hasSummary === void 0 ? false : _ref$hasSummary,
|
|
44
|
+
summaryContent = _ref.summaryContent,
|
|
44
45
|
_ref$labels = _ref.labels,
|
|
45
46
|
labels = _ref$labels === void 0 ? {
|
|
46
47
|
cancel: "Cancel",
|
|
@@ -58,16 +59,22 @@ var HvWizard = function HvWizard(_ref) {
|
|
|
58
59
|
_React$useState2 = (0, _slicedToArray2.default)(_React$useState, 2),
|
|
59
60
|
context = _React$useState2[0],
|
|
60
61
|
setContext = _React$useState2[1];
|
|
61
|
-
var _React$useState3 = _react.default.useState(
|
|
62
|
+
var _React$useState3 = _react.default.useState(null),
|
|
62
63
|
_React$useState4 = (0, _slicedToArray2.default)(_React$useState3, 2),
|
|
63
|
-
|
|
64
|
-
|
|
64
|
+
summary = _React$useState4[0],
|
|
65
|
+
setSummary = _React$useState4[1];
|
|
66
|
+
var _React$useState5 = _react.default.useState(0),
|
|
67
|
+
_React$useState6 = (0, _slicedToArray2.default)(_React$useState5, 2),
|
|
68
|
+
tab = _React$useState6[0],
|
|
69
|
+
setTab = _React$useState6[1];
|
|
65
70
|
var contextValue = _react.default.useMemo(function () {
|
|
66
71
|
return {
|
|
67
72
|
context: context,
|
|
68
|
-
setContext: setContext
|
|
73
|
+
setContext: setContext,
|
|
74
|
+
summary: summary,
|
|
75
|
+
setSummary: setSummary
|
|
69
76
|
};
|
|
70
|
-
}, [context,
|
|
77
|
+
}, [context, summary]);
|
|
71
78
|
_react.default.useEffect(function () {
|
|
72
79
|
if (!open) {
|
|
73
80
|
setTab(0);
|
|
@@ -96,6 +103,7 @@ var HvWizard = function HvWizard(_ref) {
|
|
|
96
103
|
loading: loading,
|
|
97
104
|
fixedHeight: fixedHeight,
|
|
98
105
|
tab: tab,
|
|
106
|
+
summaryContent: summaryContent,
|
|
99
107
|
children: children
|
|
100
108
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_WizardActions.default, {
|
|
101
109
|
loading: loading,
|
|
@@ -138,6 +146,10 @@ process.env.NODE_ENV !== "production" ? HvWizard.propTypes = {
|
|
|
138
146
|
* Shows the summary button.
|
|
139
147
|
*/
|
|
140
148
|
hasSummary: _propTypes.default.bool,
|
|
149
|
+
/**
|
|
150
|
+
* The content of the summary.
|
|
151
|
+
*/
|
|
152
|
+
summaryContent: _propTypes.default.node,
|
|
141
153
|
/**
|
|
142
154
|
* The content of the component.
|
|
143
155
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Wizard.js","names":["HvWizard","className","children","onClose","handleSubmit","title","open","skippable","loading","hasSummary","labels","cancel","next","previous","skip","submit","summary","fixedHeight","customStep","others","React","useState","context","setContext","tab","setTab","contextValue","useMemo","useEffect","handleClose","useCallback","evt","reason","propTypes","PropTypes","string","bool","isRequired","func","node","shape","type","oneOf","stepSize","width","xs","number","sm","md","lg","xl","withStyles","styles","name"],"sources":["../../src/Wizard/Wizard.js"],"sourcesContent":["import React from \"react\";\nimport PropTypes from \"prop-types\";\nimport { withStyles } from \"@mui/styles\";\nimport WizardContext from \"./WizardContext\";\nimport WizardContainer from \"./WizardContainer\";\nimport WizardTitle from \"./WizardTitle\";\nimport WizardContent from \"./WizardContent\";\nimport WizardActions from \"./WizardActions\";\n\nimport styles from \"./styles\";\n\nconst HvWizard = ({\n className,\n children,\n onClose,\n handleSubmit,\n title,\n open,\n skippable = true,\n loading = false,\n hasSummary = false,\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 ...others\n}) => {\n const [context, setContext] = React.useState({});\n const [tab, setTab] = React.useState(0);\n\n const contextValue = React.useMemo(\n () => ({\n context,\n setContext,\n }),\n [context,
|
|
1
|
+
{"version":3,"file":"Wizard.js","names":["HvWizard","className","children","onClose","handleSubmit","title","open","skippable","loading","hasSummary","summaryContent","labels","cancel","next","previous","skip","submit","summary","fixedHeight","customStep","others","React","useState","context","setContext","setSummary","tab","setTab","contextValue","useMemo","useEffect","handleClose","useCallback","evt","reason","propTypes","PropTypes","string","bool","isRequired","func","node","shape","type","oneOf","stepSize","width","xs","number","sm","md","lg","xl","withStyles","styles","name"],"sources":["../../src/Wizard/Wizard.js"],"sourcesContent":["import React from \"react\";\nimport PropTypes from \"prop-types\";\nimport { withStyles } from \"@mui/styles\";\nimport WizardContext from \"./WizardContext\";\nimport WizardContainer from \"./WizardContainer\";\nimport WizardTitle from \"./WizardTitle\";\nimport WizardContent from \"./WizardContent\";\nimport WizardActions from \"./WizardActions\";\n\nimport styles from \"./styles\";\n\nconst 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 ...others\n}) => {\n const [context, setContext] = React.useState({});\n const [summary, setSummary] = React.useState(null);\n const [tab, setTab] = React.useState(0);\n\n const contextValue = React.useMemo(\n () => ({\n context,\n setContext,\n summary,\n setSummary,\n }),\n [context, summary]\n );\n\n React.useEffect(() => {\n if (!open) {\n setTab(0);\n }\n }, [open]);\n\n const handleClose = React.useCallback(\n (evt, reason) => {\n if (reason !== \"backdropClick\") {\n onClose(evt, reason);\n }\n },\n [onClose]\n );\n\n return (\n <WizardContext.Provider value={contextValue}>\n <WizardContainer className={className} handleClose={handleClose} open={open} {...others}>\n <WizardTitle\n title={title}\n hasSummary={hasSummary}\n labels={labels}\n tab={tab}\n changeTab={setTab}\n customStep={customStep}\n />\n <WizardContent\n loading={loading}\n fixedHeight={fixedHeight}\n tab={tab}\n summaryContent={summaryContent}\n >\n {children}\n </WizardContent>\n <WizardActions\n loading={loading}\n skippable={skippable}\n labels={labels}\n tab={tab}\n changeTab={setTab}\n handleClose={handleClose}\n handleSubmit={handleSubmit}\n />\n </WizardContainer>\n </WizardContext.Provider>\n );\n};\n\nHvWizard.propTypes = {\n /**\n * Class names to be applied.\n */\n className: PropTypes.string,\n /**\n * Current state of the Wizard.\n */\n open: PropTypes.bool.isRequired,\n /**\n * Function executed on close.\n */\n onClose: PropTypes.func.isRequired,\n /**\n * Function executed on submit.\n */\n handleSubmit: PropTypes.func.isRequired,\n /**\n * Enables the skip button.\n */\n skippable: PropTypes.bool,\n /**\n * Title for the wizard.\n */\n title: PropTypes.string,\n /**\n * Shows the summary button.\n */\n hasSummary: PropTypes.bool,\n /**\n * The content of the summary.\n */\n summaryContent: PropTypes.node,\n /**\n * The content of the component.\n */\n children: PropTypes.node,\n /**\n * An object containing all the labels for the wizard.\n */\n labels: PropTypes.shape({\n /**\n * Cancel button label.\n */\n cancel: PropTypes.string,\n /**\n * Skip button label.\n */\n skip: PropTypes.string,\n /**\n * Previous button label.\n */\n previous: PropTypes.string,\n /**\n * Next button label.\n */\n next: PropTypes.string,\n /**\n * Submit button label.\n */\n submit: PropTypes.string,\n /**\n * Summary button label.\n */\n summary: PropTypes.string,\n }),\n /**\n * Forces minimum height to the component.\n */\n fixedHeight: PropTypes.bool,\n /**\n * Whether the loading animation is shown.\n */\n loading: PropTypes.bool,\n /**\n * Custom object to define type, size and width of the StepNavigation component\n */\n customStep: PropTypes.shape({\n /**\n * Type of step navigation. Values = {\"Simple\", \"Default\"}.\n */\n type: PropTypes.oneOf([\"Simple\", \"Default\"]),\n /**\n * Sets one of the standard sizes of the steps. Values = {\"XS\", \"SM\", \"MD\", \"LG\", \"XL\"}\n */\n stepSize: PropTypes.oneOf([\"XS\", \"SM\", \"MD\", \"LG\", \"XL\"]),\n /**\n * Width of the component element on each breakpoint screen resolution.\n */\n width: PropTypes.shape({\n xs: PropTypes.number,\n sm: PropTypes.number,\n md: PropTypes.number,\n lg: PropTypes.number,\n xl: PropTypes.number,\n }),\n }),\n};\n\nexport default withStyles(styles, { name: \"HvWizard\" })(HvWizard);\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAA8B;AAAA;AAAA;AAAA;AAE9B,IAAMA,QAAQ,GAAG,SAAXA,QAAQ,OAsBR;EAAA,IArBJC,SAAS,QAATA,SAAS;IACTC,QAAQ,QAARA,QAAQ;IACRC,OAAO,QAAPA,OAAO;IACPC,YAAY,QAAZA,YAAY;IACZC,KAAK,QAALA,KAAK;IACLC,IAAI,QAAJA,IAAI;IAAA,sBACJC,SAAS;IAATA,SAAS,+BAAG,IAAI;IAAA,oBAChBC,OAAO;IAAPA,OAAO,6BAAG,KAAK;IAAA,uBACfC,UAAU;IAAVA,UAAU,gCAAG,KAAK;IAClBC,cAAc,QAAdA,cAAc;IAAA,mBACdC,MAAM;IAANA,MAAM,4BAAG;MACPC,MAAM,EAAE,QAAQ;M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|
23
23
|
* Whether the loading animation is shown.
|
|
24
24
|
*/
|
|
25
25
|
loading?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* The content of the summary.
|
|
28
|
+
*/
|
|
29
|
+
summaryContent?: React.ReactNode;
|
|
26
30
|
};
|
|
27
31
|
|
|
28
32
|
export default function HvWizardContent(props: HvWizardContentProps): JSX.Element | null;
|
|
@@ -20,6 +20,7 @@ require("core-js/modules/es.array.map.js");
|
|
|
20
20
|
var _react = _interopRequireDefault(require("react"));
|
|
21
21
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
22
22
|
var _styles = require("@mui/styles");
|
|
23
|
+
var _reactResizeAware = _interopRequireDefault(require("react-resize-aware"));
|
|
23
24
|
var _clsx = _interopRequireDefault(require("clsx"));
|
|
24
25
|
var _uikitReactCore = require("@hitachivantara/uikit-react-core");
|
|
25
26
|
var _WizardContext = _interopRequireDefault(require("../WizardContext"));
|
|
@@ -28,6 +29,9 @@ var _styles2 = _interopRequireDefault(require("./styles"));
|
|
|
28
29
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
29
30
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
30
31
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
32
|
+
var DRAWER_PERCENTAGE = 0.3;
|
|
33
|
+
var MODAL_MARGIN = 20;
|
|
34
|
+
var DRAWER_MIN_WIDTH = 280;
|
|
31
35
|
var HvWizardContent = function HvWizardContent(_ref) {
|
|
32
36
|
var classes = _ref.classes,
|
|
33
37
|
_ref$fixedHeight = _ref.fixedHeight,
|
|
@@ -35,7 +39,8 @@ var HvWizardContent = function HvWizardContent(_ref) {
|
|
|
35
39
|
_ref$loading = _ref.loading,
|
|
36
40
|
loading = _ref$loading === void 0 ? false : _ref$loading,
|
|
37
41
|
children = _ref.children,
|
|
38
|
-
tab = _ref.tab
|
|
42
|
+
tab = _ref.tab,
|
|
43
|
+
summaryContent = _ref.summaryContent;
|
|
39
44
|
var arrayChildren = _react.default.Children.toArray(children);
|
|
40
45
|
var initialContext = arrayChildren.reduce(function (acc, child, index) {
|
|
41
46
|
var invalid = child.props.mustValidate === true ? false : null;
|
|
@@ -48,7 +53,44 @@ var HvWizardContent = function HvWizardContent(_ref) {
|
|
|
48
53
|
}, {});
|
|
49
54
|
var _React$useContext = _react.default.useContext(_WizardContext.default),
|
|
50
55
|
context = _React$useContext.context,
|
|
51
|
-
setContext = _React$useContext.setContext
|
|
56
|
+
setContext = _React$useContext.setContext,
|
|
57
|
+
summary = _React$useContext.summary;
|
|
58
|
+
var resizedRef = _react.default.useRef({
|
|
59
|
+
width: 0,
|
|
60
|
+
height: 0
|
|
61
|
+
});
|
|
62
|
+
var _useResizeAware = (0, _reactResizeAware.default)(),
|
|
63
|
+
_useResizeAware2 = (0, _slicedToArray2.default)(_useResizeAware, 2),
|
|
64
|
+
resizeListener = _useResizeAware2[0],
|
|
65
|
+
sizes = _useResizeAware2[1];
|
|
66
|
+
var _React$useState = _react.default.useState(0),
|
|
67
|
+
_React$useState2 = (0, _slicedToArray2.default)(_React$useState, 2),
|
|
68
|
+
summaryHeight = _React$useState2[0],
|
|
69
|
+
setSummaryHeight = _React$useState2[1];
|
|
70
|
+
var _React$useState3 = _react.default.useState(0),
|
|
71
|
+
_React$useState4 = (0, _slicedToArray2.default)(_React$useState3, 2),
|
|
72
|
+
summaryWidth = _React$useState4[0],
|
|
73
|
+
setSummaryWidth = _React$useState4[1];
|
|
74
|
+
var _React$useState5 = _react.default.useState(0),
|
|
75
|
+
_React$useState6 = (0, _slicedToArray2.default)(_React$useState5, 2),
|
|
76
|
+
summaryLeft = _React$useState6[0],
|
|
77
|
+
setSummaryLeft = _React$useState6[1];
|
|
78
|
+
var updateSummaryMeasures = _react.default.useCallback(function (newSizes) {
|
|
79
|
+
var modalWidth = newSizes.width;
|
|
80
|
+
var drawerWidth = modalWidth * DRAWER_PERCENTAGE;
|
|
81
|
+
setSummaryHeight(newSizes.height);
|
|
82
|
+
setSummaryWidth(Math.max(drawerWidth, DRAWER_MIN_WIDTH));
|
|
83
|
+
setSummaryLeft(modalWidth - Math.max(drawerWidth, DRAWER_MIN_WIDTH) - MODAL_MARGIN);
|
|
84
|
+
}, []);
|
|
85
|
+
_react.default.useEffect(function () {
|
|
86
|
+
if (summary && sizes.height !== resizedRef.current.height || sizes.width !== resizedRef.current.width) {
|
|
87
|
+
updateSummaryMeasures(sizes);
|
|
88
|
+
resizedRef.current = {
|
|
89
|
+
height: sizes.height,
|
|
90
|
+
width: sizes.width
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
}, [sizes, summary, updateSummaryMeasures]);
|
|
52
94
|
_react.default.useEffect(function () {
|
|
53
95
|
setContext(initialContext);
|
|
54
96
|
}, []); // eslint-disable-line react-hooks/exhaustive-deps
|
|
@@ -68,12 +110,26 @@ var HvWizardContent = function HvWizardContent(_ref) {
|
|
|
68
110
|
}, {});
|
|
69
111
|
setContext(updatedContext);
|
|
70
112
|
}
|
|
113
|
+
updateSummaryMeasures(sizes);
|
|
71
114
|
}, [tab]); // eslint-disable-line react-hooks/exhaustive-deps
|
|
72
115
|
|
|
73
|
-
|
|
116
|
+
var translateX = summaryWidth ? summaryWidth + 10 : 450;
|
|
117
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_uikitReactCore.HvDialogContent, {
|
|
74
118
|
className: (0, _clsx.default)(classes.contentContainer, fixedHeight && classes.fixedHeight),
|
|
75
119
|
indentContent: true,
|
|
76
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
120
|
+
children: [resizeListener, /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
121
|
+
className: classes.summarySticky,
|
|
122
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
123
|
+
className: classes.summaryContainer,
|
|
124
|
+
style: {
|
|
125
|
+
left: summaryLeft,
|
|
126
|
+
width: summaryWidth,
|
|
127
|
+
height: summaryHeight,
|
|
128
|
+
transform: "translate(".concat(summary ? 0 : translateX, "px, 0)")
|
|
129
|
+
},
|
|
130
|
+
children: summaryContent
|
|
131
|
+
})
|
|
132
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_LoadingContainer.default, {
|
|
77
133
|
hidden: !loading,
|
|
78
134
|
children: _react.default.Children.map(arrayChildren, function (child, index) {
|
|
79
135
|
if (index === tab) {
|
|
@@ -83,7 +139,7 @@ var HvWizardContent = function HvWizardContent(_ref) {
|
|
|
83
139
|
}
|
|
84
140
|
return null;
|
|
85
141
|
})
|
|
86
|
-
})
|
|
142
|
+
})]
|
|
87
143
|
});
|
|
88
144
|
};
|
|
89
145
|
process.env.NODE_ENV !== "production" ? HvWizardContent.propTypes = {
|
|
@@ -100,13 +156,21 @@ process.env.NODE_ENV !== "production" ? HvWizardContent.propTypes = {
|
|
|
100
156
|
*/
|
|
101
157
|
classes: _propTypes.default.shape({
|
|
102
158
|
/**
|
|
103
|
-
* Style applied to the Wizard content container
|
|
159
|
+
* Style applied to the Wizard content container.
|
|
104
160
|
*/
|
|
105
161
|
contentContainer: _propTypes.default.string,
|
|
106
162
|
/**
|
|
107
163
|
* Style applied to the Wizard to fix its height.
|
|
108
164
|
*/
|
|
109
|
-
fixedHeight: _propTypes.default.string
|
|
165
|
+
fixedHeight: _propTypes.default.string,
|
|
166
|
+
/**
|
|
167
|
+
* Style applied to the Summary container to stick it to the top.
|
|
168
|
+
*/
|
|
169
|
+
summarySticky: _propTypes.default.string,
|
|
170
|
+
/**
|
|
171
|
+
* Style applied to the Summary container to position it on the right.
|
|
172
|
+
*/
|
|
173
|
+
summaryContainer: _propTypes.default.string
|
|
110
174
|
}).isRequired,
|
|
111
175
|
/**
|
|
112
176
|
* Forces minimum height to the component.
|
|
@@ -115,7 +179,11 @@ process.env.NODE_ENV !== "production" ? HvWizardContent.propTypes = {
|
|
|
115
179
|
/**
|
|
116
180
|
* Whether the loading animation is shown.
|
|
117
181
|
*/
|
|
118
|
-
loading: _propTypes.default.bool
|
|
182
|
+
loading: _propTypes.default.bool,
|
|
183
|
+
/**
|
|
184
|
+
* The content of the summary.
|
|
185
|
+
*/
|
|
186
|
+
summaryContent: _propTypes.default.node
|
|
119
187
|
} : void 0;
|
|
120
188
|
var _default = (0, _styles.withStyles)(_styles2.default, {
|
|
121
189
|
name: "HvWizardContent"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WizardContent.js","names":["HvWizardContent","classes","fixedHeight","loading","children","tab","arrayChildren","React","Children","toArray","initialContext","reduce","acc","child","index","invalid","props","mustValidate","valid","form","touched","useContext","HvWizardContext","context","setContext","useEffect","updatedContext","Object","entries","key","childState","clsx","contentContainer","map","cloneElement","propTypes","PropTypes","number","isRequired","node","shape","string","bool","withStyles","styles","name"],"sources":["../../../src/Wizard/WizardContent/WizardContent.js"],"sourcesContent":["import React from \"react\";\nimport PropTypes from \"prop-types\";\nimport { withStyles } from \"@mui/styles\";\nimport clsx from \"clsx\";\nimport { HvDialogContent } from \"@hitachivantara/uikit-react-core\";\nimport HvWizardContext from \"../WizardContext\";\nimport LoadingContainer from \"./LoadingContainer\";\n\nimport styles from \"./styles\";\n\nconst HvWizardContent = ({ classes, fixedHeight = false, loading = false, children, tab }) => {\n const arrayChildren = React.Children.toArray(children);\n const initialContext = arrayChildren.reduce((acc, child, index) => {\n const invalid = child.props.mustValidate === true ? false : null;\n const valid = invalid ?? (index === 0 || null);\n return {\n ...acc,\n [index]: { ...child.props, form: {}, valid, touched: index === 0 },\n };\n }, {});\n\n const { context, setContext } = React.useContext(HvWizardContext);\n\n React.useEffect(() => {\n setContext(initialContext);\n }, []); // eslint-disable-line react-hooks/exhaustive-deps\n\n React.useEffect(() => {\n if (tab && !context[tab]?.touched) {\n const updatedContext = Object.entries(context).reduce(\n (acc, [key, childState]) => ({\n ...acc,\n ...(+key <= tab\n ? { [key]: { ...childState, touched: true, valid: childState.valid ?? true } }\n : { [key]: childState }),\n }),\n {}\n );\n\n setContext(updatedContext);\n }\n }, [tab]); // eslint-disable-line react-hooks/exhaustive-deps\n\n return (\n <HvDialogContent\n className={clsx(classes.contentContainer, {\n [classes.fixedHeight]: fixedHeight,\n })}\n indentContent\n >\n <LoadingContainer hidden={!loading}>\n {React.Children.map(arrayChildren, (child, index) => {\n if (index === tab) {\n return React.cloneElement(child, { tab });\n }\n return null;\n })}\n </LoadingContainer>\n </HvDialogContent>\n );\n};\n\nHvWizardContent.propTypes = {\n /**\n * Current tab to show.\n */\n tab: PropTypes.number.isRequired,\n /**\n * Tabs to show on the Wizard.\n */\n children: PropTypes.node.isRequired,\n /**\n * A Jss Object used to override or extend the styles applied.\n */\n classes: PropTypes.shape({\n /**\n * Style applied to the Wizard content container\n */\n contentContainer: PropTypes.string,\n /**\n * Style applied to the Wizard to fix its height.\n */\n fixedHeight: PropTypes.string,\n }).isRequired,\n /**\n * Forces minimum height to the component.\n */\n fixedHeight: PropTypes.bool,\n /**\n * Whether the loading animation is shown.\n */\n loading: PropTypes.bool,\n};\n\nexport default withStyles(styles, { name: \"HvWizardContent\" })(HvWizardContent);\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAA8B;AAAA;AAAA;AAE9B,IAAMA,eAAe,GAAG,SAAlBA,eAAe,OAAyE;EAAA,IAAnEC,OAAO,QAAPA,OAAO;IAAA,wBAAEC,WAAW;IAA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S,CAACM;AACrB,CAAC;AAAC,eAEa,IAAAC,kBAAU,EAACC,gBAAM,EAAE;EAAEC,IAAI,EAAE;AAAkB,CAAC,CAAC,CAAC7C,eAAe,CAAC;AAAA"}
|
|
1
|
+
{"version":3,"file":"WizardContent.js","names":["DRAWER_PERCENTAGE","MODAL_MARGIN","DRAWER_MIN_WIDTH","HvWizardContent","classes","fixedHeight","loading","children","tab","summaryContent","arrayChildren","React","Children","toArray","initialContext","reduce","acc","child","index","invalid","props","mustValidate","valid","form","touched","useContext","HvWizardContext","context","setContext","summary","resizedRef","useRef","width","height","useResizeAware","resizeListener","sizes","useState","summaryHeight","setSummaryHeight","summaryWidth","setSummaryWidth","summaryLeft","setSummaryLeft","updateSummaryMeasures","useCallback","newSizes","modalWidth","drawerWidth","Math","max","useEffect","current","updatedContext","Object","entries","key","childState","translateX","clsx","contentContainer","summarySticky","summaryContainer","left","transform","map","cloneElement","propTypes","PropTypes","number","isRequired","node","shape","string","bool","withStyles","styles","name"],"sources":["../../../src/Wizard/WizardContent/WizardContent.js"],"sourcesContent":["import React from \"react\";\nimport PropTypes from \"prop-types\";\nimport { withStyles } from \"@mui/styles\";\nimport useResizeAware from \"react-resize-aware\";\nimport clsx from \"clsx\";\nimport { HvDialogContent } from \"@hitachivantara/uikit-react-core\";\nimport HvWizardContext from \"../WizardContext\";\nimport LoadingContainer from \"./LoadingContainer\";\n\nimport styles from \"./styles\";\n\nconst DRAWER_PERCENTAGE = 0.3;\nconst MODAL_MARGIN = 20;\nconst DRAWER_MIN_WIDTH = 280;\n\nconst HvWizardContent = ({\n classes,\n fixedHeight = false,\n loading = false,\n children,\n tab,\n summaryContent,\n}) => {\n const arrayChildren = React.Children.toArray(children);\n const initialContext = arrayChildren.reduce((acc, child, index) => {\n const invalid = child.props.mustValidate === true ? false : null;\n const valid = invalid ?? (index === 0 || null);\n return {\n ...acc,\n [index]: { ...child.props, form: {}, valid, touched: index === 0 },\n };\n }, {});\n\n const { context, setContext, summary } = React.useContext(HvWizardContext);\n\n const resizedRef = React.useRef({ width: 0, height: 0 });\n const [resizeListener, sizes] = useResizeAware();\n\n const [summaryHeight, setSummaryHeight] = React.useState(0);\n const [summaryWidth, setSummaryWidth] = React.useState(0);\n const [summaryLeft, setSummaryLeft] = React.useState(0);\n const updateSummaryMeasures = React.useCallback((newSizes) => {\n const modalWidth = newSizes.width;\n const drawerWidth = modalWidth * DRAWER_PERCENTAGE;\n setSummaryHeight(newSizes.height);\n setSummaryWidth(Math.max(drawerWidth, DRAWER_MIN_WIDTH));\n setSummaryLeft(modalWidth - Math.max(drawerWidth, DRAWER_MIN_WIDTH) - MODAL_MARGIN);\n }, []);\n\n React.useEffect(() => {\n if (\n (summary && sizes.height !== resizedRef.current.height) ||\n sizes.width !== resizedRef.current.width\n ) {\n updateSummaryMeasures(sizes);\n resizedRef.current = {\n height: sizes.height,\n width: sizes.width,\n };\n }\n }, [sizes, summary, updateSummaryMeasures]);\n\n React.useEffect(() => {\n setContext(initialContext);\n }, []); // eslint-disable-line react-hooks/exhaustive-deps\n\n React.useEffect(() => {\n if (tab && !context[tab]?.touched) {\n const updatedContext = Object.entries(context).reduce(\n (acc, [key, childState]) => ({\n ...acc,\n ...(+key <= tab\n ? { [key]: { ...childState, touched: true, valid: childState.valid ?? true } }\n : { [key]: childState }),\n }),\n {}\n );\n\n setContext(updatedContext);\n }\n updateSummaryMeasures(sizes);\n }, [tab]); // eslint-disable-line react-hooks/exhaustive-deps\n\n const translateX = summaryWidth ? summaryWidth + 10 : 450;\n\n return (\n <HvDialogContent\n className={clsx(classes.contentContainer, {\n [classes.fixedHeight]: fixedHeight,\n })}\n indentContent\n >\n {resizeListener}\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 <LoadingContainer hidden={!loading}>\n {React.Children.map(arrayChildren, (child, index) => {\n if (index === tab) {\n return React.cloneElement(child, { tab });\n }\n return null;\n })}\n </LoadingContainer>\n </HvDialogContent>\n );\n};\n\nHvWizardContent.propTypes = {\n /**\n * Current tab to show.\n */\n tab: PropTypes.number.isRequired,\n /**\n * Tabs to show on the Wizard.\n */\n children: PropTypes.node.isRequired,\n /**\n * A Jss Object used to override or extend the styles applied.\n */\n classes: PropTypes.shape({\n /**\n * Style applied to the Wizard content container.\n */\n contentContainer: PropTypes.string,\n /**\n * Style applied to the Wizard to fix its height.\n */\n fixedHeight: PropTypes.string,\n /**\n * Style applied to the Summary container to stick it to the top.\n */\n summarySticky: PropTypes.string,\n /**\n * Style applied to the Summary container to position it on the right.\n */\n summaryContainer: PropTypes.string,\n }).isRequired,\n /**\n * Forces minimum height to the component.\n */\n fixedHeight: PropTypes.bool,\n /**\n * Whether the loading animation is shown.\n */\n loading: PropTypes.bool,\n /**\n * The content of the summary.\n */\n summaryContent: PropTypes.node,\n};\n\nexport default withStyles(styles, { name: \"HvWizardContent\" })(HvWizardContent);\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAA8B;AAAA;AAAA;AAE9B,IAAMA,iBAAiB,GAAG,GAAG;AAC7B,IAAMC,YAAY,GAAG,EAAE;AACvB,IAAMC,gBAAgB,GAAG,GAAG;AAE5B,IAAMC,eAAe,GAAG,SAAlBA,eAAe,OAOf;EAAA,IANJC,OAAO,QAAPA,OAAO;IAAA,wBACPC,WAAW;IAAXA,WAAW,iCAAG,KAAK;IAAA,oBACnBC,OAAO;IAAPA,OAAO,6BAAG,KAAK;IACfC,QAAQ,QAARA,QAAQ;IACRC,GAAG,QAAHA,GAAG;IACHC,cAAc,QAAdA,cAAc;EAEd,IAAMC,aAAa,GAAGC,cAAK,CAACC,QAAQ,CAACC,OAAO,CAACN,QAAQ,CAAC;EACtD,IAAMO,cAAc,GAAGJ,aAAa,CAACK,MAAM,CAAC,UAACC,GAAG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OAAO,EAAEgE,kBAAS,CAACI,KAAK,CAAC;IACvB;AACJ;AACA;IACIZ,gBAAgB,EAAEQ,kBAAS,CAACK,MAAM;IAClC;AACJ;AACA;IACIpE,WAAW,EAAE+D,kBAAS,CAACK,MAAM;IAC7B;AACJ;AACA;IACIZ,aAAa,EAAEO,kBAAS,CAACK,MAAM;IAC/B;AACJ;AACA;IACIX,gBAAgB,EAAEM,kBAAS,CAACK;EAC9B,CAAC,CAAC,CAACH,UAAU;EACb;AACF;AACA;EACEjE,WAAW,EAAE+D,kBAAS,CAACM,IAAI;EAC3B;AACF;AACA;EACEpE,OAAO,EAAE8D,kBAAS,CAACM,IAAI;EACvB;AACF;AACA;EACEjE,cAAc,EAAE2D,kBAAS,CAACG;AAC5B,CAAC;AAAC,eAEa,IAAAI,kBAAU,EAACC,gBAAM,EAAE;EAAEC,IAAI,EAAE;AAAkB,CAAC,CAAC,CAAC1E,eAAe,CAAC;AAAA"}
|
|
@@ -4,16 +4,30 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
var styles = function styles() {
|
|
7
|
+
var styles = function styles(theme) {
|
|
8
8
|
return {
|
|
9
9
|
contentContainer: {
|
|
10
10
|
position: "relative",
|
|
11
11
|
padding: 20,
|
|
12
12
|
marginLeft: 0,
|
|
13
|
-
minHeight: 400
|
|
13
|
+
minHeight: 400,
|
|
14
|
+
overflowX: "hidden"
|
|
14
15
|
},
|
|
15
16
|
fixedHeight: {
|
|
16
17
|
minHeight: "calc(100vh - 387px)"
|
|
18
|
+
},
|
|
19
|
+
summarySticky: {
|
|
20
|
+
position: "sticky",
|
|
21
|
+
top: 0
|
|
22
|
+
},
|
|
23
|
+
summaryContainer: {
|
|
24
|
+
position: "absolute",
|
|
25
|
+
minWidth: 280,
|
|
26
|
+
boxShadow: theme.hv.shadows[1],
|
|
27
|
+
backgroundColor: theme.hv.palette.atmosphere.atmo1,
|
|
28
|
+
transition: "transform 0.3s",
|
|
29
|
+
transitionTimingFunction: "ease-in-out",
|
|
30
|
+
overflowY: "scroll"
|
|
17
31
|
}
|
|
18
32
|
};
|
|
19
33
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.js","names":["styles","contentContainer","position","padding","marginLeft","minHeight","fixedHeight"],"sources":["../../../src/Wizard/WizardContent/styles.js"],"sourcesContent":["const styles = () => ({\n contentContainer: {\n position: \"relative\",\n padding: 20,\n marginLeft: 0,\n minHeight: 400,\n },\n fixedHeight: {\n minHeight: \"calc(100vh - 387px)\",\n },\n});\n\nexport default styles;\n"],"mappings":";;;;;;AAAA,IAAMA,MAAM,GAAG,SAATA,MAAM;EAAA,
|
|
1
|
+
{"version":3,"file":"styles.js","names":["styles","theme","contentContainer","position","padding","marginLeft","minHeight","overflowX","fixedHeight","summarySticky","top","summaryContainer","minWidth","boxShadow","hv","shadows","backgroundColor","palette","atmosphere","atmo1","transition","transitionTimingFunction","overflowY"],"sources":["../../../src/Wizard/WizardContent/styles.js"],"sourcesContent":["const styles = (theme) => ({\n contentContainer: {\n position: \"relative\",\n padding: 20,\n marginLeft: 0,\n minHeight: 400,\n overflowX: \"hidden\",\n },\n fixedHeight: {\n minHeight: \"calc(100vh - 387px)\",\n },\n summarySticky: {\n position: \"sticky\",\n top: 0,\n },\n summaryContainer: {\n position: \"absolute\",\n minWidth: 280,\n boxShadow: theme.hv.shadows[1],\n backgroundColor: theme.hv.palette.atmosphere.atmo1,\n transition: \"transform 0.3s\",\n transitionTimingFunction: \"ease-in-out\",\n overflowY: \"scroll\",\n },\n});\n\nexport default styles;\n"],"mappings":";;;;;;AAAA,IAAMA,MAAM,GAAG,SAATA,MAAM,CAAIC,KAAK;EAAA,OAAM;IACzBC,gBAAgB,EAAE;MAChBC,QAAQ,EAAE,UAAU;MACpBC,OAAO,EAAE,EAAE;MACXC,UAAU,EAAE,CAAC;MACbC,SAAS,EAAE,GAAG;MACdC,SAAS,EAAE;IACb,CAAC;IACDC,WAAW,EAAE;MACXF,SAAS,EAAE;IACb,CAAC;IACDG,aAAa,EAAE;MACbN,QAAQ,EAAE,QAAQ;MAClBO,GAAG,EAAE;IACP,CAAC;IACDC,gBAAgB,EAAE;MAChBR,QAAQ,EAAE,UAAU;MACpBS,QAAQ,EAAE,GAAG;MACbC,SAAS,EAAEZ,KAAK,CAACa,EAAE,CAACC,OAAO,CAAC,CAAC,CAAC;MAC9BC,eAAe,EAAEf,KAAK,CAACa,EAAE,CAACG,OAAO,CAACC,UAAU,CAACC,KAAK;MAClDC,UAAU,EAAE,gBAAgB;MAC5BC,wBAAwB,EAAE,aAAa;MACvCC,SAAS,EAAE;IACb;EACF,CAAC;AAAA,CAAC;AAAC,eAEYtB,MAAM;AAAA"}
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
|
|
3
|
-
export type HvWizardContextClassKey = "root";
|
|
4
|
-
|
|
5
3
|
export type HvWizardContextProps = {
|
|
6
4
|
context: any;
|
|
7
|
-
setContext: () => void;
|
|
5
|
+
setContext: (values: any) => void;
|
|
8
6
|
};
|
|
9
7
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
declare const HvWizardContext: React.Context<HvWizardContextProps>;
|
|
9
|
+
|
|
10
|
+
export default HvWizardContext;
|
|
@@ -41,11 +41,19 @@ var HvWizardTitle = function HvWizardTitle(_ref) {
|
|
|
41
41
|
_ref$customStep = _ref.customStep,
|
|
42
42
|
customStep = _ref$customStep === void 0 ? {} : _ref$customStep;
|
|
43
43
|
var _React$useContext = _react.default.useContext(_WizardContext.default),
|
|
44
|
-
context = _React$useContext.context
|
|
44
|
+
context = _React$useContext.context,
|
|
45
|
+
summary = _React$useContext.summary,
|
|
46
|
+
setSummary = _React$useContext.setSummary;
|
|
45
47
|
var _React$useState = _react.default.useState([]),
|
|
46
48
|
_React$useState2 = (0, _slicedToArray2.default)(_React$useState, 2),
|
|
47
49
|
steps = _React$useState2[0],
|
|
48
50
|
setSteps = _React$useState2[1];
|
|
51
|
+
_react.default.useEffect(function () {
|
|
52
|
+
if (summary === null && hasSummary) {
|
|
53
|
+
setSummary(false);
|
|
54
|
+
}
|
|
55
|
+
}, []); // eslint-disable-line react-hooks/exhaustive-deps
|
|
56
|
+
|
|
49
57
|
_react.default.useEffect(function () {
|
|
50
58
|
var contextArray = Object.entries(context);
|
|
51
59
|
if (contextArray.length) {
|
|
@@ -64,6 +72,11 @@ var HvWizardTitle = function HvWizardTitle(_ref) {
|
|
|
64
72
|
setSteps(updatedSteps);
|
|
65
73
|
}
|
|
66
74
|
}, [context, tab, changeTab]);
|
|
75
|
+
var toggleSummary = function toggleSummary() {
|
|
76
|
+
setSummary(function (oldSummary) {
|
|
77
|
+
return !oldSummary;
|
|
78
|
+
});
|
|
79
|
+
};
|
|
67
80
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_uikitReactCore.HvDialogTitle, {
|
|
68
81
|
className: classes.headerContainer,
|
|
69
82
|
classes: {
|
|
@@ -95,6 +108,7 @@ var HvWizardTitle = function HvWizardTitle(_ref) {
|
|
|
95
108
|
classes: {
|
|
96
109
|
root: classes.rootSummaryButton
|
|
97
110
|
},
|
|
111
|
+
onClick: toggleSummary,
|
|
98
112
|
children: [_Report || (_Report = /*#__PURE__*/(0, _jsxRuntime.jsx)(_uikitReactIcons.Report, {})), " ", "".concat((_labels$summary = labels.summary) !== null && _labels$summary !== void 0 ? _labels$summary : "Summary")]
|
|
99
113
|
})]
|
|
100
114
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WizardTitle.js","names":["switchTabState","state","currentTab","index","valid","touched","HvWizardTitle","title","hasSummary","labels","tab","classes","changeTab","customStep","React","useContext","HvWizardContext","context","useState","steps","setSteps","useEffect","contextArray","Object","entries","length","updatedSteps","map","childState","name","onClick","headerContainer","messageContainer","titleContainer","stepContainer","type","stepSize","width","xs","sm","md","lg","buttonWidth","root","rootSummaryButton","
|
|
1
|
+
{"version":3,"file":"WizardTitle.js","names":["switchTabState","state","currentTab","index","valid","touched","HvWizardTitle","title","hasSummary","labels","tab","classes","changeTab","customStep","React","useContext","HvWizardContext","context","summary","setSummary","useState","steps","setSteps","useEffect","contextArray","Object","entries","length","updatedSteps","map","childState","name","onClick","toggleSummary","oldSummary","headerContainer","messageContainer","titleContainer","stepContainer","type","stepSize","width","xs","sm","md","lg","buttonWidth","root","rootSummaryButton","propTypes","PropTypes","shape","string","bool","number","isRequired","func","oneOf","xl","withStyles","styles"],"sources":["../../../src/Wizard/WizardTitle/WizardTitle.js"],"sourcesContent":["import React from \"react\";\nimport PropTypes from \"prop-types\";\nimport { withStyles } from \"@mui/styles\";\nimport { HvButton, HvDialogTitle, HvGrid, HvTypography } from \"@hitachivantara/uikit-react-core\";\nimport { Report } from \"@hitachivantara/uikit-react-icons\";\nimport { HvStepNavigation } from \"@hitachivantara/uikit-react-lab\";\nimport HvWizardContext from \"../WizardContext\";\n\nimport styles from \"./styles\";\n\nconst switchTabState = (state, currentTab, index) => {\n if (index === currentTab) return \"Current\";\n if (state.valid) return \"Completed\";\n if (state.valid === null) return \"Enabled\";\n if (state.touched && state.valid === false) return \"Failed\";\n // \"Disabled\"\n // \"Pending\"\n return \"Enabled\";\n};\n\nconst HvWizardTitle = ({\n title,\n hasSummary = false,\n labels = {},\n tab,\n classes,\n changeTab,\n customStep = {},\n}) => {\n const { context, summary, setSummary } = React.useContext(HvWizardContext);\n const [steps, setSteps] = React.useState([]);\n\n React.useEffect(() => {\n if (summary === null && hasSummary) {\n setSummary(false);\n }\n }, []); // eslint-disable-line react-hooks/exhaustive-deps\n\n React.useEffect(() => {\n const contextArray = Object.entries(context);\n if (contextArray.length) {\n const updatedSteps = contextArray.map(([, childState], index) => ({\n title: childState.name ?? `${index + 1}`,\n state: switchTabState(childState, tab, index),\n onClick: () => changeTab(index),\n }));\n\n setSteps(updatedSteps);\n }\n }, [context, tab, changeTab]);\n\n const toggleSummary = () => {\n setSummary((oldSummary) => !oldSummary);\n };\n\n return (\n <HvDialogTitle\n className={classes.headerContainer}\n classes={{ messageContainer: classes.messageContainer }}\n >\n <HvGrid\n container\n justifyContent=\"space-between\"\n alignItems=\"center\"\n className={classes.titleContainer}\n >\n {title && (\n <HvTypography variant=\"xsTitle\" component=\"h3\">\n {title}\n </HvTypography>\n )}\n {!!steps.length && (\n <HvStepNavigation\n className={classes.stepContainer}\n steps={steps}\n type={customStep?.type ?? \"Default\"}\n stepSize={customStep?.stepSize ?? \"XS\"}\n width={customStep?.width ?? { xs: 200, sm: 350, md: 600, lg: 800 }}\n />\n )}\n {hasSummary && (\n <HvButton\n category=\"secondary\"\n className={classes.buttonWidth}\n classes={{ root: classes.rootSummaryButton }}\n onClick={toggleSummary}\n >\n <Report /> {`${labels.summary ?? \"Summary\"}`}\n </HvButton>\n )}\n </HvGrid>\n </HvDialogTitle>\n );\n};\n\nHvWizardTitle.propTypes = {\n /**\n * A Jss Object used to override or extend the styles applied.\n */\n classes: PropTypes.shape({\n /**\n * Styles applied to the header container.\n */\n headerContainer: PropTypes.string,\n /**\n * Styles applied to override the Dialog Title styles.\n */\n messageContainer: PropTypes.string,\n /**\n * Styles applied to the header content container.\n */\n titleContainer: PropTypes.string,\n /**\n * Styles applied to the Button component to override its width.\n */\n buttonWidth: PropTypes.string,\n /**\n * Styles applied to the Button component to override its right padding.\n */\n rootSummaryButton: PropTypes.string,\n /**\n *\n */\n stepContainer: PropTypes.string,\n }),\n /**\n * Title for the wizard.\n */\n title: PropTypes.string,\n /**\n * Shows the summary button.\n */\n hasSummary: PropTypes.bool,\n /**\n * An object containing all the labels for the wizard header.\n */\n labels: PropTypes.shape({\n /**\n * Summary button label.\n */\n summary: PropTypes.string,\n }),\n /**\n * Current tab to check if it's last page or first to disable previous button and swap between next and submit button.\n */\n tab: PropTypes.number.isRequired,\n /**\n * Function to change the tab when pressing previous and next buttons.\n */\n changeTab: PropTypes.func.isRequired,\n /**\n * Custom object to define type, size and width of the StepNavigation component\n */\n customStep: PropTypes.shape({\n /**\n * Type of step navigation. Values = {\"Simple\", \"Default\"}.\n */\n type: PropTypes.oneOf([\"Simple\", \"Default\"]),\n /**\n * Sets one of the standard sizes of the steps. Values = {\"XS\", \"SM\", \"MD\", \"LG\", \"XL\"}\n */\n stepSize: PropTypes.oneOf([\"XS\", \"SM\", \"MD\", \"LG\", \"XL\"]),\n /**\n * Width of the component element on each breakpoint screen resolution.\n */\n width: PropTypes.shape({\n xs: PropTypes.number,\n sm: PropTypes.number,\n md: PropTypes.number,\n lg: PropTypes.number,\n xl: PropTypes.number,\n }),\n }),\n};\n\nexport default withStyles(styles, { name: \"HvWizardTitle\" })(HvWizardTitle);\n"],"mappings":";;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAA8B;AAAA;AAE9B,IAAMA,cAAc,GAAG,SAAjBA,cAAc,CAAIC,KAAK,EAAEC,UAAU,EAAEC,KAAK,EAAK;EACnD,IAAIA,KAAK,KAAKD,UAAU,EAAE,OAAO,SAAS;EAC1C,IAAID,KAAK,CAACG,KAAK,EAAE,OAAO,WAAW;EACnC,IAAIH,KAAK,CAACG,KAAK,KAAK,IAAI,EAAE,OAAO,SAAS;EAC1C,IAAIH,KAAK,CAACI,OAAO,IAAIJ,KAAK,CAACG,KAAK,KAAK,KAAK,EAAE,OAAO,QAAQ;EAC3D;EACA;EACA,OAAO,SAAS;AAClB,CAAC;AAED,IAAME,aAAa,GAAG,SAAhBA,aAAa,OAQb;EAAA;EAAA,IAPJC,KAAK,QAALA,KAAK;IAAA,uBACLC,UAAU;IAAVA,UAAU,gCAAG,KAAK;IAAA,mBAClBC,MAAM;IAANA,MAAM,4BAAG,CAAC,CAAC;IACXC,GAAG,QAAHA,GAAG;IACHC,OAAO,QAAPA,OAAO;IACPC,SAAS,QAATA,SAAS;IAAA,uBACTC,UAAU;IAAVA,UAAU,gCAAG,CAAC,CAAC;EAEf,wBAAyCC,cAAK,CAACC,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a,IAAAK,kBAAU,EAACC,gBAAM,EAAE;EAAE7B,IAAI,EAAE;AAAgB,CAAC,CAAC,CAACzB,aAAa,CAAC;AAAA"}
|
|
@@ -16,16 +16,18 @@ export type HvStepNavigationProps = StandardProps<
|
|
|
16
16
|
/**
|
|
17
17
|
* Steps to show on the component.
|
|
18
18
|
*/
|
|
19
|
-
steps: Array<
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
19
|
+
steps: Array<
|
|
20
|
+
Pick<HvStepProps, "state" | "title" | "onClick" | "className" | "disabled"> & {
|
|
21
|
+
/**
|
|
22
|
+
* Class names to override styles on the separator component after the step.
|
|
23
|
+
*/
|
|
24
|
+
separatorClassName?: string;
|
|
25
|
+
/**
|
|
26
|
+
* Class names to override styles on the title component above the step.
|
|
27
|
+
*/
|
|
28
|
+
titleClassName?: string;
|
|
29
|
+
}
|
|
30
|
+
>;
|
|
29
31
|
/**
|
|
30
32
|
* Sets one of the standard sizes of the steps.
|
|
31
33
|
*/
|
|
@@ -8,7 +8,7 @@ import "core-js/modules/es.object.get-own-property-descriptors.js";
|
|
|
8
8
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
9
9
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
10
10
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
11
|
-
var _excluded = ["className", "children", "onClose", "handleSubmit", "title", "open", "skippable", "loading", "hasSummary", "labels", "fixedHeight", "customStep"];
|
|
11
|
+
var _excluded = ["className", "children", "onClose", "handleSubmit", "title", "open", "skippable", "loading", "hasSummary", "summaryContent", "labels", "fixedHeight", "customStep"];
|
|
12
12
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
13
13
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
14
14
|
import React from "react";
|
|
@@ -35,6 +35,7 @@ var HvWizard = function HvWizard(_ref) {
|
|
|
35
35
|
loading = _ref$loading === void 0 ? false : _ref$loading,
|
|
36
36
|
_ref$hasSummary = _ref.hasSummary,
|
|
37
37
|
hasSummary = _ref$hasSummary === void 0 ? false : _ref$hasSummary,
|
|
38
|
+
summaryContent = _ref.summaryContent,
|
|
38
39
|
_ref$labels = _ref.labels,
|
|
39
40
|
labels = _ref$labels === void 0 ? {
|
|
40
41
|
cancel: "Cancel",
|
|
@@ -52,16 +53,22 @@ var HvWizard = function HvWizard(_ref) {
|
|
|
52
53
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
53
54
|
context = _React$useState2[0],
|
|
54
55
|
setContext = _React$useState2[1];
|
|
55
|
-
var _React$useState3 = React.useState(
|
|
56
|
+
var _React$useState3 = React.useState(null),
|
|
56
57
|
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
57
|
-
|
|
58
|
-
|
|
58
|
+
summary = _React$useState4[0],
|
|
59
|
+
setSummary = _React$useState4[1];
|
|
60
|
+
var _React$useState5 = React.useState(0),
|
|
61
|
+
_React$useState6 = _slicedToArray(_React$useState5, 2),
|
|
62
|
+
tab = _React$useState6[0],
|
|
63
|
+
setTab = _React$useState6[1];
|
|
59
64
|
var contextValue = React.useMemo(function () {
|
|
60
65
|
return {
|
|
61
66
|
context: context,
|
|
62
|
-
setContext: setContext
|
|
67
|
+
setContext: setContext,
|
|
68
|
+
summary: summary,
|
|
69
|
+
setSummary: setSummary
|
|
63
70
|
};
|
|
64
|
-
}, [context,
|
|
71
|
+
}, [context, summary]);
|
|
65
72
|
React.useEffect(function () {
|
|
66
73
|
if (!open) {
|
|
67
74
|
setTab(0);
|
|
@@ -90,6 +97,7 @@ var HvWizard = function HvWizard(_ref) {
|
|
|
90
97
|
loading: loading,
|
|
91
98
|
fixedHeight: fixedHeight,
|
|
92
99
|
tab: tab,
|
|
100
|
+
summaryContent: summaryContent,
|
|
93
101
|
children: children
|
|
94
102
|
}), /*#__PURE__*/_jsx(WizardActions, {
|
|
95
103
|
loading: loading,
|
|
@@ -132,6 +140,10 @@ process.env.NODE_ENV !== "production" ? HvWizard.propTypes = {
|
|
|
132
140
|
* Shows the summary button.
|
|
133
141
|
*/
|
|
134
142
|
hasSummary: PropTypes.bool,
|
|
143
|
+
/**
|
|
144
|
+
* The content of the summary.
|
|
145
|
+
*/
|
|
146
|
+
summaryContent: PropTypes.node,
|
|
135
147
|
/**
|
|
136
148
|
* The content of the component.
|
|
137
149
|
*/
|