@dnb/eufemia 10.69.0 → 10.69.1

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 (276) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/cjs/components/global-error/GlobalError.d.ts +1 -1
  3. package/cjs/components/global-error/GlobalError.js +1 -1
  4. package/cjs/components/global-error/GlobalError.js.map +1 -1
  5. package/cjs/components/global-error/GlobalErrorDocs.d.ts +2 -0
  6. package/cjs/components/global-error/GlobalErrorDocs.js +64 -0
  7. package/cjs/components/global-error/GlobalErrorDocs.js.map +1 -0
  8. package/cjs/components/info-card/InfoCardDocs.d.ts +3 -0
  9. package/cjs/components/info-card/InfoCardDocs.js +101 -0
  10. package/cjs/components/info-card/InfoCardDocs.js.map +1 -0
  11. package/cjs/components/tabs/Tabs.js +2 -2
  12. package/cjs/components/tabs/Tabs.js.map +1 -1
  13. package/cjs/components/upload/UploadFileList.js +2 -3
  14. package/cjs/components/upload/UploadFileList.js.map +1 -1
  15. package/cjs/extensions/forms/DataContext/Context.d.ts +2 -2
  16. package/cjs/extensions/forms/DataContext/Context.js.map +1 -1
  17. package/cjs/extensions/forms/DataContext/FieldBoundary/FieldBoundaryProvider.js +4 -4
  18. package/cjs/extensions/forms/DataContext/FieldBoundary/FieldBoundaryProvider.js.map +1 -1
  19. package/cjs/extensions/forms/DataContext/Provider/Provider.js +35 -41
  20. package/cjs/extensions/forms/DataContext/Provider/Provider.js.map +1 -1
  21. package/cjs/extensions/forms/Field/Provider/useFieldProvider.d.ts +3 -3
  22. package/cjs/extensions/forms/FieldBlock/FieldBlock.js +2 -2
  23. package/cjs/extensions/forms/FieldBlock/FieldBlock.js.map +1 -1
  24. package/cjs/extensions/forms/FieldBlock/FieldBlockContext.d.ts +1 -1
  25. package/cjs/extensions/forms/FieldBlock/FieldBlockContext.js.map +1 -1
  26. package/cjs/extensions/forms/Form/Isolation/Isolation.js +3 -4
  27. package/cjs/extensions/forms/Form/Isolation/Isolation.js.map +1 -1
  28. package/cjs/extensions/forms/Form/Visibility/Visibility.d.ts +1 -10
  29. package/cjs/extensions/forms/Form/Visibility/Visibility.js +1 -0
  30. package/cjs/extensions/forms/Form/Visibility/Visibility.js.map +1 -1
  31. package/cjs/extensions/forms/Form/Visibility/VisibilityContext.d.ts +2 -1
  32. package/cjs/extensions/forms/Form/Visibility/VisibilityContext.js.map +1 -1
  33. package/cjs/extensions/forms/Form/Visibility/useVisibility.js +1 -1
  34. package/cjs/extensions/forms/Form/Visibility/useVisibility.js.map +1 -1
  35. package/cjs/extensions/forms/Iterate/Array/ArrayItemArea.d.ts +3 -2
  36. package/cjs/extensions/forms/Iterate/Array/ArrayItemArea.js.map +1 -1
  37. package/cjs/extensions/forms/Iterate/EditContainer/CancelButton.js +5 -2
  38. package/cjs/extensions/forms/Iterate/EditContainer/CancelButton.js.map +1 -1
  39. package/cjs/extensions/forms/Iterate/EditContainer/DoneButton.js +1 -1
  40. package/cjs/extensions/forms/Iterate/EditContainer/DoneButton.js.map +1 -1
  41. package/cjs/extensions/forms/Iterate/EditContainer/EditContainer.d.ts +2 -2
  42. package/cjs/extensions/forms/Iterate/EditContainer/EditContainer.js.map +1 -1
  43. package/cjs/extensions/forms/Iterate/PushContainer/OpenButton.js +1 -1
  44. package/cjs/extensions/forms/Iterate/PushContainer/OpenButton.js.map +1 -1
  45. package/cjs/extensions/forms/Iterate/PushContainer/PushContainer.js +9 -2
  46. package/cjs/extensions/forms/Iterate/PushContainer/PushContainer.js.map +1 -1
  47. package/cjs/extensions/forms/Iterate/ViewContainer/EditButton.js +1 -1
  48. package/cjs/extensions/forms/Iterate/ViewContainer/EditButton.js.map +1 -1
  49. package/cjs/extensions/forms/Iterate/ViewContainer/ViewContainer.d.ts +1 -1
  50. package/cjs/extensions/forms/Iterate/ViewContainer/ViewContainer.js.map +1 -1
  51. package/cjs/extensions/forms/Wizard/Buttons/Buttons.js +2 -2
  52. package/cjs/extensions/forms/Wizard/Buttons/Buttons.js.map +1 -1
  53. package/cjs/extensions/forms/Wizard/Container/DisplaySteps.js +6 -5
  54. package/cjs/extensions/forms/Wizard/Container/DisplaySteps.js.map +1 -1
  55. package/cjs/extensions/forms/Wizard/Container/IterateOverSteps.d.ts +4 -3
  56. package/cjs/extensions/forms/Wizard/Container/IterateOverSteps.js +36 -35
  57. package/cjs/extensions/forms/Wizard/Container/IterateOverSteps.js.map +1 -1
  58. package/cjs/extensions/forms/Wizard/Container/WizardContainer.js +104 -57
  59. package/cjs/extensions/forms/Wizard/Container/WizardContainer.js.map +1 -1
  60. package/cjs/extensions/forms/Wizard/Container/useCollectStepsData.d.ts +10 -0
  61. package/cjs/extensions/forms/Wizard/Container/useCollectStepsData.js +66 -0
  62. package/cjs/extensions/forms/Wizard/Container/useCollectStepsData.js.map +1 -0
  63. package/cjs/extensions/forms/Wizard/Context/WizardContext.d.ts +17 -4
  64. package/cjs/extensions/forms/Wizard/Context/WizardContext.js.map +1 -1
  65. package/cjs/extensions/forms/Wizard/Context/types.d.ts +9 -6
  66. package/cjs/extensions/forms/Wizard/Context/types.js.map +1 -1
  67. package/cjs/extensions/forms/Wizard/Step/Step.d.ts +1 -1
  68. package/cjs/extensions/forms/Wizard/Step/Step.js +65 -22
  69. package/cjs/extensions/forms/Wizard/Step/Step.js.map +1 -1
  70. package/cjs/extensions/forms/Wizard/Step/StepDocs.js +2 -2
  71. package/cjs/extensions/forms/Wizard/Step/StepDocs.js.map +1 -1
  72. package/cjs/extensions/forms/Wizard/hooks/useStep.js +10 -18
  73. package/cjs/extensions/forms/Wizard/hooks/useStep.js.map +1 -1
  74. package/cjs/extensions/forms/hooks/useFieldProps.js +16 -8
  75. package/cjs/extensions/forms/hooks/useFieldProps.js.map +1 -1
  76. package/cjs/extensions/forms/hooks/useValueProps.js +1 -1
  77. package/cjs/extensions/forms/hooks/useValueProps.js.map +1 -1
  78. package/cjs/shared/Eufemia.d.ts +1 -1
  79. package/cjs/shared/Eufemia.js +2 -2
  80. package/cjs/shared/Eufemia.js.map +1 -1
  81. package/cjs/shared/component-helper.js +1 -1
  82. package/cjs/shared/component-helper.js.map +1 -1
  83. package/cjs/style/core/scopes.scss +1 -1
  84. package/cjs/style/dnb-ui-basis.css +1 -1
  85. package/cjs/style/dnb-ui-basis.min.css +1 -1
  86. package/cjs/style/dnb-ui-body.css +1 -1
  87. package/cjs/style/dnb-ui-body.min.css +1 -1
  88. package/cjs/style/dnb-ui-core.css +1 -1
  89. package/cjs/style/dnb-ui-core.min.css +1 -1
  90. package/components/global-error/GlobalError.d.ts +1 -1
  91. package/components/global-error/GlobalError.js +1 -1
  92. package/components/global-error/GlobalError.js.map +1 -1
  93. package/components/global-error/GlobalErrorDocs.d.ts +2 -0
  94. package/components/global-error/GlobalErrorDocs.js +58 -0
  95. package/components/global-error/GlobalErrorDocs.js.map +1 -0
  96. package/components/info-card/InfoCardDocs.d.ts +3 -0
  97. package/components/info-card/InfoCardDocs.js +95 -0
  98. package/components/info-card/InfoCardDocs.js.map +1 -0
  99. package/components/tabs/Tabs.js +2 -2
  100. package/components/tabs/Tabs.js.map +1 -1
  101. package/components/upload/UploadFileList.js +2 -3
  102. package/components/upload/UploadFileList.js.map +1 -1
  103. package/es/components/global-error/GlobalError.d.ts +1 -1
  104. package/es/components/global-error/GlobalError.js +1 -1
  105. package/es/components/global-error/GlobalError.js.map +1 -1
  106. package/es/components/global-error/GlobalErrorDocs.d.ts +2 -0
  107. package/es/components/global-error/GlobalErrorDocs.js +58 -0
  108. package/es/components/global-error/GlobalErrorDocs.js.map +1 -0
  109. package/es/components/info-card/InfoCardDocs.d.ts +3 -0
  110. package/es/components/info-card/InfoCardDocs.js +95 -0
  111. package/es/components/info-card/InfoCardDocs.js.map +1 -0
  112. package/es/components/tabs/Tabs.js +2 -2
  113. package/es/components/tabs/Tabs.js.map +1 -1
  114. package/es/components/upload/UploadFileList.js +2 -3
  115. package/es/components/upload/UploadFileList.js.map +1 -1
  116. package/es/extensions/forms/DataContext/Context.d.ts +2 -2
  117. package/es/extensions/forms/DataContext/Context.js.map +1 -1
  118. package/es/extensions/forms/DataContext/FieldBoundary/FieldBoundaryProvider.js +4 -4
  119. package/es/extensions/forms/DataContext/FieldBoundary/FieldBoundaryProvider.js.map +1 -1
  120. package/es/extensions/forms/DataContext/Provider/Provider.js +21 -29
  121. package/es/extensions/forms/DataContext/Provider/Provider.js.map +1 -1
  122. package/es/extensions/forms/Field/Provider/useFieldProvider.d.ts +3 -3
  123. package/es/extensions/forms/FieldBlock/FieldBlock.js +2 -2
  124. package/es/extensions/forms/FieldBlock/FieldBlock.js.map +1 -1
  125. package/es/extensions/forms/FieldBlock/FieldBlockContext.d.ts +1 -1
  126. package/es/extensions/forms/FieldBlock/FieldBlockContext.js.map +1 -1
  127. package/es/extensions/forms/Form/Isolation/Isolation.js +3 -4
  128. package/es/extensions/forms/Form/Isolation/Isolation.js.map +1 -1
  129. package/es/extensions/forms/Form/Visibility/Visibility.d.ts +1 -10
  130. package/es/extensions/forms/Form/Visibility/Visibility.js +1 -0
  131. package/es/extensions/forms/Form/Visibility/Visibility.js.map +1 -1
  132. package/es/extensions/forms/Form/Visibility/VisibilityContext.d.ts +2 -1
  133. package/es/extensions/forms/Form/Visibility/VisibilityContext.js.map +1 -1
  134. package/es/extensions/forms/Form/Visibility/useVisibility.js +1 -1
  135. package/es/extensions/forms/Form/Visibility/useVisibility.js.map +1 -1
  136. package/es/extensions/forms/Iterate/Array/ArrayItemArea.d.ts +3 -2
  137. package/es/extensions/forms/Iterate/Array/ArrayItemArea.js.map +1 -1
  138. package/es/extensions/forms/Iterate/EditContainer/CancelButton.js +5 -2
  139. package/es/extensions/forms/Iterate/EditContainer/CancelButton.js.map +1 -1
  140. package/es/extensions/forms/Iterate/EditContainer/DoneButton.js +1 -1
  141. package/es/extensions/forms/Iterate/EditContainer/DoneButton.js.map +1 -1
  142. package/es/extensions/forms/Iterate/EditContainer/EditContainer.d.ts +2 -2
  143. package/es/extensions/forms/Iterate/EditContainer/EditContainer.js.map +1 -1
  144. package/es/extensions/forms/Iterate/PushContainer/OpenButton.js +1 -1
  145. package/es/extensions/forms/Iterate/PushContainer/OpenButton.js.map +1 -1
  146. package/es/extensions/forms/Iterate/PushContainer/PushContainer.js +9 -2
  147. package/es/extensions/forms/Iterate/PushContainer/PushContainer.js.map +1 -1
  148. package/es/extensions/forms/Iterate/ViewContainer/EditButton.js +1 -1
  149. package/es/extensions/forms/Iterate/ViewContainer/EditButton.js.map +1 -1
  150. package/es/extensions/forms/Iterate/ViewContainer/ViewContainer.d.ts +1 -1
  151. package/es/extensions/forms/Iterate/ViewContainer/ViewContainer.js.map +1 -1
  152. package/es/extensions/forms/Wizard/Buttons/Buttons.js +2 -2
  153. package/es/extensions/forms/Wizard/Buttons/Buttons.js.map +1 -1
  154. package/es/extensions/forms/Wizard/Container/DisplaySteps.js +6 -5
  155. package/es/extensions/forms/Wizard/Container/DisplaySteps.js.map +1 -1
  156. package/es/extensions/forms/Wizard/Container/IterateOverSteps.d.ts +4 -3
  157. package/es/extensions/forms/Wizard/Container/IterateOverSteps.js +35 -34
  158. package/es/extensions/forms/Wizard/Container/IterateOverSteps.js.map +1 -1
  159. package/es/extensions/forms/Wizard/Container/WizardContainer.js +101 -58
  160. package/es/extensions/forms/Wizard/Container/WizardContainer.js.map +1 -1
  161. package/es/extensions/forms/Wizard/Container/useCollectStepsData.d.ts +10 -0
  162. package/es/extensions/forms/Wizard/Container/useCollectStepsData.js +59 -0
  163. package/es/extensions/forms/Wizard/Container/useCollectStepsData.js.map +1 -0
  164. package/es/extensions/forms/Wizard/Context/WizardContext.d.ts +17 -4
  165. package/es/extensions/forms/Wizard/Context/WizardContext.js.map +1 -1
  166. package/es/extensions/forms/Wizard/Context/types.d.ts +9 -6
  167. package/es/extensions/forms/Wizard/Context/types.js.map +1 -1
  168. package/es/extensions/forms/Wizard/Step/Step.d.ts +1 -1
  169. package/es/extensions/forms/Wizard/Step/Step.js +64 -22
  170. package/es/extensions/forms/Wizard/Step/Step.js.map +1 -1
  171. package/es/extensions/forms/Wizard/Step/StepDocs.js +2 -2
  172. package/es/extensions/forms/Wizard/Step/StepDocs.js.map +1 -1
  173. package/es/extensions/forms/Wizard/hooks/useStep.js +10 -18
  174. package/es/extensions/forms/Wizard/hooks/useStep.js.map +1 -1
  175. package/es/extensions/forms/hooks/useFieldProps.js +16 -8
  176. package/es/extensions/forms/hooks/useFieldProps.js.map +1 -1
  177. package/es/extensions/forms/hooks/useValueProps.js +1 -1
  178. package/es/extensions/forms/hooks/useValueProps.js.map +1 -1
  179. package/es/shared/Eufemia.d.ts +1 -1
  180. package/es/shared/Eufemia.js +2 -2
  181. package/es/shared/Eufemia.js.map +1 -1
  182. package/es/shared/component-helper.js +1 -1
  183. package/es/shared/component-helper.js.map +1 -1
  184. package/es/style/core/scopes.scss +1 -1
  185. package/es/style/dnb-ui-basis.css +1 -1
  186. package/es/style/dnb-ui-basis.min.css +1 -1
  187. package/es/style/dnb-ui-body.css +1 -1
  188. package/es/style/dnb-ui-body.min.css +1 -1
  189. package/es/style/dnb-ui-core.css +1 -1
  190. package/es/style/dnb-ui-core.min.css +1 -1
  191. package/esm/dnb-ui-basis.min.mjs +1 -1
  192. package/esm/dnb-ui-components.min.mjs +1 -1
  193. package/esm/dnb-ui-elements.min.mjs +1 -1
  194. package/esm/dnb-ui-extensions.min.mjs +1 -1
  195. package/esm/dnb-ui-lib.min.mjs +1 -1
  196. package/extensions/forms/DataContext/Context.d.ts +2 -2
  197. package/extensions/forms/DataContext/Context.js.map +1 -1
  198. package/extensions/forms/DataContext/FieldBoundary/FieldBoundaryProvider.js +4 -4
  199. package/extensions/forms/DataContext/FieldBoundary/FieldBoundaryProvider.js.map +1 -1
  200. package/extensions/forms/DataContext/Provider/Provider.js +35 -41
  201. package/extensions/forms/DataContext/Provider/Provider.js.map +1 -1
  202. package/extensions/forms/Field/Provider/useFieldProvider.d.ts +3 -3
  203. package/extensions/forms/FieldBlock/FieldBlock.js +2 -2
  204. package/extensions/forms/FieldBlock/FieldBlock.js.map +1 -1
  205. package/extensions/forms/FieldBlock/FieldBlockContext.d.ts +1 -1
  206. package/extensions/forms/FieldBlock/FieldBlockContext.js.map +1 -1
  207. package/extensions/forms/Form/Isolation/Isolation.js +3 -4
  208. package/extensions/forms/Form/Isolation/Isolation.js.map +1 -1
  209. package/extensions/forms/Form/Visibility/Visibility.d.ts +1 -10
  210. package/extensions/forms/Form/Visibility/Visibility.js +1 -0
  211. package/extensions/forms/Form/Visibility/Visibility.js.map +1 -1
  212. package/extensions/forms/Form/Visibility/VisibilityContext.d.ts +2 -1
  213. package/extensions/forms/Form/Visibility/VisibilityContext.js.map +1 -1
  214. package/extensions/forms/Form/Visibility/useVisibility.js +1 -1
  215. package/extensions/forms/Form/Visibility/useVisibility.js.map +1 -1
  216. package/extensions/forms/Iterate/Array/ArrayItemArea.d.ts +3 -2
  217. package/extensions/forms/Iterate/Array/ArrayItemArea.js.map +1 -1
  218. package/extensions/forms/Iterate/EditContainer/CancelButton.js +5 -2
  219. package/extensions/forms/Iterate/EditContainer/CancelButton.js.map +1 -1
  220. package/extensions/forms/Iterate/EditContainer/DoneButton.js +1 -1
  221. package/extensions/forms/Iterate/EditContainer/DoneButton.js.map +1 -1
  222. package/extensions/forms/Iterate/EditContainer/EditContainer.d.ts +2 -2
  223. package/extensions/forms/Iterate/EditContainer/EditContainer.js.map +1 -1
  224. package/extensions/forms/Iterate/PushContainer/OpenButton.js +1 -1
  225. package/extensions/forms/Iterate/PushContainer/OpenButton.js.map +1 -1
  226. package/extensions/forms/Iterate/PushContainer/PushContainer.js +9 -2
  227. package/extensions/forms/Iterate/PushContainer/PushContainer.js.map +1 -1
  228. package/extensions/forms/Iterate/ViewContainer/EditButton.js +1 -1
  229. package/extensions/forms/Iterate/ViewContainer/EditButton.js.map +1 -1
  230. package/extensions/forms/Iterate/ViewContainer/ViewContainer.d.ts +1 -1
  231. package/extensions/forms/Iterate/ViewContainer/ViewContainer.js.map +1 -1
  232. package/extensions/forms/Wizard/Buttons/Buttons.js +2 -2
  233. package/extensions/forms/Wizard/Buttons/Buttons.js.map +1 -1
  234. package/extensions/forms/Wizard/Container/DisplaySteps.js +6 -5
  235. package/extensions/forms/Wizard/Container/DisplaySteps.js.map +1 -1
  236. package/extensions/forms/Wizard/Container/IterateOverSteps.d.ts +4 -3
  237. package/extensions/forms/Wizard/Container/IterateOverSteps.js +36 -34
  238. package/extensions/forms/Wizard/Container/IterateOverSteps.js.map +1 -1
  239. package/extensions/forms/Wizard/Container/WizardContainer.js +105 -58
  240. package/extensions/forms/Wizard/Container/WizardContainer.js.map +1 -1
  241. package/extensions/forms/Wizard/Container/useCollectStepsData.d.ts +10 -0
  242. package/extensions/forms/Wizard/Container/useCollectStepsData.js +60 -0
  243. package/extensions/forms/Wizard/Container/useCollectStepsData.js.map +1 -0
  244. package/extensions/forms/Wizard/Context/WizardContext.d.ts +17 -4
  245. package/extensions/forms/Wizard/Context/WizardContext.js.map +1 -1
  246. package/extensions/forms/Wizard/Context/types.d.ts +9 -6
  247. package/extensions/forms/Wizard/Context/types.js.map +1 -1
  248. package/extensions/forms/Wizard/Step/Step.d.ts +1 -1
  249. package/extensions/forms/Wizard/Step/Step.js +66 -22
  250. package/extensions/forms/Wizard/Step/Step.js.map +1 -1
  251. package/extensions/forms/Wizard/Step/StepDocs.js +2 -2
  252. package/extensions/forms/Wizard/Step/StepDocs.js.map +1 -1
  253. package/extensions/forms/Wizard/hooks/useStep.js +10 -18
  254. package/extensions/forms/Wizard/hooks/useStep.js.map +1 -1
  255. package/extensions/forms/hooks/useFieldProps.js +16 -8
  256. package/extensions/forms/hooks/useFieldProps.js.map +1 -1
  257. package/extensions/forms/hooks/useValueProps.js +1 -1
  258. package/extensions/forms/hooks/useValueProps.js.map +1 -1
  259. package/package.json +1 -1
  260. package/shared/Eufemia.d.ts +1 -1
  261. package/shared/Eufemia.js +2 -2
  262. package/shared/Eufemia.js.map +1 -1
  263. package/shared/component-helper.js +1 -1
  264. package/shared/component-helper.js.map +1 -1
  265. package/style/core/scopes.scss +1 -1
  266. package/style/dnb-ui-basis.css +1 -1
  267. package/style/dnb-ui-basis.min.css +1 -1
  268. package/style/dnb-ui-body.css +1 -1
  269. package/style/dnb-ui-body.min.css +1 -1
  270. package/style/dnb-ui-core.css +1 -1
  271. package/style/dnb-ui-core.min.css +1 -1
  272. package/umd/dnb-ui-basis.min.js +1 -1
  273. package/umd/dnb-ui-components.min.js +1 -1
  274. package/umd/dnb-ui-elements.min.js +1 -1
  275. package/umd/dnb-ui-extensions.min.js +1 -1
  276. package/umd/dnb-ui-lib.min.js +1 -1
