@nuralyui/alert 0.0.4 → 0.0.5

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.
Files changed (2) hide show
  1. package/bundle.js +4 -278
  2. package/package.json +1 -1
package/bundle.js CHANGED
@@ -1,291 +1,17 @@
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,s=Symbol(),e=new WeakMap;class n{constructor(t,i,e){if(this._$cssResult$=!0,e!==s)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=i}get styleSheet(){let t=this.o;const s=this.t;if(i&&void 0===t){const i=void 0!==s&&1===s.length;i&&(t=e.get(s)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),i&&e.set(s,t))}return t}toString(){return this.cssText}}const r=i?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let i="";for(const s of t.cssRules)i+=s.cssText;return(t=>new n("string"==typeof t?t:t+"",void 0,s))(i)})(t):t
7
- /**
8
- * @license
9
- * Copyright 2017 Google LLC
10
- * SPDX-License-Identifier: BSD-3-Clause
11
- */;var o;const l=window,h=l.trustedTypes,a=h?h.emptyScript:"",c=l.reactiveElementPolyfillSupport,d={toAttribute(t,i){switch(i){case Boolean:t=t?a:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,i){let s=t;switch(i){case Boolean:s=null!==t;break;case Number:s=null===t?null:Number(t);break;case Object:case Array:try{s=JSON.parse(t)}catch(t){s=null}}return s}},u=(t,i)=>i!==t&&(i==i||t==t),v={attribute:!0,type:String,converter:d,reflect:!1,hasChanged:u},f="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,s)=>{const e=this._$Ep(s,i);void 0!==e&&(this._$Ev.set(e,s),t.push(e))})),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 s="symbol"==typeof t?Symbol():"__"+t,e=this.getPropertyDescriptor(t,s,i);void 0!==e&&Object.defineProperty(this.prototype,t,e)}}static getPropertyDescriptor(t,i,s){return{get(){return this[i]},set(e){const n=this[t];this[i]=e,this.requestUpdate(t,n,s)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)||v}static finalize(){if(this.hasOwnProperty(f))return!1;this[f]=!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 s of i)this.createProperty(s,t[s])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(t){const i=[];if(Array.isArray(t)){const s=new Set(t.flat(1/0).reverse());for(const t of s)i.unshift(r(t))}else void 0!==t&&i.push(r(t));return i}static _$Ep(t,i){const s=i.attribute;return!1===s?void 0:"string"==typeof s?s:"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,s;(null!==(i=this._$ES)&&void 0!==i?i:this._$ES=[]).push(t),void 0!==this.renderRoot&&this.isConnected&&(null===(s=t.hostConnected)||void 0===s||s.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 s;const e=null!==(s=this.shadowRoot)&&void 0!==s?s:this.attachShadow(this.constructor.shadowRootOptions);return((s,e)=>{i?s.adoptedStyleSheets=e.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet)):e.forEach((i=>{const e=document.createElement("style"),n=t.litNonce;void 0!==n&&e.setAttribute("nonce",n),e.textContent=i.cssText,s.appendChild(e)}))})(e,this.constructor.elementStyles),e}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,s){this._$AK(t,s)}_$EO(t,i,s=v){var e;const n=this.constructor._$Ep(t,s);if(void 0!==n&&!0===s.reflect){const r=(void 0!==(null===(e=s.converter)||void 0===e?void 0:e.toAttribute)?s.converter:d).toAttribute(i,s.type);this._$El=t,null==r?this.removeAttribute(n):this.setAttribute(n,r),this._$El=null}}_$AK(t,i){var s;const e=this.constructor,n=e._$Ev.get(t);if(void 0!==n&&this._$El!==n){const t=e.getPropertyOptions(n),r="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==(null===(s=t.converter)||void 0===s?void 0:s.fromAttribute)?t.converter:d;this._$El=n,this[n]=r.fromAttribute(i,t.type),this._$El=null}}requestUpdate(t,i,s){let e=!0;void 0!==t&&(((s=s||this.constructor.getPropertyOptions(t)).hasChanged||u)(this[t],i)?(this._$AL.has(t)||this._$AL.set(t,i),!0===s.reflect&&this._$El!==t&&(void 0===this._$EC&&(this._$EC=new Map),this._$EC.set(t,s))):e=!1),!this.isUpdatePending&&e&&(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 s=this._$AL;try{i=this.shouldUpdate(s),i?(this.willUpdate(s),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(s)):this._$Ek()}catch(t){throw i=!1,this._$Ek(),t}i&&this._$AE(s)}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 g;p[f]=!0,p.elementProperties=new Map,p.elementStyles=[],p.shadowRootOptions={mode:"open"},null==c||c({ReactiveElement:p}),(null!==(o=l.reactiveElementVersions)&&void 0!==o?o:l.reactiveElementVersions=[]).push("1.6.3");const y=window,m=y.trustedTypes,b=m?m.createPolicy("lit-html",{createHTML:t=>t}):void 0,w="$lit$",$=`lit$${(Math.random()+"").slice(9)}$`,_="?"+$,A=`<${_}>`,S=document,x=()=>S.createComment(""),E=t=>null===t||"object"!=typeof t&&"function"!=typeof t,k=Array.isArray,C="[ \t\n\f\r]",j=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,O=/-->/g,T=/>/g,U=RegExp(`>|${C}(?:([^\\s"'>=/]+)(${C}*=${C}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),M=/'/g,z=/"/g,R=/^(?:script|style|textarea|title)$/i,N=Symbol.for("lit-noChange"),D=Symbol.for("lit-nothing"),I=new WeakMap,P=S.createTreeWalker(S,129,null,!1);function L(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},s){let e;this.parts=[];let n=0,r=0;const o=t.length-1,l=this.parts,[h,a]=((t,i)=>{const s=t.length-1,e=[];let n,r=2===i?"<svg>":"",o=j;for(let i=0;i<s;i++){const s=t[i];let l,h,a=-1,c=0;for(;c<s.length&&(o.lastIndex=c,h=o.exec(s),null!==h);)c=o.lastIndex,o===j?"!--"===h[1]?o=O:void 0!==h[1]?o=T:void 0!==h[2]?(R.test(h[2])&&(n=RegExp("</"+h[2],"g")),o=U):void 0!==h[3]&&(o=U):o===U?">"===h[0]?(o=null!=n?n:j,a=-1):void 0===h[1]?a=-2:(a=o.lastIndex-h[2].length,l=h[1],o=void 0===h[3]?U:'"'===h[3]?z:M):o===z||o===M?o=U:o===O||o===T?o=j:(o=U,n=void 0);const d=o===U&&t[i+1].startsWith("/>")?" ":"";r+=o===j?s+A:a>=0?(e.push(l),s.slice(0,a)+w+s.slice(a)+$+d):s+$+(-2===a?(e.push(void 0),i):d)}return[L(t,r+(t[s]||"<?>")+(2===i?"</svg>":"")),e]})(t,i);if(this.el=K.createElement(h,s),P.currentNode=this.el.content,2===i){const t=this.el.content,i=t.firstChild;i.remove(),t.append(...i.childNodes)}for(;null!==(e=P.nextNode())&&l.length<o;){if(1===e.nodeType){if(e.hasAttributes()){const t=[];for(const i of e.getAttributeNames())if(i.endsWith(w)||i.startsWith($)){const s=a[r++];if(t.push(i),void 0!==s){const t=e.getAttribute(s.toLowerCase()+w).split($),i=/([.?@])?(.*)/.exec(s);l.push({type:1,index:n,name:i[2],strings:t,ctor:"."===i[1]?H:"?"===i[1]?Z:"@"===i[1]?J:F})}else l.push({type:6,index:n})}for(const i of t)e.removeAttribute(i)}if(R.test(e.tagName)){const t=e.textContent.split($),i=t.length-1;if(i>0){e.textContent=m?m.emptyScript:"";for(let s=0;s<i;s++)e.append(t[s],x()),P.nextNode(),l.push({type:2,index:++n});e.append(t[i],x())}}}else if(8===e.nodeType)if(e.data===_)l.push({type:2,index:n});else{let t=-1;for(;-1!==(t=e.data.indexOf($,t+1));)l.push({type:7,index:n}),t+=$.length-1}n++}}static createElement(t,i){const s=S.createElement("template");return s.innerHTML=t,s}}function W(t,i,s=t,e){var n,r,o,l;if(i===N)return i;let h=void 0!==e?null===(n=s._$Co)||void 0===n?void 0:n[e]:s._$Cl;const a=E(i)?void 0:i._$litDirective$;return(null==h?void 0:h.constructor)!==a&&(null===(r=null==h?void 0:h._$AO)||void 0===r||r.call(h,!1),void 0===a?h=void 0:(h=new a(t),h._$AT(t,s,e)),void 0!==e?(null!==(o=(l=s)._$Co)&&void 0!==o?o:l._$Co=[])[e]=h:s._$Cl=h),void 0!==h&&(i=W(t,h._$AS(t,i.values),h,e)),i}class q{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:s},parts:e}=this._$AD,n=(null!==(i=null==t?void 0:t.creationScope)&&void 0!==i?i:S).importNode(s,!0);P.currentNode=n;let r=P.nextNode(),o=0,l=0,h=e[0];for(;void 0!==h;){if(o===h.index){let i;2===h.type?i=new B(r,r.nextSibling,this,t):1===h.type?i=new h.ctor(r,h.name,h.strings,this,t):6===h.type&&(i=new G(r,this,t)),this._$AV.push(i),h=e[++l]}o!==(null==h?void 0:h.index)&&(r=P.nextNode(),o++)}return P.currentNode=S,n}v(t){let i=0;for(const s of this._$AV)void 0!==s&&(void 0!==s.strings?(s._$AI(t,s,i),i+=s.strings.length-2):s._$AI(t[i])),i++}}class B{constructor(t,i,s,e){var n;this.type=2,this._$AH=D,this._$AN=void 0,this._$AA=t,this._$AB=i,this._$AM=s,this.options=e,this._$Cp=null===(n=null==e?void 0:e.isConnected)||void 0===n||n}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=W(this,t,i),E(t)?t===D||null==t||""===t?(this._$AH!==D&&this._$AR(),this._$AH=D):t!==this._$AH&&t!==N&&this._(t):void 0!==t._$litType$?this.g(t):void 0!==t.nodeType?this.$(t):(t=>k(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!==D&&E(this._$AH)?this._$AA.nextSibling.data=t:this.$(S.createTextNode(t)),this._$AH=t}g(t){var i;const{values:s,_$litType$:e}=t,n="number"==typeof e?this._$AC(t):(void 0===e.el&&(e.el=K.createElement(L(e.h,e.h[0]),this.options)),e);if((null===(i=this._$AH)||void 0===i?void 0:i._$AD)===n)this._$AH.v(s);else{const t=new q(n,this),i=t.u(this.options);t.v(s),this.$(i),this._$AH=t}}_$AC(t){let i=I.get(t.strings);return void 0===i&&I.set(t.strings,i=new K(t)),i}T(t){k(this._$AH)||(this._$AH=[],this._$AR());const i=this._$AH;let s,e=0;for(const n of t)e===i.length?i.push(s=new B(this.k(x()),this.k(x()),this,this.options)):s=i[e],s._$AI(n),e++;e<i.length&&(this._$AR(s&&s._$AB.nextSibling,e),i.length=e)}_$AR(t=this._$AA.nextSibling,i){var s;for(null===(s=this._$AP)||void 0===s||s.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 F{constructor(t,i,s,e,n){this.type=1,this._$AH=D,this._$AN=void 0,this.element=t,this.name=i,this._$AM=e,this.options=n,s.length>2||""!==s[0]||""!==s[1]?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=D}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(t,i=this,s,e){const n=this.strings;let r=!1;if(void 0===n)t=W(this,t,i,0),r=!E(t)||t!==this._$AH&&t!==N,r&&(this._$AH=t);else{const e=t;let o,l;for(t=n[0],o=0;o<n.length-1;o++)l=W(this,e[s+o],i,o),l===N&&(l=this._$AH[o]),r||(r=!E(l)||l!==this._$AH[o]),l===D?t=D:t!==D&&(t+=(null!=l?l:"")+n[o+1]),this._$AH[o]=l}r&&!e&&this.j(t)}j(t){t===D?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,null!=t?t:"")}}class H extends F{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===D?void 0:t}}const V=m?m.emptyScript:"";class Z extends F{constructor(){super(...arguments),this.type=4}j(t){t&&t!==D?this.element.setAttribute(this.name,V):this.element.removeAttribute(this.name)}}class J extends F{constructor(t,i,s,e,n){super(t,i,s,e,n),this.type=5}_$AI(t,i=this){var s;if((t=null!==(s=W(this,t,i,0))&&void 0!==s?s:D)===N)return;const e=this._$AH,n=t===D&&e!==D||t.capture!==e.capture||t.once!==e.once||t.passive!==e.passive,r=t!==D&&(e===D||n);n&&this.element.removeEventListener(this.name,this,e),r&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var i,s;"function"==typeof this._$AH?this._$AH.call(null!==(s=null===(i=this.options)||void 0===i?void 0:i.host)&&void 0!==s?s:this.element,t):this._$AH.handleEvent(t)}}class G{constructor(t,i,s){this.element=t,this.type=6,this._$AN=void 0,this._$AM=i,this.options=s}get _$AU(){return this._$AM._$AU}_$AI(t){W(this,t)}}const Q=y.litHtmlPolyfillSupport;
18
- /**
19
- * @license
20
- * Copyright 2017 Google LLC
21
- * SPDX-License-Identifier: BSD-3-Clause
22
- */
23
- var X;null==Q||Q(K,B),(null!==(g=y.litHtmlVersions)&&void 0!==g?g:y.litHtmlVersions=[]).push("2.8.0");const Y=window,tt=Y.trustedTypes,it=tt?tt.createPolicy("lit-html",{createHTML:t=>t}):void 0,st="$lit$",et=`lit$${(Math.random()+"").slice(9)}$`,nt="?"+et,rt=`<${nt}>`,ot=document,lt=()=>ot.createComment(""),ht=t=>null===t||"object"!=typeof t&&"function"!=typeof t,at=Array.isArray,ct="[ \t\n\f\r]",dt=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,ut=/-->/g,vt=/>/g,ft=RegExp(`>|${ct}(?:([^\\s"'>=/]+)(${ct}*=${ct}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),pt=/'/g,gt=/"/g,yt=/^(?:script|style|textarea|title)$/i,mt=(t=>(i,...s)=>({_$litType$:t,strings:i,values:s}))(1),bt=Symbol.for("lit-noChange"),wt=Symbol.for("lit-nothing"),$t=new WeakMap,_t=ot.createTreeWalker(ot,129,null,!1);function At(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 s=t.length-1,e=[];let n,r=2===i?"<svg>":"",o=dt;for(let i=0;i<s;i++){const s=t[i];let l,h,a=-1,c=0;for(;c<s.length&&(o.lastIndex=c,h=o.exec(s),null!==h);)c=o.lastIndex,o===dt?"!--"===h[1]?o=ut:void 0!==h[1]?o=vt:void 0!==h[2]?(yt.test(h[2])&&(n=RegExp("</"+h[2],"g")),o=ft):void 0!==h[3]&&(o=ft):o===ft?">"===h[0]?(o=null!=n?n:dt,a=-1):void 0===h[1]?a=-2:(a=o.lastIndex-h[2].length,l=h[1],o=void 0===h[3]?ft:'"'===h[3]?gt:pt):o===gt||o===pt?o=ft:o===ut||o===vt?o=dt:(o=ft,n=void 0);const d=o===ft&&t[i+1].startsWith("/>")?" ":"";r+=o===dt?s+rt:a>=0?(e.push(l),s.slice(0,a)+st+s.slice(a)+et+d):s+et+(-2===a?(e.push(void 0),i):d)}return[At(t,r+(t[s]||"<?>")+(2===i?"</svg>":"")),e]};class xt{constructor({strings:t,_$litType$:i},s){let e;this.parts=[];let n=0,r=0;const o=t.length-1,l=this.parts,[h,a]=St(t,i);if(this.el=xt.createElement(h,s),_t.currentNode=this.el.content,2===i){const t=this.el.content,i=t.firstChild;i.remove(),t.append(...i.childNodes)}for(;null!==(e=_t.nextNode())&&l.length<o;){if(1===e.nodeType){if(e.hasAttributes()){const t=[];for(const i of e.getAttributeNames())if(i.endsWith(st)||i.startsWith(et)){const s=a[r++];if(t.push(i),void 0!==s){const t=e.getAttribute(s.toLowerCase()+st).split(et),i=/([.?@])?(.*)/.exec(s);l.push({type:1,index:n,name:i[2],strings:t,ctor:"."===i[1]?Ot:"?"===i[1]?Ut:"@"===i[1]?Mt:jt})}else l.push({type:6,index:n})}for(const i of t)e.removeAttribute(i)}if(yt.test(e.tagName)){const t=e.textContent.split(et),i=t.length-1;if(i>0){e.textContent=tt?tt.emptyScript:"";for(let s=0;s<i;s++)e.append(t[s],lt()),_t.nextNode(),l.push({type:2,index:++n});e.append(t[i],lt())}}}else if(8===e.nodeType)if(e.data===nt)l.push({type:2,index:n});else{let t=-1;for(;-1!==(t=e.data.indexOf(et,t+1));)l.push({type:7,index:n}),t+=et.length-1}n++}}static createElement(t,i){const s=ot.createElement("template");return s.innerHTML=t,s}}function Et(t,i,s=t,e){var n,r,o,l;if(i===bt)return i;let h=void 0!==e?null===(n=s._$Co)||void 0===n?void 0:n[e]:s._$Cl;const a=ht(i)?void 0:i._$litDirective$;return(null==h?void 0:h.constructor)!==a&&(null===(r=null==h?void 0:h._$AO)||void 0===r||r.call(h,!1),void 0===a?h=void 0:(h=new a(t),h._$AT(t,s,e)),void 0!==e?(null!==(o=(l=s)._$Co)&&void 0!==o?o:l._$Co=[])[e]=h:s._$Cl=h),void 0!==h&&(i=Et(t,h._$AS(t,i.values),h,e)),i}class kt{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:s},parts:e}=this._$AD,n=(null!==(i=null==t?void 0:t.creationScope)&&void 0!==i?i:ot).importNode(s,!0);_t.currentNode=n;let r=_t.nextNode(),o=0,l=0,h=e[0];for(;void 0!==h;){if(o===h.index){let i;2===h.type?i=new Ct(r,r.nextSibling,this,t):1===h.type?i=new h.ctor(r,h.name,h.strings,this,t):6===h.type&&(i=new zt(r,this,t)),this._$AV.push(i),h=e[++l]}o!==(null==h?void 0:h.index)&&(r=_t.nextNode(),o++)}return _t.currentNode=ot,n}v(t){let i=0;for(const s of this._$AV)void 0!==s&&(void 0!==s.strings?(s._$AI(t,s,i),i+=s.strings.length-2):s._$AI(t[i])),i++}}class Ct{constructor(t,i,s,e){var n;this.type=2,this._$AH=wt,this._$AN=void 0,this._$AA=t,this._$AB=i,this._$AM=s,this.options=e,this._$Cp=null===(n=null==e?void 0:e.isConnected)||void 0===n||n}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),ht(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=>at(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&&ht(this._$AH)?this._$AA.nextSibling.data=t:this.$(ot.createTextNode(t)),this._$AH=t}g(t){var i;const{values:s,_$litType$:e}=t,n="number"==typeof e?this._$AC(t):(void 0===e.el&&(e.el=xt.createElement(At(e.h,e.h[0]),this.options)),e);if((null===(i=this._$AH)||void 0===i?void 0:i._$AD)===n)this._$AH.v(s);else{const t=new kt(n,this),i=t.u(this.options);t.v(s),this.$(i),this._$AH=t}}_$AC(t){let i=$t.get(t.strings);return void 0===i&&$t.set(t.strings,i=new xt(t)),i}T(t){at(this._$AH)||(this._$AH=[],this._$AR());const i=this._$AH;let s,e=0;for(const n of t)e===i.length?i.push(s=new Ct(this.k(lt()),this.k(lt()),this,this.options)):s=i[e],s._$AI(n),e++;e<i.length&&(this._$AR(s&&s._$AB.nextSibling,e),i.length=e)}_$AR(t=this._$AA.nextSibling,i){var s;for(null===(s=this._$AP)||void 0===s||s.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 jt{constructor(t,i,s,e,n){this.type=1,this._$AH=wt,this._$AN=void 0,this.element=t,this.name=i,this._$AM=e,this.options=n,s.length>2||""!==s[0]||""!==s[1]?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=wt}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(t,i=this,s,e){const n=this.strings;let r=!1;if(void 0===n)t=Et(this,t,i,0),r=!ht(t)||t!==this._$AH&&t!==bt,r&&(this._$AH=t);else{const e=t;let o,l;for(t=n[0],o=0;o<n.length-1;o++)l=Et(this,e[s+o],i,o),l===bt&&(l=this._$AH[o]),r||(r=!ht(l)||l!==this._$AH[o]),l===wt?t=wt:t!==wt&&(t+=(null!=l?l:"")+n[o+1]),this._$AH[o]=l}r&&!e&&this.j(t)}j(t){t===wt?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,null!=t?t:"")}}class Ot extends jt{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===wt?void 0:t}}const Tt=tt?tt.emptyScript:"";class Ut extends jt{constructor(){super(...arguments),this.type=4}j(t){t&&t!==wt?this.element.setAttribute(this.name,Tt):this.element.removeAttribute(this.name)}}class Mt extends jt{constructor(t,i,s,e,n){super(t,i,s,e,n),this.type=5}_$AI(t,i=this){var s;if((t=null!==(s=Et(this,t,i,0))&&void 0!==s?s:wt)===bt)return;const e=this._$AH,n=t===wt&&e!==wt||t.capture!==e.capture||t.once!==e.once||t.passive!==e.passive,r=t!==wt&&(e===wt||n);n&&this.element.removeEventListener(this.name,this,e),r&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var i,s;"function"==typeof this._$AH?this._$AH.call(null!==(s=null===(i=this.options)||void 0===i?void 0:i.host)&&void 0!==s?s:this.element,t):this._$AH.handleEvent(t)}}class zt{constructor(t,i,s){this.element=t,this.type=6,this._$AN=void 0,this._$AM=i,this.options=s}get _$AU(){return this._$AM._$AU}_$AI(t){Et(this,t)}}const Rt=Y.litHtmlPolyfillSupport;null==Rt||Rt(xt,Ct),(null!==(X=Y.litHtmlVersions)&&void 0!==X?X:Y.litHtmlVersions=[]).push("2.8.0");
24
- /**
25
- * @license
26
- * Copyright 2017 Google LLC
27
- * SPDX-License-Identifier: BSD-3-Clause
28
- */
29
- var Nt,Dt;class It extends p{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var t,i;const s=super.createRenderRoot();return null!==(t=(i=this.renderOptions).renderBefore)&&void 0!==t||(i.renderBefore=s.firstChild),s}update(t){const i=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=((t,i,s)=>{var e,n;const r=null!==(e=null==s?void 0:s.renderBefore)&&void 0!==e?e:i;let o=r._$litPart$;if(void 0===o){const t=null!==(n=null==s?void 0:s.renderBefore)&&void 0!==n?n:null;r._$litPart$=o=new Ct(i.insertBefore(lt(),t),t,void 0,null!=s?s:{})}return o._$AI(t),o})(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}}It.finalized=!0,It._$litElement$=!0,null===(Nt=globalThis.litElementHydrateSupport)||void 0===Nt||Nt.call(globalThis,{LitElement:It});const Pt=globalThis.litElementPolyfillSupport;null==Pt||Pt({LitElement:It}),(null!==(Dt=globalThis.litElementVersions)&&void 0!==Dt?Dt:globalThis.litElementVersions=[]).push("3.3.3");
30
- /**
31
- * @license
32
- * Copyright 2017 Google LLC
33
- * SPDX-License-Identifier: BSD-3-Clause
34
- */
35
- const Lt=(t,i)=>"method"===i.kind&&i.descriptor&&!("value"in i.descriptor)?{...i,finisher(s){s.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(s){s.createProperty(i.key,t)}},Kt=(t,i,s)=>{i.constructor.createProperty(s,t)};
36
- /**
37
- * @license
38
- * Copyright 2017 Google LLC
39
- * SPDX-License-Identifier: BSD-3-Clause
40
- */function Wt(t){return(i,s)=>void 0!==s?Kt(t,i,s):Lt(t,i)
41
- /**
42
- * @license
43
- * Copyright 2017 Google LLC
44
- * SPDX-License-Identifier: BSD-3-Clause
45
- */}function qt(t){return Wt({...t,state:!0})}
46
- /**
47
- * @license
48
- * Copyright 2021 Google LLC
49
- * SPDX-License-Identifier: BSD-3-Clause
50
- */var Bt;null===(Bt=window.HTMLSlotElement)||void 0===Bt||Bt.prototype.assignedElements;
51
- /**
52
- * @license
53
- * Copyright 2017 Google LLC
54
- * SPDX-License-Identifier: BSD-3-Clause
55
- */
56
- const Ft=1;class Ht{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,i,s){this._$Ct=t,this._$AM=i,this._$Ci=s}_$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=(t=>(...i)=>({_$litDirective$:t,values:i}))(class extends Ht{constructor(t){var i;if(super(t),t.type!==Ft||"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 s,e;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===(s=this.nt)||void 0===s?void 0:s.has(t))&&this.it.add(t);return this.render(i)}const n=t.element.classList;this.it.forEach((t=>{t in i||(n.remove(t),this.it.delete(t))}));for(const t in i){const s=!!i[t];s===this.it.has(t)||(null===(e=this.nt)||void 0===e?void 0:e.has(t))||(s?(n.add(t),this.it.add(t)):(n.remove(t),this.it.delete(t)))}return N}}),Zt=((t,...i)=>{const e=1===t.length?t[0]:i.reduce(((i,s,e)=>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.")})(s)+t[e+1]),t[0]);return new n(e,t,s)})`
62
- :host {
63
- display: block;
64
- font-family: var(--nuraly-font-family);
65
- font-size: var(--nuraly-font-size-base);
66
- line-height: var(--nuraly-line-height-base);
67
- }
68
-
69
- :host([hidden]) {
70
- display: none;
71
- }
72
-
73
- .alert {
74
- position: relative;
75
- display: flex;
76
- align-items: flex-start;
77
- gap: var(--nuraly-alert-gap);
78
- padding: var(--nuraly-alert-padding);
79
- border: 1px solid transparent;
80
- border-radius: var(--nuraly-alert-border-radius);
81
- transition: var(--nuraly-alert-transition);
82
- }
83
-
84
- .alert--banner {
85
- border-radius: 0;
86
- border-left: none;
87
- border-right: none;
88
- }
89
-
90
- /* Alert type variants - Success */
91
- .alert--success {
92
- background-color: var(--nuraly-color-success-light, #f6ffed);
93
- border-color: var(--nuraly-color-success, #52c41a);
94
- color: var(--nuraly-color-success-dark, #389e0d);
95
- }
96
-
97
- .alert--success .alert__icon {
98
- color: var(--nuraly-color-success, #52c41a);
99
- }
100
-
101
- /* Alert type variants - Info */
102
- .alert--info {
103
- background-color: var(--nuraly-color-info-light, #e6f7ff);
104
- border-color: var(--nuraly-color-info, #1890ff);
105
- color: var(--nuraly-color-info-dark, #096dd9);
106
- }
107
-
108
- .alert--info .alert__icon {
109
- color: var(--nuraly-color-info, #1890ff);
110
- }
111
-
112
- /* Alert type variants - Warning */
113
- .alert--warning {
114
- background-color: var(--nuraly-color-warning-light, #fffbe6);
115
- border-color: var(--nuraly-color-warning, #faad14);
116
- color: var(--nuraly-color-warning-dark, #d48806);
117
- }
118
-
119
- .alert--warning .alert__icon {
120
- color: var(--nuraly-color-warning, #faad14);
121
- }
122
-
123
- /* Alert type variants - Error */
124
- .alert--error {
125
- background-color: var(--nuraly-color-error-light, #fff2f0);
126
- border-color: var(--nuraly-color-error, #ff4d4f);
127
- color: var(--nuraly-color-error-dark, #cf1322);
128
- }
129
-
130
- .alert--error .alert__icon {
131
- color: var(--nuraly-color-error, #ff4d4f);
132
- }
133
-
134
- /* Alert with description */
135
- .alert--with-description {
136
- padding: var(--nuraly-alert-padding-with-description);
137
- }
138
-
139
- .alert--with-description .alert__icon {
140
- font-size: 1.5rem;
141
- }
142
-
143
- .alert__icon {
144
- flex-shrink: 0;
145
- display: flex;
146
- align-items: center;
147
- justify-content: center;
148
- font-size: 1rem;
149
- line-height: 1;
150
- }
151
-
152
- .alert__content {
153
- flex: 1;
154
- min-width: 0;
155
- }
156
-
157
- .alert__message {
158
- font-weight: var(--nuraly-font-weight-medium, 500);
159
- margin: 0;
160
- line-height: var(--nuraly-line-height-base);
161
- }
162
-
163
- .alert--with-description .alert__message {
164
- font-size: var(--nuraly-font-size-lg, 1.125rem);
165
- margin-bottom: var(--nuraly-spacing-1);
166
- }
167
-
168
- .alert__description {
169
- margin: var(--nuraly-spacing-1) 0 0;
170
- font-size: var(--nuraly-font-size-sm, 0.875rem);
171
- line-height: var(--nuraly-line-height-relaxed, 1.6);
172
- opacity: 0.85;
173
- }
174
-
175
- .alert__close {
176
- flex-shrink: 0;
177
- background: none;
178
- border: none;
179
- padding: 0;
180
- margin: 0;
181
- cursor: pointer;
182
- display: flex;
183
- align-items: center;
184
- justify-content: center;
185
- color: currentColor;
186
- opacity: 0.6;
187
- transition: opacity var(--nuraly-transition-fast) ease;
188
- line-height: 1;
189
- }
190
-
191
- .alert__close:hover {
192
- opacity: 1;
193
- }
194
-
195
- .alert__close:focus {
196
- outline: none;
197
- opacity: 1;
198
- }
199
-
200
- .alert__close:focus-visible {
201
- outline: 2px solid currentColor;
202
- outline-offset: 2px;
203
- border-radius: var(--nuraly-border-radius-sm, 2px);
204
- }
205
-
206
- /* Animation for closing */
207
- @keyframes alertFadeOut {
208
- from {
209
- opacity: 1;
210
- max-height: 200px;
211
- }
212
- to {
213
- opacity: 0;
214
- max-height: 0;
215
- padding-top: 0;
216
- padding-bottom: 0;
217
- margin-top: 0;
218
- margin-bottom: 0;
219
- }
220
- }
221
-
222
- .alert--closing {
223
- animation: alertFadeOut 0.3s ease forwards;
224
- overflow: hidden;
225
- }
226
-
227
- /* Responsive adjustments */
228
- @media (max-width: 768px) {
229
- .alert {
230
- padding: var(--nuraly-spacing-2) var(--nuraly-spacing-3);
231
- }
232
-
233
- .alert--with-description {
234
- padding: var(--nuraly-spacing-3) var(--nuraly-spacing-4);
235
- }
236
- }
237
- `
1
+ import{css as r,LitElement as e,nothing as t,html as a}from"lit";import{property as i,state as o,customElement as n}from"lit/decorators.js";import{classMap as l}from"lit/directives/class-map.js";import{NuralyUIBaseMixin as s}from"@nuralyui/common/mixins";
238
2
  /**
239
3
  * @license
240
4
  * Copyright 2023 Nuraly, Laabidi Aymen
241
5
  * SPDX-License-Identifier: MIT
242
- */,Jt=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,s;super.disconnectedCallback(),null===(t=this.themeObserver)||void 0===t||t.disconnect(),null===(i=this.designSystemObserver)||void 0===i||i.disconnect(),null===(s=this.mediaQuery)||void 0===s||s.removeEventListener("change",this.handleSystemThemeChange)}get currentTheme(){var t,i;const s=(null===(t=this.closest("[data-theme]"))||void 0===t?void 0:t.getAttribute("data-theme"))||document.documentElement.getAttribute("data-theme");return s||((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))}},Gt=()=>{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)},Qt=t=>class extends t{constructor(){super(...arguments),this.requiredComponents=[]}validateDependencies(){if(Gt())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(!Gt())return!0;let i=!0;for(const s of this.requiredComponents)if(!this.isComponentAvailable(s)){i=!1;const e=new Error(`Required component "${s}" is not registered. Please import and register the component before using ${this.tagName.toLowerCase()}.`);t?t(s,e):console.error(e.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)}},Xt=t=>class extends t{dispatchCustomEvent(t,i){this.dispatchEvent(new CustomEvent(t,{detail:i,bubbles:!0,composed:!0}))}dispatchEventWithMetadata(t,i){var s;const e=Object.assign(Object.assign({},i),{timestamp:Date.now(),componentName:(null===(s=this.tagName)||void 0===s?void 0:s.toLowerCase())||"unknown"});this.dispatchCustomEvent(t,e)}dispatchInputEvent(t,i){const s=Object.assign({target:i.target||this,value:i.value,originalEvent:i.originalEvent},i);this.dispatchCustomEvent(t,s)}dispatchFocusEvent(t,i){const s=Object.assign({target:i.target||this,value:i.value,focused:i.focused,cursorPosition:i.cursorPosition,selectedText:i.selectedText},i);this.dispatchCustomEvent(t,s)}dispatchValidationEvent(t,i){var s;const e=Object.assign({target:i.target||this,value:i.value,isValid:null!==(s=i.isValid)&&void 0!==s&&s,error:i.error},i);this.dispatchCustomEvent(t,e)}dispatchActionEvent(t,i){const s=Object.assign({target:i.target||this,action:i.action,previousValue:i.previousValue,newValue:i.newValue},i);this.dispatchCustomEvent(t,s)}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}},Yt="";
6
+ */const c=r`:host{display:block;font-family:var(--nuraly-font-family);font-size:var(--nuraly-font-size-base);line-height:var(--nuraly-line-height-base)}:host([hidden]){display:none}.alert{position:relative;display:flex;align-items:flex-start;gap:var(--nuraly-alert-gap);padding:var(--nuraly-alert-padding);border:1px solid transparent;border-radius:var(--nuraly-alert-border-radius);transition:var(--nuraly-alert-transition)}.alert--banner{border-radius:0;border-left:none;border-right:none}.alert--success{background-color:var(--nuraly-color-success-light,#f6ffed);border-color:var(--nuraly-color-success,#52c41a);color:var(--nuraly-color-success-dark,#389e0d)}.alert--success .alert__icon{color:var(--nuraly-color-success,#52c41a)}.alert--info{background-color:var(--nuraly-color-info-light,#e6f7ff);border-color:var(--nuraly-color-info,#1890ff);color:var(--nuraly-color-info-dark,#096dd9)}.alert--info .alert__icon{color:var(--nuraly-color-info,#1890ff)}.alert--warning{background-color:var(--nuraly-color-warning-light,#fffbe6);border-color:var(--nuraly-color-warning,#faad14);color:var(--nuraly-color-warning-dark,#d48806)}.alert--warning .alert__icon{color:var(--nuraly-color-warning,#faad14)}.alert--error{background-color:var(--nuraly-color-error-light,#fff2f0);border-color:var(--nuraly-color-error,#ff4d4f);color:var(--nuraly-color-error-dark,#cf1322)}.alert--error .alert__icon{color:var(--nuraly-color-error,#ff4d4f)}.alert--with-description{padding:var(--nuraly-alert-padding-with-description)}.alert--with-description .alert__icon{font-size:1.5rem}.alert__icon{flex-shrink:0;display:flex;align-items:center;justify-content:center;font-size:1rem;line-height:1}.alert__content{flex:1;min-width:0}.alert__message{font-weight:var(--nuraly-font-weight-medium,500);margin:0;line-height:var(--nuraly-line-height-base)}.alert--with-description .alert__message{font-size:var(--nuraly-font-size-lg,1.125rem);margin-bottom:var(--nuraly-spacing-1)}.alert__description{margin:var(--nuraly-spacing-1) 0 0;font-size:var(--nuraly-font-size-sm,.875rem);line-height:var(--nuraly-line-height-relaxed,1.6);opacity:.85}.alert__close{flex-shrink:0;background:0 0;border:none;padding:0;margin:0;cursor:pointer;display:flex;align-items:center;justify-content:center;color:currentColor;opacity:.6;transition:opacity var(--nuraly-transition-fast) ease;line-height:1}.alert__close:hover{opacity:1}.alert__close:focus{outline:0;opacity:1}.alert__close:focus-visible{outline:2px solid currentColor;outline-offset:2px;border-radius:var(--nuraly-border-radius-sm,2px)}@keyframes alertFadeOut{from{opacity:1;max-height:200px}to{opacity:0;max-height:0;padding-top:0;padding-bottom:0;margin-top:0;margin-bottom:0}}.alert--closing{animation:alertFadeOut .3s ease forwards;overflow:hidden}@media (max-width:768px){.alert{padding:var(--nuraly-spacing-2) var(--nuraly-spacing-3)}.alert--with-description{padding:var(--nuraly-spacing-3) var(--nuraly-spacing-4)}}`
243
7
  /**
244
8
  * @license
245
9
  * Copyright 2023 Nuraly, Laabidi Aymen
246
10
  * SPDX-License-Identifier: MIT
247
- */
11
+ */,d="";
248
12
  /**
249
13
  * @license
250
14
  * Copyright 2023 Nuraly, Laabidi Aymen
251
15
  * SPDX-License-Identifier: MIT
252
16
  */
253
- var ti=function(t,i,s,e){for(var n,r=arguments.length,o=r<3?i:null===e?e=Object.getOwnPropertyDescriptor(i,s):e,l=t.length-1;l>=0;l--)(n=t[l])&&(o=(r<3?n(o):r>3?n(i,s,o):n(i,s))||o);return r>3&&o&&Object.defineProperty(i,s,o),o};let ii=class extends((t=>Qt(Jt(Xt(t))))(It)){constructor(){super(...arguments),this.requiredComponents=["nr-icon"],this.message="",this.type="info",this.description="",this.closable=!1,this.showIcon=!1,this.icon="",this.banner=!1,this.visible=!0,this.closing=!1}close(){this.visible&&!this.closing&&(this.closing=!0,setTimeout((()=>{this.visible=!1,this.closing=!1,this.dispatchEvent(new CustomEvent("nr-alert-close",{detail:{message:this.message,type:this.type},bubbles:!0,composed:!0}))}),300))}handleCloseClick(t){t.stopPropagation(),this.close()}getDefaultIcon(){if(this.icon)return this.icon;switch(this.type){case"success":return"check-circle";case"info":return"info";case"warning":return"alert-triangle";case"error":return"x-circle";default:return""}}hasDescription(){return!!this.description}render(){if(!this.visible)return wt;const t={alert:!0,[`alert--${this.type}`]:!0,"alert--with-description":this.hasDescription(),"alert--banner":this.banner,"alert--closing":this.closing};return mt`
254
- <div class=${Vt(t)} role="alert">
255
- ${this.showIcon?mt`
256
- <div class="alert__icon">
257
- <slot name="icon">
258
- <nr-icon
259
- name=${this.getDefaultIcon()}
260
- size=${this.hasDescription()?"large":"small"}
261
- ></nr-icon>
262
- </slot>
263
- </div>
264
- `:wt}
265
-
266
- <div class="alert__content">
267
- ${this.message?mt`
268
- <div class="alert__message">${this.message}</div>
269
- `:wt}
270
-
271
- ${this.description?mt`
272
- <div class="alert__description">${this.description}</div>
273
- `:wt}
274
-
275
- <slot></slot>
276
-
277
- <slot name="action"></slot>
278
- </div>
279
-
280
- ${this.closable?mt`
281
- <button
282
- class="alert__close"
283
- @click=${this.handleCloseClick}
284
- aria-label="Close alert"
285
- type="button"
286
- >
287
- <nr-icon name="x" size="small"></nr-icon>
288
- </button>
289
- `:wt}
290
- </div>
291
- `}};ii.styles=Zt,ti([Wt({type:String})],ii.prototype,"message",void 0),ti([Wt({type:String,reflect:!0})],ii.prototype,"type",void 0),ti([Wt({type:String})],ii.prototype,"description",void 0),ti([Wt({type:Boolean})],ii.prototype,"closable",void 0),ti([Wt({type:Boolean,attribute:"show-icon"})],ii.prototype,"showIcon",void 0),ti([Wt({type:String})],ii.prototype,"icon",void 0),ti([Wt({type:Boolean})],ii.prototype,"banner",void 0),ti([qt()],ii.prototype,"visible",void 0),ti([qt()],ii.prototype,"closing",void 0),ii=ti([(t=>i=>"function"==typeof i?((t,i)=>(customElements.define(t,i),i))(t,i):((t,i)=>{const{kind:s,elements:e}=i;return{kind:s,elements:e,finisher(i){customElements.define(t,i)}}})(t,i))("nr-alert")],ii);export{Yt as EMPTY_STRING,ii as NrAlertElement};
17
+ var u=function(r,e,t,a){for(var i,o=arguments.length,n=o<3?e:null===a?a=Object.getOwnPropertyDescriptor(e,t):a,l=r.length-1;l>=0;l--)(i=r[l])&&(n=(o<3?i(n):o>3?i(e,t,n):i(e,t))||n);return o>3&&n&&Object.defineProperty(e,t,n),n};let h=class extends(s(e)){constructor(){super(...arguments),this.requiredComponents=["nr-icon"],this.message="",this.type="info",this.description="",this.closable=!1,this.showIcon=!1,this.icon="",this.banner=!1,this.visible=!0,this.closing=!1}close(){this.visible&&!this.closing&&(this.closing=!0,setTimeout((()=>{this.visible=!1,this.closing=!1,this.dispatchEvent(new CustomEvent("nr-alert-close",{detail:{message:this.message,type:this.type},bubbles:!0,composed:!0}))}),300))}handleCloseClick(r){r.stopPropagation(),this.close()}getDefaultIcon(){if(this.icon)return this.icon;switch(this.type){case"success":return"check-circle";case"info":return"info";case"warning":return"alert-triangle";case"error":return"x-circle";default:return""}}hasDescription(){return!!this.description}render(){if(!this.visible)return t;const r={alert:!0,[`alert--${this.type}`]:!0,"alert--with-description":this.hasDescription(),"alert--banner":this.banner,"alert--closing":this.closing};return a`<div class="${l(r)}" role="alert">${this.showIcon?a`<div class="alert__icon"><slot name="icon"><nr-icon name="${this.getDefaultIcon()}" size="${this.hasDescription()?"large":"small"}"></nr-icon></slot></div>`:t}<div class="alert__content">${this.message?a`<div class="alert__message">${this.message}</div>`:t} ${this.description?a`<div class="alert__description">${this.description}</div>`:t}<slot></slot><slot name="action"></slot></div>${this.closable?a`<button class="alert__close" @click="${this.handleCloseClick}" aria-label="Close alert" type="button"><nr-icon name="x" size="small"></nr-icon></button>`:t}</div>`}};h.styles=c,u([i({type:String})],h.prototype,"message",void 0),u([i({type:String,reflect:!0})],h.prototype,"type",void 0),u([i({type:String})],h.prototype,"description",void 0),u([i({type:Boolean})],h.prototype,"closable",void 0),u([i({type:Boolean,attribute:"show-icon"})],h.prototype,"showIcon",void 0),u([i({type:String})],h.prototype,"icon",void 0),u([i({type:Boolean})],h.prototype,"banner",void 0),u([o()],h.prototype,"visible",void 0),u([o()],h.prototype,"closing",void 0),h=u([n("nr-alert")],h);export{d as EMPTY_STRING,h as NrAlertElement};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuralyui/alert",
3
- "version": "0.0.4",
3
+ "version": "0.0.5",
4
4
  "description": "Alert component for NuralyUI library",
5
5
  "main": "index.js",
6
6
  "type": "module",