@momentum-design/components 0.129.13 → 0.129.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.
@@ -3,24 +3,31 @@ import { createComponent } from '@lit/react';
3
3
  import Component from '../../components/avatar';
4
4
  import { TAG_NAME } from '../../components/avatar/avatar.constants';
5
5
  /**
6
- * The `mdc-avatar` component is used to represent a person or a space.
7
- * An avatar can be an icon, initials, counter and photo.
8
- *
9
- * To set the photo of an avatar,
10
- * you need to set "src" attribute.
11
- *
12
- * While the avatar image is loading, as a placeholder,
13
- * we will show the initials text.
14
- * If the initials are not specified then,
15
- * we will show `user-regular` icon as a placeholder.
16
- *
17
- * By default, if there are no attributes specified,
18
- * then the default avatar will be an icon with `user-regular` name.
19
- *
20
- * The avatar component is non clickable and non interactive/focusable component.
21
- * If the avatar is typing, then the loading indicator will be displayed.
22
- * If the counter type avatar is set to a negative number, then we will display 0.
23
- * The presence indicator will be hidden when the counter property is set.
6
+ * The `mdc-avatar` component represents a person or a space. It displays as a photo, initials, icon, or counter.
7
+ *
8
+ * ## Display Priority
9
+ *
10
+ * When multiple attributes are provided, the component determines what to display based on this priority:
11
+ * 1. **Photo** (`src`) - Takes highest priority
12
+ * - While loading: Shows `initials` as placeholder if provided (instant), otherwise shows icon (requires loading)
13
+ * - After loading: Shows the photo
14
+ * - On error: Placeholder remains visible (initials or icon)
15
+ * 2. **Icon** (`icon-name`) - Takes priority if no `src` is provided
16
+ * - Shows custom icon if `icon-name` is set (requires icon library to load)
17
+ * - **Note:** If both `icon-name` and `initials` are provided (without `src`), icon takes precedence and initials are ignored.
18
+ * This means users may see a delay while the icon loads, even though initials render instantly.
19
+ * - Defaults to `user-regular` icon if no other content is available
20
+ * 3. **Initials** (`initials`) - Displayed only if no `src` or `icon-name` is provided
21
+ * - Shows first two characters, converted to uppercase
22
+ * - Renders instantly (no loading required)
23
+ * 4. **Counter** (`counter`) - Displayed only if none of the above are provided
24
+ * - Shows numeric value (max 99+)
25
+ * - Negative values display as 0
26
+ *
27
+ * ## Behavior
28
+ * - Non-interactive and non-focusable component (use `mdc-avatarbutton` for clickable avatars)
29
+ * - Shows loading indicator overlay when `is-typing` is true (displays on top of existing content)
30
+ * - Presence indicator hidden when counter is set or when typing
24
31
  *
25
32
  * @dependency mdc-icon
26
33
  * @dependency mdc-presence
@@ -2,25 +2,27 @@ import { type EventName } from '@lit/react';
2
2
  import Component from '../../components/avatarbutton';
3
3
  import type { Events as EventsInherited } from '../../components/buttonsimple/buttonsimple.types';
4
4
  /**
5
- * The `mdc-avatarbutton` component is an interactable version of the `mdc-avatar` component.
5
+ * The `mdc-avatarbutton` component is an interactive, clickable version of `mdc-avatar`.
6
+ * It wraps the avatar component in a button, making it focusable and actionable.
6
7
  *
7
- * This component is made by extending `buttonsimple` class.
8
- * The button component acts as a wrapper for the avatar component.
8
+ * This component extends `buttonsimple` and includes all avatar display features (photo, initials, icon, counter, presence).
9
+ * Use CSS parts to customize the avatar's appearance inside the button.
9
10
  *
10
- * To override styles of the avatar inside, use the specified css parts.
11
+ * ## Accessibility
12
+ * - Always provide an `aria-label` attribute to describe the button's purpose
11
13
  *
12
14
  * @dependency mdc-avatar
13
15
  *
14
- * @event click - (React: onClick) This event is dispatched when the avatarbutton is clicked.
15
- * @event keydown - (React: onKeyDown) This event is dispatched when a key is pressed down on the avatarbutton.
16
- * @event keyup - (React: onKeyUp) This event is dispatched when a key is released on the avatarbutton.
17
- * @event focus - (React: onFocus) This event is dispatched when the avatarbutton receives focus.
16
+ * @event click - (React: onClick) Dispatched when the avatar button is clicked.
17
+ * @event keydown - (React: onKeyDown) Dispatched when a key is pressed on the avatar button.
18
+ * @event keyup - (React: onKeyUp) Dispatched when a key is released on the avatar button.
19
+ * @event focus - (React: onFocus) Dispatched when the avatar button receives focus.
18
20
  *
19
21
  * @tagname mdc-avatarbutton
20
22
  *
21
- * @cssproperty --mdc-avatarbutton-overlay-background-color-rest - Background color of the overlay in rest state
22
- * @cssproperty --mdc-avatarbutton-overlay-background-color-hover - Background color of the overlay in hover state
23
- * @cssproperty --mdc-avatarbutton-overlay-background-color-active - Background color of the overlay in active state
23
+ * @cssproperty --mdc-avatarbutton-overlay-background-color-rest - Background color of the overlay in rest state.
24
+ * @cssproperty --mdc-avatarbutton-overlay-background-color-hover - Background color of the overlay in hover state.
25
+ * @cssproperty --mdc-avatarbutton-overlay-background-color-active - Background color of the overlay in active state.
24
26
  *
25
27
  * @csspart overlay - The overlay part of the avatar button.
26
28
  * @csspart content - The main content of the avatar.
@@ -3,25 +3,27 @@ import { createComponent } from '@lit/react';
3
3
  import Component from '../../components/avatarbutton';
4
4
  import { TAG_NAME } from '../../components/avatarbutton/avatarbutton.constants';
5
5
  /**
6
- * The `mdc-avatarbutton` component is an interactable version of the `mdc-avatar` component.
6
+ * The `mdc-avatarbutton` component is an interactive, clickable version of `mdc-avatar`.
7
+ * It wraps the avatar component in a button, making it focusable and actionable.
7
8
  *
8
- * This component is made by extending `buttonsimple` class.
9
- * The button component acts as a wrapper for the avatar component.
9
+ * This component extends `buttonsimple` and includes all avatar display features (photo, initials, icon, counter, presence).
10
+ * Use CSS parts to customize the avatar's appearance inside the button.
10
11
  *
11
- * To override styles of the avatar inside, use the specified css parts.
12
+ * ## Accessibility
13
+ * - Always provide an `aria-label` attribute to describe the button's purpose
12
14
  *
13
15
  * @dependency mdc-avatar
14
16
  *
15
- * @event click - (React: onClick) This event is dispatched when the avatarbutton is clicked.
16
- * @event keydown - (React: onKeyDown) This event is dispatched when a key is pressed down on the avatarbutton.
17
- * @event keyup - (React: onKeyUp) This event is dispatched when a key is released on the avatarbutton.
18
- * @event focus - (React: onFocus) This event is dispatched when the avatarbutton receives focus.
17
+ * @event click - (React: onClick) Dispatched when the avatar button is clicked.
18
+ * @event keydown - (React: onKeyDown) Dispatched when a key is pressed on the avatar button.
19
+ * @event keyup - (React: onKeyUp) Dispatched when a key is released on the avatar button.
20
+ * @event focus - (React: onFocus) Dispatched when the avatar button receives focus.
19
21
  *
20
22
  * @tagname mdc-avatarbutton
21
23
  *
22
- * @cssproperty --mdc-avatarbutton-overlay-background-color-rest - Background color of the overlay in rest state
23
- * @cssproperty --mdc-avatarbutton-overlay-background-color-hover - Background color of the overlay in hover state
24
- * @cssproperty --mdc-avatarbutton-overlay-background-color-active - Background color of the overlay in active state
24
+ * @cssproperty --mdc-avatarbutton-overlay-background-color-rest - Background color of the overlay in rest state.
25
+ * @cssproperty --mdc-avatarbutton-overlay-background-color-hover - Background color of the overlay in hover state.
26
+ * @cssproperty --mdc-avatarbutton-overlay-background-color-active - Background color of the overlay in active state.
25
27
  *
26
28
  * @csspart overlay - The overlay part of the avatar button.
27
29
  * @csspart content - The main content of the avatar.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@momentum-design/components",
3
3
  "packageManager": "yarn@3.2.4",
4
- "version": "0.129.13",
4
+ "version": "0.129.14",
5
5
  "engines": {
6
6
  "node": ">=20.0.0",
7
7
  "npm": ">=8.0.0"