@descope/web-components-ui 1.87.0 → 1.89.0

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.
@@ -1,2 +1,2 @@
1
- (self.webpackChunk_descope_web_components_ui=self.webpackChunk_descope_web_components_ui||[]).push([[743,1202,2250,6724],{6301:(t,e,i)=>{"use strict";i.r(e),i.d(e,{ImageClass:()=>u,componentName:()=>d});var n=i(88961),s=i(72270),r=i(63200),o=i(25964),a=i(25414);const l=t=>{const e=a.A.sanitize(t,{USE_PROFILES:{svg:!0,svgFilters:!0}});return(new DOMParser).parseFromString(e,"image/svg+xml").querySelector("svg")},d=(0,o.xE)("image"),c=["src","src-dark"];class h extends((0,s.qu)({componentName:d,baseSelector:"slot"})){static get observedAttributes(){return c}constructor(){super(),this.attachShadow({mode:"open"}).innerHTML="\n\t\t<slot></slot>\n\t",(0,o.fz)("\n\t\t\t:host {\n\t\t\t\tdisplay: inline-flex;\n\t\t\t}\n :host > slot {\n width: 100%;\n height: 100%;\n\t\t\t\tbox-sizing: border-box;\n\t\t\t\tdisplay: flex;\n\t\t\t\toverflow: hidden;\n\t\t\t}\n\n ::slotted(*) {\n width: 100%;\n\t\t\t}\n\n .hidden {\n display: none;\n }\n ",this)}init(){super.init?.(),this.toggleVisibility(this.src)}onThemeChange(){this.renderImage()}toggleVisibility(t){t?this.classList.remove("hidden"):this.classList.add("hidden")}get legacySrc(){return this.getAttribute("src")}get themeSrc(){return this.getAttribute(`src-${this.currentThemeName}`)}get src(){return this.themeSrc||this.legacySrc}updateFillColor(t){[t,...t.querySelectorAll("*[fill]")].forEach((t=>{t.setAttribute("fill",`var(${u.cssVarList.fill}, ${t.getAttribute("fill")||"''"})`)}))}renderImage(){this.toggleVisibility(this.src),(async t=>{try{let e;if((t=>t.startsWith("data:image/svg+xml;base64,"))(t)){const i=atob(t.slice(26));e=l(i)}else if("svg"===(t=>{const e=t.match(/\.([0-9a-z]+)(?:[\\?#]|$)/i);return e?e[1]:null})(t)){const i=await fetch(t),n=await i.text();e=l(n)}else e=(t=>{const e=document.createElement("img");return e.setAttribute("src",t),e})(t);return e.style.setProperty("max-width","100%"),e.style.setProperty("max-height","100%"),e}catch{return null}})(this.src).then((t=>{this.innerHTML="",t&&(this.updateFillColor(t),this.appendChild(t))}))}shouldRender(t){const e=this.getAttribute(t);return this.src===e}attributeChangedCallback(t,e,i){super.attributeChangedCallback?.(t,e,i),e!==i&&this.shouldRender(t)&&this.renderImage()}}const u=(0,r.Zz)((0,n.RF)({mappings:{fill:{},height:{selector:()=>":host"},width:{selector:()=>":host"}}}),n.VO,n.tQ)(h);customElements.define(d,u)},10767:(t,e,i)=>{"use strict";i.d(e,{G:()=>n});const n=t=>class extends t{get isLoading(){return"true"===this.getAttribute("loading")}click(){this.isLoading||super.click()}}},15887:(t,e,i)=>{"use strict";i.r(e),i.d(e,{TimerClass:()=>b,componentName:()=>h});var n=i(88961),s=i(72270),r=i(63200),o=i(25964),a=i(44006),l=i.n(a),d=i(98538);const c=(t,e=2)=>String(t).padStart(e,"0"),h=(0,o.xE)("timer"),u=["seconds","hide-icon","paused"],p=(0,s.qu)({componentName:h,baseSelector:":host > .wrapper"}),{host:m,icon:g,timer:M}={host:{selector:()=>":host"},icon:{selector:()=>".icon"},timer:{selector:()=>".timer"}},b=(0,r.Zz)((0,n.RF)({mappings:{fontSize:{},iconSize:[{...g,property:"width"},{...g,property:"height"}],fontFamily:{},minHeight:{},fontWeight:{...M},lineHeight:{...M},textColor:{...M,property:"color"},gap:{},textAlign:{property:"justify-content"},hostWidth:{...m,property:"width"},hostDirection:{...m,property:"direction"},iconColor:{...g,property:d.S.cssVarList.fill}}}),n.VO,n.tQ)(class extends p{#t=0;#e;static get observedAttributes(){return u.concat(p.observedAttributes||[])}constructor(){super(),this.attachShadow({mode:"open"}).innerHTML=`\n <div class="wrapper">\n <descope-icon src="${l()}" class="icon"></descope-icon>\n <div class="timer"></div>\n </div>\n\t\t`,(0,o.fz)("\n :host {\n display: inline-flex;\n user-select: none;\n -webkit-user-select: none;\n }\n .wrapper {\n display: flex;\n align-items: center;\n flex-direction: row;\n width: 100%;\n }\n .hidden {\n display: none;\n }\n ",this),this.icon=this.shadowRoot.querySelector(".icon"),this.timer=this.shadowRoot.querySelector(".timer")}get seconds(){const t=this.getAttribute("seconds"),e=1e3*parseInt(t||0,10);return Math.max(0,e)}get isPaused(){return"true"===this.getAttribute("paused")}init(){super.init?.(),this.#t=this.seconds}startInterval(){this.#t?this.#e=setInterval((()=>{this.#i(),this.#t||this.stop(),this.#n(this.#t)}),1e3):this.stop()}stopInterval(){clearInterval(this.#e)}#i(){this.#t=this.#t-1e3}reset(){this.#t=this.seconds,this.#n(this.#t),this.isPaused||(this.dispatchEvent(new CustomEvent("timer-started",{bubbles:!0})),this.startInterval())}stop(){this.stopInterval(),this.#t=0,this.#n(this.#t),this.dispatchEvent(new CustomEvent("timer-ended",{bubbles:!0}))}pause(){this.setAttribute("paused","true"),this.stopInterval()}resume(){this.removeAttribute("paused"),this.startInterval()}#n(t){this.timer.textContent=((t=0)=>{const e=Math.floor(t/1e3),i=Math.floor(e/3600),n=Math.floor(e%3600/60),s=e%60;return[...i?[c(i)]:[],c(n),c(s)].join(":")})(t)}#s(t){this.icon.classList.toggle("hidden",t)}#r(t){setTimeout((()=>{t?this.pause():this.#e||this.resume()}))}attributeChangedCallback(t,e,i){super.attributeChangedCallback?.(t,e,i),i!==e&&("seconds"===t&&this.reset(),"hide-icon"===t&&this.#s("true"===i),"paused"===t&&this.#r("true"===i))}});i(56737),customElements.define(h,b)},19624:(t,e,i)=>{"use strict";i.d(e,{J:()=>p,T:()=>l});var n=i(63200),s=i(25964),r=i(88961),o=i(98538),a=i(10767);const l=(0,s.xE)("button"),{host:d,label:c,slottedIcon:h}={host:{selector:()=>":host"},label:{selector:"::part(label)"},slottedIcon:{selector:()=>"::slotted(descope-icon)"}};let u;const p=(0,n.Zz)((0,r.RF)({mappings:{hostWidth:{property:"width"},hostHeight:{property:"height"},hostDirection:{...d,property:"direction"},fontSize:{},fontFamily:{},cursor:{},backgroundColor:{},outlineOffset:{},outlineColor:{},outlineStyle:{},outlineWidth:{},borderRadius:{},borderColor:{},borderStyle:{},borderWidth:{},verticalPadding:[{property:"padding-top"},{property:"padding-bottom"}],horizontalPadding:[{property:"padding-right",fallback:"0.875em"},{property:"padding-left",fallback:"0.875em"}],labelTextColor:{property:"color"},iconColor:{selector:()=>"::slotted(*)",property:o.S.cssVarList.fill},labelTextDecoration:{...c,property:"text-decoration"},labelSpacing:{...c,property:"gap"},textAlign:{...c,property:"justify-content",fallback:"center"},iconSize:[{...h,property:"width"},{...h,property:"height"}]}}),a.G,r.VO,r.tQ)((0,r.tz)({slots:["","prefix","label","suffix"],wrappedEleName:"vaadin-button",style:()=>`\n\t\t\t\n\t:host {\n\t\tdisplay: inline-block;\n\t\tbox-sizing: border-box;\n\t}\n\tvaadin-button::before,\n\tvaadin-button::after {\n\t\topacity: 0;\n\t}\n\tvaadin-button {\n\t\tmargin: 0;\n\t\tmin-width: 0;\n\t\twidth: 100%;\n\t\theight: auto;\n\t\tbox-shadow: none;\n\t}\n\tvaadin-button::part(label) {\n\t\tpadding: 0;\n width: 100%;\n\t}\n\tvaadin-button::part(prefix) {\n\t\tmargin-left: 0;\n\t\tmargin-right: 0;\n\t}\n\n\t\t\t\n\tvaadin-button::part(prefix),\n\tvaadin-button::part(label) {\n\t\tdisplay: flex;\n\t\talign-items: center;\n\t}\n\n\t\t\t${u}\n\t\t\tvaadin-button::part(label) { pointer-events: none; }\n\t\t\t:host {\n\t\t\t\tpadding: calc(var(${p.cssVarList.outlineWidth}) + var(${p.cssVarList.outlineOffset}));\n\t\t\t}\n :host([full-width="true"]) {\n width: var(${p.cssVarList.hostWidth});\n }\n\t\t\tvaadin-button {\n\t\t\t\theight: calc(var(${p.cssVarList.hostHeight}) - var(${p.cssVarList.outlineWidth}) - var(${p.cssVarList.outlineOffset}));\n\t\t\t}\n\t\t\t[square="true"]:not([full-width="true"]) {\n\t\t\t\twidth: calc(var(${p.cssVarList.hostWidth}) - var(${p.cssVarList.outlineWidth}) - var(${p.cssVarList.outlineOffset}));\n padding: 0;\n\t\t\t}\n\t\t`,excludeAttrsSync:["tabindex"],componentName:l})),{color:m,fontSize:g}=p.cssVarList;u=`\n\t@keyframes spin {\n\t\t0% { -webkit-transform: rotate(0deg); }\n\t\t100% { -webkit-transform: rotate(360deg); }\n\t}\n\t:host([loading="true"]) ::before {\n\t\tanimation: spin 2s linear infinite;\n\t\tposition: absolute;\n\t\tcontent: '';\n\t\tz-index: 1;\n\t\tbox-sizing: border-box;\n\t\tborder-radius: 50%;\n\t\tborder-bottom-color: transparent;\n\t\tborder-left-color: transparent;\n\t\tborder-style: solid;\n\t\tcolor: var(${m});\n\t\ttop: calc(50% - (var(${g}) / 2));\n\t\tleft: calc(50% - (var(${g}) / 2));\n\t\tborder-width: calc(var(${g}) / 10);\n\t\twidth: var(${g});\n\t\theight: var(${g});\n\t}\n\t:host([disabled="true"]),\n\t:host([loading="true"]) {\n\t\tpointer-events: none;\n\t}\n\t:host([loading="true"]) ::part(prefix),\n\t:host([loading="true"]) ::part(label) {\n\t\tvisibility: hidden;\n\t}\n`},30576:(t,e,i)=>{"use strict";i.r(e),i.d(e,{ButtonClass:()=>n.J,componentName:()=>n.T});var n=i(19624);i(83799),customElements.define(n.T,n.J)},44006:t=>{t.exports="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMWVtIiBoZWlnaHQ9IjFlbSIgdmlld0JveD0iMCAwIDEwNCAxMDQiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+IDxwYXRoIGQ9Ik01MC4zMzM0IDAuMzMzMjUyQzIyLjgzMzQgMC4zMzMyNTIgMC4zMzMzNzQgMjIuODMzMyAwLjMzMzM3NCA1MC4zMzMzQzAuMzMzMzc0IDc3LjgzMzMgMjIuODMzNCAxMDAuMzMzIDUwLjMzMzQgMTAwLjMzM0M3Ny44MzM0IDEwMC4zMzMgMTAwLjMzMyA3Ny44MzMzIDEwMC4zMzMgNTAuMzMzM0MxMDAuMzMzIDIyLjgzMzMgNzcuODMzNCAwLjMzMzI1MiA1MC4zMzM0IDAuMzMzMjUyWk01MC4zMzM0IDg3LjgzMzNDMjkuNzA4NCA4Ny44MzMzIDEyLjgzMzQgNzAuOTU4MyAxMi44MzM0IDUwLjMzMzNDMTIuODMzNCAyOS43MDgzIDI5LjcwODQgMTIuODMzMyA1MC4zMzM0IDEyLjgzMzNDNzAuOTU4NCAxMi44MzMzIDg3LjgzMzQgMjkuNzA4MyA4Ny44MzM0IDUwLjMzMzNDODcuODMzNCA3MC45NTgzIDcwLjk1ODQgODcuODMzMyA1MC4zMzM0IDg3LjgzMzNaIiBmaWxsPSIjMTgxQTFDIi8+IDxwYXRoIGQ9Ik01MC4zMzI4IDE5LjA4MzNINDQuMDgyOFY1Ni41ODMySDc1LjMzMjhWNTAuMzMzMkg1MC4zMzI4VjE5LjA4MzNaIiBmaWxsPSIjMTgxQTFDIi8+IDwvc3ZnPiA="},56737:(t,e,i)=>{"use strict";i.r(e),i.d(e,{IconClass:()=>n.S,componentName:()=>n.T}),i(6301);var n=i(98538);customElements.define(n.T,n.S)},60096:(t,e,i)=>{"use strict";i.r(e),i.d(e,{TimerButtonClass:()=>m,componentName:()=>a});var n=i(88961),s=i(72270),r=i(63200),o=i(25964);const a=(0,o.xE)("timer-button"),l=["button-variant","button-mode","size","text-align","full-width"],d={"button-variant":"variant","button-mode":"mode"},c=["timer-seconds","timer-hide-icon","timer-paused","size","text-align","full-width"],h={"timer-seconds":"seconds","timer-hide-icon":"hide-icon","timer-paused":"paused"},u=(0,s.qu)({componentName:a,baseSelector:":host > div"}),{host:p}={host:{selector:()=>":host"},icon:{selector:".icon"},timer:{selector:".timer"}},m=(0,r.Zz)((0,n.RF)({mappings:{gap:{},flexDirection:{},hostWidth:{...p,property:"width"},hostDirection:{...p,property:"direction"}}}),n.VO,n.tQ)(class extends u{constructor(){super(),this.attachShadow({mode:"open"}).innerHTML='\n <div class="wrapper">\n <descope-timer class="timer"></descope-timer>\n <descope-button class="button" disabled="true">\n <slot></slot>\n </descope-button>\n </div>\n\t\t',(0,o.fz)("\n :host {\n display: inline-flex;\n }\n .wrapper {\n display: flex;\n flex-direction: column;\n gap: 0.5em;\n align-items: center;\n width: 100%;\n }\n .timer {\n flex: 1;\n }\n ",this),this.timer=this.shadowRoot.querySelector(".timer"),this.button=this.shadowRoot.querySelector(".button"),this.timer.addEventListener("timer-started",(()=>this.onTimerStarted())),this.timer.addEventListener("timer-ended",(()=>this.onTimerEnded())),this.button.addEventListener("click",this.onClick.bind(this))}set onclick(t){this.button.onclick=t}init(){super.init?.(),(0,o.EA)(this,this.button,{includeAttrs:l,mapAttrs:d}),(0,o.EA)(this,this.timer,{includeAttrs:c,mapAttrs:h}),this.button.shadowRoot.querySelector("vaadin-button").setAttribute("disabled","true")}onTimerStarted(){this.toggleButtonDisable(!0)}onTimerEnded(){this.toggleButtonDisable(!1)}onClick(){this.timer.reset()}toggleButtonDisable(t){setTimeout((()=>{t?this.button.setAttribute("disabled","true"):this.button.removeAttribute("disabled")}))}});i(30576),i(15887),customElements.define(a,m)},98538:(t,e,i)=>{"use strict";i.d(e,{S:()=>a,T:()=>o});var n=i(88961),s=i(25964),r=i(63200);const o=(0,s.xE)("icon"),a=(0,r.Zz)((0,n.RF)({mappings:{fill:{}}}),n.VO,n.tQ)((0,n.tz)({slots:[],wrappedEleName:"descope-image",style:()=>"\n :host {\n display: inline-flex;\n }\n ",excludeAttrsSync:["tabindex","class"],componentName:o}))}}]);
1
+ (self.webpackChunk_descope_web_components_ui=self.webpackChunk_descope_web_components_ui||[]).push([[743,1202,2250,6724],{6301:(t,e,i)=>{"use strict";i.r(e),i.d(e,{ImageClass:()=>u,componentName:()=>d});var n=i(88961),s=i(72270),r=i(63200),o=i(25964),a=i(25414);const l=t=>{const e=a.A.sanitize(t,{USE_PROFILES:{svg:!0,svgFilters:!0}});return(new DOMParser).parseFromString(e,"image/svg+xml").querySelector("svg")},d=(0,o.xE)("image"),c=["src","src-dark"];class h extends((0,s.qu)({componentName:d,baseSelector:"slot"})){static get observedAttributes(){return c}constructor(){super(),this.attachShadow({mode:"open"}).innerHTML="\n\t\t<slot></slot>\n\t",(0,o.fz)("\n\t\t\t:host {\n\t\t\t\tdisplay: inline-flex;\n\t\t\t}\n :host > slot {\n width: 100%;\n height: 100%;\n\t\t\t\tbox-sizing: border-box;\n\t\t\t\tdisplay: flex;\n\t\t\t\toverflow: hidden;\n\t\t\t}\n\n ::slotted(*) {\n width: 100%;\n\t\t\t}\n\n .hidden {\n display: none;\n }\n ",this)}init(){super.init?.(),this.toggleVisibility(this.src)}onThemeChange(){this.renderImage()}toggleVisibility(t){t?this.classList.remove("hidden"):this.classList.add("hidden")}get altText(){return this.getAttribute("alt")||""}get legacySrc(){return this.getAttribute("src")}get themeSrc(){return this.getAttribute(`src-${this.currentThemeName}`)}get src(){return this.themeSrc||this.legacySrc}updateFillColor(t){[t,...t.querySelectorAll("*[fill]")].forEach((t=>{t.setAttribute("fill",`var(${u.cssVarList.fill}, ${t.getAttribute("fill")||"''"})`)}))}renderImage(){this.toggleVisibility(this.src),(async(t,e)=>{try{let i;if((t=>t.startsWith("data:image/svg+xml;base64,"))(t)){const e=atob(t.slice(26));i=l(e)}else if("svg"===(t=>{const e=t.match(/\.([0-9a-z]+)(?:[\\?#]|$)/i);return e?e[1]:null})(t)){const e=await fetch(t),n=await e.text();i=l(n)}else i=((t,e)=>{const i=document.createElement("img");return i.setAttribute("src",t),i.setAttribute("alt",e),i})(t,e);return i.style.setProperty("max-width","100%"),i.style.setProperty("max-height","100%"),i}catch{return null}})(this.src,this.altText).then((t=>{this.innerHTML="",t&&(this.updateFillColor(t),this.appendChild(t))}))}shouldRender(t){const e=this.getAttribute(t);return this.src===e}attributeChangedCallback(t,e,i){super.attributeChangedCallback?.(t,e,i),e!==i&&this.shouldRender(t)&&this.renderImage()}}const u=(0,r.Zz)((0,n.RF)({mappings:{fill:{},height:{selector:()=>":host"},width:{selector:()=>":host"}}}),n.VO,n.tQ)(h);customElements.define(d,u)},10767:(t,e,i)=>{"use strict";i.d(e,{G:()=>n});const n=t=>class extends t{get isLoading(){return"true"===this.getAttribute("loading")}click(){this.isLoading||super.click()}}},15887:(t,e,i)=>{"use strict";i.r(e),i.d(e,{TimerClass:()=>b,componentName:()=>h});var n=i(88961),s=i(72270),r=i(63200),o=i(25964),a=i(44006),l=i.n(a),d=i(98538);const c=(t,e=2)=>String(t).padStart(e,"0"),h=(0,o.xE)("timer"),u=["seconds","hide-icon","paused"],p=(0,s.qu)({componentName:h,baseSelector:":host > .wrapper"}),{host:m,icon:g,timer:M}={host:{selector:()=>":host"},icon:{selector:()=>".icon"},timer:{selector:()=>".timer"}},b=(0,r.Zz)((0,n.RF)({mappings:{fontSize:{},iconSize:[{...g,property:"width"},{...g,property:"height"}],fontFamily:{},minHeight:{},fontWeight:{...M},lineHeight:{...M},textColor:{...M,property:"color"},gap:{},textAlign:{property:"justify-content"},hostWidth:{...m,property:"width"},hostDirection:{...m,property:"direction"},iconColor:{...g,property:d.S.cssVarList.fill}}}),n.VO,n.tQ)(class extends p{#t=0;#e;static get observedAttributes(){return u.concat(p.observedAttributes||[])}constructor(){super(),this.attachShadow({mode:"open"}).innerHTML=`\n <div class="wrapper">\n <descope-icon src="${l()}" class="icon"></descope-icon>\n <div class="timer"></div>\n </div>\n\t\t`,(0,o.fz)("\n :host {\n display: inline-flex;\n user-select: none;\n -webkit-user-select: none;\n }\n .wrapper {\n display: flex;\n align-items: center;\n flex-direction: row;\n width: 100%;\n }\n .hidden {\n display: none;\n }\n ",this),this.icon=this.shadowRoot.querySelector(".icon"),this.timer=this.shadowRoot.querySelector(".timer")}get seconds(){const t=this.getAttribute("seconds"),e=1e3*parseInt(t||0,10);return Math.max(0,e)}get isPaused(){return"true"===this.getAttribute("paused")}init(){super.init?.(),this.#t=this.seconds}startInterval(){this.#t?this.#e=setInterval((()=>{this.#i(),this.#t||this.stop(),this.#n(this.#t)}),1e3):this.stop()}stopInterval(){clearInterval(this.#e)}#i(){this.#t=this.#t-1e3}reset(){this.#t=this.seconds,this.#n(this.#t),this.isPaused||(this.dispatchEvent(new CustomEvent("timer-started",{bubbles:!0})),this.startInterval())}stop(){this.stopInterval(),this.#t=0,this.#n(this.#t),this.dispatchEvent(new CustomEvent("timer-ended",{bubbles:!0}))}pause(){this.setAttribute("paused","true"),this.stopInterval()}resume(){this.removeAttribute("paused"),this.startInterval()}#n(t){this.timer.textContent=((t=0)=>{const e=Math.floor(t/1e3),i=Math.floor(e/3600),n=Math.floor(e%3600/60),s=e%60;return[...i?[c(i)]:[],c(n),c(s)].join(":")})(t)}#s(t){this.icon.classList.toggle("hidden",t)}#r(t){setTimeout((()=>{t?this.pause():this.#e||this.resume()}))}attributeChangedCallback(t,e,i){super.attributeChangedCallback?.(t,e,i),i!==e&&("seconds"===t&&this.reset(),"hide-icon"===t&&this.#s("true"===i),"paused"===t&&this.#r("true"===i))}});i(56737),customElements.define(h,b)},19624:(t,e,i)=>{"use strict";i.d(e,{J:()=>p,T:()=>l});var n=i(63200),s=i(25964),r=i(88961),o=i(98538),a=i(10767);const l=(0,s.xE)("button"),{host:d,label:c,slottedIcon:h}={host:{selector:()=>":host"},label:{selector:"::part(label)"},slottedIcon:{selector:()=>"::slotted(descope-icon)"}};let u;const p=(0,n.Zz)((0,r.RF)({mappings:{hostWidth:{property:"width"},hostHeight:{property:"height"},hostDirection:{...d,property:"direction"},fontSize:{},fontFamily:{},cursor:{},backgroundColor:{},outlineOffset:{},outlineColor:{},outlineStyle:{},outlineWidth:{},borderRadius:{},borderColor:{},borderStyle:{},borderWidth:{},verticalPadding:[{property:"padding-top"},{property:"padding-bottom"}],horizontalPadding:[{property:"padding-right",fallback:"0.875em"},{property:"padding-left",fallback:"0.875em"}],labelTextColor:{property:"color"},iconColor:{selector:()=>"::slotted(*)",property:o.S.cssVarList.fill},labelTextDecoration:{...c,property:"text-decoration"},labelSpacing:{...c,property:"gap"},textAlign:{...c,property:"justify-content",fallback:"center"},iconSize:[{...h,property:"width"},{...h,property:"height"}]}}),a.G,r.VO,r.tQ)((0,r.tz)({slots:["","prefix","label","suffix"],wrappedEleName:"vaadin-button",style:()=>`\n\t\t\t\n\t:host {\n\t\tdisplay: inline-block;\n\t\tbox-sizing: border-box;\n\t}\n\tvaadin-button::before,\n\tvaadin-button::after {\n\t\topacity: 0;\n\t}\n\tvaadin-button {\n\t\tmargin: 0;\n\t\tmin-width: 0;\n\t\twidth: 100%;\n\t\theight: auto;\n\t\tbox-shadow: none;\n\t}\n\tvaadin-button::part(label) {\n\t\tpadding: 0;\n width: 100%;\n\t}\n\tvaadin-button::part(prefix) {\n\t\tmargin-left: 0;\n\t\tmargin-right: 0;\n\t}\n\n\t\t\t\n\tvaadin-button::part(prefix),\n\tvaadin-button::part(label) {\n\t\tdisplay: flex;\n\t\talign-items: center;\n\t}\n\n\t\t\t${u}\n\t\t\tvaadin-button::part(label) { pointer-events: none; }\n\t\t\t:host {\n\t\t\t\tpadding: calc(var(${p.cssVarList.outlineWidth}) + var(${p.cssVarList.outlineOffset}));\n\t\t\t}\n :host([full-width="true"]) {\n width: var(${p.cssVarList.hostWidth});\n }\n\t\t\tvaadin-button {\n\t\t\t\theight: calc(var(${p.cssVarList.hostHeight}) - var(${p.cssVarList.outlineWidth}) - var(${p.cssVarList.outlineOffset}));\n\t\t\t}\n\t\t\t[square="true"]:not([full-width="true"]) {\n\t\t\t\twidth: calc(var(${p.cssVarList.hostWidth}) - var(${p.cssVarList.outlineWidth}) - var(${p.cssVarList.outlineOffset}));\n padding: 0;\n\t\t\t}\n\t\t`,excludeAttrsSync:["tabindex"],componentName:l})),{color:m,fontSize:g}=p.cssVarList;u=`\n\t@keyframes spin {\n\t\t0% { -webkit-transform: rotate(0deg); }\n\t\t100% { -webkit-transform: rotate(360deg); }\n\t}\n\t:host([loading="true"]) ::before {\n\t\tanimation: spin 2s linear infinite;\n\t\tposition: absolute;\n\t\tcontent: '';\n\t\tz-index: 1;\n\t\tbox-sizing: border-box;\n\t\tborder-radius: 50%;\n\t\tborder-bottom-color: transparent;\n\t\tborder-left-color: transparent;\n\t\tborder-style: solid;\n\t\tcolor: var(${m});\n\t\ttop: calc(50% - (var(${g}) / 2));\n\t\tleft: calc(50% - (var(${g}) / 2));\n\t\tborder-width: calc(var(${g}) / 10);\n\t\twidth: var(${g});\n\t\theight: var(${g});\n\t}\n\t:host([disabled="true"]),\n\t:host([loading="true"]) {\n\t\tpointer-events: none;\n\t}\n\t:host([loading="true"]) ::part(prefix),\n\t:host([loading="true"]) ::part(label) {\n\t\tvisibility: hidden;\n\t}\n`},30576:(t,e,i)=>{"use strict";i.r(e),i.d(e,{ButtonClass:()=>n.J,componentName:()=>n.T});var n=i(19624);i(83799),customElements.define(n.T,n.J)},44006:t=>{t.exports="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMWVtIiBoZWlnaHQ9IjFlbSIgdmlld0JveD0iMCAwIDEwNCAxMDQiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+IDxwYXRoIGQ9Ik01MC4zMzM0IDAuMzMzMjUyQzIyLjgzMzQgMC4zMzMyNTIgMC4zMzMzNzQgMjIuODMzMyAwLjMzMzM3NCA1MC4zMzMzQzAuMzMzMzc0IDc3LjgzMzMgMjIuODMzNCAxMDAuMzMzIDUwLjMzMzQgMTAwLjMzM0M3Ny44MzM0IDEwMC4zMzMgMTAwLjMzMyA3Ny44MzMzIDEwMC4zMzMgNTAuMzMzM0MxMDAuMzMzIDIyLjgzMzMgNzcuODMzNCAwLjMzMzI1MiA1MC4zMzM0IDAuMzMzMjUyWk01MC4zMzM0IDg3LjgzMzNDMjkuNzA4NCA4Ny44MzMzIDEyLjgzMzQgNzAuOTU4MyAxMi44MzM0IDUwLjMzMzNDMTIuODMzNCAyOS43MDgzIDI5LjcwODQgMTIuODMzMyA1MC4zMzM0IDEyLjgzMzNDNzAuOTU4NCAxMi44MzMzIDg3LjgzMzQgMjkuNzA4MyA4Ny44MzM0IDUwLjMzMzNDODcuODMzNCA3MC45NTgzIDcwLjk1ODQgODcuODMzMyA1MC4zMzM0IDg3LjgzMzNaIiBmaWxsPSIjMTgxQTFDIi8+IDxwYXRoIGQ9Ik01MC4zMzI4IDE5LjA4MzNINDQuMDgyOFY1Ni41ODMySDc1LjMzMjhWNTAuMzMzMkg1MC4zMzI4VjE5LjA4MzNaIiBmaWxsPSIjMTgxQTFDIi8+IDwvc3ZnPiA="},56737:(t,e,i)=>{"use strict";i.r(e),i.d(e,{IconClass:()=>n.S,componentName:()=>n.T}),i(6301);var n=i(98538);customElements.define(n.T,n.S)},60096:(t,e,i)=>{"use strict";i.r(e),i.d(e,{TimerButtonClass:()=>m,componentName:()=>a});var n=i(88961),s=i(72270),r=i(63200),o=i(25964);const a=(0,o.xE)("timer-button"),l=["button-variant","button-mode","size","text-align","full-width"],d={"button-variant":"variant","button-mode":"mode"},c=["timer-seconds","timer-hide-icon","timer-paused","size","text-align","full-width"],h={"timer-seconds":"seconds","timer-hide-icon":"hide-icon","timer-paused":"paused"},u=(0,s.qu)({componentName:a,baseSelector:":host > div"}),{host:p}={host:{selector:()=>":host"},icon:{selector:".icon"},timer:{selector:".timer"}},m=(0,r.Zz)((0,n.RF)({mappings:{gap:{},flexDirection:{},hostWidth:{...p,property:"width"},hostDirection:{...p,property:"direction"}}}),n.VO,n.tQ)(class extends u{constructor(){super(),this.attachShadow({mode:"open"}).innerHTML='\n <div class="wrapper">\n <descope-timer class="timer"></descope-timer>\n <descope-button class="button" disabled="true">\n <slot></slot>\n </descope-button>\n </div>\n\t\t',(0,o.fz)("\n :host {\n display: inline-flex;\n }\n .wrapper {\n display: flex;\n flex-direction: column;\n gap: 0.5em;\n align-items: center;\n width: 100%;\n }\n .timer {\n flex: 1;\n }\n ",this),this.timer=this.shadowRoot.querySelector(".timer"),this.button=this.shadowRoot.querySelector(".button"),this.timer.addEventListener("timer-started",(()=>this.onTimerStarted())),this.timer.addEventListener("timer-ended",(()=>this.onTimerEnded())),this.button.addEventListener("click",this.onClick.bind(this))}set onclick(t){this.button.onclick=t}init(){super.init?.(),(0,o.EA)(this,this.button,{includeAttrs:l,mapAttrs:d}),(0,o.EA)(this,this.timer,{includeAttrs:c,mapAttrs:h}),this.button.shadowRoot.querySelector("vaadin-button").setAttribute("disabled","true")}onTimerStarted(){this.toggleButtonDisable(!0)}onTimerEnded(){this.toggleButtonDisable(!1)}onClick(){this.timer.reset()}toggleButtonDisable(t){setTimeout((()=>{t?this.button.setAttribute("disabled","true"):this.button.removeAttribute("disabled")}))}});i(30576),i(15887),customElements.define(a,m)},98538:(t,e,i)=>{"use strict";i.d(e,{S:()=>a,T:()=>o});var n=i(88961),s=i(25964),r=i(63200);const o=(0,s.xE)("icon"),a=(0,r.Zz)((0,n.RF)({mappings:{fill:{}}}),n.VO,n.tQ)((0,n.tz)({slots:[],wrappedEleName:"descope-image",style:()=>"\n :host {\n display: inline-flex;\n }\n ",excludeAttrsSync:["tabindex","class"],componentName:o}))}}]);
2
2
  //# sourceMappingURL=descope-timer-button.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"descope-timer-button.js","mappings":"sQAEA,MAeMA,EAAgBC,IAEpB,MAAMC,EAAQ,IAAUC,SAASF,EAAM,CACrCG,aAAc,CAAEC,KAAK,EAAMC,YAAY,KAOzC,OAJe,IAAIC,WAEhBC,gBAAgBN,EAAO,iBACvBO,cAAc,MACP,ECfCC,GAAgB,QAAiB,SAExCC,EAAW,CAAC,MAAO,YAEzB,MAAMC,WAAiB,QAAgB,CACrCF,gBACAG,aAAc,UAEd,6BAAWC,GACT,OAAOH,CACT,CAEA,WAAAI,GACEC,QAEAC,KAAKC,aAAa,CAAEC,KAAM,SAAUC,UAAY,2BAIhD,QACE,6UAoBAH,KAEJ,CAEA,IAAAI,GAC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OZrJ,KAAKwJ,OAAOhE,WACThG,cAAc,iBACd8B,aAAa,WAAY,OAC9B,CAEA,cAAAoI,GACE1J,KAAKiK,qBAAoB,EAC3B,CAEA,YAAAN,GACE3J,KAAKiK,qBAAoB,EAC3B,CAEA,OAAAL,GACE5J,KAAKuE,MAAM6B,OACb,CAEA,mBAAA6D,CAAoBC,GAClB5C,YAAW,KACT4C,EACIlK,KAAKwJ,OAAOlI,aAAa,WAAY,QACrCtB,KAAKwJ,OAAO9C,gBAAgB,WAAW,GAE/C,I,kBCjIFjD,eAAeC,OAAOjE,EAAe6J,E,6FCK9B,MAAM7J,GAAgB,QAAiB,QAEjC6F,GAAY,SACvB,QAAiB,CACfjC,SAAU,CACR5B,KAAM,CAAC,KAGX,KACA,KAPuB,EASvB,QAAY,CACVmH,MAAO,GACPC,eAAgB,gBAChBpG,MAAO,IAAM,kEAKbqG,iBAAkB,CAAC,WAAY,SAC/BrJ,kB","sources":["webpack://@descope/web-components-ui/../components/descope-image/src/component/helpers.js","webpack://@descope/web-components-ui/../components/descope-image/src/component/ImageClass.js","webpack://@descope/web-components-ui/../components/descope-image/src/component/index.js","webpack://@descope/web-components-ui/../components/descope-button/src/component/clickableMixin.js","webpack://@descope/web-components-ui/../components/descope-timer/src/component/helpers.js","webpack://@descope/web-components-ui/../components/descope-timer/src/component/TimerClass.js","webpack://@descope/web-components-ui/../components/descope-timer/src/component/index.js","webpack://@descope/web-components-ui/../components/descope-button/src/component/ButtonClass.js","webpack://@descope/web-components-ui/../components/descope-button/src/component/index.js","webpack://@descope/web-components-ui/../components/descope-timer/src/component/clock.svg","webpack://@descope/web-components-ui/../components/descope-icon/src/component/index.js","webpack://@descope/web-components-ui/../components/descope-timer-button/src/component/TimerButtonClass.js","webpack://@descope/web-components-ui/../components/descope-timer-button/src/component/index.js","webpack://@descope/web-components-ui/../components/descope-icon/src/component/IconClass.js"],"sourcesContent":["import DOMPurify from 'dompurify';\n\nconst getFileExtension = (path) => {\n const match = path.match(/\\.([0-9a-z]+)(?:[\\\\?#]|$)/i);\n return match ? match[1] : null;\n};\n\nconst base64Prefix = 'data:image/svg+xml;base64,';\n\nconst isBase64Svg = (src) => src.startsWith(base64Prefix);\n\nconst createImgEle = (src) => {\n const ele = document.createElement('img');\n ele.setAttribute('src', src);\n return ele;\n};\n\nconst createSvgEle = (text) => {\n // we want to purify the SVG to avoid XSS attacks\n const clean = DOMPurify.sanitize(text, {\n USE_PROFILES: { svg: true, svgFilters: true },\n });\n\n const parser = new DOMParser();\n const ele = parser\n .parseFromString(clean, 'image/svg+xml')\n .querySelector('svg');\n return ele;\n};\n\nexport const createImage = async (src) => {\n try {\n let ele;\n if (isBase64Svg(src)) {\n // handle base64 source\n const svgXml = atob(src.slice(base64Prefix.length));\n ele = createSvgEle(svgXml);\n } else if (getFileExtension(src) === 'svg') {\n // handle urls\n const fetchedSrc = await fetch(src);\n const text = await fetchedSrc.text();\n ele = createSvgEle(text);\n } else {\n // handle binary\n ele = createImgEle(src);\n }\n\n ele.style.setProperty('max-width', '100%');\n ele.style.setProperty('max-height', '100%');\n\n return ele;\n } catch {\n return null;\n }\n};\n","/* eslint-disable no-use-before-define */\nimport {\n createStyleMixin,\n draggableMixin,\n componentNameValidationMixin,\n} from '@descope-ui/common/components-mixins';\nimport { createBaseClass } from '@descope-ui/common/base-classes';\nimport { compose } from '@descope-ui/common/utils';\nimport { getComponentName } from '@descope-ui/common/components-helpers';\nimport { createImage } from './helpers';\nimport { injectStyle } from '@descope-ui/common/components-helpers';\n\nexport const componentName = getComponentName('image');\n\nconst srcAttrs = ['src', 'src-dark'];\n\nclass RawImage extends createBaseClass({\n componentName,\n baseSelector: 'slot',\n}) {\n static get observedAttributes() {\n return srcAttrs;\n }\n\n constructor() {\n super();\n\n this.attachShadow({ mode: 'open' }).innerHTML = `\n\t\t<slot></slot>\n\t`;\n\n injectStyle(\n `\n\t\t\t:host {\n\t\t\t\tdisplay: inline-flex;\n\t\t\t}\n :host > slot {\n width: 100%;\n height: 100%;\n\t\t\t\tbox-sizing: border-box;\n\t\t\t\tdisplay: flex;\n\t\t\t\toverflow: hidden;\n\t\t\t}\n\n ::slotted(*) {\n width: 100%;\n\t\t\t}\n\n .hidden {\n display: none;\n }\n `,\n this,\n );\n }\n\n init() {\n super.init?.();\n this.toggleVisibility(this.src);\n }\n\n onThemeChange() {\n this.renderImage();\n }\n\n toggleVisibility(isVisible) {\n if (isVisible) {\n this.classList.remove('hidden');\n } else {\n this.classList.add('hidden');\n }\n }\n\n get legacySrc() {\n return this.getAttribute('src');\n }\n\n get themeSrc() {\n return this.getAttribute(`src-${this.currentThemeName}`);\n }\n\n get src() {\n return this.themeSrc || this.legacySrc;\n }\n\n // in order to fill an SVG with `currentColor` override all of its `fill` and `path` nodes\n // with the value from the `st-fill` attribute\n // eslint-disable-next-line class-methods-use-this\n updateFillColor(node) {\n // set fill to root node and all its relevant selectors\n const elementsToReplace = [node, ...node.querySelectorAll('*[fill]')];\n\n elementsToReplace.forEach((ele) => {\n ele.setAttribute(\n 'fill',\n `var(${ImageClass.cssVarList.fill}, ${ele.getAttribute('fill') || \"''\"})`,\n );\n });\n }\n\n renderImage() {\n this.toggleVisibility(this.src);\n\n createImage(this.src).then((res) => {\n this.innerHTML = '';\n if (res) {\n this.updateFillColor(res);\n this.appendChild(res);\n }\n });\n }\n\n // render only when src attribute matches current theme\n shouldRender(src) {\n const srcVal = this.getAttribute(src);\n return this.src === srcVal;\n }\n\n attributeChangedCallback(attrName, oldValue, newValue) {\n super.attributeChangedCallback?.(attrName, oldValue, newValue);\n\n if (oldValue === newValue) return;\n\n if (this.shouldRender(attrName)) {\n this.renderImage();\n }\n }\n}\n\nexport const ImageClass = compose(\n createStyleMixin({\n mappings: {\n fill: {},\n height: { selector: () => ':host' },\n width: { selector: () => ':host' },\n },\n }),\n draggableMixin,\n componentNameValidationMixin,\n)(RawImage);\n","import { componentName, ImageClass } from './ImageClass';\n\ncustomElements.define(componentName, ImageClass);\n\nexport { ImageClass, componentName };\n","export const clickableMixin = (superclass) =>\n class ClickableMixinClass extends superclass {\n get isLoading() {\n return this.getAttribute('loading') === 'true';\n }\n\n click() {\n this.isLoading || super.click();\n }\n };\n","const fmt = (val, pad = 2) => String(val).padStart(pad, '0');\n\nexport const formatTime = (ms = 0) => {\n const totalSeconds = Math.floor(ms / 1000);\n\n const secondsInMinute = 60;\n const secondsInHour = secondsInMinute * 60;\n\n const hours = Math.floor(totalSeconds / secondsInHour);\n const minutes = Math.floor((totalSeconds % secondsInHour) / secondsInMinute);\n const seconds = totalSeconds % secondsInMinute;\n\n const timeParts = [...(hours ? [fmt(hours)] : []), fmt(minutes), fmt(seconds)];\n\n return timeParts.join(':');\n};\n","import {\n createStyleMixin,\n draggableMixin,\n componentNameValidationMixin,\n} from '@descope-ui/common/components-mixins';\nimport { createBaseClass } from '@descope-ui/common/base-classes';\nimport { compose } from '@descope-ui/common/utils';\nimport {\n getComponentName,\n injectStyle,\n} from '@descope-ui/common/components-helpers';\nimport clockIcon from './clock.svg';\nimport { IconClass } from '@descope-ui/descope-icon/class';\nimport { formatTime } from './helpers';\n\nexport const componentName = getComponentName('timer');\n\nconst observedAttributes = ['seconds', 'hide-icon', 'paused'];\n\nconst BaseClass = createBaseClass({\n componentName,\n baseSelector: ':host > .wrapper',\n});\n\nconst DEFAULT_INTERVAL = 1000;\n\nclass RawTimer extends BaseClass {\n #timeRemains = 0;\n\n #intervalId;\n\n static get observedAttributes() {\n return observedAttributes.concat(BaseClass.observedAttributes || []);\n }\n\n constructor() {\n super();\n\n this.attachShadow({ mode: 'open' }).innerHTML = `\n <div class=\"wrapper\">\n <descope-icon src=\"${clockIcon}\" class=\"icon\"></descope-icon>\n <div class=\"timer\"></div>\n </div>\n\t\t`;\n\n injectStyle(\n `\n :host {\n display: inline-flex;\n user-select: none;\n -webkit-user-select: none;\n }\n .wrapper {\n display: flex;\n align-items: center;\n flex-direction: row;\n width: 100%;\n }\n .hidden {\n display: none;\n }\n `,\n this,\n );\n\n this.icon = this.shadowRoot.querySelector('.icon');\n this.timer = this.shadowRoot.querySelector('.timer');\n }\n\n get seconds() {\n const val = this.getAttribute('seconds');\n const secs = parseInt(val || 0, 10) * 1000;\n return Math.max(0, secs);\n }\n\n // we use `pause` attribute for allowing preview mode by executing `pause`\n get isPaused() {\n return this.getAttribute('paused') === 'true';\n }\n\n init() {\n super.init?.();\n\n this.#timeRemains = this.seconds;\n }\n\n startInterval() {\n const intervalCycle = () => {\n this.#decreaseInterval();\n if (!this.#timeRemains) this.stop();\n this.#updateDisplay(this.#timeRemains);\n };\n\n if (this.#timeRemains) {\n this.#intervalId = setInterval(intervalCycle, DEFAULT_INTERVAL);\n } else {\n this.stop();\n }\n }\n\n stopInterval() {\n clearInterval(this.#intervalId);\n }\n\n #decreaseInterval() {\n this.#timeRemains = this.#timeRemains - DEFAULT_INTERVAL;\n }\n\n reset() {\n this.#timeRemains = this.seconds;\n this.#updateDisplay(this.#timeRemains);\n\n if (this.isPaused) return;\n\n this.dispatchEvent(new CustomEvent('timer-started', { bubbles: true }));\n this.startInterval();\n }\n\n stop() {\n this.stopInterval();\n this.#timeRemains = 0;\n this.#updateDisplay(this.#timeRemains);\n this.dispatchEvent(new CustomEvent('timer-ended', { bubbles: true }));\n }\n\n pause() {\n this.setAttribute('paused', 'true');\n this.stopInterval();\n }\n\n resume() {\n this.removeAttribute('paused');\n this.startInterval();\n }\n\n #updateDisplay(val) {\n this.timer.textContent = formatTime(val);\n }\n\n #toggleIcon(val) {\n this.icon.classList.toggle('hidden', val);\n }\n\n #handlePause(paused) {\n setTimeout(() => {\n if (paused) {\n this.pause();\n } else {\n // we want to prevent a another interval from starting in case previous interval was not yet cleared\n if (!this.#intervalId) {\n this.resume();\n }\n }\n });\n }\n\n attributeChangedCallback(attrName, oldValue, newValue) {\n super.attributeChangedCallback?.(attrName, oldValue, newValue);\n\n if (newValue !== oldValue) {\n if (attrName === 'seconds') {\n this.reset();\n }\n if (attrName === 'hide-icon') {\n this.#toggleIcon(newValue === 'true');\n }\n if (attrName === 'paused') {\n this.#handlePause(newValue === 'true');\n }\n }\n }\n}\n\nconst { host, icon, timer } = {\n host: { selector: () => ':host' },\n icon: { selector: () => '.icon' },\n timer: { selector: () => '.timer' },\n};\n\nexport const TimerClass = compose(\n createStyleMixin({\n mappings: {\n fontSize: {},\n iconSize: [\n { ...icon, property: 'width' },\n { ...icon, property: 'height' },\n ],\n fontFamily: {},\n minHeight: {},\n fontWeight: { ...timer },\n lineHeight: { ...timer },\n textColor: { ...timer, property: 'color' },\n gap: {},\n textAlign: { property: 'justify-content' },\n hostWidth: { ...host, property: 'width' },\n hostDirection: { ...host, property: 'direction' },\n iconColor: { ...icon, property: IconClass.cssVarList.fill },\n },\n }),\n draggableMixin,\n componentNameValidationMixin,\n)(RawTimer);\n","import { componentName, TimerClass } from './TimerClass';\nimport '@descope-ui/descope-icon';\n\ncustomElements.define(componentName, TimerClass);\n\nexport { TimerClass, componentName };\n","import { compose } from '@descope-ui/common/utils';\nimport { getComponentName } from '@descope-ui/common/components-helpers';\nimport {\n createStyleMixin,\n draggableMixin,\n createProxy,\n componentNameValidationMixin,\n} from '@descope-ui/common/components-mixins';\nimport { IconClass } from '@descope-ui/descope-icon/class';\nimport { clickableMixin } from './clickableMixin';\n\nexport const componentName = getComponentName('button');\n\nconst resetStyles = `\n\t:host {\n\t\tdisplay: inline-block;\n\t\tbox-sizing: border-box;\n\t}\n\tvaadin-button::before,\n\tvaadin-button::after {\n\t\topacity: 0;\n\t}\n\tvaadin-button {\n\t\tmargin: 0;\n\t\tmin-width: 0;\n\t\twidth: 100%;\n\t\theight: auto;\n\t\tbox-shadow: none;\n\t}\n\tvaadin-button::part(label) {\n\t\tpadding: 0;\n width: 100%;\n\t}\n\tvaadin-button::part(prefix) {\n\t\tmargin-left: 0;\n\t\tmargin-right: 0;\n\t}\n`;\n\nconst iconStyles = `\n\tvaadin-button::part(prefix),\n\tvaadin-button::part(label) {\n\t\tdisplay: flex;\n\t\talign-items: center;\n\t}\n`;\n\nconst editorOverrides = `vaadin-button::part(label) { pointer-events: none; }`;\n\nconst { host, label, slottedIcon } = {\n host: { selector: () => ':host' },\n label: { selector: '::part(label)' },\n slottedIcon: { selector: () => '::slotted(descope-icon)' },\n};\n\nlet loadingIndicatorStyles;\n\nexport const ButtonClass = compose(\n createStyleMixin({\n mappings: {\n hostWidth: { property: 'width' },\n hostHeight: { property: 'height' },\n hostDirection: { ...host, property: 'direction' },\n fontSize: {},\n fontFamily: {},\n\n cursor: {},\n backgroundColor: {},\n\n outlineOffset: {},\n outlineColor: {},\n outlineStyle: {},\n outlineWidth: {},\n\n borderRadius: {},\n borderColor: {},\n borderStyle: {},\n borderWidth: {},\n\n verticalPadding: [{ property: 'padding-top' }, { property: 'padding-bottom' }],\n horizontalPadding: [\n { property: 'padding-right', fallback: '0.875em' },\n { property: 'padding-left', fallback: '0.875em' },\n ],\n\n labelTextColor: { property: 'color' },\n iconColor: {\n selector: () => `::slotted(*)`,\n property: IconClass.cssVarList.fill,\n },\n labelTextDecoration: { ...label, property: 'text-decoration' },\n labelSpacing: { ...label, property: 'gap' },\n textAlign: { ...label, property: 'justify-content', fallback: 'center' },\n\n iconSize: [\n { ...slottedIcon, property: 'width' },\n { ...slottedIcon, property: 'height' },\n ],\n },\n }),\n clickableMixin,\n draggableMixin,\n componentNameValidationMixin\n)(\n createProxy({\n slots: ['', 'prefix', 'label', 'suffix'],\n wrappedEleName: 'vaadin-button',\n style: () => `\n\t\t\t${resetStyles}\n\t\t\t${iconStyles}\n\t\t\t${loadingIndicatorStyles}\n\t\t\t${editorOverrides}\n\t\t\t:host {\n\t\t\t\tpadding: calc(var(${ButtonClass.cssVarList.outlineWidth}) + var(${ButtonClass.cssVarList.outlineOffset}));\n\t\t\t}\n :host([full-width=\"true\"]) {\n width: var(${ButtonClass.cssVarList.hostWidth});\n }\n\t\t\tvaadin-button {\n\t\t\t\theight: calc(var(${ButtonClass.cssVarList.hostHeight}) - var(${ButtonClass.cssVarList.outlineWidth}) - var(${ButtonClass.cssVarList.outlineOffset}));\n\t\t\t}\n\t\t\t[square=\"true\"]:not([full-width=\"true\"]) {\n\t\t\t\twidth: calc(var(${ButtonClass.cssVarList.hostWidth}) - var(${ButtonClass.cssVarList.outlineWidth}) - var(${ButtonClass.cssVarList.outlineOffset}));\n padding: 0;\n\t\t\t}\n\t\t`,\n excludeAttrsSync: ['tabindex'],\n componentName,\n })\n);\n\nconst { color, fontSize } = ButtonClass.cssVarList;\nloadingIndicatorStyles = `\n\t@keyframes spin {\n\t\t0% { -webkit-transform: rotate(0deg); }\n\t\t100% { -webkit-transform: rotate(360deg); }\n\t}\n\t:host([loading=\"true\"]) ::before {\n\t\tanimation: spin 2s linear infinite;\n\t\tposition: absolute;\n\t\tcontent: '';\n\t\tz-index: 1;\n\t\tbox-sizing: border-box;\n\t\tborder-radius: 50%;\n\t\tborder-bottom-color: transparent;\n\t\tborder-left-color: transparent;\n\t\tborder-style: solid;\n\t\tcolor: var(${color});\n\t\ttop: calc(50% - (var(${fontSize}) / 2));\n\t\tleft: calc(50% - (var(${fontSize}) / 2));\n\t\tborder-width: calc(var(${fontSize}) / 10);\n\t\twidth: var(${fontSize});\n\t\theight: var(${fontSize});\n\t}\n\t:host([disabled=\"true\"]),\n\t:host([loading=\"true\"]) {\n\t\tpointer-events: none;\n\t}\n\t:host([loading=\"true\"]) ::part(prefix),\n\t:host([loading=\"true\"]) ::part(label) {\n\t\tvisibility: hidden;\n\t}\n`;\n","import { componentName, ButtonClass } from './ButtonClass';\nimport '@vaadin/button';\n\ncustomElements.define(componentName, ButtonClass);\n\nexport { ButtonClass, componentName };\n","module.exports = \"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMWVtIiBoZWlnaHQ9IjFlbSIgdmlld0JveD0iMCAwIDEwNCAxMDQiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+IDxwYXRoIGQ9Ik01MC4zMzM0IDAuMzMzMjUyQzIyLjgzMzQgMC4zMzMyNTIgMC4zMzMzNzQgMjIuODMzMyAwLjMzMzM3NCA1MC4zMzMzQzAuMzMzMzc0IDc3LjgzMzMgMjIuODMzNCAxMDAuMzMzIDUwLjMzMzQgMTAwLjMzM0M3Ny44MzM0IDEwMC4zMzMgMTAwLjMzMyA3Ny44MzMzIDEwMC4zMzMgNTAuMzMzM0MxMDAuMzMzIDIyLjgzMzMgNzcuODMzNCAwLjMzMzI1MiA1MC4zMzM0IDAuMzMzMjUyWk01MC4zMzM0IDg3LjgzMzNDMjkuNzA4NCA4Ny44MzMzIDEyLjgzMzQgNzAuOTU4MyAxMi44MzM0IDUwLjMzMzNDMTIuODMzNCAyOS43MDgzIDI5LjcwODQgMTIuODMzMyA1MC4zMzM0IDEyLjgzMzNDNzAuOTU4NCAxMi44MzMzIDg3LjgzMzQgMjkuNzA4MyA4Ny44MzM0IDUwLjMzMzNDODcuODMzNCA3MC45NTgzIDcwLjk1ODQgODcuODMzMyA1MC4zMzM0IDg3LjgzMzNaIiBmaWxsPSIjMTgxQTFDIi8+IDxwYXRoIGQ9Ik01MC4zMzI4IDE5LjA4MzNINDQuMDgyOFY1Ni41ODMySDc1LjMzMjhWNTAuMzMzMkg1MC4zMzI4VjE5LjA4MzNaIiBmaWxsPSIjMTgxQTFDIi8+IDwvc3ZnPiA=\"","import '@descope-ui/descope-image';\n\nimport { componentName, IconClass } from './IconClass';\n\ncustomElements.define(componentName, IconClass);\n\nexport { IconClass, componentName };\n","import {\n createStyleMixin,\n draggableMixin,\n componentNameValidationMixin,\n} from '@descope-ui/common/components-mixins';\nimport { createBaseClass } from '@descope-ui/common/base-classes';\nimport { compose } from '@descope-ui/common/utils';\nimport {\n forwardAttrs,\n getComponentName,\n injectStyle,\n} from '@descope-ui/common/components-helpers';\n\nexport const componentName = getComponentName('timer-button');\n\nconst buttonAttrs = [\n 'button-variant',\n 'button-mode',\n 'size',\n 'text-align',\n 'full-width',\n];\n\nconst mapButtonAttrs = {\n 'button-variant': 'variant',\n 'button-mode': 'mode',\n};\n\nconst timerAttrs = [\n 'timer-seconds',\n 'timer-hide-icon',\n 'timer-paused',\n 'size',\n 'text-align',\n 'full-width',\n];\n\nconst mapTimerAttrs = {\n 'timer-seconds': 'seconds',\n 'timer-hide-icon': 'hide-icon',\n 'timer-paused': 'paused',\n};\n\nconst BaseClass = createBaseClass({\n componentName,\n baseSelector: ':host > div',\n});\n\nclass RawTimerButton extends BaseClass {\n constructor() {\n super();\n\n this.attachShadow({ mode: 'open' }).innerHTML = `\n <div class=\"wrapper\">\n <descope-timer class=\"timer\"></descope-timer>\n <descope-button class=\"button\" disabled=\"true\">\n <slot></slot>\n </descope-button>\n </div>\n\t\t`;\n\n injectStyle(\n `\n :host {\n display: inline-flex;\n }\n .wrapper {\n display: flex;\n flex-direction: column;\n gap: 0.5em;\n align-items: center;\n width: 100%;\n }\n .timer {\n flex: 1;\n }\n `,\n this,\n );\n\n this.timer = this.shadowRoot.querySelector('.timer');\n this.button = this.shadowRoot.querySelector('.button');\n\n this.timer.addEventListener('timer-started', () => this.onTimerStarted());\n this.timer.addEventListener('timer-ended', () => this.onTimerEnded());\n\n this.button.addEventListener('click', this.onClick.bind(this));\n }\n\n set onclick(val) {\n this.button.onclick = val;\n }\n\n init() {\n super.init?.();\n\n forwardAttrs(this, this.button, {\n includeAttrs: buttonAttrs,\n mapAttrs: mapButtonAttrs,\n });\n\n forwardAttrs(this, this.timer, {\n includeAttrs: timerAttrs,\n mapAttrs: mapTimerAttrs,\n });\n\n // When we sync attributes, the `disabled` attribute is being compared to the attribute\n // on Vaadin component; since the Vaadin component has no `disabled` attribute, we sync\n // that back to our component.\n // This is pending a more generic fix in the way we sync attibutes.\n this.button.shadowRoot\n .querySelector('vaadin-button')\n .setAttribute('disabled', 'true');\n }\n\n onTimerStarted() {\n this.toggleButtonDisable(true);\n }\n\n onTimerEnded() {\n this.toggleButtonDisable(false);\n }\n\n onClick() {\n this.timer.reset();\n }\n\n toggleButtonDisable(isDisabled) {\n setTimeout(() => {\n isDisabled\n ? this.button.setAttribute('disabled', 'true')\n : this.button.removeAttribute('disabled');\n });\n }\n}\n\nconst { host } = {\n host: { selector: () => ':host' },\n icon: { selector: '.icon' },\n timer: { selector: '.timer' },\n};\n\nexport const TimerButtonClass = compose(\n createStyleMixin({\n mappings: {\n gap: {},\n flexDirection: {},\n hostWidth: { ...host, property: 'width' },\n hostDirection: { ...host, property: 'direction' },\n },\n }),\n draggableMixin,\n componentNameValidationMixin,\n)(RawTimerButton);\n","import { componentName, TimerButtonClass } from './TimerButtonClass';\nimport '@descope-ui/descope-button';\nimport '@descope-ui/descope-timer';\n\ncustomElements.define(componentName, TimerButtonClass);\n\nexport { TimerButtonClass, componentName };\n","import {\n componentNameValidationMixin,\n createProxy,\n createStyleMixin,\n draggableMixin,\n} from '@descope-ui/common/components-mixins';\nimport { getComponentName } from '@descope-ui/common/components-helpers';\nimport { compose } from '@descope-ui/common/utils';\n\nexport const componentName = getComponentName('icon');\n\nexport const IconClass = compose(\n createStyleMixin({\n mappings: {\n fill: {},\n },\n }),\n draggableMixin,\n componentNameValidationMixin,\n)(\n createProxy({\n slots: [],\n wrappedEleName: 'descope-image',\n style: () => `\n :host {\n display: inline-flex;\n }\n `,\n excludeAttrsSync: ['tabindex', 'class'],\n componentName,\n }),\n);\n"],"names":["createSvgEle","text","clean","sanitize","USE_PROFILES","svg","svgFilters","DOMParser","parseFromString","querySelector","componentName","srcAttrs","RawImage","baseSelector","observedAttributes","constructor","super","this","attachShadow","mode","innerHTML","init","toggleVisibility","src","onThemeChange","renderImage","isVisible","classList","remove","add","legacySrc","getAttribute","themeSrc","currentThemeName","updateFillColor","node","querySelectorAll","forEach","ele","setAttribute","ImageClass","cssVarList","fill","async","startsWith","isBase64Svg","svgXml","atob","slice","base64Prefix","path","match","getFileExtension","fetchedSrc","fetch","document","createElement","createImgEle","style","setProperty","createImage","then","res","appendChild","shouldRender","srcVal","attributeChangedCallback","attrName","oldValue","newValue","mappings","height","selector","width","customElements","define","clickableMixin","superclass","isLoading","click","fmt","val","pad","String","padStart","BaseClass","host","icon","timer","TimerClass","fontSize","iconSize","property","fontFamily","minHeight","fontWeight","lineHeight","textColor","gap","textAlign","hostWidth","hostDirection","iconColor","IconClass","concat","shadowRoot","seconds","secs","parseInt","Math","max","isPaused","startInterval","setInterval","stop","stopInterval","clearInterval","reset","dispatchEvent","CustomEvent","bubbles","pause","resume","removeAttribute","textContent","ms","totalSeconds","floor","hours","secondsInMinute","minutes","join","formatTime","toggle","paused","setTimeout","label","slottedIcon","loadingIndicatorStyles","ButtonClass","hostHeight","cursor","backgroundColor","outlineOffset","outlineColor","outlineStyle","outlineWidth","borderRadius","borderColor","borderStyle","borderWidth","verticalPadding","horizontalPadding","fallback","labelTextColor","labelTextDecoration","labelSpacing","slots","wrappedEleName","excludeAttrsSync","color","module","exports","buttonAttrs","mapButtonAttrs","timerAttrs","mapTimerAttrs","TimerButtonClass","flexDirection","button","addEventListener","onTimerStarted","onTimerEnded","onClick","bind","onclick","includeAttrs","mapAttrs","toggleButtonDisable","isDisabled"],"sourceRoot":""}
1
+ {"version":3,"file":"descope-timer-button.js","mappings":"sQAEA,MAgBMA,EAAgBC,IAEpB,MAAMC,EAAQ,IAAUC,SAASF,EAAM,CACrCG,aAAc,CAAEC,KAAK,EAAMC,YAAY,KAOzC,OAJe,IAAIC,WAEhBC,gBAAgBN,EAAO,iBACvBO,cAAc,MACP,EChBCC,GAAgB,QAAiB,SAExCC,EAAW,CAAC,MAAO,YAEzB,MAAMC,WAAiB,QAAgB,CACrCF,gBACAG,aAAc,UAEd,6BAAWC,GACT,OAAOH,CACT,CAEA,WAAAI,GACEC,QAEAC,KAAKC,aAAa,CAAEC,KAAM,SAAUC,UAAY,2BAIhD,QACE,6UAoBAH,KAEJ,CAEA,IAAAI,GACEL,MAAMK,SACNJ,KAAKK,iBAAiBL,KAAKM,IAC7B,CAEA,aAAAC,GACEP,KAAKQ,aACP,CAEA,gBAA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,aAAcX,EACdY,SAAUX,IAOZtJ,KAAKyJ,OAAOhE,WACTjG,cAAc,iBACd+B,aAAa,WAAY,OAC9B,CAEA,cAAAoI,GACE3J,KAAKkK,qBAAoB,EAC3B,CAEA,YAAAN,GACE5J,KAAKkK,qBAAoB,EAC3B,CAEA,OAAAL,GACE7J,KAAKwE,MAAM6B,OACb,CAEA,mBAAA6D,CAAoBC,GAClB5C,YAAW,KACT4C,EACInK,KAAKyJ,OAAOlI,aAAa,WAAY,QACrCvB,KAAKyJ,OAAO9C,gBAAgB,WAAW,GAE/C,I,kBCjIFjD,eAAeC,OAAOlE,EAAe8J,E,6FCK9B,MAAM9J,GAAgB,QAAiB,QAEjC8F,GAAY,SACvB,QAAiB,CACfjC,SAAU,CACR5B,KAAM,CAAC,KAGX,KACA,KAPuB,EASvB,QAAY,CACVmH,MAAO,GACPC,eAAgB,gBAChBpG,MAAO,IAAM,kEAKbqG,iBAAkB,CAAC,WAAY,SAC/BtJ,kB","sources":["webpack://@descope/web-components-ui/../components/descope-image/src/component/helpers.js","webpack://@descope/web-components-ui/../components/descope-image/src/component/ImageClass.js","webpack://@descope/web-components-ui/../components/descope-image/src/component/index.js","webpack://@descope/web-components-ui/../components/descope-button/src/component/clickableMixin.js","webpack://@descope/web-components-ui/../components/descope-timer/src/component/helpers.js","webpack://@descope/web-components-ui/../components/descope-timer/src/component/TimerClass.js","webpack://@descope/web-components-ui/../components/descope-timer/src/component/index.js","webpack://@descope/web-components-ui/../components/descope-button/src/component/ButtonClass.js","webpack://@descope/web-components-ui/../components/descope-button/src/component/index.js","webpack://@descope/web-components-ui/../components/descope-timer/src/component/clock.svg","webpack://@descope/web-components-ui/../components/descope-icon/src/component/index.js","webpack://@descope/web-components-ui/../components/descope-timer-button/src/component/TimerButtonClass.js","webpack://@descope/web-components-ui/../components/descope-timer-button/src/component/index.js","webpack://@descope/web-components-ui/../components/descope-icon/src/component/IconClass.js"],"sourcesContent":["import DOMPurify from 'dompurify';\n\nconst getFileExtension = (path) => {\n const match = path.match(/\\.([0-9a-z]+)(?:[\\\\?#]|$)/i);\n return match ? match[1] : null;\n};\n\nconst base64Prefix = 'data:image/svg+xml;base64,';\n\nconst isBase64Svg = (src) => src.startsWith(base64Prefix);\n\nconst createImgEle = (src, altText) => {\n const ele = document.createElement('img');\n ele.setAttribute('src', src);\n ele.setAttribute('alt', altText);\n return ele;\n};\n\nconst createSvgEle = (text) => {\n // we want to purify the SVG to avoid XSS attacks\n const clean = DOMPurify.sanitize(text, {\n USE_PROFILES: { svg: true, svgFilters: true },\n });\n\n const parser = new DOMParser();\n const ele = parser\n .parseFromString(clean, 'image/svg+xml')\n .querySelector('svg');\n return ele;\n};\n\nexport const createImage = async (src, altText) => {\n try {\n let ele;\n if (isBase64Svg(src)) {\n // handle base64 source\n const svgXml = atob(src.slice(base64Prefix.length));\n ele = createSvgEle(svgXml);\n } else if (getFileExtension(src) === 'svg') {\n // handle urls\n const fetchedSrc = await fetch(src);\n const text = await fetchedSrc.text();\n ele = createSvgEle(text);\n } else {\n // handle binary\n ele = createImgEle(src, altText);\n }\n\n ele.style.setProperty('max-width', '100%');\n ele.style.setProperty('max-height', '100%');\n\n return ele;\n } catch {\n return null;\n }\n};\n","/* eslint-disable no-use-before-define */\nimport {\n createStyleMixin,\n draggableMixin,\n componentNameValidationMixin,\n} from '@descope-ui/common/components-mixins';\nimport { createBaseClass } from '@descope-ui/common/base-classes';\nimport { compose } from '@descope-ui/common/utils';\nimport { getComponentName } from '@descope-ui/common/components-helpers';\nimport { createImage } from './helpers';\nimport { injectStyle } from '@descope-ui/common/components-helpers';\n\nexport const componentName = getComponentName('image');\n\nconst srcAttrs = ['src', 'src-dark'];\n\nclass RawImage extends createBaseClass({\n componentName,\n baseSelector: 'slot',\n}) {\n static get observedAttributes() {\n return srcAttrs;\n }\n\n constructor() {\n super();\n\n this.attachShadow({ mode: 'open' }).innerHTML = `\n\t\t<slot></slot>\n\t`;\n\n injectStyle(\n `\n\t\t\t:host {\n\t\t\t\tdisplay: inline-flex;\n\t\t\t}\n :host > slot {\n width: 100%;\n height: 100%;\n\t\t\t\tbox-sizing: border-box;\n\t\t\t\tdisplay: flex;\n\t\t\t\toverflow: hidden;\n\t\t\t}\n\n ::slotted(*) {\n width: 100%;\n\t\t\t}\n\n .hidden {\n display: none;\n }\n `,\n this,\n );\n }\n\n init() {\n super.init?.();\n this.toggleVisibility(this.src);\n }\n\n onThemeChange() {\n this.renderImage();\n }\n\n toggleVisibility(isVisible) {\n if (isVisible) {\n this.classList.remove('hidden');\n } else {\n this.classList.add('hidden');\n }\n }\n\n get altText() {\n return this.getAttribute('alt') || '';\n }\n\n get legacySrc() {\n return this.getAttribute('src');\n }\n\n get themeSrc() {\n return this.getAttribute(`src-${this.currentThemeName}`);\n }\n\n get src() {\n return this.themeSrc || this.legacySrc;\n }\n\n // in order to fill an SVG with `currentColor` override all of its `fill` and `path` nodes\n // with the value from the `st-fill` attribute\n // eslint-disable-next-line class-methods-use-this\n updateFillColor(node) {\n // set fill to root node and all its relevant selectors\n const elementsToReplace = [node, ...node.querySelectorAll('*[fill]')];\n\n elementsToReplace.forEach((ele) => {\n ele.setAttribute(\n 'fill',\n `var(${ImageClass.cssVarList.fill}, ${ele.getAttribute('fill') || \"''\"})`,\n );\n });\n }\n\n renderImage() {\n this.toggleVisibility(this.src);\n\n createImage(this.src, this.altText).then((res) => {\n this.innerHTML = '';\n if (res) {\n this.updateFillColor(res);\n this.appendChild(res);\n }\n });\n }\n\n // render only when src attribute matches current theme\n shouldRender(src) {\n const srcVal = this.getAttribute(src);\n return this.src === srcVal;\n }\n\n attributeChangedCallback(attrName, oldValue, newValue) {\n super.attributeChangedCallback?.(attrName, oldValue, newValue);\n\n if (oldValue === newValue) return;\n\n if (this.shouldRender(attrName)) {\n this.renderImage();\n }\n }\n}\n\nexport const ImageClass = compose(\n createStyleMixin({\n mappings: {\n fill: {},\n height: { selector: () => ':host' },\n width: { selector: () => ':host' },\n },\n }),\n draggableMixin,\n componentNameValidationMixin,\n)(RawImage);\n","import { componentName, ImageClass } from './ImageClass';\n\ncustomElements.define(componentName, ImageClass);\n\nexport { ImageClass, componentName };\n","export const clickableMixin = (superclass) =>\n class ClickableMixinClass extends superclass {\n get isLoading() {\n return this.getAttribute('loading') === 'true';\n }\n\n click() {\n this.isLoading || super.click();\n }\n };\n","const fmt = (val, pad = 2) => String(val).padStart(pad, '0');\n\nexport const formatTime = (ms = 0) => {\n const totalSeconds = Math.floor(ms / 1000);\n\n const secondsInMinute = 60;\n const secondsInHour = secondsInMinute * 60;\n\n const hours = Math.floor(totalSeconds / secondsInHour);\n const minutes = Math.floor((totalSeconds % secondsInHour) / secondsInMinute);\n const seconds = totalSeconds % secondsInMinute;\n\n const timeParts = [...(hours ? [fmt(hours)] : []), fmt(minutes), fmt(seconds)];\n\n return timeParts.join(':');\n};\n","import {\n createStyleMixin,\n draggableMixin,\n componentNameValidationMixin,\n} from '@descope-ui/common/components-mixins';\nimport { createBaseClass } from '@descope-ui/common/base-classes';\nimport { compose } from '@descope-ui/common/utils';\nimport {\n getComponentName,\n injectStyle,\n} from '@descope-ui/common/components-helpers';\nimport clockIcon from './clock.svg';\nimport { IconClass } from '@descope-ui/descope-icon/class';\nimport { formatTime } from './helpers';\n\nexport const componentName = getComponentName('timer');\n\nconst observedAttributes = ['seconds', 'hide-icon', 'paused'];\n\nconst BaseClass = createBaseClass({\n componentName,\n baseSelector: ':host > .wrapper',\n});\n\nconst DEFAULT_INTERVAL = 1000;\n\nclass RawTimer extends BaseClass {\n #timeRemains = 0;\n\n #intervalId;\n\n static get observedAttributes() {\n return observedAttributes.concat(BaseClass.observedAttributes || []);\n }\n\n constructor() {\n super();\n\n this.attachShadow({ mode: 'open' }).innerHTML = `\n <div class=\"wrapper\">\n <descope-icon src=\"${clockIcon}\" class=\"icon\"></descope-icon>\n <div class=\"timer\"></div>\n </div>\n\t\t`;\n\n injectStyle(\n `\n :host {\n display: inline-flex;\n user-select: none;\n -webkit-user-select: none;\n }\n .wrapper {\n display: flex;\n align-items: center;\n flex-direction: row;\n width: 100%;\n }\n .hidden {\n display: none;\n }\n `,\n this,\n );\n\n this.icon = this.shadowRoot.querySelector('.icon');\n this.timer = this.shadowRoot.querySelector('.timer');\n }\n\n get seconds() {\n const val = this.getAttribute('seconds');\n const secs = parseInt(val || 0, 10) * 1000;\n return Math.max(0, secs);\n }\n\n // we use `pause` attribute for allowing preview mode by executing `pause`\n get isPaused() {\n return this.getAttribute('paused') === 'true';\n }\n\n init() {\n super.init?.();\n\n this.#timeRemains = this.seconds;\n }\n\n startInterval() {\n const intervalCycle = () => {\n this.#decreaseInterval();\n if (!this.#timeRemains) this.stop();\n this.#updateDisplay(this.#timeRemains);\n };\n\n if (this.#timeRemains) {\n this.#intervalId = setInterval(intervalCycle, DEFAULT_INTERVAL);\n } else {\n this.stop();\n }\n }\n\n stopInterval() {\n clearInterval(this.#intervalId);\n }\n\n #decreaseInterval() {\n this.#timeRemains = this.#timeRemains - DEFAULT_INTERVAL;\n }\n\n reset() {\n this.#timeRemains = this.seconds;\n this.#updateDisplay(this.#timeRemains);\n\n if (this.isPaused) return;\n\n this.dispatchEvent(new CustomEvent('timer-started', { bubbles: true }));\n this.startInterval();\n }\n\n stop() {\n this.stopInterval();\n this.#timeRemains = 0;\n this.#updateDisplay(this.#timeRemains);\n this.dispatchEvent(new CustomEvent('timer-ended', { bubbles: true }));\n }\n\n pause() {\n this.setAttribute('paused', 'true');\n this.stopInterval();\n }\n\n resume() {\n this.removeAttribute('paused');\n this.startInterval();\n }\n\n #updateDisplay(val) {\n this.timer.textContent = formatTime(val);\n }\n\n #toggleIcon(val) {\n this.icon.classList.toggle('hidden', val);\n }\n\n #handlePause(paused) {\n setTimeout(() => {\n if (paused) {\n this.pause();\n } else {\n // we want to prevent a another interval from starting in case previous interval was not yet cleared\n if (!this.#intervalId) {\n this.resume();\n }\n }\n });\n }\n\n attributeChangedCallback(attrName, oldValue, newValue) {\n super.attributeChangedCallback?.(attrName, oldValue, newValue);\n\n if (newValue !== oldValue) {\n if (attrName === 'seconds') {\n this.reset();\n }\n if (attrName === 'hide-icon') {\n this.#toggleIcon(newValue === 'true');\n }\n if (attrName === 'paused') {\n this.#handlePause(newValue === 'true');\n }\n }\n }\n}\n\nconst { host, icon, timer } = {\n host: { selector: () => ':host' },\n icon: { selector: () => '.icon' },\n timer: { selector: () => '.timer' },\n};\n\nexport const TimerClass = compose(\n createStyleMixin({\n mappings: {\n fontSize: {},\n iconSize: [\n { ...icon, property: 'width' },\n { ...icon, property: 'height' },\n ],\n fontFamily: {},\n minHeight: {},\n fontWeight: { ...timer },\n lineHeight: { ...timer },\n textColor: { ...timer, property: 'color' },\n gap: {},\n textAlign: { property: 'justify-content' },\n hostWidth: { ...host, property: 'width' },\n hostDirection: { ...host, property: 'direction' },\n iconColor: { ...icon, property: IconClass.cssVarList.fill },\n },\n }),\n draggableMixin,\n componentNameValidationMixin,\n)(RawTimer);\n","import { componentName, TimerClass } from './TimerClass';\nimport '@descope-ui/descope-icon';\n\ncustomElements.define(componentName, TimerClass);\n\nexport { TimerClass, componentName };\n","import { compose } from '@descope-ui/common/utils';\nimport { getComponentName } from '@descope-ui/common/components-helpers';\nimport {\n createStyleMixin,\n draggableMixin,\n createProxy,\n componentNameValidationMixin,\n} from '@descope-ui/common/components-mixins';\nimport { IconClass } from '@descope-ui/descope-icon/class';\nimport { clickableMixin } from './clickableMixin';\n\nexport const componentName = getComponentName('button');\n\nconst resetStyles = `\n\t:host {\n\t\tdisplay: inline-block;\n\t\tbox-sizing: border-box;\n\t}\n\tvaadin-button::before,\n\tvaadin-button::after {\n\t\topacity: 0;\n\t}\n\tvaadin-button {\n\t\tmargin: 0;\n\t\tmin-width: 0;\n\t\twidth: 100%;\n\t\theight: auto;\n\t\tbox-shadow: none;\n\t}\n\tvaadin-button::part(label) {\n\t\tpadding: 0;\n width: 100%;\n\t}\n\tvaadin-button::part(prefix) {\n\t\tmargin-left: 0;\n\t\tmargin-right: 0;\n\t}\n`;\n\nconst iconStyles = `\n\tvaadin-button::part(prefix),\n\tvaadin-button::part(label) {\n\t\tdisplay: flex;\n\t\talign-items: center;\n\t}\n`;\n\nconst editorOverrides = `vaadin-button::part(label) { pointer-events: none; }`;\n\nconst { host, label, slottedIcon } = {\n host: { selector: () => ':host' },\n label: { selector: '::part(label)' },\n slottedIcon: { selector: () => '::slotted(descope-icon)' },\n};\n\nlet loadingIndicatorStyles;\n\nexport const ButtonClass = compose(\n createStyleMixin({\n mappings: {\n hostWidth: { property: 'width' },\n hostHeight: { property: 'height' },\n hostDirection: { ...host, property: 'direction' },\n fontSize: {},\n fontFamily: {},\n\n cursor: {},\n backgroundColor: {},\n\n outlineOffset: {},\n outlineColor: {},\n outlineStyle: {},\n outlineWidth: {},\n\n borderRadius: {},\n borderColor: {},\n borderStyle: {},\n borderWidth: {},\n\n verticalPadding: [{ property: 'padding-top' }, { property: 'padding-bottom' }],\n horizontalPadding: [\n { property: 'padding-right', fallback: '0.875em' },\n { property: 'padding-left', fallback: '0.875em' },\n ],\n\n labelTextColor: { property: 'color' },\n iconColor: {\n selector: () => `::slotted(*)`,\n property: IconClass.cssVarList.fill,\n },\n labelTextDecoration: { ...label, property: 'text-decoration' },\n labelSpacing: { ...label, property: 'gap' },\n textAlign: { ...label, property: 'justify-content', fallback: 'center' },\n\n iconSize: [\n { ...slottedIcon, property: 'width' },\n { ...slottedIcon, property: 'height' },\n ],\n },\n }),\n clickableMixin,\n draggableMixin,\n componentNameValidationMixin\n)(\n createProxy({\n slots: ['', 'prefix', 'label', 'suffix'],\n wrappedEleName: 'vaadin-button',\n style: () => `\n\t\t\t${resetStyles}\n\t\t\t${iconStyles}\n\t\t\t${loadingIndicatorStyles}\n\t\t\t${editorOverrides}\n\t\t\t:host {\n\t\t\t\tpadding: calc(var(${ButtonClass.cssVarList.outlineWidth}) + var(${ButtonClass.cssVarList.outlineOffset}));\n\t\t\t}\n :host([full-width=\"true\"]) {\n width: var(${ButtonClass.cssVarList.hostWidth});\n }\n\t\t\tvaadin-button {\n\t\t\t\theight: calc(var(${ButtonClass.cssVarList.hostHeight}) - var(${ButtonClass.cssVarList.outlineWidth}) - var(${ButtonClass.cssVarList.outlineOffset}));\n\t\t\t}\n\t\t\t[square=\"true\"]:not([full-width=\"true\"]) {\n\t\t\t\twidth: calc(var(${ButtonClass.cssVarList.hostWidth}) - var(${ButtonClass.cssVarList.outlineWidth}) - var(${ButtonClass.cssVarList.outlineOffset}));\n padding: 0;\n\t\t\t}\n\t\t`,\n excludeAttrsSync: ['tabindex'],\n componentName,\n })\n);\n\nconst { color, fontSize } = ButtonClass.cssVarList;\nloadingIndicatorStyles = `\n\t@keyframes spin {\n\t\t0% { -webkit-transform: rotate(0deg); }\n\t\t100% { -webkit-transform: rotate(360deg); }\n\t}\n\t:host([loading=\"true\"]) ::before {\n\t\tanimation: spin 2s linear infinite;\n\t\tposition: absolute;\n\t\tcontent: '';\n\t\tz-index: 1;\n\t\tbox-sizing: border-box;\n\t\tborder-radius: 50%;\n\t\tborder-bottom-color: transparent;\n\t\tborder-left-color: transparent;\n\t\tborder-style: solid;\n\t\tcolor: var(${color});\n\t\ttop: calc(50% - (var(${fontSize}) / 2));\n\t\tleft: calc(50% - (var(${fontSize}) / 2));\n\t\tborder-width: calc(var(${fontSize}) / 10);\n\t\twidth: var(${fontSize});\n\t\theight: var(${fontSize});\n\t}\n\t:host([disabled=\"true\"]),\n\t:host([loading=\"true\"]) {\n\t\tpointer-events: none;\n\t}\n\t:host([loading=\"true\"]) ::part(prefix),\n\t:host([loading=\"true\"]) ::part(label) {\n\t\tvisibility: hidden;\n\t}\n`;\n","import { componentName, ButtonClass } from './ButtonClass';\nimport '@vaadin/button';\n\ncustomElements.define(componentName, ButtonClass);\n\nexport { ButtonClass, componentName };\n","module.exports = \"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMWVtIiBoZWlnaHQ9IjFlbSIgdmlld0JveD0iMCAwIDEwNCAxMDQiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+IDxwYXRoIGQ9Ik01MC4zMzM0IDAuMzMzMjUyQzIyLjgzMzQgMC4zMzMyNTIgMC4zMzMzNzQgMjIuODMzMyAwLjMzMzM3NCA1MC4zMzMzQzAuMzMzMzc0IDc3LjgzMzMgMjIuODMzNCAxMDAuMzMzIDUwLjMzMzQgMTAwLjMzM0M3Ny44MzM0IDEwMC4zMzMgMTAwLjMzMyA3Ny44MzMzIDEwMC4zMzMgNTAuMzMzM0MxMDAuMzMzIDIyLjgzMzMgNzcuODMzNCAwLjMzMzI1MiA1MC4zMzM0IDAuMzMzMjUyWk01MC4zMzM0IDg3LjgzMzNDMjkuNzA4NCA4Ny44MzMzIDEyLjgzMzQgNzAuOTU4MyAxMi44MzM0IDUwLjMzMzNDMTIuODMzNCAyOS43MDgzIDI5LjcwODQgMTIuODMzMyA1MC4zMzM0IDEyLjgzMzNDNzAuOTU4NCAxMi44MzMzIDg3LjgzMzQgMjkuNzA4MyA4Ny44MzM0IDUwLjMzMzNDODcuODMzNCA3MC45NTgzIDcwLjk1ODQgODcuODMzMyA1MC4zMzM0IDg3LjgzMzNaIiBmaWxsPSIjMTgxQTFDIi8+IDxwYXRoIGQ9Ik01MC4zMzI4IDE5LjA4MzNINDQuMDgyOFY1Ni41ODMySDc1LjMzMjhWNTAuMzMzMkg1MC4zMzI4VjE5LjA4MzNaIiBmaWxsPSIjMTgxQTFDIi8+IDwvc3ZnPiA=\"","import '@descope-ui/descope-image';\n\nimport { componentName, IconClass } from './IconClass';\n\ncustomElements.define(componentName, IconClass);\n\nexport { IconClass, componentName };\n","import {\n createStyleMixin,\n draggableMixin,\n componentNameValidationMixin,\n} from '@descope-ui/common/components-mixins';\nimport { createBaseClass } from '@descope-ui/common/base-classes';\nimport { compose } from '@descope-ui/common/utils';\nimport {\n forwardAttrs,\n getComponentName,\n injectStyle,\n} from '@descope-ui/common/components-helpers';\n\nexport const componentName = getComponentName('timer-button');\n\nconst buttonAttrs = [\n 'button-variant',\n 'button-mode',\n 'size',\n 'text-align',\n 'full-width',\n];\n\nconst mapButtonAttrs = {\n 'button-variant': 'variant',\n 'button-mode': 'mode',\n};\n\nconst timerAttrs = [\n 'timer-seconds',\n 'timer-hide-icon',\n 'timer-paused',\n 'size',\n 'text-align',\n 'full-width',\n];\n\nconst mapTimerAttrs = {\n 'timer-seconds': 'seconds',\n 'timer-hide-icon': 'hide-icon',\n 'timer-paused': 'paused',\n};\n\nconst BaseClass = createBaseClass({\n componentName,\n baseSelector: ':host > div',\n});\n\nclass RawTimerButton extends BaseClass {\n constructor() {\n super();\n\n this.attachShadow({ mode: 'open' }).innerHTML = `\n <div class=\"wrapper\">\n <descope-timer class=\"timer\"></descope-timer>\n <descope-button class=\"button\" disabled=\"true\">\n <slot></slot>\n </descope-button>\n </div>\n\t\t`;\n\n injectStyle(\n `\n :host {\n display: inline-flex;\n }\n .wrapper {\n display: flex;\n flex-direction: column;\n gap: 0.5em;\n align-items: center;\n width: 100%;\n }\n .timer {\n flex: 1;\n }\n `,\n this,\n );\n\n this.timer = this.shadowRoot.querySelector('.timer');\n this.button = this.shadowRoot.querySelector('.button');\n\n this.timer.addEventListener('timer-started', () => this.onTimerStarted());\n this.timer.addEventListener('timer-ended', () => this.onTimerEnded());\n\n this.button.addEventListener('click', this.onClick.bind(this));\n }\n\n set onclick(val) {\n this.button.onclick = val;\n }\n\n init() {\n super.init?.();\n\n forwardAttrs(this, this.button, {\n includeAttrs: buttonAttrs,\n mapAttrs: mapButtonAttrs,\n });\n\n forwardAttrs(this, this.timer, {\n includeAttrs: timerAttrs,\n mapAttrs: mapTimerAttrs,\n });\n\n // When we sync attributes, the `disabled` attribute is being compared to the attribute\n // on Vaadin component; since the Vaadin component has no `disabled` attribute, we sync\n // that back to our component.\n // This is pending a more generic fix in the way we sync attibutes.\n this.button.shadowRoot\n .querySelector('vaadin-button')\n .setAttribute('disabled', 'true');\n }\n\n onTimerStarted() {\n this.toggleButtonDisable(true);\n }\n\n onTimerEnded() {\n this.toggleButtonDisable(false);\n }\n\n onClick() {\n this.timer.reset();\n }\n\n toggleButtonDisable(isDisabled) {\n setTimeout(() => {\n isDisabled\n ? this.button.setAttribute('disabled', 'true')\n : this.button.removeAttribute('disabled');\n });\n }\n}\n\nconst { host } = {\n host: { selector: () => ':host' },\n icon: { selector: '.icon' },\n timer: { selector: '.timer' },\n};\n\nexport const TimerButtonClass = compose(\n createStyleMixin({\n mappings: {\n gap: {},\n flexDirection: {},\n hostWidth: { ...host, property: 'width' },\n hostDirection: { ...host, property: 'direction' },\n },\n }),\n draggableMixin,\n componentNameValidationMixin,\n)(RawTimerButton);\n","import { componentName, TimerButtonClass } from './TimerButtonClass';\nimport '@descope-ui/descope-button';\nimport '@descope-ui/descope-timer';\n\ncustomElements.define(componentName, TimerButtonClass);\n\nexport { TimerButtonClass, componentName };\n","import {\n componentNameValidationMixin,\n createProxy,\n createStyleMixin,\n draggableMixin,\n} from '@descope-ui/common/components-mixins';\nimport { getComponentName } from '@descope-ui/common/components-helpers';\nimport { compose } from '@descope-ui/common/utils';\n\nexport const componentName = getComponentName('icon');\n\nexport const IconClass = compose(\n createStyleMixin({\n mappings: {\n fill: {},\n },\n }),\n draggableMixin,\n componentNameValidationMixin,\n)(\n createProxy({\n slots: [],\n wrappedEleName: 'descope-image',\n style: () => `\n :host {\n display: inline-flex;\n }\n `,\n excludeAttrsSync: ['tabindex', 'class'],\n componentName,\n }),\n);\n"],"names":["createSvgEle","text","clean","sanitize","USE_PROFILES","svg","svgFilters","DOMParser","parseFromString","querySelector","componentName","srcAttrs","RawImage","baseSelector","observedAttributes","constructor","super","this","attachShadow","mode","innerHTML","init","toggleVisibility","src","onThemeChange","renderImage","isVisible","classList","remove","add","altText","getAttribute","legacySrc","themeSrc","currentThemeName","updateFillColor","node","querySelectorAll","forEach","ele","setAttribute","ImageClass","cssVarList","fill","async","startsWith","isBase64Svg","svgXml","atob","slice","base64Prefix","path","match","getFileExtension","fetchedSrc","fetch","document","createElement","createImgEle","style","setProperty","createImage","then","res","appendChild","shouldRender","srcVal","attributeChangedCallback","attrName","oldValue","newValue","mappings","height","selector","width","customElements","define","clickableMixin","superclass","isLoading","click","fmt","val","pad","String","padStart","BaseClass","host","icon","timer","TimerClass","fontSize","iconSize","property","fontFamily","minHeight","fontWeight","lineHeight","textColor","gap","textAlign","hostWidth","hostDirection","iconColor","IconClass","concat","shadowRoot","seconds","secs","parseInt","Math","max","isPaused","startInterval","setInterval","stop","stopInterval","clearInterval","reset","dispatchEvent","CustomEvent","bubbles","pause","resume","removeAttribute","textContent","ms","totalSeconds","floor","hours","secondsInMinute","minutes","join","formatTime","toggle","paused","setTimeout","label","slottedIcon","loadingIndicatorStyles","ButtonClass","hostHeight","cursor","backgroundColor","outlineOffset","outlineColor","outlineStyle","outlineWidth","borderRadius","borderColor","borderStyle","borderWidth","verticalPadding","horizontalPadding","fallback","labelTextColor","labelTextDecoration","labelSpacing","slots","wrappedEleName","excludeAttrsSync","color","module","exports","buttonAttrs","mapButtonAttrs","timerAttrs","mapTimerAttrs","TimerButtonClass","flexDirection","button","addEventListener","onTimerStarted","onTimerEnded","onClick","bind","onclick","includeAttrs","mapAttrs","toggleButtonDisable","isDisabled"],"sourceRoot":""}
@@ -1,2 +1,2 @@
1
- (self.webpackChunk_descope_web_components_ui=self.webpackChunk_descope_web_components_ui||[]).push([[1202,2250,6724],{6301:(t,e,s)=>{"use strict";s.r(e),s.d(e,{ImageClass:()=>d,componentName:()=>c});var i=s(88961),n=s(72270),r=s(63200),a=s(25964),o=s(25414);const l=t=>{const e=o.A.sanitize(t,{USE_PROFILES:{svg:!0,svgFilters:!0}});return(new DOMParser).parseFromString(e,"image/svg+xml").querySelector("svg")},c=(0,a.xE)("image"),h=["src","src-dark"];class M extends((0,n.qu)({componentName:c,baseSelector:"slot"})){static get observedAttributes(){return h}constructor(){super(),this.attachShadow({mode:"open"}).innerHTML="\n\t\t<slot></slot>\n\t",(0,a.fz)("\n\t\t\t:host {\n\t\t\t\tdisplay: inline-flex;\n\t\t\t}\n :host > slot {\n width: 100%;\n height: 100%;\n\t\t\t\tbox-sizing: border-box;\n\t\t\t\tdisplay: flex;\n\t\t\t\toverflow: hidden;\n\t\t\t}\n\n ::slotted(*) {\n width: 100%;\n\t\t\t}\n\n .hidden {\n display: none;\n }\n ",this)}init(){super.init?.(),this.toggleVisibility(this.src)}onThemeChange(){this.renderImage()}toggleVisibility(t){t?this.classList.remove("hidden"):this.classList.add("hidden")}get legacySrc(){return this.getAttribute("src")}get themeSrc(){return this.getAttribute(`src-${this.currentThemeName}`)}get src(){return this.themeSrc||this.legacySrc}updateFillColor(t){[t,...t.querySelectorAll("*[fill]")].forEach((t=>{t.setAttribute("fill",`var(${d.cssVarList.fill}, ${t.getAttribute("fill")||"''"})`)}))}renderImage(){this.toggleVisibility(this.src),(async t=>{try{let e;if((t=>t.startsWith("data:image/svg+xml;base64,"))(t)){const s=atob(t.slice(26));e=l(s)}else if("svg"===(t=>{const e=t.match(/\.([0-9a-z]+)(?:[\\?#]|$)/i);return e?e[1]:null})(t)){const s=await fetch(t),i=await s.text();e=l(i)}else e=(t=>{const e=document.createElement("img");return e.setAttribute("src",t),e})(t);return e.style.setProperty("max-width","100%"),e.style.setProperty("max-height","100%"),e}catch{return null}})(this.src).then((t=>{this.innerHTML="",t&&(this.updateFillColor(t),this.appendChild(t))}))}shouldRender(t){const e=this.getAttribute(t);return this.src===e}attributeChangedCallback(t,e,s){super.attributeChangedCallback?.(t,e,s),e!==s&&this.shouldRender(t)&&this.renderImage()}}const d=(0,r.Zz)((0,i.RF)({mappings:{fill:{},height:{selector:()=>":host"},width:{selector:()=>":host"}}}),i.VO,i.tQ)(M);customElements.define(c,d)},15887:(t,e,s)=>{"use strict";s.r(e),s.d(e,{TimerClass:()=>p,componentName:()=>M});var i=s(88961),n=s(72270),r=s(63200),a=s(25964),o=s(44006),l=s.n(o),c=s(98538);const h=(t,e=2)=>String(t).padStart(e,"0"),M=(0,a.xE)("timer"),d=["seconds","hide-icon","paused"],u=(0,n.qu)({componentName:M,baseSelector:":host > .wrapper"}),{host:z,icon:m,timer:g}={host:{selector:()=>":host"},icon:{selector:()=>".icon"},timer:{selector:()=>".timer"}},p=(0,r.Zz)((0,i.RF)({mappings:{fontSize:{},iconSize:[{...m,property:"width"},{...m,property:"height"}],fontFamily:{},minHeight:{},fontWeight:{...g},lineHeight:{...g},textColor:{...g,property:"color"},gap:{},textAlign:{property:"justify-content"},hostWidth:{...z,property:"width"},hostDirection:{...z,property:"direction"},iconColor:{...m,property:c.S.cssVarList.fill}}}),i.VO,i.tQ)(class extends u{#t=0;#e;static get observedAttributes(){return d.concat(u.observedAttributes||[])}constructor(){super(),this.attachShadow({mode:"open"}).innerHTML=`\n <div class="wrapper">\n <descope-icon src="${l()}" class="icon"></descope-icon>\n <div class="timer"></div>\n </div>\n\t\t`,(0,a.fz)("\n :host {\n display: inline-flex;\n user-select: none;\n -webkit-user-select: none;\n }\n .wrapper {\n display: flex;\n align-items: center;\n flex-direction: row;\n width: 100%;\n }\n .hidden {\n display: none;\n }\n ",this),this.icon=this.shadowRoot.querySelector(".icon"),this.timer=this.shadowRoot.querySelector(".timer")}get seconds(){const t=this.getAttribute("seconds"),e=1e3*parseInt(t||0,10);return Math.max(0,e)}get isPaused(){return"true"===this.getAttribute("paused")}init(){super.init?.(),this.#t=this.seconds}startInterval(){this.#t?this.#e=setInterval((()=>{this.#s(),this.#t||this.stop(),this.#i(this.#t)}),1e3):this.stop()}stopInterval(){clearInterval(this.#e)}#s(){this.#t=this.#t-1e3}reset(){this.#t=this.seconds,this.#i(this.#t),this.isPaused||(this.dispatchEvent(new CustomEvent("timer-started",{bubbles:!0})),this.startInterval())}stop(){this.stopInterval(),this.#t=0,this.#i(this.#t),this.dispatchEvent(new CustomEvent("timer-ended",{bubbles:!0}))}pause(){this.setAttribute("paused","true"),this.stopInterval()}resume(){this.removeAttribute("paused"),this.startInterval()}#i(t){this.timer.textContent=((t=0)=>{const e=Math.floor(t/1e3),s=Math.floor(e/3600),i=Math.floor(e%3600/60),n=e%60;return[...s?[h(s)]:[],h(i),h(n)].join(":")})(t)}#n(t){this.icon.classList.toggle("hidden",t)}#r(t){setTimeout((()=>{t?this.pause():this.#e||this.resume()}))}attributeChangedCallback(t,e,s){super.attributeChangedCallback?.(t,e,s),s!==e&&("seconds"===t&&this.reset(),"hide-icon"===t&&this.#n("true"===s),"paused"===t&&this.#r("true"===s))}});s(56737),customElements.define(M,p)},44006:t=>{t.exports="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMWVtIiBoZWlnaHQ9IjFlbSIgdmlld0JveD0iMCAwIDEwNCAxMDQiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+IDxwYXRoIGQ9Ik01MC4zMzM0IDAuMzMzMjUyQzIyLjgzMzQgMC4zMzMyNTIgMC4zMzMzNzQgMjIuODMzMyAwLjMzMzM3NCA1MC4zMzMzQzAuMzMzMzc0IDc3LjgzMzMgMjIuODMzNCAxMDAuMzMzIDUwLjMzMzQgMTAwLjMzM0M3Ny44MzM0IDEwMC4zMzMgMTAwLjMzMyA3Ny44MzMzIDEwMC4zMzMgNTAuMzMzM0MxMDAuMzMzIDIyLjgzMzMgNzcuODMzNCAwLjMzMzI1MiA1MC4zMzM0IDAuMzMzMjUyWk01MC4zMzM0IDg3LjgzMzNDMjkuNzA4NCA4Ny44MzMzIDEyLjgzMzQgNzAuOTU4MyAxMi44MzM0IDUwLjMzMzNDMTIuODMzNCAyOS43MDgzIDI5LjcwODQgMTIuODMzMyA1MC4zMzM0IDEyLjgzMzNDNzAuOTU4NCAxMi44MzMzIDg3LjgzMzQgMjkuNzA4MyA4Ny44MzM0IDUwLjMzMzNDODcuODMzNCA3MC45NTgzIDcwLjk1ODQgODcuODMzMyA1MC4zMzM0IDg3LjgzMzNaIiBmaWxsPSIjMTgxQTFDIi8+IDxwYXRoIGQ9Ik01MC4zMzI4IDE5LjA4MzNINDQuMDgyOFY1Ni41ODMySDc1LjMzMjhWNTAuMzMzMkg1MC4zMzI4VjE5LjA4MzNaIiBmaWxsPSIjMTgxQTFDIi8+IDwvc3ZnPiA="},56737:(t,e,s)=>{"use strict";s.r(e),s.d(e,{IconClass:()=>i.S,componentName:()=>i.T}),s(6301);var i=s(98538);customElements.define(i.T,i.S)},98538:(t,e,s)=>{"use strict";s.d(e,{S:()=>o,T:()=>a});var i=s(88961),n=s(25964),r=s(63200);const a=(0,n.xE)("icon"),o=(0,r.Zz)((0,i.RF)({mappings:{fill:{}}}),i.VO,i.tQ)((0,i.tz)({slots:[],wrappedEleName:"descope-image",style:()=>"\n :host {\n display: inline-flex;\n }\n ",excludeAttrsSync:["tabindex","class"],componentName:a}))}}]);
1
+ (self.webpackChunk_descope_web_components_ui=self.webpackChunk_descope_web_components_ui||[]).push([[1202,2250,6724],{6301:(t,e,s)=>{"use strict";s.r(e),s.d(e,{ImageClass:()=>d,componentName:()=>c});var i=s(88961),n=s(72270),r=s(63200),a=s(25964),o=s(25414);const l=t=>{const e=o.A.sanitize(t,{USE_PROFILES:{svg:!0,svgFilters:!0}});return(new DOMParser).parseFromString(e,"image/svg+xml").querySelector("svg")},c=(0,a.xE)("image"),h=["src","src-dark"];class M extends((0,n.qu)({componentName:c,baseSelector:"slot"})){static get observedAttributes(){return h}constructor(){super(),this.attachShadow({mode:"open"}).innerHTML="\n\t\t<slot></slot>\n\t",(0,a.fz)("\n\t\t\t:host {\n\t\t\t\tdisplay: inline-flex;\n\t\t\t}\n :host > slot {\n width: 100%;\n height: 100%;\n\t\t\t\tbox-sizing: border-box;\n\t\t\t\tdisplay: flex;\n\t\t\t\toverflow: hidden;\n\t\t\t}\n\n ::slotted(*) {\n width: 100%;\n\t\t\t}\n\n .hidden {\n display: none;\n }\n ",this)}init(){super.init?.(),this.toggleVisibility(this.src)}onThemeChange(){this.renderImage()}toggleVisibility(t){t?this.classList.remove("hidden"):this.classList.add("hidden")}get altText(){return this.getAttribute("alt")||""}get legacySrc(){return this.getAttribute("src")}get themeSrc(){return this.getAttribute(`src-${this.currentThemeName}`)}get src(){return this.themeSrc||this.legacySrc}updateFillColor(t){[t,...t.querySelectorAll("*[fill]")].forEach((t=>{t.setAttribute("fill",`var(${d.cssVarList.fill}, ${t.getAttribute("fill")||"''"})`)}))}renderImage(){this.toggleVisibility(this.src),(async(t,e)=>{try{let s;if((t=>t.startsWith("data:image/svg+xml;base64,"))(t)){const e=atob(t.slice(26));s=l(e)}else if("svg"===(t=>{const e=t.match(/\.([0-9a-z]+)(?:[\\?#]|$)/i);return e?e[1]:null})(t)){const e=await fetch(t),i=await e.text();s=l(i)}else s=((t,e)=>{const s=document.createElement("img");return s.setAttribute("src",t),s.setAttribute("alt",e),s})(t,e);return s.style.setProperty("max-width","100%"),s.style.setProperty("max-height","100%"),s}catch{return null}})(this.src,this.altText).then((t=>{this.innerHTML="",t&&(this.updateFillColor(t),this.appendChild(t))}))}shouldRender(t){const e=this.getAttribute(t);return this.src===e}attributeChangedCallback(t,e,s){super.attributeChangedCallback?.(t,e,s),e!==s&&this.shouldRender(t)&&this.renderImage()}}const d=(0,r.Zz)((0,i.RF)({mappings:{fill:{},height:{selector:()=>":host"},width:{selector:()=>":host"}}}),i.VO,i.tQ)(M);customElements.define(c,d)},15887:(t,e,s)=>{"use strict";s.r(e),s.d(e,{TimerClass:()=>p,componentName:()=>M});var i=s(88961),n=s(72270),r=s(63200),a=s(25964),o=s(44006),l=s.n(o),c=s(98538);const h=(t,e=2)=>String(t).padStart(e,"0"),M=(0,a.xE)("timer"),d=["seconds","hide-icon","paused"],u=(0,n.qu)({componentName:M,baseSelector:":host > .wrapper"}),{host:z,icon:m,timer:g}={host:{selector:()=>":host"},icon:{selector:()=>".icon"},timer:{selector:()=>".timer"}},p=(0,r.Zz)((0,i.RF)({mappings:{fontSize:{},iconSize:[{...m,property:"width"},{...m,property:"height"}],fontFamily:{},minHeight:{},fontWeight:{...g},lineHeight:{...g},textColor:{...g,property:"color"},gap:{},textAlign:{property:"justify-content"},hostWidth:{...z,property:"width"},hostDirection:{...z,property:"direction"},iconColor:{...m,property:c.S.cssVarList.fill}}}),i.VO,i.tQ)(class extends u{#t=0;#e;static get observedAttributes(){return d.concat(u.observedAttributes||[])}constructor(){super(),this.attachShadow({mode:"open"}).innerHTML=`\n <div class="wrapper">\n <descope-icon src="${l()}" class="icon"></descope-icon>\n <div class="timer"></div>\n </div>\n\t\t`,(0,a.fz)("\n :host {\n display: inline-flex;\n user-select: none;\n -webkit-user-select: none;\n }\n .wrapper {\n display: flex;\n align-items: center;\n flex-direction: row;\n width: 100%;\n }\n .hidden {\n display: none;\n }\n ",this),this.icon=this.shadowRoot.querySelector(".icon"),this.timer=this.shadowRoot.querySelector(".timer")}get seconds(){const t=this.getAttribute("seconds"),e=1e3*parseInt(t||0,10);return Math.max(0,e)}get isPaused(){return"true"===this.getAttribute("paused")}init(){super.init?.(),this.#t=this.seconds}startInterval(){this.#t?this.#e=setInterval((()=>{this.#s(),this.#t||this.stop(),this.#i(this.#t)}),1e3):this.stop()}stopInterval(){clearInterval(this.#e)}#s(){this.#t=this.#t-1e3}reset(){this.#t=this.seconds,this.#i(this.#t),this.isPaused||(this.dispatchEvent(new CustomEvent("timer-started",{bubbles:!0})),this.startInterval())}stop(){this.stopInterval(),this.#t=0,this.#i(this.#t),this.dispatchEvent(new CustomEvent("timer-ended",{bubbles:!0}))}pause(){this.setAttribute("paused","true"),this.stopInterval()}resume(){this.removeAttribute("paused"),this.startInterval()}#i(t){this.timer.textContent=((t=0)=>{const e=Math.floor(t/1e3),s=Math.floor(e/3600),i=Math.floor(e%3600/60),n=e%60;return[...s?[h(s)]:[],h(i),h(n)].join(":")})(t)}#n(t){this.icon.classList.toggle("hidden",t)}#r(t){setTimeout((()=>{t?this.pause():this.#e||this.resume()}))}attributeChangedCallback(t,e,s){super.attributeChangedCallback?.(t,e,s),s!==e&&("seconds"===t&&this.reset(),"hide-icon"===t&&this.#n("true"===s),"paused"===t&&this.#r("true"===s))}});s(56737),customElements.define(M,p)},44006:t=>{t.exports="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMWVtIiBoZWlnaHQ9IjFlbSIgdmlld0JveD0iMCAwIDEwNCAxMDQiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+IDxwYXRoIGQ9Ik01MC4zMzM0IDAuMzMzMjUyQzIyLjgzMzQgMC4zMzMyNTIgMC4zMzMzNzQgMjIuODMzMyAwLjMzMzM3NCA1MC4zMzMzQzAuMzMzMzc0IDc3LjgzMzMgMjIuODMzNCAxMDAuMzMzIDUwLjMzMzQgMTAwLjMzM0M3Ny44MzM0IDEwMC4zMzMgMTAwLjMzMyA3Ny44MzMzIDEwMC4zMzMgNTAuMzMzM0MxMDAuMzMzIDIyLjgzMzMgNzcuODMzNCAwLjMzMzI1MiA1MC4zMzM0IDAuMzMzMjUyWk01MC4zMzM0IDg3LjgzMzNDMjkuNzA4NCA4Ny44MzMzIDEyLjgzMzQgNzAuOTU4MyAxMi44MzM0IDUwLjMzMzNDMTIuODMzNCAyOS43MDgzIDI5LjcwODQgMTIuODMzMyA1MC4zMzM0IDEyLjgzMzNDNzAuOTU4NCAxMi44MzMzIDg3LjgzMzQgMjkuNzA4MyA4Ny44MzM0IDUwLjMzMzNDODcuODMzNCA3MC45NTgzIDcwLjk1ODQgODcuODMzMyA1MC4zMzM0IDg3LjgzMzNaIiBmaWxsPSIjMTgxQTFDIi8+IDxwYXRoIGQ9Ik01MC4zMzI4IDE5LjA4MzNINDQuMDgyOFY1Ni41ODMySDc1LjMzMjhWNTAuMzMzMkg1MC4zMzI4VjE5LjA4MzNaIiBmaWxsPSIjMTgxQTFDIi8+IDwvc3ZnPiA="},56737:(t,e,s)=>{"use strict";s.r(e),s.d(e,{IconClass:()=>i.S,componentName:()=>i.T}),s(6301);var i=s(98538);customElements.define(i.T,i.S)},98538:(t,e,s)=>{"use strict";s.d(e,{S:()=>o,T:()=>a});var i=s(88961),n=s(25964),r=s(63200);const a=(0,n.xE)("icon"),o=(0,r.Zz)((0,i.RF)({mappings:{fill:{}}}),i.VO,i.tQ)((0,i.tz)({slots:[],wrappedEleName:"descope-image",style:()=>"\n :host {\n display: inline-flex;\n }\n ",excludeAttrsSync:["tabindex","class"],componentName:a}))}}]);
2
2
  //# sourceMappingURL=descope-timer.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"descope-timer.js","mappings":"kQAEA,MAeMA,EAAgBC,IAEpB,MAAMC,EAAQ,IAAUC,SAASF,EAAM,CACrCG,aAAc,CAAEC,KAAK,EAAMC,YAAY,KAOzC,OAJe,IAAIC,WAEhBC,gBAAgBN,EAAO,iBACvBO,cAAc,MACP,ECfCC,GAAgB,QAAiB,SAExCC,EAAW,CAAC,MAAO,YAEzB,MAAMC,WAAiB,QAAgB,CACrCF,gBACAG,aAAc,UAEd,6BAAWC,GACT,OAAOH,CACT,CAEA,WAAAI,GACEC,QAEAC,KAAKC,aAAa,CAAEC,KAAM,SAAUC,UAAY,2BAIhD,QACE,6UAoBAH,KAEJ,CAEA,IAAAI,GACEL,MAAMK,SACNJ,KAAKK,iBAAiBL,KAAKM,IAC7B,CAEA,aAAAC,GACEP,KAAKQ,aACP,CAEA,gBAAAH,CAAiBI,GACXA,EACFT,KAAKU,UAAUC,OAAO,UAEtBX,KAAKU,UAAUE,IAAI,SAEvB,CAEA,aAAIC,GACF,OAAOb,KAAKc,aAAa,MAC3B,CAEA,YAAIC,GACF,OAAOf,KAAKc,aAAa,OAAOd,KAAKgB,mBACvC,CAEA,OAAIV,GACF,OAAON,KAAKe,UAAYf,KAAKa,SAC/B,CAKA,eAAAI,CAAgBC,GAEY,CAACA,KAASA,EAAKC,iBAAiB,YAExCC,SAASC,IACzBA,EAAIC,aACF,OACA,OAAOC,EAAWC,WAAWC,SAASJ,EAAIP,aAAa,SAAW,QACnE,GAEL,CAEA,W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EJ,CAEA,wBAAApD,CAAyBC,EAAUC,EAAUC,GAC3CrD,MAAMkD,2BAA2BC,EAAUC,EAAUC,GAEjDA,IAAaD,IACE,YAAbD,GACFlD,KAAKgG,QAEU,cAAb9C,GACFlD,MAAK,EAAyB,SAAboD,GAEF,WAAbF,GACFlD,MAAK,EAA0B,SAAboD,GAGxB,I,SCvKFK,eAAeC,OAAOjE,EAAe2E,E,YCHrC+C,EAAOC,QAAU,o4B,8GCIjB3D,eAAeC,OAAO,IAAe,I,6FCK9B,MAAMjE,GAAgB,QAAiB,QAEjCyF,GAAY,SACvB,QAAiB,CACf7B,SAAU,CACR5B,KAAM,CAAC,KAGX,KACA,KAPuB,EASvB,QAAY,CACV4F,MAAO,GACPC,eAAgB,gBAChB7E,MAAO,IAAM,kEAKb8E,iBAAkB,CAAC,WAAY,SAC/B9H,kB","sources":["webpack://@descope/web-components-ui/../components/descope-image/src/component/helpers.js","webpack://@descope/web-components-ui/../components/descope-image/src/component/ImageClass.js","webpack://@descope/web-components-ui/../components/descope-image/src/component/index.js","webpack://@descope/web-components-ui/../components/descope-timer/src/component/helpers.js","webpack://@descope/web-components-ui/../components/descope-timer/src/component/TimerClass.js","webpack://@descope/web-components-ui/../components/descope-timer/src/component/index.js","webpack://@descope/web-components-ui/../components/descope-timer/src/component/clock.svg","webpack://@descope/web-components-ui/../components/descope-icon/src/component/index.js","webpack://@descope/web-components-ui/../components/descope-icon/src/component/IconClass.js"],"sourcesContent":["import DOMPurify from 'dompurify';\n\nconst getFileExtension = (path) => {\n const match = path.match(/\\.([0-9a-z]+)(?:[\\\\?#]|$)/i);\n return match ? match[1] : null;\n};\n\nconst base64Prefix = 'data:image/svg+xml;base64,';\n\nconst isBase64Svg = (src) => src.startsWith(base64Prefix);\n\nconst createImgEle = (src) => {\n const ele = document.createElement('img');\n ele.setAttribute('src', src);\n return ele;\n};\n\nconst createSvgEle = (text) => {\n // we want to purify the SVG to avoid XSS attacks\n const clean = DOMPurify.sanitize(text, {\n USE_PROFILES: { svg: true, svgFilters: true },\n });\n\n const parser = new DOMParser();\n const ele = parser\n .parseFromString(clean, 'image/svg+xml')\n .querySelector('svg');\n return ele;\n};\n\nexport const createImage = async (src) => {\n try {\n let ele;\n if (isBase64Svg(src)) {\n // handle base64 source\n const svgXml = atob(src.slice(base64Prefix.length));\n ele = createSvgEle(svgXml);\n } else if (getFileExtension(src) === 'svg') {\n // handle urls\n const fetchedSrc = await fetch(src);\n const text = await fetchedSrc.text();\n ele = createSvgEle(text);\n } else {\n // handle binary\n ele = createImgEle(src);\n }\n\n ele.style.setProperty('max-width', '100%');\n ele.style.setProperty('max-height', '100%');\n\n return ele;\n } catch {\n return null;\n }\n};\n","/* eslint-disable no-use-before-define */\nimport {\n createStyleMixin,\n draggableMixin,\n componentNameValidationMixin,\n} from '@descope-ui/common/components-mixins';\nimport { createBaseClass } from '@descope-ui/common/base-classes';\nimport { compose } from '@descope-ui/common/utils';\nimport { getComponentName } from '@descope-ui/common/components-helpers';\nimport { createImage } from './helpers';\nimport { injectStyle } from '@descope-ui/common/components-helpers';\n\nexport const componentName = getComponentName('image');\n\nconst srcAttrs = ['src', 'src-dark'];\n\nclass RawImage extends createBaseClass({\n componentName,\n baseSelector: 'slot',\n}) {\n static get observedAttributes() {\n return srcAttrs;\n }\n\n constructor() {\n super();\n\n this.attachShadow({ mode: 'open' }).innerHTML = `\n\t\t<slot></slot>\n\t`;\n\n injectStyle(\n `\n\t\t\t:host {\n\t\t\t\tdisplay: inline-flex;\n\t\t\t}\n :host > slot {\n width: 100%;\n height: 100%;\n\t\t\t\tbox-sizing: border-box;\n\t\t\t\tdisplay: flex;\n\t\t\t\toverflow: hidden;\n\t\t\t}\n\n ::slotted(*) {\n width: 100%;\n\t\t\t}\n\n .hidden {\n display: none;\n }\n `,\n this,\n );\n }\n\n init() {\n super.init?.();\n this.toggleVisibility(this.src);\n }\n\n onThemeChange() {\n this.renderImage();\n }\n\n toggleVisibility(isVisible) {\n if (isVisible) {\n this.classList.remove('hidden');\n } else {\n this.classList.add('hidden');\n }\n }\n\n get legacySrc() {\n return this.getAttribute('src');\n }\n\n get themeSrc() {\n return this.getAttribute(`src-${this.currentThemeName}`);\n }\n\n get src() {\n return this.themeSrc || this.legacySrc;\n }\n\n // in order to fill an SVG with `currentColor` override all of its `fill` and `path` nodes\n // with the value from the `st-fill` attribute\n // eslint-disable-next-line class-methods-use-this\n updateFillColor(node) {\n // set fill to root node and all its relevant selectors\n const elementsToReplace = [node, ...node.querySelectorAll('*[fill]')];\n\n elementsToReplace.forEach((ele) => {\n ele.setAttribute(\n 'fill',\n `var(${ImageClass.cssVarList.fill}, ${ele.getAttribute('fill') || \"''\"})`,\n );\n });\n }\n\n renderImage() {\n this.toggleVisibility(this.src);\n\n createImage(this.src).then((res) => {\n this.innerHTML = '';\n if (res) {\n this.updateFillColor(res);\n this.appendChild(res);\n }\n });\n }\n\n // render only when src attribute matches current theme\n shouldRender(src) {\n const srcVal = this.getAttribute(src);\n return this.src === srcVal;\n }\n\n attributeChangedCallback(attrName, oldValue, newValue) {\n super.attributeChangedCallback?.(attrName, oldValue, newValue);\n\n if (oldValue === newValue) return;\n\n if (this.shouldRender(attrName)) {\n this.renderImage();\n }\n }\n}\n\nexport const ImageClass = compose(\n createStyleMixin({\n mappings: {\n fill: {},\n height: { selector: () => ':host' },\n width: { selector: () => ':host' },\n },\n }),\n draggableMixin,\n componentNameValidationMixin,\n)(RawImage);\n","import { componentName, ImageClass } from './ImageClass';\n\ncustomElements.define(componentName, ImageClass);\n\nexport { ImageClass, componentName };\n","const fmt = (val, pad = 2) => String(val).padStart(pad, '0');\n\nexport const formatTime = (ms = 0) => {\n const totalSeconds = Math.floor(ms / 1000);\n\n const secondsInMinute = 60;\n const secondsInHour = secondsInMinute * 60;\n\n const hours = Math.floor(totalSeconds / secondsInHour);\n const minutes = Math.floor((totalSeconds % secondsInHour) / secondsInMinute);\n const seconds = totalSeconds % secondsInMinute;\n\n const timeParts = [...(hours ? [fmt(hours)] : []), fmt(minutes), fmt(seconds)];\n\n return timeParts.join(':');\n};\n","import {\n createStyleMixin,\n draggableMixin,\n componentNameValidationMixin,\n} from '@descope-ui/common/components-mixins';\nimport { createBaseClass } from '@descope-ui/common/base-classes';\nimport { compose } from '@descope-ui/common/utils';\nimport {\n getComponentName,\n injectStyle,\n} from '@descope-ui/common/components-helpers';\nimport clockIcon from './clock.svg';\nimport { IconClass } from '@descope-ui/descope-icon/class';\nimport { formatTime } from './helpers';\n\nexport const componentName = getComponentName('timer');\n\nconst observedAttributes = ['seconds', 'hide-icon', 'paused'];\n\nconst BaseClass = createBaseClass({\n componentName,\n baseSelector: ':host > .wrapper',\n});\n\nconst DEFAULT_INTERVAL = 1000;\n\nclass RawTimer extends BaseClass {\n #timeRemains = 0;\n\n #intervalId;\n\n static get observedAttributes() {\n return observedAttributes.concat(BaseClass.observedAttributes || []);\n }\n\n constructor() {\n super();\n\n this.attachShadow({ mode: 'open' }).innerHTML = `\n <div class=\"wrapper\">\n <descope-icon src=\"${clockIcon}\" class=\"icon\"></descope-icon>\n <div class=\"timer\"></div>\n </div>\n\t\t`;\n\n injectStyle(\n `\n :host {\n display: inline-flex;\n user-select: none;\n -webkit-user-select: none;\n }\n .wrapper {\n display: flex;\n align-items: center;\n flex-direction: row;\n width: 100%;\n }\n .hidden {\n display: none;\n }\n `,\n this,\n );\n\n this.icon = this.shadowRoot.querySelector('.icon');\n this.timer = this.shadowRoot.querySelector('.timer');\n }\n\n get seconds() {\n const val = this.getAttribute('seconds');\n const secs = parseInt(val || 0, 10) * 1000;\n return Math.max(0, secs);\n }\n\n // we use `pause` attribute for allowing preview mode by executing `pause`\n get isPaused() {\n return this.getAttribute('paused') === 'true';\n }\n\n init() {\n super.init?.();\n\n this.#timeRemains = this.seconds;\n }\n\n startInterval() {\n const intervalCycle = () => {\n this.#decreaseInterval();\n if (!this.#timeRemains) this.stop();\n this.#updateDisplay(this.#timeRemains);\n };\n\n if (this.#timeRemains) {\n this.#intervalId = setInterval(intervalCycle, DEFAULT_INTERVAL);\n } else {\n this.stop();\n }\n }\n\n stopInterval() {\n clearInterval(this.#intervalId);\n }\n\n #decreaseInterval() {\n this.#timeRemains = this.#timeRemains - DEFAULT_INTERVAL;\n }\n\n reset() {\n this.#timeRemains = this.seconds;\n this.#updateDisplay(this.#timeRemains);\n\n if (this.isPaused) return;\n\n this.dispatchEvent(new CustomEvent('timer-started', { bubbles: true }));\n this.startInterval();\n }\n\n stop() {\n this.stopInterval();\n this.#timeRemains = 0;\n this.#updateDisplay(this.#timeRemains);\n this.dispatchEvent(new CustomEvent('timer-ended', { bubbles: true }));\n }\n\n pause() {\n this.setAttribute('paused', 'true');\n this.stopInterval();\n }\n\n resume() {\n this.removeAttribute('paused');\n this.startInterval();\n }\n\n #updateDisplay(val) {\n this.timer.textContent = formatTime(val);\n }\n\n #toggleIcon(val) {\n this.icon.classList.toggle('hidden', val);\n }\n\n #handlePause(paused) {\n setTimeout(() => {\n if (paused) {\n this.pause();\n } else {\n // we want to prevent a another interval from starting in case previous interval was not yet cleared\n if (!this.#intervalId) {\n this.resume();\n }\n }\n });\n }\n\n attributeChangedCallback(attrName, oldValue, newValue) {\n super.attributeChangedCallback?.(attrName, oldValue, newValue);\n\n if (newValue !== oldValue) {\n if (attrName === 'seconds') {\n this.reset();\n }\n if (attrName === 'hide-icon') {\n this.#toggleIcon(newValue === 'true');\n }\n if (attrName === 'paused') {\n this.#handlePause(newValue === 'true');\n }\n }\n }\n}\n\nconst { host, icon, timer } = {\n host: { selector: () => ':host' },\n icon: { selector: () => '.icon' },\n timer: { selector: () => '.timer' },\n};\n\nexport const TimerClass = compose(\n createStyleMixin({\n mappings: {\n fontSize: {},\n iconSize: [\n { ...icon, property: 'width' },\n { ...icon, property: 'height' },\n ],\n fontFamily: {},\n minHeight: {},\n fontWeight: { ...timer },\n lineHeight: { ...timer },\n textColor: { ...timer, property: 'color' },\n gap: {},\n textAlign: { property: 'justify-content' },\n hostWidth: { ...host, property: 'width' },\n hostDirection: { ...host, property: 'direction' },\n iconColor: { ...icon, property: IconClass.cssVarList.fill },\n },\n }),\n draggableMixin,\n componentNameValidationMixin,\n)(RawTimer);\n","import { componentName, TimerClass } from './TimerClass';\nimport '@descope-ui/descope-icon';\n\ncustomElements.define(componentName, TimerClass);\n\nexport { TimerClass, componentName };\n","module.exports = \"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMWVtIiBoZWlnaHQ9IjFlbSIgdmlld0JveD0iMCAwIDEwNCAxMDQiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+IDxwYXRoIGQ9Ik01MC4zMzM0IDAuMzMzMjUyQzIyLjgzMzQgMC4zMzMyNTIgMC4zMzMzNzQgMjIuODMzMyAwLjMzMzM3NCA1MC4zMzMzQzAuMzMzMzc0IDc3LjgzMzMgMjIuODMzNCAxMDAuMzMzIDUwLjMzMzQgMTAwLjMzM0M3Ny44MzM0IDEwMC4zMzMgMTAwLjMzMyA3Ny44MzMzIDEwMC4zMzMgNTAuMzMzM0MxMDAuMzMzIDIyLjgzMzMgNzcuODMzNCAwLjMzMzI1MiA1MC4zMzM0IDAuMzMzMjUyWk01MC4zMzM0IDg3LjgzMzNDMjkuNzA4NCA4Ny44MzMzIDEyLjgzMzQgNzAuOTU4MyAxMi44MzM0IDUwLjMzMzNDMTIuODMzNCAyOS43MDgzIDI5LjcwODQgMTIuODMzMyA1MC4zMzM0IDEyLjgzMzNDNzAuOTU4NCAxMi44MzMzIDg3LjgzMzQgMjkuNzA4MyA4Ny44MzM0IDUwLjMzMzNDODcuODMzNCA3MC45NTgzIDcwLjk1ODQgODcuODMzMyA1MC4zMzM0IDg3LjgzMzNaIiBmaWxsPSIjMTgxQTFDIi8+IDxwYXRoIGQ9Ik01MC4zMzI4IDE5LjA4MzNINDQuMDgyOFY1Ni41ODMySDc1LjMzMjhWNTAuMzMzMkg1MC4zMzI4VjE5LjA4MzNaIiBmaWxsPSIjMTgxQTFDIi8+IDwvc3ZnPiA=\"","import '@descope-ui/descope-image';\n\nimport { componentName, IconClass } from './IconClass';\n\ncustomElements.define(componentName, IconClass);\n\nexport { IconClass, componentName };\n","import {\n componentNameValidationMixin,\n createProxy,\n createStyleMixin,\n draggableMixin,\n} from '@descope-ui/common/components-mixins';\nimport { getComponentName } from '@descope-ui/common/components-helpers';\nimport { compose } from '@descope-ui/common/utils';\n\nexport const componentName = getComponentName('icon');\n\nexport const IconClass = compose(\n createStyleMixin({\n mappings: {\n fill: {},\n },\n }),\n draggableMixin,\n componentNameValidationMixin,\n)(\n createProxy({\n slots: [],\n wrappedEleName: 'descope-image',\n style: () => `\n :host {\n display: inline-flex;\n }\n `,\n excludeAttrsSync: ['tabindex', 'class'],\n componentName,\n }),\n);\n"],"names":["createSvgEle","text","clean","sanitize","USE_PROFILES","svg","svgFilters","DOMParser","parseFromString","querySelector","componentName","srcAttrs","RawImage","baseSelector","observedAttributes","constructor","super","this","attachShadow","mode","innerHTML","init","toggleVisibility","src","onThemeChange","renderImage","isVisible","classList","remove","add","legacySrc","getAttribute","themeSrc","currentThemeName","updateFillColor","node","querySelectorAll","forEach","ele","setAttribute","ImageClass","cssVarList","fill","async","startsWith","isBase64Svg","svgXml","atob","slice","base64Prefix","path","match","getFileExtension","fetchedSrc","fetch","document","createElement","createImgEle","style","setProperty","createImage","then","res","appendChild","shouldRender","srcVal","attributeChangedCallback","attrName","oldValue","newValue","mappings","height","selector","width","customElements","define","fmt","val","pad","String","padStart","BaseClass","host","icon","timer","TimerClass","fontSize","iconSize","property","fontFamily","minHeight","fontWeight","lineHeight","textColor","gap","textAlign","hostWidth","hostDirection","iconColor","IconClass","concat","shadowRoot","seconds","secs","parseInt","Math","max","isPaused","startInterval","setInterval","stop","stopInterval","clearInterval","reset","dispatchEvent","CustomEvent","bubbles","pause","resume","removeAttribute","textContent","ms","totalSeconds","floor","hours","secondsInMinute","minutes","join","formatTime","toggle","paused","setTimeout","module","exports","slots","wrapped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,MAAK,EAAyB,SAAbqD,GAEF,WAAbF,GACFnD,MAAK,EAA0B,SAAbqD,GAGxB,I,SCvKFK,eAAeC,OAAOlE,EAAe4E,E,YCHrC+C,EAAOC,QAAU,o4B,8GCIjB3D,eAAeC,OAAO,IAAe,I,6FCK9B,MAAMlE,GAAgB,QAAiB,QAEjC0F,GAAY,SACvB,QAAiB,CACf7B,SAAU,CACR5B,KAAM,CAAC,KAGX,KACA,KAPuB,EASvB,QAAY,CACV4F,MAAO,GACPC,eAAgB,gBAChB7E,MAAO,IAAM,kEAKb8E,iBAAkB,CAAC,WAAY,SAC/B/H,kB","sources":["webpack://@descope/web-components-ui/../components/descope-image/src/component/helpers.js","webpack://@descope/web-components-ui/../components/descope-image/src/component/ImageClass.js","webpack://@descope/web-components-ui/../components/descope-image/src/component/index.js","webpack://@descope/web-components-ui/../components/descope-timer/src/component/helpers.js","webpack://@descope/web-components-ui/../components/descope-timer/src/component/TimerClass.js","webpack://@descope/web-components-ui/../components/descope-timer/src/component/index.js","webpack://@descope/web-components-ui/../components/descope-timer/src/component/clock.svg","webpack://@descope/web-components-ui/../components/descope-icon/src/component/index.js","webpack://@descope/web-components-ui/../components/descope-icon/src/component/IconClass.js"],"sourcesContent":["import DOMPurify from 'dompurify';\n\nconst getFileExtension = (path) => {\n const match = path.match(/\\.([0-9a-z]+)(?:[\\\\?#]|$)/i);\n return match ? match[1] : null;\n};\n\nconst base64Prefix = 'data:image/svg+xml;base64,';\n\nconst isBase64Svg = (src) => src.startsWith(base64Prefix);\n\nconst createImgEle = (src, altText) => {\n const ele = document.createElement('img');\n ele.setAttribute('src', src);\n ele.setAttribute('alt', altText);\n return ele;\n};\n\nconst createSvgEle = (text) => {\n // we want to purify the SVG to avoid XSS attacks\n const clean = DOMPurify.sanitize(text, {\n USE_PROFILES: { svg: true, svgFilters: true },\n });\n\n const parser = new DOMParser();\n const ele = parser\n .parseFromString(clean, 'image/svg+xml')\n .querySelector('svg');\n return ele;\n};\n\nexport const createImage = async (src, altText) => {\n try {\n let ele;\n if (isBase64Svg(src)) {\n // handle base64 source\n const svgXml = atob(src.slice(base64Prefix.length));\n ele = createSvgEle(svgXml);\n } else if (getFileExtension(src) === 'svg') {\n // handle urls\n const fetchedSrc = await fetch(src);\n const text = await fetchedSrc.text();\n ele = createSvgEle(text);\n } else {\n // handle binary\n ele = createImgEle(src, altText);\n }\n\n ele.style.setProperty('max-width', '100%');\n ele.style.setProperty('max-height', '100%');\n\n return ele;\n } catch {\n return null;\n }\n};\n","/* eslint-disable no-use-before-define */\nimport {\n createStyleMixin,\n draggableMixin,\n componentNameValidationMixin,\n} from '@descope-ui/common/components-mixins';\nimport { createBaseClass } from '@descope-ui/common/base-classes';\nimport { compose } from '@descope-ui/common/utils';\nimport { getComponentName } from '@descope-ui/common/components-helpers';\nimport { createImage } from './helpers';\nimport { injectStyle } from '@descope-ui/common/components-helpers';\n\nexport const componentName = getComponentName('image');\n\nconst srcAttrs = ['src', 'src-dark'];\n\nclass RawImage extends createBaseClass({\n componentName,\n baseSelector: 'slot',\n}) {\n static get observedAttributes() {\n return srcAttrs;\n }\n\n constructor() {\n super();\n\n this.attachShadow({ mode: 'open' }).innerHTML = `\n\t\t<slot></slot>\n\t`;\n\n injectStyle(\n `\n\t\t\t:host {\n\t\t\t\tdisplay: inline-flex;\n\t\t\t}\n :host > slot {\n width: 100%;\n height: 100%;\n\t\t\t\tbox-sizing: border-box;\n\t\t\t\tdisplay: flex;\n\t\t\t\toverflow: hidden;\n\t\t\t}\n\n ::slotted(*) {\n width: 100%;\n\t\t\t}\n\n .hidden {\n display: none;\n }\n `,\n this,\n );\n }\n\n init() {\n super.init?.();\n this.toggleVisibility(this.src);\n }\n\n onThemeChange() {\n this.renderImage();\n }\n\n toggleVisibility(isVisible) {\n if (isVisible) {\n this.classList.remove('hidden');\n } else {\n this.classList.add('hidden');\n }\n }\n\n get altText() {\n return this.getAttribute('alt') || '';\n }\n\n get legacySrc() {\n return this.getAttribute('src');\n }\n\n get themeSrc() {\n return this.getAttribute(`src-${this.currentThemeName}`);\n }\n\n get src() {\n return this.themeSrc || this.legacySrc;\n }\n\n // in order to fill an SVG with `currentColor` override all of its `fill` and `path` nodes\n // with the value from the `st-fill` attribute\n // eslint-disable-next-line class-methods-use-this\n updateFillColor(node) {\n // set fill to root node and all its relevant selectors\n const elementsToReplace = [node, ...node.querySelectorAll('*[fill]')];\n\n elementsToReplace.forEach((ele) => {\n ele.setAttribute(\n 'fill',\n `var(${ImageClass.cssVarList.fill}, ${ele.getAttribute('fill') || \"''\"})`,\n );\n });\n }\n\n renderImage() {\n this.toggleVisibility(this.src);\n\n createImage(this.src, this.altText).then((res) => {\n this.innerHTML = '';\n if (res) {\n this.updateFillColor(res);\n this.appendChild(res);\n }\n });\n }\n\n // render only when src attribute matches current theme\n shouldRender(src) {\n const srcVal = this.getAttribute(src);\n return this.src === srcVal;\n }\n\n attributeChangedCallback(attrName, oldValue, newValue) {\n super.attributeChangedCallback?.(attrName, oldValue, newValue);\n\n if (oldValue === newValue) return;\n\n if (this.shouldRender(attrName)) {\n this.renderImage();\n }\n }\n}\n\nexport const ImageClass = compose(\n createStyleMixin({\n mappings: {\n fill: {},\n height: { selector: () => ':host' },\n width: { selector: () => ':host' },\n },\n }),\n draggableMixin,\n componentNameValidationMixin,\n)(RawImage);\n","import { componentName, ImageClass } from './ImageClass';\n\ncustomElements.define(componentName, ImageClass);\n\nexport { ImageClass, componentName };\n","const fmt = (val, pad = 2) => String(val).padStart(pad, '0');\n\nexport const formatTime = (ms = 0) => {\n const totalSeconds = Math.floor(ms / 1000);\n\n const secondsInMinute = 60;\n const secondsInHour = secondsInMinute * 60;\n\n const hours = Math.floor(totalSeconds / secondsInHour);\n const minutes = Math.floor((totalSeconds % secondsInHour) / secondsInMinute);\n const seconds = totalSeconds % secondsInMinute;\n\n const timeParts = [...(hours ? [fmt(hours)] : []), fmt(minutes), fmt(seconds)];\n\n return timeParts.join(':');\n};\n","import {\n createStyleMixin,\n draggableMixin,\n componentNameValidationMixin,\n} from '@descope-ui/common/components-mixins';\nimport { createBaseClass } from '@descope-ui/common/base-classes';\nimport { compose } from '@descope-ui/common/utils';\nimport {\n getComponentName,\n injectStyle,\n} from '@descope-ui/common/components-helpers';\nimport clockIcon from './clock.svg';\nimport { IconClass } from '@descope-ui/descope-icon/class';\nimport { formatTime } from './helpers';\n\nexport const componentName = getComponentName('timer');\n\nconst observedAttributes = ['seconds', 'hide-icon', 'paused'];\n\nconst BaseClass = createBaseClass({\n componentName,\n baseSelector: ':host > .wrapper',\n});\n\nconst DEFAULT_INTERVAL = 1000;\n\nclass RawTimer extends BaseClass {\n #timeRemains = 0;\n\n #intervalId;\n\n static get observedAttributes() {\n return observedAttributes.concat(BaseClass.observedAttributes || []);\n }\n\n constructor() {\n super();\n\n this.attachShadow({ mode: 'open' }).innerHTML = `\n <div class=\"wrapper\">\n <descope-icon src=\"${clockIcon}\" class=\"icon\"></descope-icon>\n <div class=\"timer\"></div>\n </div>\n\t\t`;\n\n injectStyle(\n `\n :host {\n display: inline-flex;\n user-select: none;\n -webkit-user-select: none;\n }\n .wrapper {\n display: flex;\n align-items: center;\n flex-direction: row;\n width: 100%;\n }\n .hidden {\n display: none;\n }\n `,\n this,\n );\n\n this.icon = this.shadowRoot.querySelector('.icon');\n this.timer = this.shadowRoot.querySelector('.timer');\n }\n\n get seconds() {\n const val = this.getAttribute('seconds');\n const secs = parseInt(val || 0, 10) * 1000;\n return Math.max(0, secs);\n }\n\n // we use `pause` attribute for allowing preview mode by executing `pause`\n get isPaused() {\n return this.getAttribute('paused') === 'true';\n }\n\n init() {\n super.init?.();\n\n this.#timeRemains = this.seconds;\n }\n\n startInterval() {\n const intervalCycle = () => {\n this.#decreaseInterval();\n if (!this.#timeRemains) this.stop();\n this.#updateDisplay(this.#timeRemains);\n };\n\n if (this.#timeRemains) {\n this.#intervalId = setInterval(intervalCycle, DEFAULT_INTERVAL);\n } else {\n this.stop();\n }\n }\n\n stopInterval() {\n clearInterval(this.#intervalId);\n }\n\n #decreaseInterval() {\n this.#timeRemains = this.#timeRemains - DEFAULT_INTERVAL;\n }\n\n reset() {\n this.#timeRemains = this.seconds;\n this.#updateDisplay(this.#timeRemains);\n\n if (this.isPaused) return;\n\n this.dispatchEvent(new CustomEvent('timer-started', { bubbles: true }));\n this.startInterval();\n }\n\n stop() {\n this.stopInterval();\n this.#timeRemains = 0;\n this.#updateDisplay(this.#timeRemains);\n this.dispatchEvent(new CustomEvent('timer-ended', { bubbles: true }));\n }\n\n pause() {\n this.setAttribute('paused', 'true');\n this.stopInterval();\n }\n\n resume() {\n this.removeAttribute('paused');\n this.startInterval();\n }\n\n #updateDisplay(val) {\n this.timer.textContent = formatTime(val);\n }\n\n #toggleIcon(val) {\n this.icon.classList.toggle('hidden', val);\n }\n\n #handlePause(paused) {\n setTimeout(() => {\n if (paused) {\n this.pause();\n } else {\n // we want to prevent a another interval from starting in case previous interval was not yet cleared\n if (!this.#intervalId) {\n this.resume();\n }\n }\n });\n }\n\n attributeChangedCallback(attrName, oldValue, newValue) {\n super.attributeChangedCallback?.(attrName, oldValue, newValue);\n\n if (newValue !== oldValue) {\n if (attrName === 'seconds') {\n this.reset();\n }\n if (attrName === 'hide-icon') {\n this.#toggleIcon(newValue === 'true');\n }\n if (attrName === 'paused') {\n this.#handlePause(newValue === 'true');\n }\n }\n }\n}\n\nconst { host, icon, timer } = {\n host: { selector: () => ':host' },\n icon: { selector: () => '.icon' },\n timer: { selector: () => '.timer' },\n};\n\nexport const TimerClass = compose(\n createStyleMixin({\n mappings: {\n fontSize: {},\n iconSize: [\n { ...icon, property: 'width' },\n { ...icon, property: 'height' },\n ],\n fontFamily: {},\n minHeight: {},\n fontWeight: { ...timer },\n lineHeight: { ...timer },\n textColor: { ...timer, property: 'color' },\n gap: {},\n textAlign: { property: 'justify-content' },\n hostWidth: { ...host, property: 'width' },\n hostDirection: { ...host, property: 'direction' },\n iconColor: { ...icon, property: IconClass.cssVarList.fill },\n },\n }),\n draggableMixin,\n componentNameValidationMixin,\n)(RawTimer);\n","import { componentName, TimerClass } from './TimerClass';\nimport '@descope-ui/descope-icon';\n\ncustomElements.define(componentName, TimerClass);\n\nexport { TimerClass, componentName };\n","module.exports = \"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMWVtIiBoZWlnaHQ9IjFlbSIgdmlld0JveD0iMCAwIDEwNCAxMDQiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+IDxwYXRoIGQ9Ik01MC4zMzM0IDAuMzMzMjUyQzIyLjgzMzQgMC4zMzMyNTIgMC4zMzMzNzQgMjIuODMzMyAwLjMzMzM3NCA1MC4zMzMzQzAuMzMzMzc0IDc3LjgzMzMgMjIuODMzNCAxMDAuMzMzIDUwLjMzMzQgMTAwLjMzM0M3Ny44MzM0IDEwMC4zMzMgMTAwLjMzMyA3Ny44MzMzIDEwMC4zMzMgNTAuMzMzM0MxMDAuMzMzIDIyLjgzMzMgNzcuODMzNCAwLjMzMzI1MiA1MC4zMzM0IDAuMzMzMjUyWk01MC4zMzM0IDg3LjgzMzNDMjkuNzA4NCA4Ny44MzMzIDEyLjgzMzQgNzAuOTU4MyAxMi44MzM0IDUwLjMzMzNDMTIuODMzNCAyOS43MDgzIDI5LjcwODQgMTIuODMzMyA1MC4zMzM0IDEyLjgzMzNDNzAuOTU4NCAxMi44MzMzIDg3LjgzMzQgMjkuNzA4MyA4Ny44MzM0IDUwLjMzMzNDODcuODMzNCA3MC45NTgzIDcwLjk1ODQgODcuODMzMyA1MC4zMzM0IDg3LjgzMzNaIiBmaWxsPSIjMTgxQTFDIi8+IDxwYXRoIGQ9Ik01MC4zMzI4IDE5LjA4MzNINDQuMDgyOFY1Ni41ODMySDc1LjMzMjhWNTAuMzMzMkg1MC4zMzI4VjE5LjA4MzNaIiBmaWxsPSIjMTgxQTFDIi8+IDwvc3ZnPiA=\"","import '@descope-ui/descope-image';\n\nimport { componentName, IconClass } from './IconClass';\n\ncustomElements.define(componentName, IconClass);\n\nexport { IconClass, componentName };\n","import {\n componentNameValidationMixin,\n createProxy,\n createStyleMixin,\n draggableMixin,\n} from '@descope-ui/common/components-mixins';\nimport { getComponentName } from '@descope-ui/common/components-helpers';\nimport { compose } from '@descope-ui/common/utils';\n\nexport const componentName = getComponentName('icon');\n\nexport const IconClass = compose(\n createStyleMixin({\n mappings: {\n fill: {},\n },\n }),\n draggableMixin,\n componentNameValidationMixin,\n)(\n createProxy({\n slots: [],\n wrappedEleName: 'descope-image',\n style: () => `\n :host {\n display: inline-flex;\n }\n `,\n excludeAttrsSync: ['tabindex', 'class'],\n componentName,\n }),\n);\n"],"names":["createSvgEle","text","clean","sanitize","USE_PROFILES","svg","svgFilters","DOMParser","parseFromString","querySelector","componentName","srcAttrs","RawImage","baseSelector","observedAttributes","constructor","super","this","attachShadow","mode","innerHTML","init","toggleVisibility","src","onThemeChange","renderImage","isVisible","classList","remove","add","altText","getAttribute","legacySrc","themeSrc","currentThemeName","updateFillColor","node","querySelectorAll","forEach","ele","setAttribute","ImageClass","cssVarList","fill","async","startsWith","isBase64Svg","svgXml","atob","slice","base64Prefix","path","match","getFileExtension","fetchedSrc","fetch","document","createElement","createImgEle","style","setProperty","createImage","then","res","appendChild","shouldRender","srcVal","attributeChangedCallback","attrName","oldValue","newValue","mappings","height","selector","width","customElements","define","fmt","val","pad","String","padStart","BaseClass","host","icon","timer","TimerClass","fontSize","iconSize","property","fontFamily","minHeight","fontWeight","lineHeight","textColor","gap","textAlign","hostWidth","hostDirection","iconColor","IconClass","concat","shadowRoot","seconds","secs","parseInt","Math","max","isPaused","startInterval","setInterval","stop","stopInterval","clearInterval","reset","dispatchEvent","CustomEvent","bubbles","pause","resume","removeAttribute","textContent","ms","totalSeconds","floor","hours","secondsInMinute","minutes","join","formatTime","toggle","paused","setTimeout","module","exports","slots","wrappedEleName","excludeAttrsSync"],"sourceRoot":""}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@descope/web-components-ui",
3
- "version": "1.87.0",
3
+ "version": "1.89.0",
4
4
  "description": "",
5
5
  "main": "dist/cjs/index.cjs.js",
6
6
  "module": "dist/index.esm.js",
@@ -76,19 +76,19 @@
76
76
  "lodash.debounce": "4.0.8",
77
77
  "lodash.merge": "4.6.2",
78
78
  "markdown-it": "14.1.0",
79
- "@descope-ui/common": "0.0.12",
80
- "@descope-ui/descope-button": "0.0.8",
81
- "@descope-ui/descope-image": "0.0.1",
82
- "@descope-ui/descope-icon": "0.0.7",
83
- "@descope-ui/descope-text": "0.0.12",
84
- "@descope-ui/descope-avatar": "0.0.12",
85
- "@descope-ui/descope-combo-box": "0.1.1",
86
- "@descope-ui/descope-autocomplete-field": "0.0.14",
87
- "@descope-ui/descope-address-field": "0.0.13",
88
- "@descope-ui/descope-timer": "0.0.6",
89
- "@descope-ui/descope-timer-button": "0.0.8",
90
- "@descope-ui/descope-password-strength": "0.0.5",
91
- "@descope-ui/descope-collapsible-container": "0.0.7"
79
+ "@descope-ui/common": "0.0.13",
80
+ "@descope-ui/descope-button": "0.0.10",
81
+ "@descope-ui/descope-image": "0.0.3",
82
+ "@descope-ui/descope-icon": "0.0.9",
83
+ "@descope-ui/descope-text": "0.0.13",
84
+ "@descope-ui/descope-avatar": "0.0.13",
85
+ "@descope-ui/descope-combo-box": "0.1.2",
86
+ "@descope-ui/descope-autocomplete-field": "0.0.15",
87
+ "@descope-ui/descope-address-field": "0.0.14",
88
+ "@descope-ui/descope-timer": "0.0.8",
89
+ "@descope-ui/descope-timer-button": "0.0.10",
90
+ "@descope-ui/descope-password-strength": "0.0.6",
91
+ "@descope-ui/descope-collapsible-container": "0.0.9"
92
92
  },
93
93
  "overrides": {
94
94
  "@vaadin/avatar": "24.3.4",
@@ -2,12 +2,23 @@
2
2
  // For examele, we have a DayCounter, MonthCounter and YearCounter, which can each separately navigate
3
3
  // between different ranges.
4
4
  export class DateCounter {
5
- constructor({ id, min, max, placeholder }) {
5
+ #data = Object.freeze([]);
6
+
7
+ constructor({ id, min, max, placeholder }, onChange) {
6
8
  this.id = id;
7
- this.data = [];
8
9
  this.min = min;
9
10
  this.max = max;
10
11
  this.placeholder = placeholder;
12
+ this.onChange = onChange;
13
+ }
14
+
15
+ get data() {
16
+ return this.#data;
17
+ }
18
+
19
+ set data(val) {
20
+ this.#data = Object.freeze(val);
21
+ this.onChange?.();
11
22
  }
12
23
 
13
24
  get #initialNumValue() {
@@ -39,23 +50,27 @@ export class DateCounter {
39
50
  }
40
51
 
41
52
  add(num) {
42
- this.data.push(num);
53
+ // use local var to avoid triggering onChange
54
+ let data = this.data;
55
+
56
+ data = [...data, num];
43
57
 
44
58
  if (this.numberValue > this.max) {
45
- this.data.length = 0;
46
- this.data.push(num);
47
- } else if (this.length < this.data.length) {
48
- this.data.shift();
59
+ data = [num];
60
+ } else if (this.length < data.length) {
61
+ data = data.slice(1, data.length);
49
62
  }
50
63
 
64
+ this.data = data;
65
+
51
66
  return num;
52
67
  }
53
68
 
54
69
  del() {
55
70
  if (!this.data.filter((d) => d !== '0').filter(Boolean).length) {
56
- this.data.length = 0;
71
+ this.data = [];
57
72
  } else {
58
- this.data.pop();
73
+ this.data = this.data.slice(0, this.data.length - 1);
59
74
  }
60
75
  }
61
76
 
@@ -64,11 +79,19 @@ export class DateCounter {
64
79
  }
65
80
 
66
81
  inc(gap) {
67
- this.replaceValue(this.#initialNumValue + (gap || 1));
82
+ this.replaceValue(
83
+ this.#initialNumValue < this.max
84
+ ? Math.max(this.#initialNumValue + (gap || 1), this.min)
85
+ : this.min
86
+ );
68
87
  }
69
88
 
70
89
  dec(gap) {
71
- this.replaceValue(this.#initialNumValue - (gap || 1));
90
+ this.replaceValue(
91
+ this.#initialNumValue > this.min
92
+ ? Math.min(this.#initialNumValue - (gap || 1), this.max)
93
+ : this.max
94
+ );
72
95
  }
73
96
 
74
97
  isInRange(val) {
@@ -80,4 +103,12 @@ export class DateCounter {
80
103
  this.data = val.toString().padStart(this.length, 0).split('');
81
104
  }
82
105
  }
106
+
107
+ setMin(val) {
108
+ this.min = Number(val);
109
+ }
110
+
111
+ setMax(val) {
112
+ this.max = Number(val);
113
+ }
83
114
  }