@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.
@@ -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 allow users to select single options from a list or turn an item/feature on or off.
7
- * These are often used in forms, settings, and selection in lists.
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
- * A radio component contains an optional label, optional info icon and an optional helper text.
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
- * This is a decorative component that is styled to look as a radio.
4
- * It has 4 properties - checked, disabled, readonly and soft-disabled.
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
- * We are using the same styling that has been created for the `mdc-radio` component.
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-radio-inner-circle-size - size of the inner circle
11
- * @cssproperty --mdc-radio-outer-circle-size - size of the outer circle
12
- * @cssproperty --mdc-radio-inner-circle-background-color - background color of the inner circle
13
- * @cssproperty --mdc-radio-outer-circle-border-color - border color of the outer circle
14
- * @cssproperty --mdc-radio-outer-circle-background-color - background color of the outer circle
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
- * This is a decorative component that is styled to look as a radio.
7
- * It has 4 properties - checked, disabled, readonly and soft-disabled.
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
- * We are using the same styling that has been created for the `mdc-radio` component.
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-radio-inner-circle-size - size of the inner circle
14
- * @cssproperty --mdc-radio-outer-circle-size - size of the outer circle
15
- * @cssproperty --mdc-radio-inner-circle-background-color - background color of the inner circle
16
- * @cssproperty --mdc-radio-outer-circle-border-color - border color of the outer circle
17
- * @cssproperty --mdc-radio-outer-circle-background-color - background color of the outer circle
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 checkbox input element that provides the interactive functionality.
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 checkbox input element that provides the interactive functionality.
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,
@@ -24,6 +24,7 @@ declare const ROLE: {
24
24
  readonly RADIO: "radio";
25
25
  readonly RADIOGROUP: "radiogroup";
26
26
  readonly REGION: "region";
27
+ readonly SWITCH: "switch";
27
28
  readonly TAB: "tab";
28
29
  readonly TABLIST: "tablist";
29
30
  readonly TOOLTIP: "tooltip";
@@ -24,6 +24,7 @@ const ROLE = {
24
24
  RADIO: 'radio',
25
25
  RADIOGROUP: 'radiogroup',
26
26
  REGION: 'region',
27
+ SWITCH: 'switch',
27
28
  TAB: 'tab',
28
29
  TABLIST: 'tablist',
29
30
  TOOLTIP: 'tooltip',
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@momentum-design/components",
3
3
  "packageManager": "yarn@3.2.4",
4
- "version": "0.129.28",
4
+ "version": "0.129.30",
5
5
  "engines": {
6
6
  "node": ">=20.0.0",
7
7
  "npm": ">=8.0.0"