@rededor/cura 0.5.1 → 0.5.2
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.
- package/dist/cjs/{app-globals-0e3b7fc6.js → app-globals-2988084b.js} +5 -5
- package/dist/cjs/app-globals-2988084b.js.map +1 -0
- package/dist/cjs/cura-accordion_8.cjs.entry.js +452 -0
- package/dist/cjs/cura-accordion_8.cjs.entry.js.map +1 -0
- package/dist/cjs/cura-button-outline.cjs.entry.js +83 -0
- package/dist/cjs/cura-button-outline.cjs.entry.js.map +1 -0
- package/dist/cjs/cura-button-transparent.cjs.entry.js +83 -0
- package/dist/cjs/cura-button-transparent.cjs.entry.js.map +1 -0
- package/dist/cjs/cura-display.cjs.entry.js +74 -0
- package/dist/cjs/cura-display.cjs.entry.js.map +1 -0
- package/dist/cjs/cura-icons-view.cjs.entry.js +29 -0
- package/dist/cjs/cura-icons-view.cjs.entry.js.map +1 -0
- package/dist/cjs/cura-label.cjs.entry.js +69 -0
- package/dist/cjs/cura-label.cjs.entry.js.map +1 -0
- package/dist/cjs/cura.cjs.js +2 -2
- package/dist/cjs/index.cjs.js +7 -0
- package/dist/cjs/index.cjs.js.map +1 -1
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/collection/api/cura-api.type.js.map +1 -1
- package/dist/collection/api/modules/cura-theme-breakpoints-module.js +1 -1
- package/dist/collection/api/modules/cura-theme-breakpoints-module.js.map +1 -1
- package/dist/collection/api/modules/cura-theme-colors-module.js +1 -1
- package/dist/collection/api/modules/cura-theme-colors-module.js.map +1 -1
- package/dist/collection/api/theme-presets/static.js +2 -2
- package/dist/collection/api/theme-presets/static.js.map +1 -1
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/components/accordion/cura-accordion-item/cura-accordion-item.css +10 -6
- package/dist/collection/components/cura-page-template/cura-page-template.css +13 -9
- package/dist/collection/components/forms/cura-label/cura-label.css +70 -0
- package/dist/collection/components/forms/cura-label/cura-label.js +190 -0
- package/dist/collection/components/forms/cura-label/cura-label.js.map +1 -0
- package/dist/collection/components/forms/cura-label/cura-label.stories.js +137 -0
- package/dist/collection/components/forms/cura-label/cura-label.stories.js.map +1 -0
- package/dist/collection/components/text/cura-display/cura-display.css +21 -38
- package/dist/collection/components/text/cura-display/cura-display.js +80 -49
- package/dist/collection/components/text/cura-display/cura-display.js.map +1 -1
- package/dist/collection/components/text/cura-display/cura-display.stories.js +78 -33
- package/dist/collection/components/text/cura-display/cura-display.stories.js.map +1 -1
- package/dist/collection/components/text/cura-heading/cura-heading.css +50 -24
- package/dist/collection/components/text/cura-heading/cura-heading.js +94 -39
- package/dist/collection/components/text/cura-heading/cura-heading.js.map +1 -1
- package/dist/collection/components/text/cura-heading/cura-heading.stories.js +92 -36
- package/dist/collection/components/text/cura-heading/cura-heading.stories.js.map +1 -1
- package/dist/collection/components/text/cura-paragraph/cura-paragraph.css +37 -38
- package/dist/collection/components/text/cura-paragraph/cura-paragraph.js +62 -41
- package/dist/collection/components/text/cura-paragraph/cura-paragraph.js.map +1 -1
- package/dist/collection/components/text/cura-paragraph/cura-paragraph.stories.js +78 -46
- package/dist/collection/components/text/cura-paragraph/cura-paragraph.stories.js.map +1 -1
- package/dist/collection/index.js +3 -1
- package/dist/collection/index.js.map +1 -1
- package/dist/components/cura-accordion-item.js +1 -1
- package/dist/components/cura-accordion-item.js.map +1 -1
- package/dist/components/cura-display.js +41 -35
- package/dist/components/cura-display.js.map +1 -1
- package/dist/components/cura-heading.js +34 -21
- package/dist/components/cura-heading.js.map +1 -1
- package/dist/components/cura-label.d.ts +11 -0
- package/dist/components/cura-label.js +91 -0
- package/dist/components/cura-label.js.map +1 -0
- package/dist/components/cura-page-template.js +1 -1
- package/dist/components/cura-page-template.js.map +1 -1
- package/dist/components/cura-paragraph.js +25 -23
- package/dist/components/cura-paragraph.js.map +1 -1
- package/dist/components/index.js +11 -5
- package/dist/components/index.js.map +1 -1
- package/dist/cura/cura.esm.js +1 -1
- package/dist/cura/cura.esm.js.map +1 -1
- package/dist/cura/cura.js +1 -1
- package/dist/cura/index.esm.js +1 -1
- package/dist/cura/index.esm.js.map +1 -1
- package/dist/cura/p-03047b3e.entry.js +2 -0
- package/dist/cura/p-03047b3e.entry.js.map +1 -0
- package/dist/cura/p-0c79c54e.entry.js +2 -0
- package/dist/cura/p-0c79c54e.entry.js.map +1 -0
- package/dist/cura/p-120926c5.system.js +2 -0
- package/dist/cura/p-120926c5.system.js.map +1 -0
- package/dist/cura/p-223924fb.system.entry.js +2 -0
- package/dist/cura/p-223924fb.system.entry.js.map +1 -0
- package/dist/cura/p-48426f60.system.js +2 -0
- package/dist/cura/p-48426f60.system.js.map +1 -0
- package/dist/cura/p-49813052.entry.js +2 -0
- package/dist/cura/p-49813052.entry.js.map +1 -0
- package/dist/cura/p-4bdbcdf0.system.entry.js +2 -0
- package/dist/cura/p-4bdbcdf0.system.entry.js.map +1 -0
- package/dist/cura/p-7c8f3c77.system.entry.js +2 -0
- package/dist/cura/p-7c8f3c77.system.entry.js.map +1 -0
- package/dist/cura/p-8b18b5f7.system.js +2 -0
- package/dist/cura/p-8b18b5f7.system.js.map +1 -0
- package/dist/cura/p-91b0f78e.entry.js +2 -0
- package/dist/cura/p-91b0f78e.entry.js.map +1 -0
- package/dist/cura/p-a0395f90.entry.js +2 -0
- package/dist/cura/p-a0395f90.entry.js.map +1 -0
- package/dist/cura/p-a7ef255f.entry.js +2 -0
- package/dist/cura/p-a7ef255f.entry.js.map +1 -0
- package/dist/cura/p-ca054b07.system.entry.js +2 -0
- package/dist/cura/p-ca054b07.system.entry.js.map +1 -0
- package/dist/cura/p-d47b9cfe.system.entry.js +2 -0
- package/dist/cura/p-d47b9cfe.system.entry.js.map +1 -0
- package/dist/cura/p-f8fffdc1.js +2 -0
- package/dist/cura/p-f8fffdc1.js.map +1 -0
- package/dist/cura/p-fc77814b.system.entry.js +2 -0
- package/dist/cura/p-fc77814b.system.entry.js.map +1 -0
- package/dist/esm/{app-globals-cc003eaf.js → app-globals-29001758.js} +5 -5
- package/dist/esm/app-globals-29001758.js.map +1 -0
- package/dist/esm/cura-accordion_8.entry.js +441 -0
- package/dist/esm/cura-accordion_8.entry.js.map +1 -0
- package/dist/esm/cura-button-outline.entry.js +79 -0
- package/dist/esm/cura-button-outline.entry.js.map +1 -0
- package/dist/esm/cura-button-transparent.entry.js +79 -0
- package/dist/esm/cura-button-transparent.entry.js.map +1 -0
- package/dist/esm/cura-display.entry.js +70 -0
- package/dist/esm/cura-display.entry.js.map +1 -0
- package/dist/esm/cura-icons-view.entry.js +25 -0
- package/dist/esm/cura-icons-view.entry.js.map +1 -0
- package/dist/esm/cura-label.entry.js +65 -0
- package/dist/esm/cura-label.entry.js.map +1 -0
- package/dist/esm/cura.js +2 -2
- package/dist/esm/index.js +4 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/loader.js +2 -2
- package/dist/esm-es5/app-globals-29001758.js +2 -0
- package/dist/esm-es5/app-globals-29001758.js.map +1 -0
- package/dist/esm-es5/cura-accordion_8.entry.js +2 -0
- package/dist/esm-es5/cura-accordion_8.entry.js.map +1 -0
- package/dist/esm-es5/cura-button-outline.entry.js +2 -0
- package/dist/esm-es5/cura-button-outline.entry.js.map +1 -0
- package/dist/esm-es5/cura-button-transparent.entry.js +2 -0
- package/dist/esm-es5/cura-button-transparent.entry.js.map +1 -0
- package/dist/esm-es5/cura-display.entry.js +2 -0
- package/dist/esm-es5/cura-display.entry.js.map +1 -0
- package/dist/esm-es5/cura-icons-view.entry.js +2 -0
- package/dist/esm-es5/cura-icons-view.entry.js.map +1 -0
- package/dist/esm-es5/cura-label.entry.js +2 -0
- package/dist/esm-es5/cura-label.entry.js.map +1 -0
- package/dist/esm-es5/cura.js +1 -1
- package/dist/esm-es5/cura.js.map +1 -1
- package/dist/esm-es5/index.js +1 -1
- package/dist/esm-es5/index.js.map +1 -1
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/loader.js.map +1 -1
- package/dist/types/api/cura-api.type.d.ts +1 -0
- package/dist/types/components/forms/cura-label/cura-label.d.ts +54 -0
- package/dist/types/components/forms/cura-label/cura-label.stories.d.ts +126 -0
- package/dist/types/components/text/cura-display/cura-display.d.ts +29 -18
- package/dist/types/components/text/cura-display/cura-display.stories.d.ts +52 -14
- package/dist/types/components/text/cura-heading/cura-heading.d.ts +34 -17
- package/dist/types/components/text/cura-heading/cura-heading.stories.d.ts +58 -6
- package/dist/types/components/text/cura-paragraph/cura-paragraph.d.ts +24 -12
- package/dist/types/components/text/cura-paragraph/cura-paragraph.stories.d.ts +47 -9
- package/dist/types/components.d.ts +139 -46
- package/dist/types/index.d.ts +9 -0
- package/package.json +2 -4
- package/dist/cjs/app-globals-0e3b7fc6.js.map +0 -1
- package/dist/cjs/cura-accordion_12.cjs.entry.js +0 -674
- package/dist/cjs/cura-accordion_12.cjs.entry.js.map +0 -1
- package/dist/cura/p-319699df.entry.js +0 -2
- package/dist/cura/p-319699df.entry.js.map +0 -1
- package/dist/cura/p-50ea2036.system.js +0 -2
- package/dist/cura/p-50ea2036.system.js.map +0 -1
- package/dist/cura/p-5250cb43.system.js +0 -2
- package/dist/cura/p-5250cb43.system.js.map +0 -1
- package/dist/cura/p-5cc3c8bd.system.entry.js +0 -2
- package/dist/cura/p-5cc3c8bd.system.entry.js.map +0 -1
- package/dist/cura/p-788e035b.system.js +0 -2
- package/dist/cura/p-788e035b.system.js.map +0 -1
- package/dist/cura/p-d5c64a5f.js +0 -2
- package/dist/cura/p-d5c64a5f.js.map +0 -1
- package/dist/esm/app-globals-cc003eaf.js.map +0 -1
- package/dist/esm/cura-accordion_12.entry.js +0 -659
- package/dist/esm/cura-accordion_12.entry.js.map +0 -1
- package/dist/esm-es5/app-globals-cc003eaf.js +0 -2
- package/dist/esm-es5/app-globals-cc003eaf.js.map +0 -1
- package/dist/esm-es5/cura-accordion_12.entry.js +0 -2
- package/dist/esm-es5/cura-accordion_12.entry.js.map +0 -1
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
import { Host, h } from '@stencil/core';
|
|
2
|
+
export class CuraLabel {
|
|
3
|
+
constructor() {
|
|
4
|
+
this.theme = window.CuraAPI.theme;
|
|
5
|
+
this.size = 'medium';
|
|
6
|
+
this.weight = 'regular';
|
|
7
|
+
this.spotColor = 'accent-dark';
|
|
8
|
+
this.color = undefined;
|
|
9
|
+
this.marginBlock = '0';
|
|
10
|
+
this.lineHeight = '125%';
|
|
11
|
+
this.styles = {};
|
|
12
|
+
}
|
|
13
|
+
handleChangeColor() {
|
|
14
|
+
this.setColors();
|
|
15
|
+
}
|
|
16
|
+
connectedCallback() {
|
|
17
|
+
this.setFontProperties();
|
|
18
|
+
this.setColors();
|
|
19
|
+
}
|
|
20
|
+
getClasses() {
|
|
21
|
+
const sizeclass = {};
|
|
22
|
+
sizeclass[this.size.toLowerCase()] = true;
|
|
23
|
+
sizeclass[`${this.weight.toLowerCase()}-weight`] = true;
|
|
24
|
+
return sizeclass;
|
|
25
|
+
}
|
|
26
|
+
setFontProperties() {
|
|
27
|
+
this.weights = this.theme.fonts.getWeights();
|
|
28
|
+
this.fontSizeBase = this.theme.fonts.getSize();
|
|
29
|
+
this.styles = {
|
|
30
|
+
'--font-family': this.theme.fonts.getFamily('body'),
|
|
31
|
+
'--font-weight-medium': this.weights.medium,
|
|
32
|
+
'--font-weight-bold': this.weights.bold
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
setColors() {
|
|
36
|
+
const fontColor = this.color
|
|
37
|
+
? this.theme.colors.getColor(this.color)
|
|
38
|
+
: this.theme.fonts.getColor();
|
|
39
|
+
this.styles = Object.assign(Object.assign({}, this.styles), { '--color-body': fontColor || this.theme.colors.getColor('neutral-darker'), '--color-link': this.theme.colors.getColor(`${this.spotColor}`) });
|
|
40
|
+
}
|
|
41
|
+
hostCSSProperties() {
|
|
42
|
+
return {
|
|
43
|
+
'--margin-block': this.marginBlock,
|
|
44
|
+
'--font-size-base': this.fontSizeBase,
|
|
45
|
+
'--line-height': this.lineHeight
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
render() {
|
|
49
|
+
return (h(Host, { style: this.hostCSSProperties() }, h("p", { style: this.styles, class: this.getClasses() }, h("slot", null))));
|
|
50
|
+
}
|
|
51
|
+
static get is() { return "cura-label"; }
|
|
52
|
+
static get encapsulation() { return "shadow"; }
|
|
53
|
+
static get originalStyleUrls() {
|
|
54
|
+
return {
|
|
55
|
+
"$": ["cura-label.scss"]
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
static get styleUrls() {
|
|
59
|
+
return {
|
|
60
|
+
"$": ["cura-label.css"]
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
static get properties() {
|
|
64
|
+
return {
|
|
65
|
+
"size": {
|
|
66
|
+
"type": "string",
|
|
67
|
+
"mutable": false,
|
|
68
|
+
"complexType": {
|
|
69
|
+
"original": "'medium' | 'large' | 'small' | 'xsmall'",
|
|
70
|
+
"resolved": "\"large\" | \"medium\" | \"small\" | \"xsmall\"",
|
|
71
|
+
"references": {}
|
|
72
|
+
},
|
|
73
|
+
"required": false,
|
|
74
|
+
"optional": false,
|
|
75
|
+
"docs": {
|
|
76
|
+
"tags": [],
|
|
77
|
+
"text": "Set size of body text.\nValues: medium (default) | large | small | xsmall."
|
|
78
|
+
},
|
|
79
|
+
"attribute": "size",
|
|
80
|
+
"reflect": true,
|
|
81
|
+
"defaultValue": "'medium'"
|
|
82
|
+
},
|
|
83
|
+
"weight": {
|
|
84
|
+
"type": "string",
|
|
85
|
+
"mutable": false,
|
|
86
|
+
"complexType": {
|
|
87
|
+
"original": "'regular' | 'bold'",
|
|
88
|
+
"resolved": "\"bold\" | \"regular\"",
|
|
89
|
+
"references": {}
|
|
90
|
+
},
|
|
91
|
+
"required": false,
|
|
92
|
+
"optional": false,
|
|
93
|
+
"docs": {
|
|
94
|
+
"tags": [],
|
|
95
|
+
"text": "Label font weight. It is possible to use regular HTML tags like <b> or <strong> as well.\nValues: regular (default) | bold."
|
|
96
|
+
},
|
|
97
|
+
"attribute": "weight",
|
|
98
|
+
"reflect": true,
|
|
99
|
+
"defaultValue": "'regular'"
|
|
100
|
+
},
|
|
101
|
+
"spotColor": {
|
|
102
|
+
"type": "string",
|
|
103
|
+
"mutable": false,
|
|
104
|
+
"complexType": {
|
|
105
|
+
"original": "string",
|
|
106
|
+
"resolved": "string",
|
|
107
|
+
"references": {}
|
|
108
|
+
},
|
|
109
|
+
"required": false,
|
|
110
|
+
"optional": false,
|
|
111
|
+
"docs": {
|
|
112
|
+
"tags": [],
|
|
113
|
+
"text": "Apply design system color to interactive elements like <a> and <abbr> inside the text.\nValues: Color from design system scheme. Default to 'accent-dark'."
|
|
114
|
+
},
|
|
115
|
+
"attribute": "spot-color",
|
|
116
|
+
"reflect": true,
|
|
117
|
+
"defaultValue": "'accent-dark'"
|
|
118
|
+
},
|
|
119
|
+
"color": {
|
|
120
|
+
"type": "string",
|
|
121
|
+
"mutable": false,
|
|
122
|
+
"complexType": {
|
|
123
|
+
"original": "string",
|
|
124
|
+
"resolved": "string",
|
|
125
|
+
"references": {}
|
|
126
|
+
},
|
|
127
|
+
"required": false,
|
|
128
|
+
"optional": false,
|
|
129
|
+
"docs": {
|
|
130
|
+
"tags": [],
|
|
131
|
+
"text": "Text color.\nValues: Color from design system scheme. Default to the font color from the theme."
|
|
132
|
+
},
|
|
133
|
+
"attribute": "color",
|
|
134
|
+
"reflect": false
|
|
135
|
+
},
|
|
136
|
+
"marginBlock": {
|
|
137
|
+
"type": "string",
|
|
138
|
+
"mutable": false,
|
|
139
|
+
"complexType": {
|
|
140
|
+
"original": "string",
|
|
141
|
+
"resolved": "string",
|
|
142
|
+
"references": {}
|
|
143
|
+
},
|
|
144
|
+
"required": false,
|
|
145
|
+
"optional": false,
|
|
146
|
+
"docs": {
|
|
147
|
+
"tags": [],
|
|
148
|
+
"text": "CSS margin-block property values.\nDefault to 1.25em"
|
|
149
|
+
},
|
|
150
|
+
"attribute": "margin-block",
|
|
151
|
+
"reflect": true,
|
|
152
|
+
"defaultValue": "'0'"
|
|
153
|
+
},
|
|
154
|
+
"lineHeight": {
|
|
155
|
+
"type": "string",
|
|
156
|
+
"mutable": false,
|
|
157
|
+
"complexType": {
|
|
158
|
+
"original": "string",
|
|
159
|
+
"resolved": "string",
|
|
160
|
+
"references": {}
|
|
161
|
+
},
|
|
162
|
+
"required": false,
|
|
163
|
+
"optional": false,
|
|
164
|
+
"docs": {
|
|
165
|
+
"tags": [],
|
|
166
|
+
"text": "CSS line-height property values.\nDefault to 140%"
|
|
167
|
+
},
|
|
168
|
+
"attribute": "line-height",
|
|
169
|
+
"reflect": true,
|
|
170
|
+
"defaultValue": "'125%'"
|
|
171
|
+
}
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
static get states() {
|
|
175
|
+
return {
|
|
176
|
+
"styles": {}
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
static get elementRef() { return "host"; }
|
|
180
|
+
static get watchers() {
|
|
181
|
+
return [{
|
|
182
|
+
"propName": "color",
|
|
183
|
+
"methodName": "handleChangeColor"
|
|
184
|
+
}, {
|
|
185
|
+
"propName": "spotColor",
|
|
186
|
+
"methodName": "handleChangeColor"
|
|
187
|
+
}];
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
//# sourceMappingURL=cura-label.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cura-label.js","sourceRoot":"","sources":["../../../../src/components/forms/cura-label/cura-label.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAOhF,MAAM,OAAO,SAAS;;IAsDpB,UAAK,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC;gBAhD0C,QAAQ;kBAM3B,SAAS;qBAM1B,aAAa;;uBAiBX,GAAG;sBAMJ,MAAM;kBAYxB,EA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,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAC,SAAS,EAAE,CAAC,GAChE,CAAC;EACJ,CAAC;EAED,iBAAiB;IACf,OAAO;MACL,gBAAgB,EAAE,IAAI,CAAC,WAAW;MAClC,kBAAkB,EAAE,IAAI,CAAC,YAAY;MACrC,eAAe,EAAE,IAAI,CAAC,UAAU;KACjC,CAAC;EACJ,CAAC;EAED,MAAM;IACJ,OAAO,CACL,EAAC,IAAI,IAAC,KAAK,EAAE,IAAI,CAAC,iBAAiB,EAAE;MACnC,SAAG,KAAK,EAAE,IAAI,CAAC,MAAM,EAAE,KAAK,EAAE,IAAI,CAAC,UAAU,EAAE;QAC7C,eAAa,CACX,CACC,CACR,CAAC;EACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAEF","sourcesContent":["import { Component, Host, Prop, h, Element, Watch, State } from '@stencil/core';\n\n@Component({\n tag: 'cura-label',\n styleUrl: 'cura-label.scss',\n shadow: true,\n})\nexport class CuraLabel {\n\n /**\n * Set size of body text.\n * Values: medium (default) | large | small | xsmall.\n */\n @Prop({reflect: true}) size: 'medium' | 'large' | 'small' | 'xsmall' = 'medium';\n\n /**\n * Label font weight. It is possible to use regular HTML tags like <b> or <strong> as well.\n * Values: regular (default) | bold.\n */\n @Prop({reflect: true}) weight: 'regular' | 'bold' = 'regular';\n\n /**\n * Apply design system color to interactive elements like <a> and <abbr> inside the text.\n * Values: Color from design system scheme. Default to 'accent-dark'.\n */\n @Prop({reflect: true}) spotColor = 'accent-dark';\n\n /**\n * Text color.\n * Values: Color from design system scheme. Default to the font color from the theme.\n */\n @Prop() color: string;\n @Watch('color')\n @Watch('spotColor')\n handleChangeColor() {\n this.setColors();\n }\n\n /**\n * CSS margin-block property values.\n * Default to 1.25em\n */\n @Prop({reflect: true}) marginBlock = '0';\n\n /**\n * CSS line-height property values.\n * Default to 140%\n */\n @Prop({reflect: true}) lineHeight = '125%';\n\n /**\n * Host element <cura-label>\n */\n @Element() host: HTMLElement;\n\n /**\n * Internal Props\n */\n weights: any;\n fontSizeBase: string;\n @State() styles = {};\n theme = window.CuraAPI.theme;\n\n connectedCallback() {\n this.setFontProperties();\n this.setColors();\n }\n\n getClasses() {\n const sizeclass = {};\n sizeclass[this.size.toLowerCase()] = true;\n sizeclass[`${this.weight.toLowerCase()}-weight`] = true;\n return sizeclass;\n }\n\n setFontProperties() {\n this.weights = this.theme.fonts.getWeights();\n this.fontSizeBase = this.theme.fonts.getSize();\n this.styles = {\n '--font-family': this.theme.fonts.getFamily('body'),\n '--font-weight-medium': this.weights.medium,\n '--font-weight-bold': this.weights.bold\n };\n }\n\n setColors() {\n const fontColor = this.color\n ? this.theme.colors.getColor(this.color)\n : this.theme.fonts.getColor();\n this.styles = {\n ...this.styles,\n '--color-body': fontColor || this.theme.colors.getColor('neutral-darker'),\n '--color-link': this.theme.colors.getColor(`${this.spotColor}`)\n };\n }\n\n hostCSSProperties() {\n return {\n '--margin-block': this.marginBlock,\n '--font-size-base': this.fontSizeBase,\n '--line-height': this.lineHeight\n };\n }\n\n render() {\n return (\n <Host style={this.hostCSSProperties()}>\n <p style={this.styles} class={this.getClasses()}>\n <slot></slot>\n </p>\n </Host>\n );\n }\n\n}\n"]}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s)
|
|
4
|
+
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
import { getColorsWithDepths } from "../../../utils/utils";
|
|
14
|
+
const colors = getColorsWithDepths();
|
|
15
|
+
const renderCuraLabel = (label, args) => {
|
|
16
|
+
const styles = args.cssMarginBlock || args.cssLineHeight ? `<style>
|
|
17
|
+
cura-heading { ${args.cssMarginBlock ? `
|
|
18
|
+
--margin-block: ${args.cssMarginBlock} !important;` : ``}${args.cssLineHeight ? `
|
|
19
|
+
--line-height: ${args.cssLineHeight} !important;` : ``}
|
|
20
|
+
}
|
|
21
|
+
</style>
|
|
22
|
+
|
|
23
|
+
` : '';
|
|
24
|
+
const block = `<cura-label${args.size && (args.size !== 'medium' && args.size !== 'regular') ? `
|
|
25
|
+
size="${args.size}"` : ``}${args.weight ? `
|
|
26
|
+
weight="${args.weight}"` : ''}${args.color ? `
|
|
27
|
+
color="${args.color}"` : ''}${args.spotColor ? `
|
|
28
|
+
spot-color="${args.spotColor}"` : ''}${args.marginBlock ? `
|
|
29
|
+
margin-block="${args.marginBlock}"` : ''}${args.lineHeight ? `
|
|
30
|
+
line-height="${args.lineHeight}"` : ''}>
|
|
31
|
+
${label}
|
|
32
|
+
</cura-label>
|
|
33
|
+
`;
|
|
34
|
+
return `${styles}${block}${block}${block}`;
|
|
35
|
+
};
|
|
36
|
+
export default {
|
|
37
|
+
title: 'Componentes/Forms/Label',
|
|
38
|
+
tags: ['autodocs'],
|
|
39
|
+
render: (_a) => {
|
|
40
|
+
var { label } = _a, args = __rest(_a, ["label"]);
|
|
41
|
+
return renderCuraLabel(label, args);
|
|
42
|
+
},
|
|
43
|
+
argTypes: {
|
|
44
|
+
label: {
|
|
45
|
+
control: 'text',
|
|
46
|
+
description: 'Define o texto do componente diretamente. Aceita tags HTML <i>Phrasing Content</i>.',
|
|
47
|
+
name: 'Content'
|
|
48
|
+
},
|
|
49
|
+
size: {
|
|
50
|
+
control: { type: 'select' },
|
|
51
|
+
options: ['xsmall', 'small', 'medium', 'large'],
|
|
52
|
+
description: 'Define o tamanho do bloco de texto considerando `xsmall`, `small`, `medium` (default) e `large` como valores válidos.',
|
|
53
|
+
table: {
|
|
54
|
+
category: 'Properties',
|
|
55
|
+
defaultValue: { summary: 'medium' }
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
weight: {
|
|
59
|
+
control: { type: 'inline-radio' },
|
|
60
|
+
options: ['regular', 'bold'],
|
|
61
|
+
description: 'Espessura de fonte `regular` (default) ou `bold` para todo o texto. É possível aplicar parcialmente utilizando as tags `<b>` e `<strong>`.',
|
|
62
|
+
table: {
|
|
63
|
+
category: 'Properties',
|
|
64
|
+
defaultValue: { summary: 'regular' }
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
color: {
|
|
68
|
+
control: { type: 'select' },
|
|
69
|
+
options: ['', ...colors],
|
|
70
|
+
description: 'Define a cor de texto do bloco. Aceita qualquer valor do esquema de cores do design system.',
|
|
71
|
+
table: {
|
|
72
|
+
category: 'Properties',
|
|
73
|
+
defaultValue: { summary: 'Cor de texto padrão do tema' }
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
spotColor: {
|
|
77
|
+
control: { type: 'select' },
|
|
78
|
+
options: ['', ...colors],
|
|
79
|
+
description: 'Define a cor dos itens de interação dentro do bloco de texto como as tags `<a>`. Aceita qualquer valor do esquema de cores do design system.',
|
|
80
|
+
name: 'spot-color',
|
|
81
|
+
table: {
|
|
82
|
+
category: 'Properties',
|
|
83
|
+
defaultValue: { summary: 'accent-dark' }
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
marginBlock: {
|
|
87
|
+
control: 'text',
|
|
88
|
+
description: 'Define o tamanho do espaçamento superior e inferior do bloco. Valores válidos para a propriedade CSS `margin-block`.',
|
|
89
|
+
name: 'margin-block',
|
|
90
|
+
table: {
|
|
91
|
+
category: 'Properties',
|
|
92
|
+
defaultValue: { summary: '0' }
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
lineHeight: {
|
|
96
|
+
control: 'text',
|
|
97
|
+
description: 'Define a altura de linha base a ser considerada pelo componente em sua responsividade. Valores válidos para a propriedade CSS `line-height`.',
|
|
98
|
+
name: 'line-height',
|
|
99
|
+
table: {
|
|
100
|
+
category: 'Properties',
|
|
101
|
+
defaultValue: { summary: '125%' }
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
cssMarginBlock: {
|
|
105
|
+
control: 'text',
|
|
106
|
+
description: 'Permite a definição da propriedade `margin-block` por folhas de estilo. É necessário o uso do `!important` conforme o exemplo de código.',
|
|
107
|
+
name: '--margin-block',
|
|
108
|
+
table: {
|
|
109
|
+
category: 'CSS Properties',
|
|
110
|
+
defaultValue: { summary: '0' }
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
cssLineHeight: {
|
|
114
|
+
control: 'text',
|
|
115
|
+
description: 'Permite a definição da propriedade `line-height` por folhas de estilo. É necessário o uso do `!important` conforme o exemplo de código.',
|
|
116
|
+
name: '--line-height',
|
|
117
|
+
table: {
|
|
118
|
+
category: 'CSS Properties',
|
|
119
|
+
defaultValue: { summary: '125%' }
|
|
120
|
+
}
|
|
121
|
+
},
|
|
122
|
+
},
|
|
123
|
+
};
|
|
124
|
+
export const Label = {
|
|
125
|
+
args: {
|
|
126
|
+
label: 'Dolor sit consectetur <a href="https://www.rededorsaoluiz.com.br" target="_blank">adipiscing</a> elit.',
|
|
127
|
+
size: 'medium',
|
|
128
|
+
weight: '',
|
|
129
|
+
color: '',
|
|
130
|
+
spotColor: '',
|
|
131
|
+
marginBlock: '',
|
|
132
|
+
lineHeight: '',
|
|
133
|
+
cssMarginBlock: '',
|
|
134
|
+
cssLineHeight: ''
|
|
135
|
+
},
|
|
136
|
+
};
|
|
137
|
+
//# sourceMappingURL=cura-label.stories.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cura-label.stories.js","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E;IACT,SAAS,EAAE,EAAE;IACb,WAAW,EAAE,EAAE;IACf,UAAU,EAAE,EAAE;IACd,cAAc,EAAE,EAAE;IAClB,aAAa,EAAE,EAAE;GAClB;CACF,CAAC","sourcesContent":["import { getColorsWithDepths } from \"../../../utils/utils\";\n\nconst colors = getColorsWithDepths();\n\nconst renderCuraLabel = (label: string, args: any) => {\n const styles = args.cssMarginBlock || args.cssLineHeight ? `<style>\n cura-heading { ${args.cssMarginBlock ? `\n --margin-block: ${args.cssMarginBlock} !important;` : ``}${ args.cssLineHeight ? `\n --line-height: ${args.cssLineHeight} !important;` : ``}\n }\n</style>\n\n` : '';\n const block = `<cura-label${args.size && (args.size !== 'medium' && args.size !== 'regular') ? `\n size=\"${args.size}\"` : ``}${args.weight ? `\n weight=\"${args.weight}\"` : ''}${args.color ? `\n color=\"${args.color}\"` : ''}${args.spotColor ? `\n spot-color=\"${args.spotColor}\"` : ''}${args.marginBlock ? `\n margin-block=\"${args.marginBlock}\"` : ''}${args.lineHeight ? `\n line-height=\"${args.lineHeight}\"` : ''}>\n ${label}\n</cura-label>\n`;\n return `${styles}${block}${block}${block}`;\n}\n\nexport default {\n title: 'Componentes/Forms/Label',\n tags: ['autodocs'],\n render: ({ label, ...args }) => {\n return renderCuraLabel(label, args);\n },\n argTypes: {\n label: {\n control: 'text',\n description: 'Define o texto do componente diretamente. Aceita tags HTML <i>Phrasing Content</i>.',\n name: 'Content'\n },\n size: {\n control: { type: 'select' },\n options: ['xsmall', 'small', 'medium', 'large'],\n description: 'Define o tamanho do bloco de texto considerando `xsmall`, `small`, `medium` (default) e `large` como valores válidos.',\n table: {\n category: 'Properties',\n defaultValue: { summary: 'medium'}\n }\n },\n weight: {\n control: { type: 'inline-radio' },\n options: ['regular', 'bold'],\n description: 'Espessura de fonte `regular` (default) ou `bold` para todo o texto. É possível aplicar parcialmente utilizando as tags `<b>` e `<strong>`.',\n table: {\n category: 'Properties',\n defaultValue: { summary: 'regular'}\n }\n },\n color: {\n control: { type: 'select' },\n options: ['', ...colors],\n description: 'Define a cor de texto do bloco. Aceita qualquer valor do esquema de cores do design system.',\n table: {\n category: 'Properties',\n defaultValue: { summary: 'Cor de texto padrão do tema'}\n }\n },\n spotColor: {\n control: { type: 'select' },\n options: ['', ...colors],\n description: 'Define a cor dos itens de interação dentro do bloco de texto como as tags `<a>`. Aceita qualquer valor do esquema de cores do design system.',\n name: 'spot-color',\n table: {\n category: 'Properties',\n defaultValue: { summary: 'accent-dark'}\n }\n },\n marginBlock: {\n control: 'text',\n description: 'Define o tamanho do espaçamento superior e inferior do bloco. Valores válidos para a propriedade CSS `margin-block`.',\n name: 'margin-block',\n table: {\n category: 'Properties',\n defaultValue: { summary: '0'}\n }\n },\n lineHeight: {\n control: 'text',\n description: 'Define a altura de linha base a ser considerada pelo componente em sua responsividade. Valores válidos para a propriedade CSS `line-height`.',\n name: 'line-height',\n table: {\n category: 'Properties',\n defaultValue: { summary: '125%'}\n }\n },\n cssMarginBlock: {\n control: 'text',\n description: 'Permite a definição da propriedade `margin-block` por folhas de estilo. É necessário o uso do `!important` conforme o exemplo de código.',\n name: '--margin-block',\n table: {\n category: 'CSS Properties',\n defaultValue: { summary: '0'}\n }\n },\n cssLineHeight: {\n control: 'text',\n description: 'Permite a definição da propriedade `line-height` por folhas de estilo. É necessário o uso do `!important` conforme o exemplo de código.',\n name: '--line-height',\n table: {\n category: 'CSS Properties',\n defaultValue: { summary: '125%'}\n }\n },\n },\n};\n\nexport const Label = {\n args: {\n label: 'Dolor sit consectetur <a href=\"https://www.rededorsaoluiz.com.br\" target=\"_blank\">adipiscing</a> elit.',\n size: 'medium',\n weight: '',\n color: '',\n spotColor: '',\n marginBlock: '',\n lineHeight: '',\n cssMarginBlock: '',\n cssLineHeight: ''\n },\n};\n"]}
|
|
@@ -11,59 +11,40 @@
|
|
|
11
11
|
* Responsive media for large only.
|
|
12
12
|
* Use: @include large-only() { ... }
|
|
13
13
|
*/
|
|
14
|
-
/**
|
|
15
|
-
* Responsive media for large and up.
|
|
16
|
-
* Use: @include large-up() { ... }
|
|
17
|
-
*/
|
|
18
14
|
/**
|
|
19
15
|
* Responsive media for xlarge only.
|
|
20
16
|
* Use: @include xlarge-only() { ... }
|
|
21
17
|
*/
|
|
18
|
+
/**
|
|
19
|
+
* Responsive media for medium to large.
|
|
20
|
+
* Use: @include medium-large() { ... }
|
|
21
|
+
*/
|
|
22
|
+
/**
|
|
23
|
+
* Responsive media for large and up.
|
|
24
|
+
* Use: @include large-up() { ... }
|
|
25
|
+
*/
|
|
22
26
|
:host {
|
|
23
27
|
display: block;
|
|
24
|
-
font-size: var(--font-size);
|
|
25
|
-
text-transform: uppercase;
|
|
28
|
+
font-size: var(--font-size-base);
|
|
26
29
|
}
|
|
27
30
|
:host h1, :host h2, :host h3, :host h4, :host h5, :host h6 {
|
|
28
31
|
font-family: var(--font-family);
|
|
29
|
-
font-size: 4.285em;
|
|
30
|
-
font-weight: var(--font-weight-black);
|
|
31
|
-
color: var(--color-body);
|
|
32
|
-
line-height: 120%;
|
|
33
|
-
letter-spacing: -4%;
|
|
34
|
-
margin-block-start: var(--block-margin);
|
|
35
|
-
margin-block-end: var(--block-margin);
|
|
36
|
-
}
|
|
37
|
-
:host h1.large, :host h2.large, :host h3.large, :host h4.large, :host h5.large, :host h6.large {
|
|
38
|
-
font-size: 6.21em;
|
|
39
|
-
}
|
|
40
|
-
:host h1.small, :host h2.small, :host h3.small, :host h4.small, :host h5.small, :host h6.small {
|
|
41
32
|
font-size: 3em;
|
|
42
33
|
font-weight: var(--font-weight-bold);
|
|
34
|
+
color: var(--color-body);
|
|
35
|
+
line-height: var(--line-height);
|
|
36
|
+
margin-block: var(--margin-block);
|
|
37
|
+
letter-spacing: 0px;
|
|
43
38
|
}
|
|
44
|
-
@media (min-width:
|
|
39
|
+
@media (min-width: 769px) and (max-width: 1920px) {
|
|
45
40
|
:host h1, :host h2, :host h3, :host h4, :host h5, :host h6 {
|
|
46
|
-
font-size:
|
|
47
|
-
}
|
|
48
|
-
:host h1.large, :host h2.large, :host h3.large, :host h4.large, :host h5.large, :host h6.large {
|
|
49
|
-
font-size: 7.07em;
|
|
50
|
-
}
|
|
51
|
-
:host h1.small, :host h2.small, :host h3.small, :host h4.small, :host h5.small, :host h6.small {
|
|
52
|
-
font-size: 3.428em;
|
|
41
|
+
font-size: 3.429em;
|
|
53
42
|
}
|
|
54
43
|
}
|
|
55
|
-
@media (min-width:
|
|
44
|
+
@media (min-width: 1921px) {
|
|
56
45
|
:host h1, :host h2, :host h3, :host h4, :host h5, :host h6 {
|
|
57
|
-
font-size:
|
|
58
|
-
line-height:
|
|
59
|
-
}
|
|
60
|
-
:host h1.large, :host h2.large, :host h3.large, :host h4.large, :host h5.large, :host h6.large {
|
|
61
|
-
font-size: 8.857em;
|
|
62
|
-
letter-spacing: -6%;
|
|
63
|
-
}
|
|
64
|
-
:host h1.small, :host h2.small, :host h3.small, :host h4.small, :host h5.small, :host h6.small {
|
|
65
|
-
font-size: 4.285em;
|
|
66
|
-
letter-spacing: -2%;
|
|
46
|
+
font-size: 4.286em;
|
|
47
|
+
line-height: calc(var(--line-height) + 5%);
|
|
67
48
|
}
|
|
68
49
|
}
|
|
69
50
|
:host ::slotted(b), :host ::slotted(strong) {
|
|
@@ -72,10 +53,12 @@
|
|
|
72
53
|
:host ::slotted(a) {
|
|
73
54
|
font-weight: var(--font-weight-bold);
|
|
74
55
|
color: var(--color-link);
|
|
75
|
-
text-decoration: none;
|
|
76
56
|
text-underline-offset: 10%;
|
|
77
57
|
cursor: pointer;
|
|
78
58
|
}
|
|
59
|
+
:host ::slotted(u) {
|
|
60
|
+
text-underline-offset: 10%;
|
|
61
|
+
}
|
|
79
62
|
:host ::slotted(abbr) {
|
|
80
63
|
color: var(--color-link);
|
|
81
64
|
text-decoration: underline dashed 1px var(--color-link);
|
|
@@ -1,57 +1,57 @@
|
|
|
1
1
|
import { Host, h } from '@stencil/core';
|
|
2
2
|
export class CuraDisplay {
|
|
3
3
|
constructor() {
|
|
4
|
+
this.theme = window.CuraAPI.theme;
|
|
4
5
|
this.level = 1;
|
|
5
|
-
this.
|
|
6
|
-
this.
|
|
7
|
-
this.
|
|
6
|
+
this.spotColor = 'accent-dark';
|
|
7
|
+
this.color = undefined;
|
|
8
|
+
this.marginBlock = '1.25em';
|
|
9
|
+
this.lineHeight = '120%';
|
|
10
|
+
this.styles = {};
|
|
11
|
+
}
|
|
12
|
+
handleChangeColor() {
|
|
13
|
+
this.setColors();
|
|
8
14
|
}
|
|
9
15
|
connectedCallback() {
|
|
10
|
-
this.weights = window.CuraAPI.theme.fonts.getWeights();
|
|
11
16
|
this.setFontProperties();
|
|
12
17
|
this.setColors();
|
|
13
18
|
}
|
|
14
|
-
getClasses() {
|
|
15
|
-
const classes = {};
|
|
16
|
-
classes[this.size.toLowerCase()] = true;
|
|
17
|
-
return classes;
|
|
18
|
-
}
|
|
19
19
|
setFontProperties() {
|
|
20
|
+
this.weights = this.theme.fonts.getWeights();
|
|
21
|
+
this.fontSizeBase = this.theme.fonts.getSize();
|
|
20
22
|
this.styles = {
|
|
21
23
|
'--font-family': window.CuraAPI.theme.fonts.getFamily('display'),
|
|
22
24
|
'--font-size': window.CuraAPI.theme.fonts.getSize(),
|
|
23
|
-
'--font-weight-bold': this.weights.bold
|
|
24
|
-
'--font-weight-black': this.weights.black
|
|
25
|
+
'--font-weight-bold': this.weights.bold
|
|
25
26
|
};
|
|
26
|
-
this.setHostProperty('--font-size', window.CuraAPI.theme.fonts.getSize());
|
|
27
|
-
this.setHostProperty('--block-margin', '0.5em');
|
|
28
27
|
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
:
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
? window.CuraAPI.theme.colors.getColor(`${this.spotColor}-lighter`)
|
|
36
|
-
: window.CuraAPI.theme.colors.getColor(`${this.spotColor}-dark`);
|
|
28
|
+
hostCSSProperties() {
|
|
29
|
+
return {
|
|
30
|
+
'--margin-block': this.marginBlock,
|
|
31
|
+
'--font-size-base': this.fontSizeBase,
|
|
32
|
+
'--line-height': this.lineHeight
|
|
33
|
+
};
|
|
37
34
|
}
|
|
38
|
-
|
|
39
|
-
this.
|
|
35
|
+
setColors() {
|
|
36
|
+
const fontColor = this.color
|
|
37
|
+
? this.theme.colors.getColor(this.color)
|
|
38
|
+
: this.theme.fonts.getColor();
|
|
39
|
+
this.styles = Object.assign(Object.assign({}, this.styles), { '--color-body': fontColor || this.theme.colors.getColor('neutral-darker'), '--color-link': this.theme.colors.getColor(`${this.spotColor}`) });
|
|
40
40
|
}
|
|
41
41
|
getHeadingTag() {
|
|
42
42
|
const tags = {
|
|
43
|
-
'1': h("h1", { style: this.styles
|
|
44
|
-
'2': h("h2", { style: this.styles
|
|
45
|
-
'3': h("h3", { style: this.styles
|
|
46
|
-
'4': h("h4", { style: this.styles
|
|
47
|
-
'5': h("h5", { style: this.styles
|
|
48
|
-
'6': h("h6", { style: this.styles
|
|
49
|
-
'default': h("h1", { style: this.styles
|
|
43
|
+
'1': h("h1", { style: this.styles }, h("slot", null)),
|
|
44
|
+
'2': h("h2", { style: this.styles }, h("slot", null)),
|
|
45
|
+
'3': h("h3", { style: this.styles }, h("slot", null)),
|
|
46
|
+
'4': h("h4", { style: this.styles }, h("slot", null)),
|
|
47
|
+
'5': h("h5", { style: this.styles }, h("slot", null)),
|
|
48
|
+
'6': h("h6", { style: this.styles }, h("slot", null)),
|
|
49
|
+
'default': h("h1", { style: this.styles }, h("slot", null))
|
|
50
50
|
};
|
|
51
51
|
return tags[`${this.level}`] || tags['default'];
|
|
52
52
|
}
|
|
53
53
|
render() {
|
|
54
|
-
return (h(Host,
|
|
54
|
+
return (h(Host, { style: this.hostCSSProperties() }, this.getHeadingTag()));
|
|
55
55
|
}
|
|
56
56
|
static get is() { return "cura-display"; }
|
|
57
57
|
static get encapsulation() { return "shadow"; }
|
|
@@ -71,21 +71,21 @@ export class CuraDisplay {
|
|
|
71
71
|
"type": "number",
|
|
72
72
|
"mutable": false,
|
|
73
73
|
"complexType": {
|
|
74
|
-
"original": "
|
|
75
|
-
"resolved": "
|
|
74
|
+
"original": "1 | 2 | 3 | 4 | 5 | 6",
|
|
75
|
+
"resolved": "1 | 2 | 3 | 4 | 5 | 6",
|
|
76
76
|
"references": {}
|
|
77
77
|
},
|
|
78
78
|
"required": false,
|
|
79
79
|
"optional": false,
|
|
80
80
|
"docs": {
|
|
81
81
|
"tags": [],
|
|
82
|
-
"text": "Heading level for semantics
|
|
82
|
+
"text": "Heading level for semantics. Will render the related HTML tag <h1>, <h2>, ...\nValues: 1(default) to 6."
|
|
83
83
|
},
|
|
84
84
|
"attribute": "level",
|
|
85
85
|
"reflect": true,
|
|
86
86
|
"defaultValue": "1"
|
|
87
87
|
},
|
|
88
|
-
"
|
|
88
|
+
"spotColor": {
|
|
89
89
|
"type": "string",
|
|
90
90
|
"mutable": false,
|
|
91
91
|
"complexType": {
|
|
@@ -97,31 +97,48 @@ export class CuraDisplay {
|
|
|
97
97
|
"optional": false,
|
|
98
98
|
"docs": {
|
|
99
99
|
"tags": [],
|
|
100
|
-
"text": "
|
|
100
|
+
"text": "Apply design system color to interactive elements like <a> and <abbr> inside the text.\nValues: Color from design system scheme. Default to 'accent-dark'."
|
|
101
101
|
},
|
|
102
|
-
"attribute": "
|
|
102
|
+
"attribute": "spot-color",
|
|
103
103
|
"reflect": true,
|
|
104
|
-
"defaultValue": "'
|
|
104
|
+
"defaultValue": "'accent-dark'"
|
|
105
105
|
},
|
|
106
|
-
"
|
|
107
|
-
"type": "
|
|
106
|
+
"color": {
|
|
107
|
+
"type": "string",
|
|
108
108
|
"mutable": false,
|
|
109
109
|
"complexType": {
|
|
110
|
-
"original": "
|
|
111
|
-
"resolved": "
|
|
110
|
+
"original": "string",
|
|
111
|
+
"resolved": "string",
|
|
112
112
|
"references": {}
|
|
113
113
|
},
|
|
114
114
|
"required": false,
|
|
115
115
|
"optional": false,
|
|
116
116
|
"docs": {
|
|
117
117
|
"tags": [],
|
|
118
|
-
"text": "
|
|
118
|
+
"text": "Text color.\nValues: Color from design system scheme. Default to the font color from the theme."
|
|
119
119
|
},
|
|
120
|
-
"attribute": "
|
|
120
|
+
"attribute": "color",
|
|
121
|
+
"reflect": false
|
|
122
|
+
},
|
|
123
|
+
"marginBlock": {
|
|
124
|
+
"type": "string",
|
|
125
|
+
"mutable": false,
|
|
126
|
+
"complexType": {
|
|
127
|
+
"original": "string",
|
|
128
|
+
"resolved": "string",
|
|
129
|
+
"references": {}
|
|
130
|
+
},
|
|
131
|
+
"required": false,
|
|
132
|
+
"optional": false,
|
|
133
|
+
"docs": {
|
|
134
|
+
"tags": [],
|
|
135
|
+
"text": "CSS margin-block property values.\nDefault to 1.25em"
|
|
136
|
+
},
|
|
137
|
+
"attribute": "margin-block",
|
|
121
138
|
"reflect": true,
|
|
122
|
-
"defaultValue": "
|
|
139
|
+
"defaultValue": "'1.25em'"
|
|
123
140
|
},
|
|
124
|
-
"
|
|
141
|
+
"lineHeight": {
|
|
125
142
|
"type": "string",
|
|
126
143
|
"mutable": false,
|
|
127
144
|
"complexType": {
|
|
@@ -133,14 +150,28 @@ export class CuraDisplay {
|
|
|
133
150
|
"optional": false,
|
|
134
151
|
"docs": {
|
|
135
152
|
"tags": [],
|
|
136
|
-
"text": "
|
|
153
|
+
"text": "CSS line-height property values.\nDefault to 140%"
|
|
137
154
|
},
|
|
138
|
-
"attribute": "
|
|
155
|
+
"attribute": "line-height",
|
|
139
156
|
"reflect": true,
|
|
140
|
-
"defaultValue": "'
|
|
157
|
+
"defaultValue": "'120%'"
|
|
141
158
|
}
|
|
142
159
|
};
|
|
143
160
|
}
|
|
161
|
+
static get states() {
|
|
162
|
+
return {
|
|
163
|
+
"styles": {}
|
|
164
|
+
};
|
|
165
|
+
}
|
|
144
166
|
static get elementRef() { return "host"; }
|
|
167
|
+
static get watchers() {
|
|
168
|
+
return [{
|
|
169
|
+
"propName": "color",
|
|
170
|
+
"methodName": "handleChangeColor"
|
|
171
|
+
}, {
|
|
172
|
+
"propName": "spotColor",
|
|
173
|
+
"methodName": "handleChangeColor"
|
|
174
|
+
}];
|
|
175
|
+
}
|
|
145
176
|
}
|
|
146
177
|
//# sourceMappingURL=cura-display.js.map
|