@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,10 @@
1
1
  "use client";
2
2
 
3
3
  import React, { useContext } from 'react';
4
- import { useTranslation } from '../../hooks';
5
- import { convertJsxToString } from '../../../../shared/component-helper';
6
4
  import WizardContext from '../Context/WizardContext';
5
+ import WizardStepContext from '../Step/StepContext';
7
6
  import Step, { handleDeprecatedProps as handleDeprecatedStepProps } from '../Step/Step';
7
+ import { useCollectStepsData } from './useCollectStepsData';
8
8
  export function IterateOverSteps({
9
9
  children
10
10
  }) {
@@ -13,15 +13,19 @@ export function IterateOverSteps({
13
13
  stepsRef,
14
14
  activeIndexRef,
15
15
  totalStepsRef,
16
- stepStatusRef,
16
+ stepIndexRef,
17
17
  prerenderFieldProps,
18
18
  prerenderFieldPropsRef,
19
- hasErrorInOtherStepRef
19
+ hasErrorInOtherStepRef,
20
+ mapOverChildrenRef
20
21
  } = useContext(WizardContext);
22
+ const {
23
+ collectStepsData
24
+ } = useCollectStepsData();
25
+ stepsRef.current = new Map();
21
26
  hasErrorInOtherStepRef.current = false;
22
- stepsRef.current = {};
23
- let incrementIndex = -1;
24
- const translations = useTranslation();
27
+ stepIndexRef.current = -1;
28
+ totalStepsRef.current = 0;
25
29
  const childrenArray = React.Children.map(children, child => {
26
30
  if (React.isValidElement(child)) {
27
31
  var _child, _child2;
@@ -35,7 +39,7 @@ export function IterateOverSteps({
35
39
  }
36
40
  if (((_child2 = child) === null || _child2 === void 0 ? void 0 : _child2.type) === Step) {
37
41
  const {
38
- title: titleProp,
42
+ title,
39
43
  inactive,
40
44
  include,
41
45
  includeWhen,
@@ -49,45 +53,42 @@ export function IterateOverSteps({
49
53
  })) {
50
54
  return null;
51
55
  }
52
- incrementIndex++;
53
- const index = incrementIndex;
54
- const title = titleProp !== undefined ? convertJsxToString(titleProp) : 'Title missing';
55
- const state = stepStatusRef.current[index];
56
- const status = index !== activeIndexRef.current ? state === 'error' ? translations.Step.stepHasError : state === 'unknown' ? 'Unknown state' : undefined : undefined;
57
- const statusState = state === 'error' ? 'error' : undefined;
58
- const key = `${index}-${activeIndexRef.current}`;
59
- if (status) {
60
- hasErrorInOtherStepRef.current = true;
61
- }
62
- stepsRef.current[index] = {
56
+ const index = totalStepsRef.current;
57
+ totalStepsRef.current = totalStepsRef.current + 1;
58
+ collectStepsData({
63
59
  id,
64
- title,
60
+ index,
65
61
  inactive,
66
- status,
67
- statusState
68
- };
69
- const clone = props => React.cloneElement(child, props);
62
+ title
63
+ });
70
64
  if (prerenderFieldProps && typeof document !== 'undefined' && index !== activeIndexRef.current && typeof prerenderFieldPropsRef.current['step-' + index] === 'undefined') {
71
- prerenderFieldPropsRef.current['step-' + index] = () => clone({
65
+ const key = `${index}-${activeIndexRef.current}`;
66
+ prerenderFieldPropsRef.current['step-' + index] = () => React.cloneElement(child, {
72
67
  key,
73
68
  index,
74
69
  prerenderFieldProps: true
75
70
  });
76
71
  }
77
- return clone({
78
- key,
79
- index
80
- });
72
+ return child;
81
73
  }
82
74
  }
83
75
  return child;
84
76
  });
85
- if ((childrenArray === null || childrenArray === void 0 ? void 0 : childrenArray.length) === 0) {
77
+ if (totalStepsRef.current === 0) {
86
78
  activeIndexRef.current = 0;
87
- } else if ((childrenArray === null || childrenArray === void 0 ? void 0 : childrenArray.length) < activeIndexRef.current + 1) {
88
- activeIndexRef.current = childrenArray.length - 1;
79
+ } else if (totalStepsRef.current < activeIndexRef.current + 1) {
80
+ activeIndexRef.current = totalStepsRef.current - 1;
81
+ }
82
+ if (mapOverChildrenRef.current) {
83
+ return childrenArray.map((child, index) => {
84
+ return React.createElement(WizardStepContext.Provider, {
85
+ key: index,
86
+ value: {
87
+ index
88
+ }
89
+ }, child);
90
+ });
89
91
  }
90
- totalStepsRef.current = childrenArray === null || childrenArray === void 0 ? void 0 : childrenArray.length;
91
- return childrenArray;
92
+ return children;
92
93
  }
93
94
  //# sourceMappingURL=IterateOverSteps.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"IterateOverSteps.js","names":["React","useContext","useTranslation","convertJsxToString","WizardContext","Step","handleDeprecatedProps","handleDeprecatedStepProps","IterateOverSteps","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,OAAOC,IAAI,IAETC,qBAAqB,IAAIC,yBAAyB,QAC7C,cAAc;AAErB,OA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E,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","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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A,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,OACExC,KAAA,CAAA4C,aAAA,CAACzC,iBAAiB,CAAC0C,QAAQ;QAACH,GAAG,EAAEF,KAAM;QAACM,KAAK,EAAE;UAAEN;QAAM;MAAE,GACtDf,KACyB,CAAC;IAEjC,CAAC,CAAC;EACJ;EAEA,OAAOhB,QAAQ;AACjB","ignoreList":[]}
@@ -6,7 +6,7 @@ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutPr
6
6
  const _excluded = ["className", "id", "mode", "initialActiveIndex", "omitScrollManagement", "omitFocusManagement", "onStepChange", "children", "noAnimation", "prerenderFieldProps", "keepInDOM", "validationMode", "variant", "sidebarId"];
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
- import React, { useContext, useCallback, useRef, useReducer, useMemo } from 'react';
9
+ import React, { useContext, useCallback, useRef, useReducer, useMemo, useEffect } from 'react';
10
10
  import classnames from 'classnames';
11
11
  import { Space } from '../../../../components';
12
12
  import { warn } from '../../../../shared/component-helper';
@@ -54,56 +54,96 @@ function WizardContainer(props) {
54
54
  const [, forceUpdate] = useReducer(() => ({}), {});
55
55
  const activeIndexRef = useRef(initialActiveIndex);
56
56
  const totalStepsRef = useRef(NaN);
57
- const stepStatusRef = useRef({});
58
- const hasVisibleErrorRef = useRef({});
57
+ const submitCountRef = useRef(0);
58
+ const visitedStepsRef = useRef(new Map());
59
+ const fieldErrorRef = useRef(new Map());
60
+ const storeStepStateRef = useRef(new Map());
59
61
  const hasErrorInOtherStepRef = useRef(false);
60
- const visitedStepsRef = useRef({});
61
62
  const elementRef = useRef();
62
63
  const stepElementRef = useRef();
63
64
  const preventNextStepRef = useRef(false);
64
- const stepsRef = useRef({});
65
- const tmpStepsRef = useRef({});
65
+ const stepsRef = useRef(new Map());
66
+ const tmpStepsRef = useRef();
67
+ const stepIndexRef = useRef(-1);
66
68
  const updateTitlesRef = useRef();
67
69
  const prerenderFieldPropsRef = useRef({});
68
70
  const bypassOnNavigation = validationMode === 'bypassOnNavigation';
69
71
  const sharedStateRef = useRef();
70
72
  sharedStateRef.current = useSharedState(hasContext && id ? createReferenceKey(id, 'wizard') : undefined);
71
- visitedStepsRef.current[activeIndexRef.current] = true;
72
- const setStepState = useCallback((index, state) => {
73
- stepStatusRef.current[index] = state;
74
- }, []);
75
73
  const hasFieldErrorInStep = useCallback(index => {
76
- return Object.values(hasVisibleErrorRef.current).some(({
74
+ return Array.from(fieldErrorRef.current.values()).some(({
77
75
  index: i,
78
76
  hasError
79
77
  }) => {
80
78
  return i === index && hasError;
81
79
  });
82
80
  }, []);
83
- const revealError = useCallback((index, path, hasError) => {
84
- hasVisibleErrorRef.current[path] = {
85
- index,
86
- hasError
87
- };
88
- if (hasFieldErrorInStep(index)) {
89
- setStepState(index, 'error');
81
+ const setStepAsVisited = useCallback(index => {
82
+ visitedStepsRef.current.set(index, true);
83
+ }, []);
84
+ useEffect(() => {
85
+ if (!initialActiveIndex) {
86
+ setStepAsVisited(activeIndexRef.current);
90
87
  }
91
- }, [hasFieldErrorInStep, setStepState]);
92
- const activeIndex = activeIndexRef.current;
93
- const hasErrorInActiveStep = hasFieldErrorInStep(activeIndex);
94
- useMemo(() => {
95
- const currentState = stepStatusRef.current[activeIndex];
96
- if (!hasErrorInActiveStep && ['error', 'valid'].includes(currentState)) {
97
- setStepState(activeIndex, 'valid');
98
- } else {
99
- setStepState(activeIndex, hasErrorInActiveStep ? 'error' : undefined);
88
+ }, [initialActiveIndex, setStepAsVisited]);
89
+ const writeStepsState = useCallback((index = undefined, forStates = ['unknown', 'error']) => {
90
+ for (let i = 0; i < totalStepsRef.current; i++) {
91
+ if (index !== undefined && index !== i) {
92
+ continue;
93
+ }
94
+ let result = undefined;
95
+ const existingState = storeStepStateRef.current.get(i);
96
+ if (forStates.includes('unknown')) {
97
+ const state = i < activeIndexRef.current && visitedStepsRef.current.get(i) === undefined;
98
+ if (state) {
99
+ result = 'unknown';
100
+ }
101
+ }
102
+ if (forStates.includes('error')) {
103
+ const state = hasFieldErrorInStep(i);
104
+ if (state) {
105
+ result = 'error';
106
+ } else if (existingState === 'error') {
107
+ if (i === activeIndexRef.current) {
108
+ result = undefined;
109
+ } else {
110
+ result = existingState;
111
+ }
112
+ }
113
+ }
114
+ storeStepStateRef.current.set(i, result);
115
+ }
116
+ }, [hasFieldErrorInStep]);
117
+ const hasInvalidStepsState = useCallback((index = undefined, forStates = ['unknown', 'error']) => {
118
+ for (let i = 0; i < totalStepsRef.current; i++) {
119
+ if (index !== undefined && index !== i) {
120
+ continue;
121
+ }
122
+ const state = storeStepStateRef.current.get(i);
123
+ if (forStates.includes('unknown')) {
124
+ if (state === 'unknown') {
125
+ return true;
126
+ }
127
+ }
128
+ if (forStates.includes('error')) {
129
+ if (state === 'error') {
130
+ return true;
131
+ }
132
+ }
100
133
  }
101
- }, [activeIndex, hasErrorInActiveStep, setStepState]);
134
+ return false;
135
+ }, []);
136
+ const setFieldError = useCallback((index, path, hasError) => {
137
+ fieldErrorRef.current.set(path, {
138
+ index,
139
+ hasError
140
+ });
141
+ }, []);
102
142
  const preventNavigation = useCallback((shouldPrevent = true) => {
103
143
  preventNextStepRef.current = shouldPrevent;
104
144
  }, []);
105
145
  const getStepChangeOptions = useCallback(index => {
106
- var _stepsRef$current$ind;
146
+ var _stepsRef$current$get;
107
147
  const previousIndex = activeIndexRef.current;
108
148
  const options = {
109
149
  preventNavigation,
@@ -111,10 +151,10 @@ function WizardContainer(props) {
111
151
  index: previousIndex
112
152
  }
113
153
  };
114
- const id = (_stepsRef$current$ind = stepsRef.current[index]) === null || _stepsRef$current$ind === void 0 ? void 0 : _stepsRef$current$ind.id;
154
+ const id = (_stepsRef$current$get = stepsRef.current.get(index)) === null || _stepsRef$current$get === void 0 ? void 0 : _stepsRef$current$get.id;
115
155
  if (id) {
116
- var _stepsRef$current$pre;
117
- const previousId = (_stepsRef$current$pre = stepsRef.current[previousIndex]) === null || _stepsRef$current$pre === void 0 ? void 0 : _stepsRef$current$pre.id;
156
+ var _stepsRef$current$get2;
157
+ const previousId = (_stepsRef$current$get2 = stepsRef.current.get(previousIndex)) === null || _stepsRef$current$get2 === void 0 ? void 0 : _stepsRef$current$get2.id;
118
158
  Object.assign(options, {
119
159
  id
120
160
  });
@@ -171,10 +211,11 @@ function WizardContainer(props) {
171
211
  result = await callOnStepChange(index, mode);
172
212
  }
173
213
  setFormState('abort');
174
- setShowAllErrors(bypassOnNavigation ? false : stepStatusRef.current[index] === 'error');
214
+ setShowAllErrors(bypassOnNavigation ? false : hasInvalidStepsState(index, ['error']));
175
215
  if (!preventNextStepRef.current && !(result instanceof Error)) {
176
216
  handleLayoutEffect();
177
217
  activeIndexRef.current = index;
218
+ setStepAsVisited(activeIndexRef.current);
178
219
  forceUpdate();
179
220
  }
180
221
  preventNextStepRef.current = false;
@@ -191,13 +232,15 @@ function WizardContainer(props) {
191
232
  if (bypassOnNavigation) {
192
233
  await onSubmit();
193
234
  } else {
194
- const state = stepStatusRef.current[activeIndexRef.current];
195
- if (mode === 'next' && state === 'valid') {
196
- await onSubmit();
235
+ if (mode === 'next') {
236
+ writeStepsState(activeIndexRef.current, ['error']);
237
+ if (!hasInvalidStepsState(activeIndexRef.current)) {
238
+ await onSubmit();
239
+ }
197
240
  }
198
241
  }
199
242
  }
200
- }, [bypassOnNavigation, callOnStepChange, getStepChangeOptions, handleLayoutEffect, handleSubmitCall, isInteractionRef, onStepChange, setFormState, setShowAllErrors]);
243
+ }, [bypassOnNavigation, callOnStepChange, getStepChangeOptions, handleLayoutEffect, handleSubmitCall, hasInvalidStepsState, isInteractionRef, onStepChange, setFormState, setShowAllErrors, setStepAsVisited, writeStepsState]);
201
244
  const setActiveIndex = useCallback((index, options) => {
202
245
  if (index === activeIndexRef.current) {
203
246
  return;
@@ -227,22 +270,10 @@ function WizardContainer(props) {
227
270
  error
228
271
  });
229
272
  }, [setSubmitState]);
230
- const handleUnknownStepsState = useCallback(() => {
231
- const index = activeIndexRef.current;
232
- for (let i = 0; i < totalStepsRef.current; i++) {
233
- if (!visitedStepsRef.current[i] && stepStatusRef.current[i] === undefined && i < index && i !== index) {
234
- setStepState(i, 'unknown');
235
- }
236
- }
237
- }, [setStepState]);
238
- const hasInvalidStepsState = useCallback(forStates => {
239
- const steps = Object.values(stepStatusRef.current);
240
- return (forStates || ['unknown', 'error']).some(state => steps.includes(state));
241
- }, []);
242
273
  const handleSubmit = useCallback(({
243
274
  preventSubmit
244
275
  }) => {
245
- handleUnknownStepsState();
276
+ submitCountRef.current += 1;
246
277
  if (hasInvalidStepsState()) {
247
278
  return preventSubmit();
248
279
  }
@@ -250,11 +281,16 @@ function WizardContainer(props) {
250
281
  handleNext();
251
282
  preventSubmit();
252
283
  }
253
- }, [handleUnknownStepsState, hasInvalidStepsState, handleNext]);
284
+ }, [hasInvalidStepsState, handleNext]);
254
285
  (_dataContext$setHandl = dataContext.setHandleSubmit) === null || _dataContext$setHandl === void 0 ? void 0 : _dataContext$setHandl.call(dataContext, handleSubmit);
255
286
  const {
256
287
  check
257
288
  } = useVisibility();
289
+ const mapOverChildrenRef = useRef(false);
290
+ const enableMapOverChildren = useCallback(() => {
291
+ mapOverChildrenRef.current = true;
292
+ }, []);
293
+ const activeIndex = activeIndexRef.current;
258
294
  const providerValue = useMemo(() => {
259
295
  return {
260
296
  id,
@@ -264,21 +300,25 @@ function WizardContainer(props) {
264
300
  stepsRef,
265
301
  updateTitlesRef,
266
302
  activeIndexRef,
303
+ stepIndexRef,
267
304
  totalStepsRef,
268
- stepStatusRef,
305
+ submitCountRef,
269
306
  prerenderFieldProps,
270
307
  prerenderFieldPropsRef,
271
308
  hasErrorInOtherStepRef,
272
309
  keepInDOM,
310
+ enableMapOverChildren,
311
+ mapOverChildrenRef,
273
312
  check,
274
313
  setActiveIndex,
275
314
  handlePrevious,
276
315
  hasInvalidStepsState,
277
- revealError,
316
+ writeStepsState,
317
+ setFieldError,
278
318
  handleNext,
279
319
  setFormError
280
320
  };
281
- }, [id, activeIndex, initialActiveIndex, prerenderFieldProps, keepInDOM, check, setActiveIndex, handlePrevious, hasInvalidStepsState, revealError, handleNext, setFormError]);
321
+ }, [id, activeIndex, initialActiveIndex, prerenderFieldProps, keepInDOM, enableMapOverChildren, check, setActiveIndex, handlePrevious, hasInvalidStepsState, writeStepsState, setFieldError, handleNext, setFormError]);
282
322
  useLayoutEffect(() => {
283
323
  if (id && hasContext) {
284
324
  sharedStateRef.current.extend(providerValue);
@@ -289,8 +329,11 @@ function WizardContainer(props) {
289
329
  (_updateTitlesRef$curr = updateTitlesRef.current) === null || _updateTitlesRef$curr === void 0 ? void 0 : _updateTitlesRef$curr.call(updateTitlesRef);
290
330
  }, [stepsRef.current]);
291
331
  const stepsLengthDidChange = useCallback(() => {
292
- const count = Object.keys(stepsRef.current).length;
293
- const tmpCount = Object.keys(tmpStepsRef.current).length;
332
+ const tmpCount = tmpStepsRef.current;
333
+ if (tmpCount === undefined) {
334
+ return false;
335
+ }
336
+ const count = totalStepsRef.current;
294
337
  return count !== 0 && tmpCount !== 0 && count !== tmpCount;
295
338
  }, []);
296
339
  useLayoutEffect(() => {
@@ -299,8 +342,8 @@ function WizardContainer(props) {
299
342
  callOnStepChange(activeIndexRef.current, 'stepListModified');
300
343
  (_executeLayoutAnimati = executeLayoutAnimationRef.current) === null || _executeLayoutAnimati === void 0 ? void 0 : _executeLayoutAnimati.call(executeLayoutAnimationRef);
301
344
  }
302
- tmpStepsRef.current = stepsRef.current;
303
- }, [stepsRef.current, callOnStepChange, stepsLengthDidChange]);
345
+ tmpStepsRef.current = totalStepsRef.current;
346
+ }, [totalStepsRef.current, callOnStepChange, stepsLengthDidChange]);
304
347
  if (!hasContext) {
305
348
  warn('You may wrap Wizard.Container in Form.Handler');
306
349
  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","i","hasError","revealError","path","activeIndex","hasErrorInActiveStep","currentState","includes","preventNavigation","shouldPrevent","getStepChangeOptions","_stepsRef$current$ind","previousIndex","options","previousStep","_stepsRef$current$pre","previousId","assign","callOnStepChange","setFocus","scrollToTop","isInteractionRef","executeLayoutAnimationRef","handleLayoutEffect","handleStepChange","skipErrorCheck","skipStepChangeCall","skipStepChangeCallBeforeMounted","skipStepChangeCallFromHook","didSubmit","onSubmit","_sharedStateRef$curre","_sharedStateRef$curre2","_sharedStateRef$curre3","data","call","result","Error","skipFieldValidation","enableAsyncBehavior","setActiveIndex","_objectSpread","handlePrevious","handleNext","handleChange","current_step","setFormError","error","handleUnknownStepsState","hasInvalidStepsState","forStates","steps","handleSubmit","preventSubmit","setHandleSubmit","check","providerValue","extend","_updateTitlesRef$curr","stepsLengthDidChange","count","keys","length","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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,IAAI,CAACC,SAAS,IAChCvC,KAAA,CAAA+I,aAAA,CAAC1H,+BAA+B;IAC9B6C,sBAAsB,EAAEA;EAAuB,CAChD,CAEmB,CAAC;AAE7B;AAEAzC,eAAe,CAAC2H,qBAAqB,GAAG,IAAI;AAE5C,eAAe3H,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","i","hasError","setStepAsVisited","set","writeStepsState","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","skipErrorCheck","skipStepChangeCall","skipStepChangeCallBeforeMounted","skipStepChangeCallFromHook","didSubmit","onSubmit","_sharedStateRef$curre","_sharedStateRef$curre2","_sharedStateRef$curre3","data","call","Error","skipFieldValidation","enableAsyncBehavior","setActiveIndex","_objectSpread","handlePrevious","handleNext","handleChange","current_step","setFormError","error","handleSubmit","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,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,GAAGxB,KAAK,CAACM,SAAS,GAAGN,KAAK,CAACuB,eAAe;AAoEzE,SAASE,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;IADJiB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IAAI,EAAEA,IAAK;IACXU,OAAO,EAAEA,OAAQ;IACjBJ,WAAW,EAAEA,WAAY;IACzB6F,YAAY,EAAEA,YAAa;IAC3BxF,SAAS,EAAEA;EAAU,CACtB,CAAC,EAEF1C,KAAA,CAAAoJ,aAAA;IAAKxH,SAAS,EAAC;EAAmC,GAChD5B,KAAA,CAAAoJ,aAAA,CAAC/H,gBAAgB,QAAEe,QAA2B,CAC3C,CACA,CAAC,EAEPE,mBAAmB,IAAI,CAACC,SAAS,IAChCvC,KAAA,CAAAoJ,aAAA,CAAC9H,+BAA+B;IAC9B+C,sBAAsB,EAAEA;EAAuB,CAChD,CAEmB,CAAC;AAE7B;AAEA5C,eAAe,CAACgI,qBAAqB,GAAG,IAAI;AAE5C,eAAehI,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
+ };