@momentum-design/components 0.133.4 → 0.133.6
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 +207 -218
- package/dist/browser/index.js.map +3 -3
- package/dist/components/formfieldgroup/formfieldgroup.component.d.ts +2 -3
- package/dist/components/formfieldgroup/formfieldgroup.component.js +13 -16
- package/dist/components/formfieldgroup/formfieldgroup.styles.js +1 -1
- package/dist/components/radio/radio.component.d.ts +27 -16
- package/dist/components/radio/radio.component.js +103 -120
- package/dist/components/radio/radio.styles.js +31 -17
- package/dist/components/radio/radio.types.d.ts +3 -2
- package/dist/components/radiogroup/radiogroup.component.d.ts +0 -2
- package/dist/components/radiogroup/radiogroup.component.js +10 -8
- package/dist/components/tab/tab.component.d.ts +4 -0
- package/dist/components/tab/tab.component.js +5 -4
- package/dist/components/tab/tab.styles.js +1 -2
- package/dist/custom-elements.json +170 -252
- package/dist/react/formfieldgroup/index.d.ts +0 -1
- package/dist/react/formfieldgroup/index.js +0 -1
- package/dist/react/radio/index.d.ts +17 -13
- package/dist/react/radio/index.js +17 -13
- package/dist/react/radiogroup/index.d.ts +0 -2
- package/dist/react/radiogroup/index.js +0 -2
- package/dist/react/tab/index.d.ts +3 -0
- package/dist/react/tab/index.js +3 -0
- package/dist/utils/mixins/DataAriaLabelMixin.d.ts +14 -0
- package/dist/utils/mixins/DataAriaLabelMixin.js +14 -0
- package/package.json +1 -1
|
@@ -10,19 +10,26 @@ import type { Events } from '../../components/radio/radio.types';
|
|
|
10
10
|
* To create a group of radio buttons, use the `mdc-radiogroup` component or ensure all radio buttons
|
|
11
11
|
* share the same `name` attribute.
|
|
12
12
|
*
|
|
13
|
-
*
|
|
13
|
+
* ## Validation
|
|
14
14
|
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
15
|
+
* Radio component support native form validation. But it does not have default validation message.
|
|
16
|
+
* Also, `required` attribute does not render indicator (red asterisk) for the radio component.
|
|
17
|
+
*
|
|
18
|
+
* The recommended way to show validation message for radio groups is to wrap the `mdc-radio` with `mdc-radiogroup`
|
|
19
|
+
* and set the `help-text` of the `mdc-radiogroup` based on its validation state.
|
|
20
|
+
*
|
|
21
|
+
* Alternatively you can also set the `validation-message` attribute of the `mdc-radio`. This message will appear
|
|
22
|
+
* in a native tooltip when the radio is checked and invalid.
|
|
18
23
|
*
|
|
19
24
|
* ## Accessibility
|
|
25
|
+
*
|
|
20
26
|
* - Provide clear labels that describe each option
|
|
21
27
|
* - Use `data-aria-label` when a visual label is not present
|
|
22
28
|
* - Keyboard navigation: Arrow keys to move between options, Space to select, Tab to navigate groups, Enter to submit form
|
|
23
29
|
* - Group related radio buttons using the same `name` attribute or `mdc-radiogroup` component
|
|
24
30
|
*
|
|
25
31
|
* ## Styling
|
|
32
|
+
*
|
|
26
33
|
* Use the `static-radio` part to apply custom styles to the radio visual element.
|
|
27
34
|
* This part exposes the underlying [StaticRadio](?path=/docs/components-decorator-staticradio--docs) component for advanced styling.
|
|
28
35
|
*
|
|
@@ -34,22 +41,19 @@ import type { Events } from '../../components/radio/radio.types';
|
|
|
34
41
|
*
|
|
35
42
|
* @tagname mdc-radio
|
|
36
43
|
*
|
|
37
|
-
* @event
|
|
44
|
+
* @event input - (React: onInput) Event that gets dispatched when the radio state changes (before the change event).
|
|
45
|
+
* @event change - (React: onChange) Event that gets dispatched when the radio state changes (after the input event).
|
|
38
46
|
* @event focus - (React: onFocus) Event that gets dispatched when the radio receives focus.
|
|
39
47
|
*
|
|
40
48
|
* @csspart label - The label element.
|
|
41
49
|
* @csspart label-text - The container for the label and required indicator elements.
|
|
42
|
-
* @csspart required-indicator - The required indicator element that is displayed next to the label when the `required` property is set to true.
|
|
43
|
-
* @csspart info-icon-btn - The info icon button element that is displayed next to the label when the `toggletip-text` property is set.
|
|
44
|
-
* @csspart label-toggletip - The toggletip element that is displayed when the info icon button is clicked.
|
|
45
|
-
* @csspart help-text - The helper/validation text element.
|
|
46
|
-
* @csspart helper-icon - The helper/validation icon element that is displayed next to the helper/validation text.
|
|
47
|
-
* @csspart help-text-container - The container for the helper/validation icon and text elements.
|
|
48
|
-
* @csspart radio-input - The native radio input element that provides the interactive functionality.
|
|
49
|
-
* @csspart text-container - The container for the label and helper text elements.
|
|
50
50
|
* @csspart static-radio - The staticradio that provides the visual radio appearance.
|
|
51
|
+
*
|
|
52
|
+
* @slot indicator - Slot for the radio indicator element. If not provided, a default styled radio will be rendered.
|
|
53
|
+
* @slot label - Slot for the label of the radio.
|
|
51
54
|
*/
|
|
52
55
|
declare const reactWrapper: import("@lit/react").ReactWebComponent<Component, {
|
|
56
|
+
onInput: EventName<Events["onInputEvent"]>;
|
|
53
57
|
onChange: EventName<Events["onChangeEvent"]>;
|
|
54
58
|
onFocus: EventName<Events["onFocusEvent"]>;
|
|
55
59
|
}>;
|
|
@@ -11,19 +11,26 @@ import { TAG_NAME } from '../../components/radio/radio.constants';
|
|
|
11
11
|
* To create a group of radio buttons, use the `mdc-radiogroup` component or ensure all radio buttons
|
|
12
12
|
* share the same `name` attribute.
|
|
13
13
|
*
|
|
14
|
-
*
|
|
14
|
+
* ## Validation
|
|
15
15
|
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
16
|
+
* Radio component support native form validation. But it does not have default validation message.
|
|
17
|
+
* Also, `required` attribute does not render indicator (red asterisk) for the radio component.
|
|
18
|
+
*
|
|
19
|
+
* The recommended way to show validation message for radio groups is to wrap the `mdc-radio` with `mdc-radiogroup`
|
|
20
|
+
* and set the `help-text` of the `mdc-radiogroup` based on its validation state.
|
|
21
|
+
*
|
|
22
|
+
* Alternatively you can also set the `validation-message` attribute of the `mdc-radio`. This message will appear
|
|
23
|
+
* in a native tooltip when the radio is checked and invalid.
|
|
19
24
|
*
|
|
20
25
|
* ## Accessibility
|
|
26
|
+
*
|
|
21
27
|
* - Provide clear labels that describe each option
|
|
22
28
|
* - Use `data-aria-label` when a visual label is not present
|
|
23
29
|
* - Keyboard navigation: Arrow keys to move between options, Space to select, Tab to navigate groups, Enter to submit form
|
|
24
30
|
* - Group related radio buttons using the same `name` attribute or `mdc-radiogroup` component
|
|
25
31
|
*
|
|
26
32
|
* ## Styling
|
|
33
|
+
*
|
|
27
34
|
* Use the `static-radio` part to apply custom styles to the radio visual element.
|
|
28
35
|
* This part exposes the underlying [StaticRadio](?path=/docs/components-decorator-staticradio--docs) component for advanced styling.
|
|
29
36
|
*
|
|
@@ -35,26 +42,23 @@ import { TAG_NAME } from '../../components/radio/radio.constants';
|
|
|
35
42
|
*
|
|
36
43
|
* @tagname mdc-radio
|
|
37
44
|
*
|
|
38
|
-
* @event
|
|
45
|
+
* @event input - (React: onInput) Event that gets dispatched when the radio state changes (before the change event).
|
|
46
|
+
* @event change - (React: onChange) Event that gets dispatched when the radio state changes (after the input event).
|
|
39
47
|
* @event focus - (React: onFocus) Event that gets dispatched when the radio receives focus.
|
|
40
48
|
*
|
|
41
49
|
* @csspart label - The label element.
|
|
42
50
|
* @csspart label-text - The container for the label and required indicator elements.
|
|
43
|
-
* @csspart required-indicator - The required indicator element that is displayed next to the label when the `required` property is set to true.
|
|
44
|
-
* @csspart info-icon-btn - The info icon button element that is displayed next to the label when the `toggletip-text` property is set.
|
|
45
|
-
* @csspart label-toggletip - The toggletip element that is displayed when the info icon button is clicked.
|
|
46
|
-
* @csspart help-text - The helper/validation text element.
|
|
47
|
-
* @csspart helper-icon - The helper/validation icon element that is displayed next to the helper/validation text.
|
|
48
|
-
* @csspart help-text-container - The container for the helper/validation icon and text elements.
|
|
49
|
-
* @csspart radio-input - The native radio input element that provides the interactive functionality.
|
|
50
|
-
* @csspart text-container - The container for the label and helper text elements.
|
|
51
51
|
* @csspart static-radio - The staticradio that provides the visual radio appearance.
|
|
52
|
+
*
|
|
53
|
+
* @slot indicator - Slot for the radio indicator element. If not provided, a default styled radio will be rendered.
|
|
54
|
+
* @slot label - Slot for the label of the radio.
|
|
52
55
|
*/
|
|
53
56
|
const reactWrapper = createComponent({
|
|
54
57
|
tagName: TAG_NAME,
|
|
55
58
|
elementClass: Component,
|
|
56
59
|
react: React,
|
|
57
60
|
events: {
|
|
61
|
+
onInput: 'input',
|
|
58
62
|
onChange: 'change',
|
|
59
63
|
onFocus: 'focus',
|
|
60
64
|
},
|
|
@@ -6,8 +6,6 @@ import Component from '../../components/radiogroup';
|
|
|
6
6
|
*
|
|
7
7
|
* @tagname mdc-radiogroup
|
|
8
8
|
*
|
|
9
|
-
* @cssproperty --mdc-radiogroup-description-text-normal - color of the description text
|
|
10
|
-
*
|
|
11
9
|
*/
|
|
12
10
|
declare const reactWrapper: import("@lit/react").ReactWebComponent<Component, {}>;
|
|
13
11
|
export default reactWrapper;
|
|
@@ -9,8 +9,6 @@ import { TAG_NAME } from '../../components/radiogroup/radiogroup.constants';
|
|
|
9
9
|
*
|
|
10
10
|
* @tagname mdc-radiogroup
|
|
11
11
|
*
|
|
12
|
-
* @cssproperty --mdc-radiogroup-description-text-normal - color of the description text
|
|
13
|
-
*
|
|
14
12
|
*/
|
|
15
13
|
const reactWrapper = createComponent({
|
|
16
14
|
tagName: TAG_NAME,
|
|
@@ -56,6 +56,9 @@ import type { Events as EventsInherited } from '../../components/buttonsimple/bu
|
|
|
56
56
|
* @csspart filled-icon - The icon of the tab, if active.
|
|
57
57
|
* @csspart indicator - The indicator of the tab.
|
|
58
58
|
* @csspart text - The text of the tab.
|
|
59
|
+
*
|
|
60
|
+
* @slot prefix - The slot for the content before the text, typically used for the icon.
|
|
61
|
+
* @slot postfix - The slot for the content after the text, typically used for the badge or chip.
|
|
59
62
|
*/
|
|
60
63
|
declare const reactWrapper: import("@lit/react").ReactWebComponent<Component, {
|
|
61
64
|
onActiveChange: EventName<Events["onActiveChangeEvent"]>;
|
package/dist/react/tab/index.js
CHANGED
|
@@ -56,6 +56,9 @@ import { TAG_NAME } from '../../components/tab/tab.constants';
|
|
|
56
56
|
* @csspart filled-icon - The icon of the tab, if active.
|
|
57
57
|
* @csspart indicator - The indicator of the tab.
|
|
58
58
|
* @csspart text - The text of the tab.
|
|
59
|
+
*
|
|
60
|
+
* @slot prefix - The slot for the content before the text, typically used for the icon.
|
|
61
|
+
* @slot postfix - The slot for the content after the text, typically used for the badge or chip.
|
|
59
62
|
*/
|
|
60
63
|
const reactWrapper = createComponent({
|
|
61
64
|
tagName: TAG_NAME,
|
|
@@ -3,4 +3,18 @@ import type { Constructor } from './index.types';
|
|
|
3
3
|
export interface DataAriaLabelMixinInterface {
|
|
4
4
|
dataAriaLabel: string | null;
|
|
5
5
|
}
|
|
6
|
+
/**
|
|
7
|
+
* This mixin adds a `data-aria-label` property to the component, which can be used to set the Aria-Label attribute for accessibility.
|
|
8
|
+
*
|
|
9
|
+
* It is useful when a component inside the shadow DOM needs to be labeled for accessibility purposes.
|
|
10
|
+
* The problem with using `aria-label` directly on the host element is that the Screen Reader will read both
|
|
11
|
+
* the host element and the component inside the shadow DOM, which can lead to redundant or confusing information being read out.
|
|
12
|
+
*
|
|
13
|
+
* So instead the consumer can use `data-aria-label` to set the Aria-Label attribute on the component inside the shadow DOM.
|
|
14
|
+
*
|
|
15
|
+
* For example all the input component which has a native input element inside the shadow DOM can use this mixin to allow the
|
|
16
|
+
* consumer to set the Aria-Label attribute on the native input element for better accessibility.
|
|
17
|
+
* @param superClass
|
|
18
|
+
* @constructor
|
|
19
|
+
*/
|
|
6
20
|
export declare const DataAriaLabelMixin: <T extends Constructor<LitElement>>(superClass: T) => Constructor<DataAriaLabelMixinInterface> & T;
|
|
@@ -8,6 +8,20 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
8
8
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
9
|
};
|
|
10
10
|
import { property } from 'lit/decorators.js';
|
|
11
|
+
/**
|
|
12
|
+
* This mixin adds a `data-aria-label` property to the component, which can be used to set the Aria-Label attribute for accessibility.
|
|
13
|
+
*
|
|
14
|
+
* It is useful when a component inside the shadow DOM needs to be labeled for accessibility purposes.
|
|
15
|
+
* The problem with using `aria-label` directly on the host element is that the Screen Reader will read both
|
|
16
|
+
* the host element and the component inside the shadow DOM, which can lead to redundant or confusing information being read out.
|
|
17
|
+
*
|
|
18
|
+
* So instead the consumer can use `data-aria-label` to set the Aria-Label attribute on the component inside the shadow DOM.
|
|
19
|
+
*
|
|
20
|
+
* For example all the input component which has a native input element inside the shadow DOM can use this mixin to allow the
|
|
21
|
+
* consumer to set the Aria-Label attribute on the native input element for better accessibility.
|
|
22
|
+
* @param superClass
|
|
23
|
+
* @constructor
|
|
24
|
+
*/
|
|
11
25
|
export const DataAriaLabelMixin = (superClass) => {
|
|
12
26
|
class InnerMixinClass extends superClass {
|
|
13
27
|
constructor() {
|