@descope/web-components-ui 1.0.120 → 1.0.121
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 +1 -1
- package/dist/cjs/index.cjs.js.map +1 -1
- package/dist/index.esm.js +17 -8
- package/dist/index.esm.js.map +1 -1
- package/dist/umd/descope-phone-field-descope-phone-field-internal-index-js.js +1 -1
- package/package.json +1 -1
- package/src/components/descope-phone-field/descope-phone-field-internal/PhoneFieldInternal.js +15 -7
- package/src/components/descope-phone-field/helpers.js +1 -0
- package/src/helpers/themeHelpers/index.js +1 -1
package/dist/index.esm.js
CHANGED
@@ -4403,6 +4403,7 @@ const comboBoxItem = ({ code, dialCode, name: country }) => (`
|
|
4403
4403
|
style="display:flex; flex-direction: column;"
|
4404
4404
|
data-id="${code}"
|
4405
4405
|
data-name="${code} ${dialCode} ${country}"
|
4406
|
+
data-dial-code="${dialCode}"
|
4406
4407
|
>
|
4407
4408
|
<div>
|
4408
4409
|
<span>
|
@@ -4474,7 +4475,10 @@ class PhoneFieldInternal extends BaseInputClass$1 {
|
|
4474
4475
|
|
4475
4476
|
set value(val) {
|
4476
4477
|
const [countryCode = '', phoneNumber = ''] = val.split('-');
|
4477
|
-
|
4478
|
+
const countryCodeItem = this.getCountryByDialCode(countryCode);
|
4479
|
+
if (countryCodeItem) {
|
4480
|
+
this.countryCodeInput.selectedItem = countryCodeItem;
|
4481
|
+
}
|
4478
4482
|
this.phoneNumberInput.value = phoneNumber;
|
4479
4483
|
}
|
4480
4484
|
|
@@ -4509,7 +4513,6 @@ class PhoneFieldInternal extends BaseInputClass$1 {
|
|
4509
4513
|
};
|
4510
4514
|
|
4511
4515
|
init() {
|
4512
|
-
|
4513
4516
|
this.addEventListener('focus', (e) => {
|
4514
4517
|
// we want to ignore focus events we are dispatching
|
4515
4518
|
if (e.isTrusted)
|
@@ -4521,18 +4524,24 @@ class PhoneFieldInternal extends BaseInputClass$1 {
|
|
4521
4524
|
this.setComboBoxDescriptor();
|
4522
4525
|
}
|
4523
4526
|
|
4527
|
+
getCountryByDialCode(countryDialCode) {
|
4528
|
+
return this.countryCodeInput.items.find(c => c.getAttribute('data-dial-code') === countryDialCode);
|
4529
|
+
}
|
4530
|
+
|
4531
|
+
getCountryByCodeId(countryCode) {
|
4532
|
+
return this.countryCodeInput.items.find(c => c['data-id'] === countryCode)?.['data-name'];
|
4533
|
+
}
|
4534
|
+
|
4524
4535
|
handleDefaultCountryCode(countryCode) {
|
4525
4536
|
if (!this.countryCodeInput.value) {
|
4526
|
-
const
|
4527
|
-
|
4537
|
+
const countryCodeItem = this.getCountryByCodeId(countryCode);
|
4528
4538
|
// When replacing the input component (inserting internal component into text-field) -
|
4529
4539
|
// Vaadin resets the input's value. We use setTimeout in order to make sure this happens
|
4530
4540
|
// after the reset.
|
4531
|
-
if (
|
4541
|
+
if (countryCodeItem) {
|
4532
4542
|
setTimeout(() => {
|
4533
|
-
this.countryCodeInput.selectedItem =
|
4543
|
+
this.countryCodeInput.selectedItem = countryCodeItem;
|
4534
4544
|
});
|
4535
|
-
|
4536
4545
|
}
|
4537
4546
|
}
|
4538
4547
|
}
|
@@ -5208,7 +5217,7 @@ const globalsThemeToStyle = (theme, themeName = '') => {
|
|
5208
5217
|
''
|
5209
5218
|
);
|
5210
5219
|
|
5211
|
-
if(!themeName) return style
|
5220
|
+
if (!themeName) return style
|
5212
5221
|
|
5213
5222
|
return `*[data-theme="${themeName}"] {${style}}`
|
5214
5223
|
};
|