@descope/web-components-ui 1.0.119 → 1.0.121

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.esm.js CHANGED
@@ -2597,7 +2597,7 @@ const {
2597
2597
  internalWrapper,
2598
2598
  focusedDigitField
2599
2599
  } = {
2600
- host: () => ':host',
2600
+ host: { selector: () => ':host' },
2601
2601
  focusedDigitField: { selector: () => `${TextFieldClass.componentName}[focused="true"]` },
2602
2602
  digitField: { selector: () => TextFieldClass.componentName },
2603
2603
  label: { selector: '::part(label)' },
@@ -2610,6 +2610,7 @@ const textVars$1 = TextFieldClass.cssVarList;
2610
2610
  const PasscodeClass = compose(
2611
2611
  createStyleMixin({
2612
2612
  mappings: {
2613
+ fontSize: [{ ...digitField, property: textVars$1.fontSize }, host$5],
2613
2614
  hostWidth: { property: 'width' },
2614
2615
  fontFamily: host$5,
2615
2616
  labelTextColor: [
@@ -4402,6 +4403,7 @@ const comboBoxItem = ({ code, dialCode, name: country }) => (`
4402
4403
  style="display:flex; flex-direction: column;"
4403
4404
  data-id="${code}"
4404
4405
  data-name="${code} ${dialCode} ${country}"
4406
+ data-dial-code="${dialCode}"
4405
4407
  >
4406
4408
  <div>
4407
4409
  <span>
@@ -4473,7 +4475,10 @@ class PhoneFieldInternal extends BaseInputClass$1 {
4473
4475
 
4474
4476
  set value(val) {
4475
4477
  const [countryCode = '', phoneNumber = ''] = val.split('-');
4476
- this.countryCodeInput.value = countryCode;
4478
+ const countryCodeItem = this.getCountryByDialCode(countryCode);
4479
+ if (countryCodeItem) {
4480
+ this.countryCodeInput.selectedItem = countryCodeItem;
4481
+ }
4477
4482
  this.phoneNumberInput.value = phoneNumber;
4478
4483
  }
4479
4484
 
@@ -4508,7 +4513,6 @@ class PhoneFieldInternal extends BaseInputClass$1 {
4508
4513
  };
4509
4514
 
4510
4515
  init() {
4511
-
4512
4516
  this.addEventListener('focus', (e) => {
4513
4517
  // we want to ignore focus events we are dispatching
4514
4518
  if (e.isTrusted)
@@ -4520,18 +4524,24 @@ class PhoneFieldInternal extends BaseInputClass$1 {
4520
4524
  this.setComboBoxDescriptor();
4521
4525
  }
4522
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
+
4523
4535
  handleDefaultCountryCode(countryCode) {
4524
4536
  if (!this.countryCodeInput.value) {
4525
- const countryData = this.countryCodeInput.items.find(c => c['data-id'] === countryCode)?.['data-name'];
4526
-
4537
+ const countryCodeItem = this.getCountryByCodeId(countryCode);
4527
4538
  // When replacing the input component (inserting internal component into text-field) -
4528
4539
  // Vaadin resets the input's value. We use setTimeout in order to make sure this happens
4529
4540
  // after the reset.
4530
- if (countryData) {
4541
+ if (countryCodeItem) {
4531
4542
  setTimeout(() => {
4532
- this.countryCodeInput.selectedItem = this.countryCodeInput.items.find(node => node['data-id'] === countryCode);
4543
+ this.countryCodeInput.selectedItem = countryCodeItem;
4533
4544
  });
4534
-
4535
4545
  }
4536
4546
  }
4537
4547
  }
@@ -5207,7 +5217,7 @@ const globalsThemeToStyle = (theme, themeName = '') => {
5207
5217
  ''
5208
5218
  );
5209
5219
 
5210
- if(!themeName) return style
5220
+ if (!themeName) return style
5211
5221
 
5212
5222
  return `*[data-theme="${themeName}"] {${style}}`
5213
5223
  };
@@ -6236,6 +6246,7 @@ const vars$7 = PasscodeClass.cssVarList;
6236
6246
 
6237
6247
  const passcode = {
6238
6248
  [vars$7.fontFamily]: refs.fontFamily,
6249
+ [vars$7.fontSize]: refs.fontSize,
6239
6250
  [vars$7.labelTextColor]: refs.labelTextColor,
6240
6251
  [vars$7.labelRequiredIndicator]: refs.requiredIndicator,
6241
6252
  [vars$7.digitValueTextColor]: refs.valueTextColor,