@descope/web-components-ui 1.43.0 → 1.45.0
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/cjs/index.cjs.js +124 -55
 - package/dist/cjs/index.cjs.js.map +1 -1
 - package/dist/index.esm.js +530 -256
 - package/dist/index.esm.js.map +1 -1
 - package/dist/umd/3620.js +1 -1
 - package/dist/umd/3620.js.map +1 -1
 - package/dist/umd/5348.js +2 -0
 - package/dist/umd/5348.js.map +1 -0
 - package/dist/umd/6477.js +149 -0
 - package/dist/umd/6477.js.map +1 -0
 - package/dist/umd/9365.js +1 -1
 - package/dist/umd/9365.js.map +1 -1
 - package/dist/umd/DescopeDev.js +1 -1
 - package/dist/umd/DescopeDev.js.map +1 -1
 - package/dist/umd/descope-hybrid-field-index-js.js +3 -3
 - package/dist/umd/descope-hybrid-field-index-js.js.map +1 -1
 - package/dist/umd/descope-passcode-index-js.js +1 -1
 - package/dist/umd/descope-passcode-index-js.js.map +1 -1
 - package/dist/umd/descope-timer-button.js +1 -1
 - package/dist/umd/descope-timer-button.js.map +1 -1
 - package/dist/umd/descope-timer.js +1 -1
 - package/dist/umd/descope-timer.js.map +1 -1
 - package/dist/umd/index.js +1 -1
 - package/dist/umd/index.js.map +1 -1
 - package/dist/umd/phone-fields-descope-phone-field-descope-phone-field-internal-index-js.js +1 -1
 - package/dist/umd/phone-fields-descope-phone-field-descope-phone-field-internal-index-js.js.map +1 -1
 - package/dist/umd/phone-fields-descope-phone-field-index-js.js +1 -1
 - package/dist/umd/phone-fields-descope-phone-field-index-js.js.map +1 -1
 - package/dist/umd/phone-fields-descope-phone-input-box-field-descope-phone-input-box-internal-index-js.js +2 -2
 - package/dist/umd/phone-fields-descope-phone-input-box-field-descope-phone-input-box-internal-index-js.js.map +1 -1
 - package/dist/umd/phone-fields-descope-phone-input-box-field-index-js.js +2 -113
 - package/dist/umd/phone-fields-descope-phone-input-box-field-index-js.js.LICENSE.txt +0 -6
 - package/dist/umd/phone-fields-descope-phone-input-box-field-index-js.js.map +1 -1
 - package/package.json +7 -6
 - package/src/components/descope-hybrid-field/HybridFieldClass.js +6 -0
 - package/src/components/descope-passcode/PasscodeClass.js +2 -0
 - package/src/components/phone-fields/descope-phone-field/PhoneFieldClass.js +10 -2
 - package/src/components/phone-fields/descope-phone-field/descope-phone-field-internal/PhoneFieldInternal.js +229 -125
 - package/src/components/phone-fields/descope-phone-input-box-field/PhoneFieldInputBoxClass.js +42 -24
 - package/src/components/phone-fields/descope-phone-input-box-field/descope-phone-input-box-internal/PhoneFieldInternalInputBox.js +176 -79
 - package/src/components/phone-fields/descope-phone-input-box-field/index.js +0 -1
 - package/src/components/phone-fields/helpers.js +7 -0
 - package/src/mixins/index.js +1 -0
 - package/src/mixins/inputOverrideValidConstraints.js +12 -0
 - package/dist/umd/6424.js +0 -149
 - package/dist/umd/6424.js.map +0 -1
 - /package/dist/umd/{6424.js.LICENSE.txt → 6477.js.LICENSE.txt} +0 -0
 
| 
         @@ -2,10 +2,11 @@ import { createBaseInputClass } from '../../../../baseClasses/createBaseInputCla 
     | 
|
| 
       2 
2 
     | 
    
         
             
            import { forwardAttrs, getComponentName } from '../../../../helpers/componentHelpers';
         
     | 
| 
       3 
3 
     | 
    
         
             
            import CountryCodes from '../../CountryCodes';
         
     | 
| 
       4 
4 
     | 
    
         
             
            import { comboBoxItem, parsePhoneNumber } from '../helpers';
         
     | 
| 
      
 5 
     | 
    
         
            +
            import { AsYouType, parsePhoneNumberFromString } from 'libphonenumber-js/min';
         
     | 
| 
       5 
6 
     | 
    
         | 
| 
       6 
7 
     | 
    
         
             
            export const componentName = getComponentName('phone-field-internal');
         
     | 
| 
       7 
8 
     | 
    
         | 
