@descope/web-components-ui 3.1.10 → 3.1.12
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 +12 -4
- package/dist/cjs/index.cjs.js.map +1 -1
- package/dist/index.esm.js +26 -9
- package/dist/index.esm.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 +1 -1
- package/dist/umd/descope-hybrid-field-index-js.js.map +1 -1
- package/dist/umd/index.js +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/package.json +31 -31
- package/src/components/descope-hybrid-field/HybridFieldClass.js +12 -4
- package/src/components/phone-fields/descope-phone-field/descope-phone-field-internal/PhoneFieldInternal.js +14 -5
package/dist/index.esm.js
CHANGED
|
@@ -11201,12 +11201,21 @@ let PhoneFieldInternal$1 = class PhoneFieldInternal extends BaseInputClass$a {
|
|
|
11201
11201
|
return;
|
|
11202
11202
|
}
|
|
11203
11203
|
|
|
11204
|
-
//
|
|
11205
|
-
const
|
|
11204
|
+
// Collect all country codes sharing this dial code from CountryCodes (e.g. US, CA, DO, ... for +1)
|
|
11205
|
+
const matchingCountryCodes = CountryCodes.filter((c) => c.dialCode === dialCode).map(
|
|
11206
|
+
(c) => c.code
|
|
11207
|
+
);
|
|
11206
11208
|
|
|
11207
|
-
//
|
|
11208
|
-
|
|
11209
|
-
|
|
11209
|
+
// Check if the currently selected country's data-country-code is in that set
|
|
11210
|
+
const currentSelectedCountryCode = this.selectedCountryCode;
|
|
11211
|
+
if (!matchingCountryCodes.includes(currentSelectedCountryCode)) {
|
|
11212
|
+
// If not, find the first combo box item (restricted list) whose data-country-code is in the set
|
|
11213
|
+
const matchingItem = this.comboBox.items?.find((c) =>
|
|
11214
|
+
matchingCountryCodes.includes(c.getAttribute('data-country-code'))
|
|
11215
|
+
);
|
|
11216
|
+
if (matchingItem) {
|
|
11217
|
+
this.comboBox.selectedItem = matchingItem;
|
|
11218
|
+
}
|
|
11210
11219
|
}
|
|
11211
11220
|
|
|
11212
11221
|
// set formatted or raw national number on the text field
|
|
@@ -19155,13 +19164,21 @@ class RawHybridField extends BaseClass$6 {
|
|
|
19155
19164
|
});
|
|
19156
19165
|
}
|
|
19157
19166
|
|
|
19167
|
+
#getDefaultDialCode() {
|
|
19168
|
+
const code = this.getAttribute('default-code');
|
|
19169
|
+
const match = code && PhoneFieldClass.CountryCodes.find((c) => c.code === code);
|
|
19170
|
+
return match?.dialCode || PhoneFieldClass.CountryCodes[0]?.dialCode || '';
|
|
19171
|
+
}
|
|
19172
|
+
|
|
19158
19173
|
setActiveInputValue(val) {
|
|
19159
19174
|
const sanitizedVal = sanitizeCountryCodePrefix(val);
|
|
19160
19175
|
const isPhoneField = this.activeInput.localName === PHONE_FIELD;
|
|
19161
|
-
|
|
19162
|
-
|
|
19163
|
-
|
|
19164
|
-
|
|
19176
|
+
if (isPhoneField) {
|
|
19177
|
+
const dialCode = this.phoneCountryCodeInput.countryCodeItems || this.#getDefaultDialCode();
|
|
19178
|
+
this.activeInput.value = `${dialCode}-${sanitizedVal}`;
|
|
19179
|
+
} else {
|
|
19180
|
+
this.activeInput.value = sanitizedVal;
|
|
19181
|
+
}
|
|
19165
19182
|
}
|
|
19166
19183
|
|
|
19167
19184
|
toggleInputVisibility() {
|