@descope/web-components-ui 1.0.334 → 1.0.336

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. package/dist/cjs/index.cjs.js +186 -550
  2. package/dist/cjs/index.cjs.js.map +1 -1
  3. package/dist/index.esm.js +189 -556
  4. package/dist/index.esm.js.map +1 -1
  5. package/dist/umd/4392.js +1 -1
  6. package/dist/umd/4978.js +1 -1
  7. package/dist/umd/DescopeDev.js +1 -1
  8. package/dist/umd/descope-email-field-index-js.js +4 -4
  9. package/dist/umd/descope-new-password-descope-new-password-internal-index-js.js +1 -1
  10. package/dist/umd/descope-new-password-index-js.js +1 -1
  11. package/dist/umd/descope-number-field-index-js.js +1 -1
  12. package/dist/umd/descope-passcode-index-js.js +1 -1
  13. package/dist/umd/descope-password-index-js.js +1 -1
  14. package/dist/umd/descope-radio-group-index-js.js +1 -1
  15. package/dist/umd/descope-text-field-index-js.js +2 -2
  16. package/dist/umd/index.js +1 -1
  17. package/dist/umd/mapping-fields-descope-mappings-field-index-js.js +1 -1
  18. package/dist/umd/phone-fields-descope-phone-field-descope-phone-field-internal-index-js.js +1 -1
  19. package/dist/umd/phone-fields-descope-phone-field-index-js.js +1 -1
  20. package/dist/umd/phone-fields-descope-phone-input-box-field-descope-phone-input-box-internal-index-js.js +2 -2
  21. package/dist/umd/phone-fields-descope-phone-input-box-field-index-js.js +1 -1
  22. package/package.json +1 -1
  23. package/src/components/descope-email-field/EmailFieldClass.js +3 -103
  24. package/src/components/descope-new-password/NewPasswordClass.js +0 -24
  25. package/src/components/descope-password/PasswordClass.js +1 -126
  26. package/src/components/descope-text-field/TextFieldClass.js +51 -29
  27. package/src/components/descope-text-field/index.js +2 -0
  28. package/src/components/descope-text-field/textFieldMappings.js +14 -36
  29. package/src/components/phone-fields/descope-phone-field/PhoneFieldClass.js +2 -11
  30. package/src/components/phone-fields/descope-phone-field/descope-phone-field-internal/PhoneFieldInternal.js +2 -5
  31. package/src/components/phone-fields/descope-phone-input-box-field/descope-phone-input-box-internal/PhoneFieldInternalInputBox.js +1 -1
  32. package/src/mixins/proxyInputMixin.js +2 -5
  33. package/src/theme/components/comboBox.js +10 -15
  34. package/src/theme/components/emailField.js +10 -15
  35. package/src/theme/components/inputWrapper.js +1 -0
  36. package/src/theme/components/multiSelectComboBox.js +9 -10
  37. package/src/theme/components/newPassword.js +1 -6
  38. package/src/theme/components/numberField.js +10 -15
  39. package/src/theme/components/password.js +9 -14
  40. package/src/theme/components/phoneField.js +3 -8
  41. package/src/theme/components/phoneInputBoxField.js +9 -14
  42. package/src/theme/components/textField.js +16 -15
  43. package/src/helpers/externalInputs.js +0 -76
@@ -1,5 +1,5 @@
1
1
  /*! For license information please see phone-fields-descope-phone-input-box-field-descope-phone-input-box-internal-index-js.js.LICENSE.txt */