| 
       8 
     | 
    
         
            -
            const commonAttrs = ['disabled', 'size', 'bordered', 'readonly' 
     | 
| 
      
 9 
     | 
    
         
            +
            const commonAttrs = ['disabled', 'size', 'bordered', 'readonly'];
         
     | 
| 
       9 
10 
     | 
    
         
             
            const countryAttrs = ['country-input-placeholder', 'default-code', 'restrict-countries'];
         
     | 
| 
       10 
11 
     | 
    
         
             
            const phoneAttrs = ['phone-input-placeholder', 'maxlength', 'autocomplete', 'name'];
         
     | 
| 
       11 
12 
     | 
    
         
             
            const labelTypeAttrs = ['label-type', 'country-input-label', 'label'];
         
     | 
| 
         @@ -24,6 +25,8 @@ class PhoneFieldInternal extends BaseInputClass { 
     | 
|
| 
       24 
25 
     | 
    
         
             
                return [].concat(BaseInputClass.observedAttributes || [], inputRelatedAttrs);
         
     | 
| 
       25 
26 
     | 
    
         
             
              }
         
     | 
| 
       26 
27 
     | 
    
         | 
| 
      
 28 
     | 
    
         
            +
              #ayt;
         
     | 
| 
      
 29 
     | 
    
         
            +
             
     | 
| 
       27 
30 
     | 
    
         
             
              constructor() {
         
     | 
| 
       28 
31 
     | 
    
         
             
                super();
         
     | 
| 
       29 
32 
     | 
    
         | 
| 
         @@ -40,200 +43,329 @@ class PhoneFieldInternal extends BaseInputClass { 
     | 
|
| 
       40 
43 
     | 
    
         
             
                </div>
         
     | 
| 
       41 
44 
     | 
    
         
             
                `;
         
     | 
| 
       42 
45 
     | 
    
         | 
| 
       43 
     | 
    
         
            -
                this. 
     | 
| 
       44 
     | 
    
         
            -
                this. 
     | 
| 
       45 
     | 
    
         
            -
             
     | 
| 
      
 46 
     | 
    
         
            +
                this.comboBox = this.querySelector('descope-combo-box');
         
     | 
| 
      
 47 
     | 
    
         
            +
                this.textField = this.querySelector('descope-text-field');
         
     | 
| 
      
 48 
     | 
    
         
            +
             
     | 
| 
      
 49 
     | 
    
         
            +
                this.inputs = [this.comboBox, this.textField];
         
     | 
| 
       46 
50 
     | 
    
         | 
| 
       47 
     | 
    
         
            -
                forwardAttrs(this, this. 
     | 
| 
       48 
     | 
    
         
            -
                forwardAttrs(this, this. 
     | 
| 
      
 51 
     | 
    
         
            +
                forwardAttrs(this, this.comboBox, { includeAttrs: ['label-type'] });
         
     | 
| 
      
 52 
     | 
    
         
            +
                forwardAttrs(this, this.textField, { includeAttrs: ['label-type', 'required'] });
         
     | 
| 
       49 
53 
     | 
    
         | 
| 
       50 
54 
     | 
    
         
             
                // override combo box setter to display dialCode value in input
         
     | 
| 
       51 
     | 
    
         
            -
                this. 
     | 
| 
      
 55 
     | 
    
         
            +
                this.comboBox.customValueTransformFn = (val) => {
         
     | 
| 
       52 
56 
     | 
    
         
             
                  const [, dialCode] = val?.split?.(' ') || [];
         
     | 
| 
       53 
57 
     | 
    
         
             
                  return dialCode;
         
     | 
| 
       54 
58 
     | 
    
         
             
                };
         
     | 
| 
       55 
59 
     | 
    
         
             
              }
         
     | 
| 
       56 
60 
     | 
    
         | 
| 
      
 61 
     | 
    
         
            +
              // exposed from main component
         
     | 
| 
       57 
62 
     | 
    
         
             
              get countryCodeInputData() {
         
     | 
| 
       58 
     | 
    
         
            -
                return this. 
     | 
| 
      
 63 
     | 
    
         
            +
                return this.comboBox.items;
         
     | 
| 
      
 64 
     | 
    
         
            +
              }
         
     | 
| 
      
 65 
     | 
    
         
            +
             
     | 
| 
      
 66 
     | 
    
         
            +
              // exposed from main component
         
     | 
| 
      
 67 
     | 
    
         
            +
              get countryCodeValue() {
         
     | 
| 
      
 68 
     | 
    
         
            +
                return this.comboBox.shadowRoot.querySelector('input').value;
         
     | 
| 
      
 69 
     | 
    
         
            +
              }
         
     | 
| 
      
 70 
     | 
    
         
            +
             
     | 
| 
      
 71 
     | 
    
         
            +
              // exposed from main component
         
     | 
| 
      
 72 
     | 
    
         
            +
              get phoneNumberInputEle() {
         
     | 
| 
      
 73 
     | 
    
         
            +
                return this.textField.shadowRoot.querySelector('input');
         
     | 
| 
       59 
74 
     | 
    
         
             
              }
         
     | 
| 
       60 
75 
     | 
    
         | 
| 
       61 
76 
     | 
    
         
             
              get allowAlphanumericInput() {
         
     | 
| 
       62 
77 
     | 
    
         
             
                return this.getAttribute('allow-alphanumeric-input') === 'true';
         
     | 
| 
       63 
78 
     | 
    
         
             
              }
         
     | 
| 
       64 
79 
     | 
    
         | 
| 
       65 
     | 
    
         
            -
              get  
     | 
| 
       66 
     | 
    
         
            -
                 
     | 
| 
       67 
     | 
    
         
            -
                  return '';
         
     | 
| 
       68 
     | 
    
         
            -
                }
         
     | 
| 
       69 
     | 
    
         
            -
                return `${this.countryCodeInput.value}-${this.phoneNumberInput.value}`;
         
     | 
| 
      
 80 
     | 
    
         
            +
              get defaultCode() {
         
     | 
| 
      
 81 
     | 
    
         
            +
                return this.getAttribute('default-code');
         
     | 
| 
       70 
82 
     | 
    
         
             
              }
         
     | 
| 
       71 
83 
     | 
    
         | 
| 
       72 
     | 
    
         
            -
               
     | 
| 
       73 
     | 
    
         
            -
                 
     | 
| 
      
 84 
     | 
    
         
            +
              get selectionStart() {
         
     | 
| 
      
 85 
     | 
    
         
            +
                return this.textField.selectionStart;
         
     | 
| 
      
 86 
     | 
    
         
            +
              }
         
     | 
| 
       74 
87 
     | 
    
         | 
| 
       75 
     | 
    
         
            -
             
     | 
| 
       76 
     | 
    
         
            -
                this 
     | 
| 
      
 88 
     | 
    
         
            +
              get minLength() {
         
     | 
| 
      
 89 
     | 
    
         
            +
                return parseInt(this.getAttribute('minlength'), 10) || 0;
         
     | 
| 
       77 
90 
     | 
    
         
             
              }
         
     | 
| 
       78 
91 
     | 
    
         | 
| 
       79 
     | 
    
         
            -
               
     | 
| 
       80 
     | 
    
         
            -
                this. 
     | 
| 
      
 92 
     | 
    
         
            +
              get selectedCountryCode() {
         
     | 
| 
      
 93 
     | 
    
         
            +
                return this.comboBox?.selectedItem?.getAttribute('data-country-code');
         
     | 
| 
       81 
94 
     | 
    
         
             
              }
         
     | 
| 
       82 
95 
     | 
    
         | 
| 
       83 
     | 
    
         
            -
              get  
     | 
| 
       84 
     | 
    
         
            -
                 
     | 
| 
      
 96 
     | 
    
         
            +
              get restrictCountries() {
         
     | 
| 
      
 97 
     | 
    
         
            +
                const attr = this.getAttribute('restrict-countries');
         
     | 
| 
      
 98 
     | 
    
         
            +
                return attr?.split(',').filter(Boolean) || [];
         
     | 
| 
       85 
99 
     | 
    
         
             
              }
         
     | 
| 
       86 
100 
     | 
    
         | 
| 
       87 
     | 
    
         
            -
               
     | 
| 
       88 
     | 
    
         
            -
                 
     | 
| 
       89 
     | 
    
         
            -
             
     | 
| 
       90 
     | 
    
         
            -
             
     | 
| 
       91 
     | 
    
         
            -
             
     | 
| 
       92 
     | 
    
         
            -
             
     | 
| 
       93 
     | 
    
         
            -
                 
     | 
| 
       94 
     | 
    
         
            -
                  this.countryCodeInput.selectedItem = undefined;
         
     | 
| 
       95 
     | 
    
         
            -
                }
         
     | 
| 
      
 101 
     | 
    
         
            +
              get isFormatValue() {
         
     | 
| 
      
 102 
     | 
    
         
            +
                return this.getAttribute('format-value') === 'true';
         
     | 
| 
      
 103 
     | 
    
         
            +
              }
         
     | 
| 
      
 104 
     | 
    
         
            +
             
     | 
| 
      
 105 
     | 
    
         
            +
              // `strict validation` enforces value parsing with libphonenumber-js
         
     | 
| 
      
 106 
     | 
    
         
            +
              get isStrictValidation() {
         
     | 
| 
      
 107 
     | 
    
         
            +
                return this.getAttribute('strict-validation') === 'true';
         
     | 
| 
       96 
108 
     | 
    
         
             
              }
         
     | 
| 
       97 
109 
     | 
    
         | 
| 
       98 
     | 
    
         
            -
               
     | 
| 
       99 
     | 
    
         
            -
                if (this. 
     | 
| 
       100 
     | 
    
         
            -
                  return;
         
     | 
| 
      
 110 
     | 
    
         
            +
              get value() {
         
     | 
| 
      
 111 
     | 
    
         
            +
                if (!this.comboBox.value || !this.textField.value) {
         
     | 
| 
      
 112 
     | 
    
         
            +
                  return '';
         
     | 
| 
       101 
113 
     | 
    
         
             
                }
         
     | 
| 
       102 
114 
     | 
    
         | 
| 
       103 
     | 
    
         
            -
                 
     | 
| 
       104 
     | 
    
         
            -
             
     | 
| 
      
 115 
     | 
    
         
            +
                const [countryCode, phoneNumber] = parsePhoneNumber(
         
     | 
| 
      
 116 
     | 
    
         
            +
                  `${this.comboBox.value}-${this.textField.value}`
         
     | 
| 
      
 117 
     | 
    
         
            +
                );
         
     | 
| 
       105 
118 
     | 
    
         | 
| 
       106 
     | 
    
         
            -
             
     | 
| 
       107 
     | 
    
         
            -
                return this.phoneNumberInput.value;
         
     | 
| 
      
 119 
     | 
    
         
            +
                return `${countryCode || this.comboBox.value}-${phoneNumber || this.textField.value}`;
         
     | 
| 
       108 
120 
     | 
    
         
             
              }
         
     | 
| 
       109 
121 
     | 
    
         | 
| 
       110 
     | 
    
         
            -
               
     | 
| 
       111 
     | 
    
         
            -
                 
     | 
| 
       112 
     | 
    
         
            -
              }
         
     | 
| 
      
 122 
     | 
    
         
            +
              set value(val) {
         
     | 
| 
      
 123 
     | 
    
         
            +
                const [countryCode, nationalNumber] = parsePhoneNumber(val);
         
     | 
| 
       113 
124 
     | 
    
         | 
| 
       114 
     | 
    
         
            -
             
     | 
| 
       115 
     | 
    
         
            -
                 
     | 
| 
      
 125 
     | 
    
         
            +
                this.#setCountryCode(countryCode);
         
     | 
| 
      
 126 
     | 
    
         
            +
                this.#setNationalNumber(nationalNumber);
         
     | 
| 
       116 
127 
     | 
    
         
             
              }
         
     | 
| 
       117 
128 
     | 
    
         | 
| 
       118 
     | 
    
         
            -
               
     | 
| 
       119 
     | 
    
         
            -
                 
     | 
| 
      
 129 
     | 
    
         
            +
              init() {
         
     | 
| 
      
 130 
     | 
    
         
            +
                this.addEventListener('focus', (e) => {
         
     | 
| 
      
 131 
     | 
    
         
            +
                  // we want to ignore focus events we are dispatching
         
     | 
| 
      
 132 
     | 
    
         
            +
                  if (e.isTrusted) this.inputs[1].focus();
         
     | 
| 
      
 133 
     | 
    
         
            +
                });
         
     | 
| 
      
 134 
     | 
    
         
            +
             
     | 
| 
      
 135 
     | 
    
         
            +
                super.init?.();
         
     | 
| 
      
 136 
     | 
    
         
            +
             
     | 
| 
      
 137 
     | 
    
         
            +
                this.#initInputs();
         
     | 
| 
       120 
138 
     | 
    
         
             
              }
         
     | 
| 
       121 
139 
     | 
    
         | 
| 
       122 
140 
     | 
    
         
             
              getValidity() {
         
     | 
| 
       123 
     | 
    
         
            -
                const  
     | 
| 
       124 
     | 
    
         
            -
                const  
     | 
| 
       125 
     | 
    
         
            -
                const emptyValue = !hasCode || !hasPhone;
         
     | 
| 
       126 
     | 
    
         
            -
                const hasMinPhoneLength =
         
     | 
| 
       127 
     | 
    
         
            -
                  this.phoneNumberInput.value?.length && this.phoneNumberInput.value.length < this.minLength;
         
     | 
| 
      
 141 
     | 
    
         
            +
                const countryCode = this.comboBox.value;
         
     | 
| 
      
 142 
     | 
    
         
            +
                const nationalNumer = this.textField.value;
         
     | 
| 
       128 
143 
     | 
    
         | 
| 
       129 
     | 
    
         
            -
                 
     | 
| 
      
 144 
     | 
    
         
            +
                const hasCountryCode = !!countryCode.length;
         
     | 
| 
      
 145 
     | 
    
         
            +
                const hasNationalNumber = !!nationalNumer.length;
         
     | 
| 
      
 146 
     | 
    
         
            +
             
     | 
| 
      
 147 
     | 
    
         
            +
                const isEmpty = !hasCountryCode || !hasNationalNumber;
         
     | 
| 
      
 148 
     | 
    
         
            +
                const isValidLength = hasNationalNumber && nationalNumer.length >= this.minLength;
         
     | 
| 
      
 149 
     | 
    
         
            +
             
     | 
| 
      
 150 
     | 
    
         
            +
                if (this.isRequired && isEmpty) {
         
     | 
| 
       130 
151 
     | 
    
         
             
                  return { valueMissing: true };
         
     | 
| 
       131 
152 
     | 
    
         
             
                }
         
     | 
| 
       132 
     | 
    
         
            -
             
     | 
| 
      
 153 
     | 
    
         
            +
             
     | 
| 
      
 154 
     | 
    
         
            +
                if (!isValidLength) {
         
     | 
| 
       133 
155 
     | 
    
         
             
                  return { tooShort: true };
         
     | 
| 
       134 
156 
     | 
    
         
             
                }
         
     | 
| 
       135 
     | 
    
         
            -
             
     | 
| 
       136 
     | 
    
         
            -
             
     | 
| 
      
 157 
     | 
    
         
            +
             
     | 
| 
      
 158 
     | 
    
         
            +
                if (this.value && this.isStrictValidation && !this.#isValidParsedValue()) {
         
     | 
| 
      
 159 
     | 
    
         
            +
                  return { patternMismatch: true };
         
     | 
| 
       137 
160 
     | 
    
         
             
                }
         
     | 
| 
      
 161 
     | 
    
         
            +
             
     | 
| 
       138 
162 
     | 
    
         
             
                return {};
         
     | 
| 
       139 
163 
     | 
    
         
             
              }
         
     | 
| 
       140 
164 
     | 
    
         | 
| 
       141 
     | 
    
         
            -
               
     | 
| 
       142 
     | 
    
         
            -
                this. 
     | 
| 
       143 
     | 
    
         
            -
             
     | 
| 
       144 
     | 
    
         
            -
             
     | 
| 
      
 165 
     | 
    
         
            +
              setSelectionRange(...args) {
         
     | 
| 
      
 166 
     | 
    
         
            +
                this.textField.setSelectionRange(...args);
         
     | 
| 
      
 167 
     | 
    
         
            +
              }
         
     | 
| 
      
 168 
     | 
    
         
            +
             
     | 
| 
      
 169 
     | 
    
         
            +
              attributeChangedCallback(attrName, oldValue, newValue) {
         
     | 
| 
      
 170 
     | 
    
         
            +
                super.attributeChangedCallback(attrName, oldValue, newValue);
         
     | 
| 
      
 171 
     | 
    
         
            +
             
     | 
| 
      
 172 
     | 
    
         
            +
                if (oldValue !== newValue) {
         
     | 
| 
      
 173 
     | 
    
         
            +
                  if (attrName === 'default-code' && newValue) {
         
     | 
| 
      
 174 
     | 
    
         
            +
                    this.#handleDefaultCountryCode(newValue);
         
     | 
| 
      
 175 
     | 
    
         
            +
                  } else if (inputRelatedAttrs.includes(attrName)) {
         
     | 
| 
      
 176 
     | 
    
         
            +
                    const attr = mapAttrs[attrName] || attrName;
         
     | 
| 
      
 177 
     | 
    
         
            +
             
     | 
| 
      
 178 
     | 
    
         
            +
                    if (commonAttrs.includes(attrName)) {
         
     | 
| 
      
 179 
     | 
    
         
            +
                      this.inputs.forEach((input) => input.setAttribute(attr, newValue));
         
     | 
| 
      
 180 
     | 
    
         
            +
                    } else if (countryAttrs.includes(attrName)) {
         
     | 
| 
      
 181 
     | 
    
         
            +
                      this.comboBox.setAttribute(attr, newValue);
         
     | 
| 
      
 182 
     | 
    
         
            +
                    } else if (phoneAttrs.includes(attrName)) {
         
     | 
| 
      
 183 
     | 
    
         
            +
                      this.textField.setAttribute(attr, newValue);
         
     | 
| 
      
 184 
     | 
    
         
            +
                    }
         
     | 
| 
      
 185 
     | 
    
         
            +
                  }
         
     | 
| 
      
 186 
     | 
    
         
            +
             
     | 
| 
      
 187 
     | 
    
         
            +
                  if (labelTypeAttrs.includes(attrName)) {
         
     | 
| 
      
 188 
     | 
    
         
            +
                    this.#handleLabelTypeAttrs(attrName, newValue);
         
     | 
| 
      
 189 
     | 
    
         
            +
                  }
         
     | 
| 
      
 190 
     | 
    
         
            +
             
     | 
| 
      
 191 
     | 
    
         
            +
                  if (attrName === 'restrict-countries') {
         
     | 
| 
      
 192 
     | 
    
         
            +
                    this.#updateComboBoxItems(this.restrictCountries);
         
     | 
| 
      
 193 
     | 
    
         
            +
                  }
         
     | 
| 
      
 194 
     | 
    
         
            +
                }
         
     | 
| 
      
 195 
     | 
    
         
            +
              }
         
     | 
| 
      
 196 
     | 
    
         
            +
             
     | 
| 
      
 197 
     | 
    
         
            +
              #initInputs() {
         
     | 
| 
      
 198 
     | 
    
         
            +
                // Sanitize phone input value to filter everything but digits
         
     | 
| 
      
 199 
     | 
    
         
            +
                this.textField.addEventListener('input', (e) => {
         
     | 
| 
      
 200 
     | 
    
         
            +
                  if (!this.allowAlphanumericInput) {
         
     | 
| 
      
 201 
     | 
    
         
            +
                    const telDigitsRegExp = /^\d$/;
         
     | 
| 
      
 202 
     | 
    
         
            +
                    const sanitizedInput = e.target.value
         
     | 
| 
      
 203 
     | 
    
         
            +
                      .split('')
         
     | 
| 
      
 204 
     | 
    
         
            +
                      .filter((char) => telDigitsRegExp.test(char))
         
     | 
| 
      
 205 
     | 
    
         
            +
                      .join('');
         
     | 
| 
      
 206 
     | 
    
         
            +
                    e.target.value = sanitizedInput;
         
     | 
| 
      
 207 
     | 
    
         
            +
                  }
         
     | 
| 
       145 
208 
     | 
    
         
             
                });
         
     | 
| 
       146 
209 
     | 
    
         | 
| 
       147 
     | 
    
         
            -
                 
     | 
| 
       148 
     | 
    
         
            -
                this. 
     | 
| 
      
 210 
     | 
    
         
            +
                this.handleFocusEventsDispatching(this.inputs);
         
     | 
| 
      
 211 
     | 
    
         
            +
                this.handleInputEventDispatching();
         
     | 
| 
      
 212 
     | 
    
         
            +
             
     | 
| 
      
 213 
     | 
    
         
            +
                // verify country code item against phone number pattern and replace if needed and country is allowed
         
     | 
| 
      
 214 
     | 
    
         
            +
                // (e.g. +1 can be US or CA, depending on the pattern)
         
     | 
| 
      
 215 
     | 
    
         
            +
                this.addEventListener('input', this.#handleSameCountryCodes.bind(this));
         
     | 
| 
       149 
216 
     | 
    
         
             
              }
         
     | 
| 
       150 
217 
     | 
    
         | 
| 
       151 
     | 
    
         
            -
               
     | 
| 
       152 
     | 
    
         
            -
                 
     | 
| 
       153 
     | 
    
         
            -
             
     | 
| 
      
 218 
     | 
    
         
            +
              #setCountryCode(val) {
         
     | 
| 
      
 219 
     | 
    
         
            +
                if (!val || val === this.selectedCountryCode) return;
         
     | 
| 
      
 220 
     | 
    
         
            +
             
     | 
| 
      
 221 
     | 
    
         
            +
                let countryCodeItem = undefined;
         
     | 
| 
      
 222 
     | 
    
         
            +
             
     | 
| 
      
 223 
     | 
    
         
            +
                if (this.value) {
         
     | 
| 
      
 224 
     | 
    
         
            +
                  // try to parse the phone number, and set country code item according to actual dial code (e.g. `+1` can be `US` or `CA`)
         
     | 
| 
      
 225 
     | 
    
         
            +
                  const code = this.#getCountryCodeByPhoneNumber(`${val}-${this.textField.value}`);
         
     | 
| 
      
 226 
     | 
    
         
            +
                  countryCodeItem = this.#getCountryByCodeId(code);
         
     | 
| 
      
 227 
     | 
    
         
            +
                }
         
     | 
| 
      
 228 
     | 
    
         
            +
             
     | 
| 
      
 229 
     | 
    
         
            +
                // in case country code item does not exist (for example: Parsed code is CA for +1 - but Canada is not allowed)
         
     | 
| 
      
 230 
     | 
    
         
            +
                // then use the first option with same dial code (e.g. in that case - `US` for +1)
         
     | 
| 
      
 231 
     | 
    
         
            +
                if (!countryCodeItem) {
         
     | 
| 
      
 232 
     | 
    
         
            +
                  countryCodeItem = this.#getCountryByDialCode(val);
         
     | 
| 
      
 233 
     | 
    
         
            +
                }
         
     | 
| 
      
 234 
     | 
    
         
            +
             
     | 
| 
      
 235 
     | 
    
         
            +
                // set country code item; in it doesn't exist in list - set `undefined`
         
     | 
| 
      
 236 
     | 
    
         
            +
                this.comboBox.selectedItem = countryCodeItem;
         
     | 
| 
      
 237 
     | 
    
         
            +
              }
         
     | 
| 
      
 238 
     | 
    
         
            +
             
     | 
| 
      
 239 
     | 
    
         
            +
              #setNationalNumber(val) {
         
     | 
| 
      
 240 
     | 
    
         
            +
                if (this.isFormatValue) {
         
     | 
| 
      
 241 
     | 
    
         
            +
                  val = this.#formatNationalNumber(val);
         
     | 
| 
      
 242 
     | 
    
         
            +
                }
         
     | 
| 
      
 243 
     | 
    
         
            +
             
     | 
| 
      
 244 
     | 
    
         
            +
                if (this.textField.value !== val) {
         
     | 
| 
      
 245 
     | 
    
         
            +
                  this.textField.value = val;
         
     | 
| 
      
 246 
     | 
    
         
            +
                }
         
     | 
| 
       154 
247 
     | 
    
         
             
              }
         
     | 
| 
       155 
248 
     | 
    
         | 
| 
       156 
     | 
    
         
            -
               
     | 
| 
       157 
     | 
    
         
            -
                 
     | 
| 
      
 249 
     | 
    
         
            +
              #formatNationalNumber(nationalNumber = '') {
         
     | 
| 
      
 250 
     | 
    
         
            +
                // re-initialize AsYouType if country code is outdated
         
     | 
| 
      
 251 
     | 
    
         
            +
                if (!this.#ayt || this.#ayt.country !== this.selectedCountryCode) {
         
     | 
| 
      
 252 
     | 
    
         
            +
                  this.#ayt = new AsYouType(this.selectedCountryCode);
         
     | 
| 
      
 253 
     | 
    
         
            +
                }
         
     | 
| 
      
 254 
     | 
    
         
            +
             
     | 
| 
      
 255 
     | 
    
         
            +
                // reset previous AsYouType input
         
     | 
| 
      
 256 
     | 
    
         
            +
                this.#ayt.reset();
         
     | 
| 
      
 257 
     | 
    
         
            +
             
     | 
| 
      
 258 
     | 
    
         
            +
                const formattedVal = this.#ayt.input(nationalNumber);
         
     | 
| 
      
 259 
     | 
    
         
            +
             
     | 
| 
      
 260 
     | 
    
         
            +
                return formattedVal || nationalNumber;
         
     | 
| 
       158 
261 
     | 
    
         
             
              }
         
     | 
| 
       159 
262 
     | 
    
         | 
| 
       160 
     | 
    
         
            -
               
     | 
| 
       161 
     | 
    
         
            -
                 
     | 
| 
       162 
     | 
    
         
            -
             
     | 
| 
      
 263 
     | 
    
         
            +
              #isValidParsedValue() {
         
     | 
| 
      
 264 
     | 
    
         
            +
                const parsed = parsePhoneNumberFromString(this.value);
         
     | 
| 
      
 265 
     | 
    
         
            +
             
     | 
| 
      
 266 
     | 
    
         
            +
                return (
         
     | 
| 
      
 267 
     | 
    
         
            +
                  parsed && // Parsed successfully (not undefined)
         
     | 
| 
      
 268 
     | 
    
         
            +
                  parsed.isValid?.() && // Parsed object is valid
         
     | 
| 
      
 269 
     | 
    
         
            +
                  parsed.country && // Parsed object with a country code
         
     | 
| 
      
 270 
     | 
    
         
            +
                  this.#isAllowedCountry(parsed.country) // Parsed with allowed country code
         
     | 
| 
       163 
271 
     | 
    
         
             
                );
         
     | 
| 
       164 
272 
     | 
    
         
             
              }
         
     | 
| 
       165 
273 
     | 
    
         | 
| 
       166 
     | 
    
         
            -
               
     | 
| 
      
 274 
     | 
    
         
            +
              #isAllowedCountry(countryCode) {
         
     | 
| 
      
 275 
     | 
    
         
            +
                if (!this.restrictCountries) {
         
     | 
| 
      
 276 
     | 
    
         
            +
                  return true;
         
     | 
| 
      
 277 
     | 
    
         
            +
                }
         
     | 
| 
      
 278 
     | 
    
         
            +
             
     | 
| 
      
 279 
     | 
    
         
            +
                return this.restrictCountries.includes(countryCode);
         
     | 
| 
      
 280 
     | 
    
         
            +
              }
         
     | 
| 
      
 281 
     | 
    
         
            +
             
     | 
| 
      
 282 
     | 
    
         
            +
              // return country item by dial code `data-id` (e.g. `+1`)
         
     | 
| 
      
 283 
     | 
    
         
            +
              #getCountryByDialCode(dialCode) {
         
     | 
| 
      
 284 
     | 
    
         
            +
                return this.comboBox.items?.find((c) => c.getAttribute('data-id') === dialCode) || undefined;
         
     | 
| 
      
 285 
     | 
    
         
            +
              }
         
     | 
| 
      
 286 
     | 
    
         
            +
             
     | 
| 
      
 287 
     | 
    
         
            +
              // return country item by country code `data-country-code` (e.g. `US`)
         
     | 
| 
      
 288 
     | 
    
         
            +
              #getCountryByCodeId(countryCode) {
         
     | 
| 
      
 289 
     | 
    
         
            +
                return this.comboBox.items?.find((c) => c.getAttribute('data-country-code') === countryCode);
         
     | 
| 
      
 290 
     | 
    
         
            +
              }
         
     | 
| 
      
 291 
     | 
    
         
            +
             
     | 
| 
      
 292 
     | 
    
         
            +
              #getCountryCodeByPhoneNumber(val) {
         
     | 
| 
      
 293 
     | 
    
         
            +
                if (!val) return undefined;
         
     | 
| 
      
 294 
     | 
    
         
            +
                const parsed = parsePhoneNumberFromString(val);
         
     | 
| 
      
 295 
     | 
    
         
            +
                if (!parsed?.country) return undefined;
         
     | 
| 
      
 296 
     | 
    
         
            +
                const foundCountryItem = this.#getCountryByCodeId(parsed.country);
         
     | 
| 
      
 297 
     | 
    
         
            +
                return foundCountryItem?.getAttribute('data-country-code');
         
     | 
| 
      
 298 
     | 
    
         
            +
              }
         
     | 
| 
      
 299 
     | 
    
         
            +
             
     | 
| 
      
 300 
     | 
    
         
            +
              #updateComboBoxItems(restrictCountries) {
         
     | 
| 
       167 
301 
     | 
    
         
             
                const items = restrictCountries.length
         
     | 
| 
       168 
302 
     | 
    
         
             
                  ? CountryCodes.filter((c) => restrictCountries.includes(c.code))
         
     | 
| 
       169 
303 
     | 
    
         
             
                  : CountryCodes;
         
     | 
| 
      
 304 
     | 
    
         
            +
             
     | 
| 
       170 
305 
     | 
    
         
             
                this.querySelector('descope-combo-box').innerHTML = items
         
     | 
| 
       171 
306 
     | 
    
         
             
                  .map((item) => comboBoxItem(item))
         
     | 
| 
       172 
307 
     | 
    
         
             
                  .join('');
         
     | 
| 
       173 
308 
     | 
    
         
             
              }
         
     | 
| 
       174 
309 
     | 
    
         | 
| 
       175 
     | 
    
         
            -
              handleDefaultCountryCode(countryCode) {
         
     | 
| 
       176 
     | 
    
         
            -
                if (!this. 
     | 
| 
       177 
     | 
    
         
            -
                  const countryCodeItem = this 
     | 
| 
      
 310 
     | 
    
         
            +
              #handleDefaultCountryCode(countryCode) {
         
     | 
| 
      
 311 
     | 
    
         
            +
                if (!this.comboBox.value) {
         
     | 
| 
      
 312 
     | 
    
         
            +
                  const countryCodeItem = this.#getCountryByCodeId(countryCode);
         
     | 
| 
       178 
313 
     | 
    
         
             
                  // When replacing the input component (inserting internal component into text-field) -
         
     | 
| 
       179 
314 
     | 
    
         
             
                  // Vaadin resets the input's value. We use setTimeout in order to make sure this happens
         
     | 
| 
       180 
315 
     | 
    
         
             
                  // after the reset.
         
     | 
| 
       181 
316 
     | 
    
         
             
                  if (countryCodeItem) {
         
     | 
| 
       182 
317 
     | 
    
         
             
                    setTimeout(() => {
         
     | 
| 
       183 
     | 
    
         
            -
                      this. 
     | 
| 
      
 318 
     | 
    
         
            +
                      this.comboBox.selectedItem = countryCodeItem;
         
     | 
| 
       184 
319 
     | 
    
         
             
                    });
         
     | 
| 
       185 
320 
     | 
    
         
             
                  }
         
     | 
| 
       186 
321 
     | 
    
         
             
                }
         
     | 
| 
       187 
322 
     | 
    
         
             
              }
         
     | 
| 
       188 
323 
     | 
    
         | 
| 
       189 
     | 
    
         
            -
               
     | 
| 
       190 
     | 
    
         
            -
                 
     | 
| 
       191 
     | 
    
         
            -
                this.phoneNumberInput.addEventListener('input', (e) => {
         
     | 
| 
       192 
     | 
    
         
            -
                  // we want to update only phoneNumberInput, and avoid triggering `set value`
         
     | 
| 
       193 
     | 
    
         
            -
                  e.stopPropagation();
         
     | 
| 
      
 324 
     | 
    
         
            +
              #handleSameCountryCodes() {
         
     | 
| 
      
 325 
     | 
    
         
            +
                if (!this.value) return;
         
     | 
| 
       194 
326 
     | 
    
         | 
| 
       195 
     | 
    
         
            -
             
     | 
| 
       196 
     | 
    
         
            -
                    const telDigitsRegExp = /^\d$/;
         
     | 
| 
       197 
     | 
    
         
            -
                    const sanitizedInput = e.target.value
         
     | 
| 
       198 
     | 
    
         
            -
                      .split('')
         
     | 
| 
       199 
     | 
    
         
            -
                      .filter((char) => telDigitsRegExp.test(char))
         
     | 
| 
       200 
     | 
    
         
            -
                      .join('');
         
     | 
| 
       201 
     | 
    
         
            -
                    e.target.value = sanitizedInput;
         
     | 
| 
       202 
     | 
    
         
            -
                  }
         
     | 
| 
       203 
     | 
    
         
            -
                });
         
     | 
| 
      
 327 
     | 
    
         
            +
                const country = this.#getCountryCodeByPhoneNumber(this.value);
         
     | 
| 
       204 
328 
     | 
    
         | 
| 
       205 
     | 
    
         
            -
                 
     | 
| 
       206 
     | 
    
         
            -
             
     | 
| 
      
 329 
     | 
    
         
            +
                if (!country) return;
         
     | 
| 
      
 330 
     | 
    
         
            +
             
     | 
| 
      
 331 
     | 
    
         
            +
                // re-set country code if needed (same coutnry code for different countries, e.g. +1 for US or CA)
         
     | 
| 
      
 332 
     | 
    
         
            +
                if (this.selectedCountryCode !== country) {
         
     | 
| 
      
 333 
     | 
    
         
            +
                  const foundCountryItem = this.#getCountryByCodeId(country);
         
     | 
| 
      
 334 
     | 
    
         
            +
                  // if found country is defined in country list then set it, otherwise - clear phone number
         
     | 
| 
      
 335 
     | 
    
         
            +
                  if (foundCountryItem) {
         
     | 
| 
      
 336 
     | 
    
         
            +
                    this.comboBox.selectedItem = foundCountryItem;
         
     | 
| 
      
 337 
     | 
    
         
            +
                  }
         
     | 
| 
      
 338 
     | 
    
         
            +
                }
         
     | 
| 
       207 
339 
     | 
    
         
             
              }
         
     | 
| 
       208 
340 
     | 
    
         | 
| 
       209 
     | 
    
         
            -
              handleLabelTypeAttrs(attrName, newValue) {
         
     | 
| 
      
 341 
     | 
    
         
            +
              #handleLabelTypeAttrs(attrName, newValue) {
         
     | 
| 
       210 
342 
     | 
    
         
             
                // set or remove label attributes from inner text/combo components on `label-type` change
         
     | 
| 
       211 
343 
     | 
    
         
             
                const attr = mapAttrs[attrName] || attrName;
         
     | 
| 
       212 
344 
     | 
    
         | 
| 
       213 
345 
     | 
    
         
             
                if (attrName === 'label-type') {
         
     | 
| 
       214 
     | 
    
         
            -
                  this 
     | 
| 
      
 346 
     | 
    
         
            +
                  this.#handleLabelTypeChange(newValue);
         
     | 
| 
       215 
347 
     | 
    
         
             
                }
         
     | 
| 
       216 
348 
     | 
    
         
             
                // on inner components label attr change - set label attributes for text/combo components
         
     | 
| 
       217 
349 
     | 
    
         
             
                // only if label-type is `floating`
         
     | 
| 
       218 
350 
     | 
    
         
             
                else if (this.getAttribute('label-type') === 'floating') {
         
     | 
| 
       219 
351 
     | 
    
         
             
                  if (attrName === 'country-input-label') {
         
     | 
| 
       220 
     | 
    
         
            -
                    this. 
     | 
| 
      
 352 
     | 
    
         
            +
                    this.comboBox.setAttribute(attr, newValue);
         
     | 
| 
       221 
353 
     | 
    
         
             
                  } else if (attrName === 'label') {
         
     | 
| 
       222 
     | 
    
         
            -
                    this. 
     | 
| 
      
 354 
     | 
    
         
            +
                    this.textField.setAttribute(attr, newValue);
         
     | 
| 
       223 
355 
     | 
    
         
             
                  }
         
     | 
| 
       224 
356 
     | 
    
         
             
                }
         
     | 
| 
       225 
357 
     | 
    
         
             
              }
         
     | 
| 
       226 
358 
     | 
    
         | 
| 
       227 
     | 
    
         
            -
               
     | 
| 
      
 359 
     | 
    
         
            +
              #handleLabelTypeChange(newValue) {
         
     | 
| 
       228 
360 
     | 
    
         
             
                if (newValue === 'floating') {
         
     | 
| 
       229 
361 
     | 
    
         
             
                  // on change to `floating` label - set inner components `label` and `placeholder`
         
     | 
| 
       230 
     | 
    
         
            -
                  this. 
     | 
| 
       231 
     | 
    
         
            -
                  this. 
     | 
| 
      
 362 
     | 
    
         
            +
                  this.comboBox.setAttribute('label', this.getAttribute('country-input-label') || '');
         
     | 
| 
      
 363 
     | 
    
         
            +
                  this.comboBox.setAttribute(
         
     | 
| 
       232 
364 
     | 
    
         
             
                    'placeholder',
         
     | 
| 
       233 
365 
     | 
    
         
             
                    this.getAttribute('country-input-placeholder') || ''
         
     | 
| 
       234 
366 
     | 
    
         
             
                  );
         
     | 
| 
       235 
     | 
    
         
            -
                  this. 
     | 
| 
       236 
     | 
    
         
            -
                  this. 
     | 
| 
      
 367 
     | 
    
         
            +
                  this.textField.setAttribute('label', this.getAttribute('label') || '');
         
     | 
| 
      
 368 
     | 
    
         
            +
                  this.textField.setAttribute(
         
     | 
| 
       237 
369 
     | 
    
         
             
                    'placeholder',
         
     | 
| 
       238 
370 
     | 
    
         
             
                    this.getAttribute('phone-input-placeholder') || ''
         
     | 
| 
       239 
371 
     | 
    
         
             
                  );
         
     | 
| 
         @@ -242,34 +374,6 @@ class PhoneFieldInternal extends BaseInputClass { 
     | 
|
| 
       242 
374 
     | 
    
         
             
                  this.inputs.forEach((input) => input.removeAttribute('label'));
         
     | 
| 
       243 
375 
     | 
    
         
             
                }
         
     | 
| 
       244 
376 
     | 
    
         
             
              }
         
     | 
| 
       245 
     | 
    
         
            -
             
     | 
| 
       246 
     | 
    
         
            -
              attributeChangedCallback(attrName, oldValue, newValue) {
         
     | 
| 
       247 
     | 
    
         
            -
                super.attributeChangedCallback(attrName, oldValue, newValue);
         
     | 
| 
       248 
     | 
    
         
            -
             
     | 
| 
       249 
     | 
    
         
            -
                if (oldValue !== newValue) {
         
     | 
| 
       250 
     | 
    
         
            -
                  if (attrName === 'default-code' && newValue) {
         
     | 
| 
       251 
     | 
    
         
            -
                    this.handleDefaultCountryCode(newValue);
         
     | 
| 
       252 
     | 
    
         
            -
                  } else if (inputRelatedAttrs.includes(attrName)) {
         
     | 
| 
       253 
     | 
    
         
            -
                    const attr = mapAttrs[attrName] || attrName;
         
     | 
| 
       254 
     | 
    
         
            -
             
     | 
| 
       255 
     | 
    
         
            -
                    if (commonAttrs.includes(attrName)) {
         
     | 
| 
       256 
     | 
    
         
            -
                      this.inputs.forEach((input) => input.setAttribute(attr, newValue));
         
     | 
| 
       257 
     | 
    
         
            -
                    } else if (countryAttrs.includes(attrName)) {
         
     | 
| 
       258 
     | 
    
         
            -
                      this.countryCodeInput.setAttribute(attr, newValue);
         
     | 
| 
       259 
     | 
    
         
            -
                    } else if (phoneAttrs.includes(attrName)) {
         
     | 
| 
       260 
     | 
    
         
            -
                      this.phoneNumberInput.setAttribute(attr, newValue);
         
     | 
| 
       261 
     | 
    
         
            -
                    }
         
     | 
| 
       262 
     | 
    
         
            -
                  }
         
     | 
| 
       263 
     | 
    
         
            -
             
     | 
| 
       264 
     | 
    
         
            -
                  if (labelTypeAttrs.includes(attrName)) {
         
     | 
| 
       265 
     | 
    
         
            -
                    this.handleLabelTypeAttrs(attrName, newValue);
         
     | 
| 
       266 
     | 
    
         
            -
                  }
         
     | 
| 
       267 
     | 
    
         
            -
             
     | 
| 
       268 
     | 
    
         
            -
                  if (attrName === 'restrict-countries') {
         
     | 
| 
       269 
     | 
    
         
            -
                    this.updateCountryCodeItems(this.getRestrictedCountries());
         
     | 
| 
       270 
     | 
    
         
            -
                  }
         
     | 
| 
       271 
     | 
    
         
            -
                }
         
     | 
| 
       272 
     | 
    
         
            -
              }
         
     | 
| 
       273 
377 
     | 
    
         
             
            }
         
     | 
| 
       274 
378 
     | 
    
         | 
| 
       275 
379 
     | 
    
         
             
            export default PhoneFieldInternal;
         
     | 
    
        package/src/components/phone-fields/descope-phone-input-box-field/PhoneFieldInputBoxClass.js
    CHANGED
    
    | 
         @@ -1,7 +1,13 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            import { componentName as descopeInternalComponentName } from './descope-phone-input-box-internal/PhoneFieldInternalInputBox';
         
     | 
| 
       2 
2 
     | 
    
         
             
            import { forwardAttrs, getComponentName } from '../../../helpers/componentHelpers';
         
     | 
| 
       3 
3 
     | 
    
         
             
            import { compose } from '../../../helpers';
         
     | 
| 
       4 
     | 
    
         
            -
            import { 
     | 
| 
      
 4 
     | 
    
         
            +
            import {
         
     | 
| 
      
 5 
     | 
    
         
            +
              createProxy,
         
     | 
| 
      
 6 
     | 
    
         
            +
              createStyleMixin,
         
     | 
| 
      
 7 
     | 
    
         
            +
              draggableMixin,
         
     | 
| 
      
 8 
     | 
    
         
            +
              inputOverrideValidConstraintsMixin,
         
     | 
| 
      
 9 
     | 
    
         
            +
              proxyInputMixin,
         
     | 
| 
      
 10 
     | 
    
         
            +
            } from '../../../mixins';
         
     | 
| 
       5 
11 
     | 
    
         
             
            import { TextFieldClass } from '../../descope-text-field/TextFieldClass';
         
     | 
| 
       6 
12 
     | 
    
         
             
            import CountryCodes from '../CountryCodes';
         
     | 
| 
       7 
13 
     | 
    
         
             
            import {
         
     | 
| 
         @@ -18,7 +24,7 @@ const textVars = TextFieldClass.cssVarList; 
     | 
|
| 
       18 
24 
     | 
    
         
             
            export const componentName = getComponentName('phone-input-box-field');
         
     | 
| 
       19 
25 
     | 
    
         | 
| 
       20 
26 
     | 
    
         
             
            const customMixin = (superclass) =>
         
     | 
| 
       21 
     | 
    
         
            -
              class  
     | 
| 
      
 27 
     | 
    
         
            +
              class PhoneFieldInputBoxMixinClass extends superclass {
         
     | 
| 
       22 
28 
     | 
    
         
             
                static get CountryCodes() {
         
     | 
| 
       23 
29 
     | 
    
         
             
                  return CountryCodes;
         
     | 
| 
       24 
30 
     | 
    
         
             
                }
         
     | 
| 
         @@ -42,8 +48,6 @@ const customMixin = (superclass) => 
     | 
|
| 
       42 
48 
     | 
    
         
             
                  forwardAttrs(this.shadowRoot.host, this.inputElement, {
         
     | 
| 
       43 
49 
     | 
    
         
             
                    includeAttrs: [
         
     | 
| 
       44 
50 
     | 
    
         
             
                      'size',
         
     | 
| 
       45 
     | 
    
         
            -
                      'bordered',
         
     | 
| 
       46 
     | 
    
         
            -
                      'invalid',
         
     | 
| 
       47 
51 
     | 
    
         
             
                      'minlength',
         
     | 
| 
       48 
52 
     | 
    
         
             
                      'maxlength',
         
     | 
| 
       49 
53 
     | 
    
         
             
                      'default-code',
         
     | 
| 
         @@ -52,6 +56,10 @@ const customMixin = (superclass) => 
     | 
|
| 
       52 
56 
     | 
    
         
             
                      'label',
         
     | 
| 
       53 
57 
     | 
    
         
             
                      'label-type',
         
     | 
| 
       54 
58 
     | 
    
         
             
                      'allow-alphanumeric-input',
         
     | 
| 
      
 59 
     | 
    
         
            +
                      'restrict-countries',
         
     | 
| 
      
 60 
     | 
    
         
            +
                      'format-value',
         
     | 
| 
      
 61 
     | 
    
         
            +
                      'strict-validation',
         
     | 
| 
      
 62 
     | 
    
         
            +
                      'data-errormessage-type-mismatch',
         
     | 
| 
       55 
63 
     | 
    
         
             
                    ],
         
     | 
| 
       56 
64 
     | 
    
         
             
                  });
         
     | 
| 
       57 
65 
     | 
    
         
             
                }
         
     | 
| 
         @@ -67,7 +75,8 @@ const { 
     | 
|
| 
       67 
75 
     | 
    
         
             
              inputElement,
         
     | 
| 
       68 
76 
     | 
    
         
             
              requiredIndicator,
         
     | 
| 
       69 
77 
     | 
    
         
             
              inputField,
         
     | 
| 
       70 
     | 
    
         
            -
               
     | 
| 
      
 78 
     | 
    
         
            +
              internalComponent,
         
     | 
| 
      
 79 
     | 
    
         
            +
              internalComponentAfter,
         
     | 
| 
       71 
80 
     | 
    
         
             
              phoneInput,
         
     | 
| 
       72 
81 
     | 
    
         
             
              errorMessage,
         
     | 
| 
       73 
82 
     | 
    
         
             
              helperText,
         
     | 
| 
         @@ -78,8 +87,11 @@ const { 
     | 
|
| 
       78 
87 
     | 
    
         
             
              inputElement: { selector: 'input' },
         
     | 
| 
       79 
88 
     | 
    
         
             
              requiredIndicator: { selector: '[required]::part(required-indicator)::after' },
         
     | 
| 
       80 
89 
     | 
    
         
             
              inputField: { selector: () => 'vaadin-text-field::part(input-field)' },
         
     | 
| 
       81 
     | 
    
         
            -
               
     | 
| 
       82 
     | 
    
         
            -
                selector:  
     | 
| 
      
 90 
     | 
    
         
            +
              internalComponent: {
         
     | 
| 
      
 91 
     | 
    
         
            +
                selector: 'descope-phone-field-internal-input-box',
         
     | 
| 
      
 92 
     | 
    
         
            +
              },
         
     | 
| 
      
 93 
     | 
    
         
            +
              internalComponentAfter: {
         
     | 
| 
      
 94 
     | 
    
         
            +
                selector: 'descope-phone-field-internal-input-box::after',
         
     | 
| 
       83 
95 
     | 
    
         
             
              },
         
     | 
| 
       84 
96 
     | 
    
         
             
              phoneInput: { selector: () => 'descope-text-field' },
         
     | 
| 
       85 
97 
     | 
    
         
             
              helperText: { selector: '::part(helper-text)' },
         
     | 
| 
         @@ -102,14 +114,6 @@ export const PhoneFieldInputBoxClass = compose( 
     | 
|
| 
       102 
114 
     | 
    
         
             
                  hostMinWidth: { ...host, property: 'min-width' },
         
     | 
| 
       103 
115 
     | 
    
         
             
                  hostDirection: { ...host, property: 'direction' },
         
     | 
| 
       104 
116 
     | 
    
         | 
| 
       105 
     | 
    
         
            -
                  inputBorderStyle: { ...inputFieldInternal, property: 'border-style' },
         
     | 
| 
       106 
     | 
    
         
            -
                  inputBorderWidth: { ...inputFieldInternal, property: 'border-width' },
         
     | 
| 
       107 
     | 
    
         
            -
                  inputBorderColor: { ...inputFieldInternal, property: 'border-color' },
         
     | 
| 
       108 
     | 
    
         
            -
                  inputBorderRadius: [
         
     | 
| 
       109 
     | 
    
         
            -
                    { ...inputField, property: 'border-radius' },
         
     | 
| 
       110 
     | 
    
         
            -
                    { ...inputFieldInternal, property: 'border-radius' },
         
     | 
| 
       111 
     | 
    
         
            -
                  ],
         
     | 
| 
       112 
     | 
    
         
            -
             
     | 
| 
       113 
117 
     | 
    
         
             
                  inputHorizontalPadding: [
         
     | 
| 
       114 
118 
     | 
    
         
             
                    { ...phoneInput, property: 'padding-left' },
         
     | 
| 
       115 
119 
     | 
    
         
             
                    { ...phoneInput, property: 'padding-right' },
         
     | 
| 
         @@ -134,10 +138,18 @@ export const PhoneFieldInputBoxClass = compose( 
     | 
|
| 
       134 
138 
     | 
    
         | 
| 
       135 
139 
     | 
    
         
             
                  inputPlaceholderTextColor: { ...phoneInput, property: textVars.inputPlaceholderColor },
         
     | 
| 
       136 
140 
     | 
    
         | 
| 
       137 
     | 
    
         
            -
                   
     | 
| 
       138 
     | 
    
         
            -
                   
     | 
| 
       139 
     | 
    
         
            -
                   
     | 
| 
       140 
     | 
    
         
            -
                   
     | 
| 
      
 141 
     | 
    
         
            +
                  inputBorderStyle: { ...internalComponentAfter, property: 'border-style' },
         
     | 
| 
      
 142 
     | 
    
         
            +
                  inputBorderWidth: { ...internalComponentAfter, property: 'border-width' },
         
     | 
| 
      
 143 
     | 
    
         
            +
                  inputBorderColor: { ...internalComponentAfter, property: 'border-color' },
         
     | 
| 
      
 144 
     | 
    
         
            +
                  inputBorderRadius: [
         
     | 
| 
      
 145 
     | 
    
         
            +
                    { ...internalComponent, property: 'border-radius' },
         
     | 
| 
      
 146 
     | 
    
         
            +
                    { ...internalComponentAfter, property: 'border-radius' },
         
     | 
| 
      
 147 
     | 
    
         
            +
                  ],
         
     | 
| 
      
 148 
     | 
    
         
            +
             
     | 
| 
      
 149 
     | 
    
         
            +
                  inputOutlineStyle: { ...internalComponent, property: 'outline-style' },
         
     | 
| 
      
 150 
     | 
    
         
            +
                  inputOutlineColor: { ...internalComponent, property: 'outline-color' },
         
     | 
| 
      
 151 
     | 
    
         
            +
                  inputOutlineWidth: { ...internalComponent, property: 'outline-width' },
         
     | 
| 
      
 152 
     | 
    
         
            +
                  inputOutlineOffset: { ...internalComponent, property: 'outline-offset' },
         
     | 
| 
       141 
153 
     | 
    
         | 
| 
       142 
154 
     | 
    
         
             
                  labelPosition: { ...label, property: 'position' },
         
     | 
| 
       143 
155 
     | 
    
         
             
                  labelTopPosition: { ...label, property: 'top' },
         
     | 
| 
         @@ -156,6 +168,7 @@ export const PhoneFieldInputBoxClass = compose( 
     | 
|
| 
       156 
168 
     | 
    
         
             
                },
         
     | 
| 
       157 
169 
     | 
    
         
             
              }),
         
     | 
| 
       158 
170 
     | 
    
         
             
              draggableMixin,
         
     | 
| 
      
 171 
     | 
    
         
            +
              inputOverrideValidConstraintsMixin,
         
     | 
| 
       159 
172 
     | 
    
         
             
              proxyInputMixin({ proxyProps: ['value', 'selectionStart'] }),
         
     | 
| 
       160 
173 
     | 
    
         
             
              customMixin
         
     | 
| 
       161 
174 
     | 
    
         
             
            )(
         
     | 
| 
         @@ -187,7 +200,6 @@ export const PhoneFieldInputBoxClass = compose( 
     | 
|
| 
       187 
200 
     | 
    
         
             
                vaadin-text-field::part(input-field) {
         
     | 
| 
       188 
201 
     | 
    
         
             
                  padding: 0;
         
     | 
| 
       189 
202 
     | 
    
         
             
                  background: transparent;
         
     | 
| 
       190 
     | 
    
         
            -
                  overflow: hidden;
         
     | 
| 
       191 
203 
     | 
    
         
             
                  -webkit-mask-image: none;
         
     | 
| 
       192 
204 
     | 
    
         
             
                }
         
     | 
| 
       193 
205 
     | 
    
         
             
                descope-phone-field-internal-input-box {
         
     | 
| 
         @@ -198,14 +210,20 @@ export const PhoneFieldInputBoxClass = compose( 
     | 
|
| 
       198 
210 
     | 
    
         
             
                descope-phone-field-internal-input-box > div {
         
     | 
| 
       199 
211 
     | 
    
         
             
                  width: 100%;
         
     | 
| 
       200 
212 
     | 
    
         
             
                }
         
     | 
| 
       201 
     | 
    
         
            -
                descope-phone-field-internal-input-box .separator {
         
     | 
| 
       202 
     | 
    
         
            -
                  flex: 0;
         
     | 
| 
       203 
     | 
    
         
            -
                  border: none;
         
     | 
| 
       204 
     | 
    
         
            -
                }
         
     | 
| 
       205 
213 
     | 
    
         
             
                descope-phone-field-internal-input-box descope-text-field {
         
     | 
| 
       206 
214 
     | 
    
         
             
                  ${textVars.inputOutlineWidth}: 0;
         
     | 
| 
       207 
215 
     | 
    
         
             
                  ${textVars.inputOutlineOffset}: 0;
         
     | 
| 
       208 
216 
     | 
    
         
             
                }
         
     | 
| 
      
 217 
     | 
    
         
            +
                descope-phone-field-internal-input-box::after {
         
     | 
| 
      
 218 
     | 
    
         
            +
                  content: '';
         
     | 
| 
      
 219 
     | 
    
         
            +
                  position: absolute;
         
     | 
| 
      
 220 
     | 
    
         
            +
                  width: 100%;
         
     | 
| 
      
 221 
     | 
    
         
            +
                  height: 100%;
         
     | 
| 
      
 222 
     | 
    
         
            +
                  top: 0;
         
     | 
| 
      
 223 
     | 
    
         
            +
                  left: 0;
         
     | 
| 
      
 224 
     | 
    
         
            +
                  box-sizing: border-box;
         
     | 
| 
      
 225 
     | 
    
         
            +
                  pointer-events: none;
         
     | 
| 
      
 226 
     | 
    
         
            +
                }
         
     | 
| 
       209 
227 
     | 
    
         
             
                descope-text-field {
         
     | 
| 
       210 
228 
     | 
    
         
             
                  flex-grow: 1;
         
     | 
| 
       211 
229 
     | 
    
         
             
                  width: 100%;
         
     |