@momentum-design/components 0.84.3 → 0.84.4
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/README.md +8 -3
- package/dist/browser/index.js +2233 -2291
- package/dist/browser/index.js.map +4 -4
- package/dist/components/alertchip/alertchip.component.d.ts +1 -1
- package/dist/components/alertchip/alertchip.component.js +2 -2
- package/dist/components/alertchip/alertchip.styles.js +22 -23
- package/dist/components/alertchip/alertchip.types.d.ts +1 -1
- package/dist/components/animation/animation.component.js +1 -1
- package/dist/components/animation/animation.styles.js +8 -5
- package/dist/components/appheader/appheader.component.js +12 -13
- package/dist/components/appheader/appheader.styles.js +0 -1
- package/dist/components/avatar/avatar.component.js +3 -16
- package/dist/components/avatar/avatar.constants.d.ts +1 -1
- package/dist/components/avatar/avatar.constants.js +1 -1
- package/dist/components/avatar/avatar.styles.js +129 -122
- package/dist/components/avatar/avatar.types.d.ts +1 -1
- package/dist/components/avatar/avatar.utils.d.ts +1 -1
- package/dist/components/avatar/avatar.utils.js +1 -1
- package/dist/components/avatarbutton/avatarbutton.component.d.ts +2 -2
- package/dist/components/avatarbutton/avatarbutton.component.js +2 -2
- package/dist/components/avatarbutton/avatarbutton.styles.js +34 -30
- package/dist/components/badge/badge.styles.js +9 -7
- package/dist/components/brandvisual/brandvisual.component.js +4 -4
- package/dist/components/bullet/bullet.component.d.ts +1 -1
- package/dist/components/bullet/bullet.component.js +2 -2
- package/dist/components/bullet/bullet.styles.js +3 -3
- package/dist/components/button/button.component.js +10 -4
- package/dist/components/button/button.utils.js +1 -1
- package/dist/components/buttongroup/buttongroup.component.js +1 -1
- package/dist/components/buttongroup/buttongroup.styles.js +68 -68
- package/dist/components/buttonlink/buttonlink.component.d.ts +5 -5
- package/dist/components/buttonlink/buttonlink.component.js +9 -9
- package/dist/components/buttonsimple/buttonsimple.component.js +2 -2
- package/dist/components/buttonsimple/buttonsimple.constants.d.ts +1 -1
- package/dist/components/buttonsimple/buttonsimple.constants.js +1 -1
- package/dist/components/buttonsimple/buttonsimple.styles.js +62 -57
- package/dist/components/card/card.component.d.ts +6 -6
- package/dist/components/card/card.component.js +15 -16
- package/dist/components/card/card.styles.js +24 -22
- package/dist/components/cardbutton/cardbutton.component.js +9 -12
- package/dist/components/cardbutton/cardbutton.styles.js +1 -1
- package/dist/components/cardcheckbox/cardcheckbox.component.d.ts +6 -6
- package/dist/components/cardcheckbox/cardcheckbox.component.js +30 -29
- package/dist/components/cardcheckbox/cardcheckbox.styles.js +10 -10
- package/dist/components/cardradio/cardradio.component.d.ts +12 -12
- package/dist/components/cardradio/cardradio.component.js +27 -30
- package/dist/components/cardradio/cardradio.styles.js +8 -8
- package/dist/components/checkbox/checkbox.component.js +7 -9
- package/dist/components/checkbox/checkbox.styles.js +62 -60
- package/dist/components/chip/chip.component.d.ts +1 -1
- package/dist/components/chip/chip.component.js +6 -11
- package/dist/components/chip/chip.styles.js +4 -2
- package/dist/components/dialog/dialog.component.js +28 -29
- package/dist/components/dialog/dialog.styles.js +10 -12
- package/dist/components/divider/divider.component.js +6 -8
- package/dist/components/divider/divider.constants.d.ts +1 -1
- package/dist/components/divider/divider.constants.js +1 -1
- package/dist/components/divider/divider.styles.js +5 -20
- package/dist/components/filterchip/filterchip.styles.js +4 -2
- package/dist/components/formfieldgroup/formfieldgroup.component.js +1 -4
- package/dist/components/formfieldgroup/formfieldgroup.styles.js +1 -2
- package/dist/components/formfieldwrapper/formfieldwrapper.component.js +19 -17
- package/dist/components/formfieldwrapper/formfieldwrapper.styles.js +2 -1
- package/dist/components/formfieldwrapper/formfieldwrapper.subcomponent.js +4 -4
- package/dist/components/icon/icon.component.js +7 -7
- package/dist/components/icon/icon.utils.d.ts +1 -1
- package/dist/components/icon/icon.utils.js +7 -7
- package/dist/components/iconprovider/iconprovider.component.js +7 -7
- package/dist/components/input/input.component.d.ts +5 -5
- package/dist/components/input/input.component.js +64 -62
- package/dist/components/input/input.styles.js +128 -117
- package/dist/components/inputchip/inputchip.component.js +14 -19
- package/dist/components/inputchip/inputchip.styles.js +5 -3
- package/dist/components/link/link.component.d.ts +1 -1
- package/dist/components/link/link.component.js +4 -8
- package/dist/components/link/link.constants.d.ts +1 -1
- package/dist/components/link/link.constants.js +1 -1
- package/dist/components/link/link.styles.js +12 -12
- package/dist/components/linksimple/linksimple.component.js +2 -4
- package/dist/components/linksimple/linksimple.styles.js +59 -57
- package/dist/components/list/list.component.js +12 -9
- package/dist/components/listitem/listitem.component.js +15 -11
- package/dist/components/listitem/listitem.styles.js +11 -6
- package/dist/components/marker/marker.component.js +1 -1
- package/dist/components/marker/marker.styles.js +2 -2
- package/dist/components/menubar/menubar.component.d.ts +19 -19
- package/dist/components/menubar/menubar.component.js +19 -19
- package/dist/components/menuitem/menuitem.component.js +15 -15
- package/dist/components/menuitem/menuitem.styles.js +3 -2
- package/dist/components/menuitemcheckbox/menuitemcheckbox.component.d.ts +1 -1
- package/dist/components/menuitemcheckbox/menuitemcheckbox.component.js +4 -11
- package/dist/components/menuitemradio/menuitemradio.component.js +1 -1
- package/dist/components/menupopover/menupopover.component.js +11 -11
- package/dist/components/menupopover/menupopover.utils.d.ts +1 -1
- package/dist/components/menupopover/menupopover.utils.js +3 -8
- package/dist/components/navitem/navitem.component.js +11 -19
- package/dist/components/navitem/navitem.styles.js +147 -143
- package/dist/components/navitemlist/navitemlist.component.js +2 -2
- package/dist/components/optgroup/optgroup.component.js +12 -9
- package/dist/components/option/option.component.js +11 -11
- package/dist/components/option/option.styles.js +1 -1
- package/dist/components/popover/popover.component.js +4 -4
- package/dist/components/popover/popover.stack.js +1 -1
- package/dist/components/popover/popover.styles.js +0 -1
- package/dist/components/popover/popover.utils.js +3 -4
- package/dist/components/presence/presence.component.d.ts +4 -4
- package/dist/components/presence/presence.component.js +4 -4
- package/dist/components/progressbar/progressbar.component.js +3 -4
- package/dist/components/progressbar/progressbar.styles.js +77 -71
- package/dist/components/progressspinner/progressspiner.utils.js +4 -4
- package/dist/components/progressspinner/progressspinner.component.js +38 -37
- package/dist/components/progressspinner/progressspinner.styles.js +1 -1
- package/dist/components/radio/radio.component.d.ts +41 -41
- package/dist/components/radio/radio.component.js +84 -83
- package/dist/components/radio/radio.styles.js +77 -75
- package/dist/components/radiogroup/radiogroup.component.js +1 -1
- package/dist/components/screenreaderannouncer/screenreaderannouncer.component.js +2 -2
- package/dist/components/screenreaderannouncer/screenreaderannouncer.styles.js +8 -6
- package/dist/components/searchfield/searchfield.component.js +23 -17
- package/dist/components/searchfield/searchfield.styles.js +11 -13
- package/dist/components/select/select.component.js +20 -23
- package/dist/components/select/select.styles.js +9 -9
- package/dist/components/sidenavigation/sidenavigation.component.d.ts +6 -6
- package/dist/components/sidenavigation/sidenavigation.component.js +39 -29
- package/dist/components/sidenavigation/sidenavigation.context.js +5 -5
- package/dist/components/sidenavigation/sidenavigation.styles.js +53 -53
- package/dist/components/skeleton/skeleton.component.js +1 -4
- package/dist/components/skeleton/skeleton.constants.d.ts +1 -1
- package/dist/components/skeleton/skeleton.constants.js +1 -1
- package/dist/components/skeleton/skeleton.styles.js +4 -4
- package/dist/components/spinner/spinner.component.d.ts +7 -7
- package/dist/components/spinner/spinner.component.js +9 -9
- package/dist/components/spinner/spinner.styles.js +58 -53
- package/dist/components/staticcheckbox/staticcheckbox.component.js +10 -8
- package/dist/components/staticcheckbox/staticcheckbox.styles.js +52 -51
- package/dist/components/staticradio/staticradio.component.d.ts +8 -8
- package/dist/components/staticradio/staticradio.component.js +10 -11
- package/dist/components/staticradio/staticradio.styles.js +77 -75
- package/dist/components/statictoggle/statictoggle.component.d.ts +3 -3
- package/dist/components/statictoggle/statictoggle.component.js +3 -3
- package/dist/components/statictoggle/statictoggle.styles.js +71 -68
- package/dist/components/tab/tab.component.d.ts +1 -1
- package/dist/components/tab/tab.component.js +2 -2
- package/dist/components/tab/tab.styles.js +247 -245
- package/dist/components/tablist/tablist.component.js +11 -15
- package/dist/components/tablist/tablist.styles.js +27 -25
- package/dist/components/tablist/tablist.types.d.ts +1 -1
- package/dist/components/tablist/tablist.utils.js +4 -4
- package/dist/components/text/fonts.styles.js +49 -49
- package/dist/components/text/text.component.js +21 -11
- package/dist/components/text/text.types.d.ts +1 -1
- package/dist/components/textarea/textarea.component.d.ts +31 -31
- package/dist/components/textarea/textarea.component.js +54 -61
- package/dist/components/textarea/textarea.styles.js +123 -122
- package/dist/components/themeprovider/themeprovider.component.js +1 -1
- package/dist/components/themeprovider/themeprovider.styles.js +4 -4
- package/dist/components/toggle/toggle.component.d.ts +35 -35
- package/dist/components/toggle/toggle.component.js +62 -63
- package/dist/components/toggle/toggle.styles.js +77 -69
- package/dist/components/toggletip/toggletip.component.d.ts +7 -7
- package/dist/components/toggletip/toggletip.component.js +3 -2
- package/dist/components/tooltip/tooltip.component.js +1 -1
- package/dist/components/tooltip/tooltip.styles.js +0 -1
- package/dist/components/virtualizedlist/virtualizedlist.component.js +6 -14
- package/dist/components/virtualizedlist/virtualizedlist.helper.test.d.ts +1 -1
- package/dist/components/virtualizedlist/virtualizedlist.helper.test.js +14 -11
- package/dist/components/virtualizedlist/virtualizedlist.styles.js +4 -4
- package/dist/custom-elements.json +514 -514
- package/dist/index.js +1 -0
- package/dist/models/component/index.d.ts +1 -1
- package/dist/models/index.d.ts +2 -2
- package/dist/models/index.js +1 -1
- package/dist/react/index.d.ts +4 -4
- package/dist/react/index.js +4 -4
- package/dist/utils/mixins/ButtonComponentMixin.js +10 -10
- package/dist/utils/mixins/CardAndDialogFooterMixin.js +21 -22
- package/dist/utils/mixins/FocusTrapMixin.js +12 -12
- package/dist/utils/mixins/IconNameMixin.d.ts +1 -1
- package/dist/utils/mixins/MenuMixin.js +23 -23
- package/dist/utils/mixins/PreventScrollMixin.d.ts +1 -1
- package/dist/utils/styles/index.js +12 -12
- package/package.json +1 -1
@@ -11,12 +11,12 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
11
11
|
import { html, nothing } from 'lit';
|
12
12
|
import { property } from 'lit/decorators.js';
|
13
13
|
import { ifDefined } from 'lit/directives/if-defined.js';
|
14
|
-
import styles from './radio.styles';
|
15
14
|
import FormfieldWrapper from '../formfieldwrapper/formfieldwrapper.component';
|
16
15
|
import { DataAriaLabelMixin } from '../../utils/mixins/DataAriaLabelMixin';
|
17
16
|
import { FormInternalsMixin } from '../../utils/mixins/FormInternalsMixin';
|
18
17
|
import { DEFAULTS as FORMFIELD_DEFAULTS } from '../formfieldwrapper/formfieldwrapper.constants';
|
19
18
|
import { ROLE } from '../../utils/roles';
|
19
|
+
import styles from './radio.styles';
|
20
20
|
/**
|
21
21
|
* Radio allow users to select single options from a list or turn an item/feature on or off.
|
22
22
|
* These are often used in forms, settings, and selection in lists.
|
@@ -48,30 +48,27 @@ class Radio extends FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper)) {
|
|
48
48
|
constructor() {
|
49
49
|
super(...arguments);
|
50
50
|
/**
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
51
|
+
* Determines whether the radio is selected or unselected.
|
52
|
+
*
|
53
|
+
* @default false
|
54
|
+
*/
|
55
55
|
this.checked = false;
|
56
56
|
/**
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
57
|
+
* Determines whether the radio is read-only.
|
58
|
+
*
|
59
|
+
* @default false
|
60
|
+
*/
|
61
61
|
this.readonly = false;
|
62
62
|
/**
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
63
|
+
* Automatically focus on the element when the page loads.
|
64
|
+
* [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/autofocus)
|
65
|
+
* @default false
|
66
|
+
*/
|
67
67
|
this.autofocus = false;
|
68
68
|
this.renderLabelAndHelperText = () => {
|
69
69
|
if (!this.label)
|
70
70
|
return nothing;
|
71
|
-
return html `<div class="mdc-radio__label-container"
|
72
|
-
${this.renderLabel()}
|
73
|
-
${this.renderHelperText()}
|
74
|
-
</div>`;
|
71
|
+
return html `<div class="mdc-radio__label-container">${this.renderLabel()} ${this.renderHelperText()}</div>`;
|
75
72
|
};
|
76
73
|
}
|
77
74
|
connectedCallback() {
|
@@ -83,16 +80,16 @@ class Radio extends FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper)) {
|
|
83
80
|
this.updateTabIndex();
|
84
81
|
}
|
85
82
|
/**
|
86
|
-
|
87
|
-
|
83
|
+
* Returns all radios within the same group (name).
|
84
|
+
*/
|
88
85
|
getAllRadiosWithinSameGroup() {
|
89
86
|
return Array.from(document.querySelectorAll(`mdc-radio[name="${this.name}"]`));
|
90
87
|
}
|
91
88
|
/**
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
89
|
+
* The 'change' event does not bubble up through the shadow DOM as it was not composed.
|
90
|
+
* Therefore, we need to re-dispatch the same event to ensure it is propagated correctly.
|
91
|
+
* Read more: https://developer.mozilla.org/en-US/docs/Web/API/Event/composed
|
92
|
+
*/
|
96
93
|
dispatchChangeEvent(event) {
|
97
94
|
const EventConstructor = event.constructor;
|
98
95
|
this.dispatchEvent(new EventConstructor(event.type, event));
|
@@ -100,12 +97,14 @@ class Radio extends FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper)) {
|
|
100
97
|
/** @internal */
|
101
98
|
formResetCallback() {
|
102
99
|
const radios = this.getAllRadiosWithinSameGroup();
|
103
|
-
radios.forEach(
|
100
|
+
radios.forEach(radio => {
|
104
101
|
radio.checked = false;
|
105
102
|
});
|
106
|
-
this.updateComplete
|
103
|
+
this.updateComplete
|
104
|
+
.then(() => {
|
107
105
|
this.setActualFormValue();
|
108
|
-
})
|
106
|
+
})
|
107
|
+
.catch(error => {
|
109
108
|
if (this.onerror) {
|
110
109
|
this.onerror(error);
|
111
110
|
}
|
@@ -118,8 +117,8 @@ class Radio extends FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper)) {
|
|
118
117
|
}
|
119
118
|
}
|
120
119
|
/**
|
121
|
-
|
122
|
-
|
120
|
+
* @internal
|
121
|
+
*/
|
123
122
|
setComponentValidity(isValid) {
|
124
123
|
if (isValid) {
|
125
124
|
this.internals.setValidity({});
|
@@ -141,21 +140,23 @@ class Radio extends FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper)) {
|
|
141
140
|
* @param isValid - Boolean value to set the validity of the group
|
142
141
|
*/
|
143
142
|
setGroupValidity(radios, isValid) {
|
144
|
-
this.updateComplete
|
145
|
-
|
143
|
+
this.updateComplete
|
144
|
+
.then(() => {
|
145
|
+
radios.forEach(radio => {
|
146
146
|
radio.setComponentValidity(isValid);
|
147
147
|
});
|
148
|
-
})
|
148
|
+
})
|
149
|
+
.catch(error => {
|
149
150
|
if (this.onerror) {
|
150
151
|
this.onerror(error);
|
151
152
|
}
|
152
153
|
});
|
153
154
|
}
|
154
155
|
/**
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
156
|
+
* Updates the form value to reflect the current state of the radio.
|
157
|
+
* If checked, the value is set to the user-provided value.
|
158
|
+
* If unchecked, the value is set to null.
|
159
|
+
*/
|
159
160
|
setActualFormValue() {
|
160
161
|
let actualValue = '';
|
161
162
|
if (this.checked) {
|
@@ -169,28 +170,28 @@ class Radio extends FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper)) {
|
|
169
170
|
this.setGroupValidity(radios, true);
|
170
171
|
}
|
171
172
|
else {
|
172
|
-
const anyRequired = radios.some(
|
173
|
-
const anyChecked = !!radios.find(
|
173
|
+
const anyRequired = radios.some(r => r.required);
|
174
|
+
const anyChecked = !!radios.find(r => r.checked);
|
174
175
|
const isInvalid = anyRequired && !anyChecked;
|
175
176
|
this.setGroupValidity(radios, !isInvalid);
|
176
177
|
}
|
177
178
|
this.internals.setFormValue(actualValue);
|
178
179
|
}
|
179
180
|
/**
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
181
|
+
* Handles the change event on the radio element.
|
182
|
+
* This will toggle the state of the radio element.
|
183
|
+
* Dispatches the change event.
|
184
|
+
*/
|
184
185
|
handleChange(event) {
|
185
186
|
var _a;
|
186
187
|
if (this.disabled || this.readonly)
|
187
188
|
return;
|
188
189
|
const radios = this.getAllRadiosWithinSameGroup();
|
189
|
-
radios.forEach(
|
190
|
+
radios.forEach(radio => {
|
190
191
|
var _a;
|
191
192
|
/**
|
192
|
-
|
193
|
-
|
193
|
+
* Uncheck all radios in the same group (name)
|
194
|
+
*/
|
194
195
|
const radioElement = (_a = radio.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('input');
|
195
196
|
if (radioElement) {
|
196
197
|
radio.checked = false;
|
@@ -205,27 +206,27 @@ class Radio extends FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper)) {
|
|
205
206
|
this.dispatchChangeEvent(event);
|
206
207
|
}
|
207
208
|
/**
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
209
|
+
* Updates the state of the radio button at the specified index within the enabled radios.
|
210
|
+
* Focuses the radio button and triggers the change event if the radio button is not read-only.
|
211
|
+
*
|
212
|
+
* @param enabledRadios - An array of enabled radio buttons within the same group.
|
213
|
+
* @param index - The index of the radio button to be updated within the enabled radios array.
|
214
|
+
* @param event - The event that triggered the update.
|
215
|
+
*/
|
215
216
|
updateRadio(enabledRadios, index, event) {
|
216
217
|
var _a, _b;
|
217
218
|
(_b = (_a = enabledRadios[index].shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('input')) === null || _b === void 0 ? void 0 : _b.focus();
|
218
219
|
enabledRadios[index].handleChange(event);
|
219
220
|
}
|
220
221
|
/**
|
221
|
-
|
222
|
-
|
222
|
+
* Handles the keydown event (Arrow Up/Down/Left/Right) on the radio element.
|
223
|
+
*/
|
223
224
|
handleKeyDown(event) {
|
224
225
|
var _a;
|
225
226
|
if (this.disabled)
|
226
227
|
return;
|
227
228
|
const radios = this.getAllRadiosWithinSameGroup();
|
228
|
-
const enabledRadios = radios.filter(
|
229
|
+
const enabledRadios = radios.filter(radio => !radio.disabled);
|
229
230
|
const currentIndex = enabledRadios.indexOf(this);
|
230
231
|
if (['ArrowDown', 'ArrowRight'].includes(event.key)) {
|
231
232
|
// Move focus to the next radio
|
@@ -246,15 +247,15 @@ class Radio extends FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper)) {
|
|
246
247
|
}
|
247
248
|
}
|
248
249
|
/**
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
250
|
+
* Update tab index for all radios in the same group (name)
|
251
|
+
* If any radio group is checked, it will have a tab index of 0
|
252
|
+
* If no radio group is checked, the first enabled radio will have a tab index of 0
|
253
|
+
*/
|
253
254
|
updateTabIndex() {
|
254
255
|
const radios = this.getAllRadiosWithinSameGroup();
|
255
|
-
const checked = radios.find(
|
256
|
-
const firstEnabledRadio = radios.find(
|
257
|
-
radios.forEach(
|
256
|
+
const checked = radios.find(radio => radio.checked);
|
257
|
+
const firstEnabledRadio = radios.find(radio => !radio.disabled);
|
258
|
+
radios.forEach(radio => {
|
258
259
|
var _a;
|
259
260
|
const inputElement = (_a = radio.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('input');
|
260
261
|
if (inputElement) {
|
@@ -277,32 +278,32 @@ class Radio extends FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper)) {
|
|
277
278
|
render() {
|
278
279
|
var _a;
|
279
280
|
return html `
|
280
|
-
|
281
|
+
<mdc-staticradio
|
281
282
|
class="mdc-focus-ring"
|
282
283
|
?checked="${this.checked}"
|
283
284
|
?disabled="${this.disabled}"
|
284
285
|
?readonly="${this.readonly}"
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
286
|
+
>
|
287
|
+
<input
|
288
|
+
id="${this.id}"
|
289
|
+
type="radio"
|
290
|
+
role="${ROLE.RADIO}"
|
291
|
+
?autofocus="${this.autofocus}"
|
292
|
+
name="${ifDefined(this.name)}"
|
293
|
+
value="${ifDefined(this.value)}"
|
294
|
+
?required="${this.required}"
|
295
|
+
@change=${this.handleChange}
|
296
|
+
@keydown=${this.handleKeyDown}
|
297
|
+
?checked=${this.checked}
|
298
|
+
?readonly=${this.readonly}
|
299
|
+
?disabled=${this.disabled}
|
300
|
+
class="mdc-radio__input"
|
301
|
+
aria-checked="${this.checked}"
|
302
|
+
aria-describedby="${ifDefined(this.helpText ? FORMFIELD_DEFAULTS.HELPER_TEXT_ID : '')}"
|
303
|
+
aria-label="${(_a = this.dataAriaLabel) !== null && _a !== void 0 ? _a : ''}"
|
304
|
+
/>
|
305
|
+
</mdc-staticradio>
|
306
|
+
${this.renderLabelAndHelperText()}
|
306
307
|
`;
|
307
308
|
}
|
308
309
|
}
|
@@ -1,91 +1,93 @@
|
|
1
1
|
import { css } from 'lit';
|
2
2
|
import { hostFitContentStyles, hostFocusRingStyles } from '../../utils/styles';
|
3
|
-
const styles = [
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
3
|
+
const styles = [
|
4
|
+
hostFitContentStyles,
|
5
|
+
css `
|
6
|
+
:host {
|
7
|
+
display: flex;
|
8
|
+
flex-direction: row;
|
9
|
+
align-items: start;
|
10
|
+
gap: 0.5rem;
|
9
11
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
12
|
+
--mdc-radio-text-disabled-color: var(--mds-color-theme-text-primary-disabled);
|
13
|
+
--mdc-radio-control-inactive-hover: var(--mds-color-theme-control-inactive-hover);
|
14
|
+
--mdc-radio-control-inactive-pressed-color: var(--mds-color-theme-control-inactive-pressed);
|
15
|
+
--mdc-radio-control-active-hover-color: var(--mds-color-theme-control-active-hover);
|
16
|
+
--mdc-radio-control-active-pressed-color: var(--mds-color-theme-control-active-pressed);
|
17
|
+
--mdc-radio-control-active-disabled-background: var(--mds-color-theme-control-active-disabled);
|
18
|
+
--mdc-radio-control-inactive-disabled-background: var(--mds-color-theme-control-inactive-disabled);
|
19
|
+
--mdc-radio-disabled-border-color: var(--mds-color-theme-outline-primary-disabled);
|
20
|
+
}
|
19
21
|
|
22
|
+
:host(:hover)::part(radio-icon) {
|
23
|
+
background-color: var(--mdc-radio-control-inactive-hover);
|
24
|
+
}
|
20
25
|
|
21
|
-
|
22
|
-
|
23
|
-
|
26
|
+
:host(:active)::part(radio-icon) {
|
27
|
+
background-color: var(--mdc-radio-control-inactive-pressed-color);
|
28
|
+
}
|
24
29
|
|
25
|
-
|
26
|
-
|
27
|
-
|
30
|
+
:host([checked]:hover)::part(radio-icon) {
|
31
|
+
border-color: var(--mdc-radio-control-active-hover-color);
|
32
|
+
background-color: var(--mdc-radio-control-active-hover-color);
|
33
|
+
}
|
28
34
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
35
|
+
:host([checked]:active)::part(radio-icon) {
|
36
|
+
border-color: var(--mdc-radio-control-active-pressed-color);
|
37
|
+
background-color: var(--mdc-radio-control-active-pressed-color);
|
38
|
+
}
|
33
39
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
40
|
+
:host([readonly]:hover)::part(radio-icon) {
|
41
|
+
border-color: var(--mdc-staticradio-normal-border-color);
|
42
|
+
background-color: var(--mdc-staticradio-control-inactive-color);
|
43
|
+
}
|
38
44
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
45
|
+
:host([disabled]:hover)::part(radio-icon),
|
46
|
+
:host([disabled][readonly]:hover)::part(radio-icon) {
|
47
|
+
border-color: var(--mdc-radio-disabled-border-color);
|
48
|
+
background-color: var(--mdc-radio-control-inactive-disabled-background);
|
49
|
+
}
|
43
50
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
background-color: var(--mdc-radio-control-inactive-disabled-background);
|
48
|
-
}
|
51
|
+
:host([disabled][checked]:hover)::part(radio-icon) {
|
52
|
+
background-color: var(--mdc-radio-control-active-disabled-background);
|
53
|
+
}
|
49
54
|
|
50
|
-
|
51
|
-
|
52
|
-
|
55
|
+
:host([readonly]) .mdc-radio__input,
|
56
|
+
:host([disabled]) .mdc-radio__input,
|
57
|
+
:host([disabled]) .mdc-label,
|
58
|
+
:host([readonly]) .mdc-label {
|
59
|
+
cursor: default;
|
60
|
+
}
|
53
61
|
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
:host([readonly]) .mdc-label{
|
58
|
-
cursor: default;
|
59
|
-
}
|
62
|
+
.mdc-label {
|
63
|
+
cursor: pointer;
|
64
|
+
}
|
60
65
|
|
61
|
-
|
62
|
-
|
63
|
-
|
66
|
+
:host([disabled]) .mdc-radio__label-text,
|
67
|
+
:host([disabled]) .mdc-radio__help-text {
|
68
|
+
color: var(--mdc-radio-text-disabled-color);
|
69
|
+
}
|
64
70
|
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
71
|
+
.mdc-radio__input {
|
72
|
+
position: absolute;
|
73
|
+
opacity: 0;
|
74
|
+
margin: 0;
|
75
|
+
width: 100%;
|
76
|
+
height: 100%;
|
77
|
+
cursor: pointer;
|
78
|
+
z-index: 2;
|
79
|
+
}
|
69
80
|
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
flex-direction: column;
|
83
|
-
justify-content: center;
|
84
|
-
gap: 0.25rem;
|
85
|
-
}
|
86
|
-
:host::part(required-indicator){
|
87
|
-
display: none;
|
88
|
-
}
|
89
|
-
|
90
|
-
`, ...hostFocusRingStyles(true)];
|
81
|
+
.mdc-radio__label-container {
|
82
|
+
display: flex;
|
83
|
+
flex-direction: column;
|
84
|
+
justify-content: center;
|
85
|
+
gap: 0.25rem;
|
86
|
+
}
|
87
|
+
:host::part(required-indicator) {
|
88
|
+
display: none;
|
89
|
+
}
|
90
|
+
`,
|
91
|
+
...hostFocusRingStyles(true),
|
92
|
+
];
|
91
93
|
export default styles;
|
@@ -40,7 +40,7 @@ class RadioGroup extends FormfieldGroup {
|
|
40
40
|
*/
|
41
41
|
firstUpdated() {
|
42
42
|
var _a, _b, _c, _d, _e;
|
43
|
-
(_e = (_d = (_c = (_b = Array.from(((_a = this.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelectorAll('slot')) || [])) === null || _b === void 0 ? void 0 : _b.flatMap(
|
43
|
+
(_e = (_d = (_c = (_b = Array.from(((_a = this.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelectorAll('slot')) || [])) === null || _b === void 0 ? void 0 : _b.flatMap(slot => slot.assignedElements({ flatten: true }))) === null || _c === void 0 ? void 0 : _c.filter(el => el.tagName.toLowerCase() === RADIO_TAGNAME || el.tagName.toLowerCase() === CARD_RADIO_TAGNAME)) === null || _d === void 0 ? void 0 : _d.filter(radio => !radio.hasAttribute('name'))) === null || _e === void 0 ? void 0 : _e.forEach(radio => {
|
44
44
|
radio.setAttribute('name', this.name);
|
45
45
|
if (this.required)
|
46
46
|
radio.setAttribute('required', this.required.toString());
|
@@ -130,10 +130,10 @@ class ScreenreaderAnnouncer extends Component {
|
|
130
130
|
* Clears all timeouts and removes all announcements from the screen reader.
|
131
131
|
*/
|
132
132
|
clearTimeOutsAndAnnouncements() {
|
133
|
-
this.timeOutIds.forEach(
|
133
|
+
this.timeOutIds.forEach(timeOutId => {
|
134
134
|
window.clearTimeout(timeOutId);
|
135
135
|
});
|
136
|
-
this.ariaLiveAnnouncementIds.forEach(
|
136
|
+
this.ariaLiveAnnouncementIds.forEach(announcementId => {
|
137
137
|
var _a;
|
138
138
|
(_a = document.getElementById(announcementId)) === null || _a === void 0 ? void 0 : _a.remove();
|
139
139
|
});
|
@@ -10,8 +10,8 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
10
10
|
import { html } from 'lit';
|
11
11
|
import { queryAssignedElements, state } from 'lit/decorators.js';
|
12
12
|
import { classMap } from 'lit-html/directives/class-map.js';
|
13
|
-
import styles from './searchfield.styles';
|
14
13
|
import Input from '../input/input.component';
|
14
|
+
import styles from './searchfield.styles';
|
15
15
|
import { DEFAULTS } from './searchfield.constants';
|
16
16
|
/**
|
17
17
|
* searchfield component is used as an input field for search functionality.
|
@@ -67,7 +67,7 @@ class Searchfield extends Input {
|
|
67
67
|
var _a;
|
68
68
|
this.hasInputChips = !!((_a = this.inputChips) === null || _a === void 0 ? void 0 : _a.length);
|
69
69
|
if (this.inputChips) {
|
70
|
-
this.inputChips.forEach(
|
70
|
+
this.inputChips.forEach(element => {
|
71
71
|
if (!element.matches(DEFAULTS.INPUT_CHIP_TAG)) {
|
72
72
|
element.remove();
|
73
73
|
}
|
@@ -90,30 +90,36 @@ class Searchfield extends Input {
|
|
90
90
|
clearInputText() {
|
91
91
|
var _a;
|
92
92
|
super.clearInputText();
|
93
|
-
(_a = this.inputChips) === null || _a === void 0 ? void 0 : _a.forEach(
|
93
|
+
(_a = this.inputChips) === null || _a === void 0 ? void 0 : _a.forEach(element => {
|
94
94
|
// Dispatch the custom 'remove' event from inputChip
|
95
95
|
element.dispatchEvent(new CustomEvent('remove', { bubbles: true, composed: true }));
|
96
96
|
});
|
97
97
|
}
|
98
98
|
render() {
|
99
99
|
return html `
|
100
|
-
|
101
|
-
|
100
|
+
${this.renderLabelElement()}
|
101
|
+
<div
|
102
|
+
class="${classMap({
|
102
103
|
'input-container': true,
|
103
104
|
'mdc-focus-ring': this.isInputFocused,
|
104
|
-
})}"
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
105
|
+
})}"
|
106
|
+
part="input-container"
|
107
|
+
>
|
108
|
+
${this.renderLeadingIcon()}
|
109
|
+
<div part="scrollable-container" tabindex="-1">
|
110
|
+
<div
|
111
|
+
part="filters-container"
|
112
|
+
@click=${() => this.inputElement.focus()}
|
113
|
+
@keydown=${(e) => (e.key === 'Enter' ? this.inputElement.focus() : null)}
|
114
|
+
@keyup=${(e) => (e.key === ' ' ? this.inputElement.focus() : null)}
|
115
|
+
>
|
116
|
+
<slot name="filters" @slotchange=${this.renderInputChips}></slot>
|
117
|
+
</div>
|
118
|
+
${this.renderInputElement(DEFAULTS.TYPE, this.hasInputChips)}
|
119
|
+
</div>
|
120
|
+
${this.renderTrailingButton(this.hasInputChips)}
|
113
121
|
</div>
|
114
|
-
|
115
|
-
</div>
|
116
|
-
`;
|
122
|
+
`;
|
117
123
|
}
|
118
124
|
}
|
119
125
|
Searchfield.styles = [...Input.styles, ...styles];
|
@@ -1,23 +1,22 @@
|
|
1
1
|
import { css } from 'lit';
|
2
2
|
const styles = css `
|
3
|
+
:host::part(filters-container) {
|
4
|
+
display: flex;
|
5
|
+
gap: 0.25rem;
|
6
|
+
margin: 0.25rem 0;
|
7
|
+
}
|
3
8
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
}
|
9
|
-
|
10
|
-
.input {
|
11
|
-
white-space: nowrap;
|
12
|
-
min-width: 90%;
|
13
|
-
}
|
9
|
+
.input {
|
10
|
+
white-space: nowrap;
|
11
|
+
min-width: 90%;
|
12
|
+
}
|
14
13
|
|
15
|
-
.input::-webkit-search-cancel-button {
|
14
|
+
.input::-webkit-search-cancel-button {
|
16
15
|
-webkit-appearance: none;
|
17
16
|
pointer-events: none;
|
18
17
|
}
|
19
18
|
|
20
|
-
:host::part(scrollable-container){
|
19
|
+
:host::part(scrollable-container) {
|
21
20
|
display: flex;
|
22
21
|
flex-grow: 1;
|
23
22
|
overflow-x: scroll;
|
@@ -25,6 +24,5 @@ const styles = css `
|
|
25
24
|
position: relative;
|
26
25
|
scrollbar-width: none;
|
27
26
|
}
|
28
|
-
|
29
27
|
`;
|
30
28
|
export default [styles];
|