@dnb/eufemia 9.17.2 → 9.18.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 +14 -0
- package/cjs/components/Tag.d.ts +14 -0
- package/cjs/components/Tag.js +52 -0
- package/cjs/components/accordion/Accordion.d.ts +7 -7
- package/cjs/components/autocomplete/Autocomplete.d.ts +13 -13
- package/cjs/components/button/Button.d.ts +7 -7
- package/cjs/components/button/Button.js +6 -4
- package/cjs/components/checkbox/Checkbox.d.ts +3 -3
- package/cjs/components/date-picker/DatePicker.d.ts +14 -14
- package/cjs/components/date-picker/DatePickerAddon.d.ts +1 -1
- package/cjs/components/date-picker/DatePickerCalendar.d.ts +1 -1
- package/cjs/components/date-picker/DatePickerInput.d.ts +1 -1
- package/cjs/components/dropdown/Dropdown.d.ts +9 -9
- package/cjs/components/form-row/FormRow.d.ts +4 -4
- package/cjs/components/form-set/FormSet.d.ts +5 -5
- package/cjs/components/global-error/GlobalError.d.ts +1 -1
- package/cjs/components/global-status/GlobalStatus.d.ts +5 -5
- package/cjs/components/heading/Heading.d.ts +2 -2
- package/cjs/components/heading/HeadingProvider.d.ts +2 -2
- package/cjs/components/icon/Icon.d.ts +1 -1
- package/cjs/components/icon-primary/IconPrimary.d.ts +1 -1
- package/cjs/components/index.d.ts +2 -0
- package/cjs/components/index.js +8 -0
- package/cjs/components/input/Input.d.ts +9 -9
- package/cjs/components/input-masked/InputMasked.d.ts +11 -11
- package/cjs/components/input-masked/InputMasked.js +6 -3
- package/cjs/components/input-masked/InputMaskedHooks.js +26 -34
- package/cjs/components/input-masked/InputMaskedUtils.js +9 -20
- package/cjs/components/lib.js +9 -0
- package/cjs/components/modal/Modal.js +123 -271
- package/cjs/components/modal/ModalContent.js +145 -243
- package/cjs/components/modal/ModalRoot.js +194 -0
- package/cjs/components/modal/components/CloseButton.js +125 -0
- package/cjs/components/modal/components/ModalHeader.js +124 -0
- package/cjs/components/modal/{ModalHeader.js → components/ModalHeaderBar.js} +50 -162
- package/cjs/components/modal/{ModalInner.js → components/ModalInner.js} +11 -19
- package/cjs/components/modal/helpers.js +80 -0
- package/cjs/components/modal/types.js +1 -0
- package/cjs/components/number-format/NumberFormat.d.ts +8 -8
- package/cjs/components/pagination/Pagination.d.ts +30 -30
- package/cjs/components/pagination/PaginationProvider.d.ts +2 -2
- package/cjs/components/radio/Radio.d.ts +4 -4
- package/cjs/components/radio/RadioGroup.d.ts +3 -3
- package/cjs/components/section/Section.d.ts +3 -2
- package/cjs/components/skeleton/Skeleton.d.ts +2 -2
- package/cjs/components/slider/Slider.d.ts +4 -4
- package/cjs/components/step-indicator/StepIndicator.d.ts +5 -5
- package/cjs/components/step-indicator/StepIndicatorContext.d.ts +1 -1
- package/cjs/components/step-indicator/StepIndicatorItem.d.ts +2 -2
- package/cjs/components/step-indicator/StepIndicatorItem.js +1 -0
- package/cjs/components/step-indicator/StepIndicatorSidebar.d.ts +3 -3
- package/cjs/components/step-indicator/StepIndicatorTriggerButton.d.ts +1 -1
- package/cjs/components/switch/Switch.d.ts +5 -5
- package/cjs/components/tabs/Tabs.d.ts +4 -4
- package/cjs/components/tabs/TabsContentWrapper.d.ts +1 -1
- package/cjs/components/tag/Tag.js +97 -0
- package/cjs/components/tag/index.d.ts +8 -0
- package/cjs/components/tag/index.js +52 -0
- package/cjs/components/tag/style/_tag.scss +26 -0
- package/cjs/components/tag/style/dnb-tag.css +109 -0
- package/cjs/components/tag/style/dnb-tag.min.css +1 -0
- package/cjs/components/tag/style/dnb-tag.scss +12 -0
- package/cjs/components/tag/style/index.d.ts +6 -0
- package/cjs/components/tag/style/index.js +3 -0
- package/cjs/components/tag/style.js +3 -0
- package/cjs/components/textarea/Textarea.d.ts +4 -4
- package/cjs/components/toggle-button/ToggleButton.d.ts +6 -6
- package/cjs/components/toggle-button/ToggleButtonGroup.d.ts +3 -3
- package/cjs/components/tooltip/Tooltip.d.ts +5 -5
- package/cjs/components/tooltip/TooltipContainer.d.ts +3 -3
- package/cjs/components/tooltip/TooltipPortal.d.ts +1 -1
- package/cjs/components/tooltip/TooltipWithEvents.d.ts +1 -1
- package/cjs/fragments/scroll-view/ScrollView.js +7 -16
- package/cjs/index.d.ts +2 -0
- package/cjs/index.js +8 -0
- package/cjs/shared/Context.js +2 -1
- package/cjs/style/core/helper-classes/skip-link.scss +1 -1
- package/cjs/style/dnb-ui-components.css +40 -0
- package/cjs/style/dnb-ui-components.min.css +1 -1
- package/cjs/style/dnb-ui-components.scss +1 -0
- package/components/Tag.d.ts +14 -0
- package/components/Tag.js +3 -0
- package/components/accordion/Accordion.d.ts +7 -7
- package/components/autocomplete/Autocomplete.d.ts +13 -13
- package/components/button/Button.d.ts +7 -7
- package/components/button/Button.js +6 -4
- package/components/checkbox/Checkbox.d.ts +3 -3
- package/components/date-picker/DatePicker.d.ts +14 -14
- package/components/date-picker/DatePickerAddon.d.ts +1 -1
- package/components/date-picker/DatePickerCalendar.d.ts +1 -1
- package/components/date-picker/DatePickerInput.d.ts +1 -1
- package/components/dropdown/Dropdown.d.ts +9 -9
- package/components/form-row/FormRow.d.ts +4 -4
- package/components/form-set/FormSet.d.ts +5 -5
- package/components/global-error/GlobalError.d.ts +1 -1
- package/components/global-status/GlobalStatus.d.ts +5 -5
- package/components/heading/Heading.d.ts +2 -2
- package/components/heading/HeadingProvider.d.ts +2 -2
- package/components/icon/Icon.d.ts +1 -1
- package/components/index.d.ts +2 -0
- package/components/index.js +2 -1
- package/components/input/Input.d.ts +9 -9
- package/components/input-masked/InputMasked.d.ts +11 -11
- package/components/input-masked/InputMasked.js +6 -4
- package/components/input-masked/InputMaskedHooks.js +24 -28
- package/components/input-masked/InputMaskedUtils.js +9 -20
- package/components/lib.js +3 -1
- package/components/modal/Modal.js +112 -250
- package/components/modal/Modal.tsx +524 -0
- package/components/modal/ModalContent.js +137 -224
- package/components/modal/ModalContent.tsx +515 -0
- package/components/modal/ModalContext.tsx +10 -0
- package/components/modal/ModalRoot.js +145 -0
- package/components/modal/ModalRoot.tsx +131 -0
- package/components/modal/components/CloseButton.js +72 -0
- package/components/modal/components/CloseButton.tsx +56 -0
- package/components/modal/components/ModalHeader.js +70 -0
- package/components/modal/components/ModalHeader.tsx +79 -0
- package/components/modal/components/ModalHeaderBar.js +122 -0
- package/components/modal/components/ModalHeaderBar.tsx +118 -0
- package/components/modal/{ModalInner.js → components/ModalInner.js} +11 -17
- package/components/modal/components/ModalInner.tsx +45 -0
- package/components/modal/helpers.js +64 -0
- package/components/modal/helpers.ts +63 -0
- package/components/modal/types.js +1 -0
- package/{cjs/components/modal/Modal.d.ts → components/modal/types.ts} +124 -182
- package/components/number-format/NumberFormat.d.ts +8 -8
- package/components/pagination/Pagination.d.ts +30 -30
- package/components/pagination/PaginationProvider.d.ts +2 -2
- package/components/radio/Radio.d.ts +4 -4
- package/components/radio/RadioGroup.d.ts +3 -3
- package/components/section/Section.d.ts +3 -1
- package/components/skeleton/Skeleton.d.ts +2 -2
- package/components/slider/Slider.d.ts +4 -4
- package/components/step-indicator/StepIndicator.d.ts +5 -5
- package/components/step-indicator/StepIndicatorContext.d.ts +1 -1
- package/components/step-indicator/StepIndicatorItem.d.ts +2 -2
- package/components/step-indicator/StepIndicatorItem.js +1 -0
- package/components/step-indicator/StepIndicatorSidebar.d.ts +3 -3
- package/components/step-indicator/StepIndicatorTriggerButton.d.ts +1 -1
- package/components/switch/Switch.d.ts +5 -5
- package/components/tabs/Tabs.d.ts +4 -4
- package/components/tabs/TabsContentWrapper.d.ts +1 -1
- package/components/tag/Tag.js +63 -0
- package/components/tag/Tag.tsx +95 -0
- package/components/tag/index.d.ts +8 -0
- package/components/tag/index.js +3 -0
- package/components/tag/style/_tag.scss +26 -0
- package/components/tag/style/dnb-tag.css +109 -0
- package/components/tag/style/dnb-tag.min.css +1 -0
- package/components/tag/style/dnb-tag.scss +12 -0
- package/components/tag/style/index.d.ts +6 -0
- package/components/tag/style/index.js +1 -0
- package/components/tag/style.js +1 -0
- package/components/textarea/Textarea.d.ts +4 -4
- package/components/toggle-button/ToggleButton.d.ts +6 -6
- package/components/toggle-button/ToggleButtonGroup.d.ts +3 -3
- package/components/tooltip/Tooltip.d.ts +5 -5
- package/components/tooltip/TooltipContainer.d.ts +3 -3
- package/components/tooltip/TooltipPortal.d.ts +1 -1
- package/components/tooltip/TooltipWithEvents.d.ts +1 -1
- package/es/components/Tag.d.ts +14 -0
- package/es/components/Tag.js +3 -0
- package/es/components/accordion/Accordion.d.ts +7 -7
- package/es/components/autocomplete/Autocomplete.d.ts +13 -13
- package/es/components/button/Button.d.ts +7 -7
- package/es/components/button/Button.js +6 -4
- package/es/components/checkbox/Checkbox.d.ts +3 -3
- package/es/components/date-picker/DatePicker.d.ts +14 -14
- package/es/components/date-picker/DatePickerAddon.d.ts +1 -1
- package/es/components/date-picker/DatePickerCalendar.d.ts +1 -1
- package/es/components/date-picker/DatePickerInput.d.ts +1 -1
- package/es/components/dropdown/Dropdown.d.ts +9 -9
- package/es/components/form-row/FormRow.d.ts +4 -4
- package/es/components/form-set/FormSet.d.ts +5 -5
- package/es/components/global-error/GlobalError.d.ts +1 -1
- package/es/components/global-status/GlobalStatus.d.ts +5 -5
- package/es/components/heading/Heading.d.ts +2 -2
- package/es/components/heading/HeadingProvider.d.ts +2 -2
- package/es/components/icon/Icon.d.ts +1 -1
- package/es/components/icon-primary/IconPrimary.d.ts +1 -1
- package/es/components/index.d.ts +2 -0
- package/es/components/index.js +2 -1
- package/es/components/input/Input.d.ts +9 -9
- package/es/components/input-masked/InputMasked.d.ts +11 -11
- package/es/components/input-masked/InputMasked.js +6 -4
- package/es/components/input-masked/InputMaskedHooks.js +14 -18
- package/es/components/input-masked/InputMaskedUtils.js +7 -18
- package/es/components/lib.js +3 -1
- package/es/components/modal/Modal.js +97 -227
- package/es/components/modal/Modal.tsx +524 -0
- package/es/components/modal/ModalContent.js +95 -186
- package/es/components/modal/ModalContent.tsx +515 -0
- package/es/components/modal/ModalContext.tsx +10 -0
- package/es/components/modal/ModalRoot.js +108 -0
- package/es/components/modal/ModalRoot.tsx +131 -0
- package/es/components/modal/components/CloseButton.js +41 -0
- package/es/components/modal/components/CloseButton.tsx +56 -0
- package/es/components/modal/components/ModalHeader.js +40 -0
- package/es/components/modal/components/ModalHeader.tsx +79 -0
- package/es/components/modal/components/ModalHeaderBar.js +88 -0
- package/es/components/modal/components/ModalHeaderBar.tsx +118 -0
- package/es/components/modal/{ModalInner.js → components/ModalInner.js} +8 -18
- package/es/components/modal/components/ModalInner.tsx +45 -0
- package/es/components/modal/helpers.js +60 -0
- package/es/components/modal/helpers.ts +63 -0
- package/es/components/modal/types.js +1 -0
- package/es/components/modal/{Modal.d.ts → types.ts} +124 -182
- package/es/components/number-format/NumberFormat.d.ts +8 -8
- package/es/components/pagination/Pagination.d.ts +30 -30
- package/es/components/pagination/PaginationProvider.d.ts +2 -2
- package/es/components/radio/Radio.d.ts +4 -4
- package/es/components/radio/RadioGroup.d.ts +3 -3
- package/es/components/section/Section.d.ts +3 -2
- package/es/components/skeleton/Skeleton.d.ts +2 -2
- package/es/components/slider/Slider.d.ts +4 -4
- package/es/components/step-indicator/StepIndicator.d.ts +5 -5
- package/es/components/step-indicator/StepIndicatorContext.d.ts +1 -1
- package/es/components/step-indicator/StepIndicatorItem.d.ts +2 -2
- package/es/components/step-indicator/StepIndicatorItem.js +1 -0
- package/es/components/step-indicator/StepIndicatorSidebar.d.ts +3 -3
- package/es/components/step-indicator/StepIndicatorTriggerButton.d.ts +1 -1
- package/es/components/switch/Switch.d.ts +5 -5
- package/es/components/tabs/Tabs.d.ts +4 -4
- package/es/components/tabs/TabsContentWrapper.d.ts +1 -1
- package/es/components/tag/Tag.js +58 -0
- package/es/components/tag/Tag.tsx +95 -0
- package/es/components/tag/index.d.ts +8 -0
- package/es/components/tag/index.js +3 -0
- package/es/components/tag/style/_tag.scss +26 -0
- package/es/components/tag/style/dnb-tag.css +109 -0
- package/es/components/tag/style/dnb-tag.min.css +1 -0
- package/es/components/tag/style/dnb-tag.scss +12 -0
- package/es/components/tag/style/index.d.ts +6 -0
- package/es/components/tag/style/index.js +1 -0
- package/es/components/tag/style.js +1 -0
- package/es/components/textarea/Textarea.d.ts +4 -4
- package/es/components/toggle-button/ToggleButton.d.ts +6 -6
- package/es/components/toggle-button/ToggleButtonGroup.d.ts +3 -3
- package/es/components/tooltip/Tooltip.d.ts +5 -5
- package/es/components/tooltip/TooltipContainer.d.ts +3 -3
- package/es/components/tooltip/TooltipPortal.d.ts +1 -1
- package/es/components/tooltip/TooltipWithEvents.d.ts +1 -1
- package/es/fragments/scroll-view/ScrollView.js +7 -15
- package/es/fragments/scroll-view/ScrollView.tsx +92 -0
- package/es/index.d.ts +2 -0
- package/es/index.js +2 -1
- package/es/shared/Context.js +2 -1
- package/es/style/core/helper-classes/skip-link.scss +1 -1
- package/es/style/dnb-ui-components.css +40 -0
- package/es/style/dnb-ui-components.min.css +1 -1
- package/es/style/dnb-ui-components.scss +1 -0
- package/esm/components/Tag.d.ts +14 -0
- package/esm/components/Tag.js +3 -0
- package/esm/components/accordion/Accordion.d.ts +7 -7
- package/esm/components/autocomplete/Autocomplete.d.ts +13 -13
- package/esm/components/button/Button.d.ts +7 -7
- package/esm/components/button/Button.js +6 -4
- package/esm/components/checkbox/Checkbox.d.ts +3 -3
- package/esm/components/date-picker/DatePicker.d.ts +14 -14
- package/esm/components/date-picker/DatePickerAddon.d.ts +1 -1
- package/esm/components/date-picker/DatePickerCalendar.d.ts +1 -1
- package/esm/components/date-picker/DatePickerInput.d.ts +1 -1
- package/esm/components/dropdown/Dropdown.d.ts +9 -9
- package/esm/components/form-row/FormRow.d.ts +4 -4
- package/esm/components/form-set/FormSet.d.ts +5 -5
- package/esm/components/global-error/GlobalError.d.ts +1 -1
- package/esm/components/global-status/GlobalStatus.d.ts +5 -5
- package/esm/components/heading/Heading.d.ts +2 -2
- package/esm/components/heading/HeadingProvider.d.ts +2 -2
- package/esm/components/icon/Icon.d.ts +1 -1
- package/esm/components/index.d.ts +2 -0
- package/esm/components/index.js +2 -1
- package/esm/components/input/Input.d.ts +9 -9
- package/esm/components/input-masked/InputMasked.d.ts +11 -11
- package/esm/components/input-masked/InputMasked.js +6 -4
- package/esm/components/input-masked/InputMaskedHooks.js +24 -28
- package/esm/components/input-masked/InputMaskedUtils.js +9 -20
- package/esm/components/lib.js +3 -1
- package/esm/components/modal/Modal.js +112 -250
- package/esm/components/modal/Modal.tsx +524 -0
- package/esm/components/modal/ModalContent.js +137 -224
- package/esm/components/modal/ModalContent.tsx +515 -0
- package/esm/components/modal/ModalContext.tsx +10 -0
- package/esm/components/modal/ModalRoot.js +145 -0
- package/esm/components/modal/ModalRoot.tsx +131 -0
- package/esm/components/modal/components/CloseButton.js +72 -0
- package/esm/components/modal/components/CloseButton.tsx +56 -0
- package/esm/components/modal/components/ModalHeader.js +70 -0
- package/esm/components/modal/components/ModalHeader.tsx +79 -0
- package/esm/components/modal/components/ModalHeaderBar.js +122 -0
- package/esm/components/modal/components/ModalHeaderBar.tsx +118 -0
- package/esm/components/modal/{ModalInner.js → components/ModalInner.js} +11 -17
- package/esm/components/modal/components/ModalInner.tsx +45 -0
- package/esm/components/modal/helpers.js +64 -0
- package/esm/components/modal/helpers.ts +63 -0
- package/esm/components/modal/types.js +1 -0
- package/esm/components/modal/{Modal.d.ts → types.ts} +124 -182
- package/esm/components/number-format/NumberFormat.d.ts +8 -8
- package/esm/components/pagination/Pagination.d.ts +30 -30
- package/esm/components/pagination/PaginationProvider.d.ts +2 -2
- package/esm/components/radio/Radio.d.ts +4 -4
- package/esm/components/radio/RadioGroup.d.ts +3 -3
- package/esm/components/section/Section.d.ts +3 -1
- package/esm/components/skeleton/Skeleton.d.ts +2 -2
- package/esm/components/slider/Slider.d.ts +4 -4
- package/esm/components/step-indicator/StepIndicator.d.ts +5 -5
- package/esm/components/step-indicator/StepIndicatorContext.d.ts +1 -1
- package/esm/components/step-indicator/StepIndicatorItem.d.ts +2 -2
- package/esm/components/step-indicator/StepIndicatorItem.js +1 -0
- package/esm/components/step-indicator/StepIndicatorSidebar.d.ts +3 -3
- package/esm/components/step-indicator/StepIndicatorTriggerButton.d.ts +1 -1
- package/esm/components/switch/Switch.d.ts +5 -5
- package/esm/components/tabs/Tabs.d.ts +4 -4
- package/esm/components/tabs/TabsContentWrapper.d.ts +1 -1
- package/esm/components/tag/Tag.js +63 -0
- package/esm/components/tag/Tag.tsx +95 -0
- package/esm/components/tag/index.d.ts +8 -0
- package/esm/components/tag/index.js +3 -0
- package/esm/components/tag/style/_tag.scss +26 -0
- package/esm/components/tag/style/dnb-tag.css +109 -0
- package/esm/components/tag/style/dnb-tag.min.css +1 -0
- package/esm/components/tag/style/dnb-tag.scss +12 -0
- package/esm/components/tag/style/index.d.ts +6 -0
- package/esm/components/tag/style/index.js +1 -0
- package/esm/components/tag/style.js +1 -0
- package/esm/components/textarea/Textarea.d.ts +4 -4
- package/esm/components/toggle-button/ToggleButton.d.ts +6 -6
- package/esm/components/toggle-button/ToggleButtonGroup.d.ts +3 -3
- package/esm/components/tooltip/Tooltip.d.ts +5 -5
- package/esm/components/tooltip/TooltipContainer.d.ts +3 -3
- package/esm/components/tooltip/TooltipPortal.d.ts +1 -1
- package/esm/components/tooltip/TooltipWithEvents.d.ts +1 -1
- package/esm/dnb-ui-components.min.mjs +1 -1
- package/esm/dnb-ui-elements.min.mjs +1 -1
- package/esm/dnb-ui-extensions.min.mjs +1 -1
- package/esm/dnb-ui-lib.min.mjs +2 -2
- package/esm/dnb-ui-web-components.min.mjs +2 -2
- package/esm/fragments/scroll-view/ScrollView.js +10 -16
- package/esm/fragments/scroll-view/ScrollView.tsx +92 -0
- package/esm/index.d.ts +2 -0
- package/esm/index.js +2 -1
- package/esm/shared/Context.js +2 -1
- package/esm/style/core/helper-classes/skip-link.scss +1 -1
- package/esm/style/dnb-ui-components.css +40 -0
- package/esm/style/dnb-ui-components.min.css +1 -1
- package/esm/style/dnb-ui-components.scss +1 -0
- package/fragments/scroll-view/ScrollView.js +10 -16
- package/fragments/scroll-view/ScrollView.tsx +92 -0
- package/index.d.ts +2 -0
- package/index.js +2 -1
- package/package.json +1 -1
- package/shared/Context.js +2 -1
- package/style/core/helper-classes/skip-link.scss +1 -1
- package/style/dnb-ui-components.css +40 -0
- package/style/dnb-ui-components.min.css +1 -1
- package/style/dnb-ui-components.scss +1 -0
- package/umd/dnb-ui-components.min.js +5 -5
- package/umd/dnb-ui-elements.min.js +1 -1
- package/umd/dnb-ui-extensions.min.js +1 -1
- package/umd/dnb-ui-lib.min.js +4 -4
- package/umd/dnb-ui-web-components.min.js +2 -2
- package/cjs/components/modal/ModalContent.d.ts +0 -168
- package/cjs/components/modal/ModalHeader.d.ts +0 -73
- package/cjs/components/modal/ModalInner.d.ts +0 -20
- package/cjs/fragments/scroll-view/ScrollView.d.ts +0 -1
- package/components/modal/Modal.d.ts +0 -329
- package/components/modal/ModalContent.d.ts +0 -168
- package/components/modal/ModalHeader.d.ts +0 -73
- package/components/modal/ModalHeader.js +0 -224
- package/components/modal/ModalInner.d.ts +0 -20
- package/es/components/modal/ModalContent.d.ts +0 -168
- package/es/components/modal/ModalHeader.d.ts +0 -73
- package/es/components/modal/ModalHeader.js +0 -166
- package/es/components/modal/ModalInner.d.ts +0 -20
- package/es/fragments/scroll-view/ScrollView.d.ts +0 -1
- package/esm/components/modal/ModalContent.d.ts +0 -168
- package/esm/components/modal/ModalHeader.d.ts +0 -73
- package/esm/components/modal/ModalHeader.js +0 -224
- package/esm/components/modal/ModalInner.d.ts +0 -20
- package/esm/fragments/scroll-view/ScrollView.d.ts +0 -1
- package/fragments/scroll-view/ScrollView.d.ts +0 -1
|
@@ -1,27 +1,26 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
3
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
4
|
-
const _excluded = ["root_id", "content_id", "
|
|
5
|
-
_excluded2 = ["children", "direct_dom_return"];
|
|
4
|
+
const _excluded = ["root_id", "content_id", "disabled", "spacing", "labelled_by", "focus_selector", "header_content", "bar_content", "id", "open_state", "open_delay", "trigger", "trigger_attributes", "trigger_hidden", "trigger_disabled", "trigger_variant", "trigger_text", "trigger_title", "trigger_size", "trigger_icon", "trigger_icon_position", "trigger_class"];
|
|
6
5
|
|
|
7
6
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
8
7
|
|
|
9
8
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
10
9
|
|
|
11
10
|
import React from 'react';
|
|
12
|
-
import ReactDOM from 'react-dom';
|
|
13
|
-
import PropTypes from 'prop-types';
|
|
14
11
|
import classnames from 'classnames';
|
|
15
12
|
import { SuffixContext } from '../../shared/helpers/Suffix';
|
|
16
13
|
import Context from '../../shared/Context';
|
|
17
14
|
import { warn, isTrue, makeUniqueId, extendPropsWithContext, registerElement, processChildren, dispatchCustomElementEvent } from '../../shared/component-helper';
|
|
18
|
-
import {
|
|
19
|
-
import { buttonVariantPropType } from '../button/Button';
|
|
15
|
+
import { createSpacingClasses } from '../space/SpacingHelper';
|
|
20
16
|
import HelpButtonInstance from '../help-button/HelpButtonInstance';
|
|
21
|
-
import
|
|
22
|
-
import
|
|
23
|
-
import
|
|
24
|
-
import
|
|
17
|
+
import { getListOfModalRoots, getModalRoot } from './helpers';
|
|
18
|
+
import ModalInner from './components/ModalInner';
|
|
19
|
+
import ModalHeader from './components/ModalHeader';
|
|
20
|
+
import ModalHeaderBar from './components/ModalHeaderBar';
|
|
21
|
+
import CloseButton from './components/CloseButton';
|
|
22
|
+
import ModalRoot from './ModalRoot';
|
|
23
|
+
export const ANIMATION_DURATION = 300;
|
|
25
24
|
export default class Modal extends React.PureComponent {
|
|
26
25
|
static enableWebComponent() {
|
|
27
26
|
registerElement(Modal === null || Modal === void 0 ? void 0 : Modal.tagName, Modal, Modal.defaultProps);
|
|
@@ -37,29 +36,6 @@ export default class Modal extends React.PureComponent {
|
|
|
37
36
|
return processChildren(props);
|
|
38
37
|
}
|
|
39
38
|
|
|
40
|
-
static insertModalRoot(id) {
|
|
41
|
-
if (typeof window === 'undefined') {
|
|
42
|
-
return false;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
try {
|
|
46
|
-
id = `dnb-modal-${id || 'root'}`;
|
|
47
|
-
window.__modalRoot = document.getElementById(id);
|
|
48
|
-
|
|
49
|
-
if (!window.__modalRoot) {
|
|
50
|
-
window.__modalRoot = document.createElement('div');
|
|
51
|
-
|
|
52
|
-
window.__modalRoot.setAttribute('id', id);
|
|
53
|
-
|
|
54
|
-
document.body.insertBefore(window.__modalRoot, document.body.firstChild);
|
|
55
|
-
}
|
|
56
|
-
} catch (e) {
|
|
57
|
-
warn('Modal: Could not insert dnb-modal-root', e);
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
return window.__modalRoot;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
39
|
static getDerivedStateFromProps(props, state) {
|
|
64
40
|
if (props.open_state !== state._open_state) {
|
|
65
41
|
switch (props.open_state) {
|
|
@@ -92,6 +68,24 @@ export default class Modal extends React.PureComponent {
|
|
|
92
68
|
constructor(props) {
|
|
93
69
|
super(props);
|
|
94
70
|
|
|
71
|
+
_defineProperty(this, "_id", void 0);
|
|
72
|
+
|
|
73
|
+
_defineProperty(this, "_triggerRef", void 0);
|
|
74
|
+
|
|
75
|
+
_defineProperty(this, "_onUnmount", void 0);
|
|
76
|
+
|
|
77
|
+
_defineProperty(this, "_openTimeout", void 0);
|
|
78
|
+
|
|
79
|
+
_defineProperty(this, "_closeTimeout", void 0);
|
|
80
|
+
|
|
81
|
+
_defineProperty(this, "_sideEffectsTimeout", void 0);
|
|
82
|
+
|
|
83
|
+
_defineProperty(this, "_tryToOpenTimeout", void 0);
|
|
84
|
+
|
|
85
|
+
_defineProperty(this, "activeElement", void 0);
|
|
86
|
+
|
|
87
|
+
_defineProperty(this, "isInTransition", void 0);
|
|
88
|
+
|
|
95
89
|
_defineProperty(this, "state", {
|
|
96
90
|
hide: false,
|
|
97
91
|
modalActive: false
|
|
@@ -103,6 +97,11 @@ export default class Modal extends React.PureComponent {
|
|
|
103
97
|
}
|
|
104
98
|
|
|
105
99
|
const toggleNow = () => {
|
|
100
|
+
const {
|
|
101
|
+
animation_duration = ANIMATION_DURATION,
|
|
102
|
+
no_animation = false
|
|
103
|
+
} = this.props;
|
|
104
|
+
const timeoutDuration = typeof animation_duration === 'string' ? parseFloat(animation_duration) : animation_duration;
|
|
106
105
|
const modalActive = typeof showModal === 'boolean' ? showModal : !this.state.modalActive;
|
|
107
106
|
this.isInTransition = true;
|
|
108
107
|
|
|
@@ -116,20 +115,24 @@ export default class Modal extends React.PureComponent {
|
|
|
116
115
|
});
|
|
117
116
|
};
|
|
118
117
|
|
|
119
|
-
if (modalActive === false && !isTrue(
|
|
118
|
+
if (modalActive === false && !isTrue(no_animation)) {
|
|
120
119
|
this.setState({
|
|
121
120
|
hide: true
|
|
122
121
|
});
|
|
123
|
-
this._closeTimeout = setTimeout(doItNow,
|
|
122
|
+
this._closeTimeout = setTimeout(doItNow, timeoutDuration);
|
|
124
123
|
} else {
|
|
125
124
|
doItNow();
|
|
126
125
|
}
|
|
127
126
|
};
|
|
128
127
|
|
|
129
128
|
const waitBeforeOpen = () => {
|
|
130
|
-
const
|
|
129
|
+
const {
|
|
130
|
+
open_delay,
|
|
131
|
+
no_animation
|
|
132
|
+
} = this.props;
|
|
133
|
+
const delay = typeof open_delay === 'string' ? parseFloat(open_delay) : open_delay;
|
|
131
134
|
|
|
132
|
-
if (delay > 0 && !isTrue(
|
|
135
|
+
if (delay > 0 && !isTrue(no_animation)) {
|
|
133
136
|
this._openTimeout = setTimeout(toggleNow, delay);
|
|
134
137
|
} else {
|
|
135
138
|
toggleNow();
|
|
@@ -154,11 +157,16 @@ export default class Modal extends React.PureComponent {
|
|
|
154
157
|
});
|
|
155
158
|
|
|
156
159
|
_defineProperty(this, "handleSideEffects", () => {
|
|
157
|
-
const
|
|
160
|
+
const {
|
|
161
|
+
modalActive
|
|
162
|
+
} = this.state;
|
|
163
|
+
const {
|
|
164
|
+
close_modal
|
|
165
|
+
} = this.props;
|
|
158
166
|
|
|
159
167
|
if (modalActive) {
|
|
160
|
-
if (typeof
|
|
161
|
-
const fn =
|
|
168
|
+
if (typeof close_modal === 'function') {
|
|
169
|
+
const fn = close_modal(() => {
|
|
162
170
|
this.toggleOpenClose(null, false);
|
|
163
171
|
}, this);
|
|
164
172
|
|
|
@@ -175,7 +183,7 @@ export default class Modal extends React.PureComponent {
|
|
|
175
183
|
});
|
|
176
184
|
}
|
|
177
185
|
|
|
178
|
-
if ((this.props.open_state === 'opened' || this.props.open_state === true) && this.activeElement) {
|
|
186
|
+
if ((this.props.open_state === 'opened' || this.props.open_state === true) && this.activeElement && this.activeElement instanceof HTMLElement) {
|
|
179
187
|
try {
|
|
180
188
|
this.activeElement.focus({
|
|
181
189
|
preventScroll: true
|
|
@@ -194,12 +202,12 @@ export default class Modal extends React.PureComponent {
|
|
|
194
202
|
|
|
195
203
|
_defineProperty(this, "close", (event, {
|
|
196
204
|
ifIsLatest,
|
|
197
|
-
triggeredBy
|
|
205
|
+
triggeredBy = null
|
|
198
206
|
} = {
|
|
199
207
|
ifIsLatest: true
|
|
200
208
|
}) => {
|
|
201
209
|
const {
|
|
202
|
-
prevent_close
|
|
210
|
+
prevent_close = false
|
|
203
211
|
} = this.props;
|
|
204
212
|
|
|
205
213
|
if (isTrue(prevent_close)) {
|
|
@@ -217,7 +225,7 @@ export default class Modal extends React.PureComponent {
|
|
|
217
225
|
const list = getListOfModalRoots();
|
|
218
226
|
|
|
219
227
|
if (list.length > 1) {
|
|
220
|
-
const last =
|
|
228
|
+
const last = getModalRoot(-1);
|
|
221
229
|
|
|
222
230
|
if (last !== this) {
|
|
223
231
|
return;
|
|
@@ -241,7 +249,7 @@ export default class Modal extends React.PureComponent {
|
|
|
241
249
|
componentWillUnmount() {
|
|
242
250
|
clearTimeout(this._openTimeout);
|
|
243
251
|
clearTimeout(this._closeTimeout);
|
|
244
|
-
this.removeActiveState(
|
|
252
|
+
this.removeActiveState();
|
|
245
253
|
|
|
246
254
|
this._onUnmount.forEach(fn => {
|
|
247
255
|
if (typeof fn === 'function') {
|
|
@@ -276,7 +284,7 @@ export default class Modal extends React.PureComponent {
|
|
|
276
284
|
}
|
|
277
285
|
|
|
278
286
|
removeActiveState() {
|
|
279
|
-
const last =
|
|
287
|
+
const last = getModalRoot(-1);
|
|
280
288
|
|
|
281
289
|
if (last !== null && last !== void 0 && last._id && last._id !== this._id) {
|
|
282
290
|
return this.setActiveState(last._id);
|
|
@@ -309,28 +317,28 @@ export default class Modal extends React.PureComponent {
|
|
|
309
317
|
const props = extendPropsWithContext(this.props, Modal.defaultProps, this.context.getTranslation(this.props).Modal, this.context.FormRow, this.context.Modal);
|
|
310
318
|
|
|
311
319
|
const {
|
|
312
|
-
root_id,
|
|
313
|
-
content_id,
|
|
320
|
+
root_id = 'root',
|
|
321
|
+
content_id = null,
|
|
322
|
+
disabled = null,
|
|
323
|
+
spacing = true,
|
|
324
|
+
labelled_by = null,
|
|
325
|
+
focus_selector = null,
|
|
326
|
+
header_content = null,
|
|
327
|
+
bar_content = null,
|
|
314
328
|
id,
|
|
315
329
|
open_state,
|
|
316
330
|
open_delay,
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
trigger_hidden,
|
|
326
|
-
trigger_disabled,
|
|
327
|
-
trigger_variant,
|
|
328
|
-
trigger_text,
|
|
329
|
-
trigger_title,
|
|
330
|
-
trigger_size,
|
|
331
|
+
trigger = null,
|
|
332
|
+
trigger_attributes = null,
|
|
333
|
+
trigger_hidden = 'false',
|
|
334
|
+
trigger_disabled = null,
|
|
335
|
+
trigger_variant = 'secondary',
|
|
336
|
+
trigger_text = null,
|
|
337
|
+
trigger_title = null,
|
|
338
|
+
trigger_size = null,
|
|
331
339
|
trigger_icon,
|
|
332
|
-
trigger_icon_position,
|
|
333
|
-
trigger_class
|
|
340
|
+
trigger_icon_position = 'left',
|
|
341
|
+
trigger_class = null
|
|
334
342
|
} = props,
|
|
335
343
|
rest = _objectWithoutProperties(props, _excluded);
|
|
336
344
|
|
|
@@ -343,44 +351,39 @@ export default class Modal extends React.PureComponent {
|
|
|
343
351
|
})) : this.props);
|
|
344
352
|
|
|
345
353
|
const render = suffixProps => {
|
|
346
|
-
const
|
|
354
|
+
const triggerAttributes = _objectSpread({
|
|
355
|
+
hidden: trigger_hidden,
|
|
356
|
+
disabled: trigger_disabled,
|
|
357
|
+
variant: trigger_variant,
|
|
358
|
+
text: trigger_text,
|
|
359
|
+
title: trigger_title,
|
|
360
|
+
size: trigger_size,
|
|
361
|
+
icon: trigger_icon,
|
|
362
|
+
icon_position: trigger_icon_position,
|
|
363
|
+
class: trigger_class
|
|
364
|
+
}, trigger_attributes);
|
|
347
365
|
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
for (let prop in props) {
|
|
351
|
-
if (prop.includes('trigger_') && props[prop] !== null) {
|
|
352
|
-
const name = String(prop).replace('trigger_', '');
|
|
353
|
-
|
|
354
|
-
if (name !== 'attributes' && name !== 'props' && prop !== 'element') {
|
|
355
|
-
triggerAttributes[name] = props[prop];
|
|
356
|
-
}
|
|
357
|
-
}
|
|
366
|
+
if (isTrue(disabled)) {
|
|
367
|
+
triggerAttributes.disabled = true;
|
|
358
368
|
}
|
|
359
369
|
|
|
360
370
|
if (triggerAttributes.id) {
|
|
361
371
|
this._id = triggerAttributes.id;
|
|
362
372
|
}
|
|
363
373
|
|
|
364
|
-
|
|
365
|
-
modalProps.title = triggerAttributes.title;
|
|
366
|
-
} else if (!rest.title && suffixProps) {
|
|
367
|
-
modalProps.title = this.context.translation.HelpButton.title;
|
|
368
|
-
}
|
|
374
|
+
let fallbackTitle;
|
|
369
375
|
|
|
370
|
-
if (
|
|
371
|
-
|
|
376
|
+
if (triggerAttributes.title) {
|
|
377
|
+
fallbackTitle = triggerAttributes.title;
|
|
378
|
+
} else if (suffixProps) {
|
|
379
|
+
fallbackTitle = this.context.translation.HelpButton.title;
|
|
372
380
|
}
|
|
373
381
|
|
|
374
382
|
const TriggerButton = trigger ? trigger : HelpButtonInstance;
|
|
375
|
-
return React.createElement(
|
|
376
|
-
value: _objectSpread({
|
|
377
|
-
id: this._id
|
|
378
|
-
}, rest)
|
|
379
|
-
}, TriggerButton && !isTrue(trigger_hidden) && React.createElement(TriggerButton, _extends({
|
|
383
|
+
return React.createElement(React.Fragment, null, TriggerButton && !isTrue(trigger_hidden) && React.createElement(TriggerButton, _extends({}, triggerAttributes, {
|
|
380
384
|
id: this._id,
|
|
381
|
-
title: !triggerAttributes.text ?
|
|
382
|
-
onClick: this.toggleOpenClose
|
|
383
|
-
}, triggerAttributes, {
|
|
385
|
+
title: !triggerAttributes.text ? rest.title || fallbackTitle : null,
|
|
386
|
+
onClick: this.toggleOpenClose,
|
|
384
387
|
innerRef: this._triggerRef,
|
|
385
388
|
className: classnames('dnb-modal__trigger', createSpacingClasses(props), triggerAttributes.class, triggerAttributes.className)
|
|
386
389
|
})), modalActive && modal_content && React.createElement(ModalRoot, _extends({}, rest, {
|
|
@@ -395,8 +398,8 @@ export default class Modal extends React.PureComponent {
|
|
|
395
398
|
spacing: spacing,
|
|
396
399
|
closeModal: this.close,
|
|
397
400
|
hide: hide,
|
|
398
|
-
|
|
399
|
-
}
|
|
401
|
+
title: rest.title || fallbackTitle
|
|
402
|
+
})));
|
|
400
403
|
};
|
|
401
404
|
|
|
402
405
|
return React.createElement(SuffixContext.Consumer, null, render);
|
|
@@ -418,8 +421,6 @@ _defineProperty(Modal, "Inner", ModalInner);
|
|
|
418
421
|
|
|
419
422
|
_defineProperty(Modal, "defaultProps", {
|
|
420
423
|
id: null,
|
|
421
|
-
root_id: 'root',
|
|
422
|
-
mode: 'modal',
|
|
423
424
|
focus_selector: null,
|
|
424
425
|
labelled_by: null,
|
|
425
426
|
title: null,
|
|
@@ -433,7 +434,7 @@ _defineProperty(Modal, "defaultProps", {
|
|
|
433
434
|
close_button_attributes: null,
|
|
434
435
|
prevent_close: false,
|
|
435
436
|
prevent_core_style: false,
|
|
436
|
-
animation_duration:
|
|
437
|
+
animation_duration: ANIMATION_DURATION,
|
|
437
438
|
no_animation: false,
|
|
438
439
|
no_animation_on_mobile: false,
|
|
439
440
|
fullscreen: 'auto',
|
|
@@ -444,6 +445,7 @@ _defineProperty(Modal, "defaultProps", {
|
|
|
444
445
|
open_state: null,
|
|
445
446
|
direct_dom_return: false,
|
|
446
447
|
class: null,
|
|
448
|
+
root_id: 'root',
|
|
447
449
|
className: null,
|
|
448
450
|
children: null,
|
|
449
451
|
on_open: null,
|
|
@@ -469,136 +471,4 @@ _defineProperty(Modal, "defaultProps", {
|
|
|
469
471
|
bar_content: null
|
|
470
472
|
});
|
|
471
473
|
|
|
472
|
-
process.env.NODE_ENV !== "production" ? Modal.propTypes = _objectSpread(_objectSpread({
|
|
473
|
-
id: PropTypes.string,
|
|
474
|
-
root_id: PropTypes.string,
|
|
475
|
-
mode: PropTypes.oneOf(['modal', 'drawer']),
|
|
476
|
-
focus_selector: PropTypes.string,
|
|
477
|
-
labelled_by: PropTypes.string,
|
|
478
|
-
title: PropTypes.node,
|
|
479
|
-
disabled: PropTypes.oneOfType([PropTypes.string, PropTypes.bool]),
|
|
480
|
-
spacing: PropTypes.oneOfType([PropTypes.string, PropTypes.bool]),
|
|
481
|
-
open_delay: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
482
|
-
content_id: PropTypes.string,
|
|
483
|
-
dialog_title: PropTypes.string,
|
|
484
|
-
close_title: PropTypes.string,
|
|
485
|
-
hide_close_button: PropTypes.oneOfType([PropTypes.string, PropTypes.bool]),
|
|
486
|
-
close_button_attributes: PropTypes.object,
|
|
487
|
-
prevent_close: PropTypes.oneOfType([PropTypes.string, PropTypes.bool]),
|
|
488
|
-
prevent_core_style: PropTypes.oneOfType([PropTypes.string, PropTypes.bool]),
|
|
489
|
-
animation_duration: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
490
|
-
no_animation: PropTypes.oneOfType([PropTypes.string, PropTypes.bool]),
|
|
491
|
-
no_animation_on_mobile: PropTypes.oneOfType([PropTypes.string, PropTypes.bool]),
|
|
492
|
-
fullscreen: PropTypes.oneOf(['auto', true, false, 'true', 'false']),
|
|
493
|
-
min_width: PropTypes.string,
|
|
494
|
-
max_width: PropTypes.string,
|
|
495
|
-
align_content: PropTypes.oneOf(['left', 'center', 'centered', 'right']),
|
|
496
|
-
container_placement: PropTypes.oneOf(['left', 'right', 'top', 'bottom']),
|
|
497
|
-
open_state: PropTypes.oneOfType([PropTypes.oneOf(['opened', 'closed']), PropTypes.bool]),
|
|
498
|
-
direct_dom_return: PropTypes.oneOfType([PropTypes.string, PropTypes.bool])
|
|
499
|
-
}, spacingPropTypes), {}, {
|
|
500
|
-
class: PropTypes.string,
|
|
501
|
-
className: PropTypes.string,
|
|
502
|
-
children: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
|
|
503
|
-
on_open: PropTypes.func,
|
|
504
|
-
on_close: PropTypes.func,
|
|
505
|
-
on_close_prevent: PropTypes.func,
|
|
506
|
-
open_modal: PropTypes.func,
|
|
507
|
-
close_modal: PropTypes.func,
|
|
508
|
-
trigger: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
|
|
509
|
-
trigger_attributes: PropTypes.object,
|
|
510
|
-
trigger_hidden: PropTypes.oneOfType([PropTypes.string, PropTypes.bool]),
|
|
511
|
-
trigger_disabled: PropTypes.oneOfType([PropTypes.string, PropTypes.bool]),
|
|
512
|
-
trigger_variant: buttonVariantPropType.variant,
|
|
513
|
-
trigger_text: PropTypes.string,
|
|
514
|
-
trigger_title: PropTypes.string,
|
|
515
|
-
trigger_size: PropTypes.string,
|
|
516
|
-
trigger_icon: PropTypes.oneOfType([PropTypes.string, PropTypes.node, PropTypes.func]),
|
|
517
|
-
trigger_icon_position: PropTypes.oneOf(['left', 'right']),
|
|
518
|
-
trigger_class: PropTypes.string,
|
|
519
|
-
overlay_class: PropTypes.string,
|
|
520
|
-
content_class: PropTypes.string,
|
|
521
|
-
modal_content: PropTypes.oneOfType([PropTypes.string, PropTypes.node, PropTypes.func]),
|
|
522
|
-
header_content: PropTypes.node,
|
|
523
|
-
bar_content: PropTypes.node
|
|
524
|
-
}) : void 0;
|
|
525
|
-
|
|
526
|
-
class ModalRoot extends React.PureComponent {
|
|
527
|
-
constructor(...args) {
|
|
528
|
-
super(...args);
|
|
529
|
-
|
|
530
|
-
_defineProperty(this, "state", {
|
|
531
|
-
isMounted: false
|
|
532
|
-
});
|
|
533
|
-
}
|
|
534
|
-
|
|
535
|
-
componentDidMount() {
|
|
536
|
-
if (!isTrue(this.props.direct_dom_return)) {
|
|
537
|
-
Modal.insertModalRoot(this.props.root_id);
|
|
538
|
-
|
|
539
|
-
try {
|
|
540
|
-
if (!this.portalElem) {
|
|
541
|
-
this.portalElem = document.createElement('div');
|
|
542
|
-
this.portalElem.className = 'dnb-modal-root__inner';
|
|
543
|
-
}
|
|
544
|
-
|
|
545
|
-
if (this.portalElem && typeof window !== 'undefined' && window.__modalRoot) {
|
|
546
|
-
window.__modalRoot.appendChild(this.portalElem);
|
|
547
|
-
}
|
|
548
|
-
} catch (e) {
|
|
549
|
-
warn(e);
|
|
550
|
-
}
|
|
551
|
-
|
|
552
|
-
this.setState({
|
|
553
|
-
isMounted: true
|
|
554
|
-
});
|
|
555
|
-
}
|
|
556
|
-
}
|
|
557
|
-
|
|
558
|
-
componentWillUnmount() {
|
|
559
|
-
try {
|
|
560
|
-
if (this.portalElem && typeof window !== 'undefined' && window.__modalRoot && window.__modalRoot.removeChild) {
|
|
561
|
-
window.__modalRoot.removeChild(this.portalElem);
|
|
562
|
-
|
|
563
|
-
this.portalElem = null;
|
|
564
|
-
}
|
|
565
|
-
} catch (e) {
|
|
566
|
-
warn(e);
|
|
567
|
-
}
|
|
568
|
-
}
|
|
569
|
-
|
|
570
|
-
render() {
|
|
571
|
-
const _this$props = this.props,
|
|
572
|
-
{
|
|
573
|
-
children,
|
|
574
|
-
direct_dom_return
|
|
575
|
-
} = _this$props,
|
|
576
|
-
props = _objectWithoutProperties(_this$props, _excluded2);
|
|
577
|
-
|
|
578
|
-
if (isTrue(direct_dom_return)) {
|
|
579
|
-
return React.createElement(ModalContent, props, children);
|
|
580
|
-
}
|
|
581
|
-
|
|
582
|
-
if (this.portalElem && typeof window !== 'undefined' && window.__modalRoot && this.state.isMounted) {
|
|
583
|
-
return ReactDOM.createPortal(React.createElement(ModalContent, props, children), this.portalElem);
|
|
584
|
-
}
|
|
585
|
-
|
|
586
|
-
return null;
|
|
587
|
-
}
|
|
588
|
-
|
|
589
|
-
}
|
|
590
|
-
|
|
591
|
-
_defineProperty(ModalRoot, "defaultProps", {
|
|
592
|
-
id: null,
|
|
593
|
-
root_id: null,
|
|
594
|
-
direct_dom_return: false,
|
|
595
|
-
children: null
|
|
596
|
-
});
|
|
597
|
-
|
|
598
|
-
process.env.NODE_ENV !== "production" ? ModalRoot.propTypes = {
|
|
599
|
-
id: PropTypes.string,
|
|
600
|
-
root_id: PropTypes.string,
|
|
601
|
-
direct_dom_return: PropTypes.oneOfType([PropTypes.string, PropTypes.bool]),
|
|
602
|
-
children: PropTypes.oneOfType([PropTypes.string, PropTypes.node, PropTypes.func])
|
|
603
|
-
} : void 0;
|
|
604
474
|
export { CloseButton };
|