3 lines
3.2 KiB
JavaScript
3 lines
3.2 KiB
JavaScript
/*! DSFR v1.11.2 | SPDX-License-Identifier: MIT | License-Filename: LICENSE.md | restricted use (see terms and conditions) */
|
|
!function(){"use strict";var e=window.dsfr,t={HEADER:e.internals.ns.selector("header"),TOOLS_LINKS:e.internals.ns.selector("header__tools-links"),MENU_LINKS:e.internals.ns.selector("header__menu-links"),BUTTONS:e.internals.ns.selector("header__tools-links")+" "+e.internals.ns.selector("btns-group")+", "+e.internals.ns.selector("header__tools-links")+" "+e.internals.ns.selector("links-group"),MODALS:""+e.internals.ns.selector("header__search")+e.internals.ns.selector("modal")+", "+e.internals.ns.selector("header__menu")+e.internals.ns.selector("modal")},n=function(n){function r(){n.apply(this,arguments)}n&&(r.__proto__=n),r.prototype=Object.create(n&&n.prototype),r.prototype.constructor=r;var a={instanceClassName:{configurable:!0}};return a.instanceClassName.get=function(){return"HeaderLinks"},r.prototype.init=function(){var n=this.queryParentSelector(t.HEADER);this.toolsLinks=n.querySelector(t.TOOLS_LINKS),this.menuLinks=n.querySelector(t.MENU_LINKS);var r="-mobile",a=this.toolsLinks.innerHTML.replace(/ +/g," "),s=this.menuLinks.innerHTML.replace(/ +/g," "),o=a.match(/id="(.*?)"/gm)||[];o=o.map((function(e){return e.replace('id="',"").replace('"',"")}));var i=a.match(/aria-controls="(.*?)"/gm),c=a.replace(/id="(.*?)"/gm,'id="$1'+r+'"');if(i)for(var l=0,d=i;l<d.length;l+=1){var p=d[l].replace('aria-controls="',"").replace('"',"");o.includes(p)&&(c=c.replace('aria-controls="'+p+'"','aria-controls="'+(p+r)+'"'))}if(c!==s)switch(e.mode){case e.Modes.ANGULAR:case e.Modes.REACT:case e.Modes.VUE:this.warn("header__tools-links content is different from header__menu-links content.\nAs you're using a dynamic framework, you should handle duplication of this content yourself, please refer to documentation:\n"+e.header.doc);break;default:this.menuLinks.innerHTML=c}},Object.defineProperties(r,a),r}(e.core.Instance),r=function(t){function n(){t.apply(this,arguments)}t&&(n.__proto__=t),n.prototype=Object.create(t&&t.prototype),n.prototype.constructor=n;var r={instanceClassName:{configurable:!0}};return r.instanceClassName.get=function(){return"HeaderModal"},n.prototype.init=function(){this.isResizing=!0},n.prototype.resize=function(){this.isBreakpoint(e.core.Breakpoints.LG)?this.deactivateModal():this.activateModal()},n.prototype.activateModal=function(){var e=this.element.getInstance("Modal");e&&(e.isEnabled=!0,this.listenClick({capture:!0}))},n.prototype.deactivateModal=function(){var e=this.element.getInstance("Modal");e&&(e.conceal(),e.isEnabled=!1,this.unlistenClick({capture:!0}))},n.prototype.handleClick=function(t){!t.target.matches("a, button")||t.target.matches("[aria-controls]")||t.target.matches(e.core.DisclosureSelector.PREVENT_CONCEAL)||this.element.getInstance("Modal").conceal()},Object.defineProperties(n,r),n}(e.core.Instance);e.header={HeaderLinks:n,HeaderModal:r,HeaderSelector:t,doc:"https://www.systeme-de-design.gouv.fr/elements-d-interface/composants/en-tete"},e.internals.register(e.header.HeaderSelector.TOOLS_LINKS,e.header.HeaderLinks),e.internals.register(e.header.HeaderSelector.MODALS,e.header.HeaderModal)}();
|
|
//# sourceMappingURL=header.nomodule.min.js.map
|