cas-ds-web-components 1.2.52 → 1.2.53
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/build/cas-accordion-element.js +36 -30
- package/build/cas-accordion.js +36 -30
- package/build/cas-alert.js +54 -48
- package/build/cas-booking-box.js +21 -15
- package/build/cas-button.js +79 -73
- package/build/cas-checkbox.js +21 -15
- package/build/cas-date-picker-range.js +49 -43
- package/build/cas-date-picker.js +40 -34
- package/build/cas-ds-web-components.js +2409 -2191
- package/build/cas-header.js +2099 -1890
- package/build/cas-icon.js +305 -299
- package/build/cas-input-file.js +20 -14
- package/build/cas-input.js +55 -20
- package/build/cas-modal.js +19 -13
- package/build/cas-new-footer.js +37 -31
- package/build/cas-radio-button.js +214 -99
- package/build/cas-radio.js +20 -14
- package/build/cas-select.js +922 -721
- package/build/cas-share.js +40 -34
- package/build/cas-snackbar.js +38 -32
- package/build/cas-spinner.js +18 -12
- package/build/cas-text.js +22 -16
- package/build/cas-textfield.js +20 -14
- package/build/cas-theme-provider.js +15 -9
- package/build/cas-toggle.js +18 -12
- package/build/cas-tooltip.js +21 -15
- package/package.json +1 -1
package/build/cas-share.js
CHANGED
|
@@ -1,24 +1,30 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(f,$){typeof exports=="object"&&typeof module<"u"?$(exports):typeof define=="function"&&define.amd?define(["exports"],$):(f=typeof globalThis<"u"?globalThis:f||self,$(f["cas-share"]={}))})(this,function(f){"use strict";/**
|
|
2
2
|
* @license
|
|
3
3
|
* Copyright 2019 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
5
|
-
*/const
|
|
5
|
+
*/const $=window,V=$.ShadowRoot&&($.ShadyCSS===void 0||$.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,at=Symbol(),rt=new WeakMap;class Dt{constructor(t,e,s){if(this._$cssResult$=!0,s!==at)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const e=this.t;if(V&&t===void 0){const s=e!==void 0&&e.length===1;s&&(t=rt.get(e)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),s&&rt.set(e,t))}return t}toString(){return this.cssText}}const Ht=i=>new Dt(typeof i=="string"?i:i+"",void 0,at),zt=(i,t)=>{V?i.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet):t.forEach(e=>{const s=document.createElement("style"),n=$.litNonce;n!==void 0&&s.setAttribute("nonce",n),s.textContent=e.cssText,i.appendChild(s)})},ct=V?i=>i:i=>i instanceof CSSStyleSheet?(t=>{let e="";for(const s of t.cssRules)e+=s.cssText;return Ht(e)})(i):i;/**
|
|
6
6
|
* @license
|
|
7
7
|
* Copyright 2017 Google LLC
|
|
8
8
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
9
|
-
*/var W;const
|
|
9
|
+
*/var W;const M=window,lt=M.trustedTypes,jt=lt?lt.emptyScript:"",ht=M.reactiveElementPolyfillSupport,q={toAttribute(i,t){switch(t){case Boolean:i=i?jt:null;break;case Object:case Array:i=i==null?i:JSON.stringify(i)}return i},fromAttribute(i,t){let e=i;switch(t){case Boolean:e=i!==null;break;case Number:e=i===null?null:Number(i);break;case Object:case Array:try{e=JSON.parse(i)}catch{e=null}}return e}},dt=(i,t)=>t!==i&&(t==t||i==i),K={attribute:!0,type:String,converter:q,reflect:!1,hasChanged:dt},X="finalized";class x extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this._$Eu()}static addInitializer(t){var e;this.finalize(),((e=this.h)!==null&&e!==void 0?e:this.h=[]).push(t)}static get observedAttributes(){this.finalize();const t=[];return this.elementProperties.forEach((e,s)=>{const n=this._$Ep(s,e);n!==void 0&&(this._$Ev.set(n,s),t.push(n))}),t}static createProperty(t,e=K){if(e.state&&(e.attribute=!1),this.finalize(),this.elementProperties.set(t,e),!e.noAccessor&&!this.prototype.hasOwnProperty(t)){const s=typeof t=="symbol"?Symbol():"__"+t,n=this.getPropertyDescriptor(t,s,e);n!==void 0&&Object.defineProperty(this.prototype,t,n)}}static getPropertyDescriptor(t,e,s){return{get(){return this[e]},set(n){const o=this[t];this[e]=n,this.requestUpdate(t,o,s)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)||K}static finalize(){if(this.hasOwnProperty(X))return!1;this[X]=!0;const t=Object.getPrototypeOf(this);if(t.finalize(),t.h!==void 0&&(this.h=[...t.h]),this.elementProperties=new Map(t.elementProperties),this._$Ev=new Map,this.hasOwnProperty("properties")){const e=this.properties,s=[...Object.getOwnPropertyNames(e),...Object.getOwnPropertySymbols(e)];for(const n of s)this.createProperty(n,e[n])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const s=new Set(t.flat(1/0).reverse());for(const n of s)e.unshift(ct(n))}else t!==void 0&&e.push(ct(t));return e}static _$Ep(t,e){const s=e.attribute;return s===!1?void 0:typeof s=="string"?s:typeof t=="string"?t.toLowerCase():void 0}_$Eu(){var t;this._$E_=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$Eg(),this.requestUpdate(),(t=this.constructor.h)===null||t===void 0||t.forEach(e=>e(this))}addController(t){var e,s;((e=this._$ES)!==null&&e!==void 0?e:this._$ES=[]).push(t),this.renderRoot!==void 0&&this.isConnected&&((s=t.hostConnected)===null||s===void 0||s.call(t))}removeController(t){var e;(e=this._$ES)===null||e===void 0||e.splice(this._$ES.indexOf(t)>>>0,1)}_$Eg(){this.constructor.elementProperties.forEach((t,e)=>{this.hasOwnProperty(e)&&(this._$Ei.set(e,this[e]),delete this[e])})}createRenderRoot(){var t;const e=(t=this.shadowRoot)!==null&&t!==void 0?t:this.attachShadow(this.constructor.shadowRootOptions);return zt(e,this.constructor.elementStyles),e}connectedCallback(){var t;this.renderRoot===void 0&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(t=this._$ES)===null||t===void 0||t.forEach(e=>{var s;return(s=e.hostConnected)===null||s===void 0?void 0:s.call(e)})}enableUpdating(t){}disconnectedCallback(){var t;(t=this._$ES)===null||t===void 0||t.forEach(e=>{var s;return(s=e.hostDisconnected)===null||s===void 0?void 0:s.call(e)})}attributeChangedCallback(t,e,s){this._$AK(t,s)}_$EO(t,e,s=K){var n;const o=this.constructor._$Ep(t,s);if(o!==void 0&&s.reflect===!0){const a=(((n=s.converter)===null||n===void 0?void 0:n.toAttribute)!==void 0?s.converter:q).toAttribute(e,s.type);this._$El=t,a==null?this.removeAttribute(o):this.setAttribute(o,a),this._$El=null}}_$AK(t,e){var s;const n=this.constructor,o=n._$Ev.get(t);if(o!==void 0&&this._$El!==o){const a=n.getPropertyOptions(o),l=typeof a.converter=="function"?{fromAttribute:a.converter}:((s=a.converter)===null||s===void 0?void 0:s.fromAttribute)!==void 0?a.converter:q;this._$El=o,this[o]=l.fromAttribute(e,a.type),this._$El=null}}requestUpdate(t,e,s){let n=!0;t!==void 0&&(((s=s||this.constructor.getPropertyOptions(t)).hasChanged||dt)(this[t],e)?(this._$AL.has(t)||this._$AL.set(t,e),s.reflect===!0&&this._$El!==t&&(this._$EC===void 0&&(this._$EC=new Map),this._$EC.set(t,s))):n=!1),!this.isUpdatePending&&n&&(this._$E_=this._$Ej())}async _$Ej(){this.isUpdatePending=!0;try{await this._$E_}catch(e){Promise.reject(e)}const t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var t;if(!this.isUpdatePending)return;this.hasUpdated,this._$Ei&&(this._$Ei.forEach((n,o)=>this[o]=n),this._$Ei=void 0);let e=!1;const s=this._$AL;try{e=this.shouldUpdate(s),e?(this.willUpdate(s),(t=this._$ES)===null||t===void 0||t.forEach(n=>{var o;return(o=n.hostUpdate)===null||o===void 0?void 0:o.call(n)}),this.update(s)):this._$Ek()}catch(n){throw e=!1,this._$Ek(),n}e&&this._$AE(s)}willUpdate(t){}_$AE(t){var e;(e=this._$ES)===null||e===void 0||e.forEach(s=>{var n;return(n=s.hostUpdated)===null||n===void 0?void 0:n.call(s)}),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){this._$EC!==void 0&&(this._$EC.forEach((e,s)=>this._$EO(s,this[s],e)),this._$EC=void 0),this._$Ek()}updated(t){}firstUpdated(t){}}x[X]=!0,x.elementProperties=new Map,x.elementStyles=[],x.shadowRootOptions={mode:"open"},ht?.({ReactiveElement:x}),((W=M.reactiveElementVersions)!==null&&W!==void 0?W:M.reactiveElementVersions=[]).push("1.6.3");/**
|
|
10
10
|
* @license
|
|
11
11
|
* Copyright 2017 Google LLC
|
|
12
12
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
13
|
-
*/var
|
|
14
|
-
\f\r](?:([^\\s"'>=/]+)([
|
|
15
|
-
\f\r]
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
*/var J;const L=window,k=L.trustedTypes,pt=k?k.createPolicy("lit-html",{createHTML:i=>i}):void 0,G="$lit$",g=`lit$${(Math.random()+"").slice(9)}$`,ut="?"+g,Bt=`<${ut}>`,y=document,U=()=>y.createComment(""),P=i=>i===null||typeof i!="object"&&typeof i!="function",mt=Array.isArray,Ft=i=>mt(i)||typeof i?.[Symbol.iterator]=="function",Z=`[
|
|
14
|
+
\f\r]`,O=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,bt=/-->/g,vt=/>/g,_=RegExp(`>|${Z}(?:([^\\s"'>=/]+)(${Z}*=${Z}*(?:[^
|
|
15
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),ft=/'/g,$t=/"/g,gt=/^(?:script|style|textarea|title)$/i,Vt=i=>(t,...e)=>({_$litType$:i,strings:t,values:e}),R=Vt(1),S=Symbol.for("lit-noChange"),p=Symbol.for("lit-nothing"),yt=new WeakMap,w=y.createTreeWalker(y,129,null,!1);function _t(i,t){if(!Array.isArray(i)||!i.hasOwnProperty("raw"))throw Error("invalid template strings array");return pt!==void 0?pt.createHTML(t):t}const Wt=(i,t)=>{const e=i.length-1,s=[];let n,o=t===2?"<svg>":"",a=O;for(let l=0;l<e;l++){const r=i[l];let c,h,d=-1,u=0;for(;u<r.length&&(a.lastIndex=u,h=a.exec(r),h!==null);)u=a.lastIndex,a===O?h[1]==="!--"?a=bt:h[1]!==void 0?a=vt:h[2]!==void 0?(gt.test(h[2])&&(n=RegExp("</"+h[2],"g")),a=_):h[3]!==void 0&&(a=_):a===_?h[0]===">"?(a=n??O,d=-1):h[1]===void 0?d=-2:(d=a.lastIndex-h[2].length,c=h[1],a=h[3]===void 0?_:h[3]==='"'?$t:ft):a===$t||a===ft?a=_:a===bt||a===vt?a=O:(a=_,n=void 0);const b=a===_&&i[l+1].startsWith("/>")?" ":"";o+=a===O?r+Bt:d>=0?(s.push(c),r.slice(0,d)+G+r.slice(d)+g+b):r+g+(d===-2?(s.push(void 0),l):b)}return[_t(i,o+(i[e]||"<?>")+(t===2?"</svg>":"")),s]};class T{constructor({strings:t,_$litType$:e},s){let n;this.parts=[];let o=0,a=0;const l=t.length-1,r=this.parts,[c,h]=Wt(t,e);if(this.el=T.createElement(c,s),w.currentNode=this.el.content,e===2){const d=this.el.content,u=d.firstChild;u.remove(),d.append(...u.childNodes)}for(;(n=w.nextNode())!==null&&r.length<l;){if(n.nodeType===1){if(n.hasAttributes()){const d=[];for(const u of n.getAttributeNames())if(u.endsWith(G)||u.startsWith(g)){const b=h[a++];if(d.push(u),b!==void 0){const ke=n.getAttribute(b.toLowerCase()+G).split(g),F=/([.?@])?(.*)/.exec(b);r.push({type:1,index:o,name:F[2],strings:ke,ctor:F[1]==="."?Kt:F[1]==="?"?Jt:F[1]==="@"?Gt:I})}else r.push({type:6,index:o})}for(const u of d)n.removeAttribute(u)}if(gt.test(n.tagName)){const d=n.textContent.split(g),u=d.length-1;if(u>0){n.textContent=k?k.emptyScript:"";for(let b=0;b<u;b++)n.append(d[b],U()),w.nextNode(),r.push({type:2,index:++o});n.append(d[u],U())}}}else if(n.nodeType===8)if(n.data===ut)r.push({type:2,index:o});else{let d=-1;for(;(d=n.data.indexOf(g,d+1))!==-1;)r.push({type:7,index:o}),d+=g.length-1}o++}}static createElement(t,e){const s=y.createElement("template");return s.innerHTML=t,s}}function E(i,t,e=i,s){var n,o,a,l;if(t===S)return t;let r=s!==void 0?(n=e._$Co)===null||n===void 0?void 0:n[s]:e._$Cl;const c=P(t)?void 0:t._$litDirective$;return r?.constructor!==c&&((o=r?._$AO)===null||o===void 0||o.call(r,!1),c===void 0?r=void 0:(r=new c(i),r._$AT(i,e,s)),s!==void 0?((a=(l=e)._$Co)!==null&&a!==void 0?a:l._$Co=[])[s]=r:e._$Cl=r),r!==void 0&&(t=E(i,r._$AS(i,t.values),r,s)),t}class qt{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){var e;const{el:{content:s},parts:n}=this._$AD,o=((e=t?.creationScope)!==null&&e!==void 0?e:y).importNode(s,!0);w.currentNode=o;let a=w.nextNode(),l=0,r=0,c=n[0];for(;c!==void 0;){if(l===c.index){let h;c.type===2?h=new N(a,a.nextSibling,this,t):c.type===1?h=new c.ctor(a,c.name,c.strings,this,t):c.type===6&&(h=new Zt(a,this,t)),this._$AV.push(h),c=n[++r]}l!==c?.index&&(a=w.nextNode(),l++)}return w.currentNode=y,o}v(t){let e=0;for(const s of this._$AV)s!==void 0&&(s.strings!==void 0?(s._$AI(t,s,e),e+=s.strings.length-2):s._$AI(t[e])),e++}}class N{constructor(t,e,s,n){var o;this.type=2,this._$AH=p,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=s,this.options=n,this._$Cp=(o=n?.isConnected)===null||o===void 0||o}get _$AU(){var t,e;return(e=(t=this._$AM)===null||t===void 0?void 0:t._$AU)!==null&&e!==void 0?e:this._$Cp}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return e!==void 0&&t?.nodeType===11&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=E(this,t,e),P(t)?t===p||t==null||t===""?(this._$AH!==p&&this._$AR(),this._$AH=p):t!==this._$AH&&t!==S&&this._(t):t._$litType$!==void 0?this.g(t):t.nodeType!==void 0?this.$(t):Ft(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!==p&&P(this._$AH)?this._$AA.nextSibling.data=t:this.$(y.createTextNode(t)),this._$AH=t}g(t){var e;const{values:s,_$litType$:n}=t,o=typeof n=="number"?this._$AC(t):(n.el===void 0&&(n.el=T.createElement(_t(n.h,n.h[0]),this.options)),n);if(((e=this._$AH)===null||e===void 0?void 0:e._$AD)===o)this._$AH.v(s);else{const a=new qt(o,this),l=a.u(this.options);a.v(s),this.$(l),this._$AH=a}}_$AC(t){let e=yt.get(t.strings);return e===void 0&&yt.set(t.strings,e=new T(t)),e}T(t){mt(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let s,n=0;for(const o of t)n===e.length?e.push(s=new N(this.k(U()),this.k(U()),this,this.options)):s=e[n],s._$AI(o),n++;n<e.length&&(this._$AR(s&&s._$AB.nextSibling,n),e.length=n)}_$AR(t=this._$AA.nextSibling,e){var s;for((s=this._$AP)===null||s===void 0||s.call(this,!1,!0,e);t&&t!==this._$AB;){const n=t.nextSibling;t.remove(),t=n}}setConnected(t){var e;this._$AM===void 0&&(this._$Cp=t,(e=this._$AP)===null||e===void 0||e.call(this,t))}}class I{constructor(t,e,s,n,o){this.type=1,this._$AH=p,this._$AN=void 0,this.element=t,this.name=e,this._$AM=n,this.options=o,s.length>2||s[0]!==""||s[1]!==""?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=p}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(t,e=this,s,n){const o=this.strings;let a=!1;if(o===void 0)t=E(this,t,e,0),a=!P(t)||t!==this._$AH&&t!==S,a&&(this._$AH=t);else{const l=t;let r,c;for(t=o[0],r=0;r<o.length-1;r++)c=E(this,l[s+r],e,r),c===S&&(c=this._$AH[r]),a||(a=!P(c)||c!==this._$AH[r]),c===p?t=p:t!==p&&(t+=(c??"")+o[r+1]),this._$AH[r]=c}a&&!n&&this.j(t)}j(t){t===p?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}class Kt extends I{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===p?void 0:t}}const Xt=k?k.emptyScript:"";class Jt extends I{constructor(){super(...arguments),this.type=4}j(t){t&&t!==p?this.element.setAttribute(this.name,Xt):this.element.removeAttribute(this.name)}}class Gt extends I{constructor(t,e,s,n,o){super(t,e,s,n,o),this.type=5}_$AI(t,e=this){var s;if((t=(s=E(this,t,e,0))!==null&&s!==void 0?s:p)===S)return;const n=this._$AH,o=t===p&&n!==p||t.capture!==n.capture||t.once!==n.once||t.passive!==n.passive,a=t!==p&&(n===p||o);o&&this.element.removeEventListener(this.name,this,n),a&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var e,s;typeof this._$AH=="function"?this._$AH.call((s=(e=this.options)===null||e===void 0?void 0:e.host)!==null&&s!==void 0?s:this.element,t):this._$AH.handleEvent(t)}}class Zt{constructor(t,e,s){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=s}get _$AU(){return this._$AM._$AU}_$AI(t){E(this,t)}}const wt=L.litHtmlPolyfillSupport;wt?.(T,N),((J=L.litHtmlVersions)!==null&&J!==void 0?J:L.litHtmlVersions=[]).push("2.8.0");const Yt=(i,t,e)=>{var s,n;const o=(s=e?.renderBefore)!==null&&s!==void 0?s:t;let a=o._$litPart$;if(a===void 0){const l=(n=e?.renderBefore)!==null&&n!==void 0?n:null;o._$litPart$=a=new N(t.insertBefore(U(),l),l,void 0,e??{})}return a._$AI(i),a};/**
|
|
16
|
+
* @license
|
|
17
|
+
* Copyright 2019 Google LLC
|
|
18
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
19
|
+
*/const D=window,Y=D.ShadowRoot&&(D.ShadyCSS===void 0||D.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Q=Symbol(),kt=new WeakMap;class St{constructor(t,e,s){if(this._$cssResult$=!0,s!==Q)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const e=this.t;if(Y&&t===void 0){const s=e!==void 0&&e.length===1;s&&(t=kt.get(e)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),s&&kt.set(e,t))}return t}toString(){return this.cssText}}const m=i=>new St(typeof i=="string"?i:i+"",void 0,Q),A=(i,...t)=>{const e=i.length===1?i[0]:t.reduce((s,n,o)=>s+(a=>{if(a._$cssResult$===!0)return a.cssText;if(typeof a=="number")return a;throw Error("Value passed to 'css' function must be a 'css' function result: "+a+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(n)+i[o+1],i[0]);return new St(e,i,Q)},Qt=(i,t)=>{Y?i.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet):t.forEach(e=>{const s=document.createElement("style"),n=D.litNonce;n!==void 0&&s.setAttribute("nonce",n),s.textContent=e.cssText,i.appendChild(s)})},Et=Y?i=>i:i=>i instanceof CSSStyleSheet?(t=>{let e="";for(const s of t.cssRules)e+=s.cssText;return m(e)})(i):i;/**
|
|
20
|
+
* @license
|
|
21
|
+
* Copyright 2017 Google LLC
|
|
22
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
23
|
+
*/var tt;const H=window,At=H.trustedTypes,te=At?At.emptyScript:"",Ct=H.reactiveElementPolyfillSupport,et={toAttribute(i,t){switch(t){case Boolean:i=i?te:null;break;case Object:case Array:i=i==null?i:JSON.stringify(i)}return i},fromAttribute(i,t){let e=i;switch(t){case Boolean:e=i!==null;break;case Number:e=i===null?null:Number(i);break;case Object:case Array:try{e=JSON.parse(i)}catch{e=null}}return e}},xt=(i,t)=>t!==i&&(t==t||i==i),st={attribute:!0,type:String,converter:et,reflect:!1,hasChanged:xt},it="finalized";class C extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this._$Eu()}static addInitializer(t){var e;this.finalize(),((e=this.h)!==null&&e!==void 0?e:this.h=[]).push(t)}static get observedAttributes(){this.finalize();const t=[];return this.elementProperties.forEach((e,s)=>{const n=this._$Ep(s,e);n!==void 0&&(this._$Ev.set(n,s),t.push(n))}),t}static createProperty(t,e=st){if(e.state&&(e.attribute=!1),this.finalize(),this.elementProperties.set(t,e),!e.noAccessor&&!this.prototype.hasOwnProperty(t)){const s=typeof t=="symbol"?Symbol():"__"+t,n=this.getPropertyDescriptor(t,s,e);n!==void 0&&Object.defineProperty(this.prototype,t,n)}}static getPropertyDescriptor(t,e,s){return{get(){return this[e]},set(n){const o=this[t];this[e]=n,this.requestUpdate(t,o,s)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)||st}static finalize(){if(this.hasOwnProperty(it))return!1;this[it]=!0;const t=Object.getPrototypeOf(this);if(t.finalize(),t.h!==void 0&&(this.h=[...t.h]),this.elementProperties=new Map(t.elementProperties),this._$Ev=new Map,this.hasOwnProperty("properties")){const e=this.properties,s=[...Object.getOwnPropertyNames(e),...Object.getOwnPropertySymbols(e)];for(const n of s)this.createProperty(n,e[n])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const s=new Set(t.flat(1/0).reverse());for(const n of s)e.unshift(Et(n))}else t!==void 0&&e.push(Et(t));return e}static _$Ep(t,e){const s=e.attribute;return s===!1?void 0:typeof s=="string"?s:typeof t=="string"?t.toLowerCase():void 0}_$Eu(){var t;this._$E_=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$Eg(),this.requestUpdate(),(t=this.constructor.h)===null||t===void 0||t.forEach(e=>e(this))}addController(t){var e,s;((e=this._$ES)!==null&&e!==void 0?e:this._$ES=[]).push(t),this.renderRoot!==void 0&&this.isConnected&&((s=t.hostConnected)===null||s===void 0||s.call(t))}removeController(t){var e;(e=this._$ES)===null||e===void 0||e.splice(this._$ES.indexOf(t)>>>0,1)}_$Eg(){this.constructor.elementProperties.forEach((t,e)=>{this.hasOwnProperty(e)&&(this._$Ei.set(e,this[e]),delete this[e])})}createRenderRoot(){var t;const e=(t=this.shadowRoot)!==null&&t!==void 0?t:this.attachShadow(this.constructor.shadowRootOptions);return Qt(e,this.constructor.elementStyles),e}connectedCallback(){var t;this.renderRoot===void 0&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(t=this._$ES)===null||t===void 0||t.forEach(e=>{var s;return(s=e.hostConnected)===null||s===void 0?void 0:s.call(e)})}enableUpdating(t){}disconnectedCallback(){var t;(t=this._$ES)===null||t===void 0||t.forEach(e=>{var s;return(s=e.hostDisconnected)===null||s===void 0?void 0:s.call(e)})}attributeChangedCallback(t,e,s){this._$AK(t,s)}_$EO(t,e,s=st){var n;const o=this.constructor._$Ep(t,s);if(o!==void 0&&s.reflect===!0){const a=(((n=s.converter)===null||n===void 0?void 0:n.toAttribute)!==void 0?s.converter:et).toAttribute(e,s.type);this._$El=t,a==null?this.removeAttribute(o):this.setAttribute(o,a),this._$El=null}}_$AK(t,e){var s;const n=this.constructor,o=n._$Ev.get(t);if(o!==void 0&&this._$El!==o){const a=n.getPropertyOptions(o),l=typeof a.converter=="function"?{fromAttribute:a.converter}:((s=a.converter)===null||s===void 0?void 0:s.fromAttribute)!==void 0?a.converter:et;this._$El=o,this[o]=l.fromAttribute(e,a.type),this._$El=null}}requestUpdate(t,e,s){let n=!0;t!==void 0&&(((s=s||this.constructor.getPropertyOptions(t)).hasChanged||xt)(this[t],e)?(this._$AL.has(t)||this._$AL.set(t,e),s.reflect===!0&&this._$El!==t&&(this._$EC===void 0&&(this._$EC=new Map),this._$EC.set(t,s))):n=!1),!this.isUpdatePending&&n&&(this._$E_=this._$Ej())}async _$Ej(){this.isUpdatePending=!0;try{await this._$E_}catch(e){Promise.reject(e)}const t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var t;if(!this.isUpdatePending)return;this.hasUpdated,this._$Ei&&(this._$Ei.forEach((n,o)=>this[o]=n),this._$Ei=void 0);let e=!1;const s=this._$AL;try{e=this.shouldUpdate(s),e?(this.willUpdate(s),(t=this._$ES)===null||t===void 0||t.forEach(n=>{var o;return(o=n.hostUpdate)===null||o===void 0?void 0:o.call(n)}),this.update(s)):this._$Ek()}catch(n){throw e=!1,this._$Ek(),n}e&&this._$AE(s)}willUpdate(t){}_$AE(t){var e;(e=this._$ES)===null||e===void 0||e.forEach(s=>{var n;return(n=s.hostUpdated)===null||n===void 0?void 0:n.call(s)}),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){this._$EC!==void 0&&(this._$EC.forEach((e,s)=>this._$EO(s,this[s],e)),this._$EC=void 0),this._$Ek()}updated(t){}firstUpdated(t){}}C[it]=!0,C.elementProperties=new Map,C.elementStyles=[],C.shadowRootOptions={mode:"open"},Ct?.({ReactiveElement:C}),((tt=H.reactiveElementVersions)!==null&&tt!==void 0?tt:H.reactiveElementVersions=[]).push("1.6.3");/**
|
|
18
24
|
* @license
|
|
19
25
|
* Copyright 2017 Google LLC
|
|
20
26
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
21
|
-
*/var
|
|
27
|
+
*/var nt,ot;class v extends C{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var t,e;const s=super.createRenderRoot();return(t=(e=this.renderOptions).renderBefore)!==null&&t!==void 0||(e.renderBefore=s.firstChild),s}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=Yt(e,this.renderRoot,this.renderOptions)}connectedCallback(){var t;super.connectedCallback(),(t=this._$Do)===null||t===void 0||t.setConnected(!0)}disconnectedCallback(){var t;super.disconnectedCallback(),(t=this._$Do)===null||t===void 0||t.setConnected(!1)}render(){return S}}v.finalized=!0,v._$litElement$=!0,(nt=globalThis.litElementHydrateSupport)===null||nt===void 0||nt.call(globalThis,{LitElement:v});const Ut=globalThis.litElementPolyfillSupport;Ut?.({LitElement:v}),((ot=globalThis.litElementVersions)!==null&&ot!==void 0?ot:globalThis.litElementVersions=[]).push("3.3.3");var ee=A`
|
|
22
28
|
* {
|
|
23
29
|
box-sizing: border-box;
|
|
24
30
|
}
|
|
@@ -125,7 +131,7 @@
|
|
|
125
131
|
display: none;
|
|
126
132
|
}
|
|
127
133
|
}
|
|
128
|
-
`;const
|
|
134
|
+
`;const se=A`
|
|
129
135
|
:host {
|
|
130
136
|
/* Colors: */
|
|
131
137
|
--cas-snackbar-color-bg: rgb(53, 53, 53);
|
|
@@ -154,8 +160,8 @@
|
|
|
154
160
|
--cas-snackbar-grid-gap: 1rem;
|
|
155
161
|
--cas-snackbar-box-shadow: none;
|
|
156
162
|
}
|
|
157
|
-
`,
|
|
158
|
-
${
|
|
163
|
+
`,ie="#01736C",ne="#5143D5",oe="#364855",Pt="#4D5D68",Ot="#FFFFFF",ae="#E53935",re="#FFB300",ce="#7CB342",le=A`
|
|
164
|
+
${se}
|
|
159
165
|
:host,
|
|
160
166
|
:host([position="bottom left"]) {
|
|
161
167
|
width: fit-content;
|
|
@@ -223,10 +229,10 @@
|
|
|
223
229
|
margin-left: auto;
|
|
224
230
|
margin-right: auto;
|
|
225
231
|
}
|
|
226
|
-
`,
|
|
232
|
+
`,he=A`
|
|
227
233
|
:host {
|
|
228
234
|
display: flex;
|
|
229
|
-
background: ${m(
|
|
235
|
+
background: ${m(Ot)};
|
|
230
236
|
box-shadow: 0 2px 10px #C9CFE3;
|
|
231
237
|
border-radius: 8px;
|
|
232
238
|
width: var(--cas-snackbar-width);
|
|
@@ -239,8 +245,8 @@
|
|
|
239
245
|
align-items: center;
|
|
240
246
|
justify-content: center;
|
|
241
247
|
padding: 14px 12px;
|
|
242
|
-
background-color: ${m(
|
|
243
|
-
color: ${m(
|
|
248
|
+
background-color: ${m(Pt)};
|
|
249
|
+
color: ${m(Ot)};
|
|
244
250
|
border-radius: 8px 0 0 8px;
|
|
245
251
|
}
|
|
246
252
|
:host .content {
|
|
@@ -249,56 +255,56 @@
|
|
|
249
255
|
align-items: center;
|
|
250
256
|
justify-content: space-between;
|
|
251
257
|
gap:12px;
|
|
252
|
-
color: ${m(
|
|
258
|
+
color: ${m(oe)};
|
|
253
259
|
padding: 14px 16px 14px 24px;
|
|
254
260
|
}
|
|
255
261
|
:host .content .text-container cas-text:nth-child(2) {
|
|
256
|
-
color: ${m(
|
|
262
|
+
color: ${m(Pt)};
|
|
257
263
|
}
|
|
258
264
|
:host .content .text-container a {
|
|
259
|
-
color: ${m(
|
|
265
|
+
color: ${m(ie)};
|
|
260
266
|
}
|
|
261
267
|
/* VARIANTS*/
|
|
262
268
|
:host([variant='success']) .icon {
|
|
263
|
-
background-color: ${m(
|
|
269
|
+
background-color: ${m(ce)};
|
|
264
270
|
}
|
|
265
271
|
:host([variant='error']) .icon {
|
|
266
|
-
background-color: ${m(
|
|
272
|
+
background-color: ${m(ae)};
|
|
267
273
|
}
|
|
268
274
|
:host([variant='warning']) .icon {
|
|
269
|
-
background-color: ${m(
|
|
275
|
+
background-color: ${m(re)};
|
|
270
276
|
}
|
|
271
277
|
:host([variant='info']) .icon {
|
|
272
|
-
background-color: ${m(
|
|
278
|
+
background-color: ${m(ne)};
|
|
273
279
|
}
|
|
274
|
-
`,
|
|
280
|
+
`,de={accessibilityLabel:null,animationDone:!1,animationDuration:300,animationName:"default",buttonCallback:null,buttonText:null,customClasses:null,duration:4e3,hideCallback:null,title:"Title is required",message:"Snackbar: It's a snackbar!",linkMessage:null,targetLink:"_parent",showCallback:null,size:"normal",type:"auto",variant:"default"},pe=["default","slide-in","zoom"],ue=["small","normal","large"],me=["auto","dismiss"],be=["default","success","error","warning","info"],Rt={accessibilityLabel:i=>!i||typeof i=="string",animationDuration:i=>!i||typeof i=="number",animationName:i=>!i||typeof i=="string"&&pe.includes(i),buttonCallback:i=>!i||typeof i=="function",buttonText:i=>!i||typeof i=="string",customClasses:i=>!i||typeof i=="string",duration:i=>!i||typeof i=="number"&&!Number.isNaN(i),hideCallback:i=>!i||typeof i=="function",title:i=>!i||typeof i=="string"&&i.length>0,message:i=>!i||typeof i=="string"&&i.length>0,linkMessage:i=>!i||typeof i=="string"&&i.length>0,targetLink:i=>!i||typeof i=="string"&&i.length>0,showCallback:i=>!i||typeof i=="function",size:i=>!i||typeof i=="string"&&ue.includes(i),type:i=>!i||typeof i=="string"&&me.includes(i),variant:i=>!i||typeof i=="string"&&be.includes(i)};function ve(i){return Object.keys(Rt).filter(t=>!Rt[t](i[t])).map(t=>new Error(`${t} is invalid.`))}/**
|
|
275
281
|
* @license
|
|
276
282
|
* Copyright 2020 Google LLC
|
|
277
283
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
278
|
-
*/const
|
|
284
|
+
*/const fe=Symbol.for(""),$e=i=>{if(i?.r===fe)return i?._$litStatic$},Tt=new Map,ge=i=>(t,...e)=>{const s=e.length;let n,o;const a=[],l=[];let r,c=0,h=!1;for(;c<s;){for(r=t[c];c<s&&(o=e[c],(n=$e(o))!==void 0);)r+=n+t[++c],h=!0;c!==s&&l.push(o),a.push(r),c++}if(c===s&&a.push(t[s]),h){const d=a.join("$$lit$$");(t=Tt.get(d))===void 0&&(a.raw=a,Tt.set(d,t=a)),e=l}return i(t,...e)},z=ge(R),Nt={default:{showAnimation:[{opacity:"0"},{opacity:"1"}],hideAnimation:[{opacity:"1"},{opacity:"0"}]},"slide-in":{showAnimation:[{transform:"translateX(-100%)",opacity:"0"},{transform:"translateX(0)",opacity:"1"}],hideAnimation:[{transform:"translateX(0)",opacity:"1"},{transform:"translateX(-100%)",opacity:"0"}]},zoom:{showAnimation:[{transform:"scale(0)",opacity:"0"},{transform:"scale(1)",opacity:"1"}],hideAnimation:[{transform:"scale(1)",opacity:"1"},{transform:"scale(0)",opacity:"0"}]}};function ye({type:i,variant:t}){const s={default:{title:"body2",text:"footnote2"},autoClose:{title:"body1",text:"body1"}}[i==="auto"?"autoClose":"default"],o={success:"flat-success",error:"flat-error",warning:"flat-alert",info:"flat-info"}[t];return{textVariants:s,icon:o}}class _e extends v{static get styles(){return A`${he}`}render(){const{message:t,title:e,linkMessage:s,type:n,targetLink:o,variant:a}=this,{textVariants:l,icon:r}=ye({type:n,variant:a}),c=z`<cas-text variant=${l.text}>${t}</cas-text>`,h=z`<cas-text variant=${l.text}><a href="${s}" target="${o}">${t}</a></cas-text>`;return z`
|
|
279
285
|
<div class="icon">
|
|
280
286
|
<cas-icon name=${r} size="24"></cas-icon>
|
|
281
287
|
</div>
|
|
282
288
|
<div class="content">
|
|
283
289
|
<div class="text-container">
|
|
284
|
-
<cas-text id="snackbarMessage" variant=${
|
|
285
|
-
${s?
|
|
290
|
+
<cas-text id="snackbarMessage" variant=${l.title}>${e}</cas-text>
|
|
291
|
+
${s?h:c}
|
|
286
292
|
</div>
|
|
287
|
-
${n==="dismiss"?
|
|
293
|
+
${n==="dismiss"?z`<div id="snackbarButton" class="close-icon" @click=${this._handleButtonClick}>
|
|
288
294
|
<cas-icon name="flat-close" size="16"></cas-icon>
|
|
289
295
|
</div>`:""}
|
|
290
296
|
</div>
|
|
291
|
-
`}static get properties(){return{animationDone:{type:Boolean},animationDuration:{type:Number},animationName:{type:String},buttonCallback:{type:Function},buttonText:{type:String},duration:{type:Number},id:{type:String},title:{type:String},message:{type:String},linkMessage:{type:String},targetLink:{type:String},type:{type:String},variant:{type:String}}}constructor(){super(),this._timer=this._timer.bind(this),this._showStart=Date.now()}connectedCallback(){super.connectedCallback(),(this.type==="auto"||this.type!=="dismiss")&&this._timer(),this.setAttribute("aria-label",this.accessibilityLabel||`Snackbar: ${this.message}`),this.setAttribute("role","alert")}_timer(){Date.now()-this._showStart>=this.duration?(this._fadeOut(),cancelAnimationFrame(this._timer)):requestAnimationFrame(this._timer)}update(t){super.update(t),this.animationDone||this._fadeIn()}_fadeIn(){const t=
|
|
297
|
+
`}static get properties(){return{animationDone:{type:Boolean},animationDuration:{type:Number},animationName:{type:String},buttonCallback:{type:Function},buttonText:{type:String},duration:{type:Number},id:{type:String},title:{type:String},message:{type:String},linkMessage:{type:String},targetLink:{type:String},type:{type:String},variant:{type:String}}}constructor(){super(),this._timer=this._timer.bind(this),this._showStart=Date.now()}connectedCallback(){super.connectedCallback(),(this.type==="auto"||this.type!=="dismiss")&&this._timer(),this.setAttribute("aria-label",this.accessibilityLabel||`Snackbar: ${this.message}`),this.setAttribute("role","alert")}_timer(){Date.now()-this._showStart>=this.duration?(this._fadeOut(),cancelAnimationFrame(this._timer)):requestAnimationFrame(this._timer)}update(t){super.update(t),this.animationDone||this._fadeIn()}_fadeIn(){const t=Nt[this.animationName].showAnimation,e={duration:this.animationDuration,iterations:1},s=this.animate(t,e);s.onfinish=()=>{typeof this.showCallback=="function"&&this.showCallback()},this.dispatchEvent(new CustomEvent("cas-snackbar-bar-has-faded-in",{bubbles:!0,composed:!0,detail:{snackbarID:this.id}}))}_fadeOut(){const t=Nt[this.animationName].hideAnimation,e={duration:this.animationDuration,iterations:1},s=this.animate(t,e);s.onfinish=()=>{typeof this.hideCallback=="function"&&this.hideCallback(),this._removeSnackbar()}}_removeSnackbar(){this.dispatchEvent(new CustomEvent("cas-snackbar-snackbar-remove",{bubbles:!0,composed:!0,detail:{snackbarID:this.id}}))}_handleButtonClick(){this._fadeOut(),typeof this.buttonCallback=="function"&&this.buttonCallback()}}class we extends v{static shadowRootOptions={...v.shadowRootOptions,mode:"open"};constructor(){super(),this.position="bottom left"}static properties={position:{type:String}};render(){const{position:t}=this;return R`
|
|
292
298
|
<cas-snackbar-provider-custom position=${t}></cas-snackbar-provider-custom>
|
|
293
299
|
<slot></slot>
|
|
294
|
-
`}}class
|
|
295
|
-
${
|
|
296
|
-
`}constructor(){super(),this.newSnackbarProperties=["accessibilityLabel","animationDuration","animationName","buttonCallback","duration","hideCallback","title","message","linkMessage","targetLink","showCallback","type","hasFadedIn"],this.newSnackbarAttributes=["id","size","variant"],window.addEventListener("cas-snackbar-snackbar-add",this._handleSnackbarAdd.bind(this)),window.addEventListener("cas-snackbar-snackbar-remove",this._handleSnackbarRemove.bind(this))}connectedCallback(){super.connectedCallback(),this.dispatchEvent(new CustomEvent("cas-snackbar-snackbar-ready",{bubbles:!0,composed:!0})),this.setAttribute("aria-live","polite")}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("cas-snackbar-snackbar-add",this._handleSnackbarAdd.bind(this)),window.removeEventListener("cas-snackbar-snackbar-remove",this._handleSnackbarRemove.bind(this))}_handleSnackbarAdd(t){const e=t.detail||{},s=
|
|
300
|
+
`}}class Mt extends v{render(){return R``}static get styles(){return A`
|
|
301
|
+
${le}
|
|
302
|
+
`}constructor(){super(),this.newSnackbarProperties=["accessibilityLabel","animationDuration","animationName","buttonCallback","duration","hideCallback","title","message","linkMessage","targetLink","showCallback","type","hasFadedIn"],this.newSnackbarAttributes=["id","size","variant"],window.addEventListener("cas-snackbar-snackbar-add",this._handleSnackbarAdd.bind(this)),window.addEventListener("cas-snackbar-snackbar-remove",this._handleSnackbarRemove.bind(this))}connectedCallback(){super.connectedCallback(),this.dispatchEvent(new CustomEvent("cas-snackbar-snackbar-ready",{bubbles:!0,composed:!0})),this.setAttribute("aria-live","polite")}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("cas-snackbar-snackbar-add",this._handleSnackbarAdd.bind(this)),window.removeEventListener("cas-snackbar-snackbar-remove",this._handleSnackbarRemove.bind(this))}_handleSnackbarAdd(t){const e=t.detail||{},s=ve(e);if(s.length>0)for(const{message:n}of s)console.error("There was a problem creating your snackbar. Please check your custom event options.",n);else{const n={id:Date.now(),...de,...e},o=this._createNewSnackbar(n);this.shadowRoot.prepend(o),this.dispatchEvent(new CustomEvent("cas-snackbar-snackbar-bar-added",{bubbles:!0,composed:!0,detail:{snackbarID:o.id}}))}}_handleSnackbarRemove(t){this.shadowRoot.getElementById(t.detail.snackbarID).remove(),this.dispatchEvent(new CustomEvent("cas-snackbar-snackbar-bar-removed",{bubbles:!0,composed:!0,detail:{snackbarID:t.detail.snackbarID}}))}_createNewSnackbar(t){document.querySelector("cas-snackbar-provider")?.setAttribute("position",t.position);const s=document.createElement("cas-snackbar");return this.newSnackbarProperties.forEach(n=>{s[n]=t[n]}),this.newSnackbarAttributes.forEach(n=>{s.setAttribute(n,t[n])}),t.customClasses&&(s.className+=t.customClasses),s}}const j=({variant:i,config:t})=>{const{title:e,message:s,linkMessage:n,targetLink:o,autoHide:a,autoHideDuration:l,position:r}=t;window.dispatchEvent(new CustomEvent("cas-snackbar-snackbar-add",{bubbles:!0,composed:!0,detail:{variant:i,title:e,message:s,linkMessage:n,targetLink:o,position:r||"bottom right",animationName:"slide-in",type:a?"auto":"dismiss",duration:l||4e3}}))},B={SUCCESS:"success",ERROR:"error",WARNING:"warning",INFO:"info"},Lt={success:({title:i,message:t,linkMessage:e,targetLink:s,autoHide:n,autoHideDuration:o,position:a})=>{j({variant:B.SUCCESS,config:{title:i,message:t,linkMessage:e,targetLink:s,autoHide:n,autoHideDuration:o,position:a}})},error:({title:i,message:t,linkMessage:e,targetLink:s,autoHide:n,autoHideDuration:o,position:a})=>{j({variant:B.ERROR,config:{title:i,message:t,linkMessage:e,targetLink:s,autoHide:n,autoHideDuration:o,position:a}})},warning:({title:i,message:t,linkMessage:e,targetLink:s,autoHide:n,autoHideDuration:o,position:a})=>{j({variant:B.WARNING,config:{title:i,message:t,linkMessage:e,targetLink:s,autoHide:n,autoHideDuration:o,position:a}})},info:({title:i,message:t,linkMessage:e,targetLink:s,autoHide:n,autoHideDuration:o,position:a})=>{j({variant:B.INFO,config:{title:i,message:t,linkMessage:e,targetLink:s,autoHide:n,autoHideDuration:o,position:a}})}};customElements.get("cas-snackbar")||customElements.define("cas-snackbar",_e),customElements.get("cas-snackbar-provider-custom")||customElements.define("cas-snackbar-provider-custom",Mt),customElements.get("cas-snackbar-provider")||customElements.define("cas-snackbar-provider",we);class It extends v{static styles=ee;constructor(){super(),this.open=!1,this.text=document.title,this.isMobile=window.innerWidth<768,this.shareFacebook=this.shareFacebook.bind(this),this.shareTwitter=this.shareTwitter.bind(this),this.shareWhatsApp=this.shareWhatsApp.bind(this),this.shareTelegram=this.shareTelegram.bind(this),this.shareEmail=this.shareEmail.bind(this),this.shareInstagram=this.shareInstagram.bind(this),this.platforms=[{title:"WhatsApp",icon:"flat-whatsapp",share:this.shareWhatsApp},{title:"Instagram",icon:"flat-instagramSolid",share:this.shareInstagram},{title:"Facebook",icon:"flat-facebook",share:this.shareFacebook},{title:"Twitter",icon:"flat-twitter",share:this.shareTwitter},{title:"Correo",icon:"flat-mail",share:this.shareEmail}]}static get properties(){return{text:{type:String}}}firstUpdated(){this.shadowRoot.querySelector("cas-modal")?.addEventListener("close",()=>{this.open=!1,this.requestUpdate()});const e=()=>{this.isMobile=window.innerWidth<768,this.requestUpdate()};window.addEventListener("resize",e)}render(){const t=this.isMobile?"190px":"initial";return R`
|
|
297
303
|
<cas-modal variant="compact" open="${this.open}" width=${t}>
|
|
298
304
|
<div class="modal">
|
|
299
305
|
<cas-text variant="headline3" class="hide-mobile">Compartir en:</cas-text>
|
|
300
306
|
<div class="list">
|
|
301
|
-
${this.platforms.map(({title:e,icon:s,share:n})=>
|
|
307
|
+
${this.platforms.map(({title:e,icon:s,share:n})=>R` <button class="item" @click="${()=>n()}">
|
|
302
308
|
<div class="icon">
|
|
303
309
|
<cas-icon name="${s}" size="24"></cas-icon>
|
|
304
310
|
</div>
|
|
@@ -325,4 +331,4 @@
|
|
|
325
331
|
<button @click="${this.handleOpenShare}" class="share-icon">
|
|
326
332
|
<cas-icon name="flat-share" size="20"></cas-icon>
|
|
327
333
|
</button>
|
|
328
|
-
`}handleOpenShare(){this.open=!0,this.requestUpdate();try{window.dataLayer.push({event:"evento-interactivo","evento-interactivo-categoria":"boton_compartir_blog","evento-interactivo-accion":"click","evento-interactivo-etiqueta":"compartir_articulo"})}catch(t){console.error("Error al enviar evento a GTM",t)}}shareFacebook(){const t=`https://www.facebook.com/sharer/sharer.php?u=${encodeURIComponent(window.location.href)}`;window.open(t,"_blank","width=550,height=420")}shareTwitter(){const t=`https://twitter.com/intent/tweet?text=${encodeURIComponent(`${this.text} ${window.location.href}`)}`;window.open(t,"_blank","width=550,height=420")}shareWhatsApp(){const t=`https://wa.me/?text=${encodeURIComponent(`${this.text} ${window.location.href}`)}`;window.open(t,"_blank","width=550,height=420")}shareTelegram(){const t=`https://t.me/share/url?text=${encodeURIComponent(`${this.text} ${window.location.href}`)}`;window.open(t,"_blank","width=550,height=420")}shareEmail(){const t=`mailto:?subject=${encodeURIComponent(this.text)}&body=${encodeURIComponent(window.location.href)}`;window.open(t,"_blank")}shareInstagram(){this.copyToClipboard(),window.open("https://www.instagram.com/direct/inbox/","_blank")}copyToClipboard(){navigator.clipboard.writeText(window.location.href)
|
|
334
|
+
`}handleOpenShare(){this.open=!0,this.requestUpdate();try{window.dataLayer.push({event:"evento-interactivo","evento-interactivo-categoria":"boton_compartir_blog","evento-interactivo-accion":"click","evento-interactivo-etiqueta":"compartir_articulo"})}catch(t){console.error("Error al enviar evento a GTM",t)}}shareFacebook(){const t=`https://www.facebook.com/sharer/sharer.php?u=${encodeURIComponent(window.location.href)}`;window.open(t,"_blank","width=550,height=420")}shareTwitter(){const t=`https://twitter.com/intent/tweet?text=${encodeURIComponent(`${this.text} ${window.location.href}`)}`;window.open(t,"_blank","width=550,height=420")}shareWhatsApp(){const t=`https://wa.me/?text=${encodeURIComponent(`${this.text} ${window.location.href}`)}`;window.open(t,"_blank","width=550,height=420")}shareTelegram(){const t=`https://t.me/share/url?text=${encodeURIComponent(`${this.text} ${window.location.href}`)}`;window.open(t,"_blank","width=550,height=420")}shareEmail(){const t=`mailto:?subject=${encodeURIComponent(this.text)}&body=${encodeURIComponent(window.location.href)}`;window.open(t,"_blank")}shareInstagram(){this.copyToClipboard(),window.open("https://www.instagram.com/direct/inbox/","_blank")}copyToClipboard(){navigator.clipboard.writeText(window.location.href),Lt.success({title:"Enlace copiado al portapapeles",position:"top center",autoHide:!0,autoHideDuration:1600})}}customElements.define("cas-share",It),f.CasShare=It,f.CasSnackbarProvider=Mt,f.snackbar=Lt,Object.defineProperties(f,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
package/build/cas-snackbar.js
CHANGED
|
@@ -1,24 +1,30 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(g,v){typeof exports=="object"&&typeof module<"u"?v(exports):typeof define=="function"&&define.amd?define(["exports"],v):(g=typeof globalThis<"u"?globalThis:g||self,v(g["cas-snackbar"]={}))})(this,function(g){"use strict";/**
|
|
2
2
|
* @license
|
|
3
3
|
* Copyright 2019 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
5
|
-
*/const
|
|
5
|
+
*/const v=window,V=v.ShadowRoot&&(v.ShadyCSS===void 0||v.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,rt=Symbol(),at=new WeakMap;class Lt{constructor(t,e,s){if(this._$cssResult$=!0,s!==rt)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const e=this.t;if(V&&t===void 0){const s=e!==void 0&&e.length===1;s&&(t=at.get(e)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),s&&at.set(e,t))}return t}toString(){return this.cssText}}const Dt=i=>new Lt(typeof i=="string"?i:i+"",void 0,rt),Ht=(i,t)=>{V?i.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet):t.forEach(e=>{const s=document.createElement("style"),n=v.litNonce;n!==void 0&&s.setAttribute("nonce",n),s.textContent=e.cssText,i.appendChild(s)})},ct=V?i=>i:i=>i instanceof CSSStyleSheet?(t=>{let e="";for(const s of t.cssRules)e+=s.cssText;return Dt(e)})(i):i;/**
|
|
6
6
|
* @license
|
|
7
7
|
* Copyright 2017 Google LLC
|
|
8
8
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
9
|
-
*/var F;const
|
|
9
|
+
*/var F;const T=window,lt=T.trustedTypes,It=lt?lt.emptyScript:"",ht=T.reactiveElementPolyfillSupport,W={toAttribute(i,t){switch(t){case Boolean:i=i?It:null;break;case Object:case Array:i=i==null?i:JSON.stringify(i)}return i},fromAttribute(i,t){let e=i;switch(t){case Boolean:e=i!==null;break;case Number:e=i===null?null:Number(i);break;case Object:case Array:try{e=JSON.parse(i)}catch{e=null}}return e}},dt=(i,t)=>t!==i&&(t==t||i==i),q={attribute:!0,type:String,converter:W,reflect:!1,hasChanged:dt},K="finalized";class C extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this._$Eu()}static addInitializer(t){var e;this.finalize(),((e=this.h)!==null&&e!==void 0?e:this.h=[]).push(t)}static get observedAttributes(){this.finalize();const t=[];return this.elementProperties.forEach((e,s)=>{const n=this._$Ep(s,e);n!==void 0&&(this._$Ev.set(n,s),t.push(n))}),t}static createProperty(t,e=q){if(e.state&&(e.attribute=!1),this.finalize(),this.elementProperties.set(t,e),!e.noAccessor&&!this.prototype.hasOwnProperty(t)){const s=typeof t=="symbol"?Symbol():"__"+t,n=this.getPropertyDescriptor(t,s,e);n!==void 0&&Object.defineProperty(this.prototype,t,n)}}static getPropertyDescriptor(t,e,s){return{get(){return this[e]},set(n){const o=this[t];this[e]=n,this.requestUpdate(t,o,s)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)||q}static finalize(){if(this.hasOwnProperty(K))return!1;this[K]=!0;const t=Object.getPrototypeOf(this);if(t.finalize(),t.h!==void 0&&(this.h=[...t.h]),this.elementProperties=new Map(t.elementProperties),this._$Ev=new Map,this.hasOwnProperty("properties")){const e=this.properties,s=[...Object.getOwnPropertyNames(e),...Object.getOwnPropertySymbols(e)];for(const n of s)this.createProperty(n,e[n])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const s=new Set(t.flat(1/0).reverse());for(const n of s)e.unshift(ct(n))}else t!==void 0&&e.push(ct(t));return e}static _$Ep(t,e){const s=e.attribute;return s===!1?void 0:typeof s=="string"?s:typeof t=="string"?t.toLowerCase():void 0}_$Eu(){var t;this._$E_=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$Eg(),this.requestUpdate(),(t=this.constructor.h)===null||t===void 0||t.forEach(e=>e(this))}addController(t){var e,s;((e=this._$ES)!==null&&e!==void 0?e:this._$ES=[]).push(t),this.renderRoot!==void 0&&this.isConnected&&((s=t.hostConnected)===null||s===void 0||s.call(t))}removeController(t){var e;(e=this._$ES)===null||e===void 0||e.splice(this._$ES.indexOf(t)>>>0,1)}_$Eg(){this.constructor.elementProperties.forEach((t,e)=>{this.hasOwnProperty(e)&&(this._$Ei.set(e,this[e]),delete this[e])})}createRenderRoot(){var t;const e=(t=this.shadowRoot)!==null&&t!==void 0?t:this.attachShadow(this.constructor.shadowRootOptions);return Ht(e,this.constructor.elementStyles),e}connectedCallback(){var t;this.renderRoot===void 0&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(t=this._$ES)===null||t===void 0||t.forEach(e=>{var s;return(s=e.hostConnected)===null||s===void 0?void 0:s.call(e)})}enableUpdating(t){}disconnectedCallback(){var t;(t=this._$ES)===null||t===void 0||t.forEach(e=>{var s;return(s=e.hostDisconnected)===null||s===void 0?void 0:s.call(e)})}attributeChangedCallback(t,e,s){this._$AK(t,s)}_$EO(t,e,s=q){var n;const o=this.constructor._$Ep(t,s);if(o!==void 0&&s.reflect===!0){const r=(((n=s.converter)===null||n===void 0?void 0:n.toAttribute)!==void 0?s.converter:W).toAttribute(e,s.type);this._$El=t,r==null?this.removeAttribute(o):this.setAttribute(o,r),this._$El=null}}_$AK(t,e){var s;const n=this.constructor,o=n._$Ev.get(t);if(o!==void 0&&this._$El!==o){const r=n.getPropertyOptions(o),l=typeof r.converter=="function"?{fromAttribute:r.converter}:((s=r.converter)===null||s===void 0?void 0:s.fromAttribute)!==void 0?r.converter:W;this._$El=o,this[o]=l.fromAttribute(e,r.type),this._$El=null}}requestUpdate(t,e,s){let n=!0;t!==void 0&&(((s=s||this.constructor.getPropertyOptions(t)).hasChanged||dt)(this[t],e)?(this._$AL.has(t)||this._$AL.set(t,e),s.reflect===!0&&this._$El!==t&&(this._$EC===void 0&&(this._$EC=new Map),this._$EC.set(t,s))):n=!1),!this.isUpdatePending&&n&&(this._$E_=this._$Ej())}async _$Ej(){this.isUpdatePending=!0;try{await this._$E_}catch(e){Promise.reject(e)}const t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var t;if(!this.isUpdatePending)return;this.hasUpdated,this._$Ei&&(this._$Ei.forEach((n,o)=>this[o]=n),this._$Ei=void 0);let e=!1;const s=this._$AL;try{e=this.shouldUpdate(s),e?(this.willUpdate(s),(t=this._$ES)===null||t===void 0||t.forEach(n=>{var o;return(o=n.hostUpdate)===null||o===void 0?void 0:o.call(n)}),this.update(s)):this._$Ek()}catch(n){throw e=!1,this._$Ek(),n}e&&this._$AE(s)}willUpdate(t){}_$AE(t){var e;(e=this._$ES)===null||e===void 0||e.forEach(s=>{var n;return(n=s.hostUpdated)===null||n===void 0?void 0:n.call(s)}),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){this._$EC!==void 0&&(this._$EC.forEach((e,s)=>this._$EO(s,this[s],e)),this._$EC=void 0),this._$Ek()}updated(t){}firstUpdated(t){}}C[K]=!0,C.elementProperties=new Map,C.elementStyles=[],C.shadowRootOptions={mode:"open"},ht?.({ReactiveElement:C}),((F=T.reactiveElementVersions)!==null&&F!==void 0?F:T.reactiveElementVersions=[]).push("1.6.3");/**
|
|
10
10
|
* @license
|
|
11
11
|
* Copyright 2017 Google LLC
|
|
12
12
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
13
|
-
*/var
|
|
14
|
-
\f\r](?:([^\\s"'>=/]+)([
|
|
15
|
-
\f\r]
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
*/var X;const M=window,k=M.trustedTypes,ut=k?k.createPolicy("lit-html",{createHTML:i=>i}):void 0,J="$lit$",$=`lit$${(Math.random()+"").slice(9)}$`,pt="?"+$,zt=`<${pt}>`,_=document,x=()=>_.createComment(""),P=i=>i===null||typeof i!="object"&&typeof i!="function",mt=Array.isArray,jt=i=>mt(i)||typeof i?.[Symbol.iterator]=="function",Z=`[
|
|
14
|
+
\f\r]`,U=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,bt=/-->/g,vt=/>/g,y=RegExp(`>|${Z}(?:([^\\s"'>=/]+)(${Z}*=${Z}*(?:[^
|
|
15
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),$t=/'/g,ft=/"/g,gt=/^(?:script|style|textarea|title)$/i,Bt=i=>(t,...e)=>({_$litType$:i,strings:t,values:e}),G=Bt(1),A=Symbol.for("lit-noChange"),u=Symbol.for("lit-nothing"),_t=new WeakMap,S=_.createTreeWalker(_,129,null,!1);function yt(i,t){if(!Array.isArray(i)||!i.hasOwnProperty("raw"))throw Error("invalid template strings array");return ut!==void 0?ut.createHTML(t):t}const Vt=(i,t)=>{const e=i.length-1,s=[];let n,o=t===2?"<svg>":"",r=U;for(let l=0;l<e;l++){const a=i[l];let c,h,d=-1,p=0;for(;p<a.length&&(r.lastIndex=p,h=r.exec(a),h!==null);)p=r.lastIndex,r===U?h[1]==="!--"?r=bt:h[1]!==void 0?r=vt:h[2]!==void 0?(gt.test(h[2])&&(n=RegExp("</"+h[2],"g")),r=y):h[3]!==void 0&&(r=y):r===y?h[0]===">"?(r=n??U,d=-1):h[1]===void 0?d=-2:(d=r.lastIndex-h[2].length,c=h[1],r=h[3]===void 0?y:h[3]==='"'?ft:$t):r===ft||r===$t?r=y:r===bt||r===vt?r=U:(r=y,n=void 0);const b=r===y&&i[l+1].startsWith("/>")?" ":"";o+=r===U?a+zt:d>=0?(s.push(c),a.slice(0,d)+J+a.slice(d)+$+b):a+$+(d===-2?(s.push(void 0),l):b)}return[yt(i,o+(i[e]||"<?>")+(t===2?"</svg>":"")),s]};class O{constructor({strings:t,_$litType$:e},s){let n;this.parts=[];let o=0,r=0;const l=t.length-1,a=this.parts,[c,h]=Vt(t,e);if(this.el=O.createElement(c,s),S.currentNode=this.el.content,e===2){const d=this.el.content,p=d.firstChild;p.remove(),d.append(...p.childNodes)}for(;(n=S.nextNode())!==null&&a.length<l;){if(n.nodeType===1){if(n.hasAttributes()){const d=[];for(const p of n.getAttributeNames())if(p.endsWith(J)||p.startsWith($)){const b=h[r++];if(d.push(p),b!==void 0){const ye=n.getAttribute(b.toLowerCase()+J).split($),B=/([.?@])?(.*)/.exec(b);a.push({type:1,index:o,name:B[2],strings:ye,ctor:B[1]==="."?Wt:B[1]==="?"?Kt:B[1]==="@"?Xt:L})}else a.push({type:6,index:o})}for(const p of d)n.removeAttribute(p)}if(gt.test(n.tagName)){const d=n.textContent.split($),p=d.length-1;if(p>0){n.textContent=k?k.emptyScript:"";for(let b=0;b<p;b++)n.append(d[b],x()),S.nextNode(),a.push({type:2,index:++o});n.append(d[p],x())}}}else if(n.nodeType===8)if(n.data===pt)a.push({type:2,index:o});else{let d=-1;for(;(d=n.data.indexOf($,d+1))!==-1;)a.push({type:7,index:o}),d+=$.length-1}o++}}static createElement(t,e){const s=_.createElement("template");return s.innerHTML=t,s}}function E(i,t,e=i,s){var n,o,r,l;if(t===A)return t;let a=s!==void 0?(n=e._$Co)===null||n===void 0?void 0:n[s]:e._$Cl;const c=P(t)?void 0:t._$litDirective$;return a?.constructor!==c&&((o=a?._$AO)===null||o===void 0||o.call(a,!1),c===void 0?a=void 0:(a=new c(i),a._$AT(i,e,s)),s!==void 0?((r=(l=e)._$Co)!==null&&r!==void 0?r:l._$Co=[])[s]=a:e._$Cl=a),a!==void 0&&(t=E(i,a._$AS(i,t.values),a,s)),t}class Ft{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){var e;const{el:{content:s},parts:n}=this._$AD,o=((e=t?.creationScope)!==null&&e!==void 0?e:_).importNode(s,!0);S.currentNode=o;let r=S.nextNode(),l=0,a=0,c=n[0];for(;c!==void 0;){if(l===c.index){let h;c.type===2?h=new N(r,r.nextSibling,this,t):c.type===1?h=new c.ctor(r,c.name,c.strings,this,t):c.type===6&&(h=new Jt(r,this,t)),this._$AV.push(h),c=n[++a]}l!==c?.index&&(r=S.nextNode(),l++)}return S.currentNode=_,o}v(t){let e=0;for(const s of this._$AV)s!==void 0&&(s.strings!==void 0?(s._$AI(t,s,e),e+=s.strings.length-2):s._$AI(t[e])),e++}}class N{constructor(t,e,s,n){var o;this.type=2,this._$AH=u,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=s,this.options=n,this._$Cp=(o=n?.isConnected)===null||o===void 0||o}get _$AU(){var t,e;return(e=(t=this._$AM)===null||t===void 0?void 0:t._$AU)!==null&&e!==void 0?e:this._$Cp}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return e!==void 0&&t?.nodeType===11&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=E(this,t,e),P(t)?t===u||t==null||t===""?(this._$AH!==u&&this._$AR(),this._$AH=u):t!==this._$AH&&t!==A&&this._(t):t._$litType$!==void 0?this.g(t):t.nodeType!==void 0?this.$(t):jt(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!==u&&P(this._$AH)?this._$AA.nextSibling.data=t:this.$(_.createTextNode(t)),this._$AH=t}g(t){var e;const{values:s,_$litType$:n}=t,o=typeof n=="number"?this._$AC(t):(n.el===void 0&&(n.el=O.createElement(yt(n.h,n.h[0]),this.options)),n);if(((e=this._$AH)===null||e===void 0?void 0:e._$AD)===o)this._$AH.v(s);else{const r=new Ft(o,this),l=r.u(this.options);r.v(s),this.$(l),this._$AH=r}}_$AC(t){let e=_t.get(t.strings);return e===void 0&&_t.set(t.strings,e=new O(t)),e}T(t){mt(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let s,n=0;for(const o of t)n===e.length?e.push(s=new N(this.k(x()),this.k(x()),this,this.options)):s=e[n],s._$AI(o),n++;n<e.length&&(this._$AR(s&&s._$AB.nextSibling,n),e.length=n)}_$AR(t=this._$AA.nextSibling,e){var s;for((s=this._$AP)===null||s===void 0||s.call(this,!1,!0,e);t&&t!==this._$AB;){const n=t.nextSibling;t.remove(),t=n}}setConnected(t){var e;this._$AM===void 0&&(this._$Cp=t,(e=this._$AP)===null||e===void 0||e.call(this,t))}}class L{constructor(t,e,s,n,o){this.type=1,this._$AH=u,this._$AN=void 0,this.element=t,this.name=e,this._$AM=n,this.options=o,s.length>2||s[0]!==""||s[1]!==""?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=u}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(t,e=this,s,n){const o=this.strings;let r=!1;if(o===void 0)t=E(this,t,e,0),r=!P(t)||t!==this._$AH&&t!==A,r&&(this._$AH=t);else{const l=t;let a,c;for(t=o[0],a=0;a<o.length-1;a++)c=E(this,l[s+a],e,a),c===A&&(c=this._$AH[a]),r||(r=!P(c)||c!==this._$AH[a]),c===u?t=u:t!==u&&(t+=(c??"")+o[a+1]),this._$AH[a]=c}r&&!n&&this.j(t)}j(t){t===u?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}class Wt extends L{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===u?void 0:t}}const qt=k?k.emptyScript:"";class Kt extends L{constructor(){super(...arguments),this.type=4}j(t){t&&t!==u?this.element.setAttribute(this.name,qt):this.element.removeAttribute(this.name)}}class Xt extends L{constructor(t,e,s,n,o){super(t,e,s,n,o),this.type=5}_$AI(t,e=this){var s;if((t=(s=E(this,t,e,0))!==null&&s!==void 0?s:u)===A)return;const n=this._$AH,o=t===u&&n!==u||t.capture!==n.capture||t.once!==n.once||t.passive!==n.passive,r=t!==u&&(n===u||o);o&&this.element.removeEventListener(this.name,this,n),r&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var e,s;typeof this._$AH=="function"?this._$AH.call((s=(e=this.options)===null||e===void 0?void 0:e.host)!==null&&s!==void 0?s:this.element,t):this._$AH.handleEvent(t)}}class Jt{constructor(t,e,s){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=s}get _$AU(){return this._$AM._$AU}_$AI(t){E(this,t)}}const St=M.litHtmlPolyfillSupport;St?.(O,N),((X=M.litHtmlVersions)!==null&&X!==void 0?X:M.litHtmlVersions=[]).push("2.8.0");const Zt=(i,t,e)=>{var s,n;const o=(s=e?.renderBefore)!==null&&s!==void 0?s:t;let r=o._$litPart$;if(r===void 0){const l=(n=e?.renderBefore)!==null&&n!==void 0?n:null;o._$litPart$=r=new N(t.insertBefore(x(),l),l,void 0,e??{})}return r._$AI(i),r};/**
|
|
16
|
+
* @license
|
|
17
|
+
* Copyright 2019 Google LLC
|
|
18
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
19
|
+
*/const D=window,Y=D.ShadowRoot&&(D.ShadyCSS===void 0||D.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Q=Symbol(),kt=new WeakMap;class At{constructor(t,e,s){if(this._$cssResult$=!0,s!==Q)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const e=this.t;if(Y&&t===void 0){const s=e!==void 0&&e.length===1;s&&(t=kt.get(e)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),s&&kt.set(e,t))}return t}toString(){return this.cssText}}const m=i=>new At(typeof i=="string"?i:i+"",void 0,Q),R=(i,...t)=>{const e=i.length===1?i[0]:t.reduce((s,n,o)=>s+(r=>{if(r._$cssResult$===!0)return r.cssText;if(typeof r=="number")return r;throw Error("Value passed to 'css' function must be a 'css' function result: "+r+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(n)+i[o+1],i[0]);return new At(e,i,Q)},Gt=(i,t)=>{Y?i.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet):t.forEach(e=>{const s=document.createElement("style"),n=D.litNonce;n!==void 0&&s.setAttribute("nonce",n),s.textContent=e.cssText,i.appendChild(s)})},Et=Y?i=>i:i=>i instanceof CSSStyleSheet?(t=>{let e="";for(const s of t.cssRules)e+=s.cssText;return m(e)})(i):i;/**
|
|
20
|
+
* @license
|
|
21
|
+
* Copyright 2017 Google LLC
|
|
22
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
23
|
+
*/var tt;const H=window,wt=H.trustedTypes,Yt=wt?wt.emptyScript:"",Ct=H.reactiveElementPolyfillSupport,et={toAttribute(i,t){switch(t){case Boolean:i=i?Yt:null;break;case Object:case Array:i=i==null?i:JSON.stringify(i)}return i},fromAttribute(i,t){let e=i;switch(t){case Boolean:e=i!==null;break;case Number:e=i===null?null:Number(i);break;case Object:case Array:try{e=JSON.parse(i)}catch{e=null}}return e}},xt=(i,t)=>t!==i&&(t==t||i==i),st={attribute:!0,type:String,converter:et,reflect:!1,hasChanged:xt},it="finalized";class w extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this._$Eu()}static addInitializer(t){var e;this.finalize(),((e=this.h)!==null&&e!==void 0?e:this.h=[]).push(t)}static get observedAttributes(){this.finalize();const t=[];return this.elementProperties.forEach((e,s)=>{const n=this._$Ep(s,e);n!==void 0&&(this._$Ev.set(n,s),t.push(n))}),t}static createProperty(t,e=st){if(e.state&&(e.attribute=!1),this.finalize(),this.elementProperties.set(t,e),!e.noAccessor&&!this.prototype.hasOwnProperty(t)){const s=typeof t=="symbol"?Symbol():"__"+t,n=this.getPropertyDescriptor(t,s,e);n!==void 0&&Object.defineProperty(this.prototype,t,n)}}static getPropertyDescriptor(t,e,s){return{get(){return this[e]},set(n){const o=this[t];this[e]=n,this.requestUpdate(t,o,s)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)||st}static finalize(){if(this.hasOwnProperty(it))return!1;this[it]=!0;const t=Object.getPrototypeOf(this);if(t.finalize(),t.h!==void 0&&(this.h=[...t.h]),this.elementProperties=new Map(t.elementProperties),this._$Ev=new Map,this.hasOwnProperty("properties")){const e=this.properties,s=[...Object.getOwnPropertyNames(e),...Object.getOwnPropertySymbols(e)];for(const n of s)this.createProperty(n,e[n])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const s=new Set(t.flat(1/0).reverse());for(const n of s)e.unshift(Et(n))}else t!==void 0&&e.push(Et(t));return e}static _$Ep(t,e){const s=e.attribute;return s===!1?void 0:typeof s=="string"?s:typeof t=="string"?t.toLowerCase():void 0}_$Eu(){var t;this._$E_=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$Eg(),this.requestUpdate(),(t=this.constructor.h)===null||t===void 0||t.forEach(e=>e(this))}addController(t){var e,s;((e=this._$ES)!==null&&e!==void 0?e:this._$ES=[]).push(t),this.renderRoot!==void 0&&this.isConnected&&((s=t.hostConnected)===null||s===void 0||s.call(t))}removeController(t){var e;(e=this._$ES)===null||e===void 0||e.splice(this._$ES.indexOf(t)>>>0,1)}_$Eg(){this.constructor.elementProperties.forEach((t,e)=>{this.hasOwnProperty(e)&&(this._$Ei.set(e,this[e]),delete this[e])})}createRenderRoot(){var t;const e=(t=this.shadowRoot)!==null&&t!==void 0?t:this.attachShadow(this.constructor.shadowRootOptions);return Gt(e,this.constructor.elementStyles),e}connectedCallback(){var t;this.renderRoot===void 0&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(t=this._$ES)===null||t===void 0||t.forEach(e=>{var s;return(s=e.hostConnected)===null||s===void 0?void 0:s.call(e)})}enableUpdating(t){}disconnectedCallback(){var t;(t=this._$ES)===null||t===void 0||t.forEach(e=>{var s;return(s=e.hostDisconnected)===null||s===void 0?void 0:s.call(e)})}attributeChangedCallback(t,e,s){this._$AK(t,s)}_$EO(t,e,s=st){var n;const o=this.constructor._$Ep(t,s);if(o!==void 0&&s.reflect===!0){const r=(((n=s.converter)===null||n===void 0?void 0:n.toAttribute)!==void 0?s.converter:et).toAttribute(e,s.type);this._$El=t,r==null?this.removeAttribute(o):this.setAttribute(o,r),this._$El=null}}_$AK(t,e){var s;const n=this.constructor,o=n._$Ev.get(t);if(o!==void 0&&this._$El!==o){const r=n.getPropertyOptions(o),l=typeof r.converter=="function"?{fromAttribute:r.converter}:((s=r.converter)===null||s===void 0?void 0:s.fromAttribute)!==void 0?r.converter:et;this._$El=o,this[o]=l.fromAttribute(e,r.type),this._$El=null}}requestUpdate(t,e,s){let n=!0;t!==void 0&&(((s=s||this.constructor.getPropertyOptions(t)).hasChanged||xt)(this[t],e)?(this._$AL.has(t)||this._$AL.set(t,e),s.reflect===!0&&this._$El!==t&&(this._$EC===void 0&&(this._$EC=new Map),this._$EC.set(t,s))):n=!1),!this.isUpdatePending&&n&&(this._$E_=this._$Ej())}async _$Ej(){this.isUpdatePending=!0;try{await this._$E_}catch(e){Promise.reject(e)}const t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var t;if(!this.isUpdatePending)return;this.hasUpdated,this._$Ei&&(this._$Ei.forEach((n,o)=>this[o]=n),this._$Ei=void 0);let e=!1;const s=this._$AL;try{e=this.shouldUpdate(s),e?(this.willUpdate(s),(t=this._$ES)===null||t===void 0||t.forEach(n=>{var o;return(o=n.hostUpdate)===null||o===void 0?void 0:o.call(n)}),this.update(s)):this._$Ek()}catch(n){throw e=!1,this._$Ek(),n}e&&this._$AE(s)}willUpdate(t){}_$AE(t){var e;(e=this._$ES)===null||e===void 0||e.forEach(s=>{var n;return(n=s.hostUpdated)===null||n===void 0?void 0:n.call(s)}),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){this._$EC!==void 0&&(this._$EC.forEach((e,s)=>this._$EO(s,this[s],e)),this._$EC=void 0),this._$Ek()}updated(t){}firstUpdated(t){}}w[it]=!0,w.elementProperties=new Map,w.elementStyles=[],w.shadowRootOptions={mode:"open"},Ct?.({ReactiveElement:w}),((tt=H.reactiveElementVersions)!==null&&tt!==void 0?tt:H.reactiveElementVersions=[]).push("1.6.3");/**
|
|
18
24
|
* @license
|
|
19
25
|
* Copyright 2017 Google LLC
|
|
20
26
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
21
|
-
*/var
|
|
27
|
+
*/var nt,ot;class f extends w{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var t,e;const s=super.createRenderRoot();return(t=(e=this.renderOptions).renderBefore)!==null&&t!==void 0||(e.renderBefore=s.firstChild),s}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=Zt(e,this.renderRoot,this.renderOptions)}connectedCallback(){var t;super.connectedCallback(),(t=this._$Do)===null||t===void 0||t.setConnected(!0)}disconnectedCallback(){var t;super.disconnectedCallback(),(t=this._$Do)===null||t===void 0||t.setConnected(!1)}render(){return A}}f.finalized=!0,f._$litElement$=!0,(nt=globalThis.litElementHydrateSupport)===null||nt===void 0||nt.call(globalThis,{LitElement:f});const Pt=globalThis.litElementPolyfillSupport;Pt?.({LitElement:f}),((ot=globalThis.litElementVersions)!==null&&ot!==void 0?ot:globalThis.litElementVersions=[]).push("3.3.3");const Qt=R`
|
|
22
28
|
:host {
|
|
23
29
|
/* Colors: */
|
|
24
30
|
--cas-snackbar-color-bg: rgb(53, 53, 53);
|
|
@@ -47,8 +53,8 @@
|
|
|
47
53
|
--cas-snackbar-grid-gap: 1rem;
|
|
48
54
|
--cas-snackbar-box-shadow: none;
|
|
49
55
|
}
|
|
50
|
-
`,
|
|
51
|
-
${
|
|
56
|
+
`,te="#01736C",ee="#5143D5",se="#364855",Ut="#4D5D68",Ot="#FFFFFF",ie="#E53935",ne="#FFB300",oe="#7CB342",re=R`
|
|
57
|
+
${Qt}
|
|
52
58
|
:host,
|
|
53
59
|
:host([position="bottom left"]) {
|
|
54
60
|
width: fit-content;
|
|
@@ -116,10 +122,10 @@
|
|
|
116
122
|
margin-left: auto;
|
|
117
123
|
margin-right: auto;
|
|
118
124
|
}
|
|
119
|
-
`,
|
|
125
|
+
`,ae=R`
|
|
120
126
|
:host {
|
|
121
127
|
display: flex;
|
|
122
|
-
background: ${m(
|
|
128
|
+
background: ${m(Ot)};
|
|
123
129
|
box-shadow: 0 2px 10px #C9CFE3;
|
|
124
130
|
border-radius: 8px;
|
|
125
131
|
width: var(--cas-snackbar-width);
|
|
@@ -132,8 +138,8 @@
|
|
|
132
138
|
align-items: center;
|
|
133
139
|
justify-content: center;
|
|
134
140
|
padding: 14px 12px;
|
|
135
|
-
background-color: ${m(
|
|
136
|
-
color: ${m(
|
|
141
|
+
background-color: ${m(Ut)};
|
|
142
|
+
color: ${m(Ot)};
|
|
137
143
|
border-radius: 8px 0 0 8px;
|
|
138
144
|
}
|
|
139
145
|
:host .content {
|
|
@@ -142,48 +148,48 @@
|
|
|
142
148
|
align-items: center;
|
|
143
149
|
justify-content: space-between;
|
|
144
150
|
gap:12px;
|
|
145
|
-
color: ${m(
|
|
151
|
+
color: ${m(se)};
|
|
146
152
|
padding: 14px 16px 14px 24px;
|
|
147
153
|
}
|
|
148
154
|
:host .content .text-container cas-text:nth-child(2) {
|
|
149
|
-
color: ${m(
|
|
155
|
+
color: ${m(Ut)};
|
|
150
156
|
}
|
|
151
157
|
:host .content .text-container a {
|
|
152
|
-
color: ${m(
|
|
158
|
+
color: ${m(te)};
|
|
153
159
|
}
|
|
154
160
|
/* VARIANTS*/
|
|
155
161
|
:host([variant='success']) .icon {
|
|
156
|
-
background-color: ${m(
|
|
162
|
+
background-color: ${m(oe)};
|
|
157
163
|
}
|
|
158
164
|
:host([variant='error']) .icon {
|
|
159
|
-
background-color: ${m(
|
|
165
|
+
background-color: ${m(ie)};
|
|
160
166
|
}
|
|
161
167
|
:host([variant='warning']) .icon {
|
|
162
|
-
background-color: ${m(
|
|
168
|
+
background-color: ${m(ne)};
|
|
163
169
|
}
|
|
164
170
|
:host([variant='info']) .icon {
|
|
165
|
-
background-color: ${m(
|
|
171
|
+
background-color: ${m(ee)};
|
|
166
172
|
}
|
|
167
|
-
`,
|
|
173
|
+
`,ce={accessibilityLabel:null,animationDone:!1,animationDuration:300,animationName:"default",buttonCallback:null,buttonText:null,customClasses:null,duration:4e3,hideCallback:null,title:"Title is required",message:"Snackbar: It's a snackbar!",linkMessage:null,targetLink:"_parent",showCallback:null,size:"normal",type:"auto",variant:"default"},le=["default","slide-in","zoom"],he=["small","normal","large"],de=["auto","dismiss"],ue=["default","success","error","warning","info"],Nt={accessibilityLabel:i=>!i||typeof i=="string",animationDuration:i=>!i||typeof i=="number",animationName:i=>!i||typeof i=="string"&&le.includes(i),buttonCallback:i=>!i||typeof i=="function",buttonText:i=>!i||typeof i=="string",customClasses:i=>!i||typeof i=="string",duration:i=>!i||typeof i=="number"&&!Number.isNaN(i),hideCallback:i=>!i||typeof i=="function",title:i=>!i||typeof i=="string"&&i.length>0,message:i=>!i||typeof i=="string"&&i.length>0,linkMessage:i=>!i||typeof i=="string"&&i.length>0,targetLink:i=>!i||typeof i=="string"&&i.length>0,showCallback:i=>!i||typeof i=="function",size:i=>!i||typeof i=="string"&&he.includes(i),type:i=>!i||typeof i=="string"&&de.includes(i),variant:i=>!i||typeof i=="string"&&ue.includes(i)};function pe(i){return Object.keys(Nt).filter(t=>!Nt[t](i[t])).map(t=>new Error(`${t} is invalid.`))}/**
|
|
168
174
|
* @license
|
|
169
175
|
* Copyright 2020 Google LLC
|
|
170
176
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
171
|
-
*/const
|
|
177
|
+
*/const me=Symbol.for(""),be=i=>{if(i?.r===me)return i?._$litStatic$},Rt=new Map,ve=i=>(t,...e)=>{const s=e.length;let n,o;const r=[],l=[];let a,c=0,h=!1;for(;c<s;){for(a=t[c];c<s&&(o=e[c],(n=be(o))!==void 0);)a+=n+t[++c],h=!0;c!==s&&l.push(o),r.push(a),c++}if(c===s&&r.push(t[s]),h){const d=r.join("$$lit$$");(t=Rt.get(d))===void 0&&(r.raw=r,Rt.set(d,t=r)),e=l}return i(t,...e)},I=ve(G),Tt={default:{showAnimation:[{opacity:"0"},{opacity:"1"}],hideAnimation:[{opacity:"1"},{opacity:"0"}]},"slide-in":{showAnimation:[{transform:"translateX(-100%)",opacity:"0"},{transform:"translateX(0)",opacity:"1"}],hideAnimation:[{transform:"translateX(0)",opacity:"1"},{transform:"translateX(-100%)",opacity:"0"}]},zoom:{showAnimation:[{transform:"scale(0)",opacity:"0"},{transform:"scale(1)",opacity:"1"}],hideAnimation:[{transform:"scale(1)",opacity:"1"},{transform:"scale(0)",opacity:"0"}]}};function $e({type:i,variant:t}){const s={default:{title:"body2",text:"footnote2"},autoClose:{title:"body1",text:"body1"}}[i==="auto"?"autoClose":"default"],o={success:"flat-success",error:"flat-error",warning:"flat-alert",info:"flat-info"}[t];return{textVariants:s,icon:o}}class fe extends f{static get styles(){return R`${ae}`}render(){const{message:t,title:e,linkMessage:s,type:n,targetLink:o,variant:r}=this,{textVariants:l,icon:a}=$e({type:n,variant:r}),c=I`<cas-text variant=${l.text}>${t}</cas-text>`,h=I`<cas-text variant=${l.text}><a href="${s}" target="${o}">${t}</a></cas-text>`;return I`
|
|
172
178
|
<div class="icon">
|
|
173
|
-
<cas-icon name=${
|
|
179
|
+
<cas-icon name=${a} size="24"></cas-icon>
|
|
174
180
|
</div>
|
|
175
181
|
<div class="content">
|
|
176
182
|
<div class="text-container">
|
|
177
|
-
<cas-text id="snackbarMessage" variant=${
|
|
178
|
-
${s?
|
|
183
|
+
<cas-text id="snackbarMessage" variant=${l.title}>${e}</cas-text>
|
|
184
|
+
${s?h:c}
|
|
179
185
|
</div>
|
|
180
|
-
${n==="dismiss"?
|
|
186
|
+
${n==="dismiss"?I`<div id="snackbarButton" class="close-icon" @click=${this._handleButtonClick}>
|
|
181
187
|
<cas-icon name="flat-close" size="16"></cas-icon>
|
|
182
188
|
</div>`:""}
|
|
183
189
|
</div>
|
|
184
|
-
`}static get properties(){return{animationDone:{type:Boolean},animationDuration:{type:Number},animationName:{type:String},buttonCallback:{type:Function},buttonText:{type:String},duration:{type:Number},id:{type:String},title:{type:String},message:{type:String},linkMessage:{type:String},targetLink:{type:String},type:{type:String},variant:{type:String}}}constructor(){super(),this._timer=this._timer.bind(this),this._showStart=Date.now()}connectedCallback(){super.connectedCallback(),(this.type==="auto"||this.type!=="dismiss")&&this._timer(),this.setAttribute("aria-label",this.accessibilityLabel||`Snackbar: ${this.message}`),this.setAttribute("role","alert")}_timer(){Date.now()-this._showStart>=this.duration?(this._fadeOut(),cancelAnimationFrame(this._timer)):requestAnimationFrame(this._timer)}update(t){super.update(t),this.animationDone||this._fadeIn()}_fadeIn(){const t=
|
|
190
|
+
`}static get properties(){return{animationDone:{type:Boolean},animationDuration:{type:Number},animationName:{type:String},buttonCallback:{type:Function},buttonText:{type:String},duration:{type:Number},id:{type:String},title:{type:String},message:{type:String},linkMessage:{type:String},targetLink:{type:String},type:{type:String},variant:{type:String}}}constructor(){super(),this._timer=this._timer.bind(this),this._showStart=Date.now()}connectedCallback(){super.connectedCallback(),(this.type==="auto"||this.type!=="dismiss")&&this._timer(),this.setAttribute("aria-label",this.accessibilityLabel||`Snackbar: ${this.message}`),this.setAttribute("role","alert")}_timer(){Date.now()-this._showStart>=this.duration?(this._fadeOut(),cancelAnimationFrame(this._timer)):requestAnimationFrame(this._timer)}update(t){super.update(t),this.animationDone||this._fadeIn()}_fadeIn(){const t=Tt[this.animationName].showAnimation,e={duration:this.animationDuration,iterations:1},s=this.animate(t,e);s.onfinish=()=>{typeof this.showCallback=="function"&&this.showCallback()},this.dispatchEvent(new CustomEvent("cas-snackbar-bar-has-faded-in",{bubbles:!0,composed:!0,detail:{snackbarID:this.id}}))}_fadeOut(){const t=Tt[this.animationName].hideAnimation,e={duration:this.animationDuration,iterations:1},s=this.animate(t,e);s.onfinish=()=>{typeof this.hideCallback=="function"&&this.hideCallback(),this._removeSnackbar()}}_removeSnackbar(){this.dispatchEvent(new CustomEvent("cas-snackbar-snackbar-remove",{bubbles:!0,composed:!0,detail:{snackbarID:this.id}}))}_handleButtonClick(){this._fadeOut(),typeof this.buttonCallback=="function"&&this.buttonCallback()}}class ge extends f{static shadowRootOptions={...f.shadowRootOptions,mode:"open"};constructor(){super(),this.position="bottom left"}static properties={position:{type:String}};render(){const{position:t}=this;return G`
|
|
185
191
|
<cas-snackbar-provider-custom position=${t}></cas-snackbar-provider-custom>
|
|
186
192
|
<slot></slot>
|
|
187
|
-
`}}class
|
|
188
|
-
${
|
|
189
|
-
`}constructor(){super(),this.newSnackbarProperties=["accessibilityLabel","animationDuration","animationName","buttonCallback","duration","hideCallback","title","message","linkMessage","targetLink","showCallback","type","hasFadedIn"],this.newSnackbarAttributes=["id","size","variant"],window.addEventListener("cas-snackbar-snackbar-add",this._handleSnackbarAdd.bind(this)),window.addEventListener("cas-snackbar-snackbar-remove",this._handleSnackbarRemove.bind(this))}connectedCallback(){super.connectedCallback(),this.dispatchEvent(new CustomEvent("cas-snackbar-snackbar-ready",{bubbles:!0,composed:!0})),this.setAttribute("aria-live","polite")}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("cas-snackbar-snackbar-add",this._handleSnackbarAdd.bind(this)),window.removeEventListener("cas-snackbar-snackbar-remove",this._handleSnackbarRemove.bind(this))}_handleSnackbarAdd(t){const e=t.detail||{},s=
|
|
193
|
+
`}}class Mt extends f{render(){return G``}static get styles(){return R`
|
|
194
|
+
${re}
|
|
195
|
+
`}constructor(){super(),this.newSnackbarProperties=["accessibilityLabel","animationDuration","animationName","buttonCallback","duration","hideCallback","title","message","linkMessage","targetLink","showCallback","type","hasFadedIn"],this.newSnackbarAttributes=["id","size","variant"],window.addEventListener("cas-snackbar-snackbar-add",this._handleSnackbarAdd.bind(this)),window.addEventListener("cas-snackbar-snackbar-remove",this._handleSnackbarRemove.bind(this))}connectedCallback(){super.connectedCallback(),this.dispatchEvent(new CustomEvent("cas-snackbar-snackbar-ready",{bubbles:!0,composed:!0})),this.setAttribute("aria-live","polite")}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("cas-snackbar-snackbar-add",this._handleSnackbarAdd.bind(this)),window.removeEventListener("cas-snackbar-snackbar-remove",this._handleSnackbarRemove.bind(this))}_handleSnackbarAdd(t){const e=t.detail||{},s=pe(e);if(s.length>0)for(const{message:n}of s)console.error("There was a problem creating your snackbar. Please check your custom event options.",n);else{const n={id:Date.now(),...ce,...e},o=this._createNewSnackbar(n);this.shadowRoot.prepend(o),this.dispatchEvent(new CustomEvent("cas-snackbar-snackbar-bar-added",{bubbles:!0,composed:!0,detail:{snackbarID:o.id}}))}}_handleSnackbarRemove(t){this.shadowRoot.getElementById(t.detail.snackbarID).remove(),this.dispatchEvent(new CustomEvent("cas-snackbar-snackbar-bar-removed",{bubbles:!0,composed:!0,detail:{snackbarID:t.detail.snackbarID}}))}_createNewSnackbar(t){document.querySelector("cas-snackbar-provider")?.setAttribute("position",t.position);const s=document.createElement("cas-snackbar");return this.newSnackbarProperties.forEach(n=>{s[n]=t[n]}),this.newSnackbarAttributes.forEach(n=>{s.setAttribute(n,t[n])}),t.customClasses&&(s.className+=t.customClasses),s}}const z=({variant:i,config:t})=>{const{title:e,message:s,linkMessage:n,targetLink:o,autoHide:r,autoHideDuration:l,position:a}=t;window.dispatchEvent(new CustomEvent("cas-snackbar-snackbar-add",{bubbles:!0,composed:!0,detail:{variant:i,title:e,message:s,linkMessage:n,targetLink:o,position:a||"bottom right",animationName:"slide-in",type:r?"auto":"dismiss",duration:l||4e3}}))},j={SUCCESS:"success",ERROR:"error",WARNING:"warning",INFO:"info"},_e={success:({title:i,message:t,linkMessage:e,targetLink:s,autoHide:n,autoHideDuration:o,position:r})=>{z({variant:j.SUCCESS,config:{title:i,message:t,linkMessage:e,targetLink:s,autoHide:n,autoHideDuration:o,position:r}})},error:({title:i,message:t,linkMessage:e,targetLink:s,autoHide:n,autoHideDuration:o,position:r})=>{z({variant:j.ERROR,config:{title:i,message:t,linkMessage:e,targetLink:s,autoHide:n,autoHideDuration:o,position:r}})},warning:({title:i,message:t,linkMessage:e,targetLink:s,autoHide:n,autoHideDuration:o,position:r})=>{z({variant:j.WARNING,config:{title:i,message:t,linkMessage:e,targetLink:s,autoHide:n,autoHideDuration:o,position:r}})},info:({title:i,message:t,linkMessage:e,targetLink:s,autoHide:n,autoHideDuration:o,position:r})=>{z({variant:j.INFO,config:{title:i,message:t,linkMessage:e,targetLink:s,autoHide:n,autoHideDuration:o,position:r}})}};customElements.get("cas-snackbar")||customElements.define("cas-snackbar",fe),customElements.get("cas-snackbar-provider-custom")||customElements.define("cas-snackbar-provider-custom",Mt),customElements.get("cas-snackbar-provider")||customElements.define("cas-snackbar-provider",ge),g.CasSnackbarProvider=Mt,g.snackbar=_e,Object.defineProperties(g,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|