@momentum-design/components 0.120.32 → 0.120.34
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 +12 -2
- package/dist/browser/index.js.map +2 -2
- package/dist/components/avatar/avatar.styles.js +1 -0
- package/dist/components/inputchip/inputchip.component.d.ts +6 -3
- package/dist/components/inputchip/inputchip.component.js +14 -7
- package/dist/components/inputchip/inputchip.styles.js +5 -0
- package/dist/custom-elements.json +1416 -1410
- package/dist/react/index.d.ts +2 -2
- package/dist/react/index.js +2 -2
- package/dist/react/inputchip/index.d.ts +3 -0
- package/dist/react/inputchip/index.js +3 -0
- package/package.json +1 -1
|
@@ -5,6 +5,7 @@ declare const InputChip_base: import("../../utils/mixins/index.types").Construct
|
|
|
5
5
|
* mdc-inputchip component is an interactive chip that consumers can use to represent an input.
|
|
6
6
|
*
|
|
7
7
|
* - It supports a leading icon along with label.
|
|
8
|
+
* - It supports a prefix slot for avatars (takes precedence over icon-name).
|
|
8
9
|
* - It supports an error state for validation.
|
|
9
10
|
* - It supports a close button to remove the chip.
|
|
10
11
|
*
|
|
@@ -16,6 +17,8 @@ declare const InputChip_base: import("../../utils/mixins/index.types").Construct
|
|
|
16
17
|
*
|
|
17
18
|
* @event remove - This event is dispatched when the close button is activated. It bubbles and is composed.
|
|
18
19
|
*
|
|
20
|
+
* @slot prefix - A slot for prefix content such as avatars.
|
|
21
|
+
*
|
|
19
22
|
* @csspart label - The label part of the chip.
|
|
20
23
|
* @csspart icon - The icon part of the chip.
|
|
21
24
|
* @csspart close-icon - The close icon part of the chip.
|
|
@@ -44,10 +47,10 @@ declare class InputChip extends InputChip_base {
|
|
|
44
47
|
*/
|
|
45
48
|
clearAriaLabel: string;
|
|
46
49
|
/**
|
|
47
|
-
* Renders the
|
|
48
|
-
* @returns The
|
|
50
|
+
* Renders the prefix content, supporting both icons and slot content.
|
|
51
|
+
* @returns The prefix content if available, otherwise nothing.
|
|
49
52
|
*/
|
|
50
|
-
private
|
|
53
|
+
private renderPrefix;
|
|
51
54
|
/**
|
|
52
55
|
* Handles the behavior of the close button on click event.
|
|
53
56
|
* @param event - The event object.
|
|
@@ -18,6 +18,7 @@ import { DEFAULTS } from './inputchip.constants';
|
|
|
18
18
|
* mdc-inputchip component is an interactive chip that consumers can use to represent an input.
|
|
19
19
|
*
|
|
20
20
|
* - It supports a leading icon along with label.
|
|
21
|
+
* - It supports a prefix slot for avatars (takes precedence over icon-name).
|
|
21
22
|
* - It supports an error state for validation.
|
|
22
23
|
* - It supports a close button to remove the chip.
|
|
23
24
|
*
|
|
@@ -29,6 +30,8 @@ import { DEFAULTS } from './inputchip.constants';
|
|
|
29
30
|
*
|
|
30
31
|
* @event remove - This event is dispatched when the close button is activated. It bubbles and is composed.
|
|
31
32
|
*
|
|
33
|
+
* @slot prefix - A slot for prefix content such as avatars.
|
|
34
|
+
*
|
|
32
35
|
* @csspart label - The label part of the chip.
|
|
33
36
|
* @csspart icon - The icon part of the chip.
|
|
34
37
|
* @csspart close-icon - The close icon part of the chip.
|
|
@@ -60,13 +63,17 @@ class InputChip extends IconNameMixin(DisabledMixin(Component)) {
|
|
|
60
63
|
this.clearAriaLabel = '';
|
|
61
64
|
}
|
|
62
65
|
/**
|
|
63
|
-
* Renders the
|
|
64
|
-
* @returns The
|
|
66
|
+
* Renders the prefix content, supporting both icons and slot content.
|
|
67
|
+
* @returns The prefix content if available, otherwise nothing.
|
|
65
68
|
*/
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
69
|
+
renderPrefix() {
|
|
70
|
+
return html `
|
|
71
|
+
<slot name="prefix">
|
|
72
|
+
${this.iconName
|
|
73
|
+
? html `<mdc-icon part="icon" name="${this.iconName}" length-unit="rem" size="1"></mdc-icon>`
|
|
74
|
+
: nothing}
|
|
75
|
+
</slot>
|
|
76
|
+
`;
|
|
70
77
|
}
|
|
71
78
|
/**
|
|
72
79
|
* Handles the behavior of the close button on click event.
|
|
@@ -77,7 +84,7 @@ class InputChip extends IconNameMixin(DisabledMixin(Component)) {
|
|
|
77
84
|
}
|
|
78
85
|
render() {
|
|
79
86
|
return html `
|
|
80
|
-
${this.
|
|
87
|
+
${this.renderPrefix()}
|
|
81
88
|
${this.label
|
|
82
89
|
? html `<mdc-text part="label" type="${DEFAULTS.TEXT_TYPE}" tagname="${DEFAULTS.TAG_NAME}"
|
|
83
90
|
>${this.label}</mdc-text
|