@descope/web-components-ui 3.2.2 → 3.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (26) hide show
  1. package/dist/cjs/index.cjs.js +87 -10
  2. package/dist/cjs/index.cjs.js.map +1 -1
  3. package/dist/index.esm.js +106 -12
  4. package/dist/index.esm.js.map +1 -1
  5. package/dist/umd/DescopeDev.js +1 -1
  6. package/dist/umd/DescopeDev.js.map +1 -1
  7. package/dist/umd/descope-hybrid-field-index-js.js +2 -2
  8. package/dist/umd/descope-hybrid-field-index-js.js.map +1 -1
  9. package/dist/umd/descope-recaptcha-index-js.js +1 -1
  10. package/dist/umd/descope-recaptcha-index-js.js.map +1 -1
  11. package/dist/umd/index.js +1 -1
  12. package/dist/umd/phone-fields-descope-phone-field-descope-phone-field-internal-index-js.js +1 -1
  13. package/dist/umd/phone-fields-descope-phone-field-descope-phone-field-internal-index-js.js.map +1 -1
  14. package/dist/umd/phone-fields-descope-phone-field-index-js.js +1 -1
  15. package/dist/umd/phone-fields-descope-phone-field-index-js.js.map +1 -1
  16. package/dist/umd/phone-fields-descope-phone-input-box-field-descope-phone-input-box-internal-index-js.js +1 -1
  17. package/dist/umd/phone-fields-descope-phone-input-box-field-descope-phone-input-box-internal-index-js.js.map +1 -1
  18. package/dist/umd/phone-fields-descope-phone-input-box-field-index-js.js +1 -1
  19. package/dist/umd/phone-fields-descope-phone-input-box-field-index-js.js.map +1 -1
  20. package/package.json +32 -32
  21. package/src/components/descope-hybrid-field/HybridFieldClass.js +4 -2
  22. package/src/components/descope-recaptcha/RecaptchaClass.js +81 -8
  23. package/src/components/phone-fields/descope-phone-field/PhoneFieldClass.js +1 -0
  24. package/src/components/phone-fields/descope-phone-field/descope-phone-field-internal/PhoneFieldInternal.js +12 -2
  25. package/src/components/phone-fields/descope-phone-input-box-field/PhoneFieldInputBoxClass.js +1 -0
  26. package/src/components/phone-fields/descope-phone-input-box-field/descope-phone-input-box-internal/PhoneFieldInternalInputBox.js +7 -0
@@ -1,5 +1,5 @@
1
1
  /*! For license information please see descope-hybrid-field-index-js.js.LICENSE.txt */
