@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":"ModalRoot.js","names":["_react","_interopRequireDefault","require","_reactDom","_componentHelper","_ModalContent","_excluded","obj","__esModule","default","_objectWithoutProperties","source","excluded","target","_objectWithoutPropertiesLoose","key","i","Object","getOwnPropertySymbols","sourceSymbolKeys","length","indexOf","prototype","propertyIsEnumerable","call","sourceKeys","keys","_defineProperty","value","_toPropertyKey","defineProperty","enumerable","configurable","writable","arg","_toPrimitive","String","input","hint","prim","Symbol","toPrimitive","undefined","res","TypeError","Number","ModalRoot","React","PureComponent","constructor","arguments","isMounted","insertModalRoot","id","window","__modalRoot","document","getElementById","createElement","setAttribute","body","insertBefore","firstChild","e","warn","componentDidMount","direct_dom_return","root_id","props","isTrue","portalElem","className","appendChild","setState","componentWillUnmount","removeChild","render","_this$props","children","state","ReactDOM","createPortal","exports"],"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,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,SAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,gBAAA,GAAAF,OAAA;AACA,IAAAG,aAAA,GAAAJ,sBAAA,CAAAC,OAAA;AAAyC,MAAAI,SAAA;AAAA,SAAAL,uBAAAM,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAAA,SAAAG,yBAAAC,MAAA,EAAAC,QAAA,QAAAD,MAAA,yBAAAE,MAAA,GAAAC,6BAAA,CAAAH,MAAA,EAAAC,QAAA,OAAAG,GAAA,EAAAC,CAAA,MAAAC,MAAA,CAAAC,qBAAA,QAAAC,gBAAA,GAAAF,MAAA,CAAAC,qBAAA,CAAAP,MAAA,Q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A,IACE,IAAI,CAACR,UAAU,IACf,OAAOhB,MAAM,KAAK,WAAW,IAC7BA,MAAM,CAACC,WAAW,IAClB,IAAI,CAACwB,KAAK,CAAC5B,SAAS,EACpB;MACA,OAAO6B,iBAAQ,CAACC,YAAY,CAC1BjF,MAAA,CAAAS,OAAA,CAAAiD,aAAA,CAACrD,aAAA,CAAAI,OAAY,EAAK2D,KAAK,EAAGU,QAAuB,CAAC,EAClD,IAAI,CAACR,UACP,CAAC;IACH;IAEA,OAAO,IAAI;EACb;AACF;AAACY,OAAA,CAAAzE,OAAA,GAAAqC,SAAA;AAAAnB,eAAA,CApGoBmB,SAAS,kBAKN;EACpBO,EAAE,EAAE,IAAI;EACRc,OAAO,EAAE,MAAM;EACfD,iBAAiB,EAAE,KAAK;EACxBY,QAAQ,EAAE;AACZ,CAAC"}
1
+ {"version":3,"file":"ModalRoot.js","names":["_react","_interopRequireDefault","require","_reactDom","_componentHelper","_ModalContent","_excluded","obj","__esModule","default","_objectWithoutProperties","source","excluded","target","_objectWithoutPropertiesLoose","key","i","Object","getOwnPropertySymbols","sourceSymbolKeys","length","indexOf","prototype","propertyIsEnumerable","call","sourceKeys","keys","_defineProperty","value","_toPropertyKey","defineProperty","enumerable","configurable","writable","arg","_toPrimitive","String","input","hint","prim","Symbol","toPrimitive","undefined","res","TypeError","Number","ModalRoot","React","PureComponent","constructor","arguments","isMounted","insertModalRoot","id","window","__modalRoot","document","getElementById","createElement","setAttribute","body","insertBefore","firstChild","e","warn","componentDidMount","direct_dom_return","root_id","props","isTrue","portalElem","className","appendChild","setState","componentWillUnmount","removeChild","render","_this$props","children","state","ReactDOM","createPortal","exports"],"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,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,SAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,gBAAA,GAAAF,OAAA;AACA,IAAAG,aAAA,GAAAJ,sBAAA,CAAAC,OAAA;AAAyC,MAAAI,SAAA;AAAA,SAAAL,uBAAAM,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAAA,SAAAG,yBAAAC,MAAA,EAAAC,QAAA,QAAAD,MAAA,yBAAAE,MAAA,GAAAC,6BAAA,CAAAH,MAAA,EAAAC,QAAA,OAAAG,GAAA,EAAAC,CAAA,MAAAC,MAAA,CAAAC,qBAAA,QAAAC,gBAAA,GAAAF,MAAA,CAAAC,qBAAA,CAAAP,MAAA,QAAAK,CAAA,MAAAA,CAAA,GAAAG,gBAAA,CAAAC,MAAA,EAAAJ,CAAA,MAAAD,GAAA,GAAAI,gBAAA,CAAAH,CAAA,OAAAJ,QAAA,CAAAS,OAAA,CAAAN,GAAA,uBAAAE,MAAA,CAAAK,SAAA,CAAAC,oBAAA,CAAAC,IAAA,CAAAb,MAAA,EAAAI,GAAA,aAAAF,MAAA,CAAAE,GAAA,IAAAJ,MAAA,CAAAI,GAAA,cAAAF,MAAA;AAAA,SAAAC,8BAAAH,MAAA,EAAAC,QAAA,QAAAD,MAAA,yBAAAE,MAAA,WAAAY,UAAA,GAAAR,MAAA,CAAAS,IAAA,CAAAf,MAAA,OAAAI,GAAA,EAAAC,CAAA,OAAAA,CAAA,MAAAA,CAAA,GAAAS,UAAA,CAAAL,MAAA,EAAAJ,CAAA,MAAAD,GAAA,GAA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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":""}
@@ -22,6 +22,10 @@
22
22
  color: inherit;
