@descope/web-components-ui 1.0.211 → 1.0.213

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.esm.js CHANGED
@@ -966,6 +966,9 @@ const proxyInputMixin =
966
966
  // We do not want to show the default validity report tooltip
967
967
  // So we are overriding the reportValidity fn to show the input's error message
968
968
  reportValidity = () => {
969
+ // we want to update validity so in case the value was set programmatically, we won't get an error
970
+ this.inputElement.setCustomValidity('');
971
+ this.setCustomValidity('');
969
972
  if (!this.checkValidity()) {
970
973
  this.setAttribute('invalid', 'true');
971
974
  this.#handleErrorMessage();
@@ -2081,6 +2084,8 @@ const DividerClass = compose(
2081
2084
  componentNameValidationMixin
2082
2085
  )(RawDivider);
2083
2086
 
2087
+ // eslint-disable-next-line max-classes-per-file
2088
+
2084
2089
  const componentName$o = getComponentName('text');
2085
2090
 
2086
2091
  class RawText extends createBaseClass({ componentName: componentName$o, baseSelector: ':host > slot' }) {
@@ -2102,6 +2107,22 @@ class RawText extends createBaseClass({ componentName: componentName$o, baseSele
2102
2107
  }
2103
2108
  }
2104
2109
 
2110
+ const customTextMixin = (superclass) =>
2111
+ class CustomTextMixin extends superclass {
2112
+ get hideWhenEmpty() {
2113
+ return this.getAttribute('hide-when-empty') === 'true';
2114
+ }
2115
+
2116
+ init() {
2117
+ super.init();
2118
+
2119
+ observeChildren(this, () => {
2120
+ const hasChildren = !!this.childNodes.length;
2121
+ this.style.display = !hasChildren && this.hideWhenEmpty ? 'none' : '';
2122
+ });
2123
+ }
2124
+ };
2125
+
2105
2126
  const TextClass = compose(
2106
2127
  createStyleMixin({
2107
2128
  mappings: {
@@ -2122,7 +2143,8 @@ const TextClass = compose(
2122
2143
  },
2123
2144
  }),
2124
2145
  draggableMixin,
2125
- componentNameValidationMixin
2146
+ componentNameValidationMixin,
2147
+ customTextMixin
2126
2148
  )(RawText);
2127
2149
 
2128
2150
  customElements.define(componentName$o, TextClass);
@@ -4771,7 +4793,7 @@ let PhoneFieldInternal$1 = class PhoneFieldInternal extends BaseInputClass$3 {
4771
4793
 
4772
4794
  // override combo box setter to display dialCode value in input
4773
4795
  this.countryCodeInput.customValueTransformFn = (val) => {
4774
- const [, dialCode] = val.split(' ');
4796
+ const [, dialCode] = val?.split?.(' ') || [];
4775
4797
  return dialCode;
4776
4798
  };
4777
4799
  }
@@ -4843,9 +4865,7 @@ let PhoneFieldInternal$1 = class PhoneFieldInternal extends BaseInputClass$3 {
4843
4865
  }
4844
4866
 
4845
4867
  getCountryByDialCode(countryDialCode) {
4846
- return this.countryCodeInput.items?.find(
4847
- (c) => c.getAttribute('data-country-code') === countryDialCode
4848
- );
4868
+ return this.countryCodeInput.items?.find((c) => c.getAttribute('data-id') === countryDialCode);
4849
4869
  }
4850
4870
 
4851
4871
  getCountryByCodeId(countryCode) {