@descope/web-components-ui 1.0.75 → 1.0.77

Sign up to get free protection for your applications and to get access to all the features.
package/dist/umd/447.js CHANGED
@@ -1 +1 @@
1
- "use strict";(self.webpackChunkDescopeUI=self.webpackChunkDescopeUI||[]).push([[447],{4447:(e,t,o)=>{o.d(t,{Z:()=>l});const r={label:"::part(label)",input:"::part(input-field)",readOnlyInput:"[readonly]::part(input-field)::after",placeholder:"> input:placeholder-shown",host:()=>":host"},l={backgroundColor:{selector:r.input},color:{selector:r.input},width:{selector:r.host},borderColor:[{selector:r.input},{selector:r.readOnlyInput}],borderWidth:[{selector:r.input},{selector:r.readOnlyInput}],borderStyle:[{selector:r.input},{selector:r.readOnlyInput}],borderRadius:{selector:r.input},boxShadow:{selector:r.input},fontSize:[{},{selector:r.host}],height:{selector:r.input},padding:{selector:r.input},outline:{selector:r.input},outlineOffset:{selector:r.input},placeholderColor:{selector:r.placeholder,property:"color"}}}}]);
1
+ "use strict";(self.webpackChunkDescopeUI=self.webpackChunkDescopeUI||[]).push([[447],{4447:(e,r,t)=>{t.d(r,{Z:()=>o});const p={label:"::part(label)",inputWrapper:"::part(input-field)",readOnlyInput:"[readonly]::part(input-field)::after",placeholder:"> input:placeholder-shown",host:()=>":host",input:"input"},o={backgroundColor:{selector:p.inputWrapper},color:{selector:p.inputWrapper},width:{selector:p.host},borderColor:[{selector:p.inputWrapper},{selector:p.readOnlyInput}],borderWidth:[{selector:p.inputWrapper},{selector:p.readOnlyInput}],borderStyle:[{selector:p.inputWrapper},{selector:p.readOnlyInput}],borderRadius:{selector:p.inputWrapper},boxShadow:{selector:p.inputWrapper},fontSize:[{},{selector:p.host}],height:{selector:p.inputWrapper},padding:{selector:p.inputWrapper},margin:{selector:p.inputWrapper},caretColor:{selector:p.input},outlineColor:{selector:p.inputWrapper},outlineStyle:{selector:p.inputWrapper},outlineWidth:{selector:p.inputWrapper},outlineOffset:{selector:p.inputWrapper},textAlign:{selector:p.input},placeholderColor:{selector:p.placeholder,property:"color"}}}}]);
package/dist/umd/744.js CHANGED
@@ -1 +1 @@
1
- "use strict";(self.webpackChunkDescopeUI=self.webpackChunkDescopeUI||[]).push([[744],{3346:(t,e,s)=>{s.d(e,{s:()=>n});var i=s(2061),r=s(9629);const n=({componentName:t,baseSelector:e=""})=>{class s extends HTMLElement{static get componentName(){return t}#t;#e=!0;get baseSelector(){return e}get baseElement(){return this.#t??=this.baseSelector?this.rootElement.querySelector(this.baseSelector):this,this.#t||console.warn("missing base element for component",this.localName),this.#t}get rootElement(){return this.shadowRoot||this}connectedCallback(){super.connectedCallback?.(),this.rootElement.isConnected&&this.#e&&(this.#e=!1,this.init?.())}}return(0,i.qC)(r.Ae,r._A,r.QT)(s)}},5279:(t,e,s)=>{s.d(e,{gh:()=>i,k4:()=>r,qM:()=>a,qg:()=>n});const i="descope",r=3,n="host",a="@"},4567:(t,e,s)=>{s.d(e,{Db:()=>d,FX:()=>n,P$:()=>a,Tk:()=>u,iY:()=>h,oP:()=>c,tg:()=>l});var i=s(2061),r=s(5279);const n=(t,e,{excludeAttrs:s=[],includeAttrs:i=[]})=>{const r=Array.from(t.attributes).filter((t=>!s.includes(t.name)&&(!i.length||i.includes(t.name)))).map((t=>t.name));e(r),new MutationObserver((t=>{for(const r of t)"attributes"!==r.type||s.includes(r.attributeName)||i.length&&!i.includes(r.attributeName)||e([r.attributeName])})).observe(t,{attributes:!0})},a=(t,e)=>{e({addedNodes:Array.from(t.children),removedNodes:[]}),new MutationObserver((t=>{for(const s of t)"childList"===s.type&&e(s)})).observe(t,{childList:!0})},o=(t,e,s={})=>i=>{i.forEach((i=>{const r=s[i]||i,n=t.getAttribute(i);null!==n?e.getAttribute(r)!==n&&e.setAttribute(r,n):e.removeAttribute(r)}))},l=(t,e,s)=>{n(t,o(t,e),s),n(e,o(e,t),s)},h=t=>(0,i.E3)(r.gh,t),u=(...t)=>`--${(0,i.E3)(...t)}`,c=(t,e,s={})=>{n(t,o(t,e,s.mapAttrs),s)},d=(t,e,s=[])=>{if(!s.length)return;const i=s.reduce(((t,s)=>Object.assign(t,{[s]:{get:()=>e[s],set(t){e[s]=t}}})),{});Object.defineProperties(t,i)}},2061:(t,e,s)=>{s.d(e,{E3:()=>r,GL:()=>i,mf:()=>a,qC:()=>n});const i=t=>t.replace(/([a-z])([A-Z])/g,"$1-$2").replace(/[\s_.]+/g,"-").toLowerCase(),r=(...t)=>i(t.filter((t=>!!t)).join("-")),n=(...t)=>e=>t.reduceRight(((t,e)=>e(t)),e),a=t=>"function"==typeof t},7878:(t,e,s)=>{function i(t,e={}){const s=new Event(t,e);this[`on${t}`]?.(s),this.dispatchEvent(s)}s.d(e,{C:()=>i})},9629:(t,e,s)=>{s.d(e,{li:()=>T,Ae:()=>A,DM:()=>p,yk:()=>u,e4:()=>c,pY:()=>M,_A:()=>S,wX:()=>b,QT:()=>L,Iw:()=>C,dj:()=>f,P4:()=>V});var i=s(5279),r=s(2061),n=s(4567),a=s(5561);const o=(t,...e)=>`var(${t}${e.length?` , ${o(...e)}`:""})`;class l{constructor(){this.styleMap=new Map}add(t,e,s){this.styleMap.has(t)||this.styleMap.set(t,[]),this.styleMap.set(t,[...this.styleMap.get(t),{property:e,value:s}])}toString(){return Array.from(this.styleMap.entries()).reduce(((t,[e,s])=>t+`${e} { \n${s.map((({property:t,value:e})=>`${t}: ${e}`)).join(";\n")} \n}\n\n`),"")}}const h=(t,e)=>Object.keys(e).reduce(((e,s)=>Object.assign(e,{[s]:(0,n.Tk)(t,s)})),{}),u=({mappings:t={}})=>e=>class extends e{static get cssVarList(){return{...e.cssVarList,...h(e.componentName,{...t})}}#s;#i;#r;#n;#a;#o;#l;#h;constructor({getRootElement:e,componentNameSuffix:s="",themeSection:n=i.qg,baseSelector:a}={}){super(),this.#n=s,this.#a=n,this.#o=e?.(this)||this.shadowRoot,this.#l=a??this.baseSelector,this.#h=Object.keys(t).map((t=>(0,r.E3)("st",s,t)))}get componentTheme(){return a.componentsThemeManager.currentTheme?.[e.componentName]||""}#u(){this.#i.innerHTML=this.componentTheme[this.#a]}#c(){this.#i=document.createElement("style"),this.#i.id="style-mixin-theme",this.#o.prepend(this.#i),this.#r=a.componentsThemeManager.onCurrentThemeChange(this.#u.bind(this)),this.#u()}#d(){this.#s=document.createElement("style"),this.#s.id="style-mixin-overrides";const t=(s=e.componentName,r=i.k4,Array(r).fill(`.${s}`).join(""));var s,r;this.#s.innerText=`:host(${t}) {}`,this.#o.append(this.#s)}#m(t,s){const i=this.#s?.sheet?.cssRules[0].style;if(!i)return;const r=(0,n.Tk)(e.componentName,t.replace(new RegExp("^st-"),""));s?i?.setProperty(r,s):i?.removeProperty(r)}#p(t=[]){for(const e of t)this.#h.includes(e)&&this.#m(e,this.getAttribute(e));this.#s.innerHTML=this.#s?.sheet?.cssRules[0].cssText}#g(){const s=document.createElement("style");s.id="style-mixin-mappings",s.innerHTML=((t,e,s)=>{const i=new l;return Object.keys(s).forEach((a=>{const l=((t,e)=>{const s={selector:"",property:(0,r.GL)(t)};return e&&Object.keys(e).length?Array.isArray(e)?e.map((t=>Object.assign({},s,t))):[Object.assign({},s,e)]:[s]})(a,s[a]),h=(0,n.Tk)(t,a);l.forEach((({selector:t,property:s})=>{i.add(((t="",e="")=>(0,r.mf)(e)?e(t):`${t}${/^[A-Za-z]/.test(e)?` ${e}`:e}`)(e,t),(0,r.mf)(s)?s():s,o(h))}))})),i.toString()})((0,r.E3)(e.componentName,this.#n),this.#l,t),this.#o.prepend(s)}#b(t){(this.#o.classList||this.#o.host.classList).add(t)}init(){super.init?.(),this.shadowRoot.isConnected&&(this.#b(e.componentName),this.#g(),this.#c(),this.#d(),(0,n.FX)(this,this.#p.bind(this),{}))}disconnectedCallback(){super.disconnectedCallback?.(),this.#r?.()}},c=t=>class extends t{#E=null;static get observedAttributes(){return[...t.observedAttributes||[],"draggable"]}constructor(){super(),this.#E=document.createElement("style"),this.#E.innerText="* { cursor: inherit!important }"}#y(t){t?this.shadowRoot.appendChild(this.#E):this.#E.remove()}attributeChangedCallback(t,e,s){super.attributeChangedCallback?.(t,e,s),"draggable"===t&&this.#y("true"===s)}};var d=s(3346),m=s(7878);const p=({componentName:t,wrappedEleName:e,slots:s=[],style:i,excludeAttrsSync:a=[],includeAttrsSync:o=[],includeForwardProps:l=[]})=>{class h extends((0,d.s)({componentName:t,baseSelector:e})){#v=m.C.bind(this,"blur");#f=m.C.bind(this,"focus");constructor(){super().attachShadow({mode:"open"}).innerHTML=`\n\t\t\t<style id="create-proxy">${(0,r.mf)(i)?i():i}</style>\n\t\t\t<${e}>\n\t\t\t<slot></slot>\n\t\t\t${s.map((t=>`<slot name="${t}" slot="${t}"></slot>`)).join("")}\n\t\t\t</${e}>\n\t\t`}focus=()=>this.baseElement.focus();init(){super.init?.(),this.baseElement.addEventListener("blur",(t=>{this.#v()})),this.baseElement.addEventListener("focus",(t=>{this.#f()})),this.addEventListener("focus",(t=>{t.isTrusted&&this.focus()})),(0,n.Db)(this,this.baseElement,l),this.baseElement.onkeydown=t=>{t.shiftKey&&9===t.keyCode&&this.getRootNode()===document&&(this.removeAttribute("tabindex"),setTimeout((()=>this.setAttribute("tabindex","0")),0))},(0,n.tg)(this.baseElement,this,{excludeAttrs:a,includeAttrs:o})}}return h},g=["required","pattern"],b=t=>class extends t{static get observedAttributes(){return[...t.observedAttributes||[],...g]}static get formAssociated(){return!0}#A;constructor(){super(),this.#A=this.attachInternals()}get defaultErrorMsgValueMissing(){return"Please fill out this field."}get defaultErrorMsgPatternMismatch(){return"Please match the requested format."}get defaultErrorMsgTooShort(){return`Minimum length is ${this.getAttribute("minlength")}.`}get defaultErrorMsgTooLong(){return`Maximum length is ${this.getAttribute("maxlength")}. `}getErrorMessage(t){switch(!0){case t.valueMissing:return this.getAttribute("data-errormessage-value-missing")||this.defaultErrorMsgValueMissing;case t.patternMismatch||t.typeMismatch:return this.getAttribute("data-errormessage-pattern-mismatch")||this.defaultErrorMsgPatternMismatch;case t.tooShort:return this.getAttribute("data-errormessage-pattern-mismatch-too-short")||this.defaultErrorMsgTooShort;case t.tooLong:return this.getAttribute("data-errormessage-pattern-mismatch-too-long")||this.defaultErrorMsgTooLong;case t.customError:return this.validationMessage;default:return""}}#S(){const t=this.getValidity();this.#A.setValidity(t,this.getErrorMessage(t))}get validationMessage(){return this.#A.validationMessage}getValidity(){console.warn("getValidity","is not implemented")}checkValidity(){return this.#A.validity.valid}reportValidity(){return this.#A.reportValidity()}get validity(){return this.#A.validity}setCustomValidity(t){t?this.#A.setValidity({customError:!0},t):(this.#A.setValidity({}),this.#S())}get isRequired(){return this.hasAttribute("required")&&"false"!==this.getAttribute("required")}get pattern(){return this.getAttribute("pattern")}get form(){return this.#A.form}attributeChangedCallback(t,e,s){super.attributeChangedCallback?.(t,e,s),g.includes(t)&&this.#S()}init(){super.init?.(),this.addEventListener("change",this.#S),this.addEventListener("invalid",(t=>t.stopPropagation())),this.addEventListener("input",this.#S),setTimeout((()=>this.#S()))}},E=["invalid","has-error-message"],y=(t,e,s)=>{Object.defineProperty(t,s,{set:function(t){return e[s]=t},get:function(){return e[s]},configurable:!0})},v=t=>{if(!t)return;let e=t;for(let t=0;t<10;t++)if(e=e.assignedElements()[0],"slot"!==e.localName)return e},f=t=>class extends(b(t)){static get observedAttributes(){return[...t.observedAttributes||[],...E]}#M;#C=m.C.bind(this,"change");constructor(){super(),this.#M=super.inputElement}get inputElement(){const t=this.baseElement.shadowRoot.querySelector('slot[name="input"]'),e=this.baseElement.shadowRoot.querySelector('slot[name="textarea"]');if(this.#M??=v(t)||v(e),!this.#M)throw Error("no input was found");return this.#M}set inputElement(t){this.#M=t}getValidity(){return this.inputElement.validity}reportValidityOnInternalInput(){setTimeout((()=>{this.inputElement.reportValidity()}))}reportValidity(){isValid||(this.setAttribute("invalid","true"),this.reportValidityOnInternalInput())}handleInternalInputErrorMessage(){this.inputElement.checkValidity()||this.inputElement.setCustomValidity(this.validationMessage)}#T(){this.handleInternalInputErrorMessage(),this.setAttribute("error-message",this.validationMessage)}init(){super.init?.(),this.inputElement.addEventListener("input",(t=>{this.inputElement.checkValidity()||(this.inputElement.setCustomValidity(""),this.setCustomValidity(""),this.baseElement.__onInput(t),this.#T())})),this.baseElement.addEventListener("change",(()=>{this.#C()})),this.addEventListener("blur",(()=>{this.checkValidity()||(this.setAttribute("invalid","true"),this.#T())})),this.addEventListener("focus",(t=>{t.relatedTarget?.form===this.form&&(this.checkValidity()||this.setAttribute("invalid","true"),this.hasAttribute("invalid")&&this.reportValidityOnInternalInput())})),this.addEventListener("invalid",this.#T),this.handleInternalInputErrorMessage(),this.hasAttribute("tabindex")||this.getRootNode()!==document||this.setAttribute("tabindex",0),y(this,this.inputElement,"value"),y(this,this.inputElement,"selectionStart"),this.setSelectionRange=this.inputElement.setSelectionRange?.bind(this.inputElement)}},A=t=>class extends t{#L(){const e=this.localName;if(!t.componentName)throw Error('component name is not defined on super class, make sure you have a static get for "componentName"');if(e!==t.componentName)throw Error(`component name mismatch, expected "${t.componentName}", current "${e}"`)}init(){super.init?.(),this.#L()}},S=t=>class extends t{init(){super.init?.(),this.baseElement.addEventListener("mouseover",(t=>{this.setAttribute("hover","true"),t.target.addEventListener("mouseleave",(()=>this.removeAttribute("hover")),{once:!0})}))}},M=t=>class extends t{init(){super.init?.(),this.addEventListener("blur",(t=>{t.isTrusted&&t.stopImmediatePropagation()})),this.addEventListener("focus",(t=>{t.isTrusted&&t.stopImmediatePropagation()})),this.addEventListener("focusout",(t=>{t.isTrusted&&t.stopImmediatePropagation()})),this.addEventListener("focusin",(t=>{t.isTrusted&&t.stopImmediatePropagation()}))}},C=({name:t,selector:e,mappings:s={},forward:{attributes:a=[],include:o=!0}={}})=>l=>{const c=t||(t=>t.replace(/[^\w\s]/gi,""))(e),d=u({mappings:s})(l);return class extends d{static get cssVarList(){return{...d.cssVarList,[c]:h((0,r.E3)(l.componentName,"_"+c),s)}}#V;constructor(){const t=t=>{const s=t.shadowRoot.querySelector(t.baseSelector),i=e?s.shadowRoot.querySelector(e):s;return i.shadowRoot||i};var s;super({getRootElement:t,componentNameSuffix:"_"+c,themeSection:i.qM+c,baseSelector:":host"}),this.#V=(s=t(this)).host||s}#x(){this.#V.onmouseenter=t=>{t.target.setAttribute("hover","true")},this.#V.onmouseleave=t=>{t.target.removeAttribute("hover")}}init(){super.init?.(),(0,n.oP)(this,this.#V,{[o?"includeAttrs":"excludeAttrs"]:a}),this.#x()}}},T=t=>class extends t{#C=m.C.bind(this,"change");init(){super.init?.(),this.prevValue=this.value,this.addEventListener("change",(t=>{t.stopPropagation()})),this.addEventListener("blur",(()=>{this.value!==this.prevValue&&(this.#C(),this.prevValue=this.value)}))}},L=t=>class extends t{attributeChangedCallback(t,e,s){""===s&&(this.setAttribute(t,"true"),s="true"),super.attributeChangedCallback?.(t,e,s)}},V=t=>class extends t{get isReadOnly(){return this.hasAttribute("readonly")&&"false"!==this.getAttribute("readonly")}init(){["focus","blur"].forEach((t=>{this.addEventListener(t,(t=>{this.isReadOnly&&(t.stopImmediatePropagation(),t.preventDefault())}),!0)})),super.init?.()}}}}]);
1
+ "use strict";(self.webpackChunkDescopeUI=self.webpackChunkDescopeUI||[]).push([[744],{3346:(t,e,s)=>{s.d(e,{s:()=>n});var i=s(2061),r=s(9629);const n=({componentName:t,baseSelector:e=""})=>{class s extends HTMLElement{static get componentName(){return t}#t;#e=!0;get baseSelector(){return e}get baseElement(){return this.#t??=this.baseSelector?this.rootElement.querySelector(this.baseSelector):this,this.#t||console.warn("missing base element for component",this.localName),this.#t}get rootElement(){return this.shadowRoot||this}connectedCallback(){super.connectedCallback?.(),this.rootElement.isConnected&&this.#e&&(this.#e=!1,this.init?.())}}return(0,i.qC)(r.Ae,r._A,r.QT)(s)}},5279:(t,e,s)=>{s.d(e,{gh:()=>i,k4:()=>r,qM:()=>a,qg:()=>n});const i="descope",r=3,n="host",a="@"},4567:(t,e,s)=>{s.d(e,{Db:()=>d,FX:()=>n,P$:()=>a,Tk:()=>u,iY:()=>h,oP:()=>c,tg:()=>l});var i=s(2061),r=s(5279);const n=(t,e,{excludeAttrs:s=[],includeAttrs:i=[]})=>{const r=Array.from(t.attributes).filter((t=>!s.includes(t.name)&&(!i.length||i.includes(t.name)))).map((t=>t.name));e(r),new MutationObserver((t=>{for(const r of t)"attributes"!==r.type||s.includes(r.attributeName)||i.length&&!i.includes(r.attributeName)||e([r.attributeName])})).observe(t,{attributes:!0})},a=(t,e)=>{e({addedNodes:Array.from(t.children),removedNodes:[]}),new MutationObserver((t=>{for(const s of t)"childList"===s.type&&e(s)})).observe(t,{childList:!0})},o=(t,e,s={})=>i=>{i.forEach((i=>{const r=s[i]||i,n=t.getAttribute(i);null!==n?e.getAttribute(r)!==n&&e.setAttribute(r,n):e.removeAttribute(r)}))},l=(t,e,s)=>{n(t,o(t,e),s),n(e,o(e,t),s)},h=t=>(0,i.E3)(r.gh,t),u=(...t)=>`--${(0,i.E3)(...t)}`,c=(t,e,s={})=>{n(t,o(t,e,s.mapAttrs),s)},d=(t,e,s=[])=>{if(!s.length)return;const i=s.reduce(((t,s)=>Object.assign(t,{[s]:{get:()=>e[s],set(t){e[s]=t}}})),{});Object.defineProperties(t,i)}},2061:(t,e,s)=>{s.d(e,{E3:()=>r,GL:()=>i,mf:()=>a,qC:()=>n});const i=t=>t.replace(/([a-z])([A-Z])/g,"$1-$2").replace(/[\s_.]+/g,"-").toLowerCase(),r=(...t)=>i(t.filter((t=>!!t)).join("-")),n=(...t)=>e=>t.reduceRight(((t,e)=>e(t)),e),a=t=>"function"==typeof t},7878:(t,e,s)=>{function i(t,e={}){const s=new Event(t,e);this[`on${t}`]?.(s),this.dispatchEvent(s)}s.d(e,{C:()=>i})},9629:(t,e,s)=>{s.d(e,{li:()=>T,Ae:()=>A,DM:()=>p,yk:()=>u,e4:()=>c,pY:()=>M,_A:()=>S,wX:()=>b,QT:()=>L,Iw:()=>C,dj:()=>f,P4:()=>V});var i=s(5279),r=s(2061),n=s(4567),a=s(5561);const o=(t,...e)=>`var(${t}${e.length?` , ${o(...e)}`:""})`;class l{constructor(){this.styleMap=new Map}add(t,e,s){this.styleMap.has(t)||this.styleMap.set(t,[]),this.styleMap.set(t,[...this.styleMap.get(t),{property:e,value:s}])}toString(){return Array.from(this.styleMap.entries()).reduce(((t,[e,s])=>t+`${e} { \n${s.map((({property:t,value:e})=>`${t}: ${e}`)).join(";\n")} \n}\n\n`),"")}}const h=(t,e)=>Object.keys(e).reduce(((e,s)=>Object.assign(e,{[s]:(0,n.Tk)(t,s)})),{}),u=({mappings:t={}})=>e=>class extends e{static get cssVarList(){return{...e.cssVarList,...h(e.componentName,{...t})}}#s;#i;#r;#n;#a;#o;#l;#h;constructor({getRootElement:e,componentNameSuffix:s="",themeSection:n=i.qg,baseSelector:a}={}){super(),this.#n=s,this.#a=n,this.#o=e?.(this)||this.shadowRoot,this.#l=a??this.baseSelector,this.#h=Object.keys(t).map((t=>(0,r.E3)("st",s,t)))}get componentTheme(){return a.componentsThemeManager.currentTheme?.[e.componentName]||""}#u(){this.#i.innerHTML=this.componentTheme[this.#a]}#c(){this.#i=document.createElement("style"),this.#i.id="style-mixin-theme",this.#o.prepend(this.#i),this.#r=a.componentsThemeManager.onCurrentThemeChange(this.#u.bind(this)),this.#u()}#d(){this.#s=document.createElement("style"),this.#s.id="style-mixin-overrides";const t=(s=e.componentName,r=i.k4,Array(r).fill(`.${s}`).join(""));var s,r;this.#s.innerText=`:host(${t}) {}`,this.#o.append(this.#s)}#m(t,s){const i=this.#s?.sheet?.cssRules[0].style;if(!i)return;const r=(0,n.Tk)(e.componentName,t.replace(new RegExp("^st-"),""));s?i?.setProperty(r,s):i?.removeProperty(r)}#p(t=[]){for(const e of t)this.#h.includes(e)&&this.#m(e,this.getAttribute(e));this.#s.innerHTML=this.#s?.sheet?.cssRules[0].cssText}#g(){const s=document.createElement("style");s.id="style-mixin-mappings",s.innerHTML=((t,e,s)=>{const i=new l;return Object.keys(s).forEach((a=>{const l=((t,e)=>{const s={selector:"",property:(0,r.GL)(t)};return e&&Object.keys(e).length?Array.isArray(e)?e.map((t=>Object.assign({},s,t))):[Object.assign({},s,e)]:[s]})(a,s[a]),h=(0,n.Tk)(t,a);l.forEach((({selector:t,property:s})=>{i.add(((t="",e="")=>(0,r.mf)(e)?e(t):`${t}${/^[A-Za-z]/.test(e)?` ${e}`:e}`)(e,t),(0,r.mf)(s)?s():s,o(h))}))})),i.toString()})((0,r.E3)(e.componentName,this.#n),this.#l,t),this.#o.prepend(s)}#b(t){(this.#o.classList||this.#o.host.classList).add(t)}init(){super.init?.(),this.shadowRoot.isConnected&&(this.#b(e.componentName),this.#g(),this.#c(),this.#d(),(0,n.FX)(this,this.#p.bind(this),{}))}disconnectedCallback(){super.disconnectedCallback?.(),this.#r?.()}},c=t=>class extends t{#E=null;static get observedAttributes(){return[...t.observedAttributes||[],"draggable"]}constructor(){super(),this.#E=document.createElement("style"),this.#E.innerText="* { cursor: inherit!important }"}#y(t){t?this.shadowRoot.appendChild(this.#E):this.#E.remove()}attributeChangedCallback(t,e,s){super.attributeChangedCallback?.(t,e,s),"draggable"===t&&this.#y("true"===s)}};var d=s(3346),m=s(7878);const p=({componentName:t,wrappedEleName:e,slots:s=[],style:i,excludeAttrsSync:a=[],includeAttrsSync:o=[],includeForwardProps:l=[]})=>{class h extends((0,d.s)({componentName:t,baseSelector:e})){#v=m.C.bind(this,"blur");#f=m.C.bind(this,"focus");constructor(){super().attachShadow({mode:"open"}).innerHTML=`\n\t\t\t<style id="create-proxy">${(0,r.mf)(i)?i():i}</style>\n\t\t\t<${e}>\n\t\t\t<slot></slot>\n\t\t\t${s.map((t=>`<slot name="${t}" slot="${t}"></slot>`)).join("")}\n\t\t\t</${e}>\n\t\t`}focus=()=>this.baseElement.focus();init(){super.init?.(),this.baseElement.addEventListener("blur",(t=>{this.#v()})),this.baseElement.addEventListener("focus",(t=>{this.#f()})),this.addEventListener("focus",(t=>{t.isTrusted&&this.focus()})),(0,n.Db)(this,this.baseElement,l),this.baseElement.onkeydown=t=>{t.shiftKey&&9===t.keyCode&&this.getRootNode()===document&&(this.removeAttribute("tabindex"),setTimeout((()=>this.setAttribute("tabindex","0")),0))},(0,n.tg)(this.baseElement,this,{excludeAttrs:a,includeAttrs:o})}}return h},g=["required","pattern"],b=t=>class extends t{static get observedAttributes(){return[...t.observedAttributes||[],...g]}static get formAssociated(){return!0}#A;constructor(){super(),this.#A=this.attachInternals()}get defaultErrorMsgValueMissing(){return"Please fill out this field."}get defaultErrorMsgPatternMismatch(){return"Please match the requested format."}get defaultErrorMsgTooShort(){return`Minimum length is ${this.getAttribute("minlength")}.`}get defaultErrorMsgTooLong(){return`Maximum length is ${this.getAttribute("maxlength")}. `}getErrorMessage(t){switch(!0){case t.valueMissing:return this.getAttribute("data-errormessage-value-missing")||this.defaultErrorMsgValueMissing;case t.patternMismatch||t.typeMismatch:return this.getAttribute("data-errormessage-pattern-mismatch")||this.defaultErrorMsgPatternMismatch;case t.tooShort:return this.getAttribute("data-errormessage-pattern-mismatch-too-short")||this.defaultErrorMsgTooShort;case t.tooLong:return this.getAttribute("data-errormessage-pattern-mismatch-too-long")||this.defaultErrorMsgTooLong;case t.customError:return this.validationMessage;default:return""}}#S(){const t=this.getValidity();this.#A.setValidity(t,this.getErrorMessage(t))}get validationMessage(){return this.#A.validationMessage}getValidity(){console.warn("getValidity","is not implemented")}checkValidity(){return this.#A.validity.valid}reportValidity(){return this.#A.reportValidity()}get validity(){return this.#A.validity}setCustomValidity(t){t?this.#A.setValidity({customError:!0},t):(this.#A.setValidity({}),this.#S())}get isRequired(){return this.hasAttribute("required")&&"false"!==this.getAttribute("required")}get pattern(){return this.getAttribute("pattern")}get form(){return this.#A.form}attributeChangedCallback(t,e,s){super.attributeChangedCallback?.(t,e,s),g.includes(t)&&this.#S()}init(){super.init?.(),this.addEventListener("change",this.#S),this.addEventListener("invalid",(t=>t.stopPropagation())),this.addEventListener("input",this.#S),setTimeout((()=>this.#S()))}},E=["invalid","required"],y=(t,e,s)=>{Object.defineProperty(t,s,{set:function(t){return e[s]=t},get:function(){return e[s]},configurable:!0})},v=t=>{if(!t)return;let e=t;for(let t=0;t<10;t++)if(e=e.assignedElements()[0],"slot"!==e.localName)return e},f=t=>class extends(b(t)){static get observedAttributes(){return[...t.observedAttributes||[],...E]}#M;#C=m.C.bind(this,"change");constructor(){super(),this.#M=super.inputElement}get inputElement(){const t=this.baseElement.shadowRoot.querySelector('slot[name="input"]'),e=this.baseElement.shadowRoot.querySelector('slot[name="textarea"]');if(this.#M??=v(t)||v(e),!this.#M)throw Error("no input was found");return this.#M}set inputElement(t){this.#M=t}getValidity(){return this.inputElement.validity}reportValidityOnInternalInput(){setTimeout((()=>{this.inputElement.reportValidity()}))}reportValidity(){isValid||(this.setAttribute("invalid","true"),this.reportValidityOnInternalInput())}handleInternalInputErrorMessage(){this.inputElement.checkValidity()||this.inputElement.setCustomValidity(this.validationMessage)}#T(){this.handleInternalInputErrorMessage(),this.setAttribute("error-message",this.validationMessage)}init(){super.init?.(),this.inputElement.addEventListener("input",(t=>{this.inputElement.checkValidity()||(this.inputElement.setCustomValidity(""),this.setCustomValidity(""),this.baseElement.__onInput(t),this.#T())})),this.baseElement.addEventListener("change",(()=>{this.#C()})),this.addEventListener("blur",(()=>{this.checkValidity()||(this.setAttribute("invalid","true"),this.#T())})),this.addEventListener("focus",(t=>{t.relatedTarget?.form===this.form&&(this.checkValidity()||this.setAttribute("invalid","true"),this.hasAttribute("invalid")&&this.reportValidityOnInternalInput())})),this.addEventListener("invalid",this.#T),this.handleInternalInputErrorMessage(),this.hasAttribute("tabindex")||this.getRootNode()!==document||this.setAttribute("tabindex",0),y(this,this.inputElement,"value"),y(this,this.inputElement,"selectionStart"),this.setSelectionRange=this.inputElement.setSelectionRange?.bind(this.inputElement)}},A=t=>class extends t{#L(){const e=this.localName;if(!t.componentName)throw Error('component name is not defined on super class, make sure you have a static get for "componentName"');if(e!==t.componentName)throw Error(`component name mismatch, expected "${t.componentName}", current "${e}"`)}init(){super.init?.(),this.#L()}},S=t=>class extends t{init(){super.init?.(),this.baseElement.addEventListener("mouseover",(t=>{this.setAttribute("hover","true"),t.target.addEventListener("mouseleave",(()=>this.removeAttribute("hover")),{once:!0})}))}},M=t=>class extends t{init(){super.init?.(),this.addEventListener("blur",(t=>{t.isTrusted&&t.stopImmediatePropagation()})),this.addEventListener("focus",(t=>{t.isTrusted&&t.stopImmediatePropagation()})),this.addEventListener("focusout",(t=>{t.isTrusted&&t.stopImmediatePropagation()})),this.addEventListener("focusin",(t=>{t.isTrusted&&t.stopImmediatePropagation()}))}},C=({name:t,selector:e,mappings:s={},forward:{attributes:a=[],include:o=!0}={}})=>l=>{const c=t||(t=>t.replace(/[^\w\s]/gi,""))(e),d=u({mappings:s})(l);return class extends d{static get cssVarList(){return{...d.cssVarList,[c]:h((0,r.E3)(l.componentName,"_"+c),s)}}#V;constructor(){const t=t=>{const s=t.shadowRoot.querySelector(t.baseSelector),i=e?s.shadowRoot.querySelector(e):s;return i.shadowRoot||i};var s;super({getRootElement:t,componentNameSuffix:"_"+c,themeSection:i.qM+c,baseSelector:":host"}),this.#V=(s=t(this)).host||s}#x(){this.#V.onmouseenter=t=>{t.target.setAttribute("hover","true")},this.#V.onmouseleave=t=>{t.target.removeAttribute("hover")}}init(){super.init?.(),(0,n.oP)(this,this.#V,{[o?"includeAttrs":"excludeAttrs"]:a}),this.#x()}}},T=t=>class extends t{#C=m.C.bind(this,"change");init(){super.init?.(),this.prevValue=this.value,this.addEventListener("change",(t=>{t.stopPropagation()})),this.addEventListener("blur",(()=>{this.value!==this.prevValue&&(this.#C(),this.prevValue=this.value)}))}},L=t=>class extends t{init(){super.init?.(),(0,n.FX)(this,(t=>t.forEach((t=>{const e=this.getAttribute(t);""===e?this.setAttribute(t,"true"):"false"===e&&this.removeAttribute(t)}))),{})}},V=t=>class extends t{get isReadOnly(){return this.hasAttribute("readonly")&&"false"!==this.getAttribute("readonly")}init(){["focus","blur"].forEach((t=>{this.addEventListener(t,(t=>{this.isReadOnly&&(t.stopImmediatePropagation(),t.preventDefault())}),!0)})),super.init?.()}}}}]);
@@ -1 +1 @@
1
- "use strict";(self.webpackChunkDescopeUI=self.webpackChunkDescopeUI||[]).push([[841],{7361:(t,e,i)=>{i.d(e,{f:()=>l,Z:()=>p});var s=i(3878),n=i(4567),a=i(7878);const r=t=>{t?.focus(),t?.setSelectionRange(1,1)},u=t=>{const e=t.replace(/\s/g,"");return e.match(/^\d+$/)?[...e]:[]},l=(0,n.iY)("passcode-internal"),o=["disabled","bordered","size","invalid","readonly"],d=(0,s.P)({componentName:l,baseSelector:"div"}),p=class extends d{static get observedAttributes(){return o.concat(d.observedAttributes||[])}static get componentName(){return l}#t=a.C.bind(this,"blur");#e=a.C.bind(this,"focus");constructor(){super();const t=[...Array(this.digits).keys()].map((t=>`\n\t\t<descope-text-field\n\t\t\tst-width="35px"\n\t\t\tdata-id=${t}\n\t\t\ttype="tel"\n\t\t\tautocomplete="off"\n\t\t></descope-text-field>\n\t`));this.innerHTML=`\n\t\t<div>\n\t\t\t${t.join("")}\n\t\t</div>\n\t\t`,this.inputs=Array.from(this.querySelectorAll("descope-text-field"))}get digits(){return Number.parseInt(this.getAttribute("digits"))||6}get value(){return this.inputs.map((({value:t})=>t)).join("")}set value(t){if(t===this.value)return;const e=u(t);e.length&&this.fillDigits(e,this.inputs[0])}get pattern(){return`^$|^\\d{${this.digits},}$`}getValidity(){return this.isRequired&&!this.value?{valueMissing:!0}:this.pattern&&!new RegExp(this.pattern).test(this.value)?{patternMismatch:!0}:{}}init(){this.addEventListener("focus",(t=>{t.isTrusted&&this.inputs[0].focus()})),super.init?.(),this.initInputs()}getInputIdx(t){return Number.parseInt(t.getAttribute("data-id"),10)}getNextInput(t){const e=this.getInputIdx(t),i=Math.min(e+1,this.inputs.length-1);return this.inputs[i]}getPrevInput(t){const e=this.getInputIdx(t),i=Math.max(e-1,0);return this.inputs[i]}fillDigits(t,e){for(let i=0;i<t.length;i+=1){e.value=t[i]??"";const s=this.getNextInput(e);if(s===e)break;e=s}r(e)}initInputs(){let t,e=this.value;this.inputs.forEach((i=>{i.addEventListener("blur",(e=>{e.stopImmediatePropagation(),t=setTimeout((()=>{t=null,this.#t()}))})),i.addEventListener("focus",(e=>{e.stopImmediatePropagation(),clearTimeout(t),t||this.#e()})),i.addEventListener("input",(t=>{const s=u(i.value);s.length?this.fillDigits(s,i):i.value="",e===this.value&&t.stopImmediatePropagation()})),i.onkeydown=({key:t})=>{e=this.value,"Backspace"===t?(i.selectionStart||i.setSelectionRange(1,1),setTimeout((()=>{r(this.getPrevInput(i))}))):1===t.length&&(i.value="")}}))}attributeChangedCallback(t,e,i){super.attributeChangedCallback?.(t,e,i),e!==i&&o.includes(t)&&this.inputs.forEach((e=>null===i?e.removeAttribute(t):e.setAttribute(t,i)))}}},4775:(t,e,i)=>{i.r(e);var s=i(7361);customElements.define(s.f,s.Z)}}]);
1
+ "use strict";(self.webpackChunkDescopeUI=self.webpackChunkDescopeUI||[]).push([[841],{7361:(t,e,i)=>{i.d(e,{f:()=>l,Z:()=>h});var s=i(3878),n=i(4567),r=i(7878);const a=t=>{t?.focus(),t?.setSelectionRange(1,1)},u=t=>{const e=t.replace(/\s/g,"");return e.match(/^\d+$/)?[...e]:[]},l=(0,n.iY)("passcode-internal"),p=["digits"],d=["disabled","bordered","size","invalid","readonly"],o=(0,s.P)({componentName:l,baseSelector:"div"}),h=class extends o{static get observedAttributes(){return p.concat(o.observedAttributes||[])}static get componentName(){return l}#t=r.C.bind(this,"blur");#e=r.C.bind(this,"focus");constructor(){super(),this.innerHTML='\n\t\t<div class="wrapper"></div>\n\t\t<style>\n\t\t\t.wrapper {\n\t\t\t\tdisplay: flex;\n\t\t\t\twidth: 100%;\n\t\t\t\tjustify-content: space-between;\n\t\t\t}\n\t\t</style>\n\t\t',this.wrapperEle=this.querySelector("div")}renderInputs(){const t=[...Array(this.digits).keys()].map((t=>`\n\t\t<descope-text-field\n\t\t\tdata-id=${t}\n\t\t\ttype="tel"\n\t\t\tautocomplete="off"\n\t\t></descope-text-field>\n\t`));this.wrapperEle.innerHTML=t.join(""),this.inputs=Array.from(this.querySelectorAll("descope-text-field")),this.initInputs()}get digits(){return Number.parseInt(this.getAttribute("digits"))||6}get value(){return this.inputs?.map((({value:t})=>t)).join("")||""}set value(t){if(t===this.value)return;const e=u(t);e.length&&this.fillDigits(e,this.inputs[0])}get pattern(){return`^$|^\\d{${this.digits},}$`}getValidity(){return this.isRequired&&!this.value?{valueMissing:!0}:this.pattern&&!new RegExp(this.pattern).test(this.value)?{patternMismatch:!0}:{}}init(){this.addEventListener("focus",(t=>{t.isTrusted&&this.inputs[0].focus()})),super.init?.(),this.renderInputs()}getInputIdx(t){return Number.parseInt(t.getAttribute("data-id"),10)}getNextInput(t){const e=this.getInputIdx(t),i=Math.min(e+1,this.inputs.length-1);return this.inputs[i]}getPrevInput(t){const e=this.getInputIdx(t),i=Math.max(e-1,0);return this.inputs[i]}fillDigits(t,e){for(let i=0;i<t.length;i+=1){e.value=t[i]??"";const s=this.getNextInput(e);if(s===e)break;e=s}a(e)}initInputs(){let t,e=this.value;this.inputs.forEach((i=>{i.addEventListener("blur",(e=>{e.stopImmediatePropagation(),t=setTimeout((()=>{t=null,this.#t()}))})),i.addEventListener("focus",(e=>{e.stopImmediatePropagation(),clearTimeout(t),t||this.#e()})),i.addEventListener("input",(t=>{const s=u(i.value);s.length?this.fillDigits(s,i):i.value="",e===this.value&&t.stopImmediatePropagation()})),i.onkeydown=({key:t})=>{e=this.value,"Backspace"===t?(i.selectionStart||i.setSelectionRange(1,1),setTimeout((()=>{a(this.getPrevInput(i))}))):1===t.length&&(i.value="")},(0,n.oP)(this,i,{includeAttrs:d})}))}attributeChangedCallback(t,e,i){super.attributeChangedCallback?.(t,e,i),e!==i&&p.includes(t)&&"digits"===t&&this.renderInputs()}}},4775:(t,e,i)=>{i.r(e);var s=i(7361);customElements.define(s.f,s.Z)}}]);
@@ -1 +1 @@
1
- "use strict";(self.webpackChunkDescopeUI=self.webpackChunkDescopeUI||[]).push([[939],{7102:(t,e,n)=>{n.r(e);var i=n(9629),r=n(4447),d=n(7361),a=n(9063),o=n(2061);const l=(0,n(4567).iY)("passcode"),{borderStyle:s,borderWidth:p,...c}=r.Z,{digitField:u,label:f,requiredIndicator:b}={digitField:{selector:()=>a.Z.componentName},label:{selector:"> label"},requiredIndicator:{selector:"[required]::part(required-indicator)::after"}},m=a.Z.cssVarList,x=(0,o.qC)((0,i.yk)({mappings:{...c,borderColor:{...u,property:m.borderColor},color:[c.color,f,b]}}),i.e4,i.dj,i.Ae,(t=>class extends t{constructor(){super()}get digits(){return Number.parseInt(this.getAttribute("digits"))||6}init(){super.init?.();const t=document.createElement("template");t.innerHTML=`\n\t\t\t<${d.f} \n\t\t\t\tbordered="true" \n\t\t\t\tname="code" \n\t\t\t\ttabindex="-1"\n\t\t\t\tslot="input"\n\t\t\t></${d.f}>\n\t\t\t`,this.baseElement.appendChild(t.content.cloneNode(!0)),this.inputElement=this.shadowRoot.querySelector(d.f)}}))((0,i.DM)({slots:[],wrappedEleName:"vaadin-text-field",style:()=>'\n :host {\n --vaadin-field-default-width: auto;\n\t\t\tdisplay: inline-block;\n }\n\n descope-passcode-internal {\n -webkit-mask-image: none;\n display: flex;\n gap: 2px;\n align-items: center;\n padding: 0;\n }\n vaadin-text-field::part(input-field) {\n background-color: transparent;\n padding: 0;\n\t\t\toverflow: hidden;\n }\n\t\tvaadin-text-field {\n\t\t\tmargin: 0;\n\t\t\tpadding: 0;\n\t\t}\n\t\tvaadin-text-field[readonly] > input:placeholder-shown {\n\t\t\topacity: 1;\n\t\t}\n\t\tvaadin-text-field > label,\n\t\tvaadin-text-field::part(input-field) {\n\t\t\tcursor: pointer;\n\t\t}\n\t\tvaadin-text-field::part(input-field):focus {\n\t\t\tcursor: text;\n\t\t}\n\t\tvaadin-text-field[required]::part(required-indicator)::after {\n\t\t\tfont-size: "12px";\n\t\t\tcontent: "*";\n\t\t}\n\t\tvaadin-text-field[readonly]::part(input-field)::after {\n\t\t\tborder: 0 solid;\n\t\t}\n ',excludeAttrsSync:["tabindex"],componentName:l}));n(9357),n(4775),customElements.define(l,x)}}]);
1
+ "use strict";(self.webpackChunkDescopeUI=self.webpackChunkDescopeUI||[]).push([[939],{7102:(t,e,n)=>{n.r(e);var i=n(9629),r=n(4447),o=n(7361),d=n(9063),a=n(2061),l=n(4567);const p=(0,l.iY)("passcode"),{borderStyle:s,borderWidth:c,...u}=r.Z,{digitField:g,label:h,requiredIndicator:f,internalWrapper:m,focusedValidDigitField:b}={focusedValidDigitField:{selector:()=>`${d.Z.componentName}[focused="true"]:not([invalid="true"])`},digitField:{selector:()=>d.Z.componentName},label:{selector:"> label"},requiredIndicator:{selector:"[required]::part(required-indicator)::after"},internalWrapper:{selector:"descope-passcode-internal .wrapper"}},x=d.Z.cssVarList,y=(0,a.qC)((0,i.yk)({mappings:{...u,borderColor:{...g,property:x.borderColor},outlineColor:{...g,property:x.outlineColor},outlineWidth:[{...g,property:x.outlineWidth},{...m,property:"padding"}],color:[u.color,h,f],padding:{...g,property:x.padding},margin:{...g,property:x.margin},textAlign:{...g,property:x.textAlign},caretColor:{...g,property:x.caretColor},digitsGap:{...m,property:"gap"},focusedValidDigitFieldBorderColor:{...b,property:x.borderColor}}}),i.e4,i.dj,i.Ae,(t=>class extends t{constructor(){super()}get digits(){return Number.parseInt(this.getAttribute("digits"))||6}init(){super.init?.();const t=document.createElement("template");t.innerHTML=`\n\t\t\t<${o.f} \n\t\t\t\tbordered="true" \n\t\t\t\tname="code" \n\t\t\t\ttabindex="-1"\n\t\t\t\tslot="input"\n\t\t\t></${o.f}>\n\t\t\t`,this.baseElement.appendChild(t.content.cloneNode(!0)),this.inputElement=this.shadowRoot.querySelector(o.f),(0,l.oP)(this,this.inputElement,{includeAttrs:["digits","size"]})}}))((0,i.DM)({slots:[],wrappedEleName:"vaadin-text-field",style:()=>`\n :host {\n --vaadin-field-default-width: auto;\n\t\t\tdisplay: inline-block;\n }\n\n descope-passcode-internal {\n -webkit-mask-image: none;\n padding: 0;\n\t\t\twidth: 100%;\n\t\t\theight: 100%;\n\t\t\tmin-height: initial;\n }\n\n\t\tdescope-passcode-internal .wrapper {\n\t\t\tbox-sizing: border-box;\n\t\t\tmin-height: initial;\n\t\t\theight: 100%;\n }\n\n\t\tdescope-passcode-internal descope-text-field {\n\t\t\twidth: var(${x.height})\t\t\t\n\t\t}\n\n vaadin-text-field::part(input-field) {\n background-color: transparent;\n padding: 0;\n\t\t\toverflow: hidden;\n\t\t\t-webkit-mask-image: none;\n }\n\n\t\tvaadin-text-field {\n\t\t\tmargin: 0;\n\t\t\tpadding: 0;\n\t\t\twidth: 100%\n\t\t}\n\n\t\tvaadin-text-field::before {\n\t\t\theight: initial;\n\t\t}\n\n\t\tvaadin-text-field[readonly] > input:placeholder-shown {\n\t\t\topacity: 1;\n\t\t}\n\t\n\t\tvaadin-text-field::part(input-field):focus {\n\t\t\tcursor: text;\n\t\t}\n\n\t\tvaadin-text-field[required]::part(required-indicator)::after {\n\t\t\tfont-size: "12px";\n\t\t\tcontent: "*";\n\t\t}\n\t\tvaadin-text-field[readonly]::part(input-field)::after {\n\t\t\tborder: 0 solid;\n\t\t}\n `,excludeAttrsSync:["tabindex"],componentName:p}));n(9357),n(4775),customElements.define(p,y)}}]);
@@ -1 +1 @@
1
- "use strict";(self.webpackChunkDescopeUI=self.webpackChunkDescopeUI||[]).push([[414],{4840:(t,e,n)=>{n.r(e),n.d(e,{PhoneField:()=>w}),n(4772),n(1294),n(9357);var r=n(9859),o=n(4567),d=n(2061),i=n(9629),p=n(9063),l=n(3352);const a=p.Z.cssVarList,s=l.Z.cssVarList,h=(0,o.iY)("phone-field"),{inputWrapper:c,countryCodeInput:u,phoneInput:f,label:y,requiredIndicator:b,separator:m}={inputWrapper:{selector:"::part(input-field)"},phoneInput:{selector:()=>"descope-text-field"},countryCodeInput:{selector:()=>"descope-combo-box"},label:{selector:"> label"},requiredIndicator:{selector:"[required]::part(required-indicator)::after"},separator:{selector:"descope-phone-field-internal .separator"}},w=(0,d.qC)((0,i.yk)({mappings:{componentWidth:{selector:()=>":host",property:"width"},wrapperBorderStyle:[{...c,property:"border-style"},{...m,property:"border-left-style"}],wrapperBorderWidth:[{...c,property:"border-width"},{...m,property:"border-left-width"}],wrapperBorderColor:[{...c,property:"border-color"},{...m,property:"border-left-color"}],wrapperBorderRadius:{...c,property:"border-radius"},inputHeight:{...c,property:"height"},countryCodeInputWidth:{...u,property:s.width},countryCodeDropdownWidth:{...u,property:"--vaadin-combo-box-overlay-width"},phoneInputWidth:{...f,property:"width"},color:[y,b],placeholderColor:{...f,property:a.placeholderColor},overlayItemBackgroundColor:{selector:"descope-combo-box",property:s.overlayItemBackgroundColor}}}),i.e4,i.dj,(t=>class extends t{constructor(){super()}init(){super.init?.();const t=document.createElement("template");t.innerHTML=`\n\t\t\t\t<${r.f} \n\t\t\t\t\ttabindex="-1"\n\t\t\t\t\tslot="input"\n\t\t\t\t></${r.f}>\n \t\t`,this.baseElement.appendChild(t.content.cloneNode(!0)),this.inputElement=this.shadowRoot.querySelector(r.f),(0,o.oP)(this.shadowRoot.host,this.inputElement,{includeAttrs:["size","bordered","invalid","minlength","maxlength","default-code","country-input-placeholder","phone-input-placeholder"]})}}))((0,i.DM)({slots:[],wrappedEleName:"vaadin-text-field",style:()=>`\n\t\t\t:host {\n\t\t\t\t--vaadin-field-default-width: auto;\n\t\t\t\tdisplay: inline-block;\n\t\t\t}\n\t\t\tdiv {\n\t\t\t\tdisplay: inline-flex;\n\t\t\t}\n\t\t\tvaadin-text-field {\n\t\t\t\tpadding: 0;\n\t\t\t\twidth: 100%;\n\t\t\t\theight: 100%;\n\t\t\t}\n\t\t\tvaadin-text-field::part(input-field) {\n\t\t\t\tpadding: 0;\n\t\t\t\tmin-height: 0;\n\t\t\t\tbackground: transparent;\n\t\t\t\toverflow: hidden;\n\t\t\t}\n\t\t\tdescope-phone-field-internal {\n\t\t\t\t-webkit-mask-image: none;\n\t\t\t\tpadding: 0;\n\t\t\t\tmin-height: 0;\n\t\t\t\twidth: 100%;\n\t\t\t\theight: 100%;\t\n\t\t\t}\n\t\t\tdescope-phone-field-internal > div {\n\t\t\t\twidth: 100%;\n\t\t\t\theight: 100%;\n\t\t\t}\n\t\t\tdescope-phone-field-internal .separator {\n\t\t\t\tflex: 0;\n\t\t\t\tborder: none;\n\t\t\t}\n\t\t\tdescope-combo-box {\n\t\t\t\tflex-shrink: 0;\n\t\t\t\theight: 100%;\n\t\t\t\t${s.borderWidth}: 0;\n\t\t\t}\n\t\t\tdescope-text-field {\n\t\t\t\tflex-grow: 1;\n\t\t\t\tmin-height: 0;\n\t\t\t\theight: 100%;\n\t\t\t\t${a.borderWidth}: 0;\n\t\t\t\t${a.borderRadius}: 0;\n\t\t\t}\n\t\t\tvaadin-text-field[required]::part(required-indicator)::after {\n\t\t\t\tcontent: "*";\n\t\t\t}\n\t\t\tvaadin-text-field[readonly] > input:placeholder-shown {\n\t\t\t\topacity: 1;\n\t\t\t}\n\t\t`,excludeAttrsSync:["tabindex"],componentName:h}));customElements.define(h,w)}}]);
1
+ "use strict";(self.webpackChunkDescopeUI=self.webpackChunkDescopeUI||[]).push([[414],{4840:(t,e,n)=>{n.r(e),n.d(e,{PhoneField:()=>w}),n(4772),n(1294),n(9357);var r=n(9859),o=n(4567),d=n(2061),i=n(9629),p=n(9063),l=n(3352);const a=p.Z.cssVarList,s=l.Z.cssVarList,c=(0,o.iY)("phone-field"),{inputWrapper:h,countryCodeInput:u,phoneInput:y,label:f,requiredIndicator:b,separator:m}={inputWrapper:{selector:"::part(input-field)"},phoneInput:{selector:()=>"descope-text-field"},countryCodeInput:{selector:()=>"descope-combo-box"},label:{selector:"> label"},requiredIndicator:{selector:"[required]::part(required-indicator)::after"},separator:{selector:"descope-phone-field-internal .separator"}},w=(0,d.qC)((0,i.yk)({mappings:{componentWidth:{selector:()=>":host",property:"width"},wrapperBorderStyle:[{...h,property:"border-style"},{...m,property:"border-left-style"}],wrapperBorderWidth:[{...h,property:"border-width"},{...m,property:"border-left-width"}],wrapperBorderColor:[{...h,property:"border-color"},{...m,property:"border-left-color"}],wrapperBorderRadius:{...h,property:"border-radius"},inputHeight:{...h,property:"height"},countryCodeInputWidth:{...u,property:s.width},countryCodeDropdownWidth:{...u,property:"--vaadin-combo-box-overlay-width"},phoneInputWidth:{...y,property:"width"},color:[f,b,{...y,property:a.color},{...u,property:s.color}],placeholderColor:{...y,property:a.placeholderColor},overlayItemBackgroundColor:{selector:"descope-combo-box",property:s.overlayItemBackgroundColor}}}),i.e4,i.dj,(t=>class extends t{constructor(){super()}init(){super.init?.();const t=document.createElement("template");t.innerHTML=`\n\t\t\t\t<${r.f} \n\t\t\t\t\ttabindex="-1"\n\t\t\t\t\tslot="input"\n\t\t\t\t></${r.f}>\n \t\t`,this.baseElement.appendChild(t.content.cloneNode(!0)),this.inputElement=this.shadowRoot.querySelector(r.f),(0,o.oP)(this.shadowRoot.host,this.inputElement,{includeAttrs:["size","bordered","invalid","minlength","maxlength","default-code","country-input-placeholder","phone-input-placeholder"]})}}))((0,i.DM)({slots:[],wrappedEleName:"vaadin-text-field",style:()=>`\n\t\t\t:host {\n\t\t\t\t--vaadin-field-default-width: auto;\n\t\t\t\tdisplay: inline-block;\n\t\t\t}\n\t\t\tdiv {\n\t\t\t\tdisplay: inline-flex;\n\t\t\t}\n\t\t\tvaadin-text-field {\n\t\t\t\tpadding: 0;\n\t\t\t\twidth: 100%;\n\t\t\t\theight: 100%;\n\t\t\t}\n\t\t\tvaadin-text-field::part(input-field) {\n\t\t\t\tpadding: 0;\n\t\t\t\tmin-height: 0;\n\t\t\t\tbackground: transparent;\n\t\t\t\toverflow: hidden;\n\t\t\t}\n\t\t\tdescope-phone-field-internal {\n\t\t\t\t-webkit-mask-image: none;\n\t\t\t\tpadding: 0;\n\t\t\t\tmin-height: 0;\n\t\t\t\twidth: 100%;\n\t\t\t\theight: 100%;\t\n\t\t\t}\n\t\t\tdescope-phone-field-internal > div {\n\t\t\t\twidth: 100%;\n\t\t\t\theight: 100%;\n\t\t\t}\n\t\t\tdescope-phone-field-internal .separator {\n\t\t\t\tflex: 0;\n\t\t\t\tborder: none;\n\t\t\t}\n\t\t\tdescope-combo-box {\n\t\t\t\tflex-shrink: 0;\n\t\t\t\theight: 100%;\n\t\t\t\t${s.borderWidth}: 0;\n\t\t\t}\n\t\t\tdescope-text-field {\n\t\t\t\tflex-grow: 1;\n\t\t\t\tmin-height: 0;\n\t\t\t\theight: 100%;\n\t\t\t\t${a.borderWidth}: 0;\n\t\t\t\t${a.borderRadius}: 0;\n\t\t\t}\n\t\t\tvaadin-text-field[required]::part(required-indicator)::after {\n\t\t\t\tcontent: "*";\n\t\t\t}\n\t\t\tvaadin-text-field[readonly] > input:placeholder-shown {\n\t\t\t\topacity: 1;\n\t\t\t}\n\t\t`,excludeAttrsSync:["tabindex"],componentName:c}));customElements.define(c,w)}}]);
@@ -1 +1 @@
1
- "use strict";(self.webpackChunkDescopeUI=self.webpackChunkDescopeUI||[]).push([[322],{178:(t,e,n)=>{n.r(e),n.d(e,{TextArea:()=>c}),n(7101);var r=n(9629),a=n(2061);const o=(0,n(4567).iY)("text-area"),i={label:"::part(label)",input:"::part(input-field)",required:"::part(required-indicator)::after",host:()=>":host"};let s="";const l=(0,a.qC)((0,r.yk)({mappings:{resize:{selector:"> textarea"},color:{selector:i.label},cursor:{},width:{selector:i.host},backgroundColor:{selector:i.input},borderWidth:{selector:i.input},borderStyle:{selector:i.input},borderColor:{selector:i.input},borderRadius:{selector:i.input},outline:{selector:i.input},outlineOffset:{selector:i.input}}}),r.e4,r.dj,r.Ae)((0,r.DM)({slots:[],wrappedEleName:"vaadin-text-area",style:()=>s,excludeAttrsSync:["tabindex"],componentName:o}));s='\n\t:host {\n\t\tdisplay: inline-block;\n\t}\n\n\tvaadin-text-area {\n\t\tmargin: 0;\n\t\twidth: 100%;\n\t}\n\tvaadin-text-area > label,\n\tvaadin-text-area::part(input-field) {\n\t\tcursor: pointer;\n\t}\n\tvaadin-text-area[focused]::part(input-field) {\n\t\tcursor: text;\n\t}\n\tvaadin-text-area::part(required-indicator)::after {\n\t\tfont-size: "12px";\n\t\tcontent: "*";\n\t}\t\n';const c=l;customElements.define(o,c)}}]);
1
+ "use strict";(self.webpackChunkDescopeUI=self.webpackChunkDescopeUI||[]).push([[322],{178:(t,e,n)=>{n.r(e),n.d(e,{TextArea:()=>c}),n(7101);var r=n(9629),a=n(2061);const o=(0,n(4567).iY)("text-area"),i={label:"::part(label)",input:"::part(input-field)",required:"::part(required-indicator)::after",host:()=>":host"};let l="";const s=(0,a.qC)((0,r.yk)({mappings:{resize:{selector:"> textarea"},color:{selector:i.label},cursor:{},width:{selector:i.host},backgroundColor:{selector:i.input},borderWidth:{selector:i.input},borderStyle:{selector:i.input},borderColor:{selector:i.input},borderRadius:{selector:i.input},outlineWidth:{selector:i.input},outlineStyle:{selector:i.input},outlineColor:{selector:i.input},outlineOffset:{selector:i.input}}}),r.e4,r.dj,r.Ae)((0,r.DM)({slots:[],wrappedEleName:"vaadin-text-area",style:()=>l,excludeAttrsSync:["tabindex"],componentName:o}));l='\n\t:host {\n\t\tdisplay: inline-block;\n\t}\n\n\tvaadin-text-area {\n\t\tmargin: 0;\n\t\twidth: 100%;\n\t}\n\tvaadin-text-area > label,\n\tvaadin-text-area::part(input-field) {\n\t\tcursor: pointer;\n\t}\n\tvaadin-text-area[focused]::part(input-field) {\n\t\tcursor: text;\n\t}\n\tvaadin-text-area::part(required-indicator)::after {\n\t\tfont-size: "12px";\n\t\tcontent: "*";\n\t}\t\n';const c=s;customElements.define(o,c)}}]);
@@ -1 +1 @@
1
- "use strict";(self.webpackChunkDescopeUI=self.webpackChunkDescopeUI||[]).push([[934],{9063:(t,e,n)=>{n.d(e,{Z:()=>f,f:()=>l});var i=n(9629),a=n(4447),d=n(2061);const l=(0,n(4567).iY)("text-field");let r="";const s=["type"],o=(0,d.qC)((0,i.yk)({mappings:a.Z}),i.e4,i.dj,i.Ae,(t=>class extends t{static get observedAttributes(){return s.concat(t.observedAttributes||[])}attributeChangedCallback(t,e,n){super.attributeChangeCallback?.(t,e,n),"type"===t&&this.baseElement._setType(n)}}))((0,i.DM)({slots:["prefix","suffix"],wrappedEleName:"vaadin-text-field",style:()=>r,excludeAttrsSync:["tabindex"],componentName:l}));r=`\n\t:host {\n\t\tdisplay: inline-block;\n\t\t--vaadin-field-default-width: auto;\n\t}\n\tvaadin-text-field {\n\t\tmargin: 0;\n\t\tpadding: 0;\n\t\twidth: 100%;\n\t\theight: 100%;\n\t}\n\tvaadin-text-field input {\n\t\tmin-height: 0;\n\t}\n\tvaadin-text-field::part(input-field) {\n\t\toverflow: hidden;\n\t\tpadding: 0;\n\t}\n\tvaadin-text-field[readonly] > input:placeholder-shown {\n\t\topacity: 1;\n\t}\n\tvaadin-text-field input:-webkit-autofill,\n\tvaadin-text-field input:-webkit-autofill::first-line,\n\tvaadin-text-field input:-webkit-autofill:hover,\n\tvaadin-text-field input:-webkit-autofill:active,\n\tvaadin-text-field input:-webkit-autofill:focus {\n\t\t-webkit-text-fill-color: var(${o.cssVarList.color});\n\t\tbox-shadow: 0 0 0 var(${o.cssVarList.height}) var(${o.cssVarList.backgroundColor}) inset;\n\t}\n\tvaadin-text-field > label,\n\tvaadin-text-field::part(input-field) {\n\t\tcolor: var(${o.cssVarList.color});\n\t}\n\tvaadin-text-field::part(input-field):focus {\n\t\tcursor: text;\n\t}\n\tvaadin-text-field[required]::part(required-indicator)::after {\n\t\tfont-size: "12px";\n\t\tcontent: "*";\n\t\tcolor: var(${o.cssVarList.color});\n\t}\n\tvaadin-text-field[readonly]::part(input-field)::after {\n\t\tborder: 0 solid;\n\t}\n`;const f=o},9357:(t,e,n)=>{n.r(e),n.d(e,{TextField:()=>i.Z}),n(9789);var i=n(9063);customElements.define(i.f,i.Z)}}]);
1
+ "use strict";(self.webpackChunkDescopeUI=self.webpackChunkDescopeUI||[]).push([[934],{9063:(t,e,n)=>{n.d(e,{Z:()=>f,f:()=>l});var i=n(9629),a=n(4447),d=n(2061);const l=(0,n(4567).iY)("text-field");let r="";const s=["type"],o=(0,d.qC)((0,i.yk)({mappings:a.Z}),i.e4,i.dj,i.Ae,(t=>class extends t{static get observedAttributes(){return s.concat(t.observedAttributes||[])}attributeChangedCallback(t,e,n){super.attributeChangeCallback?.(t,e,n),"type"===t&&this.baseElement._setType(n)}}))((0,i.DM)({slots:["prefix","suffix"],wrappedEleName:"vaadin-text-field",style:()=>r,excludeAttrsSync:["tabindex"],componentName:l}));r=`\n\t:host {\n\t\tdisplay: inline-block;\n\t\t--vaadin-field-default-width: auto;\n\t}\n\tvaadin-text-field {\n\t\tmargin: 0;\n\t\tpadding: 0;\n\t\twidth: 100%;\n\t\theight: 100%;\n\t}\n\n\tvaadin-text-field::part(input-field) {\n\t\toverflow: hidden;\n\t\tpadding: 0;\n\t}\n\tvaadin-text-field[readonly] > input:placeholder-shown {\n\t\topacity: 1;\n\t}\n\tvaadin-text-field input:-webkit-autofill,\n\tvaadin-text-field input:-webkit-autofill::first-line,\n\tvaadin-text-field input:-webkit-autofill:hover,\n\tvaadin-text-field input:-webkit-autofill:active,\n\tvaadin-text-field input:-webkit-autofill:focus {\n\t\t-webkit-text-fill-color: var(${o.cssVarList.color});\n\t\tbox-shadow: 0 0 0 var(${o.cssVarList.height}) var(${o.cssVarList.backgroundColor}) inset;\n\t}\n\n\tvaadin-text-field input {\n\t\t-webkit-mask-image: none;\n\t}\n\n\tvaadin-text-field > label,\n\tvaadin-text-field::part(input-field) {\n\t\tcolor: var(${o.cssVarList.color});\n\t}\n\tvaadin-text-field::part(input-field):focus {\n\t\tcursor: text;\n\t}\n\tvaadin-text-field[required]::part(required-indicator)::after {\n\t\tfont-size: "12px";\n\t\tcontent: "*";\n\t\tcolor: var(${o.cssVarList.color});\n\t}\n\tvaadin-text-field[readonly]::part(input-field)::after {\n\t\tborder: 0 solid;\n\t}\n\n\tvaadin-text-field::before {\n\t\theight: unset;\n\t}\n`;const f=o},9357:(t,e,n)=>{n.r(e),n.d(e,{TextField:()=>i.Z}),n(9789);var i=n(9063);customElements.define(i.f,i.Z)}}]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@descope/web-components-ui",
3
- "version": "1.0.75",
3
+ "version": "1.0.77",
4
4
  "description": "",
5
5
  "main": "dist/cjs/index.cjs.js",
6
6
  "module": "dist/index.esm.js",
@@ -9,7 +9,7 @@ import textFieldMappings from '../descope-text-field/textFieldMappings';
9
9
  import { componentName as descopeInternalComponentName } from './descope-passcode-internal/PasscodeInternal';
10
10
  import TextField from '../descope-text-field/TextField'
11
11
  import { compose } from '../../helpers';
12
- import { getComponentName } from '../../helpers/componentHelpers';
12
+ import { forwardAttrs, getComponentName } from '../../helpers/componentHelpers';
13
13
 
14
14
  export const componentName = getComponentName('passcode');
15
15
 
@@ -39,16 +39,20 @@ const customMixin = (superclass) =>
39
39
  this.baseElement.appendChild(template.content.cloneNode(true));
40
40
 
41
41
  this.inputElement = this.shadowRoot.querySelector(descopeInternalComponentName);
42
+
43
+ forwardAttrs(this, this.inputElement, { includeAttrs: ['digits', 'size'] })
42
44
  }
43
45
  };
44
46
 
45
47
  const { borderStyle, borderWidth, ...restTextFieldMappings } =
46
48
  textFieldMappings;
47
49
 
48
- const { digitField, label, requiredIndicator } = {
50
+ const { digitField, label, requiredIndicator, internalWrapper, focusedValidDigitField } = {
51
+ focusedValidDigitField: { selector: () => `${TextField.componentName}[focused="true"]:not([invalid="true"])` },
49
52
  digitField: { selector: () => TextField.componentName },
50
53
  label: { selector: '> label' },
51
- requiredIndicator: { selector: '[required]::part(required-indicator)::after' }
54
+ requiredIndicator: { selector: '[required]::part(required-indicator)::after' },
55
+ internalWrapper: { selector: 'descope-passcode-internal .wrapper' }
52
56
  }
53
57
 
54
58
  const textVars = TextField.cssVarList
@@ -58,7 +62,20 @@ const Passcode = compose(
58
62
  mappings: {
59
63
  ...restTextFieldMappings,
60
64
  borderColor: { ...digitField, property: textVars.borderColor },
65
+ outlineColor: { ...digitField, property: textVars.outlineColor },
66
+ outlineWidth: [
67
+ { ...digitField, property: textVars.outlineWidth },
68
+ // we want to leave enough space to the digits outline,
69
+ // ideally, this would be part of the text field
70
+ { ...internalWrapper, property: 'padding' }
71
+ ],
61
72
  color: [restTextFieldMappings.color, label, requiredIndicator],
73
+ padding: { ...digitField, property: textVars.padding },
74
+ margin: { ...digitField, property: textVars.margin },
75
+ textAlign: { ...digitField, property: textVars.textAlign },
76
+ caretColor: { ...digitField, property: textVars.caretColor },
77
+ digitsGap: { ...internalWrapper, property: 'gap' },
78
+ focusedValidDigitFieldBorderColor: { ...focusedValidDigitField, property: textVars.borderColor }
62
79
  },
63
80
  }),
64
81
  draggableMixin,
@@ -77,30 +94,47 @@ const Passcode = compose(
77
94
 
78
95
  descope-passcode-internal {
79
96
  -webkit-mask-image: none;
80
- display: flex;
81
- gap: 2px;
82
- align-items: center;
83
97
  padding: 0;
98
+ width: 100%;
99
+ height: 100%;
100
+ min-height: initial;
101
+ }
102
+
103
+ descope-passcode-internal .wrapper {
104
+ box-sizing: border-box;
105
+ min-height: initial;
106
+ height: 100%;
84
107
  }
108
+
109
+ descope-passcode-internal descope-text-field {
110
+ width: var(${textVars.height})
111
+ }
112
+
85
113
  vaadin-text-field::part(input-field) {
86
114
  background-color: transparent;
87
115
  padding: 0;
88
116
  overflow: hidden;
117
+ -webkit-mask-image: none;
89
118
  }
119
+
90
120
  vaadin-text-field {
91
121
  margin: 0;
92
122
  padding: 0;
123
+ width: 100%
124
+ }
125
+
126
+ vaadin-text-field::before {
127
+ height: initial;
93
128
  }
129
+
94
130
  vaadin-text-field[readonly] > input:placeholder-shown {
95
131
  opacity: 1;
96
132
  }
97
- vaadin-text-field > label,
98
- vaadin-text-field::part(input-field) {
99
- cursor: pointer;
100
- }
133
+
101
134
  vaadin-text-field::part(input-field):focus {
102
135
  cursor: text;
103
136
  }
137
+
104
138
  vaadin-text-field[required]::part(required-indicator)::after {
105
139
  font-size: "12px";
106
140
  content: "*";
@@ -1,11 +1,15 @@
1
1
  import { createBaseInputClass } from '../../../baseClasses/createBaseInputClass';
2
- import { getComponentName } from '../../../helpers/componentHelpers';
2
+ import { forwardAttrs, getComponentName } from '../../../helpers/componentHelpers';
3
3
  import { createDispatchEvent } from '../../../helpers/mixinsHelpers';
4
4
  import { getSanitizedCharacters, focusElement } from './helpers';
5
5
 
6
6
  export const componentName = getComponentName('passcode-internal');
7
7
 
8
8
  const observedAttributes = [
9
+ 'digits'
10
+ ]
11
+
12
+ const forwardAttributes = [
9
13
  'disabled',
10
14
  'bordered',
11
15
  'size',
@@ -29,22 +33,35 @@ class PasscodeInternal extends BaseInputClass {
29
33
 
30
34
  constructor() {
31
35
  super();
36
+
37
+ this.innerHTML = `
38
+ <div class="wrapper"></div>
39
+ <style>
40
+ .wrapper {
41
+ display: flex;
42
+ width: 100%;
43
+ justify-content: space-between;
44
+ }
45
+ </style>
46
+ `;
47
+
48
+ this.wrapperEle = this.querySelector('div');
49
+ }
50
+
51
+ renderInputs() {
32
52
  const inputs = [...Array(this.digits).keys()].map((idx) => `
33
53
  <descope-text-field
34
- st-width="35px"
35
54
  data-id=${idx}
36
55
  type="tel"
37
56
  autocomplete="off"
38
57
  ></descope-text-field>
39
58
  `)
40
59
 
41
- this.innerHTML = `
42
- <div>
43
- ${inputs.join('')}
44
- </div>
45
- `;
60
+ this.wrapperEle.innerHTML = inputs.join('');
46
61
 
47
62
  this.inputs = Array.from(this.querySelectorAll('descope-text-field'))
63
+
64
+ this.initInputs()
48
65
  }
49
66
 
50
67
  get digits() {
@@ -52,7 +69,7 @@ class PasscodeInternal extends BaseInputClass {
52
69
  }
53
70
 
54
71
  get value() {
55
- return this.inputs.map(({ value }) => value).join('')
72
+ return this.inputs?.map(({ value }) => value).join('') || ''
56
73
  }
57
74
 
58
75
  set value(val) {
@@ -91,7 +108,8 @@ class PasscodeInternal extends BaseInputClass {
91
108
 
92
109
  super.init?.();
93
110
 
94
- this.initInputs()
111
+ this.renderInputs()
112
+
95
113
  }
96
114
 
97
115
  getInputIdx(inputEle) {
@@ -180,6 +198,8 @@ class PasscodeInternal extends BaseInputClass {
180
198
  input.value = ''; // we are clearing the previous value so we can override it with the new value
181
199
  }
182
200
  };
201
+
202
+ forwardAttrs(this, input, { includeAttrs: forwardAttributes })
183
203
  })
184
204
  }
185
205
 
@@ -189,11 +209,9 @@ class PasscodeInternal extends BaseInputClass {
189
209
  // sync attributes to inputs
190
210
  if (oldValue !== newValue) {
191
211
  if (observedAttributes.includes(attrName)) {
192
- this.inputs.forEach(
193
- (input) => newValue === null ?
194
- input.removeAttribute(attrName) :
195
- input.setAttribute(attrName, newValue)
196
- )
212
+ if (attrName === 'digits') {
213
+ this.renderInputs();
214
+ }
197
215
  }
198
216
  }
199
217
  }
@@ -98,7 +98,7 @@ const PhoneField = compose(
98
98
 
99
99
  phoneInputWidth: { ...phoneInput, property: 'width' },
100
100
 
101
- color: [label, requiredIndicator],
101
+ color: [label, requiredIndicator, {...phoneInput, property: textVars.color}, {...countryCodeInput, property: comboVars.color}],
102
102
 
103
103
  placeholderColor: {
104
104
  ...phoneInput,
@@ -31,7 +31,9 @@ const TextArea = compose(
31
31
  borderStyle: { selector: selectors.input },
32
32
  borderColor: { selector: selectors.input },
33
33
  borderRadius: { selector: selectors.input },
34
- outline: { selector: selectors.input },
34
+ outlineWidth: { selector: selectors.input },
35
+ outlineStyle: { selector: selectors.input },
36
+ outlineColor: { selector: selectors.input },
35
37
  outlineOffset: { selector: selectors.input }
36
38
  }
37
39
  }),
@@ -64,9 +64,7 @@ overrides = `
64
64
  width: 100%;
65
65
  height: 100%;
66
66
  }
67
- vaadin-text-field input {
68
- min-height: 0;
69
- }
67
+
70
68
  vaadin-text-field::part(input-field) {
71
69
  overflow: hidden;
72
70
  padding: 0;
@@ -82,6 +80,11 @@ overrides = `
82
80
  -webkit-text-fill-color: var(${TextField.cssVarList.color});
83
81
  box-shadow: 0 0 0 var(${TextField.cssVarList.height}) var(${TextField.cssVarList.backgroundColor}) inset;
84
82
  }
83
+
84
+ vaadin-text-field input {
85
+ -webkit-mask-image: none;
86
+ }
87
+
85
88
  vaadin-text-field > label,
86
89
  vaadin-text-field::part(input-field) {
87
90
  color: var(${TextField.cssVarList.color});
@@ -97,6 +100,10 @@ overrides = `
97
100
  vaadin-text-field[readonly]::part(input-field)::after {
98
101
  border: 0 solid;
99
102
  }
103
+
104
+ vaadin-text-field::before {
105
+ height: unset;
106
+ }
100
107
  `;
101
108
 
102
109
  export default TextField;
@@ -1,37 +1,42 @@
1
1
  const selectors = {
2
2
  label: '::part(label)',
3
- input: '::part(input-field)',
3
+ inputWrapper: '::part(input-field)',
4
4
  readOnlyInput: '[readonly]::part(input-field)::after',
5
5
  placeholder: '> input:placeholder-shown',
6
- host: () => ':host'
6
+ host: () => ':host',
7
+ input: 'input'
7
8
  };
8
9
 
9
10
  export default {
10
- backgroundColor: { selector: selectors.input },
11
- color: { selector: selectors.input },
11
+ backgroundColor: { selector: selectors.inputWrapper },
12
+ color: { selector: selectors.inputWrapper },
12
13
  width: { selector: selectors.host },
13
14
  borderColor: [
14
- { selector: selectors.input },
15
+ { selector: selectors.inputWrapper },
15
16
  { selector: selectors.readOnlyInput }
16
17
  ],
17
18
  borderWidth: [
18
- { selector: selectors.input },
19
+ { selector: selectors.inputWrapper },
19
20
  { selector: selectors.readOnlyInput }
20
21
  ],
21
22
  borderStyle: [
22
- { selector: selectors.input },
23
+ { selector: selectors.inputWrapper },
23
24
  { selector: selectors.readOnlyInput }
24
25
  ],
25
- borderRadius: { selector: selectors.input },
26
- boxShadow: { selector: selectors.input },
26
+ borderRadius: { selector: selectors.inputWrapper },
27
+ boxShadow: { selector: selectors.inputWrapper },
27
28
 
28
29
  // we apply font-size also on the host so we can set its width with em
29
30
  fontSize: [{}, { selector: selectors.host }],
30
-
31
- height: { selector: selectors.input },
32
- padding: { selector: selectors.input },
33
- outline: { selector: selectors.input },
34
- outlineOffset: { selector: selectors.input },
35
-
31
+
32
+ height: { selector: selectors.inputWrapper },
33
+ padding: { selector: selectors.inputWrapper },
34
+ margin: { selector: selectors.inputWrapper },
35
+ caretColor: { selector: selectors.input },
36
+ outlineColor: { selector: selectors.inputWrapper },
37
+ outlineStyle: { selector: selectors.inputWrapper },
38
+ outlineWidth: { selector: selectors.inputWrapper },
39
+ outlineOffset: { selector: selectors.inputWrapper },
40
+ textAlign: {selector: selectors.input},
36
41
  placeholderColor: { selector: selectors.placeholder, property: 'color' }
37
42
  };
@@ -1,11 +1,20 @@
1
- // we want all the valueless attributes to have "true" value
1
+ import { observeAttributes } from "../helpers/componentHelpers";
2
+
3
+ // we want all the valueless attributes to have "true" value
4
+ // and all the falsy attribute to be removed
2
5
  export const normalizeBooleanAttributesMixin = (superclass) => class NormalizeBooleanAttributesMixinClass extends superclass {
3
- attributeChangedCallback(attrName, oldValue, newValue) {
4
- if (newValue === '') {
5
- this.setAttribute(attrName, 'true')
6
- newValue = 'true'
7
- }
6
+ init() {
7
+ super.init?.();
8
+
9
+ observeAttributes(this, (attrs) =>
10
+ attrs.forEach(attr => {
11
+ const attrVal = this.getAttribute(attr)
8
12
 
9
- super.attributeChangedCallback?.(attrName, oldValue, newValue)
13
+ if (attrVal === '') {
14
+ this.setAttribute(attr, 'true')
15
+ } else if (attrVal === 'false') {
16
+ this.removeAttribute(attr)
17
+ }
18
+ }), {})
10
19
  }
11
20
  }
@@ -1,7 +1,7 @@
1
1
  import { createDispatchEvent } from "../helpers/mixinsHelpers";
2
2
  import { inputValidationMixin } from "./inputValidationMixin";
3
3
 
4
- const errorAttrs = ['invalid', 'has-error-message'];
4
+ const errorAttrs = ['invalid', 'required'];
5
5
 
6
6
  const propertyObserver = (src, target, property) => {
7
7
  Object.defineProperty(src, property, {
@@ -83,10 +83,7 @@ const button = {
83
83
  },
84
84
  link: {
85
85
  [vars.color]: helperRefs.main,
86
- [vars.padding]: 0,
87
- [vars.margin]: 0,
88
86
  [vars.lineHeight]: helperRefs.height,
89
- [vars.borderRadius]: 0,
90
87
  _hover: {
91
88
  [vars.color]: helperRefs.main,
92
89
  [vars.textDecoration]: 'underline'
@@ -1,8 +1,41 @@
1
1
  import Passcode from '../../components/descope-passcode/Passcode';
2
- import { textField } from './textField';
2
+ import { getThemeRefs } from '../../helpers/themeHelpers';
3
+ import globals from '../globals';
4
+
5
+ const vars = Passcode.cssVarList
6
+ const globalRefs = getThemeRefs(globals);
3
7
 
4
8
  const passcode = {
5
- ...textField(Passcode.cssVarList),
6
- };
9
+ [vars.backgroundColor]: globalRefs.colors.surface.light,
10
+ [vars.outlineWidth]: '2px',
11
+ [vars.outlineColor]: globalRefs.colors.primary.main,
12
+ [vars.padding]: '0',
13
+ [vars.textAlign]: 'center',
14
+ [vars.borderColor]: 'transparent',
15
+ [vars.digitsGap]: '4px',
16
+ [vars.focusedValidDigitFieldBorderColor]: globalRefs.colors.primary.main,
17
+
18
+ _hideCursor: {
19
+ [vars.caretColor]: 'transparent',
20
+ },
21
+
22
+ _disabled: {
23
+ [vars.backgroundColor]: globalRefs.colors.surface.main
24
+ },
25
+
26
+ _fullWidth: {
27
+ [vars.width]: '100%'
28
+ },
29
+
30
+ _bordered: {
31
+ [vars.borderColor]: globalRefs.colors.surface.main
32
+ },
33
+
34
+ _invalid: {
35
+ [vars.borderColor]: globalRefs.colors.error.main,
36
+ [vars.color]: globalRefs.colors.error.main,
37
+ [vars.outlineColor]: globalRefs.colors.error.light,
38
+ },
39
+ }
7
40
 
8
41
  export default passcode;
@@ -15,13 +15,16 @@ const textArea = {
15
15
  [vars.borderWidth]: '1px',
16
16
  [vars.borderStyle]: 'solid',
17
17
  [vars.borderColor]: 'transparent',
18
+ [vars.outlineWidth]: '2px',
19
+ [vars.outlineStyle]: 'solid',
20
+
18
21
 
19
22
  _bordered: {
20
23
  [vars.borderColor]: globalRefs.colors.surface.main
21
24
  },
22
25
 
23
26
  _focused: {
24
- [vars.outline]: `2px solid ${globalRefs.colors.surface.main}`
27
+ [vars.outlineColor]: globalRefs.colors.surface.main
25
28
  },
26
29
 
27
30
  _fullWidth: {
@@ -33,7 +36,7 @@ const textArea = {
33
36
  },
34
37
 
35
38
  _invalid: {
36
- [vars.outline]: `2px solid ${globalRefs.colors.error.main}`
39
+ [vars.outlineColor]: globalRefs.colors.error.main
37
40
  }
38
41
  };
39
42
 
@@ -56,7 +56,9 @@ export const textField = (vars) => ({
56
56
  },
57
57
 
58
58
  _focused: {
59
- [vars.outline]: `2px solid ${globalRefs.colors.surface.main}`
59
+ [vars.outlineWidth]: '2px',
60
+ [vars.outlineStyle]: 'solid',
61
+ [vars.outlineColor]: globalRefs.colors.surface.main
60
62
  },
61
63
 
62
64
  _bordered: {
@@ -66,6 +68,7 @@ export const textField = (vars) => ({
66
68
  _invalid: {
67
69
  [vars.borderColor]: globalRefs.colors.error.main,
68
70
  [vars.color]: globalRefs.colors.error.main,
71
+ [vars.outlineColor]: globalRefs.colors.error.light,
69
72
  [vars.placeholderColor]: globalRefs.colors.error.light
70
73
  }
71
74
  });