@descope/web-components-ui 1.0.402 → 1.0.404

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 (33) hide show
  1. package/dist/cjs/index.cjs.js +1582 -1208
  2. package/dist/cjs/index.cjs.js.map +1 -1
  3. package/dist/index.d.ts +2 -1
  4. package/dist/index.esm.js +1629 -1208
  5. package/dist/index.esm.js.map +1 -1
  6. package/dist/umd/1053.js +1 -1
  7. package/dist/umd/4619.js +1 -1
  8. package/dist/umd/6726.js +1 -1
  9. package/dist/umd/7212.js +1 -1
  10. package/dist/umd/DescopeDev.js +1 -1
  11. package/dist/umd/descope-hybrid-field-index-js.js +19 -0
  12. package/dist/umd/descope-hybrid-field-index-js.js.LICENSE.txt +5 -0
  13. package/dist/umd/index.js +1 -1
  14. package/dist/umd/phone-fields-descope-phone-field-descope-phone-field-internal-index-js.js +1 -1
  15. package/dist/umd/phone-fields-descope-phone-field-index-js.js +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-index-js.js +148 -1
  18. package/package.json +1 -1
  19. package/src/components/descope-hybrid-field/HybridFieldClass.js +306 -0
  20. package/src/components/descope-hybrid-field/helpers.js +5 -0
  21. package/src/components/descope-hybrid-field/index.js +9 -0
  22. package/src/components/phone-fields/descope-phone-field/PhoneFieldClass.js +45 -5
  23. package/src/components/phone-fields/descope-phone-field/descope-phone-field-internal/PhoneFieldInternal.js +45 -11
  24. package/src/components/phone-fields/descope-phone-input-box-field/PhoneFieldInputBoxClass.js +21 -12
  25. package/src/components/phone-fields/descope-phone-input-box-field/descope-phone-input-box-internal/PhoneFieldInternalInputBox.js +17 -5
  26. package/src/index.cjs.js +1 -0
  27. package/src/index.d.ts +2 -1
  28. package/src/index.js +1 -0
  29. package/src/mixins/inputEventsDispatchingMixin.js +5 -5
  30. package/src/theme/components/hybridField.js +15 -0
  31. package/src/theme/components/index.js +2 -0
  32. package/dist/umd/4831.js +0 -148
  33. /package/dist/umd/{4831.js.LICENSE.txt → phone-fields-descope-phone-input-box-field-index-js.js.LICENSE.txt} +0 -0
