@descope/web-components-ui 1.0.407 → 1.0.409

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 (31) hide show
  1. package/dist/cjs/index.cjs.js +145 -52
  2. package/dist/cjs/index.cjs.js.map +1 -1
  3. package/dist/index.esm.js +147 -53
  4. package/dist/index.esm.js.map +1 -1
  5. package/dist/umd/1053.js +1 -1
  6. package/dist/umd/{5459.js → 2755.js} +1 -1
  7. package/dist/umd/4480.js +1 -0
  8. package/dist/umd/4619.js +1 -1
  9. package/dist/umd/6726.js +1 -1
  10. package/dist/umd/7212.js +1 -1
  11. package/dist/umd/7607.js +1 -1
  12. package/dist/umd/DescopeDev.js +1 -1
  13. package/dist/umd/descope-combo-box-index-js.js +7 -7
  14. package/dist/umd/descope-date-field-descope-calendar-index-js.js +1 -1
  15. package/dist/umd/descope-hybrid-field-index-js.js +3 -3
  16. package/dist/umd/descope-recaptcha-index-js.js +1 -1
  17. package/dist/umd/descope-security-questions-setup-index-js.js +1 -1
  18. package/dist/umd/index.js +1 -1
  19. package/dist/umd/mapping-fields-descope-mappings-field-index-js.js +1 -1
  20. package/dist/umd/mapping-fields-descope-saml-group-mappings-index-js.js +1 -1
  21. package/dist/umd/phone-fields-descope-phone-field-descope-phone-field-internal-index-js.js +1 -1
  22. package/dist/umd/phone-fields-descope-phone-field-index-js.js +1 -1
  23. package/dist/umd/phone-fields-descope-phone-input-box-field-descope-phone-input-box-internal-index-js.js +2 -2
  24. package/dist/umd/phone-fields-descope-phone-input-box-field-index-js.js +8 -8
  25. package/package.json +1 -1
  26. package/src/components/descope-combo-box/ComboBoxClass.js +112 -46
  27. package/src/components/descope-date-field/descope-calendar/CalendarClass.js +8 -6
  28. package/src/components/descope-recaptcha/RecaptchaClass.js +5 -0
  29. package/src/components/phone-fields/descope-phone-field/descope-phone-field-internal/PhoneFieldInternal.js +2 -1
  30. package/src/mixins/normalizeBooleanAttributesMixin.js +2 -0
  31. package/src/theme/components/comboBox.js +19 -0
