@dnb/eufemia 10.63.1 → 10.63.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (159) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/cjs/components/modal/Modal.d.ts +2 -1
  3. package/cjs/components/modal/Modal.js +10 -4
  4. package/cjs/components/modal/Modal.js.map +1 -1
  5. package/cjs/components/modal/ModalContent.d.ts +10 -8
  6. package/cjs/components/modal/ModalContent.js +48 -23
  7. package/cjs/components/modal/ModalContent.js.map +1 -1
  8. package/cjs/components/modal/ModalRoot.d.ts +2 -0
  9. package/cjs/components/modal/ModalRoot.js.map +1 -1
  10. package/cjs/components/modal/types.d.ts +11 -3
  11. package/cjs/components/modal/types.js.map +1 -1
  12. package/cjs/elements/code/style/code-mixins.scss +4 -0
  13. package/cjs/extensions/forms/DataContext/Context.d.ts +1 -1
  14. package/cjs/extensions/forms/DataContext/Context.js.map +1 -1
  15. package/cjs/extensions/forms/DataContext/Provider/Provider.js +2 -2
  16. package/cjs/extensions/forms/DataContext/Provider/Provider.js.map +1 -1
  17. package/cjs/extensions/forms/Form/data-context/useValidation.js +1 -1
  18. package/cjs/extensions/forms/Form/data-context/useValidation.js.map +1 -1
  19. package/cjs/extensions/forms/Wizard/Container/WizardContainer.js +1 -1
  20. package/cjs/extensions/forms/Wizard/Container/WizardContainer.js.map +1 -1
  21. package/cjs/extensions/forms/hooks/useExternalValue.js +2 -2
  22. package/cjs/extensions/forms/hooks/useExternalValue.js.map +1 -1
  23. package/cjs/extensions/forms/hooks/useFieldProps.js +23 -16
  24. package/cjs/extensions/forms/hooks/useFieldProps.js.map +1 -1
  25. package/cjs/shared/Eufemia.d.ts +1 -1
  26. package/cjs/shared/Eufemia.js +2 -2
  27. package/cjs/shared/Eufemia.js.map +1 -1
  28. package/cjs/style/core/scopes.scss +1 -1
  29. package/cjs/style/dnb-ui-basis.css +1 -1
  30. package/cjs/style/dnb-ui-basis.min.css +1 -1
  31. package/cjs/style/dnb-ui-body.css +1 -1
  32. package/cjs/style/dnb-ui-body.min.css +1 -1
  33. package/cjs/style/dnb-ui-core.css +1 -1
  34. package/cjs/style/dnb-ui-core.min.css +1 -1
  35. package/cjs/style/dnb-ui-elements.css +3 -0
  36. package/cjs/style/dnb-ui-elements.min.css +1 -1
  37. package/cjs/style/themes/theme-eiendom/eiendom-theme-basis.css +3 -0
  38. package/cjs/style/themes/theme-eiendom/eiendom-theme-basis.min.css +1 -1
  39. package/cjs/style/themes/theme-eiendom/eiendom-theme-elements.css +3 -0
  40. package/cjs/style/themes/theme-eiendom/eiendom-theme-elements.min.css +1 -1
  41. package/cjs/style/themes/theme-sbanken/sbanken-theme-basis.css +3 -0
  42. package/cjs/style/themes/theme-sbanken/sbanken-theme-basis.min.css +1 -1
  43. package/cjs/style/themes/theme-sbanken/sbanken-theme-elements.css +3 -0
  44. package/cjs/style/themes/theme-sbanken/sbanken-theme-elements.min.css +1 -1
  45. package/cjs/style/themes/theme-ui/ui-theme-basis.css +3 -0
  46. package/cjs/style/themes/theme-ui/ui-theme-basis.min.css +1 -1
  47. package/cjs/style/themes/theme-ui/ui-theme-elements.css +3 -0
  48. package/cjs/style/themes/theme-ui/ui-theme-elements.min.css +1 -1
  49. package/cjs/style/themes/theme-ui/ui-theme-tags.css +3 -0
  50. package/cjs/style/themes/theme-ui/ui-theme-tags.min.css +1 -1
  51. package/components/modal/Modal.d.ts +2 -1
  52. package/components/modal/Modal.js +10 -4
  53. package/components/modal/Modal.js.map +1 -1
  54. package/components/modal/ModalContent.d.ts +10 -8
  55. package/components/modal/ModalContent.js +48 -23
  56. package/components/modal/ModalContent.js.map +1 -1
  57. package/components/modal/ModalRoot.d.ts +2 -0
  58. package/components/modal/ModalRoot.js.map +1 -1
  59. package/components/modal/types.d.ts +11 -3
  60. package/components/modal/types.js.map +1 -1
  61. package/elements/code/style/code-mixins.scss +4 -0
  62. package/es/components/modal/Modal.d.ts +2 -1
  63. package/es/components/modal/Modal.js +10 -4
  64. package/es/components/modal/Modal.js.map +1 -1
  65. package/es/components/modal/ModalContent.d.ts +10 -8
  66. package/es/components/modal/ModalContent.js +44 -20
  67. package/es/components/modal/ModalContent.js.map +1 -1
  68. package/es/components/modal/ModalRoot.d.ts +2 -0
  69. package/es/components/modal/ModalRoot.js.map +1 -1
  70. package/es/components/modal/types.d.ts +11 -3
  71. package/es/components/modal/types.js.map +1 -1
  72. package/es/elements/code/style/code-mixins.scss +4 -0
  73. package/es/extensions/forms/DataContext/Context.d.ts +1 -1
  74. package/es/extensions/forms/DataContext/Context.js.map +1 -1
  75. package/es/extensions/forms/DataContext/Provider/Provider.js +2 -2
  76. package/es/extensions/forms/DataContext/Provider/Provider.js.map +1 -1
  77. package/es/extensions/forms/Form/data-context/useValidation.js +1 -1
  78. package/es/extensions/forms/Form/data-context/useValidation.js.map +1 -1
  79. package/es/extensions/forms/Wizard/Container/WizardContainer.js +1 -1
  80. package/es/extensions/forms/Wizard/Container/WizardContainer.js.map +1 -1
  81. package/es/extensions/forms/hooks/useExternalValue.js +2 -2
  82. package/es/extensions/forms/hooks/useExternalValue.js.map +1 -1
  83. package/es/extensions/forms/hooks/useFieldProps.js +23 -16
  84. package/es/extensions/forms/hooks/useFieldProps.js.map +1 -1
  85. package/es/shared/Eufemia.d.ts +1 -1
  86. package/es/shared/Eufemia.js +2 -2
  87. package/es/shared/Eufemia.js.map +1 -1
  88. package/es/style/core/scopes.scss +1 -1
  89. package/es/style/dnb-ui-basis.css +1 -1
  90. package/es/style/dnb-ui-basis.min.css +1 -1
  91. package/es/style/dnb-ui-body.css +1 -1
  92. package/es/style/dnb-ui-body.min.css +1 -1
  93. package/es/style/dnb-ui-core.css +1 -1
  94. package/es/style/dnb-ui-core.min.css +1 -1
  95. package/es/style/dnb-ui-elements.css +3 -0
  96. package/es/style/dnb-ui-elements.min.css +1 -1
  97. package/es/style/themes/theme-eiendom/eiendom-theme-basis.css +3 -0
  98. package/es/style/themes/theme-eiendom/eiendom-theme-basis.min.css +1 -1
  99. package/es/style/themes/theme-eiendom/eiendom-theme-elements.css +3 -0
  100. package/es/style/themes/theme-eiendom/eiendom-theme-elements.min.css +1 -1
  101. package/es/style/themes/theme-sbanken/sbanken-theme-basis.css +3 -0
  102. package/es/style/themes/theme-sbanken/sbanken-theme-basis.min.css +1 -1
  103. package/es/style/themes/theme-sbanken/sbanken-theme-elements.css +3 -0
  104. package/es/style/themes/theme-sbanken/sbanken-theme-elements.min.css +1 -1
  105. package/es/style/themes/theme-ui/ui-theme-basis.css +3 -0
  106. package/es/style/themes/theme-ui/ui-theme-basis.min.css +1 -1
  107. package/es/style/themes/theme-ui/ui-theme-elements.css +3 -0
  108. package/es/style/themes/theme-ui/ui-theme-elements.min.css +1 -1
  109. package/es/style/themes/theme-ui/ui-theme-tags.css +3 -0
  110. package/es/style/themes/theme-ui/ui-theme-tags.min.css +1 -1
  111. package/esm/dnb-ui-basis.min.mjs +1 -1
  112. package/esm/dnb-ui-components.min.mjs +1 -1
  113. package/esm/dnb-ui-elements.min.mjs +1 -1
  114. package/esm/dnb-ui-extensions.min.mjs +1 -1
  115. package/esm/dnb-ui-lib.min.mjs +1 -1
  116. package/extensions/forms/DataContext/Context.d.ts +1 -1
  117. package/extensions/forms/DataContext/Context.js.map +1 -1
  118. package/extensions/forms/DataContext/Provider/Provider.js +2 -2
  119. package/extensions/forms/DataContext/Provider/Provider.js.map +1 -1
  120. package/extensions/forms/Form/data-context/useValidation.js +1 -1
  121. package/extensions/forms/Form/data-context/useValidation.js.map +1 -1
  122. package/extensions/forms/Wizard/Container/WizardContainer.js +1 -1
  123. package/extensions/forms/Wizard/Container/WizardContainer.js.map +1 -1
  124. package/extensions/forms/hooks/useExternalValue.js +2 -2
  125. package/extensions/forms/hooks/useExternalValue.js.map +1 -1
  126. package/extensions/forms/hooks/useFieldProps.js +23 -16
  127. package/extensions/forms/hooks/useFieldProps.js.map +1 -1
  128. package/package.json +1 -1
  129. package/shared/Eufemia.d.ts +1 -1
  130. package/shared/Eufemia.js +2 -2
  131. package/shared/Eufemia.js.map +1 -1
  132. package/style/core/scopes.scss +1 -1
  133. package/style/dnb-ui-basis.css +1 -1
  134. package/style/dnb-ui-basis.min.css +1 -1
  135. package/style/dnb-ui-body.css +1 -1
  136. package/style/dnb-ui-body.min.css +1 -1
  137. package/style/dnb-ui-core.css +1 -1
  138. package/style/dnb-ui-core.min.css +1 -1
  139. package/style/dnb-ui-elements.css +3 -0
  140. package/style/dnb-ui-elements.min.css +1 -1
  141. package/style/themes/theme-eiendom/eiendom-theme-basis.css +3 -0
  142. package/style/themes/theme-eiendom/eiendom-theme-basis.min.css +1 -1
  143. package/style/themes/theme-eiendom/eiendom-theme-elements.css +3 -0
  144. package/style/themes/theme-eiendom/eiendom-theme-elements.min.css +1 -1
  145. package/style/themes/theme-sbanken/sbanken-theme-basis.css +3 -0
  146. package/style/themes/theme-sbanken/sbanken-theme-basis.min.css +1 -1
  147. package/style/themes/theme-sbanken/sbanken-theme-elements.css +3 -0
  148. package/style/themes/theme-sbanken/sbanken-theme-elements.min.css +1 -1
  149. package/style/themes/theme-ui/ui-theme-basis.css +3 -0
  150. package/style/themes/theme-ui/ui-theme-basis.min.css +1 -1
  151. package/style/themes/theme-ui/ui-theme-elements.css +3 -0
  152. package/style/themes/theme-ui/ui-theme-elements.min.css +1 -1
  153. package/style/themes/theme-ui/ui-theme-tags.css +3 -0
  154. package/style/themes/theme-ui/ui-theme-tags.min.css +1 -1
  155. package/umd/dnb-ui-basis.min.js +1 -1
  156. package/umd/dnb-ui-components.min.js +1 -1
  157. package/umd/dnb-ui-elements.min.js +1 -1
  158. package/umd/dnb-ui-extensions.min.js +2 -2
  159. package/umd/dnb-ui-lib.min.js +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"Modal.js","names":["React","classnames","SuffixContext","Context","warn","isTrue","makeUniqueId","extendPropsWithContextInClassComponent","processChildren","dispatchCustomElementEvent","createSpacingClasses","HelpButtonInstance","getListOfModalRoots","getModalRoot","ModalInner","ModalHeader","ModalHeaderBar","CloseButton","ModalRoot","classWithCamelCaseProps","ANIMATION_DURATION","Modal","PureComponent","getContent","props","modal_content","getDerivedStateFromProps","state","window","animation_duration","no_animation","open_state","_open_state","hide","modalActive","constructor","_this","this","_defineProperty","preventAutoFocus","event","arguments","length","undefined","showModal","preventDefault","toggleNow","timeoutDuration","parseFloat","isInTransition","doItNow","setState","handleSideEffects","_closeTimeout","setTimeout","waitBeforeOpen","open_delay","delay","_openTimeout","clearTimeout","open_modal","fn","_onUnmount","push","close_modal","toggleOpenClose","setActiveState","_id","_this$_triggerRef","focus","elem","setAttribute","preventScroll","Promise","resolve","removeAttribute","String","_triggerRef","current","activeElement","HTMLElement","then","e","removeActiveState","ifIsLatest","triggeredBy","prevent_close","id","close","list","last","createRef","componentDidMount","openBasedOnStateUpdate","componentWillUnmount","forEach","componentDidUpdate","prevProps","document","documentElement","modalId","render","visualTestsPropsOverride","defaultProps","context","getTranslation","root_id","content_id","disabled","labelled_by","focus_selector","header_content","bar_content","bypass_invalidation_selectors","vertical_alignment","omit_trigger_button","trigger","trigger_attributes","rest","_objectWithoutProperties","_excluded","children","Object","freeze","_objectSpread","suffixProps","triggerAttributes","hidden","variant","icon_position","fallbackTitle","title","translation","HelpButton","TriggerButton","text","createElement","Fragment","_extends","onClick","innerRef","className","class","Consumer","spacing","dialog_title","close_title","hide_close_button","close_button_attributes","prevent_core_style","no_animation_on_mobile","fullscreen","min_width","max_width","align_content","container_placement","direct_dom_return","on_open","on_close","on_close_prevent","overlay_class","content_class","OriginalComponent"],"sources":["../../../../src/components/modal/Modal.tsx"],"sourcesContent":["/**\n * Web Modal Component\n *\n */\n\nimport React from 'react'\nimport classnames from 'classnames'\nimport { SuffixContext } from '../../shared/helpers/Suffix'\nimport Context, { ContextProps } from '../../shared/Context'\nimport {\n warn,\n isTrue,\n makeUniqueId,\n extendPropsWithContextInClassComponent,\n processChildren,\n dispatchCustomElementEvent,\n} from '../../shared/component-helper'\nimport { createSpacingClasses } from '../space/SpacingHelper'\nimport HelpButtonInstance from '../help-button/HelpButtonInstance'\nimport { getListOfModalRoots, getModalRoot } from './helpers'\nimport ModalInner from './parts/ModalInner'\nimport { ModalProps } from './types'\n\nimport ModalHeader from './parts/ModalHeader'\nimport ModalHeaderBar from './parts/ModalHeaderBar'\nimport { ScrollViewAllProps } from '../../fragments/scroll-view/ScrollView'\nimport CloseButton from './parts/CloseButton'\nimport ModalRoot from './ModalRoot'\nimport type { SpacingProps } from '../../shared/types'\nimport {\n classWithCamelCaseProps,\n ToCamelCasePartial,\n} from '../../shared/helpers/withCamelCaseProps'\nimport type { ButtonProps } from '../button/Button'\n\nexport const ANIMATION_DURATION = 300\n\ninterface ModalState {\n hide: boolean\n modalActive: boolean\n preventAutoFocus: boolean\n}\n\nexport type ModalPropTypes = ModalProps &\n SpacingProps &\n Omit<ScrollViewAllProps, 'children'>\n\nclass Modal extends React.PureComponent<\n ModalPropTypes & ToCamelCasePartial<ModalPropTypes>,\n ModalState\n> {\n static contextType = Context\n\n context!: ContextProps\n\n static Bar = ModalHeaderBar\n static Header = ModalHeader\n static Content = ModalInner\n\n static getContent(props) {\n if (typeof props.modal_content === 'string') {\n return props.modal_content\n } else if (typeof props.modal_content === 'function') {\n return props.modal_content(props)\n }\n return processChildren(props)\n }\n\n _id: string\n _triggerRef: React.RefObject<any>\n _onUnmount: Array<() => void>\n _openTimeout: NodeJS.Timeout\n _closeTimeout: NodeJS.Timeout\n _sideEffectsTimeout: NodeJS.Timeout\n _tryToOpenTimeout: NodeJS.Timeout\n activeElement: Element\n isInTransition: boolean\n\n state = {\n hide: false,\n modalActive: false,\n preventAutoFocus: true,\n animation_duration: ANIMATION_DURATION,\n no_animation: false,\n }\n\n static defaultProps = {\n id: null,\n focus_selector: null,\n labelled_by: null,\n title: null,\n disabled: null,\n spacing: true,\n open_delay: null,\n content_id: null,\n dialog_title: 'Vindu',\n close_title: 'Lukk', // Close Modal Window\n hide_close_button: false,\n close_button_attributes: null,\n prevent_close: false,\n prevent_core_style: false,\n animation_duration: ANIMATION_DURATION,\n no_animation: false,\n no_animation_on_mobile: false,\n fullscreen: 'auto',\n min_width: null,\n max_width: null,\n align_content: 'left',\n container_placement: null,\n vertical_alignment: null,\n open_state: null,\n direct_dom_return: false,\n root_id: 'root',\n omit_trigger_button: false,\n\n className: null,\n children: null,\n\n on_open: null,\n on_close: null,\n on_close_prevent: null,\n open_modal: null,\n close_modal: null,\n\n trigger: null,\n trigger_attributes: null,\n\n overlay_class: null,\n content_class: null,\n\n modal_content: null,\n header_content: null,\n bar_content: null,\n }\n\n static getDerivedStateFromProps(props, state) {\n if (typeof window !== 'undefined' && window['IS_TEST']) {\n state.animation_duration = 0\n state.no_animation = true\n } else {\n state.animation_duration = props.animation_duration\n state.no_animation = props.no_animation\n }\n\n if (props.open_state !== state._open_state) {\n switch (props.open_state) {\n case 'opened':\n case true:\n state.hide = false\n if (isTrue(state.no_animation)) {\n state.modalActive = true\n }\n break\n case 'closed':\n case false:\n state.hide = true\n if (isTrue(state.no_animation)) {\n state.modalActive = false\n }\n break\n }\n }\n state._open_state = props.open_state\n\n return state\n }\n\n constructor(props) {\n super(props)\n this._id = props.id || makeUniqueId('modal-')\n\n this._triggerRef = React.createRef()\n\n this._onUnmount = []\n }\n\n componentDidMount() {\n this.openBasedOnStateUpdate()\n }\n\n componentWillUnmount() {\n clearTimeout(this._openTimeout)\n clearTimeout(this._closeTimeout)\n\n this.removeActiveState()\n\n this._onUnmount.forEach((fn) => {\n if (typeof fn === 'function') {\n fn()\n }\n })\n }\n\n componentDidUpdate(prevProps) {\n if (prevProps !== this.props) {\n this.openBasedOnStateUpdate()\n }\n }\n\n openBasedOnStateUpdate() {\n const { hide } = this.state\n const { open_state } = this.props\n\n if (!this.activeElement && typeof document !== 'undefined') {\n this.activeElement = document.activeElement\n }\n\n if (!hide && (open_state === 'opened' || open_state === true)) {\n this.toggleOpenClose(null, true)\n } else if (hide && (open_state === 'closed' || open_state === false)) {\n this.toggleOpenClose(null, false)\n }\n }\n\n toggleOpenClose = (event = null, showModal = null) => {\n if (event && event.preventDefault) {\n event.preventDefault()\n }\n\n const toggleNow = () => {\n const {\n animation_duration = ANIMATION_DURATION,\n no_animation = false,\n } = this.state\n const timeoutDuration =\n typeof animation_duration === 'string'\n ? parseFloat(animation_duration)\n : animation_duration\n\n const modalActive =\n typeof showModal === 'boolean'\n ? showModal\n : !this.state.modalActive\n\n this.isInTransition = true\n\n const doItNow = () => {\n this.setState(\n {\n hide: false,\n modalActive,\n },\n () => {\n this.isInTransition = false\n this.handleSideEffects()\n }\n )\n }\n\n if (modalActive === false && !isTrue(no_animation)) {\n this.setState({\n hide: true,\n })\n\n this._closeTimeout = setTimeout(doItNow, timeoutDuration) // delay because of the animation\n } else {\n doItNow()\n }\n }\n\n const waitBeforeOpen = () => {\n const { open_delay } = this.props\n const { no_animation } = this.state\n const delay =\n typeof open_delay === 'string'\n ? parseFloat(open_delay)\n : open_delay\n if (delay > 0 && !isTrue(no_animation)) {\n this._openTimeout = setTimeout(toggleNow, delay) // custom delay\n } else {\n toggleNow()\n }\n }\n\n clearTimeout(this._closeTimeout)\n clearTimeout(this._openTimeout)\n\n const { open_modal } = this.props\n if (typeof open_modal === 'function') {\n const fn = open_modal(waitBeforeOpen, this)\n if (fn) {\n this._onUnmount.push(fn)\n }\n } else {\n waitBeforeOpen()\n }\n }\n\n handleSideEffects = () => {\n const { modalActive, preventAutoFocus, animation_duration } =\n this.state\n const { close_modal, open_state } = this.props\n\n if (modalActive) {\n if (typeof close_modal === 'function') {\n const fn = close_modal(() => {\n this.toggleOpenClose(null, false)\n }, this)\n if (fn) {\n this._onUnmount.push(fn)\n }\n }\n this.setActiveState(this._id)\n } else if (modalActive === false && !preventAutoFocus) {\n const focus = (elem: HTMLElement) => {\n // So we can omit showing a Tooltip on the trigger button\n elem.setAttribute('data-autofocus', 'true')\n elem.focus({ preventScroll: true })\n\n return new Promise<void>((resolve) => {\n setTimeout(\n () => {\n elem?.removeAttribute('data-autofocus')\n resolve()\n },\n parseFloat(String(animation_duration)) / 3\n )\n })\n }\n\n if (this._triggerRef?.current) {\n focus(this._triggerRef.current)\n }\n\n // because the open_state was set to opened, we force\n if (\n (open_state === 'opened' || open_state === true) &&\n this.activeElement instanceof HTMLElement\n ) {\n try {\n focus(this.activeElement).then(() => {\n this.activeElement = null\n })\n } catch (e) {\n //\n }\n }\n\n this.removeActiveState()\n }\n\n if (preventAutoFocus) {\n this.setState({ preventAutoFocus: false })\n }\n }\n\n open = (e: Event) => {\n this.toggleOpenClose(e, true)\n }\n\n close = (\n event: Event,\n { ifIsLatest, triggeredBy = null } = { ifIsLatest: true }\n ) => {\n const { prevent_close = false } = this.props\n\n if (isTrue(prevent_close)) {\n const id = this._id\n dispatchCustomElementEvent(this, 'on_close_prevent', {\n id,\n event,\n triggeredBy,\n close: (e) => {\n this.toggleOpenClose(e, false)\n },\n })\n } else {\n if (ifIsLatest) {\n const list = getListOfModalRoots()\n if (list.length > 1) {\n const last = getModalRoot(-1)\n if (last !== this) {\n return // stop here\n }\n }\n }\n\n this.toggleOpenClose(event, false)\n }\n }\n\n removeActiveState() {\n const last = getModalRoot(-1)\n\n // If this instance is not the last one,\n // make the current one to as the active one\n if (last?._id && last._id !== this._id) {\n return this.setActiveState(last._id)\n }\n\n try {\n document.documentElement.removeAttribute('data-dnb-modal-active')\n } catch (e) {\n warn('Modal: Error on remove \"data-dnb-modal-active\"', e)\n }\n }\n\n /**\n * Prevent scrolling on the background\n * But checks if this instance was the last one or not\n *\n * @param {string} modalId Will remove the attribute if false is given\n */\n setActiveState(modalId: string) {\n if (!modalId) {\n warn('Modal: A valid modalId is required')\n }\n // prevent scrolling on the background\n if (typeof document !== 'undefined') {\n try {\n document.documentElement.setAttribute(\n 'data-dnb-modal-active',\n modalId\n )\n } catch (e) {\n warn('Modal: Error on set \"data-dnb-modal-active\"', e)\n }\n }\n }\n\n render() {\n const visualTestsPropsOverride =\n typeof window !== 'undefined' && window['IS_TEST']\n ? {\n animation_duration: 0,\n no_animation: true,\n }\n : {}\n\n // use only the props from context, who are available here anyway\n const props = extendPropsWithContextInClassComponent(\n this.props,\n Modal.defaultProps,\n this.context.getTranslation(this.props).Modal,\n this.context.Modal,\n visualTestsPropsOverride\n )\n\n const {\n root_id = 'root',\n content_id = null,\n disabled = null,\n labelled_by = null,\n focus_selector = null,\n header_content = null,\n bar_content = null,\n bypass_invalidation_selectors = null,\n vertical_alignment = 'center',\n\n id, // eslint-disable-line\n open_state, // eslint-disable-line\n open_delay, // eslint-disable-line\n\n omit_trigger_button = false,\n trigger = null,\n trigger_attributes = null,\n ...rest\n } = props\n\n const { hide, modalActive } = this.state\n const modal_content = Modal.getContent(\n typeof this.props.children === 'function'\n ? Object.freeze({ ...this.props, close: this.close })\n : this.props\n )\n\n const render = (suffixProps) => {\n const triggerAttributes = {\n hidden: false,\n variant: 'secondary',\n icon_position: 'left',\n ...trigger_attributes,\n } as ButtonProps\n\n if (isTrue(disabled)) {\n triggerAttributes.disabled = true\n }\n\n if (triggerAttributes.id) {\n this._id = triggerAttributes.id\n }\n\n let fallbackTitle: string\n if (triggerAttributes.title) {\n fallbackTitle = triggerAttributes.title\n }\n // in case the modal is used in suffix and no title is given\n // suffixProps.label is also available, so we could use that too\n else if (suffixProps) {\n fallbackTitle = this.context.translation.HelpButton.title\n }\n\n const TriggerButton = trigger\n ? (trigger as React.FC)\n : HelpButtonInstance\n\n const title = (\n !triggerAttributes.text ? rest.title || fallbackTitle : null\n ) as string\n\n return (\n <>\n {TriggerButton && !isTrue(omit_trigger_button) && (\n <TriggerButton\n {...triggerAttributes}\n id={this._id}\n title={title}\n onClick={this.toggleOpenClose}\n innerRef={this._triggerRef}\n className={classnames(\n 'dnb-modal__trigger',\n createSpacingClasses(props),\n triggerAttributes.className,\n\n // @deprecated – can be removed in v11\n triggerAttributes.class\n )}\n />\n )}\n\n {modalActive && modal_content && (\n <ModalRoot\n {...rest}\n id={this._id}\n root_id={root_id}\n content_id={content_id || `dnb-modal-${this._id}`}\n labelled_by={labelled_by}\n focus_selector={focus_selector}\n modal_content={modal_content}\n header_content={header_content}\n vertical_alignment={vertical_alignment}\n bar_content={bar_content}\n bypass_invalidation_selectors={bypass_invalidation_selectors}\n close={this.close}\n hide={hide}\n title={rest.title || fallbackTitle}\n />\n )}\n </>\n )\n }\n\n return <SuffixContext.Consumer>{render}</SuffixContext.Consumer>\n }\n}\n\nexport { CloseButton, Modal as OriginalComponent }\n\nexport default classWithCamelCaseProps(Modal)\n"],"mappings":";;;;;;;;AAKA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,UAAU,MAAM,YAAY;AACnC,SAASC,aAAa,QAAQ,6BAA6B;AAC3D,OAAOC,OAAO,MAAwB,sBAAsB;AAC5D,SACEC,IAAI,EACJC,MAAM,EACNC,YAAY,EACZC,sCAAsC,EACtCC,eAAe,EACfC,0BAA0B,QACrB,+BAA+B;AACtC,SAASC,oBAAoB,QAAQ,wBAAwB;AAC7D,OAAOC,kBAAkB,MAAM,mCAAmC;AAClE,SAASC,mBAAmB,EAAEC,YAAY,QAAQ,WAAW;AAC7D,OAAOC,UAAU,MAAM,oBAAoB;AAG3C,OAAOC,WAAW,MAAM,qBAAqB;AAC7C,OAAOC,cAAc,MAAM,wBAAwB;AAEnD,OAAOC,WAAW,MAAM,qBAAqB;AAC7C,OAAOC,SAAS,MAAM,aAAa;AAEnC,SACEC,uBAAuB,QAElB,yCAAyC;AAGhD,OAAO,MAAMC,kBAAkB,GAAG,GAAG;AAYrC,MAAMC,KAAK,SAASrB,KAAK,CAACsB,aAAa,CAGrC;EASA,OAAOC,UAAUA,CAACC,KAAK,EAAE;IACvB,IAAI,OAAOA,KAAK,CAACC,aAAa,KAAK,QAAQ,EAAE;MAC3C,OAAOD,KAAK,CAACC,aAAa;IAC5B,CAAC,MAAM,IAAI,OAAOD,KAAK,CAACC,aAAa,KAAK,UAAU,EAAE;MACpD,OAAOD,KAAK,CAACC,aAAa,C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,KAAK;EAE1B0B,SAAS,EAAE,IAAI;EACfpB,QAAQ,EAAE,IAAI;EAEdoC,OAAO,EAAE,IAAI;EACbC,QAAQ,EAAE,IAAI;EACdC,gBAAgB,EAAE,IAAI;EACtBnG,UAAU,EAAE,IAAI;EAChBI,WAAW,EAAE,IAAI;EAEjBoD,OAAO,EAAE,IAAI;EACbC,kBAAkB,EAAE,IAAI;EAExB2C,aAAa,EAAE,IAAI;EACnBC,aAAa,EAAE,IAAI;EAEnBxI,aAAa,EAAE,IAAI;EACnBsF,cAAc,EAAE,IAAI;EACpBC,WAAW,EAAE;AACf,CAAC;AA6ZH,SAAS/F,WAAW,EAAEI,KAAK,IAAI6I,iBAAiB;AAEhD,eAAe/I,uBAAuB,CAACE,KAAK,CAAC"}
