@momentum-design/components 0.129.13 → 0.129.15
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.map +2 -2
- package/dist/components/appheader/appheader.component.d.ts +16 -12
- package/dist/components/appheader/appheader.component.js +16 -12
- package/dist/components/avatar/avatar.component.d.ts +22 -15
- package/dist/components/avatar/avatar.component.js +22 -15
- package/dist/components/avatarbutton/avatarbutton.component.d.ts +13 -11
- package/dist/components/avatarbutton/avatarbutton.component.js +13 -11
- package/dist/components/bullet/bullet.component.d.ts +5 -2
- package/dist/components/bullet/bullet.component.js +5 -2
- package/dist/components/button/button.component.d.ts +65 -29
- package/dist/components/button/button.component.js +65 -29
- package/dist/components/buttongroup/buttongroup.component.d.ts +26 -21
- package/dist/components/buttongroup/buttongroup.component.js +26 -21
- package/dist/components/buttonsimple/buttonsimple.component.d.ts +5 -3
- package/dist/components/buttonsimple/buttonsimple.component.js +5 -3
- package/dist/custom-elements.json +166 -80
- package/dist/react/appheader/index.d.ts +16 -12
- package/dist/react/appheader/index.js +16 -12
- package/dist/react/avatar/index.d.ts +25 -18
- package/dist/react/avatar/index.js +25 -18
- package/dist/react/avatarbutton/index.d.ts +13 -11
- package/dist/react/avatarbutton/index.js +13 -11
- package/dist/react/button/index.d.ts +39 -22
- package/dist/react/button/index.js +39 -22
- package/dist/react/buttongroup/index.d.ts +16 -18
- package/dist/react/buttongroup/index.js +16 -18
- package/dist/react/buttonsimple/index.d.ts +5 -3
- package/dist/react/buttonsimple/index.js +5 -3
- package/dist/utils/mixins/ButtonComponentMixin.js +12 -5
- package/package.json +1 -1
|
@@ -1,23 +1,27 @@
|
|
|
1
1
|
import { CSSResult } from 'lit';
|
|
2
2
|
import { Component } from '../../models';
|
|
3
3
|
/**
|
|
4
|
-
* The `mdc-appheader` component provides a structured and accessible app header layout.
|
|
5
|
-
* It consists of three primary sections: leading, center, and trailing.
|
|
4
|
+
* The `mdc-appheader` component provides a structured and accessible app header layout with three sections: leading, center, and trailing.
|
|
6
5
|
*
|
|
7
|
-
*
|
|
8
|
-
* -
|
|
9
|
-
* -
|
|
6
|
+
* ## Layout sections
|
|
7
|
+
* - **Leading** - Typically holds brand logo, brand name, or menu icon
|
|
8
|
+
* - **Center** - Can contain search bar, icons, navigation links, or action controls
|
|
9
|
+
* - **Trailing** - Generally includes profile avatar, icons, settings, or additional action controls
|
|
10
|
+
*
|
|
11
|
+
* Each section automatically handles flex alignment: leading aligns left, center aligns center, trailing aligns right.
|
|
10
12
|
*
|
|
11
13
|
* @tagname mdc-appheader
|
|
12
14
|
*
|
|
13
|
-
* @slot leading -
|
|
14
|
-
* @slot center -
|
|
15
|
-
* @slot trailing -
|
|
15
|
+
* @slot leading - Content for the leading section (left-aligned).
|
|
16
|
+
* @slot center - Content for the center section (center-aligned).
|
|
17
|
+
* @slot trailing - Content for the trailing section (right-aligned).
|
|
18
|
+
*
|
|
19
|
+
* @cssproperty --mdc-appheader-height - Height of the app header. Default is 4rem (64px).
|
|
16
20
|
*
|
|
17
|
-
* @csspart container - The main container
|
|
18
|
-
* @csspart leading-section - The leading section
|
|
19
|
-
* @csspart center-section - The center section
|
|
20
|
-
* @csspart trailing-section - The trailing section
|
|
21
|
+
* @csspart container - The main header container.
|
|
22
|
+
* @csspart leading-section - The leading section wrapper (left side).
|
|
23
|
+
* @csspart center-section - The center section wrapper (middle).
|
|
24
|
+
* @csspart trailing-section - The trailing section wrapper (right side).
|
|
21
25
|
*/
|
|
22
26
|
declare class Appheader extends Component {
|
|
23
27
|
/**
|
|
@@ -2,23 +2,27 @@ import { html } from 'lit';
|
|
|
2
2
|
import { Component } from '../../models';
|
|
3
3
|
import styles from './appheader.styles';
|
|
4
4
|
/**
|
|
5
|
-
* The `mdc-appheader` component provides a structured and accessible app header layout.
|
|
6
|
-
* It consists of three primary sections: leading, center, and trailing.
|
|
5
|
+
* The `mdc-appheader` component provides a structured and accessible app header layout with three sections: leading, center, and trailing.
|
|
7
6
|
*
|
|
8
|
-
*
|
|
9
|
-
* -
|
|
10
|
-
* -
|
|
7
|
+
* ## Layout sections
|
|
8
|
+
* - **Leading** - Typically holds brand logo, brand name, or menu icon
|
|
9
|
+
* - **Center** - Can contain search bar, icons, navigation links, or action controls
|
|
10
|
+
* - **Trailing** - Generally includes profile avatar, icons, settings, or additional action controls
|
|
11
|
+
*
|
|
12
|
+
* Each section automatically handles flex alignment: leading aligns left, center aligns center, trailing aligns right.
|
|
11
13
|
*
|
|
12
14
|
* @tagname mdc-appheader
|
|
13
15
|
*
|
|
14
|
-
* @slot leading -
|
|
15
|
-
* @slot center -
|
|
16
|
-
* @slot trailing -
|
|
16
|
+
* @slot leading - Content for the leading section (left-aligned).
|
|
17
|
+
* @slot center - Content for the center section (center-aligned).
|
|
18
|
+
* @slot trailing - Content for the trailing section (right-aligned).
|
|
19
|
+
*
|
|
20
|
+
* @cssproperty --mdc-appheader-height - Height of the app header. Default is 4rem (64px).
|
|
17
21
|
*
|
|
18
|
-
* @csspart container - The main container
|
|
19
|
-
* @csspart leading-section - The leading section
|
|
20
|
-
* @csspart center-section - The center section
|
|
21
|
-
* @csspart trailing-section - The trailing section
|
|
22
|
+
* @csspart container - The main header container.
|
|
23
|
+
* @csspart leading-section - The leading section wrapper (left side).
|
|
24
|
+
* @csspart center-section - The center section wrapper (middle).
|
|
25
|
+
* @csspart trailing-section - The trailing section wrapper (right side).
|
|
22
26
|
*/
|
|
23
27
|
class Appheader extends Component {
|
|
24
28
|
/**
|
|
@@ -3,24 +3,31 @@ import { CSSResult } from 'lit';
|
|
|
3
3
|
import { Component } from '../../models';
|
|
4
4
|
declare const Avatar_base: import("../../utils/mixins/index.types").Constructor<import("../../utils/mixins/AvatarComponentMixin").AvatarComponentMixinInterface> & import("../../utils/mixins/index.types").Constructor<import("../../utils/mixins/IconNameMixin").IconNameMixinInterface> & typeof Component;
|
|
5
5
|
/**
|
|
6
|
-
* The `mdc-avatar` component
|
|
7
|
-
* An avatar can be an icon, initials, counter and photo.
|
|
6
|
+
* The `mdc-avatar` component represents a person or a space. It displays as a photo, initials, icon, or counter.
|
|
8
7
|
*
|
|
9
|
-
*
|
|
10
|
-
* you need to set "src" attribute.
|
|
8
|
+
* ## Display Priority
|
|
11
9
|
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
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
|
|
16
26
|
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
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.
|
|
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
|
|
@@ -17,24 +17,31 @@ import { AVATAR_TYPE, DEFAULTS, MAX_COUNTER } from './avatar.constants';
|
|
|
17
17
|
import styles from './avatar.styles';
|
|
18
18
|
import { getAvatarIconSize, getAvatarTextFontSize, getPresenceSize } from './avatar.utils';
|
|
19
19
|
/**
|
|
20
|
-
* The `mdc-avatar` component
|
|
21
|
-
* An avatar can be an icon, initials, counter and photo.
|
|
20
|
+
* The `mdc-avatar` component represents a person or a space. It displays as a photo, initials, icon, or counter.
|
|
22
21
|
*
|
|
23
|
-
*
|
|
24
|
-
* you need to set "src" attribute.
|
|
22
|
+
* ## Display Priority
|
|
25
23
|
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
24
|
+
* When multiple attributes are provided, the component determines what to display based on this priority:
|
|
25
|
+
* 1. **Photo** (`src`) - Takes highest priority
|
|
26
|
+
* - While loading: Shows `initials` as placeholder if provided (instant), otherwise shows icon (requires loading)
|
|
27
|
+
* - After loading: Shows the photo
|
|
28
|
+
* - On error: Placeholder remains visible (initials or icon)
|
|
29
|
+
* 2. **Icon** (`icon-name`) - Takes priority if no `src` is provided
|
|
30
|
+
* - Shows custom icon if `icon-name` is set (requires icon library to load)
|
|
31
|
+
* - **Note:** If both `icon-name` and `initials` are provided (without `src`), icon takes precedence and initials are ignored.
|
|
32
|
+
* This means users may see a delay while the icon loads, even though initials render instantly.
|
|
33
|
+
* - Defaults to `user-regular` icon if no other content is available
|
|
34
|
+
* 3. **Initials** (`initials`) - Displayed only if no `src` or `icon-name` is provided
|
|
35
|
+
* - Shows first two characters, converted to uppercase
|
|
36
|
+
* - Renders instantly (no loading required)
|
|
37
|
+
* 4. **Counter** (`counter`) - Displayed only if none of the above are provided
|
|
38
|
+
* - Shows numeric value (max 99+)
|
|
39
|
+
* - Negative values display as 0
|
|
30
40
|
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
* If the avatar is typing, then the loading indicator will be displayed.
|
|
36
|
-
* If the counter type avatar is set to a negative number, then we will display 0.
|
|
37
|
-
* The presence indicator will be hidden when the counter property is set.
|
|
41
|
+
* ## Behavior
|
|
42
|
+
* - Non-interactive and non-focusable component (use `mdc-avatarbutton` for clickable avatars)
|
|
43
|
+
* - Shows loading indicator overlay when `is-typing` is true (displays on top of existing content)
|
|
44
|
+
* - Presence indicator hidden when counter is set or when typing
|
|
38
45
|
*
|
|
39
46
|
* @dependency mdc-icon
|
|
40
47
|
* @dependency mdc-presence
|
|
@@ -3,25 +3,27 @@ import { CSSResult } from 'lit';
|
|
|
3
3
|
import Buttonsimple from '../buttonsimple/buttonsimple.component';
|
|
4
4
|
declare const AvatarButton_base: import("../../utils/mixins/index.types").Constructor<import("../../utils/mixins/AvatarComponentMixin").AvatarComponentMixinInterface> & import("../../utils/mixins/index.types").Constructor<import("../../utils/mixins/IconNameMixin").IconNameMixinInterface> & typeof Buttonsimple;
|
|
5
5
|
/**
|
|
6
|
-
* The `mdc-avatarbutton` component is an
|
|
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
|
|
9
|
-
*
|
|
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
|
-
*
|
|
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)
|
|
16
|
-
* @event keydown - (React: onKeyDown)
|
|
17
|
-
* @event keyup - (React: onKeyUp)
|
|
18
|
-
* @event focus - (React: onFocus)
|
|
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.
|
|
@@ -18,25 +18,27 @@ import { DEFAULTS as BUTTON_DEFAULTS } from '../button/button.constants';
|
|
|
18
18
|
import Buttonsimple from '../buttonsimple/buttonsimple.component';
|
|
19
19
|
import styles from './avatarbutton.styles';
|
|
20
20
|
/**
|
|
21
|
-
* The `mdc-avatarbutton` component is an
|
|
21
|
+
* The `mdc-avatarbutton` component is an interactive, clickable version of `mdc-avatar`.
|
|
22
|
+
* It wraps the avatar component in a button, making it focusable and actionable.
|
|
22
23
|
*
|
|
23
|
-
* This component
|
|
24
|
-
*
|
|
24
|
+
* This component extends `buttonsimple` and includes all avatar display features (photo, initials, icon, counter, presence).
|
|
25
|
+
* Use CSS parts to customize the avatar's appearance inside the button.
|
|
25
26
|
*
|
|
26
|
-
*
|
|
27
|
+
* ## Accessibility
|
|
28
|
+
* - Always provide an `aria-label` attribute to describe the button's purpose
|
|
27
29
|
*
|
|
28
30
|
* @dependency mdc-avatar
|
|
29
31
|
*
|
|
30
|
-
* @event click - (React: onClick)
|
|
31
|
-
* @event keydown - (React: onKeyDown)
|
|
32
|
-
* @event keyup - (React: onKeyUp)
|
|
33
|
-
* @event focus - (React: onFocus)
|
|
32
|
+
* @event click - (React: onClick) Dispatched when the avatar button is clicked.
|
|
33
|
+
* @event keydown - (React: onKeyDown) Dispatched when a key is pressed on the avatar button.
|
|
34
|
+
* @event keyup - (React: onKeyUp) Dispatched when a key is released on the avatar button.
|
|
35
|
+
* @event focus - (React: onFocus) Dispatched when the avatar button receives focus.
|
|
34
36
|
*
|
|
35
37
|
* @tagname mdc-avatarbutton
|
|
36
38
|
*
|
|
37
|
-
* @cssproperty --mdc-avatarbutton-overlay-background-color-rest - Background color of the overlay in rest state
|
|
38
|
-
* @cssproperty --mdc-avatarbutton-overlay-background-color-hover - Background color of the overlay in hover state
|
|
39
|
-
* @cssproperty --mdc-avatarbutton-overlay-background-color-active - Background color of the overlay in active state
|
|
39
|
+
* @cssproperty --mdc-avatarbutton-overlay-background-color-rest - Background color of the overlay in rest state.
|
|
40
|
+
* @cssproperty --mdc-avatarbutton-overlay-background-color-hover - Background color of the overlay in hover state.
|
|
41
|
+
* @cssproperty --mdc-avatarbutton-overlay-background-color-active - Background color of the overlay in active state.
|
|
40
42
|
*
|
|
41
43
|
* @csspart overlay - The overlay part of the avatar button.
|
|
42
44
|
* @csspart content - The main content of the avatar.
|
|
@@ -14,9 +14,12 @@ import type { Size } from './bullet.types';
|
|
|
14
14
|
*/
|
|
15
15
|
declare class Bullet extends Component {
|
|
16
16
|
/**
|
|
17
|
-
*
|
|
17
|
+
* Specifies the size of the bullet visual indicator.
|
|
18
|
+
*
|
|
19
|
+
* - `small` (default): 0.25rem (4px) - Compact bullet for dense layouts
|
|
20
|
+
* - `medium`: 0.5rem (8px) - Standard bullet for most use cases
|
|
21
|
+
* - `large`: 1rem (16px) - Prominent bullet for emphasis
|
|
18
22
|
*
|
|
19
|
-
* Possible values: 'small', 'medium', 'large'
|
|
20
23
|
* @default small
|
|
21
24
|
*/
|
|
22
25
|
size: Size;
|
|
@@ -26,9 +26,12 @@ class Bullet extends Component {
|
|
|
26
26
|
constructor() {
|
|
27
27
|
super(...arguments);
|
|
28
28
|
/**
|
|
29
|
-
*
|
|
29
|
+
* Specifies the size of the bullet visual indicator.
|
|
30
|
+
*
|
|
31
|
+
* - `small` (default): 0.25rem (4px) - Compact bullet for dense layouts
|
|
32
|
+
* - `medium`: 0.5rem (8px) - Standard bullet for most use cases
|
|
33
|
+
* - `large`: 1rem (16px) - Prominent bullet for emphasis
|
|
30
34
|
*
|
|
31
|
-
* Possible values: 'small', 'medium', 'large'
|
|
32
35
|
* @default small
|
|
33
36
|
*/
|
|
34
37
|
this.size = SIZE.SMALL;
|
|
@@ -7,28 +7,43 @@ declare const Button_base: import("../../utils/mixins/index.types").Constructor<
|
|
|
7
7
|
/**
|
|
8
8
|
* `mdc-button` is a component that can be configured in various ways to suit different use cases.
|
|
9
9
|
*
|
|
10
|
-
* Button
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
* - **
|
|
19
|
-
* - **
|
|
20
|
-
* - **
|
|
21
|
-
*
|
|
22
|
-
* Button
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
* - **
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
10
|
+
* ## Button configuration
|
|
11
|
+
*
|
|
12
|
+
* The appearance of the button depends on combination of multiple attributes.
|
|
13
|
+
*
|
|
14
|
+
* ### Button Types
|
|
15
|
+
*
|
|
16
|
+
* The type of button is inferred based on the presence of slot and/or prefix and postfix icons/slots:
|
|
17
|
+
*
|
|
18
|
+
* - **Pill button**: Contains text value, commonly used for call to action, tags, or filters
|
|
19
|
+
* - **Pill button with icons**: Contains an icon on the left or right side of the button
|
|
20
|
+
* - **Icon button**: Represented by just an icon without any text
|
|
21
|
+
*
|
|
22
|
+
* ### Button Variants:
|
|
23
|
+
*
|
|
24
|
+
* Options for button backgrounds and borders:
|
|
25
|
+
*
|
|
26
|
+
* - **Primary**: Solid background color
|
|
27
|
+
* - **Secondary**: Transparent background with solid border
|
|
28
|
+
* - **Tertiary**: No background or border, text-only appearance
|
|
29
|
+
*
|
|
30
|
+
* ### Button Colors
|
|
31
|
+
*
|
|
32
|
+
* Color options for **Primary** and **Secondary** buttons:
|
|
33
|
+
*
|
|
34
|
+
* - **Default**: For standard actions
|
|
35
|
+
* - **Positive**: For success or confirmation actions
|
|
36
|
+
* - **Negative**: For destructive or error actions
|
|
37
|
+
* - **Accent**: For informational actions
|
|
38
|
+
* - **Promotional**: For promotional actions
|
|
39
|
+
*
|
|
40
|
+
* ### Button Sizes
|
|
41
|
+
*
|
|
42
|
+
* Size options for different button configurations in REM:
|
|
43
|
+
*
|
|
44
|
+
* - **Pill button**: 40, 32, 28, 24
|
|
45
|
+
* - **Icon button**: 64, 52, 40, 32, 28, 24
|
|
46
|
+
* - **Tertiary icon button**: 20
|
|
32
47
|
*
|
|
33
48
|
* @dependency mdc-icon
|
|
34
49
|
*
|
|
@@ -41,6 +56,8 @@ declare const Button_base: import("../../utils/mixins/index.types").Constructor<
|
|
|
41
56
|
* @csspart button-text - Text label of the button, passed in default slot
|
|
42
57
|
* @csspart prefix - Content before the text label, passed in `prefix` slot
|
|
43
58
|
* @csspart postfix - Content after the text label, passed in `postfix` slot
|
|
59
|
+
* @csspart prefix-icon - Icon element displayed before the text label when `prefix-icon` attribute is set
|
|
60
|
+
* @csspart postfix-icon - Icon element displayed after the text label when `postfix-icon` attribute is set
|
|
44
61
|
*
|
|
45
62
|
* @cssproperty --mdc-button-height - Height for button size
|
|
46
63
|
* @cssproperty --mdc-button-background - Background of the button
|
|
@@ -52,18 +69,37 @@ declare const Button_base: import("../../utils/mixins/index.types").Constructor<
|
|
|
52
69
|
*/
|
|
53
70
|
declare class Button extends Button_base {
|
|
54
71
|
/**
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
* -
|
|
72
|
+
* Specifies the size of the button in pixels. Available sizes depend on the button type:
|
|
73
|
+
*
|
|
74
|
+
* **Pill button** (with text):
|
|
75
|
+
* - `40`: Large size (2.5rem)
|
|
76
|
+
* - `32`: Default size (2rem)
|
|
77
|
+
* - `28`: Medium size (1.75rem)
|
|
78
|
+
* - `24`: Small size (1.5rem)
|
|
79
|
+
*
|
|
80
|
+
* **Icon button** (icon only):
|
|
81
|
+
* - `64`: Extra large (4rem)
|
|
82
|
+
* - `52`: Large (3.25rem)
|
|
83
|
+
* - `40`: Medium-large (2.5rem)
|
|
84
|
+
* - `32`: Default (2rem)
|
|
85
|
+
* - `28`: Medium (1.75rem)
|
|
86
|
+
* - `24`: Small (1.5rem)
|
|
87
|
+
* - `20`: Extra small (1.25rem) - Only available for tertiary variant
|
|
88
|
+
*
|
|
59
89
|
* @default 32
|
|
60
90
|
*/
|
|
61
91
|
size: PillButtonSize | IconButtonSize;
|
|
62
92
|
/**
|
|
63
|
-
*
|
|
93
|
+
* Inverts the button's color scheme for use on dark backgrounds.
|
|
94
|
+
* When enabled, the button adapts its colors to maintain proper contrast on inverted surfaces.
|
|
95
|
+
*
|
|
96
|
+
* **Requirements:**
|
|
97
|
+
* - Only works with `variant="primary"`
|
|
98
|
+
* - Only works with `color="default"`
|
|
99
|
+
* - Button must not be in `active` state
|
|
100
|
+
*
|
|
101
|
+
* **Use case:** Place buttons on dark-colored backgrounds or inverted theme sections.
|
|
64
102
|
*
|
|
65
|
-
* Only applies when variant is set to `primary`, color is set to `default`
|
|
66
|
-
* and button is not `active`.
|
|
67
103
|
* @default false
|
|
68
104
|
*/
|
|
69
105
|
inverted: boolean;
|
|
@@ -18,28 +18,43 @@ import { getIconNameWithoutStyle } from './button.utils';
|
|
|
18
18
|
/**
|
|
19
19
|
* `mdc-button` is a component that can be configured in various ways to suit different use cases.
|
|
20
20
|
*
|
|
21
|
-
* Button
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
* - **
|
|
30
|
-
* - **
|
|
31
|
-
* - **
|
|
32
|
-
*
|
|
33
|
-
* Button
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
* - **
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
21
|
+
* ## Button configuration
|
|
22
|
+
*
|
|
23
|
+
* The appearance of the button depends on combination of multiple attributes.
|
|
24
|
+
*
|
|
25
|
+
* ### Button Types
|
|
26
|
+
*
|
|
27
|
+
* The type of button is inferred based on the presence of slot and/or prefix and postfix icons/slots:
|
|
28
|
+
*
|
|
29
|
+
* - **Pill button**: Contains text value, commonly used for call to action, tags, or filters
|
|
30
|
+
* - **Pill button with icons**: Contains an icon on the left or right side of the button
|
|
31
|
+
* - **Icon button**: Represented by just an icon without any text
|
|
32
|
+
*
|
|
33
|
+
* ### Button Variants:
|
|
34
|
+
*
|
|
35
|
+
* Options for button backgrounds and borders:
|
|
36
|
+
*
|
|
37
|
+
* - **Primary**: Solid background color
|
|
38
|
+
* - **Secondary**: Transparent background with solid border
|
|
39
|
+
* - **Tertiary**: No background or border, text-only appearance
|
|
40
|
+
*
|
|
41
|
+
* ### Button Colors
|
|
42
|
+
*
|
|
43
|
+
* Color options for **Primary** and **Secondary** buttons:
|
|
44
|
+
*
|
|
45
|
+
* - **Default**: For standard actions
|
|
46
|
+
* - **Positive**: For success or confirmation actions
|
|
47
|
+
* - **Negative**: For destructive or error actions
|
|
48
|
+
* - **Accent**: For informational actions
|
|
49
|
+
* - **Promotional**: For promotional actions
|
|
50
|
+
*
|
|
51
|
+
* ### Button Sizes
|
|
52
|
+
*
|
|
53
|
+
* Size options for different button configurations in REM:
|
|
54
|
+
*
|
|
55
|
+
* - **Pill button**: 40, 32, 28, 24
|
|
56
|
+
* - **Icon button**: 64, 52, 40, 32, 28, 24
|
|
57
|
+
* - **Tertiary icon button**: 20
|
|
43
58
|
*
|
|
44
59
|
* @dependency mdc-icon
|
|
45
60
|
*
|
|
@@ -52,6 +67,8 @@ import { getIconNameWithoutStyle } from './button.utils';
|
|
|
52
67
|
* @csspart button-text - Text label of the button, passed in default slot
|
|
53
68
|
* @csspart prefix - Content before the text label, passed in `prefix` slot
|
|
54
69
|
* @csspart postfix - Content after the text label, passed in `postfix` slot
|
|
70
|
+
* @csspart prefix-icon - Icon element displayed before the text label when `prefix-icon` attribute is set
|
|
71
|
+
* @csspart postfix-icon - Icon element displayed after the text label when `postfix-icon` attribute is set
|
|
55
72
|
*
|
|
56
73
|
* @cssproperty --mdc-button-height - Height for button size
|
|
57
74
|
* @cssproperty --mdc-button-background - Background of the button
|
|
@@ -65,18 +82,37 @@ class Button extends ButtonComponentMixin(Buttonsimple) {
|
|
|
65
82
|
constructor() {
|
|
66
83
|
super(...arguments);
|
|
67
84
|
/**
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
* -
|
|
85
|
+
* Specifies the size of the button in pixels. Available sizes depend on the button type:
|
|
86
|
+
*
|
|
87
|
+
* **Pill button** (with text):
|
|
88
|
+
* - `40`: Large size (2.5rem)
|
|
89
|
+
* - `32`: Default size (2rem)
|
|
90
|
+
* - `28`: Medium size (1.75rem)
|
|
91
|
+
* - `24`: Small size (1.5rem)
|
|
92
|
+
*
|
|
93
|
+
* **Icon button** (icon only):
|
|
94
|
+
* - `64`: Extra large (4rem)
|
|
95
|
+
* - `52`: Large (3.25rem)
|
|
96
|
+
* - `40`: Medium-large (2.5rem)
|
|
97
|
+
* - `32`: Default (2rem)
|
|
98
|
+
* - `28`: Medium (1.75rem)
|
|
99
|
+
* - `24`: Small (1.5rem)
|
|
100
|
+
* - `20`: Extra small (1.25rem) - Only available for tertiary variant
|
|
101
|
+
*
|
|
72
102
|
* @default 32
|
|
73
103
|
*/
|
|
74
104
|
this.size = DEFAULTS.SIZE;
|
|
75
105
|
/**
|
|
76
|
-
*
|
|
106
|
+
* Inverts the button's color scheme for use on dark backgrounds.
|
|
107
|
+
* When enabled, the button adapts its colors to maintain proper contrast on inverted surfaces.
|
|
108
|
+
*
|
|
109
|
+
* **Requirements:**
|
|
110
|
+
* - Only works with `variant="primary"`
|
|
111
|
+
* - Only works with `color="default"`
|
|
112
|
+
* - Button must not be in `active` state
|
|
113
|
+
*
|
|
114
|
+
* **Use case:** Place buttons on dark-colored backgrounds or inverted theme sections.
|
|
77
115
|
*
|
|
78
|
-
* Only applies when variant is set to `primary`, color is set to `default`
|
|
79
|
-
* and button is not `active`.
|
|
80
116
|
* @default false
|
|
81
117
|
*/
|
|
82
118
|
this.inverted = DEFAULTS.INVERTED;
|
|
@@ -2,24 +2,22 @@ import { CSSResult, PropertyValues } from 'lit';
|
|
|
2
2
|
import { Component } from '../../models';
|
|
3
3
|
import type { ButtonGroupOrientation, ButtonGroupSize, ButtonGroupVariant } from './buttongroup.types';
|
|
4
4
|
/**
|
|
5
|
-
* buttongroup
|
|
6
|
-
* It can support icon buttons, combination of icon and pill buttons, and text buttons.
|
|
7
|
-
* Button group can be positioned in horizontal orientation and vertical orientation.
|
|
5
|
+
* `mdc-buttongroup` is a wrapper component that groups multiple buttons together.
|
|
8
6
|
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
7
|
+
* ## Supported button types
|
|
8
|
+
* - Icon buttons
|
|
9
|
+
* - Pill buttons
|
|
10
|
+
* - Combination of icon and pill buttons
|
|
11
11
|
*
|
|
12
|
-
*
|
|
12
|
+
* ## Features
|
|
13
|
+
* - Horizontal or vertical orientation
|
|
14
|
+
* - Unified size and variant applied to all child buttons
|
|
15
|
+
* - Optional compact mode for reduced height
|
|
16
|
+
* - Supported sizes: 24, 28 (default), 32, 40
|
|
13
17
|
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
* All buttons are placed horizontally by default. To change the orientation to vertical, set the `orientation` attribute to `vertical`.
|
|
18
|
-
*
|
|
19
|
-
* Things to note:
|
|
20
|
-
* - Button group will allow only `mdc-button` components as its direct children.
|
|
21
|
-
* - Button group will set the `size` and `variant` attributes on the buttons within it,
|
|
22
|
-
* so any `size` or `variant` set directly on any button will be overridden.
|
|
18
|
+
* ## Usage
|
|
19
|
+
* - Only `mdc-button` components are allowed as direct children
|
|
20
|
+
* - The `size` and `variant` set on buttongroup override individual button settings
|
|
23
21
|
*
|
|
24
22
|
* @tagname mdc-buttongroup
|
|
25
23
|
*
|
|
@@ -33,23 +31,30 @@ import type { ButtonGroupOrientation, ButtonGroupSize, ButtonGroupVariant } from
|
|
|
33
31
|
*/
|
|
34
32
|
declare class ButtonGroup extends Component {
|
|
35
33
|
/**
|
|
36
|
-
*
|
|
34
|
+
* Layout direction of the buttons within the group.
|
|
35
|
+
* - `horizontal`: Buttons are arranged side by side (default)
|
|
36
|
+
* - `vertical`: Buttons are stacked vertically
|
|
37
37
|
* @default 'horizontal'
|
|
38
38
|
*/
|
|
39
39
|
orientation: ButtonGroupOrientation;
|
|
40
40
|
/**
|
|
41
|
-
*
|
|
41
|
+
* Visual style variant applied to all buttons in the group.
|
|
42
|
+
* - `primary`: Solid background color
|
|
43
|
+
* - `secondary`: Transparent background with solid border
|
|
44
|
+
* - `tertiary`: No background or border, text-only appearance
|
|
42
45
|
* @default 'primary'
|
|
43
46
|
*/
|
|
44
47
|
variant: ButtonGroupVariant;
|
|
45
48
|
/**
|
|
46
|
-
* Size
|
|
47
|
-
*
|
|
49
|
+
* Size applied to all buttons in the group.
|
|
50
|
+
* Available sizes: 24, 28, 32, 40
|
|
51
|
+
* @default 28
|
|
48
52
|
*/
|
|
49
53
|
size: ButtonGroupSize;
|
|
50
54
|
/**
|
|
51
|
-
*
|
|
52
|
-
*
|
|
55
|
+
* Enables compact mode with reduced height.
|
|
56
|
+
* When true, all buttons have a fixed height of 24px regardless of their size setting.
|
|
57
|
+
* Useful for space-constrained layouts.
|
|
53
58
|
* @default false
|
|
54
59
|
*/
|
|
55
60
|
compact: boolean;
|