@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,194 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
4
|
+
|
|
5
|
+
require("core-js/modules/es.object.get-prototype-of.js");
|
|
6
|
+
|
|
7
|
+
require("core-js/modules/es.object.to-string.js");
|
|
8
|
+
|
|
9
|
+
require("core-js/modules/es.reflect.construct.js");
|
|
10
|
+
|
|
11
|
+
require("core-js/modules/es.object.keys.js");
|
|
12
|
+
|
|
13
|
+
require("core-js/modules/es.array.index-of.js");
|
|
14
|
+
|
|
15
|
+
require("core-js/modules/es.symbol.js");
|
|
16
|
+
|
|
17
|
+
require("core-js/modules/es.symbol.description.js");
|
|
18
|
+
|
|
19
|
+
require("core-js/modules/es.symbol.iterator.js");
|
|
20
|
+
|
|
21
|
+
require("core-js/modules/es.array.iterator.js");
|
|
22
|
+
|
|
23
|
+
require("core-js/modules/es.string.iterator.js");
|
|
24
|
+
|
|
25
|
+
require("core-js/modules/web.dom-collections.iterator.js");
|
|
26
|
+
|
|
27
|
+
Object.defineProperty(exports, "__esModule", {
|
|
28
|
+
value: true
|
|
29
|
+
});
|
|
30
|
+
exports.default = void 0;
|
|
31
|
+
|
|
32
|
+
require("core-js/modules/es.array.concat.js");
|
|
33
|
+
|
|
34
|
+
var _react = _interopRequireDefault(require("react"));
|
|
35
|
+
|
|
36
|
+
var _reactDom = _interopRequireDefault(require("react-dom"));
|
|
37
|
+
|
|
38
|
+
var _componentHelper = require("../../shared/component-helper");
|
|
39
|
+
|
|
40
|
+
var _ModalContent = _interopRequireDefault(require("./ModalContent"));
|
|
41
|
+
|
|
42
|
+
var _excluded = ["children", "direct_dom_return"];
|
|
43
|
+
|
|
44
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
45
|
+
|
|
46
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
47
|
+
|
|
48
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
49
|
+
|
|
50
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
51
|
+
|
|
52
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
53
|
+
|
|
54
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
55
|
+
|
|
56
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
57
|
+
|
|
58
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
59
|
+
|
|
60
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
61
|
+
|
|
62
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
63
|
+
|
|
64
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
65
|
+
|
|
66
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
67
|
+
|
|
68
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
69
|
+
|
|
70
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
71
|
+
|
|
72
|
+
var ModalRoot = function (_React$PureComponent) {
|
|
73
|
+
_inherits(ModalRoot, _React$PureComponent);
|
|
74
|
+
|
|
75
|
+
var _super = _createSuper(ModalRoot);
|
|
76
|
+
|
|
77
|
+
function ModalRoot() {
|
|
78
|
+
var _this;
|
|
79
|
+
|
|
80
|
+
_classCallCheck(this, ModalRoot);
|
|
81
|
+
|
|
82
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
83
|
+
args[_key] = arguments[_key];
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
87
|
+
|
|
88
|
+
_defineProperty(_assertThisInitialized(_this), "portalElem", void 0);
|
|
89
|
+
|
|
90
|
+
_defineProperty(_assertThisInitialized(_this), "state", {
|
|
91
|
+
isMounted: false
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
return _this;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
_createClass(ModalRoot, [{
|
|
98
|
+
key: "componentDidMount",
|
|
99
|
+
value: function componentDidMount() {
|
|
100
|
+
var _this$props = this.props,
|
|
101
|
+
_this$props$direct_do = _this$props.direct_dom_return,
|
|
102
|
+
direct_dom_return = _this$props$direct_do === void 0 ? false : _this$props$direct_do,
|
|
103
|
+
_this$props$root_id = _this$props.root_id,
|
|
104
|
+
root_id = _this$props$root_id === void 0 ? 'root' : _this$props$root_id;
|
|
105
|
+
|
|
106
|
+
if (!(0, _componentHelper.isTrue)(direct_dom_return)) {
|
|
107
|
+
ModalRoot.insertModalRoot(root_id);
|
|
108
|
+
|
|
109
|
+
try {
|
|
110
|
+
if (!this.portalElem) {
|
|
111
|
+
this.portalElem = document.createElement('div');
|
|
112
|
+
this.portalElem.className = 'dnb-modal-root__inner';
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
if (this.portalElem && typeof window !== 'undefined' && window.__modalRoot) {
|
|
116
|
+
window.__modalRoot.appendChild(this.portalElem);
|
|
117
|
+
}
|
|
118
|
+
} catch (e) {
|
|
119
|
+
(0, _componentHelper.warn)(e);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
this.setState({
|
|
123
|
+
isMounted: true
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}, {
|
|
128
|
+
key: "componentWillUnmount",
|
|
129
|
+
value: function componentWillUnmount() {
|
|
130
|
+
try {
|
|
131
|
+
if (this.portalElem && typeof window !== 'undefined' && window.__modalRoot && window.__modalRoot.removeChild) {
|
|
132
|
+
window.__modalRoot.removeChild(this.portalElem);
|
|
133
|
+
|
|
134
|
+
this.portalElem = null;
|
|
135
|
+
}
|
|
136
|
+
} catch (e) {
|
|
137
|
+
(0, _componentHelper.warn)(e);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}, {
|
|
141
|
+
key: "render",
|
|
142
|
+
value: function render() {
|
|
143
|
+
var _this$props2 = this.props,
|
|
144
|
+
children = _this$props2.children,
|
|
145
|
+
direct_dom_return = _this$props2.direct_dom_return,
|
|
146
|
+
props = _objectWithoutProperties(_this$props2, _excluded);
|
|
147
|
+
|
|
148
|
+
if ((0, _componentHelper.isTrue)(direct_dom_return)) {
|
|
149
|
+
return _react.default.createElement(_ModalContent.default, props, children);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
if (this.portalElem && typeof window !== 'undefined' && window.__modalRoot && this.state.isMounted) {
|
|
153
|
+
return _reactDom.default.createPortal(_react.default.createElement(_ModalContent.default, props, children), this.portalElem);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
return null;
|
|
157
|
+
}
|
|
158
|
+
}], [{
|
|
159
|
+
key: "insertModalRoot",
|
|
160
|
+
value: function insertModalRoot(id) {
|
|
161
|
+
if (typeof window === 'undefined') {
|
|
162
|
+
return false;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
try {
|
|
166
|
+
id = "dnb-modal-".concat(id || 'root');
|
|
167
|
+
window.__modalRoot = document.getElementById(id);
|
|
168
|
+
|
|
169
|
+
if (!window.__modalRoot) {
|
|
170
|
+
window.__modalRoot = document.createElement('div');
|
|
171
|
+
|
|
172
|
+
window.__modalRoot.setAttribute('id', id);
|
|
173
|
+
|
|
174
|
+
document.body.insertBefore(window.__modalRoot, document.body.firstChild);
|
|
175
|
+
}
|
|
176
|
+
} catch (e) {
|
|
177
|
+
(0, _componentHelper.warn)('Modal: Could not insert dnb-modal-root', e);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
return window.__modalRoot;
|
|
181
|
+
}
|
|
182
|
+
}]);
|
|
183
|
+
|
|
184
|
+
return ModalRoot;
|
|
185
|
+
}(_react.default.PureComponent);
|
|
186
|
+
|
|
187
|
+
exports.default = ModalRoot;
|
|
188
|
+
|
|
189
|
+
_defineProperty(ModalRoot, "defaultProps", {
|
|
190
|
+
id: null,
|
|
191
|
+
root_id: 'root',
|
|
192
|
+
direct_dom_return: false,
|
|
193
|
+
children: null
|
|
194
|
+
});
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
4
|
+
|
|
5
|
+
require("core-js/modules/es.object.get-prototype-of.js");
|
|
6
|
+
|
|
7
|
+
require("core-js/modules/es.object.to-string.js");
|
|
8
|
+
|
|
9
|
+
require("core-js/modules/es.reflect.construct.js");
|
|
10
|
+
|
|
11
|
+
require("core-js/modules/es.object.keys.js");
|
|
12
|
+
|
|
13
|
+
require("core-js/modules/es.array.index-of.js");
|
|
14
|
+
|
|
15
|
+
require("core-js/modules/es.symbol.js");
|
|
16
|
+
|
|
17
|
+
require("core-js/modules/es.object.assign.js");
|
|
18
|
+
|
|
19
|
+
require("core-js/modules/es.symbol.description.js");
|
|
20
|
+
|
|
21
|
+
require("core-js/modules/es.symbol.iterator.js");
|
|
22
|
+
|
|
23
|
+
require("core-js/modules/es.array.iterator.js");
|
|
24
|
+
|
|
25
|
+
require("core-js/modules/es.string.iterator.js");
|
|
26
|
+
|
|
27
|
+
require("core-js/modules/web.dom-collections.iterator.js");
|
|
28
|
+
|
|
29
|
+
Object.defineProperty(exports, "__esModule", {
|
|
30
|
+
value: true
|
|
31
|
+
});
|
|
32
|
+
exports.default = void 0;
|
|
33
|
+
|
|
34
|
+
var _react = _interopRequireDefault(require("react"));
|
|
35
|
+
|
|
36
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
37
|
+
|
|
38
|
+
var _componentHelper = require("../../../shared/component-helper");
|
|
39
|
+
|
|
40
|
+
var _Button = _interopRequireDefault(require("../../button/Button"));
|
|
41
|
+
|
|
42
|
+
var _Context = _interopRequireDefault(require("../../../shared/Context"));
|
|
43
|
+
|
|
44
|
+
var _excluded = ["close_title", "size", "icon_position", "className"];
|
|
45
|
+
|
|
46
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
47
|
+
|
|
48
|
+
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
49
|
+
|
|
50
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
51
|
+
|
|
52
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
53
|
+
|
|
54
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
55
|
+
|
|
56
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
57
|
+
|
|
58
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
59
|
+
|
|
60
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
61
|
+
|
|
62
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
63
|
+
|
|
64
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
65
|
+
|
|
66
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
67
|
+
|
|
68
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
69
|
+
|
|
70
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
71
|
+
|
|
72
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
73
|
+
|
|
74
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
75
|
+
|
|
76
|
+
var CloseButton = function (_React$PureComponent) {
|
|
77
|
+
_inherits(CloseButton, _React$PureComponent);
|
|
78
|
+
|
|
79
|
+
var _super = _createSuper(CloseButton);
|
|
80
|
+
|
|
81
|
+
function CloseButton() {
|
|
82
|
+
_classCallCheck(this, CloseButton);
|
|
83
|
+
|
|
84
|
+
return _super.apply(this, arguments);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
_createClass(CloseButton, [{
|
|
88
|
+
key: "render",
|
|
89
|
+
value: function render() {
|
|
90
|
+
var _extendPropsWithConte = (0, _componentHelper.extendPropsWithContext)(this.props, CloseButton.defaultProps, this.context.getTranslation(this.props).Modal),
|
|
91
|
+
_extendPropsWithConte2 = _extendPropsWithConte.close_title,
|
|
92
|
+
close_title = _extendPropsWithConte2 === void 0 ? null : _extendPropsWithConte2,
|
|
93
|
+
_extendPropsWithConte3 = _extendPropsWithConte.size,
|
|
94
|
+
size = _extendPropsWithConte3 === void 0 ? 'large' : _extendPropsWithConte3,
|
|
95
|
+
_extendPropsWithConte4 = _extendPropsWithConte.icon_position,
|
|
96
|
+
icon_position = _extendPropsWithConte4 === void 0 ? 'left' : _extendPropsWithConte4,
|
|
97
|
+
_extendPropsWithConte5 = _extendPropsWithConte.className,
|
|
98
|
+
className = _extendPropsWithConte5 === void 0 ? null : _extendPropsWithConte5,
|
|
99
|
+
button_props = _objectWithoutProperties(_extendPropsWithConte, _excluded);
|
|
100
|
+
|
|
101
|
+
return _react.default.createElement(_Button.default, _extends({
|
|
102
|
+
type: "button",
|
|
103
|
+
variant: "tertiary",
|
|
104
|
+
icon: "close",
|
|
105
|
+
text: close_title,
|
|
106
|
+
size: size,
|
|
107
|
+
icon_position: icon_position,
|
|
108
|
+
className: (0, _classnames.default)('dnb-modal__close-button', className)
|
|
109
|
+
}, button_props));
|
|
110
|
+
}
|
|
111
|
+
}]);
|
|
112
|
+
|
|
113
|
+
return CloseButton;
|
|
114
|
+
}(_react.default.PureComponent);
|
|
115
|
+
|
|
116
|
+
exports.default = CloseButton;
|
|
117
|
+
|
|
118
|
+
_defineProperty(CloseButton, "contextType", _Context.default);
|
|
119
|
+
|
|
120
|
+
_defineProperty(CloseButton, "defaultProps", {
|
|
121
|
+
close_title: null,
|
|
122
|
+
size: 'large',
|
|
123
|
+
icon_position: 'left',
|
|
124
|
+
className: null
|
|
125
|
+
});
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
4
|
+
|
|
5
|
+
require("core-js/modules/es.object.get-prototype-of.js");
|
|
6
|
+
|
|
7
|
+
require("core-js/modules/es.object.to-string.js");
|
|
8
|
+
|
|
9
|
+
require("core-js/modules/es.reflect.construct.js");
|
|
10
|
+
|
|
11
|
+
require("core-js/modules/es.object.keys.js");
|
|
12
|
+
|
|
13
|
+
require("core-js/modules/es.array.index-of.js");
|
|
14
|
+
|
|
15
|
+
require("core-js/modules/es.symbol.js");
|
|
16
|
+
|
|
17
|
+
require("core-js/modules/es.object.assign.js");
|
|
18
|
+
|
|
19
|
+
require("core-js/modules/es.symbol.description.js");
|
|
20
|
+
|
|
21
|
+
require("core-js/modules/es.symbol.iterator.js");
|
|
22
|
+
|
|
23
|
+
require("core-js/modules/es.array.iterator.js");
|
|
24
|
+
|
|
25
|
+
require("core-js/modules/es.string.iterator.js");
|
|
26
|
+
|
|
27
|
+
require("core-js/modules/web.dom-collections.iterator.js");
|
|
28
|
+
|
|
29
|
+
Object.defineProperty(exports, "__esModule", {
|
|
30
|
+
value: true
|
|
31
|
+
});
|
|
32
|
+
exports.default = void 0;
|
|
33
|
+
|
|
34
|
+
var _react = _interopRequireDefault(require("react"));
|
|
35
|
+
|
|
36
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
37
|
+
|
|
38
|
+
var _componentHelper = require("../../../shared/component-helper");
|
|
39
|
+
|
|
40
|
+
var _Section = _interopRequireDefault(require("../../section/Section"));
|
|
41
|
+
|
|
42
|
+
var _ModalContext = _interopRequireDefault(require("../ModalContext"));
|
|
43
|
+
|
|
44
|
+
var _H = _interopRequireDefault(require("../../../elements/H1"));
|
|
45
|
+
|
|
46
|
+
var _excluded = ["title", "className", "children", "ref"];
|
|
47
|
+
|
|
48
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
49
|
+
|
|
50
|
+
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
51
|
+
|
|
52
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
53
|
+
|
|
54
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
55
|
+
|
|
56
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
57
|
+
|
|
58
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
59
|
+
|
|
60
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
61
|
+
|
|
62
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
63
|
+
|
|
64
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
65
|
+
|
|
66
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
67
|
+
|
|
68
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
69
|
+
|
|
70
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
71
|
+
|
|
72
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
73
|
+
|
|
74
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
75
|
+
|
|
76
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
77
|
+
|
|
78
|
+
var ModalHeader = function (_React$PureComponent) {
|
|
79
|
+
_inherits(ModalHeader, _React$PureComponent);
|
|
80
|
+
|
|
81
|
+
var _super = _createSuper(ModalHeader);
|
|
82
|
+
|
|
83
|
+
function ModalHeader() {
|
|
84
|
+
_classCallCheck(this, ModalHeader);
|
|
85
|
+
|
|
86
|
+
return _super.apply(this, arguments);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
_createClass(ModalHeader, [{
|
|
90
|
+
key: "render",
|
|
91
|
+
value: function render() {
|
|
92
|
+
var _this$props = this.props,
|
|
93
|
+
_this$props$title = _this$props.title,
|
|
94
|
+
title = _this$props$title === void 0 ? null : _this$props$title,
|
|
95
|
+
_this$props$className = _this$props.className,
|
|
96
|
+
className = _this$props$className === void 0 ? null : _this$props$className,
|
|
97
|
+
_this$props$children = _this$props.children,
|
|
98
|
+
children = _this$props$children === void 0 ? null : _this$props$children,
|
|
99
|
+
ref = _this$props.ref,
|
|
100
|
+
props = _objectWithoutProperties(_this$props, _excluded);
|
|
101
|
+
|
|
102
|
+
var customHeader = (0, _componentHelper.findElementInChildren)(children, function (cur) {
|
|
103
|
+
return cur.type === 'h1' || cur.type === _H.default;
|
|
104
|
+
});
|
|
105
|
+
var usedTitle = title || this.context.title;
|
|
106
|
+
var showTitle = !customHeader && usedTitle;
|
|
107
|
+
return _react.default.createElement(_Section.default, _extends({
|
|
108
|
+
style_type: "white",
|
|
109
|
+
className: (0, _classnames.default)('dnb-modal__header', className),
|
|
110
|
+
id: showTitle ? 'dnb-modal-' + this.context.id + '-title' : undefined
|
|
111
|
+
}, props), showTitle && _react.default.createElement("h1", {
|
|
112
|
+
className: "dnb-modal__title dnb-space__top--zero dnb-space__bottom--small " + (this.context.mode === 'drawer' ? 'dnb-h--x-large' : 'dnb-h--large')
|
|
113
|
+
}, usedTitle), _react.default.createElement("div", {
|
|
114
|
+
className: "dnb-modal__header__inner"
|
|
115
|
+
}, children));
|
|
116
|
+
}
|
|
117
|
+
}]);
|
|
118
|
+
|
|
119
|
+
return ModalHeader;
|
|
120
|
+
}(_react.default.PureComponent);
|
|
121
|
+
|
|
122
|
+
exports.default = ModalHeader;
|
|
123
|
+
|
|
124
|
+
_defineProperty(ModalHeader, "contextType", _ModalContext.default);
|