@hitachivantara/uikit-react-lab 4.0.1-next.4 → 4.0.1-next.5
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/DefaultNavigation/DefaultNavigation.d.ts +3 -1
- package/dist/StepNavigation/DefaultNavigation/DefaultNavigation.js +2 -9
- package/dist/StepNavigation/DefaultNavigation/DefaultNavigation.js.map +1 -1
- package/dist/StepNavigation/DefaultNavigation/Step/Step.d.ts +2 -2
- package/dist/StepNavigation/DefaultNavigation/Step/Step.js +2 -2
- package/dist/StepNavigation/DefaultNavigation/Step/Step.js.map +1 -1
- package/dist/StepNavigation/DefaultNavigation/utils.js +3 -2
- package/dist/StepNavigation/DefaultNavigation/utils.js.map +1 -1
- package/dist/StepNavigation/SimpleNavigation/Dot/Dot.js +2 -5
- package/dist/StepNavigation/SimpleNavigation/Dot/Dot.js.map +1 -1
- package/dist/StepNavigation/SimpleNavigation/SimpleNavigation.d.ts +3 -1
- package/dist/StepNavigation/SimpleNavigation/SimpleNavigation.js +2 -11
- package/dist/StepNavigation/SimpleNavigation/SimpleNavigation.js.map +1 -1
- package/dist/StepNavigation/SimpleNavigation/utils.js +10 -8
- package/dist/StepNavigation/SimpleNavigation/utils.js.map +1 -1
- package/dist/StepNavigation/StepNavigation.js +5 -5
- package/dist/StepNavigation/StepNavigation.js.map +1 -1
- package/dist/Wizard/Wizard.d.ts +63 -0
- package/dist/Wizard/Wizard.js +262 -0
- package/dist/Wizard/Wizard.js.map +1 -0
- package/dist/Wizard/WizardActions/WizardActions.d.ts +61 -0
- package/dist/Wizard/WizardActions/WizardActions.js +270 -0
- package/dist/Wizard/WizardActions/WizardActions.js.map +1 -0
- package/dist/Wizard/WizardActions/index.d.ts +2 -0
- package/dist/Wizard/WizardActions/index.js +16 -0
- package/dist/Wizard/WizardActions/index.js.map +1 -0
- package/dist/Wizard/WizardActions/styles.js +30 -0
- package/dist/Wizard/WizardActions/styles.js.map +1 -0
- package/dist/Wizard/WizardContainer/WizardContainer.d.ts +28 -0
- package/dist/Wizard/WizardContainer/WizardContainer.js +116 -0
- package/dist/Wizard/WizardContainer/WizardContainer.js.map +1 -0
- package/dist/Wizard/WizardContainer/index.d.ts +2 -0
- package/dist/Wizard/WizardContainer/index.js +16 -0
- package/dist/Wizard/WizardContainer/index.js.map +1 -0
- package/dist/Wizard/WizardContainer/styles.js +23 -0
- package/dist/Wizard/WizardContainer/styles.js.map +1 -0
- package/dist/Wizard/WizardContent/LoadingContainer.js +101 -0
- package/dist/Wizard/WizardContent/LoadingContainer.js.map +1 -0
- package/dist/Wizard/WizardContent/WizardContent.d.ts +28 -0
- package/dist/Wizard/WizardContent/WizardContent.js +167 -0
- package/dist/Wizard/WizardContent/WizardContent.js.map +1 -0
- package/dist/Wizard/WizardContent/index.d.ts +2 -0
- package/dist/Wizard/WizardContent/index.js +16 -0
- package/dist/Wizard/WizardContent/index.js.map +1 -0
- package/dist/Wizard/WizardContent/styles.js +24 -0
- package/dist/Wizard/WizardContent/styles.js.map +1 -0
- package/dist/Wizard/WizardContext/WizardContext.js +21 -0
- package/dist/Wizard/WizardContext/WizardContext.js.map +1 -0
- package/dist/Wizard/WizardContext/index.js +16 -0
- package/dist/Wizard/WizardContext/index.js.map +1 -0
- package/dist/Wizard/WizardTitle/WizardTitle.d.ts +42 -0
- package/dist/Wizard/WizardTitle/WizardTitle.js +227 -0
- package/dist/Wizard/WizardTitle/WizardTitle.js.map +1 -0
- package/dist/Wizard/WizardTitle/index.d.ts +2 -0
- package/dist/Wizard/WizardTitle/index.js +16 -0
- package/dist/Wizard/WizardTitle/index.js.map +1 -0
- package/dist/Wizard/WizardTitle/styles.js +41 -0
- package/dist/Wizard/WizardTitle/styles.js.map +1 -0
- package/dist/Wizard/index.d.ts +2 -0
- package/dist/Wizard/index.js +56 -0
- package/dist/Wizard/index.js.map +1 -0
- package/dist/Wizard/styles.js +16 -0
- package/dist/Wizard/styles.js.map +1 -0
- package/dist/index.d.ts +8 -5
- package/dist/index.js +14 -5
- package/dist/index.js.map +1 -1
- package/dist/legacy/StepNavigation/DefaultNavigation/DefaultNavigation.d.ts +3 -1
- package/dist/legacy/StepNavigation/DefaultNavigation/DefaultNavigation.js +2 -8
- package/dist/legacy/StepNavigation/DefaultNavigation/DefaultNavigation.js.map +1 -1
- package/dist/legacy/StepNavigation/DefaultNavigation/Step/Step.d.ts +2 -2
- package/dist/legacy/StepNavigation/DefaultNavigation/Step/Step.js +2 -2
- package/dist/legacy/StepNavigation/DefaultNavigation/Step/Step.js.map +1 -1
- package/dist/legacy/StepNavigation/DefaultNavigation/utils.js +3 -2
- package/dist/legacy/StepNavigation/DefaultNavigation/utils.js.map +1 -1
- package/dist/legacy/StepNavigation/SimpleNavigation/Dot/Dot.js +4 -7
- package/dist/legacy/StepNavigation/SimpleNavigation/Dot/Dot.js.map +1 -1
- package/dist/legacy/StepNavigation/SimpleNavigation/SimpleNavigation.d.ts +3 -1
- package/dist/legacy/StepNavigation/SimpleNavigation/SimpleNavigation.js +2 -9
- package/dist/legacy/StepNavigation/SimpleNavigation/SimpleNavigation.js.map +1 -1
- package/dist/legacy/StepNavigation/SimpleNavigation/utils.js +9 -5
- package/dist/legacy/StepNavigation/SimpleNavigation/utils.js.map +1 -1
- package/dist/legacy/StepNavigation/StepNavigation.js +5 -5
- package/dist/legacy/StepNavigation/StepNavigation.js.map +1 -1
- package/dist/legacy/Wizard/Wizard.d.ts +63 -0
- package/dist/legacy/Wizard/Wizard.js +229 -0
- package/dist/legacy/Wizard/Wizard.js.map +1 -0
- package/dist/legacy/Wizard/WizardActions/WizardActions.d.ts +61 -0
- package/dist/legacy/Wizard/WizardActions/WizardActions.js +237 -0
- package/dist/legacy/Wizard/WizardActions/WizardActions.js.map +1 -0
- package/dist/legacy/Wizard/WizardActions/index.d.ts +2 -0
- package/dist/legacy/Wizard/WizardActions/index.js +2 -0
- package/dist/legacy/Wizard/WizardActions/index.js.map +1 -0
- package/dist/legacy/Wizard/WizardActions/styles.js +22 -0
- package/dist/legacy/Wizard/WizardActions/styles.js.map +1 -0
- package/dist/legacy/Wizard/WizardContainer/WizardContainer.d.ts +28 -0
- package/dist/legacy/Wizard/WizardContainer/WizardContainer.js +90 -0
- package/dist/legacy/Wizard/WizardContainer/WizardContainer.js.map +1 -0
- package/dist/legacy/Wizard/WizardContainer/index.d.ts +2 -0
- package/dist/legacy/Wizard/WizardContainer/index.js +2 -0
- package/dist/legacy/Wizard/WizardContainer/index.js.map +1 -0
- package/dist/legacy/Wizard/WizardContainer/styles.js +15 -0
- package/dist/legacy/Wizard/WizardContainer/styles.js.map +1 -0
- package/dist/legacy/Wizard/WizardContent/LoadingContainer.js +78 -0
- package/dist/legacy/Wizard/WizardContent/LoadingContainer.js.map +1 -0
- package/dist/legacy/Wizard/WizardContent/WizardContent.d.ts +28 -0
- package/dist/legacy/Wizard/WizardContent/WizardContent.js +132 -0
- package/dist/legacy/Wizard/WizardContent/WizardContent.js.map +1 -0
- package/dist/legacy/Wizard/WizardContent/index.d.ts +2 -0
- package/dist/legacy/Wizard/WizardContent/index.js +2 -0
- package/dist/legacy/Wizard/WizardContent/index.js.map +1 -0
- package/dist/legacy/Wizard/WizardContent/styles.js +16 -0
- package/dist/legacy/Wizard/WizardContent/styles.js.map +1 -0
- package/dist/legacy/Wizard/WizardContext/WizardContext.js +12 -0
- package/dist/legacy/Wizard/WizardContext/WizardContext.js.map +1 -0
- package/dist/legacy/Wizard/WizardContext/index.js +2 -0
- package/dist/legacy/Wizard/WizardContext/index.js.map +1 -0
- package/dist/legacy/Wizard/WizardTitle/WizardTitle.d.ts +42 -0
- package/dist/legacy/Wizard/WizardTitle/WizardTitle.js +204 -0
- package/dist/legacy/Wizard/WizardTitle/WizardTitle.js.map +1 -0
- package/dist/legacy/Wizard/WizardTitle/index.d.ts +2 -0
- package/dist/legacy/Wizard/WizardTitle/index.js +2 -0
- package/dist/legacy/Wizard/WizardTitle/index.js.map +1 -0
- package/dist/legacy/Wizard/WizardTitle/styles.js +33 -0
- package/dist/legacy/Wizard/WizardTitle/styles.js.map +1 -0
- package/dist/legacy/Wizard/index.d.ts +2 -0
- package/dist/legacy/Wizard/index.js +7 -0
- package/dist/legacy/Wizard/index.js.map +1 -0
- package/dist/legacy/Wizard/styles.js +8 -0
- package/dist/legacy/Wizard/styles.js.map +1 -0
- package/dist/legacy/index.d.ts +8 -5
- package/dist/legacy/index.js +3 -2
- package/dist/legacy/index.js.map +1 -1
- package/dist/modern/StepNavigation/DefaultNavigation/DefaultNavigation.d.ts +3 -1
- package/dist/modern/StepNavigation/DefaultNavigation/DefaultNavigation.js +2 -6
- package/dist/modern/StepNavigation/DefaultNavigation/DefaultNavigation.js.map +1 -1
- package/dist/modern/StepNavigation/DefaultNavigation/Step/Step.d.ts +2 -2
- package/dist/modern/StepNavigation/DefaultNavigation/Step/Step.js +2 -2
- package/dist/modern/StepNavigation/DefaultNavigation/Step/Step.js.map +1 -1
- package/dist/modern/StepNavigation/DefaultNavigation/utils.js +3 -2
- package/dist/modern/StepNavigation/DefaultNavigation/utils.js.map +1 -1
- package/dist/modern/StepNavigation/SimpleNavigation/Dot/Dot.js +4 -5
- package/dist/modern/StepNavigation/SimpleNavigation/Dot/Dot.js.map +1 -1
- package/dist/modern/StepNavigation/SimpleNavigation/SimpleNavigation.d.ts +3 -1
- package/dist/modern/StepNavigation/SimpleNavigation/SimpleNavigation.js +2 -6
- package/dist/modern/StepNavigation/SimpleNavigation/SimpleNavigation.js.map +1 -1
- package/dist/modern/StepNavigation/SimpleNavigation/utils.js +7 -5
- package/dist/modern/StepNavigation/SimpleNavigation/utils.js.map +1 -1
- package/dist/modern/StepNavigation/StepNavigation.js +5 -5
- package/dist/modern/StepNavigation/StepNavigation.js.map +1 -1
- package/dist/modern/Wizard/Wizard.d.ts +63 -0
- package/dist/modern/Wizard/Wizard.js +209 -0
- package/dist/modern/Wizard/Wizard.js.map +1 -0
- package/dist/modern/Wizard/WizardActions/WizardActions.d.ts +61 -0
- package/dist/modern/Wizard/WizardActions/WizardActions.js +197 -0
- package/dist/modern/Wizard/WizardActions/WizardActions.js.map +1 -0
- package/dist/modern/Wizard/WizardActions/index.d.ts +2 -0
- package/dist/modern/Wizard/WizardActions/index.js +2 -0
- package/dist/modern/Wizard/WizardActions/index.js.map +1 -0
- package/dist/modern/Wizard/WizardActions/styles.js +20 -0
- package/dist/modern/Wizard/WizardActions/styles.js.map +1 -0
- package/dist/modern/Wizard/WizardContainer/WizardContainer.d.ts +28 -0
- package/dist/modern/Wizard/WizardContainer/WizardContainer.js +85 -0
- package/dist/modern/Wizard/WizardContainer/WizardContainer.js.map +1 -0
- package/dist/modern/Wizard/WizardContainer/index.d.ts +2 -0
- package/dist/modern/Wizard/WizardContainer/index.js +2 -0
- package/dist/modern/Wizard/WizardContainer/index.js.map +1 -0
- package/dist/modern/Wizard/WizardContainer/styles.js +13 -0
- package/dist/modern/Wizard/WizardContainer/styles.js.map +1 -0
- package/dist/modern/Wizard/WizardContent/LoadingContainer.js +71 -0
- package/dist/modern/Wizard/WizardContent/LoadingContainer.js.map +1 -0
- package/dist/modern/Wizard/WizardContent/WizardContent.d.ts +28 -0
- package/dist/modern/Wizard/WizardContent/WizardContent.js +122 -0
- package/dist/modern/Wizard/WizardContent/WizardContent.js.map +1 -0
- package/dist/modern/Wizard/WizardContent/index.d.ts +2 -0
- package/dist/modern/Wizard/WizardContent/index.js +2 -0
- package/dist/modern/Wizard/WizardContent/index.js.map +1 -0
- package/dist/modern/Wizard/WizardContent/styles.js +14 -0
- package/dist/modern/Wizard/WizardContent/styles.js.map +1 -0
- package/dist/modern/Wizard/WizardContext/WizardContext.js +12 -0
- package/dist/modern/Wizard/WizardContext/WizardContext.js.map +1 -0
- package/dist/modern/Wizard/WizardContext/index.js +2 -0
- package/dist/modern/Wizard/WizardContext/index.js.map +1 -0
- package/dist/modern/Wizard/WizardTitle/WizardTitle.d.ts +42 -0
- package/dist/modern/Wizard/WizardTitle/WizardTitle.js +188 -0
- package/dist/modern/Wizard/WizardTitle/WizardTitle.js.map +1 -0
- package/dist/modern/Wizard/WizardTitle/index.d.ts +2 -0
- package/dist/modern/Wizard/WizardTitle/index.js +2 -0
- package/dist/modern/Wizard/WizardTitle/index.js.map +1 -0
- package/dist/modern/Wizard/WizardTitle/styles.js +31 -0
- package/dist/modern/Wizard/WizardTitle/styles.js.map +1 -0
- package/dist/modern/Wizard/index.d.ts +2 -0
- package/dist/modern/Wizard/index.js +7 -0
- package/dist/modern/Wizard/index.js.map +1 -0
- package/dist/modern/Wizard/styles.js +6 -0
- package/dist/modern/Wizard/styles.js.map +1 -0
- package/dist/modern/index.d.ts +8 -5
- package/dist/modern/index.js +3 -2
- package/dist/modern/index.js.map +1 -1
- package/package.json +3 -3
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { ModalProps, StandardProps } from "@mui/material";
|
|
3
|
+
|
|
4
|
+
export type HvWizardActionsClassKey = "root";
|
|
5
|
+
|
|
6
|
+
export type HvWizardActionsProps = StandardProps<
|
|
7
|
+
React.HTMLAttributes<HTMLDivElement>,
|
|
8
|
+
HvWizardActionsClassKey
|
|
9
|
+
> & {
|
|
10
|
+
/**
|
|
11
|
+
* Current tab to check if it's last page or first to disable previous button and swap between next and submit button.
|
|
12
|
+
*/
|
|
13
|
+
tab: number;
|
|
14
|
+
/**
|
|
15
|
+
* Function to change the tab when pressing previous and next buttons.
|
|
16
|
+
*/
|
|
17
|
+
changeTab: any;
|
|
18
|
+
/**
|
|
19
|
+
* Function to handle the cancel button.
|
|
20
|
+
*/
|
|
21
|
+
handleClose: ModalProps["onClose"];
|
|
22
|
+
/**
|
|
23
|
+
* Function to handle the submit button. Also sends the current context state.
|
|
24
|
+
*/
|
|
25
|
+
onSubmit: any;
|
|
26
|
+
/**
|
|
27
|
+
* An object containing all the labels for the wizard actions component.
|
|
28
|
+
*/
|
|
29
|
+
labels: {
|
|
30
|
+
/**
|
|
31
|
+
* Cancel button label.
|
|
32
|
+
*/
|
|
33
|
+
cancel: string;
|
|
34
|
+
/**
|
|
35
|
+
* Skip button label.
|
|
36
|
+
*/
|
|
37
|
+
skip: string;
|
|
38
|
+
/**
|
|
39
|
+
* Previous button label.
|
|
40
|
+
*/
|
|
41
|
+
previous: string;
|
|
42
|
+
/**
|
|
43
|
+
* Next button label.
|
|
44
|
+
*/
|
|
45
|
+
next: string;
|
|
46
|
+
/**
|
|
47
|
+
* Submit button label.
|
|
48
|
+
*/
|
|
49
|
+
submit: string;
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* Whether the submit button is disabled.
|
|
53
|
+
*/
|
|
54
|
+
loading?: boolean;
|
|
55
|
+
/**
|
|
56
|
+
* Enables the skip button.
|
|
57
|
+
*/
|
|
58
|
+
skippable?: boolean;
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
export default function HvWizardActions(props: HvWizardActionsProps): JSX.Element | null;
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
+
|
|
3
|
+
var _Backwards, _Forwards;
|
|
4
|
+
|
|
5
|
+
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; }
|
|
6
|
+
|
|
7
|
+
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; }
|
|
8
|
+
|
|
9
|
+
import "core-js/modules/web.dom-collections.iterator.js";
|
|
10
|
+
import React from "react";
|
|
11
|
+
import PropTypes from "prop-types";
|
|
12
|
+
import { withStyles } from "@mui/styles";
|
|
13
|
+
import clsx from "clsx";
|
|
14
|
+
import { HvButton, HvDialogActions, HvGrid } from "@hitachivantara/uikit-react-core";
|
|
15
|
+
import { Backwards, Forwards } from "@hitachivantara/uikit-react-icons";
|
|
16
|
+
import WizardContext from "../WizardContext";
|
|
17
|
+
import styles from "./styles";
|
|
18
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
19
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
20
|
+
|
|
21
|
+
const HvWizardActions = ({
|
|
22
|
+
classes,
|
|
23
|
+
handleClose,
|
|
24
|
+
onSubmit,
|
|
25
|
+
changeTab,
|
|
26
|
+
tab,
|
|
27
|
+
loading = false,
|
|
28
|
+
skippable = false,
|
|
29
|
+
labels = {
|
|
30
|
+
cancel: "Cancel",
|
|
31
|
+
next: "Next",
|
|
32
|
+
previous: "Previous",
|
|
33
|
+
skip: "Skip",
|
|
34
|
+
submit: "Submit"
|
|
35
|
+
}
|
|
36
|
+
}) => {
|
|
37
|
+
var _labels$cancel, _labels$skip, _labels$previous, _labels$submit, _context$tab, _labels$next;
|
|
38
|
+
|
|
39
|
+
const {
|
|
40
|
+
context,
|
|
41
|
+
setContext
|
|
42
|
+
} = React.useContext(WizardContext);
|
|
43
|
+
const [pages, setPages] = React.useState(0);
|
|
44
|
+
const [canSubmit, setCanSubmit] = React.useState(false);
|
|
45
|
+
React.useEffect(() => {
|
|
46
|
+
const contextEntries = Object.entries(context);
|
|
47
|
+
|
|
48
|
+
if (contextEntries.length) {
|
|
49
|
+
setPages(contextEntries.length);
|
|
50
|
+
const validWizard = Object.entries(context).every(([, value]) => value.valid);
|
|
51
|
+
|
|
52
|
+
if (validWizard !== canSubmit) {
|
|
53
|
+
setCanSubmit(validWizard);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}, [context]); // eslint-disable-line react-hooks/exhaustive-deps
|
|
57
|
+
|
|
58
|
+
const lastPage = pages - 1;
|
|
59
|
+
const isLastPage = tab >= lastPage;
|
|
60
|
+
const handleSkip = React.useCallback(() => {
|
|
61
|
+
const skippedContext = Object.entries(context).map(([, child]) => _objectSpread(_objectSpread({}, child), {}, {
|
|
62
|
+
valid: child.valid !== false
|
|
63
|
+
}));
|
|
64
|
+
setContext(skippedContext);
|
|
65
|
+
changeTab(lastPage);
|
|
66
|
+
}, [changeTab, context, lastPage, setContext]);
|
|
67
|
+
const handleSubmit = React.useCallback(() => onSubmit(context), [onSubmit, context]);
|
|
68
|
+
return /*#__PURE__*/_jsxs(HvDialogActions, {
|
|
69
|
+
className: classes.actionsContainer,
|
|
70
|
+
children: [/*#__PURE__*/_jsxs(HvGrid, {
|
|
71
|
+
children: [/*#__PURE__*/_jsx(HvButton, {
|
|
72
|
+
category: "ghost",
|
|
73
|
+
onClick: handleClose,
|
|
74
|
+
className: classes.buttonWidth,
|
|
75
|
+
children: `${(_labels$cancel = labels.cancel) !== null && _labels$cancel !== void 0 ? _labels$cancel : "Cancel"}`
|
|
76
|
+
}), /*#__PURE__*/_jsx(HvButton, {
|
|
77
|
+
category: "ghost",
|
|
78
|
+
disabled: isLastPage || !skippable,
|
|
79
|
+
className: classes.buttonWidth,
|
|
80
|
+
onClick: handleSkip,
|
|
81
|
+
children: `${(_labels$skip = labels.skip) !== null && _labels$skip !== void 0 ? _labels$skip : "Skip"}`
|
|
82
|
+
})]
|
|
83
|
+
}), /*#__PURE__*/_jsxs(HvGrid, {
|
|
84
|
+
className: classes.buttonsContainer,
|
|
85
|
+
children: [/*#__PURE__*/_jsxs(HvButton, {
|
|
86
|
+
category: "ghost",
|
|
87
|
+
className: classes.buttonWidth,
|
|
88
|
+
disabled: tab <= 0,
|
|
89
|
+
onClick: () => changeTab(t => t - 1),
|
|
90
|
+
children: [_Backwards || (_Backwards = /*#__PURE__*/_jsx(Backwards, {})), `${(_labels$previous = labels.previous) !== null && _labels$previous !== void 0 ? _labels$previous : "Previous"}`]
|
|
91
|
+
}), isLastPage ? /*#__PURE__*/_jsx(HvButton, {
|
|
92
|
+
category: "primary",
|
|
93
|
+
className: classes.buttonWidth,
|
|
94
|
+
disabled: loading || !canSubmit,
|
|
95
|
+
onClick: handleSubmit,
|
|
96
|
+
children: `${(_labels$submit = labels.submit) !== null && _labels$submit !== void 0 ? _labels$submit : "Submit"}`
|
|
97
|
+
}) : /*#__PURE__*/_jsxs(HvButton, {
|
|
98
|
+
category: "ghost",
|
|
99
|
+
className: clsx(classes.buttonWidth, classes.buttonSpacing),
|
|
100
|
+
onClick: () => changeTab(t => t + 1),
|
|
101
|
+
disabled: !skippable && !(context !== null && context !== void 0 && (_context$tab = context[tab]) !== null && _context$tab !== void 0 && _context$tab.valid),
|
|
102
|
+
children: [`${(_labels$next = labels.next) !== null && _labels$next !== void 0 ? _labels$next : "Next"}`, _Forwards || (_Forwards = /*#__PURE__*/_jsx(Forwards, {}))]
|
|
103
|
+
})]
|
|
104
|
+
})]
|
|
105
|
+
});
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
process.env.NODE_ENV !== "production" ? HvWizardActions.propTypes = {
|
|
109
|
+
/**
|
|
110
|
+
* A Jss Object used to override or extend the styles applied.
|
|
111
|
+
*/
|
|
112
|
+
classes: PropTypes.shape({
|
|
113
|
+
/**
|
|
114
|
+
* Styles applied to the component which contains the groups of buttons.
|
|
115
|
+
*/
|
|
116
|
+
actionsContainer: PropTypes.string,
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Styles applied to the component which contains the buttons.
|
|
120
|
+
*/
|
|
121
|
+
buttonsContainer: PropTypes.string,
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Styles applied to the Button component to override its width.
|
|
125
|
+
*/
|
|
126
|
+
buttonWidth: PropTypes.string,
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Styles applied to some Button components to override its left padding.
|
|
130
|
+
*/
|
|
131
|
+
buttonSpacing: PropTypes.string
|
|
132
|
+
}).isRequired,
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* Current tab to check if it's last page or first to disable previous button and swap between next and submit button.
|
|
136
|
+
*/
|
|
137
|
+
tab: PropTypes.number.isRequired,
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Function to change the tab when pressing previous and next buttons.
|
|
141
|
+
*/
|
|
142
|
+
changeTab: PropTypes.func.isRequired,
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Function to handle the cancel button.
|
|
146
|
+
*/
|
|
147
|
+
handleClose: PropTypes.func.isRequired,
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* Function to handle the submit button. Also sends the current context state.
|
|
151
|
+
*/
|
|
152
|
+
onSubmit: PropTypes.func.isRequired,
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* An object containing all the labels for the wizard actions component.
|
|
156
|
+
*/
|
|
157
|
+
labels: PropTypes.shape({
|
|
158
|
+
/**
|
|
159
|
+
* Cancel button label.
|
|
160
|
+
*/
|
|
161
|
+
cancel: PropTypes.string,
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* Skip button label.
|
|
165
|
+
*/
|
|
166
|
+
skip: PropTypes.string,
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* Previous button label.
|
|
170
|
+
*/
|
|
171
|
+
previous: PropTypes.string,
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* Next button label.
|
|
175
|
+
*/
|
|
176
|
+
next: PropTypes.string,
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* Submit button label.
|
|
180
|
+
*/
|
|
181
|
+
submit: PropTypes.string
|
|
182
|
+
}),
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* Whether the submit button is disabled.
|
|
186
|
+
*/
|
|
187
|
+
loading: PropTypes.bool,
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* Enables the skip button.
|
|
191
|
+
*/
|
|
192
|
+
skippable: PropTypes.bool
|
|
193
|
+
} : void 0;
|
|
194
|
+
export default withStyles(styles, {
|
|
195
|
+
name: "HvWizardActions"
|
|
196
|
+
})(HvWizardActions);
|
|
197
|
+
//# sourceMappingURL=WizardActions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WizardActions.js","names":["React","PropTypes","withStyles","clsx","HvButton","HvDialogActions","HvGrid","Backwards","Forwards","WizardContext","styles","HvWizardActions","classes","handleClose","onSubmit","changeTab","tab","loading","skippable","labels","cancel","next","previous","skip","submit","context","setContext","useContext","pages","setPages","useState","canSubmit","setCanSubmit","useEffect","contextEntries","Object","entries","length","validWizard","every","value","valid","lastPage","isLastPage","handleSkip","useCallback","skippedContext","map","child","handleSubmit","actionsContainer","buttonWidth","buttonsContainer","t","buttonSpacing","propTypes","shape","string","isRequired","number","func","bool","name"],"sources":["../../../../src/Wizard/WizardActions/WizardActions.js"],"sourcesContent":["import React from \"react\";\nimport PropTypes from \"prop-types\";\nimport { withStyles } from \"@mui/styles\";\nimport clsx from \"clsx\";\nimport { HvButton, HvDialogActions, HvGrid } from \"@hitachivantara/uikit-react-core\";\nimport { Backwards, Forwards } from \"@hitachivantara/uikit-react-icons\";\nimport WizardContext from \"../WizardContext\";\n\nimport styles from \"./styles\";\n\nconst HvWizardActions = ({\n classes,\n handleClose,\n onSubmit,\n changeTab,\n tab,\n loading = false,\n skippable = false,\n labels = {\n cancel: \"Cancel\",\n next: \"Next\",\n previous: \"Previous\",\n skip: \"Skip\",\n submit: \"Submit\",\n },\n}) => {\n const { context, setContext } = React.useContext(WizardContext);\n const [pages, setPages] = React.useState(0);\n const [canSubmit, setCanSubmit] = React.useState(false);\n\n React.useEffect(() => {\n const contextEntries = Object.entries(context);\n if (contextEntries.length) {\n setPages(contextEntries.length);\n\n const validWizard = Object.entries(context).every(([, value]) => value.valid);\n if (validWizard !== canSubmit) {\n setCanSubmit(validWizard);\n }\n }\n }, [context]); // eslint-disable-line react-hooks/exhaustive-deps\n\n const lastPage = pages - 1;\n const isLastPage = tab >= lastPage;\n\n const handleSkip = React.useCallback(() => {\n const skippedContext = Object.entries(context).map(([, child]) => ({\n ...child,\n valid: child.valid !== false,\n }));\n setContext(skippedContext);\n changeTab(lastPage);\n }, [changeTab, context, lastPage, setContext]);\n const handleSubmit = React.useCallback(() => onSubmit(context), [onSubmit, context]);\n\n return (\n <HvDialogActions className={classes.actionsContainer}>\n <HvGrid>\n <HvButton category=\"ghost\" onClick={handleClose} className={classes.buttonWidth}>\n {`${labels.cancel ?? \"Cancel\"}`}\n </HvButton>\n <HvButton\n category=\"ghost\"\n disabled={isLastPage || !skippable}\n className={classes.buttonWidth}\n onClick={handleSkip}\n >\n {`${labels.skip ?? \"Skip\"}`}\n </HvButton>\n </HvGrid>\n <HvGrid className={classes.buttonsContainer}>\n <HvButton\n category=\"ghost\"\n className={classes.buttonWidth}\n disabled={tab <= 0}\n onClick={() => changeTab((t) => t - 1)}\n >\n <Backwards />\n {`${labels.previous ?? \"Previous\"}`}\n </HvButton>\n\n {isLastPage ? (\n <HvButton\n category=\"primary\"\n className={classes.buttonWidth}\n disabled={loading || !canSubmit}\n onClick={handleSubmit}\n >\n {`${labels.submit ?? \"Submit\"}`}\n </HvButton>\n ) : (\n <HvButton\n category=\"ghost\"\n className={clsx(classes.buttonWidth, classes.buttonSpacing)}\n onClick={() => changeTab((t) => t + 1)}\n disabled={!skippable && !context?.[tab]?.valid}\n >\n {`${labels.next ?? \"Next\"}`}\n <Forwards />\n </HvButton>\n )}\n </HvGrid>\n </HvDialogActions>\n );\n};\n\nHvWizardActions.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 component which contains the groups of buttons.\n */\n actionsContainer: PropTypes.string,\n /**\n * Styles applied to the component which contains the buttons.\n */\n buttonsContainer: PropTypes.string,\n /**\n * Styles applied to the Button component to override its width.\n */\n buttonWidth: PropTypes.string,\n /**\n * Styles applied to some Button components to override its left padding.\n */\n buttonSpacing: PropTypes.string,\n }).isRequired,\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 * Function to handle the cancel button.\n */\n handleClose: PropTypes.func.isRequired,\n /**\n * Function to handle the submit button. Also sends the current context state.\n */\n onSubmit: PropTypes.func.isRequired,\n /**\n * An object containing all the labels for the wizard actions component.\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 /**\n * Whether the submit button is disabled.\n */\n loading: PropTypes.bool,\n /**\n * Enables the skip button.\n */\n skippable: PropTypes.bool,\n};\n\nexport default withStyles(styles, { name: \"HvWizardActions\" })(HvWizardActions);\n"],"mappings":";;;;;;;;;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,SAASC,UAAT,QAA2B,aAA3B;AACA,OAAOC,IAAP,MAAiB,MAAjB;AACA,SAASC,QAAT,EAAmBC,eAAnB,EAAoCC,MAApC,QAAkD,kCAAlD;AACA,SAASC,SAAT,EAAoBC,QAApB,QAAoC,mCAApC;AACA,OAAOC,aAAP,MAA0B,kBAA1B;AAEA,OAAOC,MAAP,MAAmB,UAAnB;;;;AAEA,MAAMC,eAAe,GAAG,CAAC;EACvBC,OADuB;EAEvBC,WAFuB;EAGvBC,QAHuB;EAIvBC,SAJuB;EAKvBC,GALuB;EAMvBC,OAAO,GAAG,KANa;EAOvBC,SAAS,GAAG,KAPW;EAQvBC,MAAM,GAAG;IACPC,MAAM,EAAE,QADD;IAEPC,IAAI,EAAE,MAFC;IAGPC,QAAQ,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AS,CAAC2D,IAAV,CAAeF,UArCC;;EAsC1B;AACF;AACA;EACEvC,MAAM,EAAElB,SAAS,CAACuD,KAAV,CAAgB;IACtB;AACJ;AACA;IACIpC,MAAM,EAAEnB,SAAS,CAACwD,MAJI;;IAKtB;AACJ;AACA;IACIlC,IAAI,EAAEtB,SAAS,CAACwD,MARM;;IAStB;AACJ;AACA;IACInC,QAAQ,EAAErB,SAAS,CAACwD,MAZE;;IAatB;AACJ;AACA;IACIpC,IAAI,EAAEpB,SAAS,CAACwD,MAhBM;;IAiBtB;AACJ;AACA;IACIjC,MAAM,EAAEvB,SAAS,CAACwD;EApBI,CAAhB,CAzCkB;;EA+D1B;AACF;AACA;EACExC,OAAO,EAAEhB,SAAS,CAAC4D,IAlEO;;EAmE1B;AACF;AACA;EACE3C,SAAS,EAAEjB,SAAS,CAAC4D;AAtEK,CAA5B;AAyEA,eAAe3D,UAAU,CAACQ,MAAD,EAAS;EAAEoD,IAAI,EAAE;AAAR,CAAT,CAAV,CAAgDnD,eAAhD,CAAf"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["default"],"sources":["../../../../src/Wizard/WizardActions/index.js"],"sourcesContent":["export { default } from \"./WizardActions\";\n"],"mappings":"AAAA,SAASA,OAAT,QAAwB,iBAAxB"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
const styles = () => ({
|
|
2
|
+
buttonWidth: {
|
|
3
|
+
width: 120
|
|
4
|
+
},
|
|
5
|
+
actionsContainer: {
|
|
6
|
+
display: "flex",
|
|
7
|
+
justifyContent: "space-between"
|
|
8
|
+
},
|
|
9
|
+
buttonsContainer: {
|
|
10
|
+
"& > button:last-child": {
|
|
11
|
+
marginLeft: 20
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
buttonSpacing: {
|
|
15
|
+
paddingLeft: 28
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
export default styles;
|
|
20
|
+
//# sourceMappingURL=styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styles.js","names":["styles","buttonWidth","width","actionsContainer","display","justifyContent","buttonsContainer","marginLeft","buttonSpacing","paddingLeft"],"sources":["../../../../src/Wizard/WizardActions/styles.js"],"sourcesContent":["const styles = () => ({\n buttonWidth: {\n width: 120,\n },\n actionsContainer: {\n display: \"flex\",\n justifyContent: \"space-between\",\n },\n buttonsContainer: {\n \"& > button:last-child\": {\n marginLeft: 20,\n },\n },\n buttonSpacing: {\n paddingLeft: 28,\n },\n});\n\nexport default styles;\n"],"mappings":"AAAA,MAAMA,MAAM,GAAG,OAAO;EACpBC,WAAW,EAAE;IACXC,KAAK,EAAE;EADI,CADO;EAIpBC,gBAAgB,EAAE;IAChBC,OAAO,EAAE,MADO;IAEhBC,cAAc,EAAE;EAFA,CAJE;EAQpBC,gBAAgB,EAAE;IAChB,yBAAyB;MACvBC,UAAU,EAAE;IADW;EADT,CARE;EAapBC,aAAa,EAAE;IACbC,WAAW,EAAE;EADA;AAbK,CAAP,CAAf;;AAkBA,eAAeT,MAAf"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { StandardProps, ModalProps } from "@mui/material";
|
|
3
|
+
|
|
4
|
+
export type HvWizardContainerClassKey = "root";
|
|
5
|
+
|
|
6
|
+
export type HvWizardContainerProps = StandardProps<
|
|
7
|
+
React.HTMLAttributes<HTMLDivElement>,
|
|
8
|
+
HvWizardContainerClassKey
|
|
9
|
+
> & {
|
|
10
|
+
/**
|
|
11
|
+
* Class names to be applied.
|
|
12
|
+
*/
|
|
13
|
+
className?: string;
|
|
14
|
+
/**
|
|
15
|
+
* Components of the Wizard.
|
|
16
|
+
*/
|
|
17
|
+
children?: React.ReactNode;
|
|
18
|
+
/**
|
|
19
|
+
* Current state of the Wizard.
|
|
20
|
+
*/
|
|
21
|
+
open: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Function executed on close.
|
|
24
|
+
*/
|
|
25
|
+
handleClose: ModalProps["onClose"];
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export default function HvWizardContainer(props: HvWizardContainerProps): JSX.Element | null;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
|
+
const _excluded = ["classes", "className", "children", "handleClose", "open"];
|
|
4
|
+
|
|
5
|
+
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; }
|
|
6
|
+
|
|
7
|
+
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; }
|
|
8
|
+
|
|
9
|
+
import React from "react";
|
|
10
|
+
import PropTypes from "prop-types";
|
|
11
|
+
import clsx from "clsx";
|
|
12
|
+
import { withStyles } from "@mui/styles";
|
|
13
|
+
import { HvDialog } from "@hitachivantara/uikit-react-core";
|
|
14
|
+
import styles from "./styles";
|
|
15
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
16
|
+
|
|
17
|
+
const HvWizardContainer = _ref => {
|
|
18
|
+
let {
|
|
19
|
+
classes,
|
|
20
|
+
className,
|
|
21
|
+
children,
|
|
22
|
+
handleClose,
|
|
23
|
+
open
|
|
24
|
+
} = _ref,
|
|
25
|
+
others = _objectWithoutProperties(_ref, _excluded);
|
|
26
|
+
|
|
27
|
+
return /*#__PURE__*/_jsx(HvDialog, _objectSpread(_objectSpread({
|
|
28
|
+
classes: {
|
|
29
|
+
closeButton: classes.closeButton,
|
|
30
|
+
paper: classes.paper
|
|
31
|
+
} // overrides css
|
|
32
|
+
,
|
|
33
|
+
className: clsx(className, classes.root),
|
|
34
|
+
open: open,
|
|
35
|
+
onClose: handleClose
|
|
36
|
+
}, others), {}, {
|
|
37
|
+
children: children
|
|
38
|
+
}));
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
process.env.NODE_ENV !== "production" ? HvWizardContainer.propTypes = {
|
|
42
|
+
/**
|
|
43
|
+
* Class names to be applied.
|
|
44
|
+
*/
|
|
45
|
+
className: PropTypes.string,
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* A Jss Object used to override or extend the styles applied.
|
|
49
|
+
*/
|
|
50
|
+
classes: PropTypes.shape({
|
|
51
|
+
/**
|
|
52
|
+
* Styles applied to the component root class.
|
|
53
|
+
*/
|
|
54
|
+
root: PropTypes.string,
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Style applied to the component (root).
|
|
58
|
+
*/
|
|
59
|
+
paper: PropTypes.string,
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Style applied to the close button.
|
|
63
|
+
*/
|
|
64
|
+
closeButton: PropTypes.string
|
|
65
|
+
}).isRequired,
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Components of the Wizard.
|
|
69
|
+
*/
|
|
70
|
+
children: PropTypes.node.isRequired,
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Current state of the Wizard.
|
|
74
|
+
*/
|
|
75
|
+
open: PropTypes.bool.isRequired,
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Function executed on close.
|
|
79
|
+
*/
|
|
80
|
+
handleClose: PropTypes.func.isRequired
|
|
81
|
+
} : void 0;
|
|
82
|
+
export default withStyles(styles, {
|
|
83
|
+
name: "HvWizardContainer"
|
|
84
|
+
})(HvWizardContainer);
|
|
85
|
+
//# sourceMappingURL=WizardContainer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WizardContainer.js","names":["React","PropTypes","clsx","withStyles","HvDialog","styles","HvWizardContainer","classes","className","children","handleClose","open","others","closeButton","paper","root","propTypes","string","shape","isRequired","node","bool","func","name"],"sources":["../../../../src/Wizard/WizardContainer/WizardContainer.js"],"sourcesContent":["import React from \"react\";\nimport PropTypes from \"prop-types\";\nimport clsx from \"clsx\";\nimport { withStyles } from \"@mui/styles\";\nimport { HvDialog } from \"@hitachivantara/uikit-react-core\";\n\nimport styles from \"./styles\";\n\nconst HvWizardContainer = ({ classes, className, children, handleClose, open, ...others }) => {\n return (\n <HvDialog\n classes={{ closeButton: classes.closeButton, paper: classes.paper }} // overrides css\n className={clsx(className, classes.root)}\n open={open}\n onClose={handleClose}\n {...others}\n >\n {children}\n </HvDialog>\n );\n};\n\nHvWizardContainer.propTypes = {\n /**\n * Class names to be applied.\n */\n className: PropTypes.string,\n /**\n * A Jss Object used to override or extend the styles applied.\n */\n classes: PropTypes.shape({\n /**\n * Styles applied to the component root class.\n */\n root: PropTypes.string,\n /**\n * Style applied to the component (root).\n */\n paper: PropTypes.string,\n /**\n * Style applied to the close button.\n */\n closeButton: PropTypes.string,\n }).isRequired,\n /**\n * Components of the Wizard.\n */\n children: PropTypes.node.isRequired,\n /**\n * Current state of the Wizard.\n */\n open: PropTypes.bool.isRequired,\n /**\n * Function executed on close.\n */\n handleClose: PropTypes.func.isRequired,\n};\n\nexport default withStyles(styles, { name: \"HvWizardContainer\" })(HvWizardContainer);\n"],"mappings":";;;;;;;;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,OAAOC,IAAP,MAAiB,MAAjB;AACA,SAASC,UAAT,QAA2B,aAA3B;AACA,SAASC,QAAT,QAAyB,kCAAzB;AAEA,OAAOC,MAAP,MAAmB,UAAnB;;;AAEA,MAAMC,iBAAiB,GAAG,QAAoE;EAAA,IAAnE;IAAEC,OAAF;IAAWC,SAAX;IAAsBC,QAAtB;IAAgCC,WAAhC;IAA6CC;EAA7C,CAAmE;EAAA,IAAbC,MAAa;;EAC5F,oBACE,KAAC,QAAD;IACE,OAAO,EAAE;MAAEC,WAAW,EAAEN,OAAO,CAACM,WAAvB;MAAoCC,KAAK,EAAEP,OAAO,CAACO;IAAnD,CADX,CACuE;IADvE;IAEE,SAAS,EAAEZ,IAAI,CAACM,SAAD,EAAYD,OAAO,CAACQ,IAApB,CAFjB;IAGE,IAAI,EAAEJ,IAHR;IAIE,OAAO,EAAED;EAJX,GAKME,MALN;IAAA,UAOGH;EAPH,GADF;AAWD,CAZD;;AAcA,wCAAAH,iBAAiB,CAACU,SAAlB,GAA8B;EAC5B;AACF;AACA;EACER,SAAS,EAAEP,SAAS,CAACgB,MAJO;;EAK5B;AACF;AACA;EACEV,OAAO,EAAEN,SAAS,CAACiB,KAAV,CAAgB;IACvB;AACJ;AACA;IACIH,IAAI,EAAEd,SAAS,CAACgB,MAJO;;IAKvB;AACJ;AACA;IACIH,KAAK,EAAEb,SAAS,CAACgB,MARM;;IASvB;AACJ;AACA;IACIJ,WAAW,EAAEZ,SAAS,CAACgB;EAZA,CAAhB,EAaNE,UArByB;;EAsB5B;AACF;AACA;EACEV,QAAQ,EAAER,SAAS,CAACmB,IAAV,CAAeD,UAzBG;;EA0B5B;AACF;AACA;EACER,IAAI,EAAEV,SAAS,CAACoB,IAAV,CAAeF,UA7BO;;EA8B5B;AACF;AACA;EACET,WAAW,EAAET,SAAS,CAACqB,IAAV,CAAeH;AAjCA,CAA9B;AAoCA,eAAehB,UAAU,CAACE,MAAD,EAAS;EAAEkB,IAAI,EAAE;AAAR,CAAT,CAAV,CAAkDjB,iBAAlD,CAAf"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["default"],"sources":["../../../../src/Wizard/WizardContainer/index.js"],"sourcesContent":["export { default } from \"./WizardContainer\";\n"],"mappings":"AAAA,SAASA,OAAT,QAAwB,mBAAxB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styles.js","names":["styles","root","paper","width","maxWidth","closeButton","display"],"sources":["../../../../src/Wizard/WizardContainer/styles.js"],"sourcesContent":["const styles = () => ({\n root: {},\n paper: {\n width: \"80%\",\n maxWidth: \"80%\",\n },\n closeButton: {\n display: \"none\",\n },\n});\n\nexport default styles;\n"],"mappings":"AAAA,MAAMA,MAAM,GAAG,OAAO;EACpBC,IAAI,EAAE,EADc;EAEpBC,KAAK,EAAE;IACLC,KAAK,EAAE,KADF;IAELC,QAAQ,EAAE;EAFL,CAFa;EAMpBC,WAAW,EAAE;IACXC,OAAO,EAAE;EADE;AANO,CAAP,CAAf;;AAWA,eAAeN,MAAf"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
|
+
const _excluded = ["children", "hidden"];
|
|
4
|
+
|
|
5
|
+
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; }
|
|
6
|
+
|
|
7
|
+
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; }
|
|
8
|
+
|
|
9
|
+
import React from "react";
|
|
10
|
+
import PropTypes from "prop-types";
|
|
11
|
+
import clsx from "clsx";
|
|
12
|
+
import { HvLoading } from "@hitachivantara/uikit-react-core";
|
|
13
|
+
import { alpha, hexToRgb } from "@mui/material";
|
|
14
|
+
import { makeStyles } from "@mui/styles";
|
|
15
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
16
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
17
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
18
|
+
const useStyles = makeStyles(theme => ({
|
|
19
|
+
loading: {
|
|
20
|
+
width: "100%",
|
|
21
|
+
height: "100%"
|
|
22
|
+
},
|
|
23
|
+
overlay: {
|
|
24
|
+
position: "absolute",
|
|
25
|
+
transition: "background-Color .2s ease",
|
|
26
|
+
zIndex: -1
|
|
27
|
+
},
|
|
28
|
+
blur: {
|
|
29
|
+
backgroundColor: alpha(hexToRgb(theme.hv.palette.atmosphere.atmo2), 0.8),
|
|
30
|
+
zIndex: theme.zIndex.drawer
|
|
31
|
+
}
|
|
32
|
+
}));
|
|
33
|
+
|
|
34
|
+
const LoadingContainer = _ref => {
|
|
35
|
+
let {
|
|
36
|
+
children,
|
|
37
|
+
hidden
|
|
38
|
+
} = _ref,
|
|
39
|
+
others = _objectWithoutProperties(_ref, _excluded);
|
|
40
|
+
|
|
41
|
+
const classes = useStyles();
|
|
42
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
43
|
+
children: [/*#__PURE__*/_jsx("div", {
|
|
44
|
+
style: {
|
|
45
|
+
top: 0,
|
|
46
|
+
left: 0,
|
|
47
|
+
height: "100%",
|
|
48
|
+
width: "100%"
|
|
49
|
+
},
|
|
50
|
+
className: clsx(classes.overlay, !hidden && classes.blur),
|
|
51
|
+
children: /*#__PURE__*/_jsx(HvLoading, _objectSpread({
|
|
52
|
+
classes: {
|
|
53
|
+
root: classes.loading
|
|
54
|
+
},
|
|
55
|
+
hidden: hidden
|
|
56
|
+
}, others))
|
|
57
|
+
}), /*#__PURE__*/_jsx("div", {
|
|
58
|
+
style: {
|
|
59
|
+
display: "flow-root"
|
|
60
|
+
},
|
|
61
|
+
children: children
|
|
62
|
+
})]
|
|
63
|
+
});
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
process.env.NODE_ENV !== "production" ? LoadingContainer.propTypes = {
|
|
67
|
+
children: PropTypes.node,
|
|
68
|
+
hidden: PropTypes.bool
|
|
69
|
+
} : void 0;
|
|
70
|
+
export default LoadingContainer;
|
|
71
|
+
//# sourceMappingURL=LoadingContainer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LoadingContainer.js","names":["React","PropTypes","clsx","HvLoading","alpha","hexToRgb","makeStyles","useStyles","theme","loading","width","height","overlay","position","transition","zIndex","blur","backgroundColor","hv","palette","atmosphere","atmo2","drawer","LoadingContainer","children","hidden","others","classes","top","left","root","display","propTypes","node","bool"],"sources":["../../../../src/Wizard/WizardContent/LoadingContainer.js"],"sourcesContent":["import React from \"react\";\nimport PropTypes from \"prop-types\";\nimport clsx from \"clsx\";\nimport { HvLoading } from \"@hitachivantara/uikit-react-core\";\nimport { alpha, hexToRgb } from \"@mui/material\";\nimport { makeStyles } from \"@mui/styles\";\n\nconst useStyles = makeStyles((theme) => ({\n loading: {\n width: \"100%\",\n height: \"100%\",\n },\n overlay: {\n position: \"absolute\",\n transition: \"background-Color .2s ease\",\n zIndex: -1,\n },\n blur: {\n backgroundColor: alpha(hexToRgb(theme.hv.palette.atmosphere.atmo2), 0.8),\n zIndex: theme.zIndex.drawer,\n },\n}));\n\nconst LoadingContainer = ({ children, hidden, ...others }) => {\n const classes = useStyles();\n\n return (\n <>\n <div\n style={{\n top: 0,\n left: 0,\n height: \"100%\",\n width: \"100%\",\n }}\n className={clsx(classes.overlay, { [classes.blur]: !hidden })}\n >\n <HvLoading classes={{ root: classes.loading }} hidden={hidden} {...others} />\n </div>\n <div style={{ display: \"flow-root\" }}>{children}</div>\n </>\n );\n};\n\nLoadingContainer.propT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AAhB,CAApB;QAA+C,MAAM,EAAEgB;MAAvD,GAAmEC,MAAnE;IATF,EADF,eAYE;MAAK,KAAK,EAAE;QAAEK,OAAO,EAAE;MAAX,CAAZ;MAAA,UAAuCP;IAAvC,EAZF;EAAA,EADF;AAgBD,CAnBD;;AAqBA,wCAAAD,gBAAgB,CAACS,SAAjB,GAA6B;EAC3BR,QAAQ,EAAEvB,SAAS,CAACgC,IADO;EAE3BR,MAAM,EAAExB,SAAS,CAACiC;AAFS,CAA7B;AAKA,eAAeX,gBAAf"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { StandardProps } from "@mui/material";
|
|
3
|
+
|
|
4
|
+
export type HvWizardContentClassKey = "root";
|
|
5
|
+
|
|
6
|
+
export type HvWizardContentProps = StandardProps<
|
|
7
|
+
React.HTMLAttributes<HTMLDivElement>,
|
|
8
|
+
HvWizardContentClassKey
|
|
9
|
+
> & {
|
|
10
|
+
/**
|
|
11
|
+
* Tabs to show on the Wizard.
|
|
12
|
+
*/
|
|
13
|
+
children: React.ReactNode;
|
|
14
|
+
/**
|
|
15
|
+
* Current tab to show.
|
|
16
|
+
*/
|
|
17
|
+
tab: number;
|
|
18
|
+
/**
|
|
19
|
+
* Forces minimum height to the component.
|
|
20
|
+
*/
|
|
21
|
+
fixedHeight?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Whether the loading animation is shown.
|
|
24
|
+
*/
|
|
25
|
+
loading?: boolean;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export default function HvWizardContent(props: HvWizardContentProps): JSX.Element | null;
|