1
+ {"version":3,"file":"Modal.js","names":["React","classnames","SuffixContext","Context","warn","isTrue","makeUniqueId","extendPropsWithContextInClassComponent","processChildren","dispatchCustomElementEvent","createSpacingClasses","HelpButtonInstance","getListOfModalRoots","getModalRoot","ModalInner","ModalHeader","ModalHeaderBar","CloseButton","ModalRoot","classWithCamelCaseProps","ANIMATION_DURATION","Modal","PureComponent","getContent","props","modal_content","getDerivedStateFromProps","state","window","animation_duration","no_animation","open_state","_open_state","hide","modalActive","constructor","_this","this","_defineProperty","preventAutoFocus","event","arguments","length","undefined","showModal","preventDefault","toggleNow","timeoutDuration","parseFloat","isInTransition","doItNow","setState","handleSideEffects","_closeTimeout","setTimeout","waitBeforeOpen","open_delay","delay","_openTimeout","clearTimeout","open_modal","fn","_onUnmount","push","close_modal","toggleOpenClose","setActiveState","_id","_this$_triggerRef","focus","elem","setAttribute","preventScroll","Promise","resolve","removeAttribute","String","_triggerRef","current","activeElement","HTMLElement","then","e","removeActiveState","_this$modalContentClo","_this$modalContentClo2","ifIsLatest","triggeredBy","modalContentCloseRef","call","prevent_close","id","close","list","last","createRef","componentDidMount","openBasedOnStateUpdate","componentWillUnmount","forEach","componentDidUpdate","prevProps","document","documentElement","modalId","render","visualTestsPropsOverride","defaultProps","context","getTranslation","root_id","content_id","disabled","labelled_by","focus_selector","header_content","bar_content","bypass_invalidation_selectors","vertical_alignment","omit_trigger_button","trigger","trigger_attributes","rest","_objectWithoutProperties","_excluded","children","Object","freeze","_objectSpread","suffixProps","triggerAttributes","hidden","variant","icon_position","fallbackTitle","title","translation","HelpButton","TriggerButton","text","createElement","Fragment","_extends","onClick","innerRef","className","class","Consumer","spacing","dialog_title","close_title","hide_close_button","close_button_attributes","prevent_core_style","no_animation_on_mobile","fullscreen","min_width","max_width","align_content","container_placement","direct_dom_return","on_open","on_close","on_close_prevent","overlay_class","content_class","OriginalComponent"],"sources":["../../../../src/components/modal/Modal.tsx"],"sourcesContent":["/**\n * Web Modal Component\n *\n */\n\nimport React from 'react'\nimport classnames from 'classnames'\nimport { SuffixContext } from '../../shared/helpers/Suffix'\nimport Context, { ContextProps } from '../../shared/Context'\nimport {\n warn,\n isTrue,\n makeUniqueId,\n extendPropsWithContextInClassComponent,\n processChildren,\n dispatchCustomElementEvent,\n} from '../../shared/component-helper'\nimport { createSpacingClasses } from '../space/SpacingHelper'\nimport HelpButtonInstance from '../help-button/HelpButtonInstance'\nimport { getListOfModalRoots, getModalRoot } from './helpers'\nimport ModalInner from './parts/ModalInner'\nimport { ModalProps } from './types'\n\nimport ModalHeader from './parts/ModalHeader'\nimport ModalHeaderBar from './parts/ModalHeaderBar'\nimport { ScrollViewAllProps } from '../../fragments/scroll-view/ScrollView'\nimport CloseButton from './parts/CloseButton'\nimport ModalRoot from './ModalRoot'\nimport type { SpacingProps } from '../../shared/types'\nimport {\n classWithCamelCaseProps,\n ToCamelCasePartial,\n} from '../../shared/helpers/withCamelCaseProps'\nimport type { ButtonProps } from '../button/Button'\n\nexport const ANIMATION_DURATION = 300\n\ninterface ModalState {\n hide: boolean\n modalActive: boolean\n preventAutoFocus: boolean\n}\n\nexport type ModalPropTypes = ModalProps &\n SpacingProps &\n Omit<ScrollViewAllProps, 'children'>\n\nclass Modal extends React.PureComponent<\n ModalPropTypes & ToCamelCasePartial<ModalPropTypes>,\n ModalState\n> {\n static contextType = Context\n\n context!: ContextProps\n\n static Bar = ModalHeaderBar\n static Header = ModalHeader\n static Content = ModalInner\n\n static getContent(props) {\n if (typeof props.modal_content === 'string') {\n return props.modal_content\n } else if (typeof props.modal_content === 'function') {\n return props.modal_content(props)\n }\n return processChildren(props)\n }\n\n _id: string\n _triggerRef: React.RefObject<any>\n _onUnmount: Array<() => void>\n _openTimeout: NodeJS.Timeout\n _closeTimeout: NodeJS.Timeout\n _sideEffectsTimeout: NodeJS.Timeout\n _tryToOpenTimeout: NodeJS.Timeout\n activeElement: Element\n isInTransition: boolean\n modalContentCloseRef: React.RefObject<any>\n\n state = {\n hide: false,\n modalActive: false,\n preventAutoFocus: true,\n animation_duration: ANIMATION_DURATION,\n no_animation: false,\n }\n\n static defaultProps = {\n id: null,\n focus_selector: null,\n labelled_by: null,\n title: null,\n disabled: null,\n spacing: true,\n open_delay: null,\n content_id: null,\n dialog_title: 'Vindu',\n close_title: 'Lukk', // Close Modal Window\n hide_close_button: false,\n close_button_attributes: null,\n prevent_close: false,\n prevent_core_style: false,\n animation_duration: ANIMATION_DURATION,\n no_animation: false,\n no_animation_on_mobile: false,\n fullscreen: 'auto',\n min_width: null,\n max_width: null,\n align_content: 'left',\n container_placement: null,\n vertical_alignment: null,\n open_state: null,\n direct_dom_return: false,\n root_id: 'root',\n omit_trigger_button: false,\n\n className: null,\n children: null,\n\n on_open: null,\n on_close: null,\n on_close_prevent: null,\n open_modal: null,\n close_modal: null,\n\n trigger: null,\n trigger_attributes: null,\n\n overlay_class: null,\n content_class: null,\n\n modal_content: null,\n header_content: null,\n bar_content: null,\n }\n\n static getDerivedStateFromProps(props, state) {\n if (typeof window !== 'undefined' && window['IS_TEST']) {\n state.animation_duration = 0\n state.no_animation = true\n } else {\n state.animation_duration = props.animation_duration\n state.no_animation = props.no_animation\n }\n\n if (props.open_state !== state._open_state) {\n switch (props.open_state) {\n case 'opened':\n case true:\n state.hide = false\n if (isTrue(state.no_animation)) {\n state.modalActive = true\n }\n break\n case 'closed':\n case false:\n state.hide = true\n if (isTrue(state.no_animation)) {\n state.modalActive = false\n }\n break\n }\n }\n state._open_state = props.open_state\n\n return state\n }\n\n constructor(props) {\n super(props)\n this._id = props.id || makeUniqueId('modal-')\n\n this._triggerRef = React.createRef()\n this.modalContentCloseRef = React.createRef()\n\n this._onUnmount = []\n }\n\n componentDidMount() {\n this.openBasedOnStateUpdate()\n }\n\n componentWillUnmount() {\n clearTimeout(this._openTimeout)\n clearTimeout(this._closeTimeout)\n\n this.removeActiveState()\n\n this._onUnmount.forEach((fn) => {\n if (typeof fn === 'function') {\n fn()\n }\n })\n }\n\n componentDidUpdate(prevProps) {\n if (prevProps !== this.props) {\n this.openBasedOnStateUpdate()\n }\n }\n\n openBasedOnStateUpdate() {\n const { hide } = this.state\n const { open_state } = this.props\n\n if (!this.activeElement && typeof document !== 'undefined') {\n this.activeElement = document.activeElement\n }\n\n if (!hide && (open_state === 'opened' || open_state === true)) {\n this.toggleOpenClose(null, true)\n } else if (hide && (open_state === 'closed' || open_state === false)) {\n this.toggleOpenClose(null, false)\n }\n }\n\n toggleOpenClose = (event = null, showModal = null) => {\n if (event && event.preventDefault) {\n event.preventDefault()\n }\n\n const toggleNow = () => {\n const {\n animation_duration = ANIMATION_DURATION,\n no_animation = false,\n } = this.state\n const timeoutDuration =\n typeof animation_duration === 'string'\n ? parseFloat(animation_duration)\n : animation_duration\n\n const modalActive =\n typeof showModal === 'boolean'\n ? showModal\n : !this.state.modalActive\n\n this.isInTransition = true\n\n const doItNow = () => {\n this.setState(\n {\n hide: false,\n modalActive,\n },\n () => {\n this.isInTransition = false\n this.handleSideEffects()\n }\n )\n }\n\n if (modalActive === false && !isTrue(no_animation)) {\n this.setState({\n hide: true,\n })\n\n this._closeTimeout = setTimeout(doItNow, timeoutDuration) // delay because of the animation\n } else {\n doItNow()\n }\n }\n\n const waitBeforeOpen = () => {\n const { open_delay } = this.props\n const { no_animation } = this.state\n const delay =\n typeof open_delay === 'string'\n ? parseFloat(open_delay)\n : open_delay\n if (delay > 0 && !isTrue(no_animation)) {\n this._openTimeout = setTimeout(toggleNow, delay) // custom delay\n } else {\n toggleNow()\n }\n }\n\n clearTimeout(this._closeTimeout)\n clearTimeout(this._openTimeout)\n\n const { open_modal } = this.props\n if (typeof open_modal === 'function') {\n const fn = open_modal(waitBeforeOpen, this)\n if (fn) {\n this._onUnmount.push(fn)\n }\n } else {\n waitBeforeOpen()\n }\n }\n\n handleSideEffects = () => {\n const { modalActive, preventAutoFocus, animation_duration } =\n this.state\n const { close_modal, open_state } = this.props\n\n if (modalActive) {\n if (typeof close_modal === 'function') {\n const fn = close_modal(() => {\n this.toggleOpenClose(null, false)\n }, this)\n if (fn) {\n this._onUnmount.push(fn)\n }\n }\n this.setActiveState(this._id)\n } else if (modalActive === false && !preventAutoFocus) {\n const focus = (elem: HTMLElement) => {\n // So we can omit showing a Tooltip on the trigger button\n elem.setAttribute('data-autofocus', 'true')\n elem.focus({ preventScroll: true })\n\n return new Promise<void>((resolve) => {\n setTimeout(\n () => {\n elem?.removeAttribute('data-autofocus')\n resolve()\n },\n parseFloat(String(animation_duration)) / 3\n )\n })\n }\n\n if (this._triggerRef?.current) {\n focus(this._triggerRef.current)\n }\n\n // because the open_state was set to opened, we force\n if (\n (open_state === 'opened' || open_state === true) &&\n this.activeElement instanceof HTMLElement\n ) {\n try {\n focus(this.activeElement).then(() => {\n this.activeElement = null\n })\n } catch (e) {\n //\n }\n }\n\n this.removeActiveState()\n }\n\n if (preventAutoFocus) {\n this.setState({ preventAutoFocus: false })\n }\n }\n\n open = (e: Event) => {\n this.toggleOpenClose(e, true)\n }\n\n close = (\n event: Event,\n { ifIsLatest, triggeredBy = 'handler' } = {\n ifIsLatest: true,\n }\n ) => {\n this.modalContentCloseRef.current?.(event, { triggeredBy })\n\n const { prevent_close = false } = this.props\n\n if (isTrue(prevent_close)) {\n const id = this._id\n dispatchCustomElementEvent(this, 'on_close_prevent', {\n id,\n event,\n triggeredBy,\n close: (e) => {\n this.toggleOpenClose(e, false)\n },\n })\n } else {\n if (ifIsLatest) {\n const list = getListOfModalRoots()\n if (list.length > 1) {\n const last = getModalRoot(-1)\n if (last !== this) {\n return // stop here\n }\n }\n }\n\n this.toggleOpenClose(event, false)\n }\n }\n\n removeActiveState() {\n const last = getModalRoot(-1)\n\n // If this instance is not the last one,\n // make the current one to as the active one\n if (last?._id && last._id !== this._id) {\n return this.setActiveState(last._id)\n }\n\n try {\n document.documentElement.removeAttribute('data-dnb-modal-active')\n } catch (e) {\n warn('Modal: Error on remove \"data-dnb-modal-active\"', e)\n }\n }\n\n /**\n * Prevent scrolling on the background\n * But checks if this instance was the last one or not\n *\n * @param {string} modalId Will remove the attribute if false is given\n */\n setActiveState(modalId: string) {\n if (!modalId) {\n warn('Modal: A valid modalId is required')\n }\n // prevent scrolling on the background\n if (typeof document !== 'undefined') {\n try {\n document.documentElement.setAttribute(\n 'data-dnb-modal-active',\n modalId\n )\n } catch (e) {\n warn('Modal: Error on set \"data-dnb-modal-active\"', e)\n }\n }\n }\n\n render() {\n const visualTestsPropsOverride =\n typeof window !== 'undefined' && window['IS_TEST']\n ? {\n animation_duration: 0,\n no_animation: true,\n }\n : {}\n\n // use only the props from context, who are available here anyway\n const props = extendPropsWithContextInClassComponent(\n this.props,\n Modal.defaultProps,\n this.context.getTranslation(this.props).Modal,\n this.context.Modal,\n visualTestsPropsOverride\n )\n\n const {\n root_id = 'root',\n content_id = null,\n disabled = null,\n labelled_by = null,\n focus_selector = null,\n header_content = null,\n bar_content = null,\n bypass_invalidation_selectors = null,\n vertical_alignment = 'center',\n\n id, // eslint-disable-line\n open_delay, // eslint-disable-line\n\n omit_trigger_button = false,\n trigger = null,\n trigger_attributes = null,\n ...rest\n } = props\n\n const { hide, modalActive } = this.state\n const modal_content = Modal.getContent(\n typeof this.props.children === 'function'\n ? Object.freeze({ ...this.props, close: this.close })\n : this.props\n )\n\n const render = (suffixProps) => {\n const triggerAttributes = {\n hidden: false,\n variant: 'secondary',\n icon_position: 'left',\n ...trigger_attributes,\n } as ButtonProps\n\n if (isTrue(disabled)) {\n triggerAttributes.disabled = true\n }\n\n if (triggerAttributes.id) {\n this._id = triggerAttributes.id\n }\n\n let fallbackTitle: string\n if (triggerAttributes.title) {\n fallbackTitle = triggerAttributes.title\n }\n // in case the modal is used in suffix and no title is given\n // suffixProps.label is also available, so we could use that too\n else if (suffixProps) {\n fallbackTitle = this.context.translation.HelpButton.title\n }\n\n const TriggerButton = trigger\n ? (trigger as React.FC)\n : HelpButtonInstance\n\n const title = (\n !triggerAttributes.text ? rest.title || fallbackTitle : null\n ) as string\n\n return (\n <>\n {TriggerButton && !isTrue(omit_trigger_button) && (\n <TriggerButton\n {...triggerAttributes}\n id={this._id}\n title={title}\n onClick={this.toggleOpenClose}\n innerRef={this._triggerRef}\n className={classnames(\n 'dnb-modal__trigger',\n createSpacingClasses(props),\n triggerAttributes.className,\n\n // @deprecated – can be removed in v11\n triggerAttributes.class\n )}\n />\n )}\n\n {modalActive && modal_content && (\n <ModalRoot\n {...rest}\n id={this._id}\n root_id={root_id}\n content_id={content_id || `dnb-modal-${this._id}`}\n labelled_by={labelled_by}\n focus_selector={focus_selector}\n modal_content={modal_content}\n header_content={header_content}\n vertical_alignment={vertical_alignment}\n bar_content={bar_content}\n bypass_invalidation_selectors={bypass_invalidation_selectors}\n close={this.close}\n hide={hide}\n title={rest.title || fallbackTitle}\n modalContentCloseRef={this.modalContentCloseRef}\n />\n )}\n </>\n )\n }\n\n return <SuffixContext.Consumer>{render}</SuffixContext.Consumer>\n }\n}\n\nexport { CloseButton, Modal as OriginalComponent }\n\nexport default classWithCamelCaseProps(Modal)\n"],"mappings":";;;;;;;;AAKA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,UAAU,MAAM,YAAY;AACnC,SAASC,aAAa,QAAQ,6BAA6B;AAC3D,OAAOC,OAA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E,IAAI;EACtBvG,UAAU,EAAE,IAAI;EAChBI,WAAW,EAAE,IAAI;EAEjBwD,OAAO,EAAE,IAAI;EACbC,kBAAkB,EAAE,IAAI;EAExB2C,aAAa,EAAE,IAAI;EACnBC,aAAa,EAAE,IAAI;EAEnB5I,aAAa,EAAE,IAAI;EACnB0F,cAAc,EAAE,IAAI;EACpBC,WAAW,EAAE;AACf,CAAC;AAkaH,SAASnG,WAAW,EAAEI,KAAK,IAAIiJ,iBAAiB;AAEhD,eAAenJ,uBAAuB,CAACE,KAAK,CAAC"}
@@ -5,11 +5,9 @@
5
5
  /// <reference types="node" />
