@dnb/eufemia 10.48.0 → 10.50.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +57 -0
- package/cjs/components/breadcrumb/BreadcrumbItem.d.ts +1 -1
- package/cjs/components/breadcrumb/BreadcrumbItem.js +3 -3
- package/cjs/components/breadcrumb/BreadcrumbItem.js.map +1 -1
- package/cjs/components/breadcrumb/BreadcrumbMultiple.js +2 -2
- package/cjs/components/breadcrumb/BreadcrumbMultiple.js.map +1 -1
- package/cjs/components/checkbox/CheckboxDocs.js +1 -1
- package/cjs/components/checkbox/CheckboxDocs.js.map +1 -1
- package/cjs/components/height-animation/HeightAnimationInstance.d.ts +1 -0
- package/cjs/components/height-animation/HeightAnimationInstance.js +13 -6
- package/cjs/components/height-animation/HeightAnimationInstance.js.map +1 -1
- package/cjs/elements/ElementDocs.d.ts +2 -0
- package/cjs/elements/ElementDocs.js +35 -0
- package/cjs/elements/ElementDocs.js.map +1 -0
- package/cjs/elements/blockquote/BlockquoteDocs.d.ts +2 -0
- package/cjs/elements/blockquote/BlockquoteDocs.js +25 -0
- package/cjs/elements/blockquote/BlockquoteDocs.js.map +1 -0
- package/cjs/elements/hr/HrDocs.d.ts +2 -0
- package/cjs/elements/hr/HrDocs.js +25 -0
- package/cjs/elements/hr/HrDocs.js.map +1 -0
- package/cjs/elements/img/ImgDocs.d.ts +2 -0
- package/cjs/elements/img/ImgDocs.js +40 -0
- package/cjs/elements/img/ImgDocs.js.map +1 -0
- package/cjs/elements/lists/DlDocs.d.ts +2 -0
- package/cjs/elements/lists/DlDocs.js +21 -0
- package/cjs/elements/lists/DlDocs.js.map +1 -0
- package/cjs/elements/lists/OlDocs.d.ts +2 -0
- package/cjs/elements/lists/OlDocs.js +31 -0
- package/cjs/elements/lists/OlDocs.js.map +1 -0
- package/cjs/elements/lists/UlDocs.d.ts +2 -0
- package/cjs/elements/lists/UlDocs.js +31 -0
- package/cjs/elements/lists/UlDocs.js.map +1 -0
- package/cjs/elements/typography/IngressDocs.d.ts +2 -0
- package/cjs/elements/typography/IngressDocs.js +15 -0
- package/cjs/elements/typography/IngressDocs.js.map +1 -0
- package/cjs/elements/typography/LeadDocs.d.ts +2 -0
- package/cjs/elements/typography/LeadDocs.js +15 -0
- package/cjs/elements/typography/LeadDocs.js.map +1 -0
- package/cjs/elements/typography/PDocs.d.ts +2 -0
- package/cjs/elements/typography/PDocs.js +40 -0
- package/cjs/elements/typography/PDocs.js.map +1 -0
- package/cjs/extensions/forms/DataContext/Context.d.ts +21 -8
- package/cjs/extensions/forms/DataContext/Context.js +1 -2
- package/cjs/extensions/forms/DataContext/Context.js.map +1 -1
- package/cjs/extensions/forms/DataContext/FieldBoundary/FieldBoundaryContext.d.ts +4 -0
- package/cjs/extensions/forms/DataContext/FieldBoundary/FieldBoundaryContext.js.map +1 -1
- package/cjs/extensions/forms/DataContext/FieldBoundary/FieldBoundaryProvider.js +13 -4
- package/cjs/extensions/forms/DataContext/FieldBoundary/FieldBoundaryProvider.js.map +1 -1
- package/cjs/extensions/forms/DataContext/Provider/Provider.d.ts +0 -4
- package/cjs/extensions/forms/DataContext/Provider/Provider.js +85 -49
- package/cjs/extensions/forms/DataContext/Provider/Provider.js.map +1 -1
- package/cjs/extensions/forms/DataContext/Provider/ProviderDocs.js +1 -1
- package/cjs/extensions/forms/DataContext/Provider/ProviderDocs.js.map +1 -1
- package/cjs/extensions/forms/Field/OrganizationNumber/OrganizationNumber.js +34 -5
- package/cjs/extensions/forms/Field/OrganizationNumber/OrganizationNumber.js.map +1 -1
- package/cjs/extensions/forms/Field/PhoneNumber/PhoneNumber.d.ts +5 -4
- package/cjs/extensions/forms/Field/PhoneNumber/PhoneNumber.js +6 -3
- package/cjs/extensions/forms/Field/PhoneNumber/PhoneNumber.js.map +1 -1
- package/cjs/extensions/forms/Field/PhoneNumber/PhoneNumberDocs.d.ts +1 -0
- package/cjs/extensions/forms/Field/PhoneNumber/PhoneNumberDocs.js +65 -2
- package/cjs/extensions/forms/Field/PhoneNumber/PhoneNumberDocs.js.map +1 -1
- package/cjs/extensions/forms/Field/SelectCountry/SelectCountry.d.ts +10 -5
- package/cjs/extensions/forms/Field/SelectCountry/SelectCountry.js +59 -32
- package/cjs/extensions/forms/Field/SelectCountry/SelectCountry.js.map +1 -1
- package/cjs/extensions/forms/Field/SelectCountry/SelectCountryDocs.js +5 -0
- package/cjs/extensions/forms/Field/SelectCountry/SelectCountryDocs.js.map +1 -1
- package/cjs/extensions/forms/FieldBlock/FieldBlock.js +1 -1
- package/cjs/extensions/forms/FieldBlock/FieldBlock.js.map +1 -1
- package/cjs/extensions/forms/Form/Handler/Handler.d.ts +1 -1
- package/cjs/extensions/forms/Form/Handler/Handler.js +3 -1
- package/cjs/extensions/forms/Form/Handler/Handler.js.map +1 -1
- package/cjs/extensions/forms/Form/Isolation/Isolation.js +15 -6
- package/cjs/extensions/forms/Form/Isolation/Isolation.js.map +1 -1
- package/cjs/extensions/forms/Form/Section/EditContainer/EditToolbarTools.js +0 -2
- package/cjs/extensions/forms/Form/Section/EditContainer/EditToolbarTools.js.map +1 -1
- package/cjs/extensions/forms/Form/Visibility/Visibility.js +9 -3
- package/cjs/extensions/forms/Form/Visibility/Visibility.js.map +1 -1
- package/cjs/extensions/forms/Form/Visibility/VisibilityContext.d.ts +6 -0
- package/cjs/extensions/forms/Form/Visibility/VisibilityContext.js +12 -0
- package/cjs/extensions/forms/Form/Visibility/VisibilityContext.js.map +1 -0
- package/cjs/extensions/forms/Form/Visibility/VisibilityDocs.js +1 -1
- package/cjs/extensions/forms/Form/Visibility/VisibilityDocs.js.map +1 -1
- package/cjs/extensions/forms/Form/Visibility/useVisibility.js +3 -3
- package/cjs/extensions/forms/Form/Visibility/useVisibility.js.map +1 -1
- package/cjs/extensions/forms/Form/data-context/getData.d.ts +2 -1
- package/cjs/extensions/forms/Form/data-context/getData.js +6 -1
- package/cjs/extensions/forms/Form/data-context/getData.js.map +1 -1
- package/cjs/extensions/forms/Form/data-context/useData.d.ts +4 -1
- package/cjs/extensions/forms/Form/data-context/useData.js +32 -9
- package/cjs/extensions/forms/Form/data-context/useData.js.map +1 -1
- package/cjs/extensions/forms/Iterate/Array/Array.js +40 -17
- package/cjs/extensions/forms/Iterate/Array/Array.js.map +1 -1
- package/cjs/extensions/forms/Iterate/Array/ArrayDocs.js +11 -1
- package/cjs/extensions/forms/Iterate/Array/ArrayDocs.js.map +1 -1
- package/cjs/extensions/forms/Iterate/Array/ArrayItemArea.d.ts +1 -1
- package/cjs/extensions/forms/Iterate/Array/ArrayItemArea.js.map +1 -1
- package/cjs/extensions/forms/Iterate/Array/types.d.ts +2 -0
- package/cjs/extensions/forms/Iterate/Array/types.js.map +1 -1
- package/cjs/extensions/forms/Iterate/EditContainer/CancelButton.js +19 -7
- package/cjs/extensions/forms/Iterate/EditContainer/CancelButton.js.map +1 -1
- package/cjs/extensions/forms/Iterate/EditContainer/DoneButton.js +0 -1
- package/cjs/extensions/forms/Iterate/EditContainer/DoneButton.js.map +1 -1
- package/cjs/extensions/forms/Iterate/EditContainer/EditContainer.js +2 -2
- package/cjs/extensions/forms/Iterate/EditContainer/EditContainer.js.map +1 -1
- package/cjs/extensions/forms/Iterate/PushButton/PushButton.js +29 -7
- package/cjs/extensions/forms/Iterate/PushButton/PushButton.js.map +1 -1
- package/cjs/extensions/forms/Iterate/PushContainer/OpenButton.js +18 -2
- package/cjs/extensions/forms/Iterate/PushContainer/OpenButton.js.map +1 -1
- package/cjs/extensions/forms/Iterate/PushContainer/PushContainer.d.ts +2 -1
- package/cjs/extensions/forms/Iterate/PushContainer/PushContainer.js +30 -10
- 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/Iterate/RemoveButton/RemoveButton.js +3 -5
- package/cjs/extensions/forms/Iterate/RemoveButton/RemoveButton.js.map +1 -1
- package/cjs/extensions/forms/Iterate/ViewContainer/ViewContainer.js +2 -2
- package/cjs/extensions/forms/Iterate/ViewContainer/ViewContainer.js.map +1 -1
- package/cjs/extensions/forms/Iterate/hooks/index.d.ts +1 -0
- package/cjs/extensions/forms/Iterate/hooks/index.js +7 -0
- package/cjs/extensions/forms/Iterate/hooks/index.js.map +1 -1
- package/cjs/extensions/forms/Iterate/hooks/useArrayLimit.d.ts +15 -0
- package/cjs/extensions/forms/Iterate/hooks/useArrayLimit.js +50 -0
- package/cjs/extensions/forms/Iterate/hooks/useArrayLimit.js.map +1 -0
- package/cjs/extensions/forms/Tools/Log.js +1 -1
- package/cjs/extensions/forms/Tools/Log.js.map +1 -1
- package/cjs/extensions/forms/Value/ArraySelection/ArraySelection.d.ts +12 -0
- package/cjs/extensions/forms/Value/ArraySelection/ArraySelection.js +27 -10
- package/cjs/extensions/forms/Value/ArraySelection/ArraySelection.js.map +1 -1
- package/cjs/extensions/forms/Value/ArraySelection/ArraySelectionDocs.js +10 -0
- package/cjs/extensions/forms/Value/ArraySelection/ArraySelectionDocs.js.map +1 -1
- package/cjs/extensions/forms/Value/Number/Number.js +3 -2
- package/cjs/extensions/forms/Value/Number/Number.js.map +1 -1
- package/cjs/extensions/forms/Value/SelectCountry/SelectCountry.d.ts +1 -0
- package/cjs/extensions/forms/Value/SelectCountry/SelectCountry.js +7 -23
- package/cjs/extensions/forms/Value/SelectCountry/SelectCountry.js.map +1 -1
- package/cjs/extensions/forms/Value/SelectCountry/useCountry.d.ts +4 -0
- package/cjs/extensions/forms/Value/SelectCountry/useCountry.js +33 -0
- package/cjs/extensions/forms/Value/SelectCountry/useCountry.js.map +1 -0
- package/cjs/extensions/forms/Value/Selection/Selection.js +2 -1
- package/cjs/extensions/forms/Value/Selection/Selection.js.map +1 -1
- package/cjs/extensions/forms/Value/ValueDocs.js +5 -0
- package/cjs/extensions/forms/Value/ValueDocs.js.map +1 -1
- package/cjs/extensions/forms/ValueBlock/ValueBlock.js +8 -6
- package/cjs/extensions/forms/ValueBlock/ValueBlock.js.map +1 -1
- package/cjs/extensions/forms/Wizard/Step/Step.d.ts +1 -1
- package/cjs/extensions/forms/Wizard/Step/Step.js.map +1 -1
- package/cjs/extensions/forms/blocks/ChildrenWithAge/ChildrenWithAge.d.ts +4 -2
- package/cjs/extensions/forms/blocks/ChildrenWithAge/ChildrenWithAge.js +40 -22
- package/cjs/extensions/forms/blocks/ChildrenWithAge/ChildrenWithAge.js.map +1 -1
- package/cjs/extensions/forms/blocks/ChildrenWithAge/ChildrenWithAgeDocs.js +10 -0
- package/cjs/extensions/forms/blocks/ChildrenWithAge/ChildrenWithAgeDocs.js.map +1 -1
- package/cjs/extensions/forms/blocks/ChildrenWithAge/ChildrenWithAgeTranslations.js +72 -70
- package/cjs/extensions/forms/blocks/ChildrenWithAge/ChildrenWithAgeTranslations.js.map +1 -1
- package/cjs/extensions/forms/constants/countries.d.ts +1 -0
- package/cjs/extensions/forms/constants/countries.js.map +1 -1
- package/cjs/extensions/forms/constants/locales/en-GB.d.ts +5 -4
- package/cjs/extensions/forms/constants/locales/en-GB.js +8 -7
- package/cjs/extensions/forms/constants/locales/en-GB.js.map +1 -1
- package/cjs/extensions/forms/constants/locales/en-US.d.ts +5 -4
- package/cjs/extensions/forms/constants/locales/index.d.ts +10 -8
- package/cjs/extensions/forms/constants/locales/nb-NO.d.ts +5 -4
- package/cjs/extensions/forms/constants/locales/nb-NO.js +8 -7
- package/cjs/extensions/forms/constants/locales/nb-NO.js.map +1 -1
- package/cjs/extensions/forms/hooks/DataValueDocs.js +1 -1
- package/cjs/extensions/forms/hooks/DataValueDocs.js.map +1 -1
- package/cjs/extensions/forms/hooks/useFieldProps.js +156 -58
- package/cjs/extensions/forms/hooks/useFieldProps.js.map +1 -1
- package/cjs/extensions/forms/hooks/useValueProps.js +31 -8
- package/cjs/extensions/forms/hooks/useValueProps.js.map +1 -1
- package/cjs/extensions/forms/types.d.ts +13 -6
- package/cjs/extensions/forms/types.js.map +1 -1
- package/cjs/shared/Eufemia.d.ts +1 -1
- package/cjs/shared/Eufemia.js +2 -2
- package/cjs/shared/Eufemia.js.map +1 -1
- package/cjs/shared/locales/en-GB.js.map +1 -1
- package/cjs/shared/locales/en-US.d.ts +1 -1
- package/cjs/shared/locales/en-US.js +2 -2
- package/cjs/shared/locales/en-US.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/breadcrumb/BreadcrumbItem.d.ts +1 -1
- package/components/breadcrumb/BreadcrumbItem.js +3 -3
- package/components/breadcrumb/BreadcrumbItem.js.map +1 -1
- package/components/breadcrumb/BreadcrumbMultiple.js +2 -2
- package/components/breadcrumb/BreadcrumbMultiple.js.map +1 -1
- package/components/checkbox/CheckboxDocs.js +1 -1
- package/components/checkbox/CheckboxDocs.js.map +1 -1
- package/components/height-animation/HeightAnimationInstance.d.ts +1 -0
- package/components/height-animation/HeightAnimationInstance.js +13 -6
- package/components/height-animation/HeightAnimationInstance.js.map +1 -1
- package/elements/ElementDocs.d.ts +2 -0
- package/elements/ElementDocs.js +28 -0
- package/elements/ElementDocs.js.map +1 -0
- package/elements/blockquote/BlockquoteDocs.d.ts +2 -0
- package/elements/blockquote/BlockquoteDocs.js +18 -0
- package/elements/blockquote/BlockquoteDocs.js.map +1 -0
- package/elements/hr/HrDocs.d.ts +2 -0
- package/elements/hr/HrDocs.js +18 -0
- package/elements/hr/HrDocs.js.map +1 -0
- package/elements/img/ImgDocs.d.ts +2 -0
- package/elements/img/ImgDocs.js +33 -0
- package/elements/img/ImgDocs.js.map +1 -0
- package/elements/lists/DlDocs.d.ts +2 -0
- package/elements/lists/DlDocs.js +12 -0
- package/elements/lists/DlDocs.js.map +1 -0
- package/elements/lists/OlDocs.d.ts +2 -0
- package/elements/lists/OlDocs.js +22 -0
- package/elements/lists/OlDocs.js.map +1 -0
- package/elements/lists/UlDocs.d.ts +2 -0
- package/elements/lists/UlDocs.js +22 -0
- package/elements/lists/UlDocs.js.map +1 -0
- package/elements/typography/IngressDocs.d.ts +2 -0
- package/elements/typography/IngressDocs.js +6 -0
- package/elements/typography/IngressDocs.js.map +1 -0
- package/elements/typography/LeadDocs.d.ts +2 -0
- package/elements/typography/LeadDocs.js +6 -0
- package/elements/typography/LeadDocs.js.map +1 -0
- package/elements/typography/PDocs.d.ts +2 -0
- package/elements/typography/PDocs.js +33 -0
- package/elements/typography/PDocs.js.map +1 -0
- package/es/components/breadcrumb/BreadcrumbItem.d.ts +1 -1
- package/es/components/breadcrumb/BreadcrumbItem.js +3 -3
- package/es/components/breadcrumb/BreadcrumbItem.js.map +1 -1
- package/es/components/breadcrumb/BreadcrumbMultiple.js +2 -2
- package/es/components/breadcrumb/BreadcrumbMultiple.js.map +1 -1
- package/es/components/checkbox/CheckboxDocs.js +1 -1
- package/es/components/checkbox/CheckboxDocs.js.map +1 -1
- package/es/components/height-animation/HeightAnimationInstance.d.ts +1 -0
- package/es/components/height-animation/HeightAnimationInstance.js +13 -6
- package/es/components/height-animation/HeightAnimationInstance.js.map +1 -1
- package/es/elements/ElementDocs.d.ts +2 -0
- package/es/elements/ElementDocs.js +28 -0
- package/es/elements/ElementDocs.js.map +1 -0
- package/es/elements/blockquote/BlockquoteDocs.d.ts +2 -0
- package/es/elements/blockquote/BlockquoteDocs.js +18 -0
- package/es/elements/blockquote/BlockquoteDocs.js.map +1 -0
- package/es/elements/hr/HrDocs.d.ts +2 -0
- package/es/elements/hr/HrDocs.js +18 -0
- package/es/elements/hr/HrDocs.js.map +1 -0
- package/es/elements/img/ImgDocs.d.ts +2 -0
- package/es/elements/img/ImgDocs.js +33 -0
- package/es/elements/img/ImgDocs.js.map +1 -0
- package/es/elements/lists/DlDocs.d.ts +2 -0
- package/es/elements/lists/DlDocs.js +12 -0
- package/es/elements/lists/DlDocs.js.map +1 -0
- package/es/elements/lists/OlDocs.d.ts +2 -0
- package/es/elements/lists/OlDocs.js +22 -0
- package/es/elements/lists/OlDocs.js.map +1 -0
- package/es/elements/lists/UlDocs.d.ts +2 -0
- package/es/elements/lists/UlDocs.js +22 -0
- package/es/elements/lists/UlDocs.js.map +1 -0
- package/es/elements/typography/IngressDocs.d.ts +2 -0
- package/es/elements/typography/IngressDocs.js +6 -0
- package/es/elements/typography/IngressDocs.js.map +1 -0
- package/es/elements/typography/LeadDocs.d.ts +2 -0
- package/es/elements/typography/LeadDocs.js +6 -0
- package/es/elements/typography/LeadDocs.js.map +1 -0
- package/es/elements/typography/PDocs.d.ts +2 -0
- package/es/elements/typography/PDocs.js +33 -0
- package/es/elements/typography/PDocs.js.map +1 -0
- package/es/extensions/forms/DataContext/Context.d.ts +21 -8
- package/es/extensions/forms/DataContext/Context.js +1 -2
- package/es/extensions/forms/DataContext/Context.js.map +1 -1
- package/es/extensions/forms/DataContext/FieldBoundary/FieldBoundaryContext.d.ts +4 -0
- package/es/extensions/forms/DataContext/FieldBoundary/FieldBoundaryContext.js.map +1 -1
- package/es/extensions/forms/DataContext/FieldBoundary/FieldBoundaryProvider.js +13 -4
- package/es/extensions/forms/DataContext/FieldBoundary/FieldBoundaryProvider.js.map +1 -1
- package/es/extensions/forms/DataContext/Provider/Provider.d.ts +0 -4
- package/es/extensions/forms/DataContext/Provider/Provider.js +83 -47
- package/es/extensions/forms/DataContext/Provider/Provider.js.map +1 -1
- package/es/extensions/forms/DataContext/Provider/ProviderDocs.js +1 -1
- package/es/extensions/forms/DataContext/Provider/ProviderDocs.js.map +1 -1
- package/es/extensions/forms/Field/OrganizationNumber/OrganizationNumber.js +35 -6
- package/es/extensions/forms/Field/OrganizationNumber/OrganizationNumber.js.map +1 -1
- package/es/extensions/forms/Field/PhoneNumber/PhoneNumber.d.ts +5 -4
- package/es/extensions/forms/Field/PhoneNumber/PhoneNumber.js +7 -4
- package/es/extensions/forms/Field/PhoneNumber/PhoneNumber.js.map +1 -1
- package/es/extensions/forms/Field/PhoneNumber/PhoneNumberDocs.d.ts +1 -0
- package/es/extensions/forms/Field/PhoneNumber/PhoneNumberDocs.js +63 -1
- package/es/extensions/forms/Field/PhoneNumber/PhoneNumberDocs.js.map +1 -1
- package/es/extensions/forms/Field/SelectCountry/SelectCountry.d.ts +10 -5
- package/es/extensions/forms/Field/SelectCountry/SelectCountry.js +50 -21
- package/es/extensions/forms/Field/SelectCountry/SelectCountry.js.map +1 -1
- package/es/extensions/forms/Field/SelectCountry/SelectCountryDocs.js +5 -0
- package/es/extensions/forms/Field/SelectCountry/SelectCountryDocs.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/Form/Handler/Handler.d.ts +1 -1
- package/es/extensions/forms/Form/Handler/Handler.js +3 -1
- package/es/extensions/forms/Form/Handler/Handler.js.map +1 -1
- package/es/extensions/forms/Form/Isolation/Isolation.js +15 -6
- package/es/extensions/forms/Form/Isolation/Isolation.js.map +1 -1
- package/es/extensions/forms/Form/Section/EditContainer/EditToolbarTools.js +0 -2
- package/es/extensions/forms/Form/Section/EditContainer/EditToolbarTools.js.map +1 -1
- package/es/extensions/forms/Form/Visibility/Visibility.js +9 -3
- package/es/extensions/forms/Form/Visibility/Visibility.js.map +1 -1
- package/es/extensions/forms/Form/Visibility/VisibilityContext.d.ts +6 -0
- package/es/extensions/forms/Form/Visibility/VisibilityContext.js +6 -0
- package/es/extensions/forms/Form/Visibility/VisibilityContext.js.map +1 -0
- package/es/extensions/forms/Form/Visibility/VisibilityDocs.js +1 -1
- package/es/extensions/forms/Form/Visibility/VisibilityDocs.js.map +1 -1
- package/es/extensions/forms/Form/Visibility/useVisibility.js +3 -3
- package/es/extensions/forms/Form/Visibility/useVisibility.js.map +1 -1
- package/es/extensions/forms/Form/data-context/getData.d.ts +2 -1
- package/es/extensions/forms/Form/data-context/getData.js +6 -1
- package/es/extensions/forms/Form/data-context/getData.js.map +1 -1
- package/es/extensions/forms/Form/data-context/useData.d.ts +4 -1
- package/es/extensions/forms/Form/data-context/useData.js +31 -9
- package/es/extensions/forms/Form/data-context/useData.js.map +1 -1
- package/es/extensions/forms/Iterate/Array/Array.js +43 -20
- package/es/extensions/forms/Iterate/Array/Array.js.map +1 -1
- package/es/extensions/forms/Iterate/Array/ArrayDocs.js +11 -1
- package/es/extensions/forms/Iterate/Array/ArrayDocs.js.map +1 -1
- package/es/extensions/forms/Iterate/Array/ArrayItemArea.d.ts +1 -1
- package/es/extensions/forms/Iterate/Array/ArrayItemArea.js.map +1 -1
- package/es/extensions/forms/Iterate/Array/types.d.ts +2 -0
- package/es/extensions/forms/Iterate/Array/types.js.map +1 -1
- package/es/extensions/forms/Iterate/EditContainer/CancelButton.js +15 -5
- package/es/extensions/forms/Iterate/EditContainer/CancelButton.js.map +1 -1
- package/es/extensions/forms/Iterate/EditContainer/DoneButton.js +0 -1
- package/es/extensions/forms/Iterate/EditContainer/DoneButton.js.map +1 -1
- package/es/extensions/forms/Iterate/EditContainer/EditContainer.js +2 -2
- package/es/extensions/forms/Iterate/EditContainer/EditContainer.js.map +1 -1
- package/es/extensions/forms/Iterate/PushButton/PushButton.js +31 -9
- package/es/extensions/forms/Iterate/PushButton/PushButton.js.map +1 -1
- package/es/extensions/forms/Iterate/PushContainer/OpenButton.js +19 -3
- package/es/extensions/forms/Iterate/PushContainer/OpenButton.js.map +1 -1
- package/es/extensions/forms/Iterate/PushContainer/PushContainer.d.ts +2 -1
- package/es/extensions/forms/Iterate/PushContainer/PushContainer.js +31 -11
- 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/Iterate/RemoveButton/RemoveButton.js +4 -6
- package/es/extensions/forms/Iterate/RemoveButton/RemoveButton.js.map +1 -1
- package/es/extensions/forms/Iterate/ViewContainer/ViewContainer.js +2 -2
- package/es/extensions/forms/Iterate/ViewContainer/ViewContainer.js.map +1 -1
- package/es/extensions/forms/Iterate/hooks/index.d.ts +1 -0
- package/es/extensions/forms/Iterate/hooks/index.js +1 -0
- package/es/extensions/forms/Iterate/hooks/index.js.map +1 -1
- package/es/extensions/forms/Iterate/hooks/useArrayLimit.d.ts +15 -0
- package/es/extensions/forms/Iterate/hooks/useArrayLimit.js +43 -0
- package/es/extensions/forms/Iterate/hooks/useArrayLimit.js.map +1 -0
- package/es/extensions/forms/Tools/Log.js +1 -1
- package/es/extensions/forms/Tools/Log.js.map +1 -1
- package/es/extensions/forms/Value/ArraySelection/ArraySelection.d.ts +12 -0
- package/es/extensions/forms/Value/ArraySelection/ArraySelection.js +26 -9
- package/es/extensions/forms/Value/ArraySelection/ArraySelection.js.map +1 -1
- package/es/extensions/forms/Value/ArraySelection/ArraySelectionDocs.js +10 -0
- package/es/extensions/forms/Value/ArraySelection/ArraySelectionDocs.js.map +1 -1
- package/es/extensions/forms/Value/Number/Number.js +3 -2
- package/es/extensions/forms/Value/Number/Number.js.map +1 -1
- package/es/extensions/forms/Value/SelectCountry/SelectCountry.d.ts +1 -0
- package/es/extensions/forms/Value/SelectCountry/SelectCountry.js +7 -22
- package/es/extensions/forms/Value/SelectCountry/SelectCountry.js.map +1 -1
- package/es/extensions/forms/Value/SelectCountry/useCountry.d.ts +4 -0
- package/es/extensions/forms/Value/SelectCountry/useCountry.js +27 -0
- package/es/extensions/forms/Value/SelectCountry/useCountry.js.map +1 -0
- package/es/extensions/forms/Value/Selection/Selection.js +2 -1
- package/es/extensions/forms/Value/Selection/Selection.js.map +1 -1
- package/es/extensions/forms/Value/ValueDocs.js +5 -0
- package/es/extensions/forms/Value/ValueDocs.js.map +1 -1
- package/es/extensions/forms/ValueBlock/ValueBlock.js +8 -6
- package/es/extensions/forms/ValueBlock/ValueBlock.js.map +1 -1
- package/es/extensions/forms/Wizard/Step/Step.d.ts +1 -1
- package/es/extensions/forms/Wizard/Step/Step.js.map +1 -1
- package/es/extensions/forms/blocks/ChildrenWithAge/ChildrenWithAge.d.ts +4 -2
- package/es/extensions/forms/blocks/ChildrenWithAge/ChildrenWithAge.js +40 -22
- package/es/extensions/forms/blocks/ChildrenWithAge/ChildrenWithAge.js.map +1 -1
- package/es/extensions/forms/blocks/ChildrenWithAge/ChildrenWithAgeDocs.js +10 -0
- package/es/extensions/forms/blocks/ChildrenWithAge/ChildrenWithAgeDocs.js.map +1 -1
- package/es/extensions/forms/blocks/ChildrenWithAge/ChildrenWithAgeTranslations.js +72 -70
- package/es/extensions/forms/blocks/ChildrenWithAge/ChildrenWithAgeTranslations.js.map +1 -1
- package/es/extensions/forms/constants/countries.d.ts +1 -0
- package/es/extensions/forms/constants/countries.js.map +1 -1
- package/es/extensions/forms/constants/locales/en-GB.d.ts +5 -4
- package/es/extensions/forms/constants/locales/en-GB.js +8 -7
- package/es/extensions/forms/constants/locales/en-GB.js.map +1 -1
- package/es/extensions/forms/constants/locales/en-US.d.ts +5 -4
- package/es/extensions/forms/constants/locales/index.d.ts +10 -8
- package/es/extensions/forms/constants/locales/nb-NO.d.ts +5 -4
- package/es/extensions/forms/constants/locales/nb-NO.js +8 -7
- package/es/extensions/forms/constants/locales/nb-NO.js.map +1 -1
- package/es/extensions/forms/hooks/DataValueDocs.js +1 -1
- package/es/extensions/forms/hooks/DataValueDocs.js.map +1 -1
- package/es/extensions/forms/hooks/useFieldProps.js +149 -54
- package/es/extensions/forms/hooks/useFieldProps.js.map +1 -1
- package/es/extensions/forms/hooks/useValueProps.js +32 -9
- package/es/extensions/forms/hooks/useValueProps.js.map +1 -1
- package/es/extensions/forms/types.d.ts +13 -6
- package/es/extensions/forms/types.js.map +1 -1
- package/es/shared/Eufemia.d.ts +1 -1
- package/es/shared/Eufemia.js +2 -2
- package/es/shared/Eufemia.js.map +1 -1
- package/es/shared/locales/en-GB.js.map +1 -1
- package/es/shared/locales/en-US.d.ts +1 -1
- package/es/shared/locales/en-US.js +2 -2
- package/es/shared/locales/en-US.js.map +1 -1
- package/es/style/core/scopes.scss +1 -1
- package/es/style/dnb-ui-basis.css +1 -1
- package/es/style/dnb-ui-basis.min.css +1 -1
- package/es/style/dnb-ui-body.css +1 -1
- package/es/style/dnb-ui-body.min.css +1 -1
- package/es/style/dnb-ui-core.css +1 -1
- package/es/style/dnb-ui-core.min.css +1 -1
- package/esm/dnb-ui-basis.min.mjs +1 -1
- package/esm/dnb-ui-components.min.mjs +1 -1
- package/esm/dnb-ui-elements.min.mjs +1 -1
- package/esm/dnb-ui-extensions.min.mjs +3 -3
- package/esm/dnb-ui-lib.min.mjs +1 -1
- package/extensions/forms/DataContext/Context.d.ts +21 -8
- package/extensions/forms/DataContext/Context.js +1 -2
- package/extensions/forms/DataContext/Context.js.map +1 -1
- package/extensions/forms/DataContext/FieldBoundary/FieldBoundaryContext.d.ts +4 -0
- package/extensions/forms/DataContext/FieldBoundary/FieldBoundaryContext.js.map +1 -1
- package/extensions/forms/DataContext/FieldBoundary/FieldBoundaryProvider.js +13 -4
- package/extensions/forms/DataContext/FieldBoundary/FieldBoundaryProvider.js.map +1 -1
- package/extensions/forms/DataContext/Provider/Provider.d.ts +0 -4
- package/extensions/forms/DataContext/Provider/Provider.js +85 -47
- package/extensions/forms/DataContext/Provider/Provider.js.map +1 -1
- package/extensions/forms/DataContext/Provider/ProviderDocs.js +1 -1
- package/extensions/forms/DataContext/Provider/ProviderDocs.js.map +1 -1
- package/extensions/forms/Field/OrganizationNumber/OrganizationNumber.js +35 -6
- package/extensions/forms/Field/OrganizationNumber/OrganizationNumber.js.map +1 -1
- package/extensions/forms/Field/PhoneNumber/PhoneNumber.d.ts +5 -4
- package/extensions/forms/Field/PhoneNumber/PhoneNumber.js +7 -4
- package/extensions/forms/Field/PhoneNumber/PhoneNumber.js.map +1 -1
- package/extensions/forms/Field/PhoneNumber/PhoneNumberDocs.d.ts +1 -0
- package/extensions/forms/Field/PhoneNumber/PhoneNumberDocs.js +63 -1
- package/extensions/forms/Field/PhoneNumber/PhoneNumberDocs.js.map +1 -1
- package/extensions/forms/Field/SelectCountry/SelectCountry.d.ts +10 -5
- package/extensions/forms/Field/SelectCountry/SelectCountry.js +59 -33
- package/extensions/forms/Field/SelectCountry/SelectCountry.js.map +1 -1
- package/extensions/forms/Field/SelectCountry/SelectCountryDocs.js +5 -0
- package/extensions/forms/Field/SelectCountry/SelectCountryDocs.js.map +1 -1
- package/extensions/forms/FieldBlock/FieldBlock.js +1 -1
- package/extensions/forms/FieldBlock/FieldBlock.js.map +1 -1
- package/extensions/forms/Form/Handler/Handler.d.ts +1 -1
- package/extensions/forms/Form/Handler/Handler.js +3 -1
- package/extensions/forms/Form/Handler/Handler.js.map +1 -1
- package/extensions/forms/Form/Isolation/Isolation.js +15 -6
- package/extensions/forms/Form/Isolation/Isolation.js.map +1 -1
- package/extensions/forms/Form/Section/EditContainer/EditToolbarTools.js +0 -2
- package/extensions/forms/Form/Section/EditContainer/EditToolbarTools.js.map +1 -1
- package/extensions/forms/Form/Visibility/Visibility.js +9 -3
- package/extensions/forms/Form/Visibility/Visibility.js.map +1 -1
- package/extensions/forms/Form/Visibility/VisibilityContext.d.ts +6 -0
- package/extensions/forms/Form/Visibility/VisibilityContext.js +6 -0
- package/extensions/forms/Form/Visibility/VisibilityContext.js.map +1 -0
- package/extensions/forms/Form/Visibility/VisibilityDocs.js +1 -1
- package/extensions/forms/Form/Visibility/VisibilityDocs.js.map +1 -1
- package/extensions/forms/Form/Visibility/useVisibility.js +3 -3
- package/extensions/forms/Form/Visibility/useVisibility.js.map +1 -1
- package/extensions/forms/Form/data-context/getData.d.ts +2 -1
- package/extensions/forms/Form/data-context/getData.js +6 -1
- package/extensions/forms/Form/data-context/getData.js.map +1 -1
- package/extensions/forms/Form/data-context/useData.d.ts +4 -1
- package/extensions/forms/Form/data-context/useData.js +32 -9
- package/extensions/forms/Form/data-context/useData.js.map +1 -1
- package/extensions/forms/Iterate/Array/Array.js +43 -20
- package/extensions/forms/Iterate/Array/Array.js.map +1 -1
- package/extensions/forms/Iterate/Array/ArrayDocs.js +11 -1
- package/extensions/forms/Iterate/Array/ArrayDocs.js.map +1 -1
- package/extensions/forms/Iterate/Array/ArrayItemArea.d.ts +1 -1
- package/extensions/forms/Iterate/Array/ArrayItemArea.js.map +1 -1
- package/extensions/forms/Iterate/Array/types.d.ts +2 -0
- package/extensions/forms/Iterate/Array/types.js.map +1 -1
- package/extensions/forms/Iterate/EditContainer/CancelButton.js +18 -7
- package/extensions/forms/Iterate/EditContainer/CancelButton.js.map +1 -1
- package/extensions/forms/Iterate/EditContainer/DoneButton.js +0 -1
- package/extensions/forms/Iterate/EditContainer/DoneButton.js.map +1 -1
- package/extensions/forms/Iterate/EditContainer/EditContainer.js +2 -2
- package/extensions/forms/Iterate/EditContainer/EditContainer.js.map +1 -1
- package/extensions/forms/Iterate/PushButton/PushButton.js +31 -9
- package/extensions/forms/Iterate/PushButton/PushButton.js.map +1 -1
- package/extensions/forms/Iterate/PushContainer/OpenButton.js +19 -3
- package/extensions/forms/Iterate/PushContainer/OpenButton.js.map +1 -1
- package/extensions/forms/Iterate/PushContainer/PushContainer.d.ts +2 -1
- package/extensions/forms/Iterate/PushContainer/PushContainer.js +31 -11
- 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/Iterate/RemoveButton/RemoveButton.js +4 -6
- package/extensions/forms/Iterate/RemoveButton/RemoveButton.js.map +1 -1
- package/extensions/forms/Iterate/ViewContainer/ViewContainer.js +2 -2
- package/extensions/forms/Iterate/ViewContainer/ViewContainer.js.map +1 -1
- package/extensions/forms/Iterate/hooks/index.d.ts +1 -0
- package/extensions/forms/Iterate/hooks/index.js +1 -0
- package/extensions/forms/Iterate/hooks/index.js.map +1 -1
- package/extensions/forms/Iterate/hooks/useArrayLimit.d.ts +15 -0
- package/extensions/forms/Iterate/hooks/useArrayLimit.js +44 -0
- package/extensions/forms/Iterate/hooks/useArrayLimit.js.map +1 -0
- package/extensions/forms/Tools/Log.js +1 -1
- package/extensions/forms/Tools/Log.js.map +1 -1
- package/extensions/forms/Value/ArraySelection/ArraySelection.d.ts +12 -0
- package/extensions/forms/Value/ArraySelection/ArraySelection.js +27 -10
- package/extensions/forms/Value/ArraySelection/ArraySelection.js.map +1 -1
- package/extensions/forms/Value/ArraySelection/ArraySelectionDocs.js +10 -0
- package/extensions/forms/Value/ArraySelection/ArraySelectionDocs.js.map +1 -1
- package/extensions/forms/Value/Number/Number.js +3 -2
- package/extensions/forms/Value/Number/Number.js.map +1 -1
- package/extensions/forms/Value/SelectCountry/SelectCountry.d.ts +1 -0
- package/extensions/forms/Value/SelectCountry/SelectCountry.js +7 -22
- package/extensions/forms/Value/SelectCountry/SelectCountry.js.map +1 -1
- package/extensions/forms/Value/SelectCountry/useCountry.d.ts +4 -0
- package/extensions/forms/Value/SelectCountry/useCountry.js +27 -0
- package/extensions/forms/Value/SelectCountry/useCountry.js.map +1 -0
- package/extensions/forms/Value/Selection/Selection.js +2 -1
- package/extensions/forms/Value/Selection/Selection.js.map +1 -1
- package/extensions/forms/Value/ValueDocs.js +5 -0
- package/extensions/forms/Value/ValueDocs.js.map +1 -1
- package/extensions/forms/ValueBlock/ValueBlock.js +8 -6
- package/extensions/forms/ValueBlock/ValueBlock.js.map +1 -1
- package/extensions/forms/Wizard/Step/Step.d.ts +1 -1
- package/extensions/forms/Wizard/Step/Step.js.map +1 -1
- package/extensions/forms/blocks/ChildrenWithAge/ChildrenWithAge.d.ts +4 -2
- package/extensions/forms/blocks/ChildrenWithAge/ChildrenWithAge.js +40 -22
- package/extensions/forms/blocks/ChildrenWithAge/ChildrenWithAge.js.map +1 -1
- package/extensions/forms/blocks/ChildrenWithAge/ChildrenWithAgeDocs.js +10 -0
- package/extensions/forms/blocks/ChildrenWithAge/ChildrenWithAgeDocs.js.map +1 -1
- package/extensions/forms/blocks/ChildrenWithAge/ChildrenWithAgeTranslations.js +72 -70
- package/extensions/forms/blocks/ChildrenWithAge/ChildrenWithAgeTranslations.js.map +1 -1
- package/extensions/forms/constants/countries.d.ts +1 -0
- package/extensions/forms/constants/countries.js.map +1 -1
- package/extensions/forms/constants/locales/en-GB.d.ts +5 -4
- package/extensions/forms/constants/locales/en-GB.js +8 -7
- package/extensions/forms/constants/locales/en-GB.js.map +1 -1
- package/extensions/forms/constants/locales/en-US.d.ts +5 -4
- package/extensions/forms/constants/locales/index.d.ts +10 -8
- package/extensions/forms/constants/locales/nb-NO.d.ts +5 -4
- package/extensions/forms/constants/locales/nb-NO.js +8 -7
- package/extensions/forms/constants/locales/nb-NO.js.map +1 -1
- package/extensions/forms/hooks/DataValueDocs.js +1 -1
- package/extensions/forms/hooks/DataValueDocs.js.map +1 -1
- package/extensions/forms/hooks/useFieldProps.js +154 -58
- package/extensions/forms/hooks/useFieldProps.js.map +1 -1
- package/extensions/forms/hooks/useValueProps.js +32 -9
- package/extensions/forms/hooks/useValueProps.js.map +1 -1
- package/extensions/forms/types.d.ts +13 -6
- package/extensions/forms/types.js.map +1 -1
- package/package.json +1 -1
- package/shared/Eufemia.d.ts +1 -1
- package/shared/Eufemia.js +2 -2
- package/shared/Eufemia.js.map +1 -1
- package/shared/locales/en-GB.js.map +1 -1
- package/shared/locales/en-US.d.ts +1 -1
- package/shared/locales/en-US.js +2 -2
- package/shared/locales/en-US.js.map +1 -1
- package/style/core/scopes.scss +1 -1
- package/style/dnb-ui-basis.css +1 -1
- package/style/dnb-ui-basis.min.css +1 -1
- package/style/dnb-ui-body.css +1 -1
- package/style/dnb-ui-body.min.css +1 -1
- package/style/dnb-ui-core.css +1 -1
- package/style/dnb-ui-core.min.css +1 -1
- package/umd/dnb-ui-basis.min.js +1 -1
- package/umd/dnb-ui-components.min.js +1 -1
- package/umd/dnb-ui-elements.min.js +1 -1
- package/umd/dnb-ui-extensions.min.js +3 -3
- package/umd/dnb-ui-lib.min.js +1 -1
- package/cjs/extensions/forms/Form/Section/EditContainer/useEditContainerToolbar.d.ts +0 -1
- package/cjs/extensions/forms/Form/Section/EditContainer/useEditContainerToolbar.js +0 -25
- package/cjs/extensions/forms/Form/Section/EditContainer/useEditContainerToolbar.js.map +0 -1
- package/es/extensions/forms/Form/Section/EditContainer/useEditContainerToolbar.d.ts +0 -1
- package/es/extensions/forms/Form/Section/EditContainer/useEditContainerToolbar.js +0 -19
- package/es/extensions/forms/Form/Section/EditContainer/useEditContainerToolbar.js.map +0 -1
- package/extensions/forms/Form/Section/EditContainer/useEditContainerToolbar.d.ts +0 -1
- package/extensions/forms/Form/Section/EditContainer/useEditContainerToolbar.js +0 -19
- package/extensions/forms/Form/Section/EditContainer/useEditContainerToolbar.js.map +0 -1
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
4
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
5
|
-
const _excluded = ["className"];
|
|
5
|
+
const _excluded = ["text", "children", "className"];
|
|
6
6
|
import React, { useCallback, useContext } from 'react';
|
|
7
7
|
import classnames from 'classnames';
|
|
8
8
|
import { Button } from '../../../../components';
|
|
9
9
|
import IterateItemContext from '../IterateItemContext';
|
|
10
|
-
import {
|
|
10
|
+
import { useTranslation } from '../../hooks';
|
|
11
11
|
import ArrayItemAreaContext from '../Array/ArrayItemAreaContext';
|
|
12
12
|
import { omitDataValueReadWriteProps } from '../../types';
|
|
13
13
|
import { trash } from '../../../../icons';
|
|
@@ -20,13 +20,11 @@ function RemoveButton(props) {
|
|
|
20
20
|
throw new Error('RemoveButton must be inside an Iterate.Array');
|
|
21
21
|
}
|
|
22
22
|
const {
|
|
23
|
+
text,
|
|
24
|
+
children,
|
|
23
25
|
className
|
|
24
26
|
} = props,
|
|
25
27
|
restProps = _objectWithoutProperties(props, _excluded);
|
|
26
|
-
const {
|
|
27
|
-
children,
|
|
28
|
-
text
|
|
29
|
-
} = useFieldProps(restProps);
|
|
30
28
|
const buttonProps = omitDataValueReadWriteProps(restProps);
|
|
31
29
|
const translation = useTranslation().RemoveButton;
|
|
32
30
|
const textContent = text || children || translation.text;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RemoveButton.js","names":["React","useCallback","useContext","classnames","Button","IterateItemContext","
|
|
1
|
+
{"version":3,"file":"RemoveButton.js","names":["React","useCallback","useContext","classnames","Button","IterateItemContext","useTranslation","ArrayItemAreaContext","omitDataValueReadWriteProps","trash","RemoveButton","props","iterateItemContext","handleRemove","Error","text","children","className","restProps","_objectWithoutProperties","_excluded","buttonProps","translation","textContent","elementBlockContext","handleRemoveItem","handleClick","createElement","_extends","variant","icon","icon_position","on_click","_supportsSpacingProps"],"sources":["../../../../../../src/extensions/forms/Iterate/RemoveButton/RemoveButton.tsx"],"sourcesContent":["import React, { useCallback, useContext } from 'react'\nimport classnames from 'classnames'\nimport { Button } from '../../../../components'\nimport { ButtonProps } from '../../../../components/Button'\nimport IterateItemContext from '../IterateItemContext'\nimport { useTranslation } from '../../hooks'\nimport ArrayItemAreaContext from '../Array/ArrayItemAreaContext'\nimport {\n DataValueReadWriteComponentProps,\n omitDataValueReadWriteProps,\n} from '../../types'\nimport { trash } from '../../../../icons'\n\nexport type Props = ButtonProps &\n DataValueReadWriteComponentProps<unknown[]>\n\nfunction RemoveButton(props: Props) {\n const iterateItemContext = useContext(IterateItemContext)\n const { handleRemove } = iterateItemContext || {}\n\n if (!iterateItemContext) {\n throw new Error('RemoveButton must be inside an Iterate.Array')\n }\n\n const { text, children, className, ...restProps } = props\n const buttonProps = omitDataValueReadWriteProps(restProps)\n const translation = useTranslation().RemoveButton\n const textContent = text || children || translation.text\n\n const elementBlockContext = useContext(ArrayItemAreaContext)\n const { handleRemoveItem } = elementBlockContext || {}\n\n const handleClick = useCallback(() => {\n if (handleRemoveItem) {\n handleRemoveItem?.()\n } else {\n handleRemove?.()\n }\n }, [handleRemove, handleRemoveItem])\n\n return (\n <Button\n className={classnames(\n 'dnb-forms-iterate-remove-element-button',\n className\n )}\n variant={textContent ? 'tertiary' : 'secondary'}\n icon={trash}\n icon_position=\"left\"\n on_click={handleClick}\n {...buttonProps}\n >\n {textContent}\n </Button>\n )\n}\n\nRemoveButton._supportsSpacingProps = true\nexport default RemoveButton\n"],"mappings":";;;;;AAAA,OAAOA,KAAK,IAAIC,WAAW,EAAEC,UAAU,QAAQ,OAAO;AACtD,OAAOC,UAAU,MAAM,YAAY;AACnC,SAASC,MAAM,QAAQ,wBAAwB;AAE/C,OAAOC,kBAAkB,MAAM,uBAAuB;AACtD,SAASC,cAAc,QAAQ,aAAa;AAC5C,OAAOC,oBAAoB,MAAM,+BAA+B;AAChE,SAEEC,2BAA2B,QACtB,aAAa;AACpB,SAASC,KAAK,QAAQ,mBAAmB;AAKzC,SAASC,YAAYA,CAACC,KAAY,EAAE;EAClC,MAAMC,kBAAkB,GAAGV,UAAU,CAACG,kBAAkB,CAAC;EACzD,MAAM;IAAEQ;EAAa,CAAC,GAAGD,kBAAkB,IAAI,CAAC,CAAC;EAEjD,IAAI,CAACA,kBAAkB,EAAE;IACvB,MAAM,IAAIE,KAAK,CAAC,8CAA8C,CAAC;EACjE;EAEA,MAAM;MAAEC,IAAI;MAAEC,QAAQ;MAAEC;IAAwB,CAAC,GAAGN,KAAK;IAAnBO,SAAS,GAAAC,wBAAA,CAAKR,KAAK,EAAAS,SAAA;EACzD,MAAMC,WAAW,GAAGb,2BAA2B,CAACU,SAAS,CAAC;EAC1D,MAAMI,WAAW,GAAGhB,cAAc,CAAC,CAAC,CAACI,YAAY;EACjD,MAAMa,WAAW,GAAGR,IAAI,IAAIC,QAAQ,IAAIM,WAAW,CAACP,IAAI;EAExD,MAAMS,mBAAmB,GAAGtB,UAAU,CAACK,oBAAoB,CAAC;EAC5D,MAAM;IAAEkB;EAAiB,CAAC,GAAGD,mBAAmB,IAAI,CAAC,CAAC;EAEtD,MAAME,WAAW,GAAGzB,WAAW,CAAC,MAAM;IACpC,IAAIwB,gBAAgB,EAAE;MACpBA,gBAAgB,aAAhBA,gBAAgB,uBAAhBA,gBAAgB,CAAG,CAAC;IACtB,CAAC,MAAM;MACLZ,YAAY,aAAZA,YAAY,uBAAZA,YAAY,CAAG,CAAC;IAClB;EACF,CAAC,EAAE,CAACA,YAAY,EAAEY,gBAAgB,CAAC,CAAC;EAEpC,OACEzB,KAAA,CAAA2B,aAAA,CAACvB,MAAM,EAAAwB,QAAA;IACLX,SAAS,EAAEd,UAAU,CACnB,yCAAyC,EACzCc,SACF,CAAE;IACFY,OAAO,EAAEN,WAAW,GAAG,UAAU,GAAG,WAAY;IAChDO,IAAI,EAAErB,KAAM;IACZsB,aAAa,EAAC,MAAM;IACpBC,QAAQ,EAAEN;EAAY,GAClBL,WAAW,GAEdE,WACK,CAAC;AAEb;AAEAb,YAAY,CAACuB,qBAAqB,GAAG,IAAI;AACzC,eAAevB,YAAY"}
|
|
@@ -31,8 +31,8 @@ function ViewContainer(props) {
|
|
|
31
31
|
} = useContext(IterateItemContext);
|
|
32
32
|
let itemTitle = title;
|
|
33
33
|
let ariaLabel = useMemo(() => convertJsxToString(itemTitle), [itemTitle]);
|
|
34
|
-
if (ariaLabel.includes('{
|
|
35
|
-
itemTitle = ariaLabel = ariaLabel.replace('{
|
|
34
|
+
if (ariaLabel.includes('{itemNo}')) {
|
|
35
|
+
itemTitle = ariaLabel = ariaLabel.replace('{itemNo}', index + 1);
|
|
36
36
|
}
|
|
37
37
|
let toolbarElement = toolbar;
|
|
38
38
|
if (toolbarVariant === 'minimumOneItem' && arrayValue.length <= 1) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ViewContainer.js","names":["React","useContext","useMemo","classnames","convertJsxToString","Flex","Lead","ArrayItemArea","IterateItemContext","Toolbar","EditButton","RemoveButton","ViewContainer","props","_toolbarElement","_ref","children","className","title","toolbar","toolbarVariant","restProps","_objectWithoutProperties","_excluded","index","arrayValue","itemTitle","ariaLabel","includes","replace","toolbarElement","length","_Toolbar","createElement","hasToolbar","Children","toArray","some","child","_extends","mode","Stack","size","_Toolbar2","_supportsSpacingProps"],"sources":["../../../../../../src/extensions/forms/Iterate/ViewContainer/ViewContainer.tsx"],"sourcesContent":["import React, { useContext, useMemo } from 'react'\nimport classnames from 'classnames'\nimport { convertJsxToString } from '../../../../shared/component-helper'\nimport { Flex } from '../../../../components'\nimport { Props as FlexContainerProps } from '../../../../components/flex/Container'\nimport { Lead } from '../../../../elements'\nimport ArrayItemArea, { ArrayItemAreaProps } from '../Array/ArrayItemArea'\nimport IterateItemContext from '../IterateItemContext'\nimport Toolbar from '../Toolbar'\nimport EditButton from './EditButton'\nimport RemoveButton from './RemoveButton'\n\nexport type Props = {\n /**\n * The title of the ViewContainer.\n */\n title?: React.ReactNode\n /**\n * An alternative toolbar to be shown in the ViewContainer.\n */\n toolbar?: React.ReactNode\n /**\n * The variant of the toolbar.\n */\n toolbarVariant?: 'minimumOneItem'\n}\n\nexport type AllProps = Props & FlexContainerProps & ArrayItemAreaProps\n\nfunction ViewContainer(props: AllProps) {\n const {\n children,\n className,\n title,\n toolbar,\n toolbarVariant,\n ...restProps\n } = props || {}\n const { index, arrayValue } = useContext(IterateItemContext)\n\n let itemTitle = title\n let ariaLabel = useMemo(() => convertJsxToString(itemTitle), [itemTitle])\n if (ariaLabel.includes('{
|
|
1
|
+
{"version":3,"file":"ViewContainer.js","names":["React","useContext","useMemo","classnames","convertJsxToString","Flex","Lead","ArrayItemArea","IterateItemContext","Toolbar","EditButton","RemoveButton","ViewContainer","props","_toolbarElement","_ref","children","className","title","toolbar","toolbarVariant","restProps","_objectWithoutProperties","_excluded","index","arrayValue","itemTitle","ariaLabel","includes","replace","toolbarElement","length","_Toolbar","createElement","hasToolbar","Children","toArray","some","child","_extends","mode","Stack","size","_Toolbar2","_supportsSpacingProps"],"sources":["../../../../../../src/extensions/forms/Iterate/ViewContainer/ViewContainer.tsx"],"sourcesContent":["import React, { useContext, useMemo } from 'react'\nimport classnames from 'classnames'\nimport { convertJsxToString } from '../../../../shared/component-helper'\nimport { Flex } from '../../../../components'\nimport { Props as FlexContainerProps } from '../../../../components/flex/Container'\nimport { Lead } from '../../../../elements'\nimport ArrayItemArea, { ArrayItemAreaProps } from '../Array/ArrayItemArea'\nimport IterateItemContext from '../IterateItemContext'\nimport Toolbar from '../Toolbar'\nimport EditButton from './EditButton'\nimport RemoveButton from './RemoveButton'\n\nexport type Props = {\n /**\n * The title of the ViewContainer.\n */\n title?: React.ReactNode\n /**\n * An alternative toolbar to be shown in the ViewContainer.\n */\n toolbar?: React.ReactNode\n /**\n * The variant of the toolbar.\n */\n toolbarVariant?: 'minimumOneItem'\n}\n\nexport type AllProps = Props & FlexContainerProps & ArrayItemAreaProps\n\nfunction ViewContainer(props: AllProps) {\n const {\n children,\n className,\n title,\n toolbar,\n toolbarVariant,\n ...restProps\n } = props || {}\n const { index, arrayValue } = useContext(IterateItemContext)\n\n let itemTitle = title\n let ariaLabel = useMemo(() => convertJsxToString(itemTitle), [itemTitle])\n if (ariaLabel.includes('{itemNo}')) {\n itemTitle = ariaLabel = ariaLabel.replace('{itemNo}', index + 1)\n }\n\n let toolbarElement = toolbar\n if (toolbarVariant === 'minimumOneItem' && arrayValue.length <= 1) {\n toolbarElement = (\n <Toolbar>\n <EditButton />\n </Toolbar>\n )\n }\n\n const hasToolbar =\n !toolbarElement &&\n React.Children.toArray(children).some((child) => {\n return child?.['type'] === Toolbar\n })\n\n return (\n <ArrayItemArea\n mode=\"view\"\n ariaLabel={ariaLabel}\n className={classnames('dnb-forms-section-view-block', className)}\n {...restProps}\n >\n <Flex.Stack>\n {itemTitle && <Lead size=\"basis\">{itemTitle}</Lead>}\n {children}\n {hasToolbar\n ? null\n : toolbarElement ?? (\n <Toolbar>\n <EditButton />\n <RemoveButton />\n </Toolbar>\n )}\n </Flex.Stack>\n </ArrayItemArea>\n )\n}\n\nViewContainer.EditButton = EditButton\nViewContainer.RemoveButton = RemoveButton\n\nViewContainer._supportsSpacingProps = true\nexport default ViewContainer\n"],"mappings":";;;;;;AAAA,OAAOA,KAAK,IAAIC,UAAU,EAAEC,OAAO,QAAQ,OAAO;AAClD,OAAOC,UAAU,MAAM,YAAY;AACnC,SAASC,kBAAkB,QAAQ,qCAAqC;AACxE,SAASC,IAAI,QAAQ,wBAAwB;AAE7C,SAASC,IAAI,QAAQ,sBAAsB;AAC3C,OAAOC,aAAa,MAA8B,wBAAwB;AAC1E,OAAOC,kBAAkB,MAAM,uBAAuB;AACtD,OAAOC,OAAO,MAAM,YAAY;AAChC,OAAOC,UAAU,MAAM,cAAc;AACrC,OAAOC,YAAY,MAAM,gBAAgB;AAmBzC,SAASC,aAAaA,CAACC,KAAe,EAAE;EAAA,IAAAC,eAAA;EACtC,MAAAC,IAAA,GAOIF,KAAK,IAAI,CAAC,CAAC;IAPT;MACJG,QAAQ;MACRC,SAAS;MACTC,KAAK;MACLC,OAAO;MACPC;IAEF,CAAC,GAAAL,IAAA;IADIM,SAAS,GAAAC,wBAAA,CAAAP,IAAA,EAAAQ,SAAA;EAEd,MAAM;IAAEC,KAAK;IAAEC;EAAW,CAAC,GAAGxB,UAAU,CAACO,kBAAkB,CAAC;EAE5D,IAAIkB,SAAS,GAAGR,KAAK;EACrB,IAAIS,SAAS,GAAGzB,OAAO,CAAC,MAAME,kBAAkB,CAACsB,SAAS,CAAC,EAAE,CAACA,SAAS,CAAC,CAAC;EACzE,IAAIC,SAAS,CAACC,QAAQ,CAAC,UAAU,CAAC,EAAE;IAClCF,SAAS,GAAGC,SAAS,GAAGA,SAAS,CAACE,OAAO,CAAC,UAAU,EAAEL,KAAK,GAAG,CAAC,CAAC;EAClE;EAEA,IAAIM,cAAc,GAAGX,OAAO;EAC5B,IAAIC,cAAc,KAAK,gBAAgB,IAAIK,UAAU,CAACM,MAAM,IAAI,CAAC,EAAE;IACjED,cAAc,GAAAE,QAAA,KAAAA,QAAA,GACZhC,KAAA,CAAAiC,aAAA,CAACxB,OAAO,QACNT,KAAA,CAAAiC,aAAA,CAACvB,UAAU,MAAE,CACN,CAAC,CACX;EACH;EAEA,MAAMwB,UAAU,GACd,CAACJ,cAAc,IACf9B,KAAK,CAACmC,QAAQ,CAACC,OAAO,CAACpB,QAAQ,CAAC,CAACqB,IAAI,CAAEC,KAAK,IAAK;IAC/C,OAAO,CAAAA,KAAK,aAALA,KAAK,uBAALA,KAAK,CAAG,MAAM,CAAC,MAAK7B,OAAO;EACpC,CAAC,CAAC;EAEJ,OACET,KAAA,CAAAiC,aAAA,CAAC1B,aAAa,EAAAgC,QAAA;IACZC,IAAI,EAAC,MAAM;IACXb,SAAS,EAAEA,SAAU;IACrBV,SAAS,EAAEd,UAAU,CAAC,8BAA8B,EAAEc,SAAS;EAAE,GAC7DI,SAAS,GAEbrB,KAAA,CAAAiC,aAAA,CAAC5B,IAAI,CAACoC,KAAK,QACRf,SAAS,IAAI1B,KAAA,CAAAiC,aAAA,CAAC3B,IAAI;IAACoC,IAAI,EAAC;EAAO,GAAEhB,SAAgB,CAAC,EAClDV,QAAQ,EACRkB,UAAU,GACP,IAAI,IAAApB,eAAA,GACJgB,cAAc,cAAAhB,eAAA,cAAAA,eAAA,GAAA6B,SAAA,KAAAA,SAAA,GACZ3C,KAAA,CAAAiC,aAAA,CAACxB,OAAO,QACNT,KAAA,CAAAiC,aAAA,CAACvB,UAAU,MAAE,CAAC,EACdV,KAAA,CAAAiC,aAAA,CAACtB,YAAY,MAAE,CACR,CAAC,CAEN,CACC,CAAC;AAEpB;AAEAC,aAAa,CAACF,UAAU,GAAGA,UAAU;AACrCE,aAAa,CAACD,YAAY,GAAGA,YAAY;AAEzCC,aAAa,CAACgC,qBAAqB,GAAG,IAAI;AAC1C,eAAehC,aAAa"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["default","useItem","useSwitchContainerMode"],"sources":["../../../../../../src/extensions/forms/Iterate/hooks/index.ts"],"sourcesContent":["export { default as useItem } from './useItem'\nexport { default as useSwitchContainerMode } from './useSwitchContainerMode'\n"],"mappings":"AAAA,SAASA,OAAO,IAAIC,OAAO,QAAQ,WAAW;AAC9C,SAASD,OAAO,IAAIE,sBAAsB,QAAQ,0BAA0B"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["default","useItem","useSwitchContainerMode","useArrayLimit"],"sources":["../../../../../../src/extensions/forms/Iterate/hooks/index.ts"],"sourcesContent":["export { default as useItem } from './useItem'\nexport { default as useSwitchContainerMode } from './useSwitchContainerMode'\nexport { default as useArrayLimit } from './useArrayLimit'\n"],"mappings":"AAAA,SAASA,OAAO,IAAIC,OAAO,QAAQ,WAAW;AAC9C,SAASD,OAAO,IAAIE,sBAAsB,QAAQ,0BAA0B;AAC5E,SAASF,OAAO,IAAIG,aAAa,QAAQ,iBAAiB"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Path } from '../../types';
|
|
2
|
+
type SharedState = {
|
|
3
|
+
show?: boolean;
|
|
4
|
+
limit?: number;
|
|
5
|
+
total?: number;
|
|
6
|
+
};
|
|
7
|
+
export default function useArrayLimit({ path }: {
|
|
8
|
+
path: Path;
|
|
9
|
+
}): {
|
|
10
|
+
setShowStatus: (show: boolean) => void;
|
|
11
|
+
setLimitProps: (props: Omit<SharedState, 'show'>) => void;
|
|
12
|
+
error: Error;
|
|
13
|
+
hasReachedLimit: boolean;
|
|
14
|
+
};
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { useCallback } from 'react';
|
|
2
|
+
import { useTranslation } from '../../hooks';
|
|
3
|
+
import { useSharedState } from '../../../../shared/helpers/useSharedState';
|
|
4
|
+
export default function useArrayLimit(_ref) {
|
|
5
|
+
let {
|
|
6
|
+
path
|
|
7
|
+
} = _ref;
|
|
8
|
+
const sharedState = useSharedState(path + '-iterate-limit');
|
|
9
|
+
const {
|
|
10
|
+
set,
|
|
11
|
+
update,
|
|
12
|
+
extend,
|
|
13
|
+
data
|
|
14
|
+
} = sharedState || {};
|
|
15
|
+
const {
|
|
16
|
+
limit,
|
|
17
|
+
total,
|
|
18
|
+
show
|
|
19
|
+
} = data || {};
|
|
20
|
+
const setLimitProps = useCallback(props => {
|
|
21
|
+
if (props.total !== total) {
|
|
22
|
+
update(props);
|
|
23
|
+
} else {
|
|
24
|
+
set(props);
|
|
25
|
+
}
|
|
26
|
+
}, [set, total, update]);
|
|
27
|
+
const setShowStatus = useCallback(show => {
|
|
28
|
+
extend({
|
|
29
|
+
show
|
|
30
|
+
});
|
|
31
|
+
}, [extend]);
|
|
32
|
+
const hasReachedLimit = typeof limit === 'number' && total >= limit;
|
|
33
|
+
const {
|
|
34
|
+
itemsLimitReached
|
|
35
|
+
} = useTranslation().IteratePushContainer;
|
|
36
|
+
const error = show ? new Error(itemsLimitReached.replace('{limit}', String(limit))) : undefined;
|
|
37
|
+
return {
|
|
38
|
+
setShowStatus,
|
|
39
|
+
setLimitProps,
|
|
40
|
+
error,
|
|
41
|
+
hasReachedLimit
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=useArrayLimit.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useArrayLimit.js","names":["useCallback","useTranslation","useSharedState","useArrayLimit","_ref","path","sharedState","set","update","extend","data","limit","total","show","setLimitProps","props","setShowStatus","hasReachedLimit","itemsLimitReached","IteratePushContainer","error","Error","replace","String","undefined"],"sources":["../../../../../../src/extensions/forms/Iterate/hooks/useArrayLimit.tsx"],"sourcesContent":["import { useCallback } from 'react'\nimport { useTranslation } from '../../hooks'\nimport { Path } from '../../types'\nimport { useSharedState } from '../../../../shared/helpers/useSharedState'\n\ntype SharedState = {\n show?: boolean\n limit?: number\n total?: number\n}\n\nexport default function useArrayLimit({ path }: { path: Path }) {\n const sharedState = useSharedState<SharedState>(path + '-iterate-limit')\n const { set, update, extend, data } = sharedState || {}\n const { limit, total, show } = data || {}\n\n const setLimitProps = useCallback(\n (props: Omit<SharedState, 'show'>) => {\n if (props.total !== total) {\n update(props)\n } else {\n set(props)\n }\n },\n [set, total, update]\n )\n\n const setShowStatus = useCallback(\n (show: boolean) => {\n extend({ show })\n },\n [extend]\n )\n\n const hasReachedLimit = typeof limit === 'number' && total >= limit\n const { itemsLimitReached } = useTranslation().IteratePushContainer\n const error = show\n ? new Error(itemsLimitReached.replace('{limit}', String(limit)))\n : undefined\n\n return { setShowStatus, setLimitProps, error, hasReachedLimit }\n}\n"],"mappings":"AAAA,SAASA,WAAW,QAAQ,OAAO;AACnC,SAASC,cAAc,QAAQ,aAAa;AAE5C,SAASC,cAAc,QAAQ,2CAA2C;AAQ1E,eAAe,SAASC,aAAaA,CAAAC,IAAA,EAA2B;EAAA,IAA1B;IAAEC;EAAqB,CAAC,GAAAD,IAAA;EAC5D,MAAME,WAAW,GAAGJ,cAAc,CAAcG,IAAI,GAAG,gBAAgB,CAAC;EACxE,MAAM;IAAEE,GAAG;IAAEC,MAAM;IAAEC,MAAM;IAAEC;EAAK,CAAC,GAAGJ,WAAW,IAAI,CAAC,CAAC;EACvD,MAAM;IAAEK,KAAK;IAAEC,KAAK;IAAEC;EAAK,CAAC,GAAGH,IAAI,IAAI,CAAC,CAAC;EAEzC,MAAMI,aAAa,GAAGd,WAAW,CAC9Be,KAAgC,IAAK;IACpC,IAAIA,KAAK,CAACH,KAAK,KAAKA,KAAK,EAAE;MACzBJ,MAAM,CAACO,KAAK,CAAC;IACf,CAAC,MAAM;MACLR,GAAG,CAACQ,KAAK,CAAC;IACZ;EACF,CAAC,EACD,CAACR,GAAG,EAAEK,KAAK,EAAEJ,MAAM,CACrB,CAAC;EAED,MAAMQ,aAAa,GAAGhB,WAAW,CAC9Ba,IAAa,IAAK;IACjBJ,MAAM,CAAC;MAAEI;IAAK,CAAC,CAAC;EAClB,CAAC,EACD,CAACJ,MAAM,CACT,CAAC;EAED,MAAMQ,eAAe,GAAG,OAAON,KAAK,KAAK,QAAQ,IAAIC,KAAK,IAAID,KAAK;EACnE,MAAM;IAAEO;EAAkB,CAAC,GAAGjB,cAAc,CAAC,CAAC,CAACkB,oBAAoB;EACnE,MAAMC,KAAK,GAAGP,IAAI,GACd,IAAIQ,KAAK,CAACH,iBAAiB,CAACI,OAAO,CAAC,SAAS,EAAEC,MAAM,CAACZ,KAAK,CAAC,CAAC,CAAC,GAC9Da,SAAS;EAEb,OAAO;IAAER,aAAa;IAAEF,aAAa;IAAEM,KAAK;IAAEH;EAAgB,CAAC;AACjE"}
|
|
@@ -15,7 +15,7 @@ function Log(props) {
|
|
|
15
15
|
maxWidth: '80vw'
|
|
16
16
|
},
|
|
17
17
|
innerSpace: true
|
|
18
|
-
}, props), React.createElement("pre", null, JSON.stringify(data), ' '));
|
|
18
|
+
}, props), React.createElement("pre", null, JSON.stringify(data, null, 2), ' '));
|
|
19
19
|
}
|
|
20
20
|
Log._supportsSpacingProps = true;
|
|
21
21
|
export default Log;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Log.js","names":["useContext","DataContext","Section","Log","props","data","React","createElement","_extends","element","backgroundColor","style","maxWidth","innerSpace","JSON","stringify","_supportsSpacingProps"],"sources":["../../../../../src/extensions/forms/Tools/Log.tsx"],"sourcesContent":["import { useContext } from 'react'\nimport DataContext from '../DataContext/Context'\nimport Section, { SectionProps } from '../../../components/Section'\n\nfunction Log(props: SectionProps) {\n const { data } = useContext(DataContext)\n\n return (\n <Section\n element=\"output\"\n backgroundColor=\"sand-yellow\"\n style={{ maxWidth: '80vw' }}\n innerSpace\n {...props}\n >\n <pre>\n {JSON.stringify(data)}\n {' ' /* Ensure one line of spacing */}\n </pre>\n </Section>\n )\n}\n\nLog._supportsSpacingProps = true\nexport default Log\n"],"mappings":";;;AAAA,SAASA,UAAU,QAAQ,OAAO;AAClC,OAAOC,WAAW,MAAM,wBAAwB;AAChD,OAAOC,OAAO,MAAwB,6BAA6B;AAEnE,SAASC,GAAGA,CAACC,KAAmB,EAAE;EAChC,MAAM;IAAEC;EAAK,CAAC,GAAGL,UAAU,CAACC,WAAW,CAAC;EAExC,OACEK,KAAA,CAAAC,aAAA,CAACL,OAAO,EAAAM,QAAA;IACNC,OAAO,EAAC,QAAQ;IAChBC,eAAe,EAAC,aAAa;IAC7BC,KAAK,EAAE;MAAEC,QAAQ,EAAE;IAAO,CAAE;IAC5BC,UAAU;EAAA,GACNT,KAAK,GAETE,KAAA,CAAAC,aAAA,cACGO,IAAI,CAACC,SAAS,CAACV,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"Log.js","names":["useContext","DataContext","Section","Log","props","data","React","createElement","_extends","element","backgroundColor","style","maxWidth","innerSpace","JSON","stringify","_supportsSpacingProps"],"sources":["../../../../../src/extensions/forms/Tools/Log.tsx"],"sourcesContent":["import { useContext } from 'react'\nimport DataContext from '../DataContext/Context'\nimport Section, { SectionProps } from '../../../components/Section'\n\nfunction Log(props: SectionProps) {\n const { data } = useContext(DataContext)\n\n return (\n <Section\n element=\"output\"\n backgroundColor=\"sand-yellow\"\n style={{ maxWidth: '80vw' }}\n innerSpace\n {...props}\n >\n <pre>\n {JSON.stringify(data, null, 2)}\n {' ' /* Ensure one line of spacing */}\n </pre>\n </Section>\n )\n}\n\nLog._supportsSpacingProps = true\nexport default Log\n"],"mappings":";;;AAAA,SAASA,UAAU,QAAQ,OAAO;AAClC,OAAOC,WAAW,MAAM,wBAAwB;AAChD,OAAOC,OAAO,MAAwB,6BAA6B;AAEnE,SAASC,GAAGA,CAACC,KAAmB,EAAE;EAChC,MAAM;IAAEC;EAAK,CAAC,GAAGL,UAAU,CAACC,WAAW,CAAC;EAExC,OACEK,KAAA,CAAAC,aAAA,CAACL,OAAO,EAAAM,QAAA;IACNC,OAAO,EAAC,QAAQ;IAChBC,eAAe,EAAC,aAAa;IAC7BC,KAAK,EAAE;MAAEC,QAAQ,EAAE;IAAO,CAAE;IAC5BC,UAAU;EAAA,GACNT,KAAK,GAETE,KAAA,CAAAC,aAAA,cACGO,IAAI,CAACC,SAAS,CAACV,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,EAC7B,GACE,CACE,CAAC;AAEd;AAEAF,GAAG,CAACa,qBAAqB,GAAG,IAAI;AAChC,eAAeb,GAAG"}
|
|
@@ -6,6 +6,18 @@ export type Props = ValueProps<Array<number | string>> & {
|
|
|
6
6
|
* See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/ListFormat/ListFormat
|
|
7
7
|
*/
|
|
8
8
|
format?: Intl.ListFormatOptions;
|
|
9
|
+
/**
|
|
10
|
+
* Defines if the value should be displayed in list format or reuglar text format on one line.
|
|
11
|
+
* Default: `text`
|
|
12
|
+
*/
|
|
13
|
+
variant?: 'ol' | 'ul' | 'text';
|
|
14
|
+
/**
|
|
15
|
+
* Defines the type of list styling used for list variants. Used on conjuction with variant `ol` and `ul`.
|
|
16
|
+
* Variant `ol`: `a`, `A`, `i`, `I` and `1`.
|
|
17
|
+
* Variant `ul`: `cirlce`, `disc` and `square`.
|
|
18
|
+
* Default: `undefined`
|
|
19
|
+
*/
|
|
20
|
+
listType?: 'a' | 'A' | 'i' | 'I' | '1' | 'circle' | 'disc' | 'square' | undefined;
|
|
9
21
|
};
|
|
10
22
|
declare function ArraySelection(props: Props): import("react/jsx-runtime").JSX.Element;
|
|
11
23
|
declare namespace ArraySelection {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
4
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
5
|
-
const _excluded = ["path", "value", "format", "className"];
|
|
5
|
+
const _excluded = ["path", "value", "format", "className", "variant", "listType"];
|
|
6
6
|
import React, { useContext, useMemo } from 'react';
|
|
7
7
|
import classnames from 'classnames';
|
|
8
8
|
import { useValueProps } from '../../hooks';
|
|
@@ -11,6 +11,7 @@ import { LOCALE } from '../../../../shared/defaults';
|
|
|
11
11
|
import { convertJsxToString } from '../../../../shared/component-helper';
|
|
12
12
|
import SharedContext from '../../../../shared/Context';
|
|
13
13
|
import Context from '../../DataContext/Context';
|
|
14
|
+
import { Li, Ol, Ul } from '../../../../elements';
|
|
14
15
|
function ArraySelection(props) {
|
|
15
16
|
const {
|
|
16
17
|
locale
|
|
@@ -23,28 +24,44 @@ function ArraySelection(props) {
|
|
|
23
24
|
path,
|
|
24
25
|
value,
|
|
25
26
|
format,
|
|
26
|
-
className
|
|
27
|
+
className,
|
|
28
|
+
variant = 'text',
|
|
29
|
+
listType
|
|
27
30
|
} = _useValueProps,
|
|
28
31
|
rest = _objectWithoutProperties(_useValueProps, _excluded);
|
|
29
32
|
const list = useMemo(() => {
|
|
33
|
+
const isListVariant = variant !== 'text';
|
|
30
34
|
if (path) {
|
|
31
35
|
var _fieldPropsRef$curren, _data$map;
|
|
32
36
|
const data = fieldPropsRef === null || fieldPropsRef === void 0 ? void 0 : (_fieldPropsRef$curren = fieldPropsRef.current) === null || _fieldPropsRef$curren === void 0 ? void 0 : _fieldPropsRef$curren[path + '/arraySelectionData'];
|
|
33
|
-
return (data === null || data === void 0 ? void 0 : (_data$map = data.map) === null || _data$map === void 0 ? void 0 : _data$map.call(data, _ref => {
|
|
37
|
+
return (data === null || data === void 0 ? void 0 : (_data$map = data.map) === null || _data$map === void 0 ? void 0 : _data$map.call(data, (_ref, index) => {
|
|
34
38
|
let {
|
|
35
39
|
title
|
|
36
40
|
} = _ref;
|
|
37
|
-
return
|
|
41
|
+
return isListVariant ? React.createElement(Li, {
|
|
42
|
+
key: index
|
|
43
|
+
}, convertJsxToString(title)) : convertJsxToString(title);
|
|
38
44
|
})) || value;
|
|
39
45
|
}
|
|
40
|
-
return value
|
|
41
|
-
|
|
46
|
+
return isListVariant ? value.map((value, index) => React.createElement(Li, {
|
|
47
|
+
key: index
|
|
48
|
+
}, convertJsxToString(value))) : value;
|
|
49
|
+
}, [fieldPropsRef, path, value, variant]);
|
|
50
|
+
const listValue = useMemo(() => {
|
|
51
|
+
if (variant === 'text') {
|
|
52
|
+
return listFormat(list, {
|
|
53
|
+
locale,
|
|
54
|
+
format
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
const ListElement = variant.startsWith('ol') ? Ol : Ul;
|
|
58
|
+
return React.createElement(ListElement, {
|
|
59
|
+
type: listType
|
|
60
|
+
}, list);
|
|
61
|
+
}, [format, list, locale, variant, listType]);
|
|
42
62
|
return React.createElement(ValueBlock, _extends({
|
|
43
63
|
className: classnames('dnb-forms-value-array-selection', className)
|
|
44
|
-
}, rest),
|
|
45
|
-
locale,
|
|
46
|
-
format
|
|
47
|
-
}));
|
|
64
|
+
}, rest), listValue);
|
|
48
65
|
}
|
|
49
66
|
export function listFormat(value, _ref2) {
|
|
50
67
|
let {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ArraySelection.js","names":["React","useContext","useMemo","classnames","useValueProps","ValueBlock","LOCALE","convertJsxToString","SharedContext","Context","ArraySelection","props","locale","fieldPropsRef","_useValueProps","path","value","format","className","rest","_objectWithoutProperties","_excluded","list","_fieldPropsRef$curren","_data$map","data","current","map","call","_ref","title","createElement","
|
|
1
|
+
{"version":3,"file":"ArraySelection.js","names":["React","useContext","useMemo","classnames","useValueProps","ValueBlock","LOCALE","convertJsxToString","SharedContext","Context","Li","Ol","Ul","ArraySelection","props","locale","fieldPropsRef","_useValueProps","path","value","format","className","variant","listType","rest","_objectWithoutProperties","_excluded","list","isListVariant","_fieldPropsRef$curren","_data$map","data","current","map","call","_ref","index","title","createElement","key","listValue","listFormat","ListElement","startsWith","type","_extends","_ref2","style","separator","Array","isArray","formatter","Intl","ListFormat","v","String","error","join","_supportsSpacingProps"],"sources":["../../../../../../src/extensions/forms/Value/ArraySelection/ArraySelection.tsx"],"sourcesContent":["import React, { useContext, useMemo } from 'react'\nimport classnames from 'classnames'\nimport { useValueProps } from '../../hooks'\nimport { ValueProps } from '../../types'\nimport ValueBlock from '../../ValueBlock'\nimport { LOCALE } from '../../../../shared/defaults'\nimport { convertJsxToString } from '../../../../shared/component-helper'\nimport SharedContext, { InternalLocale } from '../../../../shared/Context'\nimport Context from '../../DataContext/Context'\nimport { Li, Ol, Ul } from '../../../../elements'\n\nexport type Props = ValueProps<Array<number | string>> & {\n /**\n * Formatting options for the value.\n * See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/ListFormat/ListFormat\n */\n format?: Intl.ListFormatOptions\n /**\n * Defines if the value should be displayed in list format or reuglar text format on one line.\n * Default: `text`\n */\n variant?: 'ol' | 'ul' | 'text'\n /**\n * Defines the type of list styling used for list variants. Used on conjuction with variant `ol` and `ul`.\n * Variant `ol`: `a`, `A`, `i`, `I` and `1`.\n * Variant `ul`: `cirlce`, `disc` and `square`.\n * Default: `undefined`\n */\n listType?:\n | 'a'\n | 'A'\n | 'i'\n | 'I'\n | '1'\n | 'circle'\n | 'disc'\n | 'square'\n | undefined\n}\n\nfunction ArraySelection(props: Props) {\n const { locale } = useContext(SharedContext)\n const { fieldPropsRef } = useContext(Context) || {}\n const {\n path,\n value,\n format,\n className,\n variant = 'text',\n listType,\n ...rest\n } = useValueProps(props)\n\n const list = useMemo(() => {\n const isListVariant = variant !== 'text'\n\n if (path) {\n const data = fieldPropsRef?.current?.[\n path + '/arraySelectionData'\n ] as Array<{\n value: string\n title: string | React.ReactNode\n }>\n\n return (\n data?.map?.(({ title }, index) =>\n isListVariant ? (\n <Li key={index}>{convertJsxToString(title)}</Li>\n ) : (\n convertJsxToString(title)\n )\n ) || value\n )\n }\n\n return isListVariant\n ? value.map((value, index) => (\n <Li key={index}>{convertJsxToString(value)}</Li>\n ))\n : value\n }, [fieldPropsRef, path, value, variant])\n\n const listValue = useMemo(() => {\n if (variant === 'text') {\n return listFormat(list, { locale, format })\n }\n\n const ListElement = variant.startsWith('ol') ? Ol : Ul\n\n return <ListElement type={listType}>{list}</ListElement>\n }, [format, list, locale, variant, listType])\n\n return (\n <ValueBlock\n className={classnames('dnb-forms-value-array-selection', className)}\n {...rest}\n >\n {listValue}\n </ValueBlock>\n )\n}\n\nexport function listFormat(\n value: Array<number | string>,\n {\n locale = LOCALE,\n format = {\n style: 'long',\n type: 'conjunction',\n },\n separator = ', ',\n }: {\n locale?: InternalLocale\n format?: Intl.ListFormatOptions\n separator?: string\n }\n) {\n if (!Array.isArray(value)) {\n return value\n }\n try {\n const formatter = new Intl.ListFormat(locale, format)\n return formatter.format(value.map((v) => String(v)))\n } catch (error) {\n return value.join(separator)\n }\n}\n\nArraySelection._supportsSpacingProps = true\nexport default ArraySelection\n"],"mappings":";;;;;AAAA,OAAOA,KAAK,IAAIC,UAAU,EAAEC,OAAO,QAAQ,OAAO;AAClD,OAAOC,UAAU,MAAM,YAAY;AACnC,SAASC,aAAa,QAAQ,aAAa;AAE3C,OAAOC,UAAU,MAAM,kBAAkB;AACzC,SAASC,MAAM,QAAQ,6BAA6B;AACpD,SAASC,kBAAkB,QAAQ,qCAAqC;AACxE,OAAOC,aAAa,MAA0B,4BAA4B;AAC1E,OAAOC,OAAO,MAAM,2BAA2B;AAC/C,SAASC,EAAE,EAAEC,EAAE,EAAEC,EAAE,QAAQ,sBAAsB;AA+BjD,SAASC,cAAcA,CAACC,KAAY,EAAE;EACpC,MAAM;IAAEC;EAAO,CAAC,GAAGd,UAAU,CAACO,aAAa,CAAC;EAC5C,MAAM;IAAEQ;EAAc,CAAC,GAAGf,UAAU,CAACQ,OAAO,CAAC,IAAI,CAAC,CAAC;EACnD,MAAAQ,cAAA,GAQIb,aAAa,CAACU,KAAK,CAAC;IARlB;MACJI,IAAI;MACJC,KAAK;MACLC,MAAM;MACNC,SAAS;MACTC,OAAO,GAAG,MAAM;MAChBC;IAEF,CAAC,GAAAN,cAAA;IADIO,IAAI,GAAAC,wBAAA,CAAAR,cAAA,EAAAS,SAAA;EAGT,MAAMC,IAAI,GAAGzB,OAAO,CAAC,MAAM;IACzB,MAAM0B,aAAa,GAAGN,OAAO,KAAK,MAAM;IAExC,IAAIJ,IAAI,EAAE;MAAA,IAAAW,qBAAA,EAAAC,SAAA;MACR,MAAMC,IAAI,GAAGf,aAAa,aAAbA,aAAa,wBAAAa,qBAAA,GAAbb,aAAa,CAAEgB,OAAO,cAAAH,qBAAA,uBAAtBA,qBAAA,CACXX,IAAI,GAAG,qBAAqB,CAI5B;MAEF,OACE,CAAAa,IAAI,aAAJA,IAAI,wBAAAD,SAAA,GAAJC,IAAI,CAAEE,GAAG,cAAAH,SAAA,uBAATA,SAAA,CAAAI,IAAA,CAAAH,IAAI,EAAQ,CAAAI,IAAA,EAAYC,KAAK;QAAA,IAAhB;UAAEC;QAAM,CAAC,GAAAF,IAAA;QAAA,OACpBP,aAAa,GACX5B,KAAA,CAAAsC,aAAA,CAAC5B,EAAE;UAAC6B,GAAG,EAAEH;QAAM,GAAE7B,kBAAkB,CAAC8B,KAAK,CAAM,CAAC,GAEhD9B,kBAAkB,CAAC8B,KAAK,CACzB;MAAA,CACH,CAAC,KAAIlB,KAAK;IAEd;IAEA,OAAOS,aAAa,GAChBT,KAAK,CAACc,GAAG,CAAC,CAACd,KAAK,EAAEiB,KAAK,KACrBpC,KAAA,CAAAsC,aAAA,CAAC5B,EAAE;MAAC6B,GAAG,EAAEH;IAAM,GAAE7B,kBAAkB,CAACY,KAAK,CAAM,CAChD,CAAC,GACFA,KAAK;EACX,CAAC,EAAE,CAACH,aAAa,EAAEE,IAAI,EAAEC,KAAK,EAAEG,OAAO,CAAC,CAAC;EAEzC,MAAMkB,SAAS,GAAGtC,OAAO,CAAC,MAAM;IAC9B,IAAIoB,OAAO,KAAK,MAAM,EAAE;MACtB,OAAOmB,UAAU,CAACd,IAAI,EAAE;QAAEZ,MAAM;QAAEK;MAAO,CAAC,CAAC;IAC7C;IAEA,MAAMsB,WAAW,GAAGpB,OAAO,CAACqB,UAAU,CAAC,IAAI,CAAC,GAAGhC,EAAE,GAAGC,EAAE;IAEtD,OAAOZ,KAAA,CAAAsC,aAAA,CAACI,WAAW;MAACE,IAAI,EAAErB;IAAS,GAAEI,IAAkB,CAAC;EAC1D,CAAC,EAAE,CAACP,MAAM,EAAEO,IAAI,EAAEZ,MAAM,EAAEO,OAAO,EAAEC,QAAQ,CAAC,CAAC;EAE7C,OACEvB,KAAA,CAAAsC,aAAA,CAACjC,UAAU,EAAAwC,QAAA;IACTxB,SAAS,EAAElB,UAAU,CAAC,iCAAiC,EAAEkB,SAAS;EAAE,GAChEG,IAAI,GAEPgB,SACS,CAAC;AAEjB;AAEA,OAAO,SAASC,UAAUA,CACxBtB,KAA6B,EAAA2B,KAAA,EAa7B;EAAA,IAZA;IACE/B,MAAM,GAAGT,MAAM;IACfc,MAAM,GAAG;MACP2B,KAAK,EAAE,MAAM;MACbH,IAAI,EAAE;IACR,CAAC;IACDI,SAAS,GAAG;EAKd,CAAC,GAAAF,KAAA;EAED,IAAI,CAACG,KAAK,CAACC,OAAO,CAAC/B,KAAK,CAAC,EAAE;IACzB,OAAOA,KAAK;EACd;EACA,IAAI;IACF,MAAMgC,SAAS,GAAG,IAAIC,IAAI,CAACC,UAAU,CAACtC,MAAM,EAAEK,MAAM,CAAC;IACrD,OAAO+B,SAAS,CAAC/B,MAAM,CAACD,KAAK,CAACc,GAAG,CAAEqB,CAAC,IAAKC,MAAM,CAACD,CAAC,CAAC,CAAC,CAAC;EACtD,CAAC,CAAC,OAAOE,KAAK,EAAE;IACd,OAAOrC,KAAK,CAACsC,IAAI,CAACT,SAAS,CAAC;EAC9B;AACF;AAEAnC,cAAc,CAAC6C,qBAAqB,GAAG,IAAI;AAC3C,eAAe7C,cAAc"}
|
|
@@ -3,6 +3,16 @@ export const ArraySelectionProperties = {
|
|
|
3
3
|
doc: 'Formatting options for the value. See the [Intl.ListFormat](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/ListFormat/ListFormat) documentation.',
|
|
4
4
|
type: 'Intl.ListFormatOptions',
|
|
5
5
|
status: 'optional'
|
|
6
|
+
},
|
|
7
|
+
variant: {
|
|
8
|
+
doc: 'Defines if the value should be displayed in list format, or reuglar text format on one line. Defaults to `text`',
|
|
9
|
+
type: ['ol', 'ul', 'text'],
|
|
10
|
+
status: 'optional'
|
|
11
|
+
},
|
|
12
|
+
listType: {
|
|
13
|
+
doc: 'Defines the type of list styling used for list variants. Used on conjuction with variant `ol` and `ul`. Variant `ol`: `a`, `A`, `i`, `I` and `1`. Variant `ul`: `cirlce`, `disc` and `square`. Defaults to `undefined`',
|
|
14
|
+
type: ['a', 'A', 'i', 'I', '1', 'circle', 'disc', 'square', 'undefined'],
|
|
15
|
+
status: 'optional'
|
|
6
16
|
}
|
|
7
17
|
};
|
|
8
18
|
//# sourceMappingURL=ArraySelectionDocs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ArraySelectionDocs.js","names":["ArraySelectionProperties","format","doc","type","status"],"sources":["../../../../../../src/extensions/forms/Value/ArraySelection/ArraySelectionDocs.ts"],"sourcesContent":["import { PropertiesTableProps } from '../../../../shared/types'\n\nexport const ArraySelectionProperties: PropertiesTableProps = {\n format: {\n doc: 'Formatting options for the value. See the [Intl.ListFormat](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/ListFormat/ListFormat) documentation.',\n type: 'Intl.ListFormatOptions',\n status: 'optional',\n },\n}\n"],"mappings":"AAEA,OAAO,MAAMA,wBAA8C,GAAG;EAC5DC,MAAM,EAAE;IACNC,GAAG,EAAE,yLAAyL;IAC9LC,IAAI,EAAE,wBAAwB;IAC9BC,MAAM,EAAE;EACV;AACF,CAAC"}
|
|
1
|
+
{"version":3,"file":"ArraySelectionDocs.js","names":["ArraySelectionProperties","format","doc","type","status","variant","listType"],"sources":["../../../../../../src/extensions/forms/Value/ArraySelection/ArraySelectionDocs.ts"],"sourcesContent":["import { PropertiesTableProps } from '../../../../shared/types'\n\nexport const ArraySelectionProperties: PropertiesTableProps = {\n format: {\n doc: 'Formatting options for the value. See the [Intl.ListFormat](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/ListFormat/ListFormat) documentation.',\n type: 'Intl.ListFormatOptions',\n status: 'optional',\n },\n variant: {\n doc: 'Defines if the value should be displayed in list format, or reuglar text format on one line. Defaults to `text`',\n type: ['ol', 'ul', 'text'],\n status: 'optional',\n },\n listType: {\n doc: 'Defines the type of list styling used for list variants. Used on conjuction with variant `ol` and `ul`. Variant `ol`: `a`, `A`, `i`, `I` and `1`. Variant `ul`: `cirlce`, `disc` and `square`. Defaults to `undefined`',\n type: [\n 'a',\n 'A',\n 'i',\n 'I',\n '1',\n 'circle',\n 'disc',\n 'square',\n 'undefined',\n ],\n status: 'optional',\n },\n}\n"],"mappings":"AAEA,OAAO,MAAMA,wBAA8C,GAAG;EAC5DC,MAAM,EAAE;IACNC,GAAG,EAAE,yLAAyL;IAC9LC,IAAI,EAAE,wBAAwB;IAC9BC,MAAM,EAAE;EACV,CAAC;EACDC,OAAO,EAAE;IACPH,GAAG,EAAE,iHAAiH;IACtHC,IAAI,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,CAAC;IAC1BC,MAAM,EAAE;EACV,CAAC;EACDE,QAAQ,EAAE;IACRJ,GAAG,EAAE,wNAAwN;IAC7NC,IAAI,EAAE,CACJ,GAAG,EACH,GAAG,EACH,GAAG,EACH,GAAG,EACH,GAAG,EACH,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,WAAW,CACZ;IACDC,MAAM,EAAE;EACV;AACF,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
|
-
const _excluded = ["value", "minimum", "maximum", "inline", "showEmpty", "className"];
|
|
3
|
+
const _excluded = ["value", "minimum", "maximum", "inline", "showEmpty", "className", "path"];
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import classnames from 'classnames';
|
|
6
6
|
import ValueBlock from '../../ValueBlock';
|
|
@@ -16,7 +16,8 @@ function NumberValue(props) {
|
|
|
16
16
|
maximum = Number.MAX_SAFE_INTEGER,
|
|
17
17
|
inline,
|
|
18
18
|
showEmpty,
|
|
19
|
-
className
|
|
19
|
+
className,
|
|
20
|
+
path
|
|
20
21
|
} = _useValueProps,
|
|
21
22
|
rest = _objectWithoutProperties(_useValueProps, _excluded);
|
|
22
23
|
const numberFormatProps = convertCamelCaseProps(omitSpacingProps(rest));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Number.js","names":["React","classnames","ValueBlock","useValueProps","omitSpacingProps","NumberFormat","convertCamelCaseProps","NumberValue","props","_useValueProps","value","valueProp","minimum","Number","MIN_SAFE_INTEGER","maximum","MAX_SAFE_INTEGER","inline","showEmpty","className","rest","_objectWithoutProperties","_excluded","numberFormatProps","createElement","_extends","_supportsSpacingProps"],"sources":["../../../../../../src/extensions/forms/Value/Number/Number.tsx"],"sourcesContent":["import React from 'react'\nimport classnames from 'classnames'\nimport ValueBlock from '../../ValueBlock'\nimport useValueProps from '../../hooks/useValueProps'\nimport { ValueProps } from '../../types'\nimport { omitSpacingProps } from '../../../../components/flex/utils'\nimport NumberFormat, {\n NumberFormatProps,\n} from '../../../../components/NumberFormat'\nimport {\n IncludeCamelCase,\n convertCamelCaseProps,\n} from '../../../../shared/helpers/withCamelCaseProps'\n\nexport type Props = Omit<ValueProps<number>, 'defaultValue'> &\n IncludeCamelCase<NumberFormatProps> &\n Partial<{\n defaultValue?: number | string\n minimum?: number\n maximum?: number\n }>\n\nfunction NumberValue(props: Props) {\n const {\n value: valueProp,\n minimum = Number.MIN_SAFE_INTEGER,\n maximum = Number.MAX_SAFE_INTEGER,\n inline,\n showEmpty,\n className,\n ...rest\n } = useValueProps(props)\n const numberFormatProps = convertCamelCaseProps(omitSpacingProps(rest))\n\n let value = valueProp\n if (value < minimum) {\n value = minimum\n }\n if (value > maximum) {\n value = maximum\n }\n\n return (\n <ValueBlock\n className={classnames('dnb-forms-value-number', className)}\n inline={inline}\n showEmpty={showEmpty}\n {...rest}\n >\n {typeof value !== 'undefined' || showEmpty ? (\n <NumberFormat value={value} {...numberFormatProps} />\n ) : null}\n </ValueBlock>\n )\n}\n\nNumberValue._supportsSpacingProps = true\nexport default NumberValue\n"],"mappings":";;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,UAAU,MAAM,YAAY;AACnC,OAAOC,UAAU,MAAM,kBAAkB;AACzC,OAAOC,aAAa,MAAM,2BAA2B;AAErD,SAASC,gBAAgB,QAAQ,mCAAmC;AACpE,OAAOC,YAAY,MAEZ,qCAAqC;AAC5C,SAEEC,qBAAqB,QAChB,+CAA+C;AAUtD,SAASC,WAAWA,CAACC,KAAY,EAAE;EACjC,MAAAC,cAAA,
|
|
1
|
+
{"version":3,"file":"Number.js","names":["React","classnames","ValueBlock","useValueProps","omitSpacingProps","NumberFormat","convertCamelCaseProps","NumberValue","props","_useValueProps","value","valueProp","minimum","Number","MIN_SAFE_INTEGER","maximum","MAX_SAFE_INTEGER","inline","showEmpty","className","path","rest","_objectWithoutProperties","_excluded","numberFormatProps","createElement","_extends","_supportsSpacingProps"],"sources":["../../../../../../src/extensions/forms/Value/Number/Number.tsx"],"sourcesContent":["import React from 'react'\nimport classnames from 'classnames'\nimport ValueBlock from '../../ValueBlock'\nimport useValueProps from '../../hooks/useValueProps'\nimport { ValueProps } from '../../types'\nimport { omitSpacingProps } from '../../../../components/flex/utils'\nimport NumberFormat, {\n NumberFormatProps,\n} from '../../../../components/NumberFormat'\nimport {\n IncludeCamelCase,\n convertCamelCaseProps,\n} from '../../../../shared/helpers/withCamelCaseProps'\n\nexport type Props = Omit<ValueProps<number>, 'defaultValue'> &\n IncludeCamelCase<NumberFormatProps> &\n Partial<{\n defaultValue?: number | string\n minimum?: number\n maximum?: number\n }>\n\nfunction NumberValue(props: Props) {\n const {\n value: valueProp,\n minimum = Number.MIN_SAFE_INTEGER,\n maximum = Number.MAX_SAFE_INTEGER,\n inline,\n showEmpty,\n className,\n path, // eslint-disable-line\n ...rest\n } = useValueProps(props)\n const numberFormatProps = convertCamelCaseProps(omitSpacingProps(rest))\n\n let value = valueProp\n if (value < minimum) {\n value = minimum\n }\n if (value > maximum) {\n value = maximum\n }\n\n return (\n <ValueBlock\n className={classnames('dnb-forms-value-number', className)}\n inline={inline}\n showEmpty={showEmpty}\n {...rest}\n >\n {typeof value !== 'undefined' || showEmpty ? (\n <NumberFormat value={value} {...numberFormatProps} />\n ) : null}\n </ValueBlock>\n )\n}\n\nNumberValue._supportsSpacingProps = true\nexport default NumberValue\n"],"mappings":";;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,UAAU,MAAM,YAAY;AACnC,OAAOC,UAAU,MAAM,kBAAkB;AACzC,OAAOC,aAAa,MAAM,2BAA2B;AAErD,SAASC,gBAAgB,QAAQ,mCAAmC;AACpE,OAAOC,YAAY,MAEZ,qCAAqC;AAC5C,SAEEC,qBAAqB,QAChB,+CAA+C;AAUtD,SAASC,WAAWA,CAACC,KAAY,EAAE;EACjC,MAAAC,cAAA,GASIN,aAAa,CAACK,KAAK,CAAC;IATlB;MACJE,KAAK,EAAEC,SAAS;MAChBC,OAAO,GAAGC,MAAM,CAACC,gBAAgB;MACjCC,OAAO,GAAGF,MAAM,CAACG,gBAAgB;MACjCC,MAAM;MACNC,SAAS;MACTC,SAAS;MACTC;IAEF,CAAC,GAAAX,cAAA;IADIY,IAAI,GAAAC,wBAAA,CAAAb,cAAA,EAAAc,SAAA;EAET,MAAMC,iBAAiB,GAAGlB,qBAAqB,CAACF,gBAAgB,CAACiB,IAAI,CAAC,CAAC;EAEvE,IAAIX,KAAK,GAAGC,SAAS;EACrB,IAAID,KAAK,GAAGE,OAAO,EAAE;IACnBF,KAAK,GAAGE,OAAO;EACjB;EACA,IAAIF,KAAK,GAAGK,OAAO,EAAE;IACnBL,KAAK,GAAGK,OAAO;EACjB;EAEA,OACEf,KAAA,CAAAyB,aAAA,CAACvB,UAAU,EAAAwB,QAAA;IACTP,SAAS,EAAElB,UAAU,CAAC,wBAAwB,EAAEkB,SAAS,CAAE;IAC3DF,MAAM,EAAEA,MAAO;IACfC,SAAS,EAAEA;EAAU,GACjBG,IAAI,GAEP,OAAOX,KAAK,KAAK,WAAW,IAAIQ,SAAS,GACxClB,KAAA,CAAAyB,aAAA,CAACpB,YAAY,EAAAqB,QAAA;IAAChB,KAAK,EAAEA;EAAM,GAAKc,iBAAiB,CAAG,CAAC,GACnD,IACM,CAAC;AAEjB;AAEAjB,WAAW,CAACoB,qBAAqB,GAAG,IAAI;AACxC,eAAepB,WAAW"}
|
|
@@ -2,6 +2,7 @@ import { ValueProps } from '../../types';
|
|
|
2
2
|
export type Props = ValueProps<string>;
|
|
3
3
|
declare function SelectCountry(props: Props): import("react/jsx-runtime").JSX.Element;
|
|
4
4
|
declare namespace SelectCountry {
|
|
5
|
+
var useCountry: typeof import("./useCountry").default;
|
|
5
6
|
var _supportsSpacingProps: boolean;
|
|
6
7
|
}
|
|
7
8
|
export default SelectCountry;
|
|
@@ -1,18 +1,12 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
5
3
|
const _excluded = ["value", "className", "label"];
|
|
6
|
-
import React
|
|
4
|
+
import React from 'react';
|
|
7
5
|
import classnames from 'classnames';
|
|
8
6
|
import { useTranslation, useValueProps } from '../../hooks';
|
|
9
7
|
import ValueBlock from '../../ValueBlock';
|
|
10
|
-
import
|
|
11
|
-
import { getCountryData } from '../../Field/SelectCountry';
|
|
8
|
+
import useCountry from './useCountry';
|
|
12
9
|
function SelectCountry(props) {
|
|
13
|
-
const {
|
|
14
|
-
locale
|
|
15
|
-
} = useContext(SharedContext);
|
|
16
10
|
const translations = useTranslation().SelectCountry;
|
|
17
11
|
const _useValueProps = useValueProps(props),
|
|
18
12
|
{
|
|
@@ -21,24 +15,15 @@ function SelectCountry(props) {
|
|
|
21
15
|
label = translations.label
|
|
22
16
|
} = _useValueProps,
|
|
23
17
|
rest = _objectWithoutProperties(_useValueProps, _excluded);
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
return null;
|
|
28
|
-
}
|
|
29
|
-
const lang = locale === null || locale === void 0 ? void 0 : locale.split('-')[0];
|
|
30
|
-
return (_getCountryData$at = getCountryData({
|
|
31
|
-
lang,
|
|
32
|
-
filter: country => {
|
|
33
|
-
return country.iso === value;
|
|
34
|
-
}
|
|
35
|
-
}).at(0)) === null || _getCountryData$at === void 0 ? void 0 : _getCountryData$at.content;
|
|
36
|
-
}, [locale, value]);
|
|
18
|
+
const {
|
|
19
|
+
getCountryNameByIso
|
|
20
|
+
} = useCountry();
|
|
37
21
|
return React.createElement(ValueBlock, _extends({
|
|
38
22
|
label: label,
|
|
39
23
|
className: classnames('dnb-forms-value-select-country', className)
|
|
40
|
-
}, rest),
|
|
24
|
+
}, rest), getCountryNameByIso(value));
|
|
41
25
|
}
|
|
26
|
+
SelectCountry.useCountry = useCountry;
|
|
42
27
|
SelectCountry._supportsSpacingProps = true;
|
|
43
28
|
export default SelectCountry;
|
|
44
29
|
//# sourceMappingURL=SelectCountry.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectCountry.js","names":["React","
|
|
1
|
+
{"version":3,"file":"SelectCountry.js","names":["React","classnames","useTranslation","useValueProps","ValueBlock","useCountry","SelectCountry","props","translations","_useValueProps","value","className","label","rest","_objectWithoutProperties","_excluded","getCountryNameByIso","createElement","_extends","_supportsSpacingProps"],"sources":["../../../../../../src/extensions/forms/Value/SelectCountry/SelectCountry.tsx"],"sourcesContent":["import React from 'react'\nimport classnames from 'classnames'\nimport { useTranslation, useValueProps } from '../../hooks'\nimport { ValueProps } from '../../types'\nimport ValueBlock from '../../ValueBlock'\nimport useCountry from './useCountry'\n\nexport type Props = ValueProps<string>\n\nfunction SelectCountry(props: Props) {\n const translations = useTranslation().SelectCountry\n const {\n value,\n className,\n label = translations.label,\n ...rest\n } = useValueProps(props)\n\n const { getCountryNameByIso } = useCountry()\n\n return (\n <ValueBlock\n label={label}\n className={classnames('dnb-forms-value-select-country', className)}\n {...rest}\n >\n {getCountryNameByIso(value)}\n </ValueBlock>\n )\n}\n\nSelectCountry.useCountry = useCountry\nSelectCountry._supportsSpacingProps = true\nexport default SelectCountry\n"],"mappings":";;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,UAAU,MAAM,YAAY;AACnC,SAASC,cAAc,EAAEC,aAAa,QAAQ,aAAa;AAE3D,OAAOC,UAAU,MAAM,kBAAkB;AACzC,OAAOC,UAAU,MAAM,cAAc;AAIrC,SAASC,aAAaA,CAACC,KAAY,EAAE;EACnC,MAAMC,YAAY,GAAGN,cAAc,CAAC,CAAC,CAACI,aAAa;EACnD,MAAAG,cAAA,GAKIN,aAAa,CAACI,KAAK,CAAC;IALlB;MACJG,KAAK;MACLC,SAAS;MACTC,KAAK,GAAGJ,YAAY,CAACI;IAEvB,CAAC,GAAAH,cAAA;IADII,IAAI,GAAAC,wBAAA,CAAAL,cAAA,EAAAM,SAAA;EAGT,MAAM;IAAEC;EAAoB,CAAC,GAAGX,UAAU,CAAC,CAAC;EAE5C,OACEL,KAAA,CAAAiB,aAAA,CAACb,UAAU,EAAAc,QAAA;IACTN,KAAK,EAAEA,KAAM;IACbD,SAAS,EAAEV,UAAU,CAAC,gCAAgC,EAAEU,SAAS;EAAE,GAC/DE,IAAI,GAEPG,mBAAmB,CAACN,KAAK,CAChB,CAAC;AAEjB;AAEAJ,aAAa,CAACD,UAAU,GAAGA,UAAU;AACrCC,aAAa,CAACa,qBAAqB,GAAG,IAAI;AAC1C,eAAeb,aAAa"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { useCallback, useContext } from 'react';
|
|
4
|
+
import SharedContext from '../../../../shared/Context';
|
|
5
|
+
import { getCountryData } from '../../Field/SelectCountry';
|
|
6
|
+
export default function useCountry() {
|
|
7
|
+
const {
|
|
8
|
+
locale
|
|
9
|
+
} = useContext(SharedContext);
|
|
10
|
+
const getCountryNameByIso = useCallback(iso => {
|
|
11
|
+
var _getCountryData$at;
|
|
12
|
+
if (!iso) {
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
const lang = locale === null || locale === void 0 ? void 0 : locale.split('-')[0];
|
|
16
|
+
return (_getCountryData$at = getCountryData({
|
|
17
|
+
lang,
|
|
18
|
+
filter: country => {
|
|
19
|
+
return country.iso === iso;
|
|
20
|
+
}
|
|
21
|
+
}).at(0)) === null || _getCountryData$at === void 0 ? void 0 : _getCountryData$at.content;
|
|
22
|
+
}, [locale]);
|
|
23
|
+
return {
|
|
24
|
+
getCountryNameByIso
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=useCountry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useCountry.js","names":["useCallback","useContext","SharedContext","getCountryData","useCountry","locale","getCountryNameByIso","iso","_getCountryData$at","lang","split","filter","country","at","content"],"sources":["../../../../../../src/extensions/forms/Value/SelectCountry/useCountry.ts"],"sourcesContent":["import { useCallback, useContext } from 'react'\nimport SharedContext from '../../../../shared/Context'\nimport { getCountryData } from '../../Field/SelectCountry'\nimport { CountryLang, CountryType } from '../../constants/countries'\n\nexport default function useCountry() {\n const { locale } = useContext(SharedContext)\n\n const getCountryNameByIso = useCallback(\n (iso: CountryType['iso']) => {\n if (!iso) {\n return null\n }\n\n const lang = locale?.split('-')[0] as CountryLang\n return getCountryData({\n lang,\n filter: (country) => {\n return country.iso === iso\n },\n }).at(0)?.content\n },\n [locale]\n )\n\n return { getCountryNameByIso }\n}\n"],"mappings":";;AAAA,SAASA,WAAW,EAAEC,UAAU,QAAQ,OAAO;AAC/C,OAAOC,aAAa,MAAM,4BAA4B;AACtD,SAASC,cAAc,QAAQ,2BAA2B;AAG1D,eAAe,SAASC,UAAUA,CAAA,EAAG;EACnC,MAAM;IAAEC;EAAO,CAAC,GAAGJ,UAAU,CAACC,aAAa,CAAC;EAE5C,MAAMI,mBAAmB,GAAGN,WAAW,CACpCO,GAAuB,IAAK;IAAA,IAAAC,kBAAA;IAC3B,IAAI,CAACD,GAAG,EAAE;MACR,OAAO,IAAI;IACb;IAEA,MAAME,IAAI,GAAGJ,MAAM,aAANA,MAAM,uBAANA,MAAM,CAAEK,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAgB;IACjD,QAAAF,kBAAA,GAAOL,cAAc,CAAC;MACpBM,IAAI;MACJE,MAAM,EAAGC,OAAO,IAAK;QACnB,OAAOA,OAAO,CAACL,GAAG,KAAKA,GAAG;MAC5B;IACF,CAAC,CAAC,CAACM,EAAE,CAAC,CAAC,CAAC,cAAAL,kBAAA,uBALDA,kBAAA,CAKGM,OAAO;EACnB,CAAC,EACD,CAACT,MAAM,CACT,CAAC;EAED,OAAO;IAAEC;EAAoB,CAAC;AAChC"}
|
|
@@ -40,7 +40,8 @@ function Selection(props) {
|
|
|
40
40
|
return value;
|
|
41
41
|
}, [dataPath, fieldPropsRef, getValueByPath, path, value]);
|
|
42
42
|
return React.createElement(StringValue, _extends({
|
|
43
|
-
value: valueToDisplay
|
|
43
|
+
value: valueToDisplay,
|
|
44
|
+
path: path
|
|
44
45
|
}, rest));
|
|
45
46
|
}
|
|
46
47
|
Selection._supportsSpacingProps = true;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Selection.js","names":["React","useContext","useMemo","StringValue","useValueProps","useDataValue","Context","convertJsxToString","Selection","props","fieldPropsRef","_useValueProps","path","dataPath","value","rest","_objectWithoutProperties","_excluded","getValueByPath","valueToDisplay","_fieldPropsRef$curren","fieldProp","current","_getValueByPath","_getValueByPath$map","_list","_list$find","_list$find$call","_list$find$call$props","list","map","call","title","find","child","createElement","_extends","_supportsSpacingProps"],"sources":["../../../../../../src/extensions/forms/Value/Selection/Selection.tsx"],"sourcesContent":["import React, { useContext, useMemo } from 'react'\nimport StringValue from '../String'\nimport { Path, ValueProps } from '../../types'\nimport { useValueProps } from '../../hooks'\nimport useDataValue from '../../hooks/useDataValue'\nimport Context from '../../DataContext/Context'\nimport { convertJsxToString } from '../../../../shared/component-helper'\nimport { Data } from '../../Field/Selection'\n\nexport type Props = ValueProps<string> & {\n dataPath?: Path\n}\n\nfunction Selection(props: Props) {\n const { fieldPropsRef } = useContext(Context) || {}\n const { path, dataPath, value, ...rest } = useValueProps(props)\n const { getValueByPath } = useDataValue()\n\n const valueToDisplay = useMemo<string | undefined>(() => {\n const fieldProp = fieldPropsRef?.current?.[path]\n\n if (path || dataPath) {\n let list = getValueByPath(dataPath)?.map?.((props) => ({ props }))\n\n if (!list) {\n list = fieldProp?.['children'] as Array<\n Omit<JSX.Element, 'props'> & { props: Data[number] }\n >\n }\n\n const title = list?.find?.((child) => child.props.value === value)\n ?.props?.title\n\n return title ? convertJsxToString(title) : value\n }\n\n return value\n }, [dataPath, fieldPropsRef, getValueByPath, path, value])\n\n return <StringValue value={valueToDisplay} {...rest} />\n}\n\nSelection._supportsSpacingProps = true\nexport default Selection\n"],"mappings":";;;;;AAAA,OAAOA,KAAK,IAAIC,UAAU,EAAEC,OAAO,QAAQ,OAAO;AAClD,OAAOC,WAAW,MAAM,WAAW;AAEnC,SAASC,aAAa,QAAQ,aAAa;AAC3C,OAAOC,YAAY,MAAM,0BAA0B;AACnD,OAAOC,OAAO,MAAM,2BAA2B;AAC/C,SAASC,kBAAkB,QAAQ,qCAAqC;AAOxE,SAASC,SAASA,CAACC,KAAY,EAAE;EAC/B,MAAM;IAAEC;EAAc,CAAC,GAAGT,UAAU,CAACK,OAAO,CAAC,IAAI,CAAC,CAAC;EACnD,MAAAK,cAAA,GAA2CP,aAAa,CAACK,KAAK,CAAC;IAAzD;MAAEG,IAAI;MAAEC,QAAQ;MAAEC;IAAe,CAAC,GAAAH,cAAA;IAANI,IAAI,GAAAC,wBAAA,CAAAL,cAAA,EAAAM,SAAA;EACtC,MAAM;IAAEC;EAAe,CAAC,GAAGb,YAAY,CAAC,CAAC;EAEzC,MAAMc,cAAc,GAAGjB,OAAO,CAAqB,MAAM;IAAA,IAAAkB,qBAAA;IACvD,MAAMC,SAAS,GAAGX,aAAa,aAAbA,aAAa,wBAAAU,qBAAA,GAAbV,aAAa,CAAEY,OAAO,cAAAF,qBAAA,uBAAtBA,qBAAA,CAAyBR,IAAI,CAAC;IAEhD,IAAIA,IAAI,IAAIC,QAAQ,EAAE;MAAA,IAAAU,eAAA,EAAAC,mBAAA,EAAAC,KAAA,EAAAC,UAAA,EAAAC,eAAA,EAAAC,qBAAA;MACpB,IAAIC,IAAI,IAAAN,eAAA,GAAGL,cAAc,CAACL,QAAQ,CAAC,cAAAU,eAAA,wBAAAC,mBAAA,GAAxBD,eAAA,CAA0BO,GAAG,cAAAN,mBAAA,uBAA7BA,mBAAA,CAAAO,IAAA,CAAAR,eAAA,EAAiCd,KAAK,KAAM;QAAEA;MAAM,CAAC,CAAC,CAAC;MAElE,IAAI,CAACoB,IAAI,EAAE;QACTA,IAAI,GAAGR,SAAS,aAATA,SAAS,uBAATA,SAAS,CAAG,UAAU,CAE5B;MACH;MAEA,MAAMW,KAAK,IAAAP,KAAA,GAAGI,IAAI,cAAAJ,KAAA,wBAAAC,UAAA,GAAJD,KAAA,CAAMQ,IAAI,cAAAP,UAAA,wBAAAC,eAAA,GAAVD,UAAA,CAAAK,IAAA,CAAAN,KAAA,EAAcS,KAAK,IAAKA,KAAK,CAACzB,KAAK,CAACK,KAAK,KAAKA,KAAK,CAAC,cAAAa,eAAA,wBAAAC,qBAAA,GAApDD,eAAA,CACVlB,KAAK,cAAAmB,qBAAA,uBADKA,qBAAA,CACHI,KAAK;MAEhB,OAAOA,KAAK,GAAGzB,kBAAkB,CAACyB,KAAK,CAAC,GAAGlB,KAAK;IAClD;IAEA,OAAOA,KAAK;EACd,CAAC,EAAE,CAACD,QAAQ,EAAEH,aAAa,EAAEQ,cAAc,EAAEN,IAAI,EAAEE,KAAK,CAAC,CAAC;EAE1D,OAAOd,KAAA,CAAAmC,aAAA,CAAChC,WAAW,EAAAiC,QAAA;IAACtB,KAAK,EAAEK;
|
|
1
|
+
{"version":3,"file":"Selection.js","names":["React","useContext","useMemo","StringValue","useValueProps","useDataValue","Context","convertJsxToString","Selection","props","fieldPropsRef","_useValueProps","path","dataPath","value","rest","_objectWithoutProperties","_excluded","getValueByPath","valueToDisplay","_fieldPropsRef$curren","fieldProp","current","_getValueByPath","_getValueByPath$map","_list","_list$find","_list$find$call","_list$find$call$props","list","map","call","title","find","child","createElement","_extends","_supportsSpacingProps"],"sources":["../../../../../../src/extensions/forms/Value/Selection/Selection.tsx"],"sourcesContent":["import React, { useContext, useMemo } from 'react'\nimport StringValue from '../String'\nimport { Path, ValueProps } from '../../types'\nimport { useValueProps } from '../../hooks'\nimport useDataValue from '../../hooks/useDataValue'\nimport Context from '../../DataContext/Context'\nimport { convertJsxToString } from '../../../../shared/component-helper'\nimport { Data } from '../../Field/Selection'\n\nexport type Props = ValueProps<string> & {\n dataPath?: Path\n}\n\nfunction Selection(props: Props) {\n const { fieldPropsRef } = useContext(Context) || {}\n const { path, dataPath, value, ...rest } = useValueProps(props)\n const { getValueByPath } = useDataValue()\n\n const valueToDisplay = useMemo<string | undefined>(() => {\n const fieldProp = fieldPropsRef?.current?.[path]\n\n if (path || dataPath) {\n let list = getValueByPath(dataPath)?.map?.((props) => ({ props }))\n\n if (!list) {\n list = fieldProp?.['children'] as Array<\n Omit<JSX.Element, 'props'> & { props: Data[number] }\n >\n }\n\n const title = list?.find?.((child) => child.props.value === value)\n ?.props?.title\n\n return title ? convertJsxToString(title) : value\n }\n\n return value\n }, [dataPath, fieldPropsRef, getValueByPath, path, value])\n\n return <StringValue value={valueToDisplay} path={path} {...rest} />\n}\n\nSelection._supportsSpacingProps = true\nexport default Selection\n"],"mappings":";;;;;AAAA,OAAOA,KAAK,IAAIC,UAAU,EAAEC,OAAO,QAAQ,OAAO;AAClD,OAAOC,WAAW,MAAM,WAAW;AAEnC,SAASC,aAAa,QAAQ,aAAa;AAC3C,OAAOC,YAAY,MAAM,0BAA0B;AACnD,OAAOC,OAAO,MAAM,2BAA2B;AAC/C,SAASC,kBAAkB,QAAQ,qCAAqC;AAOxE,SAASC,SAASA,CAACC,KAAY,EAAE;EAC/B,MAAM;IAAEC;EAAc,CAAC,GAAGT,UAAU,CAACK,OAAO,CAAC,IAAI,CAAC,CAAC;EACnD,MAAAK,cAAA,GAA2CP,aAAa,CAACK,KAAK,CAAC;IAAzD;MAAEG,IAAI;MAAEC,QAAQ;MAAEC;IAAe,CAAC,GAAAH,cAAA;IAANI,IAAI,GAAAC,wBAAA,CAAAL,cAAA,EAAAM,SAAA;EACtC,MAAM;IAAEC;EAAe,CAAC,GAAGb,YAAY,CAAC,CAAC;EAEzC,MAAMc,cAAc,GAAGjB,OAAO,CAAqB,MAAM;IAAA,IAAAkB,qBAAA;IACvD,MAAMC,SAAS,GAAGX,aAAa,aAAbA,aAAa,wBAAAU,qBAAA,GAAbV,aAAa,CAAEY,OAAO,cAAAF,qBAAA,uBAAtBA,qBAAA,CAAyBR,IAAI,CAAC;IAEhD,IAAIA,IAAI,IAAIC,QAAQ,EAAE;MAAA,IAAAU,eAAA,EAAAC,mBAAA,EAAAC,KAAA,EAAAC,UAAA,EAAAC,eAAA,EAAAC,qBAAA;MACpB,IAAIC,IAAI,IAAAN,eAAA,GAAGL,cAAc,CAACL,QAAQ,CAAC,cAAAU,eAAA,wBAAAC,mBAAA,GAAxBD,eAAA,CAA0BO,GAAG,cAAAN,mBAAA,uBAA7BA,mBAAA,CAAAO,IAAA,CAAAR,eAAA,EAAiCd,KAAK,KAAM;QAAEA;MAAM,CAAC,CAAC,CAAC;MAElE,IAAI,CAACoB,IAAI,EAAE;QACTA,IAAI,GAAGR,SAAS,aAATA,SAAS,uBAATA,SAAS,CAAG,UAAU,CAE5B;MACH;MAEA,MAAMW,KAAK,IAAAP,KAAA,GAAGI,IAAI,cAAAJ,KAAA,wBAAAC,UAAA,GAAJD,KAAA,CAAMQ,IAAI,cAAAP,UAAA,wBAAAC,eAAA,GAAVD,UAAA,CAAAK,IAAA,CAAAN,KAAA,EAAcS,KAAK,IAAKA,KAAK,CAACzB,KAAK,CAACK,KAAK,KAAKA,KAAK,CAAC,cAAAa,eAAA,wBAAAC,qBAAA,GAApDD,eAAA,CACVlB,KAAK,cAAAmB,qBAAA,uBADKA,qBAAA,CACHI,KAAK;MAEhB,OAAOA,KAAK,GAAGzB,kBAAkB,CAACyB,KAAK,CAAC,GAAGlB,KAAK;IAClD;IAEA,OAAOA,KAAK;EACd,CAAC,EAAE,CAACD,QAAQ,EAAEH,aAAa,EAAEQ,cAAc,EAAEN,IAAI,EAAEE,KAAK,CAAC,CAAC;EAE1D,OAAOd,KAAA,CAAAmC,aAAA,CAAChC,WAAW,EAAAiC,QAAA;IAACtB,KAAK,EAAEK,cAAe;IAACP,IAAI,EAAEA;EAAK,GAAKG,IAAI,CAAG,CAAC;AACrE;AAEAP,SAAS,CAAC6B,qBAAqB,GAAG,IAAI;AACtC,eAAe7B,SAAS"}
|
|
@@ -19,6 +19,11 @@ export const ValueProperties = {
|
|
|
19
19
|
type: 'boolean',
|
|
20
20
|
status: 'optional'
|
|
21
21
|
},
|
|
22
|
+
inheritVisibility: {
|
|
23
|
+
doc: 'Use `true` to inherit the visibility from a field with the same path. You can find more info in the [Value section](/uilib/extensions/forms/Value/#inherit-visibility-from-fields-based-on-path).',
|
|
24
|
+
type: 'boolean',
|
|
25
|
+
status: 'optional'
|
|
26
|
+
},
|
|
22
27
|
showEmpty: {
|
|
23
28
|
doc: 'Shows the value even if it is empty.',
|
|
24
29
|
type: 'boolean',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ValueDocs.js","names":["ValueProperties","value","doc","type","status","defaultValue","label","inheritLabel","showEmpty","placeholder","path","inline","maxWidth","transformIn"],"sources":["../../../../../src/extensions/forms/Value/ValueDocs.ts"],"sourcesContent":["import { PropertiesTableProps } from '../../../shared/types'\n\nexport const ValueProperties: PropertiesTableProps = {\n value: {\n doc: 'Value for the value component. Will take precedence over the path value given in the data context.',\n type: '{valueType}',\n status: 'optional',\n },\n defaultValue: {\n doc: 'Default value for the value component. Will not take precedence over the path value given in the data context.',\n type: '{valueType}',\n status: 'optional',\n },\n label: {\n doc: 'Field label to show above the displayed value.',\n type: 'string',\n status: 'optional',\n },\n inheritLabel: {\n doc: 'Use `true` to inherit the label from a visible (rendered) field with the same path.',\n type: 'boolean',\n status: 'optional',\n },\n showEmpty: {\n doc: 'Shows the value even if it is empty.',\n type: 'boolean',\n status: 'optional',\n },\n placeholder: {\n doc: 'Text showing in place of the value if no value is given.',\n type: 'string',\n status: 'optional',\n },\n path: {\n doc: 'JSON Pointer for where the data for this input is located in the source dataset.',\n type: 'string',\n status: 'optional',\n },\n inline: {\n doc: 'For showing the value inline (not as a block element).',\n type: 'boolean',\n status: 'optional',\n },\n maxWidth: {\n doc: 'Use `auto` for no max-width (use browser default), `small`, `medium` or `large` for predefined standard max widths. Defaults to `large`.',\n type: 'string',\n status: 'optional',\n },\n transformIn: {\n doc: 'Transforms the `value` before its displayed in the value component.',\n type: 'function',\n status: 'optional',\n },\n '[Space](/uilib/layout/space/properties)': {\n doc: 'Spacing properties like `top` or `bottom` are supported.',\n type: ['string', 'object'],\n status: 'optional',\n },\n}\n"],"mappings":"AAEA,OAAO,MAAMA,eAAqC,GAAG;EACnDC,KAAK,EAAE;IACLC,GAAG,EAAE,oGAAoG;IACzGC,IAAI,EAAE,aAAa;IACnBC,MAAM,EAAE;EACV,CAAC;EACDC,YAAY,EAAE;IACZH,GAAG,EAAE,gHAAgH;IACrHC,IAAI,EAAE,aAAa;IACnBC,MAAM,EAAE;EACV,CAAC;EACDE,KAAK,EAAE;IACLJ,GAAG,EAAE,gDAAgD;IACrDC,IAAI,EAAE,QAAQ;IACdC,MAAM,EAAE;EACV,CAAC;EACDG,YAAY,EAAE;IACZL,GAAG,EAAE,qFAAqF;IAC1FC,IAAI,EAAE,SAAS;IACfC,MAAM,EAAE;EACV,CAAC;EACDI,SAAS,EAAE;
|
|
1
|
+
{"version":3,"file":"ValueDocs.js","names":["ValueProperties","value","doc","type","status","defaultValue","label","inheritLabel","inheritVisibility","showEmpty","placeholder","path","inline","maxWidth","transformIn"],"sources":["../../../../../src/extensions/forms/Value/ValueDocs.ts"],"sourcesContent":["import { PropertiesTableProps } from '../../../shared/types'\n\nexport const ValueProperties: PropertiesTableProps = {\n value: {\n doc: 'Value for the value component. Will take precedence over the path value given in the data context.',\n type: '{valueType}',\n status: 'optional',\n },\n defaultValue: {\n doc: 'Default value for the value component. Will not take precedence over the path value given in the data context.',\n type: '{valueType}',\n status: 'optional',\n },\n label: {\n doc: 'Field label to show above the displayed value.',\n type: 'string',\n status: 'optional',\n },\n inheritLabel: {\n doc: 'Use `true` to inherit the label from a visible (rendered) field with the same path.',\n type: 'boolean',\n status: 'optional',\n },\n inheritVisibility: {\n doc: 'Use `true` to inherit the visibility from a field with the same path. You can find more info in the [Value section](/uilib/extensions/forms/Value/#inherit-visibility-from-fields-based-on-path).',\n type: 'boolean',\n status: 'optional',\n },\n showEmpty: {\n doc: 'Shows the value even if it is empty.',\n type: 'boolean',\n status: 'optional',\n },\n placeholder: {\n doc: 'Text showing in place of the value if no value is given.',\n type: 'string',\n status: 'optional',\n },\n path: {\n doc: 'JSON Pointer for where the data for this input is located in the source dataset.',\n type: 'string',\n status: 'optional',\n },\n inline: {\n doc: 'For showing the value inline (not as a block element).',\n type: 'boolean',\n status: 'optional',\n },\n maxWidth: {\n doc: 'Use `auto` for no max-width (use browser default), `small`, `medium` or `large` for predefined standard max widths. Defaults to `large`.',\n type: 'string',\n status: 'optional',\n },\n transformIn: {\n doc: 'Transforms the `value` before its displayed in the value component.',\n type: 'function',\n status: 'optional',\n },\n '[Space](/uilib/layout/space/properties)': {\n doc: 'Spacing properties like `top` or `bottom` are supported.',\n type: ['string', 'object'],\n status: 'optional',\n },\n}\n"],"mappings":"AAEA,OAAO,MAAMA,eAAqC,GAAG;EACnDC,KAAK,EAAE;IACLC,GAAG,EAAE,oGAAoG;IACzGC,IAAI,EAAE,aAAa;IACnBC,MAAM,EAAE;EACV,CAAC;EACDC,YAAY,EAAE;IACZH,GAAG,EAAE,gHAAgH;IACrHC,IAAI,EAAE,aAAa;IACnBC,MAAM,EAAE;EACV,CAAC;EACDE,KAAK,EAAE;IACLJ,GAAG,EAAE,gDAAgD;IACrDC,IAAI,EAAE,QAAQ;IACdC,MAAM,EAAE;EACV,CAAC;EACDG,YAAY,EAAE;IACZL,GAAG,EAAE,qFAAqF;IAC1FC,IAAI,EAAE,SAAS;IACfC,MAAM,EAAE;EACV,CAAC;EACDI,iBAAiB,EAAE;IACjBN,GAAG,EAAE,mMAAmM;IACxMC,IAAI,EAAE,SAAS;IACfC,MAAM,EAAE;EACV,CAAC;EACDK,SAAS,EAAE;IACTP,GAAG,EAAE,sCAAsC;IAC3CC,IAAI,EAAE,SAAS;IACfC,MAAM,EAAE;EACV,CAAC;EACDM,WAAW,EAAE;IACXR,GAAG,EAAE,0DAA0D;IAC/DC,IAAI,EAAE,QAAQ;IACdC,MAAM,EAAE;EACV,CAAC;EACDO,IAAI,EAAE;IACJT,GAAG,EAAE,kFAAkF;IACvFC,IAAI,EAAE,QAAQ;IACdC,MAAM,EAAE;EACV,CAAC;EACDQ,MAAM,EAAE;IACNV,GAAG,EAAE,wDAAwD;IAC7DC,IAAI,EAAE,SAAS;IACfC,MAAM,EAAE;EACV,CAAC;EACDS,QAAQ,EAAE;IACRX,GAAG,EAAE,0IAA0I;IAC/IC,IAAI,EAAE,QAAQ;IACdC,MAAM,EAAE;EACV,CAAC;EACDU,WAAW,EAAE;IACXZ,GAAG,EAAE,qEAAqE;IAC1EC,IAAI,EAAE,UAAU;IAChBC,MAAM,EAAE;EACV,CAAC;EACD,yCAAyC,EAAE;IACzCF,GAAG,EAAE,0DAA0D;IAC/DC,IAAI,EAAE,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAC1BC,MAAM,EAAE;EACV;AACF,CAAC"}
|