UNPKG

@engie-group/fluid-design-system

Version:

The Fluid Design System is ENGIE’s open-source library to create, build and deliver ENGIE digital services in a more efficient way.

2 lines (1 loc) 2.81 kB
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const e=window.NJ&&window.NJ.config||null,t={".nj-alert":"Alert",".nj-checkbox":"Checkbox",".nj-collapse":"Collapse",".nj-dropdown":"Dropdown",".nj-fab-menu":"Fab",".nj-form-autocomplete":"Form",".nj-form-input-password":"Form",".nj-search":"Search","input:not([type=hidden]):not([type=checkbox]):not([type=radio]):not([type=file]):not([type=button]):not([type=submit]):not([type=reset]).nj-form-control":"Form","textarea.nj-form-control":"Form",".nj-header":"Header",".nj-modal":"Modal",".nj-navbar":"Navbar",".nj-radio > label > input[type=radio]":"Radio","select.nj-form-control":"Select",".nj-form-item.nj-form-item--select.nj-form-item--custom-list":"SelectInput",".nj-sidebar":"Sidebar",".nj-slider":"Slider",".nj-tab":"Tab",".nj-tag":"Tag",".nj-accordion":"Accordion"},o=Object.values(t),n=Object.keys(t),r=n.toString(),s=(()=>{if("undefined"!=typeof window){function t(e=null){if(window.NJ)e?window.NJ[e].init():window.NJ.AutoInit();else if(e)window[e].init();else{const e=o.length;let t=0;for(;t<e;t++)window[o[t]]&&window[o[t]].init()}}function s(e){const t=[];for(const o of e){o&&o.key&&t.push(o)}return!!t.length&&t}function i(e,t){const r={};if("childList"===e[t].type&&e[t].addedNodes.length)for(let i=0;i<e[t].addedNodes.length;i++){const l=e[t].addedNodes[i];if(l){const e=[],t=(t,o)=>{l.classList&&l.classList.contains(t.substring(1))?e[o]=l:l.querySelector&&l.querySelector(`${t}`)&&(e[o]=l.querySelector(`${t}`))};n.forEach(t);let i=-1;switch(l.tagName){case"INPUT":i=8;break;case"SELECT":i=14;break;case"CHECKBOX":i=9}if(-1!==i&&(e[i]=l),e.length>0){const t=s(e);(!t||t.length<e.length)&&e.forEach(((e,t)=>{e&&(r[o[t]]=o[t])}))}}}return r}function l(e,t){if("childList"===e[t].type&&e[t].removedNodes.length)for(let o=0;o<e[t].removedNodes.length;o++){const i=e[t].removedNodes[o];if(i){const e=i.querySelectorAll?[...i.querySelectorAll(r)]:[];n.forEach((t=>{i.classList&&i.classList.contains(t.substring(1))&&e.push(i)})),"INPUT"!==i.tagName&&"SELECT"!==i.tagName&&"CHECKBOX"!==i.tagName||e.push(i);const t=i.querySelectorAll?[...i.querySelectorAll('[data-toggle="tooltip"]')]:[];if(i.getAttribute&&"tooltip"===i.getAttribute("data-toggle")&&t.push(i),t.length>0&&e.push(...t),e.length>0){const t=s(e);if(t){const e=e=>{const t=e;window.NJStore[t.key.id].dispose()};t.forEach(e)}}}}}function c(){let o=document.getElementById("root")||document.body;e&&e.rootElementId&&(o=document.getElementById(e.rootElementId)||o);const n=o;if(n){const e={attributes:!1,childList:!0,subtree:!0};new MutationObserver((e=>{for(let o=0,n=e.length;o<n;o++){l(e,o);const n=i(e,o);for(const e in n)t(n[e])}})).observe(n,e)}}const d=()=>{t(),c()};return document.addEventListener("DOMContentLoaded",d),!0}return!1})();exports.default=s;