@momentum-design/components 0.129.21 → 0.129.23
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 +49 -46
- 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/components/formfieldwrapper/formfieldwrapper.component.d.ts +5 -3
- package/dist/components/formfieldwrapper/formfieldwrapper.component.js +4 -2
- package/dist/components/statictoggle/statictoggle.component.d.ts +24 -23
- package/dist/components/statictoggle/statictoggle.component.js +24 -23
- package/dist/components/statictoggle/statictoggle.styles.js +37 -37
- package/dist/components/toggle/toggle.component.d.ts +30 -19
- package/dist/components/toggle/toggle.component.js +30 -19
- package/dist/components/toggle/toggle.styles.js +12 -9
- package/dist/custom-elements.json +272 -356
- 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/react/statictoggle/index.d.ts +13 -15
- package/dist/react/statictoggle/index.js +13 -15
- package/dist/react/toggle/index.d.ts +18 -15
- package/dist/react/toggle/index.js +18 -15
- package/dist/utils/mixins/CardComponentMixin.js +7 -2
- package/package.json +1 -1
|
@@ -1,32 +1,28 @@
|
|
|
1
1
|
import Component from '../../components/card';
|
|
2
2
|
/**
|
|
3
3
|
* The card component allows users to organize information in a structured and tangible
|
|
4
|
-
* format that is visually appealing. `mdc-card` is a static component
|
|
5
|
-
* the following features:
|
|
6
|
-
* - Image
|
|
7
|
-
* - Header
|
|
8
|
-
* - Icon
|
|
9
|
-
* - Title
|
|
10
|
-
* - Subtitle
|
|
11
|
-
* - Body
|
|
4
|
+
* format that is visually appealing. `mdc-card` is a static component.
|
|
12
5
|
*
|
|
13
|
-
*
|
|
6
|
+
* ## Card Structure
|
|
7
|
+
* - **Image**: Optional visual content at the top
|
|
8
|
+
* - **Header**: Contains icon, title, subtitle, and action buttons
|
|
9
|
+
* - **Body**: Main text content area
|
|
10
|
+
* - **Footer**: Optional footer with links and buttons
|
|
14
11
|
*
|
|
15
|
-
*
|
|
12
|
+
* ## Features
|
|
13
|
+
* - Supports two orientations (vertical and horizontal) and three visual variants (border, ghost, and promotional).
|
|
14
|
+
* - Can be made interactive by adding elements to slots like `icon-button`, `footer-link`, and footer buttons.
|
|
16
15
|
*
|
|
17
|
-
*
|
|
18
|
-
* - `icon-button`: This slot supports action icon buttons in the header section (maximum of 3 buttons).
|
|
19
|
-
* - `footer-link`: This slot is for passing `mdc-link` component within the footer section.
|
|
20
|
-
* - `footer-button-primary`: This slot is for passing primary variant of `mdc-button` component within the footer section.
|
|
21
|
-
* - `footer-button-secondary`: This slot is for passing secondary variant of `mdc-button` component
|
|
22
|
-
* within the footer section.
|
|
16
|
+
* @tagname mdc-card
|
|
23
17
|
*
|
|
24
|
-
*
|
|
18
|
+
* @dependency mdc-icon
|
|
19
|
+
* @dependency mdc-text
|
|
25
20
|
*
|
|
26
21
|
* @slot image - This slot is for overriding the image content of the card
|
|
27
22
|
* @slot before-body - This slot is for passing the content before the body
|
|
28
23
|
* @slot body - This slot is for passing the text content for the card
|
|
29
24
|
* @slot after-body - This slot is for passing the content after the body
|
|
25
|
+
* @slot icon-button - This slot supports action icon buttons in the header section (maximum of 3 buttons)
|
|
30
26
|
* @slot footer-link - This slot is for passing `mdc-link` component within the footer section.
|
|
31
27
|
* @slot footer-button-primary - This slot is for passing primary variant of
|
|
32
28
|
* `mdc-button` component within the footer section.
|
|
@@ -46,13 +42,7 @@ import Component from '../../components/card';
|
|
|
46
42
|
* @csspart icon-button - The icon button part of the card header
|
|
47
43
|
* @csspart text - The text part of the card
|
|
48
44
|
*
|
|
49
|
-
* @tagname mdc-card
|
|
50
|
-
*
|
|
51
|
-
* @dependency mdc-icon
|
|
52
|
-
* @dependency mdc-text
|
|
53
|
-
*
|
|
54
45
|
* @cssproperty --mdc-card-width - The width of the card
|
|
55
|
-
*
|
|
56
46
|
*/
|
|
57
47
|
declare const reactWrapper: import("@lit/react").ReactWebComponent<Component, {}>;
|
|
58
48
|
export default reactWrapper;
|
package/dist/react/card/index.js
CHANGED
|
@@ -4,32 +4,28 @@ import Component from '../../components/card';
|
|
|
4
4
|
import { TAG_NAME } from '../../components/card/card.constants';
|
|
5
5
|
/**
|
|
6
6
|
* The card component allows users to organize information in a structured and tangible
|
|
7
|
-
* format that is visually appealing. `mdc-card` is a static component
|
|
8
|
-
* the following features:
|
|
9
|
-
* - Image
|
|
10
|
-
* - Header
|
|
11
|
-
* - Icon
|
|
12
|
-
* - Title
|
|
13
|
-
* - Subtitle
|
|
14
|
-
* - Body
|
|
7
|
+
* format that is visually appealing. `mdc-card` is a static component.
|
|
15
8
|
*
|
|
16
|
-
*
|
|
9
|
+
* ## Card Structure
|
|
10
|
+
* - **Image**: Optional visual content at the top
|
|
11
|
+
* - **Header**: Contains icon, title, subtitle, and action buttons
|
|
12
|
+
* - **Body**: Main text content area
|
|
13
|
+
* - **Footer**: Optional footer with links and buttons
|
|
17
14
|
*
|
|
18
|
-
*
|
|
15
|
+
* ## Features
|
|
16
|
+
* - Supports two orientations (vertical and horizontal) and three visual variants (border, ghost, and promotional).
|
|
17
|
+
* - Can be made interactive by adding elements to slots like `icon-button`, `footer-link`, and footer buttons.
|
|
19
18
|
*
|
|
20
|
-
*
|
|
21
|
-
* - `icon-button`: This slot supports action icon buttons in the header section (maximum of 3 buttons).
|
|
22
|
-
* - `footer-link`: This slot is for passing `mdc-link` component within the footer section.
|
|
23
|
-
* - `footer-button-primary`: This slot is for passing primary variant of `mdc-button` component within the footer section.
|
|
24
|
-
* - `footer-button-secondary`: This slot is for passing secondary variant of `mdc-button` component
|
|
25
|
-
* within the footer section.
|
|
19
|
+
* @tagname mdc-card
|
|
26
20
|
*
|
|
27
|
-
*
|
|
21
|
+
* @dependency mdc-icon
|
|
22
|
+
* @dependency mdc-text
|
|
28
23
|
*
|
|
29
24
|
* @slot image - This slot is for overriding the image content of the card
|
|
30
25
|
* @slot before-body - This slot is for passing the content before the body
|
|
31
26
|
* @slot body - This slot is for passing the text content for the card
|
|
32
27
|
* @slot after-body - This slot is for passing the content after the body
|
|
28
|
+
* @slot icon-button - This slot supports action icon buttons in the header section (maximum of 3 buttons)
|
|
33
29
|
* @slot footer-link - This slot is for passing `mdc-link` component within the footer section.
|
|
34
30
|
* @slot footer-button-primary - This slot is for passing primary variant of
|
|
35
31
|
* `mdc-button` component within the footer section.
|
|
@@ -49,13 +45,7 @@ import { TAG_NAME } from '../../components/card/card.constants';
|
|
|
49
45
|
* @csspart icon-button - The icon button part of the card header
|
|
50
46
|
* @csspart text - The text part of the card
|
|
51
47
|
*
|
|
52
|
-
* @tagname mdc-card
|
|
53
|
-
*
|
|
54
|
-
* @dependency mdc-icon
|
|
55
|
-
* @dependency mdc-text
|
|
56
|
-
*
|
|
57
48
|
* @cssproperty --mdc-card-width - The width of the card
|
|
58
|
-
*
|
|
59
49
|
*/
|
|
60
50
|
const reactWrapper = createComponent({
|
|
61
51
|
tagName: TAG_NAME,
|
|
@@ -4,21 +4,18 @@ import type { Events as EventsInherited } from '../../components/buttonsimple/bu
|
|
|
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 @@ import type { Events as EventsInherited } from '../../components/buttonsimple/bu
|
|
|
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
|
|
@@ -5,21 +5,18 @@ import { TAG_NAME } from '../../components/cardbutton/cardbutton.constants';
|
|
|
5
5
|
/**
|
|
6
6
|
* cardbutton component looks like a card and behaves as a button component.
|
|
7
7
|
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
8
|
+
* ## Features
|
|
9
|
+
* - Supports two orientations (vertical and horizontal) and three visual variants (border, ghost, and promotional).
|
|
10
|
+
* - Interacting anywhere on the card triggers the click event.
|
|
11
|
+
* - Use `name` and `value` attributes when using within forms.
|
|
12
|
+
*
|
|
13
|
+
* **Note**: Only pass non-interactable elements within the slots to avoid nested interactive elements.
|
|
10
14
|
*
|
|
11
15
|
* @tagname mdc-cardbutton
|
|
12
16
|
*
|
|
13
17
|
* @dependency mdc-icon
|
|
14
18
|
* @dependency mdc-text
|
|
15
19
|
*
|
|
16
|
-
* @event click - (React: onClick) Event that gets dispatched when the card is clicked.
|
|
17
|
-
* @event keydown - (React: onKeyDown) This event is dispatched when a key is pressed down on the card.
|
|
18
|
-
* It fires the click event when enter key is used.
|
|
19
|
-
* @event keyup - (React: onKeyUp) This event is dispatched when a key is released on the card.
|
|
20
|
-
* It fires the click event when space key is used.
|
|
21
|
-
* @event focus - (React: onFocus) Event that gets dispatched when the card receives focus.
|
|
22
|
-
*
|
|
23
20
|
* @slot image - This slot is for overriding the image content of the card
|
|
24
21
|
* @slot before-body - This slot is for passing the content before the body
|
|
25
22
|
* @slot body - This slot is for passing the text content for the card
|
|
@@ -27,6 +24,13 @@ import { TAG_NAME } from '../../components/cardbutton/cardbutton.constants';
|
|
|
27
24
|
* @slot footer-link - This slot is for passing `mdc-link` component within the footer section.
|
|
28
25
|
* @slot footer-button-primary - This slot is for passing primary variant of `mdc-button` component within the footer section.
|
|
29
26
|
*
|
|
27
|
+
* @event click - (React: onClick) Event that gets dispatched when the card is clicked.
|
|
28
|
+
* @event keydown - (React: onKeyDown) This event is dispatched when a key is pressed down on the card.
|
|
29
|
+
* It fires the click event when enter key is used.
|
|
30
|
+
* @event keyup - (React: onKeyUp) This event is dispatched when a key is released on the card.
|
|
31
|
+
* It fires the click event when space key is used.
|
|
32
|
+
* @event focus - (React: onFocus) Event that gets dispatched when the card receives focus.
|
|
33
|
+
*
|
|
30
34
|
* @csspart header - The header part of the card
|
|
31
35
|
* @csspart icon - The icon part of the card header
|
|
32
36
|
* @csspart body - The body part of the card
|
|
@@ -2,15 +2,19 @@ import { type EventName } from '@lit/react';
|
|
|
2
2
|
import Component from '../../components/cardcheckbox';
|
|
3
3
|
import type { Events } from '../../components/cardcheckbox/cardcheckbox.types';
|
|
4
4
|
/**
|
|
5
|
-
* cardcheckbox component extends `mdc-card` and supports checkbox selection interaction
|
|
5
|
+
* cardcheckbox component extends `mdc-card` and supports checkbox selection interaction.
|
|
6
|
+
* Multiple cards can be checked simultaneously.
|
|
6
7
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
8
|
+
* ## Features
|
|
9
|
+
* - Supports two orientations (vertical and horizontal), three visual variants (border, ghost, and promotional), and two selection types (check icon or checkbox component).
|
|
10
|
+
* - Interacting anywhere on the card toggles the checked state and dispatches a `change` event.
|
|
11
|
+
* - Card has `role="checkbox"` and manages `aria-checked` and `aria-disabled` attributes automatically.
|
|
9
12
|
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
13
|
+
* ## Usage
|
|
14
|
+
* - The `card-title` attribute is required.
|
|
15
|
+
* - When using within a form or group, wrap cards in a container with `role="group"` and provide an `aria-label`.
|
|
12
16
|
*
|
|
13
|
-
*
|
|
17
|
+
* **Note**: Only pass non-interactable elements within the slots to avoid nested interactive elements.
|
|
14
18
|
*
|
|
15
19
|
* @tagname mdc-cardcheckbox
|
|
16
20
|
*
|
|
@@ -24,6 +28,14 @@ import type { Events } from '../../components/cardcheckbox/cardcheckbox.types';
|
|
|
24
28
|
* @slot footer-link - This slot is for passing `mdc-link` component within the footer section.
|
|
25
29
|
* @slot footer-button-primary - This slot is for passing primary variant of `mdc-button` component within the footer section.
|
|
26
30
|
*
|
|
31
|
+
* @event click - (React: onClick) Event that gets dispatched when the card is clicked. It toggles the checked state.
|
|
32
|
+
* @event keydown - (React: onKeyDown) This event is dispatched when a key is pressed down on the card.
|
|
33
|
+
* It toggles the checked state when enter key is used.
|
|
34
|
+
* @event keyup - (React: onKeyUp) This event is dispatched when a key is released on the card.
|
|
35
|
+
* It toggles the checked state when space key is used.
|
|
36
|
+
* @event focus - (React: onFocus) Event that gets dispatched when the card receives focus.
|
|
37
|
+
* @event change - (React: onChange) Event that gets dispatched when the card's checked state changes.
|
|
38
|
+
*
|
|
27
39
|
* @csspart header - The header part of the card
|
|
28
40
|
* @csspart icon - The icon part of the card header
|
|
29
41
|
* @csspart body - The body part of the card
|
|
@@ -39,14 +51,6 @@ import type { Events } from '../../components/cardcheckbox/cardcheckbox.types';
|
|
|
39
51
|
* @csspart check-icon-button - The check icon button part of the card
|
|
40
52
|
*
|
|
41
53
|
* @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
54
|
*/
|
|
51
55
|
declare const reactWrapper: import("@lit/react").ReactWebComponent<Component, {
|
|
52
56
|
onChange: EventName<Events["onChangeEvent"]>;
|
|
@@ -3,15 +3,19 @@ import { createComponent } from '@lit/react';
|
|
|
3
3
|
import Component from '../../components/cardcheckbox';
|
|
4
4
|
import { TAG_NAME } from '../../components/cardcheckbox/cardcheckbox.constants';
|
|
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 @@ import { TAG_NAME } from '../../components/cardcheckbox/cardcheckbox.constants';
|
|
|
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 @@ import { TAG_NAME } from '../../components/cardcheckbox/cardcheckbox.constants';
|
|
|
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
|
const reactWrapper = createComponent({
|
|
53
57
|
tagName: TAG_NAME,
|
|
@@ -2,15 +2,20 @@ import { type EventName } from '@lit/react';
|
|
|
2
2
|
import Component from '../../components/cardradio';
|
|
3
3
|
import type { Events } from '../../components/cardradio/cardradio.types';
|
|
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 @@ import type { Events } from '../../components/cardradio/cardradio.types';
|
|
|
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 @@ import type { Events } from '../../components/cardradio/cardradio.types';
|
|
|
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 const reactWrapper: import("@lit/react").ReactWebComponent<Component, {
|
|
52
57
|
onChange: EventName<Events["onChangeEvent"]>;
|
|
@@ -3,15 +3,20 @@ import { createComponent } from '@lit/react';
|
|
|
3
3
|
import Component from '../../components/cardradio';
|
|
4
4
|
import { TAG_NAME } from '../../components/cardradio/cardradio.constants';
|
|
5
5
|
/**
|
|
6
|
-
* cardradio component extends `mdc-card` and supports radio selection interaction
|
|
6
|
+
* cardradio component extends `mdc-card` and supports radio selection interaction.
|
|
7
|
+
* Only one card can be selected at a time within the same group (defined by `name` attribute).
|
|
7
8
|
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
9
|
+
* ## Features
|
|
10
|
+
* - Supports two orientations (vertical and horizontal) and three visual variants (border, ghost, and promotional).
|
|
11
|
+
* - Selecting a card automatically unselects other cards in the same group and dispatches a `change` event.
|
|
12
|
+
* - Supports keyboard navigation with arrow keys to move between cards in the same group.
|
|
13
|
+
* - Card has `role="radio"` and manages `aria-checked` and `aria-disabled` attributes automatically.
|
|
10
14
|
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
15
|
+
* ## Usage
|
|
16
|
+
* - Both `card-title` and `name` attributes are required.
|
|
17
|
+
* - When using within a form or group, wrap cards in a container with `role="radiogroup"` and provide an `aria-label`.
|
|
13
18
|
*
|
|
14
|
-
*
|
|
19
|
+
* **Note**: Only pass non-interactable elements within the slots to avoid nested interactive elements.
|
|
15
20
|
*
|
|
16
21
|
* @tagname mdc-cardradio
|
|
17
22
|
*
|
|
@@ -25,6 +30,14 @@ import { TAG_NAME } from '../../components/cardradio/cardradio.constants';
|
|
|
25
30
|
* @slot footer-link - This slot is for passing `mdc-link` component within the footer section.
|
|
26
31
|
* @slot footer-button-primary - This slot is for passing primary variant of `mdc-button` component within the footer section.
|
|
27
32
|
*
|
|
33
|
+
* @event click - (React: onClick) Event that gets dispatched when the card is clicked. It selects the card and unselects others in the same group.
|
|
34
|
+
* @event keydown - (React: onKeyDown) This event is dispatched when a key is pressed down on the card.
|
|
35
|
+
* It selects the card when enter key or arrow keys are used.
|
|
36
|
+
* @event keyup - (React: onKeyUp) This event is dispatched when a key is released on the card.
|
|
37
|
+
* It selects the card when space key is used.
|
|
38
|
+
* @event focus - (React: onFocus) Event that gets dispatched when the card receives focus.
|
|
39
|
+
* @event change - (React: onChange) Event that gets dispatched when the card's checked state changes.
|
|
40
|
+
*
|
|
28
41
|
* @csspart header - The header part of the card
|
|
29
42
|
* @csspart icon - The icon part of the card header
|
|
30
43
|
* @csspart body - The body part of the card
|
|
@@ -40,14 +53,6 @@ import { TAG_NAME } from '../../components/cardradio/cardradio.constants';
|
|
|
40
53
|
* @csspart check-icon-button - The check icon button part of the card
|
|
41
54
|
*
|
|
42
55
|
* @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
56
|
*/
|
|
52
57
|
const reactWrapper = createComponent({
|
|
53
58
|
tagName: TAG_NAME,
|
|
@@ -1,27 +1,25 @@
|
|
|
1
1
|
import Component from '../../components/statictoggle';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
* It
|
|
5
|
-
*
|
|
3
|
+
* The StaticToggle is a decorative component that visually represents a toggle switch without interactive functionality.
|
|
4
|
+
* It is primarily used for display purposes or as a building block within custom interactive components.
|
|
5
|
+
* This component shares the same visual styling as the interactive `mdc-toggle` component.
|
|
6
6
|
*
|
|
7
7
|
* @dependency mdc-icon
|
|
8
8
|
*
|
|
9
9
|
* @tagname mdc-statictoggle
|
|
10
10
|
*
|
|
11
|
-
* @slot
|
|
11
|
+
* @slot - Default slot for slotted content (typically used by parent `mdc-toggle` for the checkbox input).
|
|
12
12
|
*
|
|
13
|
-
* @cssproperty --mdc-
|
|
14
|
-
* @cssproperty --mdc-
|
|
15
|
-
* @cssproperty --mdc-
|
|
16
|
-
* @cssproperty --mdc-
|
|
17
|
-
* @cssproperty --mdc-
|
|
18
|
-
* @cssproperty --mdc-
|
|
19
|
-
* @cssproperty --mdc-
|
|
13
|
+
* @cssproperty --mdc-statictoggle-width - The width of the static toggle.
|
|
14
|
+
* @cssproperty --mdc-statictoggle-height - The height of the static toggle.
|
|
15
|
+
* @cssproperty --mdc-statictoggle-border-radius - The border radius of the static toggle.
|
|
16
|
+
* @cssproperty --mdc-statictoggle-border-color - The border color of the static toggle.
|
|
17
|
+
* @cssproperty --mdc-statictoggle-background-color - The background color of the static toggle.
|
|
18
|
+
* @cssproperty --mdc-statictoggle-icon-color - The icon color of the static toggle.
|
|
19
|
+
* @cssproperty --mdc-statictoggle-icon-background-color - The icon background color of the static toggle.
|
|
20
20
|
*
|
|
21
|
-
* @csspart slider - The slider part of the toggle
|
|
22
|
-
* @csspart toggle-icon - The icon part of the toggle
|
|
23
|
-
*
|
|
24
|
-
* @slot - Default slot for adding label text.
|
|
21
|
+
* @csspart slider - The slider part of the toggle.
|
|
22
|
+
* @csspart toggle-icon - The icon part of the toggle.
|
|
25
23
|
*/
|
|
26
24
|
declare const reactWrapper: import("@lit/react").ReactWebComponent<Component, {}>;
|
|
27
25
|
export default reactWrapper;
|
|
@@ -3,28 +3,26 @@ import { createComponent } from '@lit/react';
|
|
|
3
3
|
import Component from '../../components/statictoggle';
|
|
4
4
|
import { TAG_NAME } from '../../components/statictoggle/statictoggle.constants';
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
7
|
-
* It
|
|
8
|
-
*
|
|
6
|
+
* The StaticToggle is a decorative component that visually represents a toggle switch without interactive functionality.
|
|
7
|
+
* It is primarily used for display purposes or as a building block within custom interactive components.
|
|
8
|
+
* This component shares the same visual styling as the interactive `mdc-toggle` component.
|
|
9
9
|
*
|
|
10
10
|
* @dependency mdc-icon
|
|
11
11
|
*
|
|
12
12
|
* @tagname mdc-statictoggle
|
|
13
13
|
*
|
|
14
|
-
* @slot
|
|
14
|
+
* @slot - Default slot for slotted content (typically used by parent `mdc-toggle` for the checkbox input).
|
|
15
15
|
*
|
|
16
|
-
* @cssproperty --mdc-
|
|
17
|
-
* @cssproperty --mdc-
|
|
18
|
-
* @cssproperty --mdc-
|
|
19
|
-
* @cssproperty --mdc-
|
|
20
|
-
* @cssproperty --mdc-
|
|
21
|
-
* @cssproperty --mdc-
|
|
22
|
-
* @cssproperty --mdc-
|
|
16
|
+
* @cssproperty --mdc-statictoggle-width - The width of the static toggle.
|
|
17
|
+
* @cssproperty --mdc-statictoggle-height - The height of the static toggle.
|
|
18
|
+
* @cssproperty --mdc-statictoggle-border-radius - The border radius of the static toggle.
|
|
19
|
+
* @cssproperty --mdc-statictoggle-border-color - The border color of the static toggle.
|
|
20
|
+
* @cssproperty --mdc-statictoggle-background-color - The background color of the static toggle.
|
|
21
|
+
* @cssproperty --mdc-statictoggle-icon-color - The icon color of the static toggle.
|
|
22
|
+
* @cssproperty --mdc-statictoggle-icon-background-color - The icon background color of the static toggle.
|
|
23
23
|
*
|
|
24
|
-
* @csspart slider - The slider part of the toggle
|
|
25
|
-
* @csspart toggle-icon - The icon part of the toggle
|
|
26
|
-
*
|
|
27
|
-
* @slot - Default slot for adding label text.
|
|
24
|
+
* @csspart slider - The slider part of the toggle.
|
|
25
|
+
* @csspart toggle-icon - The icon part of the toggle.
|
|
28
26
|
*/
|
|
29
27
|
const reactWrapper = createComponent({
|
|
30
28
|
tagName: TAG_NAME,
|
|
@@ -2,14 +2,25 @@ import { type EventName } from '@lit/react';
|
|
|
2
2
|
import Component from '../../components/toggle';
|
|
3
3
|
import type { Events } from '../../components/toggle/toggle.types';
|
|
4
4
|
/**
|
|
5
|
-
* Toggle
|
|
6
|
-
* such as On/Off
|
|
5
|
+
* The Toggle component is an interactive control used to switch between two mutually exclusive states,
|
|
6
|
+
* such as On/Off or Active/Inactive. It is commonly used in settings panels, forms, and preference selections
|
|
7
7
|
* where users need to enable or disable a feature.
|
|
8
|
-
* It contains an optional label and an optional helper text.
|
|
9
8
|
*
|
|
10
|
-
* To create a group of toggles, use the
|
|
9
|
+
* To create a group of toggles, use the `mdc-formfieldgroup` component.
|
|
11
10
|
*
|
|
12
|
-
* Note
|
|
11
|
+
* **Note:** This component internally renders a native checkbox input element styled as a toggle switch.
|
|
12
|
+
*
|
|
13
|
+
* ## When to use
|
|
14
|
+
* Use toggles for binary choices where the change takes effect immediately, such as enabling/disabling settings or features.
|
|
15
|
+
*
|
|
16
|
+
* ## Accessibility
|
|
17
|
+
* - Provide clear labels that describe what the toggle controls
|
|
18
|
+
* - Use `data-aria-label` when a visual label is not present
|
|
19
|
+
* - Keyboard navigation: Space to toggle, Tab to navigate, Enter to submit form
|
|
20
|
+
*
|
|
21
|
+
* ## Styling
|
|
22
|
+
* Use the `static-toggle` part to apply custom styles to the toggle switch visual element.
|
|
23
|
+
* This part exposes the underlying [StaticToggle](?path=/docs/components-decorator-statictoggle--docs) component for advanced styling.
|
|
13
24
|
*
|
|
14
25
|
* @dependency mdc-button
|
|
15
26
|
* @dependency mdc-icon
|
|
@@ -22,14 +33,6 @@ import type { Events } from '../../components/toggle/toggle.types';
|
|
|
22
33
|
* @event change - (React: onChange) Event that gets dispatched when the toggle state changes.
|
|
23
34
|
* @event focus - (React: onFocus) Event that gets dispatched when the toggle receives focus.
|
|
24
35
|
*
|
|
25
|
-
* @cssproperty --mdc-toggle-width - The width of the toggle
|
|
26
|
-
* @cssproperty --mdc-toggle-height - The height of the toggle
|
|
27
|
-
* @cssproperty --mdc-toggle-border-radius - The border radius of the toggle
|
|
28
|
-
* @cssproperty --mdc-toggle-border-color - The border color of the toggle
|
|
29
|
-
* @cssproperty --mdc-toggle-background-color - The background color of the toggle
|
|
30
|
-
* @cssproperty --mdc-toggle-icon-color - The icon color of the toggle
|
|
31
|
-
* @cssproperty --mdc-toggle-icon-background-color - The icon background color of the toggle
|
|
32
|
-
*
|
|
33
36
|
* @csspart label - The label element.
|
|
34
37
|
* @csspart label-text - The container for the label and required indicator elements.
|
|
35
38
|
* @csspart required-indicator - The required indicator element that is displayed next to the label when the `required` property is set to true.
|
|
@@ -38,8 +41,8 @@ import type { Events } from '../../components/toggle/toggle.types';
|
|
|
38
41
|
* @csspart help-text - The helper/validation text element.
|
|
39
42
|
* @csspart helper-icon - The helper/validation icon element that is displayed next to the helper/validation text.
|
|
40
43
|
* @csspart help-text-container - The container for the helper/validation icon and text elements.
|
|
41
|
-
* @csspart static-toggle - The
|
|
42
|
-
* @csspart toggle-input - The native checkbox input element
|
|
44
|
+
* @csspart static-toggle - The statictoggle that provides the visual toggle switch appearance.
|
|
45
|
+
* @csspart toggle-input - The native checkbox input element that provides the interactive functionality.
|
|
43
46
|
*/
|
|
44
47
|
declare const reactWrapper: import("@lit/react").ReactWebComponent<Component, {
|
|
45
48
|
onChange: EventName<Events["onChangeEvent"]>;
|