TP_JO2024/home/dist/component/modal/modal.module.js.map

1 line
29 KiB
Text
Raw Normal View History

2024-03-27 17:19:37 +01:00
{"version":3,"file":"modal.module.js","sources":["../../../.config/config.js","../../../src/core/api.js","../../../src/component/modal/script/modal/modal-selector.js","../../../src/component/modal/script/modal/modal-button.js","../../../src/component/modal/script/modal/modal-attribute.js","../../../src/component/modal/script/modal/modal.js","../../../src/component/modal/script/modal/focus-trap.js","../../../src/component/modal/script/modal/modals-group.js","../../../src/component/modal/script/modal/modal-body.js","../../../src/component/modal/index.js","../../../src/component/modal/main.js"],"sourcesContent":["const config = {\r\n prefix: 'fr',\r\n namespace: 'dsfr',\r\n organisation: '@gouvfr',\r\n version: '1.11.2'\r\n};\r\n\r\nexport default config;\r\n","import config from './config.js';\nconst api = window[config.namespace];\nexport default api;\n","import api from '../../api.js';\n\nexport const ModalSelector = {\n MODAL: api.internals.ns.selector('modal'),\n SCROLL_DIVIDER: api.internals.ns.selector('scroll-divider'),\n BODY: api.internals.ns.selector('modal__body'),\n TITLE: api.internals.ns.selector('modal__title')\n};\n","import api from '../../api.js';\n\nclass ModalButton extends api.core.DisclosureButton {\n constructor () {\n super(api.core.DisclosureType.OPENED);\n }\n\n static get instanceClassName () {\n return 'ModalButton';\n }\n}\n\nexport { ModalButton };\n","import api from '../../api';\n\nexport const ModalAttribute = {\n CONCEALING_BACKDROP: api.internals.ns.attr('concealing-backdrop')\n};\n","import api from '../../api.js';\nimport { ModalSelector } from './modal-selector.js';\nimport { ModalButton } from './modal-button.js';\nimport { ModalAttribute } from './modal-attribute';\n\nclass Modal extends api.core.Disclosure {\n constructor () {\n super(api.core.DisclosureType.OPENED, ModalSelector.MODAL, ModalButton, 'ModalsGroup');\n this._isActive = false;\n this.scrolling = this.resize.bind(this, false);\n this.resizing = this.resize.bind(this, true);\n }\n\n static get instanceClassName () {\n return 'Modal';\n }\n\n init () {\n super.init();\n this._isDialog = this.node.tagName === 'DIALOG';\n this.isScrolling = false;\n this.listenClick();\n this.addEmission(api.core.RootEmission.KEYDOWN, this._keydown.bind(this));\n }\n\n _keydown (keyCode) {\n switch (keyCode) {\n case api.core.KeyCodes.ESCAPE:\n this._escape();\n break;\n }\n }\n\n // TODO v2 : passer les tagName d'action en constante\n _escape () {\n const tagName = document.activeElement ? document.activeElement.tagName : undefined;\n\n switch (tagName) {\n case 'INPUT':\n case 'LABEL':\n case 'TEXTAREA':\n case 'SELECT':\n case 'AUDIO':\n case 'VIDEO':\n break;\n\n default:\n if (this.isDisclosed) {\n this.conceal();\n this.focus();\n }\n }\n }\n\n retrieved () {\n this._ensureAccessibleName();\n }\n\n get body () {\n return this.element.getDescendantInstances('ModalBody', 'Modal')[0];\n }\n\n handleClick (e) {\n if (e.target === this.node && this.getAttribute(ModalAttribute.CONCEALING_BACKDROP) !== 'false') this.conceal();\n }\n\n disclose (withhold) {\n if (!super.disclose(withhold)) return false;\n if (this.body) this.body.activate();\n this.isScrollLocked = true;\n this.setAttribute('aria-modal', 'true');\n this.setAttribute('open', 'true');\n if (!this._isDialog) {\n this.activateModal();\n }\n return true;\n }\n\n conceal (withhold, preventFocus) {\n if (!super.conceal(withhold, preventFocus)) return false;\n this.isScrollLocked = false;\n this.removeAttribute('aria-modal');\n this.removeAttribute('open');\n if (this.body) this.body.deactivate();\n if (!this._isDialog) {\n this.deactivateModal();\n }\n return true;\n }\n\n get isDialog () {\n return this._isDialog;\n }\n\n set isDialog (value) {\n this._isDialog = value;\n }\n\n activateModal () {\n if (this._isActive) return;\