@descope/web-components-ui 1.0.211 → 1.0.212

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.esm.js CHANGED
@@ -2081,6 +2081,8 @@ const DividerClass = compose(
2081
2081
  componentNameValidationMixin
2082
2082
  )(RawDivider);
2083
2083
 
2084
+ // eslint-disable-next-line max-classes-per-file
2085
+
2084
2086
  const componentName$o = getComponentName('text');
2085
2087
 
2086
2088
  class RawText extends createBaseClass({ componentName: componentName$o, baseSelector: ':host > slot' }) {
@@ -2102,6 +2104,22 @@ class RawText extends createBaseClass({ componentName: componentName$o, baseSele
2102
2104
  }
2103
2105
  }
2104
2106
 
2107
+ const customTextMixin = (superclass) =>
2108
+ class CustomTextMixin extends superclass {
2109
+ get hideWhenEmpty() {
2110
+ return this.getAttribute('hide-when-empty') === 'true';
2111
+ }
2112
+
2113
+ init() {
2114
+ super.init();
2115
+
2116
+ observeChildren(this, () => {
2117
+ const hasChildren = !!this.childNodes.length;
2118
+ this.style.display = !hasChildren && this.hideWhenEmpty ? 'none' : '';
2119
+ });
2120
+ }
2121
+ };
2122
+
2105
2123
  const TextClass = compose(
2106
2124
  createStyleMixin({
2107
2125
  mappings: {
@@ -2122,7 +2140,8 @@ const TextClass = compose(
2122
2140
  },
2123
2141
  }),
2124
2142
  draggableMixin,
2125
- componentNameValidationMixin
2143
+ componentNameValidationMixin,
2144
+ customTextMixin
2126
2145
  )(RawText);
2127
2146
 
2128
2147
  customElements.define(componentName$o, TextClass);