@momentum-design/components 0.85.10 → 0.86.0
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 +23 -23
- package/dist/browser/index.js.map +3 -3
- package/dist/components/menuitemcheckbox/menuitemcheckbox.component.d.ts +1 -1
- package/dist/components/menuitemcheckbox/menuitemcheckbox.component.js +21 -21
- package/dist/components/menuitemradio/index.d.ts +1 -0
- package/dist/components/menuitemradio/index.js +1 -0
- package/dist/components/menuitemradio/menuitemradio.component.d.ts +3 -1
- package/dist/components/menuitemradio/menuitemradio.component.js +16 -14
- package/dist/components/menusection/menusection.component.js +1 -1
- package/dist/custom-elements.json +235 -235
- package/dist/react/index.d.ts +1 -1
- package/dist/react/index.js +1 -1
- package/dist/react/menuitemradio/index.d.ts +2 -0
- package/dist/react/menuitemradio/index.js +2 -0
- package/package.json +1 -1
@@ -62,7 +62,7 @@ declare class MenuItemCheckbox extends MenuItem {
|
|
62
62
|
* If the menuitemcheckbox is disabled, it does nothing.
|
63
63
|
* If the menuitemcheckbox is not disabled, it toggles the `checked` state between `true` and `false`.
|
64
64
|
*/
|
65
|
-
private
|
65
|
+
private handleMouseClick;
|
66
66
|
update(changedProperties: PropertyValues): void;
|
67
67
|
/**
|
68
68
|
* Returns a static checkbox element if the indicator is set to checkbox.
|
@@ -76,14 +76,14 @@ class MenuItemCheckbox extends MenuItem {
|
|
76
76
|
* If the menuitemcheckbox is disabled, it does nothing.
|
77
77
|
* If the menuitemcheckbox is not disabled, it toggles the `checked` state between `true` and `false`.
|
78
78
|
*/
|
79
|
-
this.
|
79
|
+
this.handleMouseClick = (event) => {
|
80
80
|
event.stopPropagation();
|
81
81
|
if (this.disabled)
|
82
82
|
return;
|
83
83
|
this.checked = !this.checked;
|
84
84
|
this.dispatchEvent(new Event('change', { bubbles: true, composed: true }));
|
85
85
|
};
|
86
|
-
this.addEventListener('click', this.
|
86
|
+
this.addEventListener('click', this.handleMouseClick);
|
87
87
|
}
|
88
88
|
connectedCallback() {
|
89
89
|
super.connectedCallback();
|
@@ -101,16 +101,16 @@ class MenuItemCheckbox extends MenuItem {
|
|
101
101
|
* @returns TemplateResult | typeof nothing
|
102
102
|
*/
|
103
103
|
staticCheckbox() {
|
104
|
-
if (this.indicator
|
105
|
-
return
|
104
|
+
if (this.indicator === INDICATOR.CHECKBOX) {
|
105
|
+
return html `
|
106
|
+
<mdc-staticcheckbox
|
107
|
+
slot="leading-controls"
|
108
|
+
?checked="${this.checked}"
|
109
|
+
?disabled="${this.disabled}"
|
110
|
+
></mdc-staticcheckbox>
|
111
|
+
`;
|
106
112
|
}
|
107
|
-
return
|
108
|
-
<mdc-staticcheckbox
|
109
|
-
slot="leading-controls"
|
110
|
-
?checked="${this.checked}"
|
111
|
-
?disabled="${this.disabled}"
|
112
|
-
></mdc-staticcheckbox>
|
113
|
-
`;
|
113
|
+
return nothing;
|
114
114
|
}
|
115
115
|
/**
|
116
116
|
* Returns a static toggle element if the indicator is set to toggle.
|
@@ -120,17 +120,17 @@ class MenuItemCheckbox extends MenuItem {
|
|
120
120
|
* @returns TemplateResult | typeof nothing
|
121
121
|
*/
|
122
122
|
staticToggle() {
|
123
|
-
if (this.indicator
|
124
|
-
return
|
123
|
+
if (this.indicator === INDICATOR.TOGGLE) {
|
124
|
+
return html `
|
125
|
+
<mdc-statictoggle
|
126
|
+
slot="trailing-controls"
|
127
|
+
?checked="${this.checked}"
|
128
|
+
?disabled="${this.disabled}"
|
129
|
+
size="${TOGGLE_SIZE.COMPACT}"
|
130
|
+
></mdc-statictoggle>
|
131
|
+
`;
|
125
132
|
}
|
126
|
-
return
|
127
|
-
<mdc-statictoggle
|
128
|
-
slot="trailing-controls"
|
129
|
-
?checked="${this.checked}"
|
130
|
-
?disabled="${this.disabled}"
|
131
|
-
size="${TOGGLE_SIZE.COMPACT}"
|
132
|
-
></mdc-statictoggle>
|
133
|
-
`;
|
133
|
+
return nothing;
|
134
134
|
}
|
135
135
|
/**
|
136
136
|
* Returns a checkmark icon if the indicator is set to checkmark and the checked state is true.
|
@@ -27,8 +27,10 @@ import { Indicator } from './menuitemradio.types';
|
|
27
27
|
* For example, you can use a custom icon or a different visual element to indicate the state of the menu item.
|
28
28
|
* Make sure the new indicator is accessible.
|
29
29
|
*
|
30
|
+
* @dependency mdc-icon
|
30
31
|
* @dependency mdc-staticradio
|
31
32
|
* @dependency mdc-text
|
33
|
+
* @dependency mdc-tooltip
|
32
34
|
*
|
33
35
|
* @tagname mdc-menuitemradio
|
34
36
|
*
|
@@ -72,7 +74,7 @@ declare class MenuItemRadio extends MenuItem {
|
|
72
74
|
* If the menuitemradio is not checked, it sets its checked state to `true`
|
73
75
|
* and sets all other menuitemradio elements of the same group with checked state to `false`.
|
74
76
|
*/
|
75
|
-
private
|
77
|
+
private handleMouseClick;
|
76
78
|
update(changedProperties: PropertyValues): void;
|
77
79
|
/**
|
78
80
|
* Returns a static checkbox element if the indicator is set to checkbox.
|
@@ -42,8 +42,10 @@ import styles from './menuitemradio.styles';
|
|
42
42
|
* For example, you can use a custom icon or a different visual element to indicate the state of the menu item.
|
43
43
|
* Make sure the new indicator is accessible.
|
44
44
|
*
|
45
|
+
* @dependency mdc-icon
|
45
46
|
* @dependency mdc-staticradio
|
46
47
|
* @dependency mdc-text
|
48
|
+
* @dependency mdc-tooltip
|
47
49
|
*
|
48
50
|
* @tagname mdc-menuitemradio
|
49
51
|
*
|
@@ -77,7 +79,7 @@ class MenuItemRadio extends MenuItem {
|
|
77
79
|
* If the menuitemradio is not checked, it sets its checked state to `true`
|
78
80
|
* and sets all other menuitemradio elements of the same group with checked state to `false`.
|
79
81
|
*/
|
80
|
-
this.
|
82
|
+
this.handleMouseClick = (event) => {
|
81
83
|
event.stopPropagation();
|
82
84
|
if (this.disabled || this.checked)
|
83
85
|
return;
|
@@ -85,7 +87,7 @@ class MenuItemRadio extends MenuItem {
|
|
85
87
|
this.checked = true;
|
86
88
|
this.dispatchEvent(new Event('change', { bubbles: true, composed: true }));
|
87
89
|
};
|
88
|
-
this.addEventListener('click', this.
|
90
|
+
this.addEventListener('click', this.handleMouseClick);
|
89
91
|
}
|
90
92
|
connectedCallback() {
|
91
93
|
super.connectedCallback();
|
@@ -108,9 +110,9 @@ class MenuItemRadio extends MenuItem {
|
|
108
110
|
updateOtherRadiosCheckedState() {
|
109
111
|
const radios = this.getAllRadiosWithinSameGroup();
|
110
112
|
radios.forEach(radio => {
|
111
|
-
|
112
|
-
|
113
|
-
|
113
|
+
if (radio !== this) {
|
114
|
+
radio.removeAttribute('checked');
|
115
|
+
}
|
114
116
|
});
|
115
117
|
}
|
116
118
|
update(changedProperties) {
|
@@ -128,16 +130,16 @@ class MenuItemRadio extends MenuItem {
|
|
128
130
|
* @returns TemplateResult | typeof nothing
|
129
131
|
*/
|
130
132
|
renderStaticRadio() {
|
131
|
-
if (this.indicator
|
132
|
-
return
|
133
|
+
if (this.indicator === INDICATOR.RADIO) {
|
134
|
+
return html `
|
135
|
+
<mdc-staticradio
|
136
|
+
slot="leading-controls"
|
137
|
+
?checked="${this.checked}"
|
138
|
+
?disabled="${this.disabled}"
|
139
|
+
></mdc-staticradio>
|
140
|
+
`;
|
133
141
|
}
|
134
|
-
return
|
135
|
-
<mdc-staticradio
|
136
|
-
slot="leading-controls"
|
137
|
-
?checked="${this.checked}"
|
138
|
-
?disabled="${this.disabled}"
|
139
|
-
></mdc-staticradio>
|
140
|
-
`;
|
142
|
+
return nothing;
|
141
143
|
}
|
142
144
|
/**
|
143
145
|
* Returns a checkmark icon if the indicator is set to checkmark and the checked state is true.
|
@@ -75,7 +75,7 @@ __decorate([
|
|
75
75
|
__metadata("design:type", Object)
|
76
76
|
], MenuSection.prototype, "ariaLabel", void 0);
|
77
77
|
__decorate([
|
78
|
-
property({ type: String, reflect: true }),
|
78
|
+
property({ type: String, reflect: true, attribute: 'header-text' }),
|
79
79
|
__metadata("design:type", Object)
|
80
80
|
], MenuSection.prototype, "headerText", void 0);
|
81
81
|
export default MenuSection;
|