@@ -1,5 +1,5 @@
1
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])}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`
2
+ "use strict";(self.webpackChunk_descope_web_components_ui=self.webpackChunk_descope_web_components_ui||[]).push([[4043,7052,7212],{69473:(t,e,n)=>{n.d(e,{T:()=>s,w:()=>p});var i=n(94619),o=n(93826),r=n(7138),a=n(14944),l=n(33177);const s=(0,a.xE)("text-field"),d=["type","label-type","copy-to-clipboard"],p=(0,r.Zz)((0,i.RF)({mappings:o.A}),i.VO,(0,i.OZ)({proxyProps:["value","selectionStart"],useProxyTargets:!0}),i.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"},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,i.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,n)=>{n.r(e),n.d(e,{TextFieldClass:()=>i.w}),n(39542),n(66418),n(56637);var i=n(69473);customElements.define(i.T,i.w)},43945:(t,e,n)=>{n.d(e,{A:()=>p,T:()=>a});var i=n(25827),o=n(14944),r=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","allow-alphanumeric-input"],s={"phone-input-placeholder":"placeholder"},d=(0,i.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,r.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 n=/^[+\d-]+$/;e=t.target.value.split("").filter((t=>n.test(t))).join("")}t.target.value=e})),this.handleFocusEventsDispatching([this.phoneNumberInput])}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 i=n(43945);customElements.define(i.T,i.A)},65636:(t,e,n)=>{n.r(e),n.d(e,{PhoneFieldInputBoxClass:()=>C}),n(46633),n(4480),n(89348);var i=n(43945),o=n(14944),r=n(7138),a=n(94619),l=n(69473),s=n(44066),d=n(33177);const p=l.w.cssVarList,u=(0,o.xE)("phone-input-box-field"),{host:c,label:h,inputElement:b,requiredIndicator:v,inputField:m,inputFieldInternal:g,phoneInput:y,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,r.Zz)((0,a.RF)({mappings:{fontSize:[c,m,{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:{...g,property:"border-style"},inputBorderWidth:{...g,property:"border-width"},inputBorderColor:{...g,property:"border-color"},inputBorderRadius:[{...m,property:"border-radius"},{...g,property:"border-radius"}],inputHorizontalPadding:[{...y,property:"padding-left"},{...y,property:"padding-right"}],labelFontSize:{...h,property:"font-size"},labelFontWeight:{...h,property:"font-weight"},labelTextColor:[{...h,property:"color"},{...v,property:"color"}],labelRequiredIndicator:{...v,property:"content"},errorMessageTextColor:{...f,property:"color"},inputValueTextColor:{...y,property:p.inputValueTextColor},inputPlaceholderTextColor:{...y,property:p.inputPlaceholderColor},inputOutlineStyle:{...m,property:"outline-style"},inputOutlineColor:{...m,property:"outline-color"},inputOutlineWidth:{...m,property:"outline-width"},inputOutlineOffset:{...m,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<${i.T}\n\t\t\t\t\ttabindex="-1"\n\t\t\t\t\tslot="input"\n\t\t\t\t></${i.T}>\n `,this.baseElement.appendChild(t.content.cloneNode(!0)),this.inputElement=this.shadowRoot.querySelector(i.T),(0,o.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,n)=>{n.d(e,{Q:()=>o});var i=n(44066);const o=t=>i.A.find((e=>e.code===t))?.dialCode},31111:(t,e,n)=>{n(46165),n(14968),n(37451),n(72815);var i=n(90500),o=n(6052);const r=o.AH`
3
3
  :host {
4
4
  outline: none;
5
5
  }
@@ -7,7 +7,7 @@
7
7
  [part='toggle-button']::before {
8
8
  content: var(--lumo-icons-dropdown);
9
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`
10
+ `;(0,o.SF)("vaadin-combo-box",[i.k,r],{moduleId:"lumo-combo-box"}),n(9077);var a=n(33791),l=n(38735),s=n(35717),d=n(10187);class p extends((0,d.y)((0,o.cp)((0,s.v)(a.Pu)))){static get template(){return a.qy`
11
11
  <style>
12
12
  :host {
13
13
  display: block;
@@ -21,7 +21,7 @@
21
21
  <div part="content">
22
22
  <slot></slot>
23
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`
24
+ `}static get is(){return"vaadin-combo-box-item"}}(0,l.X)(p);var u=n(21380),c=n(52718),h=n(75482);const b=o.AH`
25
25
  #overlay {
26
26
  width: var(--vaadin-combo-box-overlay-width, var(--_vaadin-combo-box-overlay-default-width, auto));
27
27
  }
@@ -31,13 +31,13 @@
31
31
  flex-direction: column;
32
32
  height: 100%;
33
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`
34
+ `;(0,o.SF)("vaadin-combo-box-overlay",[c.B,b],{moduleId:"vaadin-combo-box-overlay-styles"});class v extends((0,h.p)((0,u.c)((0,s.v)((0,o.cp)(a.Pu))))){static get is(){return"vaadin-combo-box-overlay"}static get template(){return a.qy`
35
35
  <div id="backdrop" part="backdrop" hidden></div>
36
36
  <div part="overlay" id="overlay">
37
37
  <div part="loader"></div>
38
38
  <div part="content" id="content"><slot></slot></div>