23
23
 
24
24
  border-radius: 0.1875em;
25
+
26
+ & .dnb-anchor {
27
+ font-size: inherit;
28
+ }
25
29
  }
26
30
 
27
31
  @mixin preStyle() {
@@ -122,7 +122,7 @@ export interface ContextState {
122
122
  existingFieldsRef?: React.MutableRefObject<Map<Path, boolean>>;
123
123
  formElementRef?: React.MutableRefObject<HTMLFormElement>;
124
124
  fieldErrorRef?: React.MutableRefObject<Record<Path, Error>>;
125
- showAllErrors: boolean;
125
+ showAllErrors: boolean | number;
126
126
  hasVisibleError: boolean;
127
127
  formState: SubmitState;
128
128
  ajvInstance: Ajv;
@@ -1 +1 @@
1
- {"version":3,"file":"Context.js","names":["_react","_interopRequireDefault","require","_utils","obj","__esModule","default","defaultContextState","hasContext","data","undefined","schema","submitState","handlePathChange","handlePathChangeUnvalidated","updateDataValue","setData","validateData","handleSubmit","scrollToTop","showAllErrors","hasVisibleError","formState","setFormState","setSubmitState","handleSubmitCall","setShowAllErrors","setMountedFieldState","hasErrors","hasFieldState","hasFieldError","ajvInstance","makeAjvInstance","contextErrorMessages","props","exports","Context","React","createContext","_default"],"sources":["../../../../../src/extensions/forms/DataContext/Context.ts"],"sourcesContent":["import React from 'react'\nimport { Ajv, FormError, JsonObject, makeAjvInstance } from '../utils'\nimport {\n AllJSONSchemaVersions,\n GlobalErrorMessagesWithPaths,\n SubmitState,\n Path,\n EventStateObject,\n EventReturnWithStateObject,\n FieldProps,\n ValueProps,\n OnChange,\n OnSubmitParams,\n} from '../types'\nimport { Props as ProviderProps } from './Provider'\nimport { SnapshotName } from '../Form/Snapshot'\nimport { SharedStateId } from '../../../shared/helpers/useSharedState'\n\nexport type MountState = {\n isPreMounted?: boolean\n isMounted?: boolean\n isVisible?: boolean\n isFocused?: boolean\n wasStepChange?: boolean\n}\n\nexport type EventListenerCall = {\n path?: Path\n type?: 'onSubmit' | 'onPathChange' | 'onMount'\n callback: (params?: { value: unknown }) => void | Promise<void | Error>\n}\n\nexport type VisibleDataHandler<Data> = (\n data?: Data,\n options?: VisibleDataOptions\n) => Partial<Data>\nexport type VisibleDataOptions = {\n keepPaths?: Array<Path>\n removePaths?: Array<Path>\n}\nexport type MutateDataHandler<Data> = (\n data: Data,\n mutate: TransformData\n) => Partial<Data>\nexport type FilterDataHandler<Data> = (\n data: Data,\n filter: FilterData\n) => Partial<Data>\nexport type FilterDataHandlerCallback<R> = (\n parameters: FilterDataHandlerParameters\n) => R\nexport type FilterDataHandlerParameters =\n FilterDataPathConditionParameters & {\n path: Path\n }\nexport type FilterDataPathCondition<Data = unknown> = (\n parameters: FilterDataPathConditionParameters<Data>\n) => boolean | undefined\nexport type FilterDataPathConditionParameters<Data = unknown> = {\n value: unknown\n displayValue: undefined | React.ReactNode | Array<React.ReactNode>\n label: React.ReactNode\n props: FieldProps\n data: Data\n internal: {\n error: Error | undefined\n }\n}\nexport type FilterDataPathObject<Data> = Record<\n Path,\n FilterDataPathCondition<Data> | boolean | undefined\n>\nexport type FilterData<Data = unknown> =\n | FilterDataPathObject<Data>\n | FilterDataHandlerCallback<boolean | undefined>\nexport type VisibleData<Data = unknown> = Partial<Data>\nexport type TransformData = FilterDataHandlerCallback<unknown>\nexport type HandleSubmitCallback = ({\n preventSubmit,\n}: {\n preventSubmit: () => void\n}) => void\nexport type FieldConnections = {\n setEventResult?: (status: EventStateObject) => void\n}\nexport type FieldInternalsRefProps =\n | (FieldProps & { children: unknown })\n | undefined\nexport type FieldInternalsRef = Record<\n Path,\n {\n props: FieldInternalsRefProps\n id: string | undefined\n }\n>\nexport type ValueInternalsRef = Record<\n Path,\n { props: ValueProps | undefined }\n>\n\nexport interface ContextState {\n id?: SharedStateId\n hasContext: boolean\n /** The dataset for the form / form wizard */\n data: any\n internalDataRef?: React.MutableRefObject<any>\n /** Should the form validate data before submitting? */\n errors?: Record<Path, Error>\n /** Will set autoComplete=\"on\" on each nested Field.String and Field.Number */\n autoComplete?: boolean\n handlePathChange: (\n path: Path,\n value?: any\n ) =>\n | EventReturnWithStateObject\n | unknown\n | Promise<EventReturnWithStateObject | unknown>\n handlePathChangeUnvalidated: (path: Path, value: any) => void\n updateDataValue: (\n path: Path,\n value: any,\n options?: { preventUpdate?: boolean }\n ) => void\n setData: (data: any) => void\n clearData?: () => void\n mutateDataHandler?: MutateDataHandler<unknown>\n filterDataHandler?: FilterDataHandler<unknown>\n visibleDataHandler?: VisibleDataHandler<unknown>\n validateData: () => void\n handleSubmit: () => Promise<EventStateObject | undefined>\n scrollToTop: () => void\n setShowAllErrors: (showAllErrors: boolean) => void\n hasErrors: () => boolean\n hasFieldState: (state: SubmitState) => boolean\n hasFieldError: (path: Path) => boolean\n setFieldState?: (path: Path, fieldState: SubmitState) => void\n setFieldError?: (path: Path, error: Error | FormError) => void\n setMountedFieldState: (path: Path, options: MountState) => void\n setFormState?: (\n state: SubmitState,\n options?: { keepPending?: boolean }\n ) => void\n setSubmitState?: (state: EventStateObject) => void\n addOnChangeHandler?: (callback: OnChange) => void\n handleSubmitCall: ({\n onSubmit,\n enableAsyncBehavior,\n skipFieldValidation,\n skipErrorCheck,\n }: {\n onSubmit: () =>\n | EventReturnWithStateObject\n | void\n | Promise<EventReturnWithStateObject | void>\n enableAsyncBehavior: boolean\n skipFieldValidation?: boolean\n skipErrorCheck?: boolean\n }) => Promise<EventStateObject | undefined>\n getSubmitData?: () => unknown\n getSubmitParams?: () => OnSubmitParams\n setFieldEventListener?: (\n path: EventListenerCall['path'],\n type: EventListenerCall['type'],\n callback: EventListenerCall['callback']\n ) => void\n setVisibleError?: (path: Path, hasError: boolean) => void\n setFieldInternals?: (path: Path, props: unknown, id?: string) => void\n setValueInternals?: (path: Path, props: unknown) => void\n setHandleSubmit?: (\n callback: HandleSubmitCallback,\n params?: { remove?: boolean }\n ) => void\n setFieldConnection?: (path: Path, connections: FieldConnections) => void\n isEmptyDataRef?: React.MutableRefObject<boolean>\n addSetShowAllErrorsRef?: React.MutableRefObject<\n Array<(showAllErrors: boolean) => void>\n >\n fieldDisplayValueRef?: React.MutableRefObject<\n Record<Path, React.ReactNode>\n >\n fieldInternalsRef?: React.MutableRefObject<FieldInternalsRef>\n valueInternalsRef?: React.MutableRefObject<ValueInternalsRef>\n fieldConnectionsRef?: React.RefObject<Record<Path, FieldConnections>>\n mountedFieldsRef?: React.MutableRefObject<Record<Path, MountState>>\n snapshotsRef?: React.MutableRefObject<\n Map<SnapshotName, Map<Path, unknown>>\n >\n existingFieldsRef?: React.MutableRefObject<Map<Path, boolean>>\n formElementRef?: React.MutableRefObject<HTMLFormElement>\n fieldErrorRef?: React.MutableRefObject<Record<Path, Error>>\n showAllErrors: boolean\n hasVisibleError: boolean\n formState: SubmitState\n ajvInstance: Ajv\n contextErrorMessages: GlobalErrorMessagesWithPaths\n schema: AllJSONSchemaVersions\n path?: Path\n disabled?: boolean\n required?: boolean\n submitState: Partial<EventStateObject>\n prerenderFieldProps?: boolean\n decoupleForm?: boolean\n hasElementRef?: React.MutableRefObject<boolean>\n restHandlerProps?: Record<string, unknown>\n props: ProviderProps<JsonObject>\n}\n\nexport const defaultContextState: ContextState = {\n hasContext: false,\n data: undefined,\n schema: undefined,\n submitState: undefined,\n handlePathChange: () => null,\n handlePathChangeUnvalidated: () => null,\n updateDataValue: () => null,\n setData: () => null,\n validateData: () => null,\n handleSubmit: () => null,\n scrollToTop: () => null,\n showAllErrors: false,\n hasVisibleError: false,\n formState: undefined,\n setFormState: () => null,\n setSubmitState: () => null,\n handleSubmitCall: () => null,\n setShowAllErrors: () => null,\n setMountedFieldState: () => null,\n hasErrors: () => false,\n hasFieldState: () => false,\n hasFieldError: () => false,\n ajvInstance: makeAjvInstance(),\n contextErrorMessages: undefined,\n props: null,\n}\n\nconst Context = React.createContext<ContextState>(defaultContextState)\n\nexport default Context\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAAsE,SAAAD,uBAAAG,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AA8M/D,MAAMG,mBAAiC,GAAG;EAC/CC,UAAU,EAAE,KAAK;EACjBC,IAAI,EAAEC,SAAS;EACfC,MAAM,EAAED,SAAS;EACjBE,WAAW,EAAEF,SAAS;EACtBG,gBAAgB,EAAEA,CAAA,KAAM,IAAI;EAC5BC,2BAA2B,EAAEA,CAAA,KAAM,IAAI;EACvCC,eAAe,EAAEA,CAAA,KAAM,IAAI;EAC3BC,OAAO,EAAEA,CAAA,KAAM,IAAI;EACnBC,YAAY,EAAEA,CAAA,KAAM,IAAI;EACxBC,YAAY,EAAEA,CAAA,KAAM,IAAI;EACxBC,WAAW,EAAEA,CAAA,KAAM,IAAI;EACvBC,aAAa,EAAE,KAAK;EACpBC,eAAe,EAAE,KAAK;EACtBC,SAAS,EAAEZ,SAAS;EACpBa,YAAY,EAAEA,CAAA,KAAM,IAAI;EACxBC,cAAc,EAAEA,CAAA,KAAM,IAAI;EAC1BC,gBAAgB,EAAEA,CAAA,KAAM,IAAI;EAC5BC,gBAAgB,EAAEA,CAAA,KAAM,IAAI;EAC5BC,oBAAoB,EAAEA,CAAA,KAAM,IAAI;EAChCC,SAAS,EAAEA,CAAA,KAAM,KAAK;EACtBC,aAAa,EAAEA,CAAA,KAAM,KAAK;EAC1BC,aAAa,EAAEA,CAAA,KAAM,KAAK;EAC1BC,WAAW,EAAE,IAAAC,sBAAe,EAAC,CAAC;EAC9BC,oBAAoB,EAAEvB,SAAS;EAC/BwB,KAAK,EAAE;AACT,CAAC;AAAAC,OAAA,CAAA5B,mBAAA,GAAAA,mBAAA;AAED,MAAM6B,OAAO,GAAGC,cAAK,CAACC,aAAa,CAAe/B,mBAAmB,CAAC;AAAA,IAAAgC,QAAA,GAEvDH,OAAO;AAAAD,OAAA,CAAA7B,OAAA,GAAAiC,QAAA"}
1
+ {"version":3,"file":"Context.js","names":["_react","_interopRequireDefault","require","_utils","obj","__esModule","default","defaultContextState","hasContext","data","undefined","schema","submitState","handlePathChange","handlePathChangeUnvalidated","updateDataValue","setData","validateData","handleSubmit","scrollToTop","showAllErrors","hasVisibleError","formState","setFormState","setSubmitState","handleSubmitCall","setShowAllErrors","setMountedFieldState","hasErrors","hasFieldState","hasFieldError","ajvInstance","makeAjvInstance","contextErrorMessages","props","exports","Context","React","createContext","_default"],"sources":["../../../../../src/extensions/forms/DataContext/Context.ts"],"sourcesContent":["import React from 'react'\nimport { Ajv, FormError, JsonObject, makeAjvInstance } from '../utils'\nimport {\n AllJSONSchemaVersions,\n GlobalErrorMessagesWithPaths,\n SubmitState,\n Path,\n EventStateObject,\n EventReturnWithStateObject,\n FieldProps,\n ValueProps,\n OnChange,\n OnSubmitParams,\n} from '../types'\nimport { Props as ProviderProps } from './Provider'\nimport { SnapshotName } from '../Form/Snapshot'\nimport { SharedStateId } from '../../../shared/helpers/useSharedState'\n\nexport type MountState = {\n isPreMounted?: boolean\n isMounted?: boolean\n isVisible?: boolean\n isFocused?: boolean\n wasStepChange?: boolean\n}\n\nexport type EventListenerCall = {\n path?: Path\n type?: 'onSubmit' | 'onPathChange' | 'onMount'\n callback: (params?: { value: unknown }) => void | Promise<void | Error>\n}\n\nexport type VisibleDataHandler<Data> = (\n data?: Data,\n options?: VisibleDataOptions\n) => Partial<Data>\nexport type VisibleDataOptions = {\n keepPaths?: Array<Path>\n removePaths?: Array<Path>\n}\nexport type MutateDataHandler<Data> = (\n data: Data,\n mutate: TransformData\n) => Partial<Data>\nexport type FilterDataHandler<Data> = (\n data: Data,\n filter: FilterData\n) => Partial<Data>\nexport type FilterDataHandlerCallback<R> = (\n parameters: FilterDataHandlerParameters\n) => R\nexport type FilterDataHandlerParameters =\n FilterDataPathConditionParameters & {\n path: Path\n }\nexport type FilterDataPathCondition<Data = unknown> = (\n parameters: FilterDataPathConditionParameters<Data>\n) => boolean | undefined\nexport type FilterDataPathConditionParameters<Data = unknown> = {\n value: unknown\n displayValue: undefined | React.ReactNode | Array<React.ReactNode>\n label: React.ReactNode\n props: FieldProps\n data: Data\n internal: {\n error: Error | undefined\n }\n}\nexport type FilterDataPathObject<Data> = Record<\n Path,\n FilterDataPathCondition<Data> | boolean | undefined\n>\nexport type FilterData<Data = unknown> =\n | FilterDataPathObject<Data>\n | FilterDataHandlerCallback<boolean | undefined>\nexport type VisibleData<Data = unknown> = Partial<Data>\nexport type TransformData = FilterDataHandlerCallback<unknown>\nexport type HandleSubmitCallback = ({\n preventSubmit,\n}: {\n preventSubmit: () => void\n}) => void\nexport type FieldConnections = {\n setEventResult?: (status: EventStateObject) => void\n}\nexport type FieldInternalsRefProps =\n | (FieldProps & { children: unknown })\n | undefined\nexport type FieldInternalsRef = Record<\n Path,\n {\n props: FieldInternalsRefProps\n id: string | undefined\n }\n>\nexport type ValueInternalsRef = Record<\n Path,\n { props: ValueProps | undefined }\n>\n\nexport interface ContextState {\n id?: SharedStateId\n hasContext: boolean\n /** The dataset for the form / form wizard */\n data: any\n internalDataRef?: React.MutableRefObject<any>\n /** Should the form validate data before submitting? */\n errors?: Record<Path, Error>\n /** Will set autoComplete=\"on\" on each nested Field.String and Field.Number */\n autoComplete?: boolean\n handlePathChange: (\n path: Path,\n value?: any\n ) =>\n | EventReturnWithStateObject\n | unknown\n | Promise<EventReturnWithStateObject | unknown>\n handlePathChangeUnvalidated: (path: Path, value: any) => void\n updateDataValue: (\n path: Path,\n value: any,\n options?: { preventUpdate?: boolean }\n ) => void\n setData: (data: any) => void\n clearData?: () => void\n mutateDataHandler?: MutateDataHandler<unknown>\n filterDataHandler?: FilterDataHandler<unknown>\n visibleDataHandler?: VisibleDataHandler<unknown>\n validateData: () => void\n handleSubmit: () => Promise<EventStateObject | undefined>\n scrollToTop: () => void\n setShowAllErrors: (showAllErrors: boolean) => void\n hasErrors: () => boolean\n hasFieldState: (state: SubmitState) => boolean\n hasFieldError: (path: Path) => boolean\n setFieldState?: (path: Path, fieldState: SubmitState) => void\n setFieldError?: (path: Path, error: Error | FormError) => void\n setMountedFieldState: (path: Path, options: MountState) => void\n setFormState?: (\n state: SubmitState,\n options?: { keepPending?: boolean }\n ) => void\n setSubmitState?: (state: EventStateObject) => void\n addOnChangeHandler?: (callback: OnChange) => void\n handleSubmitCall: ({\n onSubmit,\n enableAsyncBehavior,\n skipFieldValidation,\n skipErrorCheck,\n }: {\n onSubmit: () =>\n | EventReturnWithStateObject\n | void\n | Promise<EventReturnWithStateObject | void>\n enableAsyncBehavior: boolean\n skipFieldValidation?: boolean\n skipErrorCheck?: boolean\n }) => Promise<EventStateObject | undefined>\n getSubmitData?: () => unknown\n getSubmitParams?: () => OnSubmitParams\n setFieldEventListener?: (\n path: EventListenerCall['path'],\n type: EventListenerCall['type'],\n callback: EventListenerCall['callback']\n ) => void\n setVisibleError?: (path: Path, hasError: boolean) => void\n setFieldInternals?: (path: Path, props: unknown, id?: string) => void\n setValueInternals?: (path: Path, props: unknown) => void\n setHandleSubmit?: (\n callback: HandleSubmitCallback,\n params?: { remove?: boolean }\n ) => void\n setFieldConnection?: (path: Path, connections: FieldConnections) => void\n isEmptyDataRef?: React.MutableRefObject<boolean>\n addSetShowAllErrorsRef?: React.MutableRefObject<\n Array<(showAllErrors: boolean) => void>\n >\n fieldDisplayValueRef?: React.MutableRefObject<\n Record<Path, React.ReactNode>\n >\n fieldInternalsRef?: React.MutableRefObject<FieldInternalsRef>\n valueInternalsRef?: React.MutableRefObject<ValueInternalsRef>\n fieldConnectionsRef?: React.RefObject<Record<Path, FieldConnections>>\n mountedFieldsRef?: React.MutableRefObject<Record<Path, MountState>>\n snapshotsRef?: React.MutableRefObject<\n Map<SnapshotName, Map<Path, unknown>>\n >\n existingFieldsRef?: React.MutableRefObject<Map<Path, boolean>>\n formElementRef?: React.MutableRefObject<HTMLFormElement>\n fieldErrorRef?: React.MutableRefObject<Record<Path, Error>>\n showAllErrors: boolean | number\n hasVisibleError: boolean\n formState: SubmitState\n ajvInstance: Ajv\n contextErrorMessages: GlobalErrorMessagesWithPaths\n schema: AllJSONSchemaVersions\n path?: Path\n disabled?: boolean\n required?: boolean\n submitState: Partial<EventStateObject>\n prerenderFieldProps?: boolean\n decoupleForm?: boolean\n hasElementRef?: React.MutableRefObject<boolean>\n restHandlerProps?: Record<string, unknown>\n props: ProviderProps<JsonObject>\n}\n\nexport const defaultContextState: ContextState = {\n hasContext: false,\n data: undefined,\n schema: undefined,\n submitState: undefined,\n handlePathChange: () => null,\n handlePathChangeUnvalidated: () => null,\n updateDataValue: () => null,\n setData: () => null,\n validateData: () => null,\n handleSubmit: () => null,\n scrollToTop: () => null,\n showAllErrors: false,\n hasVisibleError: false,\n formState: undefined,\n setFormState: () => null,\n setSubmitState: () => null,\n handleSubmitCall: () => null,\n setShowAllErrors: () => null,\n setMountedFieldState: () => null,\n hasErrors: () => false,\n hasFieldState: () => false,\n hasFieldError: () => false,\n ajvInstance: makeAjvInstance(),\n contextErrorMessages: undefined,\n props: null,\n}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AAGC,cAAK,CAACC,aAAa,CAAe/B,mBAAmB,CAAC;AAAA,IAAAgC,QAAA,GAEvDH,OAAO;AAAAD,OAAA,CAAA7B,OAAA,GAAAiC,QAAA"}
@@ -87,7 +87,7 @@ function Provider(props) {
87
87
  const addSetShowAllErrorsRef = (0, _react.useRef)([]);
88
88
  const showAllErrorsRef = (0, _react.useRef)(false);
89
89
  const setShowAllErrors = (0, _react.useCallback)(showAllErrors => {
90
- showAllErrorsRef.current = showAllErrors;
90
+ showAllErrorsRef.current = showAllErrors ? Date.now() : showAllErrors;
91
91
  forceUpdate();
92
92
  addSetShowAllErrorsRef.current.forEach(fn => fn === null || fn === void 0 ? void 0 : fn(showAllErrors));
93
93
  }, []);
@@ -868,7 +868,7 @@ function Provider(props) {
868
868
  globalStatus: {
869
869
  id: globalStatusId,
870
870
  title: translation.errorSummaryTitle,
871
- show: showAllErrorsRef.current
871
+ show: Boolean(showAllErrorsRef.current)
872
872
  }
873
873
  } : undefined,
874
874
  formElement: disabled ? {