@hitachivantara/uikit-react-lab 4.0.1-next.3 → 4.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (199) hide show
  1. package/dist/StepNavigation/DefaultNavigation/DefaultNavigation.d.ts +3 -1
  2. package/dist/StepNavigation/DefaultNavigation/DefaultNavigation.js +2 -9
  3. package/dist/StepNavigation/DefaultNavigation/DefaultNavigation.js.map +1 -1
  4. package/dist/StepNavigation/DefaultNavigation/Step/Step.d.ts +2 -2
  5. package/dist/StepNavigation/DefaultNavigation/Step/Step.js +2 -2
  6. package/dist/StepNavigation/DefaultNavigation/Step/Step.js.map +1 -1
  7. package/dist/StepNavigation/DefaultNavigation/utils.js +3 -2
  8. package/dist/StepNavigation/DefaultNavigation/utils.js.map +1 -1
  9. package/dist/StepNavigation/SimpleNavigation/Dot/Dot.js +2 -5
  10. package/dist/StepNavigation/SimpleNavigation/Dot/Dot.js.map +1 -1
  11. package/dist/StepNavigation/SimpleNavigation/SimpleNavigation.d.ts +3 -1
  12. package/dist/StepNavigation/SimpleNavigation/SimpleNavigation.js +2 -11
  13. package/dist/StepNavigation/SimpleNavigation/SimpleNavigation.js.map +1 -1
  14. package/dist/StepNavigation/SimpleNavigation/utils.js +10 -8
  15. package/dist/StepNavigation/SimpleNavigation/utils.js.map +1 -1
  16. package/dist/StepNavigation/StepNavigation.js +5 -5
  17. package/dist/StepNavigation/StepNavigation.js.map +1 -1
  18. package/dist/Wizard/Wizard.d.ts +63 -0
  19. package/dist/Wizard/Wizard.js +262 -0
  20. package/dist/Wizard/Wizard.js.map +1 -0
  21. package/dist/Wizard/WizardActions/WizardActions.d.ts +61 -0
  22. package/dist/Wizard/WizardActions/WizardActions.js +270 -0
  23. package/dist/Wizard/WizardActions/WizardActions.js.map +1 -0
  24. package/dist/Wizard/WizardActions/index.d.ts +2 -0
  25. package/dist/Wizard/WizardActions/index.js +16 -0
  26. package/dist/Wizard/WizardActions/index.js.map +1 -0
  27. package/dist/Wizard/WizardActions/styles.js +30 -0
  28. package/dist/Wizard/WizardActions/styles.js.map +1 -0
  29. package/dist/Wizard/WizardContainer/WizardContainer.d.ts +28 -0
  30. package/dist/Wizard/WizardContainer/WizardContainer.js +116 -0
  31. package/dist/Wizard/WizardContainer/WizardContainer.js.map +1 -0
  32. package/dist/Wizard/WizardContainer/index.d.ts +2 -0
  33. package/dist/Wizard/WizardContainer/index.js +16 -0
  34. package/dist/Wizard/WizardContainer/index.js.map +1 -0
  35. package/dist/Wizard/WizardContainer/styles.js +23 -0
  36. package/dist/Wizard/WizardContainer/styles.js.map +1 -0
  37. package/dist/Wizard/WizardContent/LoadingContainer.js +101 -0
  38. package/dist/Wizard/WizardContent/LoadingContainer.js.map +1 -0
  39. package/dist/Wizard/WizardContent/WizardContent.d.ts +28 -0
  40. package/dist/Wizard/WizardContent/WizardContent.js +167 -0
  41. package/dist/Wizard/WizardContent/WizardContent.js.map +1 -0
  42. package/dist/Wizard/WizardContent/index.d.ts +2 -0
  43. package/dist/Wizard/WizardContent/index.js +16 -0
  44. package/dist/Wizard/WizardContent/index.js.map +1 -0
  45. package/dist/Wizard/WizardContent/styles.js +24 -0
  46. package/dist/Wizard/WizardContent/styles.js.map +1 -0
  47. package/dist/Wizard/WizardContext/WizardContext.js +21 -0
  48. package/dist/Wizard/WizardContext/WizardContext.js.map +1 -0
  49. package/dist/Wizard/WizardContext/index.js +16 -0
  50. package/dist/Wizard/WizardContext/index.js.map +1 -0
  51. package/dist/Wizard/WizardTitle/WizardTitle.d.ts +42 -0
  52. package/dist/Wizard/WizardTitle/WizardTitle.js +227 -0
  53. package/dist/Wizard/WizardTitle/WizardTitle.js.map +1 -0
  54. package/dist/Wizard/WizardTitle/index.d.ts +2 -0
  55. package/dist/Wizard/WizardTitle/index.js +16 -0
  56. package/dist/Wizard/WizardTitle/index.js.map +1 -0
  57. package/dist/Wizard/WizardTitle/styles.js +41 -0
  58. package/dist/Wizard/WizardTitle/styles.js.map +1 -0
  59. package/dist/Wizard/index.d.ts +2 -0
  60. package/dist/Wizard/index.js +56 -0
  61. package/dist/Wizard/index.js.map +1 -0
  62. package/dist/Wizard/styles.js +16 -0
  63. package/dist/Wizard/styles.js.map +1 -0
  64. package/dist/index.d.ts +8 -5
  65. package/dist/index.js +14 -5
  66. package/dist/index.js.map +1 -1
  67. package/dist/legacy/StepNavigation/DefaultNavigation/DefaultNavigation.d.ts +3 -1
  68. package/dist/legacy/StepNavigation/DefaultNavigation/DefaultNavigation.js +2 -8
  69. package/dist/legacy/StepNavigation/DefaultNavigation/DefaultNavigation.js.map +1 -1
  70. package/dist/legacy/StepNavigation/DefaultNavigation/Step/Step.d.ts +2 -2
  71. package/dist/legacy/StepNavigation/DefaultNavigation/Step/Step.js +2 -2
  72. package/dist/legacy/StepNavigation/DefaultNavigation/Step/Step.js.map +1 -1
  73. package/dist/legacy/StepNavigation/DefaultNavigation/utils.js +3 -2
  74. package/dist/legacy/StepNavigation/DefaultNavigation/utils.js.map +1 -1
  75. package/dist/legacy/StepNavigation/SimpleNavigation/Dot/Dot.js +4 -7
  76. package/dist/legacy/StepNavigation/SimpleNavigation/Dot/Dot.js.map +1 -1
  77. package/dist/legacy/StepNavigation/SimpleNavigation/SimpleNavigation.d.ts +3 -1
  78. package/dist/legacy/StepNavigation/SimpleNavigation/SimpleNavigation.js +2 -9
  79. package/dist/legacy/StepNavigation/SimpleNavigation/SimpleNavigation.js.map +1 -1
  80. package/dist/legacy/StepNavigation/SimpleNavigation/utils.js +9 -5
  81. package/dist/legacy/StepNavigation/SimpleNavigation/utils.js.map +1 -1
  82. package/dist/legacy/StepNavigation/StepNavigation.js +5 -5
  83. package/dist/legacy/StepNavigation/StepNavigation.js.map +1 -1
  84. package/dist/legacy/Wizard/Wizard.d.ts +63 -0
  85. package/dist/legacy/Wizard/Wizard.js +229 -0
  86. package/dist/legacy/Wizard/Wizard.js.map +1 -0
  87. package/dist/legacy/Wizard/WizardActions/WizardActions.d.ts +61 -0
  88. package/dist/legacy/Wizard/WizardActions/WizardActions.js +237 -0
  89. package/dist/legacy/Wizard/WizardActions/WizardActions.js.map +1 -0
  90. package/dist/legacy/Wizard/WizardActions/index.d.ts +2 -0
  91. package/dist/legacy/Wizard/WizardActions/index.js +2 -0
  92. package/dist/legacy/Wizard/WizardActions/index.js.map +1 -0
  93. package/dist/legacy/Wizard/WizardActions/styles.js +22 -0
  94. package/dist/legacy/Wizard/WizardActions/styles.js.map +1 -0
  95. package/dist/legacy/Wizard/WizardContainer/WizardContainer.d.ts +28 -0
  96. package/dist/legacy/Wizard/WizardContainer/WizardContainer.js +90 -0
  97. package/dist/legacy/Wizard/WizardContainer/WizardContainer.js.map +1 -0
  98. package/dist/legacy/Wizard/WizardContainer/index.d.ts +2 -0
  99. package/dist/legacy/Wizard/WizardContainer/index.js +2 -0
  100. package/dist/legacy/Wizard/WizardContainer/index.js.map +1 -0
  101. package/dist/legacy/Wizard/WizardContainer/styles.js +15 -0
  102. package/dist/legacy/Wizard/WizardContainer/styles.js.map +1 -0
  103. package/dist/legacy/Wizard/WizardContent/LoadingContainer.js +78 -0
  104. package/dist/legacy/Wizard/WizardContent/LoadingContainer.js.map +1 -0
  105. package/dist/legacy/Wizard/WizardContent/WizardContent.d.ts +28 -0
  106. package/dist/legacy/Wizard/WizardContent/WizardContent.js +132 -0
  107. package/dist/legacy/Wizard/WizardContent/WizardContent.js.map +1 -0
  108. package/dist/legacy/Wizard/WizardContent/index.d.ts +2 -0
  109. package/dist/legacy/Wizard/WizardContent/index.js +2 -0
  110. package/dist/legacy/Wizard/WizardContent/index.js.map +1 -0
  111. package/dist/legacy/Wizard/WizardContent/styles.js +16 -0
  112. package/dist/legacy/Wizard/WizardContent/styles.js.map +1 -0
  113. package/dist/legacy/Wizard/WizardContext/WizardContext.js +12 -0
  114. package/dist/legacy/Wizard/WizardContext/WizardContext.js.map +1 -0
  115. package/dist/legacy/Wizard/WizardContext/index.js +2 -0
  116. package/dist/legacy/Wizard/WizardContext/index.js.map +1 -0
  117. package/dist/legacy/Wizard/WizardTitle/WizardTitle.d.ts +42 -0
  118. package/dist/legacy/Wizard/WizardTitle/WizardTitle.js +204 -0
  119. package/dist/legacy/Wizard/WizardTitle/WizardTitle.js.map +1 -0
  120. package/dist/legacy/Wizard/WizardTitle/index.d.ts +2 -0
  121. package/dist/legacy/Wizard/WizardTitle/index.js +2 -0
  122. package/dist/legacy/Wizard/WizardTitle/index.js.map +1 -0
  123. package/dist/legacy/Wizard/WizardTitle/styles.js +33 -0
  124. package/dist/legacy/Wizard/WizardTitle/styles.js.map +1 -0
  125. package/dist/legacy/Wizard/index.d.ts +2 -0
  126. package/dist/legacy/Wizard/index.js +7 -0
  127. package/dist/legacy/Wizard/index.js.map +1 -0
  128. package/dist/legacy/Wizard/styles.js +8 -0
  129. package/dist/legacy/Wizard/styles.js.map +1 -0
  130. package/dist/legacy/index.d.ts +8 -5
  131. package/dist/legacy/index.js +3 -2
  132. package/dist/legacy/index.js.map +1 -1
  133. package/dist/modern/StepNavigation/DefaultNavigation/DefaultNavigation.d.ts +3 -1
  134. package/dist/modern/StepNavigation/DefaultNavigation/DefaultNavigation.js +2 -6
  135. package/dist/modern/StepNavigation/DefaultNavigation/DefaultNavigation.js.map +1 -1
  136. package/dist/modern/StepNavigation/DefaultNavigation/Step/Step.d.ts +2 -2
  137. package/dist/modern/StepNavigation/DefaultNavigation/Step/Step.js +2 -2
  138. package/dist/modern/StepNavigation/DefaultNavigation/Step/Step.js.map +1 -1
  139. package/dist/modern/StepNavigation/DefaultNavigation/utils.js +3 -2
  140. package/dist/modern/StepNavigation/DefaultNavigation/utils.js.map +1 -1
  141. package/dist/modern/StepNavigation/SimpleNavigation/Dot/Dot.js +4 -5
  142. package/dist/modern/StepNavigation/SimpleNavigation/Dot/Dot.js.map +1 -1
  143. package/dist/modern/StepNavigation/SimpleNavigation/SimpleNavigation.d.ts +3 -1
  144. package/dist/modern/StepNavigation/SimpleNavigation/SimpleNavigation.js +2 -6
  145. package/dist/modern/StepNavigation/SimpleNavigation/SimpleNavigation.js.map +1 -1
  146. package/dist/modern/StepNavigation/SimpleNavigation/utils.js +7 -5
  147. package/dist/modern/StepNavigation/SimpleNavigation/utils.js.map +1 -1
  148. package/dist/modern/StepNavigation/StepNavigation.js +5 -5
  149. package/dist/modern/StepNavigation/StepNavigation.js.map +1 -1
  150. package/dist/modern/Wizard/Wizard.d.ts +63 -0
  151. package/dist/modern/Wizard/Wizard.js +209 -0
  152. package/dist/modern/Wizard/Wizard.js.map +1 -0
  153. package/dist/modern/Wizard/WizardActions/WizardActions.d.ts +61 -0
  154. package/dist/modern/Wizard/WizardActions/WizardActions.js +197 -0
  155. package/dist/modern/Wizard/WizardActions/WizardActions.js.map +1 -0
  156. package/dist/modern/Wizard/WizardActions/index.d.ts +2 -0
  157. package/dist/modern/Wizard/WizardActions/index.js +2 -0
  158. package/dist/modern/Wizard/WizardActions/index.js.map +1 -0
  159. package/dist/modern/Wizard/WizardActions/styles.js +20 -0
  160. package/dist/modern/Wizard/WizardActions/styles.js.map +1 -0
  161. package/dist/modern/Wizard/WizardContainer/WizardContainer.d.ts +28 -0
  162. package/dist/modern/Wizard/WizardContainer/WizardContainer.js +85 -0
  163. package/dist/modern/Wizard/WizardContainer/WizardContainer.js.map +1 -0
  164. package/dist/modern/Wizard/WizardContainer/index.d.ts +2 -0
  165. package/dist/modern/Wizard/WizardContainer/index.js +2 -0
  166. package/dist/modern/Wizard/WizardContainer/index.js.map +1 -0
  167. package/dist/modern/Wizard/WizardContainer/styles.js +13 -0
  168. package/dist/modern/Wizard/WizardContainer/styles.js.map +1 -0
  169. package/dist/modern/Wizard/WizardContent/LoadingContainer.js +71 -0
  170. package/dist/modern/Wizard/WizardContent/LoadingContainer.js.map +1 -0
  171. package/dist/modern/Wizard/WizardContent/WizardContent.d.ts +28 -0
  172. package/dist/modern/Wizard/WizardContent/WizardContent.js +122 -0
  173. package/dist/modern/Wizard/WizardContent/WizardContent.js.map +1 -0
  174. package/dist/modern/Wizard/WizardContent/index.d.ts +2 -0
  175. package/dist/modern/Wizard/WizardContent/index.js +2 -0
  176. package/dist/modern/Wizard/WizardContent/index.js.map +1 -0
  177. package/dist/modern/Wizard/WizardContent/styles.js +14 -0
  178. package/dist/modern/Wizard/WizardContent/styles.js.map +1 -0
  179. package/dist/modern/Wizard/WizardContext/WizardContext.js +12 -0
  180. package/dist/modern/Wizard/WizardContext/WizardContext.js.map +1 -0
  181. package/dist/modern/Wizard/WizardContext/index.js +2 -0
  182. package/dist/modern/Wizard/WizardContext/index.js.map +1 -0
  183. package/dist/modern/Wizard/WizardTitle/WizardTitle.d.ts +42 -0
  184. package/dist/modern/Wizard/WizardTitle/WizardTitle.js +188 -0
  185. package/dist/modern/Wizard/WizardTitle/WizardTitle.js.map +1 -0
  186. package/dist/modern/Wizard/WizardTitle/index.d.ts +2 -0
  187. package/dist/modern/Wizard/WizardTitle/index.js +2 -0
  188. package/dist/modern/Wizard/WizardTitle/index.js.map +1 -0
  189. package/dist/modern/Wizard/WizardTitle/styles.js +31 -0
  190. package/dist/modern/Wizard/WizardTitle/styles.js.map +1 -0
  191. package/dist/modern/Wizard/index.d.ts +2 -0
  192. package/dist/modern/Wizard/index.js +7 -0
  193. package/dist/modern/Wizard/index.js.map +1 -0
  194. package/dist/modern/Wizard/styles.js +6 -0
  195. package/dist/modern/Wizard/styles.js.map +1 -0
  196. package/dist/modern/index.d.ts +8 -5
  197. package/dist/modern/index.js +3 -2
  198. package/dist/modern/index.js.map +1 -1
  199. package/package.json +4 -4
