@m3e/radio-group 1.0.5 → 1.1.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 +3 -2
- package/dist/custom-elements.json +8 -0
- package/dist/index.js +579 -325
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +7 -107
- package/dist/index.min.js.map +1 -1
- package/dist/src/RadioGroupElement.d.ts.map +1 -1
- package/package.json +2 -16
package/dist/index.js
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
import { LitElement, html, css } from 'lit';
|
|
7
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
|
+
import { M3eDirectionality } from '@m3e/core/bidi';
|
|
9
10
|
|
|
10
11
|
/******************************************************************************
|
|
11
12
|
Copyright (c) Microsoft Corporation.
|
|
@@ -20,26 +21,30 @@ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
|
20
21
|
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
21
22
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
22
23
|
PERFORMANCE OF THIS SOFTWARE.
|
|
23
|
-
***************************************************************************** */
|
|
24
|
-
/* global Reflect, Promise, SuppressedError, Symbol, Iterator */
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
24
|
+
***************************************************************************** */
|
|
25
|
+
/* global Reflect, Promise, SuppressedError, Symbol, Iterator */
|
|
26
|
+
|
|
27
|
+
function __decorate(decorators, target, key, desc) {
|
|
28
|
+
var c = arguments.length,
|
|
29
|
+
r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,
|
|
30
|
+
d;
|
|
31
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
32
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
33
|
+
}
|
|
34
|
+
function __classPrivateFieldGet(receiver, state, kind, f) {
|
|
35
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
36
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
37
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
38
|
+
}
|
|
39
|
+
function __classPrivateFieldSet(receiver, state, value, kind, f) {
|
|
40
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
41
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
42
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
43
|
+
return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
|
|
44
|
+
}
|
|
45
|
+
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
46
|
+
var e = new Error(message);
|
|
47
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
43
48
|
};
|
|
44
49
|
|
|
45
50
|
/**
|
|
@@ -47,39 +52,395 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
|
|
|
47
52
|
* Copyright 2017 Google LLC
|
|
48
53
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
49
54
|
*/
|
|
50
|
-
const t$1=t=>(e,o)=>
|
|
55
|
+
const t$1 = t => (e, o) => {
|
|
56
|
+
void 0 !== o ? o.addInitializer(() => {
|
|
57
|
+
customElements.define(t, e);
|
|
58
|
+
}) : customElements.define(t, e);
|
|
59
|
+
};
|
|
51
60
|
|
|
52
61
|
/**
|
|
53
62
|
* @license
|
|
54
63
|
* Copyright 2019 Google LLC
|
|
55
64
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
56
65
|
*/
|
|
57
|
-
const t
|
|
66
|
+
const t = globalThis,
|
|
67
|
+
e$3 = t.ShadowRoot && (void 0 === t.ShadyCSS || t.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype,
|
|
68
|
+
s = Symbol(),
|
|
69
|
+
o$2 = new WeakMap();
|
|
70
|
+
let n$2 = class n {
|
|
71
|
+
constructor(t, e, o) {
|
|
72
|
+
if (this._$cssResult$ = true, o !== s) throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
|
|
73
|
+
this.cssText = t, this.t = e;
|
|
74
|
+
}
|
|
75
|
+
get styleSheet() {
|
|
76
|
+
let t = this.o;
|
|
77
|
+
const s = this.t;
|
|
78
|
+
if (e$3 && void 0 === t) {
|
|
79
|
+
const e = void 0 !== s && 1 === s.length;
|
|
80
|
+
e && (t = o$2.get(s)), void 0 === t && ((this.o = t = new CSSStyleSheet()).replaceSync(this.cssText), e && o$2.set(s, t));
|
|
81
|
+
}
|
|
82
|
+
return t;
|
|
83
|
+
}
|
|
84
|
+
toString() {
|
|
85
|
+
return this.cssText;
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
const r$2 = t => new n$2("string" == typeof t ? t : t + "", void 0, s),
|
|
89
|
+
S = (s, o) => {
|
|
90
|
+
if (e$3) s.adoptedStyleSheets = o.map(t => t instanceof CSSStyleSheet ? t : t.styleSheet);else for (const e of o) {
|
|
91
|
+
const o = document.createElement("style"),
|
|
92
|
+
n = t.litNonce;
|
|
93
|
+
void 0 !== n && o.setAttribute("nonce", n), o.textContent = e.cssText, s.appendChild(o);
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
c$1 = e$3 ? t => t : t => t instanceof CSSStyleSheet ? (t => {
|
|
97
|
+
let e = "";
|
|
98
|
+
for (const s of t.cssRules) e += s.cssText;
|
|
99
|
+
return r$2(e);
|
|
100
|
+
})(t) : t;
|
|
58
101
|
|
|
59
102
|
/**
|
|
60
103
|
* @license
|
|
61
104
|
* Copyright 2017 Google LLC
|
|
62
105
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
63
|
-
*/
|
|
106
|
+
*/
|
|
107
|
+
const {
|
|
108
|
+
is: i,
|
|
109
|
+
defineProperty: e$2,
|
|
110
|
+
getOwnPropertyDescriptor: h,
|
|
111
|
+
getOwnPropertyNames: r$1,
|
|
112
|
+
getOwnPropertySymbols: o$1,
|
|
113
|
+
getPrototypeOf: n$1
|
|
114
|
+
} = Object,
|
|
115
|
+
a = globalThis,
|
|
116
|
+
c = a.trustedTypes,
|
|
117
|
+
l = c ? c.emptyScript : "",
|
|
118
|
+
p = a.reactiveElementPolyfillSupport,
|
|
119
|
+
d = (t, s) => t,
|
|
120
|
+
u = {
|
|
121
|
+
toAttribute(t, s) {
|
|
122
|
+
switch (s) {
|
|
123
|
+
case Boolean:
|
|
124
|
+
t = t ? l : null;
|
|
125
|
+
break;
|
|
126
|
+
case Object:
|
|
127
|
+
case Array:
|
|
128
|
+
t = null == t ? t : JSON.stringify(t);
|
|
129
|
+
}
|
|
130
|
+
return t;
|
|
131
|
+
},
|
|
132
|
+
fromAttribute(t, s) {
|
|
133
|
+
let i = t;
|
|
134
|
+
switch (s) {
|
|
135
|
+
case Boolean:
|
|
136
|
+
i = null !== t;
|
|
137
|
+
break;
|
|
138
|
+
case Number:
|
|
139
|
+
i = null === t ? null : Number(t);
|
|
140
|
+
break;
|
|
141
|
+
case Object:
|
|
142
|
+
case Array:
|
|
143
|
+
try {
|
|
144
|
+
i = JSON.parse(t);
|
|
145
|
+
} catch (t) {
|
|
146
|
+
i = null;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
return i;
|
|
150
|
+
}
|
|
151
|
+
},
|
|
152
|
+
f = (t, s) => !i(t, s),
|
|
153
|
+
b = {
|
|
154
|
+
attribute: true,
|
|
155
|
+
type: String,
|
|
156
|
+
converter: u,
|
|
157
|
+
reflect: false,
|
|
158
|
+
useDefault: false,
|
|
159
|
+
hasChanged: f
|
|
160
|
+
};
|
|
161
|
+
Symbol.metadata ??= Symbol("metadata"), a.litPropertyMetadata ??= new WeakMap();
|
|
162
|
+
class y extends HTMLElement {
|
|
163
|
+
static addInitializer(t) {
|
|
164
|
+
this._$Ei(), (this.l ??= []).push(t);
|
|
165
|
+
}
|
|
166
|
+
static get observedAttributes() {
|
|
167
|
+
return this.finalize(), this._$Eh && [...this._$Eh.keys()];
|
|
168
|
+
}
|
|
169
|
+
static createProperty(t, s = b) {
|
|
170
|
+
if (s.state && (s.attribute = false), this._$Ei(), this.prototype.hasOwnProperty(t) && ((s = Object.create(s)).wrapped = true), this.elementProperties.set(t, s), !s.noAccessor) {
|
|
171
|
+
const i = Symbol(),
|
|
172
|
+
h = this.getPropertyDescriptor(t, i, s);
|
|
173
|
+
void 0 !== h && e$2(this.prototype, t, h);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
static getPropertyDescriptor(t, s, i) {
|
|
177
|
+
const {
|
|
178
|
+
get: e,
|
|
179
|
+
set: r
|
|
180
|
+
} = h(this.prototype, t) ?? {
|
|
181
|
+
get() {
|
|
182
|
+
return this[s];
|
|
183
|
+
},
|
|
184
|
+
set(t) {
|
|
185
|
+
this[s] = t;
|
|
186
|
+
}
|
|
187
|
+
};
|
|
188
|
+
return {
|
|
189
|
+
get: e,
|
|
190
|
+
set(s) {
|
|
191
|
+
const h = e?.call(this);
|
|
192
|
+
r?.call(this, s), this.requestUpdate(t, h, i);
|
|
193
|
+
},
|
|
194
|
+
configurable: true,
|
|
195
|
+
enumerable: true
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
static getPropertyOptions(t) {
|
|
199
|
+
return this.elementProperties.get(t) ?? b;
|
|
200
|
+
}
|
|
201
|
+
static _$Ei() {
|
|
202
|
+
if (this.hasOwnProperty(d("elementProperties"))) return;
|
|
203
|
+
const t = n$1(this);
|
|
204
|
+
t.finalize(), void 0 !== t.l && (this.l = [...t.l]), this.elementProperties = new Map(t.elementProperties);
|
|
205
|
+
}
|
|
206
|
+
static finalize() {
|
|
207
|
+
if (this.hasOwnProperty(d("finalized"))) return;
|
|
208
|
+
if (this.finalized = true, this._$Ei(), this.hasOwnProperty(d("properties"))) {
|
|
209
|
+
const t = this.properties,
|
|
210
|
+
s = [...r$1(t), ...o$1(t)];
|
|
211
|
+
for (const i of s) this.createProperty(i, t[i]);
|
|
212
|
+
}
|
|
213
|
+
const t = this[Symbol.metadata];
|
|
214
|
+
if (null !== t) {
|
|
215
|
+
const s = litPropertyMetadata.get(t);
|
|
216
|
+
if (void 0 !== s) for (const [t, i] of s) this.elementProperties.set(t, i);
|
|
217
|
+
}
|
|
218
|
+
this._$Eh = new Map();
|
|
219
|
+
for (const [t, s] of this.elementProperties) {
|
|
220
|
+
const i = this._$Eu(t, s);
|
|
221
|
+
void 0 !== i && this._$Eh.set(i, t);
|
|
222
|
+
}
|
|
223
|
+
this.elementStyles = this.finalizeStyles(this.styles);
|
|
224
|
+
}
|
|
225
|
+
static finalizeStyles(s) {
|
|
226
|
+
const i = [];
|
|
227
|
+
if (Array.isArray(s)) {
|
|
228
|
+
const e = new Set(s.flat(1 / 0).reverse());
|
|
229
|
+
for (const s of e) i.unshift(c$1(s));
|
|
230
|
+
} else void 0 !== s && i.push(c$1(s));
|
|
231
|
+
return i;
|
|
232
|
+
}
|
|
233
|
+
static _$Eu(t, s) {
|
|
234
|
+
const i = s.attribute;
|
|
235
|
+
return false === i ? void 0 : "string" == typeof i ? i : "string" == typeof t ? t.toLowerCase() : void 0;
|
|
236
|
+
}
|
|
237
|
+
constructor() {
|
|
238
|
+
super(), this._$Ep = void 0, this.isUpdatePending = false, this.hasUpdated = false, this._$Em = null, this._$Ev();
|
|
239
|
+
}
|
|
240
|
+
_$Ev() {
|
|
241
|
+
this._$ES = new Promise(t => this.enableUpdating = t), this._$AL = new Map(), this._$E_(), this.requestUpdate(), this.constructor.l?.forEach(t => t(this));
|
|
242
|
+
}
|
|
243
|
+
addController(t) {
|
|
244
|
+
(this._$EO ??= new Set()).add(t), void 0 !== this.renderRoot && this.isConnected && t.hostConnected?.();
|
|
245
|
+
}
|
|
246
|
+
removeController(t) {
|
|
247
|
+
this._$EO?.delete(t);
|
|
248
|
+
}
|
|
249
|
+
_$E_() {
|
|
250
|
+
const t = new Map(),
|
|
251
|
+
s = this.constructor.elementProperties;
|
|
252
|
+
for (const i of s.keys()) this.hasOwnProperty(i) && (t.set(i, this[i]), delete this[i]);
|
|
253
|
+
t.size > 0 && (this._$Ep = t);
|
|
254
|
+
}
|
|
255
|
+
createRenderRoot() {
|
|
256
|
+
const t = this.shadowRoot ?? this.attachShadow(this.constructor.shadowRootOptions);
|
|
257
|
+
return S(t, this.constructor.elementStyles), t;
|
|
258
|
+
}
|
|
259
|
+
connectedCallback() {
|
|
260
|
+
this.renderRoot ??= this.createRenderRoot(), this.enableUpdating(true), this._$EO?.forEach(t => t.hostConnected?.());
|
|
261
|
+
}
|
|
262
|
+
enableUpdating(t) {}
|
|
263
|
+
disconnectedCallback() {
|
|
264
|
+
this._$EO?.forEach(t => t.hostDisconnected?.());
|
|
265
|
+
}
|
|
266
|
+
attributeChangedCallback(t, s, i) {
|
|
267
|
+
this._$AK(t, i);
|
|
268
|
+
}
|
|
269
|
+
_$ET(t, s) {
|
|
270
|
+
const i = this.constructor.elementProperties.get(t),
|
|
271
|
+
e = this.constructor._$Eu(t, i);
|
|
272
|
+
if (void 0 !== e && true === i.reflect) {
|
|
273
|
+
const h = (void 0 !== i.converter?.toAttribute ? i.converter : u).toAttribute(s, i.type);
|
|
274
|
+
this._$Em = t, null == h ? this.removeAttribute(e) : this.setAttribute(e, h), this._$Em = null;
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
_$AK(t, s) {
|
|
278
|
+
const i = this.constructor,
|
|
279
|
+
e = i._$Eh.get(t);
|
|
280
|
+
if (void 0 !== e && this._$Em !== e) {
|
|
281
|
+
const t = i.getPropertyOptions(e),
|
|
282
|
+
h = "function" == typeof t.converter ? {
|
|
283
|
+
fromAttribute: t.converter
|
|
284
|
+
} : void 0 !== t.converter?.fromAttribute ? t.converter : u;
|
|
285
|
+
this._$Em = e;
|
|
286
|
+
const r = h.fromAttribute(s, t.type);
|
|
287
|
+
this[e] = r ?? this._$Ej?.get(e) ?? r, this._$Em = null;
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
requestUpdate(t, s, i) {
|
|
291
|
+
if (void 0 !== t) {
|
|
292
|
+
const e = this.constructor,
|
|
293
|
+
h = this[t];
|
|
294
|
+
if (i ??= e.getPropertyOptions(t), !((i.hasChanged ?? f)(h, s) || i.useDefault && i.reflect && h === this._$Ej?.get(t) && !this.hasAttribute(e._$Eu(t, i)))) return;
|
|
295
|
+
this.C(t, s, i);
|
|
296
|
+
}
|
|
297
|
+
false === this.isUpdatePending && (this._$ES = this._$EP());
|
|
298
|
+
}
|
|
299
|
+
C(t, s, {
|
|
300
|
+
useDefault: i,
|
|
301
|
+
reflect: e,
|
|
302
|
+
wrapped: h
|
|
303
|
+
}, r) {
|
|
304
|
+
i && !(this._$Ej ??= new Map()).has(t) && (this._$Ej.set(t, r ?? s ?? this[t]), true !== h || void 0 !== r) || (this._$AL.has(t) || (this.hasUpdated || i || (s = void 0), this._$AL.set(t, s)), true === e && this._$Em !== t && (this._$Eq ??= new Set()).add(t));
|
|
305
|
+
}
|
|
306
|
+
async _$EP() {
|
|
307
|
+
this.isUpdatePending = true;
|
|
308
|
+
try {
|
|
309
|
+
await this._$ES;
|
|
310
|
+
} catch (t) {
|
|
311
|
+
Promise.reject(t);
|
|
312
|
+
}
|
|
313
|
+
const t = this.scheduleUpdate();
|
|
314
|
+
return null != t && (await t), !this.isUpdatePending;
|
|
315
|
+
}
|
|
316
|
+
scheduleUpdate() {
|
|
317
|
+
return this.performUpdate();
|
|
318
|
+
}
|
|
319
|
+
performUpdate() {
|
|
320
|
+
if (!this.isUpdatePending) return;
|
|
321
|
+
if (!this.hasUpdated) {
|
|
322
|
+
if (this.renderRoot ??= this.createRenderRoot(), this._$Ep) {
|
|
323
|
+
for (const [t, s] of this._$Ep) this[t] = s;
|
|
324
|
+
this._$Ep = void 0;
|
|
325
|
+
}
|
|
326
|
+
const t = this.constructor.elementProperties;
|
|
327
|
+
if (t.size > 0) for (const [s, i] of t) {
|
|
328
|
+
const {
|
|
329
|
+
wrapped: t
|
|
330
|
+
} = i,
|
|
331
|
+
e = this[s];
|
|
332
|
+
true !== t || this._$AL.has(s) || void 0 === e || this.C(s, void 0, i, e);
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
let t = false;
|
|
336
|
+
const s = this._$AL;
|
|
337
|
+
try {
|
|
338
|
+
t = this.shouldUpdate(s), t ? (this.willUpdate(s), this._$EO?.forEach(t => t.hostUpdate?.()), this.update(s)) : this._$EM();
|
|
339
|
+
} catch (s) {
|
|
340
|
+
throw t = false, this._$EM(), s;
|
|
341
|
+
}
|
|
342
|
+
t && this._$AE(s);
|
|
343
|
+
}
|
|
344
|
+
willUpdate(t) {}
|
|
345
|
+
_$AE(t) {
|
|
346
|
+
this._$EO?.forEach(t => t.hostUpdated?.()), this.hasUpdated || (this.hasUpdated = true, this.firstUpdated(t)), this.updated(t);
|
|
347
|
+
}
|
|
348
|
+
_$EM() {
|
|
349
|
+
this._$AL = new Map(), this.isUpdatePending = false;
|
|
350
|
+
}
|
|
351
|
+
get updateComplete() {
|
|
352
|
+
return this.getUpdateComplete();
|
|
353
|
+
}
|
|
354
|
+
getUpdateComplete() {
|
|
355
|
+
return this._$ES;
|
|
356
|
+
}
|
|
357
|
+
shouldUpdate(t) {
|
|
358
|
+
return true;
|
|
359
|
+
}
|
|
360
|
+
update(t) {
|
|
361
|
+
this._$Eq &&= this._$Eq.forEach(t => this._$ET(t, this[t])), this._$EM();
|
|
362
|
+
}
|
|
363
|
+
updated(t) {}
|
|
364
|
+
firstUpdated(t) {}
|
|
365
|
+
}
|
|
366
|
+
y.elementStyles = [], y.shadowRootOptions = {
|
|
367
|
+
mode: "open"
|
|
368
|
+
}, y[d("elementProperties")] = new Map(), y[d("finalized")] = new Map(), p?.({
|
|
369
|
+
ReactiveElement: y
|
|
370
|
+
}), (a.reactiveElementVersions ??= []).push("2.1.1");
|
|
64
371
|
|
|
65
372
|
/**
|
|
66
373
|
* @license
|
|
67
374
|
* Copyright 2017 Google LLC
|
|
68
375
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
69
|
-
*/
|
|
376
|
+
*/
|
|
377
|
+
const o = {
|
|
378
|
+
attribute: true,
|
|
379
|
+
type: String,
|
|
380
|
+
converter: u,
|
|
381
|
+
reflect: false,
|
|
382
|
+
hasChanged: f
|
|
383
|
+
},
|
|
384
|
+
r = (t = o, e, r) => {
|
|
385
|
+
const {
|
|
386
|
+
kind: n,
|
|
387
|
+
metadata: i
|
|
388
|
+
} = r;
|
|
389
|
+
let s = globalThis.litPropertyMetadata.get(i);
|
|
390
|
+
if (void 0 === s && globalThis.litPropertyMetadata.set(i, s = new Map()), "setter" === n && ((t = Object.create(t)).wrapped = true), s.set(r.name, t), "accessor" === n) {
|
|
391
|
+
const {
|
|
392
|
+
name: o
|
|
393
|
+
} = r;
|
|
394
|
+
return {
|
|
395
|
+
set(r) {
|
|
396
|
+
const n = e.get.call(this);
|
|
397
|
+
e.set.call(this, r), this.requestUpdate(o, n, t);
|
|
398
|
+
},
|
|
399
|
+
init(e) {
|
|
400
|
+
return void 0 !== e && this.C(o, void 0, t, e), e;
|
|
401
|
+
}
|
|
402
|
+
};
|
|
403
|
+
}
|
|
404
|
+
if ("setter" === n) {
|
|
405
|
+
const {
|
|
406
|
+
name: o
|
|
407
|
+
} = r;
|
|
408
|
+
return function (r) {
|
|
409
|
+
const n = this[o];
|
|
410
|
+
e.call(this, r), this.requestUpdate(o, n, t);
|
|
411
|
+
};
|
|
412
|
+
}
|
|
413
|
+
throw Error("Unsupported decorator location: " + n);
|
|
414
|
+
};
|
|
415
|
+
function n(t) {
|
|
416
|
+
return (e, o) => "object" == typeof o ? r(t, e, o) : ((t, e, o) => {
|
|
417
|
+
const r = e.hasOwnProperty(o);
|
|
418
|
+
return e.constructor.createProperty(o, t), r ? Object.getOwnPropertyDescriptor(e, o) : void 0;
|
|
419
|
+
})(t, e, o);
|
|
420
|
+
}
|
|
70
421
|
|
|
71
422
|
/**
|
|
72
423
|
* @license
|
|
73
424
|
* Copyright 2017 Google LLC
|
|
74
425
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
75
426
|
*/
|
|
76
|
-
const e$1=(e,t,c)=>(c.configurable=true,c.enumerable=true,Reflect.decorate&&"object"!=typeof t&&Object.defineProperty(e,t,c),c);
|
|
427
|
+
const e$1 = (e, t, c) => (c.configurable = true, c.enumerable = true, Reflect.decorate && "object" != typeof t && Object.defineProperty(e, t, c), c);
|
|
77
428
|
|
|
78
429
|
/**
|
|
79
430
|
* @license
|
|
80
431
|
* Copyright 2017 Google LLC
|
|
81
432
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
82
|
-
*/
|
|
433
|
+
*/
|
|
434
|
+
function e(e, r) {
|
|
435
|
+
return (n, s, i) => {
|
|
436
|
+
const o = t => t.renderRoot?.querySelector(e) ?? null;
|
|
437
|
+
return e$1(n, s, {
|
|
438
|
+
get() {
|
|
439
|
+
return o(this);
|
|
440
|
+
}
|
|
441
|
+
});
|
|
442
|
+
};
|
|
443
|
+
}
|
|
83
444
|
|
|
84
445
|
var _M3eRadioElement_instances, _M3eRadioElement_clickHandler, _M3eRadioElement_hoverController, _M3eRadioElement_pressedController, _M3eRadioElement_renderIcon, _M3eRadioElement_handleClick, _M3eRadioElement_notifySelectionChange;
|
|
85
446
|
/**
|
|
@@ -136,223 +497,118 @@ var _M3eRadioElement_instances, _M3eRadioElement_clickHandler, _M3eRadioElement_
|
|
|
136
497
|
* @cssprop --m3e-radio-error-icon-color - Fallback icon color used when the radio is invalid and touched.
|
|
137
498
|
*/
|
|
138
499
|
let M3eRadioElement = class M3eRadioElement extends Labelled(Dirty(Touched(Checked(KeyboardClick(Focusable(FormAssociated(Disabled(AttachInternals(Role(LitElement, "radio"), true))))))))) {
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
}
|
|
154
|
-
},
|
|
155
|
-
}));
|
|
156
|
-
/** @private */ _M3eRadioElement_pressedController.set(this, new PressedController(this, {
|
|
157
|
-
target: null,
|
|
158
|
-
minPressedDuration: 150,
|
|
159
|
-
callback: (pressed) => {
|
|
160
|
-
if (this.disabled)
|
|
161
|
-
return;
|
|
162
|
-
if (pressed) {
|
|
163
|
-
this._ripple?.show(0, 0, true);
|
|
164
|
-
}
|
|
165
|
-
else {
|
|
166
|
-
this._ripple?.hide();
|
|
167
|
-
}
|
|
168
|
-
},
|
|
169
|
-
}));
|
|
170
|
-
/**
|
|
171
|
-
* A string representing the value of the radio.
|
|
172
|
-
* @default "on"
|
|
173
|
-
*/
|
|
174
|
-
this.value = "on";
|
|
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
|
-
}
|
|
180
|
-
/** @inheritdoc */
|
|
181
|
-
connectedCallback() {
|
|
182
|
-
super.connectedCallback();
|
|
183
|
-
this.addEventListener("click", __classPrivateFieldGet(this, _M3eRadioElement_clickHandler, "f"));
|
|
184
|
-
for (const label of this.labels) {
|
|
185
|
-
__classPrivateFieldGet(this, _M3eRadioElement_hoverController, "f").observe(label);
|
|
186
|
-
__classPrivateFieldGet(this, _M3eRadioElement_pressedController, "f").observe(label);
|
|
500
|
+
constructor() {
|
|
501
|
+
super(...arguments);
|
|
502
|
+
_M3eRadioElement_instances.add(this);
|
|
503
|
+
/** @private */
|
|
504
|
+
_M3eRadioElement_clickHandler.set(this, e => __classPrivateFieldGet(this, _M3eRadioElement_instances, "m", _M3eRadioElement_handleClick).call(this, e));
|
|
505
|
+
/** @private */
|
|
506
|
+
_M3eRadioElement_hoverController.set(this, new HoverController(this, {
|
|
507
|
+
target: null,
|
|
508
|
+
callback: hovering => {
|
|
509
|
+
if (this.disabled) return;
|
|
510
|
+
if (hovering) {
|
|
511
|
+
this._stateLayer?.show("hover");
|
|
512
|
+
} else {
|
|
513
|
+
this._stateLayer?.hide("hover");
|
|
187
514
|
}
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
super.update(changedProperties);
|
|
201
|
-
if (changedProperties.has("checked")) {
|
|
202
|
-
__classPrivateFieldGet(this, _M3eRadioElement_instances, "m", _M3eRadioElement_notifySelectionChange).call(this);
|
|
515
|
+
}
|
|
516
|
+
}));
|
|
517
|
+
/** @private */
|
|
518
|
+
_M3eRadioElement_pressedController.set(this, new PressedController(this, {
|
|
519
|
+
target: null,
|
|
520
|
+
minPressedDuration: 150,
|
|
521
|
+
callback: pressed => {
|
|
522
|
+
if (this.disabled) return;
|
|
523
|
+
if (pressed) {
|
|
524
|
+
this._ripple?.show(0, 0, true);
|
|
525
|
+
} else {
|
|
526
|
+
this._ripple?.hide();
|
|
203
527
|
}
|
|
528
|
+
}
|
|
529
|
+
}));
|
|
530
|
+
/**
|
|
531
|
+
* A string representing the value of the radio.
|
|
532
|
+
* @default "on"
|
|
533
|
+
*/
|
|
534
|
+
this.value = "on";
|
|
535
|
+
}
|
|
536
|
+
/** @inheritdoc @internal */
|
|
537
|
+
get [(_M3eRadioElement_clickHandler = new WeakMap(), _M3eRadioElement_hoverController = new WeakMap(), _M3eRadioElement_pressedController = new WeakMap(), _M3eRadioElement_instances = new WeakSet(), formValue)]() {
|
|
538
|
+
return this.checked ? this.value : null;
|
|
539
|
+
}
|
|
540
|
+
/** @inheritdoc */
|
|
541
|
+
connectedCallback() {
|
|
542
|
+
super.connectedCallback();
|
|
543
|
+
this.addEventListener("click", __classPrivateFieldGet(this, _M3eRadioElement_clickHandler, "f"));
|
|
544
|
+
for (const label of this.labels) {
|
|
545
|
+
__classPrivateFieldGet(this, _M3eRadioElement_hoverController, "f").observe(label);
|
|
546
|
+
__classPrivateFieldGet(this, _M3eRadioElement_pressedController, "f").observe(label);
|
|
204
547
|
}
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
548
|
+
}
|
|
549
|
+
/** @inheritdoc */
|
|
550
|
+
disconnectedCallback() {
|
|
551
|
+
super.disconnectedCallback();
|
|
552
|
+
this.removeEventListener("click", __classPrivateFieldGet(this, _M3eRadioElement_clickHandler, "f"));
|
|
553
|
+
for (const label of this.labels) {
|
|
554
|
+
__classPrivateFieldGet(this, _M3eRadioElement_hoverController, "f").unobserve(label);
|
|
555
|
+
__classPrivateFieldGet(this, _M3eRadioElement_pressedController, "f").unobserve(label);
|
|
209
556
|
}
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
<div class="touch" aria-hidden="true"></div>
|
|
217
|
-
<div class="wrapper" aria-hidden="true">${__classPrivateFieldGet(this, _M3eRadioElement_instances, "m", _M3eRadioElement_renderIcon).call(this)}</div>
|
|
218
|
-
</div>`;
|
|
557
|
+
}
|
|
558
|
+
/** @inheritdoc */
|
|
559
|
+
update(changedProperties) {
|
|
560
|
+
super.update(changedProperties);
|
|
561
|
+
if (changedProperties.has("checked")) {
|
|
562
|
+
__classPrivateFieldGet(this, _M3eRadioElement_instances, "m", _M3eRadioElement_notifySelectionChange).call(this);
|
|
219
563
|
}
|
|
564
|
+
}
|
|
565
|
+
/** @inheritdoc */
|
|
566
|
+
firstUpdated(_changedProperties) {
|
|
567
|
+
super.firstUpdated(_changedProperties);
|
|
568
|
+
[this._focusRing, this._stateLayer, this._ripple].forEach(x => x?.attach(this));
|
|
569
|
+
}
|
|
570
|
+
/** @inheritdoc */
|
|
571
|
+
render() {
|
|
572
|
+
return html`<div class="base"><m3e-state-layer class="state-layer" ?disabled="${this.disabled}"></m3e-state-layer><m3e-focus-ring class="focus-ring" ?disabled="${this.disabled}"></m3e-focus-ring><m3e-ripple class="ripple" centered ?disabled="${this.disabled}"></m3e-ripple><div class="touch" aria-hidden="true"></div><div class="wrapper" aria-hidden="true">${__classPrivateFieldGet(this, _M3eRadioElement_instances, "m", _M3eRadioElement_renderIcon).call(this)}</div></div>`;
|
|
573
|
+
}
|
|
220
574
|
};
|
|
221
575
|
_M3eRadioElement_renderIcon = function _M3eRadioElement_renderIcon() {
|
|
222
|
-
|
|
223
|
-
<mask id="cutout2">
|
|
224
|
-
<rect width="100%" height="100%" fill="white"></rect>
|
|
225
|
-
<circle cx="10" cy="10" r="8" fill="black"></circle>
|
|
226
|
-
</mask>
|
|
227
|
-
<circle class="outer circle" cx="10" cy="10" r="10" mask="url(#cutout2)"></circle>
|
|
228
|
-
<circle class="inner circle" cx="10" cy="10" r="5"></circle>
|
|
229
|
-
</svg>`;
|
|
576
|
+
return html`<svg viewBox="0 0 20 20"><mask id="cutout2"><rect width="100%" height="100%" fill="white"></rect><circle cx="10" cy="10" r="8" fill="black"></circle></mask><circle class="outer circle" cx="10" cy="10" r="10" mask="url(#cutout2)"></circle><circle class="inner circle" cx="10" cy="10" r="5"></circle></svg>`;
|
|
230
577
|
};
|
|
231
578
|
_M3eRadioElement_handleClick = function _M3eRadioElement_handleClick(e) {
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
579
|
+
if (e.defaultPrevented || this.checked || this.disabled) return;
|
|
580
|
+
this.checked = true;
|
|
581
|
+
if (this.dispatchEvent(new Event("input", {
|
|
582
|
+
bubbles: true,
|
|
583
|
+
composed: true,
|
|
584
|
+
cancelable: true
|
|
585
|
+
}))) {
|
|
586
|
+
__classPrivateFieldGet(this, _M3eRadioElement_instances, "m", _M3eRadioElement_notifySelectionChange).call(this);
|
|
587
|
+
this.dispatchEvent(new Event("change", {
|
|
588
|
+
bubbles: true
|
|
589
|
+
}));
|
|
590
|
+
} else {
|
|
591
|
+
this.checked = false;
|
|
592
|
+
}
|
|
242
593
|
};
|
|
243
594
|
_M3eRadioElement_notifySelectionChange = function _M3eRadioElement_notifySelectionChange() {
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
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
|
-
}
|
|
595
|
+
const group = this.closest("m3e-radio-group");
|
|
596
|
+
if (group) {
|
|
597
|
+
group[selectionManager].notifySelectionChange(this);
|
|
598
|
+
} else if (this.name && this.checked) {
|
|
599
|
+
// Uncheck any sibling radios of the same name which are also checked.
|
|
600
|
+
[...(this.getRootNode()?.querySelectorAll(`m3e-radio[name="${this.name}"]`) ?? [])].filter(x => x !== this && x.checked).forEach(x => x.checked = false);
|
|
601
|
+
}
|
|
257
602
|
};
|
|
258
603
|
/** The styles of the element. */
|
|
259
|
-
M3eRadioElement.styles = css
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
vertical-align: middle;
|
|
266
|
-
user-select: none;
|
|
267
|
-
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
|
|
268
|
-
}
|
|
269
|
-
:host(:not([aria-disabled="true"])) {
|
|
270
|
-
cursor: pointer;
|
|
271
|
-
}
|
|
272
|
-
.base {
|
|
273
|
-
box-sizing: border-box;
|
|
274
|
-
vertical-align: middle;
|
|
275
|
-
display: inline-flex;
|
|
276
|
-
align-items: center;
|
|
277
|
-
justify-content: center;
|
|
278
|
-
position: relative;
|
|
279
|
-
border-radius: 50%;
|
|
280
|
-
width: calc(var(--m3e-radio-container-size, 2.5rem) + ${DesignToken.density.calc(-3)});
|
|
281
|
-
height: calc(var(--m3e-radio-container-size, 2.5rem) + ${DesignToken.density.calc(-3)});
|
|
282
|
-
}
|
|
283
|
-
.touch {
|
|
284
|
-
position: absolute;
|
|
285
|
-
height: 3rem;
|
|
286
|
-
width: 3rem;
|
|
287
|
-
margin: auto;
|
|
288
|
-
}
|
|
289
|
-
.wrapper {
|
|
290
|
-
box-sizing: border-box;
|
|
291
|
-
pointer-events: none;
|
|
292
|
-
width: var(--m3e-radio-icon-size, 1.25rem);
|
|
293
|
-
height: var(--m3e-radio-icon-size, 1.25rem);
|
|
294
|
-
}
|
|
295
|
-
.circle {
|
|
296
|
-
fill: currentColor;
|
|
297
|
-
}
|
|
298
|
-
:host(:not([checked])) .circle.inner {
|
|
299
|
-
opacity: 0;
|
|
300
|
-
}
|
|
301
|
-
:host(:not([checked])) .base {
|
|
302
|
-
--m3e-state-layer-hover-color: var(--m3e-radio-unselected-hover-color, ${DesignToken.color.onSurface});
|
|
303
|
-
--m3e-state-layer-focus-color: var(--m3e-radio-unselected-focus-color, ${DesignToken.color.onSurface});
|
|
304
|
-
--m3e-ripple-color: var(--m3e-radio-unselected-ripple-color, ${DesignToken.color.onSurface});
|
|
305
|
-
color: var(--m3e-radio-unselected-icon-color, ${DesignToken.color.onSurfaceVariant});
|
|
306
|
-
}
|
|
307
|
-
:host([checked]) .base {
|
|
308
|
-
--m3e-state-layer-hover-color: var(--m3e-radio-selected-hover-color, ${DesignToken.color.primary});
|
|
309
|
-
--m3e-state-layer-focus-color: var(--m3e-radio-selected-focus-color, ${DesignToken.color.primary});
|
|
310
|
-
--m3e-ripple-color: var(--m3e-radio-selected-ripple-color, ${DesignToken.color.primary});
|
|
311
|
-
color: var(--m3e-radio-selected-icon-color, ${DesignToken.color.primary});
|
|
312
|
-
}
|
|
313
|
-
:host([aria-disabled="true"]) .base {
|
|
314
|
-
color: color-mix(in srgb, var(--m3e-radio-disabled-icon-color, ${DesignToken.color.onSurface}) 38%, transparent);
|
|
315
|
-
}
|
|
316
|
-
:host(.-touched.-invalid) .base {
|
|
317
|
-
--m3e-state-layer-hover-color: var(--m3e-radio-error-hover-color, ${DesignToken.color.error});
|
|
318
|
-
--m3e-state-layer-focus-color: var(--m3e-radio-error-focus-color, ${DesignToken.color.error});
|
|
319
|
-
--m3e-ripple-color: var(--m3e-radio-error-ripple-color, ${DesignToken.color.error});
|
|
320
|
-
color: var(--m3e-radio-error-icon-color, ${DesignToken.color.error});
|
|
321
|
-
}
|
|
322
|
-
@media (forced-colors: active) {
|
|
323
|
-
:host(:not([checked])) .base,
|
|
324
|
-
:host([checked]) .base {
|
|
325
|
-
--m3e-state-layer-hover-color: var(--_radio-forced-color, CanvasText);
|
|
326
|
-
--m3e-state-layer-focus-color: var(--_radio-forced-color, CanvasText);
|
|
327
|
-
--m3e-ripple-color: var(--_radio-forced-color, CanvasText);
|
|
328
|
-
color: var(--_radio-forced-color, CanvasText);
|
|
329
|
-
}
|
|
330
|
-
:host([aria-disabled="true"]) .base {
|
|
331
|
-
color: GrayText;
|
|
332
|
-
}
|
|
333
|
-
:host(.-touched.-invalid) .base {
|
|
334
|
-
--_radio-forced-color: Highlight;
|
|
335
|
-
color: Highlight;
|
|
336
|
-
}
|
|
337
|
-
}
|
|
338
|
-
`;
|
|
339
|
-
__decorate([
|
|
340
|
-
e(".focus-ring")
|
|
341
|
-
], M3eRadioElement.prototype, "_focusRing", void 0);
|
|
342
|
-
__decorate([
|
|
343
|
-
e(".state-layer")
|
|
344
|
-
], M3eRadioElement.prototype, "_stateLayer", void 0);
|
|
345
|
-
__decorate([
|
|
346
|
-
e(".ripple")
|
|
347
|
-
], M3eRadioElement.prototype, "_ripple", void 0);
|
|
348
|
-
__decorate([
|
|
349
|
-
n()
|
|
350
|
-
], M3eRadioElement.prototype, "value", void 0);
|
|
351
|
-
M3eRadioElement = __decorate([
|
|
352
|
-
t$1("m3e-radio")
|
|
353
|
-
], M3eRadioElement);
|
|
604
|
+
M3eRadioElement.styles = css`:host { display: inline-block; outline: none; width: fit-content; height: fit-content; vertical-align: middle; user-select: none; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); } :host(:not([aria-disabled="true"])) { cursor: pointer; } .base { box-sizing: border-box; vertical-align: middle; display: inline-flex; align-items: center; justify-content: center; position: relative; border-radius: 50%; width: calc(var(--m3e-radio-container-size, 2.5rem) + ${DesignToken.density.calc(-3)}); height: calc(var(--m3e-radio-container-size, 2.5rem) + ${DesignToken.density.calc(-3)}); } .touch { position: absolute; height: 3rem; width: 3rem; margin: auto; } .wrapper { box-sizing: border-box; pointer-events: none; width: var(--m3e-radio-icon-size, 1.25rem); height: var(--m3e-radio-icon-size, 1.25rem); } .circle { fill: currentColor; } :host(:not([checked])) .circle.inner { opacity: 0; } :host(:not([checked])) .base { --m3e-state-layer-hover-color: var(--m3e-radio-unselected-hover-color, ${DesignToken.color.onSurface}); --m3e-state-layer-focus-color: var(--m3e-radio-unselected-focus-color, ${DesignToken.color.onSurface}); --m3e-ripple-color: var(--m3e-radio-unselected-ripple-color, ${DesignToken.color.onSurface}); color: var(--m3e-radio-unselected-icon-color, ${DesignToken.color.onSurfaceVariant}); } :host([checked]) .base { --m3e-state-layer-hover-color: var(--m3e-radio-selected-hover-color, ${DesignToken.color.primary}); --m3e-state-layer-focus-color: var(--m3e-radio-selected-focus-color, ${DesignToken.color.primary}); --m3e-ripple-color: var(--m3e-radio-selected-ripple-color, ${DesignToken.color.primary}); color: var(--m3e-radio-selected-icon-color, ${DesignToken.color.primary}); } :host([aria-disabled="true"]) .base { color: color-mix(in srgb, var(--m3e-radio-disabled-icon-color, ${DesignToken.color.onSurface}) 38%, transparent); } :host(.-touched.-invalid) .base { --m3e-state-layer-hover-color: var(--m3e-radio-error-hover-color, ${DesignToken.color.error}); --m3e-state-layer-focus-color: var(--m3e-radio-error-focus-color, ${DesignToken.color.error}); --m3e-ripple-color: var(--m3e-radio-error-ripple-color, ${DesignToken.color.error}); color: var(--m3e-radio-error-icon-color, ${DesignToken.color.error}); } @media (forced-colors: active) { :host(:not([checked])) .base, :host([checked]) .base { --m3e-state-layer-hover-color: var(--_radio-forced-color, CanvasText); --m3e-state-layer-focus-color: var(--_radio-forced-color, CanvasText); --m3e-ripple-color: var(--_radio-forced-color, CanvasText); color: var(--_radio-forced-color, CanvasText); } :host([aria-disabled="true"]) .base { color: GrayText; } :host(.-touched.-invalid) .base { --_radio-forced-color: Highlight; color: Highlight; } }`;
|
|
605
|
+
__decorate([e(".focus-ring")], M3eRadioElement.prototype, "_focusRing", void 0);
|
|
606
|
+
__decorate([e(".state-layer")], M3eRadioElement.prototype, "_stateLayer", void 0);
|
|
607
|
+
__decorate([e(".ripple")], M3eRadioElement.prototype, "_ripple", void 0);
|
|
608
|
+
__decorate([n()], M3eRadioElement.prototype, "value", void 0);
|
|
609
|
+
M3eRadioElement = __decorate([t$1("m3e-radio")], M3eRadioElement);
|
|
354
610
|
|
|
355
|
-
var _M3eRadioGroupElement_instances, _M3eRadioGroupElement_focusOutHandler, _M3eRadioGroupElement_handleSlotChange, _M3eRadioGroupElement_handleKeyDown, _M3eRadioGroupElement_handleChange, _a;
|
|
611
|
+
var _M3eRadioGroupElement_instances, _M3eRadioGroupElement_directionalitySubscription, _M3eRadioGroupElement_focusOutHandler, _M3eRadioGroupElement_handleSlotChange, _M3eRadioGroupElement_handleKeyDown, _M3eRadioGroupElement_handleChange, _a;
|
|
356
612
|
/**
|
|
357
613
|
* A container for a set of radio buttons.
|
|
358
614
|
*
|
|
@@ -387,117 +643,115 @@ var _M3eRadioGroupElement_instances, _M3eRadioGroupElement_focusOutHandler, _M3e
|
|
|
387
643
|
* @fires change - Emitted when the checked state of a radio button changes.
|
|
388
644
|
*/
|
|
389
645
|
let M3eRadioGroupElement = class M3eRadioGroupElement extends Labelled(RequiredConstraintValidation(Dirty(Touched(Required(ConstraintValidation(FormAssociated(Disabled(AttachInternals(Role(LitElement, "radiogroup")))))))))) {
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
646
|
+
constructor() {
|
|
647
|
+
super(...arguments);
|
|
648
|
+
_M3eRadioGroupElement_instances.add(this);
|
|
649
|
+
/** @private */
|
|
650
|
+
_M3eRadioGroupElement_directionalitySubscription.set(this, void 0);
|
|
651
|
+
/** @private */
|
|
652
|
+
_M3eRadioGroupElement_focusOutHandler.set(this, () => __classPrivateFieldGet(this, _M3eRadioGroupElement_instances, "m", _M3eRadioGroupElement_handleChange).call(this));
|
|
653
|
+
/** @internal */
|
|
654
|
+
this[_a] = new SelectionManager().withWrap().withDirectionality(M3eDirectionality.current).onActiveItemChange(() => {
|
|
655
|
+
this[selectionManager].activeItem?.click();
|
|
656
|
+
});
|
|
657
|
+
}
|
|
658
|
+
/** The list of attributes corresponding to the registered properties. */
|
|
659
|
+
static get observedAttributes() {
|
|
660
|
+
return [...super.observedAttributes, "aria-invalid"];
|
|
661
|
+
}
|
|
662
|
+
/** The radios in the group. */
|
|
663
|
+
get radios() {
|
|
664
|
+
return this[selectionManager]?.items ?? [];
|
|
665
|
+
}
|
|
666
|
+
/** The selected radio. */
|
|
667
|
+
get selected() {
|
|
668
|
+
return this[selectionManager]?.selectedItems[0] ?? null;
|
|
669
|
+
}
|
|
670
|
+
/** The selected value of the radio group. */
|
|
671
|
+
get value() {
|
|
672
|
+
return this.selected?.value ?? null;
|
|
673
|
+
}
|
|
674
|
+
/** @inheritdoc */
|
|
675
|
+
markAsTouched() {
|
|
676
|
+
super.markAsTouched();
|
|
677
|
+
this.radios.forEach(x => x.markAsTouched());
|
|
678
|
+
}
|
|
679
|
+
/** @inheritdoc */
|
|
680
|
+
markAsUntouched() {
|
|
681
|
+
super.markAsUntouched();
|
|
682
|
+
this.radios.forEach(x => x.markAsUntouched());
|
|
683
|
+
}
|
|
684
|
+
/** @inheritdoc */
|
|
685
|
+
markAsDirty() {
|
|
686
|
+
super.markAsDirty();
|
|
687
|
+
this.radios.forEach(x => x.markAsDirty());
|
|
688
|
+
}
|
|
689
|
+
/** @inheritdoc */
|
|
690
|
+
markAsPristine() {
|
|
691
|
+
super.markAsPristine();
|
|
692
|
+
this.radios.forEach(x => x.markAsPristine());
|
|
693
|
+
}
|
|
694
|
+
/** Synchronizes property values when attributes change. */
|
|
695
|
+
attributeChangedCallback(name, oldValue, newValue) {
|
|
696
|
+
super.attributeChangedCallback(name, oldValue, newValue);
|
|
697
|
+
switch (name) {
|
|
698
|
+
case "name":
|
|
699
|
+
this.radios.forEach(x => x.name = this.name);
|
|
700
|
+
break;
|
|
701
|
+
case "aria-invalid":
|
|
702
|
+
this.radios.forEach(x => {
|
|
703
|
+
x.classList.toggle("-invalid", newValue === "true");
|
|
704
|
+
x[updateLabels]?.();
|
|
397
705
|
});
|
|
706
|
+
break;
|
|
398
707
|
}
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
super.markAsTouched();
|
|
418
|
-
this.radios.forEach((x) => x.markAsTouched());
|
|
419
|
-
}
|
|
420
|
-
/** @inheritdoc */
|
|
421
|
-
markAsUntouched() {
|
|
422
|
-
super.markAsUntouched();
|
|
423
|
-
this.radios.forEach((x) => x.markAsUntouched());
|
|
424
|
-
}
|
|
425
|
-
/** @inheritdoc */
|
|
426
|
-
markAsDirty() {
|
|
427
|
-
super.markAsDirty();
|
|
428
|
-
this.radios.forEach((x) => x.markAsDirty());
|
|
429
|
-
}
|
|
430
|
-
/** @inheritdoc */
|
|
431
|
-
markAsPristine() {
|
|
432
|
-
super.markAsPristine();
|
|
433
|
-
this.radios.forEach((x) => x.markAsPristine());
|
|
434
|
-
}
|
|
435
|
-
/** Synchronizes property values when attributes change. */
|
|
436
|
-
attributeChangedCallback(name, oldValue, newValue) {
|
|
437
|
-
super.attributeChangedCallback(name, oldValue, newValue);
|
|
438
|
-
switch (name) {
|
|
439
|
-
case "name":
|
|
440
|
-
this.radios.forEach((x) => (x.name = this.name));
|
|
441
|
-
break;
|
|
442
|
-
case "aria-invalid":
|
|
443
|
-
this.radios.forEach((x) => {
|
|
444
|
-
x.classList.toggle("-invalid", newValue === "true");
|
|
445
|
-
x[updateLabels]?.();
|
|
446
|
-
});
|
|
447
|
-
break;
|
|
448
|
-
}
|
|
449
|
-
}
|
|
450
|
-
/** @inheritdoc */
|
|
451
|
-
connectedCallback() {
|
|
452
|
-
super.connectedCallback();
|
|
453
|
-
this.addEventListener("focusout", __classPrivateFieldGet(this, _M3eRadioGroupElement_focusOutHandler, "f"));
|
|
454
|
-
}
|
|
455
|
-
/** @inheritdoc */
|
|
456
|
-
disconnectedCallback() {
|
|
457
|
-
super.disconnectedCallback();
|
|
458
|
-
this.removeEventListener("focusout", __classPrivateFieldGet(this, _M3eRadioGroupElement_focusOutHandler, "f"));
|
|
459
|
-
}
|
|
460
|
-
/** @inheritdoc */
|
|
461
|
-
update(changedProperties) {
|
|
462
|
-
super.update(changedProperties);
|
|
463
|
-
if (changedProperties.has("disabled")) {
|
|
464
|
-
this.ariaDisabled = null;
|
|
465
|
-
}
|
|
466
|
-
if (changedProperties.has("disabled") && (changedProperties.get("disabled") !== undefined || this.disabled)) {
|
|
467
|
-
this[selectionManager].disabled = this.disabled;
|
|
468
|
-
}
|
|
708
|
+
}
|
|
709
|
+
/** @inheritdoc */
|
|
710
|
+
connectedCallback() {
|
|
711
|
+
super.connectedCallback();
|
|
712
|
+
this.addEventListener("focusout", __classPrivateFieldGet(this, _M3eRadioGroupElement_focusOutHandler, "f"));
|
|
713
|
+
__classPrivateFieldSet(this, _M3eRadioGroupElement_directionalitySubscription, M3eDirectionality.observe(() => this[selectionManager].directionality = M3eDirectionality.current), "f");
|
|
714
|
+
}
|
|
715
|
+
/** @inheritdoc */
|
|
716
|
+
disconnectedCallback() {
|
|
717
|
+
super.disconnectedCallback();
|
|
718
|
+
this.removeEventListener("focusout", __classPrivateFieldGet(this, _M3eRadioGroupElement_focusOutHandler, "f"));
|
|
719
|
+
__classPrivateFieldGet(this, _M3eRadioGroupElement_directionalitySubscription, "f")?.call(this);
|
|
720
|
+
}
|
|
721
|
+
/** @inheritdoc */
|
|
722
|
+
update(changedProperties) {
|
|
723
|
+
super.update(changedProperties);
|
|
724
|
+
if (changedProperties.has("disabled")) {
|
|
725
|
+
this.ariaDisabled = null;
|
|
469
726
|
}
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
return html `<slot
|
|
473
|
-
@slotchange="${__classPrivateFieldGet(this, _M3eRadioGroupElement_instances, "m", _M3eRadioGroupElement_handleSlotChange)}"
|
|
474
|
-
@keydown="${__classPrivateFieldGet(this, _M3eRadioGroupElement_instances, "m", _M3eRadioGroupElement_handleKeyDown)}"
|
|
475
|
-
@change="${__classPrivateFieldGet(this, _M3eRadioGroupElement_instances, "m", _M3eRadioGroupElement_handleChange)}"
|
|
476
|
-
></slot>`;
|
|
727
|
+
if (changedProperties.has("disabled") && (changedProperties.get("disabled") !== undefined || this.disabled)) {
|
|
728
|
+
this[selectionManager].disabled = this.disabled;
|
|
477
729
|
}
|
|
730
|
+
}
|
|
731
|
+
/** @inheritdoc */
|
|
732
|
+
render() {
|
|
733
|
+
return html`<slot @slotchange="${__classPrivateFieldGet(this, _M3eRadioGroupElement_instances, "m", _M3eRadioGroupElement_handleSlotChange)}" @keydown="${__classPrivateFieldGet(this, _M3eRadioGroupElement_instances, "m", _M3eRadioGroupElement_handleKeyDown)}" @change="${__classPrivateFieldGet(this, _M3eRadioGroupElement_instances, "m", _M3eRadioGroupElement_handleChange)}"></slot>`;
|
|
734
|
+
}
|
|
478
735
|
};
|
|
736
|
+
_M3eRadioGroupElement_directionalitySubscription = new WeakMap();
|
|
479
737
|
_M3eRadioGroupElement_focusOutHandler = new WeakMap();
|
|
480
738
|
_M3eRadioGroupElement_instances = new WeakSet();
|
|
481
739
|
_a = selectionManager;
|
|
482
740
|
_M3eRadioGroupElement_handleSlotChange = function _M3eRadioGroupElement_handleSlotChange() {
|
|
483
|
-
|
|
484
|
-
added
|
|
741
|
+
const {
|
|
742
|
+
added
|
|
743
|
+
} = this[selectionManager].setItems([...this.querySelectorAll("m3e-radio")]);
|
|
744
|
+
added.forEach(x => x.name = x.name || this.name);
|
|
485
745
|
};
|
|
486
746
|
_M3eRadioGroupElement_handleKeyDown = function _M3eRadioGroupElement_handleKeyDown(e) {
|
|
487
|
-
|
|
747
|
+
this[selectionManager].onKeyDown(e);
|
|
488
748
|
};
|
|
489
749
|
_M3eRadioGroupElement_handleChange = function _M3eRadioGroupElement_handleChange() {
|
|
490
|
-
|
|
750
|
+
this.checkValidity();
|
|
491
751
|
};
|
|
492
752
|
/** The styles of the element. */
|
|
493
|
-
M3eRadioGroupElement.styles = css
|
|
494
|
-
|
|
495
|
-
display: inline;
|
|
496
|
-
}
|
|
497
|
-
`;
|
|
498
|
-
M3eRadioGroupElement = __decorate([
|
|
499
|
-
t$1("m3e-radio-group")
|
|
500
|
-
], M3eRadioGroupElement);
|
|
753
|
+
M3eRadioGroupElement.styles = css`:host { display: inline-flex; }`;
|
|
754
|
+
M3eRadioGroupElement = __decorate([t$1("m3e-radio-group")], M3eRadioGroupElement);
|
|
501
755
|
|
|
502
756
|
export { M3eRadioElement, M3eRadioGroupElement };
|
|
503
757
|
//# sourceMappingURL=index.js.map
|