@momentum-design/components 0.129.21 → 0.129.22
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/buttonsimple/buttonsimple.component.d.ts +1 -1
- package/dist/components/card/card.component.d.ts +13 -23
- package/dist/components/card/card.component.js +13 -23
- package/dist/components/cardbutton/cardbutton.component.d.ts +13 -9
- package/dist/components/cardbutton/cardbutton.component.js +13 -9
- package/dist/components/cardcheckbox/cardcheckbox.component.d.ts +21 -15
- package/dist/components/cardcheckbox/cardcheckbox.component.js +21 -15
- package/dist/components/cardradio/cardradio.component.d.ts +21 -15
- package/dist/components/cardradio/cardradio.component.js +21 -15
- package/dist/custom-elements.json +73 -53
- package/dist/react/card/index.d.ts +13 -23
- package/dist/react/card/index.js +13 -23
- package/dist/react/cardbutton/index.d.ts +13 -9
- package/dist/react/cardbutton/index.js +13 -9
- package/dist/react/cardcheckbox/index.d.ts +18 -14
- package/dist/react/cardcheckbox/index.js +18 -14
- package/dist/react/cardradio/index.d.ts +19 -14
- package/dist/react/cardradio/index.js +19 -14
- package/dist/utils/mixins/CardComponentMixin.js +7 -2
- package/package.json +1 -1
|
@@ -3,32 +3,28 @@ import { Component } from '../../models';
|
|
|
3
3
|
declare const Card_base: import("../../utils/mixins/index.types").Constructor<import("../../utils/mixins/CardComponentMixin").CardComponentMixinInterface> & import("../../utils/mixins/index.types").Constructor<import("../../utils/mixins/FooterMixin").FooterMixinInterface> & typeof Component;
|
|
4
4
|
/**
|
|
5
5
|
* The card component allows users to organize information in a structured and tangible
|
|
6
|
-
* format that is visually appealing. `mdc-card` is a static component
|
|
7
|
-
* the following features:
|
|
8
|
-
* - Image
|
|
9
|
-
* - Header
|
|
10
|
-
* - Icon
|
|
11
|
-
* - Title
|
|
12
|
-
* - Subtitle
|
|
13
|
-
* - Body
|
|
6
|
+
* format that is visually appealing. `mdc-card` is a static component.
|
|
14
7
|
*
|
|
15
|
-
*
|
|
8
|
+
* ## Card Structure
|
|
9
|
+
* - **Image**: Optional visual content at the top
|
|
10
|
+
* - **Header**: Contains icon, title, subtitle, and action buttons
|
|
11
|
+
* - **Body**: Main text content area
|
|
12
|
+
* - **Footer**: Optional footer with links and buttons
|
|
16
13
|
*
|
|
17
|
-
*
|
|
14
|
+
* ## Features
|
|
15
|
+
* - Supports two orientations (vertical and horizontal) and three visual variants (border, ghost, and promotional).
|
|
16
|
+
* - Can be made interactive by adding elements to slots like `icon-button`, `footer-link`, and footer buttons.
|
|
18
17
|
*
|
|
19
|
-
*
|
|
20
|
-
* - `icon-button`: This slot supports action icon buttons in the header section (maximum of 3 buttons).
|
|
21
|
-
* - `footer-link`: This slot is for passing `mdc-link` component within the footer section.
|
|
22
|
-
* - `footer-button-primary`: This slot is for passing primary variant of `mdc-button` component within the footer section.
|
|
23
|
-
* - `footer-button-secondary`: This slot is for passing secondary variant of `mdc-button` component
|
|
24
|
-
* within the footer section.
|
|
18
|
+
* @tagname mdc-card
|
|
25
19
|
*
|
|
26
|
-
*
|
|
20
|
+
* @dependency mdc-icon
|
|
21
|
+
* @dependency mdc-text
|
|
27
22
|
*
|
|
28
23
|
* @slot image - This slot is for overriding the image content of the card
|
|
29
24
|
* @slot before-body - This slot is for passing the content before the body
|
|
30
25
|
* @slot body - This slot is for passing the text content for the card
|
|
31
26
|
* @slot after-body - This slot is for passing the content after the body
|
|
27
|
+
* @slot icon-button - This slot supports action icon buttons in the header section (maximum of 3 buttons)
|
|
32
28
|
* @slot footer-link - This slot is for passing `mdc-link` component within the footer section.
|
|
33
29
|
* @slot footer-button-primary - This slot is for passing primary variant of
|
|
34
30
|
* `mdc-button` component within the footer section.
|
|
@@ -48,13 +44,7 @@ declare const Card_base: import("../../utils/mixins/index.types").Constructor<im
|
|
|
48
44
|
* @csspart icon-button - The icon button part of the card header
|
|
49
45
|
* @csspart text - The text part of the card
|
|
50
46
|
*
|
|
51
|
-
* @tagname mdc-card
|
|
52
|
-
*
|
|
53
|
-
* @dependency mdc-icon
|
|
54
|
-
* @dependency mdc-text
|
|
55
|
-
*
|
|
56
47
|
* @cssproperty --mdc-card-width - The width of the card
|
|
57
|
-
*
|
|
58
48
|
*/
|
|
59
49
|
declare class Card extends Card_base {
|
|
60
50
|
/**
|
|
@@ -17,32 +17,28 @@ import { DEFAULTS } from './card.constants';
|
|
|
17
17
|
import styles from './card.styles';
|
|
18
18
|
/**
|
|
19
19
|
* The card component allows users to organize information in a structured and tangible
|
|
20
|
-
* format that is visually appealing. `mdc-card` is a static component
|
|
21
|
-
* the following features:
|
|
22
|
-
* - Image
|
|
23
|
-
* - Header
|
|
24
|
-
* - Icon
|
|
25
|
-
* - Title
|
|
26
|
-
* - Subtitle
|
|
27
|
-
* - Body
|
|
20
|
+
* format that is visually appealing. `mdc-card` is a static component.
|
|
28
21
|
*
|
|
29
|
-
*
|
|
22
|
+
* ## Card Structure
|
|
23
|
+
* - **Image**: Optional visual content at the top
|
|
24
|
+
* - **Header**: Contains icon, title, subtitle, and action buttons
|
|
25
|
+
* - **Body**: Main text content area
|
|
26
|
+
* - **Footer**: Optional footer with links and buttons
|
|
30
27
|
*
|
|
31
|
-
*
|
|
28
|
+
* ## Features
|
|
29
|
+
* - Supports two orientations (vertical and horizontal) and three visual variants (border, ghost, and promotional).
|
|
30
|
+
* - Can be made interactive by adding elements to slots like `icon-button`, `footer-link`, and footer buttons.
|
|
32
31
|
*
|
|
33
|
-
*
|
|
34
|
-
* - `icon-button`: This slot supports action icon buttons in the header section (maximum of 3 buttons).
|
|
35
|
-
* - `footer-link`: This slot is for passing `mdc-link` component within the footer section.
|
|
36
|
-
* - `footer-button-primary`: This slot is for passing primary variant of `mdc-button` component within the footer section.
|
|
37
|
-
* - `footer-button-secondary`: This slot is for passing secondary variant of `mdc-button` component
|
|
38
|
-
* within the footer section.
|
|
32
|
+
* @tagname mdc-card
|
|
39
33
|
*
|
|
40
|
-
*
|
|
34
|
+
* @dependency mdc-icon
|
|
35
|
+
* @dependency mdc-text
|
|
41
36
|
*
|
|
42
37
|
* @slot image - This slot is for overriding the image content of the card
|
|
43
38
|
* @slot before-body - This slot is for passing the content before the body
|
|
44
39
|
* @slot body - This slot is for passing the text content for the card
|
|
45
40
|
* @slot after-body - This slot is for passing the content after the body
|
|
41
|
+
* @slot icon-button - This slot supports action icon buttons in the header section (maximum of 3 buttons)
|
|
46
42
|
* @slot footer-link - This slot is for passing `mdc-link` component within the footer section.
|
|
47
43
|
* @slot footer-button-primary - This slot is for passing primary variant of
|
|
48
44
|
* `mdc-button` component within the footer section.
|
|
@@ -62,13 +58,7 @@ import styles from './card.styles';
|
|
|
62
58
|
* @csspart icon-button - The icon button part of the card header
|
|
63
59
|
* @csspart text - The text part of the card
|
|
64
60
|
*
|
|
65
|
-
* @tagname mdc-card
|
|
66
|
-
*
|
|
67
|
-
* @dependency mdc-icon
|
|
68
|
-
* @dependency mdc-text
|
|
69
|
-
*
|
|
70
61
|
* @cssproperty --mdc-card-width - The width of the card
|
|
71
|
-
*
|
|
72
62
|
*/
|
|
73
63
|
class Card extends CardComponentMixin(FooterMixin(Component)) {
|
|
74
64
|
constructor() {
|
|
@@ -4,21 +4,18 @@ declare const CardButton_base: import("../../utils/mixins/index.types").Construc
|
|
|
4
4
|
/**
|
|
5
5
|
* cardbutton component looks like a card and behaves as a button component.
|
|
6
6
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
7
|
+
* ## Features
|
|
8
|
+
* - Supports two orientations (vertical and horizontal) and three visual variants (border, ghost, and promotional).
|
|
9
|
+
* - Interacting anywhere on the card triggers the click event.
|
|
10
|
+
* - Use `name` and `value` attributes when using within forms.
|
|
11
|
+
*
|
|
12
|
+
* **Note**: Only pass non-interactable elements within the slots to avoid nested interactive elements.
|
|
9
13
|
*
|
|
10
14
|
* @tagname mdc-cardbutton
|
|
11
15
|
*
|
|
12
16
|
* @dependency mdc-icon
|
|
13
17
|
* @dependency mdc-text
|
|
14
18
|
*
|
|
15
|
-
* @event click - (React: onClick) Event that gets dispatched when the card is clicked.
|
|
16
|
-
* @event keydown - (React: onKeyDown) This event is dispatched when a key is pressed down on the card.
|
|
17
|
-
* It fires the click event when enter key is used.
|
|
18
|
-
* @event keyup - (React: onKeyUp) This event is dispatched when a key is released on the card.
|
|
19
|
-
* It fires the click event when space key is used.
|
|
20
|
-
* @event focus - (React: onFocus) Event that gets dispatched when the card receives focus.
|
|
21
|
-
*
|
|
22
19
|
* @slot image - This slot is for overriding the image content of the card
|
|
23
20
|
* @slot before-body - This slot is for passing the content before the body
|
|
24
21
|
* @slot body - This slot is for passing the text content for the card
|
|
@@ -26,6 +23,13 @@ declare const CardButton_base: import("../../utils/mixins/index.types").Construc
|
|
|
26
23
|
* @slot footer-link - This slot is for passing `mdc-link` component within the footer section.
|
|
27
24
|
* @slot footer-button-primary - This slot is for passing primary variant of `mdc-button` component within the footer section.
|
|
28
25
|
*
|
|
26
|
+
* @event click - (React: onClick) Event that gets dispatched when the card is clicked.
|
|
27
|
+
* @event keydown - (React: onKeyDown) This event is dispatched when a key is pressed down on the card.
|
|
28
|
+
* It fires the click event when enter key is used.
|
|
29
|
+
* @event keyup - (React: onKeyUp) This event is dispatched when a key is released on the card.
|
|
30
|
+
* It fires the click event when space key is used.
|
|
31
|
+
* @event focus - (React: onFocus) Event that gets dispatched when the card receives focus.
|
|
32
|
+
*
|
|
29
33
|
* @csspart header - The header part of the card
|
|
30
34
|
* @csspart icon - The icon part of the card header
|
|
31
35
|
* @csspart body - The body part of the card
|
|
@@ -6,21 +6,18 @@ import styles from './cardbutton.styles';
|
|
|
6
6
|
/**
|
|
7
7
|
* cardbutton component looks like a card and behaves as a button component.
|
|
8
8
|
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
9
|
+
* ## Features
|
|
10
|
+
* - Supports two orientations (vertical and horizontal) and three visual variants (border, ghost, and promotional).
|
|
11
|
+
* - Interacting anywhere on the card triggers the click event.
|
|
12
|
+
* - Use `name` and `value` attributes when using within forms.
|
|
13
|
+
*
|
|
14
|
+
* **Note**: Only pass non-interactable elements within the slots to avoid nested interactive elements.
|
|
11
15
|
*
|
|
12
16
|
* @tagname mdc-cardbutton
|
|
13
17
|
*
|
|
14
18
|
* @dependency mdc-icon
|
|
15
19
|
* @dependency mdc-text
|
|
16
20
|
*
|
|
17
|
-
* @event click - (React: onClick) Event that gets dispatched when the card is clicked.
|
|
18
|
-
* @event keydown - (React: onKeyDown) This event is dispatched when a key is pressed down on the card.
|
|
19
|
-
* It fires the click event when enter key is used.
|
|
20
|
-
* @event keyup - (React: onKeyUp) This event is dispatched when a key is released on the card.
|
|
21
|
-
* It fires the click event when space key is used.
|
|
22
|
-
* @event focus - (React: onFocus) Event that gets dispatched when the card receives focus.
|
|
23
|
-
*
|
|
24
21
|
* @slot image - This slot is for overriding the image content of the card
|
|
25
22
|
* @slot before-body - This slot is for passing the content before the body
|
|
26
23
|
* @slot body - This slot is for passing the text content for the card
|
|
@@ -28,6 +25,13 @@ import styles from './cardbutton.styles';
|
|
|
28
25
|
* @slot footer-link - This slot is for passing `mdc-link` component within the footer section.
|
|
29
26
|
* @slot footer-button-primary - This slot is for passing primary variant of `mdc-button` component within the footer section.
|
|
30
27
|
*
|
|
28
|
+
* @event click - (React: onClick) Event that gets dispatched when the card is clicked.
|
|
29
|
+
* @event keydown - (React: onKeyDown) This event is dispatched when a key is pressed down on the card.
|
|
30
|
+
* It fires the click event when enter key is used.
|
|
31
|
+
* @event keyup - (React: onKeyUp) This event is dispatched when a key is released on the card.
|
|
32
|
+
* It fires the click event when space key is used.
|
|
33
|
+
* @event focus - (React: onFocus) Event that gets dispatched when the card receives focus.
|
|
34
|
+
*
|
|
31
35
|
* @csspart header - The header part of the card
|
|
32
36
|
* @csspart icon - The icon part of the card header
|
|
33
37
|
* @csspart body - The body part of the card
|
|
@@ -3,15 +3,19 @@ import Card from '../card/card.component';
|
|
|
3
3
|
import type { SelectionType } from './cardcheckbox.types';
|
|
4
4
|
declare const CardCheckbox_base: import("../../utils/mixins/index.types").Constructor<import("../../utils/mixins/DisabledMixin").DisabledMixinInterface> & import("../../utils/mixins/index.types").Constructor<import("../../utils/mixins/TabIndexMixin").TabIndexMixinInterface> & typeof Card;
|
|
5
5
|
/**
|
|
6
|
-
* cardcheckbox component extends `mdc-card` and supports checkbox selection interaction
|
|
6
|
+
* cardcheckbox component extends `mdc-card` and supports checkbox selection interaction.
|
|
7
|
+
* Multiple cards can be checked simultaneously.
|
|
7
8
|
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
9
|
+
* ## Features
|
|
10
|
+
* - Supports two orientations (vertical and horizontal), three visual variants (border, ghost, and promotional), and two selection types (check icon or checkbox component).
|
|
11
|
+
* - Interacting anywhere on the card toggles the checked state and dispatches a `change` event.
|
|
12
|
+
* - Card has `role="checkbox"` and manages `aria-checked` and `aria-disabled` attributes automatically.
|
|
10
13
|
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
14
|
+
* ## Usage
|
|
15
|
+
* - The `card-title` attribute is required.
|
|
16
|
+
* - When using within a form or group, wrap cards in a container with `role="group"` and provide an `aria-label`.
|
|
13
17
|
*
|
|
14
|
-
*
|
|
18
|
+
* **Note**: Only pass non-interactable elements within the slots to avoid nested interactive elements.
|
|
15
19
|
*
|
|
16
20
|
* @tagname mdc-cardcheckbox
|
|
17
21
|
*
|
|
@@ -25,6 +29,14 @@ declare const CardCheckbox_base: import("../../utils/mixins/index.types").Constr
|
|
|
25
29
|
* @slot footer-link - This slot is for passing `mdc-link` component within the footer section.
|
|
26
30
|
* @slot footer-button-primary - This slot is for passing primary variant of `mdc-button` component within the footer section.
|
|
27
31
|
*
|
|
32
|
+
* @event click - (React: onClick) Event that gets dispatched when the card is clicked. It toggles the checked state.
|
|
33
|
+
* @event keydown - (React: onKeyDown) This event is dispatched when a key is pressed down on the card.
|
|
34
|
+
* It toggles the checked state when enter key is used.
|
|
35
|
+
* @event keyup - (React: onKeyUp) This event is dispatched when a key is released on the card.
|
|
36
|
+
* It toggles the checked state when space key is used.
|
|
37
|
+
* @event focus - (React: onFocus) Event that gets dispatched when the card receives focus.
|
|
38
|
+
* @event change - (React: onChange) Event that gets dispatched when the card's checked state changes.
|
|
39
|
+
*
|
|
28
40
|
* @csspart header - The header part of the card
|
|
29
41
|
* @csspart icon - The icon part of the card header
|
|
30
42
|
* @csspart body - The body part of the card
|
|
@@ -40,14 +52,6 @@ declare const CardCheckbox_base: import("../../utils/mixins/index.types").Constr
|
|
|
40
52
|
* @csspart check-icon-button - The check icon button part of the card
|
|
41
53
|
*
|
|
42
54
|
* @cssproperty --mdc-card-width - The width of the card
|
|
43
|
-
*
|
|
44
|
-
* @event click - (React: onClick) Event that gets dispatched when the card is clicked. It toggles the checked state.
|
|
45
|
-
* @event keydown - (React: onKeyDown) This event is dispatched when a key is pressed down on the card.
|
|
46
|
-
* It toggles the checked state when enter key is used.
|
|
47
|
-
* @event keyup - (React: onKeyUp) This event is dispatched when a key is released on the card.
|
|
48
|
-
* It toggles the checked state when space key is used.
|
|
49
|
-
* @event focus - (React: onFocus) Event that gets dispatched when the card receives focus.
|
|
50
|
-
* @event change - (React: onChange) Event that gets dispatched when the card's checked state changes.
|
|
51
55
|
*/
|
|
52
56
|
declare class CardCheckbox extends CardCheckbox_base {
|
|
53
57
|
/**
|
|
@@ -56,7 +60,9 @@ declare class CardCheckbox extends CardCheckbox_base {
|
|
|
56
60
|
*/
|
|
57
61
|
checked: boolean;
|
|
58
62
|
/**
|
|
59
|
-
* The selection type of the card
|
|
63
|
+
* The selection type of the card that determines the visual indicator.
|
|
64
|
+
* - `check`: Shows a check icon when selected
|
|
65
|
+
* - `checkbox`: Shows a checkbox component when selected or unselected
|
|
60
66
|
* @default 'check'
|
|
61
67
|
*/
|
|
62
68
|
selectionType: SelectionType;
|
|
@@ -17,15 +17,19 @@ import { KEYS } from '../../utils/keys';
|
|
|
17
17
|
import { CHECK_MARK, DEFAULTS, SELECTION_TYPE } from './cardcheckbox.constants';
|
|
18
18
|
import styles from './cardcheckbox.styles';
|
|
19
19
|
/**
|
|
20
|
-
* cardcheckbox component extends `mdc-card` and supports checkbox selection interaction
|
|
20
|
+
* cardcheckbox component extends `mdc-card` and supports checkbox selection interaction.
|
|
21
|
+
* Multiple cards can be checked simultaneously.
|
|
21
22
|
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
23
|
+
* ## Features
|
|
24
|
+
* - Supports two orientations (vertical and horizontal), three visual variants (border, ghost, and promotional), and two selection types (check icon or checkbox component).
|
|
25
|
+
* - Interacting anywhere on the card toggles the checked state and dispatches a `change` event.
|
|
26
|
+
* - Card has `role="checkbox"` and manages `aria-checked` and `aria-disabled` attributes automatically.
|
|
24
27
|
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
28
|
+
* ## Usage
|
|
29
|
+
* - The `card-title` attribute is required.
|
|
30
|
+
* - When using within a form or group, wrap cards in a container with `role="group"` and provide an `aria-label`.
|
|
27
31
|
*
|
|
28
|
-
*
|
|
32
|
+
* **Note**: Only pass non-interactable elements within the slots to avoid nested interactive elements.
|
|
29
33
|
*
|
|
30
34
|
* @tagname mdc-cardcheckbox
|
|
31
35
|
*
|
|
@@ -39,6 +43,14 @@ import styles from './cardcheckbox.styles';
|
|
|
39
43
|
* @slot footer-link - This slot is for passing `mdc-link` component within the footer section.
|
|
40
44
|
* @slot footer-button-primary - This slot is for passing primary variant of `mdc-button` component within the footer section.
|
|
41
45
|
*
|
|
46
|
+
* @event click - (React: onClick) Event that gets dispatched when the card is clicked. It toggles the checked state.
|
|
47
|
+
* @event keydown - (React: onKeyDown) This event is dispatched when a key is pressed down on the card.
|
|
48
|
+
* It toggles the checked state when enter key is used.
|
|
49
|
+
* @event keyup - (React: onKeyUp) This event is dispatched when a key is released on the card.
|
|
50
|
+
* It toggles the checked state when space key is used.
|
|
51
|
+
* @event focus - (React: onFocus) Event that gets dispatched when the card receives focus.
|
|
52
|
+
* @event change - (React: onChange) Event that gets dispatched when the card's checked state changes.
|
|
53
|
+
*
|
|
42
54
|
* @csspart header - The header part of the card
|
|
43
55
|
* @csspart icon - The icon part of the card header
|
|
44
56
|
* @csspart body - The body part of the card
|
|
@@ -54,14 +66,6 @@ import styles from './cardcheckbox.styles';
|
|
|
54
66
|
* @csspart check-icon-button - The check icon button part of the card
|
|
55
67
|
*
|
|
56
68
|
* @cssproperty --mdc-card-width - The width of the card
|
|
57
|
-
*
|
|
58
|
-
* @event click - (React: onClick) Event that gets dispatched when the card is clicked. It toggles the checked state.
|
|
59
|
-
* @event keydown - (React: onKeyDown) This event is dispatched when a key is pressed down on the card.
|
|
60
|
-
* It toggles the checked state when enter key is used.
|
|
61
|
-
* @event keyup - (React: onKeyUp) This event is dispatched when a key is released on the card.
|
|
62
|
-
* It toggles the checked state when space key is used.
|
|
63
|
-
* @event focus - (React: onFocus) Event that gets dispatched when the card receives focus.
|
|
64
|
-
* @event change - (React: onChange) Event that gets dispatched when the card's checked state changes.
|
|
65
69
|
*/
|
|
66
70
|
class CardCheckbox extends DisabledMixin(TabIndexMixin(Card)) {
|
|
67
71
|
constructor() {
|
|
@@ -72,7 +76,9 @@ class CardCheckbox extends DisabledMixin(TabIndexMixin(Card)) {
|
|
|
72
76
|
*/
|
|
73
77
|
this.checked = false;
|
|
74
78
|
/**
|
|
75
|
-
* The selection type of the card
|
|
79
|
+
* The selection type of the card that determines the visual indicator.
|
|
80
|
+
* - `check`: Shows a check icon when selected
|
|
81
|
+
* - `checkbox`: Shows a checkbox component when selected or unselected
|
|
76
82
|
* @default 'check'
|
|
77
83
|
*/
|
|
78
84
|
this.selectionType = DEFAULTS.SELECTION_TYPE;
|
|
@@ -2,15 +2,20 @@ import { CSSResult, nothing, PropertyValues } from 'lit';
|
|
|
2
2
|
import Card from '../card/card.component';
|
|
3
3
|
declare const CardRadio_base: import("../../utils/mixins/index.types").Constructor<import("../../utils/mixins/DisabledMixin").DisabledMixinInterface> & import("../../utils/mixins/index.types").Constructor<import("../../utils/mixins/TabIndexMixin").TabIndexMixinInterface> & typeof Card;
|
|
4
4
|
/**
|
|
5
|
-
* cardradio component extends `mdc-card` and supports radio selection interaction
|
|
5
|
+
* cardradio component extends `mdc-card` and supports radio selection interaction.
|
|
6
|
+
* Only one card can be selected at a time within the same group (defined by `name` attribute).
|
|
6
7
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
8
|
+
* ## Features
|
|
9
|
+
* - Supports two orientations (vertical and horizontal) and three visual variants (border, ghost, and promotional).
|
|
10
|
+
* - Selecting a card automatically unselects other cards in the same group and dispatches a `change` event.
|
|
11
|
+
* - Supports keyboard navigation with arrow keys to move between cards in the same group.
|
|
12
|
+
* - Card has `role="radio"` and manages `aria-checked` and `aria-disabled` attributes automatically.
|
|
9
13
|
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
14
|
+
* ## Usage
|
|
15
|
+
* - Both `card-title` and `name` attributes are required.
|
|
16
|
+
* - When using within a form or group, wrap cards in a container with `role="radiogroup"` and provide an `aria-label`.
|
|
12
17
|
*
|
|
13
|
-
*
|
|
18
|
+
* **Note**: Only pass non-interactable elements within the slots to avoid nested interactive elements.
|
|
14
19
|
*
|
|
15
20
|
* @tagname mdc-cardradio
|
|
16
21
|
*
|
|
@@ -24,6 +29,14 @@ declare const CardRadio_base: import("../../utils/mixins/index.types").Construct
|
|
|
24
29
|
* @slot footer-link - This slot is for passing `mdc-link` component within the footer section.
|
|
25
30
|
* @slot footer-button-primary - This slot is for passing primary variant of `mdc-button` component within the footer section.
|
|
26
31
|
*
|
|
32
|
+
* @event click - (React: onClick) Event that gets dispatched when the card is clicked. It selects the card and unselects others in the same group.
|
|
33
|
+
* @event keydown - (React: onKeyDown) This event is dispatched when a key is pressed down on the card.
|
|
34
|
+
* It selects the card when enter key or arrow keys are used.
|
|
35
|
+
* @event keyup - (React: onKeyUp) This event is dispatched when a key is released on the card.
|
|
36
|
+
* It selects the card when space key is used.
|
|
37
|
+
* @event focus - (React: onFocus) Event that gets dispatched when the card receives focus.
|
|
38
|
+
* @event change - (React: onChange) Event that gets dispatched when the card's checked state changes.
|
|
39
|
+
*
|
|
27
40
|
* @csspart header - The header part of the card
|
|
28
41
|
* @csspart icon - The icon part of the card header
|
|
29
42
|
* @csspart body - The body part of the card
|
|
@@ -39,14 +52,6 @@ declare const CardRadio_base: import("../../utils/mixins/index.types").Construct
|
|
|
39
52
|
* @csspart check-icon-button - The check icon button part of the card
|
|
40
53
|
*
|
|
41
54
|
* @cssproperty --mdc-card-width - The width of the card
|
|
42
|
-
*
|
|
43
|
-
* @event click - (React: onClick) Event that gets dispatched when the card is clicked. It toggles the checked state.
|
|
44
|
-
* @event keydown - (React: onKeyDown) This event is dispatched when a key is pressed down on the card.
|
|
45
|
-
* It toggles the checked state when enter key is used.
|
|
46
|
-
* @event keyup - (React: onKeyUp) This event is dispatched when a key is released on the card.
|
|
47
|
-
* It toggles the checked state when space key is used.
|
|
48
|
-
* @event focus - (React: onFocus) Event that gets dispatched when the card receives focus.
|
|
49
|
-
* @event change - (React: onChange) Event that gets dispatched when the card's checked state changes.
|
|
50
55
|
*/
|
|
51
56
|
declare class CardRadio extends CardRadio_base {
|
|
52
57
|
/**
|
|
@@ -55,7 +60,8 @@ declare class CardRadio extends CardRadio_base {
|
|
|
55
60
|
*/
|
|
56
61
|
checked: boolean;
|
|
57
62
|
/**
|
|
58
|
-
* The name of the radio.
|
|
63
|
+
* The name of the radio group. Cards with the same name are grouped together,
|
|
64
|
+
* ensuring only one card in the group can be selected at a time.
|
|
59
65
|
* @default ''
|
|
60
66
|
*/
|
|
61
67
|
name: string;
|
|
@@ -17,15 +17,20 @@ import { ROLE } from '../../utils/roles';
|
|
|
17
17
|
import { KEYS } from '../../utils/keys';
|
|
18
18
|
import styles from './cardradio.styles';
|
|
19
19
|
/**
|
|
20
|
-
* cardradio component extends `mdc-card` and supports radio selection interaction
|
|
20
|
+
* cardradio component extends `mdc-card` and supports radio selection interaction.
|
|
21
|
+
* Only one card can be selected at a time within the same group (defined by `name` attribute).
|
|
21
22
|
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
23
|
+
* ## Features
|
|
24
|
+
* - Supports two orientations (vertical and horizontal) and three visual variants (border, ghost, and promotional).
|
|
25
|
+
* - Selecting a card automatically unselects other cards in the same group and dispatches a `change` event.
|
|
26
|
+
* - Supports keyboard navigation with arrow keys to move between cards in the same group.
|
|
27
|
+
* - Card has `role="radio"` and manages `aria-checked` and `aria-disabled` attributes automatically.
|
|
24
28
|
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
29
|
+
* ## Usage
|
|
30
|
+
* - Both `card-title` and `name` attributes are required.
|
|
31
|
+
* - When using within a form or group, wrap cards in a container with `role="radiogroup"` and provide an `aria-label`.
|
|
27
32
|
*
|
|
28
|
-
*
|
|
33
|
+
* **Note**: Only pass non-interactable elements within the slots to avoid nested interactive elements.
|
|
29
34
|
*
|
|
30
35
|
* @tagname mdc-cardradio
|
|
31
36
|
*
|
|
@@ -39,6 +44,14 @@ import styles from './cardradio.styles';
|
|
|
39
44
|
* @slot footer-link - This slot is for passing `mdc-link` component within the footer section.
|
|
40
45
|
* @slot footer-button-primary - This slot is for passing primary variant of `mdc-button` component within the footer section.
|
|
41
46
|
*
|
|
47
|
+
* @event click - (React: onClick) Event that gets dispatched when the card is clicked. It selects the card and unselects others in the same group.
|
|
48
|
+
* @event keydown - (React: onKeyDown) This event is dispatched when a key is pressed down on the card.
|
|
49
|
+
* It selects the card when enter key or arrow keys are used.
|
|
50
|
+
* @event keyup - (React: onKeyUp) This event is dispatched when a key is released on the card.
|
|
51
|
+
* It selects the card when space key is used.
|
|
52
|
+
* @event focus - (React: onFocus) Event that gets dispatched when the card receives focus.
|
|
53
|
+
* @event change - (React: onChange) Event that gets dispatched when the card's checked state changes.
|
|
54
|
+
*
|
|
42
55
|
* @csspart header - The header part of the card
|
|
43
56
|
* @csspart icon - The icon part of the card header
|
|
44
57
|
* @csspart body - The body part of the card
|
|
@@ -54,14 +67,6 @@ import styles from './cardradio.styles';
|
|
|
54
67
|
* @csspart check-icon-button - The check icon button part of the card
|
|
55
68
|
*
|
|
56
69
|
* @cssproperty --mdc-card-width - The width of the card
|
|
57
|
-
*
|
|
58
|
-
* @event click - (React: onClick) Event that gets dispatched when the card is clicked. It toggles the checked state.
|
|
59
|
-
* @event keydown - (React: onKeyDown) This event is dispatched when a key is pressed down on the card.
|
|
60
|
-
* It toggles the checked state when enter key is used.
|
|
61
|
-
* @event keyup - (React: onKeyUp) This event is dispatched when a key is released on the card.
|
|
62
|
-
* It toggles the checked state when space key is used.
|
|
63
|
-
* @event focus - (React: onFocus) Event that gets dispatched when the card receives focus.
|
|
64
|
-
* @event change - (React: onChange) Event that gets dispatched when the card's checked state changes.
|
|
65
70
|
*/
|
|
66
71
|
class CardRadio extends DisabledMixin(TabIndexMixin(Card)) {
|
|
67
72
|
constructor() {
|
|
@@ -72,7 +77,8 @@ class CardRadio extends DisabledMixin(TabIndexMixin(Card)) {
|
|
|
72
77
|
*/
|
|
73
78
|
this.checked = false;
|
|
74
79
|
/**
|
|
75
|
-
* The name of the radio.
|
|
80
|
+
* The name of the radio group. Cards with the same name are grouped together,
|
|
81
|
+
* ensuring only one card in the group can be selected at a time.
|
|
76
82
|
* @default ''
|
|
77
83
|
*/
|
|
78
84
|
this.name = '';
|