2
- "use strict";(self.webpackChunk_descope_web_components_ui=self.webpackChunk_descope_web_components_ui||[]).push([[4981],{41377:(t,e,n)=>{n.d(e,{Z:()=>d,f:()=>s});var i=n(73878),a=n(54567),r=n(16418);const s=(0,a.iY)("phone-field-internal-input-box"),l=["disabled","size","bordered","invalid","readonly","phone-input-placeholder","name","autocomplete","label-type"],u={"phone-input-placeholder":"placeholder"},o=(0,i.P)({componentName:s,baseSelector:"div"}),d=class extends o{static get observedAttributes(){return[].concat(o.observedAttributes||[],l)}constructor(){super(),this.innerHTML='\n <div>\n <descope-text-field tabindex="1" external-input="true"></descope-text-field>\n </div>\n ',this.phoneNumberInput=this.querySelector("descope-text-field")}get defaultCountryCode(){return(0,r.g)(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=u[t]||t;this.phoneNumberInput.setAttribute(e,n)}}}},83067:(t,e,n)=>{n.r(e),n(19357);var i=n(41377);customElements.define(i.f,i.Z)},16418:(t,e,n)=>{n.d(e,{g:()=>a});var i=n(87262);const a=t=>i.Z.find((e=>e.code===t))?.dialCode},73208:(t,e,n)=>{n.d(e,{b:()=>a});var i=n(78591);class a extends i.n{constructor(t,e){super(t,"input","input",{initializer:(t,n)=>{n.value&&(t.value=n.value),n.type&&t.setAttribute("type",n.type),t.id=this.defaultId,"function"==typeof e&&e(t)},useUniqueId:!0})}}},20422:(t,e,n)=>{n.d(e,{j:()=>a});var i=n(73406);const a=t=>class extends((0,i.L)(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()}}},18005:(t,e,n)=>{n.d(e,{n:()=>c}),n(13553);var i=n(74241),a=n(52807),r=n(12521),s=n(34463),l=n(62743),u=n(46570),o=n(73208),d=n(20422),p=n(46729);const h=t=>class extends((0,d.j)(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 o.b(this,(t=>{this._setInputElement(t),this._setFocusElement(t),this.stateTarget=t,this.ariaTarget=t}))),this.addController(new p.v(this.inputElement,this._labelController))}};(0,u.hC)("vaadin-text-field",l.J,{moduleId:"vaadin-text-field-styles"});class c extends(h((0,u.Tb)((0,r.S)(i.H3)))){static get is(){return"vaadin-text-field"}static get template(){return i.dy`
2
+ "use strict";(self.webpackChunk_descope_web_components_ui=self.webpackChunk_descope_web_components_ui||[]).push([[4981],{41377:(t,e,n)=>{n.d(e,{Z:()=>d,f:()=>r});var i=n(73878),a=n(54567),s=n(16418);const r=(0,a.iY)("phone-field-internal-input-box"),l=["disabled","size","bordered","invalid","readonly","phone-input-placeholder","name","autocomplete","label-type"],u={"phone-input-placeholder":"placeholder"},o=(0,i.P)({componentName:r,baseSelector:"div"}),d=class extends o{static get observedAttributes(){return[].concat(o.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,s.g)(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=u[t]||t;this.phoneNumberInput.setAttribute(e,n)}}}},83067:(t,e,n)=>{n.r(e),n(19357);var i=n(41377);customElements.define(i.f,i.Z)},16418:(t,e,n)=>{n.d(e,{g:()=>a});var i=n(87262);const a=t=>i.Z.find((e=>e.code===t))?.dialCode},73208:(t,e,n)=>{n.d(e,{b:()=>a});var i=n(78591);class a extends i.n{constructor(t,e){super(t,"input","input",{initializer:(t,n)=>{n.value&&(t.value=n.value),n.type&&t.setAttribute("type",n.type),t.id=this.defaultId,"function"==typeof e&&e(t)},useUniqueId:!0})}}},20422:(t,e,n)=>{n.d(e,{j:()=>a});var i=n(73406);const a=t=>class extends((0,i.L)(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()}}},18005:(t,e,n)=>{n.d(e,{n:()=>c}),n(13553);var i=n(74241),a=n(52807),s=n(12521),r=n(34463),l=n(62743),u=n(46570),o=n(73208),d=n(20422),p=n(46729);const h=t=>class extends((0,d.j)(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 o.b(this,(t=>{this._setInputElement(t),this._setFocusElement(t),this.stateTarget=t,this.ariaTarget=t}))),this.addController(new p.v(this.inputElement,this._labelController))}};(0,u.hC)("vaadin-text-field",l.J,{moduleId:"vaadin-text-field-styles"});class c extends(h((0,u.Tb)((0,s.S)(i.H3)))){static get is(){return"vaadin-text-field"}static get template(){return i.dy`
3
3
  <style>
4
4
  [part='input-field'] {
5
5
  flex-grow: 0;
@@ -34,4 +34,4 @@
34
34
  </div>
35
35
  </div>
36
36
  <slot name="tooltip"></slot>
37
- `}static get properties(){return{maxlength:{type:Number},minlength:{type:Number}}}ready(){super.ready(),this._tooltipController=new s.f(this),this._tooltipController.setPosition("top"),this._tooltipController.setAriaTarget(this.inputElement),this.addController(this._tooltipController)}}(0,a.M)(c)},58725:(t,e,n)=>{n(21578);var i=n(83208);(0,n(46570).hC)("vaadin-text-field",i.J,{moduleId:"lumo-text-field-styles"}),n(18005)},79789:(t,e,n)=>{n(58725),n(18005)}}]);
37
+ `}static get properties(){return{maxlength:{type:Number},minlength:{type:Number}}}ready(){super.ready(),this._tooltipController=new r.f(this),this._tooltipController.setPosition("top"),this._tooltipController.setAriaTarget(this.inputElement),this.addController(this._tooltipController)}}(0,a.M)(c)},58725:(t,e,n)=>{n(21578);var i=n(83208);(0,n(46570).hC)("vaadin-text-field",i.J,{moduleId:"lumo-text-field-styles"}),n(18005)},79789:(t,e,n)=>{n(58725),n(18005)}}]);
@@ -1 +1 @@
1
- "use strict";(self.webpackChunk_descope_web_components_ui=self.webpackChunk_descope_web_components_ui||[]).push([[5119],{84049:(e,t,r)=>{r.d(t,{H:()=>f,f:()=>l});var n=r(2061),o=r(54567),i=r(54201),a=r(94978);const l=(0,o.iY)("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)"}},f=(0,n.qC)((0,a.yk)({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:()=>f.cssVarList.overlay.backgroundColor},overlayTextColor:{property:()=>f.cssVarList.overlay.textColor},overlayBorder:{property:()=>f.cssVarList.overlay.border},overlayFontSize:{property:()=>f.cssVarList.overlay.fontSize},overlayFontFamily:{property:()=>f.cssVarList.overlay.fontFamily},overlayCursor:{property:()=>f.cssVarList.overlay.cursor},overlayItemBoxShadow:{property:()=>f.cssVarList.overlay.itemBoxShadow},overlayItemPaddingInlineStart:{property:()=>f.cssVarList.overlay.itemPaddingInlineStart},overlayItemPaddingInlineEnd:{property:()=>f.cssVarList.overlay.itemPaddingInlineEnd}}}),a.e4,(0,a.Iw)({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.dj)({proxyProps:["selectionStart"],inputEvent:"selected-item-changed"}),a.Ae,(e=>class extends e{static get observedAttributes(){return["label-type"]}#e=({displayName:e,value:t,label:r})=>`<span data-name="${r}" data-id="${t}">${e||r}</span>`;#t;get defaultValue(){return this.getAttribute("default-value")}get renderItem(){return this.#e}set renderItem(e){this.#e=e,this.renderItems()}get data(){if(this.#t)return this.#t;const e=this.getAttribute("data");if(e)try{const t=JSON.parse(e);if(this.isValidDataType(t))return t}catch(e){console.error('could not parse data string from attribute "data" -',e.message)}return[]}set data(e){this.isValidDataType(e)&&(this.#t=e,this.renderItems())}isValidDataType(e){const t=Array.isArray(e);return t||console.error("data must be an array, received:",e),t}getItemsTemplate(){return this.data?.reduce?.(((e,t)=>e+(this.renderItem?.(t||{})||"")),"")}renderItems(){const e=this.getItemsTemplate();e&&(this.innerHTML=e)}handleSelectedItem(){const e=this.baseElement.selectedItem?.["data-id"];this.baseElement.selectedItem=void 0,e&&(this.value=e),this.value||this.setDefaultValue()}customValueTransformFn(e){return e}setComboBoxDescriptor(){const e=Object.getOwnPropertyDescriptor(this.inputElement.constructor.prototype,"value"),t=this;Object.defineProperties(this.inputElement,{value:{...e,set(r){if(!t.baseElement.items?.length)return;const n=t.customValueTransformFn(r)||"";n!==this.value&&e.set.call(this,n)}}})}#r(){const e=this.shadowRoot.querySelector(this.baseSelector),t=Array.from(this.children);t.length&&(t.forEach((e=>{Object.defineProperty(e,"data-name",{value:e.getAttribute("data-name"),configurable:!0,writable:!0}),Object.defineProperty(e,"data-id",{value:e.getAttribute("data-id"),configurable:!0,writable:!0})})),e.items=t,setTimeout((()=>{this.handleSelectedItem()}),0)),e.renderer=(e,t,r)=>{e.innerHTML=r.item.outerHTML}}#n(){const e=this.baseElement.shadowRoot.querySelector("vaadin-combo-box-overlay");e._attachOverlay=()=>{e.bringToFront()},e._detachOverlay=()=>{},e._enterModalState=()=>{}}init(){super.init?.(),this.getValidity=function(){return!this.value&&this.isRequired?{valueMissing:!0}:{}},this.setComboBoxDescriptor(),this.#n(),this.renderItems(),(0,o.FX)(this,this.renderItems.bind(this),{includeAttrs:["data"]}),(0,o.P$)(this,this.#r.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(e,t,r){super.attributeChangedCallback?.(e,t,r),t!==r&&"label-type"===e&&("floating"===r?this.addEventListener("click",this.onLabelClick):this.removeEventListener("click",this.onLabelClick))}setDefaultValue(){this.value=this.defaultValue}set value(e){if(e){const t=this.baseElement.items?.find((t=>t["data-id"]===e));t&&(this.baseElement.selectedItem=t)}else this.baseElement.selectedItem=void 0}get value(){return this.baseElement.selectedItem?.["data-id"]||""}}))((0,a.DM)({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.bi)(f.cssVarList)}\n\t\t${(0,i.PH)("vaadin-combo-box")}\n\t\t${(0,i.jI)("vaadin-combo-box")}\n\t\t${(0,i.Pd)("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.Wf)("vaadin-combo-box")}\n ${(0,i.bz)()}\n\t\t`,excludeAttrsSync:["tabindex","size","data"],componentName:l,includeForwardProps:["items","renderer","selectedItem"]}))},21294:(e,t,r)=>{r.r(t),r.d(t,{ComboBoxClass:()=>n.H}),r(47583);var n=r(84049);customElements.define(n.f,n.H)},41377:(e,t,r)=>{r.d(t,{Z:()=>d,f:()=>a});var n=r(73878),o=r(54567),i=r(16418);const a=(0,o.iY)("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,n.P)({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" external-input="true"></descope-text-field>\n </div>\n ',this.phoneNumberInput=this.querySelector("descope-text-field")}get defaultCountryCode(){return(0,i.g)(this.getAttribute("default-code"))}get hasDefaultCode(){return!!this.getAttribute("default-code")}get value(){if(!this.phoneNumberValue)return"";if(this.hasDefaultCode){const e=new RegExp(`\\+?${parseInt(this.defaultCountryCode,10)}--?`);return`${this.defaultCountryCode}-${this.phoneNumberInput.value.replace(e,"")}`}return this.phoneNumberInput.value}set value(e){this.phoneNumberInput.value=e}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 e=this.value.replace(/\D/g,"");return this.isRequired&&!this.value?{valueMissing:!0}:e.length<this.minLength?{tooShort:!0}:e.length>this.maxLength?{tooLong:!0}:/^\+?\d{1,4}-?(?:\d-?){1,15}$/.test(this.value)?{}:{patternMismatch:!0}}init(){this.addEventListener("focus",(e=>{e.isTrusted&&this.phoneNumberInput.focus()})),super.init?.(),this.initInputs()}getCountryByDialCode(e){return this.countryCodeInput.items?.find((t=>t.getAttribute("data-country-code")===e))}initInputs(){this.phoneNumberInput.addEventListener("input",(e=>{1===e.target.value.length&&"-"===e.target.value&&(e.target.value=""),e.target.value=e.target.value.replace(/(?!^)\+/g,"").replace("--","-").replace("+-","+");const t=/^[+\d-]+$/,r=e.target.value.split("").filter((e=>t.test(e))).join("");e.target.value=r})),this.handleFocusEventsDispatching([this.phoneNumberInput]),this.handleInputEventDispatching()}attributeChangedCallback(e,t,r){if(super.attributeChangedCallback(e,t,r),t!==r&&l.includes(e)){const t=s[e]||e;this.phoneNumberInput.setAttribute(t,r)}}}},83067:(e,t,r)=>{r.r(t),r(19357);var n=r(41377);customElements.define(n.f,n.Z)},69423:(e,t,r)=>{r.r(t),r.d(t,{PhoneFieldInputBoxClass:()=>x}),r(83067),r(21294),r(19357);var n=r(41377),o=r(54567),i=r(2061),a=r(94978),l=r(56417),s=r(87262),p=r(54201);const d=l.z.cssVarList,u=(0,o.iY)("phone-input-box-field"),{host:c,label:h,inputElement:b,requiredIndicator:m,inputField:y,phoneInput:g,errorMessage:f,helperText:v}={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.qC)((0,a.yk)({mappings:{fontSize:[c,y,{selector:l.z.componentName,property:l.z.cssVarList.fontSize}],fontFamily:[h,f,v],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:{...f,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.z.componentName,property:d.valueInputMarginBottom}}}),a.e4,(0,a.dj)({proxyProps:["value","selectionStart"]}),(e=>class extends e{static get CountryCodes(){return s.Z}init(){super.init?.();const e=document.createElement("template");e.innerHTML=`\n\t\t\t\t<${n.f}\n\t\t\t\t\ttabindex="-1"\n\t\t\t\t\tslot="input"\n\t\t\t\t></${n.f}>\n `,this.baseElement.appendChild(e.content.cloneNode(!0)),this.inputElement=this.shadowRoot.querySelector(n.f),(0,o.oP)(this.shadowRoot.host,this.inputElement,{includeAttrs:["size","bordered","invalid","minlength","maxlength","default-code","disabled","phone-input-placeholder","label","label-type"]})}}))((0,a.DM)({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.bi)(x.cssVarList)}\n ${(0,p.Pd)("vaadin-text-field")}\n ${(0,p.B)("vaadin-text-field")}\n ${(0,p.DY)()}\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.Wf)("vaadin-text-field")}\n ${(0,p.bz)()}\n\t\t`,excludeAttrsSync:["tabindex"],componentName:u}));customElements.define(u,x)},16418:(e,t,r)=>{r.d(t,{g:()=>o});var n=r(87262);const o=e=>n.Z.find((t=>t.code===e))?.dialCode}}]);
1
+ "use strict";(self.webpackChunk_descope_web_components_ui=self.webpackChunk_descope_web_components_ui||[]).push([[5119],{84049:(e,t,r)=>{r.d(t,{H:()=>f,f:()=>l});var o=r(2061),n=r(54567),i=r(54201),a=r(94978);const l=(0,n.iY)("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)"}},f=(0,o.qC)((0,a.yk)({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:()=>f.cssVarList.overlay.backgroundColor},overlayTextColor:{property:()=>f.cssVarList.overlay.textColor},overlayBorder:{property:()=>f.cssVarList.overlay.border},overlayFontSize:{property:()=>f.cssVarList.overlay.fontSize},overlayFontFamily:{property:()=>f.cssVarList.overlay.fontFamily},overlayCursor:{property:()=>f.cssVarList.overlay.cursor},overlayItemBoxShadow:{property:()=>f.cssVarList.overlay.itemBoxShadow},overlayItemPaddingInlineStart:{property:()=>f.cssVarList.overlay.itemPaddingInlineStart},overlayItemPaddingInlineEnd:{property:()=>f.cssVarList.overlay.itemPaddingInlineEnd}}}),a.e4,(0,a.Iw)({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.dj)({proxyProps:["selectionStart"],inputEvent:"selected-item-changed"}),a.Ae,(e=>class extends e{static get observedAttributes(){return["label-type"]}#e=({displayName:e,value:t,label:r})=>`<span data-name="${r}" data-id="${t}">${e||r}</span>`;#t;get defaultValue(){return this.getAttribute("default-value")}get renderItem(){return this.#e}set renderItem(e){this.#e=e,this.renderItems()}get data(){if(this.#t)return this.#t;const e=this.getAttribute("data");if(e)try{const t=JSON.parse(e);if(this.isValidDataType(t))return t}catch(e){console.error('could not parse data string from attribute "data" -',e.message)}return[]}set data(e){this.isValidDataType(e)&&(this.#t=e,this.renderItems())}isValidDataType(e){const t=Array.isArray(e);return t||console.error("data must be an array, received:",e),t}getItemsTemplate(){return this.data?.reduce?.(((e,t)=>e+(this.renderItem?.(t||{})||"")),"")}renderItems(){const e=this.getItemsTemplate();e&&(this.innerHTML=e)}handleSelectedItem(){const e=this.baseElement.selectedItem?.["data-id"];this.baseElement.selectedItem=void 0,e&&(this.value=e),this.value||this.setDefaultValue()}customValueTransformFn(e){return e}setComboBoxDescriptor(){const e=Object.getOwnPropertyDescriptor(this.inputElement.constructor.prototype,"value"),t=this;Object.defineProperties(this.inputElement,{value:{...e,set(r){if(!t.baseElement.items?.length)return;const o=t.customValueTransformFn(r)||"";o!==this.value&&e.set.call(this,o)}}})}#r(){const e=this.shadowRoot.querySelector(this.baseSelector),t=Array.from(this.children);t.length&&(t.forEach((e=>{Object.defineProperty(e,"data-name",{value:e.getAttribute("data-name"),configurable:!0,writable:!0}),Object.defineProperty(e,"data-id",{value:e.getAttribute("data-id"),configurable:!0,writable:!0})})),e.items=t,setTimeout((()=>{this.handleSelectedItem()}),0)),e.renderer=(e,t,r)=>{e.innerHTML=r.item.outerHTML}}#o(){const e=this.baseElement.shadowRoot.querySelector("vaadin-combo-box-overlay");e._attachOverlay=()=>{e.bringToFront()},e._detachOverlay=()=>{},e._enterModalState=()=>{}}init(){super.init?.(),this.getValidity=function(){return!this.value&&this.isRequired?{valueMissing:!0}:{}},this.setComboBoxDescriptor(),this.#o(),this.renderItems(),(0,n.FX)(this,this.renderItems.bind(this),{includeAttrs:["data"]}),(0,n.P$)(this,this.#r.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(e,t,r){super.attributeChangedCallback?.(e,t,r),t!==r&&"label-type"===e&&("floating"===r?this.addEventListener("click",this.onLabelClick):this.removeEventListener("click",this.onLabelClick))}setDefaultValue(){this.value=this.defaultValue}set value(e){if(e){const t=this.baseElement.items?.find((t=>t["data-id"]===e));t&&(this.baseElement.selectedItem=t)}else this.baseElement.selectedItem=void 0}get value(){return this.baseElement.selectedItem?.["data-id"]||""}}))((0,a.DM)({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.bi)(f.cssVarList)}\n\t\t${(0,i.PH)("vaadin-combo-box")}\n\t\t${(0,i.jI)("vaadin-combo-box")}\n\t\t${(0,i.Pd)("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.Wf)("vaadin-combo-box")}\n ${(0,i.bz)()}\n\t\t`,excludeAttrsSync:["tabindex","size","data"],componentName:l,includeForwardProps:["items","renderer","selectedItem"]}))},21294:(e,t,r)=>{r.r(t),r.d(t,{ComboBoxClass:()=>o.H}),r(47583);var o=r(84049);customElements.define(o.f,o.H)},41377:(e,t,r)=>{r.d(t,{Z:()=>d,f:()=>a});var o=r(73878),n=r(54567),i=r(16418);const a=(0,n.iY)("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,o.P)({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.g)(this.getAttribute("default-code"))}get hasDefaultCode(){return!!this.getAttribute("default-code")}get value(){if(!this.phoneNumberValue)return"";if(this.hasDefaultCode){const e=new RegExp(`\\+?${parseInt(this.defaultCountryCode,10)}--?`);return`${this.defaultCountryCode}-${this.phoneNumberInput.value.replace(e,"")}`}return this.phoneNumberInput.value}set value(e){this.phoneNumberInput.value=e}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 e=this.value.replace(/\D/g,"");return this.isRequired&&!this.value?{valueMissing:!0}:e.length<this.minLength?{tooShort:!0}:e.length>this.maxLength?{tooLong:!0}:/^\+?\d{1,4}-?(?:\d-?){1,15}$/.test(this.value)?{}:{patternMismatch:!0}}init(){this.addEventListener("focus",(e=>{e.isTrusted&&this.phoneNumberInput.focus()})),super.init?.(),this.initInputs()}getCountryByDialCode(e){return this.countryCodeInput.items?.find((t=>t.getAttribute("data-country-code")===e))}initInputs(){this.phoneNumberInput.addEventListener("input",(e=>{1===e.target.value.length&&"-"===e.target.value&&(e.target.value=""),e.target.value=e.target.value.replace(/(?!^)\+/g,"").replace("--","-").replace("+-","+");const t=/^[+\d-]+$/,r=e.target.value.split("").filter((e=>t.test(e))).join("");e.target.value=r})),this.handleFocusEventsDispatching([this.phoneNumberInput]),this.handleInputEventDispatching()}attributeChangedCallback(e,t,r){if(super.attributeChangedCallback(e,t,r),t!==r&&l.includes(e)){const t=s[e]||e;this.phoneNumberInput.setAttribute(t,r)}}}},83067:(e,t,r)=>{r.r(t),r(19357);var o=r(41377);customElements.define(o.f,o.Z)},69423:(e,t,r)=>{r.r(t),r.d(t,{PhoneFieldInputBoxClass:()=>x}),r(83067),r(21294),r(19357);var o=r(41377),n=r(54567),i=r(2061),a=r(94978),l=r(56417),s=r(87262),p=r(54201);const d=l.z.cssVarList,u=(0,n.iY)("phone-input-box-field"),{host:c,label:h,inputElement:b,requiredIndicator:m,inputField:y,phoneInput:g,errorMessage:f,helperText:v}={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.qC)((0,a.yk)({mappings:{fontSize:[c,y,{selector:l.z.componentName,property:l.z.cssVarList.fontSize}],fontFamily:[h,f,v],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:{...f,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.z.componentName,property:d.valueInputMarginBottom}}}),a.e4,(0,a.dj)({proxyProps:["value","selectionStart"]}),(e=>class extends e{static get CountryCodes(){return s.Z}init(){super.init?.();const e=document.createElement("template");e.innerHTML=`\n\t\t\t\t<${o.f}\n\t\t\t\t\ttabindex="-1"\n\t\t\t\t\tslot="input"\n\t\t\t\t></${o.f}>\n `,this.baseElement.appendChild(e.content.cloneNode(!0)),this.inputElement=this.shadowRoot.querySelector(o.f),(0,n.oP)(this.shadowRoot.host,this.inputElement,{includeAttrs:["size","bordered","invalid","minlength","maxlength","default-code","disabled","phone-input-placeholder","label","label-type"]})}}))((0,a.DM)({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.bi)(x.cssVarList)}\n ${(0,p.Pd)("vaadin-text-field")}\n ${(0,p.B)("vaadin-text-field")}\n ${(0,p.DY)()}\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.Wf)("vaadin-text-field")}\n ${(0,p.bz)()}\n\t\t`,excludeAttrsSync:["tabindex"],componentName:u}));customElements.define(u,x)},16418:(e,t,r)=>{r.d(t,{g:()=>n});var o=r(87262);const n=e=>o.Z.find((t=>t.code===e))?.dialCode}}]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@descope/web-components-ui",
3
- "version": "1.0.334",
3
+ "version": "1.0.336",
4
4
  "description": "",
5
5
  "main": "dist/cjs/index.cjs.js",
6
6
  "module": "dist/index.esm.js",
@@ -7,18 +7,13 @@ import {
7
7
  } from '../../mixins';
8
8
  import textFieldMappings from '../descope-text-field/textFieldMappings';
9
9
  import { compose } from '../../helpers';
10
- import { getComponentName, syncAttrs } from '../../helpers/componentHelpers';
10
+ import { getComponentName } from '../../helpers/componentHelpers';
11
11
  import {
12
12
  inputFloatingLabelStyle,
13
13
  resetInputLabelPosition,
14
14
  resetInputOverrides,
15
15
  useHostExternalPadding,
16
16
  } from '../../helpers/themeHelpers/resetHelpers';
17
- import {
18
- applyExternalInputStyles,
19
- createExternalInputEle,
20
- createExternalInputSlot,
21
- } from '../../helpers/externalInputs';
22
17
 
23
18
  export const componentName = getComponentName('email-field');
24
19
 
@@ -29,103 +24,12 @@ const customMixin = (superclass) =>
29
24
 
30
25
  this.baseElement.setAttribute('pattern', '^[\\w\\.\\%\\+\\-]+@[\\w\\.\\-]+\\.[A-Za-z]{2,}$');
31
26
 
32
- if (!this.isNoExternalInput) {
33
- this.externalInput = this.handleExternalInput();
34
-
35
- this.addEventListener('focus', () => {
36
- this.externalInput.focus();
37
- });
38
- } else {
39
- this.setAttribute('autocomplete', this.getAutocompleteType());
40
- }
41
- }
42
-
43
- get isNoExternalInput() {
44
- return this.getAttribute('no-external-input') === 'true';
45
- }
46
-
47
- forwardInputValue(source, target) {
48
- // set internal sync events
49
- const valueDescriptor = Object.getOwnPropertyDescriptor(
50
- this.inputElement.constructor.prototype,
51
- 'value'
52
- );
53
-
54
- Object.defineProperty(source, 'value', {
55
- ...valueDescriptor,
56
-
57
- set(v) {
58
- valueDescriptor.set.call(this, v);
59
- // eslint-disable-next-line no-param-reassign
60
- target.value = v;
61
- },
62
- configurable: true,
63
- });
64
- }
65
-
66
- handleExternalInput() {
67
- // set safety attribute `external-input`
68
- this.setAttribute('external-input', 'true');
69
-
70
- // use original input element as reference
71
- const origInput = this.baseElement.querySelector('input');
72
-
73
- // to avoid focus loop between external-input and origInput
74
- // we set origInput's tabindex to -1
75
- // otherwise, shift-tab will never leave the component focus
76
- origInput.setAttribute('tabindex', '-1');
77
-
78
- // create external slot
79
- const externalInputSlot = createExternalInputSlot('external-input', 'suffix');
80
- // append external slot to base element
81
- this.baseElement.appendChild(externalInputSlot);
82
-
83
- const externalInput = createExternalInputEle(
84
- 'external-input',
85
- 'text',
86
- this.getAutocompleteType()
87
- );
88
-
89
- // apply original input's styles to external input
90
- setTimeout(() => {
91
- applyExternalInputStyles(origInput, externalInput, this.getAttribute('label-type'));
92
- });
93
-
94
- // set external input events
95
- this.handleExternalInputEvents(externalInput);
96
-
97
- // 1Password catches the internal input, so we forward the value to the external input
98
- this.forwardInputValue(origInput, externalInput);
99
-
100
- syncAttrs(origInput, externalInput, {
101
- includeAttrs: ['disabled', 'readonly', 'pattern'],
102
- });
103
-
104
- // append external input to component's DOM
105
- this.appendChild(externalInput);
106
-
107
- return externalInput;
27
+ this.setAttribute('autocomplete', this.getAutocompleteType());
108
28
  }
109
29
 
110
30
  getAutocompleteType() {
111
31
  return this.getAttribute('autocomplete') || 'username';
112
32
  }
113
-
114
- handleExternalInputEvents(externalInput) {
115
- // sync value of insible input back to original input
116
- externalInput.addEventListener('input', (e) => {
117
- this.value = e.target.value;
118
- });
119
-
120
- // sync `focused` attribute on host when focusing on external input
121
- externalInput.addEventListener('focus', () => {
122
- this.setAttribute('focused', 'true');
123
- });
124
-
125
- externalInput.addEventListener('blur', () => {
126
- this.removeAttribute('focused');
127
- });
128
- }
129
33
  };
130
34
 
131
35
  export const EmailFieldClass = compose(
@@ -133,7 +37,7 @@ export const EmailFieldClass = compose(
133
37
  mappings: textFieldMappings,
134
38
  }),
135
39
  draggableMixin,
136
- proxyInputMixin({ proxyProps: ['value', 'selectionStart'], useProxyTargets: true }),
40
+ proxyInputMixin({ proxyProps: ['value', 'selectionStart'] }),
137
41
  componentNameValidationMixin,
138
42
  customMixin
139
43
  )(
@@ -161,10 +65,6 @@ export const EmailFieldClass = compose(
161
65
  opacity: 0;
162
66
  }
163
67
 
164
- vaadin-email-field:not([no-external-input="true"]) > input:not(:placeholder-shown) {
165
- opacity: 0;
166
- }
167
-
168
68
  :host ::slotted(*) {
169
69
  -webkit-mask-image: none;
170
70
  }
@@ -26,20 +26,10 @@ const customMixin = (superclass) =>
26
26
  </${descopeInternalComponentName}>
27
27
  `;
28
28
 
29
- this.setAttribute('external-input', 'true');
30
-
31
29
  this.baseElement.appendChild(template.content.cloneNode(true));
32
30
 
33
31
  this.inputElement = this.shadowRoot.querySelector(descopeInternalComponentName);
34
32
 
35
- // get descope input components
36
- this.passwordInput = this.inputElement.querySelector('[data-id="password"]');
37
- this.confirmInput = this.inputElement.querySelector('[data-id="confirm"]');
38
-
39
- // create slots for external password input
40
- this.createExternalInput(this.passwordInput, 'external-password-input');
41
- this.createExternalInput(this.confirmInput, 'external-confirm-input');
42
-
43
33
  forwardAttrs(this, this.inputElement, {
44
34
  includeAttrs: [
45
35
  'password-label',
@@ -63,20 +53,6 @@ const customMixin = (superclass) =>
63
53
  ],
64
54
  });
65
55
  }
66
-
67
- createExternalInput(node, slotName) {
68
- const externalInput = node.querySelector('input');
69
- const slotEle = document.createElement('slot');
70
- const targetSlot = externalInput.getAttribute('slot');
71
- slotEle.setAttribute('name', slotName);
72
- slotEle.setAttribute('slot', targetSlot);
73
- node.appendChild(slotEle);
74
-
75
- // move external input
76
- externalInput.setAttribute('slot', slotName);
77
- externalInput.setAttribute('data-hidden-input', 'true');
78
- this.appendChild(externalInput);
79
- }
80
56
  };
81
57
 
82
58
  const {
@@ -6,7 +6,7 @@ import {
6
6
  componentNameValidationMixin,
7
7
  } from '../../mixins';
8
8
  import { compose } from '../../helpers';
9
- import { getComponentName, syncAttrs } from '../../helpers/componentHelpers';
9
+ import { getComponentName } from '../../helpers/componentHelpers';
10
10
  import passwordDraggableMixin from './passwordDraggableMixin';
11
11
  import {
12
12
  resetInputLabelPosition,
@@ -14,116 +14,11 @@ import {
14
14
  useHostExternalPadding,
15
15
  inputFloatingLabelStyle,
16
16
  } from '../../helpers/themeHelpers/resetHelpers';
17
- import {
18
- applyExternalInputStyles,
19
- createExternalInputEle,
20
- createExternalInputSlot,
21
- } from '../../helpers/externalInputs';
22
17
 
23
18
  export const componentName = getComponentName('password');
24
19
 
25
20
  const customMixin = (superclass) =>
26
21
  class PasswordFieldMixinClass extends superclass {
27
- init() {
28
- super.init?.();
29
-
30
- // reset vaadin's checkValidity
31
- this.baseElement.checkValidity = () => {};
32
- // set safety attribute `external-input`
33
- this.setAttribute('external-input', 'true');
34
-
35
- // use original input element as reference
36
- const origInput = this.baseElement.querySelector('input');
37
-
38
- // to avoid focus loop between external-input and origInput
39
- // we set origInput's tabindex to -1
40
- // otherwise, shift-tab will never leave the component focus
41
- origInput.setAttribute('tabindex', '-1');
42
-
43
- // create external slot
44
- const externalInputSlot = createExternalInputSlot('external-input', 'suffix');
45
- // append external slot to base element
46
- this.baseElement.appendChild(externalInputSlot);
47
-
48
- // create external input
49
- const externalInput = createExternalInputEle(
50
- 'external-input',
51
- 'password',
52
- this.getAutocompleteType()
53
- );
54
-
55
- this.handlePasswordVisibility(externalInput);
56
-
57
- // apply original input's styles to external input
58
- setTimeout(() => {
59
- applyExternalInputStyles(origInput, externalInput, this.getAttribute('label-type'));
60
- });
61
-
62
- // set external input events
63
- this.handleExternalInputEvents(externalInput);
64
-
65
- // sync input stateful attributes: `type` (for visibility state change) and `readonly`
66
- syncAttrs(origInput, externalInput, { includeAttrs: ['type', 'readonly'] });
67
- syncAttrs(this, externalInput, { includeAttrs: ['focused'] });
68
-
69
- origInput.addEventListener('focus', (e) => {
70
- e.preventDefault();
71
- if (e.isTrusted) {
72
- externalInput.focus();
73
- }
74
- });
75
-
76
- externalInput.addEventListener('input', (e) => {
77
- if (!e.target.value) {
78
- this.removeAttribute('has-value');
79
- } else {
80
- this.setAttribute('has-value', 'true');
81
- }
82
- });
83
-
84
- // append external input to component's DOM
85
- this.appendChild(externalInput);
86
- }
87
-
88
- // override vaadin's password visibility toggle.
89
- // we need this override in order to to resolve the external input `focus` race condition,
90
- // which is caused due to the focus sync between the two inputs.
91
- handlePasswordVisibility(externalInput) {
92
- // disable vaadin's `__boundRevealButtonMouseDown` mouse-down event lisetener
93
- const origBoundRevealButtonMouseDown = this.baseElement.__boundRevealButtonMouseDown;
94
- this.baseElement
95
- .querySelector('vaadin-password-field-button')
96
- .removeEventListener('mousedown', origBoundRevealButtonMouseDown);
97
-
98
- // disable vaadin's `_passwordVisibleChanged` observer
99
- this.baseElement._passwordVisibleChanged = () => {};
100
-
101
- // override vaadin's `_togglePasswordVisibility`
102
- this.baseElement._togglePasswordVisibility = () => {
103
- const currVisibility = externalInput.getAttribute('type');
104
- if (currVisibility === 'password') {
105
- this.showPasswordVisibility(externalInput);
106
- } else {
107
- this.hidePasswordVisibility(externalInput);
108
- }
109
- };
110
-
111
- // on component blur, if password is revealed - hide it
112
- // this behaves differently from vaadin's focus handling, and checks if the blur takes the component out of focus
113
- // (which menas the click was made outside the component) or if the blur was called due to clicking the Reveal Button
114
- // and then focusing in the input again
115
- this.addEventListener('blur', () => {
116
- setTimeout(() => {
117
- const isHiddenAndFocused =
118
- externalInput.getAttribute('type') !== 'password' &&
119
- externalInput.getAttribute('focused') !== 'true';
120
- if (isHiddenAndFocused) {
121
- this.hidePasswordVisibility(externalInput);
122
- }
123
- });
124
- });
125
- }
126
-
127
22
  hidePasswordVisibility(input) {
128
23
  // handle input element's type
129
24
  input.setAttribute('type', 'password');
@@ -141,22 +36,6 @@ const customMixin = (superclass) =>
141
36
  getAutocompleteType() {
142
37
  return this.getAttribute('autocomplete') || 'current-password';
143
38
  }
144
-
145
- handleExternalInputEvents(inputEle) {
146
- // sync value of insible input back to original input
147
- inputEle.addEventListener('input', (e) => {
148
- this.value = e.target.value;
149
- });
150
-
151
- // sync `focused` attribute on host when focusing on external input
152
- inputEle.addEventListener('focus', () => {
153
- this.setAttribute('focused', 'true');
154
- });
155
-
156
- inputEle.addEventListener('blur', () => {
157
- this.removeAttribute('focused');
158
- });
159
- }
160
39
  };
161
40
 
162
41
  const {
@@ -315,10 +194,6 @@ export const PasswordClass = compose(
315
194
  ::part(reveal-button) {
316
195
  align-self: center;
317
196
  }
318
-
319
- vaadin-password-field > input:not(:placeholder-shown) {
320
- opacity: 0;
321
- }
322
197
  `,
323
198
  excludeAttrsSync: ['tabindex'],
324
199
  componentName,
@@ -17,7 +17,7 @@ import {
17
17
 
18
18
  export const componentName = getComponentName('text-field');
19
19
 
20
- const observedAttrs = ['type', 'label-type'];
20
+ const observedAttrs = ['type', 'label-type', 'copy-to-clipboard'];
21
21
 
22
22
  const customMixin = (superclass) =>
23
23
  class TextFieldClass extends superclass {
@@ -25,6 +25,47 @@ const customMixin = (superclass) =>
25
25
  return observedAttrs.concat(superclass.observedAttributes || []);
26
26
  }
27
27
 
28
+ icon;
29
+
30
+ init() {
31
+ super.init?.();
32
+ }
33
+
34
+ renderCopyToClipboard(shouldRender) {
35
+ if (!shouldRender) {
36
+ this.icon?.remove();
37
+ return;
38
+ }
39
+
40
+ const iconInitConfig = {
41
+ icon: 'vaadin:copy-o',
42
+ title: 'Copy',
43
+ style: 'cursor: pointer',
44
+ };
45
+
46
+ const iconCopiedConfig = {
47
+ icon: 'vaadin:check-circle-o',
48
+ title: 'Copied',
49
+ style: 'cursor: initial',
50
+ };
51
+
52
+ this.icon = Object.assign(document.createElement('vaadin-icon'), {
53
+ slot: 'suffix',
54
+ ...iconInitConfig,
55
+ });
56
+
57
+ this.baseElement.appendChild(this.icon);
58
+ this.icon.addEventListener('click', () => {
59
+ navigator.clipboard.writeText(this.value);
60
+ Object.assign(this.icon, iconCopiedConfig);
61
+
62
+ // we want the icon to go back to the initial state after 5 seconds
63
+ setTimeout(() => {
64
+ Object.assign(this.icon, iconInitConfig);
65
+ }, 5000);
66
+ });
67
+ }
68
+
28
69
  onLabelClick() {
29
70
  this.focus();
30
71
  }
@@ -48,34 +89,11 @@ const customMixin = (superclass) =>
48
89
  } else {
49
90
  this.removeEventListener('click', this.onLabelClick);
50
91
  }
92
+ } else if (attrName === 'copy-to-clipboard') {
93
+ this.renderCopyToClipboard(newVal === 'true');
51
94
  }
52
95
  }
53
96
  }
54
-
55
- // webauthn is not working when the native input element is nested inside multiple shadow roots
56
- // so we need to be able move the input outside the shadow root for some cases
57
- get isExternalInput() {
58
- return this.getAttribute('external-input') === 'true';
59
- }
60
-
61
- constructor() {
62
- super();
63
-
64
- if (this.isExternalInput) {
65
- const origInput = this.baseElement.querySelector('input');
66
- this.inputSlot = document.createElement('slot');
67
-
68
- this.focus = () => {
69
- origInput.focus();
70
- };
71
-
72
- this.inputSlot.setAttribute('name', 'input');
73
- this.inputSlot.setAttribute('slot', 'input');
74
- this.baseElement.appendChild(this.inputSlot);
75
-
76
- this.appendChild(origInput);
77
- }
78
- }
79
97
  };
80
98
 
81
99
  export const TextFieldClass = compose(
@@ -83,7 +101,7 @@ export const TextFieldClass = compose(
83
101
  mappings: textFieldMappings,
84
102
  }),
85
103
  draggableMixin,
86
- proxyInputMixin({ proxyProps: ['value', 'selectionStart'], useProxyTargets: true }),
104
+ proxyInputMixin({ proxyProps: ['value', 'selectionStart'] }),
87
105
  componentNameValidationMixin,
88
106
  customMixin
89
107
  )(
@@ -105,14 +123,18 @@ export const TextFieldClass = compose(
105
123
 
106
124
  vaadin-text-field[label-type="floating"]:not([focused])[readonly] > input:placeholder-shown {
107
125
  opacity: 0;
108
- }
126
+ }
109
127
  vaadin-text-field[label-type="floating"]:not([focused])[disabled] > input:placeholder-shown {
110
128
  opacity: 0;
111
- }
129
+ }
112
130
  ${resetInputLabelPosition('vaadin-text-field')}
113
131
  ${useHostExternalPadding(TextFieldClass.cssVarList)}
114
132
  ${resetInputOverrides('vaadin-text-field', TextFieldClass.cssVarList)}
115
133
  ${inputFloatingLabelStyle()}
134
+
135
+ vaadin-text-field vaadin-icon {
136
+ align-self: center;
137
+ }
116
138
  `,
117
139
  excludeAttrsSync: ['tabindex'],
118
140
  componentName,
@@ -1,4 +1,6 @@
1
1
  import '@vaadin/text-field';
2
+ import '@vaadin/icon';
3
+
2
4
  import { componentName, TextFieldClass } from './TextFieldClass';
3
5
 
4
6
  customElements.define(componentName, TextFieldClass);