@hitachivantara/uikit-react-lab 3.55.1 → 3.57.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (208) hide show
  1. package/dist/Controls/Controls.d.ts +2 -10
  2. package/dist/Controls/RightControl/RightControl.d.ts +1 -1
  3. package/dist/StepNavigation/DefaultNavigation/DefaultNavigation.d.ts +3 -1
  4. package/dist/StepNavigation/DefaultNavigation/DefaultNavigation.js +2 -7
  5. package/dist/StepNavigation/DefaultNavigation/DefaultNavigation.js.map +1 -1
  6. package/dist/StepNavigation/DefaultNavigation/Step/Step.d.ts +2 -2
  7. package/dist/StepNavigation/DefaultNavigation/Step/Step.js +2 -2
  8. package/dist/StepNavigation/DefaultNavigation/Step/Step.js.map +1 -1
  9. package/dist/StepNavigation/DefaultNavigation/utils.js +3 -2
  10. package/dist/StepNavigation/DefaultNavigation/utils.js.map +1 -1
  11. package/dist/StepNavigation/SimpleNavigation/Dot/Dot.js +2 -5
  12. package/dist/StepNavigation/SimpleNavigation/Dot/Dot.js.map +1 -1
  13. package/dist/StepNavigation/SimpleNavigation/SimpleNavigation.d.ts +3 -1
  14. package/dist/StepNavigation/SimpleNavigation/SimpleNavigation.js +2 -9
  15. package/dist/StepNavigation/SimpleNavigation/SimpleNavigation.js.map +1 -1
  16. package/dist/StepNavigation/SimpleNavigation/utils.js +10 -8
  17. package/dist/StepNavigation/SimpleNavigation/utils.js.map +1 -1
  18. package/dist/StepNavigation/StepNavigation.js +5 -5
  19. package/dist/StepNavigation/StepNavigation.js.map +1 -1
  20. package/dist/Table/TableBody/TableBody.d.ts +4 -0
  21. package/dist/Wizard/Wizard.d.ts +63 -0
  22. package/dist/Wizard/Wizard.js +238 -0
  23. package/dist/Wizard/Wizard.js.map +1 -0
  24. package/dist/Wizard/WizardActions/WizardActions.d.ts +61 -0
  25. package/dist/Wizard/WizardActions/WizardActions.js +259 -0
  26. package/dist/Wizard/WizardActions/WizardActions.js.map +1 -0
  27. package/dist/Wizard/WizardActions/index.d.ts +2 -0
  28. package/dist/Wizard/WizardActions/index.js +16 -0
  29. package/dist/Wizard/WizardActions/index.js.map +1 -0
  30. package/dist/Wizard/WizardActions/styles.js +30 -0
  31. package/dist/Wizard/WizardActions/styles.js.map +1 -0
  32. package/dist/Wizard/WizardContainer/WizardContainer.d.ts +28 -0
  33. package/dist/Wizard/WizardContainer/WizardContainer.js +94 -0
  34. package/dist/Wizard/WizardContainer/WizardContainer.js.map +1 -0
  35. package/dist/Wizard/WizardContainer/index.d.ts +2 -0
  36. package/dist/Wizard/WizardContainer/index.js +16 -0
  37. package/dist/Wizard/WizardContainer/index.js.map +1 -0
  38. package/dist/Wizard/WizardContainer/styles.js +23 -0
  39. package/dist/Wizard/WizardContainer/styles.js.map +1 -0
  40. package/dist/Wizard/WizardContent/LoadingContainer.js +74 -0
  41. package/dist/Wizard/WizardContent/LoadingContainer.js.map +1 -0
  42. package/dist/Wizard/WizardContent/WizardContent.d.ts +28 -0
  43. package/dist/Wizard/WizardContent/WizardContent.js +163 -0
  44. package/dist/Wizard/WizardContent/WizardContent.js.map +1 -0
  45. package/dist/Wizard/WizardContent/index.d.ts +2 -0
  46. package/dist/Wizard/WizardContent/index.js +16 -0
  47. package/dist/Wizard/WizardContent/index.js.map +1 -0
  48. package/dist/Wizard/WizardContent/styles.js +24 -0
  49. package/dist/Wizard/WizardContent/styles.js.map +1 -0
  50. package/dist/Wizard/WizardContext/WizardContext.js +21 -0
  51. package/dist/Wizard/WizardContext/WizardContext.js.map +1 -0
  52. package/dist/Wizard/WizardContext/index.js +16 -0
  53. package/dist/Wizard/WizardContext/index.js.map +1 -0
  54. package/dist/Wizard/WizardTitle/WizardTitle.d.ts +42 -0
  55. package/dist/Wizard/WizardTitle/WizardTitle.js +221 -0
  56. package/dist/Wizard/WizardTitle/WizardTitle.js.map +1 -0
  57. package/dist/Wizard/WizardTitle/index.d.ts +2 -0
  58. package/dist/Wizard/WizardTitle/index.js +16 -0
  59. package/dist/Wizard/WizardTitle/index.js.map +1 -0
  60. package/dist/Wizard/WizardTitle/styles.js +41 -0
  61. package/dist/Wizard/WizardTitle/styles.js.map +1 -0
  62. package/dist/Wizard/index.d.ts +2 -0
  63. package/dist/Wizard/index.js +56 -0
  64. package/dist/Wizard/index.js.map +1 -0
  65. package/dist/Wizard/styles.js +16 -0
  66. package/dist/Wizard/styles.js.map +1 -0
  67. package/dist/index.d.ts +3 -0
  68. package/dist/index.js +10 -1
  69. package/dist/index.js.map +1 -1
  70. package/dist/legacy/Controls/Controls.d.ts +2 -10
  71. package/dist/legacy/Controls/RightControl/RightControl.d.ts +1 -1
  72. package/dist/legacy/StepNavigation/DefaultNavigation/DefaultNavigation.d.ts +3 -1
  73. package/dist/legacy/StepNavigation/DefaultNavigation/DefaultNavigation.js +3 -8
  74. package/dist/legacy/StepNavigation/DefaultNavigation/DefaultNavigation.js.map +1 -1
  75. package/dist/legacy/StepNavigation/DefaultNavigation/Step/Step.d.ts +2 -2
  76. package/dist/legacy/StepNavigation/DefaultNavigation/Step/Step.js +2 -2
  77. package/dist/legacy/StepNavigation/DefaultNavigation/Step/Step.js.map +1 -1
  78. package/dist/legacy/StepNavigation/DefaultNavigation/utils.js +3 -2
  79. package/dist/legacy/StepNavigation/DefaultNavigation/utils.js.map +1 -1
  80. package/dist/legacy/StepNavigation/SimpleNavigation/Dot/Dot.js +4 -7
  81. package/dist/legacy/StepNavigation/SimpleNavigation/Dot/Dot.js.map +1 -1
  82. package/dist/legacy/StepNavigation/SimpleNavigation/SimpleNavigation.d.ts +3 -1
  83. package/dist/legacy/StepNavigation/SimpleNavigation/SimpleNavigation.js +3 -9
  84. package/dist/legacy/StepNavigation/SimpleNavigation/SimpleNavigation.js.map +1 -1
  85. package/dist/legacy/StepNavigation/SimpleNavigation/utils.js +9 -5
  86. package/dist/legacy/StepNavigation/SimpleNavigation/utils.js.map +1 -1
  87. package/dist/legacy/StepNavigation/StepNavigation.js +5 -5
  88. package/dist/legacy/StepNavigation/StepNavigation.js.map +1 -1
  89. package/dist/legacy/Table/TableBody/TableBody.d.ts +4 -0
  90. package/dist/legacy/Wizard/Wizard.d.ts +63 -0
  91. package/dist/legacy/Wizard/Wizard.js +211 -0
  92. package/dist/legacy/Wizard/Wizard.js.map +1 -0
  93. package/dist/legacy/Wizard/WizardActions/WizardActions.d.ts +61 -0
  94. package/dist/legacy/Wizard/WizardActions/WizardActions.js +226 -0
  95. package/dist/legacy/Wizard/WizardActions/WizardActions.js.map +1 -0
  96. package/dist/legacy/Wizard/WizardActions/index.d.ts +2 -0
  97. package/dist/legacy/Wizard/WizardActions/index.js +2 -0
  98. package/dist/legacy/Wizard/WizardActions/index.js.map +1 -0
  99. package/dist/legacy/Wizard/WizardActions/styles.js +22 -0
  100. package/dist/legacy/Wizard/WizardActions/styles.js.map +1 -0
  101. package/dist/legacy/Wizard/WizardContainer/WizardContainer.d.ts +28 -0
  102. package/dist/legacy/Wizard/WizardContainer/WizardContainer.js +75 -0
  103. package/dist/legacy/Wizard/WizardContainer/WizardContainer.js.map +1 -0
  104. package/dist/legacy/Wizard/WizardContainer/index.d.ts +2 -0
  105. package/dist/legacy/Wizard/WizardContainer/index.js +2 -0
  106. package/dist/legacy/Wizard/WizardContainer/index.js.map +1 -0
  107. package/dist/legacy/Wizard/WizardContainer/styles.js +15 -0
  108. package/dist/legacy/Wizard/WizardContainer/styles.js.map +1 -0
  109. package/dist/legacy/Wizard/WizardContent/LoadingContainer.js +58 -0
  110. package/dist/legacy/Wizard/WizardContent/LoadingContainer.js.map +1 -0
  111. package/dist/legacy/Wizard/WizardContent/WizardContent.d.ts +28 -0
  112. package/dist/legacy/Wizard/WizardContent/WizardContent.js +129 -0
  113. package/dist/legacy/Wizard/WizardContent/WizardContent.js.map +1 -0
  114. package/dist/legacy/Wizard/WizardContent/index.d.ts +2 -0
  115. package/dist/legacy/Wizard/WizardContent/index.js +2 -0
  116. package/dist/legacy/Wizard/WizardContent/index.js.map +1 -0
  117. package/dist/legacy/Wizard/WizardContent/styles.js +16 -0
  118. package/dist/legacy/Wizard/WizardContent/styles.js.map +1 -0
  119. package/dist/legacy/Wizard/WizardContext/WizardContext.js +12 -0
  120. package/dist/legacy/Wizard/WizardContext/WizardContext.js.map +1 -0
  121. package/dist/legacy/Wizard/WizardContext/index.js +2 -0
  122. package/dist/legacy/Wizard/WizardContext/index.js.map +1 -0
  123. package/dist/legacy/Wizard/WizardTitle/WizardTitle.d.ts +42 -0
  124. package/dist/legacy/Wizard/WizardTitle/WizardTitle.js +198 -0
  125. package/dist/legacy/Wizard/WizardTitle/WizardTitle.js.map +1 -0
  126. package/dist/legacy/Wizard/WizardTitle/index.d.ts +2 -0
  127. package/dist/legacy/Wizard/WizardTitle/index.js +2 -0
  128. package/dist/legacy/Wizard/WizardTitle/index.js.map +1 -0
  129. package/dist/legacy/Wizard/WizardTitle/styles.js +33 -0
  130. package/dist/legacy/Wizard/WizardTitle/styles.js.map +1 -0
  131. package/dist/legacy/Wizard/index.d.ts +2 -0
  132. package/dist/legacy/Wizard/index.js +7 -0
  133. package/dist/legacy/Wizard/index.js.map +1 -0
  134. package/dist/legacy/Wizard/styles.js +8 -0
  135. package/dist/legacy/Wizard/styles.js.map +1 -0
  136. package/dist/legacy/index.d.ts +3 -0
  137. package/dist/legacy/index.js +1 -0
  138. package/dist/legacy/index.js.map +1 -1
  139. package/dist/modern/Controls/Controls.d.ts +2 -10
  140. package/dist/modern/Controls/RightControl/RightControl.d.ts +1 -1
  141. package/dist/modern/StepNavigation/DefaultNavigation/DefaultNavigation.d.ts +3 -1
  142. package/dist/modern/StepNavigation/DefaultNavigation/DefaultNavigation.js +3 -6
  143. package/dist/modern/StepNavigation/DefaultNavigation/DefaultNavigation.js.map +1 -1
  144. package/dist/modern/StepNavigation/DefaultNavigation/Step/Step.d.ts +2 -2
  145. package/dist/modern/StepNavigation/DefaultNavigation/Step/Step.js +2 -2
  146. package/dist/modern/StepNavigation/DefaultNavigation/Step/Step.js.map +1 -1
  147. package/dist/modern/StepNavigation/DefaultNavigation/utils.js +3 -2
  148. package/dist/modern/StepNavigation/DefaultNavigation/utils.js.map +1 -1
  149. package/dist/modern/StepNavigation/SimpleNavigation/Dot/Dot.js +4 -5
  150. package/dist/modern/StepNavigation/SimpleNavigation/Dot/Dot.js.map +1 -1
  151. package/dist/modern/StepNavigation/SimpleNavigation/SimpleNavigation.d.ts +3 -1
  152. package/dist/modern/StepNavigation/SimpleNavigation/SimpleNavigation.js +3 -7
  153. package/dist/modern/StepNavigation/SimpleNavigation/SimpleNavigation.js.map +1 -1
  154. package/dist/modern/StepNavigation/SimpleNavigation/utils.js +7 -5
  155. package/dist/modern/StepNavigation/SimpleNavigation/utils.js.map +1 -1
  156. package/dist/modern/StepNavigation/StepNavigation.js +5 -5
  157. package/dist/modern/StepNavigation/StepNavigation.js.map +1 -1
  158. package/dist/modern/Table/TableBody/TableBody.d.ts +4 -0
  159. package/dist/modern/Wizard/Wizard.d.ts +63 -0
  160. package/dist/modern/Wizard/Wizard.js +198 -0
  161. package/dist/modern/Wizard/Wizard.js.map +1 -0
  162. package/dist/modern/Wizard/WizardActions/WizardActions.d.ts +61 -0
  163. package/dist/modern/Wizard/WizardActions/WizardActions.js +186 -0
  164. package/dist/modern/Wizard/WizardActions/WizardActions.js.map +1 -0
  165. package/dist/modern/Wizard/WizardActions/index.d.ts +2 -0
  166. package/dist/modern/Wizard/WizardActions/index.js +2 -0
  167. package/dist/modern/Wizard/WizardActions/index.js.map +1 -0
  168. package/dist/modern/Wizard/WizardActions/styles.js +20 -0
  169. package/dist/modern/Wizard/WizardActions/styles.js.map +1 -0
  170. package/dist/modern/Wizard/WizardContainer/WizardContainer.d.ts +28 -0
  171. package/dist/modern/Wizard/WizardContainer/WizardContainer.js +77 -0
  172. package/dist/modern/Wizard/WizardContainer/WizardContainer.js.map +1 -0
  173. package/dist/modern/Wizard/WizardContainer/index.d.ts +2 -0
  174. package/dist/modern/Wizard/WizardContainer/index.js +2 -0
  175. package/dist/modern/Wizard/WizardContainer/index.js.map +1 -0
  176. package/dist/modern/Wizard/WizardContainer/styles.js +13 -0
  177. package/dist/modern/Wizard/WizardContainer/styles.js.map +1 -0
  178. package/dist/modern/Wizard/WizardContent/LoadingContainer.js +58 -0
  179. package/dist/modern/Wizard/WizardContent/LoadingContainer.js.map +1 -0
  180. package/dist/modern/Wizard/WizardContent/WizardContent.d.ts +28 -0
  181. package/dist/modern/Wizard/WizardContent/WizardContent.js +119 -0
  182. package/dist/modern/Wizard/WizardContent/WizardContent.js.map +1 -0
  183. package/dist/modern/Wizard/WizardContent/index.d.ts +2 -0
  184. package/dist/modern/Wizard/WizardContent/index.js +2 -0
  185. package/dist/modern/Wizard/WizardContent/index.js.map +1 -0
  186. package/dist/modern/Wizard/WizardContent/styles.js +14 -0
  187. package/dist/modern/Wizard/WizardContent/styles.js.map +1 -0
  188. package/dist/modern/Wizard/WizardContext/WizardContext.js +12 -0
  189. package/dist/modern/Wizard/WizardContext/WizardContext.js.map +1 -0
  190. package/dist/modern/Wizard/WizardContext/index.js +2 -0
  191. package/dist/modern/Wizard/WizardContext/index.js.map +1 -0
  192. package/dist/modern/Wizard/WizardTitle/WizardTitle.d.ts +42 -0
  193. package/dist/modern/Wizard/WizardTitle/WizardTitle.js +182 -0
  194. package/dist/modern/Wizard/WizardTitle/WizardTitle.js.map +1 -0
  195. package/dist/modern/Wizard/WizardTitle/index.d.ts +2 -0
  196. package/dist/modern/Wizard/WizardTitle/index.js +2 -0
  197. package/dist/modern/Wizard/WizardTitle/index.js.map +1 -0
  198. package/dist/modern/Wizard/WizardTitle/styles.js +31 -0
  199. package/dist/modern/Wizard/WizardTitle/styles.js.map +1 -0
  200. package/dist/modern/Wizard/index.d.ts +2 -0
  201. package/dist/modern/Wizard/index.js +7 -0
  202. package/dist/modern/Wizard/index.js.map +1 -0
  203. package/dist/modern/Wizard/styles.js +6 -0
  204. package/dist/modern/Wizard/styles.js.map +1 -0
  205. package/dist/modern/index.d.ts +3 -0
  206. package/dist/modern/index.js +1 -0
  207. package/dist/modern/index.js.map +1 -1
  208. package/package.json +3 -3
