@momentum-ui/web-components 2.7.53 → 2.7.54
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.
package/dist/chunks/md-73.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(window["momentum-web-components-[id]"]=window["momentum-web-components-[id]"]||[]).push([[73],{119:function(t,e,o){"use strict";o.r(e),o.d(e,"PhoneInput",(function(){return i}));o(78),o(24);var i,n=o(5),r=o(4),a=o(79),l=o(80),d=o(63),p=o(0),s=o(2),
|
|
1
|
+
(window["momentum-web-components-[id]"]=window["momentum-web-components-[id]"]||[]).push([[73],{119:function(t,e,o){"use strict";o.r(e),o.d(e,"PhoneInput",(function(){return i}));o(78),o(24);var i,n=o(5),r=o(4),a=o(79),l=o(80),d=o(63),p=o(0),s=o(2),h=o(36),c=p.css`.md-phone-input__container{--combo-box-contaier-width:100px;display:flex;position:relative}.md-phone-input__container span.flag-box{align-items:center;border:1px solid var(--input-default-border-color,#ccc);border-bottom-left-radius:.25rem;border-right:none;border-top-left-radius:.25rem;display:flex;height:2.125rem;justify-content:center;position:relative;width:2.25rem}.md-phone-input__container span.flag-box .flag-svg-wrapper{justify-content:center}.md-phone-input__container .flag-svg-wrapper{align-items:center;display:flex;width:2rem}.md-phone-input__container .flag-svg-wrapper img{max-height:.7rem}.md-phone-input__container md-combobox{width:var(--combo-box-contaier-width)}.md-phone-input__container md-combobox::part(combobox){position:initial}.md-phone-input__container md-combobox::part(group){border-bottom-right-radius:0;border-right-width:0;border-top-right-radius:0}.md-phone-input__container md-combobox::part(multiwrap){overflow-x:hidden}.md-phone-input__container md-combobox::part(multiwrap-input){padding-left:0;padding-right:0;width:100%}.md-phone-input__container md-combobox::part(combobox-options){top:2.5rem}.md-phone-input__container md-combobox::part(label){width:100%}.md-phone-input__container md-input::part(input){border-bottom-left-radius:0;border-top-left-radius:0;padding-right:2.75rem}.md-phone-input__container md-input::part(message){margin-left:calc(var(--combo-box-contaier-width) * -1);width:calc(100% + var(--combo-box-contaier-width))}.md-phone-input__container .md-phone-input__option{align-items:center;display:flex;justify-content:start}.md-phone-input__container .md-phone-input__option :nth-child(3){margin-left:1rem}.md-phone-input__container md-input[disabled]::part(input){background:var(--phone-input-disabled-bg-color);border:1px solid var(--phone-input-default-border-color);color:var(--md-disabled-text-color)}.md-phone-input__container md-input[disabled]::part(input)::placeholder{border:none}`,u=function(t,e,o,i){var n,r=arguments.length,a=r<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,o):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,o,i);else for(var l=t.length-1;l>=0;l--)(n=t[l])&&(a=(r<3?n(a):r>3?n(e,o,a):n(e,o))||a);return r>3&&a&&Object.defineProperty(e,o,a),a};!function(t){let e=class extends p.LitElement{constructor(){super(...arguments),this.codePlaceholder="+1",this.numberPlaceholder="Enter Phone Number",this.countryCallingCode="",this.showFlags=!1,this.pill=!1,this.disabled=!1,this.value="",this.errorMessage="",this.showErrorMessage=!1,this.clearIconHeight="auto",this.countryCodeAriaLabel="",this.dialNumberAriaLabel="",this.countryCode="US",this.codeList=[],this.formattedValue="",this.isValid=!0}connectedCallback(){super.connectedCallback(),this.codeList=Object(a.customArray)({name:"{countryNameEn}",value:"{countryCallingCode}",code:"{countryCode}"}),this.validateInput(this.value)}getCountryFlag(t){return p.html`
|
|
2
2
|
<span class="flag-svg-wrapper">
|
|
3
3
|
<img src="${Object(l.findFlagUrlByIso2Code)(t)}" />
|
|
4
4
|
</span>
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
<span>${t.name}</span>
|
|
15
15
|
<span>+${t.value}</span>
|
|
16
16
|
</div>
|
|
17
|
-
`}validateNumber(){this.isValid=!this.value||Object(d.isValidNumberForRegion)(this.value,this.countryCode)}handleCountryChange(t){var e,o;t.detail.value&&(null===(e=t.detail.value)||void 0===e?void 0:e.id)?(this.countryCallingCode=t.detail.value.id,this.countryCode=null===(o=t.detail.value.id.split(",")[2])||void 0===o?void 0:o.trim()):(this.countryCode="US",this.countryCallingCode=""),this.validateNumber(),this.dispatchEvent(new CustomEvent("countrycode-change",{bubbles:!0,composed:!0,detail:{srcEvent:t,isValid:this.isValid}}))}handlePhoneChange(t){this.value=t.detail.value,t.stopPropagation(),this.dispatchEvent(new CustomEvent("phoneinput-change",{bubbles:!0,composed:!0,detail:{srcEvent:t,value:`${this.countryCallingCode}${this.value}`,isValid:this.isValid,phoneNumber:this.value}}))}handleKeydown(t){this.isValid=!0,t.stopPropagation(),this.dispatchEvent(new CustomEvent("phoneinput-keydown",{bubbles:!0,composed:!0,detail:{srcEvent:t,value:`${this.countryCallingCode}${this.value}`,isValid:this.isValid,phoneNumber:this.value}}))}handleBlur(t){this.validateInput(this.value),this.validateNumber(),t.stopPropagation(),this.dispatchEvent(new CustomEvent("phoneinput-blur",{bubbles:!0,composed:!0,detail:{srcEvent:t,value:`${this.countryCallingCode}${this.value}`,isValid:this.isValid,phoneNumber:this.value}}))}validateInput(t){this.formattedValue=new d.AsYouType(this.countryCode).input(t)}getFormatedCountryCallingCode(){var t;return{id:this.countryCallingCode,value:null===(t=this.countryCallingCode.split(",")[0])||void 0===t?void 0:t.trim()}}getModStyle(){return p.html`
|
|
17
|
+
`}validateNumber(){this.isValid=!this.value||Object(d.isValidNumberForRegion)(this.value,this.countryCode)}handleCountryChange(t){var e,o;t.detail.value&&(null===(e=t.detail.value)||void 0===e?void 0:e.id)?(this.countryCallingCode=t.detail.value.id,this.countryCode=null===(o=t.detail.value.id.split(",")[2])||void 0===o?void 0:o.trim()):(this.countryCode="US",this.countryCallingCode=""),this.validateNumber(),this.dispatchEvent(new CustomEvent("countrycode-change",{bubbles:!0,composed:!0,detail:{srcEvent:t,isValid:this.isValid}}))}handlePhoneChange(t){this.value=t.detail.value,t.stopPropagation(),this.dispatchEvent(new CustomEvent("phoneinput-change",{bubbles:!0,composed:!0,detail:{srcEvent:t,value:`${this.countryCallingCode}${this.value}`,isValid:this.isValid,phoneNumber:this.value}}))}handleKeydown(t){this.isValid=!0,t.stopPropagation(),this.dispatchEvent(new CustomEvent("phoneinput-keydown",{bubbles:!0,composed:!0,detail:{srcEvent:t,value:`${this.countryCallingCode}${this.value}`,isValid:this.isValid,phoneNumber:this.value}}))}handleBlur(t){this.validateInput(this.value),this.validateNumber(),t.stopPropagation(),this.removeCountryCode(),this.dispatchEvent(new CustomEvent("phoneinput-blur",{bubbles:!0,composed:!0,detail:{srcEvent:t,value:`${this.countryCallingCode}${this.value}`,isValid:this.isValid,phoneNumber:this.value}}))}removeCountryCode(){var t;const e=null===(t=this.countryCallingCode.split(",")[0])||void 0===t?void 0:t.trim();if(this.value.startsWith(e)){const t=this.value.slice(e.length).replace(/^-/,"");this.value=t.trim()}}validateInput(t){this.formattedValue=new d.AsYouType(this.countryCode).input(t)}getFormatedCountryCallingCode(){var t;return{id:this.countryCallingCode,value:null===(t=this.countryCallingCode.split(",")[0])||void 0===t?void 0:t.trim()}}getModStyle(){return p.html`
|
|
18
18
|
<style>
|
|
19
19
|
.md-phone-input__container md-combobox {
|
|
20
20
|
width: 5.625rem;
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
padding-left: 0;
|
|
28
28
|
}
|
|
29
29
|
</style>
|
|
30
|
-
`}static get styles(){return[r.a,
|
|
30
|
+
`}static get styles(){return[r.a,c]}render(){return p.html`
|
|
31
31
|
${this.showFlags?this.getModStyle():s.nothing}
|
|
32
32
|
<div class="md-phone-input__container">
|
|
33
33
|
${this.showFlags?p.html`
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
clear-icon-height="${this.clearIconHeight}"
|
|
45
45
|
with-custom-content
|
|
46
46
|
>
|
|
47
|
-
${Object(
|
|
47
|
+
${Object(h.repeat)(this.codeList,t=>t.name,(t,e)=>this.countryCodeOptionTemplate(t,e))}
|
|
48
48
|
</md-combobox>
|
|
49
49
|
<md-input
|
|
50
50
|
part="md-input"
|
|
@@ -47,6 +47,7 @@ export declare namespace PhoneInput {
|
|
|
47
47
|
handlePhoneChange(event: CustomEvent): void;
|
|
48
48
|
handleKeydown(event: Event): void;
|
|
49
49
|
handleBlur(event: Event): void;
|
|
50
|
+
removeCountryCode(): void;
|
|
50
51
|
validateInput(input: string): void;
|
|
51
52
|
getFormatedCountryCallingCode(): {
|
|
52
53
|
id: string;
|