@@ -0,0 +1,63 @@
1
+ import * as React from "react";
2
+ import { StandardProps, ModalProps } from "@mui/material";
3
+ import { HvWizardActionsProps } from "./WizardActions";
4
+ import { HvWizardTitleProps } from "./WizardTitle";
5
+ import { HvStepNavigationProps } from "../StepNavigation";
6
+
7
+ export type HvWizardClassKey = "root";
8
+
9
+ export type HvWizardProps = StandardProps<
10
+ React.HTMLAttributes<HTMLDivElement>,
11
+ HvWizardClassKey
12
+ > & {
13
+ /**
14
+ * Class names to be applied.
15
+ */
16
+ className: string;
17
+ /**
18
+ * Current state of the Wizard.
19
+ */
20
+ open: boolean;
21
+ /**
22
+ * Function executed on close.
23
+ */
24
+ onClose: ModalProps["onClose"];
25
+ /**
26
+ * Function executed on submit.
27
+ */
28
+ onSubmit: any;
29
+ /**
30
+ * Title for the wizard.
31
+ */
32
+ title: string;
33
+ /**
34
+ * The content of the component.
35
+ */
36
+ children: React.ReactNode;
37
+ /**
38
+ * An object containing all the labels for the wizard.
39
+ */
40
+ labels: HvWizardActionsProps["labels"] & HvWizardTitleProps["labels"];
41
+ /**
42
+ * Shows the summary button.
43
+ */
44
+ hasSummary?: boolean;
45
+ /**
46
+ * Enables the skip button.
47
+ */
48
+ skippable?: boolean;
49
+ /**
50
+ * Forces minimum height to the component.
51
+ */
52
+ fixedHeight?: boolean;
53
+ /**
54
+ * Whether the loading animation is shown.
55
+ */
56
+ loading?: boolean;
57
+ /**
58
+ * Custom object to define type, size and width of the StepNavigation component
59
+ */
60
+ customStep?: Pick<HvStepNavigationProps, "type" | "stepSize" | "width">;
61
+ };
62
+
63
+ export default function HvWizard(props: HvWizardProps): JSX.Element | null;
@@ -0,0 +1,262 @@
1
+ "use strict";
2
+
3
+ require("core-js/modules/es.object.keys.js");
4
+
5
+ require("core-js/modules/es.symbol.js");
6
+
7
+ require("core-js/modules/es.array.filter.js");
8
+
9
+ require("core-js/modules/es.object.to-string.js");
10
+
11
+ require("core-js/modules/es.object.get-own-property-descriptor.js");
12
+
13
+ require("core-js/modules/web.dom-collections.for-each.js");
14
+
15
+ require("core-js/modules/es.object.get-own-property-descriptors.js");
16
+
17
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
18
+
19
+ Object.defineProperty(exports, "__esModule", {
20
+ value: true
21
+ });
22
+ exports.default = void 0;
23
+
24
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
25
+
26
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
27
+
28
+ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
29
+
30
+ var _react = _interopRequireDefault(require("react"));
31
+
32
+ var _propTypes = _interopRequireDefault(require("prop-types"));
33
+
34
+ var _styles = require("@mui/styles");
35
+
36
+ var _WizardContext = _interopRequireDefault(require("./WizardContext"));
37
+
38
+ var _WizardContainer = _interopRequireDefault(require("./WizardContainer"));
39
+
40
+ var _WizardTitle = _interopRequireDefault(require("./WizardTitle"));
41
+
42
+ var _WizardContent = _interopRequireDefault(require("./WizardContent"));
43
+
44
+ var _WizardActions = _interopRequireDefault(require("./WizardActions"));
45
+
46
+ var _styles2 = _interopRequireDefault(require("./styles"));
47
+
48
+ var _jsxRuntime = require("react/jsx-runtime");
49
+
50
+ var _excluded = ["className", "children", "onClose", "onSubmit", "title", "open", "skippable", "loading", "hasSummary", "labels", "fixedHeight", "customStep"];
51
+
52
+ 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; }
53
+
54
+ 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; }
55
+
56
+ var HvWizard = function HvWizard(_ref) {
57
+ var className = _ref.className,
58
+ children = _ref.children,
59
+ onClose = _ref.onClose,
60
+ onSubmit = _ref.onSubmit,
61
+ title = _ref.title,
62
+ open = _ref.open,
63
+ _ref$skippable = _ref.skippable,
64
+ skippable = _ref$skippable === void 0 ? true : _ref$skippable,
65
+ _ref$loading = _ref.loading,
66
+ loading = _ref$loading === void 0 ? false : _ref$loading,
67
+ _ref$hasSummary = _ref.hasSummary,
68
+ hasSummary = _ref$hasSummary === void 0 ? false : _ref$hasSummary,
69
+ _ref$labels = _ref.labels,
70
+ labels = _ref$labels === void 0 ? {
71
+ cancel: "Cancel",
72
+ next: "Next",
73
+ previous: "Previous",
74
+ skip: "Skip",
75
+ submit: "Submit",
76
+ summary: "Summary"
77
+ } : _ref$labels,
78
+ _ref$fixedHeight = _ref.fixedHeight,
79
+ fixedHeight = _ref$fixedHeight === void 0 ? false : _ref$fixedHeight,
80
+ customStep = _ref.customStep,
81
+ others = (0, _objectWithoutProperties2.default)(_ref, _excluded);
82
+
83
+ var _React$useState = _react.default.useState({}),
84
+ _React$useState2 = (0, _slicedToArray2.default)(_React$useState, 2),
85
+ context = _React$useState2[0],
86
+ setContext = _React$useState2[1];
87
+
88
+ var _React$useState3 = _react.default.useState(0),
89
+ _React$useState4 = (0, _slicedToArray2.default)(_React$useState3, 2),
90
+ tab = _React$useState4[0],
91
+ setTab = _React$useState4[1];
92
+
93
+ var contextValue = _react.default.useMemo(function () {
94
+ return {
95
+ context: context,
96
+ setContext: setContext
97
+ };
98
+ }, [context, setContext]);
99
+
100
+ _react.default.useEffect(function () {
101
+ if (!open) {
102
+ setTab(0);
103
+ }
104
+ }, [open]);
105
+
106
+ var handleClose = _react.default.useCallback(function (evt, reason) {
107
+ if (reason !== "backdropClick") {
108
+ onClose(evt, reason);
109
+ }
110
+ }, [onClose]);
111
+
112
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_WizardContext.default.Provider, {
113
+ value: contextValue,
114
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_WizardContainer.default, _objectSpread(_objectSpread({
115
+ className: className,
116
+ handleClose: handleClose,
117
+ open: open
118
+ }, others), {}, {
119
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_WizardTitle.default, {
120
+ title: title,
121
+ hasSummary: hasSummary,
122
+ labels: labels,
123
+ tab: tab,
124
+ changeTab: setTab,
125
+ customStep: customStep
126
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_WizardContent.default, {
127
+ loading: loading,
128
+ fixedHeight: fixedHeight,
129
+ tab: tab,
130
+ children: children
131
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_WizardActions.default, {
132
+ loading: loading,
133
+ skippable: skippable,
134
+ labels: labels,
135
+ tab: tab,
136
+ changeTab: setTab,
137
+ handleClose: handleClose,
138
+ onSubmit: onSubmit
139
+ })]
140
+ }))
141
+ });
142
+ };
143
+
144
+ process.env.NODE_ENV !== "production" ? HvWizard.propTypes = {
145
+ /**
146
+ * Class names to be applied.
147
+ */
148
+ className: _propTypes.default.string,
149
+
150
+ /**
151
+ * Current state of the Wizard.
152
+ */
153
+ open: _propTypes.default.bool.isRequired,
154
+
155
+ /**
156
+ * Function executed on close.
157
+ */
158
+ onClose: _propTypes.default.func.isRequired,
159
+
160
+ /**
161
+ * Function executed on submit.
162
+ */
163
+ onSubmit: _propTypes.default.func.isRequired,
164
+
165
+ /**
166
+ * Enables the skip button.
167
+ */
168
+ skippable: _propTypes.default.bool,
169
+
170
+ /**
171
+ * Title for the wizard.
172
+ */
173
+ title: _propTypes.default.string,
174
+
175
+ /**
176
+ * Shows the summary button.
177
+ */
178
+ hasSummary: _propTypes.default.bool,
179
+
180
+ /**
181
+ * The content of the component.
182
+ */
183
+ children: _propTypes.default.node,
184
+
185
+ /**
186
+ * An object containing all the labels for the wizard.
187
+ */
188
+ labels: _propTypes.default.shape({
189
+ /**
190
+ * Cancel button label.
191
+ */
192
+ cancel: _propTypes.default.string,
193
+
194
+ /**
195
+ * Skip button label.
196
+ */
197
+ skip: _propTypes.default.string,
198
+
199
+ /**
200
+ * Previous button label.
201
+ */
202
+ previous: _propTypes.default.string,
203
+
204
+ /**
205
+ * Next button label.
206
+ */
207
+ next: _propTypes.default.string,
208
+
209
+ /**
210
+ * Submit button label.
211
+ */
212
+ submit: _propTypes.default.string,
213
+
214
+ /**
215
+ * Summary button label.
216
+ */
217
+ summary: _propTypes.default.string
218
+ }),
219
+
220
+ /**
221
+ * Forces minimum height to the component.
222
+ */
223
+ fixedHeight: _propTypes.default.bool,
224
+
225
+ /**
226
+ * Whether the loading animation is shown.
227
+ */
228
+ loading: _propTypes.default.bool,
229
+
230
+ /**
231
+ * Custom object to define type, size and width of the StepNavigation component
232
+ */
233
+ customStep: _propTypes.default.shape({
234
+ /**
235
+ * Type of step navigation. Values = {"Simple", "Default"}.
236
+ */
237
+ type: _propTypes.default.oneOf(["Simple", "Default"]),
238
+
239
+ /**
240
+ * Sets one of the standard sizes of the steps. Values = {"XS", "SM", "MD", "LG", "XL"}
241
+ */
242
+ stepSize: _propTypes.default.oneOf(["XS", "SM", "MD", "LG", "XL"]),
243
+
244
+ /**
245
+ * Width of the component element on each breakpoint screen resolution.
246
+ */
247
+ width: _propTypes.default.shape({
248
+ xs: _propTypes.default.number,
249
+ sm: _propTypes.default.number,
250
+ md: _propTypes.default.number,
251
+ lg: _propTypes.default.number,
252
+ xl: _propTypes.default.number
253
+ })
254
+ })
255
+ } : void 0;
256
+
257
+ var _default = (0, _styles.withStyles)(_styles2.default, {
258
+ name: "HvWizard"
259
+ })(HvWizard);
260
+
261
+ exports.default = _default;
262
+ //# sourceMappingURL=Wizard.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Wizard.js","names":["HvWizard","className","children","onClose","onSubmit","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 onSubmit,\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, setContext]\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 loading={loading} fixedHeight={fixedHeight} tab={tab}>\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 onSubmit={onSubmit}\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 onSubmit: 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 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;;;;;;;;;;AAEA,IAAMA,QAAQ,GAAG,SAAXA,QAAW,OAqBX;EAAA,IApBJC,SAoBI,QApBJA,SAoBI;EAAA,IAnBJC,QAmBI,QAnBJA,QAmBI;EAAA,IAlBJC,OAkBI,QAlBJA,OAkBI;EAAA,IAjBJC,QAiBI,QAjBJA,QAiBI;EAAA,IAhBJC,KAgBI,QAhBJA,KAgBI;EAAA,IAfJC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AZmB,CAAhB;AAzEO,CAArB;;eA+Fe,IAAAK,kBAAA,EAAWC,gBAAX,EAAmB;EAAEC,IAAI,EAAE;AAAR,CAAnB,EAAyCrD,QAAzC,C"}
@@ -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,270 @@
1
+ "use strict";
2
+
3
+ require("core-js/modules/es.object.keys.js");
4
+
5
+ require("core-js/modules/es.symbol.js");
6
+
7
+ require("core-js/modules/es.array.filter.js");
8
+
9
+ require("core-js/modules/es.object.get-own-property-descriptor.js");
10
+
11
+ require("core-js/modules/web.dom-collections.for-each.js");
12
+
13
+ require("core-js/modules/es.object.get-own-property-descriptors.js");
14
+
15
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
16
+
17
+ Object.defineProperty(exports, "__esModule", {
18
+ value: true
19
+ });
20
+ exports.default = void 0;
21
+
22
+ require("core-js/modules/es.object.entries.js");
23
+
24
+ require("core-js/modules/es.object.to-string.js");
25
+
26
+ require("core-js/modules/es.array.map.js");
27
+
28
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
29
+
30
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
31
+
32
+ var _react = _interopRequireDefault(require("react"));
33
+
34
+ var _propTypes = _interopRequireDefault(require("prop-types"));
35
+
36
+ var _styles = require("@mui/styles");
37
+
38
+ var _clsx = _interopRequireDefault(require("clsx"));
39
+
40
+ var _uikitReactCore = require("@hitachivantara/uikit-react-core");
41
+
42
+ var _uikitReactIcons = require("@hitachivantara/uikit-react-icons");
43
+
44
+ var _WizardContext = _interopRequireDefault(require("../WizardContext"));
45
+
46
+ var _styles2 = _interopRequireDefault(require("./styles"));
47
+
48
+ var _jsxRuntime = require("react/jsx-runtime");
49
+
50
+ var _Backwards, _Forwards;
51
+
52
+ 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; }
53
+
54
+ 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; }
55
+
56
+ var HvWizardActions = function HvWizardActions(_ref) {
57
+ var _labels$cancel, _labels$skip, _labels$previous, _labels$submit, _context$tab, _labels$next;
58
+
59
+ var classes = _ref.classes,
60
+ handleClose = _ref.handleClose,
61
+ onSubmit = _ref.onSubmit,
62
+ changeTab = _ref.changeTab,
63
+ tab = _ref.tab,
64
+ _ref$loading = _ref.loading,
65
+ loading = _ref$loading === void 0 ? false : _ref$loading,
66
+ _ref$skippable = _ref.skippable,
67
+ skippable = _ref$skippable === void 0 ? false : _ref$skippable,
68
+ _ref$labels = _ref.labels,
69
+ labels = _ref$labels === void 0 ? {
70
+ cancel: "Cancel",
71
+ next: "Next",
72
+ previous: "Previous",
73
+ skip: "Skip",
74
+ submit: "Submit"
75
+ } : _ref$labels;
76
+
77
+ var _React$useContext = _react.default.useContext(_WizardContext.default),
78
+ context = _React$useContext.context,
79
+ setContext = _React$useContext.setContext;
80
+
81
+ var _React$useState = _react.default.useState(0),
82
+ _React$useState2 = (0, _slicedToArray2.default)(_React$useState, 2),
83
+ pages = _React$useState2[0],
84
+ setPages = _React$useState2[1];
85
+
86
+ var _React$useState3 = _react.default.useState(false),
87
+ _React$useState4 = (0, _slicedToArray2.default)(_React$useState3, 2),
88
+ canSubmit = _React$useState4[0],
89
+ setCanSubmit = _React$useState4[1];
90
+
91
+ _react.default.useEffect(function () {
92
+ var contextEntries = Object.entries(context);
93
+
94
+ if (contextEntries.length) {
95
+ setPages(contextEntries.length);
96
+ var validWizard = Object.entries(context).every(function (_ref2) {
97
+ var _ref3 = (0, _slicedToArray2.default)(_ref2, 2),
98
+ value = _ref3[1];
99
+
100
+ return value.valid;
101
+ });
102
+
103
+ if (validWizard !== canSubmit) {
104
+ setCanSubmit(validWizard);
105
+ }
106
+ }
107
+ }, [context]); // eslint-disable-line react-hooks/exhaustive-deps
108
+
109
+
110
+ var lastPage = pages - 1;
111
+ var isLastPage = tab >= lastPage;
112
+
113
+ var handleSkip = _react.default.useCallback(function () {
114
+ var skippedContext = Object.entries(context).map(function (_ref4) {
115
+ var _ref5 = (0, _slicedToArray2.default)(_ref4, 2),
116
+ child = _ref5[1];
117
+
118
+ return _objectSpread(_objectSpread({}, child), {}, {
119
+ valid: child.valid !== false
120
+ });
121
+ });
122
+ setContext(skippedContext);
123
+ changeTab(lastPage);
124
+ }, [changeTab, context, lastPage, setContext]);
125
+
126
+ var handleSubmit = _react.default.useCallback(function () {
127
+ return onSubmit(context);
128
+ }, [onSubmit, context]);
129
+
130
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_uikitReactCore.HvDialogActions, {
131
+ className: classes.actionsContainer,
132
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_uikitReactCore.HvGrid, {
133
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_uikitReactCore.HvButton, {
134
+ category: "ghost",
135
+ onClick: handleClose,
136
+ className: classes.buttonWidth,
137
+ children: "".concat((_labels$cancel = labels.cancel) !== null && _labels$cancel !== void 0 ? _labels$cancel : "Cancel")
138
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_uikitReactCore.HvButton, {
139
+ category: "ghost",
140
+ disabled: isLastPage || !skippable,
141
+ className: classes.buttonWidth,
142
+ onClick: handleSkip,
143
+ children: "".concat((_labels$skip = labels.skip) !== null && _labels$skip !== void 0 ? _labels$skip : "Skip")
144
+ })]
145
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_uikitReactCore.HvGrid, {
146
+ className: classes.buttonsContainer,
147
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_uikitReactCore.HvButton, {
148
+ category: "ghost",
149
+ className: classes.buttonWidth,
150
+ disabled: tab <= 0,
151
+ onClick: function onClick() {
152
+ return changeTab(function (t) {
153
+ return t - 1;
154
+ });
155
+ },
156
+ children: [_Backwards || (_Backwards = /*#__PURE__*/(0, _jsxRuntime.jsx)(_uikitReactIcons.Backwards, {})), "".concat((_labels$previous = labels.previous) !== null && _labels$previous !== void 0 ? _labels$previous : "Previous")]
157
+ }), isLastPage ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_uikitReactCore.HvButton, {
158
+ category: "primary",
159
+ className: classes.buttonWidth,
160
+ disabled: loading || !canSubmit,
161
+ onClick: handleSubmit,
162
+ children: "".concat((_labels$submit = labels.submit) !== null && _labels$submit !== void 0 ? _labels$submit : "Submit")
163
+ }) : /*#__PURE__*/(0, _jsxRuntime.jsxs)(_uikitReactCore.HvButton, {
164
+ category: "ghost",
165
+ className: (0, _clsx.default)(classes.buttonWidth, classes.buttonSpacing),
166
+ onClick: function onClick() {
167
+ return changeTab(function (t) {
168
+ return t + 1;
169
+ });
170
+ },
171
+ disabled: !skippable && !(context !== null && context !== void 0 && (_context$tab = context[tab]) !== null && _context$tab !== void 0 && _context$tab.valid),
172
+ children: ["".concat((_labels$next = labels.next) !== null && _labels$next !== void 0 ? _labels$next : "Next"), _Forwards || (_Forwards = /*#__PURE__*/(0, _jsxRuntime.jsx)(_uikitReactIcons.Forwards, {}))]
173
+ })]
174
+ })]
175
+ });
176
+ };
177
+
178
+ process.env.NODE_ENV !== "production" ? HvWizardActions.propTypes = {
179
+ /**
180
+ * A Jss Object used to override or extend the styles applied.
181
+ */
182
+ classes: _propTypes.default.shape({
183
+ /**
184
+ * Styles applied to the component which contains the groups of buttons.
185
+ */
186
+ actionsContainer: _propTypes.default.string,
187
+
188
+ /**
189
+ * Styles applied to the component which contains the buttons.
190
+ */
191
+ buttonsContainer: _propTypes.default.string,
192
+
193
+ /**
194
+ * Styles applied to the Button component to override its width.
195
+ */
196
+ buttonWidth: _propTypes.default.string,
197
+
198
+ /**
199
+ * Styles applied to some Button components to override its left padding.
200
+ */
201
+ buttonSpacing: _propTypes.default.string
202
+ }).isRequired,
203
+
204
+ /**
205
+ * Current tab to check if it's last page or first to disable previous button and swap between next and submit button.
206
+ */
207
+ tab: _propTypes.default.number.isRequired,
208
+
209
+ /**
210
+ * Function to change the tab when pressing previous and next buttons.
211
+ */
212
+ changeTab: _propTypes.default.func.isRequired,
213
+
214
+ /**
215
+ * Function to handle the cancel button.
216
+ */
217
+ handleClose: _propTypes.default.func.isRequired,
218
+
219
+ /**
220
+ * Function to handle the submit button. Also sends the current context state.
221
+ */
222
+ onSubmit: _propTypes.default.func.isRequired,
223
+
224
+ /**
225
+ * An object containing all the labels for the wizard actions component.
226
+ */
227
+ labels: _propTypes.default.shape({
228
+ /**
229
+ * Cancel button label.
230
+ */
231
+ cancel: _propTypes.default.string,
232
+
233
+ /**
234
+ * Skip button label.
235
+ */
236
+ skip: _propTypes.default.string,
237
+
238
+ /**
239
+ * Previous button label.
240
+ */
241
+ previous: _propTypes.default.string,
242
+
243
+ /**
244
+ * Next button label.
245
+ */
246
+ next: _propTypes.default.string,
247
+
248
+ /**
249
+ * Submit button label.
250
+ */
251
+ submit: _propTypes.default.string
252
+ }),
253
+
254
+ /**
255
+ * Whether the submit button is disabled.
256
+ */
257
+ loading: _propTypes.default.bool,
258
+
259
+ /**
260
+ * Enables the skip button.
261
+ */
262
+ skippable: _propTypes.default.bool
263
+ } : void 0;
264
+
265
+ var _default = (0, _styles.withStyles)(_styles2.default, {
266
+ name: "HvWizardActions"
267
+ })(HvWizardActions);
268
+
269
+ exports.default = _default;
270
+ //# sourceMappingURL=WizardActions.js.map