@m3e/radio-group 1.0.0-rc.3 → 1.0.0
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 +31 -34
- package/dist/custom-elements.json +250 -161
- package/dist/html-custom-data.json +13 -2
- package/dist/index.js +102 -49
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +40 -43
- package/dist/index.min.js.map +1 -1
- package/dist/src/RadioElement.d.ts +10 -1
- package/dist/src/RadioElement.d.ts.map +1 -1
- package/dist/src/RadioGroupElement.d.ts +19 -13
- package/dist/src/RadioGroupElement.d.ts.map +1 -1
- package/package.json +2 -2
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"tags": [
|
|
5
5
|
{
|
|
6
6
|
"name": "m3e-radio",
|
|
7
|
-
"description": "A radio button that allows a user to select one option from a set of options.\n---\n\n\n### **Events:**\n - **input** - Emitted when the checked state changes.\n- **change** - Emitted when the checked state changes.\n- **click** - Emitted when the element is clicked.\n\n### **Methods:**\n - **markAsPristine(): _void_** - Marks the element as pristine.\n- **markAsDirty(): _void_** - Marks the element as dirty.\n- **markAsTouched(): _void_** - Marks the element as touched.\n- **markAsUntouched(): _void_** - Marks the element as untouched.\n\n### **CSS Properties:**\n - **--m3e-radio-container-size** - Base size of the radio button container. _(default: undefined)_\n- **--m3e-radio-icon-size** - Size of the radio icon inside the wrapper. _(default: undefined)_\n- **--m3e-radio-unselected-hover-color** - Hover state layer color when radio is not selected. _(default: undefined)_\n- **--m3e-radio-unselected-focus-color** - Focus state layer color when radio is not selected. _(default: undefined)_\n- **--m3e-radio-unselected-ripple-color** - Ripple color when radio is not selected. _(default: undefined)_\n- **--m3e-radio-unselected-icon-color** - Icon color when radio is not selected. _(default: undefined)_\n- **--m3e-radio-selected-hover-color** - Hover state layer color when radio is selected. _(default: undefined)_\n- **--m3e-radio-selected-focus-color** - Focus state layer color when radio is selected. _(default: undefined)_\n- **--m3e-radio-selected-ripple-color** - Ripple color when radio is selected. _(default: undefined)_\n- **--m3e-radio-selected-icon-color** - Icon color when radio is selected. _(default: undefined)_\n- **--m3e-radio-disabled-icon-color** - Icon color when radio is disabled. _(default: undefined)_",
|
|
7
|
+
"description": "A radio button that allows a user to select one option from a set of options.\n---\n\n\n### **Events:**\n - **input** - Emitted when the checked state changes.\n- **change** - Emitted when the checked state changes.\n- **click** - Emitted when the element is clicked.\n\n### **Methods:**\n - **markAsPristine(): _void_** - Marks the element as pristine.\n- **markAsDirty(): _void_** - Marks the element as dirty.\n- **markAsTouched(): _void_** - Marks the element as touched.\n- **markAsUntouched(): _void_** - Marks the element as untouched.\n- **formDisabledCallback(disabled: _boolean_): _void_** - Called when the element is disabled or enabled via its form association.\n- **formResetCallback(): _void_** - Called when the associated form is reset.\n\n### **CSS Properties:**\n - **--m3e-radio-container-size** - Base size of the radio button container. _(default: undefined)_\n- **--m3e-radio-icon-size** - Size of the radio icon inside the wrapper. _(default: undefined)_\n- **--m3e-radio-unselected-hover-color** - Hover state layer color when radio is not selected. _(default: undefined)_\n- **--m3e-radio-unselected-focus-color** - Focus state layer color when radio is not selected. _(default: undefined)_\n- **--m3e-radio-unselected-ripple-color** - Ripple color when radio is not selected. _(default: undefined)_\n- **--m3e-radio-unselected-icon-color** - Icon color when radio is not selected. _(default: undefined)_\n- **--m3e-radio-selected-hover-color** - Hover state layer color when radio is selected. _(default: undefined)_\n- **--m3e-radio-selected-focus-color** - Focus state layer color when radio is selected. _(default: undefined)_\n- **--m3e-radio-selected-ripple-color** - Ripple color when radio is selected. _(default: undefined)_\n- **--m3e-radio-selected-icon-color** - Icon color when radio is selected. _(default: undefined)_\n- **--m3e-radio-disabled-icon-color** - Icon color when radio is disabled. _(default: undefined)_\n- **--m3e-radio-error-hover-color** - Fallback hover color used when the radio is invalid and touched. _(default: undefined)_\n- **--m3e-radio-error-focus-color** - Fallback focus color used when the radio is invalid and touched. _(default: undefined)_\n- **--m3e-radio-error-ripple-color** - Fallback ripple color used when the radio is invalid and touched. _(default: undefined)_\n- **--m3e-radio-error-icon-color** - Fallback icon color used when the radio is invalid and touched. _(default: undefined)_",
|
|
8
8
|
"attributes": [
|
|
9
9
|
{
|
|
10
10
|
"name": "checked",
|
|
@@ -16,6 +16,16 @@
|
|
|
16
16
|
"description": "Whether the element is disabled.",
|
|
17
17
|
"values": []
|
|
18
18
|
},
|
|
19
|
+
{
|
|
20
|
+
"name": "name",
|
|
21
|
+
"description": "The name that identifies the element when submitting the associated form.",
|
|
22
|
+
"values": []
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"name": "required",
|
|
26
|
+
"description": "Whether the element is required.",
|
|
27
|
+
"values": []
|
|
28
|
+
},
|
|
19
29
|
{
|
|
20
30
|
"name": "value",
|
|
21
31
|
"description": "A string representing the value of the radio.",
|
|
@@ -26,8 +36,9 @@
|
|
|
26
36
|
},
|
|
27
37
|
{
|
|
28
38
|
"name": "m3e-radio-group",
|
|
29
|
-
"description": "A container for a set of radio buttons
|
|
39
|
+
"description": "A container for a set of radio buttons.\n---\n\n\n### **Events:**\n - **change** - Emitted when the checked state of a radio button changes.\n\n### **Methods:**\n - **markAsTouched(): _void_** - Marks the element as touched.\n- **markAsUntouched(): _void_** - Marks the element as untouched.\n- **markAsDirty(): _void_** - Marks the element as dirty.\n- **markAsPristine(): _void_** - Marks the element as pristine.\n- **reportValidity(): _boolean_** - Returns `true` if the element has no validity problems; otherwise, returns `false`, fires\r\nan invalid event, and (if the event isn't canceled) reports the problem to the user.\n- **checkValidity(): _boolean_** - Returns `true` if the element has no validity problems; otherwise,\r\nreturns `false`, fires an invalid event.\n- **setCustomValidity(error: _string_): _void_** - Sets a custom validity message for the element.\n- **formDisabledCallback(disabled: _boolean_): _void_** - Called when the element is disabled or enabled via its form association.\n- **formResetCallback(): _void_** - Called when the associated form is reset.\n\n### **Slots:**\n - _default_ - Renders the radio buttons of the group.",
|
|
30
40
|
"attributes": [
|
|
41
|
+
{ "name": "aria-invalid", "values": [] },
|
|
31
42
|
{
|
|
32
43
|
"name": "disabled",
|
|
33
44
|
"description": "Whether the element is disabled.",
|
package/dist/index.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* See LICENSE file in the project root for full license text.
|
|
5
5
|
*/
|
|
6
6
|
import { LitElement, html, css } from 'lit';
|
|
7
|
-
import { Dirty, Touched, Checked,
|
|
7
|
+
import { Labelled, Dirty, Touched, Checked, KeyboardClick, Focusable, FormAssociated, Disabled, AttachInternals, Role, HoverController, PressedController, formValue, DesignToken, RequiredConstraintValidation, Required, ConstraintValidation, updateLabels } from '@m3e/core';
|
|
8
8
|
import { selectionManager, SelectionManager } from '@m3e/core/a11y';
|
|
9
9
|
|
|
10
10
|
/******************************************************************************
|
|
@@ -81,7 +81,7 @@ const e$1=(e,t,c)=>(c.configurable=true,c.enumerable=true,Reflect.decorate&&"obj
|
|
|
81
81
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
82
82
|
*/function e(e,r){return (n,s,i)=>{const o=t=>t.renderRoot?.querySelector(e)??null;return e$1(n,s,{get(){return o(this)}})}}
|
|
83
83
|
|
|
84
|
-
var _M3eRadioElement_instances, _M3eRadioElement_clickHandler, _M3eRadioElement_hoverController, _M3eRadioElement_pressedController, _M3eRadioElement_renderIcon, _M3eRadioElement_handleClick;
|
|
84
|
+
var _M3eRadioElement_instances, _M3eRadioElement_clickHandler, _M3eRadioElement_hoverController, _M3eRadioElement_pressedController, _M3eRadioElement_renderIcon, _M3eRadioElement_handleClick, _M3eRadioElement_notifySelectionChange;
|
|
85
85
|
/**
|
|
86
86
|
* A radio button that allows a user to select one option from a set of options.
|
|
87
87
|
*
|
|
@@ -111,6 +111,8 @@ var _M3eRadioElement_instances, _M3eRadioElement_clickHandler, _M3eRadioElement_
|
|
|
111
111
|
*
|
|
112
112
|
* @attr checked - Whether the element is checked.
|
|
113
113
|
* @attr disabled - Whether the element is disabled.
|
|
114
|
+
* @attr name - The name that identifies the element when submitting the associated form.
|
|
115
|
+
* @attr required - Whether the element is required.
|
|
114
116
|
* @attr value - A string representing the value of the radio.
|
|
115
117
|
*
|
|
116
118
|
* @fires input - Emitted when the checked state changes.
|
|
@@ -128,8 +130,12 @@ var _M3eRadioElement_instances, _M3eRadioElement_clickHandler, _M3eRadioElement_
|
|
|
128
130
|
* @cssprop --m3e-radio-selected-ripple-color - Ripple color when radio is selected.
|
|
129
131
|
* @cssprop --m3e-radio-selected-icon-color - Icon color when radio is selected.
|
|
130
132
|
* @cssprop --m3e-radio-disabled-icon-color - Icon color when radio is disabled.
|
|
133
|
+
* @cssprop --m3e-radio-error-hover-color - Fallback hover color used when the radio is invalid and touched.
|
|
134
|
+
* @cssprop --m3e-radio-error-focus-color - Fallback focus color used when the radio is invalid and touched.
|
|
135
|
+
* @cssprop --m3e-radio-error-ripple-color - Fallback ripple color used when the radio is invalid and touched.
|
|
136
|
+
* @cssprop --m3e-radio-error-icon-color - Fallback icon color used when the radio is invalid and touched.
|
|
131
137
|
*/
|
|
132
|
-
let M3eRadioElement = class M3eRadioElement extends Dirty(Touched(Checked(
|
|
138
|
+
let M3eRadioElement = class M3eRadioElement extends Labelled(Dirty(Touched(Checked(KeyboardClick(Focusable(FormAssociated(Disabled(AttachInternals(Role(LitElement, "radio"), true))))))))) {
|
|
133
139
|
constructor() {
|
|
134
140
|
super(...arguments);
|
|
135
141
|
_M3eRadioElement_instances.add(this);
|
|
@@ -167,6 +173,10 @@ let M3eRadioElement = class M3eRadioElement extends Dirty(Touched(Checked(Labell
|
|
|
167
173
|
*/
|
|
168
174
|
this.value = "on";
|
|
169
175
|
}
|
|
176
|
+
/** @inheritdoc @internal */
|
|
177
|
+
get [(_M3eRadioElement_clickHandler = new WeakMap(), _M3eRadioElement_hoverController = new WeakMap(), _M3eRadioElement_pressedController = new WeakMap(), _M3eRadioElement_instances = new WeakSet(), formValue)]() {
|
|
178
|
+
return this.checked ? this.value : null;
|
|
179
|
+
}
|
|
170
180
|
/** @inheritdoc */
|
|
171
181
|
connectedCallback() {
|
|
172
182
|
super.connectedCallback();
|
|
@@ -189,7 +199,7 @@ let M3eRadioElement = class M3eRadioElement extends Dirty(Touched(Checked(Labell
|
|
|
189
199
|
update(changedProperties) {
|
|
190
200
|
super.update(changedProperties);
|
|
191
201
|
if (changedProperties.has("checked")) {
|
|
192
|
-
this
|
|
202
|
+
__classPrivateFieldGet(this, _M3eRadioElement_instances, "m", _M3eRadioElement_notifySelectionChange).call(this);
|
|
193
203
|
}
|
|
194
204
|
}
|
|
195
205
|
/** @inheritdoc */
|
|
@@ -208,10 +218,6 @@ let M3eRadioElement = class M3eRadioElement extends Dirty(Touched(Checked(Labell
|
|
|
208
218
|
</div>`;
|
|
209
219
|
}
|
|
210
220
|
};
|
|
211
|
-
_M3eRadioElement_clickHandler = new WeakMap();
|
|
212
|
-
_M3eRadioElement_hoverController = new WeakMap();
|
|
213
|
-
_M3eRadioElement_pressedController = new WeakMap();
|
|
214
|
-
_M3eRadioElement_instances = new WeakSet();
|
|
215
221
|
_M3eRadioElement_renderIcon = function _M3eRadioElement_renderIcon() {
|
|
216
222
|
return html `<svg viewBox="0 0 20 20">
|
|
217
223
|
<mask id="cutout2">
|
|
@@ -223,17 +229,32 @@ _M3eRadioElement_renderIcon = function _M3eRadioElement_renderIcon() {
|
|
|
223
229
|
</svg>`;
|
|
224
230
|
};
|
|
225
231
|
_M3eRadioElement_handleClick = function _M3eRadioElement_handleClick(e) {
|
|
226
|
-
if (e.defaultPrevented || this.checked)
|
|
232
|
+
if (e.defaultPrevented || this.checked || this.disabled)
|
|
227
233
|
return;
|
|
228
234
|
this.checked = true;
|
|
229
235
|
if (this.dispatchEvent(new Event("input", { bubbles: true, composed: true, cancelable: true }))) {
|
|
230
|
-
this
|
|
236
|
+
__classPrivateFieldGet(this, _M3eRadioElement_instances, "m", _M3eRadioElement_notifySelectionChange).call(this);
|
|
231
237
|
this.dispatchEvent(new Event("change", { bubbles: true }));
|
|
232
238
|
}
|
|
233
239
|
else {
|
|
234
240
|
this.checked = false;
|
|
235
241
|
}
|
|
236
242
|
};
|
|
243
|
+
_M3eRadioElement_notifySelectionChange = function _M3eRadioElement_notifySelectionChange() {
|
|
244
|
+
const group = this.closest("m3e-radio-group");
|
|
245
|
+
if (group) {
|
|
246
|
+
group[selectionManager].notifySelectionChange(this);
|
|
247
|
+
}
|
|
248
|
+
else if (this.name && this.checked) {
|
|
249
|
+
// Uncheck any sibling radios of the same name which are also checked.
|
|
250
|
+
[
|
|
251
|
+
...(this.getRootNode()?.querySelectorAll(`m3e-radio[name="${this.name}"]`) ??
|
|
252
|
+
[]),
|
|
253
|
+
]
|
|
254
|
+
.filter((x) => x !== this && x.checked)
|
|
255
|
+
.forEach((x) => (x.checked = false));
|
|
256
|
+
}
|
|
257
|
+
};
|
|
237
258
|
/** The styles of the element. */
|
|
238
259
|
M3eRadioElement.styles = css `
|
|
239
260
|
:host {
|
|
@@ -243,7 +264,7 @@ M3eRadioElement.styles = css `
|
|
|
243
264
|
height: fit-content;
|
|
244
265
|
vertical-align: middle;
|
|
245
266
|
}
|
|
246
|
-
:host(:not(
|
|
267
|
+
:host(:not([aria-disabled="true"])) {
|
|
247
268
|
cursor: pointer;
|
|
248
269
|
}
|
|
249
270
|
.base {
|
|
@@ -287,9 +308,15 @@ M3eRadioElement.styles = css `
|
|
|
287
308
|
--m3e-ripple-color: var(--m3e-radio-selected-ripple-color, ${DesignToken.color.primary});
|
|
288
309
|
color: var(--m3e-radio-selected-icon-color, ${DesignToken.color.primary});
|
|
289
310
|
}
|
|
290
|
-
:host(
|
|
311
|
+
:host([aria-disabled="true"]) .base {
|
|
291
312
|
color: color-mix(in srgb, var(--m3e-radio-disabled-icon-color, ${DesignToken.color.onSurface}) 38%, transparent);
|
|
292
313
|
}
|
|
314
|
+
:host(.-touched.-invalid) .base {
|
|
315
|
+
--m3e-state-layer-hover-color: var(--m3e-radio-error-hover-color, ${DesignToken.color.error});
|
|
316
|
+
--m3e-state-layer-focus-color: var(--m3e-radio-error-focus-color, ${DesignToken.color.error});
|
|
317
|
+
--m3e-ripple-color: var(--m3e-radio-error-ripple-color, ${DesignToken.color.error});
|
|
318
|
+
color: var(--m3e-radio-error-icon-color, ${DesignToken.color.error});
|
|
319
|
+
}
|
|
293
320
|
@media (forced-colors: active) {
|
|
294
321
|
:host(:not([checked])) .base,
|
|
295
322
|
:host([checked]) .base {
|
|
@@ -298,9 +325,13 @@ M3eRadioElement.styles = css `
|
|
|
298
325
|
--m3e-ripple-color: var(--_radio-forced-color, CanvasText);
|
|
299
326
|
color: var(--_radio-forced-color, CanvasText);
|
|
300
327
|
}
|
|
301
|
-
:host(
|
|
328
|
+
:host([aria-disabled="true"]) .base {
|
|
302
329
|
color: GrayText;
|
|
303
330
|
}
|
|
331
|
+
:host(.-touched.-invalid) .base {
|
|
332
|
+
--_radio-forced-color: Highlight;
|
|
333
|
+
color: Highlight;
|
|
334
|
+
}
|
|
304
335
|
}
|
|
305
336
|
`;
|
|
306
337
|
__decorate([
|
|
@@ -321,12 +352,14 @@ M3eRadioElement = __decorate([
|
|
|
321
352
|
|
|
322
353
|
var _M3eRadioGroupElement_instances, _M3eRadioGroupElement_focusOutHandler, _M3eRadioGroupElement_handleSlotChange, _M3eRadioGroupElement_handleKeyDown, _M3eRadioGroupElement_handleChange, _a;
|
|
323
354
|
/**
|
|
324
|
-
* A container for a set of radio buttons
|
|
355
|
+
* A container for a set of radio buttons.
|
|
325
356
|
*
|
|
326
357
|
* @description
|
|
327
|
-
* The `m3e-radio-group` component orchestrates a
|
|
328
|
-
*
|
|
329
|
-
*
|
|
358
|
+
* The `m3e-radio-group` component is a semantic container that orchestrates a set of `m3e-radio` elements.
|
|
359
|
+
* It provides accessible grouping, keyboard navigation, and validation logic for mutually exclusive selection.
|
|
360
|
+
* When marked as `required`, the group enforces selection constraints and reflects validation state, while
|
|
361
|
+
* delegating form submission to the checked radio. The group does not submit a value itself—it coordinates
|
|
362
|
+
* behavior, focus, and feedback across its radios.
|
|
330
363
|
*
|
|
331
364
|
* @example
|
|
332
365
|
* The following example illustrates using `m3e-radio-group` and `m3e-radio` to present a group of options.
|
|
@@ -350,23 +383,22 @@ var _M3eRadioGroupElement_instances, _M3eRadioGroupElement_focusOutHandler, _M3e
|
|
|
350
383
|
* @attr required - Whether the element is required.
|
|
351
384
|
*
|
|
352
385
|
* @fires change - Emitted when the checked state of a radio button changes.
|
|
353
|
-
*
|
|
354
|
-
* @cssprop --m3e-radio-error-hover-color - Fallback hover color used when the radio is invalid and touched.
|
|
355
|
-
* @cssprop --m3e-radio-error-focus-color - Fallback focus color used when the radio is invalid and touched.
|
|
356
|
-
* @cssprop --m3e-radio-error-ripple-color - Fallback ripple color used when the radio is invalid and touched.
|
|
357
|
-
* @cssprop --m3e-radio-error-icon-color - Fallback icon color used when the radio is invalid and touched.
|
|
358
386
|
*/
|
|
359
387
|
let M3eRadioGroupElement = class M3eRadioGroupElement extends Labelled(RequiredConstraintValidation(Dirty(Touched(Required(ConstraintValidation(FormAssociated(Disabled(AttachInternals(Role(LitElement, "radiogroup")))))))))) {
|
|
360
388
|
constructor() {
|
|
361
389
|
super(...arguments);
|
|
362
390
|
_M3eRadioGroupElement_instances.add(this);
|
|
363
|
-
/** @private */ _M3eRadioGroupElement_focusOutHandler.set(this, () => this.
|
|
391
|
+
/** @private */ _M3eRadioGroupElement_focusOutHandler.set(this, () => __classPrivateFieldGet(this, _M3eRadioGroupElement_instances, "m", _M3eRadioGroupElement_handleChange).call(this));
|
|
364
392
|
/** @internal */
|
|
365
393
|
this[_a] = new SelectionManager().withWrap().onActiveItemChange(() => {
|
|
366
394
|
this[selectionManager].activeItem?.click();
|
|
367
395
|
});
|
|
368
396
|
}
|
|
369
|
-
/** The
|
|
397
|
+
/** The list of attributes corresponding to the registered properties. */
|
|
398
|
+
static get observedAttributes() {
|
|
399
|
+
return [...super.observedAttributes, "aria-invalid"];
|
|
400
|
+
}
|
|
401
|
+
/** The radios in the group. */
|
|
370
402
|
get radios() {
|
|
371
403
|
return this[selectionManager]?.items ?? [];
|
|
372
404
|
}
|
|
@@ -378,23 +410,57 @@ let M3eRadioGroupElement = class M3eRadioGroupElement extends Labelled(RequiredC
|
|
|
378
410
|
get value() {
|
|
379
411
|
return this.selected?.value ?? null;
|
|
380
412
|
}
|
|
381
|
-
/** @inheritdoc
|
|
382
|
-
|
|
383
|
-
|
|
413
|
+
/** @inheritdoc */
|
|
414
|
+
markAsTouched() {
|
|
415
|
+
super.markAsTouched();
|
|
416
|
+
this.radios.forEach((x) => x.markAsTouched());
|
|
417
|
+
}
|
|
418
|
+
/** @inheritdoc */
|
|
419
|
+
markAsUntouched() {
|
|
420
|
+
super.markAsUntouched();
|
|
421
|
+
this.radios.forEach((x) => x.markAsUntouched());
|
|
422
|
+
}
|
|
423
|
+
/** @inheritdoc */
|
|
424
|
+
markAsDirty() {
|
|
425
|
+
super.markAsDirty();
|
|
426
|
+
this.radios.forEach((x) => x.markAsDirty());
|
|
427
|
+
}
|
|
428
|
+
/** @inheritdoc */
|
|
429
|
+
markAsPristine() {
|
|
430
|
+
super.markAsPristine();
|
|
431
|
+
this.radios.forEach((x) => x.markAsPristine());
|
|
432
|
+
}
|
|
433
|
+
/** Synchronizes property values when attributes change. */
|
|
434
|
+
attributeChangedCallback(name, oldValue, newValue) {
|
|
435
|
+
super.attributeChangedCallback(name, oldValue, newValue);
|
|
436
|
+
switch (name) {
|
|
437
|
+
case "name":
|
|
438
|
+
this.radios.forEach((x) => (x.name = this.name));
|
|
439
|
+
break;
|
|
440
|
+
case "aria-invalid":
|
|
441
|
+
this.radios.forEach((x) => {
|
|
442
|
+
x.classList.toggle("-invalid", newValue === "true");
|
|
443
|
+
x[updateLabels]?.();
|
|
444
|
+
});
|
|
445
|
+
break;
|
|
446
|
+
}
|
|
384
447
|
}
|
|
385
448
|
/** @inheritdoc */
|
|
386
449
|
connectedCallback() {
|
|
387
450
|
super.connectedCallback();
|
|
388
|
-
this.addEventListener("focusout", __classPrivateFieldGet(this, _M3eRadioGroupElement_focusOutHandler, "f")
|
|
451
|
+
this.addEventListener("focusout", __classPrivateFieldGet(this, _M3eRadioGroupElement_focusOutHandler, "f"));
|
|
389
452
|
}
|
|
390
453
|
/** @inheritdoc */
|
|
391
454
|
disconnectedCallback() {
|
|
392
455
|
super.disconnectedCallback();
|
|
393
|
-
this.removeEventListener("focusout", __classPrivateFieldGet(this, _M3eRadioGroupElement_focusOutHandler, "f")
|
|
456
|
+
this.removeEventListener("focusout", __classPrivateFieldGet(this, _M3eRadioGroupElement_focusOutHandler, "f"));
|
|
394
457
|
}
|
|
395
458
|
/** @inheritdoc */
|
|
396
459
|
update(changedProperties) {
|
|
397
460
|
super.update(changedProperties);
|
|
461
|
+
if (changedProperties.has("disabled")) {
|
|
462
|
+
this.ariaDisabled = null;
|
|
463
|
+
}
|
|
398
464
|
if (changedProperties.has("disabled") && (changedProperties.get("disabled") !== undefined || this.disabled)) {
|
|
399
465
|
this[selectionManager].disabled = this.disabled;
|
|
400
466
|
}
|
|
@@ -408,37 +474,24 @@ let M3eRadioGroupElement = class M3eRadioGroupElement extends Labelled(RequiredC
|
|
|
408
474
|
></slot>`;
|
|
409
475
|
}
|
|
410
476
|
};
|
|
477
|
+
_M3eRadioGroupElement_focusOutHandler = new WeakMap();
|
|
478
|
+
_M3eRadioGroupElement_instances = new WeakSet();
|
|
479
|
+
_a = selectionManager;
|
|
411
480
|
_M3eRadioGroupElement_handleSlotChange = function _M3eRadioGroupElement_handleSlotChange() {
|
|
412
|
-
this[selectionManager].setItems([...this.querySelectorAll("m3e-radio")]);
|
|
481
|
+
const { added } = this[selectionManager].setItems([...this.querySelectorAll("m3e-radio")]);
|
|
482
|
+
added.forEach((x) => (x.name = x.name || this.name));
|
|
413
483
|
};
|
|
414
484
|
_M3eRadioGroupElement_handleKeyDown = function _M3eRadioGroupElement_handleKeyDown(e) {
|
|
415
485
|
this[selectionManager].onKeyDown(e);
|
|
416
486
|
};
|
|
417
|
-
_M3eRadioGroupElement_handleChange = function _M3eRadioGroupElement_handleChange(
|
|
418
|
-
|
|
419
|
-
if (this.ariaInvalid === "true") {
|
|
420
|
-
this.checkValidity();
|
|
421
|
-
}
|
|
422
|
-
this.dispatchEvent(new Event("change", { bubbles: true }));
|
|
487
|
+
_M3eRadioGroupElement_handleChange = function _M3eRadioGroupElement_handleChange() {
|
|
488
|
+
this.checkValidity();
|
|
423
489
|
};
|
|
424
490
|
/** The styles of the element. */
|
|
425
491
|
M3eRadioGroupElement.styles = css `
|
|
426
492
|
:host {
|
|
427
493
|
display: inline;
|
|
428
494
|
}
|
|
429
|
-
:host(.-touched:invalid) {
|
|
430
|
-
--m3e-radio-unselected-hover-color: var(--m3e-radio-error-hover-color, ${DesignToken.color.error});
|
|
431
|
-
--m3e-radio-unselected-focus-color: var(--m3e-radio-error-focus-color, ${DesignToken.color.error});
|
|
432
|
-
--m3e-radio-unselected-ripple-color: var(--m3e-radio-error-ripple-color, ${DesignToken.color.error});
|
|
433
|
-
--m3e-radio-unselected-icon-color: var(--m3e-radio-error-icon-color, ${DesignToken.color.error});
|
|
434
|
-
color: var(--m3e-radio-error-icon-color, ${DesignToken.color.error});
|
|
435
|
-
}
|
|
436
|
-
@media (forced-colors: active) {
|
|
437
|
-
:host(.-touched:invalid) {
|
|
438
|
-
--_radio-forced-color: Highlight;
|
|
439
|
-
color: Highlight;
|
|
440
|
-
}
|
|
441
|
-
}
|
|
442
495
|
`;
|
|
443
496
|
M3eRadioGroupElement = __decorate([
|
|
444
497
|
t$1("m3e-radio-group")
|