@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
|
@@ -11,6 +11,7 @@ import { property } from 'lit/decorators.js';
|
|
|
11
11
|
import FormfieldGroup from '../formfieldgroup';
|
|
12
12
|
import { TAG_NAME as RADIO_TAGNAME } from '../radio/radio.constants';
|
|
13
13
|
import { TAG_NAME as CARD_RADIO_TAGNAME } from '../cardradio/cardradio.constants';
|
|
14
|
+
const isRadio = new RegExp(`^(${RADIO_TAGNAME}|${CARD_RADIO_TAGNAME})$`, 'i');
|
|
14
15
|
/**
|
|
15
16
|
* `mdc-radiogroup` - This is the wrapper component for radio buttons which are grouped together.
|
|
16
17
|
* It can have a header text and a description. It enables users to select a single option from a set of options.
|
|
@@ -18,8 +19,6 @@ import { TAG_NAME as CARD_RADIO_TAGNAME } from '../cardradio/cardradio.constants
|
|
|
18
19
|
*
|
|
19
20
|
* @tagname mdc-radiogroup
|
|
20
21
|
*
|
|
21
|
-
* @cssproperty --mdc-radiogroup-description-text-normal - color of the description text
|
|
22
|
-
*
|
|
23
22
|
*/
|
|
24
23
|
class RadioGroup extends FormfieldGroup {
|
|
25
24
|
constructor() {
|
|
@@ -31,7 +30,6 @@ class RadioGroup extends FormfieldGroup {
|
|
|
31
30
|
*/
|
|
32
31
|
this.name = '';
|
|
33
32
|
// This is used to set the role of the component as `radiogroup`.
|
|
34
|
-
/** @internal */
|
|
35
33
|
this.isRadio = true;
|
|
36
34
|
}
|
|
37
35
|
/**
|
|
@@ -39,11 +37,15 @@ class RadioGroup extends FormfieldGroup {
|
|
|
39
37
|
* If the name is not set, it will be set to the name of the radio group.
|
|
40
38
|
*/
|
|
41
39
|
firstUpdated() {
|
|
42
|
-
var _a
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
40
|
+
var _a;
|
|
41
|
+
Array.from(((_a = this.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelectorAll('slot')) || [])
|
|
42
|
+
.flatMap(slot => slot.assignedElements({ flatten: true }))
|
|
43
|
+
.filter(el => isRadio.test(el.tagName))
|
|
44
|
+
.forEach(radio => {
|
|
45
|
+
if (!radio.hasAttribute('name')) {
|
|
46
|
+
radio.setAttribute('name', this.name);
|
|
47
|
+
}
|
|
48
|
+
radio.toggleAttribute('required', this.required);
|
|
47
49
|
});
|
|
48
50
|
}
|
|
49
51
|
}
|
|
@@ -56,6 +56,9 @@ declare const Tab_base: import("../../utils/mixins/index.types").Constructor<imp
|
|
|
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 class Tab extends Tab_base {
|
|
61
64
|
/**
|
|
@@ -106,6 +109,7 @@ declare class Tab extends Tab_base {
|
|
|
106
109
|
* Dispatch the activechange event.
|
|
107
110
|
*
|
|
108
111
|
* @param active - The active state of the tab.
|
|
112
|
+
* @internal
|
|
109
113
|
*/
|
|
110
114
|
private handleTabActiveChange;
|
|
111
115
|
private getFilledIconName;
|
|
@@ -72,6 +72,9 @@ import styles from './tab.styles';
|
|
|
72
72
|
* @csspart filled-icon - The icon of the tab, if active.
|
|
73
73
|
* @csspart indicator - The indicator of the tab.
|
|
74
74
|
* @csspart text - The text of the tab.
|
|
75
|
+
*
|
|
76
|
+
* @slot prefix - The slot for the content before the text, typically used for the icon.
|
|
77
|
+
* @slot postfix - The slot for the content after the text, typically used for the badge or chip.
|
|
75
78
|
*/
|
|
76
79
|
class Tab extends IconNameMixin(LifeCycleMixin(Buttonsimple)) {
|
|
77
80
|
constructor() {
|
|
@@ -102,6 +105,7 @@ class Tab extends IconNameMixin(LifeCycleMixin(Buttonsimple)) {
|
|
|
102
105
|
* Dispatch the activechange event.
|
|
103
106
|
*
|
|
104
107
|
* @param active - The active state of the tab.
|
|
108
|
+
* @internal
|
|
105
109
|
*/
|
|
106
110
|
this.handleTabActiveChange = (active) => {
|
|
107
111
|
const event = new CustomEvent('activechange', {
|
|
@@ -186,10 +190,7 @@ class Tab extends IconNameMixin(LifeCycleMixin(Buttonsimple)) {
|
|
|
186
190
|
>`
|
|
187
191
|
: nothing}
|
|
188
192
|
</div>
|
|
189
|
-
<
|
|
190
|
-
<slot name="badge"></slot>
|
|
191
|
-
<slot name="chip"></slot>
|
|
192
|
-
</div>
|
|
193
|
+
<slot name="postfix"></slot>
|
|
193
194
|
</div>
|
|
194
195
|
<div part="indicator"></div>
|
|
195
196
|
`;
|