@m3e/option 1.0.6 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +591 -428
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +7 -200
- package/dist/index.min.js.map +1 -1
- package/dist/src/OptionPanelElement.d.ts.map +1 -1
- package/package.json +2 -16
package/dist/index.js
CHANGED
|
@@ -7,6 +7,7 @@ import { LitElement, html, css, unsafeCSS } from 'lit';
|
|
|
7
7
|
import { Selected, Disabled, Role, DesignToken, getTextContent, ScrollController } from '@m3e/core';
|
|
8
8
|
import { typeaheadLabel, removeAriaReferencedId, addAriaReferencedId } from '@m3e/core/a11y';
|
|
9
9
|
import { positionAnchor } from '@m3e/core/anchoring';
|
|
10
|
+
import { M3eDirectionality } from '@m3e/core/bidi';
|
|
10
11
|
|
|
11
12
|
/******************************************************************************
|
|
12
13
|
Copyright (c) Microsoft Corporation.
|
|
@@ -21,33 +22,30 @@ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
|
21
22
|
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
22
23
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
23
24
|
PERFORMANCE OF THIS SOFTWARE.
|
|
24
|
-
***************************************************************************** */
|
|
25
|
-
/* global Reflect, Promise, SuppressedError, Symbol, Iterator */
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
49
|
-
var e = new Error(message);
|
|
50
|
-
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
25
|
+
***************************************************************************** */
|
|
26
|
+
/* global Reflect, Promise, SuppressedError, Symbol, Iterator */
|
|
27
|
+
|
|
28
|
+
function __decorate(decorators, target, key, desc) {
|
|
29
|
+
var c = arguments.length,
|
|
30
|
+
r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,
|
|
31
|
+
d;
|
|
32
|
+
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;
|
|
33
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
34
|
+
}
|
|
35
|
+
function __classPrivateFieldGet(receiver, state, kind, f) {
|
|
36
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
37
|
+
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");
|
|
38
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
39
|
+
}
|
|
40
|
+
function __classPrivateFieldSet(receiver, state, value, kind, f) {
|
|
41
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
42
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
43
|
+
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");
|
|
44
|
+
return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
|
|
45
|
+
}
|
|
46
|
+
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
47
|
+
var e = new Error(message);
|
|
48
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
51
49
|
};
|
|
52
50
|
|
|
53
51
|
/**
|
|
@@ -55,39 +53,395 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
|
|
|
55
53
|
* Copyright 2017 Google LLC
|
|
56
54
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
57
55
|
*/
|
|
58
|
-
const t$1=t=>(e,o)=>
|
|
56
|
+
const t$1 = t => (e, o) => {
|
|
57
|
+
void 0 !== o ? o.addInitializer(() => {
|
|
58
|
+
customElements.define(t, e);
|
|
59
|
+
}) : customElements.define(t, e);
|
|
60
|
+
};
|
|
59
61
|
|
|
60
62
|
/**
|
|
61
63
|
* @license
|
|
62
64
|
* Copyright 2019 Google LLC
|
|
63
65
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
64
66
|
*/
|
|
65
|
-
const t
|
|
67
|
+
const t = globalThis,
|
|
68
|
+
e$3 = t.ShadowRoot && (void 0 === t.ShadyCSS || t.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype,
|
|
69
|
+
s = Symbol(),
|
|
70
|
+
o$2 = new WeakMap();
|
|
71
|
+
let n$2 = class n {
|
|
72
|
+
constructor(t, e, o) {
|
|
73
|
+
if (this._$cssResult$ = true, o !== s) throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
|
|
74
|
+
this.cssText = t, this.t = e;
|
|
75
|
+
}
|
|
76
|
+
get styleSheet() {
|
|
77
|
+
let t = this.o;
|
|
78
|
+
const s = this.t;
|
|
79
|
+
if (e$3 && void 0 === t) {
|
|
80
|
+
const e = void 0 !== s && 1 === s.length;
|
|
81
|
+
e && (t = o$2.get(s)), void 0 === t && ((this.o = t = new CSSStyleSheet()).replaceSync(this.cssText), e && o$2.set(s, t));
|
|
82
|
+
}
|
|
83
|
+
return t;
|
|
84
|
+
}
|
|
85
|
+
toString() {
|
|
86
|
+
return this.cssText;
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
const r$2 = t => new n$2("string" == typeof t ? t : t + "", void 0, s),
|
|
90
|
+
S = (s, o) => {
|
|
91
|
+
if (e$3) s.adoptedStyleSheets = o.map(t => t instanceof CSSStyleSheet ? t : t.styleSheet);else for (const e of o) {
|
|
92
|
+
const o = document.createElement("style"),
|
|
93
|
+
n = t.litNonce;
|
|
94
|
+
void 0 !== n && o.setAttribute("nonce", n), o.textContent = e.cssText, s.appendChild(o);
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
c$1 = e$3 ? t => t : t => t instanceof CSSStyleSheet ? (t => {
|
|
98
|
+
let e = "";
|
|
99
|
+
for (const s of t.cssRules) e += s.cssText;
|
|
100
|
+
return r$2(e);
|
|
101
|
+
})(t) : t;
|
|
66
102
|
|
|
67
103
|
/**
|
|
68
104
|
* @license
|
|
69
105
|
* Copyright 2017 Google LLC
|
|
70
106
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
71
|
-
*/
|
|
107
|
+
*/
|
|
108
|
+
const {
|
|
109
|
+
is: i,
|
|
110
|
+
defineProperty: e$2,
|
|
111
|
+
getOwnPropertyDescriptor: h,
|
|
112
|
+
getOwnPropertyNames: r$1,
|
|
113
|
+
getOwnPropertySymbols: o$1,
|
|
114
|
+
getPrototypeOf: n$1
|
|
115
|
+
} = Object,
|
|
116
|
+
a = globalThis,
|
|
117
|
+
c = a.trustedTypes,
|
|
118
|
+
l = c ? c.emptyScript : "",
|
|
119
|
+
p = a.reactiveElementPolyfillSupport,
|
|
120
|
+
d = (t, s) => t,
|
|
121
|
+
u = {
|
|
122
|
+
toAttribute(t, s) {
|
|
123
|
+
switch (s) {
|
|
124
|
+
case Boolean:
|
|
125
|
+
t = t ? l : null;
|
|
126
|
+
break;
|
|
127
|
+
case Object:
|
|
128
|
+
case Array:
|
|
129
|
+
t = null == t ? t : JSON.stringify(t);
|
|
130
|
+
}
|
|
131
|
+
return t;
|
|
132
|
+
},
|
|
133
|
+
fromAttribute(t, s) {
|
|
134
|
+
let i = t;
|
|
135
|
+
switch (s) {
|
|
136
|
+
case Boolean:
|
|
137
|
+
i = null !== t;
|
|
138
|
+
break;
|
|
139
|
+
case Number:
|
|
140
|
+
i = null === t ? null : Number(t);
|
|
141
|
+
break;
|
|
142
|
+
case Object:
|
|
143
|
+
case Array:
|
|
144
|
+
try {
|
|
145
|
+
i = JSON.parse(t);
|
|
146
|
+
} catch (t) {
|
|
147
|
+
i = null;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
return i;
|
|
151
|
+
}
|
|
152
|
+
},
|
|
153
|
+
f = (t, s) => !i(t, s),
|
|
154
|
+
b = {
|
|
155
|
+
attribute: true,
|
|
156
|
+
type: String,
|
|
157
|
+
converter: u,
|
|
158
|
+
reflect: false,
|
|
159
|
+
useDefault: false,
|
|
160
|
+
hasChanged: f
|
|
161
|
+
};
|
|
162
|
+
Symbol.metadata ??= Symbol("metadata"), a.litPropertyMetadata ??= new WeakMap();
|
|
163
|
+
class y extends HTMLElement {
|
|
164
|
+
static addInitializer(t) {
|
|
165
|
+
this._$Ei(), (this.l ??= []).push(t);
|
|
166
|
+
}
|
|
167
|
+
static get observedAttributes() {
|
|
168
|
+
return this.finalize(), this._$Eh && [...this._$Eh.keys()];
|
|
169
|
+
}
|
|
170
|
+
static createProperty(t, s = b) {
|
|
171
|
+
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) {
|
|
172
|
+
const i = Symbol(),
|
|
173
|
+
h = this.getPropertyDescriptor(t, i, s);
|
|
174
|
+
void 0 !== h && e$2(this.prototype, t, h);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
static getPropertyDescriptor(t, s, i) {
|
|
178
|
+
const {
|
|
179
|
+
get: e,
|
|
180
|
+
set: r
|
|
181
|
+
} = h(this.prototype, t) ?? {
|
|
182
|
+
get() {
|
|
183
|
+
return this[s];
|
|
184
|
+
},
|
|
185
|
+
set(t) {
|
|
186
|
+
this[s] = t;
|
|
187
|
+
}
|
|
188
|
+
};
|
|
189
|
+
return {
|
|
190
|
+
get: e,
|
|
191
|
+
set(s) {
|
|
192
|
+
const h = e?.call(this);
|
|
193
|
+
r?.call(this, s), this.requestUpdate(t, h, i);
|
|
194
|
+
},
|
|
195
|
+
configurable: true,
|
|
196
|
+
enumerable: true
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
static getPropertyOptions(t) {
|
|
200
|
+
return this.elementProperties.get(t) ?? b;
|
|
201
|
+
}
|
|
202
|
+
static _$Ei() {
|
|
203
|
+
if (this.hasOwnProperty(d("elementProperties"))) return;
|
|
204
|
+
const t = n$1(this);
|
|
205
|
+
t.finalize(), void 0 !== t.l && (this.l = [...t.l]), this.elementProperties = new Map(t.elementProperties);
|
|
206
|
+
}
|
|
207
|
+
static finalize() {
|
|
208
|
+
if (this.hasOwnProperty(d("finalized"))) return;
|
|
209
|
+
if (this.finalized = true, this._$Ei(), this.hasOwnProperty(d("properties"))) {
|
|
210
|
+
const t = this.properties,
|
|
211
|
+
s = [...r$1(t), ...o$1(t)];
|
|
212
|
+
for (const i of s) this.createProperty(i, t[i]);
|
|
213
|
+
}
|
|
214
|
+
const t = this[Symbol.metadata];
|
|
215
|
+
if (null !== t) {
|
|
216
|
+
const s = litPropertyMetadata.get(t);
|
|
217
|
+
if (void 0 !== s) for (const [t, i] of s) this.elementProperties.set(t, i);
|
|
218
|
+
}
|
|
219
|
+
this._$Eh = new Map();
|
|
220
|
+
for (const [t, s] of this.elementProperties) {
|
|
221
|
+
const i = this._$Eu(t, s);
|
|
222
|
+
void 0 !== i && this._$Eh.set(i, t);
|
|
223
|
+
}
|
|
224
|
+
this.elementStyles = this.finalizeStyles(this.styles);
|
|
225
|
+
}
|
|
226
|
+
static finalizeStyles(s) {
|
|
227
|
+
const i = [];
|
|
228
|
+
if (Array.isArray(s)) {
|
|
229
|
+
const e = new Set(s.flat(1 / 0).reverse());
|
|
230
|
+
for (const s of e) i.unshift(c$1(s));
|
|
231
|
+
} else void 0 !== s && i.push(c$1(s));
|
|
232
|
+
return i;
|
|
233
|
+
}
|
|
234
|
+
static _$Eu(t, s) {
|
|
235
|
+
const i = s.attribute;
|
|
236
|
+
return false === i ? void 0 : "string" == typeof i ? i : "string" == typeof t ? t.toLowerCase() : void 0;
|
|
237
|
+
}
|
|
238
|
+
constructor() {
|
|
239
|
+
super(), this._$Ep = void 0, this.isUpdatePending = false, this.hasUpdated = false, this._$Em = null, this._$Ev();
|
|
240
|
+
}
|
|
241
|
+
_$Ev() {
|
|
242
|
+
this._$ES = new Promise(t => this.enableUpdating = t), this._$AL = new Map(), this._$E_(), this.requestUpdate(), this.constructor.l?.forEach(t => t(this));
|
|
243
|
+
}
|
|
244
|
+
addController(t) {
|
|
245
|
+
(this._$EO ??= new Set()).add(t), void 0 !== this.renderRoot && this.isConnected && t.hostConnected?.();
|
|
246
|
+
}
|
|
247
|
+
removeController(t) {
|
|
248
|
+
this._$EO?.delete(t);
|
|
249
|
+
}
|
|
250
|
+
_$E_() {
|
|
251
|
+
const t = new Map(),
|
|
252
|
+
s = this.constructor.elementProperties;
|
|
253
|
+
for (const i of s.keys()) this.hasOwnProperty(i) && (t.set(i, this[i]), delete this[i]);
|
|
254
|
+
t.size > 0 && (this._$Ep = t);
|
|
255
|
+
}
|
|
256
|
+
createRenderRoot() {
|
|
257
|
+
const t = this.shadowRoot ?? this.attachShadow(this.constructor.shadowRootOptions);
|
|
258
|
+
return S(t, this.constructor.elementStyles), t;
|
|
259
|
+
}
|
|
260
|
+
connectedCallback() {
|
|
261
|
+
this.renderRoot ??= this.createRenderRoot(), this.enableUpdating(true), this._$EO?.forEach(t => t.hostConnected?.());
|
|
262
|
+
}
|
|
263
|
+
enableUpdating(t) {}
|
|
264
|
+
disconnectedCallback() {
|
|
265
|
+
this._$EO?.forEach(t => t.hostDisconnected?.());
|
|
266
|
+
}
|
|
267
|
+
attributeChangedCallback(t, s, i) {
|
|
268
|
+
this._$AK(t, i);
|
|
269
|
+
}
|
|
270
|
+
_$ET(t, s) {
|
|
271
|
+
const i = this.constructor.elementProperties.get(t),
|
|
272
|
+
e = this.constructor._$Eu(t, i);
|
|
273
|
+
if (void 0 !== e && true === i.reflect) {
|
|
274
|
+
const h = (void 0 !== i.converter?.toAttribute ? i.converter : u).toAttribute(s, i.type);
|
|
275
|
+
this._$Em = t, null == h ? this.removeAttribute(e) : this.setAttribute(e, h), this._$Em = null;
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
_$AK(t, s) {
|
|
279
|
+
const i = this.constructor,
|
|
280
|
+
e = i._$Eh.get(t);
|
|
281
|
+
if (void 0 !== e && this._$Em !== e) {
|
|
282
|
+
const t = i.getPropertyOptions(e),
|
|
283
|
+
h = "function" == typeof t.converter ? {
|
|
284
|
+
fromAttribute: t.converter
|
|
285
|
+
} : void 0 !== t.converter?.fromAttribute ? t.converter : u;
|
|
286
|
+
this._$Em = e;
|
|
287
|
+
const r = h.fromAttribute(s, t.type);
|
|
288
|
+
this[e] = r ?? this._$Ej?.get(e) ?? r, this._$Em = null;
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
requestUpdate(t, s, i) {
|
|
292
|
+
if (void 0 !== t) {
|
|
293
|
+
const e = this.constructor,
|
|
294
|
+
h = this[t];
|
|
295
|
+
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;
|
|
296
|
+
this.C(t, s, i);
|
|
297
|
+
}
|
|
298
|
+
false === this.isUpdatePending && (this._$ES = this._$EP());
|
|
299
|
+
}
|
|
300
|
+
C(t, s, {
|
|
301
|
+
useDefault: i,
|
|
302
|
+
reflect: e,
|
|
303
|
+
wrapped: h
|
|
304
|
+
}, r) {
|
|
305
|
+
i && !(this._$Ej ??= new Map()).has(t) && (this._$Ej.set(t, r ?? s ?? this[t]), true !== h || void 0 !== r) || (this._$AL.has(t) || (this.hasUpdated || i || (s = void 0), this._$AL.set(t, s)), true === e && this._$Em !== t && (this._$Eq ??= new Set()).add(t));
|
|
306
|
+
}
|
|
307
|
+
async _$EP() {
|
|
308
|
+
this.isUpdatePending = true;
|
|
309
|
+
try {
|
|
310
|
+
await this._$ES;
|
|
311
|
+
} catch (t) {
|
|
312
|
+
Promise.reject(t);
|
|
313
|
+
}
|
|
314
|
+
const t = this.scheduleUpdate();
|
|
315
|
+
return null != t && (await t), !this.isUpdatePending;
|
|
316
|
+
}
|
|
317
|
+
scheduleUpdate() {
|
|
318
|
+
return this.performUpdate();
|
|
319
|
+
}
|
|
320
|
+
performUpdate() {
|
|
321
|
+
if (!this.isUpdatePending) return;
|
|
322
|
+
if (!this.hasUpdated) {
|
|
323
|
+
if (this.renderRoot ??= this.createRenderRoot(), this._$Ep) {
|
|
324
|
+
for (const [t, s] of this._$Ep) this[t] = s;
|
|
325
|
+
this._$Ep = void 0;
|
|
326
|
+
}
|
|
327
|
+
const t = this.constructor.elementProperties;
|
|
328
|
+
if (t.size > 0) for (const [s, i] of t) {
|
|
329
|
+
const {
|
|
330
|
+
wrapped: t
|
|
331
|
+
} = i,
|
|
332
|
+
e = this[s];
|
|
333
|
+
true !== t || this._$AL.has(s) || void 0 === e || this.C(s, void 0, i, e);
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
let t = false;
|
|
337
|
+
const s = this._$AL;
|
|
338
|
+
try {
|
|
339
|
+
t = this.shouldUpdate(s), t ? (this.willUpdate(s), this._$EO?.forEach(t => t.hostUpdate?.()), this.update(s)) : this._$EM();
|
|
340
|
+
} catch (s) {
|
|
341
|
+
throw t = false, this._$EM(), s;
|
|
342
|
+
}
|
|
343
|
+
t && this._$AE(s);
|
|
344
|
+
}
|
|
345
|
+
willUpdate(t) {}
|
|
346
|
+
_$AE(t) {
|
|
347
|
+
this._$EO?.forEach(t => t.hostUpdated?.()), this.hasUpdated || (this.hasUpdated = true, this.firstUpdated(t)), this.updated(t);
|
|
348
|
+
}
|
|
349
|
+
_$EM() {
|
|
350
|
+
this._$AL = new Map(), this.isUpdatePending = false;
|
|
351
|
+
}
|
|
352
|
+
get updateComplete() {
|
|
353
|
+
return this.getUpdateComplete();
|
|
354
|
+
}
|
|
355
|
+
getUpdateComplete() {
|
|
356
|
+
return this._$ES;
|
|
357
|
+
}
|
|
358
|
+
shouldUpdate(t) {
|
|
359
|
+
return true;
|
|
360
|
+
}
|
|
361
|
+
update(t) {
|
|
362
|
+
this._$Eq &&= this._$Eq.forEach(t => this._$ET(t, this[t])), this._$EM();
|
|
363
|
+
}
|
|
364
|
+
updated(t) {}
|
|
365
|
+
firstUpdated(t) {}
|
|
366
|
+
}
|
|
367
|
+
y.elementStyles = [], y.shadowRootOptions = {
|
|
368
|
+
mode: "open"
|
|
369
|
+
}, y[d("elementProperties")] = new Map(), y[d("finalized")] = new Map(), p?.({
|
|
370
|
+
ReactiveElement: y
|
|
371
|
+
}), (a.reactiveElementVersions ??= []).push("2.1.1");
|
|
72
372
|
|
|
73
373
|
/**
|
|
74
374
|
* @license
|
|
75
375
|
* Copyright 2017 Google LLC
|
|
76
376
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
77
|
-
*/
|
|
377
|
+
*/
|
|
378
|
+
const o = {
|
|
379
|
+
attribute: true,
|
|
380
|
+
type: String,
|
|
381
|
+
converter: u,
|
|
382
|
+
reflect: false,
|
|
383
|
+
hasChanged: f
|
|
384
|
+
},
|
|
385
|
+
r = (t = o, e, r) => {
|
|
386
|
+
const {
|
|
387
|
+
kind: n,
|
|
388
|
+
metadata: i
|
|
389
|
+
} = r;
|
|
390
|
+
let s = globalThis.litPropertyMetadata.get(i);
|
|
391
|
+
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) {
|
|
392
|
+
const {
|
|
393
|
+
name: o
|
|
394
|
+
} = r;
|
|
395
|
+
return {
|
|
396
|
+
set(r) {
|
|
397
|
+
const n = e.get.call(this);
|
|
398
|
+
e.set.call(this, r), this.requestUpdate(o, n, t);
|
|
399
|
+
},
|
|
400
|
+
init(e) {
|
|
401
|
+
return void 0 !== e && this.C(o, void 0, t, e), e;
|
|
402
|
+
}
|
|
403
|
+
};
|
|
404
|
+
}
|
|
405
|
+
if ("setter" === n) {
|
|
406
|
+
const {
|
|
407
|
+
name: o
|
|
408
|
+
} = r;
|
|
409
|
+
return function (r) {
|
|
410
|
+
const n = this[o];
|
|
411
|
+
e.call(this, r), this.requestUpdate(o, n, t);
|
|
412
|
+
};
|
|
413
|
+
}
|
|
414
|
+
throw Error("Unsupported decorator location: " + n);
|
|
415
|
+
};
|
|
416
|
+
function n(t) {
|
|
417
|
+
return (e, o) => "object" == typeof o ? r(t, e, o) : ((t, e, o) => {
|
|
418
|
+
const r = e.hasOwnProperty(o);
|
|
419
|
+
return e.constructor.createProperty(o, t), r ? Object.getOwnPropertyDescriptor(e, o) : void 0;
|
|
420
|
+
})(t, e, o);
|
|
421
|
+
}
|
|
78
422
|
|
|
79
423
|
/**
|
|
80
424
|
* @license
|
|
81
425
|
* Copyright 2017 Google LLC
|
|
82
426
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
83
427
|
*/
|
|
84
|
-
const e$1=(e,t,c)=>(c.configurable=true,c.enumerable=true,Reflect.decorate&&"object"!=typeof t&&Object.defineProperty(e,t,c),c);
|
|
428
|
+
const e$1 = (e, t, c) => (c.configurable = true, c.enumerable = true, Reflect.decorate && "object" != typeof t && Object.defineProperty(e, t, c), c);
|
|
85
429
|
|
|
86
430
|
/**
|
|
87
431
|
* @license
|
|
88
432
|
* Copyright 2017 Google LLC
|
|
89
433
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
90
|
-
*/
|
|
434
|
+
*/
|
|
435
|
+
function e(e, r) {
|
|
436
|
+
return (n, s, i) => {
|
|
437
|
+
const o = t => t.renderRoot?.querySelector(e) ?? null;
|
|
438
|
+
return e$1(n, s, {
|
|
439
|
+
get() {
|
|
440
|
+
return o(this);
|
|
441
|
+
}
|
|
442
|
+
});
|
|
443
|
+
};
|
|
444
|
+
}
|
|
91
445
|
|
|
92
446
|
var _M3eOptionElement_instances, _M3eOptionElement_value, _M3eOptionElement_textContent, _M3eOptionElement_handleSlotChange;
|
|
93
447
|
/**
|
|
@@ -131,191 +485,69 @@ var _M3eOptionElement_instances, _M3eOptionElement_value, _M3eOptionElement_text
|
|
|
131
485
|
* @cssprop --m3e-option-icon-size - The size of the option icons.
|
|
132
486
|
*/
|
|
133
487
|
let M3eOptionElement = class M3eOptionElement extends Selected(Disabled(Role(LitElement, "option"))) {
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
/** @inheritdoc */
|
|
180
|
-
render() {
|
|
181
|
-
return html `<div class="base">
|
|
182
|
-
<m3e-state-layer class="state-layer" ?disabled="${this.disabled}"></m3e-state-layer>
|
|
183
|
-
<m3e-focus-ring class="focus-ring" inward ?disabled="${this.disabled}"></m3e-focus-ring>
|
|
184
|
-
<m3e-ripple class="ripple" ?disabled="${this.disabled}"></m3e-ripple>
|
|
185
|
-
<div class="touch" aria-hidden="true"></div>
|
|
186
|
-
<div class="wrapper">
|
|
187
|
-
<m3e-pseudo-checkbox class="leading-icon" ?checked="${this.selected}" ?disabled="${this.disabled}">
|
|
188
|
-
</m3e-pseudo-checkbox>
|
|
189
|
-
<m3e-text-overflow class="label"><slot @slotchange="${__classPrivateFieldGet(this, _M3eOptionElement_instances, "m", _M3eOptionElement_handleSlotChange)}"></slot></m3e-text-overflow>
|
|
190
|
-
<div class="trailing-icon">
|
|
191
|
-
<svg class="check" viewBox="0 -960 960 960" aria-hidden="true">
|
|
192
|
-
<path fill="currentColor" d="M382-240 154-468l57-57 171 171 367-367 57 57-424 424Z" />
|
|
193
|
-
</svg>
|
|
194
|
-
</div>
|
|
195
|
-
</div>
|
|
196
|
-
</div>`;
|
|
488
|
+
constructor() {
|
|
489
|
+
super(...arguments);
|
|
490
|
+
_M3eOptionElement_instances.add(this);
|
|
491
|
+
/** @private */
|
|
492
|
+
_M3eOptionElement_value.set(this, void 0);
|
|
493
|
+
/** @private */
|
|
494
|
+
_M3eOptionElement_textContent.set(this, "");
|
|
495
|
+
}
|
|
496
|
+
/** A string representing the value of the option. */
|
|
497
|
+
get value() {
|
|
498
|
+
return __classPrivateFieldGet(this, _M3eOptionElement_value, "f") ?? __classPrivateFieldGet(this, _M3eOptionElement_textContent, "f");
|
|
499
|
+
}
|
|
500
|
+
set value(value) {
|
|
501
|
+
__classPrivateFieldSet(this, _M3eOptionElement_value, value, "f");
|
|
502
|
+
}
|
|
503
|
+
/** @internal */
|
|
504
|
+
[(_M3eOptionElement_value = new WeakMap(), _M3eOptionElement_textContent = new WeakMap(), _M3eOptionElement_instances = new WeakSet(), typeaheadLabel)]() {
|
|
505
|
+
return __classPrivateFieldGet(this, _M3eOptionElement_textContent, "f");
|
|
506
|
+
}
|
|
507
|
+
/** Whether the option represents an empty option. */
|
|
508
|
+
get isEmpty() {
|
|
509
|
+
return this.value === "";
|
|
510
|
+
}
|
|
511
|
+
/** @inheritdoc */
|
|
512
|
+
connectedCallback() {
|
|
513
|
+
super.connectedCallback();
|
|
514
|
+
[this.focusRing, this.stateLayer, this._ripple].forEach(x => x?.attach(this));
|
|
515
|
+
}
|
|
516
|
+
/** @inheritdoc */
|
|
517
|
+
firstUpdated(_changedProperties) {
|
|
518
|
+
super.firstUpdated(_changedProperties);
|
|
519
|
+
[this.focusRing, this.stateLayer, this._ripple].forEach(x => x?.attach(this));
|
|
520
|
+
}
|
|
521
|
+
/** @inheritdoc */
|
|
522
|
+
update(changedProperties) {
|
|
523
|
+
super.update(changedProperties);
|
|
524
|
+
if (changedProperties.has("selected") && this.selected) {
|
|
525
|
+
const panel = this.closest("[role='listbox']") ?? this.closest("m3e-select");
|
|
526
|
+
if (panel && panel.ariaMultiSelectable !== "true" && !panel.hasAttribute("multi")) {
|
|
527
|
+
panel.querySelectorAll("m3e-option").forEach(x => {
|
|
528
|
+
if (x !== this && x.selected) {
|
|
529
|
+
x.selected = false;
|
|
530
|
+
}
|
|
531
|
+
});
|
|
532
|
+
}
|
|
197
533
|
}
|
|
534
|
+
}
|
|
535
|
+
/** @inheritdoc */
|
|
536
|
+
render() {
|
|
537
|
+
return html`<div class="base"><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><div class="touch" aria-hidden="true"></div><div class="wrapper"><m3e-pseudo-checkbox class="leading-icon" ?checked="${this.selected}" ?disabled="${this.disabled}"></m3e-pseudo-checkbox><m3e-text-overflow class="label"><slot @slotchange="${__classPrivateFieldGet(this, _M3eOptionElement_instances, "m", _M3eOptionElement_handleSlotChange)}"></slot></m3e-text-overflow><div class="trailing-icon"><svg class="check" viewBox="0 -960 960 960" aria-hidden="true"><path fill="currentColor" d="M382-240 154-468l57-57 171 171 367-367 57 57-424 424Z"/></svg></div></div></div>`;
|
|
538
|
+
}
|
|
198
539
|
};
|
|
199
540
|
_M3eOptionElement_handleSlotChange = function _M3eOptionElement_handleSlotChange(e) {
|
|
200
|
-
|
|
201
|
-
|
|
541
|
+
__classPrivateFieldSet(this, _M3eOptionElement_textContent, getTextContent(e.target), "f");
|
|
542
|
+
this.classList.toggle("-empty", this.isEmpty);
|
|
202
543
|
};
|
|
203
544
|
/** The styles of the element. */
|
|
204
|
-
M3eOptionElement.styles = css
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
height: var(--m3e-option-container-height, 3rem);
|
|
211
|
-
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
|
|
212
|
-
}
|
|
213
|
-
:host(:not([aria-disabled="true"])) .base {
|
|
214
|
-
color: var(--m3e-option-color, ${DesignToken.color.onSurface});
|
|
215
|
-
--m3e-state-layer-hover-color: var(--m3e-option-container-hover-color, ${DesignToken.color.onSurface});
|
|
216
|
-
--m3e-state-layer-focus-color: var(--m3e-option-container-focus-color, ${DesignToken.color.onSurface});
|
|
217
|
-
--m3e-ripple-color: var(--m3e-option-ripple-color, ${DesignToken.color.onSurface});
|
|
218
|
-
}
|
|
219
|
-
:host(:not([aria-disabled="true"]):not(.-empty)[selected]) .base {
|
|
220
|
-
color: var(--m3e-option-selected-color, ${DesignToken.color.onSecondaryContainer});
|
|
221
|
-
background-color: var(--m3e-option-selected-container-color, ${DesignToken.color.secondaryContainer});
|
|
222
|
-
--m3e-state-layer-hover-color: var(
|
|
223
|
-
--m3e-option-selected-container-hover-color,
|
|
224
|
-
${DesignToken.color.onSecondaryContainer}
|
|
225
|
-
);
|
|
226
|
-
--m3e-state-layer-focus-color: var(
|
|
227
|
-
--m3e-option-selected-container-focus-color,
|
|
228
|
-
${DesignToken.color.onSecondaryContainer}
|
|
229
|
-
);
|
|
230
|
-
--m3e-ripple-color: var(--m3e-option-selected-ripple-color, ${DesignToken.color.onSecondaryContainer});
|
|
231
|
-
}
|
|
232
|
-
:host(:not([aria-disabled="true"])) {
|
|
233
|
-
cursor: pointer;
|
|
234
|
-
}
|
|
235
|
-
:host([aria-disabled="true"]) .base {
|
|
236
|
-
color: color-mix(
|
|
237
|
-
in srgb,
|
|
238
|
-
var(--m3e-option-disabled-color, ${DesignToken.color.onSurface}) var(--m3e-option-disabled-opacity, 38%),
|
|
239
|
-
transparent
|
|
240
|
-
);
|
|
241
|
-
}
|
|
242
|
-
.base {
|
|
243
|
-
box-sizing: border-box;
|
|
244
|
-
vertical-align: middle;
|
|
245
|
-
display: inline-flex;
|
|
246
|
-
align-items: center;
|
|
247
|
-
position: relative;
|
|
248
|
-
width: 100%;
|
|
249
|
-
height: 100%;
|
|
250
|
-
}
|
|
251
|
-
.touch {
|
|
252
|
-
position: absolute;
|
|
253
|
-
height: 3rem;
|
|
254
|
-
left: 0;
|
|
255
|
-
right: 0;
|
|
256
|
-
}
|
|
257
|
-
.wrapper {
|
|
258
|
-
display: inline-flex;
|
|
259
|
-
align-items: center;
|
|
260
|
-
width: 100%;
|
|
261
|
-
column-gap: var(--m3e-option-icon-label-space, 0.75rem);
|
|
262
|
-
padding-inline-start: var(--_option-padding-start, var(--m3e-option-padding-start, 0.75rem));
|
|
263
|
-
padding-inline-end: var(--m3e-option-padding-end, 0.75rem);
|
|
264
|
-
font-size: var(--m3e-option-label-text-font-size, ${DesignToken.typescale.standard.label.large.fontSize});
|
|
265
|
-
font-weight: var(--m3e-option-label-text-font-weight, ${DesignToken.typescale.standard.label.large.fontWeight});
|
|
266
|
-
line-height: var(--m3e-option-label-text-line-height, ${DesignToken.typescale.standard.label.large.lineHeight});
|
|
267
|
-
letter-spacing: var(--m3e-option-label-text-tracking, ${DesignToken.typescale.standard.label.large.tracking});
|
|
268
|
-
}
|
|
269
|
-
.focus-ring {
|
|
270
|
-
border-radius: var(--m3e-option-focus-ring-shape, ${DesignToken.shape.corner.medium});
|
|
271
|
-
}
|
|
272
|
-
.content {
|
|
273
|
-
flex: 1 1 auto;
|
|
274
|
-
overflow: hidden;
|
|
275
|
-
text-overflow: ellipsis;
|
|
276
|
-
white-space: nowrap;
|
|
277
|
-
}
|
|
278
|
-
::slotted([slot="icon"]),
|
|
279
|
-
::slotted([slot="trailing-icon"]),
|
|
280
|
-
.trailing-icon {
|
|
281
|
-
flex: none;
|
|
282
|
-
width: 1em;
|
|
283
|
-
font-size: var(--m3e-option-icon-size, 1.5rem) !important;
|
|
284
|
-
}
|
|
285
|
-
:host(.-empty) .leading-icon,
|
|
286
|
-
:host(.-empty) .trailing-icon,
|
|
287
|
-
:host(:not(.-multi):not([selected])) .trailing-icon,
|
|
288
|
-
:host(.-multi) .trailing-icon,
|
|
289
|
-
:host(:not(.-multi)) .leading-icon,
|
|
290
|
-
:host(.-hide-selection-indicator) .leading-icon,
|
|
291
|
-
:host(.-hide-selection-indicator) .trailing-icon {
|
|
292
|
-
display: none;
|
|
293
|
-
}
|
|
294
|
-
@media (forced-colors: active) {
|
|
295
|
-
.base {
|
|
296
|
-
background-color: Menu;
|
|
297
|
-
color: MenuText;
|
|
298
|
-
}
|
|
299
|
-
:host([aria-disabled="true"]) .base {
|
|
300
|
-
color: GrayText;
|
|
301
|
-
}
|
|
302
|
-
}
|
|
303
|
-
`;
|
|
304
|
-
__decorate([
|
|
305
|
-
e(".focus-ring")
|
|
306
|
-
], M3eOptionElement.prototype, "focusRing", void 0);
|
|
307
|
-
__decorate([
|
|
308
|
-
e(".state-layer")
|
|
309
|
-
], M3eOptionElement.prototype, "stateLayer", void 0);
|
|
310
|
-
__decorate([
|
|
311
|
-
e(".ripple")
|
|
312
|
-
], M3eOptionElement.prototype, "_ripple", void 0);
|
|
313
|
-
__decorate([
|
|
314
|
-
n()
|
|
315
|
-
], M3eOptionElement.prototype, "value", null);
|
|
316
|
-
M3eOptionElement = __decorate([
|
|
317
|
-
t$1("m3e-option")
|
|
318
|
-
], M3eOptionElement);
|
|
545
|
+
M3eOptionElement.styles = css`:host { display: block; outline: none; user-select: none; flex: none; height: var(--m3e-option-container-height, 3rem); -webkit-tap-highlight-color: rgba(0, 0, 0, 0); } :host(:not([aria-disabled="true"])) .base { color: var(--m3e-option-color, ${DesignToken.color.onSurface}); --m3e-state-layer-hover-color: var(--m3e-option-container-hover-color, ${DesignToken.color.onSurface}); --m3e-state-layer-focus-color: var(--m3e-option-container-focus-color, ${DesignToken.color.onSurface}); --m3e-ripple-color: var(--m3e-option-ripple-color, ${DesignToken.color.onSurface}); } :host(:not([aria-disabled="true"]):not(.-empty)[selected]) .base { color: var(--m3e-option-selected-color, ${DesignToken.color.onSecondaryContainer}); background-color: var(--m3e-option-selected-container-color, ${DesignToken.color.secondaryContainer}); --m3e-state-layer-hover-color: var( --m3e-option-selected-container-hover-color, ${DesignToken.color.onSecondaryContainer} ); --m3e-state-layer-focus-color: var( --m3e-option-selected-container-focus-color, ${DesignToken.color.onSecondaryContainer} ); --m3e-ripple-color: var(--m3e-option-selected-ripple-color, ${DesignToken.color.onSecondaryContainer}); } :host(:not([aria-disabled="true"])) { cursor: pointer; } :host([aria-disabled="true"]) .base { color: color-mix( in srgb, var(--m3e-option-disabled-color, ${DesignToken.color.onSurface}) var(--m3e-option-disabled-opacity, 38%), transparent ); } .base { box-sizing: border-box; vertical-align: middle; display: inline-flex; align-items: center; position: relative; width: 100%; height: 100%; } .touch { position: absolute; height: 3rem; left: 0; right: 0; } .wrapper { display: inline-flex; align-items: center; width: 100%; column-gap: var(--m3e-option-icon-label-space, 0.75rem); padding-inline-start: var(--_option-padding-start, var(--m3e-option-padding-start, 0.75rem)); padding-inline-end: var(--m3e-option-padding-end, 0.75rem); font-size: var(--m3e-option-label-text-font-size, ${DesignToken.typescale.standard.label.large.fontSize}); font-weight: var(--m3e-option-label-text-font-weight, ${DesignToken.typescale.standard.label.large.fontWeight}); line-height: var(--m3e-option-label-text-line-height, ${DesignToken.typescale.standard.label.large.lineHeight}); letter-spacing: var(--m3e-option-label-text-tracking, ${DesignToken.typescale.standard.label.large.tracking}); } .focus-ring { border-radius: var(--m3e-option-focus-ring-shape, ${DesignToken.shape.corner.medium}); } .content { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } ::slotted([slot="icon"]), ::slotted([slot="trailing-icon"]), .trailing-icon { flex: none; width: 1em; font-size: var(--m3e-option-icon-size, 1.5rem) !important; } :host(.-empty) .leading-icon, :host(.-empty) .trailing-icon, :host(:not(.-multi):not([selected])) .trailing-icon, :host(.-multi) .trailing-icon, :host(:not(.-multi)) .leading-icon, :host(.-hide-selection-indicator) .leading-icon, :host(.-hide-selection-indicator) .trailing-icon { display: none; } @media (forced-colors: active) { .base { background-color: Menu; color: MenuText; } :host([aria-disabled="true"]) .base { color: GrayText; } }`;
|
|
546
|
+
__decorate([e(".focus-ring")], M3eOptionElement.prototype, "focusRing", void 0);
|
|
547
|
+
__decorate([e(".state-layer")], M3eOptionElement.prototype, "stateLayer", void 0);
|
|
548
|
+
__decorate([e(".ripple")], M3eOptionElement.prototype, "_ripple", void 0);
|
|
549
|
+
__decorate([n()], M3eOptionElement.prototype, "value", null);
|
|
550
|
+
M3eOptionElement = __decorate([t$1("m3e-option")], M3eOptionElement);
|
|
319
551
|
|
|
320
552
|
var _M3eOptGroupElement_instances, _M3eOptGroupElement_labelId, _M3eOptGroupElement_label, _M3eOptGroupElement_handleLabelSlotChange;
|
|
321
553
|
var M3eOptGroupElement_1;
|
|
@@ -345,61 +577,44 @@ var M3eOptGroupElement_1;
|
|
|
345
577
|
* @cssprop --m3e-option-color - The text color of the group label.
|
|
346
578
|
*/
|
|
347
579
|
let M3eOptGroupElement = M3eOptGroupElement_1 = class M3eOptGroupElement extends Role(LitElement, "group") {
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
}
|
|
580
|
+
constructor() {
|
|
581
|
+
super(...arguments);
|
|
582
|
+
_M3eOptGroupElement_instances.add(this);
|
|
583
|
+
/** @private */
|
|
584
|
+
_M3eOptGroupElement_labelId.set(this, `m3e-optgroup-label-${M3eOptGroupElement_1.__nextId++}`);
|
|
585
|
+
/** @private */
|
|
586
|
+
_M3eOptGroupElement_label.set(this, void 0);
|
|
587
|
+
}
|
|
588
|
+
/** @inheritdoc */
|
|
589
|
+
render() {
|
|
590
|
+
return html`<m3e-text-overflow class="label"><slot name="label" @slotchange="${__classPrivateFieldGet(this, _M3eOptGroupElement_instances, "m", _M3eOptGroupElement_handleLabelSlotChange)}"></slot></m3e-text-overflow><slot></slot>`;
|
|
591
|
+
}
|
|
361
592
|
};
|
|
362
593
|
_M3eOptGroupElement_labelId = new WeakMap();
|
|
363
594
|
_M3eOptGroupElement_label = new WeakMap();
|
|
364
595
|
_M3eOptGroupElement_instances = new WeakSet();
|
|
365
596
|
_M3eOptGroupElement_handleLabelSlotChange = function _M3eOptGroupElement_handleLabelSlotChange(e) {
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
}
|
|
375
|
-
__classPrivateFieldSet(this, _M3eOptGroupElement_label, label, "f");
|
|
376
|
-
if (__classPrivateFieldGet(this, _M3eOptGroupElement_label, "f")) {
|
|
377
|
-
__classPrivateFieldGet(this, _M3eOptGroupElement_label, "f").id = __classPrivateFieldGet(this, _M3eOptGroupElement_label, "f").id || __classPrivateFieldGet(this, _M3eOptGroupElement_labelId, "f");
|
|
378
|
-
addAriaReferencedId(this, "aria-labelledby", __classPrivateFieldGet(this, _M3eOptGroupElement_label, "f").id);
|
|
597
|
+
const label = e.target.assignedElements({
|
|
598
|
+
flatten: true
|
|
599
|
+
})[0] ?? undefined;
|
|
600
|
+
if (label === __classPrivateFieldGet(this, _M3eOptGroupElement_label, "f")) return;
|
|
601
|
+
if (__classPrivateFieldGet(this, _M3eOptGroupElement_label, "f")?.id) {
|
|
602
|
+
removeAriaReferencedId(this, "aria-labelledby", __classPrivateFieldGet(this, _M3eOptGroupElement_label, "f").id);
|
|
603
|
+
if (__classPrivateFieldGet(this, _M3eOptGroupElement_label, "f").id === __classPrivateFieldGet(this, _M3eOptGroupElement_labelId, "f")) {
|
|
604
|
+
__classPrivateFieldGet(this, _M3eOptGroupElement_label, "f").id = "";
|
|
379
605
|
}
|
|
606
|
+
}
|
|
607
|
+
__classPrivateFieldSet(this, _M3eOptGroupElement_label, label, "f");
|
|
608
|
+
if (__classPrivateFieldGet(this, _M3eOptGroupElement_label, "f")) {
|
|
609
|
+
__classPrivateFieldGet(this, _M3eOptGroupElement_label, "f").id = __classPrivateFieldGet(this, _M3eOptGroupElement_label, "f").id || __classPrivateFieldGet(this, _M3eOptGroupElement_labelId, "f");
|
|
610
|
+
addAriaReferencedId(this, "aria-labelledby", __classPrivateFieldGet(this, _M3eOptGroupElement_label, "f").id);
|
|
611
|
+
}
|
|
380
612
|
};
|
|
381
613
|
/** The styles of the element. */
|
|
382
|
-
M3eOptGroupElement.styles = css
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
}
|
|
387
|
-
.label {
|
|
388
|
-
height: var(--m3e-option-height, 3rem);
|
|
389
|
-
font-size: var(--m3e-option-font-size, ${DesignToken.typescale.standard.label.large.fontSize});
|
|
390
|
-
font-weight: var(--m3e-option-font-weight, ${DesignToken.typescale.standard.label.large.fontWeight});
|
|
391
|
-
line-height: var(--m3e-option-line-height, ${DesignToken.typescale.standard.label.large.lineHeight});
|
|
392
|
-
letter-spacing: var(--m3e-option-tracking, ${DesignToken.typescale.standard.label.large.tracking});
|
|
393
|
-
padding-inline-end: var(--m3e-option-padding-end, 0.75rem);
|
|
394
|
-
padding-inline-start: var(--m3e-option-padding-start, 0.75rem);
|
|
395
|
-
color: var(--m3e-option-color, ${DesignToken.color.onSurface});
|
|
396
|
-
flex: none;
|
|
397
|
-
}
|
|
398
|
-
`;
|
|
399
|
-
/** @private */ M3eOptGroupElement.__nextId = 0;
|
|
400
|
-
M3eOptGroupElement = M3eOptGroupElement_1 = __decorate([
|
|
401
|
-
t$1("m3e-optgroup")
|
|
402
|
-
], M3eOptGroupElement);
|
|
614
|
+
M3eOptGroupElement.styles = css`:host { display: block; --_option-padding-start: calc(var(--m3e-option-padding-start, 0.75rem) * 2); } .label { height: var(--m3e-option-height, 3rem); font-size: var(--m3e-option-font-size, ${DesignToken.typescale.standard.label.large.fontSize}); font-weight: var(--m3e-option-font-weight, ${DesignToken.typescale.standard.label.large.fontWeight}); line-height: var(--m3e-option-line-height, ${DesignToken.typescale.standard.label.large.lineHeight}); letter-spacing: var(--m3e-option-tracking, ${DesignToken.typescale.standard.label.large.tracking}); padding-inline-end: var(--m3e-option-padding-end, 0.75rem); padding-inline-start: var(--m3e-option-padding-start, 0.75rem); color: var(--m3e-option-color, ${DesignToken.color.onSurface}); flex: none; }`;
|
|
615
|
+
/** @private */
|
|
616
|
+
M3eOptGroupElement.__nextId = 0;
|
|
617
|
+
M3eOptGroupElement = M3eOptGroupElement_1 = __decorate([t$1("m3e-optgroup")], M3eOptGroupElement);
|
|
403
618
|
|
|
404
619
|
var _M3eOptionPanelElement_instances, _M3eOptionPanelElement_trigger, _M3eOptionPanelElement_anchor, _M3eOptionPanelElement_anchorCleanup, _M3eOptionPanelElement_documentClickHandler, _M3eOptionPanelElement_scrollController, _M3eOptionPanelElement_toggleHandler, _M3eOptionPanelElement_handleDocumentClick;
|
|
405
620
|
var M3eOptionPanelElement_1;
|
|
@@ -428,107 +643,117 @@ var M3eOptionPanelElement_1;
|
|
|
428
643
|
* @cssprop --m3e-option-panel-divider-spacing - Vertical spacing around slotted `m3e-divider` elements.
|
|
429
644
|
*/
|
|
430
645
|
let M3eOptionPanelElement = M3eOptionPanelElement_1 = class M3eOptionPanelElement extends Role(LitElement, "listbox") {
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
646
|
+
constructor() {
|
|
647
|
+
super(...arguments);
|
|
648
|
+
_M3eOptionPanelElement_instances.add(this);
|
|
649
|
+
/** @private */
|
|
650
|
+
_M3eOptionPanelElement_trigger.set(this, void 0);
|
|
651
|
+
/** @private */
|
|
652
|
+
_M3eOptionPanelElement_anchor.set(this, void 0);
|
|
653
|
+
/** @private */
|
|
654
|
+
_M3eOptionPanelElement_anchorCleanup.set(this, void 0);
|
|
655
|
+
/** @private */
|
|
656
|
+
_M3eOptionPanelElement_documentClickHandler.set(this, e => __classPrivateFieldGet(this, _M3eOptionPanelElement_instances, "m", _M3eOptionPanelElement_handleDocumentClick).call(this, e));
|
|
657
|
+
/** @private */
|
|
658
|
+
_M3eOptionPanelElement_scrollController.set(this, new ScrollController(this, {
|
|
659
|
+
target: null,
|
|
660
|
+
callback: () => this.hide(false)
|
|
661
|
+
}));
|
|
662
|
+
/** @private */
|
|
663
|
+
_M3eOptionPanelElement_toggleHandler.set(this, e => {
|
|
664
|
+
if (e.newState === "closed") {
|
|
665
|
+
__classPrivateFieldGet(this, _M3eOptionPanelElement_anchorCleanup, "f")?.call(this);
|
|
666
|
+
__classPrivateFieldSet(this, _M3eOptionPanelElement_anchorCleanup, undefined, "f");
|
|
667
|
+
}
|
|
668
|
+
});
|
|
669
|
+
}
|
|
670
|
+
/** Whether the menu is open. */
|
|
671
|
+
get isOpen() {
|
|
672
|
+
return __classPrivateFieldGet(this, _M3eOptionPanelElement_trigger, "f") !== undefined;
|
|
673
|
+
}
|
|
674
|
+
/** @inheritdoc */
|
|
675
|
+
connectedCallback() {
|
|
676
|
+
super.connectedCallback();
|
|
677
|
+
this.classList.add("-no-animate");
|
|
678
|
+
this.setAttribute("popover", "manual");
|
|
679
|
+
this.addEventListener("toggle", __classPrivateFieldGet(this, _M3eOptionPanelElement_toggleHandler, "f"));
|
|
680
|
+
document.addEventListener("click", __classPrivateFieldGet(this, _M3eOptionPanelElement_documentClickHandler, "f"));
|
|
681
|
+
}
|
|
682
|
+
/** @inheritdoc */
|
|
683
|
+
disconnectedCallback() {
|
|
684
|
+
super.disconnectedCallback();
|
|
685
|
+
this.removeEventListener("toggle", __classPrivateFieldGet(this, _M3eOptionPanelElement_toggleHandler, "f"));
|
|
686
|
+
document.removeEventListener("click", __classPrivateFieldGet(this, _M3eOptionPanelElement_documentClickHandler, "f"));
|
|
687
|
+
}
|
|
688
|
+
/**
|
|
689
|
+
* Opens the menu.
|
|
690
|
+
* @param {HTMLElement} trigger The element that triggered the menu.
|
|
691
|
+
* @param {HTMLElement | undefined} anchor The element used to position the menu.
|
|
692
|
+
* @returns {Promise<void>} A `Promise` that resolves when the menu is opened.
|
|
693
|
+
*/
|
|
694
|
+
async show(trigger, anchor) {
|
|
695
|
+
if (__classPrivateFieldGet(this, _M3eOptionPanelElement_trigger, "f") && __classPrivateFieldGet(this, _M3eOptionPanelElement_trigger, "f") !== trigger) {
|
|
696
|
+
this.hide();
|
|
460
697
|
}
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
698
|
+
__classPrivateFieldSet(this, _M3eOptionPanelElement_anchorCleanup, await positionAnchor(this, anchor ?? trigger, {
|
|
699
|
+
position: "bottom-start",
|
|
700
|
+
inline: true,
|
|
701
|
+
flip: true
|
|
702
|
+
}, (x, y, position) => {
|
|
703
|
+
this.classList.toggle("-top", position.includes("top"));
|
|
704
|
+
this.classList.toggle("-bottom", position.includes("bottom"));
|
|
705
|
+
if (M3eDirectionality.current === "rtl") {
|
|
706
|
+
this.style.right = `${window.innerWidth - x - this.clientWidth}px`;
|
|
707
|
+
this.style.left = "";
|
|
708
|
+
} else {
|
|
709
|
+
this.style.left = `${x}px`;
|
|
710
|
+
this.style.right = "";
|
|
711
|
+
}
|
|
712
|
+
this.style.top = `${y}px`;
|
|
713
|
+
}), "f");
|
|
714
|
+
this.showPopover();
|
|
715
|
+
__classPrivateFieldSet(this, _M3eOptionPanelElement_trigger, trigger, "f");
|
|
716
|
+
__classPrivateFieldGet(this, _M3eOptionPanelElement_trigger, "f").ariaExpanded = "true";
|
|
717
|
+
__classPrivateFieldSet(this, _M3eOptionPanelElement_anchor, anchor, "f");
|
|
718
|
+
__classPrivateFieldGet(this, _M3eOptionPanelElement_scrollController, "f").observe(__classPrivateFieldGet(this, _M3eOptionPanelElement_trigger, "f"));
|
|
719
|
+
}
|
|
720
|
+
/**
|
|
721
|
+
* Hides the menu.
|
|
722
|
+
* @param {boolean} [restoreFocus=false] Whether to restore focus to the menu's trigger.
|
|
723
|
+
*/
|
|
724
|
+
hide(restoreFocus = false) {
|
|
725
|
+
this.hidePopover();
|
|
726
|
+
if (__classPrivateFieldGet(this, _M3eOptionPanelElement_trigger, "f")) {
|
|
727
|
+
__classPrivateFieldGet(this, _M3eOptionPanelElement_trigger, "f").ariaExpanded = "false";
|
|
728
|
+
if (restoreFocus) {
|
|
729
|
+
__classPrivateFieldGet(this, _M3eOptionPanelElement_trigger, "f").focus();
|
|
730
|
+
}
|
|
731
|
+
__classPrivateFieldGet(this, _M3eOptionPanelElement_scrollController, "f").unobserve(__classPrivateFieldGet(this, _M3eOptionPanelElement_trigger, "f"));
|
|
732
|
+
__classPrivateFieldSet(this, _M3eOptionPanelElement_trigger, undefined, "f");
|
|
466
733
|
}
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
inline: true,
|
|
480
|
-
flip: true,
|
|
481
|
-
shift: true,
|
|
482
|
-
}, (x, y, position) => {
|
|
483
|
-
this.classList.toggle("-top", position.includes("top"));
|
|
484
|
-
this.classList.toggle("-bottom", position.includes("bottom"));
|
|
485
|
-
this.style.left = `${x}px`;
|
|
486
|
-
this.style.top = `${y}px`;
|
|
487
|
-
}), "f");
|
|
488
|
-
this.showPopover();
|
|
489
|
-
__classPrivateFieldSet(this, _M3eOptionPanelElement_trigger, trigger, "f");
|
|
490
|
-
__classPrivateFieldGet(this, _M3eOptionPanelElement_trigger, "f").ariaExpanded = "true";
|
|
491
|
-
__classPrivateFieldSet(this, _M3eOptionPanelElement_anchor, anchor, "f");
|
|
492
|
-
__classPrivateFieldGet(this, _M3eOptionPanelElement_scrollController, "f").observe(__classPrivateFieldGet(this, _M3eOptionPanelElement_trigger, "f"));
|
|
493
|
-
}
|
|
494
|
-
/**
|
|
495
|
-
* Hides the menu.
|
|
496
|
-
* @param {boolean} [restoreFocus=false] Whether to restore focus to the menu's trigger.
|
|
497
|
-
*/
|
|
498
|
-
hide(restoreFocus = false) {
|
|
499
|
-
this.hidePopover();
|
|
500
|
-
if (__classPrivateFieldGet(this, _M3eOptionPanelElement_trigger, "f")) {
|
|
501
|
-
__classPrivateFieldGet(this, _M3eOptionPanelElement_trigger, "f").ariaExpanded = "false";
|
|
502
|
-
if (restoreFocus) {
|
|
503
|
-
__classPrivateFieldGet(this, _M3eOptionPanelElement_trigger, "f").focus();
|
|
504
|
-
}
|
|
505
|
-
__classPrivateFieldGet(this, _M3eOptionPanelElement_scrollController, "f").unobserve(__classPrivateFieldGet(this, _M3eOptionPanelElement_trigger, "f"));
|
|
506
|
-
__classPrivateFieldSet(this, _M3eOptionPanelElement_trigger, undefined, "f");
|
|
507
|
-
}
|
|
508
|
-
}
|
|
509
|
-
/**
|
|
510
|
-
* Toggles the menu.
|
|
511
|
-
* @param {HTMLElement} trigger The element that triggered the menu.
|
|
512
|
-
* @param {HTMLElement | undefined} anchor The element used to position the menu.
|
|
513
|
-
* @returns {Promise<void>} A `Promise` that resolves when the menu is opened or closed.
|
|
514
|
-
*/
|
|
515
|
-
async toggle(trigger, anchor) {
|
|
516
|
-
if (__classPrivateFieldGet(this, _M3eOptionPanelElement_trigger, "f")) {
|
|
517
|
-
this.hide();
|
|
518
|
-
}
|
|
519
|
-
else {
|
|
520
|
-
await this.show(trigger, anchor);
|
|
521
|
-
}
|
|
522
|
-
}
|
|
523
|
-
/** @inheritdoc */
|
|
524
|
-
render() {
|
|
525
|
-
return html `<slot></slot>`;
|
|
526
|
-
}
|
|
527
|
-
/** @inheritdoc */
|
|
528
|
-
firstUpdated(_changedProperties) {
|
|
529
|
-
super.firstUpdated(_changedProperties);
|
|
530
|
-
requestAnimationFrame(() => this.classList.remove("-no-animate"));
|
|
734
|
+
}
|
|
735
|
+
/**
|
|
736
|
+
* Toggles the menu.
|
|
737
|
+
* @param {HTMLElement} trigger The element that triggered the menu.
|
|
738
|
+
* @param {HTMLElement | undefined} anchor The element used to position the menu.
|
|
739
|
+
* @returns {Promise<void>} A `Promise` that resolves when the menu is opened or closed.
|
|
740
|
+
*/
|
|
741
|
+
async toggle(trigger, anchor) {
|
|
742
|
+
if (__classPrivateFieldGet(this, _M3eOptionPanelElement_trigger, "f")) {
|
|
743
|
+
this.hide();
|
|
744
|
+
} else {
|
|
745
|
+
await this.show(trigger, anchor);
|
|
531
746
|
}
|
|
747
|
+
}
|
|
748
|
+
/** @inheritdoc */
|
|
749
|
+
render() {
|
|
750
|
+
return html`<slot></slot>`;
|
|
751
|
+
}
|
|
752
|
+
/** @inheritdoc */
|
|
753
|
+
firstUpdated(_changedProperties) {
|
|
754
|
+
super.firstUpdated(_changedProperties);
|
|
755
|
+
requestAnimationFrame(() => this.classList.remove("-no-animate"));
|
|
756
|
+
}
|
|
532
757
|
};
|
|
533
758
|
_M3eOptionPanelElement_trigger = new WeakMap();
|
|
534
759
|
_M3eOptionPanelElement_anchor = new WeakMap();
|
|
@@ -538,78 +763,16 @@ _M3eOptionPanelElement_scrollController = new WeakMap();
|
|
|
538
763
|
_M3eOptionPanelElement_toggleHandler = new WeakMap();
|
|
539
764
|
_M3eOptionPanelElement_instances = new WeakSet();
|
|
540
765
|
_M3eOptionPanelElement_handleDocumentClick = function _M3eOptionPanelElement_handleDocumentClick(e) {
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
766
|
+
if (!e.composedPath().some(x => x instanceof M3eOptionPanelElement_1 || x === __classPrivateFieldGet(this, _M3eOptionPanelElement_trigger, "f") || x === __classPrivateFieldGet(this, _M3eOptionPanelElement_anchor, "f"))) {
|
|
767
|
+
this.hide();
|
|
768
|
+
}
|
|
544
769
|
};
|
|
545
770
|
/** The styles of the element. */
|
|
546
|
-
M3eOptionPanelElement.styles = css `
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
margin: unset;
|
|
552
|
-
border: unset;
|
|
553
|
-
overflow-y: auto;
|
|
554
|
-
scrollbar-width: ${DesignToken.scrollbar.thinWidth};
|
|
555
|
-
scrollbar-color: ${DesignToken.scrollbar.color};
|
|
556
|
-
border-radius: var(--m3e-option-panel-container-shape, ${DesignToken.shape.corner.extraSmall});
|
|
557
|
-
min-width: var(--m3e-option-panel-container-min-width, 7rem);
|
|
558
|
-
max-width: var(--m3e-option-panel-container-max-width, 17.5rem);
|
|
559
|
-
max-height: var(--m3e-option-panel-container-max-height, 17.5rem);
|
|
560
|
-
padding-block: var(--m3e-option-panel-container-padding-block, 0.5rem);
|
|
561
|
-
background-color: var(--m3e-option-panel-container-color, ${DesignToken.color.surfaceContainer});
|
|
562
|
-
box-shadow: var(--m3e-option-panel-container-elevation, ${DesignToken.elevation.level3});
|
|
563
|
-
opacity: 0;
|
|
564
|
-
display: none;
|
|
565
|
-
}
|
|
566
|
-
:host(:not(.-no-animate)) {
|
|
567
|
-
transition: ${unsafeCSS(`opacity ${DesignToken.motion.duration.short2} ${DesignToken.motion.easing.standard},
|
|
568
|
-
transform ${DesignToken.motion.duration.short2} ${DesignToken.motion.easing.standard},
|
|
569
|
-
overlay ${DesignToken.motion.duration.short2} ${DesignToken.motion.easing.standard} allow-discrete,
|
|
570
|
-
display ${DesignToken.motion.duration.short2} ${DesignToken.motion.easing.standard} allow-discrete`)};
|
|
571
|
-
}
|
|
572
|
-
:host {
|
|
573
|
-
transform: scaleY(0.8);
|
|
574
|
-
}
|
|
575
|
-
:host(:popover-open) {
|
|
576
|
-
transform: scaleY(1);
|
|
577
|
-
display: inline-flex;
|
|
578
|
-
opacity: 1;
|
|
579
|
-
}
|
|
580
|
-
:host::backdrop {
|
|
581
|
-
background-color: transparent;
|
|
582
|
-
}
|
|
583
|
-
:host(.-bottom) {
|
|
584
|
-
transform-origin: top;
|
|
585
|
-
}
|
|
586
|
-
:host(.-top) {
|
|
587
|
-
transform-origin: bottom;
|
|
588
|
-
}
|
|
589
|
-
::slotted(m3e-divider) {
|
|
590
|
-
margin-block: var(--m3e-option-panel-divider-spacing, 0.5rem);
|
|
591
|
-
}
|
|
592
|
-
@starting-style {
|
|
593
|
-
:host(:popover-open) {
|
|
594
|
-
transform: scaleY(0.8);
|
|
595
|
-
}
|
|
596
|
-
}
|
|
597
|
-
@media (prefers-reduced-motion) {
|
|
598
|
-
:host(:not(.-no-animate)) {
|
|
599
|
-
transition: none;
|
|
600
|
-
}
|
|
601
|
-
}
|
|
602
|
-
@media (forced-colors: active) {
|
|
603
|
-
:host {
|
|
604
|
-
background-color: Menu;
|
|
605
|
-
color: MenuText;
|
|
606
|
-
border: 1px solid CanvasText;
|
|
607
|
-
}
|
|
608
|
-
}
|
|
609
|
-
`;
|
|
610
|
-
M3eOptionPanelElement = M3eOptionPanelElement_1 = __decorate([
|
|
611
|
-
t$1("m3e-option-panel")
|
|
612
|
-
], M3eOptionPanelElement);
|
|
771
|
+
M3eOptionPanelElement.styles = css`:host { position: absolute; flex-direction: column; padding: unset; margin: unset; border: unset; overflow-y: auto; scrollbar-width: ${DesignToken.scrollbar.thinWidth}; scrollbar-color: ${DesignToken.scrollbar.color}; border-radius: var(--m3e-option-panel-container-shape, ${DesignToken.shape.corner.extraSmall}); min-width: var(--m3e-option-panel-container-min-width, 7rem); max-width: var(--m3e-option-panel-container-max-width, 17.5rem); max-height: var(--m3e-option-panel-container-max-height, 17.5rem); padding-block: var(--m3e-option-panel-container-padding-block, 0.5rem); background-color: var(--m3e-option-panel-container-color, ${DesignToken.color.surfaceContainer}); box-shadow: var(--m3e-option-panel-container-elevation, ${DesignToken.elevation.level3}); opacity: 0; display: none; } :host(:not(.-no-animate)) { transition: ${unsafeCSS(`opacity ${DesignToken.motion.duration.short2} ${DesignToken.motion.easing.standard},
|
|
772
|
+
transform ${DesignToken.motion.duration.short2} ${DesignToken.motion.easing.standard},
|
|
773
|
+
overlay ${DesignToken.motion.duration.short2} ${DesignToken.motion.easing.standard} allow-discrete,
|
|
774
|
+
display ${DesignToken.motion.duration.short2} ${DesignToken.motion.easing.standard} allow-discrete`)}; } :host { transform: scaleY(0.8); } :host(:popover-open) { transform: scaleY(1); display: inline-flex; opacity: 1; } :host::backdrop { background-color: transparent; } :host(.-bottom) { transform-origin: top; } :host(.-top) { transform-origin: bottom; } ::slotted(m3e-divider) { margin-block: var(--m3e-option-panel-divider-spacing, 0.5rem); } @starting-style { :host(:popover-open) { transform: scaleY(0.8); } } @media (prefers-reduced-motion) { :host(:not(.-no-animate)) { transition: none; } } @media (forced-colors: active) { :host { background-color: Menu; color: MenuText; border: 1px solid CanvasText; } }`;
|
|
775
|
+
M3eOptionPanelElement = M3eOptionPanelElement_1 = __decorate([t$1("m3e-option-panel")], M3eOptionPanelElement);
|
|
613
776
|
|
|
614
777
|
export { M3eOptGroupElement, M3eOptionElement, M3eOptionPanelElement };
|
|
615
778
|
//# sourceMappingURL=index.js.map
|