@momentum-design/components 0.104.11 → 0.104.13
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 +43 -43
- package/dist/browser/index.js.map +3 -3
- package/dist/components/cardcheckbox/cardcheckbox.component.d.ts +1 -1
- package/dist/components/cardcheckbox/cardcheckbox.component.js +2 -1
- package/dist/components/cardcheckbox/cardcheckbox.types.d.ts +3 -1
- package/dist/components/cardradio/cardradio.component.d.ts +1 -1
- package/dist/components/cardradio/cardradio.component.js +3 -2
- package/dist/components/cardradio/cardradio.types.d.ts +3 -1
- package/dist/components/checkbox/checkbox.component.js +1 -1
- package/dist/components/formfieldgroup/formfieldgroup.component.js +0 -2
- package/dist/components/formfieldwrapper/formfieldwrapper.component.d.ts +6 -5
- package/dist/components/formfieldwrapper/formfieldwrapper.component.js +8 -10
- package/dist/components/input/input.component.js +1 -1
- package/dist/components/radio/radio.component.js +1 -1
- package/dist/components/select/select.component.js +1 -1
- package/dist/components/textarea/textarea.component.js +1 -1
- package/dist/components/toggle/toggle.component.js +1 -1
- package/dist/custom-elements.json +1378 -1705
- package/dist/react/cardcheckbox/index.d.ts +4 -1
- package/dist/react/cardcheckbox/index.js +2 -1
- package/dist/react/cardradio/index.d.ts +4 -1
- package/dist/react/cardradio/index.js +2 -1
- package/dist/react/index.d.ts +3 -3
- package/dist/react/index.js +3 -3
- package/dist/utils/mixins/FormInternalsMixin.js +0 -6
- package/package.json +1 -1
@@ -47,7 +47,7 @@ declare const CardCheckbox_base: import("../../utils/mixins/index.types").Constr
|
|
47
47
|
* @event keyup - (React: onKeyUp) This event is dispatched when a key is released on the card.
|
48
48
|
* It toggles the checked state when space key is used.
|
49
49
|
* @event focus - (React: onFocus) Event that gets dispatched when the card receives focus.
|
50
|
-
*
|
50
|
+
* @event change - (React: onChange) Event that gets dispatched when the card's checked state changes.
|
51
51
|
*/
|
52
52
|
declare class CardCheckbox extends CardCheckbox_base {
|
53
53
|
/**
|
@@ -61,7 +61,7 @@ import styles from './cardcheckbox.styles';
|
|
61
61
|
* @event keyup - (React: onKeyUp) This event is dispatched when a key is released on the card.
|
62
62
|
* It toggles the checked state when space key is used.
|
63
63
|
* @event focus - (React: onFocus) Event that gets dispatched when the card receives focus.
|
64
|
-
*
|
64
|
+
* @event change - (React: onChange) Event that gets dispatched when the card's checked state changes.
|
65
65
|
*/
|
66
66
|
class CardCheckbox extends DisabledMixin(TabIndexMixin(Card)) {
|
67
67
|
constructor() {
|
@@ -101,6 +101,7 @@ class CardCheckbox extends DisabledMixin(TabIndexMixin(Card)) {
|
|
101
101
|
if (!this.disabled) {
|
102
102
|
this.checked = !this.checked;
|
103
103
|
}
|
104
|
+
this.dispatchEvent(new Event('change', { bubbles: true, composed: true }));
|
104
105
|
}
|
105
106
|
/**
|
106
107
|
* Toggles the checked state when enter key is used
|
@@ -1,11 +1,13 @@
|
|
1
|
-
import type { OverrideEventTarget, ValueOf } from '../../utils/types';
|
1
|
+
import type { OverrideEventTarget, TypedCustomEvent, ValueOf } from '../../utils/types';
|
2
2
|
import type CardCheckbox from './cardcheckbox.component';
|
3
3
|
import { SELECTION_TYPE } from './cardcheckbox.constants';
|
4
4
|
type SelectionType = ValueOf<typeof SELECTION_TYPE>;
|
5
|
+
type CardCheckboxChangeEvent = TypedCustomEvent<CardCheckbox>;
|
5
6
|
interface Events {
|
6
7
|
onClickEvent: OverrideEventTarget<MouseEvent, CardCheckbox>;
|
7
8
|
onKeyDownEvent: OverrideEventTarget<KeyboardEvent, CardCheckbox>;
|
8
9
|
onKeyUpEvent: OverrideEventTarget<KeyboardEvent, CardCheckbox>;
|
9
10
|
onFocusEvent: OverrideEventTarget<FocusEvent, CardCheckbox>;
|
11
|
+
onChangeEvent: CardCheckboxChangeEvent;
|
10
12
|
}
|
11
13
|
export { SelectionType, Events };
|
@@ -46,7 +46,7 @@ declare const CardRadio_base: import("../../utils/mixins/index.types").Construct
|
|
46
46
|
* @event keyup - (React: onKeyUp) This event is dispatched when a key is released on the card.
|
47
47
|
* It toggles the checked state when space key is used.
|
48
48
|
* @event focus - (React: onFocus) Event that gets dispatched when the card receives focus.
|
49
|
-
*
|
49
|
+
* @event change - (React: onChange) Event that gets dispatched when the card's checked state changes.
|
50
50
|
*/
|
51
51
|
declare class CardRadio extends CardRadio_base {
|
52
52
|
/**
|
@@ -61,7 +61,7 @@ import styles from './cardradio.styles';
|
|
61
61
|
* @event keyup - (React: onKeyUp) This event is dispatched when a key is released on the card.
|
62
62
|
* It toggles the checked state when space key is used.
|
63
63
|
* @event focus - (React: onFocus) Event that gets dispatched when the card receives focus.
|
64
|
-
*
|
64
|
+
* @event change - (React: onChange) Event that gets dispatched when the card's checked state changes.
|
65
65
|
*/
|
66
66
|
class CardRadio extends DisabledMixin(TabIndexMixin(Card)) {
|
67
67
|
constructor() {
|
@@ -96,7 +96,7 @@ class CardRadio extends DisabledMixin(TabIndexMixin(Card)) {
|
|
96
96
|
* Dispatches the change event.
|
97
97
|
*/
|
98
98
|
toggleChecked() {
|
99
|
-
if (this.disabled)
|
99
|
+
if (this.disabled || this.checked)
|
100
100
|
return;
|
101
101
|
const cards = this.getAllCardsWithinSameGroup();
|
102
102
|
cards.forEach(card => {
|
@@ -106,6 +106,7 @@ class CardRadio extends DisabledMixin(TabIndexMixin(Card)) {
|
|
106
106
|
card.checked = false;
|
107
107
|
});
|
108
108
|
this.checked = true;
|
109
|
+
this.dispatchEvent(new Event('change', { bubbles: true, composed: true }));
|
109
110
|
}
|
110
111
|
setDisabled(disabled) {
|
111
112
|
this.setAttribute('aria-disabled', `${disabled}`);
|
@@ -1,9 +1,11 @@
|
|
1
|
-
import type { OverrideEventTarget } from '../../utils/types';
|
1
|
+
import type { OverrideEventTarget, TypedCustomEvent } from '../../utils/types';
|
2
2
|
import type CardRadio from './cardradio.component';
|
3
|
+
type CardRadioChangeEvent = TypedCustomEvent<CardRadio>;
|
3
4
|
interface Events {
|
4
5
|
onClickEvent: OverrideEventTarget<MouseEvent, CardRadio>;
|
5
6
|
onKeyDownEvent: OverrideEventTarget<KeyboardEvent, CardRadio>;
|
6
7
|
onKeyUpEvent: OverrideEventTarget<KeyboardEvent, CardRadio>;
|
7
8
|
onFocusEvent: OverrideEventTarget<FocusEvent, CardRadio>;
|
9
|
+
onChangeEvent: CardRadioChangeEvent;
|
8
10
|
}
|
9
11
|
export type { Events };
|
@@ -18,6 +18,12 @@ declare const FormfieldWrapper_base: import("../../utils/mixins/index.types").Co
|
|
18
18
|
*
|
19
19
|
*/
|
20
20
|
declare class FormfieldWrapper extends FormfieldWrapper_base {
|
21
|
+
/**
|
22
|
+
* Indicates the unique identifier for the native input element.
|
23
|
+
* Required for acccessibility.
|
24
|
+
* @internal
|
25
|
+
*/
|
26
|
+
protected inputId: string;
|
21
27
|
/**
|
22
28
|
* The label of the input field. It is linked to the input field using the `for` attribute.
|
23
29
|
*/
|
@@ -28,11 +34,6 @@ declare class FormfieldWrapper extends FormfieldWrapper_base {
|
|
28
34
|
* @default false
|
29
35
|
*/
|
30
36
|
required: boolean;
|
31
|
-
/**
|
32
|
-
* The unique id of the input field. It is used to link the input field with the label.
|
33
|
-
* @default ''
|
34
|
-
*/
|
35
|
-
id: string;
|
36
37
|
/**
|
37
38
|
* The type of help text. It can be 'default', 'error', 'warning', 'success', 'priority'.
|
38
39
|
*/
|
@@ -9,6 +9,7 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
9
|
};
|
10
10
|
import { html, nothing } from 'lit';
|
11
11
|
import { property } from 'lit/decorators.js';
|
12
|
+
import { v4 as uuidv4 } from 'uuid';
|
12
13
|
import { ifDefined } from 'lit/directives/if-defined.js';
|
13
14
|
import { Component } from '../../models';
|
14
15
|
import { DisabledMixin } from '../../utils/mixins/DisabledMixin';
|
@@ -33,17 +34,18 @@ import { getHelperIcon } from './formfieldwrapper.utils';
|
|
33
34
|
class FormfieldWrapper extends DisabledMixin(Component) {
|
34
35
|
constructor() {
|
35
36
|
super(...arguments);
|
37
|
+
/**
|
38
|
+
* Indicates the unique identifier for the native input element.
|
39
|
+
* Required for acccessibility.
|
40
|
+
* @internal
|
41
|
+
*/
|
42
|
+
this.inputId = `mdc-el-${uuidv4()}`;
|
36
43
|
/**
|
37
44
|
* The required attribute to indicate that the input field is required.
|
38
45
|
* It is used to append a required indicator (*) to the label.
|
39
46
|
* @default false
|
40
47
|
*/
|
41
48
|
this.required = false;
|
42
|
-
/**
|
43
|
-
* The unique id of the input field. It is used to link the input field with the label.
|
44
|
-
* @default ''
|
45
|
-
*/
|
46
|
-
this.id = '';
|
47
49
|
/**
|
48
50
|
* The type of help text. It can be 'default', 'error', 'warning', 'success', 'priority'.
|
49
51
|
*/
|
@@ -66,7 +68,7 @@ class FormfieldWrapper extends DisabledMixin(Component) {
|
|
66
68
|
return nothing;
|
67
69
|
}
|
68
70
|
return this.shouldRenderLabel
|
69
|
-
? html `<label for="${this.
|
71
|
+
? html `<label for="${this.inputId}" id="${DEFAULTS.HEADING_ID}" class="mdc-label" part="label">${this.label}</label>`
|
70
72
|
: html ` <mdc-text
|
71
73
|
id="${DEFAULTS.HEADING_ID}"
|
72
74
|
tagname="${MDC_TEXT_OPTIONS.TAGNAME}"
|
@@ -163,10 +165,6 @@ __decorate([
|
|
163
165
|
property({ type: Boolean, reflect: true, attribute: 'required' }),
|
164
166
|
__metadata("design:type", Object)
|
165
167
|
], FormfieldWrapper.prototype, "required", void 0);
|
166
|
-
__decorate([
|
167
|
-
property({ type: String }),
|
168
|
-
__metadata("design:type", Object)
|
169
|
-
], FormfieldWrapper.prototype, "id", void 0);
|
170
168
|
__decorate([
|
171
169
|
property({ reflect: true, attribute: 'help-text-type' }),
|
172
170
|
__metadata("design:type", String)
|
@@ -284,7 +284,7 @@ class Input extends FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper)) {
|
|
284
284
|
aria-label="${(_a = this.dataAriaLabel) !== null && _a !== void 0 ? _a : ''}"
|
285
285
|
class="input"
|
286
286
|
part="mdc-input"
|
287
|
-
id="${this.
|
287
|
+
id="${this.inputId}"
|
288
288
|
name="${this.name}"
|
289
289
|
.value="${live(this.value)}"
|
290
290
|
?disabled="${this.disabled}"
|
@@ -280,7 +280,7 @@ class Textarea extends FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper))
|
|
280
280
|
<textarea
|
281
281
|
aria-label="${(_a = this.dataAriaLabel) !== null && _a !== void 0 ? _a : ''}"
|
282
282
|
part="textarea"
|
283
|
-
id="${this.
|
283
|
+
id="${this.inputId}"
|
284
284
|
name="${this.name}"
|
285
285
|
.value="${this.value}"
|
286
286
|
?disabled="${this.disabled}"
|