@descope/web-components-ui 1.0.69 → 1.0.71
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/index.esm.js +290 -385
- package/dist/index.esm.js.map +1 -1
- package/dist/umd/809.js +1 -0
- package/dist/umd/descope-button-index-js.js +1 -1
- package/dist/umd/descope-checkbox-index-js.js +1 -1
- package/dist/umd/descope-combo-box-index-js.js +1 -1
- package/dist/umd/descope-container-index-js.js +1 -1
- package/dist/umd/descope-date-picker-index-js.js +1 -1
- package/dist/umd/descope-divider-index-js.js +1 -1
- package/dist/umd/descope-email-field-index-js.js +1 -1
- package/dist/umd/descope-link-index-js.js +1 -1
- package/dist/umd/descope-loader-linear-index-js.js +1 -1
- package/dist/umd/descope-loader-radial-index-js.js +1 -1
- package/dist/umd/descope-logo-index-js.js +1 -1
- package/dist/umd/descope-number-field-index-js.js +1 -1
- package/dist/umd/descope-passcode-descope-passcode-internal-index-js.js +1 -1
- package/dist/umd/descope-passcode-index-js.js +1 -1
- package/dist/umd/descope-password-field-index-js.js +1 -1
- package/dist/umd/descope-switch-toggle-index-js.js +1 -1
- package/dist/umd/descope-text-area-index-js.js +1 -1
- package/dist/umd/descope-text-field-index-js.js +1 -1
- package/dist/umd/descope-text-index-js.js +1 -1
- package/dist/umd/index.js +1 -1
- package/package.json +1 -1
- package/src/baseClasses/createBaseClass.js +29 -2
- package/src/baseClasses/createBaseInputClass.js +9 -0
- package/src/components/descope-passcode/Passcode.js +1 -1
- package/src/components/descope-passcode/descope-passcode-internal/PasscodeInternal.js +67 -51
- package/src/helpers/mixinsHelpers.js +26 -9
- package/src/mixins/changeMixin.js +13 -39
- package/src/mixins/componentNameValidationMixin.js +2 -4
- package/src/mixins/createProxy.js +45 -53
- package/src/mixins/createStyleMixin/index.js +2 -0
- package/src/mixins/focusMixin.js +20 -125
- package/src/mixins/hoverableMixin.js +10 -16
- package/src/mixins/index.js +1 -0
- package/src/mixins/inputValidationMixin.js +10 -30
- package/src/mixins/normalizeBooleanAttributesMixin.js +11 -0
- package/src/mixins/proxyInputMixin.js +51 -58
- package/dist/umd/135.js +0 -1
- package/src/baseClasses/BaseInputClass.js +0 -4
package/dist/umd/809.js
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
"use strict";(self.webpackChunkDescopeUI=self.webpackChunkDescopeUI||[]).push([[809],{3346:(e,t,s)=>{s.d(t,{s:()=>a});var n=s(2061),i=s(7878),r=s(4877);const a=({componentName:e,baseSelector:t=""})=>{class s extends HTMLElement{static get componentName(){return e}#e;#t=i.C.bind(this,"connected");#s=i.C.bind(this,"disconnected");get baseSelector(){return t}get baseElement(){return this.#e??=this.baseSelector?this.rootElement.querySelector(this.baseSelector):this,this.#e}get rootElement(){return this.shadowRoot||this}connectedCallback(){super.connectedCallback?.(),setTimeout(this.#t)}disconnectedCallback(){super.disconnectedCallback?.(),this.#s()}}return(0,n.qC)(r.Ae,r._A,r.QT)(s)}},5279:(e,t,s)=>{s.d(t,{gh:()=>n,k4:()=>i,qM:()=>a,qg:()=>r});const n="descope",i=3,r="host",a="@"},4567:(e,t,s)=>{s.d(t,{Db:()=>u,FX:()=>r,P$:()=>a,Tk:()=>h,iY:()=>c,oP:()=>d,tg:()=>l});var n=s(2061),i=s(5279);const r=(e,t,{excludeAttrs:s=[],includeAttrs:n=[]})=>{const i=Array.from(e.attributes).filter((e=>!s.includes(e.name)&&(!n.length||n.includes(e.name)))).map((e=>e.name));t(i),new MutationObserver((e=>{for(const i of e)"attributes"!==i.type||s.includes(i.attributeName)||n.length&&!n.includes(i.attributeName)||t([i.attributeName])})).observe(e,{attributes:!0})},a=(e,t)=>{t({addedNodes:Array.from(e.children),removedNodes:[]}),new MutationObserver((e=>{for(const s of e)"childList"===s.type&&t(s)})).observe(e,{childList:!0})},o=(e,t,s={})=>n=>{n.forEach((n=>{const i=s[n]||n,r=e.getAttribute(n);null!==r?t.getAttribute(i)!==r&&t.setAttribute(i,r):t.removeAttribute(i)}))},l=(e,t,s)=>{r(e,o(e,t),s),r(t,o(t,e),s)},c=e=>(0,n.E3)(i.gh,e),h=(...e)=>`--${(0,n.E3)(...e)}`,d=(e,t,s={})=>{r(e,o(e,t,s.mapAttrs),s)},u=(e,t,s=[])=>{if(!s.length)return;const n=s.reduce(((e,s)=>Object.assign(e,{[s]:{get:()=>t[s],set(e){t[s]=e}}})),{});Object.defineProperties(e,n)}},2061:(e,t,s)=>{s.d(t,{E3:()=>i,GL:()=>n,mf:()=>a,qC:()=>r});const n=e=>e.replace(/([a-z])([A-Z])/g,"$1-$2").replace(/[\s_.]+/g,"-").toLowerCase(),i=(...e)=>n(e.filter((e=>!!e)).join("-")),r=(...e)=>t=>e.reduceRight(((e,t)=>t(e)),t),a=e=>"function"==typeof e},7878:(e,t,s)=>{function n(e,t={}){const s=new Event(e,t);this[`on${e}`]?.(s),this.dispatchEvent(s)}function i(e,t,{element:s,...n}={}){const i=setTimeout((()=>console.warn(this.localName,'is not using "createBaseClass", events will not be removed automatically on disconnect')),2e3);this.addEventListener("connected",(()=>{clearTimeout(i)}),{once:!0});const r=s||this,a=t.bind(this),o=()=>{r.removeEventListener(e,a)};return this.addEventListener("disconnected",o,{once:!0}),r.addEventListener(e,a,n),o}s.d(t,{C:()=>n,t:()=>i})},4877:(e,t,s)=>{s.d(t,{li:()=>M,Ae:()=>C,DM:()=>p,yk:()=>h,e4:()=>d,pY:()=>S,_A:()=>A,wX:()=>g,QT:()=>T,Iw:()=>k,dj:()=>f});var n=s(5279),i=s(2061),r=s(4567),a=s(5561);const o=(e,...t)=>`var(${e}${t.length?` , ${o(...t)}`:""})`;class l{constructor(){this.styleMap=new Map}add(e,t,s){this.styleMap.has(e)||this.styleMap.set(e,[]),this.styleMap.set(e,[...this.styleMap.get(e),{property:t,value:s}])}toString(){return Array.from(this.styleMap.entries()).reduce(((e,[t,s])=>e+`${t} { \n${s.map((({property:e,value:t})=>`${e}: ${t}`)).join(";\n")} \n}\n\n`),"")}}const c=(e,t)=>Object.keys(t).reduce(((t,s)=>Object.assign(t,{[s]:(0,r.Tk)(e,s)})),{}),h=({mappings:e={}})=>t=>class extends t{static get cssVarList(){return{...t.cssVarList,...c(t.componentName,{...e})}}#n;#i;#r;#a;#o;#l;#c;#h;constructor({getRootElement:t,componentNameSuffix:s="",themeSection:r=n.qg,baseSelector:a}={}){super(),this.#a=s,this.#o=r,this.#l=t?.(this)||this.shadowRoot,this.#c=a??this.baseSelector,this.#h=Object.keys(e).map((e=>(0,i.E3)("st",s,e)))}get componentTheme(){return a.componentsThemeManager.currentTheme?.[t.componentName]||""}#d(){this.#i.innerHTML=this.componentTheme[this.#o]}#u(){this.#i=document.createElement("style"),this.#i.id="style-mixin-theme",this.#l.prepend(this.#i),this.#r=a.componentsThemeManager.onCurrentThemeChange(this.#d.bind(this)),this.#d()}#m(){this.#n=document.createElement("style"),this.#n.id="style-mixin-overrides";const e=(s=t.componentName,i=n.k4,Array(i).fill(`.${s}`).join(""));var s,i;this.#n.innerText=`:host(${e}) {}`,this.#l.append(this.#n)}#p(e,s){const n=this.#n?.sheet?.cssRules[0].style;if(!n)return;const i=(0,r.Tk)(t.componentName,e.replace(new RegExp("^st-"),""));s?n?.setProperty(i,s):n?.removeProperty(i)}#b(e=[]){for(const t of e)this.#h.includes(t)&&this.#p(t,this.getAttribute(t));this.#n.innerHTML=this.#n?.sheet?.cssRules[0].cssText}#g(){const s=document.createElement("style");s.id="style-mixin-mappings",s.innerHTML=((e,t,s)=>{const n=new l;return Object.keys(s).forEach((a=>{const l=((e,t)=>{const s={selector:"",property:(0,i.GL)(e)};return t&&Object.keys(t).length?Array.isArray(t)?t.map((e=>Object.assign({},s,e))):[Object.assign({},s,t)]:[s]})(a,s[a]),c=(0,r.Tk)(e,a);l.forEach((({selector:e,property:s})=>{n.add(((e="",t="")=>(0,i.mf)(t)?t(e):`${e}${/^[A-Za-z]/.test(t)?` ${t}`:t}`)(t,e),(0,i.mf)(s)?s():s,o(c))}))})),n.toString()})((0,i.E3)(t.componentName,this.#a),this.#c,e),this.#l.prepend(s)}#y(e){(this.#l.classList||this.#l.host.classList).add(e)}connectedCallback(){super.connectedCallback?.(),this.shadowRoot.isConnected&&(this.#y(t.componentName),this.#g(),this.#u(),this.#m(),(0,r.FX)(this,this.#b.bind(this),{}))}disconnectedCallback(){super.disconnectedCallback?.(),this.#r?.()}},d=e=>class extends e{#E=null;static get observedAttributes(){return[...e.observedAttributes||[],"draggable"]}constructor(){super(),this.#E=document.createElement("style"),this.#E.innerText="* { cursor: inherit!important }"}#v(e){e?this.shadowRoot.appendChild(this.#E):this.#E.remove()}attributeChangedCallback(e,t,s){super.attributeChangedCallback?.(e,t,s),"draggable"===e&&this.#v("true"===s)}};var u=s(3346),m=s(7878);const p=({componentName:e,wrappedEleName:t,slots:s=[],style:n,excludeAttrsSync:a=[],includeAttrsSync:o=[],includeForwardProps:l=[]})=>{class c extends((0,u.s)({componentName:e,baseSelector:t})){#f=m.C.bind(this,"blur");#C=m.C.bind(this,"focus");constructor(){super().attachShadow({mode:"open"}).innerHTML=`\n\t\t\t<style id="create-proxy">${(0,i.mf)(n)?n():n}</style>\n\t\t\t<${t}>\n\t\t\t<slot></slot>\n\t\t\t${s.map((e=>`<slot name="${e}" slot="${e}"></slot>`)).join("")}\n\t\t\t</${t}>\n\t\t`}focus=()=>this.baseElement.focus();connectedCallback(){super.connectedCallback?.(),m.t.call(this,"blur",(e=>{this.#f()}),{element:this.baseElement}),m.t.call(this,"focus",(e=>{this.#C()}),{element:this.baseElement}),m.t.call(this,"focus",(e=>{e.isTrusted&&this.focus()})),(0,r.Db)(this,this.baseElement,l),this.baseElement.onkeydown=e=>{e.shiftKey&&9===e.keyCode&&this.getRootNode()===document&&(this.removeAttribute("tabindex"),setTimeout((()=>this.setAttribute("tabindex","0")),0))},(0,r.tg)(this.baseElement,this,{excludeAttrs:a,includeAttrs:o})}}return c},b=["required","pattern"],g=e=>class extends e{static get observedAttributes(){return[...e.observedAttributes||[],...b]}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."}getErrorMessage(e){switch(!0){case e.valueMissing:return this.getAttribute("data-errormessage-value-missing")||this.defaultErrorMsgValueMissing;case e.patternMismatch||e.typeMismatch:return this.getAttribute("data-errormessage-pattern-mismatch")||this.defaultErrorMsgPatternMismatch;case e.customError:return this.validationMessage;default:return""}}#S(){const e=this.getValidity();this.#A.setValidity(e,this.getErrorMessage(e))}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(e){e?this.#A.setValidity({customError:!0},e):(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(e,t,s){super.attributeChangedCallback?.(e,t,s),b.includes(e)&&this.#S()}connectedCallback(){super.connectedCallback?.(),m.t.call(this,"change",this.#S),m.t.call(this,"invalid",(e=>e.stopPropagation())),m.t.call(this,"input",this.#S),this.#S()}},y=["invalid","has-error-message"],E=(e,t,s)=>{Object.defineProperty(e,s,{set:function(e){return t[s]=e},get:function(){return t[s]},configurable:!0})},v=e=>{if(!e)return;let t=e;for(let e=0;e<10;e++)if(t=t.assignedElements()[0],"slot"!==t.localName)return t},f=e=>class extends(g(e)){static get observedAttributes(){return[...e.observedAttributes||[],...y]}#k;#M=m.C.bind(this,"change");constructor(){super(),this.#k=super.inputElement}get inputElement(){const e=this.baseElement.shadowRoot.querySelector('slot[name="input"]'),t=this.baseElement.shadowRoot.querySelector('slot[name="textarea"]');if(this.#k??=v(e)||v(t),!this.#k)throw Error("no input was found");return this.#k}set inputElement(e){this.#k=e}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)}connectedCallback(){super.connectedCallback?.(),m.t.call(this,"input",(e=>{this.inputElement.checkValidity()||(this.inputElement.setCustomValidity(""),this.setCustomValidity(""),this.baseElement.__onInput(e),this.#T())}),{element:this.inputElement}),m.t.call(this,"change",(()=>{this.#M()}),{element:this.baseElement}),m.t.call(this,"blur",(()=>{this.checkValidity()||(this.setAttribute("invalid","true"),this.#T())})),m.t.call(this,"focus",(e=>{e.relatedTarget?.form===this.form&&(this.checkValidity()||this.setAttribute("invalid","true"),this.hasAttribute("invalid")&&this.reportValidityOnInternalInput())})),m.t.call(this,"invalid",this.#T),this.handleInternalInputErrorMessage(),this.hasAttribute("tabindex")||this.getRootNode()!==document||this.setAttribute("tabindex",0),E(this,this.inputElement,"value"),E(this,this.inputElement,"selectionStart"),this.setSelectionRange=this.inputElement.setSelectionRange?.bind(this.inputElement)}},C=e=>class extends e{#V(){const t=this.localName;if(!e.componentName)throw Error('component name is not defined on super class, make sure you have a static get for "componentName"');if(t!==e.componentName)throw Error(`component name mismatch, expected "${e.componentName}", current "${t}"`)}connectedCallback(){super.connectedCallback?.(),this.#V()}},A=e=>class extends e{connectedCallback(){super.connectedCallback?.(),m.t.call(this,"mouseover",(e=>{this.setAttribute("hover","true"),e.target.addEventListener("mouseleave",(()=>this.removeAttribute("hover")),{once:!0})}),{element:this.baseElement})}},S=e=>class extends e{connectedCallback(){super.connectedCallback?.(),m.t.call(this,"blur",(e=>{e.isTrusted&&e.stopImmediatePropagation()})),m.t.call(this,"focus",(e=>{e.isTrusted&&e.stopImmediatePropagation()})),m.t.call(this,"focusout",(e=>{e.isTrusted&&e.stopImmediatePropagation()})),m.t.call(this,"focusin",(e=>{e.isTrusted&&e.stopImmediatePropagation()}))}},k=({name:e,selector:t,mappings:s={}})=>a=>{const o=e||(e=>e.replace(/[^\w\s]/gi,""))(t),l=h({mappings:s})(a);return class extends l{static get cssVarList(){return{...l.cssVarList,[o]:c((0,i.E3)(a.componentName,"_"+o),s)}}#x;constructor(){const e=e=>{const s=e.shadowRoot.querySelector(e.baseSelector),n=t?s.shadowRoot.querySelector(t):s;return n.shadowRoot||n};var s;super({getRootElement:e,componentNameSuffix:"_"+o,themeSection:n.qM+o,baseSelector:":host"}),this.#x=(s=e(this)).host||s}#N(){this.#x.onmouseenter=e=>{e.target.setAttribute("hover","true")},this.#x.onmouseleave=e=>{e.target.removeAttribute("hover")}}connectedCallback(){super.connectedCallback?.(),(0,r.oP)(this,this.#x,{excludeAttrs:["hover"]}),this.#N()}}},M=e=>class extends e{#M=m.C.bind(this,"change");connectedCallback(){super.connectedCallback?.(),this.prevValue=this.value,m.t.call(this,"change",(e=>{e.stopPropagation()})),m.t.call(this,"blur",(()=>{this.value!==this.prevValue&&(this.#M(),this.prevValue=this.value)}))}},T=e=>class extends e{attributeChangedCallback(e,t,s){""===s&&(this.setAttribute(e,"true"),s="true"),super.attributeChangedCallback?.(e,t,s)}}}}]);
|
@@ -1 +1 @@
|
|
1
|
-
"use strict";(self.webpackChunkDescopeUI=self.webpackChunkDescopeUI||[]).push([[662],{3029:(t,n,a)=>{a.r(n),a.d(n,{Button:()=>b}),a(729);var e=a(2061),r=a(4567),i=a(
|
1
|
+
"use strict";(self.webpackChunkDescopeUI=self.webpackChunkDescopeUI||[]).push([[662],{3029:(t,n,a)=>{a.r(n),a.d(n,{Button:()=>b}),a(729);var e=a(2061),r=a(4567),i=a(4877);const o=(0,r.iY)("button"),{label:s,host:l}={label:{selector:"::part(label)"},host:{selector:()=>":host"}},c=(0,e.qC)((0,i.yk)({mappings:{backgroundColor:{},borderRadius:{},color:s,borderColor:{},borderStyle:{},borderWidth:{},fontSize:{},height:{},width:l,cursor:{},padding:s,textDecoration:s}}),i.e4,i.Ae)((0,i.DM)({slots:["prefix","label","suffix"],wrappedEleName:"vaadin-button",style:()=>`\n\t:host {\n\t\tdisplay: inline-block;\n\t}\n\tvaadin-button { margin: 0; }\n\tvaadin-button::part(prefix) {\n\t\tmargin-left: 0;\n\t\tmargin-right: 0;\n\t}\n vaadin-button::part(label) { pointer-events: none; } \n\tvaadin-button::part(prefix),\n\tvaadin-button::part(label) {\n\t\tdisplay: flex;\n\t\tjustify-content: center;\n\t\talign-items: center;\n\t\tgap: 5px;\n\t}\n ${d}`,excludeAttrsSync:["tabindex"],componentName:o})),d=`\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\t--marginRatio: 1.35;\n\t\tcolor: var(${c.cssVarList.color});\n\t\tanimation: spin 2s linear infinite;\n\t\tposition: absolute;\n\t\ttop: calc(50% - calc((var(${c.cssVarList.height}) / var(--marginRatio)) / 2));\n\t\tleft: calc(50% - calc((var(${c.cssVarList.height}) / var(--marginRatio)) / 2));\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-width: calc(var(${c.cssVarList.height}) / 12);\n\t\tborder-style: solid;\n\t\twidth: calc(var(${c.cssVarList.height}) / var(--marginRatio));\n\t\theight: calc(var(${c.cssVarList.height}) / var(--marginRatio));\n\t}\n\t:host([loading="true"])::part(prefix),\n\t:host([loading="true"])::part(label) {\n\t\tvisibility: hidden;\n\t}\n\n\tvaadin-button {\n\t\twidth: 100%;\n\t}\n`,b=c;customElements.define(o,b)}}]);
|
@@ -1 +1 @@
|
|
1
|
-
"use strict";(self.webpackChunkDescopeUI=self.webpackChunkDescopeUI||[]).push([[761],{7904:(t,e,n)=>{n.r(e),n.d(e,{Checkbox:()=>a}),n(9515);var c=n(
|
1
|
+
"use strict";(self.webpackChunkDescopeUI=self.webpackChunkDescopeUI||[]).push([[761],{7904:(t,e,n)=>{n.r(e),n.d(e,{Checkbox:()=>a}),n(9515);var c=n(4877),s=n(2061);const o=(0,n(4567).iY)("checkbox"),a=(0,s.qC)((0,c.yk)({mappings:{width:{selector:()=>":host"},cursor:[{},{selector:"> label"}]}}),c.e4,c.dj,c.Ae)((0,c.DM)({slots:[],wrappedEleName:"vaadin-checkbox",style:"\n\t\t:host {\n\t\t\tdisplay: inline-block;\n\t\t}\n\t\t\n\t\tvaadin-checkbox {\n\t\t\twidth: 100%;\n\t\t}\n\t\t",excludeAttrsSync:["tabindex"],componentName:o}));customElements.define(o,a)}}]);
|
@@ -1 +1 @@
|
|
1
|
-
"use strict";(self.webpackChunkDescopeUI=self.webpackChunkDescopeUI||[]).push([[483],{9258:(e,t,o)=>{o.r(t),o.d(t,{ComboBox:()=>c}),o(9314);var r=o(2061),n=o(4567),s=o(
|
1
|
+
"use strict";(self.webpackChunkDescopeUI=self.webpackChunkDescopeUI||[]).push([[483],{9258:(e,t,o)=>{o.r(t),o.d(t,{ComboBox:()=>c}),o(9314);var r=o(2061),n=o(4567),s=o(4877);const a=(0,n.iY)("combo-box"),{input:i,toggle:d}={input:{selector:"::part(input-field)"},toggle:{selector:"::part(toggle-button)"}},l={topRightRadius:{selector:i.selector,property:"border-top-right-radius"},bottomRightRadius:{selector:i.selector,property:"border-bottom-right-radius"},topLeftRadius:{selector:i.selector,property:"border-top-left-radius"},bottomLeftRadius:{selector:i.selector,property:"border-bottom-left-radius"}},c=(0,r.qC)((0,s.yk)({mappings:{...l,backgroundColor:i,width:i,color:i,padding:i,borderColor:i,borderStyle:i,borderWidth:i,cursor:d,height:i}}),s.e4,(0,s.Iw)({name:"overlay",selector:"",mappings:{}}),s.dj,s.Ae,(e=>class extends e{#e(){const e=this.shadowRoot.querySelector(this.baseSelector),t=Array.from(this.children);e.items=t.map((e=>Object.defineProperty(e,"data-name",{value:e.getAttribute("data-name")}))),e.renderer=(e,o,r)=>{e.innerHTML=t[r.index].outerHTML}}#t(){const e=this.baseElement.shadowRoot.querySelector("vaadin-combo-box-overlay");e._attachOverlay=function(){this.bringToFront()},e._detachOverlay=function(){},e._enterModalState=function(){}}connectedCallback(){super.connectedCallback?.(),this.#t(),(0,n.P$)(this,this.#e.bind(this))}}))((0,s.DM)({slots:["prefix"],wrappedEleName:"vaadin-combo-box",style:()=>"\n\t\t:host {\n\t\t\t-webkit-mask-image: none;\n\t\t}\n\t\t",excludeAttrsSync:["tabindex"],includeAttrsSync:[],componentName:a,includeForwardProps:["items","renderer"]}));customElements.define(a,c)}}]);
|
@@ -1 +1 @@
|
|
1
|
-
"use strict";(self.webpackChunkDescopeUI=self.webpackChunkDescopeUI||[]).push([[317],{147:(t,e,o)=>{o.r(e),o.d(e,{Container:()=>a});var n=o(
|
1
|
+
"use strict";(self.webpackChunkDescopeUI=self.webpackChunkDescopeUI||[]).push([[317],{147:(t,e,o)=>{o.r(e),o.d(e,{Container:()=>a});var n=o(4877),s=o(3346),r=o(2061);const i=(0,o(4567).iY)("container");class d extends((0,s.s)({componentName:i,baseSelector:":host > slot"})){constructor(){super(),this.attachShadow({mode:"open"}).innerHTML="\n\t\t<style>\n\t\t\t:host > slot {\n\t\t\t\tbox-sizing: border-box;\n\t\t\t\twidth: 100%;\n\t\t\t\theight: 100%;\n\t\t\t\tdisplay: flex;\n\t\t\t\toverflow: auto;\n\t\t\t}\n\t\t\t:host {\n\t\t\t\tdisplay: inline-block;\n\t\t\t}\n\t\t</style>\n\t\t<slot></slot>\n\t"}}const a=(0,r.qC)((0,n.yk)({mappings:{height:{selector:()=>":host"},width:{selector:()=>":host"},verticalPadding:[{property:"padding-top"},{property:"padding-bottom"}],horizontalPadding:[{property:"padding-left"},{property:"padding-right"}],flexDirection:{},justifyContent:{},alignItems:{},gap:{},backgroundColor:{},borderRadius:{},borderColor:{},borderStyle:{},borderWidth:{},boxShadow:{}}}),n.e4,n.Ae)(d);customElements.define(i,a)}}]);
|
@@ -1 +1 @@
|
|
1
|
-
"use strict";(self.webpackChunkDescopeUI=self.webpackChunkDescopeUI||[]).push([[17],{2552:(e,s,a)=>{a.r(s),a.d(s,{DatePicker:()=>i}),a(541);var c=a(
|
1
|
+
"use strict";(self.webpackChunkDescopeUI=self.webpackChunkDescopeUI||[]).push([[17],{2552:(e,s,a)=>{a.r(s),a.d(s,{DatePicker:()=>i}),a(541);var c=a(4877),p=a(2061);const t=(0,a(4567).iY)("date-picker"),i=(0,p.qC)(c.e4,c.Ae)((0,c.DM)({componentName:t,slots:["prefix","suffix"],wrappedEleName:"vaadin-date-picker",style:""}));customElements.define(t,i)}}]);
|
@@ -1 +1 @@
|
|
1
|
-
"use strict";(self.webpackChunkDescopeUI=self.webpackChunkDescopeUI||[]).push([[178],{6446:(t,e,o)=>{o.r(e),o.d(e,{Divider:()=>f});var n=o(
|
1
|
+
"use strict";(self.webpackChunkDescopeUI=self.webpackChunkDescopeUI||[]).push([[178],{6446:(t,e,o)=>{o.r(e),o.d(e,{Divider:()=>f});var n=o(4877),i=o(3346),s=o(2061),r=o(4567);const d=(0,r.iY)("divider");class h extends((0,i.s)({componentName:d,baseSelector:":host > div"})){constructor(){super(),this.attachShadow({mode:"open"}).innerHTML="\n\t\t<style>\n\t\t\t:host > div {\n\t\t\t\tdisplay: flex;\n\t\t\t\theight: 100%;\n\t\t\t\twidth: 100%;\n\t\t\t}\n\t\t\t:host > div::before,\n\t\t\t:host > div::after {\n\t\t\t\tcontent: '';\n\t\t\t\tflex-grow: 1;\n\t\t\t}\n\n\t\t\tdescope-text {\n\t\t\t\tflex-grow: 0;\n\t\t\t\tflex-shrink: 0;\n\t\t\t}\n\n\t\t\t:host(:empty) descope-text {\n\t\t\t\tdisplay: none;\n\t\t\t}\n\n\t\t\t:host([vertical=\"true\"]) div {\n\t\t\t\twidth: fit-content;\n\t\t\t}\n\n\t\t</style>\n\t\t<div>\n\t\t\t<descope-text>\n\t\t\t\t<slot></slot>\n\t\t\t</descope-text>\n\t\t</div>\n\t",this.textComponent=this.shadowRoot.querySelector("descope-text"),(0,r.oP)(this,this.textComponent,{includeAttrs:["mode","variant","italic"]})}}const{root:p,before:c,after:a,text:l,host:x}={root:{selector:""},before:{selector:"::before"},after:{selector:"::after"},text:{selector:"descope-text"},host:{selector:()=>":host"}},f=(0,s.qC)((0,n.yk)({mappings:{maxTextWidth:{...l,property:"max-width"},minHeight:p,alignItems:p,alignSelf:p,flexDirection:p,textPadding:{...l,property:"padding"},width:x,padding:x,backgroundColor:[c,a],opacity:[c,a],textWidth:{...l,property:"width"},dividerHeight:[{...c,property:"height"},{...a,property:"height"}],dividerWidth:[{...c,property:"width"},{...a,property:"width"}]}}),n.e4,n.Ae)(h);o(1876),customElements.define(d,f)}}]);
|
@@ -1 +1 @@
|
|
1
|
-
"use strict";(self.webpackChunkDescopeUI=self.webpackChunkDescopeUI||[]).push([[760],{689:(t,i,e)=>{e.r(i),e.d(i,{EmailField:()=>s}),e(9437);var n=e(
|
1
|
+
"use strict";(self.webpackChunkDescopeUI=self.webpackChunkDescopeUI||[]).push([[760],{689:(t,i,e)=>{e.r(i),e.d(i,{EmailField:()=>s}),e(9437);var n=e(4877),a=e(4447),l=e(2061);const d=(0,e(4567).iY)("email-field");let o="";const r=(0,l.qC)((0,n.yk)({mappings:{...a.Z}}),n.e4,n.dj,n.Ae)((0,n.DM)({slots:["suffix"],wrappedEleName:"vaadin-email-field",style:()=>o,excludeAttrsSync:["tabindex"],componentName:d}));o=`\n\t:host {\n\t\tdisplay: inline-block;\n\t}\n\tvaadin-email-field {\n\t\tmargin: 0;\n\t\tpadding: 0;\n\t}\n\tvaadin-email-field::part(input-field) {\n\t\toverflow: hidden;\n\t}\n\tvaadin-email-field[readonly] > input:placeholder-shown {\n\t\topacity: 1;\n\t}\n\tvaadin-email-field input:-webkit-autofill,\n\tvaadin-email-field input:-webkit-autofill::first-line,\n\tvaadin-email-field input:-webkit-autofill:hover,\n\tvaadin-email-field input:-webkit-autofill:active,\n\tvaadin-email-field input:-webkit-autofill:focus {\n\t\t-webkit-text-fill-color: var(${r.cssVarList.color});\n\t\tbox-shadow: 0 0 0 var(${r.cssVarList.height}) var(${r.cssVarList.backgroundColor}) inset;\n\t}\n\tvaadin-email-field > label,\n\tvaadin-email-field::part(input-field) {\n\t\tcursor: pointer;\n\t\tcolor: var(${r.cssVarList.color});\n\t}\n\tvaadin-email-field::part(input-field):focus {\n\t\tcursor: text;\n\t}\n\tvaadin-email-field[required]::part(required-indicator)::after {\n\t\tfont-size: "12px";\n\t\tcontent: "*";\n\t\tcolor: var(${r.cssVarList.color});\n\t}\n\tvaadin-email-field[readonly]::part(input-field)::after {\n\t\tborder: 0 solid;\n\t}\n`;const s=r;customElements.define(d,s)}}]);
|
@@ -1 +1 @@
|
|
1
|
-
"use strict";(self.webpackChunkDescopeUI=self.webpackChunkDescopeUI||[]).push([[58],{8029:(t,e,o)=>{o.r(e),o.d(e,{Link:()=>k});var s=o(
|
1
|
+
"use strict";(self.webpackChunkDescopeUI=self.webpackChunkDescopeUI||[]).push([[58],{8029:(t,e,o)=>{o.r(e),o.d(e,{Link:()=>k});var s=o(4877),n=o(3346),r=o(8801),c=o(2061),l=o(4567);const a=(0,l.iY)("link");class i extends((0,n.s)({componentName:a,baseSelector:":host a"})){constructor(){super(),document.createElement("template"),this.attachShadow({mode:"open"}).innerHTML="\n\t\t<style>\n\t\t:host {\n\t\t\tdisplay: inline-block;\n\t\t}\n\t\t:host a {\n\t\t\tdisplay: inline-block;\n\t\t}\n\t\t</style>\n\t\t<div>\n\t\t\t<a>\n\t\t\t\t<descope-text>\n\t\t\t\t\t<slot></slot>\n\t\t\t\t</descope-text>\n\t\t\t</a>\n\t\t</div>\n\t\t",(0,l.oP)(this,this.shadowRoot.querySelector("a"),{includeAttrs:["href","target","tooltip"],mapAttrs:{tooltip:"title"}}),(0,l.oP)(this,this.shadowRoot.querySelector("descope-text"),{includeAttrs:["mode","variant"]})}}const p={host:{selector:()=>"host"},anchor:{},wrapper:{selector:()=>":host > div"},text:{selector:()=>r.Z.componentName}},{anchor:d,text:h,host:m,wrapper:u}=p,k=(0,c.qC)((0,s.yk)({mappings:{width:m,textAlign:u,color:[d,{...h,property:r.Z.cssVarList.color}],cursor:d,borderBottomWidth:d,borderBottomStyle:d,borderBottomColor:d}}),s.e4,s.Ae)(i);o(1876),customElements.define(a,k)}}]);
|
@@ -1 +1 @@
|
|
1
|
-
"use strict";(self.webpackChunkDescopeUI=self.webpackChunkDescopeUI||[]).push([[453],{9929:(t,n,e)=>{e.r(n),e.d(n,{LoaderLinear:()=>p});var o=e(
|
1
|
+
"use strict";(self.webpackChunkDescopeUI=self.webpackChunkDescopeUI||[]).push([[453],{9929:(t,n,e)=>{e.r(n),e.d(n,{LoaderLinear:()=>p});var o=e(4877),r=e(3346),a=e(2061);const i=(0,e(4567).iY)("loader-linear");class s extends((0,r.s)({componentName:i,baseSelector:":host > div"})){static get componentName(){return i}constructor(){super(),this.attachShadow({mode:"open"}).innerHTML="\n\t\t<style>\n\t\t\t@keyframes tilt {\n\t\t\t\t0% { transform: translateX(0); }\n\t\t\t\t50% { transform: translateX(400%); }\n\t\t\t}\n\t\t\t:host {\n\t\t\t\tposition: relative;\n\t\t\t\tdisplay: inline-block\n\t\t\t}\n\t\t\tdiv::after {\n\t\t\t\tcontent: '';\n\t\t\t\tanimation-name: tilt;\n\t\t\t\tposition: absolute;\n\t\t\t\tleft: 0;\n\t\t\t}\n\n\t\t\t:host > div {\n\t\t\t\twidth: 100%;\n\t\t\t}\n\t\t</style>\n\t\t<div></div>\n\t"}}const{root:c,after:l,host:d}={root:{},after:{selector:"::after"},host:{selector:()=>":host"}},p=(0,a.qC)((0,o.yk)({mappings:{display:c,width:d,height:[c,l],borderRadius:[c,l],surfaceColor:[{property:"background-color"}],barColor:[{...l,property:"background-color"}],barWidth:{...l,property:"width"},animationDuration:[c,l],animationTimingFunction:[c,l],animationIterationCount:[c,l]}}),o.e4,o.Ae)(s);customElements.define(i,p)}}]);
|
@@ -1 +1 @@
|
|
1
|
-
"use strict";(self.webpackChunkDescopeUI=self.webpackChunkDescopeUI||[]).push([[72],{7603:(t,o,e)=>{e.r(o),e.d(o,{LoaderRadial:()=>a});var r=e(
|
1
|
+
"use strict";(self.webpackChunkDescopeUI=self.webpackChunkDescopeUI||[]).push([[72],{7603:(t,o,e)=>{e.r(o),e.d(o,{LoaderRadial:()=>a});var r=e(4877),n=e(3346),i=e(2061);const s=(0,e(4567).iY)("loader-radial");class p extends((0,n.s)({componentName:s,baseSelector:":host > div"})){constructor(){super(),this.attachShadow({mode:"open"}).innerHTML="\n\t\t<style>\n\t\t\t@keyframes spin {\n\t\t\t\t0% { transform: rotate(0deg); }\n\t\t\t\t100% { transform: rotate(360deg); }\n\t\t\t}\n\t\t\t:host {\n\t\t\t\tposition: relative;\n\t\t\t\tdisplay: inline-flex;\n\t\t\t}\n\t\t\t:host > div {\n\t\t\t\tanimation-name: spin;\n\t\t\t}\n\t\t</style>\n\t\t<div></div>\n\t"}}const a=(0,i.qC)((0,r.yk)({mappings:{display:{},width:{},height:{},spinnerWidth:{property:"border-width"},spinnerStyle:{property:"border-style"},spinnerRadius:{property:"border-radius"},spinnerTopColor:{property:"border-top-color"},spinnerBottomColor:{property:"border-bottom-color"},spinnerRightColor:{property:"border-right-color"},spinnerLeftColor:{property:"border-left-color"},color:{},animationDuration:{},animationTimingFunction:{},animationIterationCount:{}}}),r.e4,r.Ae)(p);customElements.define(s,a)}}]);
|
@@ -1 +1 @@
|
|
1
|
-
"use strict";(self.webpackChunkDescopeUI=self.webpackChunkDescopeUI||[]).push([[984],{4641:(t,e,s)=>{s.r(e),s.d(e,{Logo:()=>d});var n=s(
|
1
|
+
"use strict";(self.webpackChunkDescopeUI=self.webpackChunkDescopeUI||[]).push([[984],{4641:(t,e,s)=>{s.r(e),s.d(e,{Logo:()=>d});var n=s(4877),l=s(3346),o=s(2061);const c=(0,s(4567).iY)("logo");let a;class i extends((0,l.s)({componentName:c,baseSelector:":host > div"})){constructor(){super(),this.attachShadow({mode:"open"}).innerHTML=`\n\t\t<style>\n\t\t\t${a}\n\t\t</style>\n\t\t<div></div>`}}const r=(0,o.qC)((0,n.yk)({mappings:{height:{},width:{},url:{},fallbackUrl:{}}}),n.e4,n.Ae)(i);a=`\n:host {\n\tdisplay: inline-flex;\n}\n:host > div {\n\tdisplay: inline-block;\n\tcontent: var(${r.cssVarList.url}, var(${r.cssVarList.fallbackUrl}));\n}\n`;const d=r;customElements.define(c,d)}}]);
|
@@ -1 +1 @@
|
|
1
|
-
"use strict";(self.webpackChunkDescopeUI=self.webpackChunkDescopeUI||[]).push([[142],{4951:(t,n,e)=>{e.r(n),e.d(n,{NumberField:()=>s}),e(5806);var i=e(
|
1
|
+
"use strict";(self.webpackChunkDescopeUI=self.webpackChunkDescopeUI||[]).push([[142],{4951:(t,n,e)=>{e.r(n),e.d(n,{NumberField:()=>s}),e(5806);var i=e(4877),a=e(4447),r=e(2061);const l=(0,e(4567).iY)("number-field");let d="";const o=(0,r.qC)((0,i.yk)({mappings:{...a.Z}}),i.e4,i.dj,i.Ae)((0,i.DM)({slots:["prefix","suffix"],wrappedEleName:"vaadin-number-field",style:()=>d,excludeAttrsSync:["tabindex"],componentName:l}));d=`\n\t:host {\n\t\tdisplay: inline-block;\n\t}\n\tvaadin-number-field {\n\t\tmargin: 0;\n\t\tpadding: 0;\n\t}\n\tvaadin-number-field::part(input-field) {\n\t\toverflow: hidden;\n\t}\n\tvaadin-number-field[readonly] > input:placeholder-shown {\n\t\topacity: 1;\n\t}\n\tvaadin-number-field input:-webkit-autofill,\n\tvaadin-number-field input:-webkit-autofill::first-line,\n\tvaadin-number-field input:-webkit-autofill:hover,\n\tvaadin-number-field input:-webkit-autofill:active,\n\tvaadin-number-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-number-field > label,\n\tvaadin-number-field::part(input-field) {\n\t\tcursor: pointer;\n\t\tcolor: var(${o.cssVarList.color});\n\t}\n\tvaadin-number-field::part(input-field):focus {\n\t\tcursor: text;\n\t}\n\tvaadin-number-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-number-field[readonly]::part(input-field)::after {\n\t\tborder: 0 solid;\n\t}\n`;const s=o;customElements.define(l,s)}}]);
|
@@ -1 +1 @@
|
|
1
|
-
"use strict";(self.webpackChunkDescopeUI=self.webpackChunkDescopeUI||[]).push([[841],{
|
1
|
+
"use strict";(self.webpackChunkDescopeUI=self.webpackChunkDescopeUI||[]).push([[841],{1688:(t,e,s)=>{s.d(e,{f:()=>o,Z:()=>d});var i=s(2061),n=s(4877),a=s(3346),u=s(4567),r=s(7878);const l=t=>{t?.focus(),t?.setSelectionRange(1,1)},c=t=>{const e=t.replace(/\s/g,"");return e.match(/^\d+$/)?[...e]:[]},o=(0,u.iY)("passcode-internal"),h=["disabled","bordered","size","invalid"],p=((...t)=>(0,i.qC)(n.pY,n.wX,n.li)((0,a.s)(...t)))({componentName:o,baseSelector:":host > div"}),d=class extends p{static get observedAttributes(){return h.concat(p.observedAttributes||[])}static get componentName(){return o}#t=r.C.bind(this,"blur");#e=r.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=c(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}:{}}connectedCallback(){r.t.call(this,"focus",(t=>{t.isTrusted&&this.inputs[0].focus()})),super.connectedCallback?.(),this.initInputs()}getInputIdx(t){return Number.parseInt(t.getAttribute("data-id"),10)}getNextInput(t){const e=this.getInputIdx(t),s=Math.min(e+1,this.inputs.length-1);return this.inputs[s]}getPrevInput(t){const e=this.getInputIdx(t),s=Math.max(e-1,0);return this.inputs[s]}fillDigits(t,e){for(let s=0;s<t.length;s+=1){e.value=t[s]??"";const i=this.getNextInput(e);if(i===e)break;e=i}l(e)}initInputs(){let t,e=this.value;this.inputs.forEach((s=>{r.t.call(this,"blur",(e=>{e.stopImmediatePropagation(),t=setTimeout((()=>{t=null,this.#t()}))}),{element:s}),r.t.call(this,"focus",(e=>{e.stopImmediatePropagation(),clearTimeout(t),t||this.#e()}),{element:s}),r.t.call(this,"input",(t=>{const i=c(s.value);i.length?this.fillDigits(i,s):s.value="",e===this.value&&t.stopImmediatePropagation()}),{element:s}),s.onkeydown=({key:t})=>{e=this.value,"Backspace"===t?(s.selectionStart||s.setSelectionRange(1,1),setTimeout((()=>{l(this.getPrevInput(s))}))):1===t.length&&(s.value="")}}))}attributeChangedCallback(t,e,s){super.attributeChangedCallback?.(t,e,s),e!==s&&h.includes(t)&&this.inputs.forEach((e=>null===s?e.removeAttribute(t):e.setAttribute(t,s)))}}},4775:(t,e,s)=>{s.r(e);var i=s(1688);customElements.define(i.f,i.Z)}}]);
|
@@ -1 +1 @@
|
|
1
|
-
"use strict";(self.webpackChunkDescopeUI=self.webpackChunkDescopeUI||[]).push([[939],{7102:(t,e,n)=>{n.r(e);var i=n(
|
1
|
+
"use strict";(self.webpackChunkDescopeUI=self.webpackChunkDescopeUI||[]).push([[939],{7102:(t,e,n)=>{n.r(e);var i=n(4877),d=n(4447),r=n(1688),a=n(9063),o=n(2061),l=n(4567);const s=(0,l.iY)("passcode"),{borderStyle:c,borderWidth:p,...u}=d.Z,{digitField:f,label:b,requiredIndicator:h}={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:{...u,borderColor:{...f,property:m.borderColor},color:[u.color,b,h]}}),i.e4,i.dj,i.Ae,(t=>class extends t{constructor(){super()}get digits(){return Number.parseInt(this.getAttribute("digits"))||6}connectedCallback(){super.connectedCallback?.();const t=document.createElement("template");t.innerHTML=`\n\t\t\t<${r.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></${r.f}>\n\t\t\t`,this.baseElement.appendChild(t.content.cloneNode(!0)),this.inputElement=this.shadowRoot.querySelector(r.f),(0,l.oP)(this.shadowRoot.host,this.inputElement,{includeAttrs:["required","pattern"]})}}))((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\t\t:host([readonly]) descope-passcode-internal > div {\n\t\t\tpointer-events: none;\n\t\t}\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:s}));n(9357),n(4775),customElements.define(s,x)}}]);
|
@@ -1 +1 @@
|
|
1
|
-
"use strict";(self.webpackChunkDescopeUI=self.webpackChunkDescopeUI||[]).push([[320],{1721:(t,n,a)=>{a.r(n),a.d(n,{PasswordField:()=>l}),a(7056);var i=a(
|
1
|
+
"use strict";(self.webpackChunkDescopeUI=self.webpackChunkDescopeUI||[]).push([[320],{1721:(t,n,a)=>{a.r(n),a.d(n,{PasswordField:()=>l}),a(7056);var i=a(4877),e=a(4447),s=a(2061);const r=(0,a(4567).iY)("password-field");let o="";const d=(0,s.qC)((0,i.yk)({mappings:{...e.Z,revealCursor:[{selector:"::part(reveal-button)::before",property:"cursor"}]}}),i.e4,i.dj,i.Ae)((0,i.DM)({slots:["suffix"],wrappedEleName:"vaadin-password-field",style:()=>o,excludeAttrsSync:["tabindex"],componentName:r}));o=`\n\t:host {\n\t\tdisplay: inline-block;\n\t}\n\tvaadin-password-field {\n\t\tmargin: 0;\n\t\tpadding: 0;\n\t}\n\tvaadin-password-field::part(input-field) {\n\t\toverflow: hidden;\n\t}\n\tvaadin-password-field[readonly] > input:placeholder-shown {\n\t\topacity: 1;\n\t}\n\tvaadin-password-field input:-webkit-autofill,\n\tvaadin-password-field input:-webkit-autofill::first-line,\n\tvaadin-password-field input:-webkit-autofill:hover,\n\tvaadin-password-field input:-webkit-autofill:active,\n\tvaadin-password-field input:-webkit-autofill:focus {\n\t\t-webkit-text-fill-color: var(${d.cssVarList.color});\n\t\tbox-shadow: 0 0 0 var(${d.cssVarList.height}) var(${d.cssVarList.backgroundColor}) inset;\n\t}\n\tvaadin-password-field > label,\n\tvaadin-password-field::part(input-field) {\n\t\tcursor: pointer;\n\t\tcolor: var(${d.cssVarList.color});\n\t}\n\tvaadin-password-field::part(input-field):focus {\n\t\tcursor: text;\n\t}\n\tvaadin-password-field[required]::part(required-indicator)::after {\n\t\tfont-size: "12px";\n\t\tcontent: "*";\n\t\tcolor: var(${d.cssVarList.color});\n\t}\n\tvaadin-password-field[readonly]::part(input-field)::after {\n\t\tborder: 0 solid;\n\t}\n`;const l=d;customElements.define(r,l)}}]);
|
@@ -1 +1 @@
|
|
1
|
-
"use strict";(self.webpackChunkDescopeUI=self.webpackChunkDescopeUI||[]).push([[739],{3774:(t,n,e)=>{e.r(n),e.d(n,{SwitchToggle:()=>s}),e(9515);var a=e(
|
1
|
+
"use strict";(self.webpackChunkDescopeUI=self.webpackChunkDescopeUI||[]).push([[739],{3774:(t,n,e)=>{e.r(n),e.d(n,{SwitchToggle:()=>s}),e(9515);var a=e(4877),i=e(2061);const o=(0,e(4567).iY)("switch-toggle");let r="";const c=(0,i.qC)((0,a.yk)({mappings:{width:{selector:()=>":host"},cursor:[{},{selector:"> label"}]}}),a.e4,a.dj,a.Ae)((0,a.DM)({slots:[],wrappedEleName:"vaadin-checkbox",style:()=>r,excludeAttrsSync:["tabindex"],componentName:o}));r=`\n\t:host {\n\t\tdisplay: inline-block;\n\t}\n\t\n\t:host {\n\t\t--margin: 7px;\n\t\t--width: var(${c.cssVarList.width});\n\t\t--height: calc(var(--width) / 2);\n\t\t--radius: var(--height);\n\t\t--knobSize: calc(var(--height) - 5px);\n\t\t--bgColor: #fff;\n\t\t--knobBgColor: #000;\n\t}\n\tvaadin-checkbox : {\n\t\twidth: 100%;\n\t}\n\tvaadin-checkbox>label {\n\t\tcursor: pointer;\n\t\tborder: 1px solid;\n\t\ttext-indent: -99999px;\n\t\tdisplay: block;\n\t\tposition: relative;\t\t\t\n\t\twidth: var(--width);\n\t\theight: var(--height);\n\t\tbackground: var(--bgColor);\n\t\tborder-radius: var(--radius);\n\t}\n\tvaadin-checkbox>label::after {\n\t\tcontent: '';\n\t\tposition: absolute;\n\t\ttransition: 0.3s;\n\t\ttop: var(--margin);\n\t\tleft: var(--margin);\n\t\twidth: var(--knobSize);\n\t\theight: var(--knobSize);\n\t\tbackground: var(--knobBgColor);\n\t\tborder-radius: var(--knobSize);\n\t}\n\tvaadin-checkbox::part(checkbox) {\n\t\theight: 0;\n\t\twidth: 0;\n\t\tvisibility: hidden;\n\t\tmargin: 0;\n\t}\n\tvaadin-checkbox[checked]>label::after {\n\t\ttransform: translateX(-100%);\n\t\tleft: calc(100% - var(--margin));\n\t}\n\tvaadin-checkbox[active]>label::after {\n\t\twidth: calc(var(--knobSize) + 15px);\n\t}\n`;const s=c;customElements.define(o,s)}}]);
|
@@ -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(
|
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(4877),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 +1 @@
|
|
1
|
-
"use strict";(self.webpackChunkDescopeUI=self.webpackChunkDescopeUI||[]).push([[934],{9063:(t,e,n)=>{n.d(e,{Z:()=>s,f:()=>d});var i=n(
|
1
|
+
"use strict";(self.webpackChunkDescopeUI=self.webpackChunkDescopeUI||[]).push([[934],{9063:(t,e,n)=>{n.d(e,{Z:()=>s,f:()=>d});var i=n(4877),a=n(4447),l=n(2061);const d=(0,n(4567).iY)("text-field");let o="";const r=(0,l.qC)((0,i.yk)({mappings:a.Z}),i.e4,i.dj,i.Ae)((0,i.DM)({slots:["prefix","suffix"],wrappedEleName:"vaadin-text-field",style:()=>o,excludeAttrsSync:["tabindex"],componentName:d}));o=`\n\t:host {\n\t\tdisplay: inline-block;\n\t}\n\n\tvaadin-text-field {\n\t\tmargin: 0;\n\t\tpadding: 0;\n\t}\n\tvaadin-text-field::part(input-field) {\n\t\toverflow: hidden;\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(${r.cssVarList.color});\n\t\tbox-shadow: 0 0 0 var(${r.cssVarList.height}) var(${r.cssVarList.backgroundColor}) inset;\n\t}\n\tvaadin-text-field > label,\n\tvaadin-text-field::part(input-field) {\n\t\tcursor: pointer;\n\t\tcolor: var(${r.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(${r.cssVarList.color});\n\t}\n\tvaadin-text-field[readonly]::part(input-field)::after {\n\t\tborder: 0 solid;\n\t}\n`;const s=r},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 +1 @@
|
|
1
|
-
"use strict";(self.webpackChunkDescopeUI=self.webpackChunkDescopeUI||[]).push([[528],{8801:(t,e,n)=>{n.d(e,{Z:()=>c,f:()=>i});var o=n(
|
1
|
+
"use strict";(self.webpackChunkDescopeUI=self.webpackChunkDescopeUI||[]).push([[528],{8801:(t,e,n)=>{n.d(e,{Z:()=>c,f:()=>i});var o=n(4877),s=n(3346),l=n(2061);const i=(0,n(4567).iY)("text");class r extends((0,s.s)({componentName:i,baseSelector:":host > slot"})){constructor(){super(),this.attachShadow({mode:"open"}).innerHTML="\n\t\t<style>\n\t\t\t:host {\n\t\t\t\tdisplay: inline-block;\n\t\t\t}\n\t\t\t:host > slot {\n\t\t\t\twidth: 100%;\n\t\t\t\tdisplay: inline-block;\n\t\t\t}\n\t\t</style>\n\t\t<slot></slot>\n\t\t"}}const c=(0,l.qC)((0,o.yk)({mappings:{fontFamily:{},lineHeight:{},fontStyle:{},fontSize:{},fontWeight:{},width:{selector:()=>":host"},color:{},letterSpacing:{},textShadow:{},borderWidth:{},borderStyle:{},borderColor:{},textTransform:{},textAlign:{}}}),o.e4,o.Ae)(r)},1876:(t,e,n)=>{n.r(e),n.d(e,{Text:()=>o.Z});var o=n(8801);customElements.define(o.f,o.Z)}}]);
|
package/dist/umd/index.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.DescopeUI=t():e.DescopeUI=t()}(self,(()=>(()=>{var e,t,o,r={534:(e,t,o)=>{var r={"./descope-button/index.js":[3029,840,767,211,513,729,
|
1
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.DescopeUI=t():e.DescopeUI=t()}(self,(()=>(()=>{var e,t,o,r={534:(e,t,o)=>{var r={"./descope-button/index.js":[3029,840,767,211,513,729,809,662],"./descope-checkbox/index.js":[7904,840,786,208,767,515,809,761],"./descope-combo-box/index.js":[9258,840,786,208,233,824,314,809,483],"./descope-container/index.js":[147,809,317],"./descope-date-picker/index.js":[2552,840,786,208,233,767,211,824,513,541,809,17],"./descope-divider/index.js":[6446,809,528,178],"./descope-email-field/index.js":[689,840,786,208,233,422,725,437,809,447,760],"./descope-link/index.js":[8029,809,528,58],"./descope-loader-linear/index.js":[9929,809,453],"./descope-loader-radial/index.js":[7603,809,72],"./descope-logo/index.js":[4641,809,984],"./descope-number-field/index.js":[4951,840,786,208,233,422,806,809,447,142],"./descope-passcode/descope-passcode-internal/index.js":[4775,809,841],"./descope-passcode/index.js":[7102,840,786,208,233,422,725,789,809,447,841,934,939],"./descope-password-field/index.js":[1721,840,786,208,233,422,767,725,211,56,809,447,320],"./descope-switch-toggle/index.js":[3774,840,786,208,767,515,809,739],"./descope-text-area/index.js":[178,840,786,233,422,101,809,322],"./descope-text-field/index.js":[9357,840,786,208,233,422,725,789,809,447,934],"./descope-text/index.js":[1876,809,528]};function s(e){if(!o.o(r,e))return Promise.resolve().then((()=>{var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}));var t=r[e],s=t[0];return Promise.all(t.slice(1).map(o.e)).then((()=>o(s)))}s.keys=()=>Object.keys(r),s.id=534,e.exports=s},5561:(e,t,o)=>{"use strict";o.r(t),o.d(t,{componentsThemeManager:()=>r});const r=new class{static mountOnPropName="DescopeThemeManager";#e={};#t="light";#o=new Set;#r(){this.#o.forEach((e=>e?.()))}get currentThemeName(){return this.#t}set currentThemeName(e){this.#t=e,this.#r()}get currentTheme(){return this.#e[this.currentThemeName]}onCurrentThemeChange(e){return this.#o.add(e),()=>{this.#o.delete(e)}}set themes(e){this.#e=e,this.#r()}}},7507:(e,t,o)=>{const{componentsThemeManager:r}=o(5561),s=o(534);e.exports=s.keys().reduce(((e,t)=>(e[t.replace(/.*?([^\/]+)\/index\.js$/,"$1")]=()=>s(t),e)),{}),e.exports.componentsThemeManager=r}},s={};function n(e){var t=s[e];if(void 0!==t)return t.exports;var o=s[e]={exports:{}};return r[e](o,o.exports,n),o.exports}n.m=r,e=[],n.O=(t,o,r,s)=>{if(!o){var i=1/0;for(p=0;p<e.length;p++){for(var[o,r,s]=e[p],d=!0,c=0;c<o.length;c++)(!1&s||i>=s)&&Object.keys(n.O).every((e=>n.O[e](o[c])))?o.splice(c--,1):(d=!1,s<i&&(i=s));if(d){e.splice(p--,1);var a=r();void 0!==a&&(t=a)}}return t}s=s||0;for(var p=e.length;p>0&&e[p-1][2]>s;p--)e[p]=e[p-1];e[p]=[o,r,s]},n.F={},n.E=e=>{Object.keys(n.F).map((t=>{n.F[t](e)}))},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.f={},n.e=e=>Promise.all(Object.keys(n.f).reduce(((t,o)=>(n.f[o](e,t),t)),[])),n.u=e=>(({17:"descope-date-picker-index-js",58:"descope-link-index-js",72:"descope-loader-radial-index-js",142:"descope-number-field-index-js",178:"descope-divider-index-js",317:"descope-container-index-js",320:"descope-password-field-index-js",322:"descope-text-area-index-js",453:"descope-loader-linear-index-js",483:"descope-combo-box-index-js",528:"descope-text-index-js",662:"descope-button-index-js",739:"descope-switch-toggle-index-js",760:"descope-email-field-index-js",761:"descope-checkbox-index-js",841:"descope-passcode-descope-passcode-internal-index-js",934:"descope-text-field-index-js",939:"descope-passcode-index-js",984:"descope-logo-index-js"}[e]||e)+".js"),n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),t={},o="DescopeUI:",n.l=(e,r,s,i)=>{if(t[e])t[e].push(r);else{var d,c;if(void 0!==s)for(var a=document.getElementsByTagName("script"),p=0;p<a.length;p++){var l=a[p];if(l.getAttribute("src")==e||l.getAttribute("data-webpack")==o+s){d=l;break}}d||(c=!0,(d=document.createElement("script")).charset="utf-8",d.timeout=120,n.nc&&d.setAttribute("nonce",n.nc),d.setAttribute("data-webpack",o+s),d.src=e),t[e]=[r];var u=(o,r)=>{d.onerror=d.onload=null,clearTimeout(m);var s=t[e];if(delete t[e],d.parentNode&&d.parentNode.removeChild(d),s&&s.forEach((e=>e(r))),o)return o(r)},m=setTimeout(u.bind(null,void 0,{type:"timeout",target:d}),12e4);d.onerror=u.bind(null,d.onerror),d.onload=u.bind(null,d.onload),c&&document.head.appendChild(d)}},n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e;n.g.importScripts&&(e=n.g.location+"");var t=n.g.document;if(!e&&t&&(t.currentScript&&(e=t.currentScript.src),!e)){var o=t.getElementsByTagName("script");o.length&&(e=o[o.length-1].src)}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),n.p=e})(),(()=>{var e={826:0};n.f.j=(t,o)=>{var r=n.o(e,t)?e[t]:void 0;if(0!==r)if(r)o.push(r[2]);else{var s=new Promise(((o,s)=>r=e[t]=[o,s]));o.push(r[2]=s);var i=n.p+n.u(t),d=new Error;n.l(i,(o=>{if(n.o(e,t)&&(0!==(r=e[t])&&(e[t]=void 0),r)){var s=o&&("load"===o.type?"missing":o.type),i=o&&o.target&&o.target.src;d.message="Loading chunk "+t+" failed.\n("+s+": "+i+")",d.name="ChunkLoadError",d.type=s,d.request=i,r[1](d)}}),"chunk-"+t,t)}},n.F.j=t=>{if(!n.o(e,t)||void 0===e[t]){e[t]=null;var o=document.createElement("link");n.nc&&o.setAttribute("nonce",n.nc),o.rel="prefetch",o.as="script",o.href=n.p+n.u(t),document.head.appendChild(o)}},n.O.j=t=>0===e[t];var t=(t,o)=>{var r,s,[i,d,c]=o,a=0;if(i.some((t=>0!==e[t]))){for(r in d)n.o(d,r)&&(n.m[r]=d[r]);if(c)var p=c(n)}for(t&&t(o);a<i.length;a++)s=i[a],n.o(e,s)&&e[s]&&e[s][0](),e[s]=0;return n.O(p)},o=self.webpackChunkDescopeUI=self.webpackChunkDescopeUI||[];o.forEach(t.bind(null,0)),o.push=t.bind(null,o.push.bind(o))})(),n.O(0,[826],(()=>{[840,767,211,513,729,809,662,786,208,515,761,233,824,314,483,317,541,17,528,178,422,725,437,447,760,58,453,72,984,806,142,841,789,934,939,56,320,739,101,322].map(n.E)}),5);var i=n(7507);return n.O(i)})()));
|
package/package.json
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
import { compose } from "../helpers";
|
2
|
-
import {
|
2
|
+
import { createDispatchEvent } from "../helpers/mixinsHelpers";
|
3
|
+
import { componentNameValidationMixin, hoverableMixin, normalizeBooleanAttributesMixin } from "../mixins";
|
3
4
|
|
4
5
|
export const createBaseClass = ({ componentName, baseSelector = '' }) => {
|
5
6
|
class DescopeBaseClass extends HTMLElement {
|
@@ -8,10 +9,17 @@ export const createBaseClass = ({ componentName, baseSelector = '' }) => {
|
|
8
9
|
}
|
9
10
|
|
10
11
|
#baseElement;
|
12
|
+
|
13
|
+
#dispatchConnected = createDispatchEvent.bind(this, 'connected')
|
14
|
+
#dispatchDisconnected = createDispatchEvent.bind(this, 'disconnected')
|
15
|
+
|
16
|
+
// base selector is the selector for the component wrapper,
|
17
|
+
// it's the highest element that is relevant for the layout
|
11
18
|
get baseSelector() {
|
12
19
|
return baseSelector
|
13
20
|
}
|
14
21
|
|
22
|
+
// this is the base element, which returned by querying the base selector
|
15
23
|
get baseElement() {
|
16
24
|
this.#baseElement ??= this.baseSelector ?
|
17
25
|
this.rootElement.querySelector(this.baseSelector) :
|
@@ -20,10 +28,29 @@ export const createBaseClass = ({ componentName, baseSelector = '' }) => {
|
|
20
28
|
return this.#baseElement
|
21
29
|
}
|
22
30
|
|
31
|
+
// this is the component root level element,
|
32
|
+
// it can be either a shadow root or the component's node from the light DOM
|
23
33
|
get rootElement() {
|
24
34
|
return this.shadowRoot || this
|
25
35
|
}
|
36
|
+
|
37
|
+
connectedCallback() {
|
38
|
+
super.connectedCallback?.();
|
39
|
+
|
40
|
+
// we are waiting for all components to listen before dispatching
|
41
|
+
setTimeout(this.#dispatchConnected)
|
42
|
+
}
|
43
|
+
|
44
|
+
disconnectedCallback() {
|
45
|
+
super.disconnectedCallback?.();
|
46
|
+
|
47
|
+
this.#dispatchDisconnected()
|
48
|
+
}
|
26
49
|
}
|
27
50
|
|
28
|
-
return compose(
|
51
|
+
return compose(
|
52
|
+
componentNameValidationMixin,
|
53
|
+
hoverableMixin,
|
54
|
+
normalizeBooleanAttributesMixin
|
55
|
+
)(DescopeBaseClass)
|
29
56
|
}
|
@@ -0,0 +1,9 @@
|
|
1
|
+
import { compose } from "../helpers";
|
2
|
+
import { changeMixin, focusMixin, inputValidationMixin, normalizeBooleanAttributesMixin } from "../mixins";
|
3
|
+
import { createBaseClass } from "./createBaseClass";
|
4
|
+
|
5
|
+
export const createBaseInputClass = (...args) => compose(
|
6
|
+
focusMixin,
|
7
|
+
inputValidationMixin,
|
8
|
+
changeMixin,
|
9
|
+
)(createBaseClass(...args))
|
@@ -36,7 +36,7 @@ const customMixin = (superclass) =>
|
|
36
36
|
></${descopeInternalComponentName}>
|
37
37
|
`;
|
38
38
|
|
39
|
-
this.
|
39
|
+
this.baseElement.appendChild(template.content.cloneNode(true));
|
40
40
|
|
41
41
|
this.inputElement = this.shadowRoot.querySelector(descopeInternalComponentName);
|
42
42
|
|
@@ -1,26 +1,30 @@
|
|
1
|
-
import
|
1
|
+
import { createBaseInputClass } from '../../../baseClasses/createBaseInputClass';
|
2
2
|
import { getComponentName } from '../../../helpers/componentHelpers';
|
3
|
+
import { createDispatchEvent, createEventListener } from '../../../helpers/mixinsHelpers';
|
3
4
|
import { getSanitizedCharacters, focusElement } from './helpers';
|
4
5
|
|
5
6
|
export const componentName = getComponentName('passcode-internal');
|
6
7
|
|
8
|
+
const observedAttributes = [
|
9
|
+
'disabled',
|
10
|
+
'bordered',
|
11
|
+
'size',
|
12
|
+
'invalid'
|
13
|
+
]
|
14
|
+
|
15
|
+
const BaseInputClass = createBaseInputClass({ componentName, baseSelector: ':host > div' })
|
16
|
+
|
7
17
|
class PasscodeInternal extends BaseInputClass {
|
8
18
|
static get observedAttributes() {
|
9
|
-
return [
|
10
|
-
...(BaseInputClass.observedAttributes || []),
|
11
|
-
'disabled',
|
12
|
-
'bordered',
|
13
|
-
'size',
|
14
|
-
];
|
19
|
+
return observedAttributes.concat(BaseInputClass.observedAttributes || []);
|
15
20
|
}
|
16
21
|
|
17
22
|
static get componentName() {
|
18
23
|
return componentName;
|
19
24
|
}
|
20
25
|
|
21
|
-
#
|
22
|
-
#
|
23
|
-
#boundHandleBlur = this.#handleBlur.bind(this)
|
26
|
+
#dispatchBlur = createDispatchEvent.bind(this, 'blur')
|
27
|
+
#dispatchFocus = createDispatchEvent.bind(this, 'focus')
|
24
28
|
|
25
29
|
constructor() {
|
26
30
|
super();
|
@@ -29,7 +33,7 @@ class PasscodeInternal extends BaseInputClass {
|
|
29
33
|
st-width="35px"
|
30
34
|
data-id=${idx}
|
31
35
|
type="tel"
|
32
|
-
autocomplete="
|
36
|
+
autocomplete="off"
|
33
37
|
></descope-text-field>
|
34
38
|
`)
|
35
39
|
|
@@ -39,8 +43,6 @@ class PasscodeInternal extends BaseInputClass {
|
|
39
43
|
</div>
|
40
44
|
`;
|
41
45
|
|
42
|
-
this.baseSelector = ':host > div';
|
43
|
-
|
44
46
|
this.inputs = Array.from(this.querySelectorAll('descope-text-field'))
|
45
47
|
}
|
46
48
|
|
@@ -66,16 +68,6 @@ class PasscodeInternal extends BaseInputClass {
|
|
66
68
|
return `^$|^\\d{${this.digits},}$`
|
67
69
|
}
|
68
70
|
|
69
|
-
#handleInvalid() {
|
70
|
-
if (this.hasAttribute('invalid')) {
|
71
|
-
this.inputs.forEach(input => input.setAttribute('invalid', 'true'))
|
72
|
-
}
|
73
|
-
}
|
74
|
-
|
75
|
-
#handleValid() {
|
76
|
-
this.inputs.forEach(input => input.removeAttribute('invalid'))
|
77
|
-
}
|
78
|
-
|
79
71
|
getValidity() {
|
80
72
|
if (this.isRequired && !this.value) {
|
81
73
|
return { valueMissing: true };
|
@@ -88,25 +80,17 @@ class PasscodeInternal extends BaseInputClass {
|
|
88
80
|
}
|
89
81
|
};
|
90
82
|
|
91
|
-
onFocus(){
|
92
|
-
this.inputs[0].focus()
|
93
|
-
}
|
94
|
-
|
95
83
|
connectedCallback() {
|
84
|
+
// we are adding listeners before calling to super because it's stopping the events
|
85
|
+
createEventListener.call(this, 'focus', (e) => {
|
86
|
+
// we want to ignore focus events we are dispatching
|
87
|
+
if (e.isTrusted)
|
88
|
+
this.inputs[0].focus()
|
89
|
+
})
|
90
|
+
|
96
91
|
super.connectedCallback?.();
|
97
92
|
|
98
93
|
this.initInputs()
|
99
|
-
|
100
|
-
this.addEventListener('invalid', this.#boundHandleInvalid)
|
101
|
-
this.addEventListener('valid', this.#boundHandleValid)
|
102
|
-
this.addEventListener('blur', this.#boundHandleBlur)
|
103
|
-
}
|
104
|
-
|
105
|
-
disconnectedCallback() {
|
106
|
-
super.connectedCallback?.();
|
107
|
-
this.removeEventListener('invalid', this.#boundHandleInvalid)
|
108
|
-
this.removeEventListener('valid', this.#boundHandleValid)
|
109
|
-
this.removeEventListener('blur', this.#boundHandleBlur)
|
110
94
|
}
|
111
95
|
|
112
96
|
getInputIdx(inputEle) {
|
@@ -138,33 +122,60 @@ class PasscodeInternal extends BaseInputClass {
|
|
138
122
|
focusElement(currentInput);
|
139
123
|
};
|
140
124
|
|
141
|
-
#handleBlur() {
|
142
|
-
this.#handleInvalid()
|
143
|
-
}
|
144
|
-
|
145
125
|
initInputs() {
|
126
|
+
let prevVal = this.value
|
127
|
+
let blurTimerId
|
128
|
+
|
146
129
|
this.inputs.forEach((input) => {
|
147
|
-
|
130
|
+
// in order to simulate blur on the input
|
131
|
+
// we are checking if focus on one of the digits happened immediately after blur on another digit
|
132
|
+
// if not, the component is no longer focused and we should simulate blur
|
133
|
+
createEventListener.call(this, 'blur', (e) => {
|
134
|
+
e.stopImmediatePropagation();
|
135
|
+
|
136
|
+
blurTimerId = setTimeout(() => {
|
137
|
+
blurTimerId = null
|
138
|
+
this.#dispatchBlur()
|
139
|
+
});
|
140
|
+
}, { element: input })
|
141
|
+
|
142
|
+
createEventListener.call(this, 'focus', (e) => {
|
143
|
+
e.stopImmediatePropagation();
|
144
|
+
|
145
|
+
clearTimeout(blurTimerId)
|
146
|
+
if (!blurTimerId) {
|
147
|
+
this.#dispatchFocus()
|
148
|
+
}
|
149
|
+
}, { element: input })
|
150
|
+
|
151
|
+
createEventListener.call(this, 'input', (e) => {
|
148
152
|
const charArr = getSanitizedCharacters(input.value);
|
149
153
|
|
150
154
|
if (!charArr.length) {
|
151
155
|
// if we got an invalid value we want to clear the input
|
152
156
|
input.value = '';
|
153
|
-
if (e.data === null) {
|
154
|
-
// if the user deleted the char, we want to focus the prev digit
|
155
|
-
focusElement(this.getPrevInput(input));
|
156
|
-
}
|
157
157
|
}
|
158
158
|
else this.fillDigits(charArr, input);
|
159
|
-
|
159
|
+
|
160
|
+
// we want to stop input events if the value wasn't change
|
161
|
+
if (prevVal === this.value) {
|
162
|
+
e.stopImmediatePropagation();
|
163
|
+
}
|
164
|
+
}, { element: input })
|
160
165
|
|
161
166
|
input.onkeydown = ({ key }) => {
|
167
|
+
prevVal = this.value
|
168
|
+
|
162
169
|
// when user deletes a digit, we want to focus the previous digit
|
163
170
|
if (key === 'Backspace') {
|
171
|
+
// if the cursor is at 0, we want to move it to 1, so the value will be deleted
|
172
|
+
if (!input.selectionStart) {
|
173
|
+
input.setSelectionRange(1, 1);
|
174
|
+
}
|
164
175
|
setTimeout(() => {
|
165
176
|
focusElement(this.getPrevInput(input));
|
166
177
|
});
|
167
|
-
} else if (key.
|
178
|
+
} else if (key.length === 1) { // we want only characters and not command keys
|
168
179
|
input.value = ''; // we are clearing the previous value so we can override it with the new value
|
169
180
|
}
|
170
181
|
};
|
@@ -174,9 +185,14 @@ class PasscodeInternal extends BaseInputClass {
|
|
174
185
|
attributeChangedCallback(attrName, oldValue, newValue) {
|
175
186
|
super.attributeChangedCallback?.(attrName, oldValue, newValue)
|
176
187
|
|
188
|
+
// sync attributes to inputs
|
177
189
|
if (oldValue !== newValue) {
|
178
|
-
if (
|
179
|
-
this.inputs.forEach(
|
190
|
+
if (observedAttributes.includes(attrName)) {
|
191
|
+
this.inputs.forEach(
|
192
|
+
(input) => newValue === null ?
|
193
|
+
input.removeAttribute(attrName) :
|
194
|
+
input.setAttribute(attrName, newValue)
|
195
|
+
)
|
180
196
|
}
|
181
197
|
}
|
182
198
|
}
|
@@ -1,18 +1,35 @@
|
|
1
|
-
// move create event to here
|
2
1
|
|
2
|
+
// create a dispatch event function that also calls to the onevent function in case it's set
|
3
3
|
// usage example:
|
4
|
-
// #dispatchSomething = createDispatchEvent.bind(this, 'something')
|
5
|
-
|
6
|
-
|
7
|
-
|
4
|
+
// #dispatchSomething = createDispatchEvent.bind(this, 'something' { ...options })
|
5
|
+
// this will dispatch a new event when called, but also call to "onsomething"
|
6
|
+
export function createDispatchEvent(eventName, options = {}) {
|
7
|
+
const event = new Event(eventName, options)
|
8
|
+
|
9
|
+
this[`on${eventName}`]?.(event); // in case we got an event callback as property
|
10
|
+
this.dispatchEvent(event);
|
8
11
|
}
|
9
12
|
|
13
|
+
// add an event listener that is automatically removed on disconnect
|
10
14
|
// usage example:
|
11
|
-
//
|
12
|
-
export function createEventListener(event, callback) {
|
15
|
+
// createEventListener.call(this,'change', this.onChange, { element? , ...options })
|
16
|
+
export function createEventListener(event, callback, { element, ...options } = {}) {
|
17
|
+
const timerId = setTimeout(() => console.warn(this.localName, 'is not using "createBaseClass", events will not be removed automatically on disconnect'), 2000)
|
18
|
+
|
19
|
+
this.addEventListener('connected', () => {
|
20
|
+
clearTimeout(timerId);
|
21
|
+
}, { once: true })
|
22
|
+
|
23
|
+
const targetEle = element || this;
|
13
24
|
const boundCallback = callback.bind(this);
|
14
25
|
|
15
|
-
|
26
|
+
const onDisconnect = () => {
|
27
|
+
targetEle.removeEventListener(event, boundCallback);
|
28
|
+
}
|
29
|
+
|
30
|
+
this.addEventListener('disconnected', onDisconnect, { once: true })
|
31
|
+
|
32
|
+
targetEle.addEventListener(event, boundCallback, options);
|
16
33
|
|
17
|
-
return
|
34
|
+
return onDisconnect
|
18
35
|
}
|