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.74 kB
const t=window.NJ&&window.NJ.config||null,e={".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(e),n=Object.keys(e),r=n.toString(),i=(()=>{if("undefined"!=typeof window){function e(t=null){if(window.NJ)t?window.NJ[t].init():window.NJ.AutoInit();else if(t)window[t].init();else{const t=o.length;let e=0;for(;e<t;e++)window[o[e]]&&window[o[e]].init()}}function i(t){const e=[];for(const o of t){o&&o.key&&e.push(o)}return!!e.length&&e}function s(t,e){const r={};if("childList"===t[e].type&&t[e].addedNodes.length)for(let s=0;s<t[e].addedNodes.length;s++){const l=t[e].addedNodes[s];if(l){const t=[],e=(e,o)=>{l.classList&&l.classList.contains(e.substring(1))?t[o]=l:l.querySelector&&l.querySelector(`${e}`)&&(t[o]=l.querySelector(`${e}`))};n.forEach(e);let s=-1;switch(l.tagName){case"INPUT":s=8;break;case"SELECT":s=14;break;case"CHECKBOX":s=9}if(-1!==s&&(t[s]=l),t.length>0){const e=i(t);(!e||e.length<t.length)&&t.forEach(((t,e)=>{t&&(r[o[e]]=o[e])}))}}}return r}function l(t,e){if("childList"===t[e].type&&t[e].removedNodes.length)for(let o=0;o<t[e].removedNodes.length;o++){const s=t[e].removedNodes[o];if(s){const t=s.querySelectorAll?[...s.querySelectorAll(r)]:[];n.forEach((e=>{s.classList&&s.classList.contains(e.substring(1))&&t.push(s)})),"INPUT"!==s.tagName&&"SELECT"!==s.tagName&&"CHECKBOX"!==s.tagName||t.push(s);const e=s.querySelectorAll?[...s.querySelectorAll('[data-toggle="tooltip"]')]:[];if(s.getAttribute&&"tooltip"===s.getAttribute("data-toggle")&&e.push(s),e.length>0&&t.push(...e),t.length>0){const e=i(t);if(e){const t=t=>{const e=t;window.NJStore[e.key.id].dispose()};e.forEach(t)}}}}}function c(){let o=document.getElementById("root")||document.body;t&&t.rootElementId&&(o=document.getElementById(t.rootElementId)||o);const n=o;if(n){const t={attributes:!1,childList:!0,subtree:!0};new MutationObserver((t=>{for(let o=0,n=t.length;o<n;o++){l(t,o);const n=s(t,o);for(const t in n)e(n[t])}})).observe(n,t)}}const d=()=>{e(),c()};return document.addEventListener("DOMContentLoaded",d),!0}return!1})();export{i as default};