2
- "use strict";(self.webpackChunk_descope_web_components_ui=self.webpackChunk_descope_web_components_ui||[]).push([[7299],{54316(e,t,i){i.r(t),i.d(t,{EmailFieldClass:()=>f,componentName:()=>g}),i(52733);var n=i(47642),r=i(87550);const o=r.AH`
2
+ "use strict";(self.webpackChunk_descope_web_components_ui=self.webpackChunk_descope_web_components_ui||[]).push([[7299],{54316(e,t,i){i.r(t),i.d(t,{EmailFieldClass:()=>y,componentName:()=>g}),i(52733);var n=i(47642),r=i(87550);const o=r.AH`
3
3
  :host([dir='rtl']) [part='input-field'] ::slotted(input) {
4
4
  --_lumo-text-field-overflow-mask-image: linear-gradient(to left, transparent, #000 1.25em);
5
5
  }
@@ -16,5 +16,5 @@
16
16
  direction: rtl;
17
17
  text-align: left;
18
18
  }
19
- `;(0,r.SF)("vaadin-email-field",l,{moduleId:"vaadin-email-field-styles"});class p extends a.A{static get is(){return"vaadin-email-field"}constructor(){super(),this._setType("email"),this.pattern="^([a-zA-Z0-9_\\.\\-+])+@[a-zA-Z0-9\\-.]+\\.[a-zA-Z0-9\\-]{2,}$"}ready(){super.ready(),this.inputElement&&(this.inputElement.autocapitalize="off")}}(0,s.X)(p);var u=i(79365),d=i(6424),h=i(9696),c=i(97810),m=i(73551);const g=(0,c.xE)("email-field"),f=(0,h.Zz)((0,u.RF)({mappings:d.A}),u.VO,(0,u.RV)({inputType:"email",inputName:"email",autocompleteType:"username",includeAttrs:["disabled","readonly","pattern"]}),(0,u.OZ)({proxyProps:["value","selectionStart"],useProxyTargets:!0}),u.tQ,e=>class extends e{init(){super.init?.(),this.baseElement.setAttribute("pattern","^[\\w\\.\\%\\+\\-']+@[\\w\\.\\-]+\\.[A-Za-z]{2,}$"),this.getAttribute("autocomplete")||this.setAttribute("autocomplete","username"),this.createExternalInput()}})((0,u.tz)({slots:["","suffix"],wrappedEleName:"vaadin-email-field",style:()=>`\n\t\t\t:host {\n\t\t\t\tdisplay: inline-block;\n\t\t\t\tmax-width: 100%;\n\t\t\t\tpadding: calc(var(${f.cssVarList.inputOutlineWidth}) + var(${f.cssVarList.inputOutlineOffset}));\n box-sizing: border-box;\n\t\t\t}\n ${(0,m.$J)("vaadin-email-field")}\n\t\t\t${(0,m.cy)(f.cssVarList)}\n\t\t\t${(0,m.LJ)("vaadin-email-field",f.cssVarList)}\n ${(0,m.Kl)()}\n\n vaadin-email-field[label-type="floating"]:not([focused])[readonly] > input:placeholder-shown {\n opacity: 0;\n }\n vaadin-email-field[label-type="floating"]:not([focused])[disabled] > input:placeholder-shown {\n opacity: 0;\n }\n\n :host ::slotted(*) {\n -webkit-mask-image: none;\n }\n\n vaadin-email-field[external-input="true"] > input:not(:placeholder-shown) {\n opacity: 0;\n }\n\t\t`,excludeAttrsSync:["tabindex","style"],componentName:g}));customElements.define(g,f)},44966(e,t,i){i.r(t),i.d(t,{HybridFieldClass:()=>f,componentName:()=>d}),i(54316),i(98136),i(30057);var n=i(25964),r=i(79365),o=i(81365),s=i(9696),a=i(97810);const l=/[^\d\s+\-()]/;var p=i(81808),u=i(16306);const d=(0,a.xE)("hybrid-field"),h={shared:["label","bordered","full-width","label-type","size","disabled","readonly","required","st-host-direction","st-error-message-icon","st-error-message-icon-size","st-error-message-icon-padding"],email:["placeholder","data-errormessage-value-missing-email","data-errormessage-pattern-mismatch-email","external-input"],phone:{countryCode:["phone-input-label","country-input-label","country-input-placeholder","restrict-countries","default-code","phone-minlength","phone-format-value","phone-strict-validation","data-errormessage-value-missing-phone"],inputBox:["restrict-countries","default-code","phone-minlength","phone-format-value","phone-strict-validation","data-errormessage-value-missing-phone"]}},c={email:{"data-errormessage-value-missing-email":"data-errormessage-value-missing","data-errormessage-pattern-mismatch-email":"data-errormessage-pattern-mismatch"},phone:{"phone-input-label":"label","phone-minlength":"minlength","phone-format-value":"format-value","phone-strict-validation":"strict-validation","data-errormessage-value-missing-phone":"data-errormessage-value-missing"}},m="descope-phone-field",g=(0,o.q)({componentName:d,baseSelector:"div"}),f=(0,s.Zz)((0,r.RF)({componentNameOverride:(0,a.xE)("input-wrapper")}),(0,r.RF)({mappings:{hostWidth:{selector:()=>":host",property:"width"},hostDirection:[{selector:()=>"descope-email-field",property:"direction"},{selector:()=>"descope-phone-field",property:"direction"},{selector:()=>"descope-phone-input-box-field",property:"direction"}],errorMessageIcon:[{selector:()=>p.NF.componentName,property:p.NF.cssVarList.errorMessageIcon},{selector:()=>u.Ul.componentName,property:u.Ul.cssVarList.errorMessageIcon}],errorMessageIconSize:[{selector:()=>p.NF.componentName,property:p.NF.cssVarList.errorMessageIconSize},{selector:()=>u.Ul.componentName,property:u.Ul.cssVarList.errorMessageIconSize}],errorMessageIconPadding:[{selector:()=>p.NF.componentName,property:p.NF.cssVarList.errorMessageIconPadding},{selector:()=>u.Ul.componentName,property:u.Ul.cssVarList.errorMessageIconPadding}],errorMessageIconRepeat:[{selector:()=>p.NF.componentName,property:p.NF.cssVarList.errorMessageIconRepeat},{selector:()=>u.Ul.componentName,property:u.Ul.cssVarList.errorMessageIconRepeat}],errorMessageIconPosition:[{selector:()=>p.NF.componentName,property:p.NF.cssVarList.errorMessageIconPosition},{selector:()=>u.Ul.componentName,property:u.Ul.cssVarList.errorMessageIconPosition}],errorMessageFontSize:[{selector:()=>p.NF.componentName,property:p.NF.cssVarList.errorMessageFontSize},{selector:()=>u.Ul.componentName,property:u.Ul.cssVarList.errorMessageFontSize}]}}),r.VO,r.tQ)(class extends g{#e=!1;#t;constructor(){super(),this.attachShadow({mode:"open"}).innerHTML=`\n <div class="wrapper">\n <descope-email-field external-input="${this.isExternalInput}"></descope-email-field>\n <descope-phone-field allow-alphanumeric-input="true"></descope-phone-field>\n <descope-phone-input-box-field allow-alphanumeric-input="true"></descope-phone-input-box-field>\n </div>\n\t\t`,(0,n.fz)("\n :host {\n display: inline-flex;\n box-sizing: border-box;\n padding: 0;\n gap: 0;\n }\n .wrapper {\n display: grid;\n width: 100%;\n }\n descope-email-field,\n descope-phone-field,\n descope-phone-input-box-field {\n grid-area: 1/1;\n width: 100%;\n height: 100%;\n }\n .hidden {\n visibility: hidden;\n }\n ",this)}get isExternalInput(){return"true"===this.getAttribute("external-input")}get emailInputEle(){return this.isExternalInput?this.emailInput.externalInput:this.emailInput.inputElement}get phoneVariant(){return"inputBox"===this.getAttribute("phone-variant")?this.phoneInputBoxInput:this.phoneCountryCodeInput}get defaultCode(){const e=this.phoneCountryCodeInput.countryCodes?.[0]||"";return this.getAttribute("default-code")||e}get activeInputEle(){return this.activeInput===this.emailInput?this.emailInputEle:this.phoneVariant.phoneNumberInputEle}get value(){return this.activeInput?.value||""}set value(e){this.handleActiveInput(e),setTimeout(()=>{this.activeInput.value=e})}async init(){super.init?.(),this.initInputs(),this.updateAttrs(),this.toggleInputVisibility(),await this.waitForInputs(),this.initInputEles(),this.overrideEmailInputType(),this.overrideEmailSetAttribute()}waitForInputs(){return new Promise(e=>{const t=setInterval(()=>{this.emailInputEle&&(clearInterval(t),e())})})}initInputs(){this.emailInput=this.shadowRoot.querySelector("descope-email-field"),this.phoneCountryCodeInput=this.shadowRoot.querySelector(m),this.phoneInputBoxInput=this.shadowRoot.querySelector("descope-phone-input-box-field"),this.inputs=[this.emailInput,this.phoneCountryCodeInput,this.phoneInputBoxInput],this.activeInput=this.emailInput}initInputEles(){[this.emailInputEle,this.phoneCountryCodeInput.phoneNumberInputEle,this.phoneInputBoxInput.phoneNumberInputEle].forEach(e=>{e.addEventListener("input",this.onValueChange.bind(this))})}overrideEmailInputType(){this.emailInputEle.addEventListener("focus",()=>{this.emailInputEle.setAttribute("type","text")}),this.emailInputEle.addEventListener("blur",()=>{setTimeout(()=>{this.emailInputEle.setAttribute("type","email")})})}overrideEmailSetAttribute(){const e=this.emailInput.setAttribute.bind(this.emailInputEle);this.emailInputEle.setAttribute=(t,i)=>("type"!==t||"email"!==i||!this.emailInput.hasAttribute("focused"))&&e(t,i)}updateAttrs(){(0,a.EA)(this,this.emailInput,{includeAttrs:h.email,mapAttrs:c.email}),(0,a.EA)(this,this.phoneCountryCodeInput,{includeAttrs:h.phone.countryCode,mapAttrs:c.phone}),(0,a.EA)(this,this.phoneInputBoxInput,{includeAttrs:h.phone.inputBox,mapAttrs:c.phone}),this.inputs.forEach(e=>(0,a.EA)(this,e,{includeAttrs:h.shared})),setTimeout(()=>this.phoneCountryCodeInput.setAttribute("default-code",this.defaultCode))}onValueChange(){this.#t=this.activeInputEle.selectionStart,this.handleActiveInput(this.activeInputEle.value||this.activeInput.value)}handleActiveInput(e){const t=(e=>!!e&&!l.test(e))(e)?this.phoneVariant:this.emailInput;this.activeInput!==t&&this.setActiveInput(t)}setActiveInput(e){const t=this.activeInputEle.value||this.activeInput.value;this.activeInput=e,this.setActiveInputValue(t),this.#e&&this.activeInput.reportValidity(),this.setActiveInputSelectionStart(),this.toggleInputVisibility()}setActiveInputSelectionStart(){setTimeout(()=>{this.activeInputEle.focus(),this.activeInputEle.setSelectionRange?.(this.#t,this.#t)})}#i(){const e=this.getAttribute("default-code"),t=e&&p.NF.CountryCodes.find(t=>t.code===e);return t?.dialCode||p.NF.CountryCodes[0]?.dialCode||""}setActiveInputValue(e){const t=(e=>e.replace(/\+\d+-/,""))(e);if(this.activeInput.localName===m){const e=this.phoneCountryCodeInput.countryCodeItems||this.#i();this.activeInput.value=`${e}-${t}`}else this.activeInput.value=t}toggleInputVisibility(){this.inputs.forEach(e=>{e!==this.activeInput?e.classList.add("hidden"):e.classList.remove("hidden")})}reportValidity(){this.#e=!0;const e=this.activeInputEle,t=e.type;return e.setAttribute("type","text"),setTimeout(()=>{e.setSelectionRange?.(e.value.length,e.value.length),e.setAttribute("type",t)}),this.activeInput.reportValidity()}checkValidity(){return this.activeInput.checkValidity()}});customElements.define(d,f)},16306(e,t,i){i.d(t,{TQ:()=>h,Ul:()=>A});var n=i(25964),r=i(9035),o=i(97810),s=i(9696),a=i(79365),l=i(79275),p=i(51680),u=i(73551);const d=l.w.cssVarList,h=(0,o.xE)("phone-input-box-field"),{host:c,label:m,inputElement:g,requiredIndicator:f,inputField:y,internalComponent:v,internalComponentAfter:b,phoneInput:I,errorMessage:x,helperText:C}={host:{selector:()=>":host"},label:{selector:"::part(label)"},placeholder:{selector:"> input:placeholder-shown"},inputElement:{selector:"input"},requiredIndicator:{selector:"[required]::part(required-indicator)::after"},inputField:{selector:()=>"vaadin-text-field::part(input-field)"},internalComponent:{selector:"descope-phone-field-internal-input-box"},internalComponentAfter:{selector:"descope-phone-field-internal-input-box::after"},phoneInput:{selector:()=>"descope-text-field"},helperText:{selector:"::part(helper-text)"},errorMessage:{selector:"::part(error-message)"}},A=(0,s.Zz)((0,a.RF)({mappings:{fontSize:[c,y,{selector:l.w.componentName,property:l.w.cssVarList.fontSize}],fontFamily:[m,x,C],hostWidth:{...c,property:"width"},hostMinWidth:{...c,property:"min-width"},hostDirection:{...c,property:"direction"},inputHorizontalPadding:[{...I,property:"padding-left"},{...I,property:"padding-right"}],labelFontSize:{...m,property:"font-size"},labelFontWeight:{...m,property:"font-weight"},labelTextColor:[{...m,property:"color"},{...m,property:"-webkit-text-fill-color"},{...f,property:"color"}],labelRequiredIndicator:{...f,property:"content"},errorMessageTextColor:{...x,property:"color"},errorMessageIcon:{...x,property:"background-image"},errorMessageIconSize:{...x,property:"background-size"},errorMessageIconPadding:{...x,property:"padding-inline-start"},errorMessageIconRepeat:{...x,property:"background-repeat"},errorMessageIconPosition:{...x,property:"background-position"},errorMessageFontSize:{...x,property:"font-size"},inputValueTextColor:{...I,property:d.inputValueTextColor},inputPlaceholderTextColor:{...I,property:d.inputPlaceholderColor},inputBorderStyle:{...b,property:"border-style"},inputBorderWidth:{...b,property:"border-width"},inputBorderColor:{...b,property:"border-color"},inputBorderRadius:[{...v,property:"border-radius"},{...b,property:"border-radius"}],inputOutlineStyle:{...v,property:"outline-style"},inputOutlineColor:{...v,property:"outline-color"},inputOutlineWidth:{...v,property:"outline-width"},inputOutlineOffset:{...v,property:"outline-offset"},labelPosition:{...m,property:"position"},labelTopPosition:{...m,property:"top"},labelHorizontalPosition:[{...m,property:"left"},{...m,property:"right"}],inputTransformY:{...m,property:"transform"},inputTransition:{...m,property:"transition"},marginInlineStart:{...m,property:"margin-inline-start"},valueInputHeight:{...g,property:"height"},valueInputMarginBottom:{selector:l.w.componentName,property:d.valueInputMarginBottom}}}),a.VO,a.Yg,(0,a.OZ)({proxyProps:["value","selectionStart"]}),e=>class extends e{static get CountryCodes(){return p.A}init(){super.init?.();const e=document.createElement("template");e.innerHTML=`\n\t\t\t\t<${r.T}\n\t\t\t\t\ttabindex="-1"\n\t\t\t\t\tslot="input"\n\t\t\t\t></${r.T}>\n `,this.baseElement.appendChild(e.content.cloneNode(!0)),this.inputElement=this.shadowRoot.querySelector(r.T),(0,n.Gh)(this,this.inputElement,{includeAttrs:["has-value"]}),(0,o.EA)(this.shadowRoot.host,this.inputElement,{includeAttrs:["size","minlength","maxlength","default-code","disabled","phone-input-placeholder","label","label-type","allow-alphanumeric-input","restrict-countries","format-value","strict-validation","data-errormessage-type-mismatch"]})}get phoneNumberInputEle(){return this.inputElement?.phoneNumberInputEle}})((0,a.tz)({slots:[],wrappedEleName:"vaadin-text-field",style:()=>`\n :host {\n display: inline-flex;\n max-width: 100%;\n box-sizing: border-box;\n }\n ${(0,u.cy)(A.cssVarList)}\n ${(0,u.I4)("vaadin-text-field")}\n ${(0,u.kG)("vaadin-text-field")}\n ${(0,u.X6)()}\n\n vaadin-text-field {\n width: 100%;\n box-sizing: border-box;\n padding: 0;\n }\n vaadin-text-field[focus-ring]::part(input-field) {\n box-shadow: none;\n }\n vaadin-text-field::before {\n height: 0;\n }\n vaadin-text-field::part(input-field) {\n padding: 0;\n background: transparent;\n -webkit-mask-image: none;\n }\n descope-phone-field-internal-input-box {\n -webkit-mask-image: none;\n padding: 0;\n width: 100%;\n }\n descope-phone-field-internal-input-box > div {\n width: 100%;\n }\n descope-phone-field-internal-input-box descope-text-field {\n ${d.inputOutlineWidth}: 0;\n ${d.inputOutlineOffset}: 0;\n }\n descope-phone-field-internal-input-box::after {\n content: '';\n position: absolute;\n width: 100%;\n height: 100%;\n top: 0;\n left: 0;\n box-sizing: border-box;\n pointer-events: none;\n }\n descope-text-field {\n flex-grow: 1;\n width: 100%;\n direction: ltr;\n }\n vaadin-text-field[readonly] > input:placeholder-shown {\n opacity: 1;\n }\n vaadin-text-field::part(input-field)::after {\n border: none;\n }\n\n vaadin-text-field[label-type="floating"]:not([focused])[readonly] input:placeholder-shown {\n opacity: 0;\n }\n vaadin-text-field[label-type="floating"]:not([focused])[disabled] input:placeholder-shown {\n opacity: 0;\n }\n\n ${(0,u.$J)("vaadin-text-field")}\n ${(0,u.Kl)()}\n\t\t`,excludeAttrsSync:["tabindex","style"],componentName:h}))},9035(e,t,i){i.d(t,{A:()=>c,T:()=>p});var n=i(25964),r=i(10473),o=i(23530),s=i(3393),a=i(97810),l=i(92259);const p=(0,a.xE)("phone-field-internal-input-box"),u=["disabled","size","readonly","phone-input-placeholder","name","maxlength","autocomplete","label-type"],d={"phone-input-placeholder":"placeholder"},h=(0,s.y)({componentName:p,baseSelector:"div"}),c=class extends h{static get observedAttributes(){return[].concat(h.observedAttributes||[],u)}#n;constructor(){super(),this.innerHTML='\n <div>\n <descope-text-field tabindex="1" type="tel" bordered="false"></descope-text-field>\n </div>\n ',this.textField=this.querySelector("descope-text-field")}get phoneNumberInputEle(){return this.textField.shadowRoot.querySelector("input")}get defaultDialCode(){return(0,l.Q)(this.getAttribute("default-code"))}get defaultCode(){return this.getAttribute("default-code")}get allowAlphanumericInput(){return"true"===this.getAttribute("allow-alphanumeric-input")}get minLength(){return parseInt(this.getAttribute("minlength"),10)||0}get maxLength(){return parseInt(this.getAttribute("maxlength"),10)||50}get restrictCountries(){return this.getAttribute("restrict-countries")?.split(",").filter(Boolean)||[]}get isFormatValue(){return"true"===this.getAttribute("format-value")}get isStrictValidation(){return"true"===this.getAttribute("strict-validation")}get value(){if(!this.textField.value)return"";if(!this.isStrictValidation)return this.#r();const e=this.#o();return e?.country&&e?.countryCallingCode&&e?.nationalNumber?`+${[e?.countryCallingCode,e?.nationalNumber].join("-")}`:this.textField.value}set value(e){this.textField.value=e}init(){this.addEventListener("focus",e=>{e.isTrusted&&this.textField.focus()}),super.init?.(),this.textField.addEventListener("input",this.#s.bind(this)),this.handleFocusEventsDispatching([this.textField]),(0,n.EA)(this.textField,this,{includeAttrs:["has-value"]})}getValidity(){const e=/^\+?\d{1,4}-?(?:\d-?){1,15}$/,t=this.#a(this.textField.value||"");if(this.isRequired&&!this.textField.value)return{valueMissing:!0};if(this.textField.value){if(t.length<this.minLength)return{tooShort:!0};if(this.isStrictValidation&&this.textField.value&&!this.#l()||!this.isStrictValidation&&this.textField.value&&!e.test(this.value))return{patternMismatch:!0}}return{}}setSelectionRange(...e){this.textField.setSelectionRange(...e)}attributeChangedCallback(e,t,i){if(super.attributeChangedCallback(e,t,i),t!==i&&u.includes(e)){const t=d[e]||e;this.textField.setAttribute(t,i)}}#s(e){let t=this.#p(e.target.value);this.isFormatValue&&this.#u(t)&&(t=this.#d(t)),e.target.value=t}#r(){if(!this.defaultDialCode)return this.textField.value;const e=this.#h(this.textField.value),t=this.#a(e);return[this.defaultDialCode,t].join("-")}#o(){return this.defaultDialCode?(0,r.l)([this.defaultDialCode,this.#a(this.textField.value)].filter(Boolean).join("")):(0,r.l)(this.textField.value)}#a(e){return e.replace(/\D/g,"")}#h(e){if("+"===this.textField.value?.[0]){const t=new RegExp(`^\\${this.defaultDialCode}`);return e.replace(t,"")}return e}#l(){const e=(0,r.l)(this.value);return!(!e||!e.isValid?.()||!e.country||!this.#c(e.country)||this.defaultCode&&this.defaultCode!==e.country)}#c(e){return!this.restrictCountries.length||this.restrictCountries.includes(e)}#p(e){if(e=e.replace(/^-+/,"").replace(/(?!^)\+/g,"").replace("--","-").replace("+-","+"),!this.allowAlphanumericInput){const t=/^[+\d-\(\)]+$/;e=e.split("").filter(e=>t.test(e)).join("")}return e}#d(e=""){const t=this.defaultCode||this.#m(e);return t?(this.#n&&this.#n.country===t||(this.#n=new o.Q(t)),this.#n.reset(),this.#n.input(e)||e):e}#m(e){const t=(0,r.l)(e);return t?.country||""}#u(e){return!!(0,l.W)(e)}}},78343(e,t,i){i.r(t),i(21374);var n=i(9035);customElements.define(n.T,n.A)},30057(e,t,i){i.r(t),i.d(t,{PhoneFieldInputBoxClass:()=>n.Ul,componentName:()=>n.TQ}),i(78343),i(21374);var n=i(16306);customElements.define(n.TQ,n.Ul)},92259(e,t,i){i.d(t,{Q:()=>r,W:()=>o});var n=i(51680);const r=e=>n.A.find(t=>t.code===e)?.dialCode,o=e=>{const t=e.match(/\(/g),i=e.match(/\)/g);return t?.length===i?.length}}}]);
19
+ `;(0,r.SF)("vaadin-email-field",l,{moduleId:"vaadin-email-field-styles"});class p extends a.A{static get is(){return"vaadin-email-field"}constructor(){super(),this._setType("email"),this.pattern="^([a-zA-Z0-9_\\.\\-+])+@[a-zA-Z0-9\\-.]+\\.[a-zA-Z0-9\\-]{2,}$"}ready(){super.ready(),this.inputElement&&(this.inputElement.autocapitalize="off")}}(0,s.X)(p);var u=i(79365),d=i(6424),h=i(9696),c=i(97810),m=i(73551);const g=(0,c.xE)("email-field"),y=(0,h.Zz)((0,u.RF)({mappings:d.A}),u.VO,(0,u.RV)({inputType:"email",inputName:"email",autocompleteType:"username",includeAttrs:["disabled","readonly","pattern"]}),(0,u.OZ)({proxyProps:["value","selectionStart"],useProxyTargets:!0}),u.tQ,e=>class extends e{init(){super.init?.(),this.baseElement.setAttribute("pattern","^[\\w\\.\\%\\+\\-']+@[\\w\\.\\-]+\\.[A-Za-z]{2,}$"),this.getAttribute("autocomplete")||this.setAttribute("autocomplete","username"),this.createExternalInput()}})((0,u.tz)({slots:["","suffix"],wrappedEleName:"vaadin-email-field",style:()=>`\n\t\t\t:host {\n\t\t\t\tdisplay: inline-block;\n\t\t\t\tmax-width: 100%;\n\t\t\t\tpadding: calc(var(${y.cssVarList.inputOutlineWidth}) + var(${y.cssVarList.inputOutlineOffset}));\n box-sizing: border-box;\n\t\t\t}\n ${(0,m.$J)("vaadin-email-field")}\n\t\t\t${(0,m.cy)(y.cssVarList)}\n\t\t\t${(0,m.LJ)("vaadin-email-field",y.cssVarList)}\n ${(0,m.Kl)()}\n\n vaadin-email-field[label-type="floating"]:not([focused])[readonly] > input:placeholder-shown {\n opacity: 0;\n }\n vaadin-email-field[label-type="floating"]:not([focused])[disabled] > input:placeholder-shown {\n opacity: 0;\n }\n\n :host ::slotted(*) {\n -webkit-mask-image: none;\n }\n\n vaadin-email-field[external-input="true"] > input:not(:placeholder-shown) {\n opacity: 0;\n }\n\t\t`,excludeAttrsSync:["tabindex","style"],componentName:g}));customElements.define(g,y)},44966(e,t,i){i.r(t),i.d(t,{HybridFieldClass:()=>y,componentName:()=>d}),i(54316),i(98136),i(30057);var n=i(25964),r=i(79365),o=i(81365),s=i(9696),a=i(97810);const l=/[^\d\s+\-()]/;var p=i(81808),u=i(16306);const d=(0,a.xE)("hybrid-field"),h={shared:["label","bordered","full-width","label-type","size","disabled","readonly","required","st-host-direction","st-error-message-icon","st-error-message-icon-size","st-error-message-icon-padding"],email:["placeholder","data-errormessage-value-missing-email","data-errormessage-pattern-mismatch-email","external-input"],phone:{countryCode:["phone-input-label","country-input-label","country-input-placeholder","restrict-countries","default-code","phone-minlength","phone-format-value","phone-strict-validation","phone-input-type","data-errormessage-value-missing-phone"],inputBox:["restrict-countries","default-code","phone-minlength","phone-format-value","phone-strict-validation","phone-input-type","data-errormessage-value-missing-phone"]}},c={email:{"data-errormessage-value-missing-email":"data-errormessage-value-missing","data-errormessage-pattern-mismatch-email":"data-errormessage-pattern-mismatch"},phone:{"phone-input-label":"label","phone-minlength":"minlength","phone-format-value":"format-value","phone-strict-validation":"strict-validation","data-errormessage-value-missing-phone":"data-errormessage-value-missing"}},m="descope-phone-field",g=(0,o.q)({componentName:d,baseSelector:"div"}),y=(0,s.Zz)((0,r.RF)({componentNameOverride:(0,a.xE)("input-wrapper")}),(0,r.RF)({mappings:{hostWidth:{selector:()=>":host",property:"width"},hostDirection:[{selector:()=>"descope-email-field",property:"direction"},{selector:()=>"descope-phone-field",property:"direction"},{selector:()=>"descope-phone-input-box-field",property:"direction"}],errorMessageIcon:[{selector:()=>p.NF.componentName,property:p.NF.cssVarList.errorMessageIcon},{selector:()=>u.Ul.componentName,property:u.Ul.cssVarList.errorMessageIcon}],errorMessageIconSize:[{selector:()=>p.NF.componentName,property:p.NF.cssVarList.errorMessageIconSize},{selector:()=>u.Ul.componentName,property:u.Ul.cssVarList.errorMessageIconSize}],errorMessageIconPadding:[{selector:()=>p.NF.componentName,property:p.NF.cssVarList.errorMessageIconPadding},{selector:()=>u.Ul.componentName,property:u.Ul.cssVarList.errorMessageIconPadding}],errorMessageIconRepeat:[{selector:()=>p.NF.componentName,property:p.NF.cssVarList.errorMessageIconRepeat},{selector:()=>u.Ul.componentName,property:u.Ul.cssVarList.errorMessageIconRepeat}],errorMessageIconPosition:[{selector:()=>p.NF.componentName,property:p.NF.cssVarList.errorMessageIconPosition},{selector:()=>u.Ul.componentName,property:u.Ul.cssVarList.errorMessageIconPosition}],errorMessageFontSize:[{selector:()=>p.NF.componentName,property:p.NF.cssVarList.errorMessageFontSize},{selector:()=>u.Ul.componentName,property:u.Ul.cssVarList.errorMessageFontSize}]}}),r.VO,r.tQ)(class extends g{#e=!1;#t;constructor(){super(),this.attachShadow({mode:"open"}).innerHTML=`\n <div class="wrapper">\n <descope-email-field external-input="${this.isExternalInput}"></descope-email-field>\n <descope-phone-field allow-alphanumeric-input="true" phone-input-type="text"></descope-phone-field>\n <descope-phone-input-box-field allow-alphanumeric-input="true" phone-input-type="text"></descope-phone-input-box-field>\n </div>\n\t\t`,(0,n.fz)("\n :host {\n display: inline-flex;\n box-sizing: border-box;\n padding: 0;\n gap: 0;\n }\n .wrapper {\n display: grid;\n width: 100%;\n }\n descope-email-field,\n descope-phone-field,\n descope-phone-input-box-field {\n grid-area: 1/1;\n width: 100%;\n height: 100%;\n }\n .hidden {\n visibility: hidden;\n }\n ",this)}get isExternalInput(){return"true"===this.getAttribute("external-input")}get emailInputEle(){return this.isExternalInput?this.emailInput.externalInput:this.emailInput.inputElement}get phoneVariant(){return"inputBox"===this.getAttribute("phone-variant")?this.phoneInputBoxInput:this.phoneCountryCodeInput}get defaultCode(){const e=this.phoneCountryCodeInput.countryCodes?.[0]||"";return this.getAttribute("default-code")||e}get activeInputEle(){return this.activeInput===this.emailInput?this.emailInputEle:this.phoneVariant.phoneNumberInputEle}get value(){return this.activeInput?.value||""}set value(e){this.handleActiveInput(e),setTimeout(()=>{this.activeInput.value=e})}async init(){super.init?.(),this.initInputs(),this.updateAttrs(),this.toggleInputVisibility(),await this.waitForInputs(),this.initInputEles(),this.overrideEmailInputType(),this.overrideEmailSetAttribute()}waitForInputs(){return new Promise(e=>{const t=setInterval(()=>{this.emailInputEle&&(clearInterval(t),e())})})}initInputs(){this.emailInput=this.shadowRoot.querySelector("descope-email-field"),this.phoneCountryCodeInput=this.shadowRoot.querySelector(m),this.phoneInputBoxInput=this.shadowRoot.querySelector("descope-phone-input-box-field"),this.inputs=[this.emailInput,this.phoneCountryCodeInput,this.phoneInputBoxInput],this.activeInput=this.emailInput}initInputEles(){[this.emailInputEle,this.phoneCountryCodeInput.phoneNumberInputEle,this.phoneInputBoxInput.phoneNumberInputEle].forEach(e=>{e.addEventListener("input",this.onValueChange.bind(this))})}overrideEmailInputType(){this.emailInputEle.addEventListener("focus",()=>{this.emailInputEle.setAttribute("type","text")}),this.emailInputEle.addEventListener("blur",()=>{setTimeout(()=>{this.emailInputEle.setAttribute("type","email")})})}overrideEmailSetAttribute(){const e=this.emailInput.setAttribute.bind(this.emailInputEle);this.emailInputEle.setAttribute=(t,i)=>("type"!==t||"email"!==i||!this.emailInput.hasAttribute("focused"))&&e(t,i)}updateAttrs(){(0,a.EA)(this,this.emailInput,{includeAttrs:h.email,mapAttrs:c.email}),(0,a.EA)(this,this.phoneCountryCodeInput,{includeAttrs:h.phone.countryCode,mapAttrs:c.phone}),(0,a.EA)(this,this.phoneInputBoxInput,{includeAttrs:h.phone.inputBox,mapAttrs:c.phone}),this.inputs.forEach(e=>(0,a.EA)(this,e,{includeAttrs:h.shared})),setTimeout(()=>this.phoneCountryCodeInput.setAttribute("default-code",this.defaultCode))}onValueChange(){this.#t=this.activeInputEle.selectionStart,this.handleActiveInput(this.activeInputEle.value||this.activeInput.value)}handleActiveInput(e){const t=(e=>!!e&&!l.test(e))(e)?this.phoneVariant:this.emailInput;this.activeInput!==t&&this.setActiveInput(t)}setActiveInput(e){const t=this.activeInputEle.value||this.activeInput.value;this.activeInput=e,this.setActiveInputValue(t),this.#e&&this.activeInput.reportValidity(),this.setActiveInputSelectionStart(),this.toggleInputVisibility()}setActiveInputSelectionStart(){setTimeout(()=>{this.activeInputEle.focus(),this.activeInputEle.setSelectionRange?.(this.#t,this.#t)})}#i(){const e=this.getAttribute("default-code"),t=e&&p.NF.CountryCodes.find(t=>t.code===e);return t?.dialCode||p.NF.CountryCodes[0]?.dialCode||""}setActiveInputValue(e){const t=(e=>e.replace(/\+\d+-/,""))(e);if(this.activeInput.localName===m){const e=this.phoneCountryCodeInput.countryCodeItems||this.#i();this.activeInput.value=`${e}-${t}`}else this.activeInput.value=t}toggleInputVisibility(){this.inputs.forEach(e=>{e!==this.activeInput?e.classList.add("hidden"):e.classList.remove("hidden")})}reportValidity(){this.#e=!0;const e=this.activeInputEle,t=e.type;return e.setAttribute("type","text"),setTimeout(()=>{e.setSelectionRange?.(e.value.length,e.value.length),e.setAttribute("type",t)}),this.activeInput.reportValidity()}checkValidity(){return this.activeInput.checkValidity()}});customElements.define(d,y)},16306(e,t,i){i.d(t,{TQ:()=>h,Ul:()=>A});var n=i(25964),r=i(9035),o=i(97810),s=i(9696),a=i(79365),l=i(79275),p=i(51680),u=i(73551);const d=l.w.cssVarList,h=(0,o.xE)("phone-input-box-field"),{host:c,label:m,inputElement:g,requiredIndicator:y,inputField:f,internalComponent:v,internalComponentAfter:b,phoneInput:I,errorMessage:x,helperText:C}={host:{selector:()=>":host"},label:{selector:"::part(label)"},placeholder:{selector:"> input:placeholder-shown"},inputElement:{selector:"input"},requiredIndicator:{selector:"[required]::part(required-indicator)::after"},inputField:{selector:()=>"vaadin-text-field::part(input-field)"},internalComponent:{selector:"descope-phone-field-internal-input-box"},internalComponentAfter:{selector:"descope-phone-field-internal-input-box::after"},phoneInput:{selector:()=>"descope-text-field"},helperText:{selector:"::part(helper-text)"},errorMessage:{selector:"::part(error-message)"}},A=(0,s.Zz)((0,a.RF)({mappings:{fontSize:[c,f,{selector:l.w.componentName,property:l.w.cssVarList.fontSize}],fontFamily:[m,x,C],hostWidth:{...c,property:"width"},hostMinWidth:{...c,property:"min-width"},hostDirection:{...c,property:"direction"},inputHorizontalPadding:[{...I,property:"padding-left"},{...I,property:"padding-right"}],labelFontSize:{...m,property:"font-size"},labelFontWeight:{...m,property:"font-weight"},labelTextColor:[{...m,property:"color"},{...m,property:"-webkit-text-fill-color"},{...y,property:"color"}],labelRequiredIndicator:{...y,property:"content"},errorMessageTextColor:{...x,property:"color"},errorMessageIcon:{...x,property:"background-image"},errorMessageIconSize:{...x,property:"background-size"},errorMessageIconPadding:{...x,property:"padding-inline-start"},errorMessageIconRepeat:{...x,property:"background-repeat"},errorMessageIconPosition:{...x,property:"background-position"},errorMessageFontSize:{...x,property:"font-size"},inputValueTextColor:{...I,property:d.inputValueTextColor},inputPlaceholderTextColor:{...I,property:d.inputPlaceholderColor},inputBorderStyle:{...b,property:"border-style"},inputBorderWidth:{...b,property:"border-width"},inputBorderColor:{...b,property:"border-color"},inputBorderRadius:[{...v,property:"border-radius"},{...b,property:"border-radius"}],inputOutlineStyle:{...v,property:"outline-style"},inputOutlineColor:{...v,property:"outline-color"},inputOutlineWidth:{...v,property:"outline-width"},inputOutlineOffset:{...v,property:"outline-offset"},labelPosition:{...m,property:"position"},labelTopPosition:{...m,property:"top"},labelHorizontalPosition:[{...m,property:"left"},{...m,property:"right"}],inputTransformY:{...m,property:"transform"},inputTransition:{...m,property:"transition"},marginInlineStart:{...m,property:"margin-inline-start"},valueInputHeight:{...g,property:"height"},valueInputMarginBottom:{selector:l.w.componentName,property:d.valueInputMarginBottom}}}),a.VO,a.Yg,(0,a.OZ)({proxyProps:["value","selectionStart"]}),e=>class extends e{static get CountryCodes(){return p.A}init(){super.init?.();const e=document.createElement("template");e.innerHTML=`\n\t\t\t\t<${r.T}\n\t\t\t\t\ttabindex="-1"\n\t\t\t\t\tslot="input"\n\t\t\t\t></${r.T}>\n `,this.baseElement.appendChild(e.content.cloneNode(!0)),this.inputElement=this.shadowRoot.querySelector(r.T),(0,n.Gh)(this,this.inputElement,{includeAttrs:["has-value"]}),(0,o.EA)(this.shadowRoot.host,this.inputElement,{includeAttrs:["size","minlength","maxlength","default-code","disabled","phone-input-placeholder","label","label-type","allow-alphanumeric-input","restrict-countries","format-value","strict-validation","data-errormessage-type-mismatch","phone-input-type"]})}get phoneNumberInputEle(){return this.inputElement?.phoneNumberInputEle}})((0,a.tz)({slots:[],wrappedEleName:"vaadin-text-field",style:()=>`\n :host {\n display: inline-flex;\n max-width: 100%;\n box-sizing: border-box;\n }\n ${(0,u.cy)(A.cssVarList)}\n ${(0,u.I4)("vaadin-text-field")}\n ${(0,u.kG)("vaadin-text-field")}\n ${(0,u.X6)()}\n\n vaadin-text-field {\n width: 100%;\n box-sizing: border-box;\n padding: 0;\n }\n vaadin-text-field[focus-ring]::part(input-field) {\n box-shadow: none;\n }\n vaadin-text-field::before {\n height: 0;\n }\n vaadin-text-field::part(input-field) {\n padding: 0;\n background: transparent;\n -webkit-mask-image: none;\n }\n descope-phone-field-internal-input-box {\n -webkit-mask-image: none;\n padding: 0;\n width: 100%;\n }\n descope-phone-field-internal-input-box > div {\n width: 100%;\n }\n descope-phone-field-internal-input-box descope-text-field {\n ${d.inputOutlineWidth}: 0;\n ${d.inputOutlineOffset}: 0;\n }\n descope-phone-field-internal-input-box::after {\n content: '';\n position: absolute;\n width: 100%;\n height: 100%;\n top: 0;\n left: 0;\n box-sizing: border-box;\n pointer-events: none;\n }\n descope-text-field {\n flex-grow: 1;\n width: 100%;\n direction: ltr;\n }\n vaadin-text-field[readonly] > input:placeholder-shown {\n opacity: 1;\n }\n vaadin-text-field::part(input-field)::after {\n border: none;\n }\n\n vaadin-text-field[label-type="floating"]:not([focused])[readonly] input:placeholder-shown {\n opacity: 0;\n }\n vaadin-text-field[label-type="floating"]:not([focused])[disabled] input:placeholder-shown {\n opacity: 0;\n }\n\n ${(0,u.$J)("vaadin-text-field")}\n ${(0,u.Kl)()}\n\t\t`,excludeAttrsSync:["tabindex","style"],componentName:h}))},9035(e,t,i){i.d(t,{A:()=>c,T:()=>p});var n=i(25964),r=i(10473),o=i(23530),s=i(3393),a=i(97810),l=i(92259);const p=(0,a.xE)("phone-field-internal-input-box"),u=["disabled","size","readonly","phone-input-placeholder","name","maxlength","autocomplete","label-type","phone-input-type"],d={"phone-input-placeholder":"placeholder","phone-input-type":"type"},h=(0,s.y)({componentName:p,baseSelector:"div"}),c=class extends h{static get observedAttributes(){return[].concat(h.observedAttributes||[],u)}#n;constructor(){super(),this.innerHTML='\n <div>\n <descope-text-field tabindex="1" type="tel" bordered="false"></descope-text-field>\n </div>\n ',this.textField=this.querySelector("descope-text-field")}get phoneNumberInputEle(){return this.textField.shadowRoot.querySelector("input")}get defaultDialCode(){return(0,l.Q)(this.getAttribute("default-code"))}get defaultCode(){return this.getAttribute("default-code")}get allowAlphanumericInput(){return"true"===this.getAttribute("allow-alphanumeric-input")}get minLength(){return parseInt(this.getAttribute("minlength"),10)||0}get maxLength(){return parseInt(this.getAttribute("maxlength"),10)||50}get restrictCountries(){return this.getAttribute("restrict-countries")?.split(",").filter(Boolean)||[]}get isFormatValue(){return"true"===this.getAttribute("format-value")}get isStrictValidation(){return"true"===this.getAttribute("strict-validation")}get value(){if(!this.textField.value)return"";if(!this.isStrictValidation)return this.#r();const e=this.#o();return e?.country&&e?.countryCallingCode&&e?.nationalNumber?`+${[e?.countryCallingCode,e?.nationalNumber].join("-")}`:this.textField.value}set value(e){this.textField.value=e}init(){this.addEventListener("focus",e=>{e.isTrusted&&this.textField.focus()}),super.init?.(),this.textField.addEventListener("input",this.#s.bind(this)),this.handleFocusEventsDispatching([this.textField]),(0,n.EA)(this.textField,this,{includeAttrs:["has-value"]}),(0,n.EA)(this,this.textField,{includeAttrs:["phone-input-type"],mapAttrs:{"phone-input-type":"type"}})}getValidity(){const e=/^\+?\d{1,4}-?(?:\d-?){1,15}$/,t=this.#a(this.textField.value||"");if(this.isRequired&&!this.textField.value)return{valueMissing:!0};if(this.textField.value){if(t.length<this.minLength)return{tooShort:!0};if(this.isStrictValidation&&this.textField.value&&!this.#l()||!this.isStrictValidation&&this.textField.value&&!e.test(this.value))return{patternMismatch:!0}}return{}}setSelectionRange(...e){this.textField.setSelectionRange(...e)}attributeChangedCallback(e,t,i){if(super.attributeChangedCallback(e,t,i),t!==i&&u.includes(e)){const t=d[e]||e;this.textField.setAttribute(t,i)}}#s(e){let t=this.#p(e.target.value);this.isFormatValue&&this.#u(t)&&(t=this.#d(t)),e.target.value=t}#r(){if(!this.defaultDialCode)return this.textField.value;const e=this.#h(this.textField.value),t=this.#a(e);return[this.defaultDialCode,t].join("-")}#o(){return this.defaultDialCode?(0,r.l)([this.defaultDialCode,this.#a(this.textField.value)].filter(Boolean).join("")):(0,r.l)(this.textField.value)}#a(e){return e.replace(/\D/g,"")}#h(e){if("+"===this.textField.value?.[0]){const t=new RegExp(`^\\${this.defaultDialCode}`);return e.replace(t,"")}return e}#l(){const e=(0,r.l)(this.value);return!(!e||!e.isValid?.()||!e.country||!this.#c(e.country)||this.defaultCode&&this.defaultCode!==e.country)}#c(e){return!this.restrictCountries.length||this.restrictCountries.includes(e)}#p(e){if(e=e.replace(/^-+/,"").replace(/(?!^)\+/g,"").replace("--","-").replace("+-","+"),!this.allowAlphanumericInput){const t=/^[+\d-\(\)]+$/;e=e.split("").filter(e=>t.test(e)).join("")}return e}#d(e=""){const t=this.defaultCode||this.#m(e);return t?(this.#n&&this.#n.country===t||(this.#n=new o.Q(t)),this.#n.reset(),this.#n.input(e)||e):e}#m(e){const t=(0,r.l)(e);return t?.country||""}#u(e){return!!(0,l.W)(e)}}},78343(e,t,i){i.r(t),i(21374);var n=i(9035);customElements.define(n.T,n.A)},30057(e,t,i){i.r(t),i.d(t,{PhoneFieldInputBoxClass:()=>n.Ul,componentName:()=>n.TQ}),i(78343),i(21374);var n=i(16306);customElements.define(n.TQ,n.Ul)},92259(e,t,i){i.d(t,{Q:()=>r,W:()=>o});var n=i(51680);const r=e=>n.A.find(t=>t.code===e)?.dialCode,o=e=>{const t=e.match(/\(/g),i=e.match(/\)/g);return t?.length===i?.length}}}]);
20
20
  //# sourceMappingURL=descope-hybrid-field-index-js.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"descope-hybrid-field-index-js.js","mappings":";mOAQA,MAAMA,EAAa,IAAG;;;;;;;;GAUtB,QAAe,qBAAsB,CAAC,IAAkBA,GAAa,CACnEC,SAAU,qB,0BCXL,MAAMC,E,SAAmB,EAAG;;;;;;;;;GCEnC,QAAe,qBAAsBA,EAAkB,CAAED,SAAU,8BAyB5D,MAAME,UAAmB,IAC9B,aAAWC,GACT,MAAO,oBACT,CAEA,WAAAC,GACEC,QACAC,KAAKC,SAAS,SACdD,KAAKE,QAAU,gEACjB,CAGA,KAAAC,GACEJ,MAAMI,QAEFH,KAAKI,eACPJ,KAAKI,aAAaC,eAAiB,MAEvC,GAGF,OAAoBT,G,yDCtCb,MAAMU,GAAgB,QAAiB,eAqBjCC,GAAkB,SAC7B,QAAiB,CACfC,SAAUC,EAAA,IAEZ,MACA,QAAmB,CACjBC,UAAW,QACXC,UAAW,QACXC,iBAAkB,WAClBC,aAAc,CAAC,WAAY,WAAY,cAEzC,QAAgB,CAAEC,WAAY,CAAC,QAAS,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AEvCuG,EAAuBlJ,IAClC,MAAMmJ,EAAmBnJ,EAAIuC,MAAM,OAC7B6G,EAAoBpJ,EAAIuC,MAAM,OACpC,OAAO4G,GAAkB9F,SAAW+F,GAAmB/F,O","sources":["webpack://@descope/web-components-ui/../../../node_modules/@vaadin/email-field/theme/lumo/vaadin-email-field-styles.js","webpack://@descope/web-components-ui/../../../node_modules/@vaadin/email-field/src/vaadin-email-field-styles.js","webpack://@descope/web-components-ui/../../../node_modules/@vaadin/email-field/src/vaadin-email-field.js","webpack://@descope/web-components-ui/./src/components/descope-email-field/EmailFieldClass.js","webpack://@descope/web-components-ui/./src/components/descope-email-field/index.js","webpack://@descope/web-components-ui/./src/components/descope-hybrid-field/helpers.js","webpack://@descope/web-components-ui/./src/components/descope-hybrid-field/HybridFieldClass.js","webpack://@descope/web-components-ui/./src/components/descope-hybrid-field/index.js","webpack://@descope/web-components-ui/./src/components/phone-fields/descope-phone-input-box-field/PhoneFieldInputBoxClass.js","webpack://@descope/web-components-ui/./src/components/phone-fields/descope-phone-input-box-field/descope-phone-input-box-internal/PhoneFieldInternalInputBox.js","webpack://@descope/web-components-ui/./src/components/phone-fields/descope-phone-input-box-field/descope-phone-input-box-internal/index.js","webpack://@descope/web-components-ui/./src/components/phone-fields/descope-phone-input-box-field/index.js","webpack://@descope/web-components-ui/./src/components/phone-fields/helpers.js"],"sourcesContent":["/**\n * @license\n * Copyright (c) 2021 - 2023 Vaadin Ltd.\n * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/\n */\nimport { inputFieldShared } from '@vaadin/vaadin-lumo-styles/mixins/input-field-shared.js';\nimport { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';\n\nconst emailField = css`\n :host([dir='rtl']) [part='input-field'] ::slotted(input) {\n --_lumo-text-field-overflow-mask-image: linear-gradient(to left, transparent, #000 1.25em);\n }\n\n :host([dir='rtl']) [part='input-field'] ::slotted(input:placeholder-shown) {\n --_lumo-text-field-overflow-mask-image: none;\n }\n`;\n\nregisterStyles('vaadin-email-field', [inputFieldShared, emailField], {\n moduleId: 'lumo-email-field',\n});\n","/**\n * @license\n * Copyright (c) 2021 - 2023 Vaadin Ltd.\n * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/\n */\nimport { css } from 'lit';\n\n// See https://github.com/vaadin/vaadin-text-field/issues/466\nexport const emailFieldStyles = css`\n :host([dir='rtl']) [part='input-field'] {\n direction: ltr;\n }\n\n :host([dir='rtl']) [part='input-field'] ::slotted(input)::placeholder {\n direction: rtl;\n text-align: left;\n }\n`;\n","/**\n * @license\n * Copyright (c) 2021 - 2023 Vaadin Ltd.\n * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/\n */\nimport { defineCustomElement } from '@vaadin/component-base/src/define.js';\nimport { TextField } from '@vaadin/text-field/src/vaadin-text-field.js';\nimport { registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';\nimport { emailFieldStyles } from './vaadin-email-field-styles.js';\n\nregisterStyles('vaadin-email-field', emailFieldStyles, { moduleId: 'vaadin-email-field-styles' });\n\n/**\n * `<vaadin-email-field>` is a Web Component for email field control in forms.\n *\n * ```html\n * <vaadin-email-field label=\"Email\"></vaadin-email-field>\n * ```\n *\n * ### Styling\n *\n * `<vaadin-email-field>` provides the same set of shadow DOM parts and state attributes as `<vaadin-text-field>`.\n * See [`<vaadin-text-field>`](#/elements/vaadin-text-field) for the styling documentation.\n *\n * See [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.\n *\n * @fires {Event} input - Fired when the value is changed by the user: on every typing keystroke, and the value is cleared using the clear button.\n * @fires {Event} change - Fired when the user commits a value change.\n * @fires {CustomEvent} invalid-changed - Fired when the `invalid` property changes.\n * @fires {CustomEvent} value-changed - Fired when the `value` property changes.\n * @fires {CustomEvent} validated - Fired whenever the field is validated.\n *\n * @customElement\n * @extends TextField\n */\nexport class EmailField extends TextField {\n static get is() {\n return 'vaadin-email-field';\n }\n\n constructor() {\n super();\n this._setType('email');\n this.pattern = '^([a-zA-Z0-9_\\\\.\\\\-+])+@[a-zA-Z0-9\\\\-.]+\\\\.[a-zA-Z0-9\\\\-]{2,}$';\n }\n\n /** @protected */\n ready() {\n super.ready();\n\n if (this.inputElement) {\n this.inputElement.autocapitalize = 'off';\n }\n }\n}\n\ndefineCustomElement(EmailField);\n","import {\n createStyleMixin,\n draggableMixin,\n createProxy,\n proxyInputMixin,\n componentNameValidationMixin,\n externalInputMixin,\n} from '../../mixins';\nimport textFieldMappings from '../descope-text-field/textFieldMappings';\nimport { compose } from '../../helpers';\nimport { getComponentName } from '../../helpers/componentHelpers';\nimport {\n inputFloatingLabelStyle,\n resetInputLabelPosition,\n resetInputOverrides,\n useHostExternalPadding,\n} from '../../helpers/themeHelpers/resetHelpers';\n\nexport const componentName = getComponentName('email-field');\n\nconst defaultPattern = \"^[\\\\w\\\\.\\\\%\\\\+\\\\-']+@[\\\\w\\\\.\\\\-]+\\\\.[A-Za-z]{2,}$\";\nconst defaultAutocomplete = 'username';\n\nconst customMixin = (superclass) =>\n class EmailFieldMixinClass extends superclass {\n init() {\n super.init?.();\n\n // we need to set the pattern on the base element because vaadin-email-field is overriding it\n this.baseElement.setAttribute('pattern', defaultPattern);\n\n if (!this.getAttribute('autocomplete')) {\n this.setAttribute('autocomplete', defaultAutocomplete);\n }\n\n this.createExternalInput();\n }\n };\n\nexport const EmailFieldClass = compose(\n createStyleMixin({\n mappings: textFieldMappings,\n }),\n draggableMixin,\n externalInputMixin({\n inputType: 'email',\n inputName: 'email',\n autocompleteType: 'username',\n includeAttrs: ['disabled', 'readonly', 'pattern'],\n }),\n proxyInputMixin({ proxyProps: ['value', 'selectionStart'], useProxyTargets: true }),\n componentNameValidationMixin,\n customMixin\n)(\n createProxy({\n slots: ['', 'suffix'],\n wrappedEleName: 'vaadin-email-field',\n style: () => `\n\t\t\t:host {\n\t\t\t\tdisplay: inline-block;\n\t\t\t\tmax-width: 100%;\n\t\t\t\tpadding: calc(var(${EmailFieldClass.cssVarList.inputOutlineWidth}) + var(${\n EmailFieldClass.cssVarList.inputOutlineOffset\n }));\n box-sizing: border-box;\n\t\t\t}\n ${resetInputLabelPosition('vaadin-email-field')}\n\t\t\t${useHostExternalPadding(EmailFieldClass.cssVarList)}\n\t\t\t${resetInputOverrides('vaadin-email-field', EmailFieldClass.cssVarList)}\n ${inputFloatingLabelStyle()}\n\n vaadin-email-field[label-type=\"floating\"]:not([focused])[readonly] > input:placeholder-shown {\n opacity: 0;\n }\n vaadin-email-field[label-type=\"floating\"]:not([focused])[disabled] > input:placeholder-shown {\n opacity: 0;\n }\n\n :host ::slotted(*) {\n -webkit-mask-image: none;\n }\n\n vaadin-email-field[external-input=\"true\"] > input:not(:placeholder-shown) {\n opacity: 0;\n }\n\t\t`,\n excludeAttrsSync: ['tabindex', 'style'],\n componentName,\n })\n);\n","import '@vaadin/email-field';\nimport { componentName, EmailFieldClass } from './EmailFieldClass';\n\ncustomElements.define(componentName, EmailFieldClass);\n\nexport { EmailFieldClass, componentName };\n","// Matches any character that is not a digit, whitespace, or phone formatting character (+, -, (, ))\nconst INVALID_PHONE_CHARS_RE = /[^\\d\\s+\\-()]/;\n\nexport const isNumericValue = (val) => !!val && !INVALID_PHONE_CHARS_RE.test(val);\n\nexport const sanitizeCountryCodePrefix = (val) => val.replace(/\\+\\d+-/, '');\n","import { injectStyle } from '@descope-ui/common/components-helpers';\nimport { createStyleMixin, draggableMixin, componentNameValidationMixin } from '../../mixins';\nimport { createBaseClass } from '../../baseClasses/createBaseClass';\nimport { compose } from '../../helpers';\nimport { forwardAttrs, getComponentName } from '../../helpers/componentHelpers';\nimport { isNumericValue, sanitizeCountryCodePrefix as sanitizeValue } from './helpers';\nimport { PhoneFieldClass } from '../phone-fields/descope-phone-field/PhoneFieldClass';\nimport { PhoneFieldInputBoxClass } from '../phone-fields/descope-phone-input-box-field/PhoneFieldInputBoxClass';\n\nexport const componentName = getComponentName('hybrid-field');\n\nconst attrs = {\n shared: [\n 'label',\n 'bordered',\n 'full-width',\n 'label-type',\n 'size',\n 'disabled',\n 'readonly',\n 'required',\n 'st-host-direction',\n 'st-error-message-icon',\n 'st-error-message-icon-size',\n 'st-error-message-icon-padding',\n ],\n email: [\n 'placeholder',\n 'data-errormessage-value-missing-email',\n 'data-errormessage-pattern-mismatch-email',\n 'external-input',\n ],\n phone: {\n countryCode: [\n 'phone-input-label',\n 'country-input-label',\n 'country-input-placeholder',\n 'restrict-countries',\n 'default-code',\n 'phone-minlength',\n 'phone-format-value',\n 'phone-strict-validation',\n 'data-errormessage-value-missing-phone',\n ],\n inputBox: [\n 'restrict-countries',\n 'default-code',\n 'phone-minlength',\n 'phone-format-value',\n 'phone-strict-validation',\n 'data-errormessage-value-missing-phone',\n ],\n },\n};\n\nconst attrMap = {\n email: {\n 'data-errormessage-value-missing-email': 'data-errormessage-value-missing',\n 'data-errormessage-pattern-mismatch-email': 'data-errormessage-pattern-mismatch',\n },\n phone: {\n 'phone-input-label': 'label',\n 'phone-minlength': 'minlength',\n 'phone-format-value': 'format-value',\n 'phone-strict-validation': 'strict-validation',\n 'data-errormessage-value-missing-phone': 'data-errormessage-value-missing',\n },\n};\n\nconst EMAIL_FIELD = 'descope-email-field';\nconst PHONE_FIELD = 'descope-phone-field';\nconst PHONE_INPUT_BOX_FIELD = 'descope-phone-input-box-field';\n\nconst BaseClass = createBaseClass({\n componentName,\n baseSelector: 'div',\n});\n\nclass RawHybridField extends BaseClass {\n #isReportedValidity = false;\n\n #selectionStart;\n\n constructor() {\n super();\n\n this.attachShadow({ mode: 'open' }).innerHTML = `\n <div class=\"wrapper\">\n <descope-email-field external-input=\"${this.isExternalInput}\"></descope-email-field>\n <descope-phone-field allow-alphanumeric-input=\"true\"></descope-phone-field>\n <descope-phone-input-box-field allow-alphanumeric-input=\"true\"></descope-phone-input-box-field>\n </div>\n\t\t`;\n\n injectStyle(\n `\n :host {\n display: inline-flex;\n box-sizing: border-box;\n padding: 0;\n gap: 0;\n }\n .wrapper {\n display: grid;\n width: 100%;\n }\n descope-email-field,\n descope-phone-field,\n descope-phone-input-box-field {\n grid-area: 1/1;\n width: 100%;\n height: 100%;\n }\n .hidden {\n visibility: hidden;\n }\n `,\n this\n );\n }\n\n get isExternalInput() {\n return this.getAttribute('external-input') === 'true';\n }\n\n get emailInputEle() {\n return this.isExternalInput ? this.emailInput.externalInput : this.emailInput.inputElement;\n }\n\n get phoneVariant() {\n const isInputBox = this.getAttribute('phone-variant') === 'inputBox';\n return isInputBox ? this.phoneInputBoxInput : this.phoneCountryCodeInput;\n }\n\n get defaultCode() {\n const firstItem = this.phoneCountryCodeInput.countryCodes?.[0] || '';\n return this.getAttribute('default-code') || firstItem;\n }\n\n get activeInputEle() {\n if (this.activeInput === this.emailInput) {\n return this.emailInputEle;\n }\n return this.phoneVariant.phoneNumberInputEle;\n }\n\n get value() {\n return this.activeInput?.value || '';\n }\n\n set value(val) {\n this.handleActiveInput(val);\n setTimeout(() => {\n this.activeInput.value = val;\n });\n }\n\n async init() {\n super.init?.();\n\n this.initInputs();\n this.updateAttrs();\n this.toggleInputVisibility();\n\n await this.waitForInputs();\n\n this.initInputEles();\n this.overrideEmailInputType();\n this.overrideEmailSetAttribute();\n }\n\n waitForInputs() {\n return new Promise((resolve) => {\n const check = setInterval(() => {\n if (this.emailInputEle) {\n clearInterval(check);\n resolve();\n }\n });\n });\n }\n\n initInputs() {\n this.emailInput = this.shadowRoot.querySelector(EMAIL_FIELD);\n this.phoneCountryCodeInput = this.shadowRoot.querySelector(PHONE_FIELD);\n this.phoneInputBoxInput = this.shadowRoot.querySelector(PHONE_INPUT_BOX_FIELD);\n\n this.inputs = [this.emailInput, this.phoneCountryCodeInput, this.phoneInputBoxInput];\n\n this.activeInput = this.emailInput;\n }\n\n // we need to listen on the inner `input` element itself, otherwise we don't always get an `input` event\n initInputEles() {\n const inputEles = [\n this.emailInputEle,\n this.phoneCountryCodeInput.phoneNumberInputEle,\n this.phoneInputBoxInput.phoneNumberInputEle,\n ];\n\n inputEles.forEach((ele) => {\n ele.addEventListener('input', this.onValueChange.bind(this));\n });\n }\n\n overrideEmailInputType() {\n this.emailInputEle.addEventListener('focus', () => {\n this.emailInputEle.setAttribute('type', 'text');\n });\n this.emailInputEle.addEventListener('blur', () => {\n setTimeout(() => {\n this.emailInputEle.setAttribute('type', 'email');\n });\n });\n }\n\n // We want to prevent Vaadin from changing the input type to `email`\n // otherwise, we cannot get the selectionStart from the input.\n overrideEmailSetAttribute() {\n const origEmailSetAttr = this.emailInput.setAttribute.bind(this.emailInputEle);\n this.emailInputEle.setAttribute = (name, value) => {\n if (name !== 'type' || value !== 'email' || !this.emailInput.hasAttribute('focused')) {\n return origEmailSetAttr(name, value);\n }\n return false;\n };\n }\n\n updateAttrs() {\n forwardAttrs(this, this.emailInput, { includeAttrs: attrs.email, mapAttrs: attrMap.email });\n\n forwardAttrs(this, this.phoneCountryCodeInput, {\n includeAttrs: attrs.phone.countryCode,\n mapAttrs: attrMap.phone,\n });\n\n forwardAttrs(this, this.phoneInputBoxInput, {\n includeAttrs: attrs.phone.inputBox,\n mapAttrs: attrMap.phone,\n });\n\n this.inputs.forEach((input) => forwardAttrs(this, input, { includeAttrs: attrs.shared }));\n\n setTimeout(() => this.phoneCountryCodeInput.setAttribute('default-code', this.defaultCode));\n }\n\n onValueChange() {\n this.#selectionStart = this.activeInputEle.selectionStart;\n // phone components expose an API to their inputElement; in case of phone variants like\n // phone-input-box-field, we want to make sure that the value being passed\n // is raw value from input, and not the value with a dial-code prefix, or other decorations\n // applied behind the scenes by the phone components\n this.handleActiveInput(this.activeInputEle.value || this.activeInput.value);\n }\n\n handleActiveInput(val) {\n const expectedActiveInput = isNumericValue(val) ? this.phoneVariant : this.emailInput;\n\n if (this.activeInput !== expectedActiveInput) {\n this.setActiveInput(expectedActiveInput);\n }\n }\n\n setActiveInput(expectedActiveInput) {\n // phone components expose an API to their inputElement; in case of phone variants like\n // phone-input-box-field, we want to make sure that the value being passed\n // is raw value from input, and not the value with a dial-code prefix, or other decorations\n // applied behind the scenes by the phone components\n const val = this.activeInputEle.value || this.activeInput.value;\n\n this.activeInput = expectedActiveInput;\n this.setActiveInputValue(val);\n if (this.#isReportedValidity) this.activeInput.reportValidity();\n this.setActiveInputSelectionStart();\n this.toggleInputVisibility();\n }\n\n setActiveInputSelectionStart() {\n setTimeout(() => {\n this.activeInputEle.focus();\n this.activeInputEle.setSelectionRange?.(this.#selectionStart, this.#selectionStart);\n });\n }\n\n #getDefaultDialCode() {\n const code = this.getAttribute('default-code');\n const match = code && PhoneFieldClass.CountryCodes.find((c) => c.code === code);\n return match?.dialCode || PhoneFieldClass.CountryCodes[0]?.dialCode || '';\n }\n\n setActiveInputValue(val) {\n const sanitizedVal = sanitizeValue(val);\n const isPhoneField = this.activeInput.localName === PHONE_FIELD;\n if (isPhoneField) {\n const dialCode = this.phoneCountryCodeInput.countryCodeItems || this.#getDefaultDialCode();\n this.activeInput.value = `${dialCode}-${sanitizedVal}`;\n } else {\n this.activeInput.value = sanitizedVal;\n }\n }\n\n toggleInputVisibility() {\n this.inputs.forEach((input) => {\n input !== this.activeInput ? input.classList.add('hidden') : input.classList.remove('hidden');\n });\n }\n\n reportValidity() {\n this.#isReportedValidity = true;\n\n const ele = this.activeInputEle;\n\n // On reportValidity we want to set the caret at the end of the input value.\n // Since checkValidity triggers `focus` on the input, it sets the caret at the start of the input,\n // regardless the existing value.\n const origInputType = ele.type;\n ele.setAttribute('type', 'text');\n setTimeout(() => {\n ele.setSelectionRange?.(ele.value.length, ele.value.length);\n ele.setAttribute('type', origInputType);\n });\n\n return this.activeInput.reportValidity();\n }\n\n checkValidity() {\n return this.activeInput.checkValidity();\n }\n}\n\nexport const HybridFieldClass = compose(\n createStyleMixin({ componentNameOverride: getComponentName('input-wrapper') }),\n createStyleMixin({\n mappings: {\n hostWidth: { selector: () => ':host', property: 'width' },\n hostDirection: [\n { selector: () => 'descope-email-field', property: 'direction' },\n { selector: () => 'descope-phone-field', property: 'direction' },\n { selector: () => 'descope-phone-input-box-field', property: 'direction' },\n ],\n errorMessageIcon: [\n {\n selector: () => PhoneFieldClass.componentName,\n property: PhoneFieldClass.cssVarList.errorMessageIcon,\n },\n {\n selector: () => PhoneFieldInputBoxClass.componentName,\n property: PhoneFieldInputBoxClass.cssVarList.errorMessageIcon,\n },\n ],\n errorMessageIconSize: [\n {\n selector: () => PhoneFieldClass.componentName,\n property: PhoneFieldClass.cssVarList.errorMessageIconSize,\n },\n {\n selector: () => PhoneFieldInputBoxClass.componentName,\n property: PhoneFieldInputBoxClass.cssVarList.errorMessageIconSize,\n },\n ],\n errorMessageIconPadding: [\n {\n selector: () => PhoneFieldClass.componentName,\n property: PhoneFieldClass.cssVarList.errorMessageIconPadding,\n },\n {\n selector: () => PhoneFieldInputBoxClass.componentName,\n property: PhoneFieldInputBoxClass.cssVarList.errorMessageIconPadding,\n },\n ],\n errorMessageIconRepeat: [\n {\n selector: () => PhoneFieldClass.componentName,\n property: PhoneFieldClass.cssVarList.errorMessageIconRepeat,\n },\n {\n selector: () => PhoneFieldInputBoxClass.componentName,\n property: PhoneFieldInputBoxClass.cssVarList.errorMessageIconRepeat,\n },\n ],\n errorMessageIconPosition: [\n {\n selector: () => PhoneFieldClass.componentName,\n property: PhoneFieldClass.cssVarList.errorMessageIconPosition,\n },\n {\n selector: () => PhoneFieldInputBoxClass.componentName,\n property: PhoneFieldInputBoxClass.cssVarList.errorMessageIconPosition,\n },\n ],\n errorMessageFontSize: [\n {\n selector: () => PhoneFieldClass.componentName,\n property: PhoneFieldClass.cssVarList.errorMessageFontSize,\n },\n {\n selector: () => PhoneFieldInputBoxClass.componentName,\n property: PhoneFieldInputBoxClass.cssVarList.errorMessageFontSize,\n },\n ],\n },\n }),\n draggableMixin,\n componentNameValidationMixin\n)(RawHybridField);\n","import '../descope-email-field';\nimport '../phone-fields/descope-phone-field';\nimport '../phone-fields/descope-phone-input-box-field';\n\nimport { componentName, HybridFieldClass } from './HybridFieldClass';\n\ncustomElements.define(componentName, HybridFieldClass);\n\nexport { HybridFieldClass, componentName };\n","import { syncAttrs } from '@descope-ui/common/components-helpers';\nimport { componentName as descopeInternalComponentName } from './descope-phone-input-box-internal/PhoneFieldInternalInputBox';\nimport { forwardAttrs, getComponentName } from '../../../helpers/componentHelpers';\nimport { compose } from '../../../helpers';\nimport {\n createProxy,\n createStyleMixin,\n draggableMixin,\n inputOverrideValidConstraintsMixin,\n proxyInputMixin,\n} from '../../../mixins';\nimport { TextFieldClass } from '../../descope-text-field/TextFieldClass';\nimport CountryCodes from '../CountryCodes';\nimport {\n resetInputLabelPosition,\n resetInputCursor,\n resetInputFieldDefaultWidth,\n resetInputFieldInvalidBackgroundColor,\n useHostExternalPadding,\n inputFloatingLabelStyle,\n} from '../../../helpers/themeHelpers/resetHelpers';\n\nconst textVars = TextFieldClass.cssVarList;\n\nexport const componentName = getComponentName('phone-input-box-field');\n\nconst customMixin = (superclass) =>\n class PhoneFieldInputBoxMixinClass extends superclass {\n static get CountryCodes() {\n return CountryCodes;\n }\n\n init() {\n super.init?.();\n\n const template = document.createElement('template');\n\n template.innerHTML = `\n\t\t\t\t<${descopeInternalComponentName}\n\t\t\t\t\ttabindex=\"-1\"\n\t\t\t\t\tslot=\"input\"\n\t\t\t\t></${descopeInternalComponentName}>\n `;\n\n this.baseElement.appendChild(template.content.cloneNode(true));\n\n this.inputElement = this.shadowRoot.querySelector(descopeInternalComponentName);\n\n syncAttrs(this, this.inputElement, { includeAttrs: ['has-value'] });\n\n forwardAttrs(this.shadowRoot.host, this.inputElement, {\n includeAttrs: [\n 'size',\n 'minlength',\n 'maxlength',\n 'default-code',\n 'disabled',\n 'phone-input-placeholder',\n 'label',\n 'label-type',\n 'allow-alphanumeric-input',\n 'restrict-countries',\n 'format-value',\n 'strict-validation',\n 'data-errormessage-type-mismatch',\n ],\n });\n }\n\n get phoneNumberInputEle() {\n return this.inputElement?.phoneNumberInputEle;\n }\n };\n\nconst {\n host,\n label,\n inputElement,\n requiredIndicator,\n inputField,\n internalComponent,\n internalComponentAfter,\n phoneInput,\n errorMessage,\n helperText,\n} = {\n host: { selector: () => ':host' },\n label: { selector: '::part(label)' },\n placeholder: { selector: '> input:placeholder-shown' },\n inputElement: { selector: 'input' },\n requiredIndicator: { selector: '[required]::part(required-indicator)::after' },\n inputField: { selector: () => 'vaadin-text-field::part(input-field)' },\n internalComponent: {\n selector: 'descope-phone-field-internal-input-box',\n },\n internalComponentAfter: {\n selector: 'descope-phone-field-internal-input-box::after',\n },\n phoneInput: { selector: () => 'descope-text-field' },\n helperText: { selector: '::part(helper-text)' },\n errorMessage: { selector: '::part(error-message)' },\n};\n\nexport const PhoneFieldInputBoxClass = compose(\n createStyleMixin({\n mappings: {\n fontSize: [\n host,\n inputField,\n {\n selector: TextFieldClass.componentName,\n property: TextFieldClass.cssVarList.fontSize,\n },\n ],\n fontFamily: [label, errorMessage, helperText],\n hostWidth: { ...host, property: 'width' },\n hostMinWidth: { ...host, property: 'min-width' },\n hostDirection: { ...host, property: 'direction' },\n\n inputHorizontalPadding: [\n { ...phoneInput, property: 'padding-left' },\n { ...phoneInput, property: 'padding-right' },\n ],\n\n labelFontSize: { ...label, property: 'font-size' },\n labelFontWeight: { ...label, property: 'font-weight' },\n labelTextColor: [\n { ...label, property: 'color' },\n { ...label, property: '-webkit-text-fill-color' },\n { ...requiredIndicator, property: 'color' },\n ],\n labelRequiredIndicator: { ...requiredIndicator, property: 'content' },\n errorMessageTextColor: { ...errorMessage, property: 'color' },\n\n errorMessageIcon: { ...errorMessage, property: 'background-image' },\n errorMessageIconSize: { ...errorMessage, property: 'background-size' },\n errorMessageIconPadding: { ...errorMessage, property: 'padding-inline-start' },\n errorMessageIconRepeat: { ...errorMessage, property: 'background-repeat' },\n errorMessageIconPosition: { ...errorMessage, property: 'background-position' },\n errorMessageFontSize: { ...errorMessage, property: 'font-size' },\n\n inputValueTextColor: { ...phoneInput, property: textVars.inputValueTextColor },\n\n inputPlaceholderTextColor: { ...phoneInput, property: textVars.inputPlaceholderColor },\n\n inputBorderStyle: { ...internalComponentAfter, property: 'border-style' },\n inputBorderWidth: { ...internalComponentAfter, property: 'border-width' },\n inputBorderColor: { ...internalComponentAfter, property: 'border-color' },\n inputBorderRadius: [\n { ...internalComponent, property: 'border-radius' },\n { ...internalComponentAfter, property: 'border-radius' },\n ],\n\n inputOutlineStyle: { ...internalComponent, property: 'outline-style' },\n inputOutlineColor: { ...internalComponent, property: 'outline-color' },\n inputOutlineWidth: { ...internalComponent, property: 'outline-width' },\n inputOutlineOffset: { ...internalComponent, property: 'outline-offset' },\n\n labelPosition: { ...label, property: 'position' },\n labelTopPosition: { ...label, property: 'top' },\n labelHorizontalPosition: [\n { ...label, property: 'left' },\n { ...label, property: 'right' },\n ],\n inputTransformY: { ...label, property: 'transform' },\n inputTransition: { ...label, property: 'transition' },\n marginInlineStart: { ...label, property: 'margin-inline-start' },\n valueInputHeight: { ...inputElement, property: 'height' },\n valueInputMarginBottom: {\n selector: TextFieldClass.componentName,\n property: textVars.valueInputMarginBottom,\n },\n },\n }),\n draggableMixin,\n inputOverrideValidConstraintsMixin,\n proxyInputMixin({ proxyProps: ['value', 'selectionStart'] }),\n customMixin\n)(\n createProxy({\n slots: [],\n wrappedEleName: 'vaadin-text-field',\n style: () => `\n :host {\n display: inline-flex;\n max-width: 100%;\n box-sizing: border-box;\n }\n ${useHostExternalPadding(PhoneFieldInputBoxClass.cssVarList)}\n ${resetInputCursor('vaadin-text-field')}\n ${resetInputFieldInvalidBackgroundColor('vaadin-text-field')}\n ${resetInputFieldDefaultWidth()}\n\n vaadin-text-field {\n width: 100%;\n box-sizing: border-box;\n padding: 0;\n }\n vaadin-text-field[focus-ring]::part(input-field) {\n box-shadow: none;\n }\n vaadin-text-field::before {\n height: 0;\n }\n vaadin-text-field::part(input-field) {\n padding: 0;\n background: transparent;\n -webkit-mask-image: none;\n }\n descope-phone-field-internal-input-box {\n -webkit-mask-image: none;\n padding: 0;\n width: 100%;\n }\n descope-phone-field-internal-input-box > div {\n width: 100%;\n }\n descope-phone-field-internal-input-box descope-text-field {\n ${textVars.inputOutlineWidth}: 0;\n ${textVars.inputOutlineOffset}: 0;\n }\n descope-phone-field-internal-input-box::after {\n content: '';\n position: absolute;\n width: 100%;\n height: 100%;\n top: 0;\n left: 0;\n box-sizing: border-box;\n pointer-events: none;\n }\n descope-text-field {\n flex-grow: 1;\n width: 100%;\n direction: ltr;\n }\n vaadin-text-field[readonly] > input:placeholder-shown {\n opacity: 1;\n }\n vaadin-text-field::part(input-field)::after {\n border: none;\n }\n\n vaadin-text-field[label-type=\"floating\"]:not([focused])[readonly] input:placeholder-shown {\n opacity: 0;\n }\n vaadin-text-field[label-type=\"floating\"]:not([focused])[disabled] input:placeholder-shown {\n opacity: 0;\n }\n\n ${resetInputLabelPosition('vaadin-text-field')}\n ${inputFloatingLabelStyle()}\n\t\t`,\n excludeAttrsSync: ['tabindex', 'style'],\n componentName,\n })\n);\n\nexport default PhoneFieldInputBoxClass;\n","import { forwardAttrs } from '@descope-ui/common/components-helpers';\nimport parsePhoneNumberFromString, { AsYouType } from 'libphonenumber-js/min';\nimport { createBaseInputClass } from '../../../../baseClasses/createBaseInputClass';\nimport { getComponentName } from '../../../../helpers/componentHelpers';\nimport { getCountryByCodeId, matchingParenthesis } from '../../helpers';\n\nexport const componentName = getComponentName('phone-field-internal-input-box');\n\nconst observedAttributes = [\n 'disabled',\n 'size',\n 'readonly',\n 'phone-input-placeholder',\n 'name',\n 'maxlength',\n 'autocomplete',\n 'label-type',\n];\nconst mapAttrs = {\n 'phone-input-placeholder': 'placeholder',\n};\n\nconst BaseInputClass = createBaseInputClass({ componentName, baseSelector: 'div' });\n\nclass PhoneFieldInternal extends BaseInputClass {\n static get observedAttributes() {\n return [].concat(BaseInputClass.observedAttributes || [], observedAttributes);\n }\n\n #ayt;\n\n constructor() {\n super();\n\n this.innerHTML = `\n <div>\n <descope-text-field tabindex=\"1\" type=\"tel\" bordered=\"false\"></descope-text-field>\n </div>\n `;\n\n this.textField = this.querySelector('descope-text-field');\n }\n\n // notice: this function is exposed in parent component\n get phoneNumberInputEle() {\n return this.textField.shadowRoot.querySelector('input');\n }\n\n get defaultDialCode() {\n return getCountryByCodeId(this.getAttribute('default-code'));\n }\n\n get defaultCode() {\n return this.getAttribute('default-code');\n }\n\n get allowAlphanumericInput() {\n return this.getAttribute('allow-alphanumeric-input') === 'true';\n }\n\n get minLength() {\n return parseInt(this.getAttribute('minlength'), 10) || 0;\n }\n\n get maxLength() {\n return parseInt(this.getAttribute('maxlength'), 10) || 50;\n }\n\n get restrictCountries() {\n return this.getAttribute('restrict-countries')?.split(',').filter(Boolean) || [];\n }\n\n get isFormatValue() {\n return this.getAttribute('format-value') === 'true';\n }\n\n get isStrictValidation() {\n return this.getAttribute('strict-validation') === 'true';\n }\n\n get value() {\n if (!this.textField.value) return '';\n\n if (!this.isStrictValidation) {\n return this.#nonParsedValue();\n }\n\n const parsedVal = this.#parseWithCountryCode();\n\n if (parsedVal?.country && parsedVal?.countryCallingCode && parsedVal?.nationalNumber) {\n return `+${[parsedVal?.countryCallingCode, parsedVal?.nationalNumber].join('-')}`;\n }\n\n // if failed to parse or to find country code return text field value\n return this.textField.value;\n }\n\n set value(val) {\n this.textField.value = val;\n }\n\n init() {\n this.addEventListener('focus', (e) => {\n // We want to ignore focus events we are dispatching\n if (e.isTrusted) this.textField.focus();\n });\n\n super.init?.();\n\n this.textField.addEventListener('input', this.#onInput.bind(this));\n this.handleFocusEventsDispatching([this.textField]);\n\n forwardAttrs(this.textField, this, { includeAttrs: ['has-value'] });\n }\n\n getValidity() {\n const validPhonePattern = /^\\+?\\d{1,4}-?(?:\\d-?){1,15}$/;\n const stripValue = this.#sanitizeVal(this.textField.value || '');\n\n if (this.isRequired && !this.textField.value) {\n return { valueMissing: true };\n }\n\n if (this.textField.value) {\n if (stripValue.length < this.minLength) {\n return { tooShort: true };\n }\n\n if (\n // has `strict-validation` and not properly parsed\n (this.isStrictValidation && this.textField.value && !this.#isValidParsedValue()) ||\n // if no `strict-validation` then conform with naive pattern\n (!this.isStrictValidation && this.textField.value && !validPhonePattern.test(this.value))\n ) {\n return { patternMismatch: true };\n }\n }\n\n return {};\n }\n\n setSelectionRange(...args) {\n this.textField.setSelectionRange(...args);\n }\n\n attributeChangedCallback(attrName, oldValue, newValue) {\n super.attributeChangedCallback(attrName, oldValue, newValue);\n\n if (oldValue !== newValue && observedAttributes.includes(attrName)) {\n const attr = mapAttrs[attrName] || attrName;\n this.textField.setAttribute(attr, newValue);\n }\n }\n\n #onInput(e) {\n let sanitizedInput = this.#sanitizeInput(e.target.value);\n\n if (this.isFormatValue && this.#canFormat(sanitizedInput)) {\n sanitizedInput = this.#formatPhoneNumber(sanitizedInput);\n }\n\n e.target.value = sanitizedInput;\n }\n\n #nonParsedValue() {\n if (!this.defaultDialCode) {\n return this.textField.value;\n }\n\n const nationalNumber = this.#trimDuplicateCountryCode(this.textField.value);\n const sanitizedVal = this.#sanitizeVal(nationalNumber);\n\n return [this.defaultDialCode, sanitizedVal].join('-');\n }\n\n #parseWithCountryCode() {\n if (this.defaultDialCode) {\n return parsePhoneNumberFromString(\n [this.defaultDialCode, this.#sanitizeVal(this.textField.value)].filter(Boolean).join('')\n );\n }\n\n // if default-code or not parsed - try to extract country code from value\n return parsePhoneNumberFromString(this.textField.value);\n }\n\n #sanitizeVal(val) {\n return val.replace(/\\D/g, '');\n }\n\n #trimDuplicateCountryCode(val) {\n if (this.textField.value?.[0] === '+') {\n const dialCodePrefixPattern = new RegExp(`^\\\\${this.defaultDialCode}`);\n const trimmed = val.replace(dialCodePrefixPattern, '');\n return trimmed;\n }\n return val;\n }\n\n #isValidParsedValue() {\n const parsed = parsePhoneNumberFromString(this.value);\n return (\n !!parsed && // parsed successfully (not undefined)\n !!parsed.isValid?.() && // Parsed object is valid\n !!parsed.country && // Parsed object with a country code\n !!this.#isAllowedCountry(parsed.country) && // Parsed with allowed country code\n (this.defaultCode ? this.defaultCode === parsed.country : true) // In case default country code is set validate parsed country matches it\n );\n }\n\n #isAllowedCountry(countryCode) {\n if (!this.restrictCountries.length) {\n return true;\n }\n\n return this.restrictCountries.includes(countryCode);\n }\n\n #sanitizeInput(val) {\n val = val\n .replace(/^-+/, '') // dash as first char\n .replace(/(?!^)\\+/g, '') // multiple plus symbols\n .replace('--', '-') // consecutive dashes\n .replace('+-', '+'); // dash following plus symbol\n\n if (!this.allowAlphanumericInput) {\n const telDigitsRegExp = /^[+\\d-\\(\\)]+$/;\n val = val\n .split('')\n .filter((char) => telDigitsRegExp.test(char))\n .join('');\n }\n\n return val;\n }\n\n #formatPhoneNumber(phoneNumber = '') {\n // Get country code from `default-code or` from phone number\n const countryCode = this.defaultCode || this.#getCountryCodeFromValue(phoneNumber);\n\n // Skip formatting if no country code is available\n if (!countryCode) {\n return phoneNumber;\n }\n\n // Update AsYouType country code if needed\n if (!this.#ayt || this.#ayt.country !== countryCode) {\n this.#ayt = new AsYouType(countryCode);\n }\n\n // We need to reset AsYouType instance before setting new input\n this.#ayt.reset();\n\n // Set AsYouType input\n const formattedVal = this.#ayt.input(phoneNumber) || phoneNumber;\n\n return formattedVal;\n }\n\n #getCountryCodeFromValue(val) {\n const parsed = parsePhoneNumberFromString(val);\n return parsed?.country || '';\n }\n\n #canFormat(val) {\n if (!matchingParenthesis(val)) return false;\n return true;\n }\n}\n\nexport default PhoneFieldInternal;\n","import '../../../descope-text-field';\n\nimport PhoneFieldInternalInputBox, { componentName } from './PhoneFieldInternalInputBox';\n\ncustomElements.define(componentName, PhoneFieldInternalInputBox);\n","import './descope-phone-input-box-internal';\nimport '../../descope-text-field';\n\nimport { componentName, PhoneFieldInputBoxClass } from './PhoneFieldInputBoxClass';\n\ncustomElements.define(componentName, PhoneFieldInputBoxClass);\n\nexport { PhoneFieldInputBoxClass, componentName };\n","import parsePhoneNumberFromString from 'libphonenumber-js/min';\nimport CountryCodes from './CountryCodes';\n\nexport const getCountryByCodeId = (countryCode) =>\n CountryCodes.find((c) => c.code === countryCode)?.dialCode;\n\nexport const matchingParenthesis = (val) => {\n const openParenMatches = val.match(/\\(/g);\n const closeParenMatches = val.match(/\\)/g);\n return openParenMatches?.length === closeParenMatches?.length;\n};\n"],"names":["emailField","moduleId","emailFieldStyles","EmailField","is","constructor","super","this","_setType","pattern","ready","inputElement","autocapitalize","componentName","EmailFieldClass","mappings","textFieldMappings","inputType","inputName","autocompleteType","includeAttrs","proxyProps","useProxyTargets","superclass","init","baseElement","setAttribute","getAttribute","createExternalInput","slots","wrappedEleName","style","cssVarList","inputOutlineWidth","inputOutlineOffset","excludeAttrsSync","customElements","define","INVALID_PHONE_CHARS_RE","attrs","shared","email","phone","countryCode","inputBox","attrMap","PHONE_FIELD","BaseClass","createBaseClass","baseSelector","HybridFieldClass","componentNameOverride","hostWidth","selector","property","hostDirection","errorMessageIcon","PhoneFieldClass","PhoneFieldInputBoxClass","errorMessageIconSize","errorMessageIconPadding","errorMessageIconRepeat","errorMessageIconPosition","errorMessageFontSize","attachShadow","mode","innerHTML","isExternalInput","emailInputEle","emailInput","externalInput","phoneVariant","phoneInputBoxInput","phoneCountryCodeInput","defaultCode","firstItem","countryCodes","activeInputEle","activeInput","phoneNumberInputEle","value","val","handleActiveInput","setTimeout","initInputs","updateAttrs","toggleInputVisibility","waitForInputs","initInputEles","overrideEmailInputType","overrideEmailSetAttribute","Promise","resolve","check","setInterval","clearInterval","shadowRoot","querySelector","inputs","forEach","ele","addEventListener","onValueChange","bind","origEmailSetAttr","name","hasAttribute","mapAttrs","input","selectionStart","expectedActiveInput","test","isNumericValue","setActiveInput","setActiveInputValue","reportValidity","setActiveInputSelectionStart","focus","setSelectionRange","code","match","CountryCodes","find","c","dialCode","sanitizedVal","replace","localName","countryCodeItems","classList","add","remove","origInputType","type","length","checkValidity","textVars","host","label","requiredIndicator","inputField","internalComponent","internalComponentAfter","phoneInput","errorMessage","helperText","placeholder","fontSize","fontFamily","hostMinWidth","inputHorizontalPadding","labelFontSize","labelFontWeight","labelTextColor","labelRequiredIndicator","errorMessageTextColor","inputValueTextColor","inputPlaceholderTextColor","inputPlaceholderColor","inputBorderStyle","inputBorderWidth","inputBorderColor","inputBorderRadius","inputOutlineStyle","inputOutlineColor","labelPosition","labelTopPosition","labelHorizontalPosition","inputTransformY","inputTransition","marginInlineStart","valueInputHeight","valueInputMarginBottom","template","document","createElement","appendChild","content","cloneNode","observedAttributes","BaseInputClass","concat","textField","defaultDialCode","allowAlphanumericInput","minLength","parseInt","maxLength","restrictCountries","split","filter","Boolean","isFormatValue","isStrictValidation","parsedVal","country","countryCallingCode","nationalNumber","join","e","isTrusted","handleFocusEventsDispatching","getValidity","validPhonePattern","stripValue","isRequired","valueMissing","tooShort","patternMismatch","args","attributeChangedCallback","attrName","oldValue","newValue","includes","attr","sanitizedInput","target","dialCodePrefixPattern","RegExp","parsed","isValid","telDigitsRegExp","char","phoneNumber","reset","getCountryByCodeId","matchingParenthesis","openParenMatches","closeParenMatches"],"sourceRoot":""}
1
+ {"version":3,"file":"descope-hybrid-field-index-js.js","mappings":";mOAQA,MAAMA,EAAa,IAAG;;;;;;;;GAUtB,QAAe,qBAAsB,CAAC,IAAkBA,GAAa,CACnEC,SAAU,qB,0BCXL,MAAMC,E,SAAmB,EAAG;;;;;;;;;GCEnC,QAAe,qBAAsBA,EAAkB,CAAED,SAAU,8BAyB5D,MAAME,UAAmB,IAC9B,aAAWC,GACT,MAAO,oBACT,CAEA,WAAAC,GACEC,QACAC,KAAKC,SAAS,SACdD,KAAKE,QAAU,gEACjB,CAGA,KAAAC,GACEJ,MAAMI,QAEFH,KAAKI,eACPJ,KAAKI,aAAaC,eAAiB,MAEvC,GAGF,OAAoBT,G,yDCtCb,MAAMU,GAAgB,QAAiB,eAqBjCC,GAAkB,SAC7B,QAAiB,CACfC,SAAUC,EAAA,IAEZ,MACA,QAAmB,CACjBC,UAAW,QACXC,UAAW,QACXC,iBAAkB,WAClBC,aAAc,CAAC,WAAY,WAAY,cAEzC,QAAgB,CAAEC,WAAY,CAAC,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AeC,OAAO,IAAe,I,wHCCrCD,eAAeC,OAAO,KAAe,K,uDCF9B,MAAM6L,EAAsBvL,GACjC,IAAa+E,KAAMC,GAAMA,EAAEJ,OAAS5E,IAAciF,SAEvCuG,EAAuBlJ,IAClC,MAAMmJ,EAAmBnJ,EAAIuC,MAAM,OAC7B6G,EAAoBpJ,EAAIuC,MAAM,OACpC,OAAO4G,GAAkB9F,SAAW+F,GAAmB/F,O","sources":["webpack://@descope/web-components-ui/../../../node_modules/@vaadin/email-field/theme/lumo/vaadin-email-field-styles.js","webpack://@descope/web-components-ui/../../../node_modules/@vaadin/email-field/src/vaadin-email-field-styles.js","webpack://@descope/web-components-ui/../../../node_modules/@vaadin/email-field/src/vaadin-email-field.js","webpack://@descope/web-components-ui/./src/components/descope-email-field/EmailFieldClass.js","webpack://@descope/web-components-ui/./src/components/descope-email-field/index.js","webpack://@descope/web-components-ui/./src/components/descope-hybrid-field/helpers.js","webpack://@descope/web-components-ui/./src/components/descope-hybrid-field/HybridFieldClass.js","webpack://@descope/web-components-ui/./src/components/descope-hybrid-field/index.js","webpack://@descope/web-components-ui/./src/components/phone-fields/descope-phone-input-box-field/PhoneFieldInputBoxClass.js","webpack://@descope/web-components-ui/./src/components/phone-fields/descope-phone-input-box-field/descope-phone-input-box-internal/PhoneFieldInternalInputBox.js","webpack://@descope/web-components-ui/./src/components/phone-fields/descope-phone-input-box-field/descope-phone-input-box-internal/index.js","webpack://@descope/web-components-ui/./src/components/phone-fields/descope-phone-input-box-field/index.js","webpack://@descope/web-components-ui/./src/components/phone-fields/helpers.js"],"sourcesContent":["/**\n * @license\n * Copyright (c) 2021 - 2023 Vaadin Ltd.\n * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/\n */\nimport { inputFieldShared } from '@vaadin/vaadin-lumo-styles/mixins/input-field-shared.js';\nimport { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';\n\nconst emailField = css`\n :host([dir='rtl']) [part='input-field'] ::slotted(input) {\n --_lumo-text-field-overflow-mask-image: linear-gradient(to left, transparent, #000 1.25em);\n }\n\n :host([dir='rtl']) [part='input-field'] ::slotted(input:placeholder-shown) {\n --_lumo-text-field-overflow-mask-image: none;\n }\n`;\n\nregisterStyles('vaadin-email-field', [inputFieldShared, emailField], {\n moduleId: 'lumo-email-field',\n});\n","/**\n * @license\n * Copyright (c) 2021 - 2023 Vaadin Ltd.\n * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/\n */\nimport { css } from 'lit';\n\n// See https://github.com/vaadin/vaadin-text-field/issues/466\nexport const emailFieldStyles = css`\n :host([dir='rtl']) [part='input-field'] {\n direction: ltr;\n }\n\n :host([dir='rtl']) [part='input-field'] ::slotted(input)::placeholder {\n direction: rtl;\n text-align: left;\n }\n`;\n","/**\n * @license\n * Copyright (c) 2021 - 2023 Vaadin Ltd.\n * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/\n */\nimport { defineCustomElement } from '@vaadin/component-base/src/define.js';\nimport { TextField } from '@vaadin/text-field/src/vaadin-text-field.js';\nimport { registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';\nimport { emailFieldStyles } from './vaadin-email-field-styles.js';\n\nregisterStyles('vaadin-email-field', emailFieldStyles, { moduleId: 'vaadin-email-field-styles' });\n\n/**\n * `<vaadin-email-field>` is a Web Component for email field control in forms.\n *\n * ```html\n * <vaadin-email-field label=\"Email\"></vaadin-email-field>\n * ```\n *\n * ### Styling\n *\n * `<vaadin-email-field>` provides the same set of shadow DOM parts and state attributes as `<vaadin-text-field>`.\n * See [`<vaadin-text-field>`](#/elements/vaadin-text-field) for the styling documentation.\n *\n * See [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.\n *\n * @fires {Event} input - Fired when the value is changed by the user: on every typing keystroke, and the value is cleared using the clear button.\n * @fires {Event} change - Fired when the user commits a value change.\n * @fires {CustomEvent} invalid-changed - Fired when the `invalid` property changes.\n * @fires {CustomEvent} value-changed - Fired when the `value` property changes.\n * @fires {CustomEvent} validated - Fired whenever the field is validated.\n *\n * @customElement\n * @extends TextField\n */\nexport class EmailField extends TextField {\n static get is() {\n return 'vaadin-email-field';\n }\n\n constructor() {\n super();\n this._setType('email');\n this.pattern = '^([a-zA-Z0-9_\\\\.\\\\-+])+@[a-zA-Z0-9\\\\-.]+\\\\.[a-zA-Z0-9\\\\-]{2,}$';\n }\n\n /** @protected */\n ready() {\n super.ready();\n\n if (this.inputElement) {\n this.inputElement.autocapitalize = 'off';\n }\n }\n}\n\ndefineCustomElement(EmailField);\n","import {\n createStyleMixin,\n draggableMixin,\n createProxy,\n proxyInputMixin,\n componentNameValidationMixin,\n externalInputMixin,\n} from '../../mixins';\nimport textFieldMappings from '../descope-text-field/textFieldMappings';\nimport { compose } from '../../helpers';\nimport { getComponentName } from '../../helpers/componentHelpers';\nimport {\n inputFloatingLabelStyle,\n resetInputLabelPosition,\n resetInputOverrides,\n useHostExternalPadding,\n} from '../../helpers/themeHelpers/resetHelpers';\n\nexport const componentName = getComponentName('email-field');\n\nconst defaultPattern = \"^[\\\\w\\\\.\\\\%\\\\+\\\\-']+@[\\\\w\\\\.\\\\-]+\\\\.[A-Za-z]{2,}$\";\nconst defaultAutocomplete = 'username';\n\nconst customMixin = (superclass) =>\n class EmailFieldMixinClass extends superclass {\n init() {\n super.init?.();\n\n // we need to set the pattern on the base element because vaadin-email-field is overriding it\n this.baseElement.setAttribute('pattern', defaultPattern);\n\n if (!this.getAttribute('autocomplete')) {\n this.setAttribute('autocomplete', defaultAutocomplete);\n }\n\n this.createExternalInput();\n }\n };\n\nexport const EmailFieldClass = compose(\n createStyleMixin({\n mappings: textFieldMappings,\n }),\n draggableMixin,\n externalInputMixin({\n inputType: 'email',\n inputName: 'email',\n autocompleteType: 'username',\n includeAttrs: ['disabled', 'readonly', 'pattern'],\n }),\n proxyInputMixin({ proxyProps: ['value', 'selectionStart'], useProxyTargets: true }),\n componentNameValidationMixin,\n customMixin\n)(\n createProxy({\n slots: ['', 'suffix'],\n wrappedEleName: 'vaadin-email-field',\n style: () => `\n\t\t\t:host {\n\t\t\t\tdisplay: inline-block;\n\t\t\t\tmax-width: 100%;\n\t\t\t\tpadding: calc(var(${EmailFieldClass.cssVarList.inputOutlineWidth}) + var(${\n EmailFieldClass.cssVarList.inputOutlineOffset\n }));\n box-sizing: border-box;\n\t\t\t}\n ${resetInputLabelPosition('vaadin-email-field')}\n\t\t\t${useHostExternalPadding(EmailFieldClass.cssVarList)}\n\t\t\t${resetInputOverrides('vaadin-email-field', EmailFieldClass.cssVarList)}\n ${inputFloatingLabelStyle()}\n\n vaadin-email-field[label-type=\"floating\"]:not([focused])[readonly] > input:placeholder-shown {\n opacity: 0;\n }\n vaadin-email-field[label-type=\"floating\"]:not([focused])[disabled] > input:placeholder-shown {\n opacity: 0;\n }\n\n :host ::slotted(*) {\n -webkit-mask-image: none;\n }\n\n vaadin-email-field[external-input=\"true\"] > input:not(:placeholder-shown) {\n opacity: 0;\n }\n\t\t`,\n excludeAttrsSync: ['tabindex', 'style'],\n componentName,\n })\n);\n","import '@vaadin/email-field';\nimport { componentName, EmailFieldClass } from './EmailFieldClass';\n\ncustomElements.define(componentName, EmailFieldClass);\n\nexport { EmailFieldClass, componentName };\n","// Matches any character that is not a digit, whitespace, or phone formatting character (+, -, (, ))\nconst INVALID_PHONE_CHARS_RE = /[^\\d\\s+\\-()]/;\n\nexport const isNumericValue = (val) => !!val && !INVALID_PHONE_CHARS_RE.test(val);\n\nexport const sanitizeCountryCodePrefix = (val) => val.replace(/\\+\\d+-/, '');\n","import { injectStyle } from '@descope-ui/common/components-helpers';\nimport { createStyleMixin, draggableMixin, componentNameValidationMixin } from '../../mixins';\nimport { createBaseClass } from '../../baseClasses/createBaseClass';\nimport { compose } from '../../helpers';\nimport { forwardAttrs, getComponentName } from '../../helpers/componentHelpers';\nimport { isNumericValue, sanitizeCountryCodePrefix as sanitizeValue } from './helpers';\nimport { PhoneFieldClass } from '../phone-fields/descope-phone-field/PhoneFieldClass';\nimport { PhoneFieldInputBoxClass } from '../phone-fields/descope-phone-input-box-field/PhoneFieldInputBoxClass';\n\nexport const componentName = getComponentName('hybrid-field');\n\nconst attrs = {\n shared: [\n 'label',\n 'bordered',\n 'full-width',\n 'label-type',\n 'size',\n 'disabled',\n 'readonly',\n 'required',\n 'st-host-direction',\n 'st-error-message-icon',\n 'st-error-message-icon-size',\n 'st-error-message-icon-padding',\n ],\n email: [\n 'placeholder',\n 'data-errormessage-value-missing-email',\n 'data-errormessage-pattern-mismatch-email',\n 'external-input',\n ],\n phone: {\n countryCode: [\n 'phone-input-label',\n 'country-input-label',\n 'country-input-placeholder',\n 'restrict-countries',\n 'default-code',\n 'phone-minlength',\n 'phone-format-value',\n 'phone-strict-validation',\n 'phone-input-type',\n 'data-errormessage-value-missing-phone',\n ],\n inputBox: [\n 'restrict-countries',\n 'default-code',\n 'phone-minlength',\n 'phone-format-value',\n 'phone-strict-validation',\n 'phone-input-type',\n 'data-errormessage-value-missing-phone',\n ],\n },\n};\n\nconst attrMap = {\n email: {\n 'data-errormessage-value-missing-email': 'data-errormessage-value-missing',\n 'data-errormessage-pattern-mismatch-email': 'data-errormessage-pattern-mismatch',\n },\n phone: {\n 'phone-input-label': 'label',\n 'phone-minlength': 'minlength',\n 'phone-format-value': 'format-value',\n 'phone-strict-validation': 'strict-validation',\n 'data-errormessage-value-missing-phone': 'data-errormessage-value-missing',\n },\n};\n\nconst EMAIL_FIELD = 'descope-email-field';\nconst PHONE_FIELD = 'descope-phone-field';\nconst PHONE_INPUT_BOX_FIELD = 'descope-phone-input-box-field';\n\nconst BaseClass = createBaseClass({\n componentName,\n baseSelector: 'div',\n});\n\nclass RawHybridField extends BaseClass {\n #isReportedValidity = false;\n\n #selectionStart;\n\n constructor() {\n super();\n\n this.attachShadow({ mode: 'open' }).innerHTML = `\n <div class=\"wrapper\">\n <descope-email-field external-input=\"${this.isExternalInput}\"></descope-email-field>\n <descope-phone-field allow-alphanumeric-input=\"true\" phone-input-type=\"text\"></descope-phone-field>\n <descope-phone-input-box-field allow-alphanumeric-input=\"true\" phone-input-type=\"text\"></descope-phone-input-box-field>\n </div>\n\t\t`;\n\n injectStyle(\n `\n :host {\n display: inline-flex;\n box-sizing: border-box;\n padding: 0;\n gap: 0;\n }\n .wrapper {\n display: grid;\n width: 100%;\n }\n descope-email-field,\n descope-phone-field,\n descope-phone-input-box-field {\n grid-area: 1/1;\n width: 100%;\n height: 100%;\n }\n .hidden {\n visibility: hidden;\n }\n `,\n this\n );\n }\n\n get isExternalInput() {\n return this.getAttribute('external-input') === 'true';\n }\n\n get emailInputEle() {\n return this.isExternalInput ? this.emailInput.externalInput : this.emailInput.inputElement;\n }\n\n get phoneVariant() {\n const isInputBox = this.getAttribute('phone-variant') === 'inputBox';\n return isInputBox ? this.phoneInputBoxInput : this.phoneCountryCodeInput;\n }\n\n get defaultCode() {\n const firstItem = this.phoneCountryCodeInput.countryCodes?.[0] || '';\n return this.getAttribute('default-code') || firstItem;\n }\n\n get activeInputEle() {\n if (this.activeInput === this.emailInput) {\n return this.emailInputEle;\n }\n return this.phoneVariant.phoneNumberInputEle;\n }\n\n get value() {\n return this.activeInput?.value || '';\n }\n\n set value(val) {\n this.handleActiveInput(val);\n setTimeout(() => {\n this.activeInput.value = val;\n });\n }\n\n async init() {\n super.init?.();\n\n this.initInputs();\n this.updateAttrs();\n this.toggleInputVisibility();\n\n await this.waitForInputs();\n\n this.initInputEles();\n this.overrideEmailInputType();\n this.overrideEmailSetAttribute();\n }\n\n waitForInputs() {\n return new Promise((resolve) => {\n const check = setInterval(() => {\n if (this.emailInputEle) {\n clearInterval(check);\n resolve();\n }\n });\n });\n }\n\n initInputs() {\n this.emailInput = this.shadowRoot.querySelector(EMAIL_FIELD);\n this.phoneCountryCodeInput = this.shadowRoot.querySelector(PHONE_FIELD);\n this.phoneInputBoxInput = this.shadowRoot.querySelector(PHONE_INPUT_BOX_FIELD);\n\n this.inputs = [this.emailInput, this.phoneCountryCodeInput, this.phoneInputBoxInput];\n\n this.activeInput = this.emailInput;\n }\n\n // we need to listen on the inner `input` element itself, otherwise we don't always get an `input` event\n initInputEles() {\n const inputEles = [\n this.emailInputEle,\n this.phoneCountryCodeInput.phoneNumberInputEle,\n this.phoneInputBoxInput.phoneNumberInputEle,\n ];\n\n inputEles.forEach((ele) => {\n ele.addEventListener('input', this.onValueChange.bind(this));\n });\n }\n\n overrideEmailInputType() {\n this.emailInputEle.addEventListener('focus', () => {\n this.emailInputEle.setAttribute('type', 'text');\n });\n this.emailInputEle.addEventListener('blur', () => {\n setTimeout(() => {\n this.emailInputEle.setAttribute('type', 'email');\n });\n });\n }\n\n // We want to prevent Vaadin from changing the input type to `email`\n // otherwise, we cannot get the selectionStart from the input.\n overrideEmailSetAttribute() {\n const origEmailSetAttr = this.emailInput.setAttribute.bind(this.emailInputEle);\n this.emailInputEle.setAttribute = (name, value) => {\n if (name !== 'type' || value !== 'email' || !this.emailInput.hasAttribute('focused')) {\n return origEmailSetAttr(name, value);\n }\n return false;\n };\n }\n\n updateAttrs() {\n forwardAttrs(this, this.emailInput, { includeAttrs: attrs.email, mapAttrs: attrMap.email });\n\n forwardAttrs(this, this.phoneCountryCodeInput, {\n includeAttrs: attrs.phone.countryCode,\n mapAttrs: attrMap.phone,\n });\n\n forwardAttrs(this, this.phoneInputBoxInput, {\n includeAttrs: attrs.phone.inputBox,\n mapAttrs: attrMap.phone,\n });\n\n this.inputs.forEach((input) => forwardAttrs(this, input, { includeAttrs: attrs.shared }));\n\n setTimeout(() => this.phoneCountryCodeInput.setAttribute('default-code', this.defaultCode));\n }\n\n onValueChange() {\n this.#selectionStart = this.activeInputEle.selectionStart;\n // phone components expose an API to their inputElement; in case of phone variants like\n // phone-input-box-field, we want to make sure that the value being passed\n // is raw value from input, and not the value with a dial-code prefix, or other decorations\n // applied behind the scenes by the phone components\n this.handleActiveInput(this.activeInputEle.value || this.activeInput.value);\n }\n\n handleActiveInput(val) {\n const expectedActiveInput = isNumericValue(val) ? this.phoneVariant : this.emailInput;\n\n if (this.activeInput !== expectedActiveInput) {\n this.setActiveInput(expectedActiveInput);\n }\n }\n\n setActiveInput(expectedActiveInput) {\n // phone components expose an API to their inputElement; in case of phone variants like\n // phone-input-box-field, we want to make sure that the value being passed\n // is raw value from input, and not the value with a dial-code prefix, or other decorations\n // applied behind the scenes by the phone components\n const val = this.activeInputEle.value || this.activeInput.value;\n\n this.activeInput = expectedActiveInput;\n this.setActiveInputValue(val);\n if (this.#isReportedValidity) this.activeInput.reportValidity();\n this.setActiveInputSelectionStart();\n this.toggleInputVisibility();\n }\n\n setActiveInputSelectionStart() {\n setTimeout(() => {\n this.activeInputEle.focus();\n this.activeInputEle.setSelectionRange?.(this.#selectionStart, this.#selectionStart);\n });\n }\n\n #getDefaultDialCode() {\n const code = this.getAttribute('default-code');\n const match = code && PhoneFieldClass.CountryCodes.find((c) => c.code === code);\n return match?.dialCode || PhoneFieldClass.CountryCodes[0]?.dialCode || '';\n }\n\n setActiveInputValue(val) {\n const sanitizedVal = sanitizeValue(val);\n const isPhoneField = this.activeInput.localName === PHONE_FIELD;\n if (isPhoneField) {\n const dialCode = this.phoneCountryCodeInput.countryCodeItems || this.#getDefaultDialCode();\n this.activeInput.value = `${dialCode}-${sanitizedVal}`;\n } else {\n this.activeInput.value = sanitizedVal;\n }\n }\n\n toggleInputVisibility() {\n this.inputs.forEach((input) => {\n input !== this.activeInput ? input.classList.add('hidden') : input.classList.remove('hidden');\n });\n }\n\n reportValidity() {\n this.#isReportedValidity = true;\n\n const ele = this.activeInputEle;\n\n // On reportValidity we want to set the caret at the end of the input value.\n // Since checkValidity triggers `focus` on the input, it sets the caret at the start of the input,\n // regardless the existing value.\n const origInputType = ele.type;\n ele.setAttribute('type', 'text');\n setTimeout(() => {\n ele.setSelectionRange?.(ele.value.length, ele.value.length);\n ele.setAttribute('type', origInputType);\n });\n\n return this.activeInput.reportValidity();\n }\n\n checkValidity() {\n return this.activeInput.checkValidity();\n }\n}\n\nexport const HybridFieldClass = compose(\n createStyleMixin({ componentNameOverride: getComponentName('input-wrapper') }),\n createStyleMixin({\n mappings: {\n hostWidth: { selector: () => ':host', property: 'width' },\n hostDirection: [\n { selector: () => 'descope-email-field', property: 'direction' },\n { selector: () => 'descope-phone-field', property: 'direction' },\n { selector: () => 'descope-phone-input-box-field', property: 'direction' },\n ],\n errorMessageIcon: [\n {\n selector: () => PhoneFieldClass.componentName,\n property: PhoneFieldClass.cssVarList.errorMessageIcon,\n },\n {\n selector: () => PhoneFieldInputBoxClass.componentName,\n property: PhoneFieldInputBoxClass.cssVarList.errorMessageIcon,\n },\n ],\n errorMessageIconSize: [\n {\n selector: () => PhoneFieldClass.componentName,\n property: PhoneFieldClass.cssVarList.errorMessageIconSize,\n },\n {\n selector: () => PhoneFieldInputBoxClass.componentName,\n property: PhoneFieldInputBoxClass.cssVarList.errorMessageIconSize,\n },\n ],\n errorMessageIconPadding: [\n {\n selector: () => PhoneFieldClass.componentName,\n property: PhoneFieldClass.cssVarList.errorMessageIconPadding,\n },\n {\n selector: () => PhoneFieldInputBoxClass.componentName,\n property: PhoneFieldInputBoxClass.cssVarList.errorMessageIconPadding,\n },\n ],\n errorMessageIconRepeat: [\n {\n selector: () => PhoneFieldClass.componentName,\n property: PhoneFieldClass.cssVarList.errorMessageIconRepeat,\n },\n {\n selector: () => PhoneFieldInputBoxClass.componentName,\n property: PhoneFieldInputBoxClass.cssVarList.errorMessageIconRepeat,\n },\n ],\n errorMessageIconPosition: [\n {\n selector: () => PhoneFieldClass.componentName,\n property: PhoneFieldClass.cssVarList.errorMessageIconPosition,\n },\n {\n selector: () => PhoneFieldInputBoxClass.componentName,\n property: PhoneFieldInputBoxClass.cssVarList.errorMessageIconPosition,\n },\n ],\n errorMessageFontSize: [\n {\n selector: () => PhoneFieldClass.componentName,\n property: PhoneFieldClass.cssVarList.errorMessageFontSize,\n },\n {\n selector: () => PhoneFieldInputBoxClass.componentName,\n property: PhoneFieldInputBoxClass.cssVarList.errorMessageFontSize,\n },\n ],\n },\n }),\n draggableMixin,\n componentNameValidationMixin\n)(RawHybridField);\n","import '../descope-email-field';\nimport '../phone-fields/descope-phone-field';\nimport '../phone-fields/descope-phone-input-box-field';\n\nimport { componentName, HybridFieldClass } from './HybridFieldClass';\n\ncustomElements.define(componentName, HybridFieldClass);\n\nexport { HybridFieldClass, componentName };\n","import { syncAttrs } from '@descope-ui/common/components-helpers';\nimport { componentName as descopeInternalComponentName } from './descope-phone-input-box-internal/PhoneFieldInternalInputBox';\nimport { forwardAttrs, getComponentName } from '../../../helpers/componentHelpers';\nimport { compose } from '../../../helpers';\nimport {\n createProxy,\n createStyleMixin,\n draggableMixin,\n inputOverrideValidConstraintsMixin,\n proxyInputMixin,\n} from '../../../mixins';\nimport { TextFieldClass } from '../../descope-text-field/TextFieldClass';\nimport CountryCodes from '../CountryCodes';\nimport {\n resetInputLabelPosition,\n resetInputCursor,\n resetInputFieldDefaultWidth,\n resetInputFieldInvalidBackgroundColor,\n useHostExternalPadding,\n inputFloatingLabelStyle,\n} from '../../../helpers/themeHelpers/resetHelpers';\n\nconst textVars = TextFieldClass.cssVarList;\n\nexport const componentName = getComponentName('phone-input-box-field');\n\nconst customMixin = (superclass) =>\n class PhoneFieldInputBoxMixinClass extends superclass {\n static get CountryCodes() {\n return CountryCodes;\n }\n\n init() {\n super.init?.();\n\n const template = document.createElement('template');\n\n template.innerHTML = `\n\t\t\t\t<${descopeInternalComponentName}\n\t\t\t\t\ttabindex=\"-1\"\n\t\t\t\t\tslot=\"input\"\n\t\t\t\t></${descopeInternalComponentName}>\n `;\n\n this.baseElement.appendChild(template.content.cloneNode(true));\n\n this.inputElement = this.shadowRoot.querySelector(descopeInternalComponentName);\n\n syncAttrs(this, this.inputElement, { includeAttrs: ['has-value'] });\n\n forwardAttrs(this.shadowRoot.host, this.inputElement, {\n includeAttrs: [\n 'size',\n 'minlength',\n 'maxlength',\n 'default-code',\n 'disabled',\n 'phone-input-placeholder',\n 'label',\n 'label-type',\n 'allow-alphanumeric-input',\n 'restrict-countries',\n 'format-value',\n 'strict-validation',\n 'data-errormessage-type-mismatch',\n 'phone-input-type',\n ],\n });\n }\n\n get phoneNumberInputEle() {\n return this.inputElement?.phoneNumberInputEle;\n }\n };\n\nconst {\n host,\n label,\n inputElement,\n requiredIndicator,\n inputField,\n internalComponent,\n internalComponentAfter,\n phoneInput,\n errorMessage,\n helperText,\n} = {\n host: { selector: () => ':host' },\n label: { selector: '::part(label)' },\n placeholder: { selector: '> input:placeholder-shown' },\n inputElement: { selector: 'input' },\n requiredIndicator: { selector: '[required]::part(required-indicator)::after' },\n inputField: { selector: () => 'vaadin-text-field::part(input-field)' },\n internalComponent: {\n selector: 'descope-phone-field-internal-input-box',\n },\n internalComponentAfter: {\n selector: 'descope-phone-field-internal-input-box::after',\n },\n phoneInput: { selector: () => 'descope-text-field' },\n helperText: { selector: '::part(helper-text)' },\n errorMessage: { selector: '::part(error-message)' },\n};\n\nexport const PhoneFieldInputBoxClass = compose(\n createStyleMixin({\n mappings: {\n fontSize: [\n host,\n inputField,\n {\n selector: TextFieldClass.componentName,\n property: TextFieldClass.cssVarList.fontSize,\n },\n ],\n fontFamily: [label, errorMessage, helperText],\n hostWidth: { ...host, property: 'width' },\n hostMinWidth: { ...host, property: 'min-width' },\n hostDirection: { ...host, property: 'direction' },\n\n inputHorizontalPadding: [\n { ...phoneInput, property: 'padding-left' },\n { ...phoneInput, property: 'padding-right' },\n ],\n\n labelFontSize: { ...label, property: 'font-size' },\n labelFontWeight: { ...label, property: 'font-weight' },\n labelTextColor: [\n { ...label, property: 'color' },\n { ...label, property: '-webkit-text-fill-color' },\n { ...requiredIndicator, property: 'color' },\n ],\n labelRequiredIndicator: { ...requiredIndicator, property: 'content' },\n errorMessageTextColor: { ...errorMessage, property: 'color' },\n\n errorMessageIcon: { ...errorMessage, property: 'background-image' },\n errorMessageIconSize: { ...errorMessage, property: 'background-size' },\n errorMessageIconPadding: { ...errorMessage, property: 'padding-inline-start' },\n errorMessageIconRepeat: { ...errorMessage, property: 'background-repeat' },\n errorMessageIconPosition: { ...errorMessage, property: 'background-position' },\n errorMessageFontSize: { ...errorMessage, property: 'font-size' },\n\n inputValueTextColor: { ...phoneInput, property: textVars.inputValueTextColor },\n\n inputPlaceholderTextColor: { ...phoneInput, property: textVars.inputPlaceholderColor },\n\n inputBorderStyle: { ...internalComponentAfter, property: 'border-style' },\n inputBorderWidth: { ...internalComponentAfter, property: 'border-width' },\n inputBorderColor: { ...internalComponentAfter, property: 'border-color' },\n inputBorderRadius: [\n { ...internalComponent, property: 'border-radius' },\n { ...internalComponentAfter, property: 'border-radius' },\n ],\n\n inputOutlineStyle: { ...internalComponent, property: 'outline-style' },\n inputOutlineColor: { ...internalComponent, property: 'outline-color' },\n inputOutlineWidth: { ...internalComponent, property: 'outline-width' },\n inputOutlineOffset: { ...internalComponent, property: 'outline-offset' },\n\n labelPosition: { ...label, property: 'position' },\n labelTopPosition: { ...label, property: 'top' },\n labelHorizontalPosition: [\n { ...label, property: 'left' },\n { ...label, property: 'right' },\n ],\n inputTransformY: { ...label, property: 'transform' },\n inputTransition: { ...label, property: 'transition' },\n marginInlineStart: { ...label, property: 'margin-inline-start' },\n valueInputHeight: { ...inputElement, property: 'height' },\n valueInputMarginBottom: {\n selector: TextFieldClass.componentName,\n property: textVars.valueInputMarginBottom,\n },\n },\n }),\n draggableMixin,\n inputOverrideValidConstraintsMixin,\n proxyInputMixin({ proxyProps: ['value', 'selectionStart'] }),\n customMixin\n)(\n createProxy({\n slots: [],\n wrappedEleName: 'vaadin-text-field',\n style: () => `\n :host {\n display: inline-flex;\n max-width: 100%;\n box-sizing: border-box;\n }\n ${useHostExternalPadding(PhoneFieldInputBoxClass.cssVarList)}\n ${resetInputCursor('vaadin-text-field')}\n ${resetInputFieldInvalidBackgroundColor('vaadin-text-field')}\n ${resetInputFieldDefaultWidth()}\n\n vaadin-text-field {\n width: 100%;\n box-sizing: border-box;\n padding: 0;\n }\n vaadin-text-field[focus-ring]::part(input-field) {\n box-shadow: none;\n }\n vaadin-text-field::before {\n height: 0;\n }\n vaadin-text-field::part(input-field) {\n padding: 0;\n background: transparent;\n -webkit-mask-image: none;\n }\n descope-phone-field-internal-input-box {\n -webkit-mask-image: none;\n padding: 0;\n width: 100%;\n }\n descope-phone-field-internal-input-box > div {\n width: 100%;\n }\n descope-phone-field-internal-input-box descope-text-field {\n ${textVars.inputOutlineWidth}: 0;\n ${textVars.inputOutlineOffset}: 0;\n }\n descope-phone-field-internal-input-box::after {\n content: '';\n position: absolute;\n width: 100%;\n height: 100%;\n top: 0;\n left: 0;\n box-sizing: border-box;\n pointer-events: none;\n }\n descope-text-field {\n flex-grow: 1;\n width: 100%;\n direction: ltr;\n }\n vaadin-text-field[readonly] > input:placeholder-shown {\n opacity: 1;\n }\n vaadin-text-field::part(input-field)::after {\n border: none;\n }\n\n vaadin-text-field[label-type=\"floating\"]:not([focused])[readonly] input:placeholder-shown {\n opacity: 0;\n }\n vaadin-text-field[label-type=\"floating\"]:not([focused])[disabled] input:placeholder-shown {\n opacity: 0;\n }\n\n ${resetInputLabelPosition('vaadin-text-field')}\n ${inputFloatingLabelStyle()}\n\t\t`,\n excludeAttrsSync: ['tabindex', 'style'],\n componentName,\n })\n);\n\nexport default PhoneFieldInputBoxClass;\n","import { forwardAttrs } from '@descope-ui/common/components-helpers';\nimport parsePhoneNumberFromString, { AsYouType } from 'libphonenumber-js/min';\nimport { createBaseInputClass } from '../../../../baseClasses/createBaseInputClass';\nimport { getComponentName } from '../../../../helpers/componentHelpers';\nimport { getCountryByCodeId, matchingParenthesis } from '../../helpers';\n\nexport const componentName = getComponentName('phone-field-internal-input-box');\n\nconst observedAttributes = [\n 'disabled',\n 'size',\n 'readonly',\n 'phone-input-placeholder',\n 'name',\n 'maxlength',\n 'autocomplete',\n 'label-type',\n 'phone-input-type',\n];\nconst mapAttrs = {\n 'phone-input-placeholder': 'placeholder',\n 'phone-input-type': 'type',\n};\n\nconst BaseInputClass = createBaseInputClass({ componentName, baseSelector: 'div' });\n\nclass PhoneFieldInternal extends BaseInputClass {\n static get observedAttributes() {\n return [].concat(BaseInputClass.observedAttributes || [], observedAttributes);\n }\n\n #ayt;\n\n constructor() {\n super();\n\n this.innerHTML = `\n <div>\n <descope-text-field tabindex=\"1\" type=\"tel\" bordered=\"false\"></descope-text-field>\n </div>\n `;\n\n this.textField = this.querySelector('descope-text-field');\n }\n\n // notice: this function is exposed in parent component\n get phoneNumberInputEle() {\n return this.textField.shadowRoot.querySelector('input');\n }\n\n get defaultDialCode() {\n return getCountryByCodeId(this.getAttribute('default-code'));\n }\n\n get defaultCode() {\n return this.getAttribute('default-code');\n }\n\n get allowAlphanumericInput() {\n return this.getAttribute('allow-alphanumeric-input') === 'true';\n }\n\n get minLength() {\n return parseInt(this.getAttribute('minlength'), 10) || 0;\n }\n\n get maxLength() {\n return parseInt(this.getAttribute('maxlength'), 10) || 50;\n }\n\n get restrictCountries() {\n return this.getAttribute('restrict-countries')?.split(',').filter(Boolean) || [];\n }\n\n get isFormatValue() {\n return this.getAttribute('format-value') === 'true';\n }\n\n get isStrictValidation() {\n return this.getAttribute('strict-validation') === 'true';\n }\n\n get value() {\n if (!this.textField.value) return '';\n\n if (!this.isStrictValidation) {\n return this.#nonParsedValue();\n }\n\n const parsedVal = this.#parseWithCountryCode();\n\n if (parsedVal?.country && parsedVal?.countryCallingCode && parsedVal?.nationalNumber) {\n return `+${[parsedVal?.countryCallingCode, parsedVal?.nationalNumber].join('-')}`;\n }\n\n // if failed to parse or to find country code return text field value\n return this.textField.value;\n }\n\n set value(val) {\n this.textField.value = val;\n }\n\n init() {\n this.addEventListener('focus', (e) => {\n // We want to ignore focus events we are dispatching\n if (e.isTrusted) this.textField.focus();\n });\n\n super.init?.();\n\n this.textField.addEventListener('input', this.#onInput.bind(this));\n this.handleFocusEventsDispatching([this.textField]);\n\n forwardAttrs(this.textField, this, { includeAttrs: ['has-value'] });\n\n forwardAttrs(this, this.textField, {\n includeAttrs: ['phone-input-type'],\n mapAttrs: { 'phone-input-type': 'type' },\n });\n }\n\n getValidity() {\n const validPhonePattern = /^\\+?\\d{1,4}-?(?:\\d-?){1,15}$/;\n const stripValue = this.#sanitizeVal(this.textField.value || '');\n\n if (this.isRequired && !this.textField.value) {\n return { valueMissing: true };\n }\n\n if (this.textField.value) {\n if (stripValue.length < this.minLength) {\n return { tooShort: true };\n }\n\n if (\n // has `strict-validation` and not properly parsed\n (this.isStrictValidation && this.textField.value && !this.#isValidParsedValue()) ||\n // if no `strict-validation` then conform with naive pattern\n (!this.isStrictValidation && this.textField.value && !validPhonePattern.test(this.value))\n ) {\n return { patternMismatch: true };\n }\n }\n\n return {};\n }\n\n setSelectionRange(...args) {\n this.textField.setSelectionRange(...args);\n }\n\n attributeChangedCallback(attrName, oldValue, newValue) {\n super.attributeChangedCallback(attrName, oldValue, newValue);\n\n if (oldValue !== newValue && observedAttributes.includes(attrName)) {\n const attr = mapAttrs[attrName] || attrName;\n this.textField.setAttribute(attr, newValue);\n }\n }\n\n #onInput(e) {\n let sanitizedInput = this.#sanitizeInput(e.target.value);\n\n if (this.isFormatValue && this.#canFormat(sanitizedInput)) {\n sanitizedInput = this.#formatPhoneNumber(sanitizedInput);\n }\n\n e.target.value = sanitizedInput;\n }\n\n #nonParsedValue() {\n if (!this.defaultDialCode) {\n return this.textField.value;\n }\n\n const nationalNumber = this.#trimDuplicateCountryCode(this.textField.value);\n const sanitizedVal = this.#sanitizeVal(nationalNumber);\n\n return [this.defaultDialCode, sanitizedVal].join('-');\n }\n\n #parseWithCountryCode() {\n if (this.defaultDialCode) {\n return parsePhoneNumberFromString(\n [this.defaultDialCode, this.#sanitizeVal(this.textField.value)].filter(Boolean).join('')\n );\n }\n\n // if default-code or not parsed - try to extract country code from value\n return parsePhoneNumberFromString(this.textField.value);\n }\n\n #sanitizeVal(val) {\n return val.replace(/\\D/g, '');\n }\n\n #trimDuplicateCountryCode(val) {\n if (this.textField.value?.[0] === '+') {\n const dialCodePrefixPattern = new RegExp(`^\\\\${this.defaultDialCode}`);\n const trimmed = val.replace(dialCodePrefixPattern, '');\n return trimmed;\n }\n return val;\n }\n\n #isValidParsedValue() {\n const parsed = parsePhoneNumberFromString(this.value);\n return (\n !!parsed && // parsed successfully (not undefined)\n !!parsed.isValid?.() && // Parsed object is valid\n !!parsed.country && // Parsed object with a country code\n !!this.#isAllowedCountry(parsed.country) && // Parsed with allowed country code\n (this.defaultCode ? this.defaultCode === parsed.country : true) // In case default country code is set validate parsed country matches it\n );\n }\n\n #isAllowedCountry(countryCode) {\n if (!this.restrictCountries.length) {\n return true;\n }\n\n return this.restrictCountries.includes(countryCode);\n }\n\n #sanitizeInput(val) {\n val = val\n .replace(/^-+/, '') // dash as first char\n .replace(/(?!^)\\+/g, '') // multiple plus symbols\n .replace('--', '-') // consecutive dashes\n .replace('+-', '+'); // dash following plus symbol\n\n if (!this.allowAlphanumericInput) {\n const telDigitsRegExp = /^[+\\d-\\(\\)]+$/;\n val = val\n .split('')\n .filter((char) => telDigitsRegExp.test(char))\n .join('');\n }\n\n return val;\n }\n\n #formatPhoneNumber(phoneNumber = '') {\n // Get country code from `default-code or` from phone number\n const countryCode = this.defaultCode || this.#getCountryCodeFromValue(phoneNumber);\n\n // Skip formatting if no country code is available\n if (!countryCode) {\n return phoneNumber;\n }\n\n // Update AsYouType country code if needed\n if (!this.#ayt || this.#ayt.country !== countryCode) {\n this.#ayt = new AsYouType(countryCode);\n }\n\n // We need to reset AsYouType instance before setting new input\n this.#ayt.reset();\n\n // Set AsYouType input\n const formattedVal = this.#ayt.input(phoneNumber) || phoneNumber;\n\n return formattedVal;\n }\n\n #getCountryCodeFromValue(val) {\n const parsed = parsePhoneNumberFromString(val);\n return parsed?.country || '';\n }\n\n #canFormat(val) {\n if (!matchingParenthesis(val)) return false;\n return true;\n }\n}\n\nexport default PhoneFieldInternal;\n","import '../../../descope-text-field';\n\nimport PhoneFieldInternalInputBox, { componentName } from './PhoneFieldInternalInputBox';\n\ncustomElements.define(componentName, PhoneFieldInternalInputBox);\n","import './descope-phone-input-box-internal';\nimport '../../descope-text-field';\n\nimport { componentName, PhoneFieldInputBoxClass } from './PhoneFieldInputBoxClass';\n\ncustomElements.define(componentName, PhoneFieldInputBoxClass);\n\nexport { PhoneFieldInputBoxClass, componentName };\n","import parsePhoneNumberFromString from 'libphonenumber-js/min';\nimport CountryCodes from './CountryCodes';\n\nexport const getCountryByCodeId = (countryCode) =>\n CountryCodes.find((c) => c.code === countryCode)?.dialCode;\n\nexport const matchingParenthesis = (val) => {\n const openParenMatches = val.match(/\\(/g);\n const closeParenMatches = val.match(/\\)/g);\n return openParenMatches?.length === closeParenMatches?.length;\n};\n"],"names":["emailField","moduleId","emailFieldStyles","EmailField","is","constructor","super","this","_setType","pattern","ready","inputElement","autocapitalize","componentName","EmailFieldClass","mappings","textFieldMappings","inputType","inputName","autocompleteType","includeAttrs","proxyProps","useProxyTargets","superclass","init","baseElement","setAttribute","getAttribute","createExternalInput","slots","wrappedEleName","style","cssVarList","inputOutlineWidth","inputOutlineOffset","excludeAttrsSync","customElements","define","INVALID_PHONE_CHARS_RE","attrs","shared","email","phone","countryCode","inputBox","attrMap","PHONE_FIELD","BaseClass","createBaseClass","baseSelector","HybridFieldClass","componentNameOverride","hostWidth","selector","property","hostDirection","errorMessageIcon","PhoneFieldClass","PhoneFieldInputBoxClass","errorMessageIconSize","errorMessageIconPadding","errorMessageIconRepeat","errorMessageIconPosition","errorMessageFontSize","attachShadow","mode","innerHTML","isExternalInput","emailInputEle","emailInput","externalInput","phoneVariant","phoneInputBoxInput","phoneCountryCodeInput","defaultCode","firstItem","countryCodes","activeInputEle","activeInput","phoneNumberInputEle","value","val","handleActiveInput","setTimeout","initInputs","updateAttrs","toggleInputVisibility","waitForInputs","initInputEles","overrideEmailInputType","overrideEmailSetAttribute","Promise","resolve","check","setInterval","clearInterval","shadowRoot","querySelector","inputs","forEach","ele","addEventListener","onValueChange","bind","origEmailSetAttr","name","hasAttribute","mapAttrs","input","selectionStart","expectedActiveInput","test","isNumericValue","setActiveInput","setActiveInputValue","reportValidity","setActiveInputSelectionStart","focus","setSelectionRange","code","match","CountryCodes","find","c","dialCode","sanitizedVal","replace","localName","countryCodeItems","classList","add","remove","origInputType","type","length","checkValidity","textVars","host","label","requiredIndicator","inputField","internalComponent","internalComponentAfter","phoneInput","errorMessage","helperText","placeholder","fontSize","fontFamily","hostMinWidth","inputHorizontalPadding","labelFontSize","labelFontWeight","labelTextColor","labelRequiredIndicator","errorMessageTextColor","inputValueTextColor","inputPlaceholderTextColor","inputPlaceholderColor","inputBorderStyle","inputBorderWidth","inputBorderColor","inputBorderRadius","inputOutlineStyle","inputOutlineColor","labelPosition","labelTopPosition","labelHorizontalPosition","inputTransformY","inputTransition","marginInlineStart","valueInputHeight","valueInputMarginBottom","template","document","createElement","appendChild","content","cloneNode","observedAttributes","BaseInputClass","concat","textField","defaultDialCode","allowAlphanumericInput","minLength","parseInt","maxLength","restrictCountries","split","filter","Boolean","isFormatValue","isStrictValidation","parsedVal","country","countryCallingCode","nationalNumber","join","e","isTrusted","handleFocusEventsDispatching","getValidity","validPhonePattern","stripValue","isRequired","valueMissing","tooShort","patternMismatch","args","attributeChangedCallback","attrName","oldValue","newValue","includes","attr","sanitizedInput","target","dialCodePrefixPattern","RegExp","parsed","isValid","telDigitsRegExp","char","phoneNumber","reset","getCountryByCodeId","matchingParenthesis","openParenMatches","closeParenMatches"],"sourceRoot":""}
@@ -1,2 +1,2 @@
1
- "use strict";(self.webpackChunk_descope_web_components_ui=self.webpackChunk_descope_web_components_ui||[]).push([[3847],{85386(e,t,a){a.r(t),a.d(t,{RecaptchaClass:()=>d,componentName:()=>r});var n=a(25964),s=a(79365),c=a(81365),i=a(9696),h=a(97810);const r=(0,h.xE)("recaptcha"),o=["enabled","site-key","action","enterprise"],p=(0,c.q)({componentName:r,baseSelector:":host > div"}),d=(0,i.Zz)(s.VO)(class extends p{static get observedAttributes(){return o.concat(p.observedAttributes||[])}attributeChangedCallback(e,t,a){super.attributeChangedCallback?.(e,t,a),t!==a&&"enabled"===e&&this.#e("true"===a)}renderRecaptcha(e){this.children.length?this.updatePreview():this.toggleRecaptchaEles(e)}toggleRecaptchaEles(e){e?(this.recaptchaEle.style.display="",this.mockRecaptchaEle.style.display="none"):(this.recaptchaEle.style.display="none",this.mockRecaptchaEle.style.display="")}constructor(){super(),this.attachShadow({mode:"open"}).innerHTML='\n <div class="badge">\n <span id="recaptcha"></span>\n <img src="https://imgs.descope.com/connectors/templates/recaptcha/recaptcha-big.png" alt="recaptcha"/>\n </div>\n <slot></slot>\n\t',(0,n.fz)('\n :host {\n display: inline-flex;\n }\n :host > div:not(.hidden) {\n display: flex;\n }\n :host #recaptcha .grecaptcha-badge {\n box-shadow: none !important;\n }\n :host #recaptcha .grecaptcha-logo {\n height: 100%;\n }\n :host #recaptcha {\n\t\t\t\twidth: 100%;\n height: 100%;\n\t\t\t}\n :host img {\n width: 256px;\n }\n :host([full-width="true"]) {\n width: 100%;\n }\n .hidden {\n display: none;\n }\n ',this),this.recaptchaEle=this.baseElement.querySelector("#recaptcha"),this.mockRecaptchaEle=this.baseElement.querySelector("img"),this.badge=this.shadowRoot.querySelector(".badge")}init(){super.init?.(),(0,h.Ge)(this,this.updatePreview.bind(this))}updatePreview(){this.children.length?(this.recaptchaEle.style.display="none",this.mockRecaptchaEle.style.display="none",this.badge.classList.add("hidden")):(this.toggleRecaptchaEles(this.enabled),this.badge.classList.remove("hidden"))}get enterprise(){return"true"===this.getAttribute("enterprise")}get siteKey(){return this.getAttribute("site-key")}get action(){return this.getAttribute("action")||"load"}get enabled(){return"true"===this.getAttribute("enabled")}get scriptURL(){const e=new URL("https://www.google.com/recaptcha/");return e.pathname+=(this.enterprise?"enterprise":"api")+".js",e.searchParams.append("onload","onRecaptchaLoadCallback"),e.searchParams.append("render","explicit"),e.toString()}#e(e){this.renderRecaptcha(e),e&&(this.#t(),document.getElementById("recaptcha-script")?window.onRecaptchaLoadCallback():this.#a())}#a(){const e=document.createElement("script");e.src=this.scriptURL,e.async=!0,e.id="recaptcha-script",e.defer=!0,document.body.appendChild(e)}get grecaptchaInstance(){return this.enterprise?window.grecaptcha?.enterprise:window.grecaptcha}#n(e,t,a){this.isConnected&&e.ready(()=>{const n=t.querySelector('textarea[name^="g-recaptcha-response"]')?.cloneNode();if(n&&(n.style.display="none",document.body.appendChild(n)),!this.siteKey)return;const s=e?.execute(a,{action:this.action});s.then((s,c)=>{c?console.warn("could not execute recaptcha",c):(this.updateComponentsContext({risktoken:s,riskaction:this.action}),this.isConnected&&setTimeout(()=>{this.#n(e,t,a)},11e4)),n.remove()})})}#t(){window.onRecaptchaLoadCallback=()=>{const e=this.recaptchaEle;if(e.hasChildNodes())return;const{grecaptchaInstance:t}=this;t&&setTimeout(()=>{const a=t.render(e,{sitekey:this.siteKey,badge:"inline",size:"invisible"});this.#n(t,e,a)},0)}}});customElements.define(r,d)}}]);
1
+ "use strict";(self.webpackChunk_descope_web_components_ui=self.webpackChunk_descope_web_components_ui||[]).push([[3847],{85386(e,t,a){a.r(t),a.d(t,{RecaptchaClass:()=>o,componentName:()=>r});var i=a(25964),s=a(79365),c=a(81365),n=a(9696),h=a(97810);const r=(0,h.xE)("recaptcha"),d=["enabled","site-key","action","enterprise","variant"],p=(0,c.q)({componentName:r,baseSelector:":host > div"}),o=(0,n.Zz)(s.VO)(class extends p{static get observedAttributes(){return d.concat(p.observedAttributes||[])}attributeChangedCallback(e,t,a){super.attributeChangedCallback?.(e,t,a),t!==a&&("enabled"===e&&this.#e("true"===a),"variant"===e&&this.updatePreview())}renderRecaptcha(e){this.children.length?this.updatePreview():this.toggleRecaptchaEles(e)}displayRecaptcha(){this.isWidget?this.displayWidget():this.displayDeprecated()}displayWidget(){this.mockRecaptchaEle.style.display="none",this.recaptchaWidgetEle.style.display="",this.depercatedRecaptchaEle.style.display="none"}hideRecaptcha(){this.recaptchaWidgetEle.style.display="none",this.depercatedRecaptchaEle.style.display="none",this.mockRecaptchaEle.style.display=""}displayDeprecated(){this.mockRecaptchaEle.style.display="none",this.recaptchaWidgetEle.style.display="none",this.depercatedRecaptchaEle.style.display=""}toggleRecaptchaEles(e){e?this.displayRecaptcha():this.hideRecaptcha()}constructor(){super(),this.attachShadow({mode:"open"}).innerHTML='\n <div class="badge">\n <span id="recaptcha"></span>\n <span id="recaptcha-widget"></span>\n <input id="recaptcha-widget-input" type="hidden" name="recaptcha-widget" required />\n <img src="https://imgs.descope.com/connectors/templates/recaptcha/recaptcha-big.png" alt="recaptcha"/>\n </div>\n <slot></slot>\n\t',(0,i.fz)('\n :host {\n display: inline-flex;\n }\n :host > div:not(.hidden) {\n display: flex;\n }\n :host #recaptcha .grecaptcha-badge {\n box-shadow: none !important;\n }\n :host #recaptcha .grecaptcha-logo {\n height: 100%;\n }\n :host #recaptcha {\n\t\t\t\twidth: 100%;\n height: 100%;\n\t\t\t}\n :host #recaptcha-widget {\n width: 100%;\n height: 100%;\n }\n :host #recaptcha-widget-input {\n display: none;\n }\n :host img {\n width: 256px;\n }\n :host([full-width="true"]) {\n width: 100%;\n }\n .hidden {\n display: none;\n }\n ',this),this.depercatedRecaptchaEle=this.baseElement.querySelector("#recaptcha"),this.recaptchaWidgetEle=this.baseElement.querySelector("#recaptcha-widget"),this.recaptchaWidgetInputEle=this.baseElement.querySelector("#recaptcha-widget-input"),this.mockRecaptchaEle=this.baseElement.querySelector("img"),this.badge=this.shadowRoot.querySelector(".badge")}init(){super.init?.(),(0,h.Ge)(this,this.updatePreview.bind(this))}updatePreview(){this.children.length?(this.depercatedRecaptchaEle.style.display="none",this.recaptchaWidgetEle.style.display="none",this.mockRecaptchaEle.style.display="none",this.badge.classList.add("hidden")):(this.toggleRecaptchaEles(this.enabled),this.badge.classList.remove("hidden"))}getValidity(){return this.isWidget?this.recaptchaWidgetInputEle.value?{}:{valueMissing:!0}:{}}checkValidity(){return!this.isWidget||!!this.recaptchaWidgetInputEle.value}get enterprise(){return"true"===this.getAttribute("enterprise")}get siteKey(){return this.getAttribute("site-key")}get action(){return this.getAttribute("action")||"load"}get enabled(){return"true"===this.getAttribute("enabled")}get variant(){return this.getAttribute("variant")||"text"}get isWidget(){return"widget"===this.variant}get scriptURL(){const e=new URL("https://www.google.com/recaptcha/");return e.pathname+=(this.enterprise?"enterprise":"api")+".js",e.searchParams.append("onload","onRecaptchaLoadCallback"),e.searchParams.append("render","explicit"),e.toString()}#e(e){this.renderRecaptcha(e),this.isWidget||e&&(this.#t(),document.getElementById("recaptcha-script")?window.onRecaptchaLoadCallback():this.#a())}#a(){const e=document.createElement("script");e.src=this.scriptURL,e.async=!0,e.id="recaptcha-script",e.defer=!0,document.body.appendChild(e)}get grecaptchaInstance(){return this.enterprise?window.grecaptcha?.enterprise:window.grecaptcha}#i(e,t,a){this.isConnected&&e.ready(()=>{const i=t.querySelector('textarea[name^="g-recaptcha-response"]')?.cloneNode();if(i&&(i.style.display="none",document.body.appendChild(i)),!this.siteKey)return;const s=e?.execute(a,{action:this.action});s.then((s,c)=>{c?console.warn("could not execute recaptcha",c):(this.updateComponentsContext({risktoken:s,riskaction:this.action}),this.isConnected&&setTimeout(()=>{this.#i(e,t,a)},11e4)),i.remove()})})}#t(){window.onRecaptchaLoadCallback=()=>{const e=this.depercatedRecaptchaEle;if(e.hasChildNodes())return;const{grecaptchaInstance:t}=this;t&&setTimeout(()=>{const a=t.render(e,{sitekey:this.siteKey,badge:"inline",size:"invisible"});this.#i(t,e,a)},0)}}});customElements.define(r,o)}}]);
2
2
  //# sourceMappingURL=descope-recaptcha-index-js.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"descope-recaptcha-index-js.js","mappings":"yPAMO,MAAMA,GAAgB,QAAiB,aAExCC,EAAqB,CAAC,UAAW,WAAY,SAAU,cAEvDC,GAAY,EAAAC,EAAA,GAAgB,CAChCH,gBACAI,aAAc,gBA8NHC,GAAiB,QAAQ,KAAR,CA5N9B,cAA2BH,EACzB,6BAAWD,GACT,OAAOA,EAAmBK,OAA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dT,MAAO,SACPmD,KAAM,cAERpE,MAAK,EAAa+C,EAAoBE,EAAaC,IAClD,GAEP,ICrOFmB,eAAeC,OAAOlF,EAAeK,E","sources":["webpack://@descope/web-components-ui/./src/components/descope-recaptcha/RecaptchaClass.js","webpack://@descope/web-components-ui/./src/components/descope-recaptcha/index.js"],"sourcesContent":["import { injectStyle } from '@descope-ui/common/components-helpers';\nimport { draggableMixin } from '../../mixins';\nimport { createBaseClass } from '../../baseClasses/createBaseClass';\nimport { compose } from '../../helpers';\nimport { getComponentName, observeChildren } from '../../helpers/componentHelpers';\n\nexport const componentName = getComponentName('recaptcha');\n\nconst observedAttributes = ['enabled', 'site-key', 'action', 'enterprise'];\n\nconst BaseClass = createBaseClass({\n componentName,\n baseSelector: ':host > div',\n});\nclass RawRecaptcha extends BaseClass {\n static get observedAttributes() {\n return observedAttributes.concat(BaseClass.observedAttributes || []);\n }\n\n attributeChangedCallback(attrName, oldValue, newValue) {\n super.attributeChangedCallback?.(attrName, oldValue, newValue);\n if (oldValue !== newValue) {\n if (attrName === 'enabled') {\n this.#toggleRecaptcha(newValue === 'true');\n }\n }\n }\n\n renderRecaptcha(enabled) {\n if (this.children.length) {\n this.updatePreview();\n return;\n }\n\n this.toggleRecaptchaEles(enabled);\n }\n\n toggleRecaptchaEles(enabled) {\n if (enabled) {\n this.recaptchaEle.style.display = '';\n this.mockRecaptchaEle.style.display = 'none';\n } else {\n this.recaptchaEle.style.display = 'none';\n this.mockRecaptchaEle.style.display = '';\n }\n }\n\n constructor() {\n super();\n\n this.attachShadow({ mode: 'open' }).innerHTML = `\n <div class=\"badge\">\n <span id=\"recaptcha\"></span>\n <img src=\"https://imgs.descope.com/connectors/templates/recaptcha/recaptcha-big.png\" alt=\"recaptcha\"/>\n </div>\n <slot></slot>\n\t`;\n\n injectStyle(\n `\n :host {\n display: inline-flex;\n }\n :host > div:not(.hidden) {\n display: flex;\n }\n :host #recaptcha .grecaptcha-badge {\n box-shadow: none !important;\n }\n :host #recaptcha .grecaptcha-logo {\n height: 100%;\n }\n :host #recaptcha {\n\t\t\t\twidth: 100%;\n height: 100%;\n\t\t\t}\n :host img {\n width: 256px;\n }\n :host([full-width=\"true\"]) {\n width: 100%;\n }\n .hidden {\n display: none;\n }\n `,\n this\n );\n\n this.recaptchaEle = this.baseElement.querySelector('#recaptcha');\n this.mockRecaptchaEle = this.baseElement.querySelector('img');\n this.badge = this.shadowRoot.querySelector('.badge');\n }\n\n init() {\n super.init?.();\n\n observeChildren(this, this.updatePreview.bind(this));\n }\n\n updatePreview() {\n if (this.children.length) {\n this.recaptchaEle.style.display = 'none';\n this.mockRecaptchaEle.style.display = 'none';\n this.badge.classList.add('hidden');\n } else {\n this.toggleRecaptchaEles(this.enabled);\n this.badge.classList.remove('hidden');\n }\n }\n\n get enterprise() {\n return this.getAttribute('enterprise') === 'true';\n }\n\n get siteKey() {\n return this.getAttribute('site-key');\n }\n\n get action() {\n return this.getAttribute('action') || 'load';\n }\n\n get enabled() {\n return this.getAttribute('enabled') === 'true';\n }\n\n get scriptURL() {\n const url = new URL('https://www.google.com/recaptcha/');\n url.pathname += `${this.enterprise ? 'enterprise' : 'api'}.js`;\n url.searchParams.append('onload', 'onRecaptchaLoadCallback');\n url.searchParams.append('render', 'explicit');\n return url.toString();\n }\n\n #toggleRecaptcha(enabled) {\n this.renderRecaptcha(enabled);\n if (enabled) {\n this.#createOnLoadScript();\n if (!document.getElementById('recaptcha-script')) {\n this.#loadRecaptchaScript();\n } else {\n window.onRecaptchaLoadCallback();\n }\n }\n }\n\n #loadRecaptchaScript() {\n const script = document.createElement('script');\n script.src = this.scriptURL;\n script.async = true;\n script.id = 'recaptcha-script';\n script.defer = true;\n document.body.appendChild(script);\n }\n\n get grecaptchaInstance() {\n return this.enterprise ? window.grecaptcha?.enterprise : window.grecaptcha;\n }\n\n #getNewToken(grecaptchaInstance, currentNode, recaptchaWidgetId) {\n if (!this.isConnected) {\n return;\n }\n\n grecaptchaInstance.ready(() => {\n // clone the node and append it to the body so that it can be used by the grepcaptcha script\n const cloneNode = currentNode\n .querySelector('textarea[name^=\"g-recaptcha-response\"]')\n ?.cloneNode();\n if (cloneNode) {\n cloneNode.style.display = 'none';\n document.body.appendChild(cloneNode);\n }\n\n // cleaning up the recaptcha element we added to the body\n const removeCloneNode = () => {\n cloneNode.remove();\n };\n\n if (!this.siteKey) {\n return;\n }\n // we should pass recaptchaWidgetId, but this does not allow us to run execute multiple times\n // also calling grecaptchaInstance.reset() does not work\n const exec = grecaptchaInstance?.execute(recaptchaWidgetId, { action: this.action });\n exec.then((token, e) => {\n if (e) {\n // eslint-disable-next-line no-console\n console.warn('could not execute recaptcha', e);\n } else {\n this.updateComponentsContext({\n risktoken: token,\n riskaction: this.action,\n });\n // if the component is still connected, we should try to get a new token before the token expires (2 minutes)\n if (this.isConnected) {\n setTimeout(() => {\n this.#getNewToken(grecaptchaInstance, currentNode, recaptchaWidgetId);\n }, 110000);\n }\n }\n removeCloneNode();\n });\n });\n }\n\n #createOnLoadScript() {\n window.onRecaptchaLoadCallback = () => {\n const currentNode = this.recaptchaEle;\n\n // if there are child nodes, it means that the recaptcha was already rendered\n if (currentNode.hasChildNodes()) {\n return;\n }\n\n const { grecaptchaInstance } = this;\n\n if (!grecaptchaInstance) {\n return;\n }\n\n setTimeout(() => {\n const recaptchaWidgetId = grecaptchaInstance.render(currentNode, {\n sitekey: this.siteKey,\n badge: 'inline',\n size: 'invisible',\n });\n this.#getNewToken(grecaptchaInstance, currentNode, recaptchaWidgetId);\n }, 0);\n };\n }\n}\n\nexport const RecaptchaClass = compose(draggableMixin)(RawRecaptcha);\n","import { componentName, RecaptchaClass } from './RecaptchaClass';\n\ncustomElements.define(componentName, RecaptchaClass);\n\nexport { RecaptchaClass, componentName };\n"],"names":["componentName","observedAttributes","BaseClass","createBaseClass","baseSelector","RecaptchaClass","concat","attributeChangedCallback","attrName","oldValue","newValue","super","this","renderRecaptcha","enabled","children","length","updatePreview","toggleRecaptchaEles","recaptchaEle","style","display","mockRecaptchaEle","constructor","attachShadow","mode","innerHTML","baseElement","querySelector","badge","shadowRoot","init","bind","classList","add","remove","enterprise","getAttribute","siteKey","action","scriptURL","url","URL","pathname","searchParams","append","toString","document","getElementById","window","onRecaptchaLoadCallback","script","createElement","src","async","id","defer","body","appendChild","grecaptchaInstance","grecaptcha","currentNode","recaptchaWidgetId","isConnected","ready","cloneNode","exec","execute","then","token","e","console","warn","updateComponentsContext","risktoken","riskaction","setTimeout","hasChildNodes","render","sitekey","size","customElements","define"],"sourceRoot":""}
1
+ {"version":3,"file":"descope-recaptcha-index-js.js","mappings":"yPAMO,MAAMA,GAAgB,QAAiB,aAExCC,EAAqB,CAAC,UAAW,WAAY,SAAU,aAAc,WAErEC,GAAY,EAAAC,EAAA,GAAgB,CAChCH,gBACAI,aAAc,gBAuSHC,GAAiB,QAAQ,KAAR,CArS9B,cAA2BH,EACzB,6BAAWD,GACT,OAAOA,EAAmBK,OAAOJ,EAAUD,oBAAsB,GACnE,CAEA,wBAAAM,CAAyBC,EAAUC,EAAUC,GAC3CC,MAAMJ,2BAA2BC,EAAUC,EAAUC,GACjDD,IAAaC,IACE,YAAbF,GACFI,MAAK,EAA8B,SAAbF,GAGP,YAAbF,GACFI,KAAKC,gBAGX,CAEA,eAAAC,CAAgBC,GACVH,KAAKI,SAASC,OAChBL,KAAKC,gBAIPD,KAAKM,oBAAoBH,EAC3B,CAEA,gBAAAI,GACMP,KAAKQ,SACPR,KAAKS,gBAELT,KAAKU,mBAET,CAEA,aAAAD,GACET,KAAKW,iBAAiBC,MAAMC,QAAU,OACtCb,KAAKc,mBAAmBF,MAAMC,QAAU,GACxCb,KAAKe,uBAAuBH,MAAMC,QAAU,MAC9C,CAEA,aAAAG,GACEhB,KAAKc,mBAAmBF,MAAMC,QAAU,OACxCb,KAAKe,uBAAuBH,MAAMC,QAAU,OAC5Cb,KAAKW,iBAAiBC,MAAMC,QAAU,EACxC,CAEA,iBAAAH,GACEV,KAAKW,iBAAiBC,M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AAKe,uBAGzB,GAAI8C,EAAYgB,gBACd,OAGF,MAAM,mBAAElB,GAAuB3D,KAE1B2D,GAILiB,WAAW,KACT,MAAMd,EAAoBH,EAAmBmB,OAAOjB,EAAa,CAC/DkB,QAAS/E,KAAKqC,QACdb,MAAO,SACPwD,KAAM,cAERhF,MAAK,EAAa2D,EAAoBE,EAAaC,IAClD,GAEP,IC9SFmB,eAAeC,OAAO9F,EAAeK,E","sources":["webpack://@descope/web-components-ui/./src/components/descope-recaptcha/RecaptchaClass.js","webpack://@descope/web-components-ui/./src/components/descope-recaptcha/index.js"],"sourcesContent":["import { injectStyle } from '@descope-ui/common/components-helpers';\nimport { draggableMixin } from '../../mixins';\nimport { createBaseClass } from '../../baseClasses/createBaseClass';\nimport { compose } from '../../helpers';\nimport { getComponentName, observeChildren } from '../../helpers/componentHelpers';\n\nexport const componentName = getComponentName('recaptcha');\n\nconst observedAttributes = ['enabled', 'site-key', 'action', 'enterprise', 'variant'];\n\nconst BaseClass = createBaseClass({\n componentName,\n baseSelector: ':host > div',\n});\nclass RawRecaptcha extends BaseClass {\n static get observedAttributes() {\n return observedAttributes.concat(BaseClass.observedAttributes || []);\n }\n\n attributeChangedCallback(attrName, oldValue, newValue) {\n super.attributeChangedCallback?.(attrName, oldValue, newValue);\n if (oldValue !== newValue) {\n if (attrName === 'enabled') {\n this.#toggleRecaptcha(newValue === 'true');\n }\n\n if (attrName === 'variant') {\n this.updatePreview();\n }\n }\n }\n\n renderRecaptcha(enabled) {\n if (this.children.length) {\n this.updatePreview();\n return;\n }\n\n this.toggleRecaptchaEles(enabled);\n }\n\n displayRecaptcha() {\n if (this.isWidget) {\n this.displayWidget();\n } else {\n this.displayDeprecated();\n }\n }\n\n displayWidget() {\n this.mockRecaptchaEle.style.display = 'none';\n this.recaptchaWidgetEle.style.display = '';\n this.depercatedRecaptchaEle.style.display = 'none';\n }\n\n hideRecaptcha() {\n this.recaptchaWidgetEle.style.display = 'none';\n this.depercatedRecaptchaEle.style.display = 'none';\n this.mockRecaptchaEle.style.display = '';\n }\n\n displayDeprecated() {\n this.mockRecaptchaEle.style.display = 'none';\n this.recaptchaWidgetEle.style.display = 'none';\n this.depercatedRecaptchaEle.style.display = '';\n }\n\n toggleRecaptchaEles(enabled) {\n if (enabled) {\n this.displayRecaptcha();\n } else {\n this.hideRecaptcha();\n }\n }\n\n constructor() {\n super();\n\n this.attachShadow({ mode: 'open' }).innerHTML = `\n <div class=\"badge\">\n <span id=\"recaptcha\"></span>\n <span id=\"recaptcha-widget\"></span>\n <input id=\"recaptcha-widget-input\" type=\"hidden\" name=\"recaptcha-widget\" required />\n <img src=\"https://imgs.descope.com/connectors/templates/recaptcha/recaptcha-big.png\" alt=\"recaptcha\"/>\n </div>\n <slot></slot>\n\t`;\n\n injectStyle(\n `\n :host {\n display: inline-flex;\n }\n :host > div:not(.hidden) {\n display: flex;\n }\n :host #recaptcha .grecaptcha-badge {\n box-shadow: none !important;\n }\n :host #recaptcha .grecaptcha-logo {\n height: 100%;\n }\n :host #recaptcha {\n\t\t\t\twidth: 100%;\n height: 100%;\n\t\t\t}\n :host #recaptcha-widget {\n width: 100%;\n height: 100%;\n }\n :host #recaptcha-widget-input {\n display: none;\n }\n :host img {\n width: 256px;\n }\n :host([full-width=\"true\"]) {\n width: 100%;\n }\n .hidden {\n display: none;\n }\n `,\n this\n );\n\n this.depercatedRecaptchaEle = this.baseElement.querySelector('#recaptcha');\n this.recaptchaWidgetEle = this.baseElement.querySelector('#recaptcha-widget');\n this.recaptchaWidgetInputEle = this.baseElement.querySelector('#recaptcha-widget-input');\n this.mockRecaptchaEle = this.baseElement.querySelector('img');\n this.badge = this.shadowRoot.querySelector('.badge');\n }\n\n init() {\n super.init?.();\n\n observeChildren(this, this.updatePreview.bind(this));\n }\n\n updatePreview() {\n if (this.children.length) {\n this.depercatedRecaptchaEle.style.display = 'none';\n this.recaptchaWidgetEle.style.display = 'none';\n this.mockRecaptchaEle.style.display = 'none';\n this.badge.classList.add('hidden');\n } else {\n this.toggleRecaptchaEles(this.enabled);\n this.badge.classList.remove('hidden');\n }\n }\n\n getValidity() {\n if (!this.isWidget) {\n return {};\n }\n\n if (!this.recaptchaWidgetInputEle.value) {\n return { valueMissing: true };\n }\n\n return {};\n }\n\n checkValidity() {\n if (!this.isWidget) {\n return true;\n }\n\n return !!this.recaptchaWidgetInputEle.value;\n }\n\n get enterprise() {\n return this.getAttribute('enterprise') === 'true';\n }\n\n get siteKey() {\n return this.getAttribute('site-key');\n }\n\n get action() {\n return this.getAttribute('action') || 'load';\n }\n\n get enabled() {\n return this.getAttribute('enabled') === 'true';\n }\n\n get variant() {\n return this.getAttribute('variant') || 'text';\n }\n\n get isWidget() {\n return this.variant === 'widget';\n }\n\n get scriptURL() {\n const url = new URL('https://www.google.com/recaptcha/');\n url.pathname += `${this.enterprise ? 'enterprise' : 'api'}.js`;\n url.searchParams.append('onload', 'onRecaptchaLoadCallback');\n url.searchParams.append('render', 'explicit');\n return url.toString();\n }\n\n #toggleRecaptcha(enabled) {\n this.renderRecaptcha(enabled);\n if (this.isWidget) {\n // For the v2 checkbox flow, scripts are loaded/executed by the runtime (grecaptcha-v2).\n // This legacy v3/invisible path must be fully skipped.\n return;\n }\n if (enabled) {\n this.#createOnLoadScript();\n if (!document.getElementById('recaptcha-script')) {\n this.#loadRecaptchaScript();\n } else {\n window.onRecaptchaLoadCallback();\n }\n }\n }\n\n #loadRecaptchaScript() {\n const script = document.createElement('script');\n script.src = this.scriptURL;\n script.async = true;\n script.id = 'recaptcha-script';\n script.defer = true;\n document.body.appendChild(script);\n }\n\n get grecaptchaInstance() {\n return this.enterprise ? window.grecaptcha?.enterprise : window.grecaptcha;\n }\n\n #getNewToken(grecaptchaInstance, currentNode, recaptchaWidgetId) {\n if (!this.isConnected) {\n return;\n }\n\n grecaptchaInstance.ready(() => {\n // clone the node and append it to the body so that it can be used by the grepcaptcha script\n const cloneNode = currentNode\n .querySelector('textarea[name^=\"g-recaptcha-response\"]')\n ?.cloneNode();\n if (cloneNode) {\n cloneNode.style.display = 'none';\n document.body.appendChild(cloneNode);\n }\n\n // cleaning up the recaptcha element we added to the body\n const removeCloneNode = () => {\n cloneNode.remove();\n };\n\n if (!this.siteKey) {\n return;\n }\n // we should pass recaptchaWidgetId, but this does not allow us to run execute multiple times\n // also calling grecaptchaInstance.reset() does not work\n const exec = grecaptchaInstance?.execute(recaptchaWidgetId, { action: this.action });\n exec.then((token, e) => {\n if (e) {\n // eslint-disable-next-line no-console\n console.warn('could not execute recaptcha', e);\n } else {\n this.updateComponentsContext({\n risktoken: token,\n riskaction: this.action,\n });\n // if the component is still connected, we should try to get a new token before the token expires (2 minutes)\n if (this.isConnected) {\n setTimeout(() => {\n this.#getNewToken(grecaptchaInstance, currentNode, recaptchaWidgetId);\n }, 110000);\n }\n }\n removeCloneNode();\n });\n });\n }\n\n #createOnLoadScript() {\n window.onRecaptchaLoadCallback = () => {\n const currentNode = this.depercatedRecaptchaEle;\n\n // if there are child nodes, it means that the recaptcha was already rendered\n if (currentNode.hasChildNodes()) {\n return;\n }\n\n const { grecaptchaInstance } = this;\n\n if (!grecaptchaInstance) {\n return;\n }\n\n setTimeout(() => {\n const recaptchaWidgetId = grecaptchaInstance.render(currentNode, {\n sitekey: this.siteKey,\n badge: 'inline',\n size: 'invisible',\n });\n this.#getNewToken(grecaptchaInstance, currentNode, recaptchaWidgetId);\n }, 0);\n };\n }\n}\n\nexport const RecaptchaClass = compose(draggableMixin)(RawRecaptcha);\n","import { componentName, RecaptchaClass } from './RecaptchaClass';\n\ncustomElements.define(componentName, RecaptchaClass);\n\nexport { RecaptchaClass, componentName };\n"],"names":["componentName","observedAttributes","BaseClass","createBaseClass","baseSelector","RecaptchaClass","concat","attributeChangedCallback","attrName","oldValue","newValue","super","this","updatePreview","renderRecaptcha","enabled","children","length","toggleRecaptchaEles","displayRecaptcha","isWidget","displayWidget","displayDeprecated","mockRecaptchaEle","style","display","recaptchaWidgetEle","depercatedRecaptchaEle","hideRecaptcha","constructor","attachShadow","mode","innerHTML","baseElement","querySelector","recaptchaWidgetInputEle","badge","shadowRoot","init","bind","classList","add","remove","getValidity","value","valueMissing","checkValidity","enterprise","getAttribute","siteKey","action","variant","scriptURL","url","URL","pathname","searchParams","append","toString","document","getElementById","window","onRecaptchaLoadCallback","script","createElement","src","async","id","defer","body","appendChild","grecaptchaInstance","grecaptcha","currentNode","recaptchaWidgetId","isConnected","ready","cloneNode","exec","execute","then","token","e","console","warn","updateComponentsContext","risktoken","riskaction","setTimeout","hasChildNodes","render","sitekey","size","customElements","define"],"sourceRoot":""}