@descope/web-components-ui 1.0.211 → 1.0.212
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.
@@ -1 +1 @@
|
|
1
|
-
"use strict";(self.webpackChunkDescopeUI=self.webpackChunkDescopeUI||[]).push([[2528],{2138:(t,e,
|
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,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);
|