@m3e/tabs 1.0.5 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -2
- package/dist/custom-elements.json +8 -0
- package/dist/index.js +934 -500
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +13 -241
- package/dist/index.min.js.map +1 -1
- package/dist/src/TabsElement.d.ts +2 -0
- package/dist/src/TabsElement.d.ts.map +1 -1
- package/package.json +3 -17
package/dist/index.js
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
import { LitElement, html, css, nothing, unsafeCSS } from 'lit';
|
|
7
7
|
import { Selected, HtmlFor, KeyboardClick, Focusable, Disabled, AttachInternals, Role, DesignToken, ResizeController } from '@m3e/core';
|
|
8
8
|
import { addAriaReferencedId, removeAriaReferencedId, selectionManager, SelectionManager } from '@m3e/core/a11y';
|
|
9
|
+
import { M3eDirectionality } from '@m3e/core/bidi';
|
|
9
10
|
|
|
10
11
|
/******************************************************************************
|
|
11
12
|
Copyright (c) Microsoft Corporation.
|
|
@@ -20,26 +21,30 @@ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
|
20
21
|
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
21
22
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
22
23
|
PERFORMANCE OF THIS SOFTWARE.
|
|
23
|
-
***************************************************************************** */
|
|
24
|
-
/* global Reflect, Promise, SuppressedError, Symbol, Iterator */
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
24
|
+
***************************************************************************** */
|
|
25
|
+
/* global Reflect, Promise, SuppressedError, Symbol, Iterator */
|
|
26
|
+
|
|
27
|
+
function __decorate(decorators, target, key, desc) {
|
|
28
|
+
var c = arguments.length,
|
|
29
|
+
r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,
|
|
30
|
+
d;
|
|
31
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
32
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
33
|
+
}
|
|
34
|
+
function __classPrivateFieldGet(receiver, state, kind, f) {
|
|
35
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
36
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
37
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
38
|
+
}
|
|
39
|
+
function __classPrivateFieldSet(receiver, state, value, kind, f) {
|
|
40
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
41
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
42
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
43
|
+
return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
|
|
44
|
+
}
|
|
45
|
+
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
46
|
+
var e = new Error(message);
|
|
47
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
43
48
|
};
|
|
44
49
|
|
|
45
50
|
/**
|
|
@@ -47,45 +52,408 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
|
|
|
47
52
|
* Copyright 2017 Google LLC
|
|
48
53
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
49
54
|
*/
|
|
50
|
-
const t$
|
|
55
|
+
const t$2 = t => (e, o) => {
|
|
56
|
+
void 0 !== o ? o.addInitializer(() => {
|
|
57
|
+
customElements.define(t, e);
|
|
58
|
+
}) : customElements.define(t, e);
|
|
59
|
+
};
|
|
51
60
|
|
|
52
61
|
/**
|
|
53
62
|
* @license
|
|
54
63
|
* Copyright 2019 Google LLC
|
|
55
64
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
56
65
|
*/
|
|
57
|
-
const t
|
|
66
|
+
const t$1 = globalThis,
|
|
67
|
+
e$4 = t$1.ShadowRoot && (void 0 === t$1.ShadyCSS || t$1.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype,
|
|
68
|
+
s$1 = Symbol(),
|
|
69
|
+
o$4 = new WeakMap();
|
|
70
|
+
let n$3 = class n {
|
|
71
|
+
constructor(t, e, o) {
|
|
72
|
+
if (this._$cssResult$ = true, o !== s$1) throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
|
|
73
|
+
this.cssText = t, this.t = e;
|
|
74
|
+
}
|
|
75
|
+
get styleSheet() {
|
|
76
|
+
let t = this.o;
|
|
77
|
+
const s = this.t;
|
|
78
|
+
if (e$4 && void 0 === t) {
|
|
79
|
+
const e = void 0 !== s && 1 === s.length;
|
|
80
|
+
e && (t = o$4.get(s)), void 0 === t && ((this.o = t = new CSSStyleSheet()).replaceSync(this.cssText), e && o$4.set(s, t));
|
|
81
|
+
}
|
|
82
|
+
return t;
|
|
83
|
+
}
|
|
84
|
+
toString() {
|
|
85
|
+
return this.cssText;
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
const r$4 = t => new n$3("string" == typeof t ? t : t + "", void 0, s$1),
|
|
89
|
+
S$1 = (s, o) => {
|
|
90
|
+
if (e$4) s.adoptedStyleSheets = o.map(t => t instanceof CSSStyleSheet ? t : t.styleSheet);else for (const e of o) {
|
|
91
|
+
const o = document.createElement("style"),
|
|
92
|
+
n = t$1.litNonce;
|
|
93
|
+
void 0 !== n && o.setAttribute("nonce", n), o.textContent = e.cssText, s.appendChild(o);
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
c$2 = e$4 ? t => t : t => t instanceof CSSStyleSheet ? (t => {
|
|
97
|
+
let e = "";
|
|
98
|
+
for (const s of t.cssRules) e += s.cssText;
|
|
99
|
+
return r$4(e);
|
|
100
|
+
})(t) : t;
|
|
58
101
|
|
|
59
102
|
/**
|
|
60
103
|
* @license
|
|
61
104
|
* Copyright 2017 Google LLC
|
|
62
105
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
63
|
-
*/
|
|
106
|
+
*/
|
|
107
|
+
const {
|
|
108
|
+
is: i$1,
|
|
109
|
+
defineProperty: e$3,
|
|
110
|
+
getOwnPropertyDescriptor: h$1,
|
|
111
|
+
getOwnPropertyNames: r$3,
|
|
112
|
+
getOwnPropertySymbols: o$3,
|
|
113
|
+
getPrototypeOf: n$2
|
|
114
|
+
} = Object,
|
|
115
|
+
a$1 = globalThis,
|
|
116
|
+
c$1 = a$1.trustedTypes,
|
|
117
|
+
l$1 = c$1 ? c$1.emptyScript : "",
|
|
118
|
+
p$1 = a$1.reactiveElementPolyfillSupport,
|
|
119
|
+
d$1 = (t, s) => t,
|
|
120
|
+
u$1 = {
|
|
121
|
+
toAttribute(t, s) {
|
|
122
|
+
switch (s) {
|
|
123
|
+
case Boolean:
|
|
124
|
+
t = t ? l$1 : null;
|
|
125
|
+
break;
|
|
126
|
+
case Object:
|
|
127
|
+
case Array:
|
|
128
|
+
t = null == t ? t : JSON.stringify(t);
|
|
129
|
+
}
|
|
130
|
+
return t;
|
|
131
|
+
},
|
|
132
|
+
fromAttribute(t, s) {
|
|
133
|
+
let i = t;
|
|
134
|
+
switch (s) {
|
|
135
|
+
case Boolean:
|
|
136
|
+
i = null !== t;
|
|
137
|
+
break;
|
|
138
|
+
case Number:
|
|
139
|
+
i = null === t ? null : Number(t);
|
|
140
|
+
break;
|
|
141
|
+
case Object:
|
|
142
|
+
case Array:
|
|
143
|
+
try {
|
|
144
|
+
i = JSON.parse(t);
|
|
145
|
+
} catch (t) {
|
|
146
|
+
i = null;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
return i;
|
|
150
|
+
}
|
|
151
|
+
},
|
|
152
|
+
f$1 = (t, s) => !i$1(t, s),
|
|
153
|
+
b = {
|
|
154
|
+
attribute: true,
|
|
155
|
+
type: String,
|
|
156
|
+
converter: u$1,
|
|
157
|
+
reflect: false,
|
|
158
|
+
useDefault: false,
|
|
159
|
+
hasChanged: f$1
|
|
160
|
+
};
|
|
161
|
+
Symbol.metadata ??= Symbol("metadata"), a$1.litPropertyMetadata ??= new WeakMap();
|
|
162
|
+
class y extends HTMLElement {
|
|
163
|
+
static addInitializer(t) {
|
|
164
|
+
this._$Ei(), (this.l ??= []).push(t);
|
|
165
|
+
}
|
|
166
|
+
static get observedAttributes() {
|
|
167
|
+
return this.finalize(), this._$Eh && [...this._$Eh.keys()];
|
|
168
|
+
}
|
|
169
|
+
static createProperty(t, s = b) {
|
|
170
|
+
if (s.state && (s.attribute = false), this._$Ei(), this.prototype.hasOwnProperty(t) && ((s = Object.create(s)).wrapped = true), this.elementProperties.set(t, s), !s.noAccessor) {
|
|
171
|
+
const i = Symbol(),
|
|
172
|
+
h = this.getPropertyDescriptor(t, i, s);
|
|
173
|
+
void 0 !== h && e$3(this.prototype, t, h);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
static getPropertyDescriptor(t, s, i) {
|
|
177
|
+
const {
|
|
178
|
+
get: e,
|
|
179
|
+
set: r
|
|
180
|
+
} = h$1(this.prototype, t) ?? {
|
|
181
|
+
get() {
|
|
182
|
+
return this[s];
|
|
183
|
+
},
|
|
184
|
+
set(t) {
|
|
185
|
+
this[s] = t;
|
|
186
|
+
}
|
|
187
|
+
};
|
|
188
|
+
return {
|
|
189
|
+
get: e,
|
|
190
|
+
set(s) {
|
|
191
|
+
const h = e?.call(this);
|
|
192
|
+
r?.call(this, s), this.requestUpdate(t, h, i);
|
|
193
|
+
},
|
|
194
|
+
configurable: true,
|
|
195
|
+
enumerable: true
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
static getPropertyOptions(t) {
|
|
199
|
+
return this.elementProperties.get(t) ?? b;
|
|
200
|
+
}
|
|
201
|
+
static _$Ei() {
|
|
202
|
+
if (this.hasOwnProperty(d$1("elementProperties"))) return;
|
|
203
|
+
const t = n$2(this);
|
|
204
|
+
t.finalize(), void 0 !== t.l && (this.l = [...t.l]), this.elementProperties = new Map(t.elementProperties);
|
|
205
|
+
}
|
|
206
|
+
static finalize() {
|
|
207
|
+
if (this.hasOwnProperty(d$1("finalized"))) return;
|
|
208
|
+
if (this.finalized = true, this._$Ei(), this.hasOwnProperty(d$1("properties"))) {
|
|
209
|
+
const t = this.properties,
|
|
210
|
+
s = [...r$3(t), ...o$3(t)];
|
|
211
|
+
for (const i of s) this.createProperty(i, t[i]);
|
|
212
|
+
}
|
|
213
|
+
const t = this[Symbol.metadata];
|
|
214
|
+
if (null !== t) {
|
|
215
|
+
const s = litPropertyMetadata.get(t);
|
|
216
|
+
if (void 0 !== s) for (const [t, i] of s) this.elementProperties.set(t, i);
|
|
217
|
+
}
|
|
218
|
+
this._$Eh = new Map();
|
|
219
|
+
for (const [t, s] of this.elementProperties) {
|
|
220
|
+
const i = this._$Eu(t, s);
|
|
221
|
+
void 0 !== i && this._$Eh.set(i, t);
|
|
222
|
+
}
|
|
223
|
+
this.elementStyles = this.finalizeStyles(this.styles);
|
|
224
|
+
}
|
|
225
|
+
static finalizeStyles(s) {
|
|
226
|
+
const i = [];
|
|
227
|
+
if (Array.isArray(s)) {
|
|
228
|
+
const e = new Set(s.flat(1 / 0).reverse());
|
|
229
|
+
for (const s of e) i.unshift(c$2(s));
|
|
230
|
+
} else void 0 !== s && i.push(c$2(s));
|
|
231
|
+
return i;
|
|
232
|
+
}
|
|
233
|
+
static _$Eu(t, s) {
|
|
234
|
+
const i = s.attribute;
|
|
235
|
+
return false === i ? void 0 : "string" == typeof i ? i : "string" == typeof t ? t.toLowerCase() : void 0;
|
|
236
|
+
}
|
|
237
|
+
constructor() {
|
|
238
|
+
super(), this._$Ep = void 0, this.isUpdatePending = false, this.hasUpdated = false, this._$Em = null, this._$Ev();
|
|
239
|
+
}
|
|
240
|
+
_$Ev() {
|
|
241
|
+
this._$ES = new Promise(t => this.enableUpdating = t), this._$AL = new Map(), this._$E_(), this.requestUpdate(), this.constructor.l?.forEach(t => t(this));
|
|
242
|
+
}
|
|
243
|
+
addController(t) {
|
|
244
|
+
(this._$EO ??= new Set()).add(t), void 0 !== this.renderRoot && this.isConnected && t.hostConnected?.();
|
|
245
|
+
}
|
|
246
|
+
removeController(t) {
|
|
247
|
+
this._$EO?.delete(t);
|
|
248
|
+
}
|
|
249
|
+
_$E_() {
|
|
250
|
+
const t = new Map(),
|
|
251
|
+
s = this.constructor.elementProperties;
|
|
252
|
+
for (const i of s.keys()) this.hasOwnProperty(i) && (t.set(i, this[i]), delete this[i]);
|
|
253
|
+
t.size > 0 && (this._$Ep = t);
|
|
254
|
+
}
|
|
255
|
+
createRenderRoot() {
|
|
256
|
+
const t = this.shadowRoot ?? this.attachShadow(this.constructor.shadowRootOptions);
|
|
257
|
+
return S$1(t, this.constructor.elementStyles), t;
|
|
258
|
+
}
|
|
259
|
+
connectedCallback() {
|
|
260
|
+
this.renderRoot ??= this.createRenderRoot(), this.enableUpdating(true), this._$EO?.forEach(t => t.hostConnected?.());
|
|
261
|
+
}
|
|
262
|
+
enableUpdating(t) {}
|
|
263
|
+
disconnectedCallback() {
|
|
264
|
+
this._$EO?.forEach(t => t.hostDisconnected?.());
|
|
265
|
+
}
|
|
266
|
+
attributeChangedCallback(t, s, i) {
|
|
267
|
+
this._$AK(t, i);
|
|
268
|
+
}
|
|
269
|
+
_$ET(t, s) {
|
|
270
|
+
const i = this.constructor.elementProperties.get(t),
|
|
271
|
+
e = this.constructor._$Eu(t, i);
|
|
272
|
+
if (void 0 !== e && true === i.reflect) {
|
|
273
|
+
const h = (void 0 !== i.converter?.toAttribute ? i.converter : u$1).toAttribute(s, i.type);
|
|
274
|
+
this._$Em = t, null == h ? this.removeAttribute(e) : this.setAttribute(e, h), this._$Em = null;
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
_$AK(t, s) {
|
|
278
|
+
const i = this.constructor,
|
|
279
|
+
e = i._$Eh.get(t);
|
|
280
|
+
if (void 0 !== e && this._$Em !== e) {
|
|
281
|
+
const t = i.getPropertyOptions(e),
|
|
282
|
+
h = "function" == typeof t.converter ? {
|
|
283
|
+
fromAttribute: t.converter
|
|
284
|
+
} : void 0 !== t.converter?.fromAttribute ? t.converter : u$1;
|
|
285
|
+
this._$Em = e;
|
|
286
|
+
const r = h.fromAttribute(s, t.type);
|
|
287
|
+
this[e] = r ?? this._$Ej?.get(e) ?? r, this._$Em = null;
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
requestUpdate(t, s, i) {
|
|
291
|
+
if (void 0 !== t) {
|
|
292
|
+
const e = this.constructor,
|
|
293
|
+
h = this[t];
|
|
294
|
+
if (i ??= e.getPropertyOptions(t), !((i.hasChanged ?? f$1)(h, s) || i.useDefault && i.reflect && h === this._$Ej?.get(t) && !this.hasAttribute(e._$Eu(t, i)))) return;
|
|
295
|
+
this.C(t, s, i);
|
|
296
|
+
}
|
|
297
|
+
false === this.isUpdatePending && (this._$ES = this._$EP());
|
|
298
|
+
}
|
|
299
|
+
C(t, s, {
|
|
300
|
+
useDefault: i,
|
|
301
|
+
reflect: e,
|
|
302
|
+
wrapped: h
|
|
303
|
+
}, r) {
|
|
304
|
+
i && !(this._$Ej ??= new Map()).has(t) && (this._$Ej.set(t, r ?? s ?? this[t]), true !== h || void 0 !== r) || (this._$AL.has(t) || (this.hasUpdated || i || (s = void 0), this._$AL.set(t, s)), true === e && this._$Em !== t && (this._$Eq ??= new Set()).add(t));
|
|
305
|
+
}
|
|
306
|
+
async _$EP() {
|
|
307
|
+
this.isUpdatePending = true;
|
|
308
|
+
try {
|
|
309
|
+
await this._$ES;
|
|
310
|
+
} catch (t) {
|
|
311
|
+
Promise.reject(t);
|
|
312
|
+
}
|
|
313
|
+
const t = this.scheduleUpdate();
|
|
314
|
+
return null != t && (await t), !this.isUpdatePending;
|
|
315
|
+
}
|
|
316
|
+
scheduleUpdate() {
|
|
317
|
+
return this.performUpdate();
|
|
318
|
+
}
|
|
319
|
+
performUpdate() {
|
|
320
|
+
if (!this.isUpdatePending) return;
|
|
321
|
+
if (!this.hasUpdated) {
|
|
322
|
+
if (this.renderRoot ??= this.createRenderRoot(), this._$Ep) {
|
|
323
|
+
for (const [t, s] of this._$Ep) this[t] = s;
|
|
324
|
+
this._$Ep = void 0;
|
|
325
|
+
}
|
|
326
|
+
const t = this.constructor.elementProperties;
|
|
327
|
+
if (t.size > 0) for (const [s, i] of t) {
|
|
328
|
+
const {
|
|
329
|
+
wrapped: t
|
|
330
|
+
} = i,
|
|
331
|
+
e = this[s];
|
|
332
|
+
true !== t || this._$AL.has(s) || void 0 === e || this.C(s, void 0, i, e);
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
let t = false;
|
|
336
|
+
const s = this._$AL;
|
|
337
|
+
try {
|
|
338
|
+
t = this.shouldUpdate(s), t ? (this.willUpdate(s), this._$EO?.forEach(t => t.hostUpdate?.()), this.update(s)) : this._$EM();
|
|
339
|
+
} catch (s) {
|
|
340
|
+
throw t = false, this._$EM(), s;
|
|
341
|
+
}
|
|
342
|
+
t && this._$AE(s);
|
|
343
|
+
}
|
|
344
|
+
willUpdate(t) {}
|
|
345
|
+
_$AE(t) {
|
|
346
|
+
this._$EO?.forEach(t => t.hostUpdated?.()), this.hasUpdated || (this.hasUpdated = true, this.firstUpdated(t)), this.updated(t);
|
|
347
|
+
}
|
|
348
|
+
_$EM() {
|
|
349
|
+
this._$AL = new Map(), this.isUpdatePending = false;
|
|
350
|
+
}
|
|
351
|
+
get updateComplete() {
|
|
352
|
+
return this.getUpdateComplete();
|
|
353
|
+
}
|
|
354
|
+
getUpdateComplete() {
|
|
355
|
+
return this._$ES;
|
|
356
|
+
}
|
|
357
|
+
shouldUpdate(t) {
|
|
358
|
+
return true;
|
|
359
|
+
}
|
|
360
|
+
update(t) {
|
|
361
|
+
this._$Eq &&= this._$Eq.forEach(t => this._$ET(t, this[t])), this._$EM();
|
|
362
|
+
}
|
|
363
|
+
updated(t) {}
|
|
364
|
+
firstUpdated(t) {}
|
|
365
|
+
}
|
|
366
|
+
y.elementStyles = [], y.shadowRootOptions = {
|
|
367
|
+
mode: "open"
|
|
368
|
+
}, y[d$1("elementProperties")] = new Map(), y[d$1("finalized")] = new Map(), p$1?.({
|
|
369
|
+
ReactiveElement: y
|
|
370
|
+
}), (a$1.reactiveElementVersions ??= []).push("2.1.1");
|
|
64
371
|
|
|
65
372
|
/**
|
|
66
373
|
* @license
|
|
67
374
|
* Copyright 2017 Google LLC
|
|
68
375
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
69
|
-
*/
|
|
376
|
+
*/
|
|
377
|
+
const o$2 = {
|
|
378
|
+
attribute: true,
|
|
379
|
+
type: String,
|
|
380
|
+
converter: u$1,
|
|
381
|
+
reflect: false,
|
|
382
|
+
hasChanged: f$1
|
|
383
|
+
},
|
|
384
|
+
r$2 = (t = o$2, e, r) => {
|
|
385
|
+
const {
|
|
386
|
+
kind: n,
|
|
387
|
+
metadata: i
|
|
388
|
+
} = r;
|
|
389
|
+
let s = globalThis.litPropertyMetadata.get(i);
|
|
390
|
+
if (void 0 === s && globalThis.litPropertyMetadata.set(i, s = new Map()), "setter" === n && ((t = Object.create(t)).wrapped = true), s.set(r.name, t), "accessor" === n) {
|
|
391
|
+
const {
|
|
392
|
+
name: o
|
|
393
|
+
} = r;
|
|
394
|
+
return {
|
|
395
|
+
set(r) {
|
|
396
|
+
const n = e.get.call(this);
|
|
397
|
+
e.set.call(this, r), this.requestUpdate(o, n, t);
|
|
398
|
+
},
|
|
399
|
+
init(e) {
|
|
400
|
+
return void 0 !== e && this.C(o, void 0, t, e), e;
|
|
401
|
+
}
|
|
402
|
+
};
|
|
403
|
+
}
|
|
404
|
+
if ("setter" === n) {
|
|
405
|
+
const {
|
|
406
|
+
name: o
|
|
407
|
+
} = r;
|
|
408
|
+
return function (r) {
|
|
409
|
+
const n = this[o];
|
|
410
|
+
e.call(this, r), this.requestUpdate(o, n, t);
|
|
411
|
+
};
|
|
412
|
+
}
|
|
413
|
+
throw Error("Unsupported decorator location: " + n);
|
|
414
|
+
};
|
|
415
|
+
function n$1(t) {
|
|
416
|
+
return (e, o) => "object" == typeof o ? r$2(t, e, o) : ((t, e, o) => {
|
|
417
|
+
const r = e.hasOwnProperty(o);
|
|
418
|
+
return e.constructor.createProperty(o, t), r ? Object.getOwnPropertyDescriptor(e, o) : void 0;
|
|
419
|
+
})(t, e, o);
|
|
420
|
+
}
|
|
70
421
|
|
|
71
422
|
/**
|
|
72
423
|
* @license
|
|
73
424
|
* Copyright 2017 Google LLC
|
|
74
425
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
75
|
-
*/
|
|
426
|
+
*/
|
|
427
|
+
function r$1(r) {
|
|
428
|
+
return n$1({
|
|
429
|
+
...r,
|
|
430
|
+
state: true,
|
|
431
|
+
attribute: false
|
|
432
|
+
});
|
|
433
|
+
}
|
|
76
434
|
|
|
77
435
|
/**
|
|
78
436
|
* @license
|
|
79
437
|
* Copyright 2017 Google LLC
|
|
80
438
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
81
439
|
*/
|
|
82
|
-
const e$
|
|
440
|
+
const e$2 = (e, t, c) => (c.configurable = true, c.enumerable = true, Reflect.decorate && "object" != typeof t && Object.defineProperty(e, t, c), c);
|
|
83
441
|
|
|
84
442
|
/**
|
|
85
443
|
* @license
|
|
86
444
|
* Copyright 2017 Google LLC
|
|
87
445
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
88
|
-
*/
|
|
446
|
+
*/
|
|
447
|
+
function e$1(e, r) {
|
|
448
|
+
return (n, s, i) => {
|
|
449
|
+
const o = t => t.renderRoot?.querySelector(e) ?? null;
|
|
450
|
+
return e$2(n, s, {
|
|
451
|
+
get() {
|
|
452
|
+
return o(this);
|
|
453
|
+
}
|
|
454
|
+
});
|
|
455
|
+
};
|
|
456
|
+
}
|
|
89
457
|
|
|
90
458
|
var _M3eTabElement_instances, _M3eTabElement_clickHandler, _M3eTabElement_handleClick;
|
|
91
459
|
var M3eTabElement_1;
|
|
@@ -146,178 +514,83 @@ var M3eTabElement_1;
|
|
|
146
514
|
* @cssprop --m3e-tab-icon-size - Font size for slotted icon.
|
|
147
515
|
*/
|
|
148
516
|
let M3eTabElement = M3eTabElement_1 = class M3eTabElement extends Selected(HtmlFor(KeyboardClick(Focusable(Disabled(AttachInternals(Role(LitElement, "tab"), true)))))) {
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
517
|
+
constructor() {
|
|
518
|
+
super(...arguments);
|
|
519
|
+
_M3eTabElement_instances.add(this);
|
|
520
|
+
/** @private */
|
|
521
|
+
_M3eTabElement_clickHandler.set(this, e => __classPrivateFieldGet(this, _M3eTabElement_instances, "m", _M3eTabElement_handleClick).call(this, e));
|
|
522
|
+
}
|
|
523
|
+
/** @inheritdoc */
|
|
524
|
+
attach(control) {
|
|
525
|
+
super.attach(control);
|
|
526
|
+
control.id = control.id || `m3e-tab-panel-${M3eTabElement_1.__nextId++}`;
|
|
527
|
+
addAriaReferencedId(this, "aria-controls", control.id);
|
|
528
|
+
}
|
|
529
|
+
/** @inheritdoc */
|
|
530
|
+
detach() {
|
|
531
|
+
if (this.control && this.control.id) {
|
|
532
|
+
removeAriaReferencedId(this, "aria-controls", this.control.id);
|
|
153
533
|
}
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
}
|
|
177
|
-
/** @inheritdoc */
|
|
178
|
-
firstUpdated(_changedProperties) {
|
|
179
|
-
super.firstUpdated(_changedProperties);
|
|
180
|
-
[this._focusRing, this._stateLayer, this._ripple].forEach((x) => x?.attach(this));
|
|
181
|
-
}
|
|
182
|
-
/** @inheritdoc */
|
|
183
|
-
update(changedProperties) {
|
|
184
|
-
super.update(changedProperties);
|
|
185
|
-
if (changedProperties.has("selected")) {
|
|
186
|
-
this.closest("m3e-tabs")?.[selectionManager].notifySelectionChange(this);
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
/** @inheritdoc */
|
|
190
|
-
render() {
|
|
191
|
-
return html `<div class="base">
|
|
192
|
-
<m3e-state-layer class="state-layer" ?disabled="${this.disabled}"></m3e-state-layer>
|
|
193
|
-
<m3e-focus-ring class="focus-ring" inward ?disabled="${this.disabled}"></m3e-focus-ring>
|
|
194
|
-
<m3e-ripple class="ripple" ?disabled="${this.disabled}"></m3e-ripple>
|
|
195
|
-
<div class="touch" aria-hidden="true"></div>
|
|
196
|
-
<div class="wrapper">
|
|
197
|
-
<slot name="icon" aria-hidden="true"></slot><span class="label"><slot></slot></span>
|
|
198
|
-
</div>
|
|
199
|
-
</div>`;
|
|
534
|
+
super.detach();
|
|
535
|
+
}
|
|
536
|
+
/** @inheritdoc */
|
|
537
|
+
connectedCallback() {
|
|
538
|
+
super.connectedCallback();
|
|
539
|
+
this.addEventListener("click", __classPrivateFieldGet(this, _M3eTabElement_clickHandler, "f"));
|
|
540
|
+
}
|
|
541
|
+
/** @inheritdoc */
|
|
542
|
+
disconnectedCallback() {
|
|
543
|
+
super.disconnectedCallback();
|
|
544
|
+
this.removeEventListener("click", __classPrivateFieldGet(this, _M3eTabElement_clickHandler, "f"));
|
|
545
|
+
}
|
|
546
|
+
/** @inheritdoc */
|
|
547
|
+
firstUpdated(_changedProperties) {
|
|
548
|
+
super.firstUpdated(_changedProperties);
|
|
549
|
+
[this._focusRing, this._stateLayer, this._ripple].forEach(x => x?.attach(this));
|
|
550
|
+
}
|
|
551
|
+
/** @inheritdoc */
|
|
552
|
+
update(changedProperties) {
|
|
553
|
+
super.update(changedProperties);
|
|
554
|
+
if (changedProperties.has("selected")) {
|
|
555
|
+
this.closest("m3e-tabs")?.[selectionManager].notifySelectionChange(this);
|
|
200
556
|
}
|
|
557
|
+
}
|
|
558
|
+
/** @inheritdoc */
|
|
559
|
+
render() {
|
|
560
|
+
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"><slot name="icon" aria-hidden="true"></slot><span class="label"><slot></slot></span></div></div>`;
|
|
561
|
+
}
|
|
201
562
|
};
|
|
202
563
|
_M3eTabElement_clickHandler = new WeakMap();
|
|
203
564
|
_M3eTabElement_instances = new WeakSet();
|
|
204
565
|
_M3eTabElement_handleClick = function _M3eTabElement_handleClick(e) {
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
566
|
+
if (this.disabled) {
|
|
567
|
+
e.preventDefault();
|
|
568
|
+
e.stopImmediatePropagation();
|
|
569
|
+
}
|
|
570
|
+
if (e.defaultPrevented || this.selected) return;
|
|
571
|
+
this.selected = true;
|
|
572
|
+
if (this.dispatchEvent(new Event("input", {
|
|
573
|
+
bubbles: true,
|
|
574
|
+
composed: true,
|
|
575
|
+
cancelable: true
|
|
576
|
+
}))) {
|
|
577
|
+
this.closest("m3e-tabs")?.[selectionManager].notifySelectionChange(this);
|
|
578
|
+
this.dispatchEvent(new Event("change", {
|
|
579
|
+
bubbles: true
|
|
580
|
+
}));
|
|
581
|
+
} else {
|
|
582
|
+
this.selected = false;
|
|
583
|
+
}
|
|
219
584
|
};
|
|
220
585
|
/** The styles of the element. */
|
|
221
|
-
M3eTabElement.styles = css
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
line-height: var(--m3e-tab-line-height, ${DesignToken.typescale.standard.title.small.lineHeight});
|
|
230
|
-
letter-spacing: var(--m3e-tab-tracking, ${DesignToken.typescale.standard.title.small.tracking});
|
|
231
|
-
flex-grow: var(--_tab-grow);
|
|
232
|
-
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
|
|
233
|
-
}
|
|
234
|
-
:host(:not(:disabled)) {
|
|
235
|
-
cursor: pointer;
|
|
236
|
-
}
|
|
237
|
-
.base {
|
|
238
|
-
box-sizing: border-box;
|
|
239
|
-
vertical-align: middle;
|
|
240
|
-
display: inline-flex;
|
|
241
|
-
align-items: center;
|
|
242
|
-
justify-content: center;
|
|
243
|
-
position: relative;
|
|
244
|
-
width: 100%;
|
|
245
|
-
height: 100%;
|
|
246
|
-
padding-inline-start: var(--m3e-tab-padding-start, 1.5rem);
|
|
247
|
-
padding-inline-end: var(--m3e-tab-padding-end, 1.5rem);
|
|
248
|
-
}
|
|
249
|
-
.touch {
|
|
250
|
-
position: absolute;
|
|
251
|
-
height: 3rem;
|
|
252
|
-
left: 0;
|
|
253
|
-
right: 0;
|
|
254
|
-
}
|
|
255
|
-
.focus-ring {
|
|
256
|
-
border-radius: var(--m3e-tab-focus-ring-shape, ${DesignToken.shape.corner.large});
|
|
257
|
-
}
|
|
258
|
-
:host([selected]:focus-within) .focus-ring {
|
|
259
|
-
top: var(--_tab-focus-ring-top-offset, 0);
|
|
260
|
-
bottom: var(--_tab-focus-ring-bottom-offset, 0);
|
|
261
|
-
}
|
|
262
|
-
:host([selected]:not(:disabled)) .base {
|
|
263
|
-
color: var(--m3e-tab-selected-color, ${DesignToken.color.primary});
|
|
264
|
-
--m3e-state-layer-hover-color: var(--m3e-tab-selected-container-hover-color, ${DesignToken.color.primary});
|
|
265
|
-
--m3e-state-layer-focus-color: var(--m3e-tab-selected-container-focus-color, ${DesignToken.color.primary});
|
|
266
|
-
--m3e-ripple-color: var(--m3e-tab-selected-ripple-color, ${DesignToken.color.primary});
|
|
267
|
-
}
|
|
268
|
-
:host(:not([selected]):not(:disabled)) .base {
|
|
269
|
-
color: var(--m3e-tab-unselected-color, ${DesignToken.color.onSurface});
|
|
270
|
-
--m3e-state-layer-hover-color: var(--m3e-tab-unselected-container-hover-color, ${DesignToken.color.onSurface});
|
|
271
|
-
--m3e-state-layer-focus-color: var(--m3e-tab-unselected-container-focus-color, ${DesignToken.color.onSurface});
|
|
272
|
-
--m3e-ripple-color: var(--m3e-tab-unselected-ripple-color, ${DesignToken.color.onSurface});
|
|
273
|
-
}
|
|
274
|
-
:host(:disabled) .base {
|
|
275
|
-
color: color-mix(
|
|
276
|
-
in srgb,
|
|
277
|
-
var(--m3e-tab-disabled-color, ${DesignToken.color.onSurface}) var(--m3e-tab-disabled-opacity, 38%),
|
|
278
|
-
transparent
|
|
279
|
-
);
|
|
280
|
-
}
|
|
281
|
-
.wrapper {
|
|
282
|
-
display: inline-flex;
|
|
283
|
-
align-items: center;
|
|
284
|
-
white-space: nowrap;
|
|
285
|
-
flex-direction: var(--_tab-direction);
|
|
286
|
-
justify-content: center;
|
|
287
|
-
column-gap: var(--m3e-tab-spacing, 0.5rem);
|
|
288
|
-
}
|
|
289
|
-
::slotted([slot="icon"]) {
|
|
290
|
-
width: 1em;
|
|
291
|
-
font-size: var(--m3e-tab-icon-size, 1.5rem) !important;
|
|
292
|
-
}
|
|
293
|
-
@media (forced-colors: active) {
|
|
294
|
-
:host([selected]:not(:disabled)) .base {
|
|
295
|
-
color: ButtonText;
|
|
296
|
-
}
|
|
297
|
-
:host(:not([selected]):not(:disabled)) .base {
|
|
298
|
-
color: ButtonText;
|
|
299
|
-
}
|
|
300
|
-
:host(:disabled) .base {
|
|
301
|
-
color: GrayText;
|
|
302
|
-
}
|
|
303
|
-
}
|
|
304
|
-
`;
|
|
305
|
-
/** @private */ M3eTabElement.__nextId = 0;
|
|
306
|
-
__decorate([
|
|
307
|
-
e(".focus-ring")
|
|
308
|
-
], M3eTabElement.prototype, "_focusRing", void 0);
|
|
309
|
-
__decorate([
|
|
310
|
-
e(".state-layer")
|
|
311
|
-
], M3eTabElement.prototype, "_stateLayer", void 0);
|
|
312
|
-
__decorate([
|
|
313
|
-
e(".ripple")
|
|
314
|
-
], M3eTabElement.prototype, "_ripple", void 0);
|
|
315
|
-
__decorate([
|
|
316
|
-
e(".label")
|
|
317
|
-
], M3eTabElement.prototype, "label", void 0);
|
|
318
|
-
M3eTabElement = M3eTabElement_1 = __decorate([
|
|
319
|
-
t$1("m3e-tab")
|
|
320
|
-
], M3eTabElement);
|
|
586
|
+
M3eTabElement.styles = css`:host { display: inline-block; outline: none; user-select: none; height: calc(var(--_tab-height) + ${DesignToken.density.calc(-3)}); font-size: var(--m3e-tab-font-size, ${DesignToken.typescale.standard.title.small.fontSize}); font-weight: var(--m3e-tab-font-weight, ${DesignToken.typescale.standard.title.small.fontWeight}); line-height: var(--m3e-tab-line-height, ${DesignToken.typescale.standard.title.small.lineHeight}); letter-spacing: var(--m3e-tab-tracking, ${DesignToken.typescale.standard.title.small.tracking}); flex-grow: var(--_tab-grow); -webkit-tap-highlight-color: rgba(0, 0, 0, 0); } :host(:not(:disabled)) { cursor: pointer; } .base { box-sizing: border-box; vertical-align: middle; display: inline-flex; align-items: center; justify-content: center; position: relative; width: 100%; height: 100%; padding-inline-start: var(--m3e-tab-padding-start, 1.5rem); padding-inline-end: var(--m3e-tab-padding-end, 1.5rem); } .touch { position: absolute; height: 3rem; left: 0; right: 0; } .focus-ring { border-radius: var(--m3e-tab-focus-ring-shape, ${DesignToken.shape.corner.large}); } :host([selected]:focus-within) .focus-ring { top: var(--_tab-focus-ring-top-offset, 0); bottom: var(--_tab-focus-ring-bottom-offset, 0); } :host([selected]:not(:disabled)) .base { color: var(--m3e-tab-selected-color, ${DesignToken.color.primary}); --m3e-state-layer-hover-color: var(--m3e-tab-selected-container-hover-color, ${DesignToken.color.primary}); --m3e-state-layer-focus-color: var(--m3e-tab-selected-container-focus-color, ${DesignToken.color.primary}); --m3e-ripple-color: var(--m3e-tab-selected-ripple-color, ${DesignToken.color.primary}); } :host(:not([selected]):not(:disabled)) .base { color: var(--m3e-tab-unselected-color, ${DesignToken.color.onSurface}); --m3e-state-layer-hover-color: var(--m3e-tab-unselected-container-hover-color, ${DesignToken.color.onSurface}); --m3e-state-layer-focus-color: var(--m3e-tab-unselected-container-focus-color, ${DesignToken.color.onSurface}); --m3e-ripple-color: var(--m3e-tab-unselected-ripple-color, ${DesignToken.color.onSurface}); } :host(:disabled) .base { color: color-mix( in srgb, var(--m3e-tab-disabled-color, ${DesignToken.color.onSurface}) var(--m3e-tab-disabled-opacity, 38%), transparent ); } .wrapper { display: inline-flex; align-items: center; white-space: nowrap; flex-direction: var(--_tab-direction); justify-content: center; column-gap: var(--m3e-tab-spacing, 0.5rem); } ::slotted([slot="icon"]) { width: 1em; font-size: var(--m3e-tab-icon-size, 1.5rem) !important; } @media (forced-colors: active) { :host([selected]:not(:disabled)) .base { color: ButtonText; } :host(:not([selected]):not(:disabled)) .base { color: ButtonText; } :host(:disabled) .base { color: GrayText; } }`;
|
|
587
|
+
/** @private */
|
|
588
|
+
M3eTabElement.__nextId = 0;
|
|
589
|
+
__decorate([e$1(".focus-ring")], M3eTabElement.prototype, "_focusRing", void 0);
|
|
590
|
+
__decorate([e$1(".state-layer")], M3eTabElement.prototype, "_stateLayer", void 0);
|
|
591
|
+
__decorate([e$1(".ripple")], M3eTabElement.prototype, "_ripple", void 0);
|
|
592
|
+
__decorate([e$1(".label")], M3eTabElement.prototype, "label", void 0);
|
|
593
|
+
M3eTabElement = M3eTabElement_1 = __decorate([t$2("m3e-tab")], M3eTabElement);
|
|
321
594
|
|
|
322
595
|
/**
|
|
323
596
|
* A panel presented for a tab.
|
|
@@ -348,30 +621,320 @@ M3eTabElement = M3eTabElement_1 = __decorate([
|
|
|
348
621
|
* @slot - Renders the content of the panel.
|
|
349
622
|
*/
|
|
350
623
|
let M3eTabPanelElement = class M3eTabPanelElement extends Role(LitElement, "tabpanel") {
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
624
|
+
/** @inheritdoc */
|
|
625
|
+
connectedCallback() {
|
|
626
|
+
super.connectedCallback();
|
|
627
|
+
this.slot = "panel";
|
|
628
|
+
}
|
|
629
|
+
/** @inheritdoc */
|
|
630
|
+
render() {
|
|
631
|
+
return html`<slot></slot>`;
|
|
632
|
+
}
|
|
360
633
|
};
|
|
361
634
|
/** The styles of the element. */
|
|
362
|
-
M3eTabPanelElement.styles = css
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
635
|
+
M3eTabPanelElement.styles = css`:host { display: block; overflow-y: auto; scrollbar-width: ${DesignToken.scrollbar.width}; scrollbar-color: ${DesignToken.scrollbar.color}; }`;
|
|
636
|
+
M3eTabPanelElement = __decorate([t$2("m3e-tab-panel")], M3eTabPanelElement);
|
|
637
|
+
|
|
638
|
+
/**
|
|
639
|
+
* @license
|
|
640
|
+
* Copyright 2017 Google LLC
|
|
641
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
642
|
+
*/
|
|
643
|
+
const t = globalThis,
|
|
644
|
+
i = t.trustedTypes,
|
|
645
|
+
s = i ? i.createPolicy("lit-html", {
|
|
646
|
+
createHTML: t => t
|
|
647
|
+
}) : void 0,
|
|
648
|
+
e = "$lit$",
|
|
649
|
+
h = `lit$${Math.random().toFixed(9).slice(2)}$`,
|
|
650
|
+
o$1 = "?" + h,
|
|
651
|
+
n = `<${o$1}>`,
|
|
652
|
+
r = document,
|
|
653
|
+
l = () => r.createComment(""),
|
|
654
|
+
c = t => null === t || "object" != typeof t && "function" != typeof t,
|
|
655
|
+
a = Array.isArray,
|
|
656
|
+
u = t => a(t) || "function" == typeof t?.[Symbol.iterator],
|
|
657
|
+
d = "[ \t\n\f\r]",
|
|
658
|
+
f = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,
|
|
659
|
+
v = /-->/g,
|
|
660
|
+
_ = />/g,
|
|
661
|
+
m = RegExp(`>|${d}(?:([^\\s"'>=/]+)(${d}*=${d}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`, "g"),
|
|
662
|
+
p = /'/g,
|
|
663
|
+
g = /"/g,
|
|
664
|
+
$ = /^(?:script|style|textarea|title)$/i,
|
|
665
|
+
T = Symbol.for("lit-noChange"),
|
|
666
|
+
E = Symbol.for("lit-nothing"),
|
|
667
|
+
A = new WeakMap(),
|
|
668
|
+
C = r.createTreeWalker(r, 129);
|
|
669
|
+
function P(t, i) {
|
|
670
|
+
if (!a(t) || !t.hasOwnProperty("raw")) throw Error("invalid template strings array");
|
|
671
|
+
return void 0 !== s ? s.createHTML(i) : i;
|
|
672
|
+
}
|
|
673
|
+
const V = (t, i) => {
|
|
674
|
+
const s = t.length - 1,
|
|
675
|
+
o = [];
|
|
676
|
+
let r,
|
|
677
|
+
l = 2 === i ? "<svg>" : 3 === i ? "<math>" : "",
|
|
678
|
+
c = f;
|
|
679
|
+
for (let i = 0; i < s; i++) {
|
|
680
|
+
const s = t[i];
|
|
681
|
+
let a,
|
|
682
|
+
u,
|
|
683
|
+
d = -1,
|
|
684
|
+
y = 0;
|
|
685
|
+
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);
|
|
686
|
+
const x = c === m && t[i + 1].startsWith("/>") ? " " : "";
|
|
687
|
+
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);
|
|
688
|
+
}
|
|
689
|
+
return [P(t, l + (t[s] || "<?>") + (2 === i ? "</svg>" : 3 === i ? "</math>" : "")), o];
|
|
690
|
+
};
|
|
691
|
+
class N {
|
|
692
|
+
constructor({
|
|
693
|
+
strings: t,
|
|
694
|
+
_$litType$: s
|
|
695
|
+
}, n) {
|
|
696
|
+
let r;
|
|
697
|
+
this.parts = [];
|
|
698
|
+
let c = 0,
|
|
699
|
+
a = 0;
|
|
700
|
+
const u = t.length - 1,
|
|
701
|
+
d = this.parts,
|
|
702
|
+
[f, v] = V(t, s);
|
|
703
|
+
if (this.el = N.createElement(f, n), C.currentNode = this.el.content, 2 === s || 3 === s) {
|
|
704
|
+
const t = this.el.content.firstChild;
|
|
705
|
+
t.replaceWith(...t.childNodes);
|
|
706
|
+
}
|
|
707
|
+
for (; null !== (r = C.nextNode()) && d.length < u;) {
|
|
708
|
+
if (1 === r.nodeType) {
|
|
709
|
+
if (r.hasAttributes()) for (const t of r.getAttributeNames()) if (t.endsWith(e)) {
|
|
710
|
+
const i = v[a++],
|
|
711
|
+
s = r.getAttribute(t).split(h),
|
|
712
|
+
e = /([.?@])?(.*)/.exec(i);
|
|
713
|
+
d.push({
|
|
714
|
+
type: 1,
|
|
715
|
+
index: c,
|
|
716
|
+
name: e[2],
|
|
717
|
+
strings: s,
|
|
718
|
+
ctor: "." === e[1] ? H : "?" === e[1] ? I : "@" === e[1] ? L : k
|
|
719
|
+
}), r.removeAttribute(t);
|
|
720
|
+
} else t.startsWith(h) && (d.push({
|
|
721
|
+
type: 6,
|
|
722
|
+
index: c
|
|
723
|
+
}), r.removeAttribute(t));
|
|
724
|
+
if ($.test(r.tagName)) {
|
|
725
|
+
const t = r.textContent.split(h),
|
|
726
|
+
s = t.length - 1;
|
|
727
|
+
if (s > 0) {
|
|
728
|
+
r.textContent = i ? i.emptyScript : "";
|
|
729
|
+
for (let i = 0; i < s; i++) r.append(t[i], l()), C.nextNode(), d.push({
|
|
730
|
+
type: 2,
|
|
731
|
+
index: ++c
|
|
732
|
+
});
|
|
733
|
+
r.append(t[s], l());
|
|
734
|
+
}
|
|
735
|
+
}
|
|
736
|
+
} else if (8 === r.nodeType) if (r.data === o$1) d.push({
|
|
737
|
+
type: 2,
|
|
738
|
+
index: c
|
|
739
|
+
});else {
|
|
740
|
+
let t = -1;
|
|
741
|
+
for (; -1 !== (t = r.data.indexOf(h, t + 1));) d.push({
|
|
742
|
+
type: 7,
|
|
743
|
+
index: c
|
|
744
|
+
}), t += h.length - 1;
|
|
745
|
+
}
|
|
746
|
+
c++;
|
|
747
|
+
}
|
|
748
|
+
}
|
|
749
|
+
static createElement(t, i) {
|
|
750
|
+
const s = r.createElement("template");
|
|
751
|
+
return s.innerHTML = t, s;
|
|
752
|
+
}
|
|
753
|
+
}
|
|
754
|
+
function S(t, i, s = t, e) {
|
|
755
|
+
if (i === T) return i;
|
|
756
|
+
let h = void 0 !== e ? s._$Co?.[e] : s._$Cl;
|
|
757
|
+
const o = c(i) ? void 0 : i._$litDirective$;
|
|
758
|
+
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;
|
|
759
|
+
}
|
|
760
|
+
class M {
|
|
761
|
+
constructor(t, i) {
|
|
762
|
+
this._$AV = [], this._$AN = void 0, this._$AD = t, this._$AM = i;
|
|
763
|
+
}
|
|
764
|
+
get parentNode() {
|
|
765
|
+
return this._$AM.parentNode;
|
|
766
|
+
}
|
|
767
|
+
get _$AU() {
|
|
768
|
+
return this._$AM._$AU;
|
|
769
|
+
}
|
|
770
|
+
u(t) {
|
|
771
|
+
const {
|
|
772
|
+
el: {
|
|
773
|
+
content: i
|
|
774
|
+
},
|
|
775
|
+
parts: s
|
|
776
|
+
} = this._$AD,
|
|
777
|
+
e = (t?.creationScope ?? r).importNode(i, true);
|
|
778
|
+
C.currentNode = e;
|
|
779
|
+
let h = C.nextNode(),
|
|
780
|
+
o = 0,
|
|
781
|
+
n = 0,
|
|
782
|
+
l = s[0];
|
|
783
|
+
for (; void 0 !== l;) {
|
|
784
|
+
if (o === l.index) {
|
|
785
|
+
let i;
|
|
786
|
+
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];
|
|
787
|
+
}
|
|
788
|
+
o !== l?.index && (h = C.nextNode(), o++);
|
|
789
|
+
}
|
|
790
|
+
return C.currentNode = r, e;
|
|
791
|
+
}
|
|
792
|
+
p(t) {
|
|
793
|
+
let i = 0;
|
|
794
|
+
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++;
|
|
795
|
+
}
|
|
796
|
+
}
|
|
797
|
+
class R {
|
|
798
|
+
get _$AU() {
|
|
799
|
+
return this._$AM?._$AU ?? this._$Cv;
|
|
800
|
+
}
|
|
801
|
+
constructor(t, i, s, e) {
|
|
802
|
+
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;
|
|
803
|
+
}
|
|
804
|
+
get parentNode() {
|
|
805
|
+
let t = this._$AA.parentNode;
|
|
806
|
+
const i = this._$AM;
|
|
807
|
+
return void 0 !== i && 11 === t?.nodeType && (t = i.parentNode), t;
|
|
808
|
+
}
|
|
809
|
+
get startNode() {
|
|
810
|
+
return this._$AA;
|
|
811
|
+
}
|
|
812
|
+
get endNode() {
|
|
813
|
+
return this._$AB;
|
|
814
|
+
}
|
|
815
|
+
_$AI(t, i = this) {
|
|
816
|
+
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);
|
|
817
|
+
}
|
|
818
|
+
O(t) {
|
|
819
|
+
return this._$AA.parentNode.insertBefore(t, this._$AB);
|
|
820
|
+
}
|
|
821
|
+
T(t) {
|
|
822
|
+
this._$AH !== t && (this._$AR(), this._$AH = this.O(t));
|
|
823
|
+
}
|
|
824
|
+
_(t) {
|
|
825
|
+
this._$AH !== E && c(this._$AH) ? this._$AA.nextSibling.data = t : this.T(r.createTextNode(t)), this._$AH = t;
|
|
826
|
+
}
|
|
827
|
+
$(t) {
|
|
828
|
+
const {
|
|
829
|
+
values: i,
|
|
830
|
+
_$litType$: s
|
|
831
|
+
} = t,
|
|
832
|
+
e = "number" == typeof s ? this._$AC(t) : (void 0 === s.el && (s.el = N.createElement(P(s.h, s.h[0]), this.options)), s);
|
|
833
|
+
if (this._$AH?._$AD === e) this._$AH.p(i);else {
|
|
834
|
+
const t = new M(e, this),
|
|
835
|
+
s = t.u(this.options);
|
|
836
|
+
t.p(i), this.T(s), this._$AH = t;
|
|
837
|
+
}
|
|
838
|
+
}
|
|
839
|
+
_$AC(t) {
|
|
840
|
+
let i = A.get(t.strings);
|
|
841
|
+
return void 0 === i && A.set(t.strings, i = new N(t)), i;
|
|
842
|
+
}
|
|
843
|
+
k(t) {
|
|
844
|
+
a(this._$AH) || (this._$AH = [], this._$AR());
|
|
845
|
+
const i = this._$AH;
|
|
846
|
+
let s,
|
|
847
|
+
e = 0;
|
|
848
|
+
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++;
|
|
849
|
+
e < i.length && (this._$AR(s && s._$AB.nextSibling, e), i.length = e);
|
|
850
|
+
}
|
|
851
|
+
_$AR(t = this._$AA.nextSibling, i) {
|
|
852
|
+
for (this._$AP?.(false, true, i); t !== this._$AB;) {
|
|
853
|
+
const i = t.nextSibling;
|
|
854
|
+
t.remove(), t = i;
|
|
855
|
+
}
|
|
856
|
+
}
|
|
857
|
+
setConnected(t) {
|
|
858
|
+
void 0 === this._$AM && (this._$Cv = t, this._$AP?.(t));
|
|
859
|
+
}
|
|
860
|
+
}
|
|
861
|
+
class k {
|
|
862
|
+
get tagName() {
|
|
863
|
+
return this.element.tagName;
|
|
864
|
+
}
|
|
865
|
+
get _$AU() {
|
|
866
|
+
return this._$AM._$AU;
|
|
867
|
+
}
|
|
868
|
+
constructor(t, i, s, e, h) {
|
|
869
|
+
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;
|
|
870
|
+
}
|
|
871
|
+
_$AI(t, i = this, s, e) {
|
|
872
|
+
const h = this.strings;
|
|
873
|
+
let o = false;
|
|
874
|
+
if (void 0 === h) t = S(this, t, i, 0), o = !c(t) || t !== this._$AH && t !== T, o && (this._$AH = t);else {
|
|
875
|
+
const e = t;
|
|
876
|
+
let n, r;
|
|
877
|
+
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;
|
|
878
|
+
}
|
|
879
|
+
o && !e && this.j(t);
|
|
880
|
+
}
|
|
881
|
+
j(t) {
|
|
882
|
+
t === E ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, t ?? "");
|
|
883
|
+
}
|
|
884
|
+
}
|
|
885
|
+
class H extends k {
|
|
886
|
+
constructor() {
|
|
887
|
+
super(...arguments), this.type = 3;
|
|
888
|
+
}
|
|
889
|
+
j(t) {
|
|
890
|
+
this.element[this.name] = t === E ? void 0 : t;
|
|
891
|
+
}
|
|
892
|
+
}
|
|
893
|
+
class I extends k {
|
|
894
|
+
constructor() {
|
|
895
|
+
super(...arguments), this.type = 4;
|
|
896
|
+
}
|
|
897
|
+
j(t) {
|
|
898
|
+
this.element.toggleAttribute(this.name, !!t && t !== E);
|
|
899
|
+
}
|
|
900
|
+
}
|
|
901
|
+
class L extends k {
|
|
902
|
+
constructor(t, i, s, e, h) {
|
|
903
|
+
super(t, i, s, e, h), this.type = 5;
|
|
904
|
+
}
|
|
905
|
+
_$AI(t, i = this) {
|
|
906
|
+
if ((t = S(this, t, i, 0) ?? E) === T) return;
|
|
907
|
+
const s = this._$AH,
|
|
908
|
+
e = t === E && s !== E || t.capture !== s.capture || t.once !== s.once || t.passive !== s.passive,
|
|
909
|
+
h = t !== E && (s === E || e);
|
|
910
|
+
e && this.element.removeEventListener(this.name, this, s), h && this.element.addEventListener(this.name, this, t), this._$AH = t;
|
|
911
|
+
}
|
|
912
|
+
handleEvent(t) {
|
|
913
|
+
"function" == typeof this._$AH ? this._$AH.call(this.options?.host ?? this.element, t) : this._$AH.handleEvent(t);
|
|
914
|
+
}
|
|
915
|
+
}
|
|
916
|
+
class z {
|
|
917
|
+
constructor(t, i, s) {
|
|
918
|
+
this.element = t, this.type = 6, this._$AN = void 0, this._$AM = i, this.options = s;
|
|
919
|
+
}
|
|
920
|
+
get _$AU() {
|
|
921
|
+
return this._$AM._$AU;
|
|
922
|
+
}
|
|
923
|
+
_$AI(t) {
|
|
924
|
+
S(this, t);
|
|
925
|
+
}
|
|
926
|
+
}
|
|
927
|
+
const j = t.litHtmlPolyfillSupport;
|
|
928
|
+
j?.(N, R), (t.litHtmlVersions ??= []).push("3.3.1");
|
|
373
929
|
|
|
374
|
-
|
|
930
|
+
/**
|
|
931
|
+
* @license
|
|
932
|
+
* Copyright 2018 Google LLC
|
|
933
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
934
|
+
*/
|
|
935
|
+
const o = o => o ?? E;
|
|
936
|
+
|
|
937
|
+
var _M3eTabsElement_instances, _M3eTabsElement_directionalitySubscription, _M3eTabsElement_renderHeader, _M3eTabsElement_handleSlotChange, _M3eTabsElement_handleKeyDown, _M3eTabsElement_handleChange, _M3eTabsElement_handleSelectedChange, _M3eTabsElement_updateInkBar, _a;
|
|
375
938
|
const MIN_PRIMARY_TAB_WIDTH = 24;
|
|
376
939
|
/**
|
|
377
940
|
* Organizes content into separate views where only one view can be visible at a time.
|
|
@@ -424,316 +987,187 @@ const MIN_PRIMARY_TAB_WIDTH = 24;
|
|
|
424
987
|
* @cssprop --m3e-tabs-secondary-active-indicator-thickness - Thickness for secondary variant's active indicator.
|
|
425
988
|
*/
|
|
426
989
|
let M3eTabsElement = class M3eTabsElement extends AttachInternals(LitElement) {
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
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
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
this.classList.toggle("-no-animate", true);
|
|
470
|
-
__classPrivateFieldGet(this, _M3eTabsElement_instances, "m", _M3eTabsElement_updateInkBar).call(this);
|
|
471
|
-
},
|
|
472
|
-
});
|
|
473
|
-
}
|
|
474
|
-
/** The tabs. */
|
|
475
|
-
get tabs() {
|
|
476
|
-
return this[selectionManager]?.items ?? [];
|
|
477
|
-
}
|
|
478
|
-
/** The selected tab. */
|
|
479
|
-
get selectedTab() {
|
|
480
|
-
return this._selectedIndex !== null ? (this.tabs[this._selectedIndex] ?? null) : null;
|
|
481
|
-
}
|
|
482
|
-
/** The zero-based index of the selected tab. */
|
|
483
|
-
get selectedIndex() {
|
|
484
|
-
return this._selectedIndex ?? -1;
|
|
485
|
-
}
|
|
486
|
-
set selectedIndex(value) {
|
|
487
|
-
if (value >= 0 && value < this.tabs.length) {
|
|
488
|
-
this.tabs[value].selected = true;
|
|
489
|
-
}
|
|
490
|
-
else {
|
|
491
|
-
const selectedTab = this.selectedTab;
|
|
492
|
-
if (selectedTab) {
|
|
493
|
-
selectedTab.selected = false;
|
|
494
|
-
}
|
|
495
|
-
}
|
|
496
|
-
}
|
|
497
|
-
/** @inheritdoc */
|
|
498
|
-
connectedCallback() {
|
|
499
|
-
super.connectedCallback();
|
|
990
|
+
constructor() {
|
|
991
|
+
super();
|
|
992
|
+
_M3eTabsElement_instances.add(this);
|
|
993
|
+
/** @private */
|
|
994
|
+
_M3eTabsElement_directionalitySubscription.set(this, void 0);
|
|
995
|
+
/** @private */
|
|
996
|
+
this._selectedIndex = null;
|
|
997
|
+
/** @internal */
|
|
998
|
+
this[_a] = new SelectionManager().onSelectedItemsChange(() => __classPrivateFieldGet(this, _M3eTabsElement_instances, "m", _M3eTabsElement_handleSelectedChange).call(this)).withHomeAndEnd().withWrap().withDirectionality(M3eDirectionality.current);
|
|
999
|
+
/**
|
|
1000
|
+
* Whether scroll buttons are disabled.
|
|
1001
|
+
* @default false
|
|
1002
|
+
*/
|
|
1003
|
+
this.disablePagination = false;
|
|
1004
|
+
/**
|
|
1005
|
+
* The position of the tab headers.
|
|
1006
|
+
* @default "before"
|
|
1007
|
+
*/
|
|
1008
|
+
this.headerPosition = "before";
|
|
1009
|
+
/**
|
|
1010
|
+
* The appearance variant of the tabs.
|
|
1011
|
+
* @default "secondary"
|
|
1012
|
+
*/
|
|
1013
|
+
this.variant = "secondary";
|
|
1014
|
+
/**
|
|
1015
|
+
* Whether tabs are stretched to fill the header.
|
|
1016
|
+
* @default false
|
|
1017
|
+
*/
|
|
1018
|
+
this.stretch = false;
|
|
1019
|
+
/**
|
|
1020
|
+
* The accessible label given to the button used to move to the previous page.
|
|
1021
|
+
* @default "Previous page"
|
|
1022
|
+
*/
|
|
1023
|
+
this.previousPageLabel = "Previous page";
|
|
1024
|
+
/**
|
|
1025
|
+
* The accessible label given to the button used to move to the next page.
|
|
1026
|
+
* @default "Next page"
|
|
1027
|
+
*/
|
|
1028
|
+
this.nextPageLabel = "Next page";
|
|
1029
|
+
new ResizeController(this, {
|
|
1030
|
+
skipInitial: true,
|
|
1031
|
+
callback: () => {
|
|
500
1032
|
this.classList.toggle("-no-animate", true);
|
|
1033
|
+
__classPrivateFieldGet(this, _M3eTabsElement_instances, "m", _M3eTabsElement_updateInkBar).call(this);
|
|
1034
|
+
}
|
|
1035
|
+
});
|
|
1036
|
+
}
|
|
1037
|
+
/** The tabs. */
|
|
1038
|
+
get tabs() {
|
|
1039
|
+
return this[selectionManager]?.items ?? [];
|
|
1040
|
+
}
|
|
1041
|
+
/** The selected tab. */
|
|
1042
|
+
get selectedTab() {
|
|
1043
|
+
return this._selectedIndex !== null ? this.tabs[this._selectedIndex] ?? null : null;
|
|
1044
|
+
}
|
|
1045
|
+
/** The zero-based index of the selected tab. */
|
|
1046
|
+
get selectedIndex() {
|
|
1047
|
+
return this._selectedIndex ?? -1;
|
|
1048
|
+
}
|
|
1049
|
+
set selectedIndex(value) {
|
|
1050
|
+
if (value >= 0 && value < this.tabs.length) {
|
|
1051
|
+
this.tabs[value].selected = true;
|
|
1052
|
+
} else {
|
|
1053
|
+
const selectedTab = this.selectedTab;
|
|
1054
|
+
if (selectedTab) {
|
|
1055
|
+
selectedTab.selected = false;
|
|
1056
|
+
}
|
|
501
1057
|
}
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
1058
|
+
}
|
|
1059
|
+
/** @inheritdoc */
|
|
1060
|
+
connectedCallback() {
|
|
1061
|
+
super.connectedCallback();
|
|
1062
|
+
this.classList.toggle("-no-animate", true);
|
|
1063
|
+
__classPrivateFieldSet(this, _M3eTabsElement_directionalitySubscription, M3eDirectionality.observe(() => {
|
|
1064
|
+
this.requestUpdate();
|
|
1065
|
+
this[selectionManager].directionality = M3eDirectionality.current;
|
|
1066
|
+
}), "f");
|
|
1067
|
+
}
|
|
1068
|
+
/** @inheritdoc */
|
|
1069
|
+
disconnectedCallback() {
|
|
1070
|
+
super.disconnectedCallback();
|
|
1071
|
+
__classPrivateFieldGet(this, _M3eTabsElement_directionalitySubscription, "f")?.call(this);
|
|
1072
|
+
}
|
|
1073
|
+
/** @inheritdoc */
|
|
1074
|
+
updated(_changedProperties) {
|
|
1075
|
+
super.updated(_changedProperties);
|
|
1076
|
+
if ((_changedProperties.has("variant") || _changedProperties.has("stretch")) && this._selectedIndex !== null) {
|
|
1077
|
+
__classPrivateFieldGet(this, _M3eTabsElement_instances, "m", _M3eTabsElement_updateInkBar).call(this);
|
|
508
1078
|
}
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
return html ` ${this.headerPosition === "before" ? __classPrivateFieldGet(this, _M3eTabsElement_instances, "m", _M3eTabsElement_renderHeader).call(this) : nothing}
|
|
519
|
-
<m3e-slide class="tabs" .selectedIndex="${panelIndex}">
|
|
520
|
-
<slot name="panel"></slot>
|
|
521
|
-
</m3e-slide>
|
|
522
|
-
${this.headerPosition === "after" ? __classPrivateFieldGet(this, _M3eTabsElement_instances, "m", _M3eTabsElement_renderHeader).call(this) : nothing}`;
|
|
1079
|
+
}
|
|
1080
|
+
/** @inheritdoc */
|
|
1081
|
+
render() {
|
|
1082
|
+
let panelIndex;
|
|
1083
|
+
if (this.selectedTab?.control) {
|
|
1084
|
+
panelIndex = [...this.querySelectorAll("[slot='panel']")].indexOf(this.selectedTab.control);
|
|
1085
|
+
if (panelIndex === -1) {
|
|
1086
|
+
panelIndex = undefined;
|
|
1087
|
+
}
|
|
523
1088
|
}
|
|
1089
|
+
return html`${this.headerPosition === "before" ? __classPrivateFieldGet(this, _M3eTabsElement_instances, "m", _M3eTabsElement_renderHeader).call(this) : nothing}<m3e-slide class="tabs" selected-index="${o(panelIndex)}"><slot name="panel"></slot></m3e-slide>${this.headerPosition === "after" ? __classPrivateFieldGet(this, _M3eTabsElement_instances, "m", _M3eTabsElement_renderHeader).call(this) : nothing}`;
|
|
1090
|
+
}
|
|
524
1091
|
};
|
|
1092
|
+
_M3eTabsElement_directionalitySubscription = new WeakMap();
|
|
525
1093
|
_M3eTabsElement_instances = new WeakSet();
|
|
526
1094
|
_a = selectionManager;
|
|
527
1095
|
_M3eTabsElement_renderHeader = function _M3eTabsElement_renderHeader() {
|
|
528
|
-
|
|
529
|
-
class="tablist"
|
|
530
|
-
threshold="8"
|
|
531
|
-
previous-page-label="${this.previousPageLabel}"
|
|
532
|
-
next-page-label="${this.nextPageLabel}"
|
|
533
|
-
?disabled="${this.disablePagination}"
|
|
534
|
-
>
|
|
535
|
-
<slot name="prev-icon" slot="prev-icon">
|
|
536
|
-
<svg class="prev icon" viewBox="0 -960 960 960" fill="currentColor">
|
|
537
|
-
<path d="M640-80 240-480l400-400 71 71-329 329 329 329-71 71Z" />
|
|
538
|
-
</svg>
|
|
539
|
-
</slot>
|
|
540
|
-
<slot name="next-icon" slot="next-icon">
|
|
541
|
-
<svg class="next icon" viewBox="0 -960 960 960" fill="currentColor">
|
|
542
|
-
<path d="m321-80-71-71 329-329-329-329 71-71 400 400L321-80Z" />
|
|
543
|
-
</svg>
|
|
544
|
-
</slot>
|
|
545
|
-
<div class="header" role="tablist">
|
|
546
|
-
<div class="tabs">
|
|
547
|
-
<slot
|
|
548
|
-
@slotchange="${__classPrivateFieldGet(this, _M3eTabsElement_instances, "m", _M3eTabsElement_handleSlotChange)}"
|
|
549
|
-
@keydown="${__classPrivateFieldGet(this, _M3eTabsElement_instances, "m", _M3eTabsElement_handleKeyDown)}"
|
|
550
|
-
@change="${__classPrivateFieldGet(this, _M3eTabsElement_instances, "m", _M3eTabsElement_handleChange)}"
|
|
551
|
-
></slot>
|
|
552
|
-
</div>
|
|
553
|
-
<div class="ink-bar" aria-hidden="true">
|
|
554
|
-
<div class="active-indicator"></div>
|
|
555
|
-
</div>
|
|
556
|
-
</div>
|
|
557
|
-
</m3e-slide-group>`;
|
|
1096
|
+
return html`<m3e-slide-group class="tablist" threshold="8" previous-page-label="${this.previousPageLabel}" next-page-label="${this.nextPageLabel}" ?disabled="${this.disablePagination}"><slot name="prev-icon" slot="prev-icon">${M3eDirectionality.current === "ltr" ? html`<svg class="prev icon" viewBox="0 -960 960 960" fill="currentColor"><path d="M640-80 240-480l400-400 71 71-329 329 329 329-71 71Z"/></svg>` : html`<svg class="next icon" viewBox="0 -960 960 960" fill="currentColor"><path d="m321-80-71-71 329-329-329-329 71-71 400 400L321-80Z"/></svg>`}</slot><slot name="next-icon" slot="next-icon">${M3eDirectionality.current === "ltr" ? html`<svg class="next icon" viewBox="0 -960 960 960" fill="currentColor"><path d="m321-80-71-71 329-329-329-329 71-71 400 400L321-80Z"/></svg>` : html`<svg class="prev icon" viewBox="0 -960 960 960" fill="currentColor"><path d="M640-80 240-480l400-400 71 71-329 329 329 329-71 71Z"/></svg>`}</slot><div class="header" role="tablist"><div class="tabs"><slot @slotchange="${__classPrivateFieldGet(this, _M3eTabsElement_instances, "m", _M3eTabsElement_handleSlotChange)}" @keydown="${__classPrivateFieldGet(this, _M3eTabsElement_instances, "m", _M3eTabsElement_handleKeyDown)}" @change="${__classPrivateFieldGet(this, _M3eTabsElement_instances, "m", _M3eTabsElement_handleChange)}"></slot></div><div class="ink-bar" aria-hidden="true"><div class="active-indicator"></div></div></div></m3e-slide-group>`;
|
|
558
1097
|
};
|
|
559
1098
|
_M3eTabsElement_handleSlotChange = function _M3eTabsElement_handleSlotChange() {
|
|
560
|
-
|
|
1099
|
+
this[selectionManager].setItems([...this.querySelectorAll("m3e-tab")]);
|
|
561
1100
|
};
|
|
562
1101
|
_M3eTabsElement_handleKeyDown = function _M3eTabsElement_handleKeyDown(e) {
|
|
563
|
-
|
|
1102
|
+
this[selectionManager].onKeyDown(e);
|
|
564
1103
|
};
|
|
565
1104
|
_M3eTabsElement_handleChange = function _M3eTabsElement_handleChange(e) {
|
|
566
|
-
|
|
567
|
-
|
|
1105
|
+
e.stopPropagation();
|
|
1106
|
+
this.dispatchEvent(new Event("change", {
|
|
1107
|
+
bubbles: true
|
|
1108
|
+
}));
|
|
568
1109
|
};
|
|
569
1110
|
_M3eTabsElement_handleSelectedChange = function _M3eTabsElement_handleSelectedChange() {
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
1111
|
+
const selected = this[selectionManager].selectedItems[0];
|
|
1112
|
+
let selectedIndex = selected ? this.tabs.indexOf(selected) : null;
|
|
1113
|
+
if (selectedIndex === -1) {
|
|
1114
|
+
selectedIndex = null;
|
|
1115
|
+
}
|
|
1116
|
+
this._selectedIndex = selectedIndex;
|
|
1117
|
+
__classPrivateFieldGet(this, _M3eTabsElement_instances, "m", _M3eTabsElement_updateInkBar).call(this);
|
|
577
1118
|
};
|
|
578
1119
|
_M3eTabsElement_updateInkBar = function _M3eTabsElement_updateInkBar() {
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
left += this.tabs[i].clientWidth;
|
|
587
|
-
}
|
|
588
|
-
width = selected.clientWidth;
|
|
589
|
-
if (this.variant === "primary" && selected.label) {
|
|
590
|
-
left += selected.label.offsetLeft;
|
|
591
|
-
width = selected.label.clientWidth;
|
|
592
|
-
if (width < MIN_PRIMARY_TAB_WIDTH) {
|
|
593
|
-
left -= (MIN_PRIMARY_TAB_WIDTH - width) / 2;
|
|
594
|
-
width = MIN_PRIMARY_TAB_WIDTH;
|
|
595
|
-
}
|
|
596
|
-
}
|
|
1120
|
+
if (!this._tablist) return;
|
|
1121
|
+
const selected = this[selectionManager].selectedItems[0];
|
|
1122
|
+
let left = 0;
|
|
1123
|
+
let width = 0;
|
|
1124
|
+
if (selected && this._selectedIndex !== null) {
|
|
1125
|
+
for (let i = 0; i < this._selectedIndex; i++) {
|
|
1126
|
+
left += this.tabs[i].clientWidth;
|
|
597
1127
|
}
|
|
598
|
-
|
|
599
|
-
this.
|
|
600
|
-
|
|
601
|
-
|
|
1128
|
+
width = selected.clientWidth;
|
|
1129
|
+
if (this.variant === "primary" && selected.label) {
|
|
1130
|
+
left += selected.label.offsetLeft;
|
|
1131
|
+
width = selected.label.clientWidth;
|
|
1132
|
+
if (width < MIN_PRIMARY_TAB_WIDTH) {
|
|
1133
|
+
left -= (MIN_PRIMARY_TAB_WIDTH - width) / 2;
|
|
1134
|
+
width = MIN_PRIMARY_TAB_WIDTH;
|
|
1135
|
+
}
|
|
602
1136
|
}
|
|
1137
|
+
}
|
|
1138
|
+
this._tablist.style.setProperty("--_tabs-active-tab-position", `${left}px`);
|
|
1139
|
+
this._tablist.style.setProperty("--_tabs-active-tab-size", `${width}px`);
|
|
1140
|
+
if (width > 0 && this.classList.contains("-no-animate")) {
|
|
1141
|
+
setTimeout(() => this.classList.toggle("-no-animate", false));
|
|
1142
|
+
}
|
|
603
1143
|
};
|
|
604
1144
|
/** The styles of the element. */
|
|
605
|
-
M3eTabsElement.styles = css `
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
.ink-bar {
|
|
632
|
-
box-sizing: border-box;
|
|
633
|
-
height: var(--_tabs-active-indicator-thickness);
|
|
634
|
-
}
|
|
635
|
-
.active-indicator {
|
|
636
|
-
position: relative;
|
|
637
|
-
height: var(--_tabs-active-indicator-thickness);
|
|
638
|
-
left: calc(var(--_tabs-active-tab-position) + var(--_tabs-activate-indicator-inset, 0px));
|
|
639
|
-
width: calc(var(--_tabs-active-tab-size) - calc(var(--_tabs-activate-indicator-inset, 0px) * 2));
|
|
640
|
-
background-color: var(--m3e-tabs-active-indicator-color, ${DesignToken.color.primary});
|
|
641
|
-
transition: ${unsafeCSS(`left var(--m3e-slide-animation-duration, ${DesignToken.motion.duration.long2}) ${DesignToken.motion.easing.standard},
|
|
642
|
-
width var(--m3e-slide-animation-duration, ${DesignToken.motion.duration.long2}) ${DesignToken.motion.easing.standard}`)};
|
|
643
|
-
}
|
|
644
|
-
:host([header-position="after"]) .header {
|
|
645
|
-
flex-direction: column-reverse;
|
|
646
|
-
}
|
|
647
|
-
:host([header-position="before"]) .ink-bar {
|
|
648
|
-
margin-top: calc(0px - var(--_tabs-active-indicator-thickness));
|
|
649
|
-
}
|
|
650
|
-
:host([header-position="before"]) .tablist {
|
|
651
|
-
--m3e-slide-group-divider-bottom: var(--m3e-divider-thickness, 1px) solid
|
|
652
|
-
var(--m3e-divider-color, ${DesignToken.color.outlineVariant});
|
|
653
|
-
}
|
|
654
|
-
:host([header-position="after"]) .ink-bar {
|
|
655
|
-
margin-bottom: calc(0px - var(--_tabs-active-indicator-thickness));
|
|
656
|
-
}
|
|
657
|
-
:host([header-position="after"]) .tablist {
|
|
658
|
-
--m3e-slide-group-divider-top: var(--m3e-divider-thickness, 1px) solid
|
|
659
|
-
var(--m3e-divider-color, ${DesignToken.color.outlineVariant});
|
|
660
|
-
}
|
|
661
|
-
:host([header-position="before"][variant="primary"]) .active-indicator {
|
|
662
|
-
border-radius: var(--m3e-tabs-primary-before-active-indicator-shape, ${DesignToken.shape.corner.extraSmallTop});
|
|
663
|
-
}
|
|
664
|
-
:host([header-position="after"][variant="primary"]) .active-indicator {
|
|
665
|
-
border-radius: var(--m3e-tabs-primary-after-active-indicator-shape, ${DesignToken.shape.corner.extraSmallBottom});
|
|
666
|
-
}
|
|
667
|
-
.tabs {
|
|
668
|
-
flex: 1 1 auto;
|
|
669
|
-
}
|
|
670
|
-
:host([variant="primary"]) .tablist {
|
|
671
|
-
--_tabs-activate-indicator-inset: var(--m3e-tabs-primary-active-indicator-inset, 0.125rem);
|
|
672
|
-
--_tabs-active-indicator-thickness: var(--m3e-tabs-primary-active-indicator-thickness, 0.1875rem);
|
|
673
|
-
--_tab-height: 4rem;
|
|
674
|
-
}
|
|
675
|
-
:host([header-position="before"]) .tablist {
|
|
676
|
-
--_tab-focus-ring-bottom-offset: calc(var(--_tabs-active-indicator-thickness) + 1px);
|
|
677
|
-
}
|
|
678
|
-
:host([header-position="after"]) .tablist {
|
|
679
|
-
--_tab-focus-ring-top-offset: calc(var(--_tabs-active-indicator-thickness) + 2px);
|
|
680
|
-
}
|
|
681
|
-
:host([header-position="before"][variant="primary"]) .tablist {
|
|
682
|
-
--_tab-direction: column;
|
|
683
|
-
}
|
|
684
|
-
:host([header-position="after"][variant="primary"]) .tablist {
|
|
685
|
-
--_tab-direction: column-reverse;
|
|
686
|
-
}
|
|
687
|
-
:host([variant="secondary"]) .tablist {
|
|
688
|
-
--_tabs-active-indicator-thickness: var(--m3e-tabs-secondary-active-indicator-thickness, 0.125rem);
|
|
689
|
-
--_tab-height: 3rem;
|
|
690
|
-
}
|
|
691
|
-
:host([stretch]) .header {
|
|
692
|
-
width: 100%;
|
|
693
|
-
--_tab-grow: 1;
|
|
694
|
-
}
|
|
695
|
-
:host(.-no-animate) .active-indicator {
|
|
696
|
-
transition: none;
|
|
697
|
-
}
|
|
698
|
-
@media (prefers-reduced-motion) {
|
|
699
|
-
.active-indicator {
|
|
700
|
-
transition: none;
|
|
701
|
-
}
|
|
702
|
-
}
|
|
703
|
-
@media (forced-colors: active) {
|
|
704
|
-
.active-indicator {
|
|
705
|
-
background-color: ButtonText;
|
|
706
|
-
--m3e-divider-color: GrayText;
|
|
707
|
-
}
|
|
708
|
-
}
|
|
709
|
-
`;
|
|
710
|
-
__decorate([
|
|
711
|
-
e(".tablist")
|
|
712
|
-
], M3eTabsElement.prototype, "_tablist", void 0);
|
|
713
|
-
__decorate([
|
|
714
|
-
r()
|
|
715
|
-
], M3eTabsElement.prototype, "_selectedIndex", void 0);
|
|
716
|
-
__decorate([
|
|
717
|
-
n({ attribute: "disable-pagination", type: Boolean })
|
|
718
|
-
], M3eTabsElement.prototype, "disablePagination", void 0);
|
|
719
|
-
__decorate([
|
|
720
|
-
n({ attribute: "header-position", reflect: true })
|
|
721
|
-
], M3eTabsElement.prototype, "headerPosition", void 0);
|
|
722
|
-
__decorate([
|
|
723
|
-
n({ reflect: true })
|
|
724
|
-
], M3eTabsElement.prototype, "variant", void 0);
|
|
725
|
-
__decorate([
|
|
726
|
-
n({ type: Boolean, reflect: true })
|
|
727
|
-
], M3eTabsElement.prototype, "stretch", void 0);
|
|
728
|
-
__decorate([
|
|
729
|
-
n({ attribute: "previous-page-label" })
|
|
730
|
-
], M3eTabsElement.prototype, "previousPageLabel", void 0);
|
|
731
|
-
__decorate([
|
|
732
|
-
n({ attribute: "next-page-label" })
|
|
733
|
-
], M3eTabsElement.prototype, "nextPageLabel", void 0);
|
|
734
|
-
M3eTabsElement = __decorate([
|
|
735
|
-
t$1("m3e-tabs")
|
|
736
|
-
], M3eTabsElement);
|
|
1145
|
+
M3eTabsElement.styles = css`:host { display: flex; flex-direction: column; position: relative; } .tablist { position: relative; box-sizing: border-box; flex: none; } ::slotted(prev-icon), ::slotted(next-icon), .icon { width: 1em; font-size: var(--m3e-tabs-paginator-button-icon-size, var(--m3e-icon-button-icon-size, 1.5rem)) !important; } .header { display: flex; flex-direction: column; } .tabs { display: flex; flex-wrap: nowrap; align-items: center; } .ink-bar { box-sizing: border-box; height: var(--_tabs-active-indicator-thickness); } .active-indicator { position: relative; height: var(--_tabs-active-indicator-thickness); left: calc(var(--_tabs-active-tab-position) + var(--_tabs-activate-indicator-inset, 0px)); width: calc(var(--_tabs-active-tab-size) - calc(var(--_tabs-activate-indicator-inset, 0px) * 2)); background-color: var(--m3e-tabs-active-indicator-color, ${DesignToken.color.primary}); transition: ${unsafeCSS(`left var(--m3e-slide-animation-duration, ${DesignToken.motion.duration.long2}) ${DesignToken.motion.easing.standard},
|
|
1146
|
+
width var(--m3e-slide-animation-duration, ${DesignToken.motion.duration.long2}) ${DesignToken.motion.easing.standard}`)}; } :host([header-position="after"]) .header { flex-direction: column-reverse; } :host([header-position="before"]) .ink-bar { margin-top: calc(0px - var(--_tabs-active-indicator-thickness)); } :host([header-position="before"]) .tablist { --m3e-slide-group-divider-bottom: var(--m3e-divider-thickness, 1px) solid var(--m3e-divider-color, ${DesignToken.color.outlineVariant}); } :host([header-position="after"]) .ink-bar { margin-bottom: calc(0px - var(--_tabs-active-indicator-thickness)); } :host([header-position="after"]) .tablist { --m3e-slide-group-divider-top: var(--m3e-divider-thickness, 1px) solid var(--m3e-divider-color, ${DesignToken.color.outlineVariant}); } :host([header-position="before"][variant="primary"]) .active-indicator { border-radius: var(--m3e-tabs-primary-before-active-indicator-shape, ${DesignToken.shape.corner.extraSmallTop}); } :host([header-position="after"][variant="primary"]) .active-indicator { border-radius: var(--m3e-tabs-primary-after-active-indicator-shape, ${DesignToken.shape.corner.extraSmallBottom}); } .tabs { flex: 1 1 auto; } :host([variant="primary"]) .tablist { --_tabs-activate-indicator-inset: var(--m3e-tabs-primary-active-indicator-inset, 0.125rem); --_tabs-active-indicator-thickness: var(--m3e-tabs-primary-active-indicator-thickness, 0.1875rem); --_tab-height: 4rem; } :host([header-position="before"]) .tablist { --_tab-focus-ring-bottom-offset: calc(var(--_tabs-active-indicator-thickness) + 1px); } :host([header-position="after"]) .tablist { --_tab-focus-ring-top-offset: calc(var(--_tabs-active-indicator-thickness) + 2px); } :host([header-position="before"][variant="primary"]) .tablist { --_tab-direction: column; } :host([header-position="after"][variant="primary"]) .tablist { --_tab-direction: column-reverse; } :host([variant="secondary"]) .tablist { --_tabs-active-indicator-thickness: var(--m3e-tabs-secondary-active-indicator-thickness, 0.125rem); --_tab-height: 3rem; } :host([stretch]) .header { width: 100%; --_tab-grow: 1; } :host(.-no-animate) .active-indicator { transition: none; } @media (prefers-reduced-motion) { .active-indicator { transition: none; } } @media (forced-colors: active) { .active-indicator { background-color: ButtonText; --m3e-divider-color: GrayText; } }`;
|
|
1147
|
+
__decorate([e$1(".tablist")], M3eTabsElement.prototype, "_tablist", void 0);
|
|
1148
|
+
__decorate([r$1()], M3eTabsElement.prototype, "_selectedIndex", void 0);
|
|
1149
|
+
__decorate([n$1({
|
|
1150
|
+
attribute: "disable-pagination",
|
|
1151
|
+
type: Boolean
|
|
1152
|
+
})], M3eTabsElement.prototype, "disablePagination", void 0);
|
|
1153
|
+
__decorate([n$1({
|
|
1154
|
+
attribute: "header-position",
|
|
1155
|
+
reflect: true
|
|
1156
|
+
})], M3eTabsElement.prototype, "headerPosition", void 0);
|
|
1157
|
+
__decorate([n$1({
|
|
1158
|
+
reflect: true
|
|
1159
|
+
})], M3eTabsElement.prototype, "variant", void 0);
|
|
1160
|
+
__decorate([n$1({
|
|
1161
|
+
type: Boolean,
|
|
1162
|
+
reflect: true
|
|
1163
|
+
})], M3eTabsElement.prototype, "stretch", void 0);
|
|
1164
|
+
__decorate([n$1({
|
|
1165
|
+
attribute: "previous-page-label"
|
|
1166
|
+
})], M3eTabsElement.prototype, "previousPageLabel", void 0);
|
|
1167
|
+
__decorate([n$1({
|
|
1168
|
+
attribute: "next-page-label"
|
|
1169
|
+
})], M3eTabsElement.prototype, "nextPageLabel", void 0);
|
|
1170
|
+
M3eTabsElement = __decorate([t$2("m3e-tabs")], M3eTabsElement);
|
|
737
1171
|
|
|
738
1172
|
export { M3eTabElement, M3eTabPanelElement, M3eTabsElement };
|
|
739
1173
|
//# sourceMappingURL=index.js.map
|