39
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`
40
+ `}}(0,l.X)(v);var m=n(44998);class g extends((0,m.N)(a.Pu)){static get is(){return"vaadin-combo-box-scroller"}static get template(){return a.qy`
41
41
  <style>
42
42
  :host {
43
43
  display: block;
@@ -64,7 +64,7 @@
64
64
  <div id="selector">
65
65
  <slot></slot>
66
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`
67
+ `}}(0,l.X)(g);var y=n(31846),f=n(58074),x=n(32318),C=n(15408),w=n(3550),_=n(3410);const I=t=>class extends((0,_.U)(t)){static get properties(){return{pattern:{type:String}}}static get delegateAttrs(){return[...super.delegateAttrs,"pattern"]}static get constraints(){return[...super.constraints,"pattern"]}};var E=n(89385),k=n(5792),T=n(93131);(0,o.SF)("vaadin-combo-box",E.k,{moduleId:"vaadin-combo-box-styles"});class A extends((0,k.K)((0,T.x)(I((0,x.R)((0,o.cp)((0,y.q)(a.Pu))))))){static get is(){return"vaadin-combo-box"}static get template(){return a.qy`
68
68
  <style>
69
69
  :host([opened]) {
70
70
  pointer-events: auto;
@@ -110,7 +110,7 @@
110
110
  ></vaadin-combo-box-overlay>
111
111
 
112
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`
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)(A)},53430:(t,e,n)=>{n.d(e,{a:()=>o});var i=n(32318);const o=t=>class extends((0,i.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,n)=>{n.d(e,{A:()=>h}),n(9077);var i=n(33791),o=n(38735),r=n(31846),a=n(58074),l=n(89385),s=n(6052),d=n(15408),p=n(53430),u=n(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,r.q)(i.Pu)))){static get is(){return"vaadin-text-field"}static get template(){return i.qy`
114
114
  <style>
115
115
  [part='input-field'] {
116
116
  flex-grow: 0;
@@ -145,4 +145,4 @@
145
145
  </div>
146
146
  </div>
147
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)}}]);
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,o.X)(h)},70297:(t,e,n)=>{n(37451);var i=n(90500);(0,n(6052).SF)("vaadin-text-field",i.k,{moduleId:"lumo-text-field-styles"}),n(34068)},39542:(t,e,n)=>{n(70297),n(34068)}}]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@descope/web-components-ui",
3
- "version": "1.0.407",
3
+ "version": "1.0.409",
4
4
  "description": "",
5
5
  "main": "dist/cjs/index.cjs.js",
6
6
  "module": "dist/index.esm.js",
@@ -49,6 +49,23 @@ const ComboBoxMixin = (superclass) =>
49
49
  this.renderItems();
50
50
  }
51
51
 
