@momentum-design/components 0.129.28 → 0.129.30
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 +69 -66
- package/dist/browser/index.js.map +3 -3
- package/dist/components/radio/radio.component.d.ts +46 -20
- package/dist/components/radio/radio.component.js +46 -20
- package/dist/components/radio/radio.styles.js +9 -13
- package/dist/components/staticradio/staticradio.component.d.ts +17 -16
- package/dist/components/staticradio/staticradio.component.js +17 -16
- package/dist/components/staticradio/staticradio.styles.js +34 -34
- package/dist/components/statictoggle/statictoggle.styles.js +2 -1
- package/dist/components/toggle/toggle.component.d.ts +8 -5
- package/dist/components/toggle/toggle.component.js +15 -8
- package/dist/components/toggle/toggle.styles.js +20 -14
- package/dist/custom-elements.json +110 -229
- package/dist/react/radio/index.d.ts +24 -10
- package/dist/react/radio/index.js +24 -10
- package/dist/react/staticradio/index.d.ts +11 -10
- package/dist/react/staticradio/index.js +11 -10
- package/dist/react/toggle/index.d.ts +3 -2
- package/dist/react/toggle/index.js +3 -2
- package/dist/utils/roles.d.ts +1 -0
- package/dist/utils/roles.js +1 -0
- package/package.json +1 -1
|
@@ -3,10 +3,29 @@ import { createComponent } from '@lit/react';
|
|
|
3
3
|
import Component from '../../components/radio';
|
|
4
4
|
import { TAG_NAME } from '../../components/radio/radio.constants';
|
|
5
5
|
/**
|
|
6
|
-
* Radio
|
|
7
|
-
*
|
|
6
|
+
* The Radio component allows users to select a single option from a group of mutually exclusive choices.
|
|
7
|
+
* Unlike checkboxes which allow multiple selections, radio buttons ensure only one option can be selected
|
|
8
|
+
* at a time within the same group. These are commonly used in forms, surveys, and settings where users
|
|
9
|
+
* need to make a single selection from multiple options.
|
|
8
10
|
*
|
|
9
|
-
*
|
|
11
|
+
* To create a group of radio buttons, use the `mdc-radiogroup` component or ensure all radio buttons
|
|
12
|
+
* share the same `name` attribute.
|
|
13
|
+
*
|
|
14
|
+
* **Note:** This component internally renders a native radio input element with custom styling.
|
|
15
|
+
*
|
|
16
|
+
* ## When to use
|
|
17
|
+
* Use radio buttons when users must select exactly one option from a list of 2-5 choices. For longer lists,
|
|
18
|
+
* consider using a dropdown menu instead.
|
|
19
|
+
*
|
|
20
|
+
* ## Accessibility
|
|
21
|
+
* - Provide clear labels that describe each option
|
|
22
|
+
* - Use `data-aria-label` when a visual label is not present
|
|
23
|
+
* - Keyboard navigation: Arrow keys to move between options, Space to select, Tab to navigate groups, Enter to submit form
|
|
24
|
+
* - Group related radio buttons using the same `name` attribute or `mdc-radiogroup` component
|
|
25
|
+
*
|
|
26
|
+
* ## Styling
|
|
27
|
+
* Use the `static-radio` part to apply custom styles to the radio visual element.
|
|
28
|
+
* This part exposes the underlying [StaticRadio](?path=/docs/components-decorator-staticradio--docs) component for advanced styling.
|
|
10
29
|
*
|
|
11
30
|
* @dependency mdc-button
|
|
12
31
|
* @dependency mdc-icon
|
|
@@ -19,12 +38,6 @@ import { TAG_NAME } from '../../components/radio/radio.constants';
|
|
|
19
38
|
* @event change - (React: onChange) Event that gets dispatched when the radio state changes.
|
|
20
39
|
* @event focus - (React: onFocus) Event that gets dispatched when the radio receives focus.
|
|
21
40
|
*
|
|
22
|
-
* @cssproperty --mdc-radio-inner-circle-size - size of the inner circle
|
|
23
|
-
* @cssproperty --mdc-radio-outer-circle-size - size of the outer circle
|
|
24
|
-
* @cssproperty --mdc-radio-inner-circle-background-color - background color of the inner circle
|
|
25
|
-
* @cssproperty --mdc-radio-outer-circle-border-color - border color of the outer circle
|
|
26
|
-
* @cssproperty --mdc-radio-outer-circle-background-color - background color of the outer circle
|
|
27
|
-
*
|
|
28
41
|
* @csspart label - The label element.
|
|
29
42
|
* @csspart label-text - The container for the label and required indicator elements.
|
|
30
43
|
* @csspart required-indicator - The required indicator element that is displayed next to the label when the `required` property is set to true.
|
|
@@ -33,8 +46,9 @@ import { TAG_NAME } from '../../components/radio/radio.constants';
|
|
|
33
46
|
* @csspart help-text - The helper/validation text element.
|
|
34
47
|
* @csspart helper-icon - The helper/validation icon element that is displayed next to the helper/validation text.
|
|
35
48
|
* @csspart help-text-container - The container for the helper/validation icon and text elements.
|
|
36
|
-
* @csspart radio-input - The native radio input element.
|
|
49
|
+
* @csspart radio-input - The native radio input element that provides the interactive functionality.
|
|
37
50
|
* @csspart text-container - The container for the label and helper text elements.
|
|
51
|
+
* @csspart static-radio - The staticradio that provides the visual radio appearance.
|
|
38
52
|
*/
|
|
39
53
|
const reactWrapper = createComponent({
|
|
40
54
|
tagName: TAG_NAME,
|
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
import Component from '../../components/staticradio';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
3
|
+
* StaticRadio is a decorative component styled as a radio button for visual presentation.
|
|
4
|
+
* Unlike the interactive `mdc-radio`, this component does not handle user interactions or form submissions.
|
|
5
|
+
* It is used purely for displaying radio button states in read-only scenarios.
|
|
5
6
|
*
|
|
6
|
-
*
|
|
7
|
+
* This component supports four display states: checked, disabled, readonly, and soft-disabled.
|
|
7
8
|
*
|
|
8
9
|
* @tagname mdc-staticradio
|
|
9
10
|
*
|
|
10
|
-
* @cssproperty --mdc-
|
|
11
|
-
* @cssproperty --mdc-
|
|
12
|
-
* @cssproperty --mdc-
|
|
13
|
-
* @cssproperty --mdc-
|
|
14
|
-
* @cssproperty --mdc-
|
|
11
|
+
* @cssproperty --mdc-staticradio-inner-circle-size - The size of the inner circle when checked.
|
|
12
|
+
* @cssproperty --mdc-staticradio-outer-circle-size - The size of the outer circle border.
|
|
13
|
+
* @cssproperty --mdc-staticradio-inner-circle-background-color - The background color of the inner circle when checked.
|
|
14
|
+
* @cssproperty --mdc-staticradio-outer-circle-border-color - The border color of the outer circle.
|
|
15
|
+
* @cssproperty --mdc-staticradio-outer-circle-background-color - The background color of the outer circle.
|
|
15
16
|
*
|
|
16
|
-
* @csspart radio-icon - The radio icon
|
|
17
|
+
* @csspart radio-icon - The radio icon element
|
|
17
18
|
*
|
|
18
|
-
* @slot - Default slot for the label of the radio
|
|
19
|
+
* @slot - Default slot for the label of the radio
|
|
19
20
|
*/
|
|
20
21
|
declare const reactWrapper: import("@lit/react").ReactWebComponent<Component, {}>;
|
|
21
22
|
export default reactWrapper;
|
|
@@ -3,22 +3,23 @@ import { createComponent } from '@lit/react';
|
|
|
3
3
|
import Component from '../../components/staticradio';
|
|
4
4
|
import { TAG_NAME } from '../../components/staticradio/staticradio.constants';
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
7
|
-
*
|
|
6
|
+
* StaticRadio is a decorative component styled as a radio button for visual presentation.
|
|
7
|
+
* Unlike the interactive `mdc-radio`, this component does not handle user interactions or form submissions.
|
|
8
|
+
* It is used purely for displaying radio button states in read-only scenarios.
|
|
8
9
|
*
|
|
9
|
-
*
|
|
10
|
+
* This component supports four display states: checked, disabled, readonly, and soft-disabled.
|
|
10
11
|
*
|
|
11
12
|
* @tagname mdc-staticradio
|
|
12
13
|
*
|
|
13
|
-
* @cssproperty --mdc-
|
|
14
|
-
* @cssproperty --mdc-
|
|
15
|
-
* @cssproperty --mdc-
|
|
16
|
-
* @cssproperty --mdc-
|
|
17
|
-
* @cssproperty --mdc-
|
|
14
|
+
* @cssproperty --mdc-staticradio-inner-circle-size - The size of the inner circle when checked.
|
|
15
|
+
* @cssproperty --mdc-staticradio-outer-circle-size - The size of the outer circle border.
|
|
16
|
+
* @cssproperty --mdc-staticradio-inner-circle-background-color - The background color of the inner circle when checked.
|
|
17
|
+
* @cssproperty --mdc-staticradio-outer-circle-border-color - The border color of the outer circle.
|
|
18
|
+
* @cssproperty --mdc-staticradio-outer-circle-background-color - The background color of the outer circle.
|
|
18
19
|
*
|
|
19
|
-
* @csspart radio-icon - The radio icon
|
|
20
|
+
* @csspart radio-icon - The radio icon element
|
|
20
21
|
*
|
|
21
|
-
* @slot - Default slot for the label of the radio
|
|
22
|
+
* @slot - Default slot for the label of the radio
|
|
22
23
|
*/
|
|
23
24
|
const reactWrapper = createComponent({
|
|
24
25
|
tagName: TAG_NAME,
|
|
@@ -8,7 +8,7 @@ import type { Events } from '../../components/toggle/toggle.types';
|
|
|
8
8
|
*
|
|
9
9
|
* To create a group of toggles, use the `mdc-formfieldgroup` component.
|
|
10
10
|
*
|
|
11
|
-
* **Note:** This component internally renders a native checkbox input element styled as a toggle switch.
|
|
11
|
+
* **Note:** This component internally renders a native checkbox input element with the `switch` role, styled as a toggle switch.
|
|
12
12
|
*
|
|
13
13
|
* ## When to use
|
|
14
14
|
* Use toggles for binary choices where the change takes effect immediately, such as enabling/disabling settings or features.
|
|
@@ -41,8 +41,9 @@ import type { Events } from '../../components/toggle/toggle.types';
|
|
|
41
41
|
* @csspart help-text - The helper/validation text element.
|
|
42
42
|
* @csspart helper-icon - The helper/validation icon element that is displayed next to the helper/validation text.
|
|
43
43
|
* @csspart help-text-container - The container for the helper/validation icon and text elements.
|
|
44
|
+
* @csspart text-container - The container for the label and helper text elements.
|
|
44
45
|
* @csspart static-toggle - The statictoggle that provides the visual toggle switch appearance.
|
|
45
|
-
* @csspart toggle-input - The native
|
|
46
|
+
* @csspart toggle-input - The native input element with switch role that provides the interactive functionality.
|
|
46
47
|
*/
|
|
47
48
|
declare const reactWrapper: import("@lit/react").ReactWebComponent<Component, {
|
|
48
49
|
onChange: EventName<Events["onChangeEvent"]>;
|
|
@@ -9,7 +9,7 @@ import { TAG_NAME } from '../../components/toggle/toggle.constants';
|
|
|
9
9
|
*
|
|
10
10
|
* To create a group of toggles, use the `mdc-formfieldgroup` component.
|
|
11
11
|
*
|
|
12
|
-
* **Note:** This component internally renders a native checkbox input element styled as a toggle switch.
|
|
12
|
+
* **Note:** This component internally renders a native checkbox input element with the `switch` role, styled as a toggle switch.
|
|
13
13
|
*
|
|
14
14
|
* ## When to use
|
|
15
15
|
* Use toggles for binary choices where the change takes effect immediately, such as enabling/disabling settings or features.
|
|
@@ -42,8 +42,9 @@ import { TAG_NAME } from '../../components/toggle/toggle.constants';
|
|
|
42
42
|
* @csspart help-text - The helper/validation text element.
|
|
43
43
|
* @csspart helper-icon - The helper/validation icon element that is displayed next to the helper/validation text.
|
|
44
44
|
* @csspart help-text-container - The container for the helper/validation icon and text elements.
|
|
45
|
+
* @csspart text-container - The container for the label and helper text elements.
|
|
45
46
|
* @csspart static-toggle - The statictoggle that provides the visual toggle switch appearance.
|
|
46
|
-
* @csspart toggle-input - The native
|
|
47
|
+
* @csspart toggle-input - The native input element with switch role that provides the interactive functionality.
|
|
47
48
|
*/
|
|
48
49
|
const reactWrapper = createComponent({
|
|
49
50
|
tagName: TAG_NAME,
|
package/dist/utils/roles.d.ts
CHANGED
package/dist/utils/roles.js
CHANGED