@momentum-design/components 0.122.12 → 0.122.14
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 +35 -21
- package/dist/browser/index.js.map +4 -4
- package/dist/components/alertchip/alertchip.component.d.ts +2 -1
- package/dist/components/alertchip/alertchip.component.js +3 -2
- package/dist/components/alertchip/alertchip.styles.js +4 -0
- package/dist/components/chip/chip.component.js +1 -1
- package/dist/components/menuitemcheckbox/menuitemcheckbox.component.d.ts +1 -1
- package/dist/components/menuitemcheckbox/menuitemcheckbox.component.js +2 -2
- package/dist/components/menuitemradio/menuitemradio.component.d.ts +1 -0
- package/dist/components/menuitemradio/menuitemradio.component.js +2 -1
- package/dist/components/menupopover/menupopover.component.js +3 -3
- package/dist/components/staticchip/staticchip.component.js +1 -1
- package/dist/components/staticchip/staticchip.styles.js +10 -0
- package/dist/custom-elements.json +1353 -1322
- package/dist/react/index.d.ts +2 -2
- package/dist/react/index.js +2 -2
- package/package.json +1 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { CSSResult } from 'lit';
|
|
2
2
|
import Buttonsimple from '../buttonsimple/buttonsimple.component';
|
|
3
3
|
import type { VariantType } from './alertchip.types';
|
|
4
|
+
declare const AlertChip_base: import("../../utils/mixins/index.types").Constructor<import("../../utils/mixins/IconNameMixin").IconNameMixinInterface> & typeof Buttonsimple;
|
|
4
5
|
/**
|
|
5
6
|
* mdc-alertchip component is an interactive chip that consumers can use to represent an alert.
|
|
6
7
|
*
|
|
@@ -27,7 +28,7 @@ import type { VariantType } from './alertchip.types';
|
|
|
27
28
|
* @event keyup - (React: onKeyUp) This event is dispatched when a key is released on the chip.
|
|
28
29
|
* @event focus - (React: onFocus) This event is dispatched when the chip receives focus.
|
|
29
30
|
*/
|
|
30
|
-
declare class AlertChip extends
|
|
31
|
+
declare class AlertChip extends AlertChip_base {
|
|
31
32
|
/**
|
|
32
33
|
* The variant of the alertchip. It supports 5 variants
|
|
33
34
|
* - neutral
|
|
@@ -11,6 +11,7 @@ import { html, nothing } from 'lit';
|
|
|
11
11
|
import { property } from 'lit/decorators.js';
|
|
12
12
|
import { Component } from '../../models';
|
|
13
13
|
import Buttonsimple from '../buttonsimple/buttonsimple.component';
|
|
14
|
+
import { IconNameMixin } from '../../utils/mixins/IconNameMixin';
|
|
14
15
|
import styles from './alertchip.styles';
|
|
15
16
|
import { DEFAULTS } from './alertchip.constants';
|
|
16
17
|
import { getAlertIcon } from './alertchip.utils';
|
|
@@ -40,7 +41,7 @@ import { getAlertIcon } from './alertchip.utils';
|
|
|
40
41
|
* @event keyup - (React: onKeyUp) This event is dispatched when a key is released on the chip.
|
|
41
42
|
* @event focus - (React: onFocus) This event is dispatched when the chip receives focus.
|
|
42
43
|
*/
|
|
43
|
-
class AlertChip extends Buttonsimple {
|
|
44
|
+
class AlertChip extends IconNameMixin(Buttonsimple) {
|
|
44
45
|
constructor() {
|
|
45
46
|
super(...arguments);
|
|
46
47
|
/**
|
|
@@ -72,7 +73,7 @@ class AlertChip extends Buttonsimple {
|
|
|
72
73
|
}
|
|
73
74
|
render() {
|
|
74
75
|
return html `
|
|
75
|
-
<mdc-icon part="icon" name="${getAlertIcon(this.variant)}" length-unit="rem" size="1"></mdc-icon>
|
|
76
|
+
<mdc-icon part="icon" name="${this.iconName || getAlertIcon(this.variant)}" length-unit="rem" size="1"></mdc-icon>
|
|
76
77
|
${this.label
|
|
77
78
|
? html `<mdc-text part="label" type="${DEFAULTS.TEXT_TYPE}" tagname="${DEFAULTS.TAG_NAME}"
|
|
78
79
|
>${this.label}</mdc-text
|
|
@@ -21,10 +21,14 @@ const styles = css `
|
|
|
21
21
|
|
|
22
22
|
:host::part(label) {
|
|
23
23
|
color: var(--mdc-chip-color);
|
|
24
|
+
text-overflow: ellipsis;
|
|
25
|
+
white-space: nowrap;
|
|
26
|
+
overflow: hidden;
|
|
24
27
|
}
|
|
25
28
|
|
|
26
29
|
:host::part(icon) {
|
|
27
30
|
color: var(--mdc-chip-icon-color);
|
|
31
|
+
flex-shrink: 0;
|
|
28
32
|
}
|
|
29
33
|
|
|
30
34
|
:host([variant='neutral']:hover) {
|
|
@@ -83,7 +83,7 @@ class Chip extends IconNameMixin(Buttonsimple) {
|
|
|
83
83
|
renderIcon() {
|
|
84
84
|
if (!this.iconName)
|
|
85
85
|
return nothing;
|
|
86
|
-
return html ` <mdc-icon name="${this.iconName}" length-unit="rem" size="1"></mdc-icon> `;
|
|
86
|
+
return html ` <mdc-icon part="icon" name="${this.iconName}" length-unit="rem" size="1"></mdc-icon> `;
|
|
87
87
|
}
|
|
88
88
|
render() {
|
|
89
89
|
return html `
|
|
@@ -70,7 +70,7 @@ declare class MenuItemCheckbox extends MenuItemCheckbox_base {
|
|
|
70
70
|
connectedCallback(): void;
|
|
71
71
|
/**
|
|
72
72
|
* Handles click events to toggle checked state
|
|
73
|
-
* If the menuitemcheckbox is disabled, it does nothing.
|
|
73
|
+
* If the menuitemcheckbox is disabled or soft-disabled, it does nothing.
|
|
74
74
|
* If the menuitemcheckbox is not disabled, it toggles checked if uncontrolled, and dispatches the 'change' event.
|
|
75
75
|
*/
|
|
76
76
|
private handleMouseClick;
|
|
@@ -91,11 +91,11 @@ class MenuItemCheckbox extends ControlTypeMixin(MenuItem) {
|
|
|
91
91
|
}
|
|
92
92
|
/**
|
|
93
93
|
* Handles click events to toggle checked state
|
|
94
|
-
* If the menuitemcheckbox is disabled, it does nothing.
|
|
94
|
+
* If the menuitemcheckbox is disabled or soft-disabled, it does nothing.
|
|
95
95
|
* If the menuitemcheckbox is not disabled, it toggles checked if uncontrolled, and dispatches the 'change' event.
|
|
96
96
|
*/
|
|
97
97
|
handleMouseClick() {
|
|
98
|
-
if (this.disabled)
|
|
98
|
+
if (this.disabled || this.softDisabled)
|
|
99
99
|
return;
|
|
100
100
|
if (this.controlType !== 'controlled') {
|
|
101
101
|
this.checked = !this.checked;
|
|
@@ -82,6 +82,7 @@ declare class MenuItemRadio extends MenuItemRadio_base {
|
|
|
82
82
|
private updateOtherRadiosCheckedState;
|
|
83
83
|
/**
|
|
84
84
|
* Handles click events to set checked state and uncheck siblings in the same group and container.
|
|
85
|
+
* If the menuitemradio is disabled, soft-disabled, or already checked, it does nothing.
|
|
85
86
|
* If the menuitemradio is not checked, it sets its checked state to `true`
|
|
86
87
|
* and sets all other menuitemradio elements of the same group with checked state to `false`.
|
|
87
88
|
*/
|
|
@@ -116,11 +116,12 @@ class MenuItemRadio extends ControlTypeMixin(MenuItem) {
|
|
|
116
116
|
}
|
|
117
117
|
/**
|
|
118
118
|
* Handles click events to set checked state and uncheck siblings in the same group and container.
|
|
119
|
+
* If the menuitemradio is disabled, soft-disabled, or already checked, it does nothing.
|
|
119
120
|
* If the menuitemradio is not checked, it sets its checked state to `true`
|
|
120
121
|
* and sets all other menuitemradio elements of the same group with checked state to `false`.
|
|
121
122
|
*/
|
|
122
123
|
handleMouseClick() {
|
|
123
|
-
if (this.disabled || this.checked)
|
|
124
|
+
if (this.disabled || this.softDisabled || this.checked)
|
|
124
125
|
return;
|
|
125
126
|
if (this.controlType !== 'controlled') {
|
|
126
127
|
this.updateOtherRadiosCheckedState();
|
|
@@ -226,7 +226,7 @@ class MenuPopover extends Popover {
|
|
|
226
226
|
break;
|
|
227
227
|
}
|
|
228
228
|
case KEYS.ENTER: {
|
|
229
|
-
if (!this.getSubMenuPopoverOfTarget(target)) {
|
|
229
|
+
if (!this.getSubMenuPopoverOfTarget(target) && !target.hasAttribute('soft-disabled')) {
|
|
230
230
|
this.closeAllMenuPopovers();
|
|
231
231
|
this.fireMenuItemAction(target);
|
|
232
232
|
isKeyHandled = true;
|
|
@@ -267,7 +267,7 @@ class MenuPopover extends Popover {
|
|
|
267
267
|
switch (event.key) {
|
|
268
268
|
case KEYS.SPACE: {
|
|
269
269
|
// If the target is a menu item, trigger its click event
|
|
270
|
-
if (!target.matches(`${MENUITEMRADIO_TAGNAME}, ${MENUITEMCHECKBOX_TAGNAME}`)) {
|
|
270
|
+
if (!target.matches(`${MENUITEMRADIO_TAGNAME}, ${MENUITEMCHECKBOX_TAGNAME}`) && !target.hasAttribute('soft-disabled')) {
|
|
271
271
|
// only close all menu popovers if the target is not opening a menu popover
|
|
272
272
|
if (!this.getSubMenuPopoverOfTarget(target)) {
|
|
273
273
|
this.closeAllMenuPopovers();
|
|
@@ -473,7 +473,7 @@ class MenuPopover extends Popover {
|
|
|
473
473
|
// if the target is not a valid menu item or if the event is not trusted (
|
|
474
474
|
// e.g., triggered by keydown originally), do nothing. Pressing space and enter
|
|
475
475
|
// is handled separately in the respective handler.
|
|
476
|
-
if (!isValidMenuItem(target) || !event.isTrusted)
|
|
476
|
+
if (!isValidMenuItem(target) || !event.isTrusted || target.hasAttribute('soft-disabled'))
|
|
477
477
|
return;
|
|
478
478
|
// If the target has a submenu, show it and close other submenus on the same level
|
|
479
479
|
if (this.getSubMenuPopoverOfTarget(target)) {
|
|
@@ -65,7 +65,7 @@ class StaticChip extends IconNameMixin(Component) {
|
|
|
65
65
|
renderIcon() {
|
|
66
66
|
if (!this.iconName)
|
|
67
67
|
return nothing;
|
|
68
|
-
return html ` <mdc-icon name="${this.iconName}" length-unit="rem" size="1"></mdc-icon> `;
|
|
68
|
+
return html ` <mdc-icon part="icon" name="${this.iconName}" length-unit="rem" size="1"></mdc-icon> `;
|
|
69
69
|
}
|
|
70
70
|
render() {
|
|
71
71
|
return html `
|
|
@@ -18,6 +18,16 @@ const styles = css `
|
|
|
18
18
|
background-color: var(--mdc-chip-background-color);
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
+
:host::part(icon) {
|
|
22
|
+
flex-shrink: 0;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
:host::part(label) {
|
|
26
|
+
text-overflow: ellipsis;
|
|
27
|
+
white-space: nowrap;
|
|
28
|
+
overflow: hidden;
|
|
29
|
+
}
|
|
30
|
+
|
|
21
31
|
:host([color='cobalt']) {
|
|
22
32
|
--mdc-chip-border-color: var(--mds-color-theme-outline-theme-normal);
|
|
23
33
|
--mdc-chip-background-color: var(--mds-color-theme-background-label-cobalt-normal);
|