@descope/web-components-ui 3.1.9 → 3.1.11

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.
@@ -24193,13 +24193,21 @@ class RawHybridField extends BaseClass$2 {
24193
24193
  });
24194
24194
  }
24195
24195
 
24196
+ #getDefaultDialCode() {
24197
+ const code = this.getAttribute('default-code');
24198
+ const match = code && PhoneFieldClass.CountryCodes.find((c) => c.code === code);
24199
+ return match?.dialCode || PhoneFieldClass.CountryCodes[0]?.dialCode || '';
24200
+ }
24201
+
24196
24202
  setActiveInputValue(val) {
24197
24203
  const sanitizedVal = sanitizeCountryCodePrefix(val);
24198
24204
  const isPhoneField = this.activeInput.localName === PHONE_FIELD;
24199
- const value = isPhoneField
24200
- ? `${this.phoneCountryCodeInput.countryCodeItems}-${sanitizedVal}`
24201
- : sanitizedVal;
24202
- this.activeInput.value = value;
24205
+ if (isPhoneField) {
24206
+ const dialCode = this.phoneCountryCodeInput.countryCodeItems || this.#getDefaultDialCode();
24207
+ this.activeInput.value = `${dialCode}-${sanitizedVal}`;
24208
+ } else {
24209
+ this.activeInput.value = sanitizedVal;
24210
+ }
24203
24211
  }
24204
24212
 
24205
24213
  toggleInputVisibility() {