6
6
  import React from 'react';
7
7
  import { InteractionInvalidation } from '../../shared/component-helper';
8
- import { ModalContentProps } from './types';
8
+ import { CloseHandlerParams, ModalContentProps, TriggeredBy } from './types';
9
9
  import { ContextProps } from '../../shared/Context';
10
10
  interface ModalContentState {
11
- triggeredBy: string;
12
- triggeredByEvent: Event;
13
11
  color: string;
14
12
  }
15
13
  declare global {
@@ -19,8 +17,6 @@ declare global {
19
17
  }
20
18
  export default class ModalContent extends React.PureComponent<ModalContentProps, ModalContentState> {
21
19
  state: {
22
- triggeredBy: any;
23
- triggeredByEvent: any;
24
20
  color: any;
25
21
  };
26
22
  _contentRef: React.RefObject<HTMLElement>;
@@ -34,11 +30,17 @@ export default class ModalContent extends React.PureComponent<ModalContentProps,
34
30
  _androidFocusTimeout: NodeJS.Timeout;
35
31
  _ii: InteractionInvalidation;
36
32
  _iiLocal: InteractionInvalidation;
33
+ _triggeredBy: TriggeredBy;
34
+ _triggeredByEvent: React.SyntheticEvent;
35
+ _isControlled: boolean;
37
36
  static contextType: React.Context<ContextProps>;
38
37
  context: ContextProps;
39
38
  constructor(props: ModalContentProps);
40
39
  componentDidMount(): void;
41
40
  componentWillUnmount(): void;
41
+ setIsControlled(): void;
42
+ componentDidUpdate(): void;
43
+ wasOpenedManually(): boolean;
42
44
  lockBody: () => void;
43
45
  removeLocks(): void;
44
46
  setAndroidFocusHelper(): void;
@@ -52,9 +54,9 @@ export default class ModalContent extends React.PureComponent<ModalContentProps,
52
54
  onContentMouseDownHandler: (event: React.SyntheticEvent) => void;
53
55
  onContentClickHandler: (event: React.SyntheticEvent) => void;
54
56
  onKeyDownHandler: (event: any) => void;
55
- closeModalContent(event: any, { triggeredBy, ...params }: {
56
- [x: string]: any;
57
- triggeredBy: any;
57
+ setModalContentState: (event: React.SyntheticEvent, { triggeredBy }: CloseHandlerParams) => void;
58
+ closeModalContent(event: any, { triggeredBy, ...params }: CloseHandlerParams & {
59
+ ifIsLatest?: boolean;
58
60
  }): void;
59
61
  setBackgroundColor: (color: string) => void;
60
62
  render(): import("react/jsx-runtime").JSX.Element;
@@ -20,8 +20,6 @@ export default class ModalContent extends React.PureComponent {
20
20
  constructor(props) {
21
21
  super(props);
22
22
  _defineProperty(this, "state", {
23
- triggeredBy: null,
24
- triggeredByEvent: null,
25
23
  color: null
26
24
  });
27
25
  _defineProperty(this, "_contentRef", void 0);
@@ -33,6 +31,9 @@ export default class ModalContent extends React.PureComponent {
33
31
  _defineProperty(this, "_androidFocusTimeout", void 0);
34
32
  _defineProperty(this, "_ii", void 0);
35
33
  _defineProperty(this, "_iiLocal", void 0);
34
+ _defineProperty(this, "_triggeredBy", void 0);
35
+ _defineProperty(this, "_triggeredByEvent", void 0);
36
+ _defineProperty(this, "_isControlled", false);
36
37
  _defineProperty(this, "context", void 0);
37
38
  _defineProperty(this, "lockBody", () => {
38
39
  const modalRoots = getListOfModalRoots();
@@ -112,6 +113,13 @@ export default class ModalContent extends React.PureComponent {
112
113
  }
113
114
  }
114
115
  });
116
+ _defineProperty(this, "setModalContentState", (event, _ref) => {
117
+ let {
118
+ triggeredBy
119
+ } = _ref;
120
+ this._triggeredBy = triggeredBy;
121
+ this._triggeredByEvent = event;
122
+ });
115
123
  _defineProperty(this, "setBackgroundColor", color => {
116
124
  this.setState({
117
125
  color
@@ -120,6 +128,9 @@ export default class ModalContent extends React.PureComponent {
120
128
  this._contentRef = this.props.content_ref || React.createRef();
121
129
  this._scrollRef = this.props.scroll_ref || React.createRef();
122
130
  this._overlayClickRef = React.createRef();
131
+ if (this.props.modalContentCloseRef) {
132
+ this.props.modalContentCloseRef.current = this.setModalContentState;
133
+ }
123
134
  this._id = props.id;
124
135
  }
125
136
  componentDidMount() {
@@ -141,12 +152,33 @@ export default class ModalContent extends React.PureComponent {
141
152
  } else {
142
153
  this._lockTimeout = setTimeout(this.lockBody, timeoutDuration * 1.2);
143
154
  }
155
+ this.setIsControlled();
144
156
  }
145
157
  componentWillUnmount() {
146
158
  clearTimeout(this._focusTimeout);
147
159
  clearTimeout(this._lockTimeout);
148
160
  this.removeLocks();
149
161
  }
162
+ setIsControlled() {
163
+ const {
164
+ open_state
165
+ } = this.props;
166
+ if (typeof open_state !== 'undefined' && open_state !== null) {
167
+ this._isControlled = true;
168
+ }
169
+ }
170
+ componentDidUpdate() {
171
+ this.setIsControlled();
172
+ }
173
+ wasOpenedManually() {
174
+ if (this._triggeredBy) {
175
+ return true;
176
+ }
177
+ if (this._isControlled) {
178
+ return true;
179
+ }
180
+ return false;
181
+ }
150
182
  removeLocks() {
151
183
  const modalRoots = getListOfModalRoots();
152
184
  const firstLevel = modalRoots[0];
@@ -167,16 +199,14 @@ export default class ModalContent extends React.PureComponent {
167
199
  }
168
200
  }
169
201
  this.removeAndroidFocusHelper();
170
- const id = this.props.id;
171
- const {
172
- triggeredBy,
173
- triggeredByEvent
174
- } = this.state;
175
- dispatchCustomElementEvent(this, 'on_close', {
176
- id,
177
- event: triggeredByEvent,
178
- triggeredBy: triggeredBy || 'unmount'
179
- });
202
+ if (this.wasOpenedManually()) {
203
+ const id = this.props.id;
204
+ dispatchCustomElementEvent(this, 'on_close', {
205
+ id,
206
+ event: this._triggeredByEvent,
207
+ triggeredBy: this._triggeredBy || 'unmount'
208
+ });
209
+ }
180
210
  if (typeof document !== 'undefined') {
181
211
  document.removeEventListener('keydown', this.onKeyDownHandler);
182
212
  }
@@ -230,21 +260,16 @@ export default class ModalContent extends React.PureComponent {
230
260
  enableBodyScroll(this._scrollRef.current);
231
261
  clearAllBodyScrollLocks();
232
262
  }
233
- closeModalContent(event, _ref) {
263
+ closeModalContent(event, _ref2) {
234
264
  var _event$persist;
235
265
  let {
236
266
  triggeredBy
237
- } = _ref,
238
- params = _objectWithoutProperties(_ref, _excluded);
267
+ } = _ref2,
268
+ params = _objectWithoutProperties(_ref2, _excluded);
239
269
  event === null || event === void 0 ? void 0 : (_event$persist = event.persist) === null || _event$persist === void 0 ? void 0 : _event$persist.call(event);
240
- this.setState({
241
- triggeredBy,
242
- triggeredByEvent: event
243
- }, () => {
244
- this.props.close(event, _objectSpread({
245
- triggeredBy
246
- }, params));
247
- });
270
+ this.props.close(event, _objectSpread({
271
+ triggeredBy
272
+ }, params));
248
273
  }
249
274
  render() {
250
275
  var _this$context;
@@ -1 +1 @@
1
- {"version":3,"file":"ModalContent.js","names":["React","classnames","disableBodyScroll","enableBodyScroll","clearAllBodyScrollLocks","warn","isTrue","makeUniqueId","InteractionInvalidation","combineLabelledBy","combineDescribedBy","dispatchCustomElementEvent","keycode","ModalContext","IS_IOS","IS_SAFARI","IS_MAC","isAndroid","getListOfModalRoots","getModalRoot","addToIndex","removeFromIndex","getThemeClasses","Context","ModalContent","PureComponent","constructor","props","_defineProperty","triggeredBy","triggeredByEvent","color","modalRoots","firstLevel","_this$props","_ii","setBypassSelector","root_id","bypass_invalidation_selectors","filter","Boolean","activate","forEach","modal","_iiLocal","_scrollRef","current","document","addEventListener","onKeyDownHandler","animation_duration","timeoutDuration","parseFloat","clearTimeout","_androidFocusTimeout","setTimeout","_document$activeEleme","_document$activeEleme2","activeElement","tagName","scrollIntoView","e","event","stopPropagation","closeModalContent","_overlayClickRef","target","currentTarget","prevent_overlay_close","ifIsLatest","mostCurrent","preventDefault","setState","_contentRef","content_ref","createRef","scroll_ref","_id","id","componentDidMount","no_animation","removeScrollPossibility","setFocus","setAndroidFocusHelper","process","env","NODE_ENV","lockBody","_lockTimeout","componentWillUnmount","_focusTimeout","removeLocks","_this$_ii","revert","revertScrollPossibility","length","removeAndroidFocusHelper","state","removeEventListener","window","_androidFocusHelper","focus_selector","elem","_focusElement","_focusElement$focus","_focusElement2","_focusElement2$select","_elem$parentElement","_elem$parentElement$q","_elem$parentElement2","_elem$parentElement2$","focusElement","querySelector","focus","call","select","noH1Elem","noH1ElemInDrawerHeader","parentElement","noH1ElemInDialogHeader","_ref","_event$persist","params","_objectWithoutProperties","_excluded","persist","close","_objectSpread","render","_this$context","_this$props2","hide","title","labelled_by","close_title","dialog_title","hide_close_button","close_button_attributes","no_animation_on_mobile","fullscreen","container_placement","vertical_alignment","content_class","overlay_class","content_id","children","dialog_role","rest","_excluded2","contentId","useDialogRole","role","contentParams","undefined","className","context","theme","onMouseDown","onContentMouseDownHandler","onClick","onContentClickHandler","content","createElement","Provider","value","setBackgroundColor","onCloseClickHandler","preventClick","contentRef","scrollRef","_extends","style"],"sources":["../../../../src/components/modal/ModalContent.tsx"],"sourcesContent":["/**\n * Web Modal Component\n *\n */\n\nimport React from 'react'\nimport classnames from 'classnames'\nimport {\n disableBodyScroll,\n enableBodyScroll,\n clearAllBodyScrollLocks,\n} from './bodyScrollLock'\nimport {\n warn,\n isTrue,\n makeUniqueId,\n InteractionInvalidation,\n combineLabelledBy,\n combineDescribedBy,\n dispatchCustomElementEvent,\n keycode,\n} from '../../shared/component-helper'\nimport ModalContext from './ModalContext'\nimport { IS_IOS, IS_SAFARI, IS_MAC, isAndroid } from '../../shared/helpers'\nimport { ModalContentProps } from './types'\nimport {\n getListOfModalRoots,\n getModalRoot,\n addToIndex,\n removeFromIndex,\n} from './helpers'\nimport { getThemeClasses } from '../../shared/Theme'\nimport { Context } from '../../shared'\nimport { ContextProps } from '../../shared/Context'\n\ninterface ModalContentState {\n triggeredBy: string\n triggeredByEvent: Event\n color: string\n}\n\ndeclare global {\n interface Window {\n __modalStack: any[]\n }\n}\n\ninterface CSSPropertiesWithVars extends React.CSSProperties {\n '--modal-background-color': string\n}\n\nexport default class ModalContent extends React.PureComponent<\n ModalContentProps,\n ModalContentState\n> {\n state = { triggeredBy: null, triggeredByEvent: null, color: null }\n\n _contentRef: React.RefObject<HTMLElement>\n _scrollRef: React.RefObject<HTMLElement>\n _overlayClickRef: { current: null | HTMLElement }\n _id: string\n _lockTimeout: NodeJS.Timeout\n _focusTimeout: NodeJS.Timeout\n _androidFocusTimeout: NodeJS.Timeout\n _ii: InteractionInvalidation\n _iiLocal: InteractionInvalidation\n\n static contextType = Context\n\n context!: ContextProps\n\n constructor(props: ModalContentProps) {\n super(props)\n this._contentRef = this.props.content_ref || React.createRef()\n this._scrollRef = this.props.scroll_ref || React.createRef()\n this._overlayClickRef = React.createRef()\n\n // NB: The \"\"._id\" is used in the __modalStack as \"last._id\"\n this._id = props.id\n }\n\n componentDidMount() {\n const {\n id = null,\n no_animation = false,\n animation_duration = null,\n } = this.props\n\n const timeoutDuration: number =\n typeof animation_duration === 'string'\n ? parseFloat(animation_duration)\n : animation_duration\n\n // Add it to the index at first\n // we use it later with getListOfModalRoots\n addToIndex(this)\n\n // Because of nested modals/drawers, we run this regardless\n // has to be run at first – so the scrollbar gets removed\n this.removeScrollPossibility() // forces browser to re-paint\n\n this.setFocus()\n this.setAndroidFocusHelper()\n\n dispatchCustomElementEvent(this, 'on_open', {\n id,\n })\n\n if (isTrue(no_animation) || process.env.NODE_ENV === 'test') {\n this.lockBody() // forces browser to re-paint\n } else {\n this._lockTimeout = setTimeout(this.lockBody, timeoutDuration * 1.2) // a little over --modal-animation-duration\n }\n }\n\n componentWillUnmount() {\n clearTimeout(this._focusTimeout)\n clearTimeout(this._lockTimeout)\n this.removeLocks()\n }\n\n lockBody = () => {\n const modalRoots = getListOfModalRoots()\n const firstLevel = modalRoots[0]\n\n if (firstLevel === this) {\n this._ii = new InteractionInvalidation()\n this._ii.setBypassSelector(\n [\n // Bypass modal content\n '.dnb-modal__content *',\n `#dnb-modal-${this.props.root_id || 'root'}`,\n `#dnb-modal-${this.props.root_id || 'root'} *`,\n\n // TODO: Eventually in future, make it possible to bypass invalidation from outside\n // '.dnb-modal--bypass_invalidation',\n // '.dnb-modal--bypass_invalidation_deep *',\n\n ...(this.props?.bypass_invalidation_selectors || []),\n ].filter(Boolean)\n )\n this._ii.activate()\n } else {\n modalRoots.forEach((modal) => {\n if (\n modal !== this &&\n typeof modal._iiLocal === 'undefined' &&\n typeof modal._scrollRef !== 'undefined'\n ) {\n modal._iiLocal = new InteractionInvalidation()\n modal._iiLocal.activate(modal._scrollRef.current)\n }\n })\n }\n\n if (typeof document !== 'undefined') {\n /** To ensure, we have always a working keydown, we call it both on the element and document */\n document.addEventListener('keydown', this.onKeyDownHandler)\n }\n }\n\n removeLocks() {\n const modalRoots = getListOfModalRoots()\n const firstLevel = modalRoots[0]\n\n removeFromIndex(this)\n\n if (firstLevel === this) {\n this._ii?.revert()\n this.revertScrollPossibility()\n } else {\n try {\n const modal = modalRoots[modalRoots.length - 2]\n if (modal !== this && modal._iiLocal) {\n modal._iiLocal.revert()\n delete modal._iiLocal\n }\n } catch (e) {\n warn(e)\n }\n }\n\n this.removeAndroidFocusHelper()\n\n const id = this.props.id\n const { triggeredBy, triggeredByEvent } = this.state\n dispatchCustomElementEvent(this, 'on_close', {\n id,\n event: triggeredByEvent,\n triggeredBy: triggeredBy || 'unmount',\n })\n\n if (typeof document !== 'undefined') {\n document.removeEventListener('keydown', this.onKeyDownHandler)\n }\n }\n\n setAndroidFocusHelper() {\n if (typeof window !== 'undefined' && isAndroid()) {\n window.addEventListener('resize', this._androidFocusHelper)\n }\n }\n\n removeAndroidFocusHelper() {\n window.removeEventListener('resize', this._androidFocusHelper)\n clearTimeout(this._androidFocusTimeout)\n }\n\n _androidFocusHelper = () => {\n const { animation_duration = null } = this.props\n const timeoutDuration: number =\n typeof animation_duration === 'string'\n ? parseFloat(animation_duration)\n : animation_duration\n\n clearTimeout(this._androidFocusTimeout)\n this._androidFocusTimeout = setTimeout(() => {\n try {\n if (\n document.activeElement?.tagName == 'INPUT' ||\n document.activeElement?.tagName == 'TEXTAREA'\n ) {\n document.activeElement.scrollIntoView()\n }\n } catch (e) {\n //\n }\n }, timeoutDuration / 2) // Older Android needs a delay here\n }\n\n setFocus() {\n const {\n focus_selector = null,\n no_animation = null,\n animation_duration = null,\n } = this.props\n const elem = this._contentRef.current\n const timeoutDuration: number =\n typeof animation_duration === 'string'\n ? parseFloat(animation_duration)\n : animation_duration\n\n if (elem) {\n clearTimeout(this._focusTimeout)\n this._focusTimeout = setTimeout(\n () => {\n try {\n let focusElement = elem as HTMLInputElement\n\n // Try to use the \"first-focus\" method first\n if (typeof focus_selector === 'string') {\n focusElement = elem.querySelector(focus_selector)\n }\n\n focusElement?.focus?.()\n focusElement?.select?.()\n\n const noH1Elem = elem.querySelector('h1, h2, h3')\n // Check if there's a header in a Drawer.Header\n const noH1ElemInDrawerHeader = elem.parentElement\n ?.querySelector('.dnb-drawer__header')\n ?.querySelector('h1, h2, h3')\n\n // Check if there's a header in a Dialog.Header\n const noH1ElemInDialogHeader = elem.parentElement\n ?.querySelector('.dnb-dialog__header')\n ?.querySelector('h1, h2, h3')\n\n if (\n noH1Elem?.tagName !== 'H1' &&\n noH1ElemInDrawerHeader?.tagName !== 'H1' &&\n noH1ElemInDialogHeader?.tagName !== 'H1'\n ) {\n warn('A Dialog or Drawer needs a h1 as its first element!')\n }\n } catch (e) {\n warn(e)\n }\n },\n isTrue(no_animation) ? 0 : timeoutDuration || 0\n ) // with this delay, the user can press esc without an focus action first\n }\n }\n\n removeScrollPossibility() {\n if (this._scrollRef.current) {\n disableBodyScroll(this._scrollRef.current)\n }\n }\n\n revertScrollPossibility() {\n enableBodyScroll(this._scrollRef.current)\n clearAllBodyScrollLocks()\n }\n\n preventClick = (event) => {\n if (event) {\n event.stopPropagation()\n }\n }\n\n onCloseClickHandler = (event: React.SyntheticEvent) => {\n this.closeModalContent(event, { triggeredBy: 'button' })\n }\n\n onContentMouseDownHandler = (event: React.SyntheticEvent) => {\n this._overlayClickRef.current =\n event.target === event.currentTarget\n ? (event.target as HTMLElement)\n : null\n }\n\n onContentClickHandler = (event: React.SyntheticEvent) => {\n /**\n * Prevent false-positive Modal close,\n * when e.g. selecting text inside and moving the mouse outside,\n * we would still get this event fired. There we check if the current click,\n * has the same target as where the click got initiated.\n */\n if (this._overlayClickRef.current !== event.target) {\n return // stop here\n }\n this._overlayClickRef.current = null\n\n const { prevent_overlay_close } = this.props\n\n if (!isTrue(prevent_overlay_close)) {\n this.closeModalContent(event, {\n triggeredBy: 'overlay',\n ifIsLatest: false,\n })\n }\n }\n\n onKeyDownHandler = (event) => {\n switch (keycode(event)) {\n case 'esc': {\n const mostCurrent = getModalRoot(-1)\n\n if (mostCurrent === this) {\n event.preventDefault()\n this.closeModalContent(event, {\n triggeredBy: 'keyboard',\n })\n }\n\n break\n }\n }\n }\n\n closeModalContent(event, { triggeredBy, ...params }) {\n event?.persist?.()\n this.setState({ triggeredBy, triggeredByEvent: event }, () => {\n this.props.close(event, {\n triggeredBy,\n ...params,\n })\n })\n }\n\n setBackgroundColor = (color: string) => {\n this.setState({ color })\n }\n\n render() {\n const {\n hide,\n title,\n labelled_by,\n id: _id, // eslint-disable-line\n close_title = 'Lukk',\n dialog_title = 'Vindu',\n hide_close_button = false,\n close_button_attributes,\n no_animation = false,\n no_animation_on_mobile = false,\n fullscreen = 'auto',\n container_placement = 'right',\n vertical_alignment = 'center',\n close,\n content_class,\n overlay_class,\n content_id,\n children, // eslint-disable-line\n dialog_role = null,\n ...rest\n } = this.props\n const { color } = this.state\n\n const contentId = content_id || makeUniqueId('modal-')\n\n const useDialogRole = !(IS_MAC || IS_SAFARI || IS_IOS)\n let role = dialog_role || 'dialog'\n if (!useDialogRole && role === 'dialog') {\n role = 'region'\n }\n\n const contentParams = {\n /**\n * Do not use role=\"dialog\" on Safari\n *\n * VoiceOver has troubles with role=\"dialog\" and \"Modal in Modal\",\n * the result is, only the first Modal gets focus (set by Safari)\n *\n * Tests have shown: Both VoiceOver are working fine with the:\n * \"aria-labelledby\" and \"aria-describedby\" approach\n *\n */\n role,\n 'aria-modal': useDialogRole ? true : undefined,\n\n /**\n * ARIA references\n */\n 'aria-labelledby': combineLabelledBy(\n this.props,\n title ? contentId + '-title' : null,\n labelled_by\n ),\n 'aria-describedby': combineDescribedBy(\n this.props,\n contentId + '-content'\n ),\n\n /**\n * If no labelled_by and no title is given,\n * set a fallback \"dialog_title\"\n */\n 'aria-label': !title && !labelled_by ? dialog_title : undefined,\n\n className: classnames(\n 'dnb-modal__content',\n isTrue(fullscreen)\n ? 'dnb-modal__content--fullscreen'\n : fullscreen === 'auto' && 'dnb-modal__content--auto-fullscreen',\n container_placement\n ? `dnb-modal__content--${container_placement || 'right'}`\n : null,\n `dnb-modal__vertical-alignment--${vertical_alignment}`,\n getThemeClasses(this.context?.theme),\n content_class\n ),\n onMouseDown: this.onContentMouseDownHandler,\n onClick: this.onContentClickHandler,\n }\n\n const content =\n typeof children === 'function'\n ? children({ ...rest, close })\n : children\n\n return (\n <ModalContext.Provider\n value={{\n id: this.props.id,\n title,\n hide_close_button,\n close_button_attributes,\n close_title,\n hide,\n setBackgroundColor: this.setBackgroundColor,\n onCloseClickHandler: this.onCloseClickHandler,\n preventClick: this.preventClick,\n onKeyDownHandler: this.onKeyDownHandler,\n contentRef: this._contentRef,\n scrollRef: this._scrollRef,\n contentId,\n close,\n }}\n >\n <div\n id={contentId}\n /** Sets the color on scroll overflow (at the bottom) */\n style={\n (color\n ? { '--modal-background-color': `var(--color-${color})` }\n : null) as CSSPropertiesWithVars\n }\n {...contentParams}\n >\n {content}\n </div>\n\n <span\n className={classnames(\n 'dnb-modal__overlay',\n hide && 'dnb-modal__overlay--hide',\n isTrue(no_animation) && 'dnb-modal__overlay--no-animation',\n isTrue(no_animation_on_mobile) &&\n 'dnb-modal__overlay--no-animation-on-mobile',\n overlay_class\n )}\n aria-hidden={true}\n />\n </ModalContext.Provider>\n )\n }\n}\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,CACoB,CAAC;EAE5B;AACF;AAAC9G,eAAA,CA/boBJ,YAAY,iBAgBVD,OAAO"}
1
+ {"version":3,"file":"ModalContent.js","names":["React","classnames","disableBodyScroll","enableBodyScroll","clearAllBodyScrollLocks","warn","isTrue","makeUniqueId","InteractionInvalidation","combineLabelledBy","combineDescribedBy","dispatchCustomElementEvent","keycode","ModalContext","IS_IOS","IS_SAFARI","IS_MAC","isAndroid","getListOfModalRoots","getModalRoot","addToIndex","removeFromIndex","getThemeClasses","Context","ModalContent","PureComponent","constructor","props","_defineProperty","color","modalRoots","firstLevel","_this$props","_ii","setBypassSelector","root_id","bypass_invalidation_selectors","filter","Boolean","activate","forEach","modal","_iiLocal","_scrollRef","current","document","addEventListener","onKeyDownHandler","animation_duration","timeoutDuration","parseFloat","clearTimeout","_androidFocusTimeout","setTimeout","_document$activeEleme","_document$activeEleme2","activeElement","tagName","scrollIntoView","e","event","stopPropagation","closeModalContent","triggeredBy","_overlayClickRef","target","currentTarget","prevent_overlay_close","ifIsLatest","mostCurrent","preventDefault","_ref","_triggeredBy","_triggeredByEvent","setState","_contentRef","content_ref","createRef","scroll_ref","modalContentCloseRef","setModalContentState","_id","id","componentDidMount","no_animation","removeScrollPossibility","setFocus","setAndroidFocusHelper","process","env","NODE_ENV","lockBody","_lockTimeout","setIsControlled","componentWillUnmount","_focusTimeout","removeLocks","open_state","_isControlled","componentDidUpdate","wasOpenedManually","_this$_ii","revert","revertScrollPossibility","length","removeAndroidFocusHelper","removeEventListener","window","_androidFocusHelper","focus_selector","elem","_focusElement","_focusElement$focus","_focusElement2","_focusElement2$select","_elem$parentElement","_elem$parentElement$q","_elem$parentElement2","_elem$parentElement2$","focusElement","querySelector","focus","call","select","noH1Elem","noH1ElemInDrawerHeader","parentElement","noH1ElemInDialogHeader","_ref2","_event$persist","params","_objectWithoutProperties","_excluded","persist","close","_objectSpread","render","_this$context","_this$props2","hide","title","labelled_by","close_title","dialog_title","hide_close_button","close_button_attributes","no_animation_on_mobile","fullscreen","container_placement","vertical_alignment","content_class","overlay_class","content_id","children","dialog_role","rest","_excluded2","state","contentId","useDialogRole","role","contentParams","undefined","className","context","theme","onMouseDown","onContentMouseDownHandler","onClick","onContentClickHandler","content","createElement","Provider","value","setBackgroundColor","onCloseClickHandler","preventClick","contentRef","scrollRef","_extends","style"],"sources":["../../../../src/components/modal/ModalContent.tsx"],"sourcesContent":["/**\n * Web Modal Component\n *\n */\n\nimport React from 'react'\nimport classnames from 'classnames'\nimport {\n disableBodyScroll,\n enableBodyScroll,\n clearAllBodyScrollLocks,\n} from './bodyScrollLock'\nimport {\n warn,\n isTrue,\n makeUniqueId,\n InteractionInvalidation,\n combineLabelledBy,\n combineDescribedBy,\n dispatchCustomElementEvent,\n keycode,\n} from '../../shared/component-helper'\nimport ModalContext from './ModalContext'\nimport { IS_IOS, IS_SAFARI, IS_MAC, isAndroid } from '../../shared/helpers'\nimport {\n CloseHandlerParams,\n ModalContentProps,\n TriggeredBy,\n} from './types'\nimport {\n getListOfModalRoots,\n getModalRoot,\n addToIndex,\n removeFromIndex,\n} from './helpers'\nimport { getThemeClasses } from '../../shared/Theme'\nimport { Context } from '../../shared'\nimport { ContextProps } from '../../shared/Context'\n\ninterface ModalContentState {\n color: string\n}\n\ndeclare global {\n interface Window {\n __modalStack: any[]\n }\n}\n\ninterface CSSPropertiesWithVars extends React.CSSProperties {\n '--modal-background-color': string\n}\n\nexport default class ModalContent extends React.PureComponent<\n ModalContentProps,\n ModalContentState\n> {\n state = { color: null }\n\n _contentRef: React.RefObject<HTMLElement>\n _scrollRef: React.RefObject<HTMLElement>\n _overlayClickRef: { current: null | HTMLElement }\n _id: string\n _lockTimeout: NodeJS.Timeout\n _focusTimeout: NodeJS.Timeout\n _androidFocusTimeout: NodeJS.Timeout\n _ii: InteractionInvalidation\n _iiLocal: InteractionInvalidation\n _triggeredBy: TriggeredBy\n _triggeredByEvent: React.SyntheticEvent\n _isControlled = false\n\n static contextType = Context\n\n context!: ContextProps\n\n constructor(props: ModalContentProps) {\n super(props)\n this._contentRef = this.props.content_ref || React.createRef()\n this._scrollRef = this.props.scroll_ref || React.createRef()\n this._overlayClickRef = React.createRef()\n if (this.props.modalContentCloseRef) {\n this.props.modalContentCloseRef.current = this.setModalContentState\n }\n\n // NB: The \"\"._id\" is used in the __modalStack as \"last._id\"\n this._id = props.id\n }\n\n componentDidMount() {\n const {\n id = null,\n no_animation = false,\n animation_duration = null,\n } = this.props\n\n const timeoutDuration: number =\n typeof animation_duration === 'string'\n ? parseFloat(animation_duration)\n : animation_duration\n\n // Add it to the index at first\n // we use it later with getListOfModalRoots\n addToIndex(this)\n\n // Because of nested modals/drawers, we run this regardless\n // has to be run at first – so the scrollbar gets removed\n this.removeScrollPossibility() // forces browser to re-paint\n\n this.setFocus()\n this.setAndroidFocusHelper()\n\n dispatchCustomElementEvent(this, 'on_open', {\n id,\n })\n\n if (isTrue(no_animation) || process.env.NODE_ENV === 'test') {\n this.lockBody() // forces browser to re-paint\n } else {\n this._lockTimeout = setTimeout(this.lockBody, timeoutDuration * 1.2) // a little over --modal-animation-duration\n }\n\n this.setIsControlled()\n }\n\n componentWillUnmount() {\n clearTimeout(this._focusTimeout)\n clearTimeout(this._lockTimeout)\n this.removeLocks()\n }\n\n setIsControlled() {\n const { open_state } = this.props\n if (typeof open_state !== 'undefined' && open_state !== null) {\n this._isControlled = true\n }\n }\n\n componentDidUpdate() {\n this.setIsControlled()\n }\n\n wasOpenedManually() {\n if (this._triggeredBy) {\n return true\n }\n\n if (this._isControlled) {\n return true\n }\n\n return false\n }\n\n lockBody = () => {\n const modalRoots = getListOfModalRoots()\n const firstLevel = modalRoots[0]\n\n if (firstLevel === this) {\n this._ii = new InteractionInvalidation()\n this._ii.setBypassSelector(\n [\n // Bypass modal content\n '.dnb-modal__content *',\n `#dnb-modal-${this.props.root_id || 'root'}`,\n `#dnb-modal-${this.props.root_id || 'root'} *`,\n\n // TODO: Eventually in future, make it possible to bypass invalidation from outside\n // '.dnb-modal--bypass_invalidation',\n // '.dnb-modal--bypass_invalidation_deep *',\n\n ...(this.props?.bypass_invalidation_selectors || []),\n ].filter(Boolean)\n )\n this._ii.activate()\n } else {\n modalRoots.forEach((modal) => {\n if (\n modal !== this &&\n typeof modal._iiLocal === 'undefined' &&\n typeof modal._scrollRef !== 'undefined'\n ) {\n modal._iiLocal = new InteractionInvalidation()\n modal._iiLocal.activate(modal._scrollRef.current)\n }\n })\n }\n\n if (typeof document !== 'undefined') {\n /** To ensure, we have always a working keydown, we call it both on the element and document */\n document.addEventListener('keydown', this.onKeyDownHandler)\n }\n }\n\n removeLocks() {\n const modalRoots = getListOfModalRoots()\n const firstLevel = modalRoots[0]\n\n removeFromIndex(this)\n\n if (firstLevel === this) {\n this._ii?.revert()\n this.revertScrollPossibility()\n } else {\n try {\n const modal = modalRoots[modalRoots.length - 2]\n if (modal !== this && modal._iiLocal) {\n modal._iiLocal.revert()\n delete modal._iiLocal\n }\n } catch (e) {\n warn(e)\n }\n }\n\n this.removeAndroidFocusHelper()\n\n if (this.wasOpenedManually()) {\n const id = this.props.id\n dispatchCustomElementEvent(this, 'on_close', {\n id,\n event: this._triggeredByEvent,\n triggeredBy: this._triggeredBy || 'unmount',\n })\n }\n\n if (typeof document !== 'undefined') {\n document.removeEventListener('keydown', this.onKeyDownHandler)\n }\n }\n\n setAndroidFocusHelper() {\n if (typeof window !== 'undefined' && isAndroid()) {\n window.addEventListener('resize', this._androidFocusHelper)\n }\n }\n\n removeAndroidFocusHelper() {\n window.removeEventListener('resize', this._androidFocusHelper)\n clearTimeout(this._androidFocusTimeout)\n }\n\n _androidFocusHelper = () => {\n const { animation_duration = null } = this.props\n const timeoutDuration: number =\n typeof animation_duration === 'string'\n ? parseFloat(animation_duration)\n : animation_duration\n\n clearTimeout(this._androidFocusTimeout)\n this._androidFocusTimeout = setTimeout(() => {\n try {\n if (\n document.activeElement?.tagName == 'INPUT' ||\n document.activeElement?.tagName == 'TEXTAREA'\n ) {\n document.activeElement.scrollIntoView()\n }\n } catch (e) {\n //\n }\n }, timeoutDuration / 2) // Older Android needs a delay here\n }\n\n setFocus() {\n const {\n focus_selector = null,\n no_animation = null,\n animation_duration = null,\n } = this.props\n const elem = this._contentRef.current\n const timeoutDuration: number =\n typeof animation_duration === 'string'\n ? parseFloat(animation_duration)\n : animation_duration\n\n if (elem) {\n clearTimeout(this._focusTimeout)\n this._focusTimeout = setTimeout(\n () => {\n try {\n let focusElement = elem as HTMLInputElement\n\n // Try to use the \"first-focus\" method first\n if (typeof focus_selector === 'string') {\n focusElement = elem.querySelector(focus_selector)\n }\n\n focusElement?.focus?.()\n focusElement?.select?.()\n\n const noH1Elem = elem.querySelector('h1, h2, h3')\n // Check if there's a header in a Drawer.Header\n const noH1ElemInDrawerHeader = elem.parentElement\n ?.querySelector('.dnb-drawer__header')\n ?.querySelector('h1, h2, h3')\n\n // Check if there's a header in a Dialog.Header\n const noH1ElemInDialogHeader = elem.parentElement\n ?.querySelector('.dnb-dialog__header')\n ?.querySelector('h1, h2, h3')\n\n if (\n noH1Elem?.tagName !== 'H1' &&\n noH1ElemInDrawerHeader?.tagName !== 'H1' &&\n noH1ElemInDialogHeader?.tagName !== 'H1'\n ) {\n warn('A Dialog or Drawer needs a h1 as its first element!')\n }\n } catch (e) {\n warn(e)\n }\n },\n isTrue(no_animation) ? 0 : timeoutDuration || 0\n ) // with this delay, the user can press esc without an focus action first\n }\n }\n\n removeScrollPossibility() {\n if (this._scrollRef.current) {\n disableBodyScroll(this._scrollRef.current)\n }\n }\n\n revertScrollPossibility() {\n enableBodyScroll(this._scrollRef.current)\n clearAllBodyScrollLocks()\n }\n\n preventClick = (event) => {\n if (event) {\n event.stopPropagation()\n }\n }\n\n onCloseClickHandler = (event: React.SyntheticEvent) => {\n this.closeModalContent(event, { triggeredBy: 'button' })\n }\n\n onContentMouseDownHandler = (event: React.SyntheticEvent) => {\n this._overlayClickRef.current =\n event.target === event.currentTarget\n ? (event.target as HTMLElement)\n : null\n }\n\n onContentClickHandler = (event: React.SyntheticEvent) => {\n /**\n * Prevent false-positive Modal close,\n * when e.g. selecting text inside and moving the mouse outside,\n * we would still get this event fired. There we check if the current click,\n * has the same target as where the click got initiated.\n */\n if (this._overlayClickRef.current !== event.target) {\n return // stop here\n }\n this._overlayClickRef.current = null\n\n const { prevent_overlay_close } = this.props\n\n if (!isTrue(prevent_overlay_close)) {\n this.closeModalContent(event, {\n triggeredBy: 'overlay',\n ifIsLatest: false,\n })\n }\n }\n\n onKeyDownHandler = (event) => {\n switch (keycode(event)) {\n case 'esc': {\n const mostCurrent = getModalRoot(-1)\n\n if (mostCurrent === this) {\n event.preventDefault()\n this.closeModalContent(event, {\n triggeredBy: 'keyboard',\n })\n }\n\n break\n }\n }\n }\n\n setModalContentState = (\n event: React.SyntheticEvent,\n { triggeredBy }: CloseHandlerParams\n ) => {\n this._triggeredBy = triggeredBy\n this._triggeredByEvent = event\n }\n\n closeModalContent(\n event,\n {\n triggeredBy,\n ...params\n }: CloseHandlerParams & { ifIsLatest?: boolean }\n ) {\n event?.persist?.()\n\n this.props.close(event, {\n triggeredBy,\n ...params,\n })\n }\n\n setBackgroundColor = (color: string) => {\n this.setState({ color })\n }\n\n render() {\n const {\n hide,\n title,\n labelled_by,\n id: _id, // eslint-disable-line\n close_title = 'Lukk',\n dialog_title = 'Vindu',\n hide_close_button = false,\n close_button_attributes,\n no_animation = false,\n no_animation_on_mobile = false,\n fullscreen = 'auto',\n container_placement = 'right',\n vertical_alignment = 'center',\n close,\n content_class,\n overlay_class,\n content_id,\n children, // eslint-disable-line\n dialog_role = null,\n ...rest\n } = this.props\n const { color } = this.state\n\n const contentId = content_id || makeUniqueId('modal-')\n\n const useDialogRole = !(IS_MAC || IS_SAFARI || IS_IOS)\n let role = dialog_role || 'dialog'\n if (!useDialogRole && role === 'dialog') {\n role = 'region'\n }\n\n const contentParams = {\n /**\n * Do not use role=\"dialog\" on Safari\n *\n * VoiceOver has troubles with role=\"dialog\" and \"Modal in Modal\",\n * the result is, only the first Modal gets focus (set by Safari)\n *\n * Tests have shown: Both VoiceOver are working fine with the:\n * \"aria-labelledby\" and \"aria-describedby\" approach\n *\n */\n role,\n 'aria-modal': useDialogRole ? true : undefined,\n\n /**\n * ARIA references\n */\n 'aria-labelledby': combineLabelledBy(\n this.props,\n title ? contentId + '-title' : null,\n labelled_by\n ),\n 'aria-describedby': combineDescribedBy(\n this.props,\n contentId + '-content'\n ),\n\n /**\n * If no labelled_by and no title is given,\n * set a fallback \"dialog_title\"\n */\n 'aria-label': !title && !labelled_by ? dialog_title : undefined,\n\n className: classnames(\n 'dnb-modal__content',\n isTrue(fullscreen)\n ? 'dnb-modal__content--fullscreen'\n : fullscreen === 'auto' && 'dnb-modal__content--auto-fullscreen',\n container_placement\n ? `dnb-modal__content--${container_placement || 'right'}`\n : null,\n `dnb-modal__vertical-alignment--${vertical_alignment}`,\n getThemeClasses(this.context?.theme),\n content_class\n ),\n onMouseDown: this.onContentMouseDownHandler,\n onClick: this.onContentClickHandler,\n }\n\n const content =\n typeof children === 'function'\n ? children({ ...rest, close })\n : children\n\n return (\n <ModalContext.Provider\n value={{\n id: this.props.id,\n title,\n hide_close_button,\n close_button_attributes,\n close_title,\n hide,\n setBackgroundColor: this.setBackgroundColor,\n onCloseClickHandler: this.onCloseClickHandler,\n preventClick: this.preventClick,\n onKeyDownHandler: this.onKeyDownHandler,\n contentRef: this._contentRef,\n scrollRef: this._scrollRef,\n contentId,\n close,\n }}\n >\n <div\n id={contentId}\n /** Sets the color on scroll overflow (at the bottom) */\n style={\n (color\n ? { '--modal-background-color': `var(--color-${color})` }\n : null) as CSSPropertiesWithVars\n }\n {...contentParams}\n >\n {content}\n </div>\n\n <span\n className={classnames(\n 'dnb-modal__overlay',\n hide && 'dnb-modal__overlay--hide',\n isTrue(no_animation) && 'dnb-modal__overlay--no-animation',\n isTrue(no_animation_on_mobile) &&\n 'dnb-modal__overlay--no-animation-on-mobile',\n overlay_class\n )}\n aria-hidden={true}\n />\n </Modal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;QACXH,IAAI;QACJmC,kBAAkB,EAAE,IAAI,CAACA,kBAAkB;QAC3CC,mBAAmB,EAAE,IAAI,CAACA,mBAAmB;QAC7CC,YAAY,EAAE,IAAI,CAACA,YAAY;QAC/BjI,gBAAgB,EAAE,IAAI,CAACA,gBAAgB;QACvCkI,UAAU,EAAE,IAAI,CAACtG,WAAW;QAC5BuG,SAAS,EAAE,IAAI,CAACvI,UAAU;QAC1BmH,SAAS;QACTxB;MACF;IAAE,GAEFtI,KAAA,CAAA2K,aAAA,QAAAQ,QAAA;MACEjG,EAAE,EAAE4E,SAAU;MAEdsB,KAAK,EACFvJ,KAAK,GACF;QAAE,0BAA0B,EAAG,eAAcA,KAAM;MAAG,CAAC,GACvD;IACL,GACGoI,aAAa,GAEhBS,OACE,CAAC,EAEN1K,KAAA,CAAA2K,aAAA;MACER,SAAS,EAAElK,UAAU,CACnB,oBAAoB,EAKpBsJ,aAAa,EAJbZ,IAAI,IAAI,0BAA0B,EAClCrI,MAAM,CAAC8E,YAAY,CAAC,IAAI,kCAAkC,EAC1D9E,MAAM,CAAC4I,sBAAsB,CAAC,IAC5B,4CAEJ,CAAE;MACF,eAAa;IAAK,CACnB,CACoB,CAAC;EAE5B;AACF;AAACtH,eAAA,CA5eoBJ,YAAY,iBAmBVD,OAAO"}
@@ -16,6 +16,8 @@ export interface ModalRootProps extends ModalContentProps {
16
16
  * The content which will appear when triggering the modal/drawer.
17
17
  */
18
18
  children?: ReactChildType;
19
+ /** For internal use only */
20
+ modalContentCloseRef?: React.RefObject<any>;
19
21
  }
20
22
  interface ModalRootState {
21
23
  isMounted: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"ModalRoot.js","names":["React","ReactDOM","warn","isTrue","ModalContent","ModalRoot","PureComponent","constructor","arguments","_defineProperty","isMounted","insertModalRoot","id","window","__modalRoot","document","getElementById","createElement","setAttribute","body","insertBefore","firstChild","e","componentDidMount","direct_dom_return","root_id","props","portalElem","className","appendChild","setState","componentWillUnmount","removeChild","render","_this$props","children","_objectWithoutProperties","_excluded","state","createPortal"],"sources":["../../../../src/components/modal/ModalRoot.tsx"],"sourcesContent":["import React from 'react'\nimport ReactDOM from 'react-dom'\nimport { warn, isTrue } from '../../shared/component-helper'\nimport ModalContent from './ModalContent'\nimport { ModalContentProps, ReactChildType } from './types'\n\ndeclare global {\n interface Window {\n __modalRoot: HTMLElement\n }\n}\n\nexport interface ModalRootProps extends ModalContentProps {\n /**\n * The id used internal in the modal/drawer root element. Defaults to `root`, so the element id will be `dnb-modal-root`.\n */\n id?: string\n root_id?: string\n direct_dom_return?: boolean\n\n /**\n * The content which will appear when triggering the modal/drawer.\n */\n children?: ReactChildType\n}\n\ninterface ModalRootState {\n isMounted: boolean\n}\n\nexport default class ModalRoot extends React.PureComponent<\n ModalRootProps,\n ModalRootState\n> {\n portalElem: HTMLDivElement | null\n static defaultProps = {\n id: null,\n root_id: 'root',\n direct_dom_return: false,\n children: null,\n }\n\n state = {\n isMounted: false,\n }\n\n static insertModalRoot(id) {\n if (typeof window === 'undefined') {\n return false\n }\n\n try {\n id = `dnb-modal-${id || 'root'}`\n window.__modalRoot = document.getElementById(id)\n if (!window.__modalRoot) {\n window.__modalRoot = document.createElement('div')\n window.__modalRoot.setAttribute('id', id)\n document.body.insertBefore(\n window.__modalRoot,\n document.body.firstChild\n )\n }\n } catch (e) {\n warn('Modal: Could not insert dnb-modal-root', e)\n }\n\n return window.__modalRoot\n }\n\n componentDidMount() {\n const { direct_dom_return = false, root_id = 'root' } = this.props\n if (!isTrue(direct_dom_return)) {\n ModalRoot.insertModalRoot(root_id)\n\n try {\n if (!this.portalElem) {\n this.portalElem = document.createElement('div')\n this.portalElem.className = 'dnb-modal-root__inner'\n }\n if (\n this.portalElem &&\n typeof window !== 'undefined' &&\n window.__modalRoot\n ) {\n window.__modalRoot.appendChild(this.portalElem)\n }\n } catch (e) {\n warn(e)\n }\n this.setState({ isMounted: true })\n }\n }\n\n componentWillUnmount() {\n try {\n if (\n this.portalElem &&\n typeof window !== 'undefined' &&\n window.__modalRoot &&\n window.__modalRoot.removeChild\n ) {\n window.__modalRoot.removeChild(this.portalElem)\n this.portalElem = null\n }\n } catch (e) {\n warn(e)\n }\n }\n\n render() {\n const { children, direct_dom_return, ...props } = this.props\n\n if (isTrue(direct_dom_return)) {\n return <ModalContent {...props}>{children}</ModalContent>\n }\n\n if (\n this.portalElem &&\n typeof window !== 'undefined' &&\n window.__modalRoot &&\n this.state.isMounted\n ) {\n return ReactDOM.createPortal(\n <ModalContent {...props}>{children}</ModalContent>,\n this.portalElem\n )\n }\n\n return null\n }\n}\n"],"mappings":";;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,QAAQ,MAAM,WAAW;AAChC,SAASC,IAAI,EAAEC,MAAM,QAAQ,+BAA+B;AAC5D,OAAOC,YAAY,MAAM,gBAAgB;AA2BzC,eAAe,MAAMC,SAAS,SAASL,KAAK,CAACM,aAAa,CAGxD;EAAAC,YAAA;IAAA,SAAAC,SAAA;IAAAC,eAAA;IAAAA,eAAA,gBASQ;MACNC,SAAS,EAAE;IACb,CAAC;EAAA;EAED,OAAOC,eAAeA,CAACC,EAAE,EAAE;IACzB,IAAI,OAAOC,MAAM,KAAK,WAAW,EAAE;MACjC,OAAO,KAAK;IACd;IAEA,IAAI;MACFD,EAAE,GAAI,aAAYA,EAAE,IAAI,MAAO,EAAC;MAChCC,MAAM,CAACC,WAAW,GAAGC,QAAQ,CAACC,cAAc,CAACJ,EAAE,CAAC;MAChD,IAAI,CAACC,MAAM,CAACC,WAAW,EAAE;QACvBD,MAAM,CAACC,WAAW,GAAGC,QAAQ,CAACE,aAAa,CAAC,KAAK,CAAC;QAClDJ,MAAM,CAACC,WAAW,CAACI,YAAY,CAAC,IAAI,EAAEN,EAAE,CAAC;QACzCG,QAAQ,CAACI,IAAI,CAACC,YAAY,CACxBP,MAAM,CAACC,WAAW,EAClBC,QAAQ,CAACI,IAAI,CAACE,UAChB,CAAC;MACH;IACF,CAAC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,MAAAC,WAAA,GAAkD,IAAI,CAACR,KAAK;MAAtD;QAAES,QAAQ;QAAEX;MAA4B,CAAC,GAAAU,WAAA;MAAPR,KAAK,GAAAU,wBAAA,CAAAF,WAAA,EAAAG,SAAA;IAE7C,IAAIlC,MAAM,CAACqB,iBAAiB,CAAC,EAAE;MAC7B,OAAOxB,KAAA,CAAAiB,aAAA,CAACb,YAAY,EAAKsB,KAAK,EAAGS,QAAuB,CAAC;IAC3D;IAEA,IACE,IAAI,CAACR,UAAU,IACf,OAAOd,MAAM,KAAK,WAAW,IAC7BA,MAAM,CAACC,WAAW,IAClB,IAAI,CAACwB,KAAK,CAAC5B,SAAS,EACpB;MACA,OAAOT,QAAQ,CAACsC,YAAY,CAC1BvC,KAAA,CAAAiB,aAAA,CAACb,YAAY,EAAKsB,KAAK,EAAGS,QAAuB,CAAC,EAClD,IAAI,CAACR,UACP,CAAC;IACH;IAEA,OAAO,IAAI;EACb;AACF;AAAClB,eAAA,CApGoBJ,SAAS,kBAKN;EACpBO,EAAE,EAAE,IAAI;EACRa,OAAO,EAAE,MAAM;EACfD,iBAAiB,EAAE,KAAK;EACxBW,QAAQ,EAAE;AACZ,CAAC"}
1
+ {"version":3,"file":"ModalRoot.js","names":["React","ReactDOM","warn","isTrue","ModalContent","ModalRoot","PureComponent","constructor","arguments","_defineProperty","isMounted","insertModalRoot","id","window","__modalRoot","document","getElementById","createElement","setAttribute","body","insertBefore","firstChild","e","componentDidMount","direct_dom_return","root_id","props","portalElem","className","appendChild","setState","componentWillUnmount","removeChild","render","_this$props","children","_objectWithoutProperties","_excluded","state","createPortal"],"sources":["../../../../src/components/modal/ModalRoot.tsx"],"sourcesContent":["import React from 'react'\nimport ReactDOM from 'react-dom'\nimport { warn, isTrue } from '../../shared/component-helper'\nimport ModalContent from './ModalContent'\nimport { ModalContentProps, ReactChildType } from './types'\n\ndeclare global {\n interface Window {\n __modalRoot: HTMLElement\n }\n}\n\nexport interface ModalRootProps extends ModalContentProps {\n /**\n * The id used internal in the modal/drawer root element. Defaults to `root`, so the element id will be `dnb-modal-root`.\n */\n id?: string\n root_id?: string\n direct_dom_return?: boolean\n\n /**\n * The content which will appear when triggering the modal/drawer.\n */\n children?: ReactChildType\n\n /** For internal use only */\n modalContentCloseRef?: React.RefObject<any>\n}\n\ninterface ModalRootState {\n isMounted: boolean\n}\n\nexport default class ModalRoot extends React.PureComponent<\n ModalRootProps,\n ModalRootState\n> {\n portalElem: HTMLDivElement | null\n static defaultProps = {\n id: null,\n root_id: 'root',\n direct_dom_return: false,\n children: null,\n }\n\n state = {\n isMounted: false,\n }\n\n static insertModalRoot(id) {\n if (typeof window === 'undefined') {\n return false\n }\n\n try {\n id = `dnb-modal-${id || 'root'}`\n window.__modalRoot = document.getElementById(id)\n if (!window.__modalRoot) {\n window.__modalRoot = document.createElement('div')\n window.__modalRoot.setAttribute('id', id)\n document.body.insertBefore(\n window.__modalRoot,\n document.body.firstChild\n )\n }\n } catch (e) {\n warn('Modal: Could not insert dnb-modal-root', e)\n }\n\n return window.__modalRoot\n }\n\n componentDidMount() {\n const { direct_dom_return = false, root_id = 'root' } = this.props\n if (!isTrue(direct_dom_return)) {\n ModalRoot.insertModalRoot(root_id)\n\n try {\n if (!this.portalElem) {\n this.portalElem = document.createElement('div')\n this.portalElem.className = 'dnb-modal-root__inner'\n }\n if (\n this.portalElem &&\n typeof window !== 'undefined' &&\n window.__modalRoot\n ) {\n window.__modalRoot.appendChild(this.portalElem)\n }\n } catch (e) {\n warn(e)\n }\n this.setState({ isMounted: true })\n }\n }\n\n componentWillUnmount() {\n try {\n if (\n this.portalElem &&\n typeof window !== 'undefined' &&\n window.__modalRoot &&\n window.__modalRoot.removeChild\n ) {\n window.__modalRoot.removeChild(this.portalElem)\n this.portalElem = null\n }\n } catch (e) {\n warn(e)\n }\n }\n\n render() {\n const { children, direct_dom_return, ...props } = this.props\n\n if (isTrue(direct_dom_return)) {\n return <ModalContent {...props}>{children}</ModalContent>\n }\n\n if (\n this.portalElem &&\n typeof window !== 'undefined' &&\n window.__modalRoot &&\n this.state.isMounted\n ) {\n return ReactDOM.createPortal(\n <ModalContent {...props}>{children}</ModalContent>,\n this.portalElem\n )\n }\n\n return null\n }\n}\n"],"mappings":";;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,QAAQ,MAAM,WAAW;AAChC,SAASC,IAAI,EAAEC,MAAM,QAAQ,+BAA+B;AAC5D,OAAOC,YAAY,MAAM,gBAAgB;AA8BzC,eAAe,MAAMC,SAAS,SAASL,KAAK,CAACM,aAAa,CAGxD;EAAAC,YAAA;IAAA,SAAAC,SAAA;IAAAC,eAAA;IAAAA,eAAA,gBASQ;MACNC,SAAS,EAAE;IACb,CAAC;EAAA;EAED,OAAOC,eAAeA,CAACC,EAAE,EAAE;IACzB,IAAI,OAAOC,MAAM,KAAK,WAAW,EAAE;MACjC,OAAO,KAAK;IACd;IAEA,IAAI;MACFD,EAAE,GAAI,aAAYA,EAAE,IAAI,MAAO,EAAC;MAChCC,MAAM,CAACC,WAAW,GAAGC,QAAQ,CAACC,cAAc,CAACJ,EAAE,CAAC;MAChD,IAAI,CAACC,MAAM,CAACC,WAAW,EAAE;QACvBD,MAAM,CAACC,WAAW,GAAGC,QAAQ,CAACE,aAAa,CAAC,KAAK,CAAC;QAClDJ,MAAM,CAACC,WAAW,CAACI,YAAY,CAAC,IAAI,EAAEN,EAAE,CAAC;QACzCG,QAAQ,CAACI,IAAI,CAACC,YAAY,CACxBP,MAAM,CAACC,WAAW,EAClBC,QAAQ,CAACI,IAAI,CAACE,UAChB,CAAC;MACH;IACF,CAAC,CAAC,OAAOC,CAAC,EAAE;MACVpB,IAAI,CAAC,wCAAwC,EAAEoB,CAAC,CAAC;IACnD;IAEA,OAAOT,MAAM,CAACC,WAAW;EAC3B;EAEAS,iBAAiBA,CAAA,EAAG;IAClB,MAAM;MAAEC,iBAAiB,GAAG,KAAK;MAAEC,OAAO,GAAG;IAAO,CAAC,GAAG,IAAI,CAACC,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b,YAAY,EAAKsB,KAAK,EAAGS,QAAuB,CAAC;IAC3D;IAEA,IACE,IAAI,CAACR,UAAU,IACf,OAAOd,MAAM,KAAK,WAAW,IAC7BA,MAAM,CAACC,WAAW,IAClB,IAAI,CAACwB,KAAK,CAAC5B,SAAS,EACpB;MACA,OAAOT,QAAQ,CAACsC,YAAY,CAC1BvC,KAAA,CAAAiB,aAAA,CAACb,YAAY,EAAKsB,KAAK,EAAGS,QAAuB,CAAC,EAClD,IAAI,CAACR,UACP,CAAC;IACH;IAEA,OAAO,IAAI;EACb;AACF;AAAClB,eAAA,CApGoBJ,SAAS,kBAKN;EACpBO,EAAE,EAAE,IAAI;EACRa,OAAO,EAAE,MAAM;EACfD,iBAAiB,EAAE,KAAK;EACxBW,QAAQ,EAAE;AACZ,CAAC"}
@@ -11,6 +11,12 @@ export type ModalTriggerVariant = 'primary' | 'secondary' | 'tertiary' | 'signal
11
11
  export type ModalTriggerIconPosition = 'left' | 'right';
12
12
  export type ModalContentMinWidth = string | number;
13
13
  export type ModalContentMaxWidth = string | number;
14
+ export type TriggeredBy = 'handler' | 'button' | 'overlay' | 'keyboard' | 'unmount';
15
+ export type CloseHandlerParams = {
16
+ triggeredBy: TriggeredBy;
17
+ triggeredByEvent?: Event;
18
+ };
19
+ export type CloseHandler = (params?: CloseHandlerParams) => void;
14
20
  export interface ModalProps extends ModalRootProps {
15
21
  /**
16
22
  * The id used internal in the modal/drawer root element. Defaults to `root`, so the element id will be `dnb-modal-root`.
@@ -69,16 +75,16 @@ export interface ModalProps extends ModalRootProps {
69
75
  id?: string;
70
76
  event?: Event;
71
77
  triggeredBy?: string;
72
- close?: (...args: any[]) => any;
78
+ close?: CloseHandler;
73
79
  }) => void;
74
80
  /**
75
81
  * Set a function to call the callback function, once the modal/drawer should open: `open_modal={(open) => open()}`
76
82
  */
77
- open_modal?: (open?: (e: Event) => void, elem?: any) => () => void | void;
83
+ open_modal?: (open?: (e: Event) => void, instance?: any) => () => void | void;
78
84
  /**
79
85
  * Set a function to call the callback function, once the modal/drawer should close: `close_modal={(close) => close()}`
80
86
  */
81
- close_modal?: (close?: (...args: any[]) => void, elem?: any) => () => void | void;
87
+ close_modal?: (close?: CloseHandler, instance?: any) => () => void | void;
82
88
  /**
83
89
  * Provide a custom trigger component. Like trigger={<Anchor href="/" />}. It will set the focus on it when the modal/drawer gets closed.
84
90
  */
@@ -238,5 +244,7 @@ export interface ModalContentProps {
238
244
  dialog_role?: 'dialog' | 'alertdialog' | 'region';
239
245
  content_ref?: React.RefObject<HTMLElement>;
240
246
  scroll_ref?: React.RefObject<HTMLElement>;
247
+ open_state?: ModalOpenState;
248
+ modalContentCloseRef?: React.MutableRefObject<any>;
241
249
  }
242
250
  export type TriggerAttributes = ButtonProps;
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","names":[],"sources":["../../../../src/components/modal/types.ts"],"sourcesContent":["import * as React from 'react'\nimport type { CloseButtonProps } from './parts/CloseButton'\nimport type { ButtonProps } from '../button/Button'\nimport type { ModalRootProps } from './ModalRoot'\n\nexport type ReactChildType = React.ReactNode | ((...args: any[]) => any)\n\nexport type ModalFullscreen = 'auto' | boolean\nexport type ModalAlignContent = 'left' | 'center' | 'centered' | 'right'\nexport type ModalContainerPlacement = 'left' | 'right' | 'top' | 'bottom'\nexport type ModalOpenState = 'opened' | 'closed' | boolean\nexport type ModalTriggerVariant =\n | 'primary'\n | 'secondary'\n | 'tertiary'\n | 'signal'\nexport type ModalTriggerIconPosition = 'left' | 'right'\nexport type ModalContentMinWidth = string | number\nexport type ModalContentMaxWidth = string | number\n\nexport interface ModalProps extends ModalRootProps {\n /**\n * The id used internal in the modal/drawer root element. Defaults to `root`, so the element id will be `dnb-modal-root`.\n */\n id?: string\n\n /**\n * Will disable the trigger button.\n */\n disabled?: boolean\n\n /**\n * Forces the modal/drawer to delay the opening. The delay is given in `ms`.\n */\n open_delay?: string | number\n\n /**\n * If set to `true` (boolean or string), then the user can&#39;t close the modal/drawer.\n */\n prevent_close?: boolean\n\n /**\n * Duration of animation open/close in ms. Defaults to 300ms.\n */\n animation_duration?: string | number\n\n /**\n * If set to `true`, no open/close animation will be shown. Defaults to false.\n */\n no_animation?: boolean\n\n /**\n * Use this prop to control the open/close state by setting either: `opened` / `closed` or `true` / `false`.\n */\n open_state?: ModalOpenState\n\n /**\n * The content which will appear when triggering the modal/drawer.\n */\n children?: ReactChildType\n\n /**\n * Omits default showing trigger button\n */\n omit_trigger_button?: boolean\n\n /**\n * This event gets triggered once the modal shows up. Returns the modal id: `{ id }`.\n */\n on_open?: ({ id }: { id?: string }) => void\n\n /**\n * This event gets triggered once the modal gets closed. Returns the modal id: `{ id, event, triggeredBy }`.\n */\n on_close?: ({\n id,\n event,\n triggeredBy,\n }: {\n id?: string\n event?: Event\n triggeredBy?: string\n }) => void\n\n /**\n * This event gets triggered once the user tries to close the modal, but `prevent_close` is set to \"true\". Returns a callback `close` you can call to trigger the close mechanism. More details below. Returns the modal id: `{ id, event, close: Method, triggeredBy }`\n */\n on_close_prevent?: ({\n id,\n event,\n triggeredBy,\n close,\n }: {\n id?: string\n event?: Event\n triggeredBy?: string\n close?: (...args: any[]) => any\n }) => void\n\n /**\n * Set a function to call the callback function, once the modal/drawer should open: `open_modal={(open) => open()}`\n */\n open_modal?: (open?: (e: Event) => void, elem?: any) => () => void | void\n\n /**\n * Set a function to call the callback function, once the modal/drawer should close: `close_modal={(close) => close()}`\n */\n close_modal?: (\n close?: (...args: any[]) => void,\n elem?: any\n ) => () => void | void\n\n /**\n * Provide a custom trigger component. Like trigger={<Anchor href=\"/\" />}. It will set the focus on it when the modal/drawer gets closed.\n */\n trigger?: ReactChildType\n\n /**\n * Send along custom HTML attributes or properties to the trigger button.\n */\n trigger_attributes?: TriggerAttributes\n\n /**\n * The content which will appear when triggering the modal/drawer.\n */\n modal_content?: ReactChildType\n\n /**\n * If true, the drawer will not open in a new DOM but directly in current DOM. Defaults to `false`.\n */\n direct_dom_return?: boolean\n\n /**\n * To get the inner content Element, pass in your own React ref\n */\n content_ref?: React.RefObject<HTMLElement>\n\n /**\n * To get the scroll Element, pass in your own React ref\n */\n scroll_ref?: React.RefObject<HTMLElement>\n}\n\nexport interface ModalContentProps {\n /**\n * The content which will appear when triggering the modal/drawer.\n */\n modal_content?: ReactChildType\n\n /**\n * The content which will appear in the bar, above the header, and side-by-side the close button.\n */\n bar_content?: ReactChildType\n\n /**\n * The content which will appear in the header of the modal/drawer the modal/drawer.\n */\n header_content?: ReactChildType\n hide?: boolean\n\n /**\n * The id used internal for the trigger button and modal component.\n */\n id?: string\n\n /**\n * The id used internal in the modal/drawer root element. Defaults to `root`, so the element id will be `dnb-modal-root`.\n */\n root_id?: string\n\n /**\n * The ID of the trigger component, describing the modal/drawer content. Defaults to the internal `trigger`, so make sure you define the trigger title.\n */\n labelled_by?: string\n\n /**\n * The Modal handles the first focus – automatically. How ever, you can defined a custom focus selector the will be used instead `focus_selector=\".css-selector\"`.\n */\n focus_selector?: string\n\n /**\n * Defines an unique identifier to a modal. Use it in case you have to refer in some way to the modal/drawer content wrapper.\n */\n content_id?: string\n\n /**\n * The modal/drawer title. Displays on the very top of the content.\n */\n title?: React.ReactNode\n\n /**\n * The aria label of the dialog when no labelled_by and no title is given. Defaults to `Vindu`.\n */\n dialog_title?: string\n\n /**\n * If boolean, the close button will not be shown.\n */\n hide_close_button?: boolean\n\n /**\n * Define any valid Eufemia Button property or HTML attribute inside an object.\n */\n close_button_attributes?: CloseButtonProps\n\n /**\n * If set to `false` then the modal/drawer content will be shown without any spacing. Defaults to `true`.\n */\n spacing?: boolean\n\n /**\n * By default the modal/drawer content gets added the core style class `dnb-core-style`. Use `false` to disable this behavior.\n */\n prevent_core_style?: boolean\n animation_duration?: string | number\n\n /**\n * Disable clicking the background overlay to close the modal\n */\n prevent_overlay_close?: boolean\n\n /**\n * If set to `true`, no open/close animation will be shown. Defaults to false.\n */\n no_animation?: boolean\n\n /**\n * Same as `no_animation`, but gets triggered only if the viewport width is less than `40em`. Defaults to false.\n */\n no_animation_on_mobile?: boolean\n\n /**\n * The minimum Modal content width, defined by a CSS width value like `50vw` (50% of the viewport). Be careful on using fixed `min_width` so you don&#39;t break responsiveness. Defaults to `30rem` (average width is set to `60vw`).\n */\n min_width?: ModalContentMinWidth\n\n /**\n * The maximum Modal content width, defined by a CSS width value like `20rem`. Defaults to `60rem` (average width is set to `60vw`).\n */\n max_width?: ModalContentMaxWidth\n\n /**\n * If set to `true` then the modal/drawer content will be shown as fullscreen, without showing the original content behind. Can be set to `false` to omit the auto fullscreen. Defaults to `auto`.\n */\n fullscreen?: ModalFullscreen\n\n /**\n * Define the inner horizontal alignment of the content. Can be set to `left`, `center`, `right` and `centered`. If `centered`, then the content will also be centered vertically. Defaults to `left`.\n */\n align_content?: 'right' | 'left' | 'centered' | 'center'\n\n /**\n * For `drawer` mode only. Defines the placement on what side the Drawer should be opened. Can be set to `left`, `right`, `top` and `bottom`. Defaults to `right`.\n */\n container_placement?: 'left' | 'right' | 'top' | 'bottom'\n\n /**\n * Define the vertical alignment of the container. Can be set to `top` or `center`. Defaults to `center`.\n */\n vertical_alignment?: 'top' | 'center'\n\n /**\n * Give the content wrapper a custom class name (maps to `dnb-modal__content`).\n */\n content_class?: string\n\n /**\n * @deprecated – use className instead. Will be removed in v11.\n */\n class?: string\n\n /**\n * Give the page overlay a custom class name (maps to `dnb-modal__overlay`).\n */\n overlay_class?: string\n\n /**\n * Define an array with HTML class selectors (`['.element-selector']`) which should not get invalidated when the modal opens/closes. Use this in order to let some parts of your site still be accessible by screen readers.\n */\n bypass_invalidation_selectors?: Array<string>\n\n /**\n * For internal usage\n * Will close the modal\n */\n close?: (...args: any[]) => any\n\n /**\n * Give the inner Dialog or Drawer component a className (only works with mode)\n */\n className?: string\n\n /**\n * The content which will appear when triggering the modal/drawer.\n */\n children?: ReactChildType\n\n /**\n * The displayed text for the 'close' button. Defaults to `Lukk`.\n */\n close_title?: string\n\n /**\n * Internal\n */\n dialog_role?: 'dialog' | 'alertdialog' | 'region'\n content_ref?: React.RefObject<HTMLElement>\n scroll_ref?: React.RefObject<HTMLElement>\n}\n\nexport type TriggerAttributes = ButtonProps\n"],"mappings":""}
1
+ {"version":3,"file":"types.js","names":[],"sources":["../../../../src/components/modal/types.ts"],"sourcesContent":["import * as React from 'react'\nimport type { CloseButtonProps } from './parts/CloseButton'\nimport type { ButtonProps } from '../button/Button'\nimport type { ModalRootProps } from './ModalRoot'\n\nexport type ReactChildType = React.ReactNode | ((...args: any[]) => any)\n\nexport type ModalFullscreen = 'auto' | boolean\nexport type ModalAlignContent = 'left' | 'center' | 'centered' | 'right'\nexport type ModalContainerPlacement = 'left' | 'right' | 'top' | 'bottom'\nexport type ModalOpenState = 'opened' | 'closed' | boolean\nexport type ModalTriggerVariant =\n | 'primary'\n | 'secondary'\n | 'tertiary'\n | 'signal'\nexport type ModalTriggerIconPosition = 'left' | 'right'\nexport type ModalContentMinWidth = string | number\nexport type ModalContentMaxWidth = string | number\n\nexport type TriggeredBy =\n | 'handler'\n | 'button'\n | 'overlay'\n | 'keyboard'\n | 'unmount'\nexport type CloseHandlerParams = {\n triggeredBy: TriggeredBy\n triggeredByEvent?: Event\n}\nexport type CloseHandler = (params?: CloseHandlerParams) => void\n\nexport interface ModalProps extends ModalRootProps {\n /**\n * The id used internal in the modal/drawer root element. Defaults to `root`, so the element id will be `dnb-modal-root`.\n */\n id?: string\n\n /**\n * Will disable the trigger button.\n */\n disabled?: boolean\n\n /**\n * Forces the modal/drawer to delay the opening. The delay is given in `ms`.\n */\n open_delay?: string | number\n\n /**\n * If set to `true` (boolean or string), then the user can&#39;t close the modal/drawer.\n */\n prevent_close?: boolean\n\n /**\n * Duration of animation open/close in ms. Defaults to 300ms.\n */\n animation_duration?: string | number\n\n /**\n * If set to `true`, no open/close animation will be shown. Defaults to false.\n */\n no_animation?: boolean\n\n /**\n * Use this prop to control the open/close state by setting either: `opened` / `closed` or `true` / `false`.\n */\n open_state?: ModalOpenState\n\n /**\n * The content which will appear when triggering the modal/drawer.\n */\n children?: ReactChildType\n\n /**\n * Omits default showing trigger button\n */\n omit_trigger_button?: boolean\n\n /**\n * This event gets triggered once the modal shows up. Returns the modal id: `{ id }`.\n */\n on_open?: ({ id }: { id?: string }) => void\n\n /**\n * This event gets triggered once the modal gets closed. Returns the modal id: `{ id, event, triggeredBy }`.\n */\n on_close?: ({\n id,\n event,\n triggeredBy,\n }: {\n id?: string\n event?: Event\n triggeredBy?: string\n }) => void\n\n /**\n * This event gets triggered once the user tries to close the modal, but `prevent_close` is set to \"true\". Returns a callback `close` you can call to trigger the close mechanism. More details below. Returns the modal id: `{ id, event, close: Method, triggeredBy }`\n */\n on_close_prevent?: ({\n id,\n event,\n triggeredBy,\n close,\n }: {\n id?: string\n event?: Event\n triggeredBy?: string\n close?: CloseHandler\n }) => void\n\n /**\n * Set a function to call the callback function, once the modal/drawer should open: `open_modal={(open) => open()}`\n */\n open_modal?: (\n open?: (e: Event) => void,\n instance?: any\n ) => () => void | void\n\n /**\n * Set a function to call the callback function, once the modal/drawer should close: `close_modal={(close) => close()}`\n */\n close_modal?: (close?: CloseHandler, instance?: any) => () => void | void\n\n /**\n * Provide a custom trigger component. Like trigger={<Anchor href=\"/\" />}. It will set the focus on it when the modal/drawer gets closed.\n */\n trigger?: ReactChildType\n\n /**\n * Send along custom HTML attributes or properties to the trigger button.\n */\n trigger_attributes?: TriggerAttributes\n\n /**\n * The content which will appear when triggering the modal/drawer.\n */\n modal_content?: ReactChildType\n\n /**\n * If true, the drawer will not open in a new DOM but directly in current DOM. Defaults to `false`.\n */\n direct_dom_return?: boolean\n\n /**\n * To get the inner content Element, pass in your own React ref\n */\n content_ref?: React.RefObject<HTMLElement>\n\n /**\n * To get the scroll Element, pass in your own React ref\n */\n scroll_ref?: React.RefObject<HTMLElement>\n}\n\nexport interface ModalContentProps {\n /**\n * The content which will appear when triggering the modal/drawer.\n */\n modal_content?: ReactChildType\n\n /**\n * The content which will appear in the bar, above the header, and side-by-side the close button.\n */\n bar_content?: ReactChildType\n\n /**\n * The content which will appear in the header of the modal/drawer the modal/drawer.\n */\n header_content?: ReactChildType\n hide?: boolean\n\n /**\n * The id used internal for the trigger button and modal component.\n */\n id?: string\n\n /**\n * The id used internal in the modal/drawer root element. Defaults to `root`, so the element id will be `dnb-modal-root`.\n */\n root_id?: string\n\n /**\n * The ID of the trigger component, describing the modal/drawer content. Defaults to the internal `trigger`, so make sure you define the trigger title.\n */\n labelled_by?: string\n\n /**\n * The Modal handles the first focus – automatically. How ever, you can defined a custom focus selector the will be used instead `focus_selector=\".css-selector\"`.\n */\n focus_selector?: string\n\n /**\n * Defines an unique identifier to a modal. Use it in case you have to refer in some way to the modal/drawer content wrapper.\n */\n content_id?: string\n\n /**\n * The modal/drawer title. Displays on the very top of the content.\n */\n title?: React.ReactNode\n\n /**\n * The aria label of the dialog when no labelled_by and no title is given. Defaults to `Vindu`.\n */\n dialog_title?: string\n\n /**\n * If boolean, the close button will not be shown.\n */\n hide_close_button?: boolean\n\n /**\n * Define any valid Eufemia Button property or HTML attribute inside an object.\n */\n close_button_attributes?: CloseButtonProps\n\n /**\n * If set to `false` then the modal/drawer content will be shown without any spacing. Defaults to `true`.\n */\n spacing?: boolean\n\n /**\n * By default the modal/drawer content gets added the core style class `dnb-core-style`. Use `false` to disable this behavior.\n */\n prevent_core_style?: boolean\n animation_duration?: string | number\n\n /**\n * Disable clicking the background overlay to close the modal\n */\n prevent_overlay_close?: boolean\n\n /**\n * If set to `true`, no open/close animation will be shown. Defaults to false.\n */\n no_animation?: boolean\n\n /**\n * Same as `no_animation`, but gets triggered only if the viewport width is less than `40em`. Defaults to false.\n */\n no_animation_on_mobile?: boolean\n\n /**\n * The minimum Modal content width, defined by a CSS width value like `50vw` (50% of the viewport). Be careful on using fixed `min_width` so you don&#39;t break responsiveness. Defaults to `30rem` (average width is set to `60vw`).\n */\n min_width?: ModalContentMinWidth\n\n /**\n * The maximum Modal content width, defined by a CSS width value like `20rem`. Defaults to `60rem` (average width is set to `60vw`).\n */\n max_width?: ModalContentMaxWidth\n\n /**\n * If set to `true` then the modal/drawer content will be shown as fullscreen, without showing the original content behind. Can be set to `false` to omit the auto fullscreen. Defaults to `auto`.\n */\n fullscreen?: ModalFullscreen\n\n /**\n * Define the inner horizontal alignment of the content. Can be set to `left`, `center`, `right` and `centered`. If `centered`, then the content will also be centered vertically. Defaults to `left`.\n */\n align_content?: 'right' | 'left' | 'centered' | 'center'\n\n /**\n * For `drawer` mode only. Defines the placement on what side the Drawer should be opened. Can be set to `left`, `right`, `top` and `bottom`. Defaults to `right`.\n */\n container_placement?: 'left' | 'right' | 'top' | 'bottom'\n\n /**\n * Define the vertical alignment of the container. Can be set to `top` or `center`. Defaults to `center`.\n */\n vertical_alignment?: 'top' | 'center'\n\n /**\n * Give the content wrapper a custom class name (maps to `dnb-modal__content`).\n */\n content_class?: string\n\n /**\n * @deprecated – use className instead. Will be removed in v11.\n */\n class?: string\n\n /**\n * Give the page overlay a custom class name (maps to `dnb-modal__overlay`).\n */\n overlay_class?: string\n\n /**\n * Define an array with HTML class selectors (`['.element-selector']`) which should not get invalidated when the modal opens/closes. Use this in order to let some parts of your site still be accessible by screen readers.\n */\n bypass_invalidation_selectors?: Array<string>\n\n /**\n * For internal usage\n * Will close the modal\n */\n close?: (...args: any[]) => any\n\n /**\n * Give the inner Dialog or Drawer component a className (only works with mode)\n */\n className?: string\n\n /**\n * The content which will appear when triggering the modal/drawer.\n */\n children?: ReactChildType\n\n /**\n * The displayed text for the 'close' button. Defaults to `Lukk`.\n */\n close_title?: string\n\n /**\n * Internal\n */\n dialog_role?: 'dialog' | 'alertdialog' | 'region'\n content_ref?: React.RefObject<HTMLElement>\n scroll_ref?: React.RefObject<HTMLElement>\n open_state?: ModalOpenState\n modalContentCloseRef?: React.MutableRefObject<any>\n}\n\nexport type TriggerAttributes = ButtonProps\n"],"mappings":""}