@@ -0,0 +1,63 @@
1
+ import * as React from "react";
2
+ import { StandardProps, ModalProps } from "@material-ui/core";
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,238 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.default = void 0;
9
+
10
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
11
+
12
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
13
+
14
+ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
15
+
16
+ var _react = _interopRequireDefault(require("react"));
17
+
18
+ var _propTypes = _interopRequireDefault(require("prop-types"));
19
+
20
+ var _core = require("@material-ui/core");
21
+
22
+ var _WizardContext = _interopRequireDefault(require("./WizardContext"));
23
+
24
+ var _WizardContainer = _interopRequireDefault(require("./WizardContainer"));
25
+
26
+ var _WizardTitle = _interopRequireDefault(require("./WizardTitle"));
27
+
28
+ var _WizardContent = _interopRequireDefault(require("./WizardContent"));
29
+
30
+ var _WizardActions = _interopRequireDefault(require("./WizardActions"));
31
+
32
+ var _styles = _interopRequireDefault(require("./styles"));
33
+
34
+ var _excluded = ["className", "children", "onClose", "onSubmit", "title", "open", "skippable", "loading", "hasSummary", "labels", "fixedHeight", "customStep"];
35
+
36
+ var HvWizard = function HvWizard(_ref) {
37
+ var className = _ref.className,
38
+ children = _ref.children,
39
+ onClose = _ref.onClose,
40
+ onSubmit = _ref.onSubmit,
41
+ title = _ref.title,
42
+ open = _ref.open,
43
+ _ref$skippable = _ref.skippable,
44
+ skippable = _ref$skippable === void 0 ? true : _ref$skippable,
45
+ _ref$loading = _ref.loading,
46
+ loading = _ref$loading === void 0 ? false : _ref$loading,
47
+ _ref$hasSummary = _ref.hasSummary,
48
+ hasSummary = _ref$hasSummary === void 0 ? false : _ref$hasSummary,
49
+ _ref$labels = _ref.labels,
50
+ labels = _ref$labels === void 0 ? {
51
+ cancel: "Cancel",
52
+ next: "Next",
53
+ previous: "Previous",
54
+ skip: "Skip",
55
+ submit: "Submit",
56
+ summary: "Summary"
57
+ } : _ref$labels,
58
+ _ref$fixedHeight = _ref.fixedHeight,
59
+ fixedHeight = _ref$fixedHeight === void 0 ? false : _ref$fixedHeight,
60
+ customStep = _ref.customStep,
61
+ others = (0, _objectWithoutProperties2.default)(_ref, _excluded);
62
+
63
+ var _React$useState = _react.default.useState({}),
64
+ _React$useState2 = (0, _slicedToArray2.default)(_React$useState, 2),
65
+ context = _React$useState2[0],
66
+ setContext = _React$useState2[1];
67
+
68
+ var _React$useState3 = _react.default.useState(0),
69
+ _React$useState4 = (0, _slicedToArray2.default)(_React$useState3, 2),
70
+ tab = _React$useState4[0],
71
+ setTab = _React$useState4[1];
72
+
73
+ var contextValue = _react.default.useMemo(function () {
74
+ return {
75
+ context: context,
76
+ setContext: setContext
77
+ };
78
+ }, [context, setContext]);
79
+
80
+ _react.default.useEffect(function () {
81
+ if (!open) {
82
+ setTab(0);
83
+ }
84
+ }, [open]);
85
+
86
+ var handleClose = _react.default.useCallback(function (evt, reason) {
87
+ if (reason !== "backdropClick") {
88
+ onClose(evt, reason);
89
+ }
90
+ }, [onClose]);
91
+
92
+ return /*#__PURE__*/_react.default.createElement(_WizardContext.default.Provider, {
93
+ value: contextValue
94
+ }, /*#__PURE__*/_react.default.createElement(_WizardContainer.default, (0, _extends2.default)({
95
+ className: className,
96
+ handleClose: handleClose,
97
+ open: open
98
+ }, others), /*#__PURE__*/_react.default.createElement(_WizardTitle.default, {
99
+ title: title,
100
+ hasSummary: hasSummary,
101
+ labels: labels,
102
+ tab: tab,
103
+ changeTab: setTab,
104
+ customStep: customStep
105
+ }), /*#__PURE__*/_react.default.createElement(_WizardContent.default, {
106
+ loading: loading,
107
+ fixedHeight: fixedHeight,
108
+ tab: tab
109
+ }, children), /*#__PURE__*/_react.default.createElement(_WizardActions.default, {
110
+ loading: loading,
111
+ skippable: skippable,
112
+ labels: labels,
113
+ tab: tab,
114
+ changeTab: setTab,
115
+ handleClose: handleClose,
116
+ onSubmit: onSubmit
117
+ })));
118
+ };
119
+
120
+ process.env.NODE_ENV !== "production" ? HvWizard.propTypes = {
121
+ /**
122
+ * Class names to be applied.
123
+ */
124
+ className: _propTypes.default.string,
125
+
126
+ /**
127
+ * Current state of the Wizard.
128
+ */
129
+ open: _propTypes.default.bool.isRequired,
130
+
131
+ /**
132
+ * Function executed on close.
133
+ */
134
+ onClose: _propTypes.default.func.isRequired,
135
+
136
+ /**
137
+ * Function executed on submit.
138
+ */
139
+ onSubmit: _propTypes.default.func.isRequired,
140
+
141
+ /**
142
+ * Enables the skip button.
143
+ */
144
+ skippable: _propTypes.default.bool,
145
+
146
+ /**
147
+ * Title for the wizard.
148
+ */
149
+ title: _propTypes.default.string,
150
+
151
+ /**
152
+ * Shows the summary button.
153
+ */
154
+ hasSummary: _propTypes.default.bool,
155
+
156
+ /**
157
+ * The content of the component.
158
+ */
159
+ children: _propTypes.default.node,
160
+
161
+ /**
162
+ * An object containing all the labels for the wizard.
163
+ */
164
+ labels: _propTypes.default.shape({
165
+ /**
166
+ * Cancel button label.
167
+ */
168
+ cancel: _propTypes.default.string,
169
+
170
+ /**
171
+ * Skip button label.
172
+ */
173
+ skip: _propTypes.default.string,
174
+
175
+ /**
176
+ * Previous button label.
177
+ */
178
+ previous: _propTypes.default.string,
179
+
180
+ /**
181
+ * Next button label.
182
+ */
183
+ next: _propTypes.default.string,
184
+
185
+ /**
186
+ * Submit button label.
187
+ */
188
+ submit: _propTypes.default.string,
189
+
190
+ /**
191
+ * Summary button label.
192
+ */
193
+ summary: _propTypes.default.string
194
+ }),
195
+
196
+ /**
197
+ * Forces minimum height to the component.
198
+ */
199
+ fixedHeight: _propTypes.default.bool,
200
+
201
+ /**
202
+ * Whether the loading animation is shown.
203
+ */
204
+ loading: _propTypes.default.bool,
205
+
206
+ /**
207
+ * Custom object to define type, size and width of the StepNavigation component
208
+ */
209
+ customStep: _propTypes.default.shape({
210
+ /**
211
+ * Type of step navigation. Values = {"Simple", "Default"}.
212
+ */
213
+ type: _propTypes.default.oneOf(["Simple", "Default"]),
214
+
215
+ /**
216
+ * Sets one of the standard sizes of the steps. Values = {"XS", "SM", "MD", "LG", "XL"}
217
+ */
218
+ stepSize: _propTypes.default.oneOf(["XS", "SM", "MD", "LG", "XL"]),
219
+
220
+ /**
221
+ * Width of the component element on each breakpoint screen resolution.
222
+ */
223
+ width: _propTypes.default.shape({
224
+ xs: _propTypes.default.number,
225
+ sm: _propTypes.default.number,
226
+ md: _propTypes.default.number,
227
+ lg: _propTypes.default.number,
228
+ xl: _propTypes.default.number
229
+ })
230
+ })
231
+ } : void 0;
232
+
233
+ var _default = (0, _core.withStyles)(_styles.default, {
234
+ name: "HvWizard"
235
+ })(HvWizard);
236
+
237
+ exports.default = _default;
238
+ //# 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 \"@material-ui/core\";\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,IAeI,QAfJA,IAeI;EAAA,0BAdJC,SAcI;EAAA,IAdJA,SAcI,+BAdQ,IAcR;EAAA,wBAbJC,OAaI;EAAA,IAbJA,OAaI,6BAbM,KAaN;EAAA,2BAZJC,UAYI;EAAA,IAZJA,UAYI,gCAZS,KAYT;EAAA,uBAXJC,MAWI;EAAA,IAXJA,MAWI,4BAXK;IACPC,MAAM,EAAE,QADD;IAEPC,IAAI,EAAE,MAFC;IAGPC,QAAQ,EAAE,UAHH;IAIPC,IAAI,EAAE,MAJC;IAKPC,MAAM,EAAE,QALD;IAMPC,OAAO,EAAE;EANF,CAWL;EAAA,4BAHJC,WAGI;EAAA,IAHJA,WAGI,iCAHU,KAGV;EAAA,IAFJC,UAEI,QAFJA,UAEI;EAAA,IADDC,MACC;;EACJ,sBAA8BC,cAAA,CAAMC,QAAN,CAAe,EAAf,CAA9B;EA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jEJ;;EAkEnB;AACF;AACA;EACE5B,OAAO,EAAE0B,kBAAA,CAAUE,IArEA;;EAsEnB;AACF;AACA;EACElB,UAAU,EAAEgB,kBAAA,CAAUM,KAAV,CAAgB;IAC1B;AACJ;AACA;IACIC,IAAI,EAAEP,kBAAA,CAAUQ,KAAV,CAAgB,CAAC,QAAD,EAAW,SAAX,CAAhB,CAJoB;;IAK1B;AACJ;AACA;IACIC,QAAQ,EAAET,kBAAA,CAAUQ,KAAV,CAAgB,CAAC,IAAD,EAAO,IAAP,EAAa,IAAb,EAAmB,IAAnB,EAAyB,IAAzB,CAAhB,CARgB;;IAS1B;AACJ;AACA;IACIE,KAAK,EAAEV,kBAAA,CAAUM,KAAV,CAAgB;MACrBK,EAAE,EAAEX,kBAAA,CAAUY,MADO;MAErBC,EAAE,EAAEb,kBAAA,CAAUY,MAFO;MAGrBE,EAAE,EAAEd,kBAAA,CAAUY,MAHO;MAIrBG,EAAE,EAAEf,kBAAA,CAAUY,MAJO;MAKrBI,EAAE,EAAEhB,kBAAA,CAAUY;IALO,CAAhB;EAZmB,CAAhB;AAzEO,CAArB;;eA+Fe,IAAAK,gBAAA,EAAWC,eAAX,EAAmB;EAAEC,IAAI,EAAE;AAAR,CAAnB,EAAyCrD,QAAzC,C"}
@@ -0,0 +1,61 @@
1
+ import * as React from "react";
2
+ import { ModalProps, StandardProps } from "@material-ui/core";
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,259 @@
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 _core = require("@material-ui/core");
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 _styles = _interopRequireDefault(require("./styles"));
47
+
48
+ var _Backwards, _Forwards;
49
+
50
+ 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; }
51
+
52
+ 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; }
53
+
54
+ var HvWizardActions = function HvWizardActions(_ref) {
55
+ var _labels$cancel, _labels$skip, _labels$previous, _labels$submit, _context$tab, _labels$next;
56
+
57
+ var classes = _ref.classes,
58
+ handleClose = _ref.handleClose,
59
+ onSubmit = _ref.onSubmit,
60
+ changeTab = _ref.changeTab,
61
+ tab = _ref.tab,
62
+ _ref$loading = _ref.loading,
63
+ loading = _ref$loading === void 0 ? false : _ref$loading,
64
+ _ref$skippable = _ref.skippable,
65
+ skippable = _ref$skippable === void 0 ? false : _ref$skippable,
66
+ _ref$labels = _ref.labels,
67
+ labels = _ref$labels === void 0 ? {
68
+ cancel: "Cancel",
69
+ next: "Next",
70
+ previous: "Previous",
71
+ skip: "Skip",
72
+ submit: "Submit"
73
+ } : _ref$labels;
74
+
75
+ var _React$useContext = _react.default.useContext(_WizardContext.default),
76
+ context = _React$useContext.context,
77
+ setContext = _React$useContext.setContext;
78
+
79
+ var _React$useState = _react.default.useState(0),
80
+ _React$useState2 = (0, _slicedToArray2.default)(_React$useState, 2),
81
+ pages = _React$useState2[0],
82
+ setPages = _React$useState2[1];
83
+
84
+ var _React$useState3 = _react.default.useState(false),
85
+ _React$useState4 = (0, _slicedToArray2.default)(_React$useState3, 2),
86
+ canSubmit = _React$useState4[0],
87
+ setCanSubmit = _React$useState4[1];
88
+
89
+ _react.default.useEffect(function () {
90
+ var contextEntries = Object.entries(context);
91
+
92
+ if (contextEntries.length) {
93
+ setPages(contextEntries.length);
94
+ var validWizard = Object.entries(context).every(function (_ref2) {
95
+ var _ref3 = (0, _slicedToArray2.default)(_ref2, 2),
96
+ value = _ref3[1];
97
+
98
+ return value.valid;
99
+ });
100
+
101
+ if (validWizard !== canSubmit) {
102
+ setCanSubmit(validWizard);
103
+ }
104
+ }
105
+ }, [context]); // eslint-disable-line react-hooks/exhaustive-deps
106
+
107
+
108
+ var lastPage = pages - 1;
109
+ var isLastPage = tab >= lastPage;
110
+
111
+ var handleSkip = _react.default.useCallback(function () {
112
+ var skippedContext = Object.entries(context).map(function (_ref4) {
113
+ var _ref5 = (0, _slicedToArray2.default)(_ref4, 2),
114
+ child = _ref5[1];
115
+
116
+ return _objectSpread(_objectSpread({}, child), {}, {
117
+ valid: child.valid !== false
118
+ });
119
+ });
120
+ setContext(skippedContext);
121
+ changeTab(lastPage);
122
+ }, [changeTab, context, lastPage, setContext]);
123
+
124
+ var handleSubmit = _react.default.useCallback(function () {
125
+ return onSubmit(context);
126
+ }, [onSubmit, context]);
127
+
128
+ return /*#__PURE__*/_react.default.createElement(_uikitReactCore.HvDialogActions, {
129
+ className: classes.actionsContainer
130
+ }, /*#__PURE__*/_react.default.createElement(_uikitReactCore.HvGrid, null, /*#__PURE__*/_react.default.createElement(_uikitReactCore.HvButton, {
131
+ category: "ghost",
132
+ onClick: handleClose,
133
+ className: classes.buttonWidth
134
+ }, "".concat((_labels$cancel = labels.cancel) !== null && _labels$cancel !== void 0 ? _labels$cancel : "Cancel")), /*#__PURE__*/_react.default.createElement(_uikitReactCore.HvButton, {
135
+ category: "ghost",
136
+ disabled: isLastPage || !skippable,
137
+ className: classes.buttonWidth,
138
+ onClick: handleSkip
139
+ }, "".concat((_labels$skip = labels.skip) !== null && _labels$skip !== void 0 ? _labels$skip : "Skip"))), /*#__PURE__*/_react.default.createElement(_uikitReactCore.HvGrid, {
140
+ className: classes.buttonsContainer
141
+ }, /*#__PURE__*/_react.default.createElement(_uikitReactCore.HvButton, {
142
+ category: "ghost",
143
+ className: classes.buttonWidth,
144
+ disabled: tab <= 0,
145
+ onClick: function onClick() {
146
+ return changeTab(function (t) {
147
+ return t - 1;
148
+ });
149
+ }
150
+ }, _Backwards || (_Backwards = /*#__PURE__*/_react.default.createElement(_uikitReactIcons.Backwards, null)), "".concat((_labels$previous = labels.previous) !== null && _labels$previous !== void 0 ? _labels$previous : "Previous")), isLastPage ? /*#__PURE__*/_react.default.createElement(_uikitReactCore.HvButton, {
151
+ category: "primary",
152
+ className: classes.buttonWidth,
153
+ disabled: loading || !canSubmit,
154
+ onClick: handleSubmit
155
+ }, "".concat((_labels$submit = labels.submit) !== null && _labels$submit !== void 0 ? _labels$submit : "Submit")) : /*#__PURE__*/_react.default.createElement(_uikitReactCore.HvButton, {
156
+ category: "ghost",
157
+ className: (0, _clsx.default)(classes.buttonWidth, classes.buttonSpacing),
158
+ onClick: function onClick() {
159
+ return changeTab(function (t) {
160
+ return t + 1;
161
+ });
162
+ },
163
+ disabled: !skippable && !(context !== null && context !== void 0 && (_context$tab = context[tab]) !== null && _context$tab !== void 0 && _context$tab.valid)
164
+ }, "".concat((_labels$next = labels.next) !== null && _labels$next !== void 0 ? _labels$next : "Next"), _Forwards || (_Forwards = /*#__PURE__*/_react.default.createElement(_uikitReactIcons.Forwards, null)))));
165
+ };
166
+
167
+ process.env.NODE_ENV !== "production" ? HvWizardActions.propTypes = {
168
+ /**
169
+ * A Jss Object used to override or extend the styles applied.
170
+ */
171
+ classes: _propTypes.default.shape({
172
+ /**
173
+ * Styles applied to the component which contains the groups of buttons.
174
+ */
175
+ actionsContainer: _propTypes.default.string,
176
+
177
+ /**
178
+ * Styles applied to the component which contains the buttons.
179
+ */
180
+ buttonsContainer: _propTypes.default.string,
181
+
182
+ /**
183
+ * Styles applied to the Button component to override its width.
184
+ */
185
+ buttonWidth: _propTypes.default.string,
186
+
187
+ /**
188
+ * Styles applied to some Button components to override its left padding.
189
+ */
190
+ buttonSpacing: _propTypes.default.string
191
+ }).isRequired,
192
+
193
+ /**
194
+ * Current tab to check if it's last page or first to disable previous button and swap between next and submit button.
195
+ */
196
+ tab: _propTypes.default.number.isRequired,
197
+
198
+ /**
199
+ * Function to change the tab when pressing previous and next buttons.
200
+ */
201
+ changeTab: _propTypes.default.func.isRequired,
202
+
203
+ /**
204
+ * Function to handle the cancel button.
205
+ */
206
+ handleClose: _propTypes.default.func.isRequired,
207
+
208
+ /**
209
+ * Function to handle the submit button. Also sends the current context state.
210
+ */
211
+ onSubmit: _propTypes.default.func.isRequired,
212
+
213
+ /**
214
+ * An object containing all the labels for the wizard actions component.
215
+ */
216
+ labels: _propTypes.default.shape({
217
+ /**
218
+ * Cancel button label.
219
+ */
220
+ cancel: _propTypes.default.string,
221
+
222
+ /**
223
+ * Skip button label.
224
+ */
225
+ skip: _propTypes.default.string,
226
+
227
+ /**
228
+ * Previous button label.
229
+ */
230
+ previous: _propTypes.default.string,
231
+
232
+ /**
233
+ * Next button label.
234
+ */
235
+ next: _propTypes.default.string,
236
+
237
+ /**
238
+ * Submit button label.
239
+ */
240
+ submit: _propTypes.default.string
241
+ }),
242
+
243
+ /**
244
+ * Whether the submit button is disabled.
245
+ */
246
+ loading: _propTypes.default.bool,
247
+
248
+ /**
249
+ * Enables the skip button.
250
+ */
251
+ skippable: _propTypes.default.bool
252
+ } : void 0;
253
+
254
+ var _default = (0, _core.withStyles)(_styles.default, {
255
+ name: "HvWizardActions"
256
+ })(HvWizardActions);
257
+
258
+ exports.default = _default;
259
+ //# sourceMappingURL=WizardActions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WizardActions.js","names":["HvWizardActions","classes","handleClose","onSubmit","changeTab","tab","loading","skippable","labels","cancel","next","previous","skip","submit","React","useContext","WizardContext","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","clsx","buttonSpacing","propTypes","PropTypes","shape","string","isRequired","number","func","bool","withStyles","styles","name"],"sources":["../../../src/Wizard/WizardActions/WizardActions.js"],"sourcesContent":["import React from \"react\";\nimport PropTypes from \"prop-types\";\nimport { withStyles } from \"@material-ui/core\";\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;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA;;;;;;;;AAEA,IAAMA,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,wBAAgCC,cAAA,CAAMC,UAAN,CAAiBC,sBAAjB,CAAhC;EAAA,IAAQC,OAAR,qBAAQA,OAAR;EAAA,IAAiBC,UAAjB,qBAAiBA,UAAjB;;EACA,sBAA0BJ,cAAA,CAAMK,QAAN,CAAe,CAAf,CAA1B;EAAA;EAAA,IAAOC,KAAP;E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;AACJ;AACA;IACIvC,QAAQ,EAAEqC,kBAAA,CAAUE,MAZE;;IAatB;AACJ;AACA;IACIxC,IAAI,EAAEsC,kBAAA,CAAUE,MAhBM;;IAiBtB;AACJ;AACA;IACIrC,MAAM,EAAEmC,kBAAA,CAAUE;EApBI,CAAhB,CAzCkB;;EA+D1B;AACF;AACA;EACE5C,OAAO,EAAE0C,kBAAA,CAAUM,IAlEO;;EAmE1B;AACF;AACA;EACE/C,SAAS,EAAEyC,kBAAA,CAAUM;AAtEK,CAA5B;;eAyEe,IAAAC,gBAAA,EAAWC,eAAX,EAAmB;EAAEC,IAAI,EAAE;AAAR,CAAnB,EAAgDzD,eAAhD,C"}
@@ -0,0 +1,2 @@
1
+ export { default } from "./WizardActions";
2
+ export * from "./WizardActions";
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ Object.defineProperty(exports, "default", {
9
+ enumerable: true,
10
+ get: function get() {
11
+ return _WizardActions.default;
12
+ }
13
+ });
14
+
15
+ var _WizardActions = _interopRequireDefault(require("./WizardActions"));
16
+ //# sourceMappingURL=index.js.map