@@ -1 +1,148 @@
1
- "use strict";(self.webpackChunk_descope_web_components_ui=self.webpackChunk_descope_web_components_ui||[]).push([[4043],{78313:(t,e,n)=>{n.d(e,{C:()=>v,T:()=>l});var r=n(7138),o=n(14944),i=n(33177),a=n(94619);const l=(0,o.xE)("combo-box"),{host:s,inputField:p,inputElement:d,placeholder:u,toggle:c,clearButton:h,label:b,requiredIndicator:m,helperText:y,errorMessage:g}={host:{selector:()=>":host"},inputField:{selector:"::part(input-field)"},inputElement:{selector:"input"},placeholder:{selector:"> input:placeholder-shown"},toggle:{selector:"::part(toggle-button)"},clearButton:{selector:"::part(clear-button)"},label:{selector:"::part(label)"},requiredIndicator:{selector:"[required]::part(required-indicator)::after"},helperText:{selector:"::part(helper-text)"},errorMessage:{selector:"::part(error-message)"}},v=(0,r.Zz)((0,a.RF)({mappings:{hostWidth:{...s,property:"width"},hostDirection:{...s,property:"direction"},fontSize:[{},s],fontFamily:[b,u,p,y,g],labelFontSize:{...b,property:"font-size"},labelFontWeight:{...b,property:"font-weight"},labelTextColor:[{...b,property:"color"},{...m,property:"color"}],errorMessageTextColor:{...g,property:"color"},inputHeight:{...p,property:"height"},inputBackgroundColor:{...p,property:"background-color"},inputBorderColor:{...p,property:"border-color"},inputBorderWidth:{...p,property:"border-width"},inputBorderStyle:{...p,property:"border-style"},inputBorderRadius:{...p,property:"border-radius"},labelRequiredIndicator:{...m,property:"content"},inputValueTextColor:{...p,property:"color"},inputPlaceholderTextColor:{...u,property:"color"},inputDropdownButtonCursor:[{...c,property:"cursor"},{...h,property:"cursor"}],inputDropdownButtonColor:[{...c,property:"color"},{...h,property:"color"}],inputDropdownButtonSize:[{...c,property:"font-size"},{...h,property:"font-size"}],inputDropdownButtonOffset:[{...c,property:"margin-right"},{...c,property:"margin-left"}],inputOutlineColor:{...p,property:"outline-color"},inputOutlineWidth:{...p,property:"outline-width"},inputOutlineStyle:{...p,property:"outline-style"},inputOutlineOffset:{...p,property:"outline-offset"},inputHorizontalPadding:[{...d,property:"padding-left"},{...d,property:"padding-right"}],labelPosition:{...b,property:"position"},labelTopPosition:{...b,property:"top"},labelHorizontalPosition:[{...b,property:"left"},{...b,property:"right"}],inputTransformY:{...b,property:"transform"},inputTransition:{...b,property:"transition"},marginInlineStart:{...b,property:"margin-inline-start"},placeholderOpacity:{...u,property:"opacity"},inputVerticalAlignment:{...p,property:"align-items"},valueInputHeight:{...d,property:"height"},valueInputMarginBottom:{...d,property:"margin-bottom"},overlayBackground:{property:()=>v.cssVarList.overlay.backgroundColor},overlayTextColor:{property:()=>v.cssVarList.overlay.textColor},overlayBorder:{property:()=>v.cssVarList.overlay.border},overlayFontSize:{property:()=>v.cssVarList.overlay.fontSize},overlayFontFamily:{property:()=>v.cssVarList.overlay.fontFamily},overlayCursor:{property:()=>v.cssVarList.overlay.cursor},overlayItemBoxShadow:{property:()=>v.cssVarList.overlay.itemBoxShadow},overlayItemPaddingInlineStart:{property:()=>v.cssVarList.overlay.itemPaddingInlineStart},overlayItemPaddingInlineEnd:{property:()=>v.cssVarList.overlay.itemPaddingInlineEnd}}}),a.VO,(0,a.mA)({name:"overlay",selector:"",mappings:{backgroundColor:{selector:"vaadin-combo-box-scroller"},minHeight:{selector:"vaadin-combo-box-overlay"},margin:{selector:"vaadin-combo-box-overlay"},cursor:{selector:"vaadin-combo-box-item"},fontFamily:{selector:"vaadin-combo-box-item"},textColor:{selector:"vaadin-combo-box-item",property:"color"},fontSize:{selector:"vaadin-combo-box-item"},itemBoxShadow:{selector:"vaadin-combo-box-item",property:"box-shadow"},itemPaddingInlineStart:{selector:"vaadin-combo-box-item",property:"padding-inline-start"},itemPaddingInlineEnd:{selector:"vaadin-combo-box-item",property:"padding-inline-end"}},forward:{include:!1,attributes:["size"]}}),(0,a.OZ)({proxyProps:["selectionStart"],inputEvent:"selected-item-changed"}),a.tQ,(t=>class extends t{static get observedAttributes(){return["label-type"]}#t=({displayName:t,value:e,label:n})=>`<span data-name="${n}" data-id="${e}">${t||n}</span>`;#e;get defaultValue(){return this.getAttribute("default-value")}get renderItem(){return this.#t}set renderItem(t){this.#t=t,this.renderItems()}get data(){if(this.#e)return this.#e;const t=this.getAttribute("data");if(t)try{const e=JSON.parse(t);if(this.isValidDataType(e))return e}catch(t){console.error('could not parse data string from attribute "data" -',t.message)}return[]}set data(t){this.isValidDataType(t)&&(this.#e=t,this.renderItems())}isValidDataType(t){const e=Array.isArray(t);return e||console.error("data must be an array, received:",t),e}getItemsTemplate(){return this.data?.reduce?.(((t,e)=>t+(this.renderItem?.(e||{})||"")),"")}renderItems(){const t=this.getItemsTemplate();t&&(this.innerHTML=t)}handleSelectedItem(){const t=this.baseElement.selectedItem?.["data-id"];this.baseElement.selectedItem=void 0,t&&(this.value=t),this.value||this.setDefaultValue()}customValueTransformFn(t){return t}setComboBoxDescriptor(){const t=Object.getOwnPropertyDescriptor(this.inputElement.constructor.prototype,"value"),e=this;Object.defineProperties(this.inputElement,{value:{...t,set(n){if(!e.baseElement.items?.length)return;const r=e.customValueTransformFn(n)||"";r!==this.value&&t.set.call(this,r)}}})}#n(){const t=this.shadowRoot.querySelector(this.baseSelector),e=Array.from(this.children);e.length&&(e.forEach((t=>{Object.defineProperty(t,"data-name",{value:t.getAttribute("data-name"),configurable:!0,writable:!0}),Object.defineProperty(t,"data-id",{value:t.getAttribute("data-id"),configurable:!0,writable:!0})})),t.items=e,setTimeout((()=>{this.handleSelectedItem()}),0)),t.renderer=(t,e,n)=>{t.innerHTML=n.item.outerHTML}}#r(){const t=this.baseElement.shadowRoot.querySelector("vaadin-combo-box-overlay");t._attachOverlay=()=>{t.bringToFront()},t._detachOverlay=()=>{},t._enterModalState=()=>{}}init(){super.init?.(),this.getValidity=function(){return!this.value&&this.isRequired?{valueMissing:!0}:{}},this.setComboBoxDescriptor(),this.#r(),this.renderItems(),(0,o.mx)(this,this.renderItems.bind(this),{includeAttrs:["data"]}),(0,o.Ge)(this,this.#n.bind(this)),this.setDefaultValue(),this.baseElement.addEventListener("selected-item-changed",(()=>{this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0}))}))}onLabelClick(){this.isReadOnly||this.isDisabled||(this.focus(),this.setAttribute("opened","true"))}attributeChangedCallback(t,e,n){super.attributeChangedCallback?.(t,e,n),e!==n&&"label-type"===t&&("floating"===n?this.addEventListener("click",this.onLabelClick):this.removeEventListener("click",this.onLabelClick))}setDefaultValue(){this.value=this.defaultValue}set value(t){if(t){const e=this.baseElement.items?.find((e=>e["data-id"]===t));e&&(this.baseElement.selectedItem=e)}else this.baseElement.selectedItem=void 0}get value(){return(this.baseElement.selectedItem?.["data-id"]||this.allowCustomValue)&&this.baseElement.__data.value||""}get allowCustomValue(){return"true"===this.getAttribute("allow-custom-value")}}))((0,a.tz)({slots:["","prefix"],wrappedEleName:"vaadin-combo-box",style:()=>`\n\t\t:host {\n\t\t\tdisplay: inline-flex;\n\t\t\tbox-sizing: border-box;\n\t\t\t-webkit-mask-image: none;\n\t\t}\n\t\t${(0,i.cy)(v.cssVarList)}\n\t\t${(0,i.fu)("vaadin-combo-box")}\n\t\t${(0,i.lS)("vaadin-combo-box")}\n\t\t${(0,i.I4)("vaadin-combo-box")}\n\n\t\tvaadin-combo-box {\n\t\t\tpadding: 0;\n\t\t\twidth: 100%;\n\t\t}\n\t\tvaadin-combo-box::before {\n\t\t\theight: initial;\n\t\t}\n\t\tvaadin-combo-box [slot="input"] {\n\t\t\t-webkit-mask-image: none;\n\t\t\tmin-height: 0;\n\t\t\tbox-sizing: border-box;\n\t\t}\n\n\t\tvaadin-combo-box::part(input-field) {\n\t\t\tpadding: 0;\n\t\t\tbox-shadow: none;\n\t\t}\n\n vaadin-combo-box::part(toggle-button),\n vaadin-combo-box::part(clear-button) {\n align-self: center;\n }\n\n vaadin-combo-box[label-type="floating"]:not([focused])[readonly] > input:placeholder-shown {\n opacity: 0;\n }\n vaadin-combo-box[label-type="floating"]:not([focused])[disabled] > input:placeholder-shown {\n opacity: 0;\n }\n\n ${(0,i.$J)("vaadin-combo-box")}\n ${(0,i.Kl)()}\n\t\t`,excludeAttrsSync:["tabindex","size","data"],componentName:l,includeForwardProps:["items","renderer","selectedItem"]}))},4480:(t,e,n)=>{n.r(e),n.d(e,{ComboBoxClass:()=>r.C}),n(31111);var r=n(78313);customElements.define(r.T,r.C)},69473:(t,e,n)=>{n.d(e,{T:()=>s,w:()=>d});var r=n(94619),o=n(93826),i=n(7138),a=n(14944),l=n(33177);const s=(0,a.xE)("text-field"),p=["type","label-type","copy-to-clipboard"],d=(0,i.Zz)((0,r.RF)({mappings:o.A}),r.VO,(0,r.OZ)({proxyProps:["value","selectionStart"],useProxyTargets:!0}),r.tQ,(t=>class extends t{static get observedAttributes(){return p.concat(t.observedAttributes||[])}icon;init(){super.init?.()}renderCopyToClipboard(t){if(!t)return void this.icon?.remove();const e={icon:"vaadin:copy-o",title:"Copy",style:"cursor: pointer"},n={icon:"vaadin:check-circle-o",title:"Copied",style:"cursor: initial"};this.icon=Object.assign(document.createElement("vaadin-icon"),{slot:"suffix",...e}),this.baseElement.appendChild(this.icon),this.icon.addEventListener("click",(()=>{navigator.clipboard.writeText(this.value),Object.assign(this.icon,n),setTimeout((()=>{Object.assign(this.icon,e)}),5e3)}))}onLabelClick(){this.focus()}attributeChangedCallback(t,e,n){super.attributeChangeCallback?.(t,e,n),"type"===t&&this.baseElement._setType(n),e!==n&&("label-type"===t?"floating"===n?this.addEventListener("click",this.onLabelClick):this.removeEventListener("click",this.onLabelClick):"copy-to-clipboard"===t&&this.renderCopyToClipboard("true"===n))}}))((0,r.tz)({slots:["prefix","suffix"],wrappedEleName:"vaadin-text-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(${d.cssVarList.inputOutlineWidth}) + var(${d.cssVarList.inputOutlineOffset}));\n box-sizing: border-box;\n\t\t\t}\n :host(:is([readonly], [disabled])) ::slotted(:is(input, textarea):placeholder-shown) {\n opacity: 1;\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 ${(0,l.$J)("vaadin-text-field")}\n\t\t\t${(0,l.cy)(d.cssVarList)}\n\t\t\t${(0,l.LJ)("vaadin-text-field",d.cssVarList)}\n ${(0,l.Kl)()}\n\n vaadin-text-field vaadin-icon {\n align-self: center;\n }\n\t\t`,excludeAttrsSync:["tabindex"],componentName:s}))},89348:(t,e,n)=>{n.r(e),n.d(e,{TextFieldClass:()=>r.w}),n(39542),n(66418),n(56637);var r=n(69473);customElements.define(r.T,r.w)},43945:(t,e,n)=>{n.d(e,{A:()=>d,T:()=>a});var r=n(25827),o=n(14944),i=n(63789);const a=(0,o.xE)("phone-field-internal-input-box"),l=["disabled","size","bordered","invalid","readonly","phone-input-placeholder","name","autocomplete","label-type"],s={"phone-input-placeholder":"placeholder"},p=(0,r.y)({componentName:a,baseSelector:"div"}),d=class extends p{static get observedAttributes(){return[].concat(p.observedAttributes||[],l)}constructor(){super(),this.innerHTML='\n <div>\n <descope-text-field tabindex="1"></descope-text-field>\n </div>\n ',this.phoneNumberInput=this.querySelector("descope-text-field")}get defaultCountryCode(){return(0,i.Q)(this.getAttribute("default-code"))}get hasDefaultCode(){return!!this.getAttribute("default-code")}get value(){if(!this.phoneNumberValue)return"";if(this.hasDefaultCode){const t=new RegExp(`\\+?${parseInt(this.defaultCountryCode,10)}--?`);return`${this.defaultCountryCode}-${this.phoneNumberInput.value.replace(t,"")}`}return this.phoneNumberInput.value}set value(t){this.phoneNumberInput.value=t}get phoneNumberValue(){return this.phoneNumberInput.value}get minLength(){return parseInt(this.getAttribute("minlength"),10)||0}get maxLength(){return parseInt(this.getAttribute("maxlength"),10)||50}getValidity(){const t=this.value.replace(/\D/g,"");return this.isRequired&&!this.value?{valueMissing:!0}:t.length<this.minLength?{tooShort:!0}:t.length>this.maxLength?{tooLong:!0}:/^\+?\d{1,4}-?(?:\d-?){1,15}$/.test(this.value)?{}:{patternMismatch:!0}}init(){this.addEventListener("focus",(t=>{t.isTrusted&&this.phoneNumberInput.focus()})),super.init?.(),this.initInputs()}getCountryByDialCode(t){return this.countryCodeInput.items?.find((e=>e.getAttribute("data-country-code")===t))}initInputs(){this.phoneNumberInput.addEventListener("input",(t=>{1===t.target.value.length&&"-"===t.target.value&&(t.target.value=""),t.target.value=t.target.value.replace(/(?!^)\+/g,"").replace("--","-").replace("+-","+");const e=/^[+\d-]+$/,n=t.target.value.split("").filter((t=>e.test(t))).join("");t.target.value=n})),this.handleFocusEventsDispatching([this.phoneNumberInput]),this.handleInputEventDispatching()}attributeChangedCallback(t,e,n){if(super.attributeChangedCallback(t,e,n),e!==n&&l.includes(t)){const e=s[t]||t;this.phoneNumberInput.setAttribute(e,n)}}}},46633:(t,e,n)=>{n.r(e),n(89348);var r=n(43945);customElements.define(r.T,r.A)},65636:(t,e,n)=>{n.r(e),n.d(e,{PhoneFieldInputBoxClass:()=>x}),n(46633),n(4480),n(89348);var r=n(43945),o=n(14944),i=n(7138),a=n(94619),l=n(69473),s=n(44066),p=n(33177);const d=l.w.cssVarList,u=(0,o.xE)("phone-input-box-field"),{host:c,label:h,inputElement:b,requiredIndicator:m,inputField:y,phoneInput:g,errorMessage:v,helperText:f}={host:{selector:()=>":host"},label:{selector:"::part(label)"},placeholder:{selector:"> input:placeholder-shown"},inputElement:{selector:"input"},requiredIndicator:{selector:"[required]::part(required-indicator)::after"},inputField:{selector:"::part(input-field)"},phoneInput:{selector:()=>"descope-text-field"},helperText:{selector:"::part(helper-text)"},errorMessage:{selector:"::part(error-message)"}},x=(0,i.Zz)((0,a.RF)({mappings:{fontSize:[c,y,{selector:l.w.componentName,property:l.w.cssVarList.fontSize}],fontFamily:[h,v,f],hostWidth:{...c,property:"width"},hostMinWidth:{...c,property:"min-width"},hostDirection:{...c,property:"direction"},inputBorderStyle:{...y,property:"border-style"},inputBorderWidth:{...y,property:"border-width"},inputBorderColor:{...y,property:"border-color"},inputBorderRadius:{...y,property:"border-radius"},inputHorizontalPadding:[{...g,property:"padding-left"},{...g,property:"padding-right"}],labelFontSize:{...h,property:"font-size"},labelFontWeight:{...h,property:"font-weight"},labelTextColor:[{...h,property:"color"},{...m,property:"color"}],labelRequiredIndicator:{...m,property:"content"},errorMessageTextColor:{...v,property:"color"},inputValueTextColor:{...g,property:d.inputValueTextColor},inputPlaceholderTextColor:{...g,property:d.inputPlaceholderColor},inputOutlineStyle:{...y,property:"outline-style"},inputOutlineColor:{...y,property:"outline-color"},inputOutlineWidth:{...y,property:"outline-width"},inputOutlineOffset:{...y,property:"outline-offset"},labelPosition:{...h,property:"position"},labelTopPosition:{...h,property:"top"},labelHorizontalPosition:[{...h,property:"left"},{...h,property:"right"}],inputTransformY:{...h,property:"transform"},inputTransition:{...h,property:"transition"},marginInlineStart:{...h,property:"margin-inline-start"},valueInputHeight:{...b,property:"height"},valueInputMarginBottom:{selector:l.w.componentName,property:d.valueInputMarginBottom}}}),a.VO,(0,a.OZ)({proxyProps:["value","selectionStart"]}),(t=>class extends t{static get CountryCodes(){return s.A}init(){super.init?.();const t=document.createElement("template");t.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(t.content.cloneNode(!0)),this.inputElement=this.shadowRoot.querySelector(r.T),(0,o.EA)(this.shadowRoot.host,this.inputElement,{includeAttrs:["size","bordered","invalid","minlength","maxlength","default-code","disabled","phone-input-placeholder","label","label-type"]})}}))((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,p.cy)(x.cssVarList)}\n ${(0,p.I4)("vaadin-text-field")}\n ${(0,p.kG)("vaadin-text-field")}\n ${(0,p.X6)()}\n\n vaadin-text-field {\n width: 100%;\n height: 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 overflow: hidden;\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 height: 100%;\n }\n descope-phone-field-internal-input-box > div {\n width: 100%;\n height: 100%;\n }\n descope-phone-field-internal-input-box .separator {\n flex: 0;\n border: none;\n }\n descope-text-field {\n flex-grow: 1;\n width: 100%;\n ${d.inputOutlineWidth}: 0;\n ${d.inputOutlineOffset}: 0;\n ${d.inputBorderWidth}: 0;\n ${d.inputBorderRadius}: 0;\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,p.$J)("vaadin-text-field")}\n ${(0,p.Kl)()}\n\t\t`,excludeAttrsSync:["tabindex"],componentName:u}));customElements.define(u,x)},63789:(t,e,n)=>{n.d(e,{Q:()=>o});var r=n(44066);const o=t=>r.A.find((e=>e.code===t))?.dialCode}}]);
1
+ /*! For license information please see phone-fields-descope-phone-input-box-field-index-js.js.LICENSE.txt */
2
+ "use strict";(self.webpackChunk_descope_web_components_ui=self.webpackChunk_descope_web_components_ui||[]).push([[4043,7212],{78313:(t,e,o)=>{o.d(e,{C:()=>g,T:()=>l});var r=o(7138),n=o(14944),i=o(33177),a=o(94619);const l=(0,n.xE)("combo-box"),{host:s,inputField:d,inputElement:p,placeholder:u,toggle:c,clearButton:h,label:b,requiredIndicator:m,helperText:v,errorMessage:y}={host:{selector:()=>":host"},inputField:{selector:"::part(input-field)"},inputElement:{selector:"input"},placeholder:{selector:"> input:placeholder-shown"},toggle:{selector:"::part(toggle-button)"},clearButton:{selector:"::part(clear-button)"},label:{selector:"::part(label)"},requiredIndicator:{selector:"[required]::part(required-indicator)::after"},helperText:{selector:"::part(helper-text)"},errorMessage:{selector:"::part(error-message)"}},g=(0,r.Zz)((0,a.RF)({mappings:{hostWidth:{...s,property:"width"},hostDirection:{...s,property:"direction"},fontSize:[{},s],fontFamily:[b,u,d,v,y],labelFontSize:{...b,property:"font-size"},labelFontWeight:{...b,property:"font-weight"},labelTextColor:[{...b,property:"color"},{...m,property:"color"}],errorMessageTextColor:{...y,property:"color"},inputHeight:{...d,property:"height"},inputBackgroundColor:{...d,property:"background-color"},inputBorderColor:{...d,property:"border-color"},inputBorderWidth:{...d,property:"border-width"},inputBorderStyle:{...d,property:"border-style"},inputBorderRadius:{...d,property:"border-radius"},labelRequiredIndicator:{...m,property:"content"},inputValueTextColor:{...d,property:"color"},inputPlaceholderTextColor:{...u,property:"color"},inputDropdownButtonCursor:[{...c,property:"cursor"},{...h,property:"cursor"}],inputDropdownButtonColor:[{...c,property:"color"},{...h,property:"color"}],inputDropdownButtonSize:[{...c,property:"font-size"},{...h,property:"font-size"}],inputDropdownButtonOffset:[{...c,property:"margin-right"},{...c,property:"margin-left"}],inputOutlineColor:{...d,property:"outline-color"},inputOutlineWidth:{...d,property:"outline-width"},inputOutlineStyle:{...d,property:"outline-style"},inputOutlineOffset:{...d,property:"outline-offset"},inputHorizontalPadding:[{...p,property:"padding-left"},{...p,property:"padding-right"}],labelPosition:{...b,property:"position"},labelTopPosition:{...b,property:"top"},labelHorizontalPosition:[{...b,property:"left"},{...b,property:"right"}],inputTransformY:{...b,property:"transform"},inputTransition:{...b,property:"transition"},marginInlineStart:{...b,property:"margin-inline-start"},placeholderOpacity:{...u,property:"opacity"},inputVerticalAlignment:{...d,property:"align-items"},valueInputHeight:{...p,property:"height"},valueInputMarginBottom:{...p,property:"margin-bottom"},overlayBackground:{property:()=>g.cssVarList.overlay.backgroundColor},overlayTextColor:{property:()=>g.cssVarList.overlay.textColor},overlayBorder:{property:()=>g.cssVarList.overlay.border},overlayFontSize:{property:()=>g.cssVarList.overlay.fontSize},overlayFontFamily:{property:()=>g.cssVarList.overlay.fontFamily},overlayCursor:{property:()=>g.cssVarList.overlay.cursor},overlayItemBoxShadow:{property:()=>g.cssVarList.overlay.itemBoxShadow},overlayItemPaddingInlineStart:{property:()=>g.cssVarList.overlay.itemPaddingInlineStart},overlayItemPaddingInlineEnd:{property:()=>g.cssVarList.overlay.itemPaddingInlineEnd}}}),a.VO,(0,a.mA)({name:"overlay",selector:"",mappings:{backgroundColor:{selector:"vaadin-combo-box-scroller"},minHeight:{selector:"vaadin-combo-box-overlay"},margin:{selector:"vaadin-combo-box-overlay"},cursor:{selector:"vaadin-combo-box-item"},fontFamily:{selector:"vaadin-combo-box-item"},textColor:{selector:"vaadin-combo-box-item",property:"color"},fontSize:{selector:"vaadin-combo-box-item"},itemBoxShadow:{selector:"vaadin-combo-box-item",property:"box-shadow"},itemPaddingInlineStart:{selector:"vaadin-combo-box-item",property:"padding-inline-start"},itemPaddingInlineEnd:{selector:"vaadin-combo-box-item",property:"padding-inline-end"}},forward:{include:!1,attributes:["size"]}}),(0,a.OZ)({proxyProps:["selectionStart"],inputEvent:"selected-item-changed"}),a.tQ,(t=>class extends t{static get observedAttributes(){return["label-type"]}#t=({displayName:t,value:e,label:o})=>`<span data-name="${o}" data-id="${e}">${t||o}</span>`;#e;get defaultValue(){return this.getAttribute("default-value")}get renderItem(){return this.#t}set renderItem(t){this.#t=t,this.renderItems()}get data(){if(this.#e)return this.#e;const t=this.getAttribute("data");if(t)try{const e=JSON.parse(t);if(this.isValidDataType(e))return e}catch(t){console.error('could not parse data string from attribute "data" -',t.message)}return[]}set data(t){this.isValidDataType(t)&&(this.#e=t,this.renderItems())}isValidDataType(t){const e=Array.isArray(t);return e||console.error("data must be an array, received:",t),e}getItemsTemplate(){return this.data?.reduce?.(((t,e)=>t+(this.renderItem?.(e||{})||"")),"")}renderItems(){const t=this.getItemsTemplate();t&&(this.innerHTML=t)}handleSelectedItem(){const t=this.baseElement.selectedItem?.["data-id"];this.baseElement.selectedItem=void 0,t&&(this.value=t),this.value||this.setDefaultValue()}customValueTransformFn(t){return t}setComboBoxDescriptor(){const t=Object.getOwnPropertyDescriptor(this.inputElement.constructor.prototype,"value"),e=this;Object.defineProperties(this.inputElement,{value:{...t,set(o){if(!e.baseElement.items?.length)return;const r=e.customValueTransformFn(o)||"";r!==this.value&&t.set.call(this,r)}}})}#o(){const t=this.shadowRoot.querySelector(this.baseSelector),e=Array.from(this.children);e.length&&(e.forEach((t=>{Object.defineProperty(t,"data-name",{value:t.getAttribute("data-name"),configurable:!0,writable:!0}),Object.defineProperty(t,"data-id",{value:t.getAttribute("data-id"),configurable:!0,writable:!0})})),t.items=e,setTimeout((()=>{this.handleSelectedItem()}),0)),t.renderer=(t,e,o)=>{t.innerHTML=o.item.outerHTML}}#r(){const t=this.baseElement.shadowRoot.querySelector("vaadin-combo-box-overlay");t._attachOverlay=()=>{t.bringToFront()},t._detachOverlay=()=>{},t._enterModalState=()=>{}}init(){super.init?.(),this.getValidity=function(){return!this.value&&this.isRequired?{valueMissing:!0}:{}},this.setComboBoxDescriptor(),this.#r(),this.renderItems(),(0,n.mx)(this,this.renderItems.bind(this),{includeAttrs:["data"]}),(0,n.Ge)(this,this.#o.bind(this)),this.setDefaultValue(),this.baseElement.addEventListener("selected-item-changed",(()=>{this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0}))}))}onLabelClick(){this.isReadOnly||this.isDisabled||(this.focus(),this.setAttribute("opened","true"))}attributeChangedCallback(t,e,o){super.attributeChangedCallback?.(t,e,o),e!==o&&"label-type"===t&&("floating"===o?this.addEventListener("click",this.onLabelClick):this.removeEventListener("click",this.onLabelClick))}setDefaultValue(){this.value=this.defaultValue}set value(t){if(t){const e=this.baseElement.items?.find((e=>e["data-id"]===t));e&&(this.baseElement.selectedItem=e)}else this.baseElement.selectedItem=void 0}get value(){return(this.baseElement.selectedItem?.["data-id"]||this.allowCustomValue)&&this.baseElement.__data.value||""}get allowCustomValue(){return"true"===this.getAttribute("allow-custom-value")}}))((0,a.tz)({slots:["","prefix"],wrappedEleName:"vaadin-combo-box",style:()=>`\n\t\t:host {\n\t\t\tdisplay: inline-flex;\n\t\t\tbox-sizing: border-box;\n\t\t\t-webkit-mask-image: none;\n\t\t}\n\t\t${(0,i.cy)(g.cssVarList)}\n\t\t${(0,i.fu)("vaadin-combo-box")}\n\t\t${(0,i.lS)("vaadin-combo-box")}\n\t\t${(0,i.I4)("vaadin-combo-box")}\n\n\t\tvaadin-combo-box {\n\t\t\tpadding: 0;\n\t\t\twidth: 100%;\n\t\t}\n\t\tvaadin-combo-box::before {\n\t\t\theight: initial;\n\t\t}\n\t\tvaadin-combo-box [slot="input"] {\n\t\t\t-webkit-mask-image: none;\n\t\t\tmin-height: 0;\n\t\t\tbox-sizing: border-box;\n\t\t}\n\n\t\tvaadin-combo-box::part(input-field) {\n\t\t\tpadding: 0;\n\t\t\tbox-shadow: none;\n\t\t}\n\n vaadin-combo-box::part(toggle-button),\n vaadin-combo-box::part(clear-button) {\n align-self: center;\n }\n\n vaadin-combo-box[label-type="floating"]:not([focused])[readonly] > input:placeholder-shown {\n opacity: 0;\n }\n vaadin-combo-box[label-type="floating"]:not([focused])[disabled] > input:placeholder-shown {\n opacity: 0;\n }\n\n ${(0,i.$J)("vaadin-combo-box")}\n ${(0,i.Kl)()}\n\t\t`,excludeAttrsSync:["tabindex","size","data"],componentName:l,includeForwardProps:["items","renderer","selectedItem"]}))},4480:(t,e,o)=>{o.r(e),o.d(e,{ComboBoxClass:()=>r.C}),o(31111);var r=o(78313);customElements.define(r.T,r.C)},69473:(t,e,o)=>{o.d(e,{T:()=>s,w:()=>p});var r=o(94619),n=o(93826),i=o(7138),a=o(14944),l=o(33177);const s=(0,a.xE)("text-field"),d=["type","label-type","copy-to-clipboard"],p=(0,i.Zz)((0,r.RF)({mappings:n.A}),r.VO,(0,r.OZ)({proxyProps:["value","selectionStart"],useProxyTargets:!0}),r.tQ,(t=>class extends t{static get observedAttributes(){return d.concat(t.observedAttributes||[])}icon;init(){super.init?.()}renderCopyToClipboard(t){if(!t)return void this.icon?.remove();const e={icon:"vaadin:copy-o",title:"Copy",style:"cursor: pointer"},o={icon:"vaadin:check-circle-o",title:"Copied",style:"cursor: initial"};this.icon=Object.assign(document.createElement("vaadin-icon"),{slot:"suffix",...e}),this.baseElement.appendChild(this.icon),this.icon.addEventListener("click",(()=>{navigator.clipboard.writeText(this.value),Object.assign(this.icon,o),setTimeout((()=>{Object.assign(this.icon,e)}),5e3)}))}onLabelClick(){this.focus()}attributeChangedCallback(t,e,o){super.attributeChangeCallback?.(t,e,o),"type"===t&&this.baseElement._setType(o),e!==o&&("label-type"===t?"floating"===o?this.addEventListener("click",this.onLabelClick):this.removeEventListener("click",this.onLabelClick):"copy-to-clipboard"===t&&this.renderCopyToClipboard("true"===o))}}))((0,r.tz)({slots:["prefix","suffix"],wrappedEleName:"vaadin-text-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(${p.cssVarList.inputOutlineWidth}) + var(${p.cssVarList.inputOutlineOffset}));\n box-sizing: border-box;\n\t\t\t}\n :host(:is([readonly], [disabled])) ::slotted(:is(input, textarea):placeholder-shown) {\n opacity: 1;\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 ${(0,l.$J)("vaadin-text-field")}\n\t\t\t${(0,l.cy)(p.cssVarList)}\n\t\t\t${(0,l.LJ)("vaadin-text-field",p.cssVarList)}\n ${(0,l.Kl)()}\n\n vaadin-text-field vaadin-icon {\n align-self: center;\n }\n\t\t`,excludeAttrsSync:["tabindex"],componentName:s}))},89348:(t,e,o)=>{o.r(e),o.d(e,{TextFieldClass:()=>r.w}),o(39542),o(66418),o(56637);var r=o(69473);customElements.define(r.T,r.w)},43945:(t,e,o)=>{o.d(e,{A:()=>p,T:()=>a});var r=o(25827),n=o(14944),i=o(63789);const a=(0,n.xE)("phone-field-internal-input-box"),l=["disabled","size","bordered","invalid","readonly","phone-input-placeholder","name","autocomplete","label-type","allow-alphanumeric-input"],s={"phone-input-placeholder":"placeholder"},d=(0,r.y)({componentName:a,baseSelector:"div"}),p=class extends d{static get observedAttributes(){return[].concat(d.observedAttributes||[],l)}constructor(){super(),this.innerHTML='\n <div>\n <descope-text-field tabindex="1"></descope-text-field>\n </div>\n ',this.phoneNumberInput=this.querySelector("descope-text-field")}get defaultCountryCode(){return(0,i.Q)(this.getAttribute("default-code"))}get hasDefaultCode(){return!!this.getAttribute("default-code")}get allowAlphanumericInput(){return"true"===this.getAttribute("allow-alphanumeric-input")}get value(){if(!this.phoneNumberValue)return"";if(this.hasDefaultCode){const t=new RegExp(`\\+?${parseInt(this.defaultCountryCode,10)}--?`);return`${this.defaultCountryCode}-${this.phoneNumberInput.value.replace(t,"")}`}return this.phoneNumberInput.value}set value(t){this.phoneNumberInput.value=t}get phoneNumberValue(){return this.phoneNumberInput.value}get phoneNumberInputEle(){return this.phoneNumberInput.shadowRoot.querySelector("input")}get minLength(){return parseInt(this.getAttribute("minlength"),10)||0}get maxLength(){return parseInt(this.getAttribute("maxlength"),10)||50}getValidity(){const t=this.value.replace(/\D/g,"");return this.isRequired&&!this.value?{valueMissing:!0}:t.length<this.minLength?{tooShort:!0}:t.length>this.maxLength?{tooLong:!0}:/^\+?\d{1,4}-?(?:\d-?){1,15}$/.test(this.value)?{}:{patternMismatch:!0}}init(){this.addEventListener("focus",(t=>{t.isTrusted&&this.phoneNumberInput.focus()})),super.init?.(),this.initInputs()}getCountryByDialCode(t){return this.countryCodeInput.items?.find((e=>e.getAttribute("data-country-code")===t))}initInputs(){this.phoneNumberInput.addEventListener("input",(t=>{1===t.target.value.length&&"-"===t.target.value&&(t.target.value=""),t.target.value=t.target.value.replace(/(?!^)\+/g,"").replace("--","-").replace("+-","+");let e=t.target.value;if(!this.allowAlphanumericInput){const o=/^[+\d-]+$/;e=t.target.value.split("").filter((t=>o.test(t))).join("")}t.target.value=e})),this.handleFocusEventsDispatching([this.phoneNumberInput]),this.handleInputEventDispatching()}attributeChangedCallback(t,e,o){if(super.attributeChangedCallback(t,e,o),e!==o&&l.includes(t)){const e=s[t]||t;this.phoneNumberInput.setAttribute(e,o)}}}},46633:(t,e,o)=>{o.r(e),o(89348);var r=o(43945);customElements.define(r.T,r.A)},65636:(t,e,o)=>{o.r(e),o.d(e,{PhoneFieldInputBoxClass:()=>C}),o(46633),o(4480),o(89348);var r=o(43945),n=o(14944),i=o(7138),a=o(94619),l=o(69473),s=o(44066),d=o(33177);const p=l.w.cssVarList,u=(0,n.xE)("phone-input-box-field"),{host:c,label:h,inputElement:b,requiredIndicator:m,inputField:v,inputFieldInternal:y,phoneInput:g,errorMessage:f,helperText:x}={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)"},inputFieldInternal:{selector:()=>"descope-phone-field-internal-input-box vaadin-text-field::part(input-field)"},phoneInput:{selector:()=>"descope-text-field"},helperText:{selector:"::part(helper-text)"},errorMessage:{selector:"::part(error-message)"}},C=(0,i.Zz)((0,a.RF)({mappings:{fontSize:[c,v,{selector:l.w.componentName,property:l.w.cssVarList.fontSize}],fontFamily:[h,f,x],hostWidth:{...c,property:"width"},hostMinWidth:{...c,property:"min-width"},hostDirection:{...c,property:"direction"},inputBorderStyle:{...y,property:"border-style"},inputBorderWidth:{...y,property:"border-width"},inputBorderColor:{...y,property:"border-color"},inputBorderRadius:[{...v,property:"border-radius"},{...y,property:"border-radius"}],inputHorizontalPadding:[{...g,property:"padding-left"},{...g,property:"padding-right"}],labelFontSize:{...h,property:"font-size"},labelFontWeight:{...h,property:"font-weight"},labelTextColor:[{...h,property:"color"},{...m,property:"color"}],labelRequiredIndicator:{...m,property:"content"},errorMessageTextColor:{...f,property:"color"},inputValueTextColor:{...g,property:p.inputValueTextColor},inputPlaceholderTextColor:{...g,property:p.inputPlaceholderColor},inputOutlineStyle:{...v,property:"outline-style"},inputOutlineColor:{...v,property:"outline-color"},inputOutlineWidth:{...v,property:"outline-width"},inputOutlineOffset:{...v,property:"outline-offset"},labelPosition:{...h,property:"position"},labelTopPosition:{...h,property:"top"},labelHorizontalPosition:[{...h,property:"left"},{...h,property:"right"}],inputTransformY:{...h,property:"transform"},inputTransition:{...h,property:"transition"},marginInlineStart:{...h,property:"margin-inline-start"},valueInputHeight:{...b,property:"height"},valueInputMarginBottom:{selector:l.w.componentName,property:p.valueInputMarginBottom}}}),a.VO,(0,a.OZ)({proxyProps:["value","selectionStart"]}),(t=>class extends t{static get CountryCodes(){return s.A}init(){super.init?.();const t=document.createElement("template");t.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(t.content.cloneNode(!0)),this.inputElement=this.shadowRoot.querySelector(r.T),(0,n.EA)(this.shadowRoot.host,this.inputElement,{includeAttrs:["size","bordered","invalid","minlength","maxlength","default-code","disabled","phone-input-placeholder","label","label-type","allow-alphanumeric-input"]})}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,d.cy)(C.cssVarList)}\n ${(0,d.I4)("vaadin-text-field")}\n ${(0,d.kG)("vaadin-text-field")}\n ${(0,d.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 overflow: hidden;\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 .separator {\n flex: 0;\n border: none;\n }\n descope-phone-field-internal-input-box descope-text-field {\n ${p.inputOutlineWidth}: 0;\n ${p.inputOutlineOffset}: 0;\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,d.$J)("vaadin-text-field")}\n ${(0,d.Kl)()}\n\t\t`,excludeAttrsSync:["tabindex"],componentName:u}));customElements.define(u,C)},63789:(t,e,o)=>{o.d(e,{Q:()=>n});var r=o(44066);const n=t=>r.A.find((e=>e.code===t))?.dialCode},31111:(t,e,o)=>{o(46165),o(14968),o(37451),o(72815);var r=o(90500),n=o(6052);const i=n.AH`
3
+ :host {
4
+ outline: none;
5
+ }
6
+
7
+ [part='toggle-button']::before {
8
+ content: var(--lumo-icons-dropdown);
9
+ }
10
+ `;(0,n.SF)("vaadin-combo-box",[r.k,i],{moduleId:"lumo-combo-box"}),o(9077);var a=o(33791),l=o(38735),s=o(35717),d=o(10187);class p extends((0,d.y)((0,n.cp)((0,s.v)(a.Pu)))){static get template(){return a.qy`
11
+ <style>
12
+ :host {
13
+ display: block;
14
+ }
15
+
16
+ :host([hidden]) {
17
+ display: none;
18
+ }
19
+ </style>
20
+ <span part="checkmark" aria-hidden="true"></span>
21
+ <div part="content">
22
+ <slot></slot>
23
+ </div>
24
+ `}static get is(){return"vaadin-combo-box-item"}}(0,l.X)(p);var u=o(21380),c=o(52718),h=o(75482);const b=n.AH`
25
+ #overlay {
26
+ width: var(--vaadin-combo-box-overlay-width, var(--_vaadin-combo-box-overlay-default-width, auto));
27
+ }
28
+
29
+ [part='content'] {
30
+ display: flex;
31
+ flex-direction: column;
32
+ height: 100%;
33
+ }
34
+ `;(0,n.SF)("vaadin-combo-box-overlay",[c.B,b],{moduleId:"vaadin-combo-box-overlay-styles"});class m extends((0,h.p)((0,u.c)((0,s.v)((0,n.cp)(a.Pu))))){static get is(){return"vaadin-combo-box-overlay"}static get template(){return a.qy`
35
+ <div id="backdrop" part="backdrop" hidden></div>
36
+ <div part="overlay" id="overlay">
37
+ <div part="loader"></div>
38
+ <div part="content" id="content"><slot></slot></div>
39
+ </div>
40
+ `}}(0,l.X)(m);var v=o(44998);class y extends((0,v.N)(a.Pu)){static get is(){return"vaadin-combo-box-scroller"}static get template(){return a.qy`
41
+ <style>
42
+ :host {
43
+ display: block;
44
+ min-height: 1px;
45
+ overflow: auto;
46
+
47
+ /* Fixes item background from getting on top of scrollbars on Safari */
48
+ transform: translate3d(0, 0, 0);
49
+
50
+ /* Enable momentum scrolling on iOS */
51
+ -webkit-overflow-scrolling: touch;
52
+
53
+ /* Fixes scrollbar disappearing when 'Show scroll bars: Always' enabled in Safari */
54
+ box-shadow: 0 0 0 white;
55
+ }
56
+
57
+ #selector {
58
+ border-width: var(--_vaadin-combo-box-items-container-border-width);
59
+ border-style: var(--_vaadin-combo-box-items-container-border-style);
60
+ border-color: var(--_vaadin-combo-box-items-container-border-color, transparent);
61
+ position: relative;
62
+ }
63
+ </style>
64
+ <div id="selector">
65
+ <slot></slot>
66
+ </div>
67
+ `}}(0,l.X)(y);var g=o(31846),f=o(58074),x=o(32318),C=o(15408),w=o(3550),I=o(3410);const E=t=>class extends((0,I.U)(t)){static get properties(){return{pattern:{type:String}}}static get delegateAttrs(){return[...super.delegateAttrs,"pattern"]}static get constraints(){return[...super.constraints,"pattern"]}};var _=o(89385),T=o(5792),S=o(93131);(0,n.SF)("vaadin-combo-box",_.k,{moduleId:"vaadin-combo-box-styles"});class k extends((0,T.K)((0,S.x)(E((0,x.R)((0,n.cp)((0,g.q)(a.Pu))))))){static get is(){return"vaadin-combo-box"}static get template(){return a.qy`
68
+ <style>
69
+ :host([opened]) {
70
+ pointer-events: auto;
71
+ }
72
+ </style>
73
+
74
+ <div class="vaadin-combo-box-container">
75
+ <div part="label">
76
+ <slot name="label"></slot>
77
+ <span part="required-indicator" aria-hidden="true" on-click="focus"></span>
78
+ </div>
79
+
80
+ <vaadin-input-container
81
+ part="input-field"
82
+ readonly="[[readonly]]"
83
+ disabled="[[disabled]]"
84
+ invalid="[[invalid]]"
85
+ theme$="[[_theme]]"
86
+ >
87
+ <slot name="prefix" slot="prefix"></slot>
88
+ <slot name="input"></slot>
89
+ <div id="clearButton" part="clear-button" slot="suffix" aria-hidden="true"></div>
90
+ <div id="toggleButton" part="toggle-button" slot="suffix" aria-hidden="true"></div>
91
+ </vaadin-input-container>
92
+
93
+ <div part="helper-text">
94
+ <slot name="helper"></slot>
95
+ </div>
96
+
97
+ <div part="error-message">
98
+ <slot name="error-message"></slot>
99
+ </div>
100
+ </div>
101
+
102
+ <vaadin-combo-box-overlay
103
+ id="overlay"
104
+ opened="[[_overlayOpened]]"
105
+ loading$="[[loading]]"
106
+ theme$="[[_theme]]"
107
+ position-target="[[_positionTarget]]"
108
+ no-vertical-overlap
109
+ restore-focus-node="[[inputElement]]"
110
+ ></vaadin-combo-box-overlay>
111
+
112
+ <slot name="tooltip"></slot>
113
+ `}static get properties(){return{_positionTarget:{type:Object}}}get clearElement(){return this.$.clearButton}ready(){super.ready(),this.addController(new C.f(this,(t=>{this._setInputElement(t),this._setFocusElement(t),this.stateTarget=t,this.ariaTarget=t}))),this.addController(new w.q(this.inputElement,this._labelController)),this._tooltipController=new f.I(this),this.addController(this._tooltipController),this._tooltipController.setPosition("top"),this._tooltipController.setAriaTarget(this.inputElement),this._tooltipController.setShouldShow((t=>!t.opened)),this._positionTarget=this.shadowRoot.querySelector('[part="input-field"]'),this._toggleElement=this.$.toggleButton}_onClearButtonClick(t){t.stopPropagation(),super._onClearButtonClick(t)}_onHostClick(t){const e=t.composedPath();(e.includes(this._labelNode)||e.includes(this._positionTarget))&&super._onHostClick(t)}}(0,l.X)(k)},53430:(t,e,o)=>{o.d(e,{a:()=>n});var r=o(32318);const n=t=>class extends((0,r.R)(t)){static get properties(){return{autocomplete:{type:String},autocorrect:{type:String},autocapitalize:{type:String,reflectToAttribute:!0}}}static get delegateAttrs(){return[...super.delegateAttrs,"autocapitalize","autocomplete","autocorrect"]}get __data(){return this.__dataValue||{}}set __data(t){this.__dataValue=t}_inputElementChanged(t){super._inputElementChanged(t),t&&(t.value&&t.value!==this.value&&(console.warn(`Please define value on the <${this.localName}> component!`),t.value=""),this.value&&(t.value=this.value))}_setFocused(t){super._setFocused(t),!t&&document.hasFocus()&&this.validate()}_onInput(t){super._onInput(t),this.invalid&&this.validate()}_valueChanged(t,e){super._valueChanged(t,e),void 0!==e&&this.invalid&&this.validate()}}},34068:(t,e,o)=>{o.d(e,{A:()=>h}),o(9077);var r=o(33791),n=o(38735),i=o(31846),a=o(58074),l=o(89385),s=o(6052),d=o(15408),p=o(53430),u=o(3550);const c=t=>class extends((0,p.a)(t)){static get properties(){return{maxlength:{type:Number},minlength:{type:Number},pattern:{type:String}}}static get delegateAttrs(){return[...super.delegateAttrs,"maxlength","minlength","pattern"]}static get constraints(){return[...super.constraints,"maxlength","minlength","pattern"]}constructor(){super(),this._setType("text")}get clearElement(){return this.$.clearButton}ready(){super.ready(),this.addController(new d.f(this,(t=>{this._setInputElement(t),this._setFocusElement(t),this.stateTarget=t,this.ariaTarget=t}))),this.addController(new u.q(this.inputElement,this._labelController))}};(0,s.SF)("vaadin-text-field",l.k,{moduleId:"vaadin-text-field-styles"});class h extends(c((0,s.cp)((0,i.q)(r.Pu)))){static get is(){return"vaadin-text-field"}static get template(){return r.qy`
114
+ <style>
115
+ [part='input-field'] {
116
+ flex-grow: 0;
117
+ }
118
+ </style>
119
+
120
+ <div class="vaadin-field-container">
121
+ <div part="label">
122
+ <slot name="label"></slot>
123
+ <span part="required-indicator" aria-hidden="true" on-click="focus"></span>
124
+ </div>
125
+
126
+ <vaadin-input-container
127
+ part="input-field"
128
+ readonly="[[readonly]]"
129
+ disabled="[[disabled]]"
130
+ invalid="[[invalid]]"
131
+ theme$="[[_theme]]"
132
+ >
133
+ <slot name="prefix" slot="prefix"></slot>
134
+ <slot name="input"></slot>
135
+ <slot name="suffix" slot="suffix"></slot>
136
+ <div id="clearButton" part="clear-button" slot="suffix" aria-hidden="true"></div>
137
+ </vaadin-input-container>
138
+
139
+ <div part="helper-text">
140
+ <slot name="helper"></slot>
141
+ </div>
142
+
143
+ <div part="error-message">
144
+ <slot name="error-message"></slot>
145
+ </div>
146
+ </div>
147
+ <slot name="tooltip"></slot>
148
+ `}static get properties(){return{maxlength:{type:Number},minlength:{type:Number}}}ready(){super.ready(),this._tooltipController=new a.I(this),this._tooltipController.setPosition("top"),this._tooltipController.setAriaTarget(this.inputElement),this.addController(this._tooltipController)}}(0,n.X)(h)},70297:(t,e,o)=>{o(37451);var r=o(90500);(0,o(6052).SF)("vaadin-text-field",r.k,{moduleId:"lumo-text-field-styles"}),o(34068)},39542:(t,e,o)=>{o(70297),o(34068)}}]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@descope/web-components-ui",
3
- "version": "1.0.402",
3
+ "version": "1.0.404",
4
4
  "description": "",
5
5
  "main": "dist/cjs/index.cjs.js",
6
6
  "module": "dist/index.esm.js",
@@ -0,0 +1,306 @@
1
+ import { createStyleMixin, draggableMixin, componentNameValidationMixin } from '../../mixins';
2
+ import { createBaseClass } from '../../baseClasses/createBaseClass';
3
+ import { compose } from '../../helpers';
4
+ import { forwardAttrs, getComponentName } from '../../helpers/componentHelpers';
5
+ import { isNumericValue, sanitizeCountryCodePrefix as sanitizeValue } from './helpers';
6
+
7
+ export const componentName = getComponentName('hybrid-field');
8
+
9
+ const attrs = {
10
+ shared: [
11
+ 'label',
12
+ 'placeholder',
13
+ 'bordered',
14
+ 'full-width',
15
+ 'label-type',
16
+ 'size',
17
+ 'disabled',
18
+ 'readonly',
19
+ 'required',
20
+ 'st-host-direction',
21
+ ],
22
+ email: [
23
+ 'data-errormessage-value-missing-email',
24
+ 'data-errormessage-pattern-mismatch-email',
25
+ 'external-input',
26
+ ],
27
+ phone: {
28
+ countryCode: [
29
+ 'country-input-label',
30
+ 'country-input-placeholder',
31
+ 'restrict-countries',
32
+ 'default-code',
33
+ 'phone-minlength',
34
+ 'data-errormessage-value-missing-phone',
35
+ ],
36
+ inputBox: [
37
+ 'restrict-countries',
38
+ 'default-code',
39
+ 'phone-minlength',
40
+ 'data-errormessage-value-missing-phone',
41
+ ],
42
+ },
43
+ };
44
+
45
+ const attrMap = {
46
+ email: {
47
+ 'data-errormessage-value-missing-email': 'data-errormessage-value-missing',
48
+ 'data-errormessage-pattern-mismatch-email': 'data-errormessage-pattern-mismatch',
49
+ },
50
+ phone: {
51
+ placeholder: 'phone-input-placeholder',
52
+ 'phone-minlength': 'minlength',
53
+ 'data-errormessage-value-missing-phone': 'data-errormessage-value-missing',
54
+ },
55
+ };
56
+
57
+ const EMAIL_FIELD = 'descope-email-field';
58
+ const PHONE_FIELD = 'descope-phone-field';
59
+ const PHONE_INPUT_BOX_FIELD = 'descope-phone-input-box-field';
60
+
61
+ const BaseClass = createBaseClass({
62
+ componentName,
63
+ baseSelector: 'div',
64
+ });
65
+
66
+ class RawHybridField extends BaseClass {
67
+ #isReportedValidity = false;
68
+
69
+ #selectionStart;
70
+
71
+ constructor() {
72
+ super();
73
+
74
+ this.attachShadow({ mode: 'open' }).innerHTML = `
75
+ <style>
76
+ :host {
77
+ display: inline-flex;
78
+ box-sizing: border-box;
79
+ padding: 0;
80
+ gap: 0;
81
+ }
82
+ .wrapper {
83
+ display: grid;
84
+ place-content: center;
85
+ }
86
+ descope-email-field,
87
+ descope-phone-field,
88
+ descope-phone-input-box-field {
89
+ grid-area: 1/1;
90
+ width: 100%;
91
+ height: 100%;
92
+ }
93
+ .hidden {
94
+ visibility: hidden;
95
+ }
96
+ </style>
97
+ <div class="wrapper">
98
+ <descope-email-field external-input="${this.isExternalInput}"></descope-email-field>
99
+ <descope-phone-field allow-alphanumeric-input="true"></descope-phone-field>
100
+ <descope-phone-input-box-field allow-alphanumeric-input="true"></descope-phone-input-box-field>
101
+ </div>
102
+ `;
103
+ }
104
+
105
+ get isExternalInput() {
106
+ return this.getAttribute('external-input') === 'true';
107
+ }
108
+
109
+ get emailInputEle() {
110
+ return this.isExternalInput ? this.emailInput.externalInput : this.emailInput.inputElement;
111
+ }
112
+
113
+ get phoneVariant() {
114
+ const isInputBox = this.getAttribute('phone-variant') === 'inputBox';
115
+ return isInputBox ? this.phoneInputBoxInput : this.phoneCountryCodeInput;
116
+ }
117
+
118
+ get defaultCode() {
119
+ const firstItem = this.phoneCountryCodeInput.countryCodes?.[0] || '';
120
+ return this.getAttribute('default-code') || firstItem;
121
+ }
122
+
123
+ get activeInputEle() {
124
+ if (this.activeInput === this.emailInput) {
125
+ return this.emailInputEle;
126
+ }
127
+ return this.phoneVariant.phoneNumberInputEle;
128
+ }
129
+
130
+ get value() {
131
+ return this.activeInput?.value || '';
132
+ }
133
+
134
+ set value(val) {
135
+ this.handleActiveInput(val);
136
+ this.activeInput.value = val;
137
+ }
138
+
139
+ async init() {
140
+ super.init?.();
141
+
142
+ this.initInputs();
143
+ this.updateAttrs();
144
+ this.toggleInputVisibility();
145
+
146
+ await this.waitForInputs();
147
+
148
+ this.initInputEles();
149
+ this.overrideEmailInputType();
150
+ this.overrideEmailSetAttribute();
151
+ }
152
+
153
+ waitForInputs() {
154
+ return new Promise((resolve) => {
155
+ const check = setInterval(() => {
156
+ if (this.emailInputEle) {
157
+ clearInterval(check);
158
+ resolve();
159
+ }
160
+ });
161
+ });
162
+ }
163
+
164
+ initInputs() {
165
+ this.emailInput = this.shadowRoot.querySelector(EMAIL_FIELD);
166
+ this.phoneCountryCodeInput = this.shadowRoot.querySelector(PHONE_FIELD);
167
+ this.phoneInputBoxInput = this.shadowRoot.querySelector(PHONE_INPUT_BOX_FIELD);
168
+
169
+ this.inputs = [this.emailInput, this.phoneCountryCodeInput, this.phoneInputBoxInput];
170
+
171
+ this.activeInput = this.emailInput;
172
+ }
173
+
174
+ // we need to listen on the inner `input` element itself, otherwise we don't always get an `input` event
175
+ initInputEles() {
176
+ const inputEles = [
177
+ this.emailInputEle,
178
+ this.phoneCountryCodeInput.phoneNumberInputEle,
179
+ this.phoneInputBoxInput.phoneNumberInputEle,
180
+ ];
181
+
182
+ inputEles.forEach((ele) => {
183
+ ele.addEventListener('input', this.onValueChange.bind(this));
184
+ });
185
+ }
186
+
187
+ overrideEmailInputType() {
188
+ this.emailInputEle.addEventListener('focus', () => {
189
+ this.emailInputEle.setAttribute('type', 'text');
190
+ });
191
+ this.emailInputEle.addEventListener('blur', () => {
192
+ setTimeout(() => {
193
+ this.emailInputEle.setAttribute('type', 'email');
194
+ });
195
+ });
196
+ }
197
+
198
+ // We want to prevent Vaadin from changing the input type to `email`
199
+ // otherwise, we cannot get the selectionStart from the input.
200
+ overrideEmailSetAttribute() {
201
+ const origEmailSetAttr = this.emailInput.setAttribute.bind(this.emailInputEle);
202
+ this.emailInputEle.setAttribute = (name, value) => {
203
+ if (name !== 'type' || value !== 'email' || !this.emailInput.hasAttribute('focused')) {
204
+ return origEmailSetAttr(name, value);
205
+ }
206
+ return false;
207
+ };
208
+ }
209
+
210
+ updateAttrs() {
211
+ this.inputs.forEach((input) => forwardAttrs(this, input, { includeAttrs: attrs.shared }));
212
+
213
+ forwardAttrs(this, this.emailInput, { includeAttrs: attrs.email, mapAttrs: attrMap.email });
214
+
215
+ forwardAttrs(this, this.phoneCountryCodeInput, {
216
+ includeAttrs: attrs.phone.countryCode,
217
+ mapAttrs: attrMap.phone,
218
+ });
219
+
220
+ forwardAttrs(this, this.phoneInputBoxInput, {
221
+ includeAttrs: attrs.phone.inputBox,
222
+ mapAttrs: attrMap.phone,
223
+ });
224
+
225
+ setTimeout(() => this.phoneCountryCodeInput.setAttribute('default-code', this.defaultCode));
226
+ }
227
+
228
+ onValueChange() {
229
+ this.#selectionStart = this.activeInputEle.selectionStart;
230
+ this.handleActiveInput(this.activeInput.value);
231
+ }
232
+
233
+ handleActiveInput(val) {
234
+ const expectedActiveInput = isNumericValue(val) ? this.phoneVariant : this.emailInput;
235
+
236
+ if (this.activeInput !== expectedActiveInput) {
237
+ this.setActiveInput(expectedActiveInput);
238
+ }
239
+ }
240
+
241
+ setActiveInput(expectedActiveInput) {
242
+ const val = this.activeInput.value;
243
+ this.activeInput = expectedActiveInput;
244
+ this.setActiveInputValue(val);
245
+ if (this.#isReportedValidity) this.activeInput.reportValidity();
246
+ this.setActiveInputSelectionStart();
247
+ this.toggleInputVisibility();
248
+ }
249
+
250
+ setActiveInputSelectionStart() {
251
+ setTimeout(() => {
252
+ this.activeInputEle.focus();
253
+ this.activeInputEle.setSelectionRange?.(this.#selectionStart, this.#selectionStart);
254
+ });
255
+ }
256
+
257
+ setActiveInputValue(val) {
258
+ const sanitizedVal = sanitizeValue(val);
259
+ const isPhoneField = this.activeInput.localName === PHONE_FIELD;
260
+ const value = isPhoneField
261
+ ? `${this.phoneCountryCodeInput.countryCodeItems}-${sanitizedVal}`
262
+ : sanitizedVal;
263
+ this.activeInput.value = value;
264
+ }
265
+
266
+ toggleInputVisibility() {
267
+ this.inputs.forEach((input) => {
268
+ input !== this.activeInput ? input.classList.add('hidden') : input.classList.remove('hidden');
269
+ });
270
+ }
271
+
272
+ reportValidity() {
273
+ this.#isReportedValidity = true;
274
+
275
+ const ele = this.activeInputEle;
276
+
277
+ // On reportValidity we want to set the caret at the end of the input value.
278
+ // Since checkValidity triggers `focus` on the input, it sets the caret at the start of the input,
279
+ // regardless the existing value.
280
+ setTimeout(() => {
281
+ ele.setSelectionRange?.(ele.value.length, ele.value.length);
282
+ });
283
+
284
+ return this.activeInput.reportValidity();
285
+ }
286
+
287
+ checkValidity() {
288
+ return this.activeInput.checkValidity();
289
+ }
290
+ }
291
+
292
+ export const HybridFieldClass = compose(
293
+ createStyleMixin({ componentNameOverride: getComponentName('input-wrapper') }),
294
+ createStyleMixin({
295
+ mappings: {
296
+ hostWidth: { selector: () => ':host', property: 'width' },
297
+ hostDirection: [
298
+ { selector: () => 'descope-email-field', property: 'direction' },
299
+ { selector: () => 'descope-phone-field', property: 'direction' },
300
+ { selector: () => 'descope-phone-input-box-field', property: 'direction' },
301
+ ],
302
+ },
303
+ }),
304
+ draggableMixin,
305
+ componentNameValidationMixin
306
+ )(RawHybridField);
@@ -0,0 +1,5 @@
1
+ const NUMERIC_RE = /^\d+$/;
2
+
3
+ export const isNumericValue = (val) => NUMERIC_RE.test(val.replaceAll('+', '').replaceAll('-', ''));
4
+
5
+ export const sanitizeCountryCodePrefix = (val) => val.replace(/\+\d+-/, '');
@@ -0,0 +1,9 @@
1
+ import '../descope-email-field';
2
+ import '../phone-fields/descope-phone-field';
3
+ import '../phone-fields/descope-phone-input-box-field';
4
+
5
+ import { componentName, HybridFieldClass } from './HybridFieldClass';
6
+
7
+ customElements.define(componentName, HybridFieldClass);
8
+
9
+ export { HybridFieldClass };