@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
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import ReactDOM from 'react-dom'
|
|
3
|
+
import { warn, isTrue } from '../../shared/component-helper'
|
|
4
|
+
import ModalContent from './ModalContent'
|
|
5
|
+
import { ModalContentProps } from './types'
|
|
6
|
+
|
|
7
|
+
declare global {
|
|
8
|
+
interface Window {
|
|
9
|
+
__modalRoot: HTMLElement
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface ModalRootProps extends ModalContentProps {
|
|
14
|
+
/**
|
|
15
|
+
* The id used internal in the modal/drawer root element. Defaults to `root`, so the element id will be `dnb-modal-root`.
|
|
16
|
+
*/
|
|
17
|
+
id?: string
|
|
18
|
+
root_id?: string
|
|
19
|
+
direct_dom_return?: string | boolean
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* The content which will appear when triggering the modal/drawer.
|
|
23
|
+
*/
|
|
24
|
+
children?: string | React.ReactNode | ((...args: any[]) => any)
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
interface ModalRootState {
|
|
28
|
+
isMounted: boolean
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export default class ModalRoot extends React.PureComponent<
|
|
32
|
+
ModalRootProps,
|
|
33
|
+
ModalRootState
|
|
34
|
+
> {
|
|
35
|
+
portalElem: HTMLDivElement | null
|
|
36
|
+
static defaultProps = {
|
|
37
|
+
id: null,
|
|
38
|
+
root_id: 'root',
|
|
39
|
+
direct_dom_return: false,
|
|
40
|
+
children: null,
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
state = {
|
|
44
|
+
isMounted: false,
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
static insertModalRoot(id) {
|
|
48
|
+
if (typeof window === 'undefined') {
|
|
49
|
+
return false
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
try {
|
|
53
|
+
id = `dnb-modal-${id || 'root'}`
|
|
54
|
+
window.__modalRoot = document.getElementById(id)
|
|
55
|
+
if (!window.__modalRoot) {
|
|
56
|
+
window.__modalRoot = document.createElement('div')
|
|
57
|
+
window.__modalRoot.setAttribute('id', id)
|
|
58
|
+
document.body.insertBefore(
|
|
59
|
+
window.__modalRoot,
|
|
60
|
+
document.body.firstChild
|
|
61
|
+
)
|
|
62
|
+
}
|
|
63
|
+
} catch (e) {
|
|
64
|
+
warn('Modal: Could not insert dnb-modal-root', e)
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
return window.__modalRoot
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
componentDidMount() {
|
|
71
|
+
const { direct_dom_return = false, root_id = 'root' } = this.props
|
|
72
|
+
if (!isTrue(direct_dom_return)) {
|
|
73
|
+
ModalRoot.insertModalRoot(root_id)
|
|
74
|
+
|
|
75
|
+
try {
|
|
76
|
+
if (!this.portalElem) {
|
|
77
|
+
this.portalElem = document.createElement('div')
|
|
78
|
+
this.portalElem.className = 'dnb-modal-root__inner'
|
|
79
|
+
}
|
|
80
|
+
if (
|
|
81
|
+
this.portalElem &&
|
|
82
|
+
typeof window !== 'undefined' &&
|
|
83
|
+
window.__modalRoot
|
|
84
|
+
) {
|
|
85
|
+
window.__modalRoot.appendChild(this.portalElem)
|
|
86
|
+
}
|
|
87
|
+
} catch (e) {
|
|
88
|
+
warn(e)
|
|
89
|
+
}
|
|
90
|
+
this.setState({ isMounted: true })
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
componentWillUnmount() {
|
|
95
|
+
try {
|
|
96
|
+
if (
|
|
97
|
+
this.portalElem &&
|
|
98
|
+
typeof window !== 'undefined' &&
|
|
99
|
+
window.__modalRoot &&
|
|
100
|
+
window.__modalRoot.removeChild
|
|
101
|
+
) {
|
|
102
|
+
window.__modalRoot.removeChild(this.portalElem)
|
|
103
|
+
this.portalElem = null
|
|
104
|
+
}
|
|
105
|
+
} catch (e) {
|
|
106
|
+
warn(e)
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
render() {
|
|
111
|
+
const { children, direct_dom_return, ...props } = this.props
|
|
112
|
+
|
|
113
|
+
if (isTrue(direct_dom_return)) {
|
|
114
|
+
return <ModalContent {...props}>{children}</ModalContent>
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
if (
|
|
118
|
+
this.portalElem &&
|
|
119
|
+
typeof window !== 'undefined' &&
|
|
120
|
+
window.__modalRoot &&
|
|
121
|
+
this.state.isMounted
|
|
122
|
+
) {
|
|
123
|
+
return ReactDOM.createPortal(
|
|
124
|
+
<ModalContent {...props}>{children}</ModalContent>,
|
|
125
|
+
this.portalElem
|
|
126
|
+
)
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
return null
|
|
130
|
+
}
|
|
131
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
4
|
+
const _excluded = ["close_title", "size", "icon_position", "className"];
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import classnames from 'classnames';
|
|
7
|
+
import { extendPropsWithContext } from '../../../shared/component-helper';
|
|
8
|
+
import Button from '../../button/Button';
|
|
9
|
+
import Context from '../../../shared/Context';
|
|
10
|
+
export default class CloseButton extends React.PureComponent {
|
|
11
|
+
render() {
|
|
12
|
+
const _extendPropsWithConte = extendPropsWithContext(this.props, CloseButton.defaultProps, this.context.getTranslation(this.props).Modal),
|
|
13
|
+
{
|
|
14
|
+
close_title = null,
|
|
15
|
+
size = 'large',
|
|
16
|
+
icon_position = 'left',
|
|
17
|
+
className = null
|
|
18
|
+
} = _extendPropsWithConte,
|
|
19
|
+
button_props = _objectWithoutProperties(_extendPropsWithConte, _excluded);
|
|
20
|
+
|
|
21
|
+
return React.createElement(Button, _extends({
|
|
22
|
+
type: "button",
|
|
23
|
+
variant: "tertiary",
|
|
24
|
+
icon: "close",
|
|
25
|
+
text: close_title,
|
|
26
|
+
size: size,
|
|
27
|
+
icon_position: icon_position,
|
|
28
|
+
className: classnames('dnb-modal__close-button', className)
|
|
29
|
+
}, button_props));
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
_defineProperty(CloseButton, "contextType", Context);
|
|
35
|
+
|
|
36
|
+
_defineProperty(CloseButton, "defaultProps", {
|
|
37
|
+
close_title: null,
|
|
38
|
+
size: 'large',
|
|
39
|
+
icon_position: 'left',
|
|
40
|
+
className: null
|
|
41
|
+
});
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Web Modal Component
|
|
3
|
+
*
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import React from 'react'
|
|
7
|
+
import classnames from 'classnames'
|
|
8
|
+
import { extendPropsWithContext } from '../../../shared/component-helper'
|
|
9
|
+
import Button from '../../button/Button'
|
|
10
|
+
import Context from '../../../shared/Context'
|
|
11
|
+
import { ButtonProps } from '../../button'
|
|
12
|
+
|
|
13
|
+
export interface CloseButtonProps extends ButtonProps {
|
|
14
|
+
/**
|
|
15
|
+
* The title of the close button. Defaults to <em>Close</em> or <em>Lukk</em>.
|
|
16
|
+
*/
|
|
17
|
+
close_title?: string
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export default class CloseButton extends React.PureComponent<CloseButtonProps> {
|
|
21
|
+
static contextType = Context
|
|
22
|
+
static defaultProps = {
|
|
23
|
+
close_title: null,
|
|
24
|
+
size: 'large',
|
|
25
|
+
icon_position: 'left',
|
|
26
|
+
className: null,
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
render() {
|
|
30
|
+
// use only the props from context, who are available here anyway
|
|
31
|
+
const {
|
|
32
|
+
close_title = null,
|
|
33
|
+
size = 'large',
|
|
34
|
+
icon_position = 'left',
|
|
35
|
+
className = null,
|
|
36
|
+
...button_props
|
|
37
|
+
} = extendPropsWithContext(
|
|
38
|
+
this.props,
|
|
39
|
+
CloseButton.defaultProps,
|
|
40
|
+
this.context.getTranslation(this.props).Modal
|
|
41
|
+
)
|
|
42
|
+
|
|
43
|
+
return (
|
|
44
|
+
<Button
|
|
45
|
+
type="button"
|
|
46
|
+
variant="tertiary"
|
|
47
|
+
icon="close"
|
|
48
|
+
text={close_title}
|
|
49
|
+
size={size}
|
|
50
|
+
icon_position={icon_position}
|
|
51
|
+
className={classnames('dnb-modal__close-button', className)}
|
|
52
|
+
{...button_props}
|
|
53
|
+
/>
|
|
54
|
+
)
|
|
55
|
+
}
|
|
56
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
4
|
+
const _excluded = ["title", "className", "children", "ref"];
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import classnames from 'classnames';
|
|
7
|
+
import { findElementInChildren } from '../../../shared/component-helper';
|
|
8
|
+
import Section from '../../section/Section';
|
|
9
|
+
import ModalContext from '../ModalContext';
|
|
10
|
+
import H1 from '../../../elements/H1';
|
|
11
|
+
export default class ModalHeader extends React.PureComponent {
|
|
12
|
+
render() {
|
|
13
|
+
const _this$props = this.props,
|
|
14
|
+
{
|
|
15
|
+
title = null,
|
|
16
|
+
className = null,
|
|
17
|
+
children = null,
|
|
18
|
+
ref
|
|
19
|
+
} = _this$props,
|
|
20
|
+
props = _objectWithoutProperties(_this$props, _excluded);
|
|
21
|
+
|
|
22
|
+
const customHeader = findElementInChildren(children, cur => {
|
|
23
|
+
return cur.type === 'h1' || cur.type === H1;
|
|
24
|
+
});
|
|
25
|
+
const usedTitle = title || this.context.title;
|
|
26
|
+
const showTitle = !customHeader && usedTitle;
|
|
27
|
+
return React.createElement(Section, _extends({
|
|
28
|
+
style_type: "white",
|
|
29
|
+
className: classnames('dnb-modal__header', className),
|
|
30
|
+
id: showTitle ? 'dnb-modal-' + this.context.id + '-title' : undefined
|
|
31
|
+
}, props), showTitle && React.createElement("h1", {
|
|
32
|
+
className: "dnb-modal__title dnb-space__top--zero dnb-space__bottom--small " + (this.context.mode === 'drawer' ? 'dnb-h--x-large' : 'dnb-h--large')
|
|
33
|
+
}, usedTitle), React.createElement("div", {
|
|
34
|
+
className: "dnb-modal__header__inner"
|
|
35
|
+
}, children));
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
_defineProperty(ModalHeader, "contextType", ModalContext);
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Web Modal Component
|
|
3
|
+
*
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import React from 'react'
|
|
7
|
+
import classnames from 'classnames'
|
|
8
|
+
import { findElementInChildren } from '../../../shared/component-helper'
|
|
9
|
+
import Section from '../../section/Section'
|
|
10
|
+
import { SectionProps } from '../../section'
|
|
11
|
+
import ModalContext from '../ModalContext'
|
|
12
|
+
import H1 from '../../../elements/H1'
|
|
13
|
+
import { ReactChildType } from '../types'
|
|
14
|
+
|
|
15
|
+
interface ModalHeaderProps {
|
|
16
|
+
/**
|
|
17
|
+
* The content which will appear when triggering the modal/drawer.
|
|
18
|
+
*/
|
|
19
|
+
children?: ReactChildType
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* The modal/drawer title. Displays on the very top of the content.
|
|
23
|
+
*/
|
|
24
|
+
title?: React.ReactNode | string
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Give the inner content wrapper a class name (maps to `dnb-modal__content__inner`).
|
|
28
|
+
*/
|
|
29
|
+
className?: string
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export default class ModalHeader extends React.PureComponent<
|
|
33
|
+
ModalHeaderProps & SectionProps
|
|
34
|
+
> {
|
|
35
|
+
static contextType = ModalContext
|
|
36
|
+
render() {
|
|
37
|
+
const {
|
|
38
|
+
title = null,
|
|
39
|
+
className = null,
|
|
40
|
+
children = null,
|
|
41
|
+
ref, // eslint-disable-line
|
|
42
|
+
...props
|
|
43
|
+
} = this.props
|
|
44
|
+
|
|
45
|
+
const customHeader = findElementInChildren(children, (cur) => {
|
|
46
|
+
return cur.type === 'h1' || cur.type === H1
|
|
47
|
+
})
|
|
48
|
+
|
|
49
|
+
const usedTitle = title || this.context.title
|
|
50
|
+
const showTitle = !customHeader && usedTitle
|
|
51
|
+
|
|
52
|
+
return (
|
|
53
|
+
<Section
|
|
54
|
+
style_type="white"
|
|
55
|
+
className={classnames('dnb-modal__header', className)}
|
|
56
|
+
id={
|
|
57
|
+
showTitle ? 'dnb-modal-' + this.context.id + '-title' : undefined
|
|
58
|
+
}
|
|
59
|
+
{...props}
|
|
60
|
+
>
|
|
61
|
+
{showTitle && (
|
|
62
|
+
<h1
|
|
63
|
+
className={classnames(
|
|
64
|
+
'dnb-modal__title',
|
|
65
|
+
'dnb-space__top--zero',
|
|
66
|
+
'dnb-space__bottom--small',
|
|
67
|
+
this.context.mode === 'drawer'
|
|
68
|
+
? 'dnb-h--x-large'
|
|
69
|
+
: 'dnb-h--large'
|
|
70
|
+
)}
|
|
71
|
+
>
|
|
72
|
+
{usedTitle}
|
|
73
|
+
</h1>
|
|
74
|
+
)}
|
|
75
|
+
<div className="dnb-modal__header__inner">{children}</div>
|
|
76
|
+
</Section>
|
|
77
|
+
)
|
|
78
|
+
}
|
|
79
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
4
|
+
const _excluded = ["className", "children", "ref"];
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import classnames from 'classnames';
|
|
7
|
+
import { isTrue } from '../../../shared/component-helper';
|
|
8
|
+
import Section from '../../section/Section';
|
|
9
|
+
import ModalContext from '../ModalContext';
|
|
10
|
+
import CloseButton from './CloseButton';
|
|
11
|
+
export default class ModalHeaderBar extends React.PureComponent {
|
|
12
|
+
constructor(props) {
|
|
13
|
+
super(props);
|
|
14
|
+
|
|
15
|
+
_defineProperty(this, "_ref", void 0);
|
|
16
|
+
|
|
17
|
+
_defineProperty(this, "intersectionObserver", void 0);
|
|
18
|
+
|
|
19
|
+
_defineProperty(this, "state", {
|
|
20
|
+
showShadow: false
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
this._ref = React.createRef();
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
componentDidMount() {
|
|
27
|
+
if (typeof window !== 'undefined' && typeof IntersectionObserver !== 'undefined' && this._ref.current) {
|
|
28
|
+
const marginTop = -this._ref.current.clientHeight;
|
|
29
|
+
this.intersectionObserver = new IntersectionObserver(entries => {
|
|
30
|
+
const [entry] = entries;
|
|
31
|
+
this.setState({
|
|
32
|
+
showShadow: !entry.isIntersecting
|
|
33
|
+
});
|
|
34
|
+
}, {
|
|
35
|
+
rootMargin: `${marginTop}px 0px 0px 0px`,
|
|
36
|
+
threshold: 0.001
|
|
37
|
+
});
|
|
38
|
+
this.intersectionObserver.observe(this._ref.current);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
componentWillUnmount() {
|
|
43
|
+
var _this$intersectionObs;
|
|
44
|
+
|
|
45
|
+
(_this$intersectionObs = this.intersectionObserver) === null || _this$intersectionObs === void 0 ? void 0 : _this$intersectionObs.disconnect();
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
render() {
|
|
49
|
+
const _this$props = this.props,
|
|
50
|
+
{
|
|
51
|
+
className = null,
|
|
52
|
+
children = null,
|
|
53
|
+
ref
|
|
54
|
+
} = _this$props,
|
|
55
|
+
props = _objectWithoutProperties(_this$props, _excluded);
|
|
56
|
+
|
|
57
|
+
const {
|
|
58
|
+
showShadow
|
|
59
|
+
} = this.state;
|
|
60
|
+
const {
|
|
61
|
+
title,
|
|
62
|
+
hide_close_button = false,
|
|
63
|
+
close_button_attributes,
|
|
64
|
+
onCloseClickHandler,
|
|
65
|
+
close_title
|
|
66
|
+
} = this.context;
|
|
67
|
+
|
|
68
|
+
if (!title && isTrue(hide_close_button) && !this._ref.current) {
|
|
69
|
+
return null;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
return React.createElement(Section, _extends({
|
|
73
|
+
style_type: "white",
|
|
74
|
+
className: classnames('dnb-modal__header__bar', className, showShadow && 'dnb-modal__header__bar--sticky'),
|
|
75
|
+
inner_ref: this._ref
|
|
76
|
+
}, props), React.createElement("div", {
|
|
77
|
+
className: "dnb-modal__header__bar__inner"
|
|
78
|
+
}, children), !isTrue(hide_close_button) && React.createElement("div", {
|
|
79
|
+
className: "dnb-modal__header__bar__close"
|
|
80
|
+
}, React.createElement(CloseButton, _extends({
|
|
81
|
+
on_click: onCloseClickHandler,
|
|
82
|
+
close_title: close_title
|
|
83
|
+
}, close_button_attributes))));
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
_defineProperty(ModalHeaderBar, "contextType", ModalContext);
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Web Modal Component
|
|
3
|
+
*
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import React from 'react'
|
|
7
|
+
import classnames from 'classnames'
|
|
8
|
+
import { isTrue } from '../../../shared/component-helper'
|
|
9
|
+
import Section from '../../section/Section'
|
|
10
|
+
import ModalContext from '../ModalContext'
|
|
11
|
+
import CloseButton from './CloseButton'
|
|
12
|
+
import { SectionProps } from '../../Section'
|
|
13
|
+
|
|
14
|
+
export interface ModalHeaderBarProps extends SectionProps {
|
|
15
|
+
/**
|
|
16
|
+
* The content which will appear when triggering the modal/drawer.
|
|
17
|
+
*/
|
|
18
|
+
children?: React.ReactNode
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Give the inner content wrapper a class name (maps to `dnb-modal__content__inner`).
|
|
22
|
+
*/
|
|
23
|
+
className?: string
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
interface ModalHeaderBarState {
|
|
27
|
+
showShadow: boolean
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export default class ModalHeaderBar extends React.PureComponent<
|
|
31
|
+
ModalHeaderBarProps,
|
|
32
|
+
ModalHeaderBarState
|
|
33
|
+
> {
|
|
34
|
+
static contextType = ModalContext
|
|
35
|
+
_ref: React.RefObject<any>
|
|
36
|
+
intersectionObserver: IntersectionObserver
|
|
37
|
+
|
|
38
|
+
constructor(props) {
|
|
39
|
+
super(props)
|
|
40
|
+
this._ref = React.createRef()
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
state = { showShadow: false }
|
|
44
|
+
|
|
45
|
+
componentDidMount() {
|
|
46
|
+
if (
|
|
47
|
+
typeof window !== 'undefined' &&
|
|
48
|
+
typeof IntersectionObserver !== 'undefined' &&
|
|
49
|
+
this._ref.current
|
|
50
|
+
) {
|
|
51
|
+
const marginTop = -this._ref.current.clientHeight
|
|
52
|
+
this.intersectionObserver = new IntersectionObserver(
|
|
53
|
+
(entries) => {
|
|
54
|
+
const [entry] = entries
|
|
55
|
+
this.setState({
|
|
56
|
+
showShadow: !entry.isIntersecting,
|
|
57
|
+
})
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
rootMargin: `${marginTop}px 0px 0px 0px`,
|
|
61
|
+
threshold: 0.001,
|
|
62
|
+
}
|
|
63
|
+
)
|
|
64
|
+
|
|
65
|
+
this.intersectionObserver.observe(this._ref.current)
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
componentWillUnmount() {
|
|
70
|
+
this.intersectionObserver?.disconnect()
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
render() {
|
|
74
|
+
const {
|
|
75
|
+
className = null,
|
|
76
|
+
children = null,
|
|
77
|
+
ref, //eslint-disable-line
|
|
78
|
+
...props
|
|
79
|
+
} = this.props
|
|
80
|
+
const { showShadow } = this.state
|
|
81
|
+
const {
|
|
82
|
+
title,
|
|
83
|
+
hide_close_button = false,
|
|
84
|
+
close_button_attributes,
|
|
85
|
+
onCloseClickHandler,
|
|
86
|
+
close_title,
|
|
87
|
+
} = this.context
|
|
88
|
+
|
|
89
|
+
if (!title && isTrue(hide_close_button) && !this._ref.current) {
|
|
90
|
+
return null
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
return (
|
|
94
|
+
<Section
|
|
95
|
+
style_type="white"
|
|
96
|
+
className={classnames(
|
|
97
|
+
'dnb-modal__header__bar',
|
|
98
|
+
showShadow && 'dnb-modal__header__bar--sticky',
|
|
99
|
+
className
|
|
100
|
+
)}
|
|
101
|
+
inner_ref={this._ref}
|
|
102
|
+
{...props}
|
|
103
|
+
>
|
|
104
|
+
<div className="dnb-modal__header__bar__inner">{children}</div>
|
|
105
|
+
|
|
106
|
+
{!isTrue(hide_close_button) && (
|
|
107
|
+
<div className="dnb-modal__header__bar__close">
|
|
108
|
+
<CloseButton
|
|
109
|
+
on_click={onCloseClickHandler}
|
|
110
|
+
close_title={close_title}
|
|
111
|
+
{...close_button_attributes}
|
|
112
|
+
/>
|
|
113
|
+
</div>
|
|
114
|
+
)}
|
|
115
|
+
</Section>
|
|
116
|
+
)
|
|
117
|
+
}
|
|
118
|
+
}
|
|
@@ -1,16 +1,15 @@
|
|
|
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 = ["className", "style_type"];
|
|
4
|
+
const _excluded = ["className", "style_type", "ref"];
|
|
5
5
|
import React from 'react';
|
|
6
|
-
import PropTypes from 'prop-types';
|
|
7
6
|
import classnames from 'classnames';
|
|
8
|
-
import Section from '
|
|
9
|
-
import ModalContext from '
|
|
7
|
+
import Section from '../../section/Section';
|
|
8
|
+
import ModalContext from '../ModalContext';
|
|
10
9
|
export default class ModalInner extends React.PureComponent {
|
|
11
10
|
componentDidMount() {
|
|
12
11
|
const {
|
|
13
|
-
style_type
|
|
12
|
+
style_type = 'black-3'
|
|
14
13
|
} = this.props;
|
|
15
14
|
|
|
16
15
|
if (style_type) {
|
|
@@ -21,8 +20,9 @@ export default class ModalInner extends React.PureComponent {
|
|
|
21
20
|
render() {
|
|
22
21
|
const _this$props = this.props,
|
|
23
22
|
{
|
|
24
|
-
className,
|
|
25
|
-
style_type
|
|
23
|
+
className = null,
|
|
24
|
+
style_type = 'black-3',
|
|
25
|
+
ref
|
|
26
26
|
} = _this$props,
|
|
27
27
|
props = _objectWithoutProperties(_this$props, _excluded);
|
|
28
28
|
|
|
@@ -34,14 +34,4 @@ export default class ModalInner extends React.PureComponent {
|
|
|
34
34
|
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
_defineProperty(ModalInner, "contextType", ModalContext);
|
|
38
|
-
|
|
39
|
-
_defineProperty(ModalInner, "defaultProps", {
|
|
40
|
-
style_type: 'black-3',
|
|
41
|
-
className: null
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
process.env.NODE_ENV !== "production" ? ModalInner.propTypes = {
|
|
45
|
-
style_type: PropTypes.string,
|
|
46
|
-
className: PropTypes.string
|
|
47
|
-
} : void 0;
|
|
37
|
+
_defineProperty(ModalInner, "contextType", ModalContext);
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Web Modal Component
|
|
3
|
+
*
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import React from 'react'
|
|
7
|
+
import classnames from 'classnames'
|
|
8
|
+
import Section from '../../section/Section'
|
|
9
|
+
import ModalContext from '../ModalContext'
|
|
10
|
+
import { SectionProps } from '../../Section'
|
|
11
|
+
|
|
12
|
+
export interface ModalInnerProps extends SectionProps {
|
|
13
|
+
/**
|
|
14
|
+
* Give the inner content wrapper a class name (maps to `dnb-modal__content__inner`).
|
|
15
|
+
*/
|
|
16
|
+
className?: string
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export default class ModalInner extends React.PureComponent<ModalInnerProps> {
|
|
20
|
+
static contextType = ModalContext
|
|
21
|
+
|
|
22
|
+
componentDidMount() {
|
|
23
|
+
const { style_type = 'black-3' } = this.props
|
|
24
|
+
if (style_type) {
|
|
25
|
+
this.context.setBackgroundColor(style_type)
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
render() {
|
|
30
|
+
const {
|
|
31
|
+
className = null,
|
|
32
|
+
style_type = 'black-3',
|
|
33
|
+
ref, // eslint-disable-line
|
|
34
|
+
...props
|
|
35
|
+
} = this.props
|
|
36
|
+
|
|
37
|
+
return (
|
|
38
|
+
<Section
|
|
39
|
+
style_type={style_type}
|
|
40
|
+
className={classnames('dnb-modal__wrapper__inner', className)}
|
|
41
|
+
{...props}
|
|
42
|
+
/>
|
|
43
|
+
)
|
|
44
|
+
}
|
|
45
|
+
}
|