@@ -1,10 +1,11 @@
1
1
  "use client";
2
2
 
3
+ import "core-js/modules/web.dom-collections.iterator.js";
3
4
  import React, { useContext } from 'react';
4
- import { useTranslation } from '../../hooks';
5
- import { convertJsxToString } from '../../../../shared/component-helper';
6
5
  import WizardContext from '../Context/WizardContext';
6
+ import WizardStepContext from '../Step/StepContext';
7
7
  import Step, { handleDeprecatedProps as handleDeprecatedStepProps } from '../Step/Step';
8
+ import { useCollectStepsData } from './useCollectStepsData';
8
9
  export function IterateOverSteps(_ref) {
9
10
  let {
10
11
  children
@@ -14,15 +15,19 @@ export function IterateOverSteps(_ref) {
14
15
  stepsRef,
15
16
  activeIndexRef,
16
17
  totalStepsRef,
17
- stepStatusRef,
18
+ stepIndexRef,
18
19
  prerenderFieldProps,
19
20
  prerenderFieldPropsRef,
20
- hasErrorInOtherStepRef
21
+ hasErrorInOtherStepRef,
22
+ mapOverChildrenRef
21
23
  } = useContext(WizardContext);
24
+ const {
25
+ collectStepsData
26
+ } = useCollectStepsData();
27
+ stepsRef.current = new Map();
22
28
  hasErrorInOtherStepRef.current = false;
23
- stepsRef.current = {};
24
- let incrementIndex = -1;
25
- const translations = useTranslation();
29
+ stepIndexRef.current = -1;
30
+ totalStepsRef.current = 0;
26
31
  const childrenArray = React.Children.map(children, child => {
27
32
  if (React.isValidElement(child)) {
28
33
  var _child, _child2;
@@ -36,7 +41,7 @@ export function IterateOverSteps(_ref) {
36
41
  }
37
42
  if (((_child2 = child) === null || _child2 === void 0 ? void 0 : _child2.type) === Step) {
38
43
  const {
39
- title: titleProp,
44
+ title,
40
45
  inactive,
41
46
  include,
42
47
  includeWhen,
@@ -50,45 +55,42 @@ export function IterateOverSteps(_ref) {
50
55
  })) {
51
56
  return null;
52
57
  }
53
- incrementIndex++;
54
- const index = incrementIndex;
55
- const title = titleProp !== undefined ? convertJsxToString(titleProp) : 'Title missing';
56
- const state = stepStatusRef.current[index];
57
- const status = index !== activeIndexRef.current ? state === 'error' ? translations.Step.stepHasError : state === 'unknown' ? 'Unknown state' : undefined : undefined;
58
- const statusState = state === 'error' ? 'error' : undefined;
59
- const key = `${index}-${activeIndexRef.current}`;
60
- if (status) {
61
- hasErrorInOtherStepRef.current = true;
62
- }
63
- stepsRef.current[index] = {
58
+ const index = totalStepsRef.current;
59
+ totalStepsRef.current = totalStepsRef.current + 1;
60
+ collectStepsData({
64
61
  id,
65
- title,
62
+ index,
66
63
  inactive,
67
- status,
68
- statusState
69
- };
70
- const clone = props => React.cloneElement(child, props);
64
+ title
65
+ });
71
66
  if (prerenderFieldProps && typeof document !== 'undefined' && index !== activeIndexRef.current && typeof prerenderFieldPropsRef.current['step-' + index] === 'undefined') {
72
- prerenderFieldPropsRef.current['step-' + index] = () => clone({
67
+ const key = `${index}-${activeIndexRef.current}`;
68
+ prerenderFieldPropsRef.current['step-' + index] = () => React.cloneElement(child, {
73
69
  key,
74
70
  index,
75
71
  prerenderFieldProps: true
76
72
  });
77
73
  }
78
- return clone({
79
- key,
80
- index
81
- });
74
+ return child;
82
75
  }
83
76
  }
84
77
  return child;
85
78
  });
86
- if ((childrenArray === null || childrenArray === void 0 ? void 0 : childrenArray.length) === 0) {
79
+ if (totalStepsRef.current === 0) {
87
80
  activeIndexRef.current = 0;
88
- } else if ((childrenArray === null || childrenArray === void 0 ? void 0 : childrenArray.length) < activeIndexRef.current + 1) {
89
- activeIndexRef.current = childrenArray.length - 1;
81
+ } else if (totalStepsRef.current < activeIndexRef.current + 1) {
82
+ activeIndexRef.current = totalStepsRef.current - 1;
83
+ }
84
+ if (mapOverChildrenRef.current) {
85
+ return childrenArray.map((child, index) => {
86
+ return React.createElement(WizardStepContext.Provider, {
87
+ key: index,
88
+ value: {
89
+ index
90
+ }
91
+ }, child);
92
+ });
90
93
  }
91
- totalStepsRef.current = childrenArray === null || childrenArray === void 0 ? void 0 : childrenArray.length;
92
- return childrenArray;
94
+ return children;
93
95
  }
94
96
  //# sourceMappingURL=IterateOverSteps.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"IterateOverSteps.js","names":["React","useContext","useTranslation","convertJsxToString","WizardContext","Step","handleDeprecatedProps","handleDeprecatedStepProps","IterateOverSteps","_ref","children","check","stepsRef","activeIndexRef","totalStepsRef","stepStatusRef","prerenderFieldProps","prerenderFieldPropsRef","hasErrorInOtherStepRef","current","incrementIndex","translations","childrenArray","Children","map","child","isValidElement","_child","_child2","step","type","_step","apply","props","title","titleProp","inactive","include","includeWhen","id","visibleWhen","index","undefined","state","status","stepHasError","statusState","key","clone","cloneElement","document","length"],"sources":["../../../../../../src/extensions/forms/Wizard/Container/IterateOverSteps.tsx"],"sourcesContent":["import React, { useContext } from 'react'\nimport { useTranslation } from '../../hooks'\nimport { convertJsxToString } from '../../../../shared/component-helper'\nimport WizardContext from '../Context/WizardContext'\nimport Step, {\n Props as StepProps,\n handleDeprecatedProps as handleDeprecatedStepProps,\n} from '../Step/Step'\n\nexport function IterateOverSteps({ children }) {\n const {\n check,\n stepsRef,\n activeIndexRef,\n totalStepsRef,\n stepStatusRef,\n prerenderFieldProps,\n prerenderFieldPropsRef,\n hasErrorInOtherStepRef,\n } = useContext(WizardContext)\n hasErrorInOtherStepRef.current = false\n\n stepsRef.current = {}\n let incrementIndex = -1\n\n const translations = useTranslation()\n\n const childrenArray = React.Children.map(children, (child) => {\n if (React.isValidElement(child)) {\n let step = child\n\n if (child?.type !== Step && typeof child.type === 'function') {\n step = child.type.apply(child.type, [\n child.props,\n ]) as React.ReactElement\n\n if (step?.type === Step) {\n child = step\n }\n }\n\n if (child?.type === Step) {\n const {\n title: titleProp,\n inactive,\n include,\n includeWhen,\n id,\n } = handleDeprecatedStepProps(child.props)\n\n if (include === false) {\n return null\n }\n\n if (\n includeWhen &&\n !check({\n visibleWhen: includeWhen,\n })\n ) {\n return null\n }\n\n incrementIndex++\n\n const index = incrementIndex\n const title =\n titleProp !== undefined\n ? convertJsxToString(titleProp)\n : 'Title missing'\n const state = stepStatusRef.current[index]\n const status =\n index !== activeIndexRef.current\n ? state === 'error'\n ? translations.Step.stepHasError\n : state === 'unknown'\n ? 'Unknown state'\n : undefined\n : undefined\n const statusState = state === 'error' ? 'error' : undefined // undefined shows 'warn' by default\n const key = `${index}-${activeIndexRef.current}`\n\n if (status) {\n hasErrorInOtherStepRef.current = true\n }\n\n stepsRef.current[index] = {\n id,\n title,\n inactive,\n status,\n statusState,\n }\n\n const clone = (props) =>\n React.cloneElement(child as React.ReactElement<StepProps>, props)\n\n if (\n prerenderFieldProps &&\n typeof document !== 'undefined' &&\n index !== activeIndexRef.current &&\n typeof prerenderFieldPropsRef.current['step-' + index] ===\n 'undefined'\n ) {\n prerenderFieldPropsRef.current['step-' + index] = () =>\n clone({\n key,\n index,\n prerenderFieldProps: true,\n })\n }\n\n return clone({\n key,\n index,\n })\n }\n }\n\n return child\n })\n\n // Ensure we never have a higher index than the available children\n // else we get a white screen\n if (childrenArray?.length === 0) {\n activeIndexRef.current = 0\n } else if (childrenArray?.length < activeIndexRef.current + 1) {\n activeIndexRef.current = childrenArray.length - 1\n }\n\n totalStepsRef.current = childrenArray?.length\n\n return childrenArray\n}\n"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,UAAU,QAAQ,OAAO;AACzC,SAASC,cAAc,QAAQ,aAAa;AAC5C,SAASC,kBAAkB,QAAQ,qCAAqC;AACxE,OAAOC,aAAa,MAAM,0BAA0B;AACpD,OAA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AAOF,sBAAsB,CAACE,OAAO,CAAC,OAAO,GAAGsB,KAAK,CAAC,KACpD,WAAW,EACb;UACAxB,sBAAsB,CAACE,OAAO,CAAC,OAAO,GAAGsB,KAAK,CAAC,GAAG,MAChDO,KAAK,CAAC;YACJD,GAAG;YACHN,KAAK;YACLzB,mBAAmB,EAAE;UACvB,CAAC,CAAC;QACN;QAEA,OAAOgC,KAAK,CAAC;UACXD,GAAG;UACHN;QACF,CAAC,CAAC;MACJ;IACF;IAEA,OAAOhB,KAAK;EACd,CAAC,CAAC;EAIF,IAAI,CAAAH,aAAa,aAAbA,aAAa,uBAAbA,aAAa,CAAE6B,MAAM,MAAK,CAAC,EAAE;IAC/BtC,cAAc,CAACM,OAAO,GAAG,CAAC;EAC5B,CAAC,MAAM,IAAI,CAAAG,aAAa,aAAbA,aAAa,uBAAbA,aAAa,CAAE6B,MAAM,IAAGtC,cAAc,CAACM,OAAO,GAAG,CAAC,EAAE;IAC7DN,cAAc,CAACM,OAAO,GAAGG,aAAa,CAAC6B,MAAM,GAAG,CAAC;EACnD;EAEArC,aAAa,CAACK,OAAO,GAAGG,aAAa,aAAbA,aAAa,uBAAbA,aAAa,CAAE6B,MAAM;EAE7C,OAAO7B,aAAa;AACtB","ignoreList":[]}
1
+ {"version":3,"file":"IterateOverSteps.js","names":["React","useContext","WizardContext","WizardStepContext","Step","handleDeprecatedProps","handleDeprecatedStepProps","useCollectStepsData","IterateOverSteps","_ref","children","check","stepsRef","activeIndexRef","totalStepsRef","stepIndexRef","prerenderFieldProps","prerenderFieldPropsRef","hasErrorInOtherStepRef","mapOverChildrenRef","collectStepsData","current","Map","childrenArray","Children","map","child","isValidElement","_child","_child2","step","type","_step","apply","props","title","inactive","include","includeWhen","id","visibleWhen","index","document","key","cloneElement","createElement","Provider","value"],"sources":["../../../../../../src/extensions/forms/Wizard/Container/IterateOverSteps.tsx"],"sourcesContent":["import React, { useContext } from 'react'\nimport WizardContext from '../Context/WizardContext'\nimport WizardStepContext from '../Step/StepContext'\nimport Step, {\n Props as StepProps,\n handleDeprecatedProps as handleDeprecatedStepProps,\n} from '../Step/Step'\nimport { useCollectStepsData } from './useCollectStepsData'\n\nexport function IterateOverSteps({\n children,\n}: {\n children: React.ReactNode\n}): React.ReactNode {\n const {\n check,\n stepsRef,\n activeIndexRef,\n totalStepsRef,\n stepIndexRef,\n prerenderFieldProps,\n prerenderFieldPropsRef,\n hasErrorInOtherStepRef,\n mapOverChildrenRef,\n } = useContext(WizardContext)\n\n const { collectStepsData } = useCollectStepsData()\n\n // Reset before iterating and calling \"collectStepsData\" and other variables are collected.\n stepsRef.current = new Map()\n hasErrorInOtherStepRef.current = false\n stepIndexRef.current = -1\n totalStepsRef.current = 0\n\n const childrenArray = React.Children.map(children, (child) => {\n if (React.isValidElement(child)) {\n let step = child\n\n if (child?.type !== Step && typeof child.type === 'function') {\n step = child.type.apply(child.type, [\n child.props,\n ]) as React.ReactElement\n\n if (step?.type === Step) {\n child = step\n }\n }\n\n if (child?.type === Step) {\n const { title, inactive, include, includeWhen, id } =\n handleDeprecatedStepProps(child.props)\n\n if (include === false) {\n return null\n }\n\n if (\n includeWhen &&\n !check({\n visibleWhen: includeWhen,\n })\n ) {\n return null\n }\n\n const index = totalStepsRef.current\n totalStepsRef.current = totalStepsRef.current + 1\n\n collectStepsData({\n id,\n index,\n inactive,\n title,\n })\n\n if (\n prerenderFieldProps &&\n typeof document !== 'undefined' &&\n index !== activeIndexRef.current &&\n typeof prerenderFieldPropsRef.current['step-' + index] ===\n 'undefined'\n ) {\n const key = `${index}-${activeIndexRef.current}`\n prerenderFieldPropsRef.current['step-' + index] = () =>\n React.cloneElement(child as React.ReactElement<StepProps>, {\n key,\n index,\n prerenderFieldProps: true,\n })\n }\n\n return child\n }\n }\n\n return child\n })\n\n // Ensure we never have a higher index than the available children\n // else we get a white screen\n if (totalStepsRef.current === 0) {\n activeIndexRef.current = 0\n } else if (totalStepsRef.current < activeIndexRef.current + 1) {\n activeIndexRef.current = totalStepsRef.current - 1\n }\n\n if (mapOverChildrenRef.current) {\n return childrenArray.map((child, index) => {\n return (\n <WizardStepContext.Provider key={index} value={{ index }}>\n {child}\n </WizardStepContext.Provider>\n )\n })\n }\n\n return children\n}\n"],"mappings":";;;AAAA,OAAOA,KAAK,IAAIC,UAAU,QAAQ,OAAO;AACzC,OAAOC,aAAa,MAAM,0BAA0B;AACpD,OAAOC,iBAAiB,MAAM,qBAAqB;AACnD,OAAOC,IAAI,IAETC,qBAAqB,IAAIC,yBAAyB,QAC7C,cAAc;AACrB,SAASC,mBAAmB,QAAQ,uBAAuB;AAE3D,OAAO,SAASC,gBAAgBA,CAAAC,IAAA,EAIZ;EAAA,IAJa;IAC/BC;EAGF,CAAC,GAAAD,IAAA;EACC,MAAM;IACJE,KAAK;IACLC,QAAQ;IACRC,cAAc;IACdC,aAAa;IACbC,YAAY;IACZC,mBAAmB;IACnBC,sBAAsB;IACtBC,sBAAsB;IACtBC;EACF,CAAC,GAAGlB,UAAU,CAACC,aAAa,CAAC;EAE7B,MAAM;IAAEkB;EAAiB,CAAC,GAAGb,mBAAmB,CAAC,CAAC;EAGlDK,QAAQ,CAACS,OAAO,GAAG,IAAIC,GAAG,CAAC,CAAC;EAC5BJ,sBAAsB,CAACG,OAAO,GAAG,KAAK;EACtCN,YAAY,CAACM,OAAO,GAAG,CAAC,CAAC;EACzBP,aAAa,CAACO,OAAO,GAAG,CAAC;EAEzB,MAAME,aAAa,GAAGvB,KAAK,CAACwB,QAAQ,CAACC,GAAG,CAACf,QAAQ,EAAGgB,KAAK,IAAK;IAC5D,IAAI1B,KAAK,CAAC2B,cAAc,CAACD,KAAK,CAAC,EAAE;MAAA,IAAAE,MAAA,EAAAC,OAAA;MAC/B,IAAIC,IAAI,GAAGJ,KAAK;MAEhB,IAAI,EAAAE,MAAA,GAAAF,KAAK,cAAAE,MAAA,uBAALA,MAAA,CAAOG,IAAI,MAAK3B,IAAI,IAAI,OAAOsB,KAAK,CAACK,IAAI,KAAK,U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CAAClB,KAAK,EAAmC;YACzDiB,GAAG;YACHF,KAAK;YACLzB,mBAAmB,EAAE;UACvB,CAAC,CAAC;QACN;QAEA,OAAOU,KAAK;MACd;IACF;IAEA,OAAOA,KAAK;EACd,CAAC,CAAC;EAIF,IAAIZ,aAAa,CAACO,OAAO,KAAK,CAAC,EAAE;IAC/BR,cAAc,CAACQ,OAAO,GAAG,CAAC;EAC5B,CAAC,MAAM,IAAIP,aAAa,CAACO,OAAO,GAAGR,cAAc,CAACQ,OAAO,GAAG,CAAC,EAAE;IAC7DR,cAAc,CAACQ,OAAO,GAAGP,aAAa,CAACO,OAAO,GAAG,CAAC;EACpD;EAEA,IAAIF,kBAAkB,CAACE,OAAO,EAAE;IAC9B,OAAOE,aAAa,CAACE,GAAG,CAAC,CAACC,KAAK,EAAEe,KAAK,KAAK;MACzC,OACEzC,KAAA,CAAA6C,aAAA,CAAC1C,iBAAiB,CAAC2C,QAAQ;QAACH,GAAG,EAAEF,KAAM;QAACM,KAAK,EAAE;UAAEN;QAAM;MAAE,GACtDf,KACyB,CAAC;IAEjC,CAAC,CAAC;EACJ;EAEA,OAAOhB,QAAQ;AACjB","ignoreList":[]}
@@ -7,7 +7,7 @@ const _excluded = ["className", "id", "mode", "initialActiveIndex", "omitScrollM
7
7
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
8
8
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
9
9
  import "core-js/modules/web.dom-collections.iterator.js";
10
- import React, { useContext, useCallback, useRef, useReducer, useMemo } from 'react';
10
+ import React, { useContext, useCallback, useRef, useReducer, useMemo, useEffect } from 'react';
11
11
  import classnames from 'classnames';
12
12
  import { Space } from '../../../../components';
13
13
  import { warn } from '../../../../shared/component-helper';
@@ -55,26 +55,24 @@ function WizardContainer(props) {
55
55
  const [, forceUpdate] = useReducer(() => ({}), {});
56
56
  const activeIndexRef = useRef(initialActiveIndex);
57
57
  const totalStepsRef = useRef(NaN);
58
- const stepStatusRef = useRef({});
59
- const hasVisibleErrorRef = useRef({});
58
+ const submitCountRef = useRef(0);
59
+ const visitedStepsRef = useRef(new Map());
60
+ const fieldErrorRef = useRef(new Map());
61
+ const storeStepStateRef = useRef(new Map());
60
62
  const hasErrorInOtherStepRef = useRef(false);
61
- const visitedStepsRef = useRef({});
62
63
  const elementRef = useRef();
63
64
  const stepElementRef = useRef();
64
65
  const preventNextStepRef = useRef(false);
65
- const stepsRef = useRef({});
66
- const tmpStepsRef = useRef({});
66
+ const stepsRef = useRef(new Map());
67
+ const tmpStepsRef = useRef();
68
+ const stepIndexRef = useRef(-1);
67
69
  const updateTitlesRef = useRef();
68
70
  const prerenderFieldPropsRef = useRef({});
69
71
  const bypassOnNavigation = validationMode === 'bypassOnNavigation';
70
72
  const sharedStateRef = useRef();
71
73
  sharedStateRef.current = useSharedState(hasContext && id ? createReferenceKey(id, 'wizard') : undefined);
72
- visitedStepsRef.current[activeIndexRef.current] = true;
73
- const setStepState = useCallback((index, state) => {
74
- stepStatusRef.current[index] = state;
75
- }, []);
76
74
  const hasFieldErrorInStep = useCallback(index => {
77
- return Object.values(hasVisibleErrorRef.current).some(_ref => {
75
+ return Array.from(fieldErrorRef.current.values()).some(_ref => {
78
76
  let {
79
77
  index: i,
80
78
  hasError
@@ -82,31 +80,77 @@ function WizardContainer(props) {
82
80
  return i === index && hasError;
83
81
  });
84
82
  }, []);
85
- const revealError = useCallback((index, path, hasError) => {
86
- hasVisibleErrorRef.current[path] = {
87
- index,
88
- hasError
89
- };
90
- if (hasFieldErrorInStep(index)) {
91
- setStepState(index, 'error');
83
+ const setStepAsVisited = useCallback(index => {
84
+ visitedStepsRef.current.set(index, true);
85
+ }, []);
86
+ useEffect(() => {
87
+ if (!initialActiveIndex) {
88
+ setStepAsVisited(activeIndexRef.current);
92
89
  }
93
- }, [hasFieldErrorInStep, setStepState]);
94
- const activeIndex = activeIndexRef.current;
95
- const hasErrorInActiveStep = hasFieldErrorInStep(activeIndex);
96
- useMemo(() => {
97
- const currentState = stepStatusRef.current[activeIndex];
98
- if (!hasErrorInActiveStep && ['error', 'valid'].includes(currentState)) {
99
- setStepState(activeIndex, 'valid');
100
- } else {
101
- setStepState(activeIndex, hasErrorInActiveStep ? 'error' : undefined);
90
+ }, [initialActiveIndex, setStepAsVisited]);
91
+ const writeStepsState = useCallback(function () {
92
+ let index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : undefined;
93
+ let forStates = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ['unknown', 'error'];
94
+ for (let i = 0; i < totalStepsRef.current; i++) {
95
+ if (index !== undefined && index !== i) {
96
+ continue;
97
+ }
98
+ let result = undefined;
99
+ const existingState = storeStepStateRef.current.get(i);
100
+ if (forStates.includes('unknown')) {
101
+ const state = i < activeIndexRef.current && visitedStepsRef.current.get(i) === undefined;
102
+ if (state) {
103
+ result = 'unknown';
104
+ }
105
+ }
106
+ if (forStates.includes('error')) {
107
+ const state = hasFieldErrorInStep(i);
108
+ if (state) {
109
+ result = 'error';
110
+ } else if (existingState === 'error') {
111
+ if (i === activeIndexRef.current) {
112
+ result = undefined;
113
+ } else {
114
+ result = existingState;
115
+ }
116
+ }
117
+ }
118
+ storeStepStateRef.current.set(i, result);
119
+ }
120
+ }, [hasFieldErrorInStep]);
121
+ const hasInvalidStepsState = useCallback(function () {
122
+ let index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : undefined;
123
+ let forStates = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ['unknown', 'error'];
124
+ for (let i = 0; i < totalStepsRef.current; i++) {
125
+ if (index !== undefined && index !== i) {
126
+ continue;
127
+ }
128
+ const state = storeStepStateRef.current.get(i);
129
+ if (forStates.includes('unknown')) {
130
+ if (state === 'unknown') {
131
+ return true;
132
+ }
133
+ }
134
+ if (forStates.includes('error')) {
135
+ if (state === 'error') {
136
+ return true;
137
+ }
138
+ }
102
139
  }
103
- }, [activeIndex, hasErrorInActiveStep, setStepState]);
140
+ return false;
141
+ }, []);
142
+ const setFieldError = useCallback((index, path, hasError) => {
143
+ fieldErrorRef.current.set(path, {
144
+ index,
145
+ hasError
146
+ });
147
+ }, []);
104
148
  const preventNavigation = useCallback(function () {
105
149
  let shouldPrevent = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
106
150
  preventNextStepRef.current = shouldPrevent;
107
151
  }, []);
108
152
  const getStepChangeOptions = useCallback(index => {
109
- var _stepsRef$current$ind;
153
+ var _stepsRef$current$get;
110
154
  const previousIndex = activeIndexRef.current;
111
155
  const options = {
112
156
  preventNavigation,
@@ -114,10 +158,10 @@ function WizardContainer(props) {
114
158
  index: previousIndex
115
159
  }
116
160
  };
117
- const id = (_stepsRef$current$ind = stepsRef.current[index]) === null || _stepsRef$current$ind === void 0 ? void 0 : _stepsRef$current$ind.id;
161
+ const id = (_stepsRef$current$get = stepsRef.current.get(index)) === null || _stepsRef$current$get === void 0 ? void 0 : _stepsRef$current$get.id;
118
162
  if (id) {
119
- var _stepsRef$current$pre;
120
- const previousId = (_stepsRef$current$pre = stepsRef.current[previousIndex]) === null || _stepsRef$current$pre === void 0 ? void 0 : _stepsRef$current$pre.id;
163
+ var _stepsRef$current$get2;
164
+ const previousId = (_stepsRef$current$get2 = stepsRef.current.get(previousIndex)) === null || _stepsRef$current$get2 === void 0 ? void 0 : _stepsRef$current$get2.id;
121
165
  Object.assign(options, {
122
166
  id
123
167
  });
@@ -175,10 +219,11 @@ function WizardContainer(props) {
175
219
  result = await callOnStepChange(index, mode);
176
220
  }
177
221
  setFormState('abort');
178
- setShowAllErrors(bypassOnNavigation ? false : stepStatusRef.current[index] === 'error');
222
+ setShowAllErrors(bypassOnNavigation ? false : hasInvalidStepsState(index, ['error']));
179
223
  if (!preventNextStepRef.current && !(result instanceof Error)) {
180
224
  handleLayoutEffect();
181
225
  activeIndexRef.current = index;
226
+ setStepAsVisited(activeIndexRef.current);
182
227
  forceUpdate();
183
228
  }
184
229
  preventNextStepRef.current = false;
@@ -195,13 +240,15 @@ function WizardContainer(props) {
195
240
  if (bypassOnNavigation) {
196
241
  await onSubmit();
197
242
  } else {
198
- const state = stepStatusRef.current[activeIndexRef.current];
199
- if (mode === 'next' && state === 'valid') {
200
- await onSubmit();
243
+ if (mode === 'next') {
244
+ writeStepsState(activeIndexRef.current, ['error']);
245
+ if (!hasInvalidStepsState(activeIndexRef.current)) {
246
+ await onSubmit();
247
+ }
201
248
  }
202
249
  }
203
250
  }
204
- }, [bypassOnNavigation, callOnStepChange, getStepChangeOptions, handleLayoutEffect, handleSubmitCall, isInteractionRef, onStepChange, setFormState, setShowAllErrors]);
251
+ }, [bypassOnNavigation, callOnStepChange, getStepChangeOptions, handleLayoutEffect, handleSubmitCall, hasInvalidStepsState, isInteractionRef, onStepChange, setFormState, setShowAllErrors, setStepAsVisited, writeStepsState]);
205
252
  const setActiveIndex = useCallback((index, options) => {
206
253
  if (index === activeIndexRef.current) {
207
254
  return;
@@ -232,23 +279,11 @@ function WizardContainer(props) {
232
279
  error
233
280
  });
234
281
  }, [setSubmitState]);
235
- const handleUnknownStepsState = useCallback(() => {
236
- const index = activeIndexRef.current;
237
- for (let i = 0; i < totalStepsRef.current; i++) {
238
- if (!visitedStepsRef.current[i] && stepStatusRef.current[i] === undefined && i < index && i !== index) {
239
- setStepState(i, 'unknown');
240
- }
241
- }
242
- }, [setStepState]);
243
- const hasInvalidStepsState = useCallback(forStates => {
244
- const steps = Object.values(stepStatusRef.current);
245
- return (forStates || ['unknown', 'error']).some(state => steps.includes(state));
246
- }, []);
247
282
  const handleSubmit = useCallback(_ref4 => {
248
283
  let {
249
284
  preventSubmit
250
285
  } = _ref4;
251
- handleUnknownStepsState();
286
+ submitCountRef.current += 1;
252
287
  if (hasInvalidStepsState()) {
253
288
  return preventSubmit();
254
289
  }
@@ -256,11 +291,16 @@ function WizardContainer(props) {
256
291
  handleNext();
257
292
  preventSubmit();
258
293
  }
259
- }, [handleUnknownStepsState, hasInvalidStepsState, handleNext]);
294
+ }, [hasInvalidStepsState, handleNext]);
260
295
  (_dataContext$setHandl = dataContext.setHandleSubmit) === null || _dataContext$setHandl === void 0 ? void 0 : _dataContext$setHandl.call(dataContext, handleSubmit);
261
296
  const {
262
297
  check
263
298
  } = useVisibility();
299
+ const mapOverChildrenRef = useRef(false);
300
+ const enableMapOverChildren = useCallback(() => {
301
+ mapOverChildrenRef.current = true;
302
+ }, []);
303
+ const activeIndex = activeIndexRef.current;
264
304
  const providerValue = useMemo(() => {
265
305
  return {
266
306
  id,
@@ -270,21 +310,25 @@ function WizardContainer(props) {
270
310
  stepsRef,
271
311
  updateTitlesRef,
272
312
  activeIndexRef,
313
+ stepIndexRef,
273
314
  totalStepsRef,
274
- stepStatusRef,
315
+ submitCountRef,
275
316
  prerenderFieldProps,
276
317
  prerenderFieldPropsRef,
277
318
  hasErrorInOtherStepRef,
278
319
  keepInDOM,
320
+ enableMapOverChildren,
321
+ mapOverChildrenRef,
279
322
  check,
280
323
  setActiveIndex,
281
324
  handlePrevious,
282
325
  hasInvalidStepsState,
283
- revealError,
326
+ writeStepsState,
327
+ setFieldError,
284
328
  handleNext,
285
329
  setFormError
286
330
  };
287
- }, [id, activeIndex, initialActiveIndex, prerenderFieldProps, keepInDOM, check, setActiveIndex, handlePrevious, hasInvalidStepsState, revealError, handleNext, setFormError]);
331
+ }, [id, activeIndex, initialActiveIndex, prerenderFieldProps, keepInDOM, enableMapOverChildren, check, setActiveIndex, handlePrevious, hasInvalidStepsState, writeStepsState, setFieldError, handleNext, setFormError]);
288
332
  useLayoutEffect(() => {
289
333
  if (id && hasContext) {
290
334
  sharedStateRef.current.extend(providerValue);
@@ -295,8 +339,11 @@ function WizardContainer(props) {
295
339
  (_updateTitlesRef$curr = updateTitlesRef.current) === null || _updateTitlesRef$curr === void 0 ? void 0 : _updateTitlesRef$curr.call(updateTitlesRef);
296
340
  }, [stepsRef.current]);
297
341
  const stepsLengthDidChange = useCallback(() => {
298
- const count = Object.keys(stepsRef.current).length;
299
- const tmpCount = Object.keys(tmpStepsRef.current).length;
342
+ const tmpCount = tmpStepsRef.current;
343
+ if (tmpCount === undefined) {
344
+ return false;
345
+ }
346
+ const count = totalStepsRef.current;
300
347
  return count !== 0 && tmpCount !== 0 && count !== tmpCount;
301
348
  }, []);
302
349
  useLayoutEffect(() => {
@@ -305,8 +352,8 @@ function WizardContainer(props) {
305
352
  callOnStepChange(activeIndexRef.current, 'stepListModified');
306
353
  (_executeLayoutAnimati = executeLayoutAnimationRef.current) === null || _executeLayoutAnimati === void 0 ? void 0 : _executeLayoutAnimati.call(executeLayoutAnimationRef);
307
354
  }
308
- tmpStepsRef.current = stepsRef.current;
309
- }, [stepsRef.current, callOnStepChange, stepsLengthDidChange]);
355
+ tmpStepsRef.current = totalStepsRef.current;
356
+ }, [totalStepsRef.current, callOnStepChange, stepsLengthDidChange]);
310
357
  if (!hasContext) {
311
358
  warn('You may wrap Wizard.Container in Form.Handler');
312
359
  return React.createElement(Handler, null, React.createElement(WizardContainer, _extends({}, props, {
@@ -1 +1 @@
1
- {"version":3,"file":"WizardContainer.js","names":["React","useContext","useCallback","useRef","useReducer","useMemo","classnames","Space","warn","isAsync","useId","WizardContext","DataContext","Handler","createReferenceKey","useSharedState","useHandleLayoutEffect","useStepAnimation","useVisibility","DisplaySteps","IterateOverSteps","PrerenderFieldPropsOfOtherSteps","useLayoutEffect","window","useEffect","WizardContainer","props","_dataContext$setHandl","className","id","idProp","mode","initialActiveIndex","omitScrollManagement","omitFocusManagement","onStepChange","children","noAnimation","prerenderFieldProps","keepInDOM","validationMode","variant","sidebarId","rest","_objectWithoutProperties","_excluded","dataContext","hasContext","setFormState","handleSubmitCall","setShowAllErrors","setSubmitState","forceUpdate","activeIndexRef","totalStepsRef","NaN","stepStatusRef","hasVisibleErrorRef","hasErrorInOtherStepRef","visitedStepsRef","elementRef","stepElementRef","preventNextStepRef","stepsRef","tmpStepsRef","updateTitlesRef","prerenderFieldPropsRef","bypassOnNavigation","sharedStateRef","current","undefined","setStepState","index","state","hasFieldErrorInStep","Object","values","some","_ref","i","hasError","revealError","path","activeIndex","hasErrorInActiveStep","currentState","includes","preventNavigation","shouldPrevent","arguments","length","getStepChangeOptions","_stepsRef$current$ind","previousIndex","options","previousStep","_stepsRef$current$pre","previousId","assign","callOnStepChange","setFocus","scrollToTop","isInteractionRef","executeLayoutAnimationRef","handleLayoutEffect","handleStepChange","_ref2","skipErrorCheck","skipStepChangeCall","skipStepChangeCallBeforeMounted","skipStepChangeCallFromHook","didSubmit","onSubmit","_sharedStateRef$curre","_sharedStateRef$curre2","_sharedStateRef$curre3","data","call","result","Error","skipFieldValidation","enableAsyncBehavior","setActiveIndex","_objectSpread","handlePrevious","handleNext","handleChange","_ref3","current_step","setFormError","error","handleUnknownStepsState","hasInvalidStepsState","forStates","steps","handleSubmit","_ref4","preventSubmit","setHandleSubmit","check","providerValue","extend","_updateTitlesRef$curr","stepsLengthDidChange","count","keys","tmpCount","_executeLayoutAnimati","createElement","_extends","Provider","value","innerRef","_supportsSpacingProps"],"sources":["../../../../../../src/extensions/forms/Wizard/Container/WizardContainer.tsx"],"sourcesContent":["import React, {\n useContext,\n useCallback,\n useRef,\n useReducer,\n useMemo,\n} from 'react'\nimport classnames from 'classnames'\nimport { Space } from '../../../../components'\nimport { warn } from '../../../../shared/component-helper'\nimport { isAsync } from '../../../../shared/helpers/isAsync'\nimport useId from '../../../../shared/helpers/useId'\nimport WizardContext, {\n WizardContextState,\n} from '../Context/WizardContext'\nimport type {\n OnStepChange,\n OnStepChangeOptions,\n OnStepsChangeMode,\n SetActiveIndexOptions,\n StepIndex,\n Steps,\n InternalFieldError,\n InternalStepStatus,\n InternalStepStatuses,\n InternalVisitedSteps,\n} from '../Context/types'\nimport DataContext from '../../DataContext/Context'\nimport Handler from '../../Form/Handler/Handler'\nimport {\n SharedStateReturn,\n createReferenceKey,\n useSharedState,\n} from '../../../../shared/helpers/useSharedState'\nimport useHandleLayoutEffect from './useHandleLayoutEffect'\nimport useStepAnimation from './useStepAnimation'\nimport { ComponentProps } from '../../types'\nimport useVisibility from '../../Form/Visibility/useVisibility'\nimport { DisplaySteps } from './DisplaySteps'\nimport { IterateOverSteps } from './IterateOverSteps'\nimport { PrerenderFieldPropsOfOtherSteps } from './PrerenderFieldPropsOfOtherSteps'\n\n// SSR warning fix: https://gist.github.com/gaearon/e7d97cdf38a2907924ea12e4ebdf3c85\nconst useLayoutEffect =\n typeof window === 'undefined' ? React.useEffect : React.useLayoutEffect\n\nexport type Props = ComponentProps & {\n id?: string\n\n /**\n * The mode of the wizard.\n */\n mode?: 'static' | 'strict' | 'loose'\n\n /**\n * If set to `true`, the wizard will not scroll to the first step when the user clicks on the next button.\n */\n omitScrollManagement?: boolean\n\n /**\n * If set to `true`, the wizard will not focus on the next step when the user clicks on the next button.\n */\n omitFocusManagement?: boolean\n\n /**\n * The index of the first step to be rendered.\n */\n initialActiveIndex?: StepIndex\n\n /**\n * The callback function that will be called when the user clicks on the next button.\n */\n onStepChange?: OnStepChange\n\n /**\n * The sidebar variant.\n */\n variant?: 'sidebar' | 'drawer'\n sidebarId?: string\n\n /**\n * If set to `true`, the wizard will not animate the steps.\n */\n noAnimation?: boolean\n\n /**\n * If set to `true`, the wizard will not unmount the steps when navigating back and forth.\n */\n keepInDOM?: boolean\n\n /**\n * If set to `true`, the wizard pre-render all steps so the props of each field is available in the data context.\n * Defaults to `true`.\n */\n prerenderFieldProps?: boolean\n\n /**\n * Determines if and how the validation will be bypassed.\n */\n validationMode?: 'bypassOnNavigation'\n\n /**\n * The children of the wizard container.\n */\n children: React.ReactNode\n\n /**\n * @deprecated Is enabled by default. You can disable it with \"omitScrollManagement\"\n */\n scrollTopOnStepChange?: boolean\n}\n\nfunction WizardContainer(props: Props) {\n const {\n className,\n id: idProp,\n mode = 'strict',\n initialActiveIndex = 0,\n omitScrollManagement,\n omitFocusManagement,\n onStepChange,\n children,\n noAnimation = true,\n prerenderFieldProps = true,\n keepInDOM,\n validationMode,\n variant = 'sidebar',\n sidebarId,\n ...rest\n } = props\n\n const dataContext = useContext(DataContext)\n const {\n hasContext,\n setFormState,\n handleSubmitCall,\n setShowAllErrors,\n setSubmitState,\n } = dataContext\n\n const id = useId(idProp)\n const [, forceUpdate] = useReducer(() => ({}), {})\n const activeIndexRef = useRef<StepIndex>(initialActiveIndex)\n const totalStepsRef = useRef<number>(NaN)\n const stepStatusRef = useRef<InternalStepStatuses>({})\n const hasVisibleErrorRef = useRef<InternalFieldError>({})\n const hasErrorInOtherStepRef = useRef<boolean>(false)\n const visitedStepsRef = useRef<InternalVisitedSteps>({})\n const elementRef = useRef<HTMLElement>()\n const stepElementRef = useRef<HTMLElement>()\n const preventNextStepRef = useRef(false)\n const stepsRef = useRef<Steps>({})\n const tmpStepsRef = useRef<Steps>({})\n const updateTitlesRef = useRef<() => void>()\n const prerenderFieldPropsRef = useRef<\n Record<string, () => React.ReactElement>\n >({})\n\n const bypassOnNavigation = validationMode === 'bypassOnNavigation'\n\n // - Handle shared state\n const sharedStateRef =\n useRef<\n SharedStateReturn<\n WizardContextState & { onStepChange?: OnStepChange }\n >\n >()\n sharedStateRef.current = useSharedState<WizardContextState>(\n hasContext && id ? createReferenceKey(id, 'wizard') : undefined\n )\n\n visitedStepsRef.current[activeIndexRef.current] = true\n\n const setStepState = useCallback(\n (index: number, state: InternalStepStatus) => {\n stepStatusRef.current[index] = state\n },\n []\n )\n const hasFieldErrorInStep = useCallback((index: StepIndex) => {\n return Object.values(hasVisibleErrorRef.current).some(\n ({ index: i, hasError }) => {\n return i === index && hasError\n }\n )\n }, [])\n const revealError: WizardContextState['revealError'] = useCallback(\n (index, path, hasError) => {\n hasVisibleErrorRef.current[path] = { index, hasError }\n\n if (hasFieldErrorInStep(index)) {\n setStepState(index, 'error')\n }\n },\n [hasFieldErrorInStep, setStepState]\n )\n\n const activeIndex = activeIndexRef.current\n const hasErrorInActiveStep = hasFieldErrorInStep(activeIndex)\n useMemo(() => {\n const currentState = stepStatusRef.current[activeIndex]\n if (\n !hasErrorInActiveStep &&\n ['error', 'valid'].includes(currentState)\n ) {\n setStepState(activeIndex, 'valid')\n } else {\n setStepState(activeIndex, hasErrorInActiveStep ? 'error' : undefined)\n }\n }, [activeIndex, hasErrorInActiveStep, setStepState])\n\n const preventNavigation = useCallback((shouldPrevent = true) => {\n preventNextStepRef.current = shouldPrevent\n }, [])\n\n const getStepChangeOptions: (index: StepIndex) => OnStepChangeOptions =\n useCallback(\n (index) => {\n const previousIndex = activeIndexRef.current\n const options = {\n preventNavigation,\n previousStep: { index: previousIndex },\n }\n\n const id = stepsRef.current[index]?.id\n if (id) {\n const previousId = stepsRef.current[previousIndex]?.id\n Object.assign(options, { id })\n Object.assign(options.previousStep, { id: previousId })\n }\n\n return options\n },\n [preventNavigation]\n )\n\n const callOnStepChange = useCallback(\n async (index: StepIndex, mode: OnStepsChangeMode) => {\n if (isAsync(onStepChange)) {\n return await onStepChange(index, mode, getStepChangeOptions(index))\n }\n\n return onStepChange?.(index, mode, getStepChangeOptions(index))\n },\n [getStepChangeOptions, onStepChange]\n )\n\n const { setFocus, scrollToTop, isInteractionRef } =\n useHandleLayoutEffect({ elementRef, stepElementRef })\n\n const executeLayoutAnimationRef = useRef<() => void>()\n useStepAnimation({\n activeIndexRef,\n stepElementRef,\n executeLayoutAnimationRef,\n })\n\n const handleLayoutEffect = useCallback(() => {\n if (!omitFocusManagement) {\n setFocus()\n }\n if (!omitScrollManagement) {\n scrollToTop()\n }\n }, [omitScrollManagement, omitFocusManagement, setFocus, scrollToTop])\n\n const handleStepChange = useCallback(\n async ({\n index,\n skipErrorCheck,\n skipStepChangeCall,\n skipStepChangeCallBeforeMounted,\n skipStepChangeCallFromHook,\n mode,\n }: {\n index: StepIndex\n mode: OnStepsChangeMode\n } & SetActiveIndexOptions) => {\n let didSubmit = false\n const onSubmit = async () => {\n if (!skipStepChangeCallFromHook) {\n sharedStateRef.current?.data?.onStepChange?.(\n index,\n mode,\n getStepChangeOptions(index)\n )\n }\n\n let result = undefined\n\n if (\n !skipStepChangeCall &&\n !(skipStepChangeCallBeforeMounted && !isInteractionRef.current)\n ) {\n result = await callOnStepChange(index, mode)\n }\n\n // Hide async indicator\n setFormState('abort')\n\n // Set the \"showAllErrors\" to the step we got to\n setShowAllErrors(\n bypassOnNavigation\n ? false\n : stepStatusRef.current[index] === 'error'\n )\n\n if (!preventNextStepRef.current && !(result instanceof Error)) {\n handleLayoutEffect()\n\n activeIndexRef.current = index\n forceUpdate()\n }\n\n preventNextStepRef.current = false\n didSubmit = true\n\n return result\n }\n\n await handleSubmitCall({\n skipErrorCheck,\n skipFieldValidation: skipErrorCheck,\n enableAsyncBehavior: isAsync(onStepChange),\n onSubmit: bypassOnNavigation ? () => null : onSubmit,\n })\n\n if (!didSubmit) {\n if (bypassOnNavigation) {\n await onSubmit()\n } else {\n // In case steps were visited before, or they use the \"keepInDOM\" prop,\n // we need to check the step status, because other steps may report an error,\n // so the user will not be able to navigate to the next step,\n // because the form contains errors. Thats why onSubmit will not be called via handleSubmitCall.\n const state = stepStatusRef.current[activeIndexRef.current]\n if (mode === 'next' && state === 'valid') {\n await onSubmit()\n }\n }\n }\n },\n [\n bypassOnNavigation,\n callOnStepChange,\n getStepChangeOptions,\n handleLayoutEffect,\n handleSubmitCall,\n isInteractionRef,\n onStepChange,\n setFormState,\n setShowAllErrors,\n ]\n )\n\n const setActiveIndex = useCallback(\n (index: StepIndex, options?: SetActiveIndexOptions) => {\n if (index === activeIndexRef.current) {\n return\n }\n\n const mode = index > activeIndexRef.current ? 'next' : 'previous'\n\n handleStepChange({\n index,\n skipErrorCheck: mode === 'previous',\n mode,\n ...options,\n })\n },\n [handleStepChange]\n )\n\n const handlePrevious = useCallback(() => {\n setActiveIndex(activeIndexRef.current - 1)\n }, [setActiveIndex])\n\n const handleNext = useCallback(() => {\n setActiveIndex(activeIndexRef.current + 1)\n }, [setActiveIndex])\n\n const handleChange = useCallback(\n ({ current_step }) => {\n setActiveIndex(\n current_step,\n mode === 'loose' ? { skipErrorCheck: true } : undefined\n )\n },\n [mode, setActiveIndex]\n )\n\n const setFormError = useCallback(\n (error: Error) => {\n setSubmitState?.({ error })\n },\n [setSubmitState]\n )\n\n const handleUnknownStepsState = useCallback(() => {\n const index = activeIndexRef.current\n for (let i = 0; i < totalStepsRef.current; i++) {\n // - Check if the step was visited before,\n // - if, not check if the step has already an state,\n // - if, not check if the step is before the active step and and below.\n // - Only then set the state to \"unknown\"\n if (\n !visitedStepsRef.current[i] &&\n stepStatusRef.current[i] === undefined &&\n i < index &&\n i !== index\n ) {\n setStepState(i, 'unknown')\n }\n }\n }, [setStepState])\n\n const hasInvalidStepsState: WizardContextState['hasInvalidStepsState'] =\n useCallback((forStates) => {\n const steps = Object.values(stepStatusRef.current)\n return (forStates || ['unknown', 'error']).some((state) =>\n steps.includes(state)\n )\n }, [])\n\n const handleSubmit = useCallback(\n ({ preventSubmit }) => {\n handleUnknownStepsState()\n\n // - If there is an unknown step state, we need to prevent the submit\n if (hasInvalidStepsState()) {\n return preventSubmit()\n }\n\n if (activeIndexRef.current + 1 < totalStepsRef.current) {\n handleNext()\n preventSubmit()\n }\n },\n [handleUnknownStepsState, hasInvalidStepsState, handleNext]\n )\n dataContext.setHandleSubmit?.(handleSubmit)\n\n const { check } = useVisibility()\n\n const providerValue = useMemo<WizardContextState>(() => {\n return {\n id,\n activeIndex,\n initialActiveIndex,\n stepElementRef,\n stepsRef,\n updateTitlesRef,\n activeIndexRef,\n totalStepsRef,\n stepStatusRef,\n prerenderFieldProps,\n prerenderFieldPropsRef,\n hasErrorInOtherStepRef,\n keepInDOM,\n check,\n setActiveIndex,\n handlePrevious,\n hasInvalidStepsState,\n revealError,\n handleNext,\n setFormError,\n }\n }, [\n id,\n activeIndex,\n initialActiveIndex,\n prerenderFieldProps,\n keepInDOM,\n check,\n setActiveIndex,\n handlePrevious,\n hasInvalidStepsState,\n revealError,\n handleNext,\n setFormError,\n ])\n\n // - Handle shared state\n useLayoutEffect(() => {\n if (id && hasContext) {\n sharedStateRef.current.extend(providerValue)\n }\n }, [hasContext, id, providerValue])\n\n useLayoutEffect(() => {\n updateTitlesRef.current?.()\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [stepsRef.current])\n\n const stepsLengthDidChange = useCallback(() => {\n const count = Object.keys(stepsRef.current).length\n const tmpCount = Object.keys(tmpStepsRef.current).length\n return count !== 0 && tmpCount !== 0 && count !== tmpCount\n }, [])\n\n // - Call onStepChange when step gets replaced or added (e.g. via includeWhen)\n useLayoutEffect(() => {\n if (stepsLengthDidChange()) {\n callOnStepChange(activeIndexRef.current, 'stepListModified')\n executeLayoutAnimationRef.current?.()\n }\n tmpStepsRef.current = stepsRef.current\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [stepsRef.current, callOnStepChange, stepsLengthDidChange])\n\n if (!hasContext) {\n warn('You may wrap Wizard.Container in Form.Handler')\n return (\n <Handler>\n <WizardContainer {...props} id={id} />\n </Handler>\n )\n }\n\n return (\n <WizardContext.Provider value={providerValue}>\n <Space\n className={classnames(\n 'dnb-forms-wizard-layout',\n `dnb-forms-wizard-layout--${variant}`,\n className\n )}\n innerRef={elementRef}\n {...rest}\n >\n <DisplaySteps\n mode={mode}\n variant={variant}\n noAnimation={noAnimation}\n handleChange={handleChange}\n sidebarId={sidebarId}\n />\n\n <div className=\"dnb-forms-wizard-layout__contents\">\n <IterateOverSteps>{children}</IterateOverSteps>\n </div>\n </Space>\n\n {prerenderFieldProps && !keepInDOM && (\n <PrerenderFieldPropsOfOtherSteps\n prerenderFieldPropsRef={prerenderFieldPropsRef}\n />\n )}\n </WizardContext.Provider>\n )\n}\n\nWizardContainer._supportsSpacingProps = true\n\nexport default WizardContainer\n"],"mappings":";;;;;;;;;AAAA,OAAOA,KAAK,IACVC,UAAU,EACVC,WAAW,EACXC,MAAM,EACNC,UAAU,EACVC,OAAO,QACF,OAAO;AACd,OAAOC,UAAU,MAAM,YAAY;AACnC,SAASC,KAAK,QAAQ,wBAAwB;AAC9C,SAASC,IAAI,QAAQ,qCAAqC;AAC1D,SAASC,OAAO,QAAQ,oCAAoC;AAC5D,OAAOC,KAAK,MAAM,kCAAkC;AACpD,OAAOC,aAAa,MAEb,0BAA0B;AAajC,OAAOC,WAAW,MAAM,2BAA2B;AACnD,OAAOC,OAAO,MAAM,4BAA4B;AAChD,SAEEC,kBAAkB,EAClBC,cAAc,QACT,2CAA2C;AAClD,OAAOC,qBAAqB,MAAM,yBAAyB;AAC3D,OAAOC,gBAAgB,MAAM,oBAAoB;AAEjD,OAAOC,aAAa,MAAM,qCAAqC;AAC/D,SAASC,YAAY,QAAQ,gBAAgB;AAC7C,SAASC,gBAAgB,QAAQ,oBAAoB;AACrD,SAASC,+BAA+B,QAAQ,mCAAmC;AAGnF,MAAMC,eAAe,GACnB,OAAOC,MAAM,KAAK,WAAW,GAAGvB,KAAK,CAACwB,SAAS,GAAGxB,KAAK,CAACsB,eAAe;AAoEzE,SAASG,eAAeA,CAACC,KAAY,EAAE;EAAA,IAAAC,qBAAA;EACrC,MAAM;MACJC,SAAS;MACTC,EAAE,EAAEC,MAAM;MACVC,IAAI,GAAG,QAAQ;MACfC,kBAAkB,GAAG,CAAC;MACtBC,oBAAoB;MACpBC,mBAAmB;MACnBC,YAAY;MACZC,QAAQ;MACRC,WAAW,GAAG,IAAI;MAClBC,mBAAmB,GAAG,IAAI;MAC1BC,SAAS;MACTC,cAAc;MACdC,OAAO,GAAG,SAAS;MACnBC;IAEF,CAAC,GAAGhB,KAAK;IADJ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AACzI,aAAa,CAAC2I,QAAQ;IAACC,KAAK,EAAEX;EAAc,GAC3C5I,KAAA,CAAAoJ,aAAA,CAAC7I,KAAK,EAAA8I,QAAA;IACJzH,SAAS,EAAEtB,UAAU,qDAESmC,OAAO,IACnCb,SACF,CAAE;IACF4H,QAAQ,EAAE5F;EAAW,GACjBjB,IAAI,GAER3C,KAAA,CAAAoJ,aAAA,CAACjI,YAAY;IACXY,IAAI,EAAEA,IAAK;IACXU,OAAO,EAAEA,OAAQ;IACjBJ,WAAW,EAAEA,WAAY;IACzByF,YAAY,EAAEA,YAAa;IAC3BpF,SAAS,EAAEA;EAAU,CACtB,CAAC,EAEF1C,KAAA,CAAAoJ,aAAA;IAAKxH,SAAS,EAAC;EAAmC,GAChD5B,KAAA,CAAAoJ,aAAA,CAAChI,gBAAgB,QAAEgB,QAA2B,CAC3C,CACA,CAAC,EAEPE,mBAAmB,IAAI,CAACC,SAAS,IAChCvC,KAAA,CAAAoJ,aAAA,CAAC/H,+BAA+B;IAC9B6C,sBAAsB,EAAEA;EAAuB,CAChD,CAEmB,CAAC;AAE7B;AAEAzC,eAAe,CAACgI,qBAAqB,GAAG,IAAI;AAE5C,eAAehI,eAAe","ignoreList":[]}
1
+ {"version":3,"file":"WizardContainer.js","names":["React","useContext","useCallback","useRef","useReducer","useMemo","useEffect","classnames","Space","warn","isAsync","useId","WizardContext","DataContext","Handler","createReferenceKey","useSharedState","useHandleLayoutEffect","useStepAnimation","useVisibility","DisplaySteps","IterateOverSteps","PrerenderFieldPropsOfOtherSteps","useLayoutEffect","window","WizardContainer","props","_dataContext$setHandl","className","id","idProp","mode","initialActiveIndex","omitScrollManagement","omitFocusManagement","onStepChange","children","noAnimation","prerenderFieldProps","keepInDOM","validationMode","variant","sidebarId","rest","_objectWithoutProperties","_excluded","dataContext","hasContext","setFormState","handleSubmitCall","setShowAllErrors","setSubmitState","forceUpdate","activeIndexRef","totalStepsRef","NaN","submitCountRef","visitedStepsRef","Map","fieldErrorRef","storeStepStateRef","hasErrorInOtherStepRef","elementRef","stepElementRef","preventNextStepRef","stepsRef","tmpStepsRef","stepIndexRef","updateTitlesRef","prerenderFieldPropsRef","bypassOnNavigation","sharedStateRef","current","undefined","hasFieldErrorInStep","index","Array","from","values","some","_ref","i","hasError","setStepAsVisited","set","writeStepsState","arguments","length","forStates","result","existingState","get","includes","state","hasInvalidStepsState","setFieldError","path","preventNavigation","shouldPrevent","getStepChangeOptions","_stepsRef$current$get","previousIndex","options","previousStep","_stepsRef$current$get2","previousId","Object","assign","callOnStepChange","setFocus","scrollToTop","isInteractionRef","executeLayoutAnimationRef","handleLayoutEffect","handleStepChange","_ref2","skipErrorCheck","skipStepChangeCall","skipStepChangeCallBeforeMounted","skipStepChangeCallFromHook","didSubmit","onSubmit","_sharedStateRef$curre","_sharedStateRef$curre2","_sharedStateRef$curre3","data","call","Error","skipFieldValidation","enableAsyncBehavior","setActiveIndex","_objectSpread","handlePrevious","handleNext","handleChange","_ref3","current_step","setFormError","error","handleSubmit","_ref4","preventSubmit","setHandleSubmit","check","mapOverChildrenRef","enableMapOverChildren","activeIndex","providerValue","extend","_updateTitlesRef$curr","stepsLengthDidChange","tmpCount","count","_executeLayoutAnimati","createElement","_extends","Provider","value","innerRef","_supportsSpacingProps"],"sources":["../../../../../../src/extensions/forms/Wizard/Container/WizardContainer.tsx"],"sourcesContent":["import React, {\n useContext,\n useCallback,\n useRef,\n useReducer,\n useMemo,\n useEffect,\n} from 'react'\nimport classnames from 'classnames'\nimport { Space } from '../../../../components'\nimport { warn } from '../../../../shared/component-helper'\nimport { isAsync } from '../../../../shared/helpers/isAsync'\nimport useId from '../../../../shared/helpers/useId'\nimport WizardContext, {\n WizardContextState,\n} from '../Context/WizardContext'\nimport type {\n OnStepChange,\n OnStepChangeOptions,\n OnStepsChangeMode,\n SetActiveIndexOptions,\n StepIndex,\n Steps,\n InternalFieldError,\n InternalVisitedSteps,\n InternalStepStatus,\n InternalStepStatuses,\n} from '../Context/types'\nimport DataContext from '../../DataContext/Context'\nimport Handler from '../../Form/Handler/Handler'\nimport {\n SharedStateReturn,\n createReferenceKey,\n useSharedState,\n} from '../../../../shared/helpers/useSharedState'\nimport useHandleLayoutEffect from './useHandleLayoutEffect'\nimport useStepAnimation from './useStepAnimation'\nimport { ComponentProps } from '../../types'\nimport useVisibility from '../../Form/Visibility/useVisibility'\nimport { DisplaySteps } from './DisplaySteps'\nimport { IterateOverSteps } from './IterateOverSteps'\nimport { PrerenderFieldPropsOfOtherSteps } from './PrerenderFieldPropsOfOtherSteps'\n\n// SSR warning fix: https://gist.github.com/gaearon/e7d97cdf38a2907924ea12e4ebdf3c85\nconst useLayoutEffect =\n typeof window === 'undefined' ? React.useEffect : React.useLayoutEffect\n\nexport type Props = ComponentProps & {\n id?: string\n\n /**\n * The mode of the wizard.\n */\n mode?: 'static' | 'strict' | 'loose'\n\n /**\n * If set to `true`, the wizard will not scroll to the first step when the user clicks on the next button.\n */\n omitScrollManagement?: boolean\n\n /**\n * If set to `true`, the wizard will not focus on the next step when the user clicks on the next button.\n */\n omitFocusManagement?: boolean\n\n /**\n * The index of the first step to be rendered.\n */\n initialActiveIndex?: StepIndex\n\n /**\n * The callback function that will be called when the user clicks on the next button.\n */\n onStepChange?: OnStepChange\n\n /**\n * The sidebar variant.\n */\n variant?: 'sidebar' | 'drawer'\n sidebarId?: string\n\n /**\n * If set to `true`, the wizard will not animate the steps.\n */\n noAnimation?: boolean\n\n /**\n * If set to `true`, the wizard will not unmount the steps when navigating back and forth.\n */\n keepInDOM?: boolean\n\n /**\n * If set to `true`, the wizard pre-render all steps so the props of each field is available in the data context.\n * Defaults to `true`.\n */\n prerenderFieldProps?: boolean\n\n /**\n * Determines if and how the validation will be bypassed.\n */\n validationMode?: 'bypassOnNavigation'\n\n /**\n * The children of the wizard container.\n */\n children: React.ReactNode\n\n /**\n * @deprecated Is enabled by default. You can disable it with \"omitScrollManagement\"\n */\n scrollTopOnStepChange?: boolean\n}\n\nfunction WizardContainer(props: Props) {\n const {\n className,\n id: idProp,\n mode = 'strict',\n initialActiveIndex = 0,\n omitScrollManagement,\n omitFocusManagement,\n onStepChange,\n children,\n noAnimation = true,\n prerenderFieldProps = true,\n keepInDOM,\n validationMode,\n variant = 'sidebar',\n sidebarId,\n ...rest\n } = props\n\n const dataContext = useContext(DataContext)\n const {\n hasContext,\n setFormState,\n handleSubmitCall,\n setShowAllErrors,\n setSubmitState,\n } = dataContext\n\n const id = useId(idProp)\n const [, forceUpdate] = useReducer(() => ({}), {})\n const activeIndexRef = useRef<StepIndex>(initialActiveIndex)\n const totalStepsRef = useRef<number>(NaN)\n const submitCountRef = useRef(0)\n const visitedStepsRef = useRef<InternalVisitedSteps>(new Map())\n const fieldErrorRef = useRef<InternalFieldError>(new Map())\n const storeStepStateRef = useRef<InternalStepStatuses>(new Map())\n const hasErrorInOtherStepRef = useRef<boolean>(false)\n const elementRef = useRef<HTMLElement>()\n const stepElementRef = useRef<HTMLElement>()\n const preventNextStepRef = useRef(false)\n const stepsRef = useRef<Steps>(new Map())\n const tmpStepsRef = useRef<number>()\n const stepIndexRef = useRef<number>(-1)\n const updateTitlesRef = useRef<() => void>()\n const prerenderFieldPropsRef = useRef<\n Record<string, () => React.ReactElement>\n >({})\n\n const bypassOnNavigation = validationMode === 'bypassOnNavigation'\n\n // - Handle shared state\n const sharedStateRef =\n useRef<\n SharedStateReturn<\n WizardContextState & { onStepChange?: OnStepChange }\n >\n >()\n sharedStateRef.current = useSharedState<WizardContextState>(\n hasContext && id ? createReferenceKey(id, 'wizard') : undefined\n )\n\n const hasFieldErrorInStep = useCallback((index: StepIndex) => {\n return Array.from(fieldErrorRef.current.values()).some(\n ({ index: i, hasError }) => {\n return i === index && hasError\n }\n )\n }, [])\n\n const setStepAsVisited = useCallback((index: StepIndex) => {\n visitedStepsRef.current.set(index, true)\n }, [])\n\n useEffect(() => {\n if (!initialActiveIndex) {\n setStepAsVisited(activeIndexRef.current)\n }\n }, [initialActiveIndex, setStepAsVisited])\n\n /**\n * - This method is used to check if a step (or any step) has an invalid state.\n *\n * If a step was not visited before, it will be set to \"unknown\".\n * If a step was visited before, but has an invalid state, it will be set to \"error\".\n * If an index is given, it will check if the step, with the given index, has an invalid state.\n */\n const writeStepsState: WizardContextState['writeStepsState'] =\n useCallback(\n (index = undefined, forStates = ['unknown', 'error']) => {\n for (let i = 0; i < totalStepsRef.current; i++) {\n if (index !== undefined && index !== i) {\n continue\n }\n\n let result: InternalStepStatus = undefined\n const existingState = storeStepStateRef.current.get(i)\n\n if (forStates.includes('unknown')) {\n const state =\n i < activeIndexRef.current &&\n visitedStepsRef.current.get(i) === undefined\n if (state) {\n result = 'unknown'\n }\n }\n\n if (forStates.includes('error')) {\n const state = hasFieldErrorInStep(i)\n if (state) {\n result = 'error'\n } else if (existingState === 'error') {\n if (i === activeIndexRef.current) {\n result = undefined\n } else {\n result = existingState\n }\n }\n }\n\n storeStepStateRef.current.set(i, result)\n }\n },\n [hasFieldErrorInStep]\n )\n\n const hasInvalidStepsState: WizardContextState['hasInvalidStepsState'] =\n useCallback((index = undefined, forStates = ['unknown', 'error']) => {\n for (let i = 0; i < totalStepsRef.current; i++) {\n if (index !== undefined && index !== i) {\n continue\n }\n\n const state = storeStepStateRef.current.get(i)\n\n if (forStates.includes('unknown')) {\n if (state === 'unknown') {\n return true\n }\n }\n\n if (forStates.includes('error')) {\n if (state === 'error') {\n return true\n }\n }\n }\n\n return false\n }, [])\n\n const setFieldError: WizardContextState['setFieldError'] = useCallback(\n (index, path, hasError) => {\n fieldErrorRef.current.set(path, { index, hasError })\n },\n []\n )\n\n const preventNavigation = useCallback((shouldPrevent = true) => {\n preventNextStepRef.current = shouldPrevent\n }, [])\n\n const getStepChangeOptions: (index: StepIndex) => OnStepChangeOptions =\n useCallback(\n (index) => {\n const previousIndex = activeIndexRef.current\n const options = {\n preventNavigation,\n previousStep: { index: previousIndex },\n }\n\n const id = stepsRef.current.get(index)?.id\n if (id) {\n const previousId = stepsRef.current.get(previousIndex)?.id\n Object.assign(options, { id })\n Object.assign(options.previousStep, { id: previousId })\n }\n\n return options\n },\n [preventNavigation]\n )\n\n const callOnStepChange = useCallback(\n async (index: StepIndex, mode: OnStepsChangeMode) => {\n if (isAsync(onStepChange)) {\n return await onStepChange(index, mode, getStepChangeOptions(index))\n }\n\n return onStepChange?.(index, mode, getStepChangeOptions(index))\n },\n [getStepChangeOptions, onStepChange]\n )\n\n const { setFocus, scrollToTop, isInteractionRef } =\n useHandleLayoutEffect({ elementRef, stepElementRef })\n\n const executeLayoutAnimationRef = useRef<() => void>()\n useStepAnimation({\n activeIndexRef,\n stepElementRef,\n executeLayoutAnimationRef,\n })\n\n const handleLayoutEffect = useCallback(() => {\n if (!omitFocusManagement) {\n setFocus()\n }\n if (!omitScrollManagement) {\n scrollToTop()\n }\n }, [omitScrollManagement, omitFocusManagement, setFocus, scrollToTop])\n\n const handleStepChange = useCallback(\n async ({\n index,\n skipErrorCheck,\n skipStepChangeCall,\n skipStepChangeCallBeforeMounted,\n skipStepChangeCallFromHook,\n mode,\n }: {\n index: StepIndex\n mode: OnStepsChangeMode\n } & SetActiveIndexOptions) => {\n let didSubmit = false\n const onSubmit = async () => {\n if (!skipStepChangeCallFromHook) {\n sharedStateRef.current?.data?.onStepChange?.(\n index,\n mode,\n getStepChangeOptions(index)\n )\n }\n\n let result = undefined\n\n if (\n !skipStepChangeCall &&\n !(skipStepChangeCallBeforeMounted && !isInteractionRef.current)\n ) {\n result = await callOnStepChange(index, mode)\n }\n\n // Hide async indicator\n setFormState('abort')\n\n // Set the \"showAllErrors\" to the step we got to\n setShowAllErrors(\n bypassOnNavigation\n ? false\n : hasInvalidStepsState(index, ['error'])\n )\n\n if (!preventNextStepRef.current && !(result instanceof Error)) {\n handleLayoutEffect()\n\n activeIndexRef.current = index\n setStepAsVisited(activeIndexRef.current)\n forceUpdate()\n }\n\n preventNextStepRef.current = false\n didSubmit = true\n\n return result\n }\n\n await handleSubmitCall({\n skipErrorCheck,\n skipFieldValidation: skipErrorCheck,\n enableAsyncBehavior: isAsync(onStepChange),\n onSubmit: bypassOnNavigation ? () => null : onSubmit,\n })\n\n if (!didSubmit) {\n if (bypassOnNavigation) {\n await onSubmit()\n } else {\n if (mode === 'next') {\n // First we need to write the steps state for the current active index.\n writeStepsState(activeIndexRef.current, ['error'])\n\n // In case steps were visited before, or they use the \"keepInDOM\" prop,\n // we need to check the step status, because other steps may report an error,\n // so the user will not be able to navigate to the next step,\n // because the form contains errors. Thats why onSubmit will not be called via handleSubmitCall.\n if (!hasInvalidStepsState(activeIndexRef.current)) {\n await onSubmit()\n }\n }\n }\n }\n },\n [\n bypassOnNavigation,\n callOnStepChange,\n getStepChangeOptions,\n handleLayoutEffect,\n handleSubmitCall,\n hasInvalidStepsState,\n isInteractionRef,\n onStepChange,\n setFormState,\n setShowAllErrors,\n setStepAsVisited,\n writeStepsState,\n ]\n )\n\n const setActiveIndex = useCallback(\n (index: StepIndex, options?: SetActiveIndexOptions) => {\n if (index === activeIndexRef.current) {\n return\n }\n\n const mode = index > activeIndexRef.current ? 'next' : 'previous'\n\n handleStepChange({\n index,\n skipErrorCheck: mode === 'previous',\n mode,\n ...options,\n })\n },\n [handleStepChange]\n )\n\n const handlePrevious = useCallback(() => {\n setActiveIndex(activeIndexRef.current - 1)\n }, [setActiveIndex])\n\n const handleNext = useCallback(() => {\n setActiveIndex(activeIndexRef.current + 1)\n }, [setActiveIndex])\n\n const handleChange = useCallback(\n ({ current_step }) => {\n setActiveIndex(\n current_step,\n mode === 'loose' ? { skipErrorCheck: true } : undefined\n )\n },\n [mode, setActiveIndex]\n )\n\n const setFormError = useCallback(\n (error: Error) => {\n setSubmitState?.({ error })\n },\n [setSubmitState]\n )\n\n const handleSubmit = useCallback(\n ({ preventSubmit }) => {\n submitCountRef.current += 1\n\n // - If there is an unknown step state, we need to prevent the submit\n if (hasInvalidStepsState()) {\n return preventSubmit()\n }\n\n if (activeIndexRef.current + 1 < totalStepsRef.current) {\n handleNext()\n preventSubmit()\n }\n },\n [hasInvalidStepsState, handleNext]\n )\n dataContext.setHandleSubmit?.(handleSubmit)\n\n // NB: useVisibility needs to be imported here,\n // because it need the outer context to be available.\n const { check } = useVisibility()\n\n // This is used to map over the children and to give them the correct index,\n // in case it could be given properly, like if no id or title was given in React.StrictMode.\n const mapOverChildrenRef = useRef(false)\n const enableMapOverChildren = useCallback(() => {\n mapOverChildrenRef.current = true\n }, [])\n\n const activeIndex = activeIndexRef.current\n const providerValue = useMemo<WizardContextState>(() => {\n return {\n id,\n activeIndex,\n initialActiveIndex,\n stepElementRef,\n stepsRef,\n updateTitlesRef,\n activeIndexRef,\n stepIndexRef,\n totalStepsRef,\n submitCountRef,\n prerenderFieldProps,\n prerenderFieldPropsRef,\n hasErrorInOtherStepRef,\n keepInDOM,\n enableMapOverChildren,\n mapOverChildrenRef,\n check,\n setActiveIndex,\n handlePrevious,\n hasInvalidStepsState,\n writeStepsState,\n setFieldError,\n handleNext,\n setFormError,\n } satisfies WizardContextState\n }, [\n id,\n activeIndex,\n initialActiveIndex,\n prerenderFieldProps,\n keepInDOM,\n enableMapOverChildren,\n check,\n setActiveIndex,\n handlePrevious,\n hasInvalidStepsState,\n writeStepsState,\n setFieldError,\n handleNext,\n setFormError,\n ])\n\n // - Handle shared state\n useLayoutEffect(() => {\n if (id && hasContext) {\n sharedStateRef.current.extend(providerValue)\n }\n }, [hasContext, id, providerValue])\n\n useLayoutEffect(() => {\n updateTitlesRef.current?.()\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [stepsRef.current])\n\n const stepsLengthDidChange = useCallback(() => {\n const tmpCount = tmpStepsRef.current\n if (tmpCount === undefined) {\n return false\n }\n const count = totalStepsRef.current\n return count !== 0 && tmpCount !== 0 && count !== tmpCount\n }, [])\n\n // - Call onStepChange when step gets replaced or added (e.g. via includeWhen)\n useLayoutEffect(() => {\n if (stepsLengthDidChange()) {\n callOnStepChange(activeIndexRef.current, 'stepListModified')\n executeLayoutAnimationRef.current?.()\n }\n\n tmpStepsRef.current = totalStepsRef.current\n\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [\n totalStepsRef.current, // Include the totalStepsRef.current to trigger the useEffect on change\n callOnStepChange,\n stepsLengthDidChange,\n ])\n\n if (!hasContext) {\n warn('You may wrap Wizard.Container in Form.Handler')\n return (\n <Handler>\n <WizardContainer {...props} id={id} />\n </Handler>\n )\n }\n\n return (\n <WizardContext.Provider value={providerValue}>\n <Space\n className={classnames(\n 'dnb-forms-wizard-layout',\n `dnb-forms-wizard-layout--${variant}`,\n className\n )}\n innerRef={elementRef}\n {...rest}\n >\n <DisplaySteps\n mode={mode}\n variant={variant}\n noAnimation={noAnimation}\n handleChange={handleChange}\n sidebarId={sidebarId}\n />\n\n <div className=\"dnb-forms-wizard-layout__contents\">\n <IterateOverSteps>{children}</IterateOverSteps>\n </div>\n </Space>\n\n {prerenderFieldProps && !keepInDOM && (\n <PrerenderFieldPropsOfOtherSteps\n prerenderFieldPropsRef={prerenderFieldPropsRef}\n />\n )}\n </WizardContext.Provider>\n )\n}\n\nWizardContainer._supportsSpacingProps = true\n\nexport default WizardContainer\n"],"mappings":";;;;;;;;;AAAA,OAAOA,KAAK,IACVC,UAAU,EACVC,WAAW,EACXC,MAAM,EACNC,UAAU,EACVC,OAAO,EACPC,SAAS,QACJ,OAAO;AACd,OAAOC,UAAU,MAAM,YAAY;AACnC,SAASC,KAAK,QAAQ,wBAAwB;AAC9C,SAASC,IAAI,QAAQ,qCAAqC;AAC1D,SAASC,OAAO,QAAQ,oCAAoC;AAC5D,OAAOC,KAAK,MAAM,kCAAkC;AACpD,OAAOC,aAAa,MAEb,0BAA0B;AAajC,OAAOC,WAAW,MAAM,2BAA2B;AACnD,OAAOC,OAAO,MAAM,4BAA4B;AAChD,SAEEC,kBAAkB,EAClBC,cAAc,QACT,2CAA2C;AAClD,OAAOC,qBAAqB,MAAM,yBAAyB;AAC3D,OAAOC,gBAAgB,MAAM,oBAAoB;AAEjD,OAAOC,aAAa,M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AC,EAEF1C,KAAA,CAAA0J,aAAA;IAAK9H,SAAS,EAAC;EAAmC,GAChD5B,KAAA,CAAA0J,aAAA,CAACrI,gBAAgB,QAAEe,QAA2B,CAC3C,CACA,CAAC,EAEPE,mBAAmB,IAAI,CAACC,SAAS,IAChCvC,KAAA,CAAA0J,aAAA,CAACpI,+BAA+B;IAC9B+C,sBAAsB,EAAEA;EAAuB,CAChD,CAEmB,CAAC;AAE7B;AAEA5C,eAAe,CAACsI,qBAAqB,GAAG,IAAI;AAE5C,eAAetI,eAAe","ignoreList":[]}
@@ -0,0 +1,10 @@
1
+ export declare function useCollectStepsData(): {
2
+ collectStepsData: ({ id, index, inactive, title }: {
3
+ id: any;
4
+ index: any;
5
+ inactive: any;
6
+ title: any;
7
+ }) => {
8
+ title: any;
9
+ };
10
+ };