@hitachivantara/uikit-react-lab 4.0.1-next.2 → 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.
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 +3 -3
@@ -0,0 +1,229 @@
1
+ import "core-js/modules/es.object.keys.js";
2
+ import "core-js/modules/es.symbol.js";
3
+ import "core-js/modules/es.array.filter.js";
4
+ import "core-js/modules/es.object.to-string.js";
5
+ import "core-js/modules/es.object.get-own-property-descriptor.js";
6
+ import "core-js/modules/web.dom-collections.for-each.js";
7
+ import "core-js/modules/es.object.get-own-property-descriptors.js";
8
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
9
+ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
10
+ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
11
+ var _excluded = ["className", "children", "onClose", "onSubmit", "title", "open", "skippable", "loading", "hasSummary", "labels", "fixedHeight", "customStep"];
12
+
13
+ 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; }
14
+
15
+ 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; }
16
+
17
+ import React from "react";
18
+ import PropTypes from "prop-types";
19
+ import { withStyles } from "@mui/styles";
20
+ import WizardContext from "./WizardContext";
21
+ import WizardContainer from "./WizardContainer";
22
+ import WizardTitle from "./WizardTitle";
23
+ import WizardContent from "./WizardContent";
24
+ import WizardActions from "./WizardActions";
25
+ import styles from "./styles";
26
+ import { jsx as _jsx } from "react/jsx-runtime";
27
+ import { jsxs as _jsxs } from "react/jsx-runtime";
28
+
29
+ var HvWizard = function HvWizard(_ref) {
30
+ var className = _ref.className,
31
+ children = _ref.children,
32
+ onClose = _ref.onClose,
33
+ onSubmit = _ref.onSubmit,
34
+ title = _ref.title,
35
+ open = _ref.open,
36
+ _ref$skippable = _ref.skippable,
37
+ skippable = _ref$skippable === void 0 ? true : _ref$skippable,
38
+ _ref$loading = _ref.loading,
39
+ loading = _ref$loading === void 0 ? false : _ref$loading,
40
+ _ref$hasSummary = _ref.hasSummary,
41
+ hasSummary = _ref$hasSummary === void 0 ? false : _ref$hasSummary,
42
+ _ref$labels = _ref.labels,
43
+ labels = _ref$labels === void 0 ? {
44
+ cancel: "Cancel",
45
+ next: "Next",
46
+ previous: "Previous",
47
+ skip: "Skip",
48
+ submit: "Submit",
49
+ summary: "Summary"
50
+ } : _ref$labels,
51
+ _ref$fixedHeight = _ref.fixedHeight,
52
+ fixedHeight = _ref$fixedHeight === void 0 ? false : _ref$fixedHeight,
53
+ customStep = _ref.customStep,
54
+ others = _objectWithoutProperties(_ref, _excluded);
55
+
56
+ var _React$useState = React.useState({}),
57
+ _React$useState2 = _slicedToArray(_React$useState, 2),
58
+ context = _React$useState2[0],
59
+ setContext = _React$useState2[1];
60
+
61
+ var _React$useState3 = React.useState(0),
62
+ _React$useState4 = _slicedToArray(_React$useState3, 2),
63
+ tab = _React$useState4[0],
64
+ setTab = _React$useState4[1];
65
+
66
+ var contextValue = React.useMemo(function () {
67
+ return {
68
+ context: context,
69
+ setContext: setContext
70
+ };
71
+ }, [context, setContext]);
72
+ React.useEffect(function () {
73
+ if (!open) {
74
+ setTab(0);
75
+ }
76
+ }, [open]);
77
+ var handleClose = React.useCallback(function (evt, reason) {
78
+ if (reason !== "backdropClick") {
79
+ onClose(evt, reason);
80
+ }
81
+ }, [onClose]);
82
+ return /*#__PURE__*/_jsx(WizardContext.Provider, {
83
+ value: contextValue,
84
+ children: /*#__PURE__*/_jsxs(WizardContainer, _objectSpread(_objectSpread({
85
+ className: className,
86
+ handleClose: handleClose,
87
+ open: open
88
+ }, others), {}, {
89
+ children: [/*#__PURE__*/_jsx(WizardTitle, {
90
+ title: title,
91
+ hasSummary: hasSummary,
92
+ labels: labels,
93
+ tab: tab,
94
+ changeTab: setTab,
95
+ customStep: customStep
96
+ }), /*#__PURE__*/_jsx(WizardContent, {
97
+ loading: loading,
98
+ fixedHeight: fixedHeight,
99
+ tab: tab,
100
+ children: children
101
+ }), /*#__PURE__*/_jsx(WizardActions, {
102
+ loading: loading,
103
+ skippable: skippable,
104
+ labels: labels,
105
+ tab: tab,
106
+ changeTab: setTab,
107
+ handleClose: handleClose,
108
+ onSubmit: onSubmit
109
+ })]
110
+ }))
111
+ });
112
+ };
113
+
114
+ process.env.NODE_ENV !== "production" ? HvWizard.propTypes = {
115
+ /**
116
+ * Class names to be applied.
117
+ */
118
+ className: PropTypes.string,
119
+
120
+ /**
121
+ * Current state of the Wizard.
122
+ */
123
+ open: PropTypes.bool.isRequired,
124
+
125
+ /**
126
+ * Function executed on close.
127
+ */
128
+ onClose: PropTypes.func.isRequired,
129
+
130
+ /**
131
+ * Function executed on submit.
132
+ */
133
+ onSubmit: PropTypes.func.isRequired,
134
+
135
+ /**
136
+ * Enables the skip button.
137
+ */
138
+ skippable: PropTypes.bool,
139
+
140
+ /**
141
+ * Title for the wizard.
142
+ */
143
+ title: PropTypes.string,
144
+
145
+ /**
146
+ * Shows the summary button.
147
+ */
148
+ hasSummary: PropTypes.bool,
149
+
150
+ /**
151
+ * The content of the component.
152
+ */
153
+ children: PropTypes.node,
154
+
155
+ /**
156
+ * An object containing all the labels for the wizard.
157
+ */
158
+ labels: PropTypes.shape({
159
+ /**
160
+ * Cancel button label.
161
+ */
162
+ cancel: PropTypes.string,
163
+
164
+ /**
165
+ * Skip button label.
166
+ */
167
+ skip: PropTypes.string,
168
+
169
+ /**
170
+ * Previous button label.
171
+ */
172
+ previous: PropTypes.string,
173
+
174
+ /**
175
+ * Next button label.
176
+ */
177
+ next: PropTypes.string,
178
+
179
+ /**
180
+ * Submit button label.
181
+ */
182
+ submit: PropTypes.string,
183
+
184
+ /**
185
+ * Summary button label.
186
+ */
187
+ summary: PropTypes.string
188
+ }),
189
+
190
+ /**
191
+ * Forces minimum height to the component.
192
+ */
193
+ fixedHeight: PropTypes.bool,
194
+
195
+ /**
196
+ * Whether the loading animation is shown.
197
+ */
198
+ loading: PropTypes.bool,
199
+
200
+ /**
201
+ * Custom object to define type, size and width of the StepNavigation component
202
+ */
203
+ customStep: PropTypes.shape({
204
+ /**
205
+ * Type of step navigation. Values = {"Simple", "Default"}.
206
+ */
207
+ type: PropTypes.oneOf(["Simple", "Default"]),
208
+
209
+ /**
210
+ * Sets one of the standard sizes of the steps. Values = {"XS", "SM", "MD", "LG", "XL"}
211
+ */
212
+ stepSize: PropTypes.oneOf(["XS", "SM", "MD", "LG", "XL"]),
213
+
214
+ /**
215
+ * Width of the component element on each breakpoint screen resolution.
216
+ */
217
+ width: PropTypes.shape({
218
+ xs: PropTypes.number,
219
+ sm: PropTypes.number,
220
+ md: PropTypes.number,
221
+ lg: PropTypes.number,
222
+ xl: PropTypes.number
223
+ })
224
+ })
225
+ } : void 0;
226
+ export default withStyles(styles, {
227
+ name: "HvWizard"
228
+ })(HvWizard);
229
+ //# sourceMappingURL=Wizard.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Wizard.js","names":["React","PropTypes","withStyles","WizardContext","WizardContainer","WizardTitle","WizardContent","WizardActions","styles","HvWizard","className","children","onClose","onSubmit","title","open","skippable","loading","hasSummary","labels","cancel","next","previous","skip","submit","summary","fixedHeight","customStep","others","useState","context","setContext","tab","setTab","contextValue","useMemo","useEffect","handleClose","useCallback","evt","reason","propTypes","string","bool","isRequired","func","node","shape","type","oneOf","stepSize","width","xs","number","sm","md","lg","xl","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,OAAOA,KAAP,MAAkB,OAAlB;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,SAASC,UAAT,QAA2B,aAA3B;AACA,OAAOC,aAAP,MAA0B,iBAA1B;AACA,OAAOC,eAAP,MAA4B,mBAA5B;AACA,OAAOC,WAAP,MAAwB,eAAxB;AACA,OAAOC,aAAP,MAA0B,iBAA1B;AACA,OAAOC,aAAP,MAA0B,iBAA1B;AAEA,OAAOC,MAAP,MAAmB,UAAnB;;;;AAEA,IAAMC,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,IAeI,QAfJA,IAeI;EAAA,0BAdJC,SAcI;EAAA,IAdJA,SAcI,+BAdQ,IAcR;EAAA,wBAbJC,OAaI;EAAA,IAbJA,OAaI,6BAbM,KAaN;EAAA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
+ 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,237 @@
1
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
+ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
3
+
4
+ var _Backwards, _Forwards;
5
+
6
+ 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; }
7
+
8
+ 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; }
9
+
10
+ import "core-js/modules/es.object.entries.js";
11
+ import "core-js/modules/es.object.to-string.js";
12
+ import "core-js/modules/es.array.map.js";
13
+ import "core-js/modules/es.object.keys.js";
14
+ import "core-js/modules/es.symbol.js";
15
+ import "core-js/modules/es.array.filter.js";
16
+ import "core-js/modules/es.object.get-own-property-descriptor.js";
17
+ import "core-js/modules/web.dom-collections.for-each.js";
18
+ import "core-js/modules/es.object.get-own-property-descriptors.js";
19
+ import React from "react";
20
+ import PropTypes from "prop-types";
21
+ import { withStyles } from "@mui/styles";
22
+ import clsx from "clsx";
23
+ import { HvButton, HvDialogActions, HvGrid } from "@hitachivantara/uikit-react-core";
24
+ import { Backwards, Forwards } from "@hitachivantara/uikit-react-icons";
25
+ import WizardContext from "../WizardContext";
26
+ import styles from "./styles";
27
+ import { jsx as _jsx } from "react/jsx-runtime";
28
+ import { jsxs as _jsxs } from "react/jsx-runtime";
29
+
30
+ var HvWizardActions = function HvWizardActions(_ref) {
31
+ var _labels$cancel, _labels$skip, _labels$previous, _labels$submit, _context$tab, _labels$next;
32
+
33
+ var classes = _ref.classes,
34
+ handleClose = _ref.handleClose,
35
+ onSubmit = _ref.onSubmit,
36
+ changeTab = _ref.changeTab,
37
+ tab = _ref.tab,
38
+ _ref$loading = _ref.loading,
39
+ loading = _ref$loading === void 0 ? false : _ref$loading,
40
+ _ref$skippable = _ref.skippable,
41
+ skippable = _ref$skippable === void 0 ? false : _ref$skippable,
42
+ _ref$labels = _ref.labels,
43
+ labels = _ref$labels === void 0 ? {
44
+ cancel: "Cancel",
45
+ next: "Next",
46
+ previous: "Previous",
47
+ skip: "Skip",
48
+ submit: "Submit"
49
+ } : _ref$labels;
50
+
51
+ var _React$useContext = React.useContext(WizardContext),
52
+ context = _React$useContext.context,
53
+ setContext = _React$useContext.setContext;
54
+
55
+ var _React$useState = React.useState(0),
56
+ _React$useState2 = _slicedToArray(_React$useState, 2),
57
+ pages = _React$useState2[0],
58
+ setPages = _React$useState2[1];
59
+
60
+ var _React$useState3 = React.useState(false),
61
+ _React$useState4 = _slicedToArray(_React$useState3, 2),
62
+ canSubmit = _React$useState4[0],
63
+ setCanSubmit = _React$useState4[1];
64
+
65
+ React.useEffect(function () {
66
+ var contextEntries = Object.entries(context);
67
+
68
+ if (contextEntries.length) {
69
+ setPages(contextEntries.length);
70
+ var validWizard = Object.entries(context).every(function (_ref2) {
71
+ var _ref3 = _slicedToArray(_ref2, 2),
72
+ value = _ref3[1];
73
+
74
+ return value.valid;
75
+ });
76
+
77
+ if (validWizard !== canSubmit) {
78
+ setCanSubmit(validWizard);
79
+ }
80
+ }
81
+ }, [context]); // eslint-disable-line react-hooks/exhaustive-deps
82
+
83
+ var lastPage = pages - 1;
84
+ var isLastPage = tab >= lastPage;
85
+ var handleSkip = React.useCallback(function () {
86
+ var skippedContext = Object.entries(context).map(function (_ref4) {
87
+ var _ref5 = _slicedToArray(_ref4, 2),
88
+ child = _ref5[1];
89
+
90
+ return _objectSpread(_objectSpread({}, child), {}, {
91
+ valid: child.valid !== false
92
+ });
93
+ });
94
+ setContext(skippedContext);
95
+ changeTab(lastPage);
96
+ }, [changeTab, context, lastPage, setContext]);
97
+ var handleSubmit = React.useCallback(function () {
98
+ return onSubmit(context);
99
+ }, [onSubmit, context]);
100
+ return /*#__PURE__*/_jsxs(HvDialogActions, {
101
+ className: classes.actionsContainer,
102
+ children: [/*#__PURE__*/_jsxs(HvGrid, {
103
+ children: [/*#__PURE__*/_jsx(HvButton, {
104
+ category: "ghost",
105
+ onClick: handleClose,
106
+ className: classes.buttonWidth,
107
+ children: "".concat((_labels$cancel = labels.cancel) !== null && _labels$cancel !== void 0 ? _labels$cancel : "Cancel")
108
+ }), /*#__PURE__*/_jsx(HvButton, {
109
+ category: "ghost",
110
+ disabled: isLastPage || !skippable,
111
+ className: classes.buttonWidth,
112
+ onClick: handleSkip,
113
+ children: "".concat((_labels$skip = labels.skip) !== null && _labels$skip !== void 0 ? _labels$skip : "Skip")
114
+ })]
115
+ }), /*#__PURE__*/_jsxs(HvGrid, {
116
+ className: classes.buttonsContainer,
117
+ children: [/*#__PURE__*/_jsxs(HvButton, {
118
+ category: "ghost",
119
+ className: classes.buttonWidth,
120
+ disabled: tab <= 0,
121
+ onClick: function onClick() {
122
+ return changeTab(function (t) {
123
+ return t - 1;
124
+ });
125
+ },
126
+ children: [_Backwards || (_Backwards = /*#__PURE__*/_jsx(Backwards, {})), "".concat((_labels$previous = labels.previous) !== null && _labels$previous !== void 0 ? _labels$previous : "Previous")]
127
+ }), isLastPage ? /*#__PURE__*/_jsx(HvButton, {
128
+ category: "primary",
129
+ className: classes.buttonWidth,
130
+ disabled: loading || !canSubmit,
131
+ onClick: handleSubmit,
132
+ children: "".concat((_labels$submit = labels.submit) !== null && _labels$submit !== void 0 ? _labels$submit : "Submit")
133
+ }) : /*#__PURE__*/_jsxs(HvButton, {
134
+ category: "ghost",
135
+ className: clsx(classes.buttonWidth, classes.buttonSpacing),
136
+ onClick: function onClick() {
137
+ return changeTab(function (t) {
138
+ return t + 1;
139
+ });
140
+ },
141
+ disabled: !skippable && !(context !== null && context !== void 0 && (_context$tab = context[tab]) !== null && _context$tab !== void 0 && _context$tab.valid),
142
+ children: ["".concat((_labels$next = labels.next) !== null && _labels$next !== void 0 ? _labels$next : "Next"), _Forwards || (_Forwards = /*#__PURE__*/_jsx(Forwards, {}))]
143
+ })]
144
+ })]
145
+ });
146
+ };
147
+
148
+ process.env.NODE_ENV !== "production" ? HvWizardActions.propTypes = {
149
+ /**
150
+ * A Jss Object used to override or extend the styles applied.
151
+ */
152
+ classes: PropTypes.shape({
153
+ /**
154
+ * Styles applied to the component which contains the groups of buttons.
155
+ */
156
+ actionsContainer: PropTypes.string,
157
+
158
+ /**
159
+ * Styles applied to the component which contains the buttons.
160
+ */
161
+ buttonsContainer: PropTypes.string,
162
+
163
+ /**
164
+ * Styles applied to the Button component to override its width.
165
+ */
166
+ buttonWidth: PropTypes.string,
167
+
168
+ /**
169
+ * Styles applied to some Button components to override its left padding.
170
+ */
171
+ buttonSpacing: PropTypes.string
172
+ }).isRequired,
173
+
174
+ /**
175
+ * Current tab to check if it's last page or first to disable previous button and swap between next and submit button.
176
+ */
177
+ tab: PropTypes.number.isRequired,
178
+
179
+ /**
180
+ * Function to change the tab when pressing previous and next buttons.
181
+ */
182
+ changeTab: PropTypes.func.isRequired,
183
+
184
+ /**
185
+ * Function to handle the cancel button.
186
+ */
187
+ handleClose: PropTypes.func.isRequired,
188
+
189
+ /**
190
+ * Function to handle the submit button. Also sends the current context state.
191
+ */
192
+ onSubmit: PropTypes.func.isRequired,
193
+
194
+ /**
195
+ * An object containing all the labels for the wizard actions component.
196
+ */
197
+ labels: PropTypes.shape({
198
+ /**
199
+ * Cancel button label.
200
+ */
201
+ cancel: PropTypes.string,
202
+
203
+ /**
204
+ * Skip button label.
205
+ */
206
+ skip: PropTypes.string,
207
+
208
+ /**
209
+ * Previous button label.
210
+ */
211
+ previous: PropTypes.string,
212
+
213
+ /**
214
+ * Next button label.
215
+ */
216
+ next: PropTypes.string,
217
+
218
+ /**
219
+ * Submit button label.
220
+ */
221
+ submit: PropTypes.string
222
+ }),
223
+
224
+ /**
225
+ * Whether the submit button is disabled.
226
+ */
227
+ loading: PropTypes.bool,
228
+
229
+ /**
230
+ * Enables the skip button.
231
+ */
232
+ skippable: PropTypes.bool
233
+ } : void 0;
234
+ export default withStyles(styles, {
235
+ name: "HvWizardActions"
236
+ })(HvWizardActions);
237
+ //# 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","useContext","context","setContext","useState","pages","setPages","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,IAAMC,eAAe,GAAG,SAAlBA,eAAkB,OAelB;EAAA;;EAAA,IAdJC,OAcI,QAdJA,OAcI;EAAA,IAbJC,WAaI,QAbJA,WAaI;EAAA,IAZJC,QAYI,QAZJA,QAYI;EAAA,IAXJC,SAWI,QAXJA,SAWI;EAAA,IAVJC,GAUI,QAVJA,GAUI;EAAA,wBATJC,OASI;EAAA,IATJA,OASI,6BATM,KASN;EAAA,0BARJC,SAQI;EAAA,IARJA,SAQI,+BARQ,KAQR;EAAA,uBAPJC,MAOI;EAAA,IAPJA,MAOI,4BAPK;IACPC,MAAM,EAAE,QADD;IAEPC,IAAI,EAAE,MAFC;IAGPC,QAAQ,EAAE,UAHH;IAIPC,IAAI,EAAE,MAJC;IAKPC,MAAM,EAAE;EALD,CAOL;;EACJ,wBAAgCxB,KAAK,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,QAAQ,EAAEb,SAAS,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,2 @@
1
+ export { default } from "./WizardActions";
2
+ export * from "./WizardActions";
@@ -0,0 +1,2 @@
1
+ export { default } from "./WizardActions";
2
+ //# sourceMappingURL=index.js.map
@@ -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,22 @@
1
+ var styles = function styles() {
2
+ return {
3
+ buttonWidth: {
4
+ width: 120
5
+ },
6
+ actionsContainer: {
7
+ display: "flex",
8
+ justifyContent: "space-between"
9
+ },
10
+ buttonsContainer: {
11
+ "& > button:last-child": {
12
+ marginLeft: 20
13
+ }
14
+ },
15
+ buttonSpacing: {
16
+ paddingLeft: 28
17
+ }
18
+ };
19
+ };
20
+
21
+ export default styles;
22
+ //# 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,IAAMA,MAAM,GAAG,SAATA,MAAS;EAAA,OAAO;IACpBC,WAAW,EAAE;MACXC,KAAK,EAAE;IADI,CADO;IAIpBC,gBAAgB,EAAE;MAChBC,OAAO,EAAE,MADO;MAEhBC,cAAc,EAAE;IAFA,CAJE;IAQpBC,gBAAgB,EAAE;MAChB,yBAAyB;QACvBC,UAAU,EAAE;MADW;IADT,CARE;IAapBC,aAAa,EAAE;MACbC,WAAW,EAAE;IADA;EAbK,CAAP;AAAA,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;