@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.
- package/CHANGELOG.md +24 -0
- package/cjs/components/global-error/GlobalError.d.ts +1 -1
- package/cjs/components/global-error/GlobalError.js +1 -1
- package/cjs/components/global-error/GlobalError.js.map +1 -1
- package/cjs/components/global-error/GlobalErrorDocs.d.ts +2 -0
- package/cjs/components/global-error/GlobalErrorDocs.js +64 -0
- package/cjs/components/global-error/GlobalErrorDocs.js.map +1 -0
- package/cjs/components/info-card/InfoCardDocs.d.ts +3 -0
- package/cjs/components/info-card/InfoCardDocs.js +101 -0
- package/cjs/components/info-card/InfoCardDocs.js.map +1 -0
- package/cjs/components/tabs/Tabs.js +2 -2
- package/cjs/components/tabs/Tabs.js.map +1 -1
- package/cjs/components/upload/UploadFileList.js +2 -3
- package/cjs/components/upload/UploadFileList.js.map +1 -1
- package/cjs/extensions/forms/DataContext/Context.d.ts +2 -2
- package/cjs/extensions/forms/DataContext/Context.js.map +1 -1
- package/cjs/extensions/forms/DataContext/FieldBoundary/FieldBoundaryProvider.js +4 -4
- package/cjs/extensions/forms/DataContext/FieldBoundary/FieldBoundaryProvider.js.map +1 -1
- package/cjs/extensions/forms/DataContext/Provider/Provider.js +35 -41
- package/cjs/extensions/forms/DataContext/Provider/Provider.js.map +1 -1
- package/cjs/extensions/forms/Field/Provider/useFieldProvider.d.ts +3 -3
- package/cjs/extensions/forms/FieldBlock/FieldBlock.js +2 -2
- package/cjs/extensions/forms/FieldBlock/FieldBlock.js.map +1 -1
- package/cjs/extensions/forms/FieldBlock/FieldBlockContext.d.ts +1 -1
- package/cjs/extensions/forms/FieldBlock/FieldBlockContext.js.map +1 -1
- package/cjs/extensions/forms/Form/Isolation/Isolation.js +3 -4
- package/cjs/extensions/forms/Form/Isolation/Isolation.js.map +1 -1
- package/cjs/extensions/forms/Form/Visibility/Visibility.d.ts +1 -10
- package/cjs/extensions/forms/Form/Visibility/Visibility.js +1 -0
- package/cjs/extensions/forms/Form/Visibility/Visibility.js.map +1 -1
- package/cjs/extensions/forms/Form/Visibility/VisibilityContext.d.ts +2 -1
- package/cjs/extensions/forms/Form/Visibility/VisibilityContext.js.map +1 -1
- package/cjs/extensions/forms/Form/Visibility/useVisibility.js +1 -1
- package/cjs/extensions/forms/Form/Visibility/useVisibility.js.map +1 -1
- package/cjs/extensions/forms/Iterate/Array/ArrayItemArea.d.ts +3 -2
- package/cjs/extensions/forms/Iterate/Array/ArrayItemArea.js.map +1 -1
- package/cjs/extensions/forms/Iterate/EditContainer/CancelButton.js +5 -2
- package/cjs/extensions/forms/Iterate/EditContainer/CancelButton.js.map +1 -1
- package/cjs/extensions/forms/Iterate/EditContainer/DoneButton.js +1 -1
- package/cjs/extensions/forms/Iterate/EditContainer/DoneButton.js.map +1 -1
- package/cjs/extensions/forms/Iterate/EditContainer/EditContainer.d.ts +2 -2
- package/cjs/extensions/forms/Iterate/EditContainer/EditContainer.js.map +1 -1
- package/cjs/extensions/forms/Iterate/PushContainer/OpenButton.js +1 -1
- package/cjs/extensions/forms/Iterate/PushContainer/OpenButton.js.map +1 -1
- package/cjs/extensions/forms/Iterate/PushContainer/PushContainer.js +9 -2
- package/cjs/extensions/forms/Iterate/PushContainer/PushContainer.js.map +1 -1
- package/cjs/extensions/forms/Iterate/ViewContainer/EditButton.js +1 -1
- package/cjs/extensions/forms/Iterate/ViewContainer/EditButton.js.map +1 -1
- package/cjs/extensions/forms/Iterate/ViewContainer/ViewContainer.d.ts +1 -1
- package/cjs/extensions/forms/Iterate/ViewContainer/ViewContainer.js.map +1 -1
- package/cjs/extensions/forms/Wizard/Buttons/Buttons.js +2 -2
- package/cjs/extensions/forms/Wizard/Buttons/Buttons.js.map +1 -1
- package/cjs/extensions/forms/Wizard/Container/DisplaySteps.js +6 -5
- package/cjs/extensions/forms/Wizard/Container/DisplaySteps.js.map +1 -1
- package/cjs/extensions/forms/Wizard/Container/IterateOverSteps.d.ts +4 -3
- package/cjs/extensions/forms/Wizard/Container/IterateOverSteps.js +36 -35
- package/cjs/extensions/forms/Wizard/Container/IterateOverSteps.js.map +1 -1
- package/cjs/extensions/forms/Wizard/Container/WizardContainer.js +104 -57
- package/cjs/extensions/forms/Wizard/Container/WizardContainer.js.map +1 -1
- package/cjs/extensions/forms/Wizard/Container/useCollectStepsData.d.ts +10 -0
- package/cjs/extensions/forms/Wizard/Container/useCollectStepsData.js +66 -0
- package/cjs/extensions/forms/Wizard/Container/useCollectStepsData.js.map +1 -0
- package/cjs/extensions/forms/Wizard/Context/WizardContext.d.ts +17 -4
- package/cjs/extensions/forms/Wizard/Context/WizardContext.js.map +1 -1
- package/cjs/extensions/forms/Wizard/Context/types.d.ts +9 -6
- package/cjs/extensions/forms/Wizard/Context/types.js.map +1 -1
- package/cjs/extensions/forms/Wizard/Step/Step.d.ts +1 -1
- package/cjs/extensions/forms/Wizard/Step/Step.js +65 -22
- package/cjs/extensions/forms/Wizard/Step/Step.js.map +1 -1
- package/cjs/extensions/forms/Wizard/Step/StepDocs.js +2 -2
- package/cjs/extensions/forms/Wizard/Step/StepDocs.js.map +1 -1
- package/cjs/extensions/forms/Wizard/hooks/useStep.js +10 -18
- package/cjs/extensions/forms/Wizard/hooks/useStep.js.map +1 -1
- package/cjs/extensions/forms/hooks/useFieldProps.js +16 -8
- package/cjs/extensions/forms/hooks/useFieldProps.js.map +1 -1
- package/cjs/extensions/forms/hooks/useValueProps.js +1 -1
- package/cjs/extensions/forms/hooks/useValueProps.js.map +1 -1
- package/cjs/shared/Eufemia.d.ts +1 -1
- package/cjs/shared/Eufemia.js +2 -2
- package/cjs/shared/Eufemia.js.map +1 -1
- package/cjs/shared/component-helper.js +1 -1
- package/cjs/shared/component-helper.js.map +1 -1
- package/cjs/style/core/scopes.scss +1 -1
- package/cjs/style/dnb-ui-basis.css +1 -1
- package/cjs/style/dnb-ui-basis.min.css +1 -1
- package/cjs/style/dnb-ui-body.css +1 -1
- package/cjs/style/dnb-ui-body.min.css +1 -1
- package/cjs/style/dnb-ui-core.css +1 -1
- package/cjs/style/dnb-ui-core.min.css +1 -1
- package/components/global-error/GlobalError.d.ts +1 -1
- package/components/global-error/GlobalError.js +1 -1
- package/components/global-error/GlobalError.js.map +1 -1
- package/components/global-error/GlobalErrorDocs.d.ts +2 -0
- package/components/global-error/GlobalErrorDocs.js +58 -0
- package/components/global-error/GlobalErrorDocs.js.map +1 -0
- package/components/info-card/InfoCardDocs.d.ts +3 -0
- package/components/info-card/InfoCardDocs.js +95 -0
- package/components/info-card/InfoCardDocs.js.map +1 -0
- package/components/tabs/Tabs.js +2 -2
- package/components/tabs/Tabs.js.map +1 -1
- package/components/upload/UploadFileList.js +2 -3
- package/components/upload/UploadFileList.js.map +1 -1
- package/es/components/global-error/GlobalError.d.ts +1 -1
- package/es/components/global-error/GlobalError.js +1 -1
- package/es/components/global-error/GlobalError.js.map +1 -1
- package/es/components/global-error/GlobalErrorDocs.d.ts +2 -0
- package/es/components/global-error/GlobalErrorDocs.js +58 -0
- package/es/components/global-error/GlobalErrorDocs.js.map +1 -0
- package/es/components/info-card/InfoCardDocs.d.ts +3 -0
- package/es/components/info-card/InfoCardDocs.js +95 -0
- package/es/components/info-card/InfoCardDocs.js.map +1 -0
- package/es/components/tabs/Tabs.js +2 -2
- package/es/components/tabs/Tabs.js.map +1 -1
- package/es/components/upload/UploadFileList.js +2 -3
- package/es/components/upload/UploadFileList.js.map +1 -1
- package/es/extensions/forms/DataContext/Context.d.ts +2 -2
- package/es/extensions/forms/DataContext/Context.js.map +1 -1
- package/es/extensions/forms/DataContext/FieldBoundary/FieldBoundaryProvider.js +4 -4
- package/es/extensions/forms/DataContext/FieldBoundary/FieldBoundaryProvider.js.map +1 -1
- package/es/extensions/forms/DataContext/Provider/Provider.js +21 -29
- package/es/extensions/forms/DataContext/Provider/Provider.js.map +1 -1
- package/es/extensions/forms/Field/Provider/useFieldProvider.d.ts +3 -3
- package/es/extensions/forms/FieldBlock/FieldBlock.js +2 -2
- package/es/extensions/forms/FieldBlock/FieldBlock.js.map +1 -1
- package/es/extensions/forms/FieldBlock/FieldBlockContext.d.ts +1 -1
- package/es/extensions/forms/FieldBlock/FieldBlockContext.js.map +1 -1
- package/es/extensions/forms/Form/Isolation/Isolation.js +3 -4
- package/es/extensions/forms/Form/Isolation/Isolation.js.map +1 -1
- package/es/extensions/forms/Form/Visibility/Visibility.d.ts +1 -10
- package/es/extensions/forms/Form/Visibility/Visibility.js +1 -0
- package/es/extensions/forms/Form/Visibility/Visibility.js.map +1 -1
- package/es/extensions/forms/Form/Visibility/VisibilityContext.d.ts +2 -1
- package/es/extensions/forms/Form/Visibility/VisibilityContext.js.map +1 -1
- package/es/extensions/forms/Form/Visibility/useVisibility.js +1 -1
- package/es/extensions/forms/Form/Visibility/useVisibility.js.map +1 -1
- package/es/extensions/forms/Iterate/Array/ArrayItemArea.d.ts +3 -2
- package/es/extensions/forms/Iterate/Array/ArrayItemArea.js.map +1 -1
- package/es/extensions/forms/Iterate/EditContainer/CancelButton.js +5 -2
- package/es/extensions/forms/Iterate/EditContainer/CancelButton.js.map +1 -1
- package/es/extensions/forms/Iterate/EditContainer/DoneButton.js +1 -1
- package/es/extensions/forms/Iterate/EditContainer/DoneButton.js.map +1 -1
- package/es/extensions/forms/Iterate/EditContainer/EditContainer.d.ts +2 -2
- package/es/extensions/forms/Iterate/EditContainer/EditContainer.js.map +1 -1
- package/es/extensions/forms/Iterate/PushContainer/OpenButton.js +1 -1
- package/es/extensions/forms/Iterate/PushContainer/OpenButton.js.map +1 -1
- package/es/extensions/forms/Iterate/PushContainer/PushContainer.js +9 -2
- package/es/extensions/forms/Iterate/PushContainer/PushContainer.js.map +1 -1
- package/es/extensions/forms/Iterate/ViewContainer/EditButton.js +1 -1
- package/es/extensions/forms/Iterate/ViewContainer/EditButton.js.map +1 -1
- package/es/extensions/forms/Iterate/ViewContainer/ViewContainer.d.ts +1 -1
- package/es/extensions/forms/Iterate/ViewContainer/ViewContainer.js.map +1 -1
- package/es/extensions/forms/Wizard/Buttons/Buttons.js +2 -2
- package/es/extensions/forms/Wizard/Buttons/Buttons.js.map +1 -1
- package/es/extensions/forms/Wizard/Container/DisplaySteps.js +6 -5
- package/es/extensions/forms/Wizard/Container/DisplaySteps.js.map +1 -1
- package/es/extensions/forms/Wizard/Container/IterateOverSteps.d.ts +4 -3
- package/es/extensions/forms/Wizard/Container/IterateOverSteps.js +35 -34
- package/es/extensions/forms/Wizard/Container/IterateOverSteps.js.map +1 -1
- package/es/extensions/forms/Wizard/Container/WizardContainer.js +101 -58
- package/es/extensions/forms/Wizard/Container/WizardContainer.js.map +1 -1
- package/es/extensions/forms/Wizard/Container/useCollectStepsData.d.ts +10 -0
- package/es/extensions/forms/Wizard/Container/useCollectStepsData.js +59 -0
- package/es/extensions/forms/Wizard/Container/useCollectStepsData.js.map +1 -0
- package/es/extensions/forms/Wizard/Context/WizardContext.d.ts +17 -4
- package/es/extensions/forms/Wizard/Context/WizardContext.js.map +1 -1
- package/es/extensions/forms/Wizard/Context/types.d.ts +9 -6
- package/es/extensions/forms/Wizard/Context/types.js.map +1 -1
- package/es/extensions/forms/Wizard/Step/Step.d.ts +1 -1
- package/es/extensions/forms/Wizard/Step/Step.js +64 -22
- package/es/extensions/forms/Wizard/Step/Step.js.map +1 -1
- package/es/extensions/forms/Wizard/Step/StepDocs.js +2 -2
- package/es/extensions/forms/Wizard/Step/StepDocs.js.map +1 -1
- package/es/extensions/forms/Wizard/hooks/useStep.js +10 -18
- package/es/extensions/forms/Wizard/hooks/useStep.js.map +1 -1
- package/es/extensions/forms/hooks/useFieldProps.js +16 -8
- package/es/extensions/forms/hooks/useFieldProps.js.map +1 -1
- package/es/extensions/forms/hooks/useValueProps.js +1 -1
- package/es/extensions/forms/hooks/useValueProps.js.map +1 -1
- package/es/shared/Eufemia.d.ts +1 -1
- package/es/shared/Eufemia.js +2 -2
- package/es/shared/Eufemia.js.map +1 -1
- package/es/shared/component-helper.js +1 -1
- package/es/shared/component-helper.js.map +1 -1
- package/es/style/core/scopes.scss +1 -1
- package/es/style/dnb-ui-basis.css +1 -1
- package/es/style/dnb-ui-basis.min.css +1 -1
- package/es/style/dnb-ui-body.css +1 -1
- package/es/style/dnb-ui-body.min.css +1 -1
- package/es/style/dnb-ui-core.css +1 -1
- package/es/style/dnb-ui-core.min.css +1 -1
- package/esm/dnb-ui-basis.min.mjs +1 -1
- package/esm/dnb-ui-components.min.mjs +1 -1
- package/esm/dnb-ui-elements.min.mjs +1 -1
- package/esm/dnb-ui-extensions.min.mjs +1 -1
- package/esm/dnb-ui-lib.min.mjs +1 -1
- package/extensions/forms/DataContext/Context.d.ts +2 -2
- package/extensions/forms/DataContext/Context.js.map +1 -1
- package/extensions/forms/DataContext/FieldBoundary/FieldBoundaryProvider.js +4 -4
- package/extensions/forms/DataContext/FieldBoundary/FieldBoundaryProvider.js.map +1 -1
- package/extensions/forms/DataContext/Provider/Provider.js +35 -41
- package/extensions/forms/DataContext/Provider/Provider.js.map +1 -1
- package/extensions/forms/Field/Provider/useFieldProvider.d.ts +3 -3
- package/extensions/forms/FieldBlock/FieldBlock.js +2 -2
- package/extensions/forms/FieldBlock/FieldBlock.js.map +1 -1
- package/extensions/forms/FieldBlock/FieldBlockContext.d.ts +1 -1
- package/extensions/forms/FieldBlock/FieldBlockContext.js.map +1 -1
- package/extensions/forms/Form/Isolation/Isolation.js +3 -4
- package/extensions/forms/Form/Isolation/Isolation.js.map +1 -1
- package/extensions/forms/Form/Visibility/Visibility.d.ts +1 -10
- package/extensions/forms/Form/Visibility/Visibility.js +1 -0
- package/extensions/forms/Form/Visibility/Visibility.js.map +1 -1
- package/extensions/forms/Form/Visibility/VisibilityContext.d.ts +2 -1
- package/extensions/forms/Form/Visibility/VisibilityContext.js.map +1 -1
- package/extensions/forms/Form/Visibility/useVisibility.js +1 -1
- package/extensions/forms/Form/Visibility/useVisibility.js.map +1 -1
- package/extensions/forms/Iterate/Array/ArrayItemArea.d.ts +3 -2
- package/extensions/forms/Iterate/Array/ArrayItemArea.js.map +1 -1
- package/extensions/forms/Iterate/EditContainer/CancelButton.js +5 -2
- package/extensions/forms/Iterate/EditContainer/CancelButton.js.map +1 -1
- package/extensions/forms/Iterate/EditContainer/DoneButton.js +1 -1
- package/extensions/forms/Iterate/EditContainer/DoneButton.js.map +1 -1
- package/extensions/forms/Iterate/EditContainer/EditContainer.d.ts +2 -2
- package/extensions/forms/Iterate/EditContainer/EditContainer.js.map +1 -1
- package/extensions/forms/Iterate/PushContainer/OpenButton.js +1 -1
- package/extensions/forms/Iterate/PushContainer/OpenButton.js.map +1 -1
- package/extensions/forms/Iterate/PushContainer/PushContainer.js +9 -2
- package/extensions/forms/Iterate/PushContainer/PushContainer.js.map +1 -1
- package/extensions/forms/Iterate/ViewContainer/EditButton.js +1 -1
- package/extensions/forms/Iterate/ViewContainer/EditButton.js.map +1 -1
- package/extensions/forms/Iterate/ViewContainer/ViewContainer.d.ts +1 -1
- package/extensions/forms/Iterate/ViewContainer/ViewContainer.js.map +1 -1
- package/extensions/forms/Wizard/Buttons/Buttons.js +2 -2
- package/extensions/forms/Wizard/Buttons/Buttons.js.map +1 -1
- package/extensions/forms/Wizard/Container/DisplaySteps.js +6 -5
- package/extensions/forms/Wizard/Container/DisplaySteps.js.map +1 -1
- package/extensions/forms/Wizard/Container/IterateOverSteps.d.ts +4 -3
- package/extensions/forms/Wizard/Container/IterateOverSteps.js +36 -34
- package/extensions/forms/Wizard/Container/IterateOverSteps.js.map +1 -1
- package/extensions/forms/Wizard/Container/WizardContainer.js +105 -58
- package/extensions/forms/Wizard/Container/WizardContainer.js.map +1 -1
- package/extensions/forms/Wizard/Container/useCollectStepsData.d.ts +10 -0
- package/extensions/forms/Wizard/Container/useCollectStepsData.js +60 -0
- package/extensions/forms/Wizard/Container/useCollectStepsData.js.map +1 -0
- package/extensions/forms/Wizard/Context/WizardContext.d.ts +17 -4
- package/extensions/forms/Wizard/Context/WizardContext.js.map +1 -1
- package/extensions/forms/Wizard/Context/types.d.ts +9 -6
- package/extensions/forms/Wizard/Context/types.js.map +1 -1
- package/extensions/forms/Wizard/Step/Step.d.ts +1 -1
- package/extensions/forms/Wizard/Step/Step.js +66 -22
- package/extensions/forms/Wizard/Step/Step.js.map +1 -1
- package/extensions/forms/Wizard/Step/StepDocs.js +2 -2
- package/extensions/forms/Wizard/Step/StepDocs.js.map +1 -1
- package/extensions/forms/Wizard/hooks/useStep.js +10 -18
- package/extensions/forms/Wizard/hooks/useStep.js.map +1 -1
- package/extensions/forms/hooks/useFieldProps.js +16 -8
- package/extensions/forms/hooks/useFieldProps.js.map +1 -1
- package/extensions/forms/hooks/useValueProps.js +1 -1
- package/extensions/forms/hooks/useValueProps.js.map +1 -1
- package/package.json +1 -1
- package/shared/Eufemia.d.ts +1 -1
- package/shared/Eufemia.js +2 -2
- package/shared/Eufemia.js.map +1 -1
- package/shared/component-helper.js +1 -1
- package/shared/component-helper.js.map +1 -1
- package/style/core/scopes.scss +1 -1
- package/style/dnb-ui-basis.css +1 -1
- package/style/dnb-ui-basis.min.css +1 -1
- package/style/dnb-ui-body.css +1 -1
- package/style/dnb-ui-body.min.css +1 -1
- package/style/dnb-ui-core.css +1 -1
- package/style/dnb-ui-core.min.css +1 -1
- package/umd/dnb-ui-basis.min.js +1 -1
- package/umd/dnb-ui-components.min.js +1 -1
- package/umd/dnb-ui-elements.min.js +1 -1
- package/umd/dnb-ui-extensions.min.js +1 -1
- package/umd/dnb-ui-lib.min.js +1 -1
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { useCallback, useContext } from 'react';
|
|
4
|
+
import { convertJsxToString } from '../../../../shared/component-helper';
|
|
5
|
+
import WizardContext from '../Context/WizardContext';
|
|
6
|
+
import { useTranslation } from '../../hooks';
|
|
7
|
+
export function useCollectStepsData() {
|
|
8
|
+
const {
|
|
9
|
+
activeIndexRef,
|
|
10
|
+
hasErrorInOtherStepRef,
|
|
11
|
+
stepsRef,
|
|
12
|
+
submitCountRef,
|
|
13
|
+
writeStepsState,
|
|
14
|
+
hasInvalidStepsState
|
|
15
|
+
} = useContext(WizardContext) || {};
|
|
16
|
+
const translations = useTranslation();
|
|
17
|
+
const collectStepsData = useCallback(({
|
|
18
|
+
id,
|
|
19
|
+
index,
|
|
20
|
+
inactive,
|
|
21
|
+
title
|
|
22
|
+
}) => {
|
|
23
|
+
if (!hasInvalidStepsState) {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
writeStepsState(index);
|
|
27
|
+
const stringifiedTitle = title !== undefined ? convertJsxToString(title) : 'Title missing';
|
|
28
|
+
let status = undefined;
|
|
29
|
+
let statusState = undefined;
|
|
30
|
+
if (index !== activeIndexRef.current && !inactive) {
|
|
31
|
+
if (hasInvalidStepsState(index, ['error'])) {
|
|
32
|
+
status = translations.Step.stepHasError;
|
|
33
|
+
statusState = 'error';
|
|
34
|
+
} else if (submitCountRef.current > 0 && hasInvalidStepsState(index, ['unknown'])) {
|
|
35
|
+
status = 'Unknown state';
|
|
36
|
+
statusState = 'warn';
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
if (status) {
|
|
40
|
+
hasErrorInOtherStepRef.current = true;
|
|
41
|
+
}
|
|
42
|
+
stepsRef.current.set(index, {
|
|
43
|
+
index,
|
|
44
|
+
id,
|
|
45
|
+
title,
|
|
46
|
+
stringifiedTitle,
|
|
47
|
+
inactive,
|
|
48
|
+
status,
|
|
49
|
+
statusState
|
|
50
|
+
});
|
|
51
|
+
return {
|
|
52
|
+
title
|
|
53
|
+
};
|
|
54
|
+
}, [activeIndexRef, hasErrorInOtherStepRef, hasInvalidStepsState, stepsRef, submitCountRef, translations.Step.stepHasError, writeStepsState]);
|
|
55
|
+
return {
|
|
56
|
+
collectStepsData
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=useCollectStepsData.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useCollectStepsData.js","names":["useCallback","useContext","convertJsxToString","WizardContext","useTranslation","useCollectStepsData","activeIndexRef","hasErrorInOtherStepRef","stepsRef","submitCountRef","writeStepsState","hasInvalidStepsState","translations","collectStepsData","id","index","inactive","title","stringifiedTitle","undefined","status","statusState","current","Step","stepHasError","set"],"sources":["../../../../../../src/extensions/forms/Wizard/Container/useCollectStepsData.tsx"],"sourcesContent":["import { useCallback, useContext } from 'react'\nimport { convertJsxToString } from '../../../../shared/component-helper'\nimport WizardContext from '../Context/WizardContext'\nimport { useTranslation } from '../../hooks'\n\nexport function useCollectStepsData() {\n const {\n activeIndexRef,\n hasErrorInOtherStepRef,\n stepsRef,\n submitCountRef,\n writeStepsState,\n hasInvalidStepsState,\n } = useContext(WizardContext) || {}\n\n const translations = useTranslation()\n\n const collectStepsData = useCallback(\n ({ id, index, inactive, title }) => {\n if (!hasInvalidStepsState) {\n return // stop here\n }\n\n writeStepsState(index)\n\n const stringifiedTitle =\n title !== undefined ? convertJsxToString(title) : 'Title missing'\n\n let status = undefined\n let statusState = undefined\n if (index !== activeIndexRef.current && !inactive) {\n if (hasInvalidStepsState(index, ['error'])) {\n status = translations.Step.stepHasError\n statusState = 'error'\n } else if (\n submitCountRef.current > 0 &&\n hasInvalidStepsState(index, ['unknown'])\n ) {\n status = 'Unknown state'\n statusState = 'warn'\n }\n }\n\n if (status) {\n hasErrorInOtherStepRef.current = true\n }\n\n stepsRef.current.set(index, {\n index,\n id,\n title,\n stringifiedTitle,\n inactive,\n status,\n statusState,\n })\n\n return { title }\n },\n [\n activeIndexRef,\n hasErrorInOtherStepRef,\n hasInvalidStepsState,\n stepsRef,\n submitCountRef,\n translations.Step.stepHasError,\n writeStepsState,\n ]\n )\n\n return { collectStepsData }\n}\n"],"mappings":";;AAAA,SAASA,WAAW,EAAEC,UAAU,QAAQ,OAAO;AAC/C,SAASC,kBAAkB,QAAQ,qCAAqC;AACxE,OAAOC,aAAa,MAAM,0BAA0B;AACpD,SA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AEF,OAAO;MAAEJ;IAAM,CAAC;EAClB,CAAC,EACD,CACEX,cAAc,EACdC,sBAAsB,EACtBI,oBAAoB,EACpBH,QAAQ,EACRC,cAAc,EACdG,YAAY,CAACW,IAAI,CAACC,YAAY,EAC9Bd,eAAe,CAEnB,CAAC;EAED,OAAO;IAAEG;EAAiB,CAAC;AAC7B","ignoreList":[]}
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Path } from '../../types';
|
|
3
3
|
import { VisibleWhen } from '../../Form/Visibility';
|
|
4
|
-
import { InternalStepStatus,
|
|
4
|
+
import { InternalStepStatus, SetActiveIndexOptions, StepIndex, Steps } from './types';
|
|
5
|
+
export type HandleStatusArgs = {
|
|
6
|
+
id: string;
|
|
7
|
+
index: StepIndex;
|
|
8
|
+
inactive: boolean;
|
|
9
|
+
titleProp: React.ReactNode;
|
|
10
|
+
};
|
|
5
11
|
export interface WizardContextState {
|
|
6
12
|
id?: string;
|
|
7
13
|
totalSteps?: number;
|
|
@@ -11,8 +17,9 @@ export interface WizardContextState {
|
|
|
11
17
|
stepsRef?: React.MutableRefObject<Steps>;
|
|
12
18
|
updateTitlesRef?: React.MutableRefObject<() => void>;
|
|
13
19
|
activeIndexRef?: React.MutableRefObject<StepIndex>;
|
|
20
|
+
stepIndexRef?: React.MutableRefObject<StepIndex>;
|
|
14
21
|
totalStepsRef?: React.MutableRefObject<number>;
|
|
15
|
-
|
|
22
|
+
submitCountRef?: React.MutableRefObject<number>;
|
|
16
23
|
prerenderFieldPropsRef?: React.MutableRefObject<Record<string, () => React.ReactElement>>;
|
|
17
24
|
hasErrorInOtherStepRef?: React.MutableRefObject<boolean>;
|
|
18
25
|
prerenderFieldProps?: boolean;
|
|
@@ -21,11 +28,17 @@ export interface WizardContextState {
|
|
|
21
28
|
handleNext?: () => void;
|
|
22
29
|
setActiveIndex?: (index: StepIndex, { skipStepChangeCall, skipStepChangeCallBeforeMounted, skipStepChangeCallFromHook, }?: SetActiveIndexOptions) => void;
|
|
23
30
|
setFormError?: (error: Error) => void;
|
|
24
|
-
|
|
25
|
-
|
|
31
|
+
setFieldError?: (index: StepIndex, path: Path, hasError: boolean) => void;
|
|
32
|
+
writeStepsState?: (index?: StepIndex, forStates?: Array<InternalStepStatus>) => void;
|
|
33
|
+
hasInvalidStepsState?: (index?: StepIndex, forStates?: Array<InternalStepStatus>) => boolean;
|
|
26
34
|
check?: ({ visibleWhen }: {
|
|
27
35
|
visibleWhen: VisibleWhen;
|
|
28
36
|
}) => boolean;
|
|
37
|
+
collectStepsData?: (args: HandleStatusArgs) => {
|
|
38
|
+
title: string;
|
|
39
|
+
};
|
|
40
|
+
enableMapOverChildren?: () => void;
|
|
41
|
+
mapOverChildrenRef?: React.MutableRefObject<boolean>;
|
|
29
42
|
}
|
|
30
43
|
declare const WizardContext: React.Context<WizardContextState>;
|
|
31
44
|
export default WizardContext;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WizardContext.js","names":["React","WizardContext","createContext","undefined"],"sources":["../../../../../../src/extensions/forms/Wizard/Context/WizardContext.ts"],"sourcesContent":["import React from 'react'\nimport { Path } from '../../types'\nimport { VisibleWhen } from '../../Form/Visibility'\nimport {\n InternalStepStatus,\n
|
|
1
|
+
{"version":3,"file":"WizardContext.js","names":["React","WizardContext","createContext","undefined"],"sources":["../../../../../../src/extensions/forms/Wizard/Context/WizardContext.ts"],"sourcesContent":["import React from 'react'\nimport { Path } from '../../types'\nimport { VisibleWhen } from '../../Form/Visibility'\nimport {\n InternalStepStatus,\n SetActiveIndexOptions,\n StepIndex,\n Steps,\n} from './types'\n\nexport type HandleStatusArgs = {\n id: string\n index: StepIndex\n inactive: boolean\n titleProp: React.ReactNode\n}\n\nexport interface WizardContextState {\n id?: string\n totalSteps?: number\n activeIndex?: StepIndex\n initialActiveIndex?: StepIndex\n stepElementRef?: React.MutableRefObject<HTMLElement>\n stepsRef?: React.MutableRefObject<Steps>\n updateTitlesRef?: React.MutableRefObject<() => void>\n activeIndexRef?: React.MutableRefObject<StepIndex>\n stepIndexRef?: React.MutableRefObject<StepIndex>\n totalStepsRef?: React.MutableRefObject<number>\n submitCountRef?: React.MutableRefObject<number>\n prerenderFieldPropsRef?: React.MutableRefObject<\n Record<string, () => React.ReactElement>\n >\n hasErrorInOtherStepRef?: React.MutableRefObject<boolean>\n prerenderFieldProps?: boolean\n keepInDOM?: boolean\n handlePrevious?: () => void\n handleNext?: () => void\n setActiveIndex?: (\n index: StepIndex,\n {\n skipStepChangeCall,\n skipStepChangeCallBeforeMounted,\n skipStepChangeCallFromHook,\n }?: SetActiveIndexOptions\n ) => void\n setFormError?: (error: Error) => void\n setFieldError?: (index: StepIndex, path: Path, hasError: boolean) => void\n writeStepsState?: (\n index?: StepIndex,\n forStates?: Array<InternalStepStatus>\n ) => void\n hasInvalidStepsState?: (\n index?: StepIndex,\n forStates?: Array<InternalStepStatus>\n ) => boolean\n check?: ({ visibleWhen }: { visibleWhen: VisibleWhen }) => boolean\n collectStepsData?: (args: HandleStatusArgs) => { title: string }\n enableMapOverChildren?: () => void\n mapOverChildrenRef?: React.MutableRefObject<boolean>\n}\n\nconst WizardContext = React.createContext<WizardContextState | undefined>(\n undefined\n)\n\nexport default WizardContext\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AA6DzB,MAAMC,aAAa,GAAGD,KAAK,CAACE,aAAa,CACvCC,SACF,CAAC;AAED,eAAeF,aAAa","ignoreList":[]}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import { StepIndicatorStatusState } from '../../../../components/step-indicator/StepIndicatorItem';
|
|
2
3
|
import { EventReturnWithStateObject, Path } from '../../types';
|
|
3
4
|
export type OnStepsChangeMode = 'previous' | 'next' | 'stepListModified';
|
|
@@ -11,9 +12,11 @@ export type OnStepChangeOptions = {
|
|
|
11
12
|
};
|
|
12
13
|
export type OnStepChange = (index: StepIndex, mode: OnStepsChangeMode, options: OnStepChangeOptions) => EventReturnWithStateObject | void | Promise<EventReturnWithStateObject | void>;
|
|
13
14
|
export type StepIndex = number;
|
|
14
|
-
export type Steps =
|
|
15
|
-
|
|
15
|
+
export type Steps = Map<StepIndex, {
|
|
16
|
+
index: StepIndex;
|
|
16
17
|
id: string;
|
|
18
|
+
title: React.ReactNode;
|
|
19
|
+
stringifiedTitle: string;
|
|
17
20
|
inactive?: boolean;
|
|
18
21
|
/** Used internally to set the status */
|
|
19
22
|
status?: string;
|
|
@@ -26,10 +29,10 @@ export type SetActiveIndexOptions = {
|
|
|
26
29
|
skipStepChangeCallFromHook?: boolean;
|
|
27
30
|
skipErrorCheck?: boolean;
|
|
28
31
|
};
|
|
29
|
-
export type InternalStepStatus = 'error' | '
|
|
30
|
-
export type InternalStepStatuses =
|
|
31
|
-
export type InternalVisitedSteps =
|
|
32
|
-
export type InternalFieldError =
|
|
32
|
+
export type InternalStepStatus = 'error' | 'unknown' | undefined;
|
|
33
|
+
export type InternalStepStatuses = Map<StepIndex, InternalStepStatus>;
|
|
34
|
+
export type InternalVisitedSteps = Map<StepIndex, boolean>;
|
|
35
|
+
export type InternalFieldError = Map<Path, {
|
|
33
36
|
index: StepIndex;
|
|
34
37
|
hasError: boolean;
|
|
35
38
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","names":[],"sources":["../../../../../../src/extensions/forms/Wizard/Context/types.ts"],"sourcesContent":["import { StepIndicatorStatusState } from '../../../../components/step-indicator/StepIndicatorItem'\nimport { EventReturnWithStateObject, Path } from '../../types'\n\nexport type OnStepsChangeMode = 'previous' | 'next' | 'stepListModified'\nexport type OnStepChangeOptions = {\n preventNavigation: (shouldPrevent?: boolean) => void\n id?: string\n previousStep: {\n index: StepIndex\n id?: string\n }\n}\nexport type OnStepChange = (\n index: StepIndex,\n mode: OnStepsChangeMode,\n options: OnStepChangeOptions\n) =>\n | EventReturnWithStateObject\n | void\n | Promise<EventReturnWithStateObject | void>\n\nexport type StepIndex = number\nexport type Steps =
|
|
1
|
+
{"version":3,"file":"types.js","names":[],"sources":["../../../../../../src/extensions/forms/Wizard/Context/types.ts"],"sourcesContent":["import { StepIndicatorStatusState } from '../../../../components/step-indicator/StepIndicatorItem'\nimport { EventReturnWithStateObject, Path } from '../../types'\n\nexport type OnStepsChangeMode = 'previous' | 'next' | 'stepListModified'\nexport type OnStepChangeOptions = {\n preventNavigation: (shouldPrevent?: boolean) => void\n id?: string\n previousStep: {\n index: StepIndex\n id?: string\n }\n}\nexport type OnStepChange = (\n index: StepIndex,\n mode: OnStepsChangeMode,\n options: OnStepChangeOptions\n) =>\n | EventReturnWithStateObject\n | void\n | Promise<EventReturnWithStateObject | void>\n\nexport type StepIndex = number\nexport type Steps = Map<\n StepIndex,\n {\n index: StepIndex\n id: string\n title: React.ReactNode\n stringifiedTitle: string\n inactive?: boolean\n\n /** Used internally to set the status */\n status?: string\n\n /** Used internally to set the statusState */\n statusState?: StepIndicatorStatusState\n }\n>\nexport type SetActiveIndexOptions = {\n skipStepChangeCall?: boolean\n skipStepChangeCallBeforeMounted?: boolean\n skipStepChangeCallFromHook?: boolean\n skipErrorCheck?: boolean\n}\n\nexport type InternalStepStatus = 'error' | 'unknown' | undefined\nexport type InternalStepStatuses = Map<StepIndex, InternalStepStatus>\nexport type InternalVisitedSteps = Map<StepIndex, boolean>\nexport type InternalFieldError = Map<\n Path,\n {\n index: StepIndex\n hasError: boolean\n }\n>\n"],"mappings":"","ignoreList":[]}
|
|
@@ -4,7 +4,7 @@ import { Props as FlexContainerProps } from '../../../../components/flex/Contain
|
|
|
4
4
|
import type { VisibleWhen } from '../../Form/Visibility';
|
|
5
5
|
export type Props = ComponentProps & FlexContainerProps & {
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
7
|
+
* An unique title of the step.
|
|
8
8
|
*/
|
|
9
9
|
title?: React.ReactNode;
|
|
10
10
|
/**
|
|
@@ -3,19 +3,18 @@
|
|
|
3
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
4
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
5
5
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
6
|
-
var _Fragment;
|
|
6
|
+
var _Fragment, _Fragment2, _Fragment3;
|
|
7
7
|
const _excluded = ["active", "activeWhen", "include", "includeWhen"],
|
|
8
|
-
_excluded2 = ["className", "title", "
|
|
8
|
+
_excluded2 = ["id", "className", "title", "index", "inactive", "include", "includeWhen", "required", "keepInDOM", "prerenderFieldProps", "children"];
|
|
9
9
|
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; }
|
|
10
10
|
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; }
|
|
11
|
-
import React, { useContext, useMemo
|
|
11
|
+
import React, { useContext, useMemo } from 'react';
|
|
12
12
|
import classnames from 'classnames';
|
|
13
13
|
import WizardContext from '../Context/WizardContext';
|
|
14
14
|
import WizardStepContext from './StepContext';
|
|
15
15
|
import Flex from '../../../../components/flex/Flex';
|
|
16
16
|
import { convertJsxToString, warn } from '../../../../shared/component-helper';
|
|
17
17
|
import FieldProvider from '../../Field/Provider';
|
|
18
|
-
const useLayoutEffect = typeof window === 'undefined' ? React.useEffect : React.useLayoutEffect;
|
|
19
18
|
export function handleDeprecatedProps(_ref) {
|
|
20
19
|
let {
|
|
21
20
|
active,
|
|
@@ -32,10 +31,11 @@ export function handleDeprecatedProps(_ref) {
|
|
|
32
31
|
function Step(props) {
|
|
33
32
|
const _handleDeprecatedProp = handleDeprecatedProps(props),
|
|
34
33
|
{
|
|
34
|
+
id,
|
|
35
35
|
className,
|
|
36
36
|
title,
|
|
37
|
+
index: indexProp,
|
|
37
38
|
inactive,
|
|
38
|
-
index,
|
|
39
39
|
include = true,
|
|
40
40
|
includeWhen,
|
|
41
41
|
required,
|
|
@@ -46,33 +46,75 @@ function Step(props) {
|
|
|
46
46
|
restProps = _objectWithoutProperties(_handleDeprecatedProp, _excluded2);
|
|
47
47
|
const {
|
|
48
48
|
check,
|
|
49
|
+
enableMapOverChildren,
|
|
49
50
|
activeIndex,
|
|
50
51
|
initialActiveIndex,
|
|
51
|
-
|
|
52
|
+
totalStepsRef,
|
|
52
53
|
stepElementRef,
|
|
54
|
+
stepIndexRef,
|
|
55
|
+
stepsRef,
|
|
53
56
|
keepInDOM
|
|
54
57
|
} = useContext(WizardContext) || {};
|
|
55
|
-
const
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
const
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
58
|
+
const wizardStepContext = useContext(WizardStepContext) || {};
|
|
59
|
+
const indexFromContext = wizardStepContext.index;
|
|
60
|
+
const totalSteps = totalStepsRef === null || totalStepsRef === void 0 ? void 0 : totalStepsRef.current;
|
|
61
|
+
const ariaLabel = useMemo(() => convertJsxToString(title), [title]);
|
|
62
|
+
const index = useMemo(() => {
|
|
63
|
+
if (indexProp !== undefined) {
|
|
64
|
+
return indexProp;
|
|
65
|
+
}
|
|
66
|
+
if (indexFromContext !== undefined) {
|
|
67
|
+
return indexFromContext;
|
|
68
|
+
}
|
|
69
|
+
if (stepsRef !== null && stepsRef !== void 0 && stepsRef.current) {
|
|
70
|
+
const {
|
|
71
|
+
index
|
|
72
|
+
} = Array.from(stepsRef.current.values()).find(({
|
|
73
|
+
id: currentId,
|
|
74
|
+
title: originalTitleProp,
|
|
75
|
+
stringifiedTitle
|
|
76
|
+
}) => {
|
|
77
|
+
var _originalTitleProp$pr;
|
|
78
|
+
if (id !== undefined) {
|
|
79
|
+
return id === currentId;
|
|
80
|
+
}
|
|
81
|
+
const translationId = originalTitleProp === null || originalTitleProp === void 0 ? void 0 : (_originalTitleProp$pr = originalTitleProp['props']) === null || _originalTitleProp$pr === void 0 ? void 0 : _originalTitleProp$pr.id;
|
|
82
|
+
if (translationId) {
|
|
83
|
+
var _title$props;
|
|
84
|
+
return translationId === (title === null || title === void 0 ? void 0 : (_title$props = title['props']) === null || _title$props === void 0 ? void 0 : _title$props.id);
|
|
85
|
+
}
|
|
86
|
+
if (stringifiedTitle) {
|
|
87
|
+
return stringifiedTitle === ariaLabel;
|
|
88
|
+
}
|
|
89
|
+
return originalTitleProp === title;
|
|
90
|
+
}) || {};
|
|
91
|
+
if (index !== undefined) {
|
|
92
|
+
return index;
|
|
64
93
|
}
|
|
65
|
-
return () => {
|
|
66
|
-
stepElementRef.current = null;
|
|
67
|
-
};
|
|
68
94
|
}
|
|
69
|
-
|
|
95
|
+
if (totalSteps && stepIndexRef) {
|
|
96
|
+
stepIndexRef.current += 1;
|
|
97
|
+
}
|
|
98
|
+
return stepIndexRef === null || stepIndexRef === void 0 ? void 0 : stepIndexRef.current;
|
|
99
|
+
}, [indexProp, stepsRef, totalSteps, stepIndexRef, indexFromContext, title, id, ariaLabel]);
|
|
100
|
+
if (index >= totalSteps) {
|
|
101
|
+
enableMapOverChildren();
|
|
102
|
+
}
|
|
70
103
|
if (prerenderFieldProps) {
|
|
71
104
|
return children;
|
|
72
105
|
}
|
|
106
|
+
if (include === false) {
|
|
107
|
+
return _Fragment || (_Fragment = React.createElement(React.Fragment, null));
|
|
108
|
+
}
|
|
109
|
+
if (includeWhen && !check({
|
|
110
|
+
visibleWhen: includeWhen
|
|
111
|
+
})) {
|
|
112
|
+
return _Fragment2 || (_Fragment2 = React.createElement(React.Fragment, null));
|
|
113
|
+
}
|
|
73
114
|
const fieldProps = typeof required === 'boolean' ? {
|
|
74
115
|
required
|
|
75
116
|
} : undefined;
|
|
117
|
+
const innerRef = !prerenderFieldProps && activeIndex === index ? stepElementRef : null;
|
|
76
118
|
const content = React.createElement(WizardStepContext.Provider, {
|
|
77
119
|
value: {
|
|
78
120
|
index
|
|
@@ -81,10 +123,10 @@ function Step(props) {
|
|
|
81
123
|
className: classnames('dnb-forms-step', className),
|
|
82
124
|
element: "section",
|
|
83
125
|
"aria-label": ariaLabel,
|
|
84
|
-
innerRef:
|
|
126
|
+
innerRef: innerRef,
|
|
85
127
|
tabIndex: -1
|
|
86
128
|
}, restProps), fieldProps ? React.createElement(FieldProvider, fieldProps, children) : children));
|
|
87
|
-
if (activeIndex !== index ||
|
|
129
|
+
if (activeIndex !== index || includeWhen && !check({
|
|
88
130
|
visibleWhen: includeWhen
|
|
89
131
|
})) {
|
|
90
132
|
if (keepInDOMProp !== null && keepInDOMProp !== void 0 ? keepInDOMProp : keepInDOM) {
|
|
@@ -97,7 +139,7 @@ function Step(props) {
|
|
|
97
139
|
warn(`initialActiveIndex={${initialActiveIndex}} is used. Fields of previews steps may not validate. You can use "keepInDOM" to always run validation.`);
|
|
98
140
|
}
|
|
99
141
|
}
|
|
100
|
-
return
|
|
142
|
+
return _Fragment3 || (_Fragment3 = React.createElement(React.Fragment, null));
|
|
101
143
|
}
|
|
102
144
|
return React.createElement(React.Fragment, null, content);
|
|
103
145
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Step.js","names":["React","useContext","useMemo","useRef","classnames","WizardContext","WizardStepContext","Flex","convertJsxToString","warn","FieldProvider","useLayoutEffect","window","useEffect","handleDeprecatedProps","_ref","active","activeWhen","include","includeWhen","rest","_objectWithoutProperties","_excluded","_objectSpread","Step","props","_handleDeprecatedProp","className","title","inactive","index","required","keepInDOM","keepInDOMProp","prerenderFieldProps","children","restProps","_excluded2","check","activeIndex","initialActiveIndex","stepsRef","stepElementRef","ariaLabel","_ref2","_stepsRef$current","_stepsRef$current$ind","_stepsRef$current2","current","currentElementRef","fieldProps","undefined","content","createElement","Provider","value","Stack","_extends","element","innerRef","tabIndex","visibleWhen","hidden","_Fragment","Fragment","_supportsSpacingProps"],"sources":["../../../../../../src/extensions/forms/Wizard/Step/Step.tsx"],"sourcesContent":["import React, { useContext, useMemo, useRef } from 'react'\nimport classnames from 'classnames'\nimport { ComponentProps } from '../../types'\nimport { Props as FlexContainerProps } from '../../../../components/flex/Container'\nimport WizardContext from '../Context/WizardContext'\nimport WizardStepContext from './StepContext'\nimport Flex from '../../../../components/flex/Flex'\nimport {\n convertJsxToString,\n warn,\n} from '../../../../shared/component-helper'\nimport FieldProvider from '../../Field/Provider'\nimport type { VisibleWhen } from '../../Form/Visibility'\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 FlexContainerProps & {\n /**\n * A title that will be displayed in the indicator.\n */\n title?: React.ReactNode\n /**\n * Will treat the step as non-navigable if set to `true`.\n */\n inactive?: boolean\n\n /**\n * To determine if the step should be rendered.\n * Used internally by the WizardContainer.\n */\n index?: number\n\n /**\n * Will make all the fields inside the step to be required.\n */\n required?: boolean\n\n /**\n * If set to `false`, the step will not be rendered.\n * @deprecated use `include` instead\n */\n active?: boolean\n\n /**\n * Provide a `path` and a `hasValue` property with the expected value in order to enable the step. You can alternatively provide a `hasValue` function that returns a boolean. The first parameter is the value of the path.\n * @deprecated use `includeWhen` instead\n */\n activeWhen?: VisibleWhen\n\n /**\n * If set to `false`, the step will not be rendered.\n */\n\n include?: boolean\n /**\n * Provide a `path` and a `hasValue` property with the expected value in order to enable the step. You can alternatively provide a `hasValue` function that returns a boolean. The first parameter is the value of the path.\n */\n includeWhen?: VisibleWhen\n\n /**\n * Determines if the step should be kept in the DOM. Defaults to `false`.\n */\n keepInDOM?: boolean\n\n /**\n * If set to `true`, the step will always be rendered.\n * For internal use only.\n */\n prerenderFieldProps?: boolean\n }\n\nexport function handleDeprecatedProps({\n active,\n activeWhen,\n include,\n includeWhen,\n ...rest\n}: Props): Omit<Props, 'active' | 'activeWhen'> {\n return {\n include: include ?? active,\n includeWhen: includeWhen ?? activeWhen,\n ...rest,\n }\n}\nfunction Step(props: Props): JSX.Element {\n const {\n className,\n title,\n inactive, // eslint-disable-line\n index,\n include = true,\n includeWhen,\n required,\n keepInDOM: keepInDOMProp,\n prerenderFieldProps,\n children,\n ...restProps\n } = handleDeprecatedProps(props)\n const {\n check,\n activeIndex,\n initialActiveIndex,\n stepsRef,\n stepElementRef,\n keepInDOM,\n } = useContext(WizardContext) || {}\n\n const ariaLabel = useMemo(() => {\n return (\n (!prerenderFieldProps &&\n (stepsRef?.current?.[index]?.title ||\n stepsRef?.current?.[index])) ??\n convertJsxToString(title)\n )\n }, [index, prerenderFieldProps, title, stepsRef])\n\n const currentElementRef = useRef<HTMLElement>()\n useLayoutEffect(() => {\n if (!prerenderFieldProps && typeof stepElementRef !== 'undefined') {\n if (currentElementRef.current) {\n stepElementRef.current = currentElementRef.current\n }\n return () => {\n stepElementRef.current = null\n }\n }\n }, [prerenderFieldProps, stepElementRef])\n\n if (prerenderFieldProps) {\n return children as JSX.Element\n }\n\n const fieldProps =\n typeof required === 'boolean' ? { required } : undefined\n\n const content = (\n <WizardStepContext.Provider value={{ index }}>\n <Flex.Stack\n className={classnames('dnb-forms-step', className)}\n element=\"section\"\n aria-label={ariaLabel}\n innerRef={currentElementRef}\n tabIndex={-1}\n {...restProps}\n >\n {fieldProps ? (\n <FieldProvider {...fieldProps}>{children}</FieldProvider>\n ) : (\n children\n )}\n </Flex.Stack>\n </WizardStepContext.Provider>\n )\n\n if (\n activeIndex !== index ||\n include === false ||\n (includeWhen && !check({ visibleWhen: includeWhen }))\n ) {\n if (keepInDOMProp ?? keepInDOM) {\n return (\n <div title=\"Wizard Step\" hidden>\n {content}\n </div>\n )\n } else {\n if (initialActiveIndex > 0) {\n warn(\n `initialActiveIndex={${initialActiveIndex}} is used. Fields of previews steps may not validate. You can use \"keepInDOM\" to always run validation.`\n )\n }\n }\n\n // Another step is active\n return <></>\n }\n\n return <>{content}</>\n}\n\nStep._supportsSpacingProps = true\nexport default Step\n"],"mappings":";;;;;;;;;;AAAA,OAAOA,KAAK,IAAIC,UAAU,EAAEC,OAAO,EAAEC,MAAM,QAAQ,OAAO;AAC1D,OAAOC,UAAU,MAAM,YAAY;AAGnC,OAAOC,aAAa,MAAM,0BAA0B;AACpD,OAAOC,iBAAiB,MAAM,eAAe;AAC7C,OAAOC,IAAI,MAAM,kCAAkC;AACnD,SACEC,kBAAkB,EAClBC,IAAI,QACC,qCAAqC;AAC5C,OAAOC,aAAa,MAAM,sBAAsB;AAIhD,MAAMC,eAAe,GACnB,OAAOC,MAAM,KAAK,WAAW,GAAGZ,KAAK,CAACa,SAAS,GAAGb,KAAK,CAACW,eAAe;AA0DzE,OAAO,SAASG,qBAAqBA,CAAAC,IAAA,EAMW;EAAA,IANV;MACpCC,MAAM;MACNC,UAAU;MACVC,OAAO;MACPC;IAEK,CAAC,GAAAJ,IAAA;IADHK,IAAI,GAAAC,wBAAA,CAAAN,IAAA,EAAAO,SAAA;EAEP,OAAAC,aAAA;IACEL,OAAO,EAAEA,OAAO,aAAPA,OAAO,cAAPA,OAAO,GAAIF,MAAM;IAC1BG,WAAW,EAAEA,WAAW,aAAXA,WAAW,cAAXA,WAAW,GAAIF;EAAU,GACnCG,IAAI;AAEX;AACA,SAASI,IAAIA,CAACC,KAAY,EAAe;EACvC,MAAAC,qBAAA,GAYIZ,qBAAqB,CAACW,KAAK,CAAC;IAZ1B;MACJE,SAAS;MACTC,KAAK;MACLC,QAAQ;MACRC,KAAK;MACLZ,OAAO,GAAG,IAAI;MACdC,WAAW;MACXY,QAAQ;MACRC,SAAS,EAAEC,aAAa;MACxBC,mBAAmB;MACnBC;IAEF,CAAC,GAAAT,qBAAA;IADIU,SAAS,GAAAf,wBAA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AG,IAAI;AACjC,eAAezC,IAAI","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"Step.js","names":["React","useContext","useMemo","classnames","WizardContext","WizardStepContext","Flex","convertJsxToString","warn","FieldProvider","handleDeprecatedProps","_ref","active","activeWhen","include","includeWhen","rest","_objectWithoutProperties","_excluded","_objectSpread","Step","props","_handleDeprecatedProp","id","className","title","index","indexProp","inactive","required","keepInDOM","keepInDOMProp","prerenderFieldProps","children","restProps","_excluded2","check","enableMapOverChildren","activeIndex","initialActiveIndex","totalStepsRef","stepElementRef","stepIndexRef","stepsRef","wizardStepContext","indexFromContext","totalSteps","current","ariaLabel","undefined","Array","from","values","find","currentId","originalTitleProp","stringifiedTitle","_originalTitleProp$pr","translationId","_title$props","_Fragment","createElement","Fragment","visibleWhen","_Fragment2","fieldProps","innerRef","content","Provider","value","Stack","_extends","element","tabIndex","hidden","_Fragment3","_supportsSpacingProps"],"sources":["../../../../../../src/extensions/forms/Wizard/Step/Step.tsx"],"sourcesContent":["import React, { useContext, useMemo } from 'react'\nimport classnames from 'classnames'\nimport { ComponentProps } from '../../types'\nimport { Props as FlexContainerProps } from '../../../../components/flex/Container'\nimport WizardContext from '../Context/WizardContext'\nimport WizardStepContext from './StepContext'\nimport Flex from '../../../../components/flex/Flex'\nimport {\n convertJsxToString,\n warn,\n} from '../../../../shared/component-helper'\nimport FieldProvider from '../../Field/Provider'\nimport type { VisibleWhen } from '../../Form/Visibility'\n\nexport type Props = ComponentProps &\n FlexContainerProps & {\n /**\n * An unique title of the step.\n */\n title?: React.ReactNode\n\n /**\n * Will treat the step as non-navigable if set to `true`.\n */\n inactive?: boolean\n\n /**\n * To determine if the step should be rendered.\n * Used internally by the WizardContainer.\n */\n index?: number\n\n /**\n * Will make all the fields inside the step to be required.\n */\n required?: boolean\n\n /**\n * If set to `false`, the step will not be rendered.\n * @deprecated use `include` instead\n */\n active?: boolean\n\n /**\n * Provide a `path` and a `hasValue` property with the expected value in order to enable the step. You can alternatively provide a `hasValue` function that returns a boolean. The first parameter is the value of the path.\n * @deprecated use `includeWhen` instead\n */\n activeWhen?: VisibleWhen\n\n /**\n * If set to `false`, the step will not be rendered.\n */\n\n include?: boolean\n /**\n * Provide a `path` and a `hasValue` property with the expected value in order to enable the step. You can alternatively provide a `hasValue` function that returns a boolean. The first parameter is the value of the path.\n */\n includeWhen?: VisibleWhen\n\n /**\n * Determines if the step should be kept in the DOM. Defaults to `false`.\n */\n keepInDOM?: boolean\n\n /**\n * If set to `true`, the step will always be rendered.\n * For internal use only.\n */\n prerenderFieldProps?: boolean\n }\n\nexport function handleDeprecatedProps({\n active,\n activeWhen,\n include,\n includeWhen,\n ...rest\n}: Props): Omit<Props, 'active' | 'activeWhen'> {\n return {\n include: include ?? active,\n includeWhen: includeWhen ?? activeWhen,\n ...rest,\n }\n}\n\nfunction Step(props: Props): JSX.Element {\n const {\n id,\n className,\n title,\n index: indexProp,\n inactive, // eslint-disable-line\n include = true,\n includeWhen,\n required,\n keepInDOM: keepInDOMProp,\n prerenderFieldProps,\n children,\n ...restProps\n } = handleDeprecatedProps(props)\n\n const {\n check,\n enableMapOverChildren,\n activeIndex,\n initialActiveIndex,\n totalStepsRef,\n stepElementRef,\n stepIndexRef,\n stepsRef,\n keepInDOM,\n } = useContext(WizardContext) || {}\n\n const wizardStepContext = useContext(WizardStepContext) || {}\n const indexFromContext = wizardStepContext.index\n\n const totalSteps = totalStepsRef?.current\n const ariaLabel = useMemo(() => convertJsxToString(title), [title])\n const index = useMemo(() => {\n if (indexProp !== undefined) {\n return indexProp\n }\n\n // Try to use the index from the step context\n if (indexFromContext !== undefined) {\n return indexFromContext\n }\n\n if (stepsRef?.current) {\n // Try different ways to find the step index\n const { index } =\n Array.from(stepsRef.current.values()).find(\n ({\n id: currentId,\n title: originalTitleProp,\n stringifiedTitle,\n }) => {\n // Try to find the step by id\n if (id !== undefined) {\n return id === currentId\n }\n\n // Try to find the step by <Translation id=\"...\" />\n const translationId = originalTitleProp?.['props']?.id\n if (translationId) {\n return translationId === title?.['props']?.id\n }\n\n // Try to find the step by a string (with convertJsxToString) title\n if (stringifiedTitle) {\n return stringifiedTitle === ariaLabel\n }\n\n // Try to find the step by a JSX title\n return originalTitleProp === title\n }\n ) || {}\n\n if (index !== undefined) {\n return index\n }\n }\n\n if (\n totalSteps && // Is only used to make the deps ESLint happy.\n stepIndexRef\n ) {\n stepIndexRef.current += 1\n }\n\n return stepIndexRef?.current\n }, [\n indexProp,\n stepsRef,\n totalSteps, // \"totalSteps\" is needed to make dynamic steps work.\n stepIndexRef,\n indexFromContext,\n title,\n id,\n ariaLabel,\n ])\n\n // If the index is greater than the total steps,\n // its a sign that e.g. React.StrictMode is used.\n // And if no title or id is given,\n // we need to force an re-render and use an alternative render method,\n // using React.Children.map(children, ...).\n if (index >= totalSteps) {\n enableMapOverChildren()\n }\n\n if (prerenderFieldProps) {\n return children as JSX.Element\n }\n\n if (include === false) {\n return <></>\n }\n\n if (\n includeWhen &&\n !check({\n visibleWhen: includeWhen,\n })\n ) {\n return <></>\n }\n\n const fieldProps =\n typeof required === 'boolean' ? { required } : undefined\n const innerRef =\n !prerenderFieldProps && activeIndex === index ? stepElementRef : null\n\n const content = (\n <WizardStepContext.Provider value={{ index }}>\n <Flex.Stack\n className={classnames('dnb-forms-step', className)}\n element=\"section\"\n aria-label={ariaLabel}\n innerRef={innerRef}\n tabIndex={-1}\n {...restProps}\n >\n {fieldProps ? (\n <FieldProvider {...fieldProps}>{children}</FieldProvider>\n ) : (\n children\n )}\n </Flex.Stack>\n </WizardStepContext.Provider>\n )\n\n if (\n activeIndex !== index ||\n (includeWhen && !check({ visibleWhen: includeWhen }))\n ) {\n if (keepInDOMProp ?? keepInDOM) {\n return (\n <div title=\"Wizard Step\" hidden>\n {content}\n </div>\n )\n } else {\n if (initialActiveIndex > 0) {\n warn(\n `initialActiveIndex={${initialActiveIndex}} is used. Fields of previews steps may not validate. You can use \"keepInDOM\" to always run validation.`\n )\n }\n }\n\n // Another step is active\n return <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ACC,KAAK,EAAE;MAAE3C;IAAM;EAAE,GAC3C1B,KAAA,CAAA6D,aAAA,CAACvD,IAAI,CAACgE,KAAK,EAAAC,QAAA;IACT/C,SAAS,EAAErB,UAAU,CAAC,gBAAgB,EAAEqB,SAAS,CAAE;IACnDgD,OAAO,EAAC,SAAS;IACjB,cAAYxB,SAAU;IACtBkB,QAAQ,EAAEA,QAAS;IACnBO,QAAQ,EAAE,CAAC;EAAE,GACTvC,SAAS,GAEZ+B,UAAU,GACTjE,KAAA,CAAA6D,aAAA,CAACpD,aAAa,EAAKwD,UAAU,EAAGhC,QAAwB,CAAC,GAEzDA,QAEQ,CACc,CAC7B;EAED,IACEK,WAAW,KAAKZ,KAAK,IACpBX,WAAW,IAAI,CAACqB,KAAK,CAAC;IAAE2B,WAAW,EAAEhD;EAAY,CAAC,CAAE,EACrD;IACA,IAAIgB,aAAa,aAAbA,aAAa,cAAbA,aAAa,GAAID,SAAS,EAAE;MAC9B,OACE9B,KAAA,CAAA6D,aAAA;QAAKpC,KAAK,EAAC,aAAa;QAACiD,MAAM;MAAA,GAC5BP,OACE,CAAC;IAEV,CAAC,MAAM;MACL,IAAI5B,kBAAkB,GAAG,CAAC,EAAE;QAC1B/B,IAAI,CACF,uBAAuB+B,kBAAkB,yGAC3C,CAAC;MACH;IACF;IAGA,OAAAoC,UAAA,KAAAA,UAAA,GAAO3E,KAAA,CAAA6D,aAAA,CAAA7D,KAAA,CAAA8D,QAAA,MAAI,CAAC;EACd;EAEA,OAAO9D,KAAA,CAAA6D,aAAA,CAAA7D,KAAA,CAAA8D,QAAA,QAAGK,OAAU,CAAC;AACvB;AAEA/C,IAAI,CAACwD,qBAAqB,GAAG,IAAI;AACjC,eAAexD,IAAI","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StepDocs.js","names":["StepProperties","title","doc","type","status","inactive","required","include","includeWhen","keepInDOM","children","active","activeWhen","StepEvents"],"sources":["../../../../../../src/extensions/forms/Wizard/Step/StepDocs.ts"],"sourcesContent":["import { PropertiesTableProps } from '../../../../shared/types'\n\nexport const StepProperties: PropertiesTableProps = {\n title: {\n doc: '
|
|
1
|
+
{"version":3,"file":"StepDocs.js","names":["StepProperties","title","doc","type","status","inactive","required","include","includeWhen","keepInDOM","children","active","activeWhen","StepEvents"],"sources":["../../../../../../src/extensions/forms/Wizard/Step/StepDocs.ts"],"sourcesContent":["import { PropertiesTableProps } from '../../../../shared/types'\n\nexport const StepProperties: PropertiesTableProps = {\n title: {\n doc: 'An unique title of the step.',\n type: 'React.Node',\n status: 'required',\n },\n inactive: {\n doc: 'Will treat the step as non-navigable if set to `true`.',\n type: 'boolean',\n status: 'optional',\n },\n required: {\n doc: 'Will make all nested form fields required.',\n type: 'boolean',\n status: 'optional',\n },\n include: {\n doc: 'If set to `false`, the step will not be rendered.',\n type: 'boolean',\n status: 'optional',\n },\n includeWhen: {\n doc: 'Provide a `path` and a `hasValue` property with the expected value in order to enable the step. You can alternatively provide a `hasValue` function that returns a boolean. The first parameter is the value of the path.',\n type: 'object',\n status: 'optional',\n },\n keepInDOM: {\n doc: 'Determines if the step should be kept in the DOM. Defaults to `false`.',\n type: 'boolean',\n status: 'optional',\n },\n children: {\n doc: 'Contents.',\n type: 'React.Node',\n status: 'required',\n },\n '[Flex.Container](/uilib/layout/flex/container/properties)': {\n doc: 'Flex.Container properties.',\n type: 'Various',\n status: 'optional',\n },\n '[Space](/uilib/layout/space/properties)': {\n doc: 'Spacing properties like `top` or `bottom` are supported.',\n type: ['string', 'object'],\n status: 'optional',\n },\n active: {\n doc: 'Deprecated, use `include`. Old docs: If set to `false`, the step will not be rendered.',\n type: 'boolean',\n status: 'deprecated',\n },\n activeWhen: {\n doc: 'Deprecated, use `includeWhen`. Old docs: Provide a `path` and a `hasValue` property with the expected value in order to enable the step. You can alternatively provide a `hasValue` function that returns a boolean. The first parameter is the value of the path.',\n type: 'object',\n status: 'deprecated',\n },\n}\n\nexport const StepEvents: PropertiesTableProps =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ignoreList":[]}
|
|
@@ -8,11 +8,11 @@ export default function useStep(id = null, {
|
|
|
8
8
|
onStepChange
|
|
9
9
|
} = {}) {
|
|
10
10
|
const setFormError = useCallback(() => null, []);
|
|
11
|
-
const
|
|
11
|
+
const wizardContext = useContext(WizardContext) || {
|
|
12
12
|
setFormError
|
|
13
13
|
};
|
|
14
|
-
if (onStepChange && !id &&
|
|
15
|
-
id =
|
|
14
|
+
if (onStepChange && !id && wizardContext.id) {
|
|
15
|
+
id = wizardContext.id;
|
|
16
16
|
}
|
|
17
17
|
const sharedDataRef = useRef(null);
|
|
18
18
|
sharedDataRef.current = useSharedState(id ? createReferenceKey(id, 'wizard') : undefined);
|
|
@@ -25,22 +25,14 @@ export default function useStep(id = null, {
|
|
|
25
25
|
if (data && !data.setFormError) {
|
|
26
26
|
data.setFormError = setFormError;
|
|
27
27
|
}
|
|
28
|
-
const
|
|
28
|
+
const context = data || wizardContext;
|
|
29
29
|
const {
|
|
30
|
-
|
|
31
|
-
} =
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
value.totalSteps = totalSteps;
|
|
36
|
-
}
|
|
37
|
-
}, [stepsRef, value]);
|
|
38
|
-
if (data) {
|
|
39
|
-
setTotalSteps();
|
|
30
|
+
totalStepsRef
|
|
31
|
+
} = context || {};
|
|
32
|
+
const totalSteps = (totalStepsRef === null || totalStepsRef === void 0 ? void 0 : totalStepsRef.current) || 0;
|
|
33
|
+
if (context && context.totalSteps !== totalSteps) {
|
|
34
|
+
context.totalSteps = totalSteps;
|
|
40
35
|
}
|
|
41
|
-
|
|
42
|
-
setTotalSteps();
|
|
43
|
-
}, [setTotalSteps, stepsRef, value]);
|
|
44
|
-
return value;
|
|
36
|
+
return context;
|
|
45
37
|
}
|
|
46
38
|
//# sourceMappingURL=useStep.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useStep.js","names":["React","useCallback","useContext","useRef","WizardContext","createReferenceKey","useSharedState","useLayoutEffect","window","useEffect","useStep","id","onStepChange","setFormError","
|
|
1
|
+
{"version":3,"file":"useStep.js","names":["React","useCallback","useContext","useRef","WizardContext","createReferenceKey","useSharedState","useLayoutEffect","window","useEffect","useStep","id","onStepChange","setFormError","wizardContext","sharedDataRef","current","undefined","extend","data","context","totalStepsRef","totalSteps"],"sources":["../../../../../../src/extensions/forms/Wizard/hooks/useStep.tsx"],"sourcesContent":["import React, { useCallback, useContext, useRef } from 'react'\nimport WizardContext, {\n WizardContextState,\n} from '../Context/WizardContext'\nimport type { OnStepChange } from '../Context/types'\nimport {\n SharedStateId,\n createReferenceKey,\n useSharedState,\n} from '../../../../shared/helpers/useSharedState'\n\n// SSR warning fix: https://gist.github.com/gaearon/e7d97cdf38a2907924ea12e4ebdf3c85\nconst useLayoutEffect =\n typeof window === 'undefined' ? React.useEffect : React.useLayoutEffect\n\nexport default function useStep(\n id: SharedStateId = null,\n { onStepChange }: { onStepChange?: OnStepChange } = {}\n) {\n const setFormError = useCallback(() => null, [])\n const wizardContext = useContext(WizardContext) || { setFormError }\n\n // In order to make it possible to add a \"onStepChange\" handler without an id,\n // we at least check if there is one from the context.\n if (onStepChange && !id && wizardContext.id) {\n id = wizardContext.id\n }\n\n const sharedDataRef =\n useRef<ReturnType<typeof useSharedState<WizardContextState>>>(null)\n sharedDataRef.current = useSharedState<WizardContextState>(\n id ? createReferenceKey(id, 'wizard') : undefined\n )\n\n useLayoutEffect(() => {\n sharedDataRef.current.extend({\n onStepChange,\n } as unknown as WizardContextState) // Internal type\n }, [onStepChange])\n\n const data = sharedDataRef.current.data\n if (data && !data.setFormError) {\n data.setFormError = setFormError\n }\n\n const context = data || wizardContext\n const { totalStepsRef } = context || {}\n const totalSteps = totalStepsRef?.current || 0\n if (context && context.totalSteps !== totalSteps) {\n context.totalSteps = totalSteps\n }\n\n return context\n}\n"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,WAAW,EAAEC,UAAU,EAAEC,MAAM,QAAQ,OAAO;AAC9D,O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A,OAAO,CAACE,UAAU,KAAKA,UAAU,EAAE;IAChDF,OAAO,CAACE,UAAU,GAAGA,UAAU;EACjC;EAEA,OAAOF,OAAO;AAChB","ignoreList":[]}
|
|
@@ -101,8 +101,10 @@ export default function useFieldProps(localProps, {
|
|
|
101
101
|
setMountedField: setMountedFieldSnapshot
|
|
102
102
|
} = useContext(SnapshotContext) || {};
|
|
103
103
|
const {
|
|
104
|
-
isVisible
|
|
104
|
+
isVisible,
|
|
105
|
+
keepInDOM
|
|
105
106
|
} = useContext(VisibilityContext) || {};
|
|
107
|
+
const handleFieldAsVisible = isVisible || keepInDOM;
|
|
106
108
|
const {
|
|
107
109
|
getValueByPath,
|
|
108
110
|
getSourceValue
|
|
@@ -156,7 +158,7 @@ export default function useFieldProps(localProps, {
|
|
|
156
158
|
activeIndex,
|
|
157
159
|
activeIndexRef,
|
|
158
160
|
prerenderFieldProps,
|
|
159
|
-
|
|
161
|
+
setFieldError: setFieldErrorWizard
|
|
160
162
|
} = wizardContext || {};
|
|
161
163
|
const {
|
|
162
164
|
index: wizardIndex
|
|
@@ -383,10 +385,10 @@ export default function useFieldProps(localProps, {
|
|
|
383
385
|
}, [setFieldStateDataContext, identifier, setFieldStateFieldBlock, validateInitially]);
|
|
384
386
|
const setErrorState = useCallback(hasError => {
|
|
385
387
|
showFieldErrorFieldBlock === null || showFieldErrorFieldBlock === void 0 ? void 0 : showFieldErrorFieldBlock(identifier, hasError);
|
|
386
|
-
revealErrorWizard === null || revealErrorWizard === void 0 ? void 0 : revealErrorWizard(wizardIndex, identifier, hasError);
|
|
387
388
|
revealErrorBoundary === null || revealErrorBoundary === void 0 ? void 0 : revealErrorBoundary(identifier, hasError);
|
|
388
389
|
revealErrorDataContext === null || revealErrorDataContext === void 0 ? void 0 : revealErrorDataContext(identifier, hasError);
|
|
389
|
-
|
|
390
|
+
setFieldErrorWizard === null || setFieldErrorWizard === void 0 ? void 0 : setFieldErrorWizard(wizardIndex, identifier, handleFieldAsVisible !== false ? hasError : undefined);
|
|
391
|
+
}, [identifier, handleFieldAsVisible, revealErrorBoundary, revealErrorDataContext, setFieldErrorWizard, showFieldErrorFieldBlock, wizardIndex]);
|
|
390
392
|
const revealError = useCallback(() => {
|
|
391
393
|
if (validateInitially === false && revealErrorRef.current === false) {
|
|
392
394
|
revealErrorRef.current = undefined;
|
|
@@ -616,6 +618,7 @@ export default function useFieldProps(localProps, {
|
|
|
616
618
|
localErrorRef.current = error;
|
|
617
619
|
setFieldErrorDataContext === null || setFieldErrorDataContext === void 0 ? void 0 : setFieldErrorDataContext(identifier, error);
|
|
618
620
|
setFieldErrorBoundary === null || setFieldErrorBoundary === void 0 ? void 0 : setFieldErrorBoundary(identifier, error);
|
|
621
|
+
setFieldErrorWizard === null || setFieldErrorWizard === void 0 ? void 0 : setFieldErrorWizard(wizardIndex, identifier, handleFieldAsVisible !== false ? Boolean(error) : undefined);
|
|
619
622
|
setBlockRecord === null || setBlockRecord === void 0 ? void 0 : setBlockRecord({
|
|
620
623
|
stateId,
|
|
621
624
|
identifier,
|
|
@@ -625,7 +628,7 @@ export default function useFieldProps(localProps, {
|
|
|
625
628
|
});
|
|
626
629
|
setFieldStateDataContext === null || setFieldStateDataContext === void 0 ? void 0 : setFieldStateDataContext(identifier, error ? 'error' : undefined);
|
|
627
630
|
forceUpdate();
|
|
628
|
-
}, [identifier, inFieldBlock, prepareError, setFieldErrorBoundary, setFieldErrorDataContext,
|
|
631
|
+
}, [handleFieldAsVisible, identifier, inFieldBlock, prepareError, setBlockRecord, setFieldErrorBoundary, setFieldErrorDataContext, setFieldErrorWizard, setFieldStateDataContext, stateId, validateInitially, wizardIndex]);
|
|
629
632
|
const clearErrorState = useCallback(() => {
|
|
630
633
|
var _schemaValidatorRef$c;
|
|
631
634
|
persistErrorState('wipe', undefined);
|
|
@@ -1173,7 +1176,12 @@ export default function useFieldProps(localProps, {
|
|
|
1173
1176
|
setFieldErrorBoundary === null || setFieldErrorBoundary === void 0 ? void 0 : setFieldErrorBoundary(identifier, undefined);
|
|
1174
1177
|
localErrorRef.current = undefined;
|
|
1175
1178
|
};
|
|
1176
|
-
}, [identifier, setFieldErrorBoundary, setFieldErrorDataContext
|
|
1179
|
+
}, [identifier, setFieldErrorBoundary, setFieldErrorDataContext]);
|
|
1180
|
+
useEffect(() => {
|
|
1181
|
+
return () => {
|
|
1182
|
+
setFieldErrorWizard === null || setFieldErrorWizard === void 0 ? void 0 : setFieldErrorWizard(wizardIndex, identifier, undefined);
|
|
1183
|
+
};
|
|
1184
|
+
}, [identifier, setFieldErrorWizard, wizardIndex]);
|
|
1177
1185
|
useEffect(() => {
|
|
1178
1186
|
validateValue();
|
|
1179
1187
|
}, [validateValue]);
|
|
@@ -1382,7 +1390,7 @@ export default function useFieldProps(localProps, {
|
|
|
1382
1390
|
});
|
|
1383
1391
|
return () => {
|
|
1384
1392
|
if (mountedFieldsRefFieldBlock) {
|
|
1385
|
-
mountedFieldsRefFieldBlock.current
|
|
1393
|
+
mountedFieldsRefFieldBlock.current.set(identifier, true);
|
|
1386
1394
|
}
|
|
1387
1395
|
};
|
|
1388
1396
|
}
|
|
@@ -1419,7 +1427,7 @@ export default function useFieldProps(localProps, {
|
|
|
1419
1427
|
if (inFieldBlock) {
|
|
1420
1428
|
var _fieldBlockContext$fi;
|
|
1421
1429
|
if (mountedFieldsRefFieldBlock) {
|
|
1422
|
-
mountedFieldsRefFieldBlock.current
|
|
1430
|
+
mountedFieldsRefFieldBlock.current.set(identifier, true);
|
|
1423
1431
|
}
|
|
1424
1432
|
const stateIds = (_fieldBlockContext$fi = fieldBlockContext.fieldStateIdsRef) === null || _fieldBlockContext$fi === void 0 ? void 0 : _fieldBlockContext$fi.current;
|
|
1425
1433
|
if (stateIds) {
|