@nuralyui/modal 0.0.6 → 0.0.7

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.
package/bundle.js CHANGED
@@ -1,514 +1,26 @@
1
- /**
2
- * @license
3
- * Copyright 2019 Google LLC
4
- * SPDX-License-Identifier: BSD-3-Clause
5
- */
6
- const t=window,i=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,e=Symbol(),s=new WeakMap;class o{constructor(t,i,s){if(this._$cssResult$=!0,s!==e)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=i}get styleSheet(){let t=this.o;const e=this.t;if(i&&void 0===t){const i=void 0!==e&&1===e.length;i&&(t=s.get(e)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),i&&s.set(e,t))}return t}toString(){return this.cssText}}const n=i?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let i="";for(const e of t.cssRules)i+=e.cssText;return(t=>new o("string"==typeof t?t:t+"",void 0,e))(i)})(t):t
7
- /**
8
- * @license
9
- * Copyright 2017 Google LLC
10
- * SPDX-License-Identifier: BSD-3-Clause
11
- */;var r;const a=window,l=a.trustedTypes,h=l?l.emptyScript:"",d=a.reactiveElementPolyfillSupport,c={toAttribute(t,i){switch(i){case Boolean:t=t?h:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,i){let e=t;switch(i){case Boolean:e=null!==t;break;case Number:e=null===t?null:Number(t);break;case Object:case Array:try{e=JSON.parse(t)}catch(t){e=null}}return e}},u=(t,i)=>i!==t&&(i==i||t==t),v={attribute:!0,type:String,converter:c,reflect:!1,hasChanged:u},m="finalized";class p extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this._$Eu()}static addInitializer(t){var i;this.finalize(),(null!==(i=this.h)&&void 0!==i?i:this.h=[]).push(t)}static get observedAttributes(){this.finalize();const t=[];return this.elementProperties.forEach(((i,e)=>{const s=this._$Ep(e,i);void 0!==s&&(this._$Ev.set(s,e),t.push(s))})),t}static createProperty(t,i=v){if(i.state&&(i.attribute=!1),this.finalize(),this.elementProperties.set(t,i),!i.noAccessor&&!this.prototype.hasOwnProperty(t)){const e="symbol"==typeof t?Symbol():"__"+t,s=this.getPropertyDescriptor(t,e,i);void 0!==s&&Object.defineProperty(this.prototype,t,s)}}static getPropertyDescriptor(t,i,e){return{get(){return this[i]},set(s){const o=this[t];this[i]=s,this.requestUpdate(t,o,e)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)||v}static finalize(){if(this.hasOwnProperty(m))return!1;this[m]=!0;const t=Object.getPrototypeOf(this);if(t.finalize(),void 0!==t.h&&(this.h=[...t.h]),this.elementProperties=new Map(t.elementProperties),this._$Ev=new Map,this.hasOwnProperty("properties")){const t=this.properties,i=[...Object.getOwnPropertyNames(t),...Object.getOwnPropertySymbols(t)];for(const e of i)this.createProperty(e,t[e])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(t){const i=[];if(Array.isArray(t)){const e=new Set(t.flat(1/0).reverse());for(const t of e)i.unshift(n(t))}else void 0!==t&&i.push(n(t));return i}static _$Ep(t,i){const e=i.attribute;return!1===e?void 0:"string"==typeof e?e:"string"==typeof t?t.toLowerCase():void 0}_$Eu(){var t;this._$E_=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$Eg(),this.requestUpdate(),null===(t=this.constructor.h)||void 0===t||t.forEach((t=>t(this)))}addController(t){var i,e;(null!==(i=this._$ES)&&void 0!==i?i:this._$ES=[]).push(t),void 0!==this.renderRoot&&this.isConnected&&(null===(e=t.hostConnected)||void 0===e||e.call(t))}removeController(t){var i;null===(i=this._$ES)||void 0===i||i.splice(this._$ES.indexOf(t)>>>0,1)}_$Eg(){this.constructor.elementProperties.forEach(((t,i)=>{this.hasOwnProperty(i)&&(this._$Ei.set(i,this[i]),delete this[i])}))}createRenderRoot(){var e;const s=null!==(e=this.shadowRoot)&&void 0!==e?e:this.attachShadow(this.constructor.shadowRootOptions);return((e,s)=>{i?e.adoptedStyleSheets=s.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet)):s.forEach((i=>{const s=document.createElement("style"),o=t.litNonce;void 0!==o&&s.setAttribute("nonce",o),s.textContent=i.cssText,e.appendChild(s)}))})(s,this.constructor.elementStyles),s}connectedCallback(){var t;void 0===this.renderRoot&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),null===(t=this._$ES)||void 0===t||t.forEach((t=>{var i;return null===(i=t.hostConnected)||void 0===i?void 0:i.call(t)}))}enableUpdating(t){}disconnectedCallback(){var t;null===(t=this._$ES)||void 0===t||t.forEach((t=>{var i;return null===(i=t.hostDisconnected)||void 0===i?void 0:i.call(t)}))}attributeChangedCallback(t,i,e){this._$AK(t,e)}_$EO(t,i,e=v){var s;const o=this.constructor._$Ep(t,e);if(void 0!==o&&!0===e.reflect){const n=(void 0!==(null===(s=e.converter)||void 0===s?void 0:s.toAttribute)?e.converter:c).toAttribute(i,e.type);this._$El=t,null==n?this.removeAttribute(o):this.setAttribute(o,n),this._$El=null}}_$AK(t,i){var e;const s=this.constructor,o=s._$Ev.get(t);if(void 0!==o&&this._$El!==o){const t=s.getPropertyOptions(o),n="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==(null===(e=t.converter)||void 0===e?void 0:e.fromAttribute)?t.converter:c;this._$El=o,this[o]=n.fromAttribute(i,t.type),this._$El=null}}requestUpdate(t,i,e){let s=!0;void 0!==t&&(((e=e||this.constructor.getPropertyOptions(t)).hasChanged||u)(this[t],i)?(this._$AL.has(t)||this._$AL.set(t,i),!0===e.reflect&&this._$El!==t&&(void 0===this._$EC&&(this._$EC=new Map),this._$EC.set(t,e))):s=!1),!this.isUpdatePending&&s&&(this._$E_=this._$Ej())}async _$Ej(){this.isUpdatePending=!0;try{await this._$E_}catch(t){Promise.reject(t)}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var t;if(!this.isUpdatePending)return;this.hasUpdated,this._$Ei&&(this._$Ei.forEach(((t,i)=>this[i]=t)),this._$Ei=void 0);let i=!1;const e=this._$AL;try{i=this.shouldUpdate(e),i?(this.willUpdate(e),null===(t=this._$ES)||void 0===t||t.forEach((t=>{var i;return null===(i=t.hostUpdate)||void 0===i?void 0:i.call(t)})),this.update(e)):this._$Ek()}catch(t){throw i=!1,this._$Ek(),t}i&&this._$AE(e)}willUpdate(t){}_$AE(t){var i;null===(i=this._$ES)||void 0===i||i.forEach((t=>{var i;return null===(i=t.hostUpdated)||void 0===i?void 0:i.call(t)})),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$Ek(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$E_}shouldUpdate(t){return!0}update(t){void 0!==this._$EC&&(this._$EC.forEach(((t,i)=>this._$EO(i,this[i],t))),this._$EC=void 0),this._$Ek()}updated(t){}firstUpdated(t){}}
12
- /**
13
- * @license
14
- * Copyright 2017 Google LLC
15
- * SPDX-License-Identifier: BSD-3-Clause
16
- */
17
- var f;p[m]=!0,p.elementProperties=new Map,p.elementStyles=[],p.shadowRootOptions={mode:"open"},null==d||d({ReactiveElement:p}),(null!==(r=a.reactiveElementVersions)&&void 0!==r?r:a.reactiveElementVersions=[]).push("1.6.3");const y=window,g=y.trustedTypes,b=g?g.createPolicy("lit-html",{createHTML:t=>t}):void 0,w="$lit$",x=`lit$${(Math.random()+"").slice(9)}$`,k="?"+x,$=`<${k}>`,S=document,A=()=>S.createComment(""),E=t=>null===t||"object"!=typeof t&&"function"!=typeof t,C=Array.isArray,z="[ \t\n\f\r]",M=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,_=/-->/g,T=/>/g,O=RegExp(`>|${z}(?:([^\\s"'>=/]+)(${z}*=${z}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),j=/'/g,D=/"/g,I=/^(?:script|style|textarea|title)$/i,U=Symbol.for("lit-noChange"),N=Symbol.for("lit-nothing"),R=new WeakMap,B=S.createTreeWalker(S,129,null,!1);function F(t,i){if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==b?b.createHTML(i):i}class K{constructor({strings:t,_$litType$:i},e){let s;this.parts=[];let o=0,n=0;const r=t.length-1,a=this.parts,[l,h]=((t,i)=>{const e=t.length-1,s=[];let o,n=2===i?"<svg>":"",r=M;for(let i=0;i<e;i++){const e=t[i];let a,l,h=-1,d=0;for(;d<e.length&&(r.lastIndex=d,l=r.exec(e),null!==l);)d=r.lastIndex,r===M?"!--"===l[1]?r=_:void 0!==l[1]?r=T:void 0!==l[2]?(I.test(l[2])&&(o=RegExp("</"+l[2],"g")),r=O):void 0!==l[3]&&(r=O):r===O?">"===l[0]?(r=null!=o?o:M,h=-1):void 0===l[1]?h=-2:(h=r.lastIndex-l[2].length,a=l[1],r=void 0===l[3]?O:'"'===l[3]?D:j):r===D||r===j?r=O:r===_||r===T?r=M:(r=O,o=void 0);const c=r===O&&t[i+1].startsWith("/>")?" ":"";n+=r===M?e+$:h>=0?(s.push(a),e.slice(0,h)+w+e.slice(h)+x+c):e+x+(-2===h?(s.push(void 0),i):c)}return[F(t,n+(t[e]||"<?>")+(2===i?"</svg>":"")),s]})(t,i);if(this.el=K.createElement(l,e),B.currentNode=this.el.content,2===i){const t=this.el.content,i=t.firstChild;i.remove(),t.append(...i.childNodes)}for(;null!==(s=B.nextNode())&&a.length<r;){if(1===s.nodeType){if(s.hasAttributes()){const t=[];for(const i of s.getAttributeNames())if(i.endsWith(w)||i.startsWith(x)){const e=h[n++];if(t.push(i),void 0!==e){const t=s.getAttribute(e.toLowerCase()+w).split(x),i=/([.?@])?(.*)/.exec(e);a.push({type:1,index:o,name:i[2],strings:t,ctor:"."===i[1]?Y:"?"===i[1]?V:"@"===i[1]?W:Z})}else a.push({type:6,index:o})}for(const i of t)s.removeAttribute(i)}if(I.test(s.tagName)){const t=s.textContent.split(x),i=t.length-1;if(i>0){s.textContent=g?g.emptyScript:"";for(let e=0;e<i;e++)s.append(t[e],A()),B.nextNode(),a.push({type:2,index:++o});s.append(t[i],A())}}}else if(8===s.nodeType)if(s.data===k)a.push({type:2,index:o});else{let t=-1;for(;-1!==(t=s.data.indexOf(x,t+1));)a.push({type:7,index:o}),t+=x.length-1}o++}}static createElement(t,i){const e=S.createElement("template");return e.innerHTML=t,e}}function H(t,i,e=t,s){var o,n,r,a;if(i===U)return i;let l=void 0!==s?null===(o=e._$Co)||void 0===o?void 0:o[s]:e._$Cl;const h=E(i)?void 0:i._$litDirective$;return(null==l?void 0:l.constructor)!==h&&(null===(n=null==l?void 0:l._$AO)||void 0===n||n.call(l,!1),void 0===h?l=void 0:(l=new h(t),l._$AT(t,e,s)),void 0!==s?(null!==(r=(a=e)._$Co)&&void 0!==r?r:a._$Co=[])[s]=l:e._$Cl=l),void 0!==l&&(i=H(t,l._$AS(t,i.values),l,s)),i}class L{constructor(t,i){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=i}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){var i;const{el:{content:e},parts:s}=this._$AD,o=(null!==(i=null==t?void 0:t.creationScope)&&void 0!==i?i:S).importNode(e,!0);B.currentNode=o;let n=B.nextNode(),r=0,a=0,l=s[0];for(;void 0!==l;){if(r===l.index){let i;2===l.type?i=new P(n,n.nextSibling,this,t):1===l.type?i=new l.ctor(n,l.name,l.strings,this,t):6===l.type&&(i=new J(n,this,t)),this._$AV.push(i),l=s[++a]}r!==(null==l?void 0:l.index)&&(n=B.nextNode(),r++)}return B.currentNode=S,o}v(t){let i=0;for(const e of this._$AV)void 0!==e&&(void 0!==e.strings?(e._$AI(t,e,i),i+=e.strings.length-2):e._$AI(t[i])),i++}}class P{constructor(t,i,e,s){var o;this.type=2,this._$AH=N,this._$AN=void 0,this._$AA=t,this._$AB=i,this._$AM=e,this.options=s,this._$Cp=null===(o=null==s?void 0:s.isConnected)||void 0===o||o}get _$AU(){var t,i;return null!==(i=null===(t=this._$AM)||void 0===t?void 0:t._$AU)&&void 0!==i?i:this._$Cp}get parentNode(){let t=this._$AA.parentNode;const i=this._$AM;return void 0!==i&&11===(null==t?void 0:t.nodeType)&&(t=i.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,i=this){t=H(this,t,i),E(t)?t===N||null==t||""===t?(this._$AH!==N&&this._$AR(),this._$AH=N):t!==this._$AH&&t!==U&&this._(t):void 0!==t._$litType$?this.g(t):void 0!==t.nodeType?this.$(t):(t=>C(t)||"function"==typeof(null==t?void 0:t[Symbol.iterator]))(t)?this.T(t):this._(t)}k(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}$(t){this._$AH!==t&&(this._$AR(),this._$AH=this.k(t))}_(t){this._$AH!==N&&E(this._$AH)?this._$AA.nextSibling.data=t:this.$(S.createTextNode(t)),this._$AH=t}g(t){var i;const{values:e,_$litType$:s}=t,o="number"==typeof s?this._$AC(t):(void 0===s.el&&(s.el=K.createElement(F(s.h,s.h[0]),this.options)),s);if((null===(i=this._$AH)||void 0===i?void 0:i._$AD)===o)this._$AH.v(e);else{const t=new L(o,this),i=t.u(this.options);t.v(e),this.$(i),this._$AH=t}}_$AC(t){let i=R.get(t.strings);return void 0===i&&R.set(t.strings,i=new K(t)),i}T(t){C(this._$AH)||(this._$AH=[],this._$AR());const i=this._$AH;let e,s=0;for(const o of t)s===i.length?i.push(e=new P(this.k(A()),this.k(A()),this,this.options)):e=i[s],e._$AI(o),s++;s<i.length&&(this._$AR(e&&e._$AB.nextSibling,s),i.length=s)}_$AR(t=this._$AA.nextSibling,i){var e;for(null===(e=this._$AP)||void 0===e||e.call(this,!1,!0,i);t&&t!==this._$AB;){const i=t.nextSibling;t.remove(),t=i}}setConnected(t){var i;void 0===this._$AM&&(this._$Cp=t,null===(i=this._$AP)||void 0===i||i.call(this,t))}}class Z{constructor(t,i,e,s,o){this.type=1,this._$AH=N,this._$AN=void 0,this.element=t,this.name=i,this._$AM=s,this.options=o,e.length>2||""!==e[0]||""!==e[1]?(this._$AH=Array(e.length-1).fill(new String),this.strings=e):this._$AH=N}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(t,i=this,e,s){const o=this.strings;let n=!1;if(void 0===o)t=H(this,t,i,0),n=!E(t)||t!==this._$AH&&t!==U,n&&(this._$AH=t);else{const s=t;let r,a;for(t=o[0],r=0;r<o.length-1;r++)a=H(this,s[e+r],i,r),a===U&&(a=this._$AH[r]),n||(n=!E(a)||a!==this._$AH[r]),a===N?t=N:t!==N&&(t+=(null!=a?a:"")+o[r+1]),this._$AH[r]=a}n&&!s&&this.j(t)}j(t){t===N?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,null!=t?t:"")}}class Y extends Z{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===N?void 0:t}}const q=g?g.emptyScript:"";class V extends Z{constructor(){super(...arguments),this.type=4}j(t){t&&t!==N?this.element.setAttribute(this.name,q):this.element.removeAttribute(this.name)}}class W extends Z{constructor(t,i,e,s,o){super(t,i,e,s,o),this.type=5}_$AI(t,i=this){var e;if((t=null!==(e=H(this,t,i,0))&&void 0!==e?e:N)===U)return;const s=this._$AH,o=t===N&&s!==N||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,n=t!==N&&(s===N||o);o&&this.element.removeEventListener(this.name,this,s),n&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var i,e;"function"==typeof this._$AH?this._$AH.call(null!==(e=null===(i=this.options)||void 0===i?void 0:i.host)&&void 0!==e?e:this.element,t):this._$AH.handleEvent(t)}}class J{constructor(t,i,e){this.element=t,this.type=6,this._$AN=void 0,this._$AM=i,this.options=e}get _$AU(){return this._$AM._$AU}_$AI(t){H(this,t)}}const X=y.litHtmlPolyfillSupport;
18
- /**
19
- * @license
20
- * Copyright 2017 Google LLC
21
- * SPDX-License-Identifier: BSD-3-Clause
22
- */
23
- var G;null==X||X(K,P),(null!==(f=y.litHtmlVersions)&&void 0!==f?f:y.litHtmlVersions=[]).push("2.8.0");const Q=window,tt=Q.trustedTypes,it=tt?tt.createPolicy("lit-html",{createHTML:t=>t}):void 0,et="$lit$",st=`lit$${(Math.random()+"").slice(9)}$`,ot="?"+st,nt=`<${ot}>`,rt=document,at=()=>rt.createComment(""),lt=t=>null===t||"object"!=typeof t&&"function"!=typeof t,ht=Array.isArray,dt="[ \t\n\f\r]",ct=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,ut=/-->/g,vt=/>/g,mt=RegExp(`>|${dt}(?:([^\\s"'>=/]+)(${dt}*=${dt}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),pt=/'/g,ft=/"/g,yt=/^(?:script|style|textarea|title)$/i,gt=(t=>(i,...e)=>({_$litType$:t,strings:i,values:e}))(1),bt=Symbol.for("lit-noChange"),wt=Symbol.for("lit-nothing"),xt=new WeakMap,kt=rt.createTreeWalker(rt,129,null,!1);function $t(t,i){if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==it?it.createHTML(i):i}const St=(t,i)=>{const e=t.length-1,s=[];let o,n=2===i?"<svg>":"",r=ct;for(let i=0;i<e;i++){const e=t[i];let a,l,h=-1,d=0;for(;d<e.length&&(r.lastIndex=d,l=r.exec(e),null!==l);)d=r.lastIndex,r===ct?"!--"===l[1]?r=ut:void 0!==l[1]?r=vt:void 0!==l[2]?(yt.test(l[2])&&(o=RegExp("</"+l[2],"g")),r=mt):void 0!==l[3]&&(r=mt):r===mt?">"===l[0]?(r=null!=o?o:ct,h=-1):void 0===l[1]?h=-2:(h=r.lastIndex-l[2].length,a=l[1],r=void 0===l[3]?mt:'"'===l[3]?ft:pt):r===ft||r===pt?r=mt:r===ut||r===vt?r=ct:(r=mt,o=void 0);const c=r===mt&&t[i+1].startsWith("/>")?" ":"";n+=r===ct?e+nt:h>=0?(s.push(a),e.slice(0,h)+et+e.slice(h)+st+c):e+st+(-2===h?(s.push(void 0),i):c)}return[$t(t,n+(t[e]||"<?>")+(2===i?"</svg>":"")),s]};class At{constructor({strings:t,_$litType$:i},e){let s;this.parts=[];let o=0,n=0;const r=t.length-1,a=this.parts,[l,h]=St(t,i);if(this.el=At.createElement(l,e),kt.currentNode=this.el.content,2===i){const t=this.el.content,i=t.firstChild;i.remove(),t.append(...i.childNodes)}for(;null!==(s=kt.nextNode())&&a.length<r;){if(1===s.nodeType){if(s.hasAttributes()){const t=[];for(const i of s.getAttributeNames())if(i.endsWith(et)||i.startsWith(st)){const e=h[n++];if(t.push(i),void 0!==e){const t=s.getAttribute(e.toLowerCase()+et).split(st),i=/([.?@])?(.*)/.exec(e);a.push({type:1,index:o,name:i[2],strings:t,ctor:"."===i[1]?_t:"?"===i[1]?Ot:"@"===i[1]?jt:Mt})}else a.push({type:6,index:o})}for(const i of t)s.removeAttribute(i)}if(yt.test(s.tagName)){const t=s.textContent.split(st),i=t.length-1;if(i>0){s.textContent=tt?tt.emptyScript:"";for(let e=0;e<i;e++)s.append(t[e],at()),kt.nextNode(),a.push({type:2,index:++o});s.append(t[i],at())}}}else if(8===s.nodeType)if(s.data===ot)a.push({type:2,index:o});else{let t=-1;for(;-1!==(t=s.data.indexOf(st,t+1));)a.push({type:7,index:o}),t+=st.length-1}o++}}static createElement(t,i){const e=rt.createElement("template");return e.innerHTML=t,e}}function Et(t,i,e=t,s){var o,n,r,a;if(i===bt)return i;let l=void 0!==s?null===(o=e._$Co)||void 0===o?void 0:o[s]:e._$Cl;const h=lt(i)?void 0:i._$litDirective$;return(null==l?void 0:l.constructor)!==h&&(null===(n=null==l?void 0:l._$AO)||void 0===n||n.call(l,!1),void 0===h?l=void 0:(l=new h(t),l._$AT(t,e,s)),void 0!==s?(null!==(r=(a=e)._$Co)&&void 0!==r?r:a._$Co=[])[s]=l:e._$Cl=l),void 0!==l&&(i=Et(t,l._$AS(t,i.values),l,s)),i}class Ct{constructor(t,i){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=i}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){var i;const{el:{content:e},parts:s}=this._$AD,o=(null!==(i=null==t?void 0:t.creationScope)&&void 0!==i?i:rt).importNode(e,!0);kt.currentNode=o;let n=kt.nextNode(),r=0,a=0,l=s[0];for(;void 0!==l;){if(r===l.index){let i;2===l.type?i=new zt(n,n.nextSibling,this,t):1===l.type?i=new l.ctor(n,l.name,l.strings,this,t):6===l.type&&(i=new Dt(n,this,t)),this._$AV.push(i),l=s[++a]}r!==(null==l?void 0:l.index)&&(n=kt.nextNode(),r++)}return kt.currentNode=rt,o}v(t){let i=0;for(const e of this._$AV)void 0!==e&&(void 0!==e.strings?(e._$AI(t,e,i),i+=e.strings.length-2):e._$AI(t[i])),i++}}class zt{constructor(t,i,e,s){var o;this.type=2,this._$AH=wt,this._$AN=void 0,this._$AA=t,this._$AB=i,this._$AM=e,this.options=s,this._$Cp=null===(o=null==s?void 0:s.isConnected)||void 0===o||o}get _$AU(){var t,i;return null!==(i=null===(t=this._$AM)||void 0===t?void 0:t._$AU)&&void 0!==i?i:this._$Cp}get parentNode(){let t=this._$AA.parentNode;const i=this._$AM;return void 0!==i&&11===(null==t?void 0:t.nodeType)&&(t=i.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,i=this){t=Et(this,t,i),lt(t)?t===wt||null==t||""===t?(this._$AH!==wt&&this._$AR(),this._$AH=wt):t!==this._$AH&&t!==bt&&this._(t):void 0!==t._$litType$?this.g(t):void 0!==t.nodeType?this.$(t):(t=>ht(t)||"function"==typeof(null==t?void 0:t[Symbol.iterator]))(t)?this.T(t):this._(t)}k(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}$(t){this._$AH!==t&&(this._$AR(),this._$AH=this.k(t))}_(t){this._$AH!==wt&&lt(this._$AH)?this._$AA.nextSibling.data=t:this.$(rt.createTextNode(t)),this._$AH=t}g(t){var i;const{values:e,_$litType$:s}=t,o="number"==typeof s?this._$AC(t):(void 0===s.el&&(s.el=At.createElement($t(s.h,s.h[0]),this.options)),s);if((null===(i=this._$AH)||void 0===i?void 0:i._$AD)===o)this._$AH.v(e);else{const t=new Ct(o,this),i=t.u(this.options);t.v(e),this.$(i),this._$AH=t}}_$AC(t){let i=xt.get(t.strings);return void 0===i&&xt.set(t.strings,i=new At(t)),i}T(t){ht(this._$AH)||(this._$AH=[],this._$AR());const i=this._$AH;let e,s=0;for(const o of t)s===i.length?i.push(e=new zt(this.k(at()),this.k(at()),this,this.options)):e=i[s],e._$AI(o),s++;s<i.length&&(this._$AR(e&&e._$AB.nextSibling,s),i.length=s)}_$AR(t=this._$AA.nextSibling,i){var e;for(null===(e=this._$AP)||void 0===e||e.call(this,!1,!0,i);t&&t!==this._$AB;){const i=t.nextSibling;t.remove(),t=i}}setConnected(t){var i;void 0===this._$AM&&(this._$Cp=t,null===(i=this._$AP)||void 0===i||i.call(this,t))}}class Mt{constructor(t,i,e,s,o){this.type=1,this._$AH=wt,this._$AN=void 0,this.element=t,this.name=i,this._$AM=s,this.options=o,e.length>2||""!==e[0]||""!==e[1]?(this._$AH=Array(e.length-1).fill(new String),this.strings=e):this._$AH=wt}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(t,i=this,e,s){const o=this.strings;let n=!1;if(void 0===o)t=Et(this,t,i,0),n=!lt(t)||t!==this._$AH&&t!==bt,n&&(this._$AH=t);else{const s=t;let r,a;for(t=o[0],r=0;r<o.length-1;r++)a=Et(this,s[e+r],i,r),a===bt&&(a=this._$AH[r]),n||(n=!lt(a)||a!==this._$AH[r]),a===wt?t=wt:t!==wt&&(t+=(null!=a?a:"")+o[r+1]),this._$AH[r]=a}n&&!s&&this.j(t)}j(t){t===wt?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,null!=t?t:"")}}class _t extends Mt{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===wt?void 0:t}}const Tt=tt?tt.emptyScript:"";class Ot extends Mt{constructor(){super(...arguments),this.type=4}j(t){t&&t!==wt?this.element.setAttribute(this.name,Tt):this.element.removeAttribute(this.name)}}class jt extends Mt{constructor(t,i,e,s,o){super(t,i,e,s,o),this.type=5}_$AI(t,i=this){var e;if((t=null!==(e=Et(this,t,i,0))&&void 0!==e?e:wt)===bt)return;const s=this._$AH,o=t===wt&&s!==wt||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,n=t!==wt&&(s===wt||o);o&&this.element.removeEventListener(this.name,this,s),n&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var i,e;"function"==typeof this._$AH?this._$AH.call(null!==(e=null===(i=this.options)||void 0===i?void 0:i.host)&&void 0!==e?e:this.element,t):this._$AH.handleEvent(t)}}class Dt{constructor(t,i,e){this.element=t,this.type=6,this._$AN=void 0,this._$AM=i,this.options=e}get _$AU(){return this._$AM._$AU}_$AI(t){Et(this,t)}}const It=Q.litHtmlPolyfillSupport;null==It||It(At,zt),(null!==(G=Q.litHtmlVersions)&&void 0!==G?G:Q.litHtmlVersions=[]).push("2.8.0");
24
- /**
25
- * @license
26
- * Copyright 2017 Google LLC
27
- * SPDX-License-Identifier: BSD-3-Clause
28
- */
29
- var Ut,Nt;class Rt extends p{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var t,i;const e=super.createRenderRoot();return null!==(t=(i=this.renderOptions).renderBefore)&&void 0!==t||(i.renderBefore=e.firstChild),e}update(t){const i=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=((t,i,e)=>{var s,o;const n=null!==(s=null==e?void 0:e.renderBefore)&&void 0!==s?s:i;let r=n._$litPart$;if(void 0===r){const t=null!==(o=null==e?void 0:e.renderBefore)&&void 0!==o?o:null;n._$litPart$=r=new zt(i.insertBefore(at(),t),t,void 0,null!=e?e:{})}return r._$AI(t),r})(i,this.renderRoot,this.renderOptions)}connectedCallback(){var t;super.connectedCallback(),null===(t=this._$Do)||void 0===t||t.setConnected(!0)}disconnectedCallback(){var t;super.disconnectedCallback(),null===(t=this._$Do)||void 0===t||t.setConnected(!1)}render(){return bt}}Rt.finalized=!0,Rt._$litElement$=!0,null===(Ut=globalThis.litElementHydrateSupport)||void 0===Ut||Ut.call(globalThis,{LitElement:Rt});const Bt=globalThis.litElementPolyfillSupport;null==Bt||Bt({LitElement:Rt}),(null!==(Nt=globalThis.litElementVersions)&&void 0!==Nt?Nt:globalThis.litElementVersions=[]).push("3.3.3");
30
- /**
31
- * @license
32
- * Copyright 2017 Google LLC
33
- * SPDX-License-Identifier: BSD-3-Clause
34
- */
35
- const Ft=(t,i)=>"method"===i.kind&&i.descriptor&&!("value"in i.descriptor)?{...i,finisher(e){e.createProperty(i.key,t)}}:{kind:"field",key:Symbol(),placement:"own",descriptor:{},originalKey:i.key,initializer(){"function"==typeof i.initializer&&(this[i.key]=i.initializer.call(this))},finisher(e){e.createProperty(i.key,t)}},Kt=(t,i,e)=>{i.constructor.createProperty(e,t)};
36
- /**
37
- * @license
38
- * Copyright 2017 Google LLC
39
- * SPDX-License-Identifier: BSD-3-Clause
40
- */function Ht(t){return(i,e)=>void 0!==e?Kt(t,i,e):Ft(t,i)
41
- /**
42
- * @license
43
- * Copyright 2017 Google LLC
44
- * SPDX-License-Identifier: BSD-3-Clause
45
- */}function Lt(t){return Ht({...t,state:!0})}
46
- /**
47
- * @license
48
- * Copyright 2021 Google LLC
49
- * SPDX-License-Identifier: BSD-3-Clause
50
- */var Pt;null===(Pt=window.HTMLSlotElement)||void 0===Pt||Pt.prototype.assignedElements;
51
- /**
52
- * @license
53
- * Copyright 2017 Google LLC
54
- * SPDX-License-Identifier: BSD-3-Clause
55
- */
56
- const Zt=1,Yt=t=>(...i)=>({_$litDirective$:t,values:i});class qt{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,i,e){this._$Ct=t,this._$AM=i,this._$Ci=e}_$AS(t,i){return this.update(t,i)}update(t,i){return this.render(...i)}}
57
- /**
58
- * @license
59
- * Copyright 2018 Google LLC
60
- * SPDX-License-Identifier: BSD-3-Clause
61
- */const Vt=Yt(class extends qt{constructor(t){var i;if(super(t),t.type!==Zt||"class"!==t.name||(null===(i=t.strings)||void 0===i?void 0:i.length)>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(t){return" "+Object.keys(t).filter((i=>t[i])).join(" ")+" "}update(t,[i]){var e,s;if(void 0===this.it){this.it=new Set,void 0!==t.strings&&(this.nt=new Set(t.strings.join(" ").split(/\s/).filter((t=>""!==t))));for(const t in i)i[t]&&!(null===(e=this.nt)||void 0===e?void 0:e.has(t))&&this.it.add(t);return this.render(i)}const o=t.element.classList;this.it.forEach((t=>{t in i||(o.remove(t),this.it.delete(t))}));for(const t in i){const e=!!i[t];e===this.it.has(t)||(null===(s=this.nt)||void 0===s?void 0:s.has(t))||(e?(o.add(t),this.it.add(t)):(o.remove(t),this.it.delete(t)))}return U}}),Wt="important",Jt=" !"+Wt,Xt=Yt(class extends qt{constructor(t){var i;if(super(t),t.type!==Zt||"style"!==t.name||(null===(i=t.strings)||void 0===i?void 0:i.length)>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(t){return Object.keys(t).reduce(((i,e)=>{const s=t[e];return null==s?i:i+`${e=e.includes("-")?e:e.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${s};`}),"")}update(t,[i]){const{style:e}=t.element;if(void 0===this.ht){this.ht=new Set;for(const t in i)this.ht.add(t);return this.render(i)}this.ht.forEach((t=>{null==i[t]&&(this.ht.delete(t),t.includes("-")?e.removeProperty(t):e[t]="")}));for(const t in i){const s=i[t];if(null!=s){this.ht.add(t);const i="string"==typeof s&&s.endsWith(Jt);t.includes("-")||i?e.setProperty(t,i?s.slice(0,-11):s,i?Wt:""):e[t]=s}}return U}});
62
- /**
63
- * @license
64
- * Copyright 2018 Google LLC
65
- * SPDX-License-Identifier: BSD-3-Clause
66
- */
67
- /**
68
- * @license
69
- * Copyright 2023 Nuraly, Laabidi Aymen
70
- * SPDX-License-Identifier: MIT
71
- */
72
- var Gt,Qt,ti,ii;!function(t){t.Small="small",t.Medium="medium",t.Large="large",t.ExtraLarge="xl"}(Gt||(Gt={})),function(t){t.Center="center",t.Top="top",t.Bottom="bottom"}(Qt||(Qt={})),function(t){t.Fade="fade",t.Zoom="zoom",t.SlideUp="slide-up",t.SlideDown="slide-down",t.None="none"}(ti||(ti={})),function(t){t.Static="static",t.Closable="closable",t.None="none"}(ii||(ii={}));const ei="",si=1e3,oi=t=>Object.values(Gt).includes(t),ni=t=>Object.values(Qt).includes(t),ri=t=>Object.values(ti).includes(t),ai=t=>Object.values(ii).includes(t),li={size:Gt.Medium,position:Qt.Center,animation:ti.Fade,backdrop:ii.Closable,closable:!0,draggable:!1,resizable:!1,fullscreen:!1,destroyOnClose:!1,zIndex:1e3},hi={title:ei,showCloseButton:!0,icon:ei,draggable:!1},di={showCancelButton:!1,showOkButton:!1,cancelText:"Cancel",okText:"OK",okType:"primary"},ci=((t,...i)=>{const s=1===t.length?t[0]:i.reduce(((i,e,s)=>i+(t=>{if(!0===t._$cssResult$)return t.cssText;if("number"==typeof t)return t;throw Error("Value passed to 'css' function must be a 'css' function result: "+t+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(e)+t[s+1]),t[0]);return new o(s,t,e)})`
73
- :host {
74
- display: contents;
75
- font-family: var(--nuraly-font-family);
76
-
77
- /* Force CSS custom property inheritance to ensure theme switching works properly */
78
- color: var(--nuraly-color-text);
79
- background-color: var(--nuraly-color-background);
80
-
81
- /* Ensure theme variables are properly inherited */
82
- --modal-border-radius: var(--nuraly-border-radius-modal, 8px);
83
-
84
- /* Ensure clean state transitions when theme changes */
85
- * {
86
- transition: all var(--nuraly-transition-fast, 0.15s) ease;
87
- }
88
- }
89
-
90
- /* Force re-evaluation of theme-dependent properties on theme change */
91
- :host([data-theme]) {
92
- color: inherit;
93
- background-color: inherit;
94
- }
95
-
96
- /* Modal backdrop */
97
- .modal-backdrop {
98
- position: fixed;
99
- top: 0;
100
- left: 0;
101
- right: 0;
102
- bottom: 0;
103
- background-color: var(--nuraly-color-modal-backdrop, rgba(0, 0, 0, 0.45));
104
- z-index: var(--nuraly-z-modal-backdrop, 1000);
105
- display: flex;
106
- align-items: center;
107
- justify-content: center;
108
- padding: var(--nuraly-spacing-modal-padding, var(--nuraly-spacing-05, 1rem));
109
- backdrop-filter: var(--nuraly-modal-backdrop-filter, none);
110
-
111
- &.modal-backdrop--hidden {
112
- display: none;
113
- }
114
-
115
- &.modal-backdrop--position-top {
116
- align-items: flex-start;
117
- padding-top: var(--nuraly-spacing-modal-top, var(--nuraly-spacing-07, 2rem));
118
- }
119
-
120
- &.modal-backdrop--position-bottom {
121
- align-items: flex-end;
122
- padding-bottom: var(--nuraly-spacing-modal-bottom, var(--nuraly-spacing-07, 2rem));
123
- }
124
- }
125
-
126
- /* Nested modals support */
127
- .modal-backdrop {
128
- /* Ensure each modal backdrop has its own stacking context */
129
- z-index: var(--nuraly-z-modal-backdrop, 1000);
130
- }
131
-
132
- /* Nested modal backdrop styling */
133
- .modal-backdrop + .modal-backdrop {
134
- /* Subsequent modals get slightly darker backdrop */
135
- background-color: var(--nuraly-color-modal-backdrop-nested, rgba(0, 0, 0, 0.6));
136
- }
137
-
138
- /* Nested modal animation delay to avoid conflicts */
139
- .modal-backdrop:not(:first-of-type) {
140
- animation-delay: 0.1s;
141
- }
142
-
143
- /* Modal container */
144
- .modal {
145
- position: relative;
146
- background-color: var(--nuraly-color-modal-background, var(--nuraly-color-background, #ffffff));
147
- border-radius: var(--modal-border-radius);
148
- box-shadow: var(--nuraly-shadow-modal,
149
- 0 6px 16px 0 rgba(0, 0, 0, 0.08),
150
- 0 3px 6px -4px rgba(0, 0, 0, 0.12),
151
- 0 9px 28px 8px rgba(0, 0, 0, 0.05)
152
- );
153
- border: var(--nuraly-border-modal, 1px solid var(--nuraly-color-border, #e0e0e0));
154
- max-height: calc(100vh - var(--nuraly-spacing-modal-margin, var(--nuraly-spacing-07, 2rem)) * 2);
155
- max-width: calc(100vw - var(--nuraly-spacing-modal-margin, var(--nuraly-spacing-07, 2rem)) * 2);
156
- display: flex;
157
- flex-direction: column;
158
- outline: none;
159
-
160
- &:focus {
161
- outline: var(--nuraly-focus-outline, 2px solid var(--nuraly-color-primary, #0f62fe));
162
- outline-offset: var(--nuraly-focus-outline-offset, 1px);
163
- }
164
- }
165
-
166
-
167
- /* Modal sizes */
168
- .modal--size-small {
169
- width: var(--nuraly-modal-width-small, 400px);
170
- min-height: var(--nuraly-modal-min-height-small, 200px);
171
- }
172
-
173
- .modal--size-medium {
174
- width: var(--nuraly-modal-width-medium, 600px);
175
- min-height: var(--nuraly-modal-min-height-medium, 300px);
176
- }
177
-
178
- .modal--size-large {
179
- width: var(--nuraly-modal-width-large, 800px);
180
- min-height: var(--nuraly-modal-min-height-large, 400px);
181
- }
182
-
183
- .modal--size-xl {
184
- width: var(--nuraly-modal-width-xl, 1000px);
185
- min-height: var(--nuraly-modal-min-height-xl, 500px);
186
- }
187
-
188
- .modal--fullscreen {
189
- width: 100vw;
190
- height: 100vh;
191
- max-width: 100vw;
192
- max-height: 100vh;
193
- border-radius: 0;
194
- }
195
-
196
- /* Modal header */
197
- .modal-header {
198
- padding: var(--nuraly-spacing-modal-header, var(--nuraly-spacing-05, 1rem) var(--nuraly-spacing-06, 1.5rem));
199
- border-bottom: var(--nuraly-border-modal-header, 1px solid var(--nuraly-color-border, #e0e0e0));
200
- display: flex;
201
- align-items: center;
202
- justify-content: space-between;
203
- min-height: var(--nuraly-modal-header-height);
204
- flex-shrink: 0;
205
-
206
- &.modal-header--draggable {
207
- cursor: move;
208
- user-select: none;
209
- }
210
- }
211
-
212
- .modal-header-content {
213
- display: flex;
214
- align-items: center;
215
- gap: var(--nuraly-spacing-03, 0.5rem);
216
- flex: 1;
217
- min-width: 0;
218
- }
219
-
220
- .modal-header-icon {
221
- flex-shrink: 0;
222
- width: var(--nuraly-modal-header-icon-size, 20px);
223
- height: var(--nuraly-modal-header-icon-size, 20px);
224
- color: var(--nuraly-color-modal-header-icon, var(--nuraly-color-text-secondary, #525252));
225
- }
226
-
227
- .modal-title {
228
- font-size: var(--nuraly-font-size-modal-title, var(--nuraly-font-size-04, 1.125rem));
229
- font-weight: var(--nuraly-font-weight-modal-title, var(--nuraly-font-weight-medium, 500));
230
- color: var(--nuraly-color-modal-title, var(--nuraly-color-text, #161616));
231
- margin: 0;
232
- line-height: var(--nuraly-line-height-02, 1.375);
233
- overflow: hidden;
234
- text-overflow: ellipsis;
235
- white-space: nowrap;
236
- }
237
-
238
- .modal-close-button {
239
- flex-shrink: 0;
240
- width: var(--nuraly-modal-close-size, 32px);
241
- height: var(--nuraly-modal-close-size, 32px);
242
- border: none;
243
- background: transparent;
244
- border-radius: var(--nuraly-border-radius-sm, 4px);
245
- cursor: pointer;
246
- display: flex;
247
- align-items: center;
248
- justify-content: center;
249
- color: var(--nuraly-color-modal-close-icon, var(--nuraly-color-text-secondary, #525252));
250
- transition: all var(--nuraly-transition-fast, 0.15s) ease;
251
-
252
- &:hover {
253
- background-color: var(--nuraly-color-modal-close-hover, var(--nuraly-color-background-hover, #f4f4f4));
254
- color: var(--nuraly-color-modal-close-icon-hover, var(--nuraly-color-text, #161616));
255
- }
256
-
257
- &:focus {
258
- outline: var(--nuraly-focus-outline, 2px solid var(--nuraly-color-primary, #0f62fe));
259
- outline-offset: var(--nuraly-focus-outline-offset, 1px);
260
- }
261
-
262
- &:active {
263
- background-color: var(--nuraly-color-modal-close-active, var(--nuraly-color-background-active, #c6c6c6));
264
- }
265
- }
266
-
267
- .modal-close-icon {
268
- width: var(--nuraly-modal-close-icon-size, 16px);
269
- height: var(--nuraly-modal-close-icon-size, 16px);
270
- }
271
-
272
- /* Carbon theme specific - sharp corners for close button */
273
- :host([data-theme="carbon"]) .modal-close-button,
274
- :host([data-theme="carbon-light"]) .modal-close-button,
275
- :host([data-theme="carbon-dark"]) .modal-close-button {
276
- border-radius: 0;
277
- }
278
-
279
- /* Modal body */
280
- .modal-body {
281
- flex: 1;
282
- padding: var(--nuraly-spacing-modal-body, var(--nuraly-spacing-05, 1rem) var(--nuraly-spacing-06, 1.5rem));
283
- overflow-y: auto;
284
- color: var(--nuraly-color-modal-body-text, var(--nuraly-color-text, #161616));
285
- line-height: var(--nuraly-line-height-03, 1.5);
286
- }
287
-
288
- /* Modal footer */
289
- .modal-footer {
290
- padding: var(--nuraly-spacing-modal-footer, var(--nuraly-spacing-03, 0.5rem) var(--nuraly-spacing-05, 1rem));
291
- border-top: var(--nuraly-border-modal-footer, 1px solid var(--nuraly-color-border, #e0e0e0));
292
- display: flex;
293
- align-items: center;
294
- justify-content: flex-end;
295
- gap: var(--nuraly-spacing-03, 0.5rem);
296
- min-height: var(--nuraly-modal-footer-height, 48px);
297
- flex-shrink: 0;
298
- }
299
-
300
- /* Animation keyframes */
301
- @keyframes modalFadeIn {
302
- from {
303
- opacity: 0;
304
- transform: scale(0.9);
305
- }
306
- to {
307
- opacity: 1;
308
- transform: scale(1);
309
- }
310
- }
311
-
312
- @keyframes modalZoomIn {
313
- from {
314
- opacity: 0;
315
- transform: scale(0.7);
316
- }
317
- to {
318
- opacity: 1;
319
- transform: scale(1);
320
- }
321
- }
322
-
323
- @keyframes modalSlideUp {
324
- from {
325
- opacity: 0;
326
- transform: translateY(20px);
327
- }
328
- to {
329
- opacity: 1;
330
- transform: translateY(0);
331
- }
332
- }
333
-
334
- @keyframes modalSlideDown {
335
- from {
336
- opacity: 0;
337
- transform: translateY(-20px);
338
- }
339
- to {
340
- opacity: 1;
341
- transform: translateY(0);
342
- }
343
- }
344
-
345
- @keyframes backdropFadeIn {
346
- from {
347
- opacity: 0;
348
- }
349
- to {
350
- opacity: 1;
351
- }
352
- }
353
-
354
- /* Animation classes */
355
- .modal-backdrop--animation-fade {
356
- animation: backdropFadeIn var(--nuraly-transition-modal, 0.3s) ease;
357
- }
358
-
359
- .modal--animation-fade {
360
- animation: modalFadeIn var(--nuraly-transition-modal, 0.3s) ease;
361
- }
362
-
363
- .modal--animation-zoom {
364
- animation: modalZoomIn var(--nuraly-transition-modal, 0.3s) ease;
365
- }
366
-
367
- .modal--animation-slide-up {
368
- animation: modalSlideUp var(--nuraly-transition-modal, 0.3s) ease;
369
- }
370
-
371
- .modal--animation-slide-down {
372
- animation: modalSlideDown var(--nuraly-transition-modal, 0.3s) ease;
373
- }
374
-
375
- /* Dragging state */
376
- .modal--dragging {
377
- user-select: none;
378
- cursor: move;
379
- }
380
-
381
- /* Resizing handles (when resizable) */
382
- .modal--resizable {
383
- resize: both;
384
- overflow: auto;
385
- }
386
-
387
- .resize-handle {
388
- position: absolute;
389
- bottom: 0;
390
- right: 0;
391
- width: 20px;
392
- height: 20px;
393
- cursor: se-resize;
394
- background: linear-gradient(
395
- -45deg,
396
- transparent 40%,
397
- var(--nuraly-color-border, #e0e0e0) 40%,
398
- var(--nuraly-color-border, #e0e0e0) 60%,
399
- transparent 60%
400
- );
401
- }
402
-
403
- /* Responsive behavior */
404
- @media (max-width: 768px) {
405
- .modal-backdrop {
406
- padding: var(--nuraly-spacing-02, 0.25rem);
407
- }
408
-
409
- .modal--size-small,
410
- .modal--size-medium,
411
- .modal--size-large,
412
- .modal--size-xl {
413
- width: 100%;
414
- max-width: none;
415
- }
416
-
417
- .modal-header,
418
- .modal-body,
419
- .modal-footer {
420
- padding-left: var(--nuraly-spacing-04, 0.75rem);
421
- padding-right: var(--nuraly-spacing-04, 0.75rem);
422
- }
423
- }
424
-
425
- /* Dark theme support through CSS custom properties */
426
- @media (prefers-color-scheme: dark) {
427
- :host(:not([data-theme])) {
428
- --nuraly-color-modal-backdrop: rgba(0, 0, 0, 0.6);
429
- }
430
- }
431
- `
1
+ import{css as t,LitElement as a,nothing as o,html as e}from"lit";import{property as i,state as r,customElement as s}from"lit/decorators.js";import{classMap as n}from"lit/directives/class-map.js";import{styleMap as l}from"lit/directives/style-map.js";import{NuralyUIBaseMixin as d}from"@nuralyui/common/mixins";
432
2
  /**
433
3
  * @license
434
4
  * Copyright 2023 Nuraly, Laabidi Aymen
435
5
  * SPDX-License-Identifier: MIT
436
- */,ui=t=>class extends t{constructor(){super(...arguments),this.handleSystemThemeChange=()=>{this.closest("[data-theme]")||document.documentElement.hasAttribute("data-theme")||this.requestUpdate()}}connectedCallback(){super.connectedCallback(),this.setupThemeObserver(),this.setupDesignSystemObserver(),this.setupSystemThemeListener()}disconnectedCallback(){var t,i,e;super.disconnectedCallback(),null===(t=this.themeObserver)||void 0===t||t.disconnect(),null===(i=this.designSystemObserver)||void 0===i||i.disconnect(),null===(e=this.mediaQuery)||void 0===e||e.removeEventListener("change",this.handleSystemThemeChange)}get currentTheme(){var t,i;const e=(null===(t=this.closest("[data-theme]"))||void 0===t?void 0:t.getAttribute("data-theme"))||document.documentElement.getAttribute("data-theme");return e||((null===(i=window.matchMedia)||void 0===i?void 0:i.call(window,"(prefers-color-scheme: dark)").matches)?"dark":"light")}get currentDesignSystem(){var t;const i=(null===(t=this.closest("[design-system]"))||void 0===t?void 0:t.getAttribute("design-system"))||document.documentElement.getAttribute("design-system");return"carbon"===i?i:"default"}setupThemeObserver(){this.themeObserver=new MutationObserver((()=>{this.requestUpdate()})),this.themeObserver.observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme"]})}setupDesignSystemObserver(){this.designSystemObserver=new MutationObserver((()=>{this.requestUpdate()})),this.designSystemObserver.observe(document.documentElement,{attributes:!0,attributeFilter:["design-system"]})}setupSystemThemeListener(){window.matchMedia&&(this.mediaQuery=window.matchMedia("(prefers-color-scheme: dark)"),this.mediaQuery.addEventListener("change",this.handleSystemThemeChange))}},vi=()=>{var t;return void 0!==globalThis.litElementVersions||"undefined"!=typeof process&&"development"===(null===(t=process.env)||void 0===t?void 0:t.NODE_ENV)||"undefined"!=typeof window&&("localhost"===window.location.hostname||"127.0.0.1"===window.location.hostname)},mi=t=>class extends t{constructor(){super(...arguments),this.requiredComponents=[]}validateDependencies(){if(vi())for(const t of this.requiredComponents)if(!this.isComponentAvailable(t))throw new Error(`Required component "${t}" is not registered. Please import and register the component before using ${this.tagName.toLowerCase()}. Example: import '@nuralyui/${t}';`)}validateDependenciesWithHandler(t){if(!vi())return!0;let i=!0;for(const e of this.requiredComponents)if(!this.isComponentAvailable(e)){i=!1;const s=new Error(`Required component "${e}" is not registered. Please import and register the component before using ${this.tagName.toLowerCase()}.`);t?t(e,s):console.error(s.message)}return i}isComponentAvailable(t){return!!customElements.get(t)}getMissingDependencies(){return this.requiredComponents.filter((t=>!this.isComponentAvailable(t)))}areDependenciesAvailable(){return this.requiredComponents.every((t=>this.isComponentAvailable(t)))}addRequiredComponent(t){this.requiredComponents.includes(t)||this.requiredComponents.push(t)}removeRequiredComponent(t){const i=this.requiredComponents.indexOf(t);i>-1&&this.requiredComponents.splice(i,1)}},pi=t=>class extends t{dispatchCustomEvent(t,i){this.dispatchEvent(new CustomEvent(t,{detail:i,bubbles:!0,composed:!0}))}dispatchEventWithMetadata(t,i){var e;const s=Object.assign(Object.assign({},i),{timestamp:Date.now(),componentName:(null===(e=this.tagName)||void 0===e?void 0:e.toLowerCase())||"unknown"});this.dispatchCustomEvent(t,s)}dispatchInputEvent(t,i){const e=Object.assign({target:i.target||this,value:i.value,originalEvent:i.originalEvent},i);this.dispatchCustomEvent(t,e)}dispatchFocusEvent(t,i){const e=Object.assign({target:i.target||this,value:i.value,focused:i.focused,cursorPosition:i.cursorPosition,selectedText:i.selectedText},i);this.dispatchCustomEvent(t,e)}dispatchValidationEvent(t,i){var e;const s=Object.assign({target:i.target||this,value:i.value,isValid:null!==(e=i.isValid)&&void 0!==e&&e,error:i.error},i);this.dispatchCustomEvent(t,s)}dispatchActionEvent(t,i){const e=Object.assign({target:i.target||this,action:i.action,previousValue:i.previousValue,newValue:i.newValue},i);this.dispatchCustomEvent(t,e)}isReadonlyKeyAllowed(t){if(t.ctrlKey||t.metaKey){return["KeyA","KeyC"].includes(t.code)}return["Tab","Escape","ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(t.key)}isActivationKey(t){return"Enter"===t.key||" "===t.key}};const fi=new
6
+ */var h,c,m,u;!function(t){t.Small="small",t.Medium="medium",t.Large="large",t.ExtraLarge="xl"}(h||(h={})),function(t){t.Center="center",t.Top="top",t.Bottom="bottom"}(c||(c={})),function(t){t.Fade="fade",t.Zoom="zoom",t.SlideUp="slide-up",t.SlideDown="slide-down",t.None="none"}(m||(m={})),function(t){t.Static="static",t.Closable="closable",t.None="none"}(u||(u={}));const p="",v=1e3,y=t=>Object.values(h).includes(t),b=t=>Object.values(c).includes(t),g=t=>Object.values(m).includes(t),f=t=>Object.values(u).includes(t),x={size:h.Medium,position:c.Center,animation:m.Fade,backdrop:u.Closable,closable:!0,draggable:!1,resizable:!1,fullscreen:!1,destroyOnClose:!1,zIndex:1e3},w={title:p,showCloseButton:!0,icon:p,draggable:!1},k={showCancelButton:!1,showOkButton:!1,cancelText:"Cancel",okText:"OK",okType:"primary"},z=t`:host{display:contents;font-family:var(--nuraly-font-family);color:var(--nuraly-color-text);background-color:var(--nuraly-color-background);--modal-border-radius:var(--nuraly-border-radius-modal, 8px)}.modal-backdrop{position:fixed;top:0;left:0;right:0;bottom:0;background-color:var(--nuraly-color-modal-backdrop,rgba(0,0,0,.45));z-index:var(--nuraly-z-modal-backdrop,1000);display:flex;align-items:center;justify-content:center;padding:var(--nuraly-spacing-modal-padding,var(--nuraly-spacing-05,1rem));backdrop-filter:var(--nuraly-modal-backdrop-filter, none)}&.modal-backdrop--position-top{align-items:flex-start;padding-top:var(--nuraly-spacing-modal-top,var(--nuraly-spacing-07,2rem))}&.modal-backdrop--position-bottom{align-items:flex-end;padding-bottom:var(--nuraly-spacing-modal-bottom,var(--nuraly-spacing-07,2rem))}.modal-backdrop+.modal-backdrop{background-color:var(--nuraly-color-modal-backdrop-nested,rgba(0,0,0,.6))}.modal-backdrop:not(:first-of-type){animation-delay:.1s}.modal{position:relative;background-color:var(--nuraly-color-modal-background,var(--nuraly-color-background,#fff));border-radius:var(--modal-border-radius);box-shadow:var(--nuraly-shadow-modal,0 6px 16px 0 rgba(0,0,0,.08),0 3px 6px -4px rgba(0,0,0,.12),0 9px 28px 8px rgba(0,0,0,.05));border:var(--nuraly-border-modal,1px solid var(--nuraly-color-border,#e0e0e0));max-height:calc(100vh - var(--nuraly-spacing-modal-margin,var(--nuraly-spacing-07,2rem)) * 2);max-width:calc(100vw - var(--nuraly-spacing-modal-margin,var(--nuraly-spacing-07,2rem)) * 2);display:flex;flex-direction:column;outline:0}.modal--size-small{width:var(--nuraly-modal-width-small,400px);min-height:var(--nuraly-modal-min-height-small,200px)}.modal--size-medium{width:var(--nuraly-modal-width-medium,600px);min-height:var(--nuraly-modal-min-height-medium,300px)}.modal--size-large{width:var(--nuraly-modal-width-large,800px);min-height:var(--nuraly-modal-min-height-large,400px)}.modal--size-xl{width:var(--nuraly-modal-width-xl,1000px);min-height:var(--nuraly-modal-min-height-xl,500px)}.modal--fullscreen{width:100vw;height:100vh;max-width:100vw;max-height:100vh;border-radius:0}.modal-header{padding:var(--nuraly-spacing-modal-header,var(--nuraly-spacing-05,1rem) var(--nuraly-spacing-06,1.5rem));border-bottom:var(--nuraly-border-modal-header,1px solid var(--nuraly-color-border,#e0e0e0));display:flex;align-items:center;justify-content:space-between;min-height:var(--nuraly-modal-header-height);flex-shrink:0;user-select:none}.modal-header-icon{flex-shrink:0;width:var(--nuraly-modal-header-icon-size,20px);height:var(--nuraly-modal-header-icon-size,20px);color:var(--nuraly-color-modal-header-icon,var(--nuraly-color-text-secondary,#525252))}.modal-title{font-size:var(--nuraly-font-size-modal-title,var(--nuraly-font-size-04,1.125rem));font-weight:var(--nuraly-font-weight-modal-title,var(--nuraly-font-weight-medium,500));color:var(--nuraly-color-modal-title,var(--nuraly-color-text,#161616));margin:0;line-height:var(--nuraly-line-height-02,1.375);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.modal-close-button{flex-shrink:0;width:var(--nuraly-modal-close-size,32px);height:var(--nuraly-modal-close-size,32px);border:none;background:0 0;border-radius:var(--nuraly-border-radius-sm,4px);cursor:pointer;display:flex;align-items:center;justify-content:center;color:var(--nuraly-color-modal-close-icon,var(--nuraly-color-text-secondary,#525252));transition:all var(--nuraly-transition-fast,.15s) ease}.modal-close-icon{width:var(--nuraly-modal-close-icon-size,16px);height:var(--nuraly-modal-close-icon-size,16px)}:host([data-theme=carbon-dark]) .modal-close-button,:host([data-theme=carbon-light]) .modal-close-button,:host([data-theme=carbon]) .modal-close-button{border-radius:0}.modal-body{flex:1;padding:var(--nuraly-spacing-modal-body,var(--nuraly-spacing-05,1rem) var(--nuraly-spacing-06,1.5rem));overflow-y:auto;color:var(--nuraly-color-modal-body-text,var(--nuraly-color-text,#161616));line-height:var(--nuraly-line-height-03,1.5)}.modal-footer{padding:var(--nuraly-spacing-modal-footer,var(--nuraly-spacing-03,.5rem) var(--nuraly-spacing-05,1rem));border-top:var(--nuraly-border-modal-footer,1px solid var(--nuraly-color-border,#e0e0e0));display:flex;align-items:center;justify-content:flex-end;gap:var(--nuraly-spacing-03,.5rem);min-height:var(--nuraly-modal-footer-height,48px);flex-shrink:0}@keyframes modalFadeIn{from{opacity:0;transform:scale(.9)}to{opacity:1;transform:scale(1)}}@keyframes modalZoomIn{from{opacity:0;transform:scale(.7)}to{opacity:1;transform:scale(1)}}@keyframes modalSlideUp{from{opacity:0;transform:translateY(20px)}to{opacity:1;transform:translateY(0)}}@keyframes modalSlideDown{from{opacity:0;transform:translateY(-20px)}to{opacity:1;transform:translateY(0)}}@keyframes backdropFadeIn{from{opacity:0}to{opacity:1}}.modal-backdrop--animation-fade{animation:backdropFadeIn var(--nuraly-transition-modal,.3s) ease}.modal--animation-fade{animation:modalFadeIn var(--nuraly-transition-modal,.3s) ease}.modal--animation-zoom{animation:modalZoomIn var(--nuraly-transition-modal,.3s) ease}.modal--animation-slide-up{animation:modalSlideUp var(--nuraly-transition-modal,.3s) ease}.modal--animation-slide-down{animation:modalSlideDown var(--nuraly-transition-modal,.3s) ease}.modal--dragging{user-select:none;cursor:move}.modal--resizable{resize:both;overflow:auto}.resize-handle{position:absolute;bottom:0;right:0;width:20px;height:20px;cursor:se-resize;background:linear-gradient(-45deg,transparent 40%,var(--nuraly-color-border,#e0e0e0) 40%,var(--nuraly-color-border,#e0e0e0) 60%,transparent 60%)}@media (max-width:768px){.modal-backdrop{padding:var(--nuraly-spacing-02,.25rem)}.modal--size-large,.modal--size-medium,.modal--size-small,.modal--size-xl{width:100%;max-width:none}.modal-body,.modal-footer,.modal-header{padding-left:var(--nuraly-spacing-04,.75rem);padding-right:var(--nuraly-spacing-04,.75rem)}}@media (prefers-color-scheme:dark){:host(:not([data-theme])){--nuraly-color-modal-backdrop:rgba(0, 0, 0, 0.6)}}`
437
7
  /**
438
8
  * @license
439
9
  * Copyright 2023 Nuraly, Laabidi Aymen
440
10
  * SPDX-License-Identifier: MIT
441
- */
442
- class{constructor(){this.modalStack=[],this.baseZIndex=1e3,this.zIndexIncrement=10,this.bodyScrollDisabled=!1,this.originalBodyOverflow=""}openModal(t){const i=this.generateModalId(),e=this.baseZIndex+this.modalStack.length*this.zIndexIncrement,s={modal:t,previousFocus:document.activeElement,zIndex:e,id:i};return this.modalStack.push(s),1===this.modalStack.length&&this.disableBodyScroll(),this.updateModalZIndex(t,e),console.log(`Modal opened. Stack depth: ${this.modalStack.length}, Z-Index: ${e}`),e}closeModal(t){const i=this.modalStack.findIndex((i=>i.modal===t));if(-1===i)return void console.warn("Attempting to close a modal that is not in the stack");const e=this.modalStack[i];if(i<this.modalStack.length-1){this.modalStack.slice(i+1).forEach((t=>{t.modal&&"function"==typeof t.modal.closeModal&&t.modal.closeModal()}))}this.modalStack.splice(i),e.previousFocus instanceof HTMLElement&&setTimeout((()=>{e.previousFocus instanceof HTMLElement&&e.previousFocus.focus()}),100),0===this.modalStack.length&&this.restoreBodyScroll(),console.log(`Modal closed. Stack depth: ${this.modalStack.length}`)}getModalZIndex(t){const i=this.modalStack.find((i=>i.modal===t));return i?i.zIndex:this.baseZIndex}isTopModal(t){return 0!==this.modalStack.length&&this.modalStack[this.modalStack.length-1].modal===t}getStackDepth(){return this.modalStack.length}closeAllModals(){[...this.modalStack].reverse().forEach((t=>{t.modal&&"function"==typeof t.modal.closeModal&&t.modal.closeModal()}))}getOpenModalIds(){return this.modalStack.map((t=>t.id))}hasOpenModals(){return this.modalStack.length>0}generateModalId(){return`modal-${Date.now()}-${Math.random().toString(36).substr(2,9)}`}updateModalZIndex(t,i){t&&t.style&&t.style.setProperty("--nuraly-z-modal-backdrop",i.toString())}disableBodyScroll(){this.bodyScrollDisabled||(this.originalBodyOverflow=document.body.style.overflow,document.body.style.overflow="hidden",this.bodyScrollDisabled=!0)}restoreBodyScroll(){this.bodyScrollDisabled&&(document.body.style.overflow=this.originalBodyOverflow,this.bodyScrollDisabled=!1)}handleEscapeKey(){if(0===this.modalStack.length)return!1;const t=this.modalStack[this.modalStack.length-1].modal;return!(!t||"function"!=typeof t.closeModal||!1===t.closable)&&(t.closeModal(),!0)}handleBackdropClick(t){return this.isTopModal(t)}};"undefined"!=typeof window&&(window.ModalManager=fi)
11
+ */;const $=new class{constructor(){this.modalStack=[],this.baseZIndex=1e3,this.zIndexIncrement=10,this.bodyScrollDisabled=!1,this.originalBodyOverflow=""}openModal(t){const a=this.generateModalId(),o=this.baseZIndex+this.modalStack.length*this.zIndexIncrement,e={modal:t,previousFocus:document.activeElement,zIndex:o,id:a};return this.modalStack.push(e),1===this.modalStack.length&&this.disableBodyScroll(),this.updateModalZIndex(t,o),console.log(`Modal opened. Stack depth: ${this.modalStack.length}, Z-Index: ${o}`),o}closeModal(t){const a=this.modalStack.findIndex((a=>a.modal===t));if(-1===a)return void console.warn("Attempting to close a modal that is not in the stack");const o=this.modalStack[a];if(a<this.modalStack.length-1){this.modalStack.slice(a+1).forEach((t=>{t.modal&&"function"==typeof t.modal.closeModal&&t.modal.closeModal()}))}this.modalStack.splice(a),o.previousFocus instanceof HTMLElement&&setTimeout((()=>{o.previousFocus instanceof HTMLElement&&o.previousFocus.focus()}),100),0===this.modalStack.length&&this.restoreBodyScroll(),console.log(`Modal closed. Stack depth: ${this.modalStack.length}`)}getModalZIndex(t){const a=this.modalStack.find((a=>a.modal===t));return a?a.zIndex:this.baseZIndex}isTopModal(t){return 0!==this.modalStack.length&&this.modalStack[this.modalStack.length-1].modal===t}getStackDepth(){return this.modalStack.length}closeAllModals(){[...this.modalStack].reverse().forEach((t=>{t.modal&&"function"==typeof t.modal.closeModal&&t.modal.closeModal()}))}getOpenModalIds(){return this.modalStack.map((t=>t.id))}hasOpenModals(){return this.modalStack.length>0}generateModalId(){return`modal-${Date.now()}-${Math.random().toString(36).substr(2,9)}`}updateModalZIndex(t,a){t&&t.style&&t.style.setProperty("--nuraly-z-modal-backdrop",a.toString())}disableBodyScroll(){this.bodyScrollDisabled||(this.originalBodyOverflow=document.body.style.overflow,document.body.style.overflow="hidden",this.bodyScrollDisabled=!0)}restoreBodyScroll(){this.bodyScrollDisabled&&(document.body.style.overflow=this.originalBodyOverflow,this.bodyScrollDisabled=!1)}handleEscapeKey(){if(0===this.modalStack.length)return!1;const t=this.modalStack[this.modalStack.length-1].modal;return!(!t||"function"!=typeof t.closeModal||!1===t.closable)&&(t.closeModal(),!0)}handleBackdropClick(t){return this.isTopModal(t)}};"undefined"!=typeof window&&(window.ModalManager=$)
443
12
  /**
444
13
  * @license
445
14
  * Copyright 2023 Nuraly, Laabidi Aymen
446
15
  * SPDX-License-Identifier: MIT
447
- */;class yi{constructor(t){this.initialX=0,this.initialY=0,this.dragHandle=null,this.handleMouseDown=t=>{var i;if(!this.host.modalDraggable)return;t.preventDefault(),this.host.isDragging=!0,this.initialX=t.clientX-this.host.offsetX,this.initialY=t.clientY-this.host.offsetY;const e=null===(i=this.host.shadowRoot)||void 0===i?void 0:i.querySelector(".modal");e&&e.classList.add("modal--dragging")},this.handleMouseMove=t=>{var i;if(!this.host.isDragging||!this.host.modalDraggable)return;t.preventDefault();const e=t.clientX-this.initialX,s=t.clientY-this.initialY,o=null===(i=this.host.shadowRoot)||void 0===i?void 0:i.querySelector(".modal");if(o){const t=o.getBoundingClientRect(),i=window.innerWidth,n=window.innerHeight,r=-t.width/2,a=i-t.width/2,l=-t.height/2,h=n-t.height/2;this.host.offsetX=Math.max(r,Math.min(a,e)),this.host.offsetY=Math.max(l,Math.min(h,s)),o.style.transform=`translate(${this.host.offsetX}px, ${this.host.offsetY}px)`}this.host.requestUpdate()},this.handleMouseUp=()=>{var t;if(!this.host.isDragging)return;this.host.isDragging=!1;const i=null===(t=this.host.shadowRoot)||void 0===t?void 0:t.querySelector(".modal");i&&i.classList.remove("modal--dragging"),this.host.requestUpdate()},this.host=t,this.host.addController(this)}hostConnected(){this.setupDragHandlers()}hostDisconnected(){this.cleanupDragHandlers()}setupDragHandlers(){requestAnimationFrame((()=>{var t;this.dragHandle=null===(t=this.host.shadowRoot)||void 0===t?void 0:t.querySelector(".modal-header--draggable"),this.dragHandle&&this.host.modalDraggable&&(this.dragHandle.addEventListener("mousedown",this.handleMouseDown),document.addEventListener("mousemove",this.handleMouseMove),document.addEventListener("mouseup",this.handleMouseUp))}))}cleanupDragHandlers(){this.dragHandle&&this.dragHandle.removeEventListener("mousedown",this.handleMouseDown),document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp)}resetPosition(){var t;this.host.offsetX=0,this.host.offsetY=0;const i=null===(t=this.host.shadowRoot)||void 0===t?void 0:t.querySelector(".modal");i&&(i.style.transform="none"),this.host.requestUpdate()}}
16
+ */;class M{constructor(t){this.initialX=0,this.initialY=0,this.dragHandle=null,this.handleMouseDown=t=>{var a;if(!this.host.modalDraggable)return;t.preventDefault(),this.host.isDragging=!0,this.initialX=t.clientX-this.host.offsetX,this.initialY=t.clientY-this.host.offsetY;const o=null===(a=this.host.shadowRoot)||void 0===a?void 0:a.querySelector(".modal");o&&o.classList.add("modal--dragging")},this.handleMouseMove=t=>{var a;if(!this.host.isDragging||!this.host.modalDraggable)return;t.preventDefault();const o=t.clientX-this.initialX,e=t.clientY-this.initialY,i=null===(a=this.host.shadowRoot)||void 0===a?void 0:a.querySelector(".modal");if(i){const t=i.getBoundingClientRect(),a=window.innerWidth,r=window.innerHeight,s=-t.width/2,n=a-t.width/2,l=-t.height/2,d=r-t.height/2;this.host.offsetX=Math.max(s,Math.min(n,o)),this.host.offsetY=Math.max(l,Math.min(d,e)),i.style.transform=`translate(${this.host.offsetX}px, ${this.host.offsetY}px)`}this.host.requestUpdate()},this.handleMouseUp=()=>{var t;if(!this.host.isDragging)return;this.host.isDragging=!1;const a=null===(t=this.host.shadowRoot)||void 0===t?void 0:t.querySelector(".modal");a&&a.classList.remove("modal--dragging"),this.host.requestUpdate()},this.host=t,this.host.addController(this)}hostConnected(){this.setupDragHandlers()}hostDisconnected(){this.cleanupDragHandlers()}setupDragHandlers(){requestAnimationFrame((()=>{var t;this.dragHandle=null===(t=this.host.shadowRoot)||void 0===t?void 0:t.querySelector(".modal-header--draggable"),this.dragHandle&&this.host.modalDraggable&&(this.dragHandle.addEventListener("mousedown",this.handleMouseDown),document.addEventListener("mousemove",this.handleMouseMove),document.addEventListener("mouseup",this.handleMouseUp))}))}cleanupDragHandlers(){this.dragHandle&&this.dragHandle.removeEventListener("mousedown",this.handleMouseDown),document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp)}resetPosition(){var t;this.host.offsetX=0,this.host.offsetY=0;const a=null===(t=this.host.shadowRoot)||void 0===t?void 0:t.querySelector(".modal");a&&(a.style.transform="none"),this.host.requestUpdate()}}
448
17
  /**
449
18
  * @license
450
19
  * Copyright 2023 Nuraly, Laabidi Aymen
451
20
  * SPDX-License-Identifier: MIT
452
- */class gi{constructor(t){this.handleKeyDown=t=>{if(this.host.open)switch(t.key){case"Escape":if(this.host.closable){t.preventDefault(),t.stopPropagation();if(!fi.handleEscapeKey()){const t=new CustomEvent("modal-escape",{bubbles:!0,cancelable:!0});this.host.dispatchEvent(t)&&this.host.closeModal()}}break;case"Tab":fi.isTopModal(this.host)&&this.handleTabNavigation(t)}},this.host=t,this.host.addController(this)}hostConnected(){document.addEventListener("keydown",this.handleKeyDown)}hostDisconnected(){document.removeEventListener("keydown",this.handleKeyDown)}handleTabNavigation(t){var i;const e=null===(i=this.host.shadowRoot)||void 0===i?void 0:i.querySelector(".modal");if(!e)return;const s=this.getFocusableElements(e);if(0===s.length)return;const o=s[0],n=s[s.length-1];t.shiftKey?document.activeElement===o&&(t.preventDefault(),n.focus()):document.activeElement===n&&(t.preventDefault(),o.focus())}getFocusableElements(t){const i=["a[href]","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])",'[tabindex]:not([tabindex="-1"])','[contenteditable="true"]'].join(", ");return Array.from(t.querySelectorAll(i)).filter((t=>t.offsetWidth>0&&t.offsetHeight>0&&!t.hidden&&"hidden"!==getComputedStyle(t).visibility))}focusFirstElement(){var t;const i=null===(t=this.host.shadowRoot)||void 0===t?void 0:t.querySelector(".modal");if(!i)return;const e=this.getFocusableElements(i);e.length>0?e[0].focus():i.focus()}focusLastElement(){var t;const i=null===(t=this.host.shadowRoot)||void 0===t?void 0:t.querySelector(".modal");if(!i)return;const e=this.getFocusableElements(i);e.length>0&&e[e.length-1].focus()}}
21
+ */class C{constructor(t){this.handleKeyDown=t=>{if(this.host.open)switch(t.key){case"Escape":if(this.host.closable){t.preventDefault(),t.stopPropagation();if(!$.handleEscapeKey()){const t=new CustomEvent("modal-escape",{bubbles:!0,cancelable:!0});this.host.dispatchEvent(t)&&this.host.closeModal()}}break;case"Tab":$.isTopModal(this.host)&&this.handleTabNavigation(t)}},this.host=t,this.host.addController(this)}hostConnected(){document.addEventListener("keydown",this.handleKeyDown)}hostDisconnected(){document.removeEventListener("keydown",this.handleKeyDown)}handleTabNavigation(t){var a;const o=null===(a=this.host.shadowRoot)||void 0===a?void 0:a.querySelector(".modal");if(!o)return;const e=this.getFocusableElements(o);if(0===e.length)return;const i=e[0],r=e[e.length-1];t.shiftKey?document.activeElement===i&&(t.preventDefault(),r.focus()):document.activeElement===r&&(t.preventDefault(),i.focus())}getFocusableElements(t){const a=["a[href]","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])",'[tabindex]:not([tabindex="-1"])','[contenteditable="true"]'].join(", ");return Array.from(t.querySelectorAll(a)).filter((t=>t.offsetWidth>0&&t.offsetHeight>0&&!t.hidden&&"hidden"!==getComputedStyle(t).visibility))}focusFirstElement(){var t;const a=null===(t=this.host.shadowRoot)||void 0===t?void 0:t.querySelector(".modal");if(!a)return;const o=this.getFocusableElements(a);o.length>0?o[0].focus():a.focus()}focusLastElement(){var t;const a=null===(t=this.host.shadowRoot)||void 0===t?void 0:t.querySelector(".modal");if(!a)return;const o=this.getFocusableElements(a);o.length>0&&o[o.length-1].focus()}}
453
22
  /**
454
23
  * @license
455
24
  * Copyright 2023 Nuraly, Laabidi Aymen
456
25
  * SPDX-License-Identifier: MIT
457
- */var bi=function(t,i,e,s){for(var o,n=arguments.length,r=n<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s,a=t.length-1;a>=0;a--)(o=t[a])&&(r=(n<3?o(r):n>3?o(i,e,r):o(i,e))||r);return n>3&&r&&Object.defineProperty(i,e,r),r};let wi=class extends((t=>mi(ui(pi(t))))(Rt)){constructor(){super(...arguments),this.open=!1,this.size=Gt.Medium,this.position=Qt.Center,this.animation=ti.Fade,this.backdrop=ii.Closable,this.closable=!0,this.modalDraggable=!1,this.resizable=!1,this.fullscreen=!1,this.modalTitle=ei,this.showCloseButton=!0,this.headerIcon=ei,this.zIndex=1e3,this.width=ei,this.height=ei,this.isDragging=!1,this.offsetX=0,this.offsetY=0,this.animationState="closed",this.previousActiveElement=null,this.requiredComponents=["nr-icon","nr-button"],this.dragController=new yi(this),this.keyboardController=new gi(this),this.handleBackdropClick=t=>{this.backdrop===ii.Closable&&t.target===t.currentTarget&&fi.handleBackdropClick(this)&&this.closeModal()}}connectedCallback(){super.connectedCallback(),this.validateDependencies()}disconnectedCallback(){super.disconnectedCallback(),this.previousActiveElement instanceof HTMLElement&&this.previousActiveElement.focus()}willUpdate(t){super.willUpdate(t),t.has("open")&&(this.open?this.handleOpen():this.handleClose())}handleOpen(){const t=fi.openModal(this);this.zIndex=t,this.animationState="opening",this.dispatchEvent(new CustomEvent("modal-open",{bubbles:!0,detail:{modal:this,stackDepth:fi.getStackDepth()}})),this.updateComplete.then((()=>{this.startOpenAnimation()}))}startOpenAnimation(){var t,i;const e=null===(t=this.shadowRoot)||void 0===t?void 0:t.querySelector(".modal"),s=null===(i=this.shadowRoot)||void 0===i?void 0:i.querySelector(".modal-backdrop");if(!e||!s)return;const{modalKeyframes:o}=this.getAnimationKeyframes();e.animate(o,{duration:300,easing:"ease",fill:"forwards"}).addEventListener("finish",(()=>{this.animationState="open",fi.isTopModal(this)&&this.keyboardController.focusFirstElement(),this.dispatchEvent(new CustomEvent("modal-after-open",{bubbles:!0,detail:{modal:this,stackDepth:fi.getStackDepth()}}))}))}getAnimationKeyframes(){let t;switch(this.animation){case"fade":default:t=[{opacity:0,transform:"scale(0.9)"},{opacity:1,transform:"scale(1)"}];break;case"zoom":t=[{opacity:0,transform:"scale(0.7)"},{opacity:1,transform:"scale(1)"}];break;case"slide-up":t=[{opacity:0,transform:"translateY(20px)"},{opacity:1,transform:"translateY(0)"}];break;case"slide-down":t=[{opacity:0,transform:"translateY(-20px)"},{opacity:1,transform:"translateY(0)"}]}return{modalKeyframes:t,backdropKeyframes:[{opacity:0},{opacity:1}]}}handleClose(){this.animationState="closing",fi.closeModal(this),this.dragController.resetPosition(),setTimeout((()=>{this.animationState="closed"}),300)}openModal(){this.open=!0}closeModal(){if(!this.closable)return;const t=new CustomEvent("modal-before-close",{bubbles:!0,cancelable:!0,detail:{modal:this,cancel:()=>t.preventDefault()}});this.dispatchEvent(t)&&(this.open=!1,this.dispatchEvent(new CustomEvent("modal-close",{bubbles:!0,detail:{modal:this}})))}getBackdropClasses(){return{"modal-backdrop":!0,"modal-backdrop--hidden":!this.open,[`modal-backdrop--position-${this.position}`]:!0}}getModalClasses(){return{modal:!0,[`modal--size-${this.size}`]:!this.fullscreen,"modal--fullscreen":this.fullscreen,[`modal--animation-${this.animation}`]:"opening"===this.animationState||"open"===this.animationState,"modal--dragging":this.isDragging,"modal--resizable":this.resizable}}getModalStyles(){const t={};return this.zIndex&&(t["--nuraly-z-modal-backdrop"]=this.zIndex.toString()),this.width&&(t.width=this.width),this.height&&(t.height=this.height),t}renderHeader(){const t=this.querySelector('[slot="header"]'),i=this.modalTitle||this.headerIcon;return t||i||this.showCloseButton?gt`
458
- <div class="modal-header ${this.modalDraggable?"modal-header--draggable":""}">
459
- ${t?gt`
460
- <div class="modal-header-content">
461
- <slot name="header"></slot>
462
- </div>
463
- `:i?gt`
464
- <div class="modal-header-content">
465
- ${this.headerIcon?gt`
466
- <nr-icon class="modal-header-icon" name="${this.headerIcon}"></nr-icon>
467
- `:wt}
468
- ${this.modalTitle?gt`
469
- <h2 class="modal-title">${this.modalTitle}</h2>
470
- `:wt}
471
- </div>
472
- `:wt}
473
-
474
- ${this.showCloseButton?gt`
475
- <button
476
- class="modal-close-button"
477
- @click=${this.closeModal}
478
- aria-label="Close modal"
479
- type="button">
480
- <nr-icon class="modal-close-icon" name="close"></nr-icon>
481
- </button>
482
- `:wt}
483
- </div>
484
- `:wt}renderFooter(){return this.querySelector('[slot="footer"]')?gt`
485
- <div class="modal-footer">
486
- <slot name="footer"></slot>
487
- </div>
488
- `:wt}updated(){this.updateDataTheme()}updateDataTheme(){this.closest("[data-theme]")||this.setAttribute("data-theme",this.currentTheme)}render(){return this.open||"closed"!==this.animationState?gt`
489
- <div
490
- class=${Vt(this.getBackdropClasses())}
491
- @click=${this.handleBackdropClick}
492
- style=${Xt(this.getModalStyles())}>
493
-
494
- <div
495
- class=${Vt(this.getModalClasses())}
496
- role="dialog"
497
- aria-modal="true"
498
- aria-labelledby=${this.modalTitle?"modal-title":wt}
499
- tabindex="-1">
500
-
501
- ${this.renderHeader()}
502
-
503
- <div class="modal-body">
504
- <slot></slot>
505
- </div>
506
-
507
- ${this.renderFooter()}
508
-
509
- ${this.resizable?gt`
510
- <div class="resize-handle"></div>
511
- `:wt}
512
- </div>
513
- </div>
514
- `:wt}};wi.styles=ci,bi([Ht({type:Boolean,reflect:!0})],wi.prototype,"open",void 0),bi([Ht({type:String})],wi.prototype,"size",void 0),bi([Ht({type:String})],wi.prototype,"position",void 0),bi([Ht({type:String})],wi.prototype,"animation",void 0),bi([Ht({type:String})],wi.prototype,"backdrop",void 0),bi([Ht({type:Boolean})],wi.prototype,"closable",void 0),bi([Ht({type:Boolean})],wi.prototype,"modalDraggable",void 0),bi([Ht({type:Boolean})],wi.prototype,"resizable",void 0),bi([Ht({type:Boolean})],wi.prototype,"fullscreen",void 0),bi([Ht({type:String})],wi.prototype,"modalTitle",void 0),bi([Ht({type:Boolean,attribute:"show-close-button"})],wi.prototype,"showCloseButton",void 0),bi([Ht({type:String})],wi.prototype,"headerIcon",void 0),bi([Ht({type:Number})],wi.prototype,"zIndex",void 0),bi([Ht({type:String})],wi.prototype,"width",void 0),bi([Ht({type:String})],wi.prototype,"height",void 0),bi([Lt()],wi.prototype,"isDragging",void 0),bi([Ht({type:Number})],wi.prototype,"offsetX",void 0),bi([Ht({type:Number})],wi.prototype,"offsetY",void 0),bi([Lt()],wi.prototype,"animationState",void 0),wi=bi([(t=>i=>"function"==typeof i?((t,i)=>(customElements.define(t,i),i))(t,i):((t,i)=>{const{kind:e,elements:s}=i;return{kind:e,elements:s,finisher(i){customElements.define(t,i)}}})(t,i))("nr-modal")],wi);export{li as DEFAULT_MODAL_CONFIG,di as DEFAULT_MODAL_FOOTER,hi as DEFAULT_MODAL_HEADER,si as DEFAULT_Z_INDEX,ei as EMPTY_STRING,ti as ModalAnimation,ii as ModalBackdrop,yi as ModalDragController,gi as ModalKeyboardController,fi as ModalManager,Qt as ModalPosition,Gt as ModalSize,wi as NrModalElement,ri as isModalAnimation,ai as isModalBackdrop,ni as isModalPosition,oi as isModalSize};
26
+ */var S=function(t,a,o,e){for(var i,r=arguments.length,s=r<3?a:null===e?e=Object.getOwnPropertyDescriptor(a,o):e,n=t.length-1;n>=0;n--)(i=t[n])&&(s=(r<3?i(s):r>3?i(a,o,s):i(a,o))||s);return r>3&&s&&Object.defineProperty(a,o,s),s};let I=class extends(d(a)){constructor(){super(...arguments),this.open=!1,this.size=h.Medium,this.position=c.Center,this.animation=m.Fade,this.backdrop=u.Closable,this.closable=!0,this.modalDraggable=!1,this.resizable=!1,this.fullscreen=!1,this.modalTitle=p,this.showCloseButton=!0,this.headerIcon=p,this.zIndex=1e3,this.width=p,this.height=p,this.isDragging=!1,this.offsetX=0,this.offsetY=0,this.animationState="closed",this.previousActiveElement=null,this.requiredComponents=["nr-icon","nr-button"],this.dragController=new M(this),this.keyboardController=new C(this),this.handleBackdropClick=t=>{this.backdrop===u.Closable&&t.target===t.currentTarget&&$.handleBackdropClick(this)&&this.closeModal()}}connectedCallback(){super.connectedCallback(),this.validateDependencies()}disconnectedCallback(){super.disconnectedCallback(),this.previousActiveElement instanceof HTMLElement&&this.previousActiveElement.focus()}willUpdate(t){super.willUpdate(t),t.has("open")&&(this.open?this.handleOpen():this.handleClose())}handleOpen(){const t=$.openModal(this);this.zIndex=t,this.animationState="opening",this.dispatchEvent(new CustomEvent("modal-open",{bubbles:!0,detail:{modal:this,stackDepth:$.getStackDepth()}})),this.updateComplete.then((()=>{this.startOpenAnimation()}))}startOpenAnimation(){var t,a;const o=null===(t=this.shadowRoot)||void 0===t?void 0:t.querySelector(".modal"),e=null===(a=this.shadowRoot)||void 0===a?void 0:a.querySelector(".modal-backdrop");if(!o||!e)return;const{modalKeyframes:i}=this.getAnimationKeyframes();o.animate(i,{duration:300,easing:"ease",fill:"forwards"}).addEventListener("finish",(()=>{this.animationState="open",$.isTopModal(this)&&this.keyboardController.focusFirstElement(),this.dispatchEvent(new CustomEvent("modal-after-open",{bubbles:!0,detail:{modal:this,stackDepth:$.getStackDepth()}}))}))}getAnimationKeyframes(){let t;switch(this.animation){case"fade":default:t=[{opacity:0,transform:"scale(0.9)"},{opacity:1,transform:"scale(1)"}];break;case"zoom":t=[{opacity:0,transform:"scale(0.7)"},{opacity:1,transform:"scale(1)"}];break;case"slide-up":t=[{opacity:0,transform:"translateY(20px)"},{opacity:1,transform:"translateY(0)"}];break;case"slide-down":t=[{opacity:0,transform:"translateY(-20px)"},{opacity:1,transform:"translateY(0)"}]}return{modalKeyframes:t,backdropKeyframes:[{opacity:0},{opacity:1}]}}handleClose(){this.animationState="closing",$.closeModal(this),this.dragController.resetPosition(),setTimeout((()=>{this.animationState="closed"}),300)}openModal(){this.open=!0}closeModal(){if(!this.closable)return;const t=new CustomEvent("modal-before-close",{bubbles:!0,cancelable:!0,detail:{modal:this,cancel:()=>t.preventDefault()}});this.dispatchEvent(t)&&(this.open=!1,this.dispatchEvent(new CustomEvent("modal-close",{bubbles:!0,detail:{modal:this}})))}getBackdropClasses(){return{"modal-backdrop":!0,"modal-backdrop--hidden":!this.open,[`modal-backdrop--position-${this.position}`]:!0}}getModalClasses(){return{modal:!0,[`modal--size-${this.size}`]:!this.fullscreen,"modal--fullscreen":this.fullscreen,[`modal--animation-${this.animation}`]:"opening"===this.animationState||"open"===this.animationState,"modal--dragging":this.isDragging,"modal--resizable":this.resizable}}getModalStyles(){const t={};return this.zIndex&&(t["--nuraly-z-modal-backdrop"]=this.zIndex.toString()),this.width&&(t.width=this.width),this.height&&(t.height=this.height),t}renderHeader(){const t=this.querySelector('[slot="header"]'),a=this.modalTitle||this.headerIcon;return t||a||this.showCloseButton?e`<div class="modal-header ${this.modalDraggable?"modal-header--draggable":""}">${t?e`<div class="modal-header-content"><slot name="header"></slot></div>`:a?e`<div class="modal-header-content">${this.headerIcon?e`<nr-icon class="modal-header-icon" name="${this.headerIcon}"></nr-icon>`:o} ${this.modalTitle?e`<h2 class="modal-title">${this.modalTitle}</h2>`:o}</div>`:o} ${this.showCloseButton?e`<button class="modal-close-button" @click="${this.closeModal}" aria-label="Close modal" type="button"><nr-icon class="modal-close-icon" name="close"></nr-icon></button>`:o}</div>`:o}renderFooter(){return this.querySelector('[slot="footer"]')?e`<div class="modal-footer"><slot name="footer"></slot></div>`:o}updated(){this.updateDataTheme()}updateDataTheme(){this.closest("[data-theme]")||this.setAttribute("data-theme",this.currentTheme)}render(){return this.open||"closed"!==this.animationState?e`<div class="${n(this.getBackdropClasses())}" @click="${this.handleBackdropClick}" style="${l(this.getModalStyles())}"><div class="${n(this.getModalClasses())}" role="dialog" aria-modal="true" aria-labelledby="${this.modalTitle?"modal-title":o}" tabindex="-1">${this.renderHeader()}<div class="modal-body"><slot></slot></div>${this.renderFooter()} ${this.resizable?e`<div class="resize-handle"></div>`:o}</div></div>`:o}};I.styles=z,S([i({type:Boolean,reflect:!0})],I.prototype,"open",void 0),S([i({type:String})],I.prototype,"size",void 0),S([i({type:String})],I.prototype,"position",void 0),S([i({type:String})],I.prototype,"animation",void 0),S([i({type:String})],I.prototype,"backdrop",void 0),S([i({type:Boolean})],I.prototype,"closable",void 0),S([i({type:Boolean})],I.prototype,"modalDraggable",void 0),S([i({type:Boolean})],I.prototype,"resizable",void 0),S([i({type:Boolean})],I.prototype,"fullscreen",void 0),S([i({type:String})],I.prototype,"modalTitle",void 0),S([i({type:Boolean,attribute:"show-close-button"})],I.prototype,"showCloseButton",void 0),S([i({type:String})],I.prototype,"headerIcon",void 0),S([i({type:Number})],I.prototype,"zIndex",void 0),S([i({type:String})],I.prototype,"width",void 0),S([i({type:String})],I.prototype,"height",void 0),S([r()],I.prototype,"isDragging",void 0),S([i({type:Number})],I.prototype,"offsetX",void 0),S([i({type:Number})],I.prototype,"offsetY",void 0),S([r()],I.prototype,"animationState",void 0),I=S([s("nr-modal")],I);export{x as DEFAULT_MODAL_CONFIG,k as DEFAULT_MODAL_FOOTER,w as DEFAULT_MODAL_HEADER,v as DEFAULT_Z_INDEX,p as EMPTY_STRING,m as ModalAnimation,u as ModalBackdrop,M as ModalDragController,C as ModalKeyboardController,$ as ModalManager,c as ModalPosition,h as ModalSize,I as NrModalElement,g as isModalAnimation,f as isModalBackdrop,b as isModalPosition,y as isModalSize};
@@ -115,7 +115,7 @@ export declare class NrModalElement extends NrModalElement_base implements Modal
115
115
  private renderFooter;
116
116
  updated(): void;
117
117
  private updateDataTheme;
118
- render(): import("lit").TemplateResult<1> | typeof nothing;
118
+ render(): typeof nothing | import("lit").TemplateResult<1>;
119
119
  }
120
120
  export {};
121
121
  //# sourceMappingURL=modal.component.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuralyui/modal",
3
- "version": "0.0.6",
3
+ "version": "0.0.7",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "type": "module",