@momentum-design/components 0.28.6 → 0.28.7
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/browser/index.js +61 -53
- package/dist/browser/index.js.map +3 -3
- package/dist/components/checkbox/checkbox.component.d.ts +1 -0
- package/dist/components/checkbox/checkbox.component.js +9 -5
- package/dist/components/formfieldwrapper/formfieldwrapper.component.d.ts +1 -1
- package/dist/components/formfieldwrapper/formfieldwrapper.component.js +2 -0
- package/dist/components/radio/radio.component.d.ts +1 -0
- package/dist/components/radio/radio.component.js +9 -5
- package/dist/components/toggle/toggle.styles.js +10 -2
- package/dist/custom-elements.json +10 -0
- package/package.json +1 -1
@@ -89,6 +89,7 @@ declare class Checkbox extends Checkbox_base implements AssociatedFormControl {
|
|
89
89
|
*/
|
90
90
|
handleChange(event: Event): void;
|
91
91
|
update(changedProperties: PropertyValues): void;
|
92
|
+
private renderLabelAndHelperText;
|
92
93
|
render(): import("lit-html").TemplateResult<1>;
|
93
94
|
static styles: Array<CSSResult>;
|
94
95
|
}
|
@@ -68,6 +68,14 @@ class Checkbox extends FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper))
|
|
68
68
|
* @default false
|
69
69
|
*/
|
70
70
|
this.autofocus = false;
|
71
|
+
this.renderLabelAndHelperText = () => {
|
72
|
+
if (!this.label)
|
73
|
+
return nothing;
|
74
|
+
return html `<div class="text-container">
|
75
|
+
${this.renderLabel()}
|
76
|
+
${this.renderHelperText()}
|
77
|
+
</div>`;
|
78
|
+
};
|
71
79
|
// Checkbox does not contain helpTextType property.
|
72
80
|
this.helpTextType = undefined;
|
73
81
|
}
|
@@ -166,7 +174,6 @@ class Checkbox extends FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper))
|
|
166
174
|
length-unit="rem"
|
167
175
|
></mdc-icon>
|
168
176
|
` : nothing;
|
169
|
-
const helpTextContent = this.helpText ? this.renderHelperText() : nothing;
|
170
177
|
return html `
|
171
178
|
<div class="container mdc-focus-ring">
|
172
179
|
<input
|
@@ -189,10 +196,7 @@ class Checkbox extends FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper))
|
|
189
196
|
/>
|
190
197
|
<div class="icon-container">${checkboxIconContent}</div>
|
191
198
|
</div>
|
192
|
-
|
193
|
-
${this.renderLabel()}
|
194
|
-
${helpTextContent}
|
195
|
-
</div>
|
199
|
+
${this.renderLabelAndHelperText()}
|
196
200
|
`;
|
197
201
|
}
|
198
202
|
}
|
@@ -61,7 +61,7 @@ declare class FormfieldWrapper extends FormfieldWrapper_base {
|
|
61
61
|
* renders the mdc-label-text container that contains the label and labelInfoToggleTip.
|
62
62
|
* @returns void
|
63
63
|
*/
|
64
|
-
protected renderLabel(): import("lit-html").TemplateResult<1
|
64
|
+
protected renderLabel(): import("lit-html").TemplateResult<1> | typeof nothing;
|
65
65
|
/**
|
66
66
|
* renders the mdc-help-text container that contains the helpertext icon and helpertext.
|
67
67
|
* @returns void
|
@@ -108,6 +108,8 @@ class FormfieldWrapper extends DisabledMixin(Component) {
|
|
108
108
|
* @returns void
|
109
109
|
*/
|
110
110
|
renderLabel() {
|
111
|
+
if (!this.label)
|
112
|
+
return nothing;
|
111
113
|
return html `<div class="mdc-label-text" part="label-text">
|
112
114
|
<slot name="label">${this.renderLabelElement()}</slot>
|
113
115
|
<slot name="required-label">${this.renderRequiredLabel()}</slot>
|
@@ -109,6 +109,7 @@ declare class Radio extends Radio_base implements AssociatedFormControl {
|
|
109
109
|
*/
|
110
110
|
private updateTabIndex;
|
111
111
|
update(changedProperties: PropertyValues): void;
|
112
|
+
private renderLabelAndHelperText;
|
112
113
|
render(): import("lit-html").TemplateResult<1>;
|
113
114
|
static styles: Array<CSSResult>;
|
114
115
|
}
|
@@ -67,6 +67,14 @@ class Radio extends FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper)) {
|
|
67
67
|
* @default false
|
68
68
|
*/
|
69
69
|
this.autofocus = false;
|
70
|
+
this.renderLabelAndHelperText = () => {
|
71
|
+
if (!this.label)
|
72
|
+
return nothing;
|
73
|
+
return html `<div class="mdc-radio__label-container">
|
74
|
+
${this.renderLabel()}
|
75
|
+
${this.renderHelperText()}
|
76
|
+
</div>`;
|
77
|
+
};
|
70
78
|
// Radio does not contain helpTextType property.
|
71
79
|
this.helpTextType = undefined;
|
72
80
|
}
|
@@ -267,7 +275,6 @@ class Radio extends FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper)) {
|
|
267
275
|
}
|
268
276
|
render() {
|
269
277
|
var _a;
|
270
|
-
const helpTextContent = this.helpText ? this.renderHelperText() : nothing;
|
271
278
|
return html `
|
272
279
|
<div class="mdc-radio__container">
|
273
280
|
<div class="mdc-radio__icon-container mdc-focus-ring">
|
@@ -291,10 +298,7 @@ class Radio extends FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper)) {
|
|
291
298
|
/>
|
292
299
|
<span class="mdc-radio__icon"></span>
|
293
300
|
</div>
|
294
|
-
|
295
|
-
${this.renderLabel()}
|
296
|
-
${helpTextContent}
|
297
|
-
</div>
|
301
|
+
${this.renderLabelAndHelperText()}
|
298
302
|
</div>
|
299
303
|
`;
|
300
304
|
}
|
@@ -29,7 +29,9 @@ const styles = [hostFitContentStyles, css `
|
|
29
29
|
--mdc-toggle-icon-color-disabled: var(--mds-color-theme-common-inverted-text-primary-disabled);
|
30
30
|
--mdc-toggle-icon-background-color-normal: var(--mds-color-theme-common-text-primary-normal);
|
31
31
|
--mdc-toggle-icon-background-color-disabled: var(--mds-color-theme-common-text-primary-disabled);
|
32
|
+
}
|
32
33
|
|
34
|
+
:host([label]), :host([help-text]){
|
33
35
|
display: grid;
|
34
36
|
grid-template-rows: auto auto;
|
35
37
|
grid-template-columns: auto auto;
|
@@ -38,6 +40,7 @@ const styles = [hostFitContentStyles, css `
|
|
38
40
|
}
|
39
41
|
|
40
42
|
:host([help-text='']) {
|
43
|
+
grid-template-rows: auto;
|
41
44
|
row-gap: 0rem;
|
42
45
|
}
|
43
46
|
|
@@ -49,9 +52,10 @@ const styles = [hostFitContentStyles, css `
|
|
49
52
|
.mdc-toggle__input {
|
50
53
|
opacity: 0;
|
51
54
|
position: absolute;
|
55
|
+
cursor: pointer;
|
56
|
+
margin: 0;
|
52
57
|
width: var(--mdc-toggle-width);
|
53
58
|
height: var(--mdc-toggle-height);
|
54
|
-
cursor: pointer;
|
55
59
|
}
|
56
60
|
|
57
61
|
.mdc-toggle__slider {
|
@@ -79,7 +83,11 @@ const styles = [hostFitContentStyles, css `
|
|
79
83
|
height: var(--mdc-toggle-height-compact);
|
80
84
|
border-radius: var(--mdc-toggle-border-radius-compact);
|
81
85
|
}
|
82
|
-
|
86
|
+
:host([size='compact']) .mdc-toggle__input {
|
87
|
+
width: var(--mdc-toggle-width-compact);
|
88
|
+
height: var(--mdc-toggle-height-compact);
|
89
|
+
}
|
90
|
+
|
83
91
|
.mdc-toggle__icon {
|
84
92
|
padding: 0.25rem;
|
85
93
|
--mdc-icon-fill-color: var(--mdc-toggle-icon-color-normal);
|
@@ -2739,6 +2739,11 @@
|
|
2739
2739
|
],
|
2740
2740
|
"description": "Toggles the state of the checkbox element.\nand dispatch the new change event."
|
2741
2741
|
},
|
2742
|
+
{
|
2743
|
+
"kind": "field",
|
2744
|
+
"name": "renderLabelAndHelperText",
|
2745
|
+
"privacy": "private"
|
2746
|
+
},
|
2742
2747
|
{
|
2743
2748
|
"kind": "field",
|
2744
2749
|
"name": "helpTextType",
|
@@ -7587,6 +7592,11 @@
|
|
7587
7592
|
},
|
7588
7593
|
"description": "Update tab index for all radios in the same group (name)\nIf any radio group is checked, it will have a tab index of 0\nIf no radio group is checked, the first enabled radio will have a tab index of 0"
|
7589
7594
|
},
|
7595
|
+
{
|
7596
|
+
"kind": "field",
|
7597
|
+
"name": "renderLabelAndHelperText",
|
7598
|
+
"privacy": "private"
|
7599
|
+
},
|
7590
7600
|
{
|
7591
7601
|
"kind": "field",
|
7592
7602
|
"name": "helpTextType",
|
package/package.json
CHANGED