52
+ set renderer(fn) {
53
+ // fn takes (root, comboBox, model) as arguments
54
+ this.baseElement.renderer = fn;
55
+ }
56
+
57
+ get loading() {
58
+ return this.getAttribute('loading') === 'true';
59
+ }
60
+
61
+ set loading(val) {
62
+ if (val) {
63
+ this.setAttribute('loading', 'true');
64
+ } else {
65
+ this.removeAttribute('loading');
66
+ }
67
+ }
68
+
52
69
  get data() {
53
70
  if (this.#data) return this.#data;
54
71
 
@@ -92,14 +109,20 @@ const ComboBoxMixin = (superclass) =>
92
109
  }
93
110
 
94
111
  renderItems() {
95
- const template = this.getItemsTemplate();
96
- if (template) this.innerHTML = template;
112
+ if (this.#data || this.getAttribute('data')) {
113
+ const template = this.getItemsTemplate();
114
+ this.innerHTML = template;
115
+ }
97
116
  }
98
117
 
99
118
  handleSelectedItem() {
100
- const currentSelected = this.baseElement.selectedItem?.['data-id'];
119
+ const { selectedItem } = this.baseElement;
120
+ const currentSelected = selectedItem?.['data-id'];
101
121
 
102
- this.baseElement.selectedItem = undefined;
122
+ // If the selected item is still a child, there's no need to update the value
123
+ if (selectedItem && Array.from(this.children).includes(selectedItem)) {
124
+ return;
125
+ }
103
126
 
104
127
  // if previously selected item ID exists in current children, set it as selected
105
128
  if (currentSelected) {
@@ -132,7 +155,7 @@ const ComboBoxMixin = (superclass) =>
132
155
  value: {
133
156
  ...valueDescriptor,
134
157
  set(val) {
135
- if (!comboBox.baseElement.items?.length) {
158
+ if (!comboBox.baseElement.items?.length && !comboBox.allowCustomValue) {
136
159
  return;
137
160
  }
138
161
 
@@ -152,39 +175,27 @@ const ComboBoxMixin = (superclass) =>
152
175
  // in order to avoid it, we are passing the children of this component
153
176
  // to the items & renderer props, so it will be used as the combo box items
154
177
  #onChildrenChange() {
155
- const baseElement = this.shadowRoot.querySelector(this.baseSelector);
156
178
  const items = Array.from(this.children);
157
179
 
158
180
  // we want the data-name attribute to be accessible as an object attribute
159
- if (items.length) {
160
- items.forEach((node) => {
161
- Object.defineProperty(node, 'data-name', {
162
- value: node.getAttribute('data-name'),
163
- configurable: true,
164
- writable: true,
165
- });
166
- Object.defineProperty(node, 'data-id', {
167
- value: node.getAttribute('data-id'),
168
- configurable: true,
169
- writable: true,
170
- });
181
+ items.forEach((node) => {
182
+ Object.defineProperty(node, 'data-name', {
183
+ value: node.getAttribute('data-name'),
184
+ configurable: true,
185
+ writable: true,
171
186
  });
187
+ Object.defineProperty(node, 'data-id', {
188
+ value: node.getAttribute('data-id'),
189
+ configurable: true,
190
+ writable: true,
191
+ });
192
+ });
172
193
 
173
- baseElement.items = items;
174
-
175
- setTimeout(() => {
176
- // set timeout to ensure this runs after customValueTransformFn had the chance to be overriden
177
- this.handleSelectedItem();
178
- }, 0);
179
- }
180
-
181
- // use vaadin combobox custom renderer to render options as HTML
182
- // and not via default renderer, which renders only the data-name's value
183
- // in its own HTML template
184
- baseElement.renderer = (root, combo, model) => {
185
- // eslint-disable-next-line no-param-reassign
186
- root.innerHTML = model.item.outerHTML;
187
- };
194
+ this.baseElement.items = items;
195
+ setTimeout(() => {
196
+ // set timeout to ensure this runs after customValueTransformFn had the chance to be overriden
197
+ this.handleSelectedItem();
198
+ }, 0);
188
199
  }
189
200
 
190
201
  // the default vaadin behavior is to attach the overlay to the body when opened
@@ -199,6 +210,16 @@ const ComboBoxMixin = (superclass) =>
199
210
  overlay._enterModalState = () => {};
200
211
  }
201
212
 
213
+ #overrideRenderer() {
214
+ // use vaadin combobox custom renderer to render options as HTML
215
+ // and not via default renderer, which renders only the data-name's value
216
+ // in its own HTML template
217
+ this.baseElement.renderer = (root, combo, model) => {
218
+ // eslint-disable-next-line no-param-reassign
219
+ root.innerHTML = model.item.outerHTML;
220
+ };
221
+ }
222
+
202
223
  init() {
203
224
  super.init?.();
204
225
 
@@ -213,13 +234,11 @@ const ComboBoxMixin = (superclass) =>
213
234
  };
214
235
 
215
236
  this.setComboBoxDescriptor();
216
-
217
237
  this.#overrideOverlaySettings();
238
+ this.#overrideRenderer();
218
239
 
219
- this.renderItems();
220
-
240
+ // Set up observers - order matters here since renderItems can clear innerHTML
221
241
  observeAttributes(this, this.renderItems.bind(this), { includeAttrs: ['data'] });
222
-
223
242
  observeChildren(this, this.#onChildrenChange.bind(this));
224
243
 
225
244
  this.setDefaultValue();
@@ -252,16 +271,38 @@ const ComboBoxMixin = (superclass) =>
252
271
  }
253
272
 
254
273
  setDefaultValue() {
255
- this.value = this.defaultValue;
274
+ if (this.defaultValue) {
275
+ this.value = this.defaultValue;
276
+ }
256
277
  }
257
278
 
258
- set value(val) {
259
- if (val) {
260
- const child = this.baseElement.items?.find((item) => item['data-id'] === val);
279
+ #getChildToSelect(val) {
280
+ return this.baseElement.items?.find((item) => item['data-id'] === val);
281
+ }
261
282
 
262
- if (child) {
263
- this.baseElement.selectedItem = child;
264
- }
283
+ #preventSelectedItemChangeEventIfNeeded(val, selectedChild) {
284
+ // If the actual value didn't change, but the selected item did (the element changed),
285
+ // we want to stop the event propagation since it's not a real change
286
+ const shouldPreventItemChangeEvent =
287
+ val === this.value && selectedChild !== this.baseElement.selectedItem;
288
+ if (shouldPreventItemChangeEvent) {
289
+ this.baseElement.addEventListener(
290
+ 'selected-item-changed',
291
+ (e) => {
292
+ e.stopImmediatePropagation();
293
+ },
294
+ { once: true, capture: true }
295
+ );
296
+ }
297
+ }
298
+
299
+ set value(val) {
300
+ const selectedChild = this.#getChildToSelect(val);
301
+ this.#preventSelectedItemChangeEventIfNeeded(val, selectedChild);
302
+ if (val && selectedChild) {
303
+ this.baseElement.selectedItem = selectedChild;
304
+ } else if (!selectedChild && this.allowCustomValue) {
305
+ this.baseElement.value = val;
265
306
  } else {
266
307
  this.baseElement.selectedItem = undefined;
267
308
  }
@@ -391,7 +432,10 @@ export const ComboBoxClass = compose(
391
432
  name: 'overlay',
392
433
  selector: '',
393
434
  mappings: {
394
- backgroundColor: { selector: 'vaadin-combo-box-scroller' },
435
+ backgroundColor: [
436
+ { selector: 'vaadin-combo-box-scroller' },
437
+ { selector: 'vaadin-combo-box-overlay::part(overlay)' },
438
+ ],
395
439
  minHeight: { selector: 'vaadin-combo-box-overlay' },
396
440
  margin: { selector: 'vaadin-combo-box-overlay' },
397
441
  cursor: { selector: 'vaadin-combo-box-item' },
@@ -404,6 +448,24 @@ export const ComboBoxClass = compose(
404
448
  property: 'padding-inline-start',
405
449
  },
406
450
  itemPaddingInlineEnd: { selector: 'vaadin-combo-box-item', property: 'padding-inline-end' },
451
+
452
+ loaderTop: { selector: 'vaadin-combo-box-overlay::part(loader)', property: 'top' },
453
+ loaderLeft: { selector: 'vaadin-combo-box-overlay::part(loader)', property: 'left' },
454
+ loaderRight: { selector: 'vaadin-combo-box-overlay::part(loader)', property: 'right' },
455
+ loaderMargin: { selector: 'vaadin-combo-box-overlay::part(loader)', property: 'margin' },
456
+ loaderWidth: { selector: 'vaadin-combo-box-overlay::part(loader)', property: 'width' },
457
+ loaderHeight: { selector: 'vaadin-combo-box-overlay::part(loader)', property: 'height' },
458
+ loaderBorder: { selector: 'vaadin-combo-box-overlay::part(loader)', property: 'border' },
459
+ loaderBorderColor: {
460
+ selector: 'vaadin-combo-box-overlay::part(loader)',
461
+ property: 'border-color',
462
+ },
463
+ loaderBorderRadius: {
464
+ selector: 'vaadin-combo-box-overlay::part(loader)',
465
+ property: 'border-radius',
466
+ },
467
+ contentHeight: { selector: 'vaadin-combo-box-overlay::part(content)', property: 'height' },
468
+ contentOpacity: { selector: 'vaadin-combo-box-overlay::part(content)', property: 'opacity' },
407
469
  },
408
470
  forward: {
409
471
  include: false,
@@ -451,6 +513,10 @@ export const ComboBoxClass = compose(
451
513
  align-self: center;
452
514
  }
453
515
 
516
+ vaadin-combo-box[hide-toggle-button="true"]::part(toggle-button) {
517
+ display: none;
518
+ }
519
+
454
520
  vaadin-combo-box[label-type="floating"]:not([focused])[readonly] > input:placeholder-shown {
455
521
  opacity: 0;
456
522
  }
@@ -465,7 +531,7 @@ export const ComboBoxClass = compose(
465
531
  // with the same name. Including it will cause Vaadin to calculate NaN size,
466
532
  // and reset items to an empty array, and opening the list box with no items
467
533
  // to display.
468
- excludeAttrsSync: ['tabindex', 'size', 'data'],
534
+ excludeAttrsSync: ['tabindex', 'size', 'data', 'loading'],
469
535
  componentName,
470
536
  includeForwardProps: ['items', 'renderer', 'selectedItem'],
471
537
  })
@@ -24,6 +24,7 @@ import {
24
24
  import {
25
25
  createMonthView,
26
26
  createInputs,
27
+ getMonthsOptions,
27
28
  getYearOptions,
28
29
  initComboBox,
29
30
  ensureMonthNamesArr,
@@ -286,7 +287,9 @@ class RawCalendar extends BaseInputClass {
286
287
  this.monthInput.value = month;
287
288
  // For the yearInput we update the base element directly to properly trigger the change event
288
289
  // since this can be a custom value
289
- this.yearInput.baseElement.value = year;
290
+ setTimeout(() => {
291
+ this.yearInput.baseElement.value = year;
292
+ });
290
293
  }
291
294
  }
292
295
 
@@ -425,11 +428,10 @@ class RawCalendar extends BaseInputClass {
425
428
  }
426
429
 
427
430
  onMonthNamesChange() {
428
- Array.from(this.monthInput?.children || []).forEach((child, index) => {
429
- const month = this.monthNames[index];
430
- child.setAttribute('data-name', month);
431
- // eslint-disable-next-line no-param-reassign
432
- child.textContent = month;
431
+ setTimeout(() => {
432
+ if (this.monthInput) {
433
+ this.monthInput.innerHTML = getMonthsOptions(this.monthNames);
434
+ }
433
435
  });
434
436
  }
435
437
 
@@ -31,6 +31,10 @@ class RawRecaptcha extends BaseClass {
31
31
  return;
32
32
  }
33
33
 
34
+ this.toggleRecaptchaEles(enabled);
35
+ }
36
+
37
+ toggleRecaptchaEles(enabled) {
34
38
  if (enabled) {
35
39
  this.recaptchaEle.style.display = '';
36
40
  this.mockRecaptchaEle.style.display = 'none';
@@ -95,6 +99,7 @@ class RawRecaptcha extends BaseClass {
95
99
  this.mockRecaptchaEle.style.display = 'none';
96
100
  this.badge.classList.add('hidden');
97
101
  } else {
102
+ this.toggleRecaptchaEles(this.enabled);
98
103
  this.badge.classList.remove('hidden');
99
104
  }
100
105
  }
@@ -149,7 +149,8 @@ class PhoneFieldInternal extends BaseInputClass {
149
149
  }
150
150
 
151
151
  getRestrictedCountries() {
152
- return this.getAttribute('restrict-countries')?.split(',') || [];
152
+ const attr = this.getAttribute('restrict-countries');
153
+ return attr ? attr.split(',') : [];
153
154
  }
154
155
 
155
156
  getCountryByDialCode(countryDialCode) {
@@ -20,6 +20,8 @@ const booleanAttributesList = [
20
20
  'opening',
21
21
  'closing',
22
22
  'has-no-options',
23
+ 'loading',
24
+ 'allow-custom-value',
23
25
  ];
24
26
 
25
27
  const isBooleanAttribute = (attr) => {
@@ -61,6 +61,25 @@ export const comboBox = {
61
61
  // Overlay direct theme:
62
62
  [vars.overlay.minHeight]: '400px',
63
63
  [vars.overlay.margin]: '0',
64
+
65
+ [vars.overlay.contentHeight]: '100%',
66
+ [vars.overlay.contentOpacity]: '1',
67
+ _loading: {
68
+ [vars.overlay.loaderTop]: '50%',
69
+ [vars.overlay.loaderLeft]: '50%',
70
+ [vars.overlay.loaderRight]: 'auto',
71
+ // Margin has to be negative to center the loader, "transform" can't be used because the animation uses it
72
+ // Margin has to be half of the width/height of the loader to center it
73
+ [vars.overlay.loaderMargin]: '-15px 0 0 -15px',
74
+ [vars.overlay.loaderWidth]: '30px',
75
+ [vars.overlay.loaderHeight]: '30px',
76
+ [vars.overlay.loaderBorder]: '2px solid transparent',
77
+ [vars.overlay
78
+ .loaderBorderColor]: `${globalRefs.colors.primary.highlight} ${globalRefs.colors.primary.highlight} ${globalRefs.colors.primary.main} ${globalRefs.colors.primary.main}`,
79
+ [vars.overlay.loaderBorderRadius]: '50%',
80
+ [vars.overlay.contentHeight]: '100px',
81
+ [vars.overlay.contentOpacity]: '0',
82
+ },
64
83
  };
65
84
 
66
85
  export default comboBox;