@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.
@@ -66,6 +66,7 @@ const styles = [
66
66
  position: relative;
67
67
  display: grid;
68
68
  place-items: center;
69
+ flex-shrink: 0;
69
70
  }
70
71
  :host::part(photo) {
71
72
  border-radius: 100vh;
@@ -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 icon element if available.
48
- * @returns The icon element if available, otherwise nothing.
50
+ * Renders the prefix content, supporting both icons and slot content.
51
+ * @returns The prefix content if available, otherwise nothing.
49
52
  */
50
- private renderIcon;
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 icon element if available.
64
- * @returns The icon element if available, otherwise nothing.
66
+ * Renders the prefix content, supporting both icons and slot content.
67
+ * @returns The prefix content if available, otherwise nothing.
65
68
  */
66
- renderIcon() {
67
- if (!this.iconName)
68
- return nothing;
69
- return html ` <mdc-icon part="icon" name="${this.iconName}" length-unit="rem" size="1"></mdc-icon> `;
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.renderIcon()}
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
@@ -31,5 +31,10 @@ const styles = css `
31
31
  --mdc-chip-color: var(--mds-color-theme-text-primary-disabled);
32
32
  cursor: auto;
33
33
  }
34
+
35
+ ::slotted(mdc-avatar[slot='prefix']){
36
+ width: 1.25rem;
37
+ height: 1.25rem;
38
+ }
34
39
  `;
35
40
  export default [hostFitContentStyles, styles];