@m3e/list 1.1.5 → 1.1.7
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 +468 -45
- package/dist/css-custom-data.json +1615 -10
- package/dist/custom-elements.json +5099 -94
- package/dist/html-custom-data.json +156 -3
- package/dist/index.js +1423 -85
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +33 -4
- package/dist/index.min.js.map +1 -1
- package/dist/src/ActionListElement.d.ts +46 -0
- package/dist/src/ActionListElement.d.ts.map +1 -0
- package/dist/src/ExpandableListItemElement.d.ts +146 -0
- package/dist/src/ExpandableListItemElement.d.ts.map +1 -0
- package/dist/src/ListActionElement.d.ts +105 -0
- package/dist/src/ListActionElement.d.ts.map +1 -0
- package/dist/src/ListElement.d.ts +41 -2
- package/dist/src/ListElement.d.ts.map +1 -1
- package/dist/src/ListItemButtonElement.d.ts +25 -0
- package/dist/src/ListItemButtonElement.d.ts.map +1 -0
- package/dist/src/ListItemContentType.d.ts +3 -0
- package/dist/src/ListItemContentType.d.ts.map +1 -0
- package/dist/src/ListItemElement.d.ts +50 -14
- package/dist/src/ListItemElement.d.ts.map +1 -1
- package/dist/src/ListOptionElement.d.ts +127 -0
- package/dist/src/ListOptionElement.d.ts.map +1 -0
- package/dist/src/ListVariant.d.ts +3 -0
- package/dist/src/ListVariant.d.ts.map +1 -0
- package/dist/src/SelectionListElement.d.ts +77 -0
- package/dist/src/SelectionListElement.d.ts.map +1 -0
- package/dist/src/index.d.ts +8 -0
- package/dist/src/index.d.ts.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -3,8 +3,9 @@
|
|
|
3
3
|
* Copyright (c) 2025 matraic
|
|
4
4
|
* See LICENSE file in the project root for full license text.
|
|
5
5
|
*/
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
6
|
+
import { selectionManager, RovingTabIndexManager, SelectionManager } from '@m3e/core/a11y';
|
|
7
|
+
import { LitElement, html, unsafeCSS, css } from 'lit';
|
|
8
|
+
import { Role, ResizeController, DesignToken, computeLineCount, LinkButton, KeyboardClick, Focusable, Disabled, AttachInternals, renderPseudoLink, Selected, getTextContent, Labelled, Dirty, Touched, FormAssociated, formValue } from '@m3e/core';
|
|
8
9
|
|
|
9
10
|
/******************************************************************************
|
|
10
11
|
Copyright (c) Microsoft Corporation.
|
|
@@ -29,6 +30,17 @@ function __decorate(decorators, target, key, desc) {
|
|
|
29
30
|
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;
|
|
30
31
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
31
32
|
}
|
|
33
|
+
function __classPrivateFieldGet(receiver, state, kind, f) {
|
|
34
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
35
|
+
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");
|
|
36
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
37
|
+
}
|
|
38
|
+
function __classPrivateFieldSet(receiver, state, value, kind, f) {
|
|
39
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
40
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
41
|
+
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");
|
|
42
|
+
return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
|
|
43
|
+
}
|
|
32
44
|
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
33
45
|
var e = new Error(message);
|
|
34
46
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
@@ -39,7 +51,7 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
|
|
|
39
51
|
* Copyright 2017 Google LLC
|
|
40
52
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
41
53
|
*/
|
|
42
|
-
const t$
|
|
54
|
+
const t$2 = t => (e, o) => {
|
|
43
55
|
void 0 !== o ? o.addInitializer(() => {
|
|
44
56
|
customElements.define(t, e);
|
|
45
57
|
}) : customElements.define(t, e);
|
|
@@ -50,21 +62,21 @@ const t$1 = t => (e, o) => {
|
|
|
50
62
|
* Copyright 2019 Google LLC
|
|
51
63
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
52
64
|
*/
|
|
53
|
-
const t = globalThis,
|
|
54
|
-
e$
|
|
55
|
-
s = Symbol(),
|
|
56
|
-
o$
|
|
57
|
-
let n$
|
|
65
|
+
const t$1 = globalThis,
|
|
66
|
+
e$4 = t$1.ShadowRoot && (void 0 === t$1.ShadyCSS || t$1.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype,
|
|
67
|
+
s$1 = Symbol(),
|
|
68
|
+
o$4 = new WeakMap();
|
|
69
|
+
let n$3 = class n {
|
|
58
70
|
constructor(t, e, o) {
|
|
59
|
-
if (this._$cssResult$ = true, o !== s) throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
|
|
71
|
+
if (this._$cssResult$ = true, o !== s$1) throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
|
|
60
72
|
this.cssText = t, this.t = e;
|
|
61
73
|
}
|
|
62
74
|
get styleSheet() {
|
|
63
75
|
let t = this.o;
|
|
64
76
|
const s = this.t;
|
|
65
|
-
if (e$
|
|
77
|
+
if (e$4 && void 0 === t) {
|
|
66
78
|
const e = void 0 !== s && 1 === s.length;
|
|
67
|
-
e && (t = o$
|
|
79
|
+
e && (t = o$4.get(s)), void 0 === t && ((this.o = t = new CSSStyleSheet()).replaceSync(this.cssText), e && o$4.set(s, t));
|
|
68
80
|
}
|
|
69
81
|
return t;
|
|
70
82
|
}
|
|
@@ -72,18 +84,18 @@ let n$1 = class n {
|
|
|
72
84
|
return this.cssText;
|
|
73
85
|
}
|
|
74
86
|
};
|
|
75
|
-
const r$
|
|
76
|
-
S = (s, o) => {
|
|
77
|
-
if (e$
|
|
87
|
+
const r$3 = t => new n$3("string" == typeof t ? t : t + "", void 0, s$1),
|
|
88
|
+
S$1 = (s, o) => {
|
|
89
|
+
if (e$4) s.adoptedStyleSheets = o.map(t => t instanceof CSSStyleSheet ? t : t.styleSheet);else for (const e of o) {
|
|
78
90
|
const o = document.createElement("style"),
|
|
79
|
-
n = t.litNonce;
|
|
91
|
+
n = t$1.litNonce;
|
|
80
92
|
void 0 !== n && o.setAttribute("nonce", n), o.textContent = e.cssText, s.appendChild(o);
|
|
81
93
|
}
|
|
82
94
|
},
|
|
83
|
-
c$
|
|
95
|
+
c$2 = e$4 ? t => t : t => t instanceof CSSStyleSheet ? (t => {
|
|
84
96
|
let e = "";
|
|
85
97
|
for (const s of t.cssRules) e += s.cssText;
|
|
86
|
-
return r$
|
|
98
|
+
return r$3(e);
|
|
87
99
|
})(t) : t;
|
|
88
100
|
|
|
89
101
|
/**
|
|
@@ -92,23 +104,23 @@ const r$1 = t => new n$1("string" == typeof t ? t : t + "", void 0, s),
|
|
|
92
104
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
93
105
|
*/
|
|
94
106
|
const {
|
|
95
|
-
is: i,
|
|
96
|
-
defineProperty: e,
|
|
97
|
-
getOwnPropertyDescriptor: h,
|
|
98
|
-
getOwnPropertyNames: r,
|
|
99
|
-
getOwnPropertySymbols: o,
|
|
100
|
-
getPrototypeOf: n
|
|
107
|
+
is: i$1,
|
|
108
|
+
defineProperty: e$3,
|
|
109
|
+
getOwnPropertyDescriptor: h$1,
|
|
110
|
+
getOwnPropertyNames: r$2,
|
|
111
|
+
getOwnPropertySymbols: o$3,
|
|
112
|
+
getPrototypeOf: n$2
|
|
101
113
|
} = Object,
|
|
102
|
-
a = globalThis,
|
|
103
|
-
c = a.trustedTypes,
|
|
104
|
-
l = c ? c.emptyScript : "",
|
|
105
|
-
p = a.reactiveElementPolyfillSupport,
|
|
106
|
-
d = (t, s) => t,
|
|
107
|
-
u = {
|
|
114
|
+
a$1 = globalThis,
|
|
115
|
+
c$1 = a$1.trustedTypes,
|
|
116
|
+
l$1 = c$1 ? c$1.emptyScript : "",
|
|
117
|
+
p$1 = a$1.reactiveElementPolyfillSupport,
|
|
118
|
+
d$1 = (t, s) => t,
|
|
119
|
+
u$1 = {
|
|
108
120
|
toAttribute(t, s) {
|
|
109
121
|
switch (s) {
|
|
110
122
|
case Boolean:
|
|
111
|
-
t = t ? l : null;
|
|
123
|
+
t = t ? l$1 : null;
|
|
112
124
|
break;
|
|
113
125
|
case Object:
|
|
114
126
|
case Array:
|
|
@@ -136,16 +148,16 @@ const {
|
|
|
136
148
|
return i;
|
|
137
149
|
}
|
|
138
150
|
},
|
|
139
|
-
f = (t, s) => !i(t, s),
|
|
151
|
+
f$1 = (t, s) => !i$1(t, s),
|
|
140
152
|
b = {
|
|
141
153
|
attribute: true,
|
|
142
154
|
type: String,
|
|
143
|
-
converter: u,
|
|
155
|
+
converter: u$1,
|
|
144
156
|
reflect: false,
|
|
145
157
|
useDefault: false,
|
|
146
|
-
hasChanged: f
|
|
158
|
+
hasChanged: f$1
|
|
147
159
|
};
|
|
148
|
-
Symbol.metadata ??= Symbol("metadata"), a.litPropertyMetadata ??= new WeakMap();
|
|
160
|
+
Symbol.metadata ??= Symbol("metadata"), a$1.litPropertyMetadata ??= new WeakMap();
|
|
149
161
|
class y extends HTMLElement {
|
|
150
162
|
static addInitializer(t) {
|
|
151
163
|
this._$Ei(), (this.l ??= []).push(t);
|
|
@@ -157,14 +169,14 @@ class y extends HTMLElement {
|
|
|
157
169
|
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) {
|
|
158
170
|
const i = Symbol(),
|
|
159
171
|
h = this.getPropertyDescriptor(t, i, s);
|
|
160
|
-
void 0 !== h && e(this.prototype, t, h);
|
|
172
|
+
void 0 !== h && e$3(this.prototype, t, h);
|
|
161
173
|
}
|
|
162
174
|
}
|
|
163
175
|
static getPropertyDescriptor(t, s, i) {
|
|
164
176
|
const {
|
|
165
177
|
get: e,
|
|
166
178
|
set: r
|
|
167
|
-
} = h(this.prototype, t) ?? {
|
|
179
|
+
} = h$1(this.prototype, t) ?? {
|
|
168
180
|
get() {
|
|
169
181
|
return this[s];
|
|
170
182
|
},
|
|
@@ -186,15 +198,15 @@ class y extends HTMLElement {
|
|
|
186
198
|
return this.elementProperties.get(t) ?? b;
|
|
187
199
|
}
|
|
188
200
|
static _$Ei() {
|
|
189
|
-
if (this.hasOwnProperty(d("elementProperties"))) return;
|
|
190
|
-
const t = n(this);
|
|
201
|
+
if (this.hasOwnProperty(d$1("elementProperties"))) return;
|
|
202
|
+
const t = n$2(this);
|
|
191
203
|
t.finalize(), void 0 !== t.l && (this.l = [...t.l]), this.elementProperties = new Map(t.elementProperties);
|
|
192
204
|
}
|
|
193
205
|
static finalize() {
|
|
194
|
-
if (this.hasOwnProperty(d("finalized"))) return;
|
|
195
|
-
if (this.finalized = true, this._$Ei(), this.hasOwnProperty(d("properties"))) {
|
|
206
|
+
if (this.hasOwnProperty(d$1("finalized"))) return;
|
|
207
|
+
if (this.finalized = true, this._$Ei(), this.hasOwnProperty(d$1("properties"))) {
|
|
196
208
|
const t = this.properties,
|
|
197
|
-
s = [...r(t), ...o(t)];
|
|
209
|
+
s = [...r$2(t), ...o$3(t)];
|
|
198
210
|
for (const i of s) this.createProperty(i, t[i]);
|
|
199
211
|
}
|
|
200
212
|
const t = this[Symbol.metadata];
|
|
@@ -213,8 +225,8 @@ class y extends HTMLElement {
|
|
|
213
225
|
const i = [];
|
|
214
226
|
if (Array.isArray(s)) {
|
|
215
227
|
const e = new Set(s.flat(1 / 0).reverse());
|
|
216
|
-
for (const s of e) i.unshift(c$
|
|
217
|
-
} else void 0 !== s && i.push(c$
|
|
228
|
+
for (const s of e) i.unshift(c$2(s));
|
|
229
|
+
} else void 0 !== s && i.push(c$2(s));
|
|
218
230
|
return i;
|
|
219
231
|
}
|
|
220
232
|
static _$Eu(t, s) {
|
|
@@ -241,7 +253,7 @@ class y extends HTMLElement {
|
|
|
241
253
|
}
|
|
242
254
|
createRenderRoot() {
|
|
243
255
|
const t = this.shadowRoot ?? this.attachShadow(this.constructor.shadowRootOptions);
|
|
244
|
-
return S(t, this.constructor.elementStyles), t;
|
|
256
|
+
return S$1(t, this.constructor.elementStyles), t;
|
|
245
257
|
}
|
|
246
258
|
connectedCallback() {
|
|
247
259
|
this.renderRoot ??= this.createRenderRoot(), this.enableUpdating(true), this._$EO?.forEach(t => t.hostConnected?.());
|
|
@@ -257,7 +269,7 @@ class y extends HTMLElement {
|
|
|
257
269
|
const i = this.constructor.elementProperties.get(t),
|
|
258
270
|
e = this.constructor._$Eu(t, i);
|
|
259
271
|
if (void 0 !== e && true === i.reflect) {
|
|
260
|
-
const h = (void 0 !== i.converter?.toAttribute ? i.converter : u).toAttribute(s, i.type);
|
|
272
|
+
const h = (void 0 !== i.converter?.toAttribute ? i.converter : u$1).toAttribute(s, i.type);
|
|
261
273
|
this._$Em = t, null == h ? this.removeAttribute(e) : this.setAttribute(e, h), this._$Em = null;
|
|
262
274
|
}
|
|
263
275
|
}
|
|
@@ -268,7 +280,7 @@ class y extends HTMLElement {
|
|
|
268
280
|
const t = i.getPropertyOptions(e),
|
|
269
281
|
h = "function" == typeof t.converter ? {
|
|
270
282
|
fromAttribute: t.converter
|
|
271
|
-
} : void 0 !== t.converter?.fromAttribute ? t.converter : u;
|
|
283
|
+
} : void 0 !== t.converter?.fromAttribute ? t.converter : u$1;
|
|
272
284
|
this._$Em = e;
|
|
273
285
|
const r = h.fromAttribute(s, t.type);
|
|
274
286
|
this[e] = r ?? this._$Ej?.get(e) ?? r, this._$Em = null;
|
|
@@ -278,7 +290,7 @@ class y extends HTMLElement {
|
|
|
278
290
|
if (void 0 !== t) {
|
|
279
291
|
const e = this.constructor,
|
|
280
292
|
h = this[t];
|
|
281
|
-
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;
|
|
293
|
+
if (i ??= e.getPropertyOptions(t), !((i.hasChanged ?? f$1)(h, s) || i.useDefault && i.reflect && h === this._$Ej?.get(t) && !this.hasAttribute(e._$Eu(t, i)))) return;
|
|
282
294
|
this.C(t, s, i);
|
|
283
295
|
}
|
|
284
296
|
false === this.isUpdatePending && (this._$ES = this._$EP());
|
|
@@ -352,17 +364,92 @@ class y extends HTMLElement {
|
|
|
352
364
|
}
|
|
353
365
|
y.elementStyles = [], y.shadowRootOptions = {
|
|
354
366
|
mode: "open"
|
|
355
|
-
}, y[d("elementProperties")] = new Map(), y[d("finalized")] = new Map(), p?.({
|
|
367
|
+
}, y[d$1("elementProperties")] = new Map(), y[d$1("finalized")] = new Map(), p$1?.({
|
|
356
368
|
ReactiveElement: y
|
|
357
|
-
}), (a.reactiveElementVersions ??= []).push("2.1.1");
|
|
369
|
+
}), (a$1.reactiveElementVersions ??= []).push("2.1.1");
|
|
358
370
|
|
|
359
371
|
/**
|
|
360
|
-
*
|
|
372
|
+
* @license
|
|
373
|
+
* Copyright 2017 Google LLC
|
|
374
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
375
|
+
*/
|
|
376
|
+
const o$2 = {
|
|
377
|
+
attribute: true,
|
|
378
|
+
type: String,
|
|
379
|
+
converter: u$1,
|
|
380
|
+
reflect: false,
|
|
381
|
+
hasChanged: f$1
|
|
382
|
+
},
|
|
383
|
+
r$1 = (t = o$2, e, r) => {
|
|
384
|
+
const {
|
|
385
|
+
kind: n,
|
|
386
|
+
metadata: i
|
|
387
|
+
} = r;
|
|
388
|
+
let s = globalThis.litPropertyMetadata.get(i);
|
|
389
|
+
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) {
|
|
390
|
+
const {
|
|
391
|
+
name: o
|
|
392
|
+
} = r;
|
|
393
|
+
return {
|
|
394
|
+
set(r) {
|
|
395
|
+
const n = e.get.call(this);
|
|
396
|
+
e.set.call(this, r), this.requestUpdate(o, n, t);
|
|
397
|
+
},
|
|
398
|
+
init(e) {
|
|
399
|
+
return void 0 !== e && this.C(o, void 0, t, e), e;
|
|
400
|
+
}
|
|
401
|
+
};
|
|
402
|
+
}
|
|
403
|
+
if ("setter" === n) {
|
|
404
|
+
const {
|
|
405
|
+
name: o
|
|
406
|
+
} = r;
|
|
407
|
+
return function (r) {
|
|
408
|
+
const n = this[o];
|
|
409
|
+
e.call(this, r), this.requestUpdate(o, n, t);
|
|
410
|
+
};
|
|
411
|
+
}
|
|
412
|
+
throw Error("Unsupported decorator location: " + n);
|
|
413
|
+
};
|
|
414
|
+
function n$1(t) {
|
|
415
|
+
return (e, o) => "object" == typeof o ? r$1(t, e, o) : ((t, e, o) => {
|
|
416
|
+
const r = e.hasOwnProperty(o);
|
|
417
|
+
return e.constructor.createProperty(o, t), r ? Object.getOwnPropertyDescriptor(e, o) : void 0;
|
|
418
|
+
})(t, e, o);
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
/**
|
|
422
|
+
* @license
|
|
423
|
+
* Copyright 2017 Google LLC
|
|
424
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
425
|
+
*/
|
|
426
|
+
const e$2 = (e, t, c) => (c.configurable = true, c.enumerable = true, Reflect.decorate && "object" != typeof t && Object.defineProperty(e, t, c), c);
|
|
427
|
+
|
|
428
|
+
/**
|
|
429
|
+
* @license
|
|
430
|
+
* Copyright 2017 Google LLC
|
|
431
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
432
|
+
*/
|
|
433
|
+
function e$1(e, r) {
|
|
434
|
+
return (n, s, i) => {
|
|
435
|
+
const o = t => t.renderRoot?.querySelector(e) ?? null;
|
|
436
|
+
return e$2(n, s, {
|
|
437
|
+
get() {
|
|
438
|
+
return o(this);
|
|
439
|
+
}
|
|
440
|
+
});
|
|
441
|
+
};
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
var _M3eListItemElement_instances, _M3eListItemElement_resizeController, _M3eListItemElement_leadingContentType, _M3eListItemElement_trailingContentType, _M3eListItemElement_updateMultiline, _M3eListItemElement_getSlotContentType;
|
|
445
|
+
/**
|
|
446
|
+
* An item in a list.
|
|
361
447
|
*
|
|
362
448
|
* @description
|
|
363
|
-
* The `m3e-list` component
|
|
364
|
-
*
|
|
365
|
-
* via CSS custom properties
|
|
449
|
+
* The `m3e-list-item` component represents a single item within a list. It supports rich
|
|
450
|
+
* content, leading/trailing media, overline, supporting text, and trailing supporting text
|
|
451
|
+
* via named slots. The component is highly customizable through CSS custom properties and
|
|
452
|
+
* is designed for accessibility and flexible layout.
|
|
366
453
|
*
|
|
367
454
|
* @example
|
|
368
455
|
* The following example illustrates a list with a single item using all supported slots.
|
|
@@ -373,42 +460,157 @@ y.elementStyles = [], y.shadowRootOptions = {
|
|
|
373
460
|
* ```html
|
|
374
461
|
* <m3e-list>
|
|
375
462
|
* <m3e-list-item>
|
|
376
|
-
* <m3e-icon slot="leading
|
|
463
|
+
* <m3e-icon slot="leading" name="person"></m3e-icon>
|
|
377
464
|
* <span slot="overline">Overline</span>
|
|
378
465
|
* Headline
|
|
379
466
|
* <span slot="supporting-text">Supporting text</span>
|
|
380
|
-
* <
|
|
381
|
-
* <m3e-icon slot="trailing-icon" name="arrow_right"></m3e-icon>
|
|
467
|
+
* <m3e-icon slot="trailing" name="arrow_right"></m3e-icon>
|
|
382
468
|
* </m3e-list-item>
|
|
383
469
|
* </m3e-list>
|
|
384
470
|
* ```
|
|
385
471
|
*
|
|
386
|
-
* @tag m3e-list
|
|
472
|
+
* @tag m3e-list-item
|
|
387
473
|
*
|
|
388
|
-
* @slot - Renders the
|
|
474
|
+
* @slot - Renders the content of the list item.
|
|
475
|
+
* @slot leading - Renders the leading content of the list item.
|
|
476
|
+
* @slot overline - Renders the overline of the list item.
|
|
477
|
+
* @slot supporting-text - Renders the supporting text of the list item.
|
|
478
|
+
* @slot trailing - Renders the trailing content of the list item.
|
|
389
479
|
*
|
|
390
|
-
* @cssprop --m3e-list-
|
|
391
|
-
* @cssprop --m3e-list-
|
|
392
|
-
* @cssprop --m3e-list-
|
|
480
|
+
* @cssprop --m3e-list-item-between-space - Horizontal gap between elements.
|
|
481
|
+
* @cssprop --m3e-list-item-leading-space - Horizontal padding for the leading side.
|
|
482
|
+
* @cssprop --m3e-list-item-trailing-space - Horizontal padding for the trailing side.
|
|
483
|
+
* @cssprop --m3e-list-item-padding-inline - Horizontal padding for the list item.
|
|
484
|
+
* @cssprop --m3e-list-item-padding-block - Vertical padding for the list item.
|
|
485
|
+
* @cssprop --m3e-list-item-one-line-top-space - Top padding for one-line items.
|
|
486
|
+
* @cssprop --m3e-list-item-one-line-bottom-space - Bottom padding for one-line items.
|
|
487
|
+
* @cssprop --m3e-list-item-two-line-top-space - Top padding for two-line items.
|
|
488
|
+
* @cssprop --m3e-list-item-two-line-bottom-space - Bottom padding for two-line items.
|
|
489
|
+
* @cssprop --m3e-list-item-three-line-top-space - Top padding for three-line items.
|
|
490
|
+
* @cssprop --m3e-list-item-three-line-bottom-space - Bottom padding for three-line items.
|
|
491
|
+
* @cssprop --m3e-list-item-font-size - Font size for main content.
|
|
492
|
+
* @cssprop --m3e-list-item-font-weight - Font weight for main content.
|
|
493
|
+
* @cssprop --m3e-list-item-line-height - Line height for main content.
|
|
494
|
+
* @cssprop --m3e-list-item-tracking - Letter spacing for main content.
|
|
495
|
+
* @cssprop --m3e-list-item-overline-font-size - Font size for overline slot.
|
|
496
|
+
* @cssprop --m3e-list-item-overline-font-weight - Font weight for overline slot.
|
|
497
|
+
* @cssprop --m3e-list-item-overline-line-height - Line height for overline slot.
|
|
498
|
+
* @cssprop --m3e-list-item-overline-tracking - Letter spacing for overline slot.
|
|
499
|
+
* @cssprop --m3e-list-item-supporting-text-font-size - Font size for supporting text slot.
|
|
500
|
+
* @cssprop --m3e-list-item-supporting-text-font-weight - Font weight for supporting text slot.
|
|
501
|
+
* @cssprop --m3e-list-item-supporting-text-line-height - Line height for supporting text slot.
|
|
502
|
+
* @cssprop --m3e-list-item-supporting-text-tracking - Letter spacing for supporting text slot.
|
|
503
|
+
* @cssprop --m3e-list-item-trailing-text-font-size - Font size for trailing supporting text slot.
|
|
504
|
+
* @cssprop --m3e-list-item-trailing-text-font-weight - Font weight for trailing supporting text slot.
|
|
505
|
+
* @cssprop --m3e-list-item-trailing-text-line-height - Line height for trailing supporting text slot.
|
|
506
|
+
* @cssprop --m3e-list-item-trailing-text-tracking - Letter spacing for trailing supporting text slot.
|
|
507
|
+
* @cssprop --m3e-list-item-icon-size - Size for leading/trailing icons.
|
|
508
|
+
* @cssprop --m3e-list-item-label-text-color - Color for the main content.
|
|
509
|
+
* @cssprop --m3e-list-item-overline-color - Color for the overline slot.
|
|
510
|
+
* @cssprop --m3e-list-item-supporting-text-color - Color for the supporting text slot.
|
|
511
|
+
* @cssprop --m3e-list-item-leading-color - Color for the leading content.
|
|
512
|
+
* @cssprop --m3e-list-item-trailing-color - Color for the trailing content.
|
|
513
|
+
* @cssprop --m3e-list-item-container-color - Background color of the list item.
|
|
514
|
+
* @cssprop --m3e-list-item-container-shape - Border radius of the list item.
|
|
515
|
+
* @cssprop --m3e-list-item-hover-container-shape - Border radius of the list item on hover.
|
|
516
|
+
* @cssprop --m3e-list-item-focus-container-shape - Border radius of the list item on focus.
|
|
517
|
+
* @cssprop --m3e-list-item-video-width - Width of the video slot.
|
|
518
|
+
* @cssprop --m3e-list-item-video-height - Height of the video slot.
|
|
519
|
+
* @cssprop --m3e-list-item-video-shape - Border radius of the video slot.
|
|
520
|
+
* @cssprop --m3e-list-item-image-width - Width of the image slot.
|
|
521
|
+
* @cssprop --m3e-list-item-image-height - Height of the image slot.
|
|
522
|
+
* @cssprop --m3e-list-item-image-shape - Border radius of the image slot.
|
|
523
|
+
* @cssprop --m3e-list-item-three-line-top-offset - Top offset for media in three line items.
|
|
524
|
+
* @cssprop --m3e-list-item-one-line-height - Minimum height of a one line list item.
|
|
525
|
+
* @cssprop --m3e-list-item-two-line-height - Minimum height of a two line list item.
|
|
526
|
+
* @cssprop --m3e-list-item-three-line-height - Minimum height of a three line list item.
|
|
393
527
|
*/
|
|
394
|
-
let
|
|
528
|
+
let M3eListItemElement = class M3eListItemElement extends Role(LitElement, "listitem") {
|
|
529
|
+
constructor() {
|
|
530
|
+
super(...arguments);
|
|
531
|
+
_M3eListItemElement_instances.add(this);
|
|
532
|
+
/** @private */
|
|
533
|
+
_M3eListItemElement_resizeController.set(this, new ResizeController(this, {
|
|
534
|
+
target: null,
|
|
535
|
+
callback: () => __classPrivateFieldGet(this, _M3eListItemElement_instances, "m", _M3eListItemElement_updateMultiline).call(this)
|
|
536
|
+
}));
|
|
537
|
+
/** @private */
|
|
538
|
+
_M3eListItemElement_leadingContentType.set(this, void 0);
|
|
539
|
+
/** @private */
|
|
540
|
+
_M3eListItemElement_trailingContentType.set(this, void 0);
|
|
541
|
+
}
|
|
542
|
+
/** The type of leading content. */
|
|
543
|
+
get leadingContentType() {
|
|
544
|
+
return __classPrivateFieldGet(this, _M3eListItemElement_leadingContentType, "f");
|
|
545
|
+
}
|
|
546
|
+
/** The type of trailing content. */
|
|
547
|
+
get trailingContentType() {
|
|
548
|
+
return __classPrivateFieldGet(this, _M3eListItemElement_trailingContentType, "f");
|
|
549
|
+
}
|
|
550
|
+
/** @inheritdoc */
|
|
551
|
+
firstUpdated(_changedProperties) {
|
|
552
|
+
super.firstUpdated(_changedProperties);
|
|
553
|
+
const base = this.shadowRoot?.querySelector(".base");
|
|
554
|
+
if (base) {
|
|
555
|
+
__classPrivateFieldGet(this, _M3eListItemElement_resizeController, "f").observe(base);
|
|
556
|
+
}
|
|
557
|
+
}
|
|
395
558
|
/** @inheritdoc */
|
|
396
559
|
render() {
|
|
397
|
-
return html`<slot></slot>`;
|
|
560
|
+
return html`<slot name="leading" @slotchange="${this._handleLeadingSlotChange}"><slot name="leading-icon" @slotchange="${this._handleLeadingSlotChange}"></slot></slot><div class="base"><slot name="overline"></slot><slot></slot><slot name="supporting-text"></slot></div><slot name="trailing" @slotchange="${this._handleTrailingSlotChange}"><slot name="trailing-supporting-text" @slotchange="${this._handleTrailingSlotChange}"></slot><slot name="trailing-icon" @slotchange="${this._handleTrailingSlotChange}"></slot></slot>`;
|
|
561
|
+
}
|
|
562
|
+
/** @internal */
|
|
563
|
+
_handleLeadingSlotChange(e) {
|
|
564
|
+
const contentType = __classPrivateFieldGet(this, _M3eListItemElement_leadingContentType, "f");
|
|
565
|
+
__classPrivateFieldSet(this, _M3eListItemElement_leadingContentType, __classPrivateFieldGet(this, _M3eListItemElement_instances, "m", _M3eListItemElement_getSlotContentType).call(this, e.target), "f");
|
|
566
|
+
this.classList.toggle("-has-leading", __classPrivateFieldGet(this, _M3eListItemElement_leadingContentType, "f") !== undefined);
|
|
567
|
+
if (contentType !== __classPrivateFieldGet(this, _M3eListItemElement_leadingContentType, "f")) {
|
|
568
|
+
this.closest("m3e-list,m3e-action-list,m3e-selection-list")?.notifyLeadingContentTypeChange(contentType, __classPrivateFieldGet(this, _M3eListItemElement_leadingContentType, "f"));
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
/** @internal */
|
|
572
|
+
_handleTrailingSlotChange(e) {
|
|
573
|
+
const contentType = __classPrivateFieldGet(this, _M3eListItemElement_trailingContentType, "f");
|
|
574
|
+
__classPrivateFieldSet(this, _M3eListItemElement_trailingContentType, __classPrivateFieldGet(this, _M3eListItemElement_instances, "m", _M3eListItemElement_getSlotContentType).call(this, e.target), "f");
|
|
575
|
+
this.classList.toggle("-has-trailing", __classPrivateFieldGet(this, _M3eListItemElement_trailingContentType, "f") !== undefined);
|
|
576
|
+
if (contentType !== __classPrivateFieldGet(this, _M3eListItemElement_trailingContentType, "f")) {
|
|
577
|
+
this.closest("m3e-list,m3e-action-list,m3e-selection-list")?.notifyTrailingContentTypeChange(contentType, __classPrivateFieldGet(this, _M3eListItemElement_trailingContentType, "f"));
|
|
578
|
+
}
|
|
398
579
|
}
|
|
399
580
|
};
|
|
581
|
+
_M3eListItemElement_resizeController = new WeakMap();
|
|
582
|
+
_M3eListItemElement_leadingContentType = new WeakMap();
|
|
583
|
+
_M3eListItemElement_trailingContentType = new WeakMap();
|
|
584
|
+
_M3eListItemElement_instances = new WeakSet();
|
|
585
|
+
_M3eListItemElement_updateMultiline = function _M3eListItemElement_updateMultiline() {
|
|
586
|
+
const base = this.shadowRoot?.querySelector(".base") ?? null;
|
|
587
|
+
const lines = base === null ? 0 : computeLineCount(base);
|
|
588
|
+
this.classList.toggle("-one-line", lines <= 1);
|
|
589
|
+
this.classList.toggle("-two-line", lines == 2);
|
|
590
|
+
this.classList.toggle("-three-line", lines > 2);
|
|
591
|
+
};
|
|
592
|
+
_M3eListItemElement_getSlotContentType = function _M3eListItemElement_getSlotContentType(slot) {
|
|
593
|
+
const elements = slot.assignedElements({
|
|
594
|
+
flatten: true
|
|
595
|
+
});
|
|
596
|
+
if (elements.some(x => x.tagName === "VIDEO")) return "video";
|
|
597
|
+
if (elements.some(x => x.tagName === "IMG")) return "image";
|
|
598
|
+
if (elements.some(x => x.tagName === "M3E-AVATAR")) return "avatar";
|
|
599
|
+
if (elements.some(x => x.tagName === "M3E-ICON")) return "icon";
|
|
600
|
+
return elements.length > 0 ? "text" : undefined;
|
|
601
|
+
};
|
|
400
602
|
/** The styles of the element. */
|
|
401
|
-
M3eListElement.styles = css`:host { display: block; padding-block: var(--m3e-list-block-padding, 0.5rem); --m3e-divider-inset-start-size: var(--m3e-list-divider-inset-start-size, 1rem); --m3e-divider-inset-end-size: var(--m3e-list-divider-inset-end-size, 1.5rem); }`;
|
|
402
|
-
|
|
603
|
+
M3eListItemElement.styles = css`:host { flex: none; display: flex; box-sizing: border-box; column-gap: var(--m3e-list-item-between-space, 1rem); padding-inline-start: var(--m3e-list-item-leading-space, 1rem); padding-inline-end: var(--m3e-list-item-trailing-space, 1rem); border-top-left-radius: var( --_list-item-top-container-shape, var(--m3e-list-item-container-shape, ${DesignToken.shape.corner.none}) ); border-top-right-radius: var( --_list-item-top-container-shape, var(--m3e-list-item-container-shape, ${DesignToken.shape.corner.none}) ); border-bottom-left-radius: var( --_list-item-bottom-container-shape, var(--m3e-list-item-container-shape, ${DesignToken.shape.corner.none}) ); border-bottom-right-radius: var( --_list-item-bottom-container-shape, var(--m3e-list-item-container-shape, ${DesignToken.shape.corner.none}) ); transition: ${unsafeCSS(`border-radius ${DesignToken.motion.spring.fastEffects}, background-color ${DesignToken.motion.duration.short4} ${DesignToken.motion.easing.standard}`)}; } :host(.-one-line) { padding-block-start: var(--m3e-list-item-one-line-top-space, 0.5rem); padding-block-end: var(--m3e-list-item-one-line-bottom-space, 0.5rem); min-height: calc(var(--m3e-list-item-one-line-height, 3.5rem) + ${DesignToken.density.calc(-3)}); } :host(.-two-line) { padding-block-start: var(--m3e-list-item-two-line-top-space, 0.5rem); padding-block-end: var(--m3e-list-item-two-line-bottom-space, 0.5rem); min-height: calc(var(--m3e-list-item-two-line-height, 4.5rem) + ${DesignToken.density.calc(-3)}); } :host(.-three-line) { padding-block-start: var(--m3e-list-item-three-line-top-space, 0.75rem); padding-block-end: var(--m3e-list-item-three-line-bottom-space, 0.75rem); min-height: calc(var(--m3e-list-item-three-line-height, 5.5rem) + ${DesignToken.density.calc(-3)}); } :host(:not(.-three-line)) { align-items: center; } :host(.-three-line) { align-items: flex-start; } :host(:not(:disabled):not([selected]:not(:hover)):focus-visible) .state-layer, :host(:not(:disabled):not([selected]:not(:hover)):focus-visible) .ripple, :host(:not(:disabled):not([selected]:not(:hover)):focus-visible) .focus-ring { border-top-left-radius: var( --_list-item-top-container-shape, var(--m3e-list-item-focus-container-shape, ${DesignToken.shape.corner.large}) ); border-top-right-radius: var( --_list-item-top-container-shape, var(--m3e-list-item-focus-container-shape, ${DesignToken.shape.corner.large}) ); border-bottom-left-radius: var( --_list-item-bottom-container-shape, var(--m3e-list-item-focus-container-shape, ${DesignToken.shape.corner.large}) ); border-bottom-right-radius: var( --_list-item-bottom-container-shape, var(--m3e-list-item-focus-container-shape, ${DesignToken.shape.corner.large}) ); } :host(:not(:disabled):not([selected])) .state-layer, :host(:not(:disabled):not([selected])) .ripple, :host(:not(:disabled):not([selected])) .focus-ring { border-top-left-radius: var( --_list-item-top-container-shape, var(--m3e-list-item-hover-container-shape, ${DesignToken.shape.corner.medium}) ); border-top-right-radius: var( --_list-item-top-container-shape, var(--m3e-list-item-hover-container-shape, ${DesignToken.shape.corner.medium}) ); border-bottom-left-radius: var( --_list-item-bottom-container-shape, var(--m3e-list-item-hover-container-shape, ${DesignToken.shape.corner.medium}) ); border-bottom-right-radius: var( --_list-item-bottom-container-shape, var(--m3e-list-item-hover-container-shape, ${DesignToken.shape.corner.medium}) ); } .base { flex: 1 1 auto; display: flex; flex-direction: column; align-items: unset; justify-content: unset; } ::slotted([slot="overline"]) { font-size: var(--m3e-list-item-overline-font-size, ${DesignToken.typescale.standard.label.small.fontSize}); font-weight: var(--m3e-list-item-overline-font-weight, ${DesignToken.typescale.standard.label.small.fontWeight}); line-height: var(--m3e-list-item-overline-line-height, ${DesignToken.typescale.standard.label.small.lineHeight}); letter-spacing: var(--m3e-list-item-overline-tracking, ${DesignToken.typescale.standard.label.small.tracking}); } ::slotted([slot="supporting-text"]) { font-size: var(--m3e-list-item-supporting-text-font-size, ${DesignToken.typescale.standard.body.medium.fontSize}); font-weight: var( --m3e-list-item-supporting-text-font-weight, ${DesignToken.typescale.standard.body.medium.fontWeight} ); line-height: var( --m3e-list-item-supporting-text-line-height, ${DesignToken.typescale.standard.body.medium.lineHeight} ); letter-spacing: var( --m3e-list-item-supporting-text-tracking, ${DesignToken.typescale.standard.body.medium.tracking} ); } ::slotted(:not([slot])) { font-size: var(--m3e-list-item-font-size, ${DesignToken.typescale.standard.body.large.fontSize}); font-weight: var(--m3e-list-item-font-weight, ${DesignToken.typescale.standard.body.large.fontWeight}); line-height: var(--m3e-list-item-line-height, ${DesignToken.typescale.standard.body.large.lineHeight}); letter-spacing: var(--m3e-list-item-tracking, ${DesignToken.typescale.standard.body.large.tracking}); } :host(.-has-leading) slot[name="leading"], :host(.-has-trailing) slot[name="trailing"] { display: flex; justify-content: center; } :host(:not(.-has-leading)) slot[name="leading"] { display: var(--_list-item-leading-reserved-display, contents); } :host(:not(.-has-trailing)) slot[name="trailing"] { display: var(--_list-item-trailing-reserved-display, contents); } slot[name="leading"] { min-width: var(--_list-item-leading-reserved-space, 0px); margin-inline-start: calc(0px - var(--_list-item-leading-reserved-outset, 0px)); } slot[name="trailing"] { min-width: var(--_list-item-trailing-reserved-space, 0px); margin-inline-end: calc(0px - var(--_list-item-trailing-reserved-outset, 0px)); } ::slotted(span[slot="trailing"]), ::slotted([slot="trailing-supporting-text"]) { white-space: nowrap; font-size: var(--m3e-list-item-trailing-text-font-size, ${DesignToken.typescale.standard.label.small.fontSize}); font-weight: var( --m3e-list-item-trailing-text-font-weight, ${DesignToken.typescale.standard.label.small.fontWeight} ); line-height: var( --m3e-list-item-trailing-text-line-height, ${DesignToken.typescale.standard.label.small.lineHeight} ); letter-spacing: var( --m3e-list-item-trailing-text-tracking, ${DesignToken.typescale.standard.label.small.tracking} ); } ::slotted(video[slot="leading"]), ::slotted(video[slot="trailing"]), ::slotted(img[slot="leading"]), ::slotted(img[slot="trailing"]) { display: block; margin: 0 auto; overflow: hidden; object-fit: cover; } ::slotted(video) { width: var(--m3e-list-item-video-width, 6.25rem); height: var(--m3e-list-item-video-height, 3.5rem); } ::slotted(video[slot="leading"]), ::slotted(video[slot="trailing"]) { border-radius: var(--m3e-list-item-video-shape, ${DesignToken.shape.corner.none}); } ::slotted(video[slot="leading"]) { margin-inline-start: calc(0px - var(--_list-item-leading-video-outset, 0px)); } ::slotted(video[slot="trailing"]) { margin-inline-end: calc(0px - var(--_list-item-trailing-video-outset, 0px)); } ::slotted(img) { user-drag: none; user-select: none; pointer-events: none; width: var(--m3e-list-item-image-width, 3.5rem); height: var(--m3e-list-item-image-height, 3.5rem); } ::slotted(img[slot="leading"]), ::slotted(img[slot="trailing"]) { border-radius: var(--m3e-list-item-image-shape, ${DesignToken.shape.corner.none}); } ::slotted(m3e-icon[slot="leading"]), ::slotted(m3e-icon[slot="leading-icon"]), ::slotted(m3e-icon[slot="trailing"]), ::slotted(m3e-icon[slot="trailing-icon"]) { --m3e-icon-size: var(--m3e-list-item-icon-size, 1.5rem); } :host(:not(:disabled)) ::slotted(m3e-icon[slot="leading"]), :host(:not(:disabled)) ::slotted(m3e-icon[slot="leading-icon"]) { color: var(--m3e-list-item-leading-color, ${DesignToken.color.onSurfaceVariant}); } :host(:not(:disabled)) .base { color: var(--m3e-list-item-label-text-color, ${DesignToken.color.onSurface}); } :host(:not(:disabled)) ::slotted([slot="overline"]) { color: var(--m3e-list-item-overline-color, ${DesignToken.color.onSurfaceVariant}); } :host(:not(:disabled)) ::slotted([slot="supporting-text"]) { color: var(--m3e-list-item-supporting-text-color, ${DesignToken.color.onSurfaceVariant}); } :host(:not(:disabled)) ::slotted([slot="trailing"]), :host(:not(:disabled)) ::slotted([slot="trailing-supporting-text"]), :host(:not(:disabled)) ::slotted([slot="trailing-icon"]) { color: var(--m3e-list-item-trailing-color, ${DesignToken.color.onSurfaceVariant}); } :host(:not(:disabled)) { background-color: var(--_list-item-container-color, var(--m3e-list-item-container-color, transparent)); } :host(:disabled) { background-color: var(--m3e-list-item-disabled-container-color, transparent); } :host(:disabled) ::slotted(video), :host(:disabled) ::slotted(img), :host(:disabled) ::slotted(m3e-avatar) { opacity: var(--m3e-list-item-disabled-media-opacity, 38%); } :host(:disabled) .base { color: color-mix( in srgb, var(--m3e-list-item-disabled-label-text-color, ${DesignToken.color.onSurface}) var(--m3e-list-item-disabled-label-text-opacity, 38%), transparent ); } :host(:disabled) ::slotted([slot="overline"]) { color: color-mix( in srgb, var(--m3e-list-item-disabled-overline-color, ${DesignToken.color.onSurface}) var(--m3e-list-item-disabled-overline-opacity, 38%), transparent ); } :host(:disabled) ::slotted([slot="supporting-text"]) { color: color-mix( in srgb, var(--m3e-list-item-disabled-supporting-text-color, ${DesignToken.color.onSurface}) var(--m3e-list-item-disabled-supporting-text-opacity, 38%), transparent ); } :host(:disabled) ::slotted([slot="leading"]), :host(:disabled) ::slotted([slot="leading-icon"]) { color: color-mix( in srgb, var(--m3e-list-item-disabled-leading-color, ${DesignToken.color.onSurface}) var(--m3e-list-item-disabled-leading-opacity, 38%), transparent ); } :host(:disabled) ::slotted([slot="trailing"]), :host(:disabled) ::slotted([slot="trailing-supporting-text"]), :host(:disabled) ::slotted([slot="trailing-icon"]) { color: color-mix( in srgb, var(--m3e-list-item-disabled-trailing-color, ${DesignToken.color.onSurface}) var(--m3e-list-item-disabled-trailing-opacity, 38%), transparent ); } :host(:not(:disabled)) .state-layer { --m3e-state-layer-hover-color: var(--m3e-list-item-hover-state-layer-color, ${DesignToken.color.onSurface}); --m3e-state-layer-hover-opacity: var( --m3e-list-item-hover-state-layer-opacity, ${DesignToken.state.hoverStateLayerOpacity} ); --m3e-state-layer-focus-color: var(--m3e-list-item-focus-state-layer-color, ${DesignToken.color.onSurface}); --m3e-state-layer-focus-opacity: var( --m3e-list-item-focus-state-layer-opacity, ${DesignToken.state.focusStateLayerOpacity} ); } :host(:not(:disabled)) .ripple { --m3e-ripple-color: var(--m3e-list-item-pressed-state-layer-color, ${DesignToken.color.onSurface}); --m3e-ripple-opacity: var( --m3e-list-item-pressed-state-layer-opacity, ${DesignToken.state.pressedStateLayerOpacity} ); } @media (forced-colors: active) { :host(:disabled) ::slotted([slot="leading"]), :host(:disabled) ::slotted([slot="leading-icon"]), :host(:disabled) .base, :host(:disabled) ::slotted([slot="overline"]), :host(:disabled) ::slotted([slot="supporting-text"]), :host(:disabled) ::slotted([slot="trailing"]), :host(:disabled) ::slotted([slot="trailing-supporting-text"]), :host(:disabled) ::slotted([slot="trailing-icon"]) { color: GrayText; } } @media (prefers-reduced-motion) { :host { transition: none; } }`;
|
|
604
|
+
M3eListItemElement = __decorate([t$2("m3e-list-item")], M3eListItemElement);
|
|
403
605
|
|
|
606
|
+
var _M3eListElement_instances, _M3eListElement_items, _M3eListElement_leadingContentTypes, _M3eListElement_trailingContentTypes, _M3eListElement_handleSlotChange;
|
|
404
607
|
/**
|
|
405
|
-
*
|
|
608
|
+
* A list of items.
|
|
406
609
|
*
|
|
407
610
|
* @description
|
|
408
|
-
* The `m3e-list
|
|
409
|
-
*
|
|
410
|
-
* via
|
|
411
|
-
* is designed for accessibility and flexible layout.
|
|
611
|
+
* The `m3e-list` component provides a list container for organizing and displaying
|
|
612
|
+
* multiple list items. It supports flexible layout, custom padding, and divider insets
|
|
613
|
+
* via CSS custom properties.
|
|
412
614
|
*
|
|
413
615
|
* @example
|
|
414
616
|
* The following example illustrates a list with a single item using all supported slots.
|
|
@@ -423,22 +625,189 @@ M3eListElement = __decorate([t$1("m3e-list")], M3eListElement);
|
|
|
423
625
|
* <span slot="overline">Overline</span>
|
|
424
626
|
* Headline
|
|
425
627
|
* <span slot="supporting-text">Supporting text</span>
|
|
426
|
-
* <span slot="trailing-
|
|
628
|
+
* <span slot="trailing-text">100+</span>
|
|
427
629
|
* <m3e-icon slot="trailing-icon" name="arrow_right"></m3e-icon>
|
|
428
630
|
* </m3e-list-item>
|
|
429
631
|
* </m3e-list>
|
|
430
632
|
* ```
|
|
431
633
|
*
|
|
432
|
-
* @tag m3e-list
|
|
634
|
+
* @tag m3e-list
|
|
635
|
+
*
|
|
636
|
+
* @slot - Renders the items of the list.
|
|
637
|
+
*
|
|
638
|
+
* @attr variant - The appearance variant of the list.
|
|
639
|
+
*
|
|
640
|
+
* @cssprop --m3e-list-divider-inset-start-size - Start inset for dividers within the list.
|
|
641
|
+
* @cssprop --m3e-list-divider-inset-end-size - End inset for dividers within the list.
|
|
642
|
+
* @cssprop --m3e-segmented-list-segment-gap - Gap between list items in segmented variant.
|
|
643
|
+
* @cssprop --m3e-segmented-list-container-shape - Border radius of the segmented list container.
|
|
644
|
+
* @cssprop --m3e-segmented-list-item-container-color - Background color of items in segmented variant.
|
|
645
|
+
* @cssprop --m3e-segmented-list-item-disabled-container-color - Background color of disabled items in segmented variant.
|
|
646
|
+
* @cssprop --m3e-segmented-list-item-container-shape - Border radius of items in segmented variant.
|
|
647
|
+
* @cssprop --m3e-segmented-list-item-hover-container-shape - Border radius of items in segmented variant on hover.
|
|
648
|
+
* @cssprop --m3e-segmented-list-item-focus-container-shape - Border radius of items in segmented variant on focus.
|
|
649
|
+
* @cssprop --m3e-segmented-list-item-selected-container-shape - Border radius of items in segmented variant when selected.
|
|
650
|
+
*/
|
|
651
|
+
let M3eListElement = class M3eListElement extends Role(LitElement, "list") {
|
|
652
|
+
constructor() {
|
|
653
|
+
super(...arguments);
|
|
654
|
+
_M3eListElement_instances.add(this);
|
|
655
|
+
/** @private */
|
|
656
|
+
_M3eListElement_items.set(this, new Array());
|
|
657
|
+
/** @private */
|
|
658
|
+
_M3eListElement_leadingContentTypes.set(this, {
|
|
659
|
+
video: 0,
|
|
660
|
+
image: 0,
|
|
661
|
+
avatar: 0,
|
|
662
|
+
icon: 0,
|
|
663
|
+
text: 0
|
|
664
|
+
});
|
|
665
|
+
/** @private */
|
|
666
|
+
_M3eListElement_trailingContentTypes.set(this, {
|
|
667
|
+
video: 0,
|
|
668
|
+
image: 0,
|
|
669
|
+
avatar: 0,
|
|
670
|
+
icon: 0,
|
|
671
|
+
text: 0
|
|
672
|
+
});
|
|
673
|
+
/**
|
|
674
|
+
* The appearance variant of the list.
|
|
675
|
+
* @default "standard"
|
|
676
|
+
*/
|
|
677
|
+
this.variant = "standard";
|
|
678
|
+
}
|
|
679
|
+
/** The items of the list. */
|
|
680
|
+
get items() {
|
|
681
|
+
return __classPrivateFieldGet(this, _M3eListElement_items, "f");
|
|
682
|
+
}
|
|
683
|
+
/** The type of leading content. */
|
|
684
|
+
get leadingContentType() {
|
|
685
|
+
return __classPrivateFieldGet(this, _M3eListElement_leadingContentTypes, "f").video > 0 ? "video" : __classPrivateFieldGet(this, _M3eListElement_leadingContentTypes, "f").image > 0 ? "image" : __classPrivateFieldGet(this, _M3eListElement_leadingContentTypes, "f").avatar > 0 ? "avatar" : __classPrivateFieldGet(this, _M3eListElement_leadingContentTypes, "f").icon > 0 ? "icon" : __classPrivateFieldGet(this, _M3eListElement_leadingContentTypes, "f").text > 0 ? "text" : undefined;
|
|
686
|
+
}
|
|
687
|
+
/** The type of trailing content. */
|
|
688
|
+
get trailingContentType() {
|
|
689
|
+
return __classPrivateFieldGet(this, _M3eListElement_trailingContentTypes, "f").video > 0 ? "video" : __classPrivateFieldGet(this, _M3eListElement_trailingContentTypes, "f").image > 0 ? "image" : __classPrivateFieldGet(this, _M3eListElement_trailingContentTypes, "f").avatar > 0 ? "avatar" : __classPrivateFieldGet(this, _M3eListElement_trailingContentTypes, "f").icon > 0 ? "icon" : __classPrivateFieldGet(this, _M3eListElement_trailingContentTypes, "f").text > 0 ? "text" : undefined;
|
|
690
|
+
}
|
|
691
|
+
/** @inheritdoc */
|
|
692
|
+
render() {
|
|
693
|
+
return html`<slot @slotchange="${__classPrivateFieldGet(this, _M3eListElement_instances, "m", _M3eListElement_handleSlotChange)}"></slot>`;
|
|
694
|
+
}
|
|
695
|
+
/**
|
|
696
|
+
* @internal
|
|
697
|
+
* Notifies the list that items have changed.
|
|
698
|
+
*/
|
|
699
|
+
notifyItemsChange() {}
|
|
700
|
+
/**
|
|
701
|
+
* @internal
|
|
702
|
+
* Notifies the list that the leading content of an item has changed.
|
|
703
|
+
*/
|
|
704
|
+
notifyLeadingContentTypeChange(oldType, newType) {
|
|
705
|
+
if (oldType) {
|
|
706
|
+
__classPrivateFieldGet(this, _M3eListElement_leadingContentTypes, "f")[oldType]--;
|
|
707
|
+
}
|
|
708
|
+
if (newType) {
|
|
709
|
+
__classPrivateFieldGet(this, _M3eListElement_leadingContentTypes, "f")[newType]++;
|
|
710
|
+
}
|
|
711
|
+
["video", "image", "avatar", "icon"].forEach(x => {
|
|
712
|
+
this.classList.toggle(`-has-leading-${x}`, this.leadingContentType === x);
|
|
713
|
+
});
|
|
714
|
+
}
|
|
715
|
+
/**
|
|
716
|
+
* @internal
|
|
717
|
+
* Notifies the list that the trailing content of an item has changed.
|
|
718
|
+
*/
|
|
719
|
+
notifyTrailingContentTypeChange(oldType, newType) {
|
|
720
|
+
if (oldType) {
|
|
721
|
+
__classPrivateFieldGet(this, _M3eListElement_trailingContentTypes, "f")[oldType]--;
|
|
722
|
+
}
|
|
723
|
+
if (newType) {
|
|
724
|
+
__classPrivateFieldGet(this, _M3eListElement_trailingContentTypes, "f")[newType]--;
|
|
725
|
+
}
|
|
726
|
+
["video", "image", "avatar", "icon"].forEach(x => {
|
|
727
|
+
this.classList.toggle(`-has-trailing-${x}`, this.trailingContentType === x);
|
|
728
|
+
});
|
|
729
|
+
}
|
|
730
|
+
};
|
|
731
|
+
_M3eListElement_items = new WeakMap();
|
|
732
|
+
_M3eListElement_leadingContentTypes = new WeakMap();
|
|
733
|
+
_M3eListElement_trailingContentTypes = new WeakMap();
|
|
734
|
+
_M3eListElement_instances = new WeakSet();
|
|
735
|
+
_M3eListElement_handleSlotChange = function _M3eListElement_handleSlotChange(e) {
|
|
736
|
+
__classPrivateFieldSet(this, _M3eListElement_items, e.target.assignedElements({
|
|
737
|
+
flatten: true
|
|
738
|
+
}).filter(x => x instanceof M3eListItemElement), "f");
|
|
739
|
+
__classPrivateFieldGet(this, _M3eListElement_items, "f").forEach((x, i) => {
|
|
740
|
+
x.classList.toggle("-first", i === 0);
|
|
741
|
+
x.classList.toggle("-last", i === __classPrivateFieldGet(this, _M3eListElement_items, "f").length - 1);
|
|
742
|
+
});
|
|
743
|
+
this.notifyItemsChange();
|
|
744
|
+
};
|
|
745
|
+
/** The styles of the element. */
|
|
746
|
+
M3eListElement.styles = css`:host { display: flex; flex-direction: column; overflow-y: auto; box-sizing: border-box; padding-block: var(--m3e-list-block-padding, 0px); --m3e-divider-inset-start-size: var(--m3e-list-divider-inset-start-size, 1rem); --m3e-divider-inset-end-size: var(--m3e-list-divider-inset-end-size, 1.5rem); } :host([variant="standard"]) { --_list-item-leading-video-outset: var(--m3e-list-item-leading-space, 1rem); --_list-item-trailing-video-outset: var(--m3e-list-item-trailing-space, 1rem); --_expandable-list-item-expanded-toggle-icon-container-color: transparent; } :host([variant="segmented"]) { row-gap: var(--m3e-segmented-list-segment-gap, 0.125rem); } :host([variant="segmented"]) { --m3e-list-item-container-color: var(--m3e-segmented-list-item-container-color, ${DesignToken.color.surface}); --m3e-list-item-disabled-container-color: var( --m3e-segmented-list-item-disabled-container-color, ${DesignToken.color.surface} ); --m3e-list-item-container-shape: var( --m3e-segmented-list-item-container-shape, ${DesignToken.shape.corner.extraSmall} ); --m3e-list-item-hover-container-shape: var( --m3e-segmented-list-item-hover-container-shape, ${DesignToken.shape.corner.medium} ); --m3e-list-item-focus-container-shape: var( --m3e-segmented-list-item-focus-container-shape, ${DesignToken.shape.corner.large} ); --m3e-list-item-selected-container-shape: var( --m3e-segmented-list-item-selected-container-shape, ${DesignToken.shape.corner.large} ); --m3e-list-item-video-shape: var(--m3e-segmented-list-item-video-shape, ${DesignToken.shape.corner.small}); --m3e-list-item-image-shape: var(--m3e-segmented-list-item-image-shape, ${DesignToken.shape.corner.small}); --m3e-list-item-between-space: var(--m3e-segmented-list-item-spacing, 0.75rem); --_expandable-list-item-items-segment-gap: var(--m3e-segmented-list-segment-gap, 0.125rem); --_expandable-list-item-expanded-top-shape: var( --m3e-segmented-list-container-shape, ${DesignToken.shape.corner.large} ); } :host([variant="segmented"]) ::slotted(.-first), :host([variant="segmented"]) ::slotted(.-last.-has-previous-open:not([open])) { --_list-item-top-container-shape: var(--m3e-segmented-list-container-shape, ${DesignToken.shape.corner.large}); } :host([variant="segmented"]) ::slotted(.-first.-has-next-open:not([open])), :host([variant="segmented"]) ::slotted(.-last) { --_list-item-bottom-container-shape: var(--m3e-segmented-list-container-shape, ${DesignToken.shape.corner.large}); } :host([variant="segmented"]) ::slotted(m3e-divider) { display: none; } :host(.-has-leading-video) { --_list-item-leading-reserved-display: block; --_list-item-leading-reserved-space: var(--m3e-list-item-video-width, 6.25rem); } :host([variant="standard"].-has-leading-video) { --_list-item-leading-reserved-outset: var(--m3e-list-item-leading-space, 1rem); --_list-item-trailing-reserved-outset: var(--m3e-list-item-trailing-space, 1rem); } :host(.-has-leading-image) { --_list-item-leading-reserved-display: block; --_list-item-leading-reserved-space: var(--m3e-list-item-image-width, 3.5rem); } :host(.-has-leading-avatar) { --_list-item-leading-reserved-display: block; --_list-item-leading-reserved-space: var(--m3e-avatar-size, 2.5rem); } :host(.-has-leading-icon) { --_list-item-leading-reserved-display: block; --_list-item-leading-reserved-space: var(--m3e-list-item-icon-size, 1.5rem); }`;
|
|
747
|
+
__decorate([n$1({
|
|
748
|
+
reflect: true
|
|
749
|
+
})], M3eListElement.prototype, "variant", void 0);
|
|
750
|
+
M3eListElement = __decorate([t$2("m3e-list")], M3eListElement);
|
|
751
|
+
|
|
752
|
+
var _M3eExpandableListItem_instances, _M3eExpandableListItem_id, _M3eExpandableListItem_contentId, _M3eExpandableListItem_headerId, _M3eExpandableListItem_items, _M3eExpandableListItem_handleHeaderClick, _M3eExpandableListItem_handleCollapsibleEvent, _M3eExpandableListItem_handleSlotChange;
|
|
753
|
+
var M3eExpandableListItem_1;
|
|
754
|
+
/**
|
|
755
|
+
* An item in a list that can be expanded to show more items.
|
|
756
|
+
*
|
|
757
|
+
* @description
|
|
758
|
+
* The `m3e-expandable-list-item` provides a hierarchical navigation structure that allows
|
|
759
|
+
* users to expand and collapse content sections. It follows Material 3 design principles
|
|
760
|
+
* with smooth animations, semantic color tokens, and accessible interactions. The component
|
|
761
|
+
* extends the base `m3e-list-item` functionality with toggle state management and nested
|
|
762
|
+
* content support.
|
|
763
|
+
*
|
|
764
|
+
* @example
|
|
765
|
+
* The following example illustrates an expandable list item.
|
|
766
|
+
* ```html
|
|
767
|
+
* <m3e-action-list>
|
|
768
|
+
* <m3e-expandable-list-item>
|
|
769
|
+
* Pick up supplies
|
|
770
|
+
* <span slot="supporting-text">Due monday</span>
|
|
771
|
+
* <div slot="items">
|
|
772
|
+
* <m3e-list-action>
|
|
773
|
+
* Dry-erase board
|
|
774
|
+
* <span slot="supporting-text">$35.99</span>
|
|
775
|
+
* </m3e-list-action>
|
|
776
|
+
* <m3e-list-action>
|
|
777
|
+
* Markers
|
|
778
|
+
* <span slot="supporting-text">$8.99</span>
|
|
779
|
+
* </m3e-list-action>
|
|
780
|
+
* </div>
|
|
781
|
+
* </m3e-expandable-list-item>
|
|
782
|
+
* </m3e-action-list>
|
|
783
|
+
* ```
|
|
784
|
+
*
|
|
785
|
+
* @tag m3e-expandable-list-item
|
|
433
786
|
*
|
|
434
787
|
* @slot - Renders the content of the list item.
|
|
435
|
-
* @slot leading
|
|
788
|
+
* @slot leading - Renders the leading content of the list item.
|
|
436
789
|
* @slot overline - Renders the overline of the list item.
|
|
437
790
|
* @slot supporting-text - Renders the supporting text of the list item.
|
|
438
|
-
* @slot
|
|
439
|
-
* @slot
|
|
791
|
+
* @slot toggle-icon - Renders a custom icon for the expand/collapse toggle.
|
|
792
|
+
* @slot items - Container for child list items displayed when expanded.
|
|
793
|
+
* @slot trailing - This component does not expose the base trailing slot.
|
|
440
794
|
*
|
|
441
|
-
* @
|
|
795
|
+
* @attr disabled - Whether the element is disabled.
|
|
796
|
+
* @attr open - Whether the item is expanded.
|
|
797
|
+
*
|
|
798
|
+
* @fires opening - Emitted when the item begins to open.
|
|
799
|
+
* @fires opened - Emitted when the item has opened.
|
|
800
|
+
* @fires closing - Emitted when the item begins to close.
|
|
801
|
+
* @fires closed - Emitted when the item has closed.
|
|
802
|
+
*
|
|
803
|
+
* @cssprop --m3e-expandable-list-item-toggle-icon-container-width - Width of the toggle icon container.
|
|
804
|
+
* @cssprop --m3e-expandable-list-item-toggle-icon-container-shape - Border radius of the toggle icon container.
|
|
805
|
+
* @cssprop --m3e-expandable-list-item-toggle-icon-size - Size of the toggle icon.
|
|
806
|
+
* @cssprop --m3e-expandable-list-item-expanded-toggle-icon-container-color - Background color of the toggle icon container when expanded.
|
|
807
|
+
* @cssprop --m3e-expandable-list-item-bounce-duration - Duration of the bounce animation when expanding.
|
|
808
|
+
* @cssprop --m3e-expandable-list-item-bounce-factor - Multiplication factor for the bounce effect.
|
|
809
|
+
* @cssprop --m3e-expandable-list-item-expand-duration - Duration of the expand/collapse animation.
|
|
810
|
+
* @cssprop --m3e-list-item-between-space - Horizontal gap between elements.
|
|
442
811
|
* @cssprop --m3e-list-item-padding-inline - Horizontal padding for the list item.
|
|
443
812
|
* @cssprop --m3e-list-item-padding-block - Vertical padding for the list item.
|
|
444
813
|
* @cssprop --m3e-list-item-height - Minimum height of the list item.
|
|
@@ -454,21 +823,990 @@ M3eListElement = __decorate([t$1("m3e-list")], M3eListElement);
|
|
|
454
823
|
* @cssprop --m3e-list-item-supporting-text-font-weight - Font weight for supporting text slot.
|
|
455
824
|
* @cssprop --m3e-list-item-supporting-text-line-height - Line height for supporting text slot.
|
|
456
825
|
* @cssprop --m3e-list-item-supporting-text-tracking - Letter spacing for supporting text slot.
|
|
457
|
-
* @cssprop --m3e-list-item-trailing-
|
|
458
|
-
* @cssprop --m3e-list-item-trailing-
|
|
459
|
-
* @cssprop --m3e-list-item-trailing-
|
|
460
|
-
* @cssprop --m3e-list-item-trailing-
|
|
826
|
+
* @cssprop --m3e-list-item-trailing-text-font-size - Font size for trailing supporting text slot.
|
|
827
|
+
* @cssprop --m3e-list-item-trailing-text-font-weight - Font weight for trailing supporting text slot.
|
|
828
|
+
* @cssprop --m3e-list-item-trailing-text-line-height - Line height for trailing supporting text slot.
|
|
829
|
+
* @cssprop --m3e-list-item-trailing-text-tracking - Letter spacing for trailing supporting text slot.
|
|
461
830
|
* @cssprop --m3e-list-item-icon-size - Size for leading/trailing icons.
|
|
831
|
+
* @cssprop --m3e-list-item-label-text-color - Color for the main content.
|
|
832
|
+
* @cssprop --m3e-list-item-overline-color - Color for the overline slot.
|
|
833
|
+
* @cssprop --m3e-list-item-supporting-text-color - Color for the supporting text slot.
|
|
834
|
+
* @cssprop --m3e-list-item-leading-color - Color for the leading content.
|
|
835
|
+
* @cssprop --m3e-list-item-trailing-color - Color for the trailing content.
|
|
836
|
+
* @cssprop --m3e-list-item-container-color - Background color of the list item.
|
|
837
|
+
* @cssprop --m3e-list-item-container-shape - Border radius of the list item.
|
|
838
|
+
* @cssprop --m3e-list-item-hover-container-shape - Border radius of the list item on hover.
|
|
839
|
+
* @cssprop --m3e-list-item-focus-container-shape - Border radius of the list item on focus.
|
|
840
|
+
* @cssprop --m3e-list-item-video-width - Width of the video slot.
|
|
841
|
+
* @cssprop --m3e-list-item-video-height - Height of the video slot.
|
|
842
|
+
* @cssprop --m3e-list-item-video-shape - Border radius of the video slot.
|
|
843
|
+
* @cssprop --m3e-list-item-image-width - Width of the image slot.
|
|
844
|
+
* @cssprop --m3e-list-item-image-height - Height of the image slot.
|
|
845
|
+
* @cssprop --m3e-list-item-image-shape - Border radius of the image slot.
|
|
846
|
+
* @cssprop --m3e-list-item-disabled-label-text-color - Color for the main content when disabled.
|
|
847
|
+
* @cssprop --m3e-list-item-disabled-label-text-opacity - Opacity for the main content when disabled.
|
|
848
|
+
* @cssprop --m3e-list-item-disabled-overline-color - Color for the overline slot when disabled.
|
|
849
|
+
* @cssprop --m3e-list-item-disabled-overline-opacity - Opacity for the overline slot when disabled.
|
|
850
|
+
* @cssprop --m3e-list-item-disabled-supporting-text-color - Color for the supporting text slot when disabled.
|
|
851
|
+
* @cssprop --m3e-list-item-disabled-supporting-text-opacity - Opacity for the supporting text slot when disabled.
|
|
852
|
+
* @cssprop --m3e-list-item-disabled-leading-color - Color for the leading icon when disabled.
|
|
853
|
+
* @cssprop --m3e-list-item-disabled-leading-opacity - Opacity for the leading icon when disabled.
|
|
854
|
+
* @cssprop --m3e-list-item-disabled-trailing-color - Color for the trailing icon when disabled.
|
|
855
|
+
* @cssprop --m3e-list-item-disabled-trailing-opacity - Opacity for the trailing icon when disabled.
|
|
856
|
+
* @cssprop --m3e-list-item-hover-state-layer-color - Color for the hover state layer.
|
|
857
|
+
* @cssprop --m3e-list-item-hover-state-layer-opacity - Opacity for the hover state layer.
|
|
858
|
+
* @cssprop --m3e-list-item-focus-state-layer-color - Color for the focus state layer.
|
|
859
|
+
* @cssprop --m3e-list-item-focus-state-layer-opacity - Opacity for the focus state layer.
|
|
860
|
+
* @cssprop --m3e-list-item-pressed-state-layer-color - Color for the pressed state layer.
|
|
861
|
+
* @cssprop --m3e-list-item-pressed-state-layer-opacity - Opacity for the pressed state layer.
|
|
862
|
+
* @cssprop --m3e-segmented-list-container-shape - Border radius of the segmented list container shape.
|
|
863
|
+
* @cssprop --m3e-segmented-list-segment-gap - Gap between list item segments.
|
|
864
|
+
* @cssprop --m3e-list-item-three-line-top-offset - Top offset for media in three line items.
|
|
865
|
+
* @cssprop --m3e-list-item-disabled-media-opacity - Opacity for media when disabled.
|
|
462
866
|
*/
|
|
463
|
-
let
|
|
867
|
+
let M3eExpandableListItem = M3eExpandableListItem_1 = class M3eExpandableListItem extends M3eListItemElement {
|
|
868
|
+
constructor() {
|
|
869
|
+
super(...arguments);
|
|
870
|
+
_M3eExpandableListItem_instances.add(this);
|
|
871
|
+
/** @private */
|
|
872
|
+
_M3eExpandableListItem_id.set(this, M3eExpandableListItem_1.__nextId++);
|
|
873
|
+
/** @private */
|
|
874
|
+
_M3eExpandableListItem_contentId.set(this, `m3e-expandable-list-item-${__classPrivateFieldGet(this, _M3eExpandableListItem_id, "f")}-content`);
|
|
875
|
+
/** @private */
|
|
876
|
+
_M3eExpandableListItem_headerId.set(this, `m3e-expandable-list-item-${__classPrivateFieldGet(this, _M3eExpandableListItem_id, "f")}-header`);
|
|
877
|
+
/** @private */
|
|
878
|
+
_M3eExpandableListItem_items.set(this, new Array());
|
|
879
|
+
/**
|
|
880
|
+
* Whether the element is disabled.
|
|
881
|
+
* @default false
|
|
882
|
+
*/
|
|
883
|
+
this.disabled = false;
|
|
884
|
+
/**
|
|
885
|
+
* Whether the item is expanded.
|
|
886
|
+
* @default false
|
|
887
|
+
*/
|
|
888
|
+
this.open = false;
|
|
889
|
+
}
|
|
890
|
+
/** The direct child items of this item. */
|
|
891
|
+
get items() {
|
|
892
|
+
return __classPrivateFieldGet(this, _M3eExpandableListItem_items, "f");
|
|
893
|
+
}
|
|
894
|
+
/** @inheritdoc */
|
|
895
|
+
updated(_changedProperties) {
|
|
896
|
+
super.updated(_changedProperties);
|
|
897
|
+
if (_changedProperties.has("open")) {
|
|
898
|
+
for (let sibling = this.previousElementSibling; sibling; sibling = sibling.previousElementSibling) {
|
|
899
|
+
if (sibling instanceof M3eListItemElement) {
|
|
900
|
+
sibling.classList.toggle("-has-next-open", this.open);
|
|
901
|
+
break;
|
|
902
|
+
}
|
|
903
|
+
}
|
|
904
|
+
for (let sibling = this.nextElementSibling; sibling; sibling = sibling.nextElementSibling) {
|
|
905
|
+
if (sibling instanceof M3eListItemElement) {
|
|
906
|
+
sibling.classList.toggle("-has-previous-open", this.open);
|
|
907
|
+
break;
|
|
908
|
+
}
|
|
909
|
+
}
|
|
910
|
+
}
|
|
911
|
+
}
|
|
912
|
+
/** @inheritdoc */
|
|
913
|
+
render() {
|
|
914
|
+
return html`<m3e-list-item-button id="${__classPrivateFieldGet(this, _M3eExpandableListItem_headerId, "f")}" class="header" ?disabled="${this.disabled}" aria-expanded="${this.open}" aria-controls="${__classPrivateFieldGet(this, _M3eExpandableListItem_contentId, "f")}" @click="${__classPrivateFieldGet(this, _M3eExpandableListItem_instances, "m", _M3eExpandableListItem_handleHeaderClick)}"><slot name="leading" slot="leading" @slotchange="${this._handleLeadingSlotChange}"></slot><slot name="overline" slot="overline"></slot><slot></slot><slot name="supporting-text" slot="supporting-text"></slot><div class="toggle-container" slot="trailing" aria-hidden="true"><div class="toggle"><slot name="toggle-icon"><svg viewBox="0 -960 960 960" fill="currentColor"><path d="M480-344 240-584l56-56 184 184 184-184 56 56-240 240Z"/></svg></slot></div></div></m3e-list-item-button><m3e-collapsible id="${__classPrivateFieldGet(this, _M3eExpandableListItem_contentId, "f")}" class="items" role="list" aria-labelledby="${__classPrivateFieldGet(this, _M3eExpandableListItem_headerId, "f")}" aria-hidden="${!this.open}" ?open="${this.open}" @opening="${__classPrivateFieldGet(this, _M3eExpandableListItem_instances, "m", _M3eExpandableListItem_handleCollapsibleEvent)}" @opened="${__classPrivateFieldGet(this, _M3eExpandableListItem_instances, "m", _M3eExpandableListItem_handleCollapsibleEvent)}" @closing="${__classPrivateFieldGet(this, _M3eExpandableListItem_instances, "m", _M3eExpandableListItem_handleCollapsibleEvent)}" @closed="${__classPrivateFieldGet(this, _M3eExpandableListItem_instances, "m", _M3eExpandableListItem_handleCollapsibleEvent)}"><slot name="items" @slotchange="${__classPrivateFieldGet(this, _M3eExpandableListItem_instances, "m", _M3eExpandableListItem_handleSlotChange)}"></slot></m3e-collapsible>`;
|
|
915
|
+
}
|
|
916
|
+
};
|
|
917
|
+
_M3eExpandableListItem_id = new WeakMap();
|
|
918
|
+
_M3eExpandableListItem_contentId = new WeakMap();
|
|
919
|
+
_M3eExpandableListItem_headerId = new WeakMap();
|
|
920
|
+
_M3eExpandableListItem_items = new WeakMap();
|
|
921
|
+
_M3eExpandableListItem_instances = new WeakSet();
|
|
922
|
+
_M3eExpandableListItem_handleHeaderClick = function _M3eExpandableListItem_handleHeaderClick(e) {
|
|
923
|
+
if (!e.defaultPrevented) {
|
|
924
|
+
this.open = !this.open;
|
|
925
|
+
this.closest("m3e-action-list")?.[selectionManager].updateActiveItem(this.button);
|
|
926
|
+
}
|
|
927
|
+
};
|
|
928
|
+
_M3eExpandableListItem_handleCollapsibleEvent = function _M3eExpandableListItem_handleCollapsibleEvent(e) {
|
|
929
|
+
e.stopPropagation();
|
|
930
|
+
["opening", "opened", "closing", "closed"].forEach(x => {
|
|
931
|
+
this.button?.classList.toggle(x, e.type === x);
|
|
932
|
+
});
|
|
933
|
+
this.dispatchEvent(new Event(e.type, {
|
|
934
|
+
bubbles: true
|
|
935
|
+
}));
|
|
936
|
+
};
|
|
937
|
+
_M3eExpandableListItem_handleSlotChange = function _M3eExpandableListItem_handleSlotChange(e) {
|
|
938
|
+
__classPrivateFieldSet(this, _M3eExpandableListItem_items, e.target.assignedElements({
|
|
939
|
+
flatten: true
|
|
940
|
+
}).flatMap(x => [...x.childNodes].filter(x => x instanceof M3eListItemElement)), "f");
|
|
941
|
+
__classPrivateFieldGet(this, _M3eExpandableListItem_items, "f").forEach((x, i) => {
|
|
942
|
+
if (i == __classPrivateFieldGet(this, _M3eExpandableListItem_items, "f").length - 1) {
|
|
943
|
+
x.style.setProperty("--_list-item-bottom-container-shape", `var(--m3e-segmented-list-container-shape, ${DesignToken.shape.corner.large})`);
|
|
944
|
+
} else {
|
|
945
|
+
x.style.removeProperty("--_list-item-bottom-container-shape");
|
|
946
|
+
}
|
|
947
|
+
});
|
|
948
|
+
this.closest("m3e-list, m3e-action-list, m3e-selection-list")?.notifyItemsChange();
|
|
949
|
+
};
|
|
950
|
+
/** The styles of the element. */
|
|
951
|
+
M3eExpandableListItem.styles = css`.header { width: 100%; margin-bottom: 0px; transition: ${unsafeCSS(`margin-bottom
|
|
952
|
+
var(--m3e-expandable-list-item-bounce-duration, ${DesignToken.motion.duration.medium1})
|
|
953
|
+
${DesignToken.motion.easing.standard}`)}; } .toggle-container { display: flex; align-items: center; justify-content: center; align-self: stretch; width: var(--m3e-expandable-list-item-toggle-icon-container-width, 2rem); border-radius: var(--m3e-expandable-list-item-toggle-icon-container-shape, ${DesignToken.shape.corner.full}); transition: ${unsafeCSS(`background-color ${DesignToken.motion.duration.short4} ${DesignToken.motion.easing.standard}`)}; } .toggle { display: flex; align-items: center; justify-content: center; vertical-align: middle; font-size: var(--m3e-expandable-list-item-toggle-icon-size, 1.5rem); transition: ${unsafeCSS(`transform ${DesignToken.motion.duration.short4} ${DesignToken.motion.easing.standard}`)}; } .toggle svg, ::slotted(svg[slot="toggle-icon"]) { width: 1em; height: 1em; } :host([open]) .toggle-container { background-color: var( --_expandable-list-item-expanded-toggle-icon-container-color, var(--m3e-expandable-list-item-expanded-toggle-icon-container-color, ${DesignToken.color.surfaceContainer}) ); } :host([open]) .toggle { transform: rotate(180deg); } :host([open]) .header { --_list-item-top-container-shape: var(--_expandable-list-item-expanded-top-shape, initial); --_list-item-bottom-container-shape: initial; margin-bottom: var(--_expandable-list-item-items-segment-gap, 0px); } :host([open]) .header.opening { margin-bottom: calc( var(--_expandable-list-item-items-segment-gap, 0px) * var(--m3e-expandable-list-item-bounce-factor, 4) ); } :host([open]) .header, :host([open]) .items { --_list-item-container-color: var( --m3e-expandable-list-item-expanded-container-color, var(--m3e-list-item-container-color, transparent) ); } :host, ::slotted([slot="items"]) { flex: none; display: flex; flex-direction: column; box-sizing: border-box; } ::slotted([slot="items"]) { --_list-item-top-container-shape: initial; --_list-item-bottom-container-shape: initial; row-gap: var(--_expandable-list-item-items-segment-gap, 0px); } .items { --m3e-collapsible-animation-duration: var( --m3e-expandable-list-item-expand-duration, ${DesignToken.motion.duration.medium1} ); } @media (forced-colors: active) { .header { transition: none; } :host([open]) .header.opening { margin-bottom: var(--_expandable-list-item-items-segment-gap, 0px); } } @media (prefers-reduced-motion) { .header, .toggle-container, .toggle { transition: none; } }`;
|
|
954
|
+
/** @private */
|
|
955
|
+
M3eExpandableListItem.__nextId = 0;
|
|
956
|
+
__decorate([n$1({
|
|
957
|
+
type: Boolean,
|
|
958
|
+
reflect: true
|
|
959
|
+
})], M3eExpandableListItem.prototype, "disabled", void 0);
|
|
960
|
+
__decorate([n$1({
|
|
961
|
+
type: Boolean,
|
|
962
|
+
reflect: true
|
|
963
|
+
})], M3eExpandableListItem.prototype, "open", void 0);
|
|
964
|
+
__decorate([e$1(".header")], M3eExpandableListItem.prototype, "button", void 0);
|
|
965
|
+
M3eExpandableListItem = M3eExpandableListItem_1 = __decorate([t$2("m3e-expandable-list-item")], M3eExpandableListItem);
|
|
966
|
+
|
|
967
|
+
var _M3eActionListElement_keyDownHandler, _a$1;
|
|
968
|
+
/**
|
|
969
|
+
* A list of actions.
|
|
970
|
+
*
|
|
971
|
+
* @description
|
|
972
|
+
* The `m3e-action-list` component provides a specialized list container for action-based
|
|
973
|
+
* interactions following Material 3 design principles. It manages keyboard navigation with
|
|
974
|
+
* roving tab index, supporting arrow keys, Home/End navigation, and vertical orientation.
|
|
975
|
+
* The component is optimized for scenarios where each list item represents a clickable action.
|
|
976
|
+
*
|
|
977
|
+
* @tag m3e-action-list
|
|
978
|
+
*
|
|
979
|
+
* @slot - Renders the items of the list.
|
|
980
|
+
*
|
|
981
|
+
* @attr variant - The appearance variant of the list.
|
|
982
|
+
*
|
|
983
|
+
* @cssprop --m3e-list-divider-inset-start-size - Start inset for dividers within the list.
|
|
984
|
+
* @cssprop --m3e-list-divider-inset-end-size - End inset for dividers within the list.
|
|
985
|
+
* @cssprop --m3e-segmented-list-segment-gap - Gap between list items in segmented variant.
|
|
986
|
+
* @cssprop --m3e-segmented-list-container-shape - Border radius of the segmented list container.
|
|
987
|
+
* @cssprop --m3e-segmented-list-item-container-color - Background color of items in segmented variant.
|
|
988
|
+
* @cssprop --m3e-segmented-list-item-disabled-container-color - Background color of disabled items in segmented variant.
|
|
989
|
+
* @cssprop --m3e-segmented-list-item-container-shape - Border radius of items in segmented variant.
|
|
990
|
+
* @cssprop --m3e-segmented-list-item-hover-container-shape - Border radius of items in segmented variant on hover.
|
|
991
|
+
* @cssprop --m3e-segmented-list-item-focus-container-shape - Border radius of items in segmented variant on focus.
|
|
992
|
+
* @cssprop --m3e-segmented-list-item-selected-container-shape - Border radius of items in segmented variant when selected.
|
|
993
|
+
*/
|
|
994
|
+
let M3eActionListElement = class M3eActionListElement extends M3eListElement {
|
|
995
|
+
constructor() {
|
|
996
|
+
super(...arguments);
|
|
997
|
+
/** @private */
|
|
998
|
+
_M3eActionListElement_keyDownHandler.set(this, e => this[selectionManager].onKeyDown(e));
|
|
999
|
+
/** @private */
|
|
1000
|
+
this[_a$1] = new RovingTabIndexManager().withWrap().withHomeAndEnd().withVerticalOrientation().withSkipPredicate(x => {
|
|
1001
|
+
if (x.disabled) return true;
|
|
1002
|
+
const listItem = x.getRootNode().host;
|
|
1003
|
+
if (listItem.parentElement?.slot === "items") {
|
|
1004
|
+
let expandable = listItem.closest("m3e-expandable-list-item");
|
|
1005
|
+
while (expandable) {
|
|
1006
|
+
if (!expandable.open) {
|
|
1007
|
+
return true;
|
|
1008
|
+
}
|
|
1009
|
+
const ancestor = expandable.closest("m3e-expandable-list-item,m3e-action-list");
|
|
1010
|
+
if (ancestor instanceof M3eExpandableListItem) {
|
|
1011
|
+
expandable = ancestor;
|
|
1012
|
+
}
|
|
1013
|
+
break;
|
|
1014
|
+
}
|
|
1015
|
+
}
|
|
1016
|
+
return false;
|
|
1017
|
+
});
|
|
1018
|
+
}
|
|
1019
|
+
/** @inheritdoc */
|
|
1020
|
+
connectedCallback() {
|
|
1021
|
+
super.connectedCallback();
|
|
1022
|
+
this.addEventListener("keydown", __classPrivateFieldGet(this, _M3eActionListElement_keyDownHandler, "f"));
|
|
1023
|
+
}
|
|
1024
|
+
/** @inheritdoc */
|
|
1025
|
+
disconnectedCallback() {
|
|
1026
|
+
super.disconnectedCallback();
|
|
1027
|
+
this.removeEventListener("keydown", __classPrivateFieldGet(this, _M3eActionListElement_keyDownHandler, "f"));
|
|
1028
|
+
}
|
|
1029
|
+
/** @inheritdoc */
|
|
1030
|
+
async notifyItemsChange() {
|
|
1031
|
+
const items = [...this.querySelectorAll("m3e-list-action,m3e-expandable-list-item")];
|
|
1032
|
+
for (const item of items) {
|
|
1033
|
+
if (item.isUpdatePending) {
|
|
1034
|
+
await item.updateComplete;
|
|
1035
|
+
}
|
|
1036
|
+
}
|
|
1037
|
+
if (this.isUpdatePending) {
|
|
1038
|
+
await this.updateComplete;
|
|
1039
|
+
}
|
|
1040
|
+
const {
|
|
1041
|
+
added
|
|
1042
|
+
} = this[selectionManager].setItems(items.map(x => x instanceof M3eExpandableListItem ? x.button : x.button));
|
|
1043
|
+
if (!this[selectionManager].activeItem) {
|
|
1044
|
+
this[selectionManager].updateActiveItem(added.find(x => !x.disabled));
|
|
1045
|
+
}
|
|
1046
|
+
}
|
|
1047
|
+
};
|
|
1048
|
+
_M3eActionListElement_keyDownHandler = new WeakMap();
|
|
1049
|
+
_a$1 = selectionManager;
|
|
1050
|
+
M3eActionListElement = __decorate([t$2("m3e-action-list")], M3eActionListElement);
|
|
1051
|
+
|
|
1052
|
+
/**
|
|
1053
|
+
* @license
|
|
1054
|
+
* Copyright 2017 Google LLC
|
|
1055
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
1056
|
+
*/
|
|
1057
|
+
const t = globalThis,
|
|
1058
|
+
i = t.trustedTypes,
|
|
1059
|
+
s = i ? i.createPolicy("lit-html", {
|
|
1060
|
+
createHTML: t => t
|
|
1061
|
+
}) : void 0,
|
|
1062
|
+
e = "$lit$",
|
|
1063
|
+
h = `lit$${Math.random().toFixed(9).slice(2)}$`,
|
|
1064
|
+
o$1 = "?" + h,
|
|
1065
|
+
n = `<${o$1}>`,
|
|
1066
|
+
r = document,
|
|
1067
|
+
l = () => r.createComment(""),
|
|
1068
|
+
c = t => null === t || "object" != typeof t && "function" != typeof t,
|
|
1069
|
+
a = Array.isArray,
|
|
1070
|
+
u = t => a(t) || "function" == typeof t?.[Symbol.iterator],
|
|
1071
|
+
d = "[ \t\n\f\r]",
|
|
1072
|
+
f = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,
|
|
1073
|
+
v = /-->/g,
|
|
1074
|
+
_ = />/g,
|
|
1075
|
+
m = RegExp(`>|${d}(?:([^\\s"'>=/]+)(${d}*=${d}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`, "g"),
|
|
1076
|
+
p = /'/g,
|
|
1077
|
+
g = /"/g,
|
|
1078
|
+
$ = /^(?:script|style|textarea|title)$/i,
|
|
1079
|
+
T = Symbol.for("lit-noChange"),
|
|
1080
|
+
E = Symbol.for("lit-nothing"),
|
|
1081
|
+
A = new WeakMap(),
|
|
1082
|
+
C = r.createTreeWalker(r, 129);
|
|
1083
|
+
function P(t, i) {
|
|
1084
|
+
if (!a(t) || !t.hasOwnProperty("raw")) throw Error("invalid template strings array");
|
|
1085
|
+
return void 0 !== s ? s.createHTML(i) : i;
|
|
1086
|
+
}
|
|
1087
|
+
const V = (t, i) => {
|
|
1088
|
+
const s = t.length - 1,
|
|
1089
|
+
o = [];
|
|
1090
|
+
let r,
|
|
1091
|
+
l = 2 === i ? "<svg>" : 3 === i ? "<math>" : "",
|
|
1092
|
+
c = f;
|
|
1093
|
+
for (let i = 0; i < s; i++) {
|
|
1094
|
+
const s = t[i];
|
|
1095
|
+
let a,
|
|
1096
|
+
u,
|
|
1097
|
+
d = -1,
|
|
1098
|
+
y = 0;
|
|
1099
|
+
for (; y < s.length && (c.lastIndex = y, u = c.exec(s), null !== u);) y = c.lastIndex, c === f ? "!--" === u[1] ? c = v : void 0 !== u[1] ? c = _ : void 0 !== u[2] ? ($.test(u[2]) && (r = RegExp("</" + u[2], "g")), c = m) : void 0 !== u[3] && (c = m) : c === m ? ">" === u[0] ? (c = r ?? f, d = -1) : void 0 === u[1] ? d = -2 : (d = c.lastIndex - u[2].length, a = u[1], c = void 0 === u[3] ? m : '"' === u[3] ? g : p) : c === g || c === p ? c = m : c === v || c === _ ? c = f : (c = m, r = void 0);
|
|
1100
|
+
const x = c === m && t[i + 1].startsWith("/>") ? " " : "";
|
|
1101
|
+
l += c === f ? s + n : d >= 0 ? (o.push(a), s.slice(0, d) + e + s.slice(d) + h + x) : s + h + (-2 === d ? i : x);
|
|
1102
|
+
}
|
|
1103
|
+
return [P(t, l + (t[s] || "<?>") + (2 === i ? "</svg>" : 3 === i ? "</math>" : "")), o];
|
|
1104
|
+
};
|
|
1105
|
+
class N {
|
|
1106
|
+
constructor({
|
|
1107
|
+
strings: t,
|
|
1108
|
+
_$litType$: s
|
|
1109
|
+
}, n) {
|
|
1110
|
+
let r;
|
|
1111
|
+
this.parts = [];
|
|
1112
|
+
let c = 0,
|
|
1113
|
+
a = 0;
|
|
1114
|
+
const u = t.length - 1,
|
|
1115
|
+
d = this.parts,
|
|
1116
|
+
[f, v] = V(t, s);
|
|
1117
|
+
if (this.el = N.createElement(f, n), C.currentNode = this.el.content, 2 === s || 3 === s) {
|
|
1118
|
+
const t = this.el.content.firstChild;
|
|
1119
|
+
t.replaceWith(...t.childNodes);
|
|
1120
|
+
}
|
|
1121
|
+
for (; null !== (r = C.nextNode()) && d.length < u;) {
|
|
1122
|
+
if (1 === r.nodeType) {
|
|
1123
|
+
if (r.hasAttributes()) for (const t of r.getAttributeNames()) if (t.endsWith(e)) {
|
|
1124
|
+
const i = v[a++],
|
|
1125
|
+
s = r.getAttribute(t).split(h),
|
|
1126
|
+
e = /([.?@])?(.*)/.exec(i);
|
|
1127
|
+
d.push({
|
|
1128
|
+
type: 1,
|
|
1129
|
+
index: c,
|
|
1130
|
+
name: e[2],
|
|
1131
|
+
strings: s,
|
|
1132
|
+
ctor: "." === e[1] ? H : "?" === e[1] ? I : "@" === e[1] ? L : k
|
|
1133
|
+
}), r.removeAttribute(t);
|
|
1134
|
+
} else t.startsWith(h) && (d.push({
|
|
1135
|
+
type: 6,
|
|
1136
|
+
index: c
|
|
1137
|
+
}), r.removeAttribute(t));
|
|
1138
|
+
if ($.test(r.tagName)) {
|
|
1139
|
+
const t = r.textContent.split(h),
|
|
1140
|
+
s = t.length - 1;
|
|
1141
|
+
if (s > 0) {
|
|
1142
|
+
r.textContent = i ? i.emptyScript : "";
|
|
1143
|
+
for (let i = 0; i < s; i++) r.append(t[i], l()), C.nextNode(), d.push({
|
|
1144
|
+
type: 2,
|
|
1145
|
+
index: ++c
|
|
1146
|
+
});
|
|
1147
|
+
r.append(t[s], l());
|
|
1148
|
+
}
|
|
1149
|
+
}
|
|
1150
|
+
} else if (8 === r.nodeType) if (r.data === o$1) d.push({
|
|
1151
|
+
type: 2,
|
|
1152
|
+
index: c
|
|
1153
|
+
});else {
|
|
1154
|
+
let t = -1;
|
|
1155
|
+
for (; -1 !== (t = r.data.indexOf(h, t + 1));) d.push({
|
|
1156
|
+
type: 7,
|
|
1157
|
+
index: c
|
|
1158
|
+
}), t += h.length - 1;
|
|
1159
|
+
}
|
|
1160
|
+
c++;
|
|
1161
|
+
}
|
|
1162
|
+
}
|
|
1163
|
+
static createElement(t, i) {
|
|
1164
|
+
const s = r.createElement("template");
|
|
1165
|
+
return s.innerHTML = t, s;
|
|
1166
|
+
}
|
|
1167
|
+
}
|
|
1168
|
+
function S(t, i, s = t, e) {
|
|
1169
|
+
if (i === T) return i;
|
|
1170
|
+
let h = void 0 !== e ? s._$Co?.[e] : s._$Cl;
|
|
1171
|
+
const o = c(i) ? void 0 : i._$litDirective$;
|
|
1172
|
+
return h?.constructor !== o && (h?._$AO?.(false), void 0 === o ? h = void 0 : (h = new o(t), h._$AT(t, s, e)), void 0 !== e ? (s._$Co ??= [])[e] = h : s._$Cl = h), void 0 !== h && (i = S(t, h._$AS(t, i.values), h, e)), i;
|
|
1173
|
+
}
|
|
1174
|
+
class M {
|
|
1175
|
+
constructor(t, i) {
|
|
1176
|
+
this._$AV = [], this._$AN = void 0, this._$AD = t, this._$AM = i;
|
|
1177
|
+
}
|
|
1178
|
+
get parentNode() {
|
|
1179
|
+
return this._$AM.parentNode;
|
|
1180
|
+
}
|
|
1181
|
+
get _$AU() {
|
|
1182
|
+
return this._$AM._$AU;
|
|
1183
|
+
}
|
|
1184
|
+
u(t) {
|
|
1185
|
+
const {
|
|
1186
|
+
el: {
|
|
1187
|
+
content: i
|
|
1188
|
+
},
|
|
1189
|
+
parts: s
|
|
1190
|
+
} = this._$AD,
|
|
1191
|
+
e = (t?.creationScope ?? r).importNode(i, true);
|
|
1192
|
+
C.currentNode = e;
|
|
1193
|
+
let h = C.nextNode(),
|
|
1194
|
+
o = 0,
|
|
1195
|
+
n = 0,
|
|
1196
|
+
l = s[0];
|
|
1197
|
+
for (; void 0 !== l;) {
|
|
1198
|
+
if (o === l.index) {
|
|
1199
|
+
let i;
|
|
1200
|
+
2 === l.type ? i = new R(h, h.nextSibling, this, t) : 1 === l.type ? i = new l.ctor(h, l.name, l.strings, this, t) : 6 === l.type && (i = new z(h, this, t)), this._$AV.push(i), l = s[++n];
|
|
1201
|
+
}
|
|
1202
|
+
o !== l?.index && (h = C.nextNode(), o++);
|
|
1203
|
+
}
|
|
1204
|
+
return C.currentNode = r, e;
|
|
1205
|
+
}
|
|
1206
|
+
p(t) {
|
|
1207
|
+
let i = 0;
|
|
1208
|
+
for (const s of this._$AV) void 0 !== s && (void 0 !== s.strings ? (s._$AI(t, s, i), i += s.strings.length - 2) : s._$AI(t[i])), i++;
|
|
1209
|
+
}
|
|
1210
|
+
}
|
|
1211
|
+
class R {
|
|
1212
|
+
get _$AU() {
|
|
1213
|
+
return this._$AM?._$AU ?? this._$Cv;
|
|
1214
|
+
}
|
|
1215
|
+
constructor(t, i, s, e) {
|
|
1216
|
+
this.type = 2, this._$AH = E, this._$AN = void 0, this._$AA = t, this._$AB = i, this._$AM = s, this.options = e, this._$Cv = e?.isConnected ?? true;
|
|
1217
|
+
}
|
|
1218
|
+
get parentNode() {
|
|
1219
|
+
let t = this._$AA.parentNode;
|
|
1220
|
+
const i = this._$AM;
|
|
1221
|
+
return void 0 !== i && 11 === t?.nodeType && (t = i.parentNode), t;
|
|
1222
|
+
}
|
|
1223
|
+
get startNode() {
|
|
1224
|
+
return this._$AA;
|
|
1225
|
+
}
|
|
1226
|
+
get endNode() {
|
|
1227
|
+
return this._$AB;
|
|
1228
|
+
}
|
|
1229
|
+
_$AI(t, i = this) {
|
|
1230
|
+
t = S(this, t, i), c(t) ? t === E || null == t || "" === t ? (this._$AH !== E && this._$AR(), this._$AH = E) : t !== this._$AH && t !== T && this._(t) : void 0 !== t._$litType$ ? this.$(t) : void 0 !== t.nodeType ? this.T(t) : u(t) ? this.k(t) : this._(t);
|
|
1231
|
+
}
|
|
1232
|
+
O(t) {
|
|
1233
|
+
return this._$AA.parentNode.insertBefore(t, this._$AB);
|
|
1234
|
+
}
|
|
1235
|
+
T(t) {
|
|
1236
|
+
this._$AH !== t && (this._$AR(), this._$AH = this.O(t));
|
|
1237
|
+
}
|
|
1238
|
+
_(t) {
|
|
1239
|
+
this._$AH !== E && c(this._$AH) ? this._$AA.nextSibling.data = t : this.T(r.createTextNode(t)), this._$AH = t;
|
|
1240
|
+
}
|
|
1241
|
+
$(t) {
|
|
1242
|
+
const {
|
|
1243
|
+
values: i,
|
|
1244
|
+
_$litType$: s
|
|
1245
|
+
} = t,
|
|
1246
|
+
e = "number" == typeof s ? this._$AC(t) : (void 0 === s.el && (s.el = N.createElement(P(s.h, s.h[0]), this.options)), s);
|
|
1247
|
+
if (this._$AH?._$AD === e) this._$AH.p(i);else {
|
|
1248
|
+
const t = new M(e, this),
|
|
1249
|
+
s = t.u(this.options);
|
|
1250
|
+
t.p(i), this.T(s), this._$AH = t;
|
|
1251
|
+
}
|
|
1252
|
+
}
|
|
1253
|
+
_$AC(t) {
|
|
1254
|
+
let i = A.get(t.strings);
|
|
1255
|
+
return void 0 === i && A.set(t.strings, i = new N(t)), i;
|
|
1256
|
+
}
|
|
1257
|
+
k(t) {
|
|
1258
|
+
a(this._$AH) || (this._$AH = [], this._$AR());
|
|
1259
|
+
const i = this._$AH;
|
|
1260
|
+
let s,
|
|
1261
|
+
e = 0;
|
|
1262
|
+
for (const h of t) e === i.length ? i.push(s = new R(this.O(l()), this.O(l()), this, this.options)) : s = i[e], s._$AI(h), e++;
|
|
1263
|
+
e < i.length && (this._$AR(s && s._$AB.nextSibling, e), i.length = e);
|
|
1264
|
+
}
|
|
1265
|
+
_$AR(t = this._$AA.nextSibling, i) {
|
|
1266
|
+
for (this._$AP?.(false, true, i); t !== this._$AB;) {
|
|
1267
|
+
const i = t.nextSibling;
|
|
1268
|
+
t.remove(), t = i;
|
|
1269
|
+
}
|
|
1270
|
+
}
|
|
1271
|
+
setConnected(t) {
|
|
1272
|
+
void 0 === this._$AM && (this._$Cv = t, this._$AP?.(t));
|
|
1273
|
+
}
|
|
1274
|
+
}
|
|
1275
|
+
class k {
|
|
1276
|
+
get tagName() {
|
|
1277
|
+
return this.element.tagName;
|
|
1278
|
+
}
|
|
1279
|
+
get _$AU() {
|
|
1280
|
+
return this._$AM._$AU;
|
|
1281
|
+
}
|
|
1282
|
+
constructor(t, i, s, e, h) {
|
|
1283
|
+
this.type = 1, this._$AH = E, this._$AN = void 0, this.element = t, this.name = i, this._$AM = e, this.options = h, s.length > 2 || "" !== s[0] || "" !== s[1] ? (this._$AH = Array(s.length - 1).fill(new String()), this.strings = s) : this._$AH = E;
|
|
1284
|
+
}
|
|
1285
|
+
_$AI(t, i = this, s, e) {
|
|
1286
|
+
const h = this.strings;
|
|
1287
|
+
let o = false;
|
|
1288
|
+
if (void 0 === h) t = S(this, t, i, 0), o = !c(t) || t !== this._$AH && t !== T, o && (this._$AH = t);else {
|
|
1289
|
+
const e = t;
|
|
1290
|
+
let n, r;
|
|
1291
|
+
for (t = h[0], n = 0; n < h.length - 1; n++) r = S(this, e[s + n], i, n), r === T && (r = this._$AH[n]), o ||= !c(r) || r !== this._$AH[n], r === E ? t = E : t !== E && (t += (r ?? "") + h[n + 1]), this._$AH[n] = r;
|
|
1292
|
+
}
|
|
1293
|
+
o && !e && this.j(t);
|
|
1294
|
+
}
|
|
1295
|
+
j(t) {
|
|
1296
|
+
t === E ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, t ?? "");
|
|
1297
|
+
}
|
|
1298
|
+
}
|
|
1299
|
+
class H extends k {
|
|
1300
|
+
constructor() {
|
|
1301
|
+
super(...arguments), this.type = 3;
|
|
1302
|
+
}
|
|
1303
|
+
j(t) {
|
|
1304
|
+
this.element[this.name] = t === E ? void 0 : t;
|
|
1305
|
+
}
|
|
1306
|
+
}
|
|
1307
|
+
class I extends k {
|
|
1308
|
+
constructor() {
|
|
1309
|
+
super(...arguments), this.type = 4;
|
|
1310
|
+
}
|
|
1311
|
+
j(t) {
|
|
1312
|
+
this.element.toggleAttribute(this.name, !!t && t !== E);
|
|
1313
|
+
}
|
|
1314
|
+
}
|
|
1315
|
+
class L extends k {
|
|
1316
|
+
constructor(t, i, s, e, h) {
|
|
1317
|
+
super(t, i, s, e, h), this.type = 5;
|
|
1318
|
+
}
|
|
1319
|
+
_$AI(t, i = this) {
|
|
1320
|
+
if ((t = S(this, t, i, 0) ?? E) === T) return;
|
|
1321
|
+
const s = this._$AH,
|
|
1322
|
+
e = t === E && s !== E || t.capture !== s.capture || t.once !== s.once || t.passive !== s.passive,
|
|
1323
|
+
h = t !== E && (s === E || e);
|
|
1324
|
+
e && this.element.removeEventListener(this.name, this, s), h && this.element.addEventListener(this.name, this, t), this._$AH = t;
|
|
1325
|
+
}
|
|
1326
|
+
handleEvent(t) {
|
|
1327
|
+
"function" == typeof this._$AH ? this._$AH.call(this.options?.host ?? this.element, t) : this._$AH.handleEvent(t);
|
|
1328
|
+
}
|
|
1329
|
+
}
|
|
1330
|
+
class z {
|
|
1331
|
+
constructor(t, i, s) {
|
|
1332
|
+
this.element = t, this.type = 6, this._$AN = void 0, this._$AM = i, this.options = s;
|
|
1333
|
+
}
|
|
1334
|
+
get _$AU() {
|
|
1335
|
+
return this._$AM._$AU;
|
|
1336
|
+
}
|
|
1337
|
+
_$AI(t) {
|
|
1338
|
+
S(this, t);
|
|
1339
|
+
}
|
|
1340
|
+
}
|
|
1341
|
+
const j = t.litHtmlPolyfillSupport;
|
|
1342
|
+
j?.(N, R), (t.litHtmlVersions ??= []).push("3.3.1");
|
|
1343
|
+
|
|
1344
|
+
/**
|
|
1345
|
+
* @license
|
|
1346
|
+
* Copyright 2018 Google LLC
|
|
1347
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
1348
|
+
*/
|
|
1349
|
+
const o = o => o ?? E;
|
|
1350
|
+
|
|
1351
|
+
var _M3eListActionElement_instances, _M3eListActionElement_handleClick;
|
|
1352
|
+
/**
|
|
1353
|
+
* An item in a list that performs an action.
|
|
1354
|
+
*
|
|
1355
|
+
* @description
|
|
1356
|
+
* The `m3e-list-action` component represents an interactive list item that performs a
|
|
1357
|
+
* user-initiated action. It combines the semantic structure of a list item with
|
|
1358
|
+
* button-like interactions, supporting keyboard navigation, ripple effects, and state layers.
|
|
1359
|
+
*
|
|
1360
|
+
* @tag m3e-list-action
|
|
1361
|
+
*
|
|
1362
|
+
* @slot - Renders the content of the list item.
|
|
1363
|
+
* @slot leading - Renders the leading content of the list item.
|
|
1364
|
+
* @slot overline - Renders the overline of the list item.
|
|
1365
|
+
* @slot supporting-text - Renders the supporting text of the list item.
|
|
1366
|
+
* @slot trailing - Renders the trailing content of the list item.
|
|
1367
|
+
*
|
|
1368
|
+
* @attr disabled - Whether the element is disabled.
|
|
1369
|
+
* @attr download - A value indicating whether the `target` of the link button will be downloaded, optionally specifying the new name of the file.
|
|
1370
|
+
* @attr href - The URL to which the link button points.
|
|
1371
|
+
* @attr rel - The relationship between the `target` of the link button and the document.
|
|
1372
|
+
* @attr target - The target of the link button.
|
|
1373
|
+
*
|
|
1374
|
+
* @fires click - Emitted when the element is clicked.
|
|
1375
|
+
*
|
|
1376
|
+
* @cssprop --m3e-list-item-between-space - Horizontal gap between elements.
|
|
1377
|
+
* @cssprop --m3e-list-item-padding-inline - Horizontal padding for the list item.
|
|
1378
|
+
* @cssprop --m3e-list-item-padding-block - Vertical padding for the list item.
|
|
1379
|
+
* @cssprop --m3e-list-item-height - Minimum height of the list item.
|
|
1380
|
+
* @cssprop --m3e-list-item-font-size - Font size for main content.
|
|
1381
|
+
* @cssprop --m3e-list-item-font-weight - Font weight for main content.
|
|
1382
|
+
* @cssprop --m3e-list-item-line-height - Line height for main content.
|
|
1383
|
+
* @cssprop --m3e-list-item-tracking - Letter spacing for main content.
|
|
1384
|
+
* @cssprop --m3e-list-item-overline-font-size - Font size for overline slot.
|
|
1385
|
+
* @cssprop --m3e-list-item-overline-font-weight - Font weight for overline slot.
|
|
1386
|
+
* @cssprop --m3e-list-item-overline-line-height - Line height for overline slot.
|
|
1387
|
+
* @cssprop --m3e-list-item-overline-tracking - Letter spacing for overline slot.
|
|
1388
|
+
* @cssprop --m3e-list-item-supporting-text-font-size - Font size for supporting text slot.
|
|
1389
|
+
* @cssprop --m3e-list-item-supporting-text-font-weight - Font weight for supporting text slot.
|
|
1390
|
+
* @cssprop --m3e-list-item-supporting-text-line-height - Line height for supporting text slot.
|
|
1391
|
+
* @cssprop --m3e-list-item-supporting-text-tracking - Letter spacing for supporting text slot.
|
|
1392
|
+
* @cssprop --m3e-list-item-trailing-text-font-size - Font size for trailing supporting text slot.
|
|
1393
|
+
* @cssprop --m3e-list-item-trailing-text-font-weight - Font weight for trailing supporting text slot.
|
|
1394
|
+
* @cssprop --m3e-list-item-trailing-text-line-height - Line height for trailing supporting text slot.
|
|
1395
|
+
* @cssprop --m3e-list-item-trailing-text-tracking - Letter spacing for trailing supporting text slot.
|
|
1396
|
+
* @cssprop --m3e-list-item-icon-size - Size for leading/trailing icons.
|
|
1397
|
+
* @cssprop --m3e-list-item-label-text-color - Color for the main content.
|
|
1398
|
+
* @cssprop --m3e-list-item-overline-color - Color for the overline slot.
|
|
1399
|
+
* @cssprop --m3e-list-item-supporting-text-color - Color for the supporting text slot.
|
|
1400
|
+
* @cssprop --m3e-list-item-leading-color - Color for the leading content.
|
|
1401
|
+
* @cssprop --m3e-list-item-trailing-color - Color for the trailing content.
|
|
1402
|
+
* @cssprop --m3e-list-item-container-color - Background color of the list item.
|
|
1403
|
+
* @cssprop --m3e-list-item-container-shape - Border radius of the list item.
|
|
1404
|
+
* @cssprop --m3e-list-item-hover-container-shape - Border radius of the list item on hover.
|
|
1405
|
+
* @cssprop --m3e-list-item-focus-container-shape - Border radius of the list item on focus.
|
|
1406
|
+
* @cssprop --m3e-list-item-video-width - Width of the video slot.
|
|
1407
|
+
* @cssprop --m3e-list-item-video-height - Height of the video slot.
|
|
1408
|
+
* @cssprop --m3e-list-item-video-shape - Border radius of the video slot.
|
|
1409
|
+
* @cssprop --m3e-list-item-image-width - Width of the image slot.
|
|
1410
|
+
* @cssprop --m3e-list-item-image-height - Height of the image slot.
|
|
1411
|
+
* @cssprop --m3e-list-item-image-shape - Border radius of the image slot.
|
|
1412
|
+
* @cssprop --m3e-list-item-disabled-container-color - Background color of the list item when disabled.
|
|
1413
|
+
* @cssprop --m3e-list-item-disabled-label-text-color - Color for the main content when disabled.
|
|
1414
|
+
* @cssprop --m3e-list-item-disabled-label-text-opacity - Opacity for the main content when disabled.
|
|
1415
|
+
* @cssprop --m3e-list-item-disabled-overline-color - Color for the overline slot when disabled.
|
|
1416
|
+
* @cssprop --m3e-list-item-disabled-overline-opacity - Opacity for the overline slot when disabled.
|
|
1417
|
+
* @cssprop --m3e-list-item-disabled-supporting-text-color - Color for the supporting text slot when disabled.
|
|
1418
|
+
* @cssprop --m3e-list-item-disabled-supporting-text-opacity - Opacity for the supporting text slot when disabled.
|
|
1419
|
+
* @cssprop --m3e-list-item-disabled-leading-color - Color for the leading icon when disabled.
|
|
1420
|
+
* @cssprop --m3e-list-item-disabled-leading-opacity - Opacity for the leading icon when disabled.
|
|
1421
|
+
* @cssprop --m3e-list-item-disabled-trailing-color - Color for the trailing icon when disabled.
|
|
1422
|
+
* @cssprop --m3e-list-item-disabled-trailing-opacity - Opacity for the trailing icon when disabled.
|
|
1423
|
+
* @cssprop --m3e-list-item-hover-state-layer-color - Color for the hover state layer.
|
|
1424
|
+
* @cssprop --m3e-list-item-hover-state-layer-opacity - Opacity for the hover state layer.
|
|
1425
|
+
* @cssprop --m3e-list-item-focus-state-layer-color - Color for the focus state layer.
|
|
1426
|
+
* @cssprop --m3e-list-item-focus-state-layer-opacity - Opacity for the focus state layer.
|
|
1427
|
+
* @cssprop --m3e-list-item-pressed-state-layer-color - Color for the pressed state layer.
|
|
1428
|
+
* @cssprop --m3e-list-item-pressed-state-layer-opacity - Opacity for the pressed state layer.
|
|
1429
|
+
* @cssprop --m3e-list-item-three-line-top-offset - Top offset for media in three line items.
|
|
1430
|
+
* @cssprop --m3e-list-item-disabled-media-opacity - Opacity for media when disabled.
|
|
1431
|
+
*/
|
|
1432
|
+
let M3eListActionElement = class M3eListActionElement extends LinkButton(M3eListItemElement) {
|
|
1433
|
+
constructor() {
|
|
1434
|
+
super(...arguments);
|
|
1435
|
+
_M3eListActionElement_instances.add(this);
|
|
1436
|
+
/**
|
|
1437
|
+
* Whether the element is disabled.
|
|
1438
|
+
* @default false
|
|
1439
|
+
*/
|
|
1440
|
+
this.disabled = false;
|
|
1441
|
+
}
|
|
1442
|
+
/** @inheritdoc */
|
|
1443
|
+
render() {
|
|
1444
|
+
return html`<m3e-list-item-button class="button" ?disabled="${this.disabled}" href="${o(this.href || undefined)}" target="${o(this.target || undefined)}" download="${o(this.download || undefined)}" rel="${o(this.rel || undefined)}" @click="${__classPrivateFieldGet(this, _M3eListActionElement_instances, "m", _M3eListActionElement_handleClick)}"><slot name="leading" slot="leading" @slotchange="${this._handleLeadingSlotChange}"></slot><slot name="overline" slot="overline"></slot><slot></slot><slot name="supporting-text" slot="supporting-text"></slot><slot name="trailing" slot="trailing" @slotchange="${this._handleTrailingSlotChange}"></slot></m3e-list-item-button>`;
|
|
1445
|
+
}
|
|
1446
|
+
};
|
|
1447
|
+
_M3eListActionElement_instances = new WeakSet();
|
|
1448
|
+
_M3eListActionElement_handleClick = function _M3eListActionElement_handleClick(e) {
|
|
1449
|
+
if (!e.defaultPrevented) {
|
|
1450
|
+
this.closest("m3e-action-list")?.[selectionManager].updateActiveItem(this.button);
|
|
1451
|
+
}
|
|
1452
|
+
};
|
|
1453
|
+
/** The styles of the element. */
|
|
1454
|
+
M3eListActionElement.styles = css`:host { display: block; } .button { width: 100%; }`;
|
|
1455
|
+
__decorate([e$1(".button")], M3eListActionElement.prototype, "button", void 0);
|
|
1456
|
+
__decorate([n$1({
|
|
1457
|
+
type: Boolean,
|
|
1458
|
+
reflect: true
|
|
1459
|
+
})], M3eListActionElement.prototype, "disabled", void 0);
|
|
1460
|
+
M3eListActionElement = __decorate([t$2("m3e-list-action")], M3eListActionElement);
|
|
1461
|
+
|
|
1462
|
+
/**
|
|
1463
|
+
* @internal
|
|
1464
|
+
* An internal interactive element used to present the content of a list item.
|
|
1465
|
+
*/
|
|
1466
|
+
let M3eListItemButtonElement = class M3eListItemButtonElement extends KeyboardClick(LinkButton(Focusable(Disabled(AttachInternals(Role(M3eListItemElement, "button"), true))))) {
|
|
1467
|
+
/** @inheritdoc */
|
|
1468
|
+
firstUpdated(_changedProperties) {
|
|
1469
|
+
super.firstUpdated(_changedProperties);
|
|
1470
|
+
[this._focusRing, this._stateLayer, this._ripple].forEach(x => x?.attach(this));
|
|
1471
|
+
}
|
|
1472
|
+
/** @inheritdoc */
|
|
1473
|
+
render() {
|
|
1474
|
+
return html`<m3e-state-layer class="state-layer" ?disabled="${this.disabled}"></m3e-state-layer><m3e-focus-ring class="focus-ring" inward ?disabled="${this.disabled}"></m3e-focus-ring><m3e-ripple class="ripple" ?disabled="${this.disabled}"></m3e-ripple>${this[renderPseudoLink]()} ${super.render()}`;
|
|
1475
|
+
}
|
|
1476
|
+
};
|
|
1477
|
+
/** The styles of the element. */
|
|
1478
|
+
M3eListItemButtonElement.styles = [M3eListItemElement.styles, css`:host { position: relative; outline: none; user-select: none; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); } :host(:not(:disabled)) { cursor: pointer; } a { all: unset; display: block; position: absolute; top: 0px; left: 0px; right: 0px; bottom: 0px; z-index: 1; }`];
|
|
1479
|
+
__decorate([e$1(".focus-ring")], M3eListItemButtonElement.prototype, "_focusRing", void 0);
|
|
1480
|
+
__decorate([e$1(".state-layer")], M3eListItemButtonElement.prototype, "_stateLayer", void 0);
|
|
1481
|
+
__decorate([e$1(".ripple")], M3eListItemButtonElement.prototype, "_ripple", void 0);
|
|
1482
|
+
M3eListItemButtonElement = __decorate([t$2("m3e-list-item-button")], M3eListItemButtonElement);
|
|
1483
|
+
|
|
1484
|
+
var _M3eListOptionElement_instances, _M3eListOptionElement_value, _M3eListOptionElement_textContent, _M3eListOptionElement_clickHandler, _M3eListOptionElement_handleSlotChange, _M3eListOptionElement_handleClick;
|
|
1485
|
+
/**
|
|
1486
|
+
* A selectable option in a list.
|
|
1487
|
+
*
|
|
1488
|
+
* @description
|
|
1489
|
+
* The `m3e-list-option` component represents a selectable item within a list container. It extends
|
|
1490
|
+
* the base `m3e-list-item` functionality with selection state management, providing visual feedback
|
|
1491
|
+
* for selected and unselected states. The component is designed for use with `m3e-selection-list`
|
|
1492
|
+
* and supports rich content through multiple slots, comprehensive styling via CSS custom properties,
|
|
1493
|
+
* and accessible interactions following Material 3 design principles.
|
|
1494
|
+
*
|
|
1495
|
+
* @tag m3e-list-option
|
|
1496
|
+
*
|
|
1497
|
+
* @slot - Renders the content of the list item.
|
|
1498
|
+
* @slot leading - Renders the leading content of the list item.
|
|
1499
|
+
* @slot overline - Renders the overline of the list item.
|
|
1500
|
+
* @slot supporting-text - Renders the supporting text of the list item.
|
|
1501
|
+
* @slot trailing - Renders the trailing content of the list item.
|
|
1502
|
+
*
|
|
1503
|
+
* @attr disabled - Whether the element is disabled.
|
|
1504
|
+
* @attr selected - Whether the element is selected.
|
|
1505
|
+
*
|
|
1506
|
+
* @fires input - Emitted when the selected state changes.
|
|
1507
|
+
* @fires change - Emitted when the selected state changes.
|
|
1508
|
+
* @fires click - Emitted when the element is clicked.
|
|
1509
|
+
*
|
|
1510
|
+
* @cssprop --m3e-list-item-between-space - Horizontal gap between elements.
|
|
1511
|
+
* @cssprop --m3e-list-item-padding-inline - Horizontal padding for the list item.
|
|
1512
|
+
* @cssprop --m3e-list-item-padding-block - Vertical padding for the list item.
|
|
1513
|
+
* @cssprop --m3e-list-item-height - Minimum height of the list item.
|
|
1514
|
+
* @cssprop --m3e-list-item-font-size - Font size for main content.
|
|
1515
|
+
* @cssprop --m3e-list-item-font-weight - Font weight for main content.
|
|
1516
|
+
* @cssprop --m3e-list-item-line-height - Line height for main content.
|
|
1517
|
+
* @cssprop --m3e-list-item-tracking - Letter spacing for main content.
|
|
1518
|
+
* @cssprop --m3e-list-item-overline-font-size - Font size for overline slot.
|
|
1519
|
+
* @cssprop --m3e-list-item-overline-font-weight - Font weight for overline slot.
|
|
1520
|
+
* @cssprop --m3e-list-item-overline-line-height - Line height for overline slot.
|
|
1521
|
+
* @cssprop --m3e-list-item-overline-tracking - Letter spacing for overline slot.
|
|
1522
|
+
* @cssprop --m3e-list-item-supporting-text-font-size - Font size for supporting text slot.
|
|
1523
|
+
* @cssprop --m3e-list-item-supporting-text-font-weight - Font weight for supporting text slot.
|
|
1524
|
+
* @cssprop --m3e-list-item-supporting-text-line-height - Line height for supporting text slot.
|
|
1525
|
+
* @cssprop --m3e-list-item-supporting-text-tracking - Letter spacing for supporting text slot.
|
|
1526
|
+
* @cssprop --m3e-list-item-trailing-text-font-size - Font size for trailing supporting text slot.
|
|
1527
|
+
* @cssprop --m3e-list-item-trailing-text-font-weight - Font weight for trailing supporting text slot.
|
|
1528
|
+
* @cssprop --m3e-list-item-trailing-text-line-height - Line height for trailing supporting text slot.
|
|
1529
|
+
* @cssprop --m3e-list-item-trailing-text-tracking - Letter spacing for trailing supporting text slot.
|
|
1530
|
+
* @cssprop --m3e-list-item-icon-size - Size for leading/trailing icons.
|
|
1531
|
+
* @cssprop --m3e-list-item-label-text-color - Color for the main content.
|
|
1532
|
+
* @cssprop --m3e-list-item-overline-color - Color for the overline slot.
|
|
1533
|
+
* @cssprop --m3e-list-item-supporting-text-color - Color for the supporting text slot.
|
|
1534
|
+
* @cssprop --m3e-list-item-leading-color - Color for the leading content.
|
|
1535
|
+
* @cssprop --m3e-list-item-trailing-color - Color for the trailing content.
|
|
1536
|
+
* @cssprop --m3e-list-item-container-color - Background color of the list item.
|
|
1537
|
+
* @cssprop --m3e-list-item-container-shape - Border radius of the list item.
|
|
1538
|
+
* @cssprop --m3e-list-item-hover-container-shape - Border radius of the list item on hover.
|
|
1539
|
+
* @cssprop --m3e-list-item-focus-container-shape - Border radius of the list item on focus.
|
|
1540
|
+
* @cssprop --m3e-list-item-video-width - Width of the video slot.
|
|
1541
|
+
* @cssprop --m3e-list-item-video-height - Height of the video slot.
|
|
1542
|
+
* @cssprop --m3e-list-item-video-shape - Border radius of the video slot.
|
|
1543
|
+
* @cssprop --m3e-list-item-image-width - Width of the image slot.
|
|
1544
|
+
* @cssprop --m3e-list-item-image-height - Height of the image slot.
|
|
1545
|
+
* @cssprop --m3e-list-item-image-shape - Border radius of the image slot.
|
|
1546
|
+
* @cssprop --m3e-list-item-disabled-container-color - Background color of the list item when disabled.
|
|
1547
|
+
* @cssprop --m3e-list-item-disabled-label-text-color - Color for the main content when disabled.
|
|
1548
|
+
* @cssprop --m3e-list-item-disabled-label-text-opacity - Opacity for the main content when disabled.
|
|
1549
|
+
* @cssprop --m3e-list-item-disabled-overline-color - Color for the overline slot when disabled.
|
|
1550
|
+
* @cssprop --m3e-list-item-disabled-overline-opacity - Opacity for the overline slot when disabled.
|
|
1551
|
+
* @cssprop --m3e-list-item-disabled-supporting-text-color - Color for the supporting text slot when disabled.
|
|
1552
|
+
* @cssprop --m3e-list-item-disabled-supporting-text-opacity - Opacity for the supporting text slot when disabled.
|
|
1553
|
+
* @cssprop --m3e-list-item-disabled-leading-color - Color for the leading icon when disabled.
|
|
1554
|
+
* @cssprop --m3e-list-item-disabled-leading-opacity - Opacity for the leading icon when disabled.
|
|
1555
|
+
* @cssprop --m3e-list-item-disabled-trailing-color - Color for the trailing icon when disabled.
|
|
1556
|
+
* @cssprop --m3e-list-item-disabled-trailing-opacity - Opacity for the trailing icon when disabled.
|
|
1557
|
+
* @cssprop --m3e-list-item-hover-state-layer-color - Color for the hover state layer.
|
|
1558
|
+
* @cssprop --m3e-list-item-hover-state-layer-opacity - Opacity for the hover state layer.
|
|
1559
|
+
* @cssprop --m3e-list-item-focus-state-layer-color - Color for the focus state layer.
|
|
1560
|
+
* @cssprop --m3e-list-item-focus-state-layer-opacity - Opacity for the focus state layer.
|
|
1561
|
+
* @cssprop --m3e-list-item-pressed-state-layer-color - Color for the pressed state layer.
|
|
1562
|
+
* @cssprop --m3e-list-item-pressed-state-layer-opacity - Opacity for the pressed state layer.
|
|
1563
|
+
* @cssprop --m3e-list-item-selected-label-text-color - Selected color for the main content.
|
|
1564
|
+
* @cssprop --m3e-list-item-selected-overline-color - Selected color for the overline slot.
|
|
1565
|
+
* @cssprop --m3e-list-item-selected-supporting-text-color - Selected color for the supporting text slot.
|
|
1566
|
+
* @cssprop --m3e-list-item-selected-leading-color - Selected color for the leading content.
|
|
1567
|
+
* @cssprop --m3e-list-item-selected-trailing-color - Selected color for the trailing content.
|
|
1568
|
+
* @cssprop --m3e-list-item-selected-container-color - Selected background color of the list item.
|
|
1569
|
+
* @cssprop --m3e-list-item-selected-container-shape - Selected border radius of the list item.
|
|
1570
|
+
* @cssprop --m3e-list-item-selected-disabled-container-color - Selected background color when disabled.
|
|
1571
|
+
* @cssprop --m3e-list-item-selected-disabled-container-opacity - Selected opacity when disabled.
|
|
1572
|
+
* @cssprop --m3e-list-item-selected-hover-state-layer-color - Color for the hover state layer when selected.
|
|
1573
|
+
* @cssprop --m3e-list-item-selected-hover-state-layer-opacity - Opacity for the hover state layer when selected.
|
|
1574
|
+
* @cssprop --m3e-list-item-selected-focus-state-layer-color - Color for the focus state layer when selected.
|
|
1575
|
+
* @cssprop --m3e-list-item-selected-focus-state-layer-opacity - Opacity for the focus state layer when selected.
|
|
1576
|
+
* @cssprop --m3e-list-item-selected-pressed-state-layer-color - Color for the pressed state layer when selected.
|
|
1577
|
+
* @cssprop --m3e-list-item-selected-pressed-state-layer-opacity - Opacity for the pressed state layer when selected.
|
|
1578
|
+
* @cssprop --m3e-list-item-three-line-top-offset - Top offset for media in three line items.
|
|
1579
|
+
* @cssprop --m3e-list-item-disabled-media-opacity - Opacity for media when disabled.
|
|
1580
|
+
*/
|
|
1581
|
+
let M3eListOptionElement = class M3eListOptionElement extends KeyboardClick(Focusable(Selected(Disabled(AttachInternals(Role(M3eListItemElement, "option"), true))))) {
|
|
1582
|
+
constructor() {
|
|
1583
|
+
super(...arguments);
|
|
1584
|
+
_M3eListOptionElement_instances.add(this);
|
|
1585
|
+
/** @private */
|
|
1586
|
+
_M3eListOptionElement_value.set(this, void 0);
|
|
1587
|
+
/** @private */
|
|
1588
|
+
_M3eListOptionElement_textContent.set(this, "");
|
|
1589
|
+
/** @private */
|
|
1590
|
+
_M3eListOptionElement_clickHandler.set(this, e => __classPrivateFieldGet(this, _M3eListOptionElement_instances, "m", _M3eListOptionElement_handleClick).call(this, e));
|
|
1591
|
+
}
|
|
1592
|
+
/** A string representing the value of the option. */
|
|
1593
|
+
get value() {
|
|
1594
|
+
return __classPrivateFieldGet(this, _M3eListOptionElement_value, "f") ?? __classPrivateFieldGet(this, _M3eListOptionElement_textContent, "f");
|
|
1595
|
+
}
|
|
1596
|
+
set value(value) {
|
|
1597
|
+
__classPrivateFieldSet(this, _M3eListOptionElement_value, value, "f");
|
|
1598
|
+
}
|
|
1599
|
+
/** @inheritdoc */
|
|
1600
|
+
connectedCallback() {
|
|
1601
|
+
super.connectedCallback();
|
|
1602
|
+
this.addEventListener("click", __classPrivateFieldGet(this, _M3eListOptionElement_clickHandler, "f"));
|
|
1603
|
+
}
|
|
1604
|
+
/** @inheritdoc */
|
|
1605
|
+
disconnectedCallback() {
|
|
1606
|
+
super.disconnectedCallback();
|
|
1607
|
+
this.removeEventListener("click", __classPrivateFieldGet(this, _M3eListOptionElement_clickHandler, "f"));
|
|
1608
|
+
}
|
|
1609
|
+
/** @inheritdoc */
|
|
1610
|
+
firstUpdated(_changedProperties) {
|
|
1611
|
+
super.firstUpdated(_changedProperties);
|
|
1612
|
+
[this._focusRing, this._stateLayer, this._ripple].forEach(x => x?.attach(this));
|
|
1613
|
+
}
|
|
1614
|
+
/** @inheritdoc */
|
|
1615
|
+
update(changedProperties) {
|
|
1616
|
+
super.update(changedProperties);
|
|
1617
|
+
if (changedProperties.has("selected")) {
|
|
1618
|
+
this.closest("m3e-selection-list")?.[selectionManager].notifySelectionChange(this);
|
|
1619
|
+
for (const icon of this.querySelectorAll("m3e-icon")) {
|
|
1620
|
+
icon.toggleAttribute("filled", this.selected);
|
|
1621
|
+
}
|
|
1622
|
+
}
|
|
1623
|
+
}
|
|
464
1624
|
/** @inheritdoc */
|
|
465
1625
|
render() {
|
|
466
|
-
return html`<slot name="leading
|
|
1626
|
+
return html`<m3e-state-layer class="state-layer" ?disabled="${this.disabled}"></m3e-state-layer><m3e-focus-ring class="focus-ring" inward ?disabled="${this.disabled}"></m3e-focus-ring><m3e-ripple class="ripple" ?disabled="${this.disabled}"></m3e-ripple><slot name="leading" @slotchange="${this._handleLeadingSlotChange}"></slot><div class="base"><slot name="overline"></slot><slot @slotchange="${__classPrivateFieldGet(this, _M3eListOptionElement_instances, "m", _M3eListOptionElement_handleSlotChange)}"></slot><slot name="supporting-text"></slot></div><slot name="trailing" @slotchange="${this._handleTrailingSlotChange}"></slot><div class="indicator">${this.closest("m3e-selection-list")?.multi ? html`<m3e-pseudo-checkbox ?checked="${this.selected}" ?disabled="${this.disabled}"></m3e-pseudo-checkbox>` : html`<m3e-pseudo-radio ?checked="${this.selected}" ?disabled="${this.disabled}"></m3e-pseudo-radio>`}</div>`;
|
|
1627
|
+
}
|
|
1628
|
+
};
|
|
1629
|
+
_M3eListOptionElement_value = new WeakMap();
|
|
1630
|
+
_M3eListOptionElement_textContent = new WeakMap();
|
|
1631
|
+
_M3eListOptionElement_clickHandler = new WeakMap();
|
|
1632
|
+
_M3eListOptionElement_instances = new WeakSet();
|
|
1633
|
+
_M3eListOptionElement_handleSlotChange = function _M3eListOptionElement_handleSlotChange(e) {
|
|
1634
|
+
__classPrivateFieldSet(this, _M3eListOptionElement_textContent, getTextContent(e.target), "f");
|
|
1635
|
+
};
|
|
1636
|
+
_M3eListOptionElement_handleClick = function _M3eListOptionElement_handleClick(e) {
|
|
1637
|
+
const selectionList = this.closest("m3e-selection-list");
|
|
1638
|
+
if (e.defaultPrevented || !selectionList) return;
|
|
1639
|
+
if (selectionList.multi || !this.selected) {
|
|
1640
|
+
const selected = this.selected;
|
|
1641
|
+
this.selected = !this.selected;
|
|
1642
|
+
if (this.dispatchEvent(new Event("input", {
|
|
1643
|
+
bubbles: true,
|
|
1644
|
+
composed: true,
|
|
1645
|
+
cancelable: true
|
|
1646
|
+
}))) {
|
|
1647
|
+
selectionList[selectionManager].notifySelectionChange(this);
|
|
1648
|
+
this.dispatchEvent(new Event("change", {
|
|
1649
|
+
bubbles: true
|
|
1650
|
+
}));
|
|
1651
|
+
} else {
|
|
1652
|
+
this.selected = selected;
|
|
1653
|
+
}
|
|
467
1654
|
}
|
|
468
1655
|
};
|
|
469
1656
|
/** The styles of the element. */
|
|
470
|
-
|
|
471
|
-
|
|
1657
|
+
M3eListOptionElement.styles = [M3eListItemElement.styles, css`:host { position: relative; outline: none; user-select: none; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); } .indicator { min-width: 1.5rem; min-height: 1.5rem; display: flex; align-items: center; justify-content: center; } :host(:not(:disabled)) { cursor: pointer; } :host(.-three-line) .indicator { align-self: flex-start; margin-top: var(--m3e-list-item-three-line-top-offset, 0.25rem); } :host([selected]), :host([selected]) .state-layer, :host([selected]) .ripple, :host([selected]) .focus-ring { border-radius: var(--m3e-list-item-selected-container-shape, ${DesignToken.shape.corner.large}); } :host([selected]:not(:disabled)) .base { color: var(--m3e-list-item-selected-label-text-color, ${DesignToken.color.onSecondaryContainer}); } :host([selected]:not(:disabled)) ::slotted([slot="overline"]) { color: var(--m3e-list-item-selected-overline-color, ${DesignToken.color.onSecondaryContainer}); } :host([selected]:not(:disabled)) ::slotted([slot="supporting-text"]) { color: var(--m3e-list-item-selected-supporting-text-color, ${DesignToken.color.onSecondaryContainer}); } :host([selected]:not(:disabled)) ::slotted([slot="leading"]) { color: var(--m3e-list-item-selected-leading-color, ${DesignToken.color.onSecondaryContainer}); } :host([selected]:not(:disabled)) ::slotted([slot="trailing"]) { color: var(--m3e-list-item-selected-trailing-color, ${DesignToken.color.onSecondaryContainer}); } :host([selected]:not(:disabled)) { background-color: var(--m3e-list-item-selected-container-color, ${DesignToken.color.secondaryContainer}); } :host([selected]:disabled) { background-color: color-mix( in srgb, var(--m3e-list-item-selected-disabled-container-color, ${DesignToken.color.onSurface}) var(--m3e-list-item-selected-disabled-container-opacity, 10%), transparent ); } :host([selected]:not(:disabled)) .state-layer { --m3e-state-layer-hover-color: var( --m3e-list-item-selected-hover-state-layer-color, ${DesignToken.color.onSurface} ); --m3e-state-layer-hover-opacity: var( --m3e-list-item-selected-hover-state-layer-opacity, ${DesignToken.state.hoverStateLayerOpacity} ); --m3e-state-layer-focus-color: var( --m3e-list-item-selected-focus-state-layer-color, ${DesignToken.color.onSurface} ); --m3e-state-layer-focus-opacity: var( --m3e-list-item-selected-focus-state-layer-opacity, ${DesignToken.state.focusStateLayerOpacity} ); } :host([selected]:not(:disabled)) .ripple { --m3e-ripple-color: var(--m3e-list-item-selected-pressed-state-layer-color, ${DesignToken.color.onSurface}); --m3e-ripple-opacity: var( --m3e-list-item-selected-pressed-state-layer-opacity, ${DesignToken.state.pressedStateLayerOpacity} ); } :host(.-hide-selection) .indicator, :host(:not(.-hide-selection)) ::slotted([slot="trailing"]) { display: none; } @media (forced-colors: active) { :host([selected]:not(:disabled)) .base, :host([selected]:not(:disabled)) ::slotted([slot="overline"]), :host([selected]:not(:disabled)) ::slotted([slot="supporting-text"]), :host([selected]:not(:disabled)) ::slotted([slot="leading"]), :host([selected]:not(:disabled)) ::slotted([slot="trailing"]) { color: HighlightText; forced-color-adjust: none; } :host([selected]:not(:disabled)) { background-color: Highlight; } }`];
|
|
1658
|
+
__decorate([e$1(".focus-ring")], M3eListOptionElement.prototype, "_focusRing", void 0);
|
|
1659
|
+
__decorate([e$1(".state-layer")], M3eListOptionElement.prototype, "_stateLayer", void 0);
|
|
1660
|
+
__decorate([e$1(".ripple")], M3eListOptionElement.prototype, "_ripple", void 0);
|
|
1661
|
+
__decorate([n$1()], M3eListOptionElement.prototype, "value", null);
|
|
1662
|
+
M3eListOptionElement = __decorate([t$2("m3e-list-option")], M3eListOptionElement);
|
|
1663
|
+
|
|
1664
|
+
var _M3eSelectionListElement_instances, _M3eSelectionListElement_keyDownHandler, _M3eSelectionListElement_changeHandler, _M3eSelectionListElement_handleChange, _a;
|
|
1665
|
+
/**
|
|
1666
|
+
* A list of selectable options.
|
|
1667
|
+
*
|
|
1668
|
+
* @description
|
|
1669
|
+
* The `m3e-selection-list` component provides a container for managing selectable list items with
|
|
1670
|
+
* single or multi-select capabilities. It implements robust keyboard navigation, form association,
|
|
1671
|
+
* and state management for both individual options and the list as a whole. The component supports
|
|
1672
|
+
* flexible layout, custom theming via CSS custom properties, and comprehensive accessibility features
|
|
1673
|
+
* including aria roles, roving tabindex management, and semantic event handling following Material 3
|
|
1674
|
+
* design principles.
|
|
1675
|
+
*
|
|
1676
|
+
* @tag m3e-selection-list
|
|
1677
|
+
*
|
|
1678
|
+
* @slot - Renders the items of the list.
|
|
1679
|
+
*
|
|
1680
|
+
* @attr hide-selection-indicator - Whether to hide the selection indicator.
|
|
1681
|
+
* @attr multi - Whether multiple items can be selected.
|
|
1682
|
+
* @attr variant - The appearance variant of the list.
|
|
1683
|
+
*
|
|
1684
|
+
* @fires input - Emitted when the selected state of an option changes.
|
|
1685
|
+
* @fires change - Emitted when the selected state of an option changes.
|
|
1686
|
+
*
|
|
1687
|
+
* @cssprop --m3e-list-divider-inset-start-size - Start inset for dividers within the list.
|
|
1688
|
+
* @cssprop --m3e-list-divider-inset-end-size - End inset for dividers within the list.
|
|
1689
|
+
* @cssprop --m3e-segmented-list-segment-gap - Gap between list items in segmented variant.
|
|
1690
|
+
* @cssprop --m3e-segmented-list-container-shape - Border radius of the segmented list container.
|
|
1691
|
+
* @cssprop --m3e-segmented-list-item-container-color - Background color of items in segmented variant.
|
|
1692
|
+
* @cssprop --m3e-segmented-list-item-disabled-container-color - Background color of disabled items in segmented variant.
|
|
1693
|
+
* @cssprop --m3e-segmented-list-item-container-shape - Border radius of items in segmented variant.
|
|
1694
|
+
* @cssprop --m3e-segmented-list-item-hover-container-shape - Border radius of items in segmented variant on hover.
|
|
1695
|
+
* @cssprop --m3e-segmented-list-item-focus-container-shape - Border radius of items in segmented variant on focus.
|
|
1696
|
+
* @cssprop --m3e-segmented-list-item-selected-container-shape - Border radius of items in segmented variant when selected.
|
|
1697
|
+
*/
|
|
1698
|
+
let M3eSelectionListElement = class M3eSelectionListElement extends Labelled(Dirty(Touched(FormAssociated(Disabled(AttachInternals(Role(M3eListElement, "listbox"))))))) {
|
|
1699
|
+
constructor() {
|
|
1700
|
+
super(...arguments);
|
|
1701
|
+
_M3eSelectionListElement_instances.add(this);
|
|
1702
|
+
/** @private */
|
|
1703
|
+
_M3eSelectionListElement_keyDownHandler.set(this, e => this[selectionManager].onKeyDown(e));
|
|
1704
|
+
/** @private */
|
|
1705
|
+
_M3eSelectionListElement_changeHandler.set(this, e => __classPrivateFieldGet(this, _M3eSelectionListElement_instances, "m", _M3eSelectionListElement_handleChange).call(this, e));
|
|
1706
|
+
/** @private */
|
|
1707
|
+
this[_a] = new SelectionManager().withWrap().withHomeAndEnd().withVerticalOrientation();
|
|
1708
|
+
/**
|
|
1709
|
+
* Whether multiple items can be selected.
|
|
1710
|
+
* @default false
|
|
1711
|
+
*/
|
|
1712
|
+
this.multi = false;
|
|
1713
|
+
/**
|
|
1714
|
+
* Whether to hide the selection indicator.
|
|
1715
|
+
* @default false
|
|
1716
|
+
*/
|
|
1717
|
+
this.hideSelectionIndicator = false;
|
|
1718
|
+
}
|
|
1719
|
+
/** The options of the list. */
|
|
1720
|
+
get options() {
|
|
1721
|
+
return this[selectionManager]?.items ?? [];
|
|
1722
|
+
}
|
|
1723
|
+
/** The selected option(s) of the list. */
|
|
1724
|
+
get selected() {
|
|
1725
|
+
return this[selectionManager]?.selectedItems ?? [];
|
|
1726
|
+
}
|
|
1727
|
+
/** The selected (enabled) value(s) of the set. */
|
|
1728
|
+
get value() {
|
|
1729
|
+
const values = this.selected.filter(x => !x.disabled).map(x => x.value);
|
|
1730
|
+
switch (values.length) {
|
|
1731
|
+
case 0:
|
|
1732
|
+
return null;
|
|
1733
|
+
case 1:
|
|
1734
|
+
return values[0];
|
|
1735
|
+
default:
|
|
1736
|
+
return values;
|
|
1737
|
+
}
|
|
1738
|
+
}
|
|
1739
|
+
/** @inheritdoc @internal */
|
|
1740
|
+
get [(_M3eSelectionListElement_keyDownHandler = new WeakMap(), _M3eSelectionListElement_changeHandler = new WeakMap(), _M3eSelectionListElement_instances = new WeakSet(), _a = selectionManager, formValue)]() {
|
|
1741
|
+
const values = this.value;
|
|
1742
|
+
if (Array.isArray(values)) {
|
|
1743
|
+
const data = new FormData();
|
|
1744
|
+
for (const value of values) {
|
|
1745
|
+
data.append(this.name, value);
|
|
1746
|
+
}
|
|
1747
|
+
return data;
|
|
1748
|
+
}
|
|
1749
|
+
return values;
|
|
1750
|
+
}
|
|
1751
|
+
/** @inheritdoc */
|
|
1752
|
+
connectedCallback() {
|
|
1753
|
+
super.connectedCallback();
|
|
1754
|
+
this.addEventListener("keydown", __classPrivateFieldGet(this, _M3eSelectionListElement_keyDownHandler, "f"));
|
|
1755
|
+
this.addEventListener("change", __classPrivateFieldGet(this, _M3eSelectionListElement_changeHandler, "f"));
|
|
1756
|
+
}
|
|
1757
|
+
/** @inheritdoc */
|
|
1758
|
+
disconnectedCallback() {
|
|
1759
|
+
super.disconnectedCallback();
|
|
1760
|
+
this.removeEventListener("keydown", __classPrivateFieldGet(this, _M3eSelectionListElement_keyDownHandler, "f"));
|
|
1761
|
+
this.removeEventListener("change", __classPrivateFieldGet(this, _M3eSelectionListElement_changeHandler, "f"));
|
|
1762
|
+
}
|
|
1763
|
+
/** @inheritdoc */
|
|
1764
|
+
update(changedProperties) {
|
|
1765
|
+
super.update(changedProperties);
|
|
1766
|
+
if (changedProperties.has("disabled") && (changedProperties.get("disabled") !== undefined || this.disabled)) {
|
|
1767
|
+
this[selectionManager].disabled = this.disabled;
|
|
1768
|
+
}
|
|
1769
|
+
if (changedProperties.has("multi")) {
|
|
1770
|
+
this[selectionManager].multi = this.multi;
|
|
1771
|
+
if (this.multi) {
|
|
1772
|
+
this.setAttribute("aria-multiselectable", "true");
|
|
1773
|
+
} else {
|
|
1774
|
+
this.removeAttribute("aria-multiselectable");
|
|
1775
|
+
}
|
|
1776
|
+
this[selectionManager].items.forEach(x => x.requestUpdate());
|
|
1777
|
+
}
|
|
1778
|
+
if (changedProperties.has("hideSelectionIndicator")) {
|
|
1779
|
+
this[selectionManager].items.forEach(x => x.classList.toggle("-hide-selection", this.hideSelectionIndicator));
|
|
1780
|
+
}
|
|
1781
|
+
}
|
|
1782
|
+
/** @inheritdoc */
|
|
1783
|
+
notifyItemsChange() {
|
|
1784
|
+
const {
|
|
1785
|
+
added
|
|
1786
|
+
} = this[selectionManager].setItems(this.items.filter(x => x instanceof M3eListOptionElement));
|
|
1787
|
+
added.forEach(x => x.classList.toggle("-hide-selection", this.hideSelectionIndicator));
|
|
1788
|
+
if (!this[selectionManager].activeItem) {
|
|
1789
|
+
this[selectionManager].updateActiveItem(added.find(x => !x.disabled));
|
|
1790
|
+
}
|
|
1791
|
+
}
|
|
1792
|
+
};
|
|
1793
|
+
_M3eSelectionListElement_handleChange = function _M3eSelectionListElement_handleChange(e) {
|
|
1794
|
+
if (e.target !== this) {
|
|
1795
|
+
e.stopImmediatePropagation();
|
|
1796
|
+
e.stopPropagation();
|
|
1797
|
+
this.dispatchEvent(new Event("change", {
|
|
1798
|
+
bubbles: true
|
|
1799
|
+
}));
|
|
1800
|
+
}
|
|
1801
|
+
};
|
|
1802
|
+
__decorate([n$1({
|
|
1803
|
+
type: Boolean
|
|
1804
|
+
})], M3eSelectionListElement.prototype, "multi", void 0);
|
|
1805
|
+
__decorate([n$1({
|
|
1806
|
+
attribute: "hide-selection-indicator",
|
|
1807
|
+
type: Boolean
|
|
1808
|
+
})], M3eSelectionListElement.prototype, "hideSelectionIndicator", void 0);
|
|
1809
|
+
M3eSelectionListElement = __decorate([t$2("m3e-selection-list")], M3eSelectionListElement);
|
|
472
1810
|
|
|
473
|
-
export { M3eListElement, M3eListItemElement };
|
|
1811
|
+
export { M3eActionListElement, M3eExpandableListItem, M3eListActionElement, M3eListElement, M3eListItemButtonElement, M3eListItemElement, M3eListOptionElement, M3eSelectionListElement };
|
|
474
1812
|
//# sourceMappingURL=index.js.map
|