@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.
@@ -1 +1 @@
1
- "use strict";(self.webpackChunkDescopeUI=self.webpackChunkDescopeUI||[]).push([[2528],{2138:(t,e,o)=>{o.d(e,{f:()=>l,k:()=>p});var n=o(1e3),s=o(3874),r=o(2061);const l=(0,o(4567).iY)("text");class i extends((0,s.s)({componentName:l,baseSelector:":host > slot"})){constructor(){super(),this.attachShadow({mode:"open"}).innerHTML="\n\t\t<style>\n\t\t\t:host {\n\t\t\t\tdisplay: inline-block;\n\t\t\t}\n\t\t\t:host > slot {\n\t\t\t\twidth: 100%;\n\t\t\t\tdisplay: inline-block;\n\t\t\t}\n\t\t</style>\n\t\t<slot></slot>\n\t\t"}}const p=(0,r.qC)((0,n.yk)({mappings:{hostWidth:{selector:()=>":host",property:"width"},fontSize:{},textColor:{property:"color"},textLineHeight:{property:"line-height"},textLetterSpacing:{property:"letter-spacing"},textShadow:{},textAlign:{},textTransform:{},fontFamily:{},fontStyle:{},fontWeight:{},borderWidth:{},borderStyle:{},borderColor:{}}}),n.e4,n.Ae)(i)},1876:(t,e,o)=>{o.r(e),o.d(e,{TextClass:()=>n.k});var n=o(2138);customElements.define(n.f,n.k)}}]);
1
+ "use strict";(self.webpackChunkDescopeUI=self.webpackChunkDescopeUI||[]).push([[2528],{2138:(t,e,s)=>{s.d(e,{f:()=>h,k:()=>p});var n=s(1e3),o=s(3874),i=s(2061),r=s(4567);const h=(0,r.iY)("text");class l extends((0,o.s)({componentName:h,baseSelector:":host > slot"})){constructor(){super(),this.attachShadow({mode:"open"}).innerHTML="\n\t\t<style>\n\t\t\t:host {\n\t\t\t\tdisplay: inline-block;\n\t\t\t}\n\t\t\t:host > slot {\n\t\t\t\twidth: 100%;\n\t\t\t\tdisplay: inline-block;\n\t\t\t}\n\t\t</style>\n\t\t<slot></slot>\n\t\t"}}const p=(0,i.qC)((0,n.yk)({mappings:{hostWidth:{selector:()=>":host",property:"width"},fontSize:{},textColor:{property:"color"},textLineHeight:{property:"line-height"},textLetterSpacing:{property:"letter-spacing"},textShadow:{},textAlign:{},textTransform:{},fontFamily:{},fontStyle:{},fontWeight:{},borderWidth:{},borderStyle:{},borderColor:{}}}),n.e4,n.Ae,(t=>class extends t{get hideWhenEmpty(){return"true"===this.getAttribute("hide-when-empty")}init(){super.init(),(0,r.P$)(this,(()=>{const t=!!this.childNodes.length;this.style.display=!t&&this.hideWhenEmpty?"none":""}))}}))(l)},1876:(t,e,s)=>{s.r(e),s.d(e,{TextClass:()=>n.k});var n=s(2138);customElements.define(n.f,n.k)}}]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@descope/web-components-ui",
3
- "version": "1.0.211",
3
+ "version": "1.0.212",
4
4
  "description": "",
5
5
  "main": "dist/cjs/index.cjs.js",
6
6
  "module": "dist/index.esm.js",
@@ -1,7 +1,8 @@
1
+ // eslint-disable-next-line max-classes-per-file
1
2
  import { createStyleMixin, draggableMixin, componentNameValidationMixin } from '../../mixins';
2
3
  import { createBaseClass } from '../../baseClasses/createBaseClass';
3
4
  import { compose } from '../../helpers';
4
- import { getComponentName } from '../../helpers/componentHelpers';
5
+ import { getComponentName, observeChildren } from '../../helpers/componentHelpers';
5
6
 
6
7
  export const componentName = getComponentName('text');
7
8
 
@@ -24,6 +25,22 @@ class RawText extends createBaseClass({ componentName, baseSelector: ':host > sl
24
25
  }
25
26
  }
26
27
 
28
+ const customTextMixin = (superclass) =>
29
+ class CustomTextMixin extends superclass {
30
+ get hideWhenEmpty() {
31
+ return this.getAttribute('hide-when-empty') === 'true';
32
+ }
33
+
34
+ init() {
35
+ super.init();
36
+
37
+ observeChildren(this, () => {
38
+ const hasChildren = !!this.childNodes.length;
39
+ this.style.display = !hasChildren && this.hideWhenEmpty ? 'none' : '';
40
+ });
41
+ }
42
+ };
43
+
27
44
  export const TextClass = compose(
28
45
  createStyleMixin({
29
46
  mappings: {
@@ -44,5 +61,6 @@ export const TextClass = compose(
44
61
  },
45
62
  }),
46
63
  draggableMixin,
47
- componentNameValidationMixin
64
+ componentNameValidationMixin,
65
+ customTextMixin
48
66
  )(RawText);