@dnb/eufemia 10.75.0 → 10.75.2
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 +35 -0
- package/cjs/components/dropdown/Dropdown.js +1 -1
- package/cjs/components/dropdown/Dropdown.js.map +1 -1
- package/cjs/components/toggle-button/ToggleButton.d.ts +1 -1
- package/cjs/components/toggle-button/ToggleButtonDocs.js +1 -1
- package/cjs/components/toggle-button/ToggleButtonDocs.js.map +1 -1
- package/cjs/components/upload/Upload.js +5 -2
- package/cjs/components/upload/Upload.js.map +1 -1
- package/cjs/components/upload/UploadFileInput.d.ts +2 -1
- package/cjs/components/upload/UploadFileInput.js +7 -4
- package/cjs/components/upload/UploadFileInput.js.map +1 -1
- package/cjs/extensions/forms/DataContext/Context.d.ts +5 -2
- package/cjs/extensions/forms/DataContext/Context.js.map +1 -1
- package/cjs/extensions/forms/DataContext/Provider/Provider.js +42 -16
- package/cjs/extensions/forms/DataContext/Provider/Provider.js.map +1 -1
- package/cjs/extensions/forms/DataContext/Provider/useEventListener.d.ts +3 -0
- package/cjs/extensions/forms/DataContext/Provider/useEventListener.js +29 -0
- package/cjs/extensions/forms/DataContext/Provider/useEventListener.js.map +1 -0
- package/cjs/extensions/forms/Field/BankAccountNumber/BankAccountNumberDocs.js +8 -2
- package/cjs/extensions/forms/Field/BankAccountNumber/BankAccountNumberDocs.js.map +1 -1
- package/cjs/extensions/forms/Field/NationalIdentityNumber/NationalIdentityNumberDocs.js +8 -2
- package/cjs/extensions/forms/Field/NationalIdentityNumber/NationalIdentityNumberDocs.js.map +1 -1
- package/cjs/extensions/forms/Field/Number/NumberDocs.js +1 -1
- package/cjs/extensions/forms/Field/Number/NumberDocs.js.map +1 -1
- package/cjs/extensions/forms/Field/OrganizationNumber/OrganizationNumberDocs.js +8 -2
- package/cjs/extensions/forms/Field/OrganizationNumber/OrganizationNumberDocs.js.map +1 -1
- package/cjs/extensions/forms/Field/Password/PasswordDocs.js +8 -2
- package/cjs/extensions/forms/Field/Password/PasswordDocs.js.map +1 -1
- package/cjs/extensions/forms/Field/PhoneNumber/PhoneNumber.d.ts +1 -1
- package/cjs/extensions/forms/Field/PhoneNumber/PhoneNumber.js.map +1 -1
- package/cjs/extensions/forms/Field/PhoneNumber/PhoneNumberDocs.js +9 -0
- package/cjs/extensions/forms/Field/PhoneNumber/PhoneNumberDocs.js.map +1 -1
- package/cjs/extensions/forms/Field/Provider/useFieldProvider.d.ts +3 -3
- package/cjs/extensions/forms/Field/Selection/SelectionDocs.js +1 -1
- package/cjs/extensions/forms/Field/Selection/SelectionDocs.js.map +1 -1
- package/cjs/extensions/forms/Field/String/StringDocs.js +7 -7
- package/cjs/extensions/forms/Field/String/StringDocs.js.map +1 -1
- package/cjs/extensions/forms/Field/Toggle/Toggle.js +2 -2
- package/cjs/extensions/forms/Field/Toggle/Toggle.js.map +1 -1
- package/cjs/extensions/forms/Field/Upload/Upload.d.ts +1 -1
- package/cjs/extensions/forms/Field/Upload/Upload.js +3 -1
- package/cjs/extensions/forms/Field/Upload/Upload.js.map +1 -1
- package/cjs/extensions/forms/Field/Upload/UploadDocs.js.map +1 -1
- package/cjs/extensions/forms/FieldBlock/FieldBlock.js +2 -2
- package/cjs/extensions/forms/FieldBlock/FieldBlock.js.map +1 -1
- package/cjs/extensions/forms/FieldBlock/FieldBlockDocs.js +1 -1
- package/cjs/extensions/forms/FieldBlock/FieldBlockDocs.js.map +1 -1
- package/cjs/extensions/forms/Form/Isolation/IsolatedContainer.js +4 -6
- package/cjs/extensions/forms/Form/Isolation/IsolatedContainer.js.map +1 -1
- package/cjs/extensions/forms/Form/Isolation/Isolation.js +2 -3
- package/cjs/extensions/forms/Form/Isolation/Isolation.js.map +1 -1
- package/cjs/extensions/forms/Form/Isolation/IsolationDataReference.d.ts +4 -2
- package/cjs/extensions/forms/Form/Isolation/IsolationDataReference.js +20 -4
- package/cjs/extensions/forms/Form/Isolation/IsolationDataReference.js.map +1 -1
- package/cjs/extensions/forms/Form/Isolation/IsolationResetButton.js +2 -1
- package/cjs/extensions/forms/Form/Isolation/IsolationResetButton.js.map +1 -1
- package/cjs/extensions/forms/Form/Isolation/useDataContextSnapshot.js +24 -10
- package/cjs/extensions/forms/Form/Isolation/useDataContextSnapshot.js.map +1 -1
- package/cjs/extensions/forms/Form/Isolation/useHandleStatus.d.ts +2 -1
- package/cjs/extensions/forms/Form/Isolation/useHandleStatus.js +10 -3
- package/cjs/extensions/forms/Form/Isolation/useHandleStatus.js.map +1 -1
- package/cjs/extensions/forms/Form/Isolation/useHasContentChanged.d.ts +3 -1
- package/cjs/extensions/forms/Form/Isolation/useHasContentChanged.js +6 -2
- package/cjs/extensions/forms/Form/Isolation/useHasContentChanged.js.map +1 -1
- package/cjs/extensions/forms/Form/Isolation/useReportError.d.ts +1 -1
- package/cjs/extensions/forms/Form/Isolation/useReportError.js +22 -7
- package/cjs/extensions/forms/Form/Isolation/useReportError.js.map +1 -1
- package/cjs/extensions/forms/Form/SubmitConfirmation/SubmitConfirmation.js +6 -6
- package/cjs/extensions/forms/Form/SubmitConfirmation/SubmitConfirmation.js.map +1 -1
- package/cjs/extensions/forms/Iterate/EditContainer/ResetButton.js +3 -1
- package/cjs/extensions/forms/Iterate/EditContainer/ResetButton.js.map +1 -1
- package/cjs/extensions/forms/Iterate/ItemNo/{useIItemNo.js → useIterateItemNo.js} +2 -2
- package/cjs/extensions/forms/Iterate/ItemNo/useIterateItemNo.js.map +1 -0
- package/cjs/extensions/forms/Iterate/PushContainer/PushContainer.d.ts +3 -1
- package/cjs/extensions/forms/Iterate/PushContainer/PushContainer.js +7 -3
- package/cjs/extensions/forms/Iterate/PushContainer/PushContainer.js.map +1 -1
- package/cjs/extensions/forms/Iterate/PushContainer/PushContainerDocs.js +5 -0
- package/cjs/extensions/forms/Iterate/PushContainer/PushContainerDocs.js.map +1 -1
- package/cjs/extensions/forms/Tools/Errors.d.ts +5 -0
- package/cjs/extensions/forms/Tools/Errors.js +46 -0
- package/cjs/extensions/forms/Tools/Errors.js.map +1 -0
- package/cjs/extensions/forms/Tools/index.d.ts +1 -0
- package/cjs/extensions/forms/Tools/index.js +7 -0
- package/cjs/extensions/forms/Tools/index.js.map +1 -1
- package/cjs/extensions/forms/Wizard/Container/PrerenderFieldPropsOfOtherSteps.js +2 -4
- package/cjs/extensions/forms/Wizard/Container/PrerenderFieldPropsOfOtherSteps.js.map +1 -1
- package/cjs/extensions/forms/Wizard/Container/WizardContainer.js +11 -5
- package/cjs/extensions/forms/Wizard/Container/WizardContainer.js.map +1 -1
- package/cjs/extensions/forms/Wizard/Context/WizardContext.d.ts +2 -1
- package/cjs/extensions/forms/Wizard/Context/WizardContext.js.map +1 -1
- package/cjs/extensions/forms/Wizard/Step/Step.js +1 -1
- package/cjs/extensions/forms/Wizard/Step/Step.js.map +1 -1
- package/cjs/extensions/forms/Wizard/hooks/useStep.js +13 -5
- package/cjs/extensions/forms/Wizard/hooks/useStep.js.map +1 -1
- package/cjs/extensions/forms/blocks/ChildrenWithAge/ChildrenWithAge.js +4 -3
- package/cjs/extensions/forms/blocks/ChildrenWithAge/ChildrenWithAge.js.map +1 -1
- package/cjs/extensions/forms/hooks/useFieldProps.js +17 -10
- package/cjs/extensions/forms/hooks/useFieldProps.js.map +1 -1
- package/cjs/extensions/payment-card/icons/brandLogos/DNB.js +2 -2
- package/cjs/extensions/payment-card/icons/brandLogos/DNB.js.map +1 -1
- package/cjs/extensions/payment-card/icons/providers/BankAxept.js +2 -2
- package/cjs/extensions/payment-card/icons/providers/BankAxept.js.map +1 -1
- package/cjs/extensions/payment-card/icons/providers/ClickToPay.js +2 -2
- package/cjs/extensions/payment-card/icons/providers/ClickToPay.js.map +1 -1
- package/cjs/extensions/payment-card/icons/providers/MastercardDefault.js +2 -2
- package/cjs/extensions/payment-card/icons/providers/MastercardDefault.js.map +1 -1
- package/cjs/extensions/payment-card/icons/providers/VisaDefault.js +2 -2
- package/cjs/extensions/payment-card/icons/providers/VisaDefault.js.map +1 -1
- package/cjs/extensions/payment-card/icons/providers/VisaPlatinum.js +2 -2
- package/cjs/extensions/payment-card/icons/providers/VisaPlatinum.js.map +1 -1
- package/cjs/fragments/drawer-list/DrawerListHelpers.js +2 -1
- package/cjs/fragments/drawer-list/DrawerListHelpers.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/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/dropdown/Dropdown.js +2 -2
- package/components/dropdown/Dropdown.js.map +1 -1
- package/components/toggle-button/ToggleButton.d.ts +1 -1
- package/components/toggle-button/ToggleButtonDocs.js +1 -1
- package/components/toggle-button/ToggleButtonDocs.js.map +1 -1
- package/components/upload/Upload.js +5 -2
- package/components/upload/Upload.js.map +1 -1
- package/components/upload/UploadFileInput.d.ts +2 -1
- package/components/upload/UploadFileInput.js +7 -4
- package/components/upload/UploadFileInput.js.map +1 -1
- package/es/components/dropdown/Dropdown.js +2 -2
- package/es/components/dropdown/Dropdown.js.map +1 -1
- package/es/components/toggle-button/ToggleButton.d.ts +1 -1
- package/es/components/toggle-button/ToggleButtonDocs.js +1 -1
- package/es/components/toggle-button/ToggleButtonDocs.js.map +1 -1
- package/es/components/upload/Upload.js +5 -2
- package/es/components/upload/Upload.js.map +1 -1
- package/es/components/upload/UploadFileInput.d.ts +2 -1
- package/es/components/upload/UploadFileInput.js +7 -4
- package/es/components/upload/UploadFileInput.js.map +1 -1
- package/es/extensions/forms/DataContext/Context.d.ts +5 -2
- package/es/extensions/forms/DataContext/Context.js.map +1 -1
- package/es/extensions/forms/DataContext/Provider/Provider.js +42 -16
- package/es/extensions/forms/DataContext/Provider/Provider.js.map +1 -1
- package/es/extensions/forms/DataContext/Provider/useEventListener.d.ts +3 -0
- package/es/extensions/forms/DataContext/Provider/useEventListener.js +22 -0
- package/es/extensions/forms/DataContext/Provider/useEventListener.js.map +1 -0
- package/es/extensions/forms/Field/BankAccountNumber/BankAccountNumberDocs.js +6 -2
- package/es/extensions/forms/Field/BankAccountNumber/BankAccountNumberDocs.js.map +1 -1
- package/es/extensions/forms/Field/NationalIdentityNumber/NationalIdentityNumberDocs.js +6 -2
- package/es/extensions/forms/Field/NationalIdentityNumber/NationalIdentityNumberDocs.js.map +1 -1
- package/es/extensions/forms/Field/Number/NumberDocs.js +1 -1
- package/es/extensions/forms/Field/Number/NumberDocs.js.map +1 -1
- package/es/extensions/forms/Field/OrganizationNumber/OrganizationNumberDocs.js +6 -2
- package/es/extensions/forms/Field/OrganizationNumber/OrganizationNumberDocs.js.map +1 -1
- package/es/extensions/forms/Field/Password/PasswordDocs.js +6 -2
- package/es/extensions/forms/Field/Password/PasswordDocs.js.map +1 -1
- package/es/extensions/forms/Field/PhoneNumber/PhoneNumber.d.ts +1 -1
- package/es/extensions/forms/Field/PhoneNumber/PhoneNumber.js.map +1 -1
- package/es/extensions/forms/Field/PhoneNumber/PhoneNumberDocs.js +7 -0
- package/es/extensions/forms/Field/PhoneNumber/PhoneNumberDocs.js.map +1 -1
- package/es/extensions/forms/Field/Provider/useFieldProvider.d.ts +3 -3
- package/es/extensions/forms/Field/Selection/SelectionDocs.js +1 -1
- package/es/extensions/forms/Field/Selection/SelectionDocs.js.map +1 -1
- package/es/extensions/forms/Field/String/StringDocs.js +7 -7
- package/es/extensions/forms/Field/String/StringDocs.js.map +1 -1
- package/es/extensions/forms/Field/Toggle/Toggle.js +1 -1
- package/es/extensions/forms/Field/Toggle/Toggle.js.map +1 -1
- package/es/extensions/forms/Field/Upload/Upload.d.ts +1 -1
- package/es/extensions/forms/Field/Upload/Upload.js +3 -1
- package/es/extensions/forms/Field/Upload/Upload.js.map +1 -1
- package/es/extensions/forms/Field/Upload/UploadDocs.js.map +1 -1
- package/es/extensions/forms/FieldBlock/FieldBlock.js +1 -1
- package/es/extensions/forms/FieldBlock/FieldBlock.js.map +1 -1
- package/es/extensions/forms/FieldBlock/FieldBlockDocs.js +1 -1
- package/es/extensions/forms/FieldBlock/FieldBlockDocs.js.map +1 -1
- package/es/extensions/forms/Form/Isolation/IsolatedContainer.js +4 -6
- package/es/extensions/forms/Form/Isolation/IsolatedContainer.js.map +1 -1
- package/es/extensions/forms/Form/Isolation/Isolation.js +2 -3
- package/es/extensions/forms/Form/Isolation/Isolation.js.map +1 -1
- package/es/extensions/forms/Form/Isolation/IsolationDataReference.d.ts +4 -2
- package/es/extensions/forms/Form/Isolation/IsolationDataReference.js +18 -4
- package/es/extensions/forms/Form/Isolation/IsolationDataReference.js.map +1 -1
- package/es/extensions/forms/Form/Isolation/IsolationResetButton.js +2 -1
- package/es/extensions/forms/Form/Isolation/IsolationResetButton.js.map +1 -1
- package/es/extensions/forms/Form/Isolation/useDataContextSnapshot.js +24 -11
- package/es/extensions/forms/Form/Isolation/useDataContextSnapshot.js.map +1 -1
- package/es/extensions/forms/Form/Isolation/useHandleStatus.d.ts +2 -1
- package/es/extensions/forms/Form/Isolation/useHandleStatus.js +10 -3
- package/es/extensions/forms/Form/Isolation/useHandleStatus.js.map +1 -1
- package/es/extensions/forms/Form/Isolation/useHasContentChanged.d.ts +3 -1
- package/es/extensions/forms/Form/Isolation/useHasContentChanged.js +6 -3
- package/es/extensions/forms/Form/Isolation/useHasContentChanged.js.map +1 -1
- package/es/extensions/forms/Form/Isolation/useReportError.d.ts +1 -1
- package/es/extensions/forms/Form/Isolation/useReportError.js +22 -7
- package/es/extensions/forms/Form/Isolation/useReportError.js.map +1 -1
- package/es/extensions/forms/Form/SubmitConfirmation/SubmitConfirmation.js +6 -6
- package/es/extensions/forms/Form/SubmitConfirmation/SubmitConfirmation.js.map +1 -1
- package/es/extensions/forms/Iterate/EditContainer/ResetButton.js +3 -1
- package/es/extensions/forms/Iterate/EditContainer/ResetButton.js.map +1 -1
- package/es/extensions/forms/Iterate/ItemNo/{useIItemNo.js → useIterateItemNo.js} +2 -2
- package/es/extensions/forms/Iterate/ItemNo/useIterateItemNo.js.map +1 -0
- package/es/extensions/forms/Iterate/PushContainer/PushContainer.d.ts +3 -1
- package/es/extensions/forms/Iterate/PushContainer/PushContainer.js +7 -3
- package/es/extensions/forms/Iterate/PushContainer/PushContainer.js.map +1 -1
- package/es/extensions/forms/Iterate/PushContainer/PushContainerDocs.js +5 -0
- package/es/extensions/forms/Iterate/PushContainer/PushContainerDocs.js.map +1 -1
- package/es/extensions/forms/Tools/Errors.d.ts +5 -0
- package/es/extensions/forms/Tools/Errors.js +37 -0
- package/es/extensions/forms/Tools/Errors.js.map +1 -0
- package/es/extensions/forms/Tools/index.d.ts +1 -0
- package/es/extensions/forms/Tools/index.js +1 -0
- package/es/extensions/forms/Tools/index.js.map +1 -1
- package/es/extensions/forms/Wizard/Container/PrerenderFieldPropsOfOtherSteps.js +2 -4
- package/es/extensions/forms/Wizard/Container/PrerenderFieldPropsOfOtherSteps.js.map +1 -1
- package/es/extensions/forms/Wizard/Container/WizardContainer.js +11 -5
- package/es/extensions/forms/Wizard/Container/WizardContainer.js.map +1 -1
- package/es/extensions/forms/Wizard/Context/WizardContext.d.ts +2 -1
- package/es/extensions/forms/Wizard/Context/WizardContext.js.map +1 -1
- package/es/extensions/forms/Wizard/Step/Step.js +1 -1
- package/es/extensions/forms/Wizard/Step/Step.js.map +1 -1
- package/es/extensions/forms/Wizard/hooks/useStep.js +13 -5
- package/es/extensions/forms/Wizard/hooks/useStep.js.map +1 -1
- package/es/extensions/forms/blocks/ChildrenWithAge/ChildrenWithAge.js +4 -3
- package/es/extensions/forms/blocks/ChildrenWithAge/ChildrenWithAge.js.map +1 -1
- package/es/extensions/forms/hooks/useFieldProps.js +19 -12
- package/es/extensions/forms/hooks/useFieldProps.js.map +1 -1
- package/es/extensions/payment-card/icons/brandLogos/DNB.js +2 -2
- package/es/extensions/payment-card/icons/brandLogos/DNB.js.map +1 -1
- package/es/extensions/payment-card/icons/providers/BankAxept.js +2 -2
- package/es/extensions/payment-card/icons/providers/BankAxept.js.map +1 -1
- package/es/extensions/payment-card/icons/providers/ClickToPay.js +2 -2
- package/es/extensions/payment-card/icons/providers/ClickToPay.js.map +1 -1
- package/es/extensions/payment-card/icons/providers/MastercardDefault.js +2 -2
- package/es/extensions/payment-card/icons/providers/MastercardDefault.js.map +1 -1
- package/es/extensions/payment-card/icons/providers/VisaDefault.js +2 -2
- package/es/extensions/payment-card/icons/providers/VisaDefault.js.map +1 -1
- package/es/extensions/payment-card/icons/providers/VisaPlatinum.js +2 -2
- package/es/extensions/payment-card/icons/providers/VisaPlatinum.js.map +1 -1
- package/es/fragments/drawer-list/DrawerListHelpers.js +2 -1
- package/es/fragments/drawer-list/DrawerListHelpers.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/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-components.min.mjs +1 -1
- package/esm/dnb-ui-elements.min.mjs +1 -1
- package/esm/dnb-ui-extensions.min.mjs +3 -3
- package/esm/dnb-ui-lib.min.mjs +1 -1
- package/extensions/forms/DataContext/Context.d.ts +5 -2
- package/extensions/forms/DataContext/Context.js.map +1 -1
- package/extensions/forms/DataContext/Provider/Provider.js +42 -16
- package/extensions/forms/DataContext/Provider/Provider.js.map +1 -1
- package/extensions/forms/DataContext/Provider/useEventListener.d.ts +3 -0
- package/extensions/forms/DataContext/Provider/useEventListener.js +23 -0
- package/extensions/forms/DataContext/Provider/useEventListener.js.map +1 -0
- package/extensions/forms/Field/BankAccountNumber/BankAccountNumberDocs.js +6 -2
- package/extensions/forms/Field/BankAccountNumber/BankAccountNumberDocs.js.map +1 -1
- package/extensions/forms/Field/NationalIdentityNumber/NationalIdentityNumberDocs.js +6 -2
- package/extensions/forms/Field/NationalIdentityNumber/NationalIdentityNumberDocs.js.map +1 -1
- package/extensions/forms/Field/Number/NumberDocs.js +1 -1
- package/extensions/forms/Field/Number/NumberDocs.js.map +1 -1
- package/extensions/forms/Field/OrganizationNumber/OrganizationNumberDocs.js +6 -2
- package/extensions/forms/Field/OrganizationNumber/OrganizationNumberDocs.js.map +1 -1
- package/extensions/forms/Field/Password/PasswordDocs.js +6 -2
- package/extensions/forms/Field/Password/PasswordDocs.js.map +1 -1
- package/extensions/forms/Field/PhoneNumber/PhoneNumber.d.ts +1 -1
- package/extensions/forms/Field/PhoneNumber/PhoneNumber.js.map +1 -1
- package/extensions/forms/Field/PhoneNumber/PhoneNumberDocs.js +7 -0
- package/extensions/forms/Field/PhoneNumber/PhoneNumberDocs.js.map +1 -1
- package/extensions/forms/Field/Provider/useFieldProvider.d.ts +3 -3
- package/extensions/forms/Field/Selection/SelectionDocs.js +1 -1
- package/extensions/forms/Field/Selection/SelectionDocs.js.map +1 -1
- package/extensions/forms/Field/String/StringDocs.js +7 -7
- package/extensions/forms/Field/String/StringDocs.js.map +1 -1
- package/extensions/forms/Field/Toggle/Toggle.js +1 -1
- package/extensions/forms/Field/Toggle/Toggle.js.map +1 -1
- package/extensions/forms/Field/Upload/Upload.d.ts +1 -1
- package/extensions/forms/Field/Upload/Upload.js +3 -1
- package/extensions/forms/Field/Upload/Upload.js.map +1 -1
- package/extensions/forms/Field/Upload/UploadDocs.js.map +1 -1
- package/extensions/forms/FieldBlock/FieldBlock.js +1 -1
- package/extensions/forms/FieldBlock/FieldBlock.js.map +1 -1
- package/extensions/forms/FieldBlock/FieldBlockDocs.js +1 -1
- package/extensions/forms/FieldBlock/FieldBlockDocs.js.map +1 -1
- package/extensions/forms/Form/Isolation/IsolatedContainer.js +4 -6
- package/extensions/forms/Form/Isolation/IsolatedContainer.js.map +1 -1
- package/extensions/forms/Form/Isolation/Isolation.js +2 -3
- package/extensions/forms/Form/Isolation/Isolation.js.map +1 -1
- package/extensions/forms/Form/Isolation/IsolationDataReference.d.ts +4 -2
- package/extensions/forms/Form/Isolation/IsolationDataReference.js +20 -4
- package/extensions/forms/Form/Isolation/IsolationDataReference.js.map +1 -1
- package/extensions/forms/Form/Isolation/IsolationResetButton.js +2 -1
- package/extensions/forms/Form/Isolation/IsolationResetButton.js.map +1 -1
- package/extensions/forms/Form/Isolation/useDataContextSnapshot.js +25 -11
- package/extensions/forms/Form/Isolation/useDataContextSnapshot.js.map +1 -1
- package/extensions/forms/Form/Isolation/useHandleStatus.d.ts +2 -1
- package/extensions/forms/Form/Isolation/useHandleStatus.js +10 -3
- package/extensions/forms/Form/Isolation/useHandleStatus.js.map +1 -1
- package/extensions/forms/Form/Isolation/useHasContentChanged.d.ts +3 -1
- package/extensions/forms/Form/Isolation/useHasContentChanged.js +6 -2
- package/extensions/forms/Form/Isolation/useHasContentChanged.js.map +1 -1
- package/extensions/forms/Form/Isolation/useReportError.d.ts +1 -1
- package/extensions/forms/Form/Isolation/useReportError.js +22 -7
- package/extensions/forms/Form/Isolation/useReportError.js.map +1 -1
- package/extensions/forms/Form/SubmitConfirmation/SubmitConfirmation.js +6 -6
- package/extensions/forms/Form/SubmitConfirmation/SubmitConfirmation.js.map +1 -1
- package/extensions/forms/Iterate/EditContainer/ResetButton.js +3 -1
- package/extensions/forms/Iterate/EditContainer/ResetButton.js.map +1 -1
- package/extensions/forms/Iterate/ItemNo/{useIItemNo.js → useIterateItemNo.js} +2 -2
- package/extensions/forms/Iterate/ItemNo/useIterateItemNo.js.map +1 -0
- package/extensions/forms/Iterate/PushContainer/PushContainer.d.ts +3 -1
- package/extensions/forms/Iterate/PushContainer/PushContainer.js +7 -3
- package/extensions/forms/Iterate/PushContainer/PushContainer.js.map +1 -1
- package/extensions/forms/Iterate/PushContainer/PushContainerDocs.js +5 -0
- package/extensions/forms/Iterate/PushContainer/PushContainerDocs.js.map +1 -1
- package/extensions/forms/Tools/Errors.d.ts +5 -0
- package/extensions/forms/Tools/Errors.js +38 -0
- package/extensions/forms/Tools/Errors.js.map +1 -0
- package/extensions/forms/Tools/index.d.ts +1 -0
- package/extensions/forms/Tools/index.js +1 -0
- package/extensions/forms/Tools/index.js.map +1 -1
- package/extensions/forms/Wizard/Container/PrerenderFieldPropsOfOtherSteps.js +2 -4
- package/extensions/forms/Wizard/Container/PrerenderFieldPropsOfOtherSteps.js.map +1 -1
- package/extensions/forms/Wizard/Container/WizardContainer.js +11 -5
- package/extensions/forms/Wizard/Container/WizardContainer.js.map +1 -1
- package/extensions/forms/Wizard/Context/WizardContext.d.ts +2 -1
- package/extensions/forms/Wizard/Context/WizardContext.js.map +1 -1
- package/extensions/forms/Wizard/Step/Step.js +1 -1
- package/extensions/forms/Wizard/Step/Step.js.map +1 -1
- package/extensions/forms/Wizard/hooks/useStep.js +13 -5
- package/extensions/forms/Wizard/hooks/useStep.js.map +1 -1
- package/extensions/forms/blocks/ChildrenWithAge/ChildrenWithAge.js +4 -3
- package/extensions/forms/blocks/ChildrenWithAge/ChildrenWithAge.js.map +1 -1
- package/extensions/forms/hooks/useFieldProps.js +19 -12
- package/extensions/forms/hooks/useFieldProps.js.map +1 -1
- package/extensions/payment-card/icons/brandLogos/DNB.js +2 -2
- package/extensions/payment-card/icons/brandLogos/DNB.js.map +1 -1
- package/extensions/payment-card/icons/providers/BankAxept.js +2 -2
- package/extensions/payment-card/icons/providers/BankAxept.js.map +1 -1
- package/extensions/payment-card/icons/providers/ClickToPay.js +2 -2
- package/extensions/payment-card/icons/providers/ClickToPay.js.map +1 -1
- package/extensions/payment-card/icons/providers/MastercardDefault.js +2 -2
- package/extensions/payment-card/icons/providers/MastercardDefault.js.map +1 -1
- package/extensions/payment-card/icons/providers/VisaDefault.js +2 -2
- package/extensions/payment-card/icons/providers/VisaDefault.js.map +1 -1
- package/extensions/payment-card/icons/providers/VisaPlatinum.js +2 -2
- package/extensions/payment-card/icons/providers/VisaPlatinum.js.map +1 -1
- package/fragments/drawer-list/DrawerListHelpers.js +2 -1
- package/fragments/drawer-list/DrawerListHelpers.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/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-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
- package/cjs/extensions/forms/Iterate/ItemNo/useIItemNo.js.map +0 -1
- package/es/extensions/forms/Iterate/ItemNo/useIItemNo.js.map +0 -1
- package/extensions/forms/Iterate/ItemNo/useIItemNo.js.map +0 -1
- /package/cjs/extensions/forms/Iterate/ItemNo/{useIItemNo.d.ts → useIterateItemNo.d.ts} +0 -0
- /package/es/extensions/forms/Iterate/ItemNo/{useIItemNo.d.ts → useIterateItemNo.d.ts} +0 -0
- /package/extensions/forms/Iterate/ItemNo/{useIItemNo.d.ts → useIterateItemNo.d.ts} +0 -0
|
@@ -3,7 +3,7 @@
|
|
|
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
|
-
const _excluded = ["data", "defaultData", "isolatedData", "bubbleValidation", "preventUncommittedChanges", "requireCommit", "showResetButton", "path", "itemPath", "insertAt", "title", "required", "children", "openButton", "showOpenButtonWhen", "onCommit"],
|
|
6
|
+
const _excluded = ["data", "defaultData", "isolatedData", "bubbleValidation", "preventUncommittedChanges", "requireCommit", "dataReference", "showResetButton", "path", "itemPath", "insertAt", "title", "required", "children", "openButton", "showOpenButtonWhen", "onCommit"],
|
|
7
7
|
_excluded2 = ["title", "openButton", "showOpenButton", "showResetButton", "switchContainerModeRef", "cancelHandler", "containerModeRef", "rerenderPushContainer", "preventUncommittedChanges", "outerContext", "children"];
|
|
8
8
|
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; }
|
|
9
9
|
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; }
|
|
@@ -40,6 +40,7 @@ function PushContainer(props) {
|
|
|
40
40
|
bubbleValidation,
|
|
41
41
|
preventUncommittedChanges = props === null || props === void 0 ? void 0 : props.requireCommit,
|
|
42
42
|
requireCommit,
|
|
43
|
+
dataReference,
|
|
43
44
|
showResetButton,
|
|
44
45
|
path,
|
|
45
46
|
itemPath,
|
|
@@ -124,6 +125,7 @@ function PushContainer(props) {
|
|
|
124
125
|
data: data,
|
|
125
126
|
defaultData: defaultData,
|
|
126
127
|
required: required,
|
|
128
|
+
dataReference: dataReference,
|
|
127
129
|
emptyData: emptyData,
|
|
128
130
|
bubbleValidation: containerModeRef.current === 'view' ? false : bubbleValidation,
|
|
129
131
|
commitHandleRef: commitHandleRef,
|
|
@@ -196,13 +198,15 @@ function NewContainer(_ref3) {
|
|
|
196
198
|
} = useHandleStatus({
|
|
197
199
|
outerContext,
|
|
198
200
|
preventUncommittedChanges,
|
|
199
|
-
error: pushContainerError
|
|
201
|
+
error: pushContainerError,
|
|
202
|
+
name: 'push-container'
|
|
200
203
|
});
|
|
201
204
|
useEffect(() => {
|
|
202
205
|
rerenderPushContainer();
|
|
203
206
|
}, [containerMode, rerenderPushContainer]);
|
|
207
|
+
const visibilityContext = useContext(VisibilityContext);
|
|
204
208
|
switchContainerModeRef.current = switchContainerMode;
|
|
205
|
-
const isVisible = Boolean(!showOpenButton || containerMode === 'edit');
|
|
209
|
+
const isVisible = (visibilityContext === null || visibilityContext === void 0 ? void 0 : visibilityContext.isVisible) === false ? false : Boolean(!showOpenButton || containerMode === 'edit' || showCommitStatus);
|
|
206
210
|
const {
|
|
207
211
|
preventUncommittedChangesText
|
|
208
212
|
} = useTranslation().Isolation;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PushContainer.js","names":["React","useCallback","useContext","useEffect","useMemo","useReducer","useRef","classnames","Isolation","useHandleStatus","PushContainerContext","IterateItemContext","DataContext","VisibilityContext","useDataValue","EditContainer","DoneButton","CancelButton","ResetButton","IterateArray","OpenButton","Flex","FormStatus","HeightAnimation","useArrayLimit","useItemPath","useSwitchContainerMode","Toolbar","usePath","useTranslation","clearedData","structuredClone","PushContainer","props","forceUpdate","outerContext","data","outerData","required","requiredInherited","dataProp","defaultData","defaultDataProp","isolatedData","bubbleValidation","preventUncommittedChanges","requireCommit","showResetButton","path","itemPath","insertAt","title","children","openButton","showOpenButtonWhen","onCommit","rest","_objectWithoutProperties","_excluded","absolutePath","relativePath","commitHandleRef","switchContainerModeRef","containerModeRef","value","entries","moveValueToPath","getValueByPath","setNextContainerMode","hasReachedLimit","setShowStatus","cancelHandler","showOpenButton","newItemContextProps","switchContainerMode","current","_Object$freeze","_objectSpread","pushContainerItems","Object","freeze","isFrozen","assign","emptyData","_data$pushContainerIt","_ref","firstItem","createElement","transformOnCommit","_ref2","slice","options","clearData","preventCommit","_switchContainerModeR","call","Provider","containerMode","withoutFlex","omitSectionPath","NewContainer","_extends","rerenderPushContainer","_ref3","_DoneButton","_CancelButton","_FormStatus","_excluded2","hasContentChanged","showStatus","showCommitStatus","error","pushContainerError","isVisible","Boolean","preventUncommittedChangesText","createButton","IteratePushContainer","restoreOriginalValue","toolbar","Consumer","context","Horizontal","gap","text","onClick","hidden","no_animation","show","keepInDOM","open","className","Error","_supportsSpacingProps"],"sources":["../../../../../../src/extensions/forms/Iterate/PushContainer/PushContainer.tsx"],"sourcesContent":["import React, {\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useReducer,\n useRef,\n} from 'react'\nimport classnames from 'classnames'\nimport Isolation from '../../Form/Isolation'\nimport useHandleStatus from '../../Form/Isolation/useHandleStatus'\nimport PushContainerContext from './PushContainerContext'\nimport IterateItemContext from '../IterateItemContext'\nimport DataContext from '../../DataContext/Context'\nimport VisibilityContext from '../../Form/Visibility/VisibilityContext'\nimport useDataValue from '../../hooks/useDataValue'\nimport EditContainer, {\n DoneButton,\n CancelButton,\n ResetButton,\n AllProps as EditContainerProps,\n} from '../EditContainer'\nimport IterateArray, { ContainerMode } from '../Array'\nimport OpenButton from './OpenButton'\nimport { Flex, FormStatus, HeightAnimation } from '../../../../components'\nimport { OnCommit, Path } from '../../types'\nimport { SpacingProps } from '../../../../shared/types'\nimport {\n useArrayLimit,\n useItemPath,\n useSwitchContainerMode,\n} from '../hooks'\nimport Toolbar from '../Toolbar'\nimport { usePath, useTranslation } from '../../hooks'\nimport { clearedData } from '../../DataContext/Provider'\n\n/**\n * Deprecated, as it is supported by all major browsers and Node.js >=v18\n * So it's a question of time, when we will remove this polyfill\n */\nimport structuredClone from '@ungap/structured-clone'\n\ntype OnlyPathRequired = {\n /**\n * The path to the array to add the new item to.\n */\n path: Path\n\n /** The sub path to the array to add the new item to. */\n itemPath?: Path\n}\n\ntype OnlyItemPathRequired = {\n /**\n * The path to the array to add the new item to.\n */\n path?: Path\n\n /** The sub path to the array to add the new item to. */\n itemPath: Path\n}\n\nexport type Props = (OnlyPathRequired | OnlyItemPathRequired) & {\n /**\n * The title of the container.\n */\n title?: React.ReactNode\n\n /**\n * If the fields inside the container are required.\n */\n required?: boolean\n\n /**\n * The index to insert the new item at.\n */\n insertAt?: number\n\n /**\n * The button to open container.\n */\n openButton?: React.ReactNode\n\n /**\n * Define when the \"open button\" should be shown.\n * Should be a function that returns a boolean.\n */\n showOpenButtonWhen?: (list: unknown[]) => boolean\n\n /**\n * Prefilled data to add to the fields. The data will be put into this path: \"/pushContainerItems/0\".\n */\n data?: unknown | Record<string, unknown>\n\n /**\n * Prefilled data to add to the fields. The data will be put into this path: \"/pushContainerItems/0\".\n */\n defaultData?: unknown | Record<string, unknown>\n\n /**\n * Provide additional data that will be put into the root of the isolated data context (parallel to \"/pushContainerItems/0\").\n */\n isolatedData?: Record<string, unknown>\n\n /**\n * Prevent the form from being submitted when there are fields with errors inside the PushContainer.\n */\n bubbleValidation?: boolean\n\n /**\n * If the container should be committed before the form is submitted.\n */\n /**\n * @deprecated – Replaced with preventUncommittedChanges, requireCommit will be removed in v11.\n */\n requireCommit?: boolean\n\n /**\n * Prevents uncommitted changes before the form is submitted. Will display an error message if user tries to submit without committing their changes.\n */\n preventUncommittedChanges?: boolean\n\n /**\n * Show a button to clear the PushContainer data.\n */\n showResetButton?: boolean\n\n /**\n * A custom toolbar to be shown below the container.\n */\n toolbar?: React.ReactNode\n\n /**\n * Will be called when the user clicks on the \"Done\" button.\n */\n onCommit?: OnCommit\n\n /**\n * The container contents.\n */\n children: React.ReactNode\n}\n\nexport type AllProps = Props &\n SpacingProps &\n Omit<EditContainerProps, 'data'>\n\nfunction PushContainer(props: AllProps) {\n const [, forceUpdate] = useReducer(() => ({}), {})\n const outerContext = useContext(DataContext)\n const { data: outerData, required: requiredInherited } = outerContext\n\n const {\n data: dataProp,\n defaultData: defaultDataProp,\n isolatedData,\n bubbleValidation,\n preventUncommittedChanges = props?.requireCommit,\n requireCommit, // eslint-disable-line @typescript-eslint/no-unused-vars\n showResetButton,\n path,\n itemPath,\n insertAt,\n title,\n required = requiredInherited,\n children,\n openButton,\n showOpenButtonWhen,\n onCommit,\n ...rest\n } = props\n\n const { absolutePath } = useItemPath(itemPath)\n const { path: relativePath } = usePath({ path, itemPath })\n const commitHandleRef = useRef<() => void>()\n const switchContainerModeRef = useRef<(mode: ContainerMode) => void>()\n const containerModeRef = useRef<ContainerMode>()\n const {\n value: entries = [],\n moveValueToPath,\n getValueByPath,\n } = useDataValue<Array<unknown>>(path || itemPath)\n\n const { setNextContainerMode } = useSwitchContainerMode(\n path || absolutePath\n )\n const { hasReachedLimit, setShowStatus } = useArrayLimit(\n path || absolutePath\n )\n const cancelHandler = useCallback(() => {\n if (hasReachedLimit) {\n setShowStatus(false)\n }\n }, [hasReachedLimit, setShowStatus])\n\n const showOpenButton = showOpenButtonWhen?.(entries)\n const newItemContextProps: PushContainerContext = {\n path,\n itemPath,\n entries,\n commitHandleRef,\n switchContainerMode: switchContainerModeRef.current,\n }\n\n const data = useMemo(() => {\n if (defaultDataProp) {\n return // don't return a fallback, because we want to use the defaultData\n }\n return {\n ...isolatedData,\n pushContainerItems: [Object.freeze(dataProp) ?? clearedData],\n }\n }, [dataProp, defaultDataProp, isolatedData])\n\n if (outerData) {\n // Use assign to avoid mutating the original data object.\n // Because changes from outside should only silently be applied to the\n // data object, without triggering a rerender.\n // This way \"pushContainerItems\" will not clear/unset changed data.\n if (!Object.isFrozen(data)) {\n Object.assign(data || {}, outerData)\n }\n }\n\n const defaultData = useMemo(() => {\n return {\n ...(!dataProp ? isolatedData : null),\n pushContainerItems: [Object.freeze(defaultDataProp ?? clearedData)],\n }\n }, [dataProp, defaultDataProp, isolatedData])\n\n const emptyData = useCallback(\n (data: { pushContainerItems: unknown[] }) => {\n const firstItem = data.pushContainerItems?.[0]\n if (firstItem === null || typeof firstItem !== 'object') {\n return {\n ...isolatedData,\n pushContainerItems: [null],\n }\n }\n\n return {\n ...isolatedData,\n pushContainerItems: [dataProp ?? defaultDataProp ?? clearedData],\n }\n },\n [dataProp, defaultDataProp, isolatedData]\n )\n\n return (\n <Isolation\n data={data}\n defaultData={defaultData}\n required={required}\n emptyData={emptyData}\n bubbleValidation={\n containerModeRef.current === 'view' ? false : bubbleValidation\n }\n commitHandleRef={commitHandleRef}\n transformOnCommit={({ pushContainerItems }) => {\n return moveValueToPath(\n absolutePath || relativePath,\n typeof insertAt === 'number'\n ? [\n ...entries.slice(0, insertAt),\n ...pushContainerItems,\n ...entries.slice(insertAt),\n ]\n : [...entries, ...pushContainerItems],\n absolutePath ? structuredClone(getValueByPath('/')) : {}\n )\n }}\n onCommit={(data, options) => {\n const { clearData, preventCommit } = options\n if (hasReachedLimit) {\n preventCommit()\n setShowStatus(true)\n } else {\n setNextContainerMode('view')\n switchContainerModeRef.current?.('view')\n clearData()\n }\n onCommit?.(data, options)\n }}\n >\n <PushContainerContext.Provider value={newItemContextProps}>\n <IterateArray\n path=\"/pushContainerItems\"\n containerMode={showOpenButton ? 'view' : 'edit'}\n withoutFlex\n omitSectionPath\n >\n <NewContainer\n title={title}\n openButton={openButton}\n switchContainerModeRef={switchContainerModeRef}\n showOpenButton={showOpenButton}\n cancelHandler={cancelHandler}\n containerModeRef={containerModeRef}\n rerenderPushContainer={forceUpdate}\n preventUncommittedChanges={preventUncommittedChanges}\n showResetButton={showResetButton}\n outerContext={outerContext}\n {...rest}\n >\n {children}\n </NewContainer>\n </IterateArray>\n </PushContainerContext.Provider>\n </Isolation>\n )\n}\n\nfunction NewContainer({\n title,\n openButton,\n showOpenButton,\n showResetButton,\n switchContainerModeRef,\n cancelHandler,\n containerModeRef,\n rerenderPushContainer,\n preventUncommittedChanges,\n outerContext,\n children,\n ...rest\n}) {\n const { containerMode, switchContainerMode } =\n useContext(IterateItemContext) || {}\n containerModeRef.current = containerMode\n\n const { hasContentChanged, showStatus: showCommitStatus } =\n useHandleStatus({\n outerContext,\n preventUncommittedChanges,\n error: pushContainerError,\n })\n\n useEffect(() => {\n rerenderPushContainer()\n }, [containerMode, rerenderPushContainer])\n\n switchContainerModeRef.current = switchContainerMode\n const isVisible = Boolean(!showOpenButton || containerMode === 'edit')\n const { preventUncommittedChangesText } = useTranslation().Isolation\n const { createButton } = useTranslation().IteratePushContainer\n const { clearData } = useContext(DataContext) || {}\n const restoreOriginalValue = useCallback(() => {\n clearData?.()\n }, [clearData])\n\n const toolbar = (\n <Toolbar>\n <IterateItemContext.Consumer>\n {(context) => {\n const newItemContextProps = {\n ...context,\n restoreOriginalValue,\n }\n return (\n <IterateItemContext.Provider value={newItemContextProps}>\n <Flex.Horizontal gap=\"large\">\n <DoneButton text={createButton} />\n {showOpenButton && (\n <CancelButton onClick={cancelHandler} />\n )}\n {(preventUncommittedChanges || showResetButton) && (\n <ResetButton\n // Use hidden in order to render the useHasContentChanged hook\n hidden={!(showResetButton || showCommitStatus)}\n />\n )}\n </Flex.Horizontal>\n\n {preventUncommittedChanges && showCommitStatus && (\n <FormStatus no_animation={false} show={hasContentChanged}>\n {preventUncommittedChangesText}\n </FormStatus>\n )}\n </IterateItemContext.Provider>\n )\n }}\n </IterateItemContext.Consumer>\n </Toolbar>\n )\n\n return (\n <VisibilityContext.Provider value={{ isVisible, keepInDOM: false }}>\n <EditContainer\n open={isVisible}\n title={title}\n toolbar={toolbar}\n {...rest}\n // Add the class by default, because we don't get a \"hasSubmitError\" trigger\n className={classnames(\n 'dnb-forms-section-block--error',\n rest.className\n )}\n >\n {children}\n </EditContainer>\n\n {openButton && typeof showOpenButton === 'boolean' && (\n <HeightAnimation open={showOpenButton && containerMode === 'view'}>\n {openButton}\n </HeightAnimation>\n )}\n </VisibilityContext.Provider>\n )\n}\n\nconst pushContainerError = new Error('Iterate.PushContainer')\n\nPushContainer.OpenButton = OpenButton\nPushContainer._supportsSpacingProps = true\n\nexport default PushContainer\n"],"mappings":";;;;;;;;;;AAAA,OAAOA,KAAK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A,MAAM2D,kBAAkB,GAAG,IAAIoB,KAAK,CAAC,uBAAuB,CAAC;AAE7DpG,aAAa,CAACZ,UAAU,GAAGA,UAAU;AACrCY,aAAa,CAACqG,qBAAqB,GAAG,IAAI;AAE1C,eAAerG,aAAa","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"PushContainer.js","names":["React","useCallback","useContext","useEffect","useMemo","useReducer","useRef","classnames","Isolation","useHandleStatus","PushContainerContext","IterateItemContext","DataContext","VisibilityContext","useDataValue","EditContainer","DoneButton","CancelButton","ResetButton","IterateArray","OpenButton","Flex","FormStatus","HeightAnimation","useArrayLimit","useItemPath","useSwitchContainerMode","Toolbar","usePath","useTranslation","clearedData","structuredClone","PushContainer","props","forceUpdate","outerContext","data","outerData","required","requiredInherited","dataProp","defaultData","defaultDataProp","isolatedData","bubbleValidation","preventUncommittedChanges","requireCommit","dataReference","showResetButton","path","itemPath","insertAt","title","children","openButton","showOpenButtonWhen","onCommit","rest","_objectWithoutProperties","_excluded","absolutePath","relativePath","commitHandleRef","switchContainerModeRef","containerModeRef","value","entries","moveValueToPath","getValueByPath","setNextContainerMode","hasReachedLimit","setShowStatus","cancelHandler","showOpenButton","newItemContextProps","switchContainerMode","current","_Object$freeze","_objectSpread","pushContainerItems","Object","freeze","isFrozen","assign","emptyData","_data$pushContainerIt","_ref","firstItem","createElement","transformOnCommit","_ref2","slice","options","clearData","preventCommit","_switchContainerModeR","call","Provider","containerMode","withoutFlex","omitSectionPath","NewContainer","_extends","rerenderPushContainer","_ref3","_DoneButton","_CancelButton","_FormStatus","_excluded2","hasContentChanged","showStatus","showCommitStatus","error","pushContainerError","name","visibilityContext","isVisible","Boolean","preventUncommittedChangesText","createButton","IteratePushContainer","restoreOriginalValue","toolbar","Consumer","context","Horizontal","gap","text","onClick","hidden","no_animation","show","keepInDOM","open","className","Error","_supportsSpacingProps"],"sources":["../../../../../../src/extensions/forms/Iterate/PushContainer/PushContainer.tsx"],"sourcesContent":["import React, {\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useReducer,\n useRef,\n} from 'react'\nimport classnames from 'classnames'\nimport Isolation, { IsolationProps } from '../../Form/Isolation'\nimport useHandleStatus from '../../Form/Isolation/useHandleStatus'\nimport PushContainerContext from './PushContainerContext'\nimport IterateItemContext from '../IterateItemContext'\nimport DataContext from '../../DataContext/Context'\nimport VisibilityContext from '../../Form/Visibility/VisibilityContext'\nimport useDataValue from '../../hooks/useDataValue'\nimport EditContainer, {\n DoneButton,\n CancelButton,\n ResetButton,\n AllProps as EditContainerProps,\n} from '../EditContainer'\nimport IterateArray, { ContainerMode } from '../Array'\nimport OpenButton from './OpenButton'\nimport { Flex, FormStatus, HeightAnimation } from '../../../../components'\nimport { OnCommit, Path } from '../../types'\nimport { SpacingProps } from '../../../../shared/types'\nimport {\n useArrayLimit,\n useItemPath,\n useSwitchContainerMode,\n} from '../hooks'\nimport Toolbar from '../Toolbar'\nimport { usePath, useTranslation } from '../../hooks'\nimport { JsonObject } from '../../utils'\nimport { clearedData } from '../../DataContext/Provider'\n\n/**\n * Deprecated, as it is supported by all major browsers and Node.js >=v18\n * So it's a question of time, when we will remove this polyfill\n */\nimport structuredClone from '@ungap/structured-clone'\n\ntype OnlyPathRequired = {\n /**\n * The path to the array to add the new item to.\n */\n path: Path\n\n /** The sub path to the array to add the new item to. */\n itemPath?: Path\n}\n\ntype OnlyItemPathRequired = {\n /**\n * The path to the array to add the new item to.\n */\n path?: Path\n\n /** The sub path to the array to add the new item to. */\n itemPath: Path\n}\n\nexport type Props = (OnlyPathRequired | OnlyItemPathRequired) & {\n /**\n * The title of the container.\n */\n title?: React.ReactNode\n\n /**\n * If the fields inside the container are required.\n */\n required?: boolean\n\n /**\n * The index to insert the new item at.\n */\n insertAt?: number\n\n /**\n * The button to open container.\n */\n openButton?: React.ReactNode\n\n /**\n * Define when the \"open button\" should be shown.\n * Should be a function that returns a boolean.\n */\n showOpenButtonWhen?: (list: unknown[]) => boolean\n\n /**\n * Prefilled data to add to the fields. The data will be put into this path: \"/pushContainerItems/0\".\n */\n data?: unknown | Record<string, unknown>\n\n /**\n * Prefilled data to add to the fields. The data will be put into this path: \"/pushContainerItems/0\".\n */\n defaultData?: unknown | Record<string, unknown>\n\n /**\n * Provide additional data that will be put into the root of the isolated data context (parallel to \"/pushContainerItems/0\").\n */\n isolatedData?: Record<string, unknown>\n\n /**\n * Prevent the form from being submitted when there are fields with errors inside the PushContainer.\n */\n bubbleValidation?: boolean\n\n /**\n * If the container should be committed before the form is submitted.\n */\n /**\n * @deprecated – Replaced with preventUncommittedChanges, requireCommit will be removed in v11.\n */\n requireCommit?: boolean\n\n /**\n * Prevents uncommitted changes before the form is submitted. Will display an error message if user tries to submit without committing their changes.\n */\n preventUncommittedChanges?: boolean\n\n /**\n * Show a button to clear the PushContainer data.\n */\n showResetButton?: boolean\n\n /**\n * A custom toolbar to be shown below the container.\n */\n toolbar?: React.ReactNode\n\n /**\n * Will be called when the user clicks on the \"Done\" button.\n */\n onCommit?: OnCommit\n\n /**\n * The container contents.\n */\n children: React.ReactNode\n} & Pick<IsolationProps<JsonObject>, 'dataReference'>\n\nexport type AllProps = Props &\n SpacingProps &\n Omit<EditContainerProps, 'data'>\n\nfunction PushContainer(props: AllProps) {\n const [, forceUpdate] = useReducer(() => ({}), {})\n const outerContext = useContext(DataContext)\n const { data: outerData, required: requiredInherited } = outerContext\n\n const {\n data: dataProp,\n defaultData: defaultDataProp,\n isolatedData,\n bubbleValidation,\n preventUncommittedChanges = props?.requireCommit,\n requireCommit, // eslint-disable-line @typescript-eslint/no-unused-vars\n dataReference,\n showResetButton,\n path,\n itemPath,\n insertAt,\n title,\n required = requiredInherited,\n children,\n openButton,\n showOpenButtonWhen,\n onCommit,\n ...rest\n } = props\n\n const { absolutePath } = useItemPath(itemPath)\n const { path: relativePath } = usePath({ path, itemPath })\n const commitHandleRef = useRef<() => void>()\n const switchContainerModeRef = useRef<(mode: ContainerMode) => void>()\n const containerModeRef = useRef<ContainerMode>()\n const {\n value: entries = [],\n moveValueToPath,\n getValueByPath,\n } = useDataValue<Array<unknown>>(path || itemPath)\n\n const { setNextContainerMode } = useSwitchContainerMode(\n path || absolutePath\n )\n const { hasReachedLimit, setShowStatus } = useArrayLimit(\n path || absolutePath\n )\n const cancelHandler = useCallback(() => {\n if (hasReachedLimit) {\n setShowStatus(false)\n }\n }, [hasReachedLimit, setShowStatus])\n\n const showOpenButton = showOpenButtonWhen?.(entries)\n const newItemContextProps: PushContainerContext = {\n path,\n itemPath,\n entries,\n commitHandleRef,\n switchContainerMode: switchContainerModeRef.current,\n }\n\n const data = useMemo(() => {\n if (defaultDataProp) {\n return // don't return a fallback, because we want to use the defaultData\n }\n return {\n ...isolatedData,\n pushContainerItems: [Object.freeze(dataProp) ?? clearedData],\n }\n }, [dataProp, defaultDataProp, isolatedData])\n\n if (outerData) {\n // Use assign to avoid mutating the original data object.\n // Because changes from outside should only silently be applied to the\n // data object, without triggering a rerender.\n // This way \"pushContainerItems\" will not clear/unset changed data.\n if (!Object.isFrozen(data)) {\n Object.assign(data || {}, outerData)\n }\n }\n\n const defaultData = useMemo(() => {\n return {\n ...(!dataProp ? isolatedData : null),\n pushContainerItems: [Object.freeze(defaultDataProp ?? clearedData)],\n }\n }, [dataProp, defaultDataProp, isolatedData])\n\n const emptyData = useCallback(\n (data: { pushContainerItems: unknown[] }) => {\n const firstItem = data.pushContainerItems?.[0]\n if (firstItem === null || typeof firstItem !== 'object') {\n return {\n ...isolatedData,\n pushContainerItems: [null],\n }\n }\n\n return {\n ...isolatedData,\n pushContainerItems: [dataProp ?? defaultDataProp ?? clearedData],\n }\n },\n [dataProp, defaultDataProp, isolatedData]\n )\n\n return (\n <Isolation\n data={data}\n defaultData={defaultData}\n required={required}\n dataReference={dataReference}\n emptyData={emptyData}\n bubbleValidation={\n containerModeRef.current === 'view' ? false : bubbleValidation\n }\n commitHandleRef={commitHandleRef}\n transformOnCommit={({ pushContainerItems }) => {\n return moveValueToPath(\n absolutePath || relativePath,\n typeof insertAt === 'number'\n ? [\n ...entries.slice(0, insertAt),\n ...pushContainerItems,\n ...entries.slice(insertAt),\n ]\n : [...entries, ...pushContainerItems],\n absolutePath ? structuredClone(getValueByPath('/')) : {}\n )\n }}\n onCommit={(data, options) => {\n const { clearData, preventCommit } = options\n if (hasReachedLimit) {\n preventCommit()\n setShowStatus(true)\n } else {\n setNextContainerMode('view')\n switchContainerModeRef.current?.('view')\n clearData()\n }\n onCommit?.(data, options)\n }}\n >\n <PushContainerContext.Provider value={newItemContextProps}>\n <IterateArray\n path=\"/pushContainerItems\"\n containerMode={showOpenButton ? 'view' : 'edit'}\n withoutFlex\n omitSectionPath\n >\n <NewContainer\n title={title}\n openButton={openButton}\n switchContainerModeRef={switchContainerModeRef}\n showOpenButton={showOpenButton}\n cancelHandler={cancelHandler}\n containerModeRef={containerModeRef}\n rerenderPushContainer={forceUpdate}\n preventUncommittedChanges={preventUncommittedChanges}\n showResetButton={showResetButton}\n outerContext={outerContext}\n {...rest}\n >\n {children}\n </NewContainer>\n </IterateArray>\n </PushContainerContext.Provider>\n </Isolation>\n )\n}\n\nfunction NewContainer({\n title,\n openButton,\n showOpenButton,\n showResetButton,\n switchContainerModeRef,\n cancelHandler,\n containerModeRef,\n rerenderPushContainer,\n preventUncommittedChanges,\n outerContext,\n children,\n ...rest\n}) {\n const { containerMode, switchContainerMode } =\n useContext(IterateItemContext) || {}\n containerModeRef.current = containerMode\n\n const { hasContentChanged, showStatus: showCommitStatus } =\n useHandleStatus({\n outerContext,\n preventUncommittedChanges,\n error: pushContainerError,\n name: 'push-container',\n })\n\n useEffect(() => {\n rerenderPushContainer()\n }, [containerMode, rerenderPushContainer])\n\n const visibilityContext = useContext(VisibilityContext)\n switchContainerModeRef.current = switchContainerMode\n const isVisible =\n visibilityContext?.isVisible === false\n ? false\n : Boolean(\n !showOpenButton || containerMode === 'edit' || showCommitStatus\n )\n const { preventUncommittedChangesText } = useTranslation().Isolation\n const { createButton } = useTranslation().IteratePushContainer\n const { clearData } = useContext(DataContext) || {}\n const restoreOriginalValue = useCallback(() => {\n clearData?.()\n }, [clearData])\n\n const toolbar = (\n <Toolbar>\n <IterateItemContext.Consumer>\n {(context) => {\n const newItemContextProps = {\n ...context,\n restoreOriginalValue,\n }\n return (\n <IterateItemContext.Provider value={newItemContextProps}>\n <Flex.Horizontal gap=\"large\">\n <DoneButton text={createButton} />\n {showOpenButton && (\n <CancelButton onClick={cancelHandler} />\n )}\n {(preventUncommittedChanges || showResetButton) && (\n <ResetButton\n // Use hidden in order to render the useHasContentChanged hook\n hidden={!(showResetButton || showCommitStatus)}\n />\n )}\n </Flex.Horizontal>\n\n {preventUncommittedChanges && showCommitStatus && (\n <FormStatus no_animation={false} show={hasContentChanged}>\n {preventUncommittedChangesText}\n </FormStatus>\n )}\n </IterateItemContext.Provider>\n )\n }}\n </IterateItemContext.Consumer>\n </Toolbar>\n )\n\n return (\n <VisibilityContext.Provider value={{ isVisible, keepInDOM: false }}>\n <EditContainer\n open={isVisible}\n title={title}\n toolbar={toolbar}\n {...rest}\n // Add the class by default, because we don't get a \"hasSubmitError\" trigger\n className={classnames(\n 'dnb-forms-section-block--error',\n rest.className\n )}\n >\n {children}\n </EditContainer>\n\n {openButton && typeof showOpenButton === 'boolean' && (\n <HeightAnimation open={showOpenButton && containerMode === 'view'}>\n {openButton}\n </HeightAnimation>\n )}\n </VisibilityContext.Provider>\n )\n}\n\nconst pushContainerError = new Error('Iterate.PushContainer')\n\nPushContainer.OpenButton = OpenButton\nPushContainer._supportsSpacingProps = true\n\nexport default PushContainer\n"],"mappings":";;;;;;;;;;AAAA,OAAOA,KAAK,IACVC,WAAW,EACXC,UAAU,EACVC,SAAS,EACTC,OAAO,EACPC,UAAU,EACVC,MAAM,QACD,OAAO;AACd,OAAOC,UAAU,MAAM,YAAY;AACnC,OAAOC,SAAS,MAA0B,sBAAsB;AAChE,OAAOC,eAAe,MAAM,sCAAsC;AAClE,OAAOC,oBAAoB,MAAM,wBAAwB;AACzD,O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AAM2D,kBAAkB,GAAG,IAAIsB,KAAK,CAAC,uBAAuB,CAAC;AAE7DvG,aAAa,CAACZ,UAAU,GAAGA,UAAU;AACrCY,aAAa,CAACwG,qBAAqB,GAAG,IAAI;AAE1C,eAAexG,aAAa","ignoreList":[]}
|
|
@@ -75,6 +75,11 @@ export const PushContainerProperties = {
|
|
|
75
75
|
type: 'React.Node',
|
|
76
76
|
status: 'optional'
|
|
77
77
|
},
|
|
78
|
+
dataReference: {
|
|
79
|
+
doc: 'Provide a reference by using `Form.Isolation.createDataReference.`',
|
|
80
|
+
type: 'IsolationDataReference',
|
|
81
|
+
status: 'optional'
|
|
82
|
+
},
|
|
78
83
|
children: {
|
|
79
84
|
doc: 'The container contents.',
|
|
80
85
|
type: 'React.Node',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PushContainerDocs.js","names":["IsolationEvents","PushContainerProperties","path","doc","type","status","itemPath","insertAt","title","data","defaultData","isolatedData","required","bubbleValidation","preventUncommittedChanges","showResetButton","openButton","showOpenButtonWhen","variant","toolbar","children","PushContainerEvents","onCommit"],"sources":["../../../../../../src/extensions/forms/Iterate/PushContainer/PushContainerDocs.ts"],"sourcesContent":["import { PropertiesTableProps } from '../../../../shared/types'\nimport { IsolationEvents } from '../../Form/Isolation/IsolationDocs'\n\nexport const PushContainerProperties: PropertiesTableProps = {\n path: {\n doc: 'The path to the array to add the new item to.',\n type: 'string',\n status: 'required',\n },\n itemPath: {\n doc: 'The path to the item in a nested array, to add the new item to.',\n type: 'string',\n status: 'optional',\n },\n insertAt: {\n doc: 'The index to insert the new item at.',\n type: 'number',\n status: 'optional',\n },\n title: {\n doc: 'The title of the container.',\n type: 'React.Node',\n status: 'optional',\n },\n data: {\n doc: 'Prefilled data to be used by fields. The data will be put into this path: `/pushContainerItems/0`. Use `defaultData` when possible.',\n type: ['object', 'array'],\n status: 'optional',\n },\n defaultData: {\n doc: 'Prefilled data to be used by fields. The data will be put into this path: `/pushContainerItems/0`',\n type: ['object', 'array'],\n status: 'optional',\n },\n isolatedData: {\n doc: 'Provide additional data that will be put into the root of the isolated data context (parallel to `/pushContainerItems/0`).',\n type: 'object',\n status: 'optional',\n },\n required: {\n doc: 'If the fields inside the container are required.',\n type: 'boolean',\n status: 'optional',\n },\n bubbleValidation: {\n doc: 'Prevent the form from being submitted when there are fields with errors inside the PushContainer.',\n type: 'boolean',\n status: 'optional',\n },\n preventUncommittedChanges: {\n doc: 'Prevents uncommitted changes before the form is submitted. Will display an error message if user tries to submit without committing their changes.',\n type: 'boolean',\n status: 'optional',\n },\n showResetButton: {\n doc: 'Show a button to clear the PushContainer data.',\n type: 'boolean',\n status: 'optional',\n },\n openButton: {\n doc: 'The button to open container.',\n type: 'React.Node',\n status: 'optional',\n },\n showOpenButtonWhen: {\n doc: 'Define when the \"open button\" should be shown. Should be a function that returns a boolean.',\n type: 'function',\n status: 'optional',\n },\n variant: {\n doc: 'Defines the variant of the container. Can be `outline`, `filled` or `basic`. Defaults to `outline`.',\n type: 'string',\n status: 'optional',\n },\n toolbar: {\n doc: 'A custom toolbar to be shown below the container.',\n type: 'React.Node',\n status: 'optional',\n },\n children: {\n doc: 'The container contents.',\n type: 'React.Node',\n status: 'required',\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}\n\nexport const PushContainerEvents: PropertiesTableProps = {\n onCommit: IsolationEvents.onCommit,\n}\n"],"mappings":"AACA,SAASA,eAAe,QAAQ,oCAAoC;AAEpE,OAAO,MAAMC,uBAA6C,GAAG;EAC3DC,IAAI,EAAE;IACJC,GAAG,EAAE,+CAA+C;IACpDC,IAAI,EAAE,QAAQ;IACdC,MAAM,EAAE;EACV,CAAC;EACDC,QAAQ,EAAE;IACRH,GAAG,EAAE,iEAAiE;IACtEC,IAAI,EAAE,QAAQ;IACdC,MAAM,EAAE;EACV,CAAC;EACDE,QAAQ,EAAE;IACRJ,GAAG,EAA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Dc,OAAO,EAAE;IACPhB,GAAG,EAAE,mDAAmD;IACxDC,IAAI,EAAE,YAAY;IAClBC,MAAM,EAAE;EACV,CAAC;EACDe,QAAQ,EAAE;
|
|
1
|
+
{"version":3,"file":"PushContainerDocs.js","names":["IsolationEvents","PushContainerProperties","path","doc","type","status","itemPath","insertAt","title","data","defaultData","isolatedData","required","bubbleValidation","preventUncommittedChanges","showResetButton","openButton","showOpenButtonWhen","variant","toolbar","dataReference","children","PushContainerEvents","onCommit"],"sources":["../../../../../../src/extensions/forms/Iterate/PushContainer/PushContainerDocs.ts"],"sourcesContent":["import { PropertiesTableProps } from '../../../../shared/types'\nimport { IsolationEvents } from '../../Form/Isolation/IsolationDocs'\n\nexport const PushContainerProperties: PropertiesTableProps = {\n path: {\n doc: 'The path to the array to add the new item to.',\n type: 'string',\n status: 'required',\n },\n itemPath: {\n doc: 'The path to the item in a nested array, to add the new item to.',\n type: 'string',\n status: 'optional',\n },\n insertAt: {\n doc: 'The index to insert the new item at.',\n type: 'number',\n status: 'optional',\n },\n title: {\n doc: 'The title of the container.',\n type: 'React.Node',\n status: 'optional',\n },\n data: {\n doc: 'Prefilled data to be used by fields. The data will be put into this path: `/pushContainerItems/0`. Use `defaultData` when possible.',\n type: ['object', 'array'],\n status: 'optional',\n },\n defaultData: {\n doc: 'Prefilled data to be used by fields. The data will be put into this path: `/pushContainerItems/0`',\n type: ['object', 'array'],\n status: 'optional',\n },\n isolatedData: {\n doc: 'Provide additional data that will be put into the root of the isolated data context (parallel to `/pushContainerItems/0`).',\n type: 'object',\n status: 'optional',\n },\n required: {\n doc: 'If the fields inside the container are required.',\n type: 'boolean',\n status: 'optional',\n },\n bubbleValidation: {\n doc: 'Prevent the form from being submitted when there are fields with errors inside the PushContainer.',\n type: 'boolean',\n status: 'optional',\n },\n preventUncommittedChanges: {\n doc: 'Prevents uncommitted changes before the form is submitted. Will display an error message if user tries to submit without committing their changes.',\n type: 'boolean',\n status: 'optional',\n },\n showResetButton: {\n doc: 'Show a button to clear the PushContainer data.',\n type: 'boolean',\n status: 'optional',\n },\n openButton: {\n doc: 'The button to open container.',\n type: 'React.Node',\n status: 'optional',\n },\n showOpenButtonWhen: {\n doc: 'Define when the \"open button\" should be shown. Should be a function that returns a boolean.',\n type: 'function',\n status: 'optional',\n },\n variant: {\n doc: 'Defines the variant of the container. Can be `outline`, `filled` or `basic`. Defaults to `outline`.',\n type: 'string',\n status: 'optional',\n },\n toolbar: {\n doc: 'A custom toolbar to be shown below the container.',\n type: 'React.Node',\n status: 'optional',\n },\n dataReference: {\n doc: 'Provide a reference by using `Form.Isolation.createDataReference.`',\n type: 'IsolationDataReference',\n status: 'optional',\n },\n children: {\n doc: 'The container contents.',\n type: 'React.Node',\n status: 'required',\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}\n\nexport const PushContainerEvents: PropertiesTableProps = {\n onCommit: IsolationEvents.onCommit,\n}\n"],"mappings":"AACA,SAASA,eAAe,QAAQ,oCAAoC;AAEpE,OAAO,MAAMC,uBAA6C,GAAG;EAC3DC,IAAI,EAAE;IACJC,GAAG,EAAE,+CAA+C;IACpDC,IAAI,EAAE,QAAQ;IACdC,MAAM,EAAE;EACV,CAAC;EACDC,QAAQ,EAAE;IACRH,GAAG,EAAE,iEAAiE;IACtEC,IAAI,EAAE,QAAQ;IACdC,MAAM,EAAE;EACV,CAAC;EACDE,QAAQ,EAAE;IACRJ,GAAG,EAAE,sCAAsC;IAC3CC,IAAI,EAAE,QAAQ;IACdC,MAAM,EAAE;EACV,CAAC;EACDG,KAAK,EAAE;IACLL,GAAG,EAAE,6BAA6B;IAClCC,IAAI,EAAE,YAAY;IAClBC,MAAM,EAAE;EACV,CAAC;EACDI,IAAI,EAAE;IACJN,GAAG,EAAE,qIAAqI;IAC1IC,IAAI,EAAE,CAAC,QAAQ,EAAE,OAAO,CAAC;IACzBC,MAAM,EAAE;EACV,CAAC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AAE;EACV,CAAC;EACD,yCAAyC,EAAE;IACzCF,GAAG,EAAE,0DAA0D;IAC/DC,IAAI,EAAE,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAC1BC,MAAM,EAAE;EACV;AACF,CAAC;AAED,OAAO,MAAMiB,mBAAyC,GAAG;EACvDC,QAAQ,EAAEvB,eAAe,CAACuB;AAC5B,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import "core-js/modules/web.dom-collections.iterator.js";
|
|
4
|
+
import React, { useCallback, useContext, useReducer } from 'react';
|
|
5
|
+
import DataContext from '../DataContext/Context';
|
|
6
|
+
import Log from './Log';
|
|
7
|
+
import useEventListener from '../DataContext/Provider/useEventListener';
|
|
8
|
+
function Errors() {
|
|
9
|
+
const [, forceUpdate] = useReducer(() => ({}), {});
|
|
10
|
+
const {
|
|
11
|
+
fieldErrorRef,
|
|
12
|
+
errorsRef
|
|
13
|
+
} = useContext(DataContext);
|
|
14
|
+
const fieldErrors = Object.keys((fieldErrorRef === null || fieldErrorRef === void 0 ? void 0 : fieldErrorRef.current) || {}).reduce((acc, key) => {
|
|
15
|
+
var _fieldErrorRef$curren;
|
|
16
|
+
acc[key] = fieldErrorRef === null || fieldErrorRef === void 0 ? void 0 : (_fieldErrorRef$curren = fieldErrorRef.current[key]) === null || _fieldErrorRef$curren === void 0 ? void 0 : _fieldErrorRef$curren.message;
|
|
17
|
+
return acc;
|
|
18
|
+
}, {});
|
|
19
|
+
const formErrors = Object.keys((errorsRef === null || errorsRef === void 0 ? void 0 : errorsRef.current) || {}).reduce((acc, key) => {
|
|
20
|
+
var _errorsRef$current$ke;
|
|
21
|
+
acc[key || '/'] = errorsRef === null || errorsRef === void 0 ? void 0 : (_errorsRef$current$ke = errorsRef.current[key]) === null || _errorsRef$current$ke === void 0 ? void 0 : _errorsRef$current$ke.message;
|
|
22
|
+
return acc;
|
|
23
|
+
}, {});
|
|
24
|
+
const handleSetFieldError = useCallback(() => {
|
|
25
|
+
forceUpdate();
|
|
26
|
+
}, []);
|
|
27
|
+
useEventListener('onSetFieldError', handleSetFieldError);
|
|
28
|
+
const data = {
|
|
29
|
+
fieldErrors,
|
|
30
|
+
formErrors
|
|
31
|
+
};
|
|
32
|
+
return React.createElement(Log, {
|
|
33
|
+
data: data
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
Errors._supportsSpacingProps = true;
|
|
37
|
+
export default Errors;
|
|
38
|
+
//# sourceMappingURL=Errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Errors.js","names":["React","useCallback","useContext","useReducer","DataContext","Log","useEventListener","Errors","forceUpdate","fieldErrorRef","errorsRef","fieldErrors","Object","keys","current","reduce","acc","key","_fieldErrorRef$curren","message","formErrors","_errorsRef$current$ke","handleSetFieldError","data","createElement","_supportsSpacingProps"],"sources":["../../../../../src/extensions/forms/Tools/Errors.tsx"],"sourcesContent":["import React, { useCallback, useContext, useReducer } from 'react'\nimport DataContext from '../DataContext/Context'\nimport Log from './Log'\nimport useEventListener from '../DataContext/Provider/useEventListener'\n\nfunction Errors() {\n const [, forceUpdate] = useReducer(() => ({}), {})\n const { fieldErrorRef, errorsRef } = useContext(DataContext)\n\n const fieldErrors = Object.keys(fieldErrorRef?.current || {}).reduce(\n (acc, key) => {\n acc[key] = fieldErrorRef?.current[key]?.message\n return acc\n },\n {}\n )\n const formErrors = Object.keys(errorsRef?.current || {}).reduce(\n (acc, key) => {\n acc[key || '/'] = errorsRef?.current[key]?.message\n return acc\n },\n {}\n )\n\n const handleSetFieldError = useCallback(() => {\n forceUpdate()\n }, [])\n useEventListener('onSetFieldError', handleSetFieldError)\n\n const data = {\n fieldErrors,\n formErrors,\n }\n\n return <Log data={data} />\n}\n\nErrors._supportsSpacingProps = true\nexport default Errors\n"],"mappings":";;;AAAA,OAAOA,KAAK,IAAIC,WAAW,EAAEC,UAAU,EAAEC,UAAU,QAAQ,OA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C,EAAE,EAAE,CAAC;EACNF,gBAAgB,CAAC,iBAAiB,EAAEgB,mBAAmB,CAAC;EAExD,MAAMC,IAAI,GAAG;IACXZ,WAAW;IACXS;EACF,CAAC;EAED,OAAOpB,KAAA,CAAAwB,aAAA,CAACnB,GAAG;IAACkB,IAAI,EAAEA;EAAK,CAAE,CAAC;AAC5B;AAEAhB,MAAM,CAACkB,qBAAqB,GAAG,IAAI;AACnC,eAAelB,MAAM","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["default","GenerateSchema","ListAllProps","Log"],"sources":["../../../../../src/extensions/forms/Tools/index.ts"],"sourcesContent":["export { default as GenerateSchema } from './GenerateSchema'\nexport { default as ListAllProps } from './ListAllProps'\nexport { default as Log } from './Log'\n"],"mappings":"AAAA,SAASA,OAAO,IAAIC,cAAc,QAAQ,kBAAkB;AAC5D,SAASD,OAAO,IAAIE,YAAY,QAAQ,gBAAgB;AACxD,SAASF,OAAO,IAAIG,GAAG,QAAQ,OAAO","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"index.js","names":["default","GenerateSchema","ListAllProps","Log","Errors"],"sources":["../../../../../src/extensions/forms/Tools/index.ts"],"sourcesContent":["export { default as GenerateSchema } from './GenerateSchema'\nexport { default as ListAllProps } from './ListAllProps'\nexport { default as Log } from './Log'\nexport { default as Errors } from './Errors'\n"],"mappings":"AAAA,SAASA,OAAO,IAAIC,cAAc,QAAQ,kBAAkB;AAC5D,SAASD,OAAO,IAAIE,YAAY,QAAQ,gBAAgB;AACxD,SAASF,OAAO,IAAIG,GAAG,QAAQ,OAAO;AACtC,SAASH,OAAO,IAAII,MAAM,QAAQ,UAAU","ignoreList":[]}
|
|
@@ -8,6 +8,7 @@ import React, { useCallback, useContext, useEffect, useReducer, useRef } from 'r
|
|
|
8
8
|
import ReactDOM from 'react-dom';
|
|
9
9
|
import DataContext, { defaultContextState } from '../../DataContext/Context';
|
|
10
10
|
import WizardContext from '../Context/WizardContext';
|
|
11
|
+
import useEventListener from '../../DataContext/Provider/useEventListener';
|
|
11
12
|
export function PrerenderFieldPropsOfOtherSteps(_ref) {
|
|
12
13
|
let {
|
|
13
14
|
prerenderFieldPropsRef,
|
|
@@ -45,16 +46,13 @@ export function PrerenderFieldPropsOfOtherSteps(_ref) {
|
|
|
45
46
|
}
|
|
46
47
|
function usePrerenderState() {
|
|
47
48
|
const [, forceUpdate] = useReducer(() => ({}), {});
|
|
48
|
-
const {
|
|
49
|
-
setFieldEventListener
|
|
50
|
-
} = useContext(DataContext);
|
|
51
49
|
let renderContent = true;
|
|
52
50
|
const hasRenderedRef = useRef(false);
|
|
53
51
|
const handleBeforeSubmit = useCallback(() => {
|
|
54
52
|
hasRenderedRef.current = null;
|
|
55
53
|
forceUpdate();
|
|
56
54
|
}, []);
|
|
57
|
-
|
|
55
|
+
useEventListener('onBeforeSubmit', handleBeforeSubmit);
|
|
58
56
|
const state = hasRenderedRef.current;
|
|
59
57
|
useEffect(() => {
|
|
60
58
|
if (hasRenderedRef.current === null) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PrerenderFieldPropsOfOtherSteps.js","names":["React","useCallback","useContext","useEffect","useReducer","useRef","ReactDOM","DataContext","defaultContextState","WizardContext","PrerenderFieldPropsOfOtherSteps","_ref","prerenderFieldPropsRef","stepsRef","activeIndex","renderContent","hasRenderedRef","usePrerenderState","usePreventSubmit","createElement","PrerenderPortal","PrerenderFieldPropsProvider","showAllErrorsNow","current","title","hidden","Object","values","map","_ref2","index","fn","Fn","step","get","keepInDOM","key","forceUpdate","setFieldEventListener","handleBeforeSubmit","undefined","state","useEffectPromise","promiseRef","resolveRef","effectPromise","Promise","resolve","_resolveRef$current","call","hasInvalidStepsState","hasUnknownSteps","handleSubmit","_ref3","preventSubmit","remove","_ref4","children","document","createPortal","body","_ref5","dataContext","data","setFieldInternals","updateDataValue","showAllErrors","Provider","value","_objectSpread","hasContext","prerenderFieldProps"],"sources":["../../../../../../src/extensions/forms/Wizard/Container/PrerenderFieldPropsOfOtherSteps.tsx"],"sourcesContent":["import React, {\n useCallback,\n useContext,\n useEffect,\n useReducer,\n useRef,\n} from 'react'\nimport ReactDOM from 'react-dom'\nimport DataContext, {\n defaultContextState,\n} from '../../DataContext/Context'\nimport WizardContext, {\n WizardContextState,\n} from '../Context/WizardContext'\n\nexport function PrerenderFieldPropsOfOtherSteps({\n prerenderFieldPropsRef,\n stepsRef,\n}: Pick<WizardContextState, 'prerenderFieldPropsRef' | 'stepsRef'>) {\n const { activeIndex } = useContext(WizardContext) || {}\n const { renderContent, hasRenderedRef } = usePrerenderState()\n\n // Prevent submit when there is an error in the other steps\n usePreventSubmit()\n\n return (\n <PrerenderPortal>\n <PrerenderFieldPropsProvider\n showAllErrorsNow={hasRenderedRef.current === null}\n >\n <iframe title=\"Wizard Prerender\" hidden>\n {renderContent &&\n Object.values(prerenderFieldPropsRef.current).map(\n ({ index, fn: Fn }) => {\n if (activeIndex === index) {\n return null\n }\n const step = stepsRef.current.get(index)\n if (step?.keepInDOM === true) {\n return null\n }\n return <Fn key={index} />\n }\n )}\n </iframe>\n </PrerenderFieldPropsProvider>\n </PrerenderPortal>\n )\n}\n\nfunction usePrerenderState() {\n const [, forceUpdate] = useReducer(() => ({}), {})\n const { setFieldEventListener } = useContext(DataContext)\n\n // Keep track whether to render the content or not\n let renderContent = true\n\n // Tracks the rendering state: false (initial), null (show content), true (hide content)\n const hasRenderedRef = useRef(false)\n\n const handleBeforeSubmit = useCallback(() => {\n // Ensure we render the content and also force a re-render so it actually gets rendered\n hasRenderedRef.current = null\n forceUpdate()\n }, [])\n setFieldEventListener?.(undefined, 'onBeforeSubmit', handleBeforeSubmit)\n\n // Track state changes to handle re-rendering\n const state = hasRenderedRef.current\n useEffect(() => {\n // Ensure whe don't render the content after the content has been rendered\n if (hasRenderedRef.current === null) {\n hasRenderedRef.current = true\n forceUpdate()\n }\n }, [state])\n\n // Don't render the content\n if (hasRenderedRef.current) {\n renderContent = false\n }\n\n // Ensure we don't render the content again on the next render\n if (hasRenderedRef.current !== null) {\n hasRenderedRef.current = true\n }\n\n return {\n renderContent,\n hasRenderedRef,\n }\n}\n\nfunction useEffectPromise() {\n const promiseRef = useRef<Promise<void>>()\n const resolveRef = useRef<() => void>()\n\n const effectPromise = useCallback(() => {\n promiseRef.current = new Promise((resolve) => {\n resolveRef.current = resolve\n })\n\n return promiseRef.current\n }, [])\n\n useEffect(() => {\n // Delay the promise to allow the prerendered steps to be rendered\n if (resolveRef.current) {\n resolveRef.current?.()\n resolveRef.current = null\n }\n }) // No deps, because we want to run this effect always\n\n return effectPromise\n}\n\nfunction usePreventSubmit() {\n const { setFieldEventListener } = useContext(DataContext)\n const { hasInvalidStepsState } = useContext(WizardContext) || {}\n\n const effectPromise = useEffectPromise()\n const hasUnknownSteps = hasInvalidStepsState(undefined, ['unknown'])\n\n const handleSubmit = useCallback(\n async ({ preventSubmit }) => {\n // - Wait for the prerendered steps to be rendered\n if (hasUnknownSteps) {\n await effectPromise()\n }\n\n // - If there is a step with an error state, we need to prevent the submit\n if (hasInvalidStepsState(undefined, ['error'])) {\n return preventSubmit()\n }\n },\n [hasUnknownSteps, hasInvalidStepsState, effectPromise]\n )\n\n // Only add the listener when there is an unknown step state\n if (hasUnknownSteps) {\n setFieldEventListener?.(undefined, 'onSubmit', handleSubmit)\n }\n\n useEffect(() => {\n return () => {\n setFieldEventListener?.(undefined, 'onSubmit', handleSubmit, {\n remove: true,\n })\n }\n }, [handleSubmit, setFieldEventListener])\n}\n\nfunction PrerenderPortal({ children }) {\n if (typeof document !== 'undefined') {\n return ReactDOM.createPortal(children, document.body)\n }\n}\n\nfunction PrerenderFieldPropsProvider({ showAllErrorsNow, children }) {\n const dataContext = useContext(DataContext)\n\n const { data, setFieldInternals, updateDataValue, showAllErrors } =\n dataContext || {}\n\n // Run validation of all fields\n if (showAllErrorsNow) {\n return (\n <DataContext.Provider\n value={{\n ...dataContext,\n hasContext: true,\n prerenderFieldProps: true,\n showAllErrors: showAllErrorsNow ? true : showAllErrors,\n }}\n >\n {children}\n </DataContext.Provider>\n )\n }\n\n // Pre-render field props\n return (\n <DataContext.Provider\n value={{\n ...defaultContextState,\n hasContext: true,\n prerenderFieldProps: true,\n\n // Essential methods to pre-render field props\n data,\n setFieldInternals,\n updateDataValue,\n }}\n >\n {children}\n </DataContext.Provider>\n )\n}\n"],"mappings":";;;;;;AAAA,OAAOA,KAAK,IACVC,WAAW,EACXC,UAAU,EACVC,SAAS,EACTC,UAAU,EACVC,MAAM,QACD,OAAO;AACd,OAAOC,QAAQ,MAAM,WAAW;AAChC,OAAOC,WAAW,IAChBC,mBAAmB,QACd,2BAA2B;AAClC,OAAOC,aAAa,MAEb,0BAA0B;AAEjC,OAAO,SAASC,+BAA+BA,CAAAC,IAAA,EAGqB;EAAA,IAHpB;IAC9CC,sBAAsB;IACtBC;EAC+D,CAAC,GAAAF,IAAA;EAChE,MAAM;IAAEG;EAAY,CAAC,GAAGZ,UAAU,CAACO,aAAa,CAAC,IAAI,CAAC,CAAC;EACvD,MAAM;IAAEM,aAAa;IAAEC;EAAe,CAAC,GAAGC,iBAAiB,CAAC,CAAC;EAG7DC,gBAAgB,CAAC,CAAC;EAElB,OACElB,KAAA,CAAAmB,aAAA,CAACC,eAAe,QACdpB,KAAA,CAAAmB,aAAA,CAACE,2BAA2B;IAC1BC,gBAAgB,EAAEN,cAAc,CAACO,OAAO,KAAK;EAAK,GAElDvB,KAAA,CAAAmB,aAAA;IAAQK,KAAK,EAAC,kBAAkB;IAACC,MAAM;EAAA,GACpCV,aAAa,IACZW,MAAM,CAACC,MAAM,CAACf,sBAAsB,CAACW,OAAO,CAAC,CAACK,GAAG,CAC/CC,KAAA,IAAuB;IAAA,IAAtB;MAAEC,KAAK;MAAEC,EAAE,EAAEC;IAAG,CAAC,GAAAH,KAAA;IAChB,IAAIf,WAAW,KAAKgB,KAAK,EAAE;MACzB,OAAO,IAAI;IACb;IACA,MAAMG,IAAI,G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AG4C;MAAa;IACtD,GAEDT,QACmB,CAAC;EAE3B;EAGA,OACEzD,KAAA,CAAAmB,aAAA,CAACZ,WAAW,CAAC4D,QAAQ;IACnBC,KAAK,EAAAC,aAAA,CAAAA,aAAA,KACA7D,mBAAmB;MACtB8D,UAAU,EAAE,IAAI;MAChBC,mBAAmB,EAAE,IAAI;MAGzBR,IAAI;MACJC,iBAAiB;MACjBC;IAAe;EACf,GAEDR,QACmB,CAAC;AAE3B","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"PrerenderFieldPropsOfOtherSteps.js","names":["React","useCallback","useContext","useEffect","useReducer","useRef","ReactDOM","DataContext","defaultContextState","WizardContext","useEventListener","PrerenderFieldPropsOfOtherSteps","_ref","prerenderFieldPropsRef","stepsRef","activeIndex","renderContent","hasRenderedRef","usePrerenderState","usePreventSubmit","createElement","PrerenderPortal","PrerenderFieldPropsProvider","showAllErrorsNow","current","title","hidden","Object","values","map","_ref2","index","fn","Fn","step","get","keepInDOM","key","forceUpdate","handleBeforeSubmit","state","useEffectPromise","promiseRef","resolveRef","effectPromise","Promise","resolve","_resolveRef$current","call","setFieldEventListener","hasInvalidStepsState","hasUnknownSteps","undefined","handleSubmit","_ref3","preventSubmit","remove","_ref4","children","document","createPortal","body","_ref5","dataContext","data","setFieldInternals","updateDataValue","showAllErrors","Provider","value","_objectSpread","hasContext","prerenderFieldProps"],"sources":["../../../../../../src/extensions/forms/Wizard/Container/PrerenderFieldPropsOfOtherSteps.tsx"],"sourcesContent":["import React, {\n useCallback,\n useContext,\n useEffect,\n useReducer,\n useRef,\n} from 'react'\nimport ReactDOM from 'react-dom'\nimport DataContext, {\n defaultContextState,\n} from '../../DataContext/Context'\nimport WizardContext, {\n WizardContextState,\n} from '../Context/WizardContext'\nimport useEventListener from '../../DataContext/Provider/useEventListener'\n\nexport function PrerenderFieldPropsOfOtherSteps({\n prerenderFieldPropsRef,\n stepsRef,\n}: Pick<WizardContextState, 'prerenderFieldPropsRef' | 'stepsRef'>) {\n const { activeIndex } = useContext(WizardContext) || {}\n const { renderContent, hasRenderedRef } = usePrerenderState()\n\n // Prevent submit when there is an error in the other steps\n usePreventSubmit()\n\n return (\n <PrerenderPortal>\n <PrerenderFieldPropsProvider\n showAllErrorsNow={hasRenderedRef.current === null}\n >\n <iframe title=\"Wizard Prerender\" hidden>\n {renderContent &&\n Object.values(prerenderFieldPropsRef.current).map(\n ({ index, fn: Fn }) => {\n if (activeIndex === index) {\n return null\n }\n const step = stepsRef.current.get(index)\n if (step?.keepInDOM === true) {\n return null\n }\n return <Fn key={index} />\n }\n )}\n </iframe>\n </PrerenderFieldPropsProvider>\n </PrerenderPortal>\n )\n}\n\nfunction usePrerenderState() {\n const [, forceUpdate] = useReducer(() => ({}), {})\n\n // Keep track whether to render the content or not\n let renderContent = true\n\n // Tracks the rendering state: false (initial), null (show content), true (hide content)\n const hasRenderedRef = useRef(false)\n\n const handleBeforeSubmit = useCallback(() => {\n // Ensure we render the content and also force a re-render so it actually gets rendered\n hasRenderedRef.current = null\n forceUpdate()\n }, [])\n useEventListener('onBeforeSubmit', handleBeforeSubmit)\n\n // Track state changes to handle re-rendering\n const state = hasRenderedRef.current\n useEffect(() => {\n // Ensure whe don't render the content after the content has been rendered\n if (hasRenderedRef.current === null) {\n hasRenderedRef.current = true\n forceUpdate()\n }\n }, [state])\n\n // Don't render the content\n if (hasRenderedRef.current) {\n renderContent = false\n }\n\n // Ensure we don't render the content again on the next render\n if (hasRenderedRef.current !== null) {\n hasRenderedRef.current = true\n }\n\n return {\n renderContent,\n hasRenderedRef,\n }\n}\n\nfunction useEffectPromise() {\n const promiseRef = useRef<Promise<void>>()\n const resolveRef = useRef<() => void>()\n\n const effectPromise = useCallback(() => {\n promiseRef.current = new Promise((resolve) => {\n resolveRef.current = resolve\n })\n\n return promiseRef.current\n }, [])\n\n useEffect(() => {\n // Delay the promise to allow the prerendered steps to be rendered\n if (resolveRef.current) {\n resolveRef.current?.()\n resolveRef.current = null\n }\n }) // No deps, because we want to run this effect always\n\n return effectPromise\n}\n\nfunction usePreventSubmit() {\n const { setFieldEventListener } = useContext(DataContext)\n const { hasInvalidStepsState } = useContext(WizardContext) || {}\n\n const effectPromise = useEffectPromise()\n const hasUnknownSteps = hasInvalidStepsState(undefined, ['unknown'])\n\n const handleSubmit = useCallback(\n async ({ preventSubmit }) => {\n // - Wait for the prerendered steps to be rendered\n if (hasUnknownSteps) {\n await effectPromise()\n }\n\n // - If there is a step with an error state, we need to prevent the submit\n if (hasInvalidStepsState(undefined, ['error'])) {\n return preventSubmit()\n }\n },\n [hasUnknownSteps, hasInvalidStepsState, effectPromise]\n )\n\n // Only add the listener when there is an unknown step state\n if (hasUnknownSteps) {\n setFieldEventListener?.(undefined, 'onSubmit', handleSubmit)\n }\n\n useEffect(() => {\n return () => {\n setFieldEventListener?.(undefined, 'onSubmit', handleSubmit, {\n remove: true,\n })\n }\n }, [handleSubmit, setFieldEventListener])\n}\n\nfunction PrerenderPortal({ children }) {\n if (typeof document !== 'undefined') {\n return ReactDOM.createPortal(children, document.body)\n }\n}\n\nfunction PrerenderFieldPropsProvider({ showAllErrorsNow, children }) {\n const dataContext = useContext(DataContext)\n\n const { data, setFieldInternals, updateDataValue, showAllErrors } =\n dataContext || {}\n\n // Run validation of all fields\n if (showAllErrorsNow) {\n return (\n <DataContext.Provider\n value={{\n ...dataContext,\n hasContext: true,\n prerenderFieldProps: true,\n showAllErrors: showAllErrorsNow ? true : showAllErrors,\n }}\n >\n {children}\n </DataContext.Provider>\n )\n }\n\n // Pre-render field props\n return (\n <DataContext.Provider\n value={{\n ...defaultContextState,\n hasContext: true,\n prerenderFieldProps: true,\n\n // Essential methods to pre-render field props\n data,\n setFieldInternals,\n updateDataValue,\n }}\n >\n {children}\n </DataContext.Provider>\n )\n}\n"],"mappings":";;;;;;AAAA,OAAOA,KAAK,IACVC,WAAW,EACXC,UAAU,EACVC,SAAS,EACTC,UAAU,EACVC,MAAM,QACD,OAAO;AACd,OAAOC,QAAQ,M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AC,EAAE,CAACH,YAAY,EAAEJ,qBAAqB,CAAC,CAAC;AAC3C;AAEA,SAAS5B,eAAeA,CAAAoC,KAAA,EAAe;EAAA,IAAd;IAAEC;EAAS,CAAC,GAAAD,KAAA;EACnC,IAAI,OAAOE,QAAQ,KAAK,WAAW,EAAE;IACnC,OAAOrD,QAAQ,CAACsD,YAAY,CAACF,QAAQ,EAAEC,QAAQ,CAACE,IAAI,CAAC;EACvD;AACF;AAEA,SAASvC,2BAA2BA,CAAAwC,KAAA,EAAiC;EAAA,IAAhC;IAAEvC,gBAAgB;IAAEmC;EAAS,CAAC,GAAAI,KAAA;EACjE,MAAMC,WAAW,GAAG7D,UAAU,CAACK,WAAW,CAAC;EAE3C,MAAM;IAAEyD,IAAI;IAAEC,iBAAiB;IAAEC,eAAe;IAAEC;EAAc,CAAC,GAC/DJ,WAAW,IAAI,CAAC,CAAC;EAGnB,IAAIxC,gBAAgB,EAAE;IACpB,OACEvB,KAAA,CAAAoB,aAAA,CAACb,WAAW,CAAC6D,QAAQ;MACnBC,KAAK,EAAAC,aAAA,CAAAA,aAAA,KACAP,WAAW;QACdQ,UAAU,EAAE,IAAI;QAChBC,mBAAmB,EAAE,IAAI;QACzBL,aAAa,EAAE5C,gBAAgB,GAAG,IAAI,GAAG4C;MAAa;IACtD,GAEDT,QACmB,CAAC;EAE3B;EAGA,OACE1D,KAAA,CAAAoB,aAAA,CAACb,WAAW,CAAC6D,QAAQ;IACnBC,KAAK,EAAAC,aAAA,CAAAA,aAAA,KACA9D,mBAAmB;MACtB+D,UAAU,EAAE,IAAI;MAChBC,mBAAmB,EAAE,IAAI;MAGzBR,IAAI;MACJC,iBAAiB;MACjBC;IAAe;EACf,GAEDR,QACmB,CAAC;AAE3B","ignoreList":[]}
|
|
@@ -16,6 +16,7 @@ import { isAsync } from '../../../../shared/helpers/isAsync';
|
|
|
16
16
|
import useId from '../../../../shared/helpers/useId';
|
|
17
17
|
import WizardContext from '../Context/WizardContext';
|
|
18
18
|
import DataContext from '../../DataContext/Context';
|
|
19
|
+
import useEventListener from '../../DataContext/Provider/useEventListener';
|
|
19
20
|
import Handler from '../../Form/Handler/Handler';
|
|
20
21
|
import { createReferenceKey, useSharedState } from '../../../../shared/helpers/useSharedState';
|
|
21
22
|
import useHandleLayoutEffect from './useHandleLayoutEffect';
|
|
@@ -58,8 +59,7 @@ function WizardContainer(props) {
|
|
|
58
59
|
setFormState,
|
|
59
60
|
handleSubmitCall,
|
|
60
61
|
setShowAllErrors,
|
|
61
|
-
setSubmitState
|
|
62
|
-
setFieldEventListener
|
|
62
|
+
setSubmitState
|
|
63
63
|
} = dataContext;
|
|
64
64
|
const id = useId(idProp);
|
|
65
65
|
const [, forceUpdate] = useReducer(() => ({}), {});
|
|
@@ -68,6 +68,7 @@ function WizardContainer(props) {
|
|
|
68
68
|
const visitedStepsRef = useRef(new Map());
|
|
69
69
|
const fieldErrorRef = useRef(new Map());
|
|
70
70
|
const storeStepStateRef = useRef(new Map());
|
|
71
|
+
const onStepChangeEventsRef = useRef(new Set());
|
|
71
72
|
const hasErrorInOtherStepRef = useRef(false);
|
|
72
73
|
const elementRef = useRef();
|
|
73
74
|
const stepElementRef = useRef();
|
|
@@ -226,8 +227,12 @@ function WizardContainer(props) {
|
|
|
226
227
|
let didSubmit = false;
|
|
227
228
|
const onSubmit = async () => {
|
|
228
229
|
if (!skipStepChangeCallFromHook) {
|
|
229
|
-
var
|
|
230
|
-
|
|
230
|
+
var _onStepChangeEventsRe;
|
|
231
|
+
onStepChangeEventsRef === null || onStepChangeEventsRef === void 0 ? void 0 : (_onStepChangeEventsRe = onStepChangeEventsRef.current) === null || _onStepChangeEventsRe === void 0 ? void 0 : _onStepChangeEventsRe.forEach(onStepChange => {
|
|
232
|
+
if (typeof onStepChange === 'function') {
|
|
233
|
+
onStepChange(index, mode, getStepChangeOptions(index));
|
|
234
|
+
}
|
|
235
|
+
});
|
|
231
236
|
}
|
|
232
237
|
let result = undefined;
|
|
233
238
|
if (!skipStepChangeCall && !(skipStepChangeCallBeforeMounted && !isInteractionRef.current)) {
|
|
@@ -305,7 +310,7 @@ function WizardContainer(props) {
|
|
|
305
310
|
preventSubmit();
|
|
306
311
|
}
|
|
307
312
|
}, [hasInvalidStepsState, handleNext]);
|
|
308
|
-
|
|
313
|
+
useEventListener('onSubmit', handleSubmit);
|
|
309
314
|
const {
|
|
310
315
|
check
|
|
311
316
|
} = useVisibility();
|
|
@@ -328,6 +333,7 @@ function WizardContainer(props) {
|
|
|
328
333
|
prerenderFieldProps,
|
|
329
334
|
prerenderFieldPropsRef,
|
|
330
335
|
hasErrorInOtherStepRef,
|
|
336
|
+
onStepChangeEventsRef,
|
|
331
337
|
keepInDOM,
|
|
332
338
|
enableMapOverChildren,
|
|
333
339
|
mapOverChildrenRef,
|
|
@@ -1 +1 @@
|
|
|
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","handleDeprecatedProps","props","variant","sidebarId","rest","_objectWithoutProperties","_excluded","WizardContainer","_handleDeprecatedProp","className","id","idProp","mode","initialActiveIndex","omitScrollManagement","omitFocusManagement","onStepChange","children","noAnimation","expandedInitially","prerenderFieldProps","keepInDOM","validationMode","outset","_excluded2","dataContext","hasContext","setFormState","handleSubmitCall","setShowAllErrors","setSubmitState","setFieldEventListener","forceUpdate","activeIndexRef","totalStepsRef","NaN","visitedStepsRef","Map","fieldErrorRef","storeStepStateRef","hasErrorInOtherStepRef","elementRef","stepElementRef","preventNextStepRef","stepsRef","tmpStepsRef","stepIndexRef","updateTitlesRef","prerenderFieldPropsRef","bypassOnNavigation","sharedStateRef","current","undefined","hasFieldErrorInStep","index","Array","from","values","some","_ref","i","hasError","setStepAsVisited","set","syncStepsState","arguments","length","forStates","checkUnknown","includes","checkError","result","state","get","existingState","hasInvalidStepsState","setFieldError","path","preventNavigation","shouldPrevent","getStepChangeOptions","_stepsRef$current$get","_stepsRef$current$get2","previousIndex","options","previousStep","Object","assign","previousId","callOnStepChange","setFocus","scrollToTop","isInteractionRef","executeLayoutAnimationRef","handleLayoutEffect","handleStepChange","_ref2","skipErrorCheck","skipStepChangeCall","skipStepChangeCallBeforeMounted","skipStepChangeCallFromHook","didSubmit","onSubmit","_sharedStateRef$curre","_sharedStateRef$curre2","_sharedStateRef$curre3","data","call","Error","skipFieldValidation","enableAsyncBehavior","setActiveIndex","_objectSpread","handlePrevious","handleNext","handleChange","_ref3","current_step","setFormError","error","handleSubmit","_ref4","preventSubmit","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 * @deprecated there is only one variant available. This props has no effect\n */\n variant?: 'sidebar' | 'drawer'\n /**\n * @deprecated there is no longer a sidebar. This prop does nothing.\n */\n sidebarId?: string\n\n /**\n * If set to `true`, the wizard will not animate the steps.\n */\n noAnimation?: boolean\n /**\n * Set to `true` to have the list be expanded initially. Defaults to `false`.\n */\n expandedInitially?: boolean\n /**\n * If set to `true`, the wizard will not unmount the steps when navigating back and forth.\n */\n keepInDOM?: boolean\n /**\n * Whether or not to break out (using negative margins) on larger screens. Defaults to `true`.\n */\n outset?: boolean\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 handleDeprecatedProps(\n props: Props\n): Omit<Props, 'variant' | 'sidebarId'> {\n const { variant, sidebarId, ...rest } = props\n return rest\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 = false,\n expandedInitially = false,\n prerenderFieldProps = true,\n keepInDOM,\n validationMode,\n outset = true,\n ...rest\n } = handleDeprecatedProps(props)\n\n const dataContext = useContext(DataContext)\n const {\n hasContext,\n setFormState,\n handleSubmitCall,\n setShowAllErrors,\n setSubmitState,\n setFieldEventListener,\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 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 Pick<WizardContextState, 'prerenderFieldPropsRef'>\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 syncStepsState = useCallback(\n (index = undefined, forStates = ['unknown', 'error']) => {\n const checkUnknown = forStates.includes('unknown')\n const checkError = forStates.includes('error')\n\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\n if (checkUnknown) {\n const state =\n i < activeIndexRef.current &&\n visitedStepsRef.current.get(i) === undefined\n if (state) {\n result = 'unknown'\n }\n }\n\n if (checkError) {\n const state = hasFieldErrorInStep(i)\n const existingState = storeStepStateRef.current.get(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(\n (index = undefined, forStates = ['unknown', 'error']) => {\n // Update all steps state before checking\n syncStepsState()\n\n const checkUnknown = forStates.includes('unknown')\n const checkError = forStates.includes('error')\n\n // Check if there are any errors in other steps\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 (checkUnknown) {\n if (state === 'unknown') {\n return true\n }\n }\n\n if (checkError) {\n if (state === 'error') {\n return true\n }\n }\n }\n\n return false\n },\n [syncStepsState]\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 Object.assign(options, { id })\n }\n\n const previousId = stepsRef.current.get(previousIndex)?.id\n if (previousId) {\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 // 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 ]\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 // - If there is a step with an error state, we need to prevent the submit\n if (hasInvalidStepsState(undefined, ['error'])) {\n return preventSubmit()\n }\n\n if (activeIndexRef.current + 1 < totalStepsRef.current) {\n handleNext()\n preventSubmit()\n }\n },\n [hasInvalidStepsState, handleNext]\n )\n setFieldEventListener?.(undefined, 'onSubmit', 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 prerenderFieldProps,\n prerenderFieldPropsRef,\n hasErrorInOtherStepRef,\n keepInDOM,\n enableMapOverChildren,\n mapOverChildrenRef,\n check,\n setActiveIndex,\n handlePrevious,\n hasInvalidStepsState,\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 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('dnb-forms-wizard-layout', className)}\n innerRef={elementRef}\n {...rest}\n >\n <DisplaySteps\n mode={mode}\n noAnimation={noAnimation}\n expandedInitially={expandedInitially}\n handleChange={handleChange}\n outset={outset}\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 stepsRef={stepsRef}\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,QAC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+J,aAAA,CAACvJ,KAAK,EAAAwJ,QAAA;IACJ9H,SAAS,EAAE3B,UAAU,CAAC,yBAAyB,EAAE2B,SAAS,CAAE;IAC5DiI,QAAQ,EAAEjG;EAAW,GACjBrC,IAAI,GAER7B,KAAA,CAAA+J,aAAA,CAAC3I,YAAY;IACXiB,IAAI,EAAEA,IAAK;IACXM,WAAW,EAAEA,WAAY;IACzBC,iBAAiB,EAAEA,iBAAkB;IACrCgG,YAAY,EAAEA,YAAa;IAC3B5F,MAAM,EAAEA;EAAO,CAChB,CAAC,EAEFhD,KAAA,CAAA+J,aAAA;IAAK7H,SAAS,EAAC;EAAmC,GAChDlC,KAAA,CAAA+J,aAAA,CAAC1I,gBAAgB,QAAEqB,QAA2B,CAC3C,CACA,CAAC,EAEPG,mBAAmB,IAAI,CAACC,SAAS,IAChC9C,KAAA,CAAA+J,aAAA,CAACzI,+BAA+B;IAC9BmD,sBAAsB,EAAEA,sBAAuB;IAC/CJ,QAAQ,EAAEA;EAAS,CACpB,CAEmB,CAAC;AAE7B;AAEArC,eAAe,CAACoI,qBAAqB,GAAG,IAAI;AAE5C,eAAepI,eAAe","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"WizardContainer.js","names":["React","useContext","useCallback","useRef","useReducer","useMemo","useEffect","classnames","Space","warn","isAsync","useId","WizardContext","DataContext","useEventListener","Handler","createReferenceKey","useSharedState","useHandleLayoutEffect","useStepAnimation","useVisibility","DisplaySteps","IterateOverSteps","PrerenderFieldPropsOfOtherSteps","useLayoutEffect","window","handleDeprecatedProps","props","variant","sidebarId","rest","_objectWithoutProperties","_excluded","WizardContainer","_handleDeprecatedProp","className","id","idProp","mode","initialActiveIndex","omitScrollManagement","omitFocusManagement","onStepChange","children","noAnimation","expandedInitially","prerenderFieldProps","keepInDOM","validationMode","outset","_excluded2","dataContext","hasContext","setFormState","handleSubmitCall","setShowAllErrors","setSubmitState","forceUpdate","activeIndexRef","totalStepsRef","NaN","visitedStepsRef","Map","fieldErrorRef","storeStepStateRef","onStepChangeEventsRef","Set","hasErrorInOtherStepRef","elementRef","stepElementRef","preventNextStepRef","stepsRef","tmpStepsRef","stepIndexRef","updateTitlesRef","prerenderFieldPropsRef","bypassOnNavigation","sharedStateRef","current","undefined","hasFieldErrorInStep","index","Array","from","values","some","_ref","i","hasError","setStepAsVisited","set","syncStepsState","arguments","length","forStates","checkUnknown","includes","checkError","result","state","get","existingState","hasInvalidStepsState","setFieldError","path","preventNavigation","shouldPrevent","getStepChangeOptions","_stepsRef$current$get","_stepsRef$current$get2","previousIndex","options","previousStep","Object","assign","previousId","callOnStepChange","setFocus","scrollToTop","isInteractionRef","executeLayoutAnimationRef","handleLayoutEffect","handleStepChange","_ref2","skipErrorCheck","skipStepChangeCall","skipStepChangeCallBeforeMounted","skipStepChangeCallFromHook","didSubmit","onSubmit","_onStepChangeEventsRe","forEach","Error","skipFieldValidation","enableAsyncBehavior","setActiveIndex","_objectSpread","handlePrevious","handleNext","handleChange","_ref3","current_step","setFormError","error","handleSubmit","_ref4","preventSubmit","check","mapOverChildrenRef","enableMapOverChildren","activeIndex","providerValue","extend","_updateTitlesRef$curr","call","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 useEventListener from '../../DataContext/Provider/useEventListener'\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 * @deprecated there is only one variant available. This props has no effect\n */\n variant?: 'sidebar' | 'drawer'\n /**\n * @deprecated there is no longer a sidebar. This prop does nothing.\n */\n sidebarId?: string\n\n /**\n * If set to `true`, the wizard will not animate the steps.\n */\n noAnimation?: boolean\n /**\n * Set to `true` to have the list be expanded initially. Defaults to `false`.\n */\n expandedInitially?: boolean\n /**\n * If set to `true`, the wizard will not unmount the steps when navigating back and forth.\n */\n keepInDOM?: boolean\n /**\n * Whether or not to break out (using negative margins) on larger screens. Defaults to `true`.\n */\n outset?: boolean\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 handleDeprecatedProps(\n props: Props\n): Omit<Props, 'variant' | 'sidebarId'> {\n const { variant, sidebarId, ...rest } = props\n return rest\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 = false,\n expandedInitially = false,\n prerenderFieldProps = true,\n keepInDOM,\n validationMode,\n outset = true,\n ...rest\n } = handleDeprecatedProps(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 visitedStepsRef = useRef<InternalVisitedSteps>(new Map())\n const fieldErrorRef = useRef<InternalFieldError>(new Map())\n const storeStepStateRef = useRef<InternalStepStatuses>(new Map())\n const onStepChangeEventsRef = useRef<Set<OnStepChange>>(new Set())\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 Pick<WizardContextState, 'prerenderFieldPropsRef'>\n >({})\n\n const bypassOnNavigation = validationMode === 'bypassOnNavigation'\n\n // - Handle shared state\n const sharedStateRef = useRef<SharedStateReturn<WizardContextState>>()\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 syncStepsState = useCallback(\n (index = undefined, forStates = ['unknown', 'error']) => {\n const checkUnknown = forStates.includes('unknown')\n const checkError = forStates.includes('error')\n\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\n if (checkUnknown) {\n const state =\n i < activeIndexRef.current &&\n visitedStepsRef.current.get(i) === undefined\n if (state) {\n result = 'unknown'\n }\n }\n\n if (checkError) {\n const state = hasFieldErrorInStep(i)\n const existingState = storeStepStateRef.current.get(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(\n (index = undefined, forStates = ['unknown', 'error']) => {\n // Update all steps state before checking\n syncStepsState()\n\n const checkUnknown = forStates.includes('unknown')\n const checkError = forStates.includes('error')\n\n // Check if there are any errors in other steps\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 (checkUnknown) {\n if (state === 'unknown') {\n return true\n }\n }\n\n if (checkError) {\n if (state === 'error') {\n return true\n }\n }\n }\n\n return false\n },\n [syncStepsState]\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 Object.assign(options, { id })\n }\n\n const previousId = stepsRef.current.get(previousIndex)?.id\n if (previousId) {\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 onStepChangeEventsRef?.current?.forEach((onStepChange) => {\n if (typeof onStepChange === 'function') {\n onStepChange(index, mode, getStepChangeOptions(index))\n }\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 // 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 ]\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 // - If there is a step with an error state, we need to prevent the submit\n if (hasInvalidStepsState(undefined, ['error'])) {\n return preventSubmit()\n }\n\n if (activeIndexRef.current + 1 < totalStepsRef.current) {\n handleNext()\n preventSubmit()\n }\n },\n [hasInvalidStepsState, handleNext]\n )\n useEventListener('onSubmit', 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 NOT 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 prerenderFieldProps,\n prerenderFieldPropsRef,\n hasErrorInOtherStepRef,\n onStepChangeEventsRef,\n keepInDOM,\n enableMapOverChildren,\n mapOverChildrenRef,\n check,\n setActiveIndex,\n handlePrevious,\n hasInvalidStepsState,\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 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('dnb-forms-wizard-layout', className)}\n innerRef={elementRef}\n {...rest}\n >\n <DisplaySteps\n mode={mode}\n noAnimation={noAnimation}\n expandedInitially={expandedInitially}\n handleChange={handleChange}\n outset={outset}\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 stepsRef={stepsRef}\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,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