@m3e/chips 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/README.md +3 -2
- package/dist/custom-elements.json +16 -0
- package/dist/index.js +1139 -951
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +7 -453
- package/dist/index.min.js.map +1 -1
- package/dist/src/FilterChipSetElement.d.ts +4 -0
- package/dist/src/FilterChipSetElement.d.ts.map +1 -1
- package/dist/src/InputChipSetElement.d.ts.map +1 -1
- package/package.json +4 -18
package/dist/index.js
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
import { unsafeCSS, css, LitElement, nothing, html } from 'lit';
|
|
7
7
|
import { DesignToken, isDisabledMixin, isDisabledInteractiveMixin, isLinkButtonMixin, renderPseudoLink, hasAssignedNodes, getTextContent, FormSubmitter, AttachInternals, LinkButton, KeyboardClick, Focusable, DisabledInteractive, Disabled, Role, Vertical, Selected, Labelled, Dirty, Touched, FormAssociated, formValue, EventAttribute, RequiredConstraintValidation, Required, ConstraintValidation } from '@m3e/core';
|
|
8
8
|
import { selectionManager, SelectionManager, ListManager, ListKeyManager } from '@m3e/core/a11y';
|
|
9
|
+
import { M3eDirectionality } from '@m3e/core/bidi';
|
|
9
10
|
|
|
10
11
|
/******************************************************************************
|
|
11
12
|
Copyright (c) Microsoft Corporation.
|
|
@@ -20,33 +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
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
48
|
-
var e = new Error(message);
|
|
49
|
-
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
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;
|
|
50
48
|
};
|
|
51
49
|
|
|
52
50
|
/**
|
|
@@ -54,39 +52,395 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
|
|
|
54
52
|
* Copyright 2017 Google LLC
|
|
55
53
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
56
54
|
*/
|
|
57
|
-
const t$2=t=>(e,o)=>
|
|
55
|
+
const t$2 = t => (e, o) => {
|
|
56
|
+
void 0 !== o ? o.addInitializer(() => {
|
|
57
|
+
customElements.define(t, e);
|
|
58
|
+
}) : customElements.define(t, e);
|
|
59
|
+
};
|
|
58
60
|
|
|
59
61
|
/**
|
|
60
62
|
* @license
|
|
61
63
|
* Copyright 2019 Google LLC
|
|
62
64
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
63
65
|
*/
|
|
64
|
-
const t$1
|
|
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$3 = 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$3(e);
|
|
100
|
+
})(t) : t;
|
|
65
101
|
|
|
66
102
|
/**
|
|
67
103
|
* @license
|
|
68
104
|
* Copyright 2017 Google LLC
|
|
69
105
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
70
|
-
*/
|
|
106
|
+
*/
|
|
107
|
+
const {
|
|
108
|
+
is: i$1,
|
|
109
|
+
defineProperty: e$3,
|
|
110
|
+
getOwnPropertyDescriptor: h$1,
|
|
111
|
+
getOwnPropertyNames: r$2,
|
|
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$2(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");
|
|
71
371
|
|
|
72
372
|
/**
|
|
73
373
|
* @license
|
|
74
374
|
* Copyright 2017 Google LLC
|
|
75
375
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
76
|
-
*/
|
|
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$1 = (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$1(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
|
+
}
|
|
77
421
|
|
|
78
422
|
/**
|
|
79
423
|
* @license
|
|
80
424
|
* Copyright 2017 Google LLC
|
|
81
425
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
82
426
|
*/
|
|
83
|
-
const e$2=(e,t,c)=>(c.configurable=true,c.enumerable=true,Reflect.decorate&&"object"!=typeof t&&Object.defineProperty(e,t,c),c);
|
|
427
|
+
const e$2 = (e, t, c) => (c.configurable = true, c.enumerable = true, Reflect.decorate && "object" != typeof t && Object.defineProperty(e, t, c), c);
|
|
84
428
|
|
|
85
429
|
/**
|
|
86
430
|
* @license
|
|
87
431
|
* Copyright 2017 Google LLC
|
|
88
432
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
89
|
-
*/
|
|
433
|
+
*/
|
|
434
|
+
function e$1(e, r) {
|
|
435
|
+
return (n, s, i) => {
|
|
436
|
+
const o = t => t.renderRoot?.querySelector(e) ?? null;
|
|
437
|
+
return e$2(n, s, {
|
|
438
|
+
get() {
|
|
439
|
+
return o(this);
|
|
440
|
+
}
|
|
441
|
+
});
|
|
442
|
+
};
|
|
443
|
+
}
|
|
90
444
|
|
|
91
445
|
var _M3eChipElement_instances, _M3eChipElement_value, _M3eChipElement_textContent, _M3eChipElement_renderContent, _M3eChipElement_handleIconSlotChange, _M3eChipElement_handleTrailingIconSlotChange, _M3eChipElement_handleSlotChange;
|
|
92
446
|
/**
|
|
@@ -138,278 +492,83 @@ var _M3eChipElement_instances, _M3eChipElement_value, _M3eChipElement_textConten
|
|
|
138
492
|
* @cssprop --m3e-outlined-chip-outline-color - Outline color for outlined variant.
|
|
139
493
|
*/
|
|
140
494
|
let M3eChipElement = class M3eChipElement extends LitElement {
|
|
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
|
-
if (!x?.htmlFor) {
|
|
167
|
-
x?.attach(this);
|
|
168
|
-
}
|
|
169
|
-
});
|
|
170
|
-
}
|
|
171
|
-
/** @inheritdoc */
|
|
172
|
-
render() {
|
|
173
|
-
const disabled = !isDisabledMixin(this) || this.disabled;
|
|
174
|
-
const disabledInteractive = isDisabledInteractiveMixin(this) && this.disabledInteractive;
|
|
175
|
-
return html `<div class="base">
|
|
176
|
-
<m3e-elevation class="elevation" ?disabled="${disabled || disabledInteractive}"></m3e-elevation>
|
|
177
|
-
<m3e-state-layer class="state-layer" ?disabled="${disabled || disabledInteractive}"></m3e-state-layer>
|
|
178
|
-
<m3e-focus-ring class="focus-ring" ?disabled="${disabled}"></m3e-focus-ring>
|
|
179
|
-
<m3e-ripple class="ripple" ?disabled="${disabled || disabledInteractive}"></m3e-ripple>
|
|
180
|
-
<div class="touch" aria-hidden="true"></div>
|
|
181
|
-
${isLinkButtonMixin(this) ? this[renderPseudoLink]() : nothing}
|
|
182
|
-
<div class="wrapper">${__classPrivateFieldGet(this, _M3eChipElement_instances, "m", _M3eChipElement_renderContent).call(this)}</div>
|
|
183
|
-
</div>`;
|
|
184
|
-
}
|
|
185
|
-
/** @internal */
|
|
186
|
-
_renderIcon() {
|
|
187
|
-
return html `<slot name="icon" aria-hidden="true" @slotchange="${__classPrivateFieldGet(this, _M3eChipElement_instances, "m", _M3eChipElement_handleIconSlotChange)}"></slot>`;
|
|
188
|
-
}
|
|
189
|
-
/** @internal */
|
|
190
|
-
_renderTrailingIcon() {
|
|
191
|
-
return html `<slot
|
|
192
|
-
name="trailing-icon"
|
|
193
|
-
aria-hidden="true"
|
|
194
|
-
@slotchange="${__classPrivateFieldGet(this, _M3eChipElement_instances, "m", _M3eChipElement_handleTrailingIconSlotChange)}"
|
|
195
|
-
></slot>`;
|
|
196
|
-
}
|
|
197
|
-
/** @internal */
|
|
198
|
-
_renderSlot() {
|
|
199
|
-
return html `<slot @slotchange="${__classPrivateFieldGet(this, _M3eChipElement_instances, "m", _M3eChipElement_handleSlotChange)}"></slot>`;
|
|
495
|
+
constructor() {
|
|
496
|
+
super(...arguments);
|
|
497
|
+
_M3eChipElement_instances.add(this);
|
|
498
|
+
/** @private */
|
|
499
|
+
_M3eChipElement_value.set(this, void 0);
|
|
500
|
+
/** @private */
|
|
501
|
+
_M3eChipElement_textContent.set(this, "");
|
|
502
|
+
/**
|
|
503
|
+
* The appearance variant of the chip.
|
|
504
|
+
* @default "outlined"
|
|
505
|
+
*/
|
|
506
|
+
this.variant = "outlined";
|
|
507
|
+
}
|
|
508
|
+
/** A string representing the value of the chip. */
|
|
509
|
+
get value() {
|
|
510
|
+
return __classPrivateFieldGet(this, _M3eChipElement_value, "f") ?? __classPrivateFieldGet(this, _M3eChipElement_textContent, "f");
|
|
511
|
+
}
|
|
512
|
+
set value(value) {
|
|
513
|
+
__classPrivateFieldSet(this, _M3eChipElement_value, value, "f");
|
|
514
|
+
}
|
|
515
|
+
/** @inheritdoc */
|
|
516
|
+
firstUpdated(_changedProperties) {
|
|
517
|
+
super.firstUpdated(_changedProperties);
|
|
518
|
+
if (this.role === "listitem") {
|
|
519
|
+
this.removeAttribute("tabindex");
|
|
200
520
|
}
|
|
521
|
+
[this._elevation, this._focusRing, this._stateLayer, this._ripple].forEach(x => {
|
|
522
|
+
if (!x?.htmlFor) {
|
|
523
|
+
x?.attach(this);
|
|
524
|
+
}
|
|
525
|
+
});
|
|
526
|
+
}
|
|
527
|
+
/** @inheritdoc */
|
|
528
|
+
render() {
|
|
529
|
+
const disabled = !isDisabledMixin(this) || this.disabled;
|
|
530
|
+
const disabledInteractive = isDisabledInteractiveMixin(this) && this.disabledInteractive;
|
|
531
|
+
return html`<div class="base"><m3e-elevation class="elevation" ?disabled="${disabled || disabledInteractive}"></m3e-elevation><m3e-state-layer class="state-layer" ?disabled="${disabled || disabledInteractive}"></m3e-state-layer><m3e-focus-ring class="focus-ring" ?disabled="${disabled}"></m3e-focus-ring><m3e-ripple class="ripple" ?disabled="${disabled || disabledInteractive}"></m3e-ripple><div class="touch" aria-hidden="true"></div>${isLinkButtonMixin(this) ? this[renderPseudoLink]() : nothing}<div class="wrapper">${__classPrivateFieldGet(this, _M3eChipElement_instances, "m", _M3eChipElement_renderContent).call(this)}</div></div>`;
|
|
532
|
+
}
|
|
533
|
+
/** @internal */
|
|
534
|
+
_renderIcon() {
|
|
535
|
+
return html`<slot name="icon" aria-hidden="true" @slotchange="${__classPrivateFieldGet(this, _M3eChipElement_instances, "m", _M3eChipElement_handleIconSlotChange)}"></slot>`;
|
|
536
|
+
}
|
|
537
|
+
/** @internal */
|
|
538
|
+
_renderTrailingIcon() {
|
|
539
|
+
return html`<slot name="trailing-icon" aria-hidden="true" @slotchange="${__classPrivateFieldGet(this, _M3eChipElement_instances, "m", _M3eChipElement_handleTrailingIconSlotChange)}"></slot>`;
|
|
540
|
+
}
|
|
541
|
+
/** @internal */
|
|
542
|
+
_renderSlot() {
|
|
543
|
+
return html`<slot @slotchange="${__classPrivateFieldGet(this, _M3eChipElement_instances, "m", _M3eChipElement_handleSlotChange)}"></slot>`;
|
|
544
|
+
}
|
|
201
545
|
};
|
|
202
546
|
_M3eChipElement_value = new WeakMap();
|
|
203
547
|
_M3eChipElement_textContent = new WeakMap();
|
|
204
548
|
_M3eChipElement_instances = new WeakSet();
|
|
205
549
|
_M3eChipElement_renderContent = function _M3eChipElement_renderContent() {
|
|
206
|
-
|
|
207
|
-
<div class="label">${this._renderSlot()}</div>
|
|
208
|
-
${this._renderTrailingIcon()}`;
|
|
550
|
+
return html`${this._renderIcon()}<div class="label">${this._renderSlot()}</div>${this._renderTrailingIcon()}`;
|
|
209
551
|
};
|
|
210
552
|
_M3eChipElement_handleIconSlotChange = function _M3eChipElement_handleIconSlotChange(e) {
|
|
211
|
-
|
|
553
|
+
this.classList.toggle("-with-icon", hasAssignedNodes(e.target));
|
|
212
554
|
};
|
|
213
555
|
_M3eChipElement_handleTrailingIconSlotChange = function _M3eChipElement_handleTrailingIconSlotChange(e) {
|
|
214
|
-
|
|
556
|
+
this.classList.toggle("-with-trailing-icon", hasAssignedNodes(e.target));
|
|
215
557
|
};
|
|
216
558
|
_M3eChipElement_handleSlotChange = function _M3eChipElement_handleSlotChange(e) {
|
|
217
|
-
|
|
559
|
+
__classPrivateFieldSet(this, _M3eChipElement_textContent, getTextContent(e.target), "f");
|
|
218
560
|
};
|
|
219
561
|
/** The styles of the element. */
|
|
220
|
-
M3eChipElement.styles = css `
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
display: inline-flex;
|
|
231
|
-
align-items: center;
|
|
232
|
-
justify-content: center;
|
|
233
|
-
position: relative;
|
|
234
|
-
width: 100%;
|
|
235
|
-
transition: ${unsafeCSS(`background-color ${DesignToken.motion.duration.short4} ${DesignToken.motion.easing.standard}`)};
|
|
236
|
-
border-radius: var(--m3e-chip-container-shape, ${DesignToken.shape.corner.small});
|
|
237
|
-
height: calc(var(--m3e-chip-container-height, 2rem) + ${DesignToken.density.calc(-2)});
|
|
238
|
-
font-size: var(--m3e-chip-label-text-font-size, ${DesignToken.typescale.standard.label.large.fontSize});
|
|
239
|
-
font-weight: var(--m3e-chip-label-text-font-weight, ${DesignToken.typescale.standard.label.large.fontWeight});
|
|
240
|
-
line-height: var(--m3e-chip-label-text-line-height, ${DesignToken.typescale.standard.label.large.lineHeight});
|
|
241
|
-
letter-spacing: var(--m3e-chip-label-text-tracking, ${DesignToken.typescale.standard.label.large.tracking});
|
|
242
|
-
}
|
|
243
|
-
:host(:not(m3e-chip):not(:disabled):not([disabled-interactive])) {
|
|
244
|
-
cursor: pointer;
|
|
245
|
-
}
|
|
246
|
-
:host(:not(m3e-chip):not(:disabled)[disabled-interactive]) {
|
|
247
|
-
cursor: not-allowed;
|
|
248
|
-
}
|
|
249
|
-
:host(:not(m3e-chip):not(:disabled):not([disabled-interactive])) .base {
|
|
250
|
-
user-select: none;
|
|
251
|
-
}
|
|
252
|
-
.touch {
|
|
253
|
-
position: absolute;
|
|
254
|
-
height: 3rem;
|
|
255
|
-
left: 0;
|
|
256
|
-
right: 0;
|
|
257
|
-
}
|
|
258
|
-
.wrapper {
|
|
259
|
-
width: 100%;
|
|
260
|
-
overflow: hidden;
|
|
261
|
-
display: inline-flex;
|
|
262
|
-
align-items: center;
|
|
263
|
-
column-gap: var(--m3e-chip-spacing, 0.5rem);
|
|
264
|
-
}
|
|
265
|
-
.label {
|
|
266
|
-
flex: 1 1 auto;
|
|
267
|
-
min-width: 0;
|
|
268
|
-
white-space: nowrap;
|
|
269
|
-
overflow: hidden;
|
|
270
|
-
text-overflow: ellipsis;
|
|
271
|
-
}
|
|
272
|
-
a {
|
|
273
|
-
all: unset;
|
|
274
|
-
display: block;
|
|
275
|
-
position: absolute;
|
|
276
|
-
top: 0px;
|
|
277
|
-
left: 0px;
|
|
278
|
-
right: 0px;
|
|
279
|
-
bottom: 0px;
|
|
280
|
-
z-index: 1;
|
|
281
|
-
}
|
|
282
|
-
:host([variant="elevated"]) .base {
|
|
283
|
-
background-color: var(--m3e-elevated-chip-container-color, ${DesignToken.color.surfaceContainerLow});
|
|
284
|
-
|
|
285
|
-
--m3e-elevation-level: var(--m3e-elevated-chip-elevation, ${DesignToken.elevation.level1});
|
|
286
|
-
--m3e-elevation-hover-level: var(--m3e-elevated-chip-hover-elevation, ${DesignToken.elevation.level2});
|
|
287
|
-
--m3e-elevation-focus-level: var(--m3e-elevated-chip-elevation, ${DesignToken.elevation.level1});
|
|
288
|
-
--m3e-elevation-pressed-level: var(--m3e-elevated-chip-elevation, ${DesignToken.elevation.level1});
|
|
289
|
-
}
|
|
290
|
-
:host([variant="outlined"]) .base {
|
|
291
|
-
outline-width: var(--m3e-outlined-chip-outline-thickness, 1px);
|
|
292
|
-
outline-style: solid;
|
|
293
|
-
outline-offset: calc(0px - var(--m3e-outlined-chip-outline-thickness, 1px));
|
|
294
|
-
}
|
|
295
|
-
:host(:not(:disabled):not([disabled-interactive])[variant="outlined"]) .base {
|
|
296
|
-
outline-color: var(--m3e-outlined-chip-outline-color, ${DesignToken.color.outlineVariant});
|
|
297
|
-
}
|
|
298
|
-
:host(:disabled[variant="outlined"]) .base,
|
|
299
|
-
:host([disabled-interactive][variant="outlined"]) .base {
|
|
300
|
-
outline-color: color-mix(
|
|
301
|
-
in srgb,
|
|
302
|
-
var(--m3e-outlined-chip-disabled-outline-color, ${DesignToken.color.onSurface})
|
|
303
|
-
var(--m3e-outlined-chip-disabled-outline-opacity, 12%),
|
|
304
|
-
transparent
|
|
305
|
-
);
|
|
306
|
-
}
|
|
307
|
-
:host(.-with-icon) .wrapper {
|
|
308
|
-
padding-inline-start: var(--m3e-chip-with-icon-padding-start, 0.5rem);
|
|
309
|
-
}
|
|
310
|
-
:host(:not(.-with-icon)) .wrapper {
|
|
311
|
-
padding-inline-start: var(--m3e-chip-padding-start, 1rem);
|
|
312
|
-
}
|
|
313
|
-
:host(.-with-trailing-icon) .wrapper {
|
|
314
|
-
padding-inline-end: var(--m3e-chip-with-icon-padding-end, 0.5rem);
|
|
315
|
-
}
|
|
316
|
-
:host(:not(.-with-trailing-icon)) .wrapper {
|
|
317
|
-
padding-inline-end: var(--m3e-chip-padding-end, 1rem);
|
|
318
|
-
}
|
|
319
|
-
::slotted([slot="icon"]),
|
|
320
|
-
::slotted([slot="trailing-icon"]) {
|
|
321
|
-
flex: none;
|
|
322
|
-
width: 1em;
|
|
323
|
-
font-size: var(--m3e-chip-icon-size, 1.125rem) !important;
|
|
324
|
-
}
|
|
325
|
-
:host(:not(:disabled):not([disabled-interactive]):not([selected])) .base {
|
|
326
|
-
color: var(--m3e-chip-label-text-color, ${DesignToken.color.onSurface});
|
|
327
|
-
}
|
|
328
|
-
:host(:not(:disabled):not([disabled-interactive]):not([selected])) ::slotted([slot="icon"]),
|
|
329
|
-
:host(:not(:disabled):not([disabled-interactive]):not([selected])) ::slotted([slot="trailing-icon"]) {
|
|
330
|
-
color: var(--m3e-chip-icon-color, ${DesignToken.color.primary});
|
|
331
|
-
}
|
|
332
|
-
:host(:disabled) .base,
|
|
333
|
-
:host([disabled-interactive]) .base {
|
|
334
|
-
color: color-mix(
|
|
335
|
-
in srgb,
|
|
336
|
-
var(--m3e-chip-disabled-label-text-color, ${DesignToken.color.onSurface})
|
|
337
|
-
var(--m3e-chip-disabled-label-text-opacity, 38%),
|
|
338
|
-
transparent
|
|
339
|
-
);
|
|
340
|
-
}
|
|
341
|
-
:host(:disabled) ::slotted([slot="icon"]),
|
|
342
|
-
:host([disabled-interactive]) ::slotted([slot="icon"]),
|
|
343
|
-
:host(:disabled) ::slotted([slot="trailing-icon"]),
|
|
344
|
-
:host([disabled-interactive]) ::slotted([slot="trailing-icon"]) {
|
|
345
|
-
color: color-mix(
|
|
346
|
-
in srgb,
|
|
347
|
-
var(--m3e-chip-disabled-icon-color, ${DesignToken.color.onSurface}) var(--m3e-chip-disabled-icon-opacity, 38%),
|
|
348
|
-
transparent
|
|
349
|
-
);
|
|
350
|
-
}
|
|
351
|
-
:host([variant="elevated"]:disabled) .base,
|
|
352
|
-
:host([variant="elevated"][disabled-interactive]) .base {
|
|
353
|
-
background-color: color-mix(
|
|
354
|
-
in srgb,
|
|
355
|
-
var(--m3e-elevated-chip-disabled-container-color, ${DesignToken.color.onSurface})
|
|
356
|
-
var(--m3e-elevated-chip-disabled-container-opacity, 12%),
|
|
357
|
-
transparent
|
|
358
|
-
);
|
|
359
|
-
--m3e-elevation-level: var(--m3e-elevated-chip-disabled-elevation, ${DesignToken.elevation.level0});
|
|
360
|
-
}
|
|
361
|
-
@media (prefers-reduced-motion) {
|
|
362
|
-
.base {
|
|
363
|
-
transition: none;
|
|
364
|
-
}
|
|
365
|
-
}
|
|
366
|
-
@media (forced-colors: active) {
|
|
367
|
-
.base {
|
|
368
|
-
transition: none;
|
|
369
|
-
}
|
|
370
|
-
:host(:not(:disabled):not([disabled-interactive]):not([selected])) .base,
|
|
371
|
-
:host(:not(:disabled):not([disabled-interactive]):not([selected])) ::slotted([slot="icon"]),
|
|
372
|
-
:host(:not(:disabled):not([disabled-interactive]):not([selected])) ::slotted([slot="trailing-icon"]) {
|
|
373
|
-
color: CanvasText;
|
|
374
|
-
}
|
|
375
|
-
:host(:not(:disabled):not([disabled-interactive])[variant="outlined"]) .base {
|
|
376
|
-
outline-color: CanvasText;
|
|
377
|
-
}
|
|
378
|
-
:host(:disabled) .base,
|
|
379
|
-
:host([disabled-interactive]) .base,
|
|
380
|
-
:host(:disabled) ::slotted([slot="icon"]),
|
|
381
|
-
:host([disabled-interactive]) ::slotted([slot="icon"]),
|
|
382
|
-
:host(:disabled) ::slotted([slot="trailing-icon"]),
|
|
383
|
-
:host([disabled-interactive]) ::slotted([slot="trailing-icon"]) {
|
|
384
|
-
color: GrayText;
|
|
385
|
-
}
|
|
386
|
-
:host(:disabled[variant="outlined"]) .base,
|
|
387
|
-
:host([disabled-interactive][variant="outlined"]) .base {
|
|
388
|
-
outline-color: GrayText;
|
|
389
|
-
}
|
|
390
|
-
}
|
|
391
|
-
`;
|
|
392
|
-
__decorate([
|
|
393
|
-
e$1(".elevation")
|
|
394
|
-
], M3eChipElement.prototype, "_elevation", void 0);
|
|
395
|
-
__decorate([
|
|
396
|
-
e$1(".focus-ring")
|
|
397
|
-
], M3eChipElement.prototype, "_focusRing", void 0);
|
|
398
|
-
__decorate([
|
|
399
|
-
e$1(".state-layer")
|
|
400
|
-
], M3eChipElement.prototype, "_stateLayer", void 0);
|
|
401
|
-
__decorate([
|
|
402
|
-
e$1(".ripple")
|
|
403
|
-
], M3eChipElement.prototype, "_ripple", void 0);
|
|
404
|
-
__decorate([
|
|
405
|
-
n$1({ reflect: true })
|
|
406
|
-
], M3eChipElement.prototype, "variant", void 0);
|
|
407
|
-
__decorate([
|
|
408
|
-
n$1()
|
|
409
|
-
], M3eChipElement.prototype, "value", null);
|
|
410
|
-
M3eChipElement = __decorate([
|
|
411
|
-
t$2("m3e-chip")
|
|
412
|
-
], M3eChipElement);
|
|
562
|
+
M3eChipElement.styles = css`:host { display: inline-block; vertical-align: middle; outline: none; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); } .base { box-sizing: border-box; vertical-align: middle; display: inline-flex; align-items: center; justify-content: center; position: relative; width: 100%; transition: ${unsafeCSS(`background-color ${DesignToken.motion.duration.short4} ${DesignToken.motion.easing.standard}`)}; border-radius: var(--m3e-chip-container-shape, ${DesignToken.shape.corner.small}); height: calc(var(--m3e-chip-container-height, 2rem) + ${DesignToken.density.calc(-2)}); font-size: var(--m3e-chip-label-text-font-size, ${DesignToken.typescale.standard.label.large.fontSize}); font-weight: var(--m3e-chip-label-text-font-weight, ${DesignToken.typescale.standard.label.large.fontWeight}); line-height: var(--m3e-chip-label-text-line-height, ${DesignToken.typescale.standard.label.large.lineHeight}); letter-spacing: var(--m3e-chip-label-text-tracking, ${DesignToken.typescale.standard.label.large.tracking}); } :host(:not(m3e-chip):not(:disabled):not([disabled-interactive])) { cursor: pointer; } :host(:not(m3e-chip):not(:disabled)[disabled-interactive]) { cursor: not-allowed; } :host(:not(m3e-chip):not(:disabled):not([disabled-interactive])) .base { user-select: none; } .touch { position: absolute; height: 3rem; left: 0; right: 0; } .wrapper { width: 100%; overflow: hidden; display: inline-flex; align-items: center; column-gap: var(--m3e-chip-spacing, 0.5rem); } .label { flex: 1 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } a { all: unset; display: block; position: absolute; top: 0px; left: 0px; right: 0px; bottom: 0px; z-index: 1; } :host([variant="elevated"]) .base { background-color: var(--m3e-elevated-chip-container-color, ${DesignToken.color.surfaceContainerLow}); --m3e-elevation-level: var(--m3e-elevated-chip-elevation, ${DesignToken.elevation.level1}); --m3e-elevation-hover-level: var(--m3e-elevated-chip-hover-elevation, ${DesignToken.elevation.level2}); --m3e-elevation-focus-level: var(--m3e-elevated-chip-elevation, ${DesignToken.elevation.level1}); --m3e-elevation-pressed-level: var(--m3e-elevated-chip-elevation, ${DesignToken.elevation.level1}); } :host([variant="outlined"]) .base { outline-width: var(--m3e-outlined-chip-outline-thickness, 1px); outline-style: solid; outline-offset: calc(0px - var(--m3e-outlined-chip-outline-thickness, 1px)); } :host(:not(:disabled):not([disabled-interactive])[variant="outlined"]) .base { outline-color: var(--m3e-outlined-chip-outline-color, ${DesignToken.color.outlineVariant}); } :host(:disabled[variant="outlined"]) .base, :host([disabled-interactive][variant="outlined"]) .base { outline-color: color-mix( in srgb, var(--m3e-outlined-chip-disabled-outline-color, ${DesignToken.color.onSurface}) var(--m3e-outlined-chip-disabled-outline-opacity, 12%), transparent ); } :host(.-with-icon) .wrapper { padding-inline-start: var(--m3e-chip-with-icon-padding-start, 0.5rem); } :host(:not(.-with-icon)) .wrapper { padding-inline-start: var(--m3e-chip-padding-start, 1rem); } :host(.-with-trailing-icon) .wrapper { padding-inline-end: var(--m3e-chip-with-icon-padding-end, 0.5rem); } :host(:not(.-with-trailing-icon)) .wrapper { padding-inline-end: var(--m3e-chip-padding-end, 1rem); } ::slotted([slot="icon"]), ::slotted([slot="trailing-icon"]) { flex: none; width: 1em; font-size: var(--m3e-chip-icon-size, 1.125rem) !important; } :host(:not(:disabled):not([disabled-interactive]):not([selected])) .base { color: var(--m3e-chip-label-text-color, ${DesignToken.color.onSurface}); } :host(:not(:disabled):not([disabled-interactive]):not([selected])) ::slotted([slot="icon"]), :host(:not(:disabled):not([disabled-interactive]):not([selected])) ::slotted([slot="trailing-icon"]) { color: var(--m3e-chip-icon-color, ${DesignToken.color.primary}); } :host(:disabled) .base, :host([disabled-interactive]) .base { color: color-mix( in srgb, var(--m3e-chip-disabled-label-text-color, ${DesignToken.color.onSurface}) var(--m3e-chip-disabled-label-text-opacity, 38%), transparent ); } :host(:disabled) ::slotted([slot="icon"]), :host([disabled-interactive]) ::slotted([slot="icon"]), :host(:disabled) ::slotted([slot="trailing-icon"]), :host([disabled-interactive]) ::slotted([slot="trailing-icon"]) { color: color-mix( in srgb, var(--m3e-chip-disabled-icon-color, ${DesignToken.color.onSurface}) var(--m3e-chip-disabled-icon-opacity, 38%), transparent ); } :host([variant="elevated"]:disabled) .base, :host([variant="elevated"][disabled-interactive]) .base { background-color: color-mix( in srgb, var(--m3e-elevated-chip-disabled-container-color, ${DesignToken.color.onSurface}) var(--m3e-elevated-chip-disabled-container-opacity, 12%), transparent ); --m3e-elevation-level: var(--m3e-elevated-chip-disabled-elevation, ${DesignToken.elevation.level0}); } @media (prefers-reduced-motion) { .base { transition: none; } } @media (forced-colors: active) { .base { transition: none; } :host(:not(:disabled):not([disabled-interactive]):not([selected])) .base, :host(:not(:disabled):not([disabled-interactive]):not([selected])) ::slotted([slot="icon"]), :host(:not(:disabled):not([disabled-interactive]):not([selected])) ::slotted([slot="trailing-icon"]) { color: CanvasText; } :host(:not(:disabled):not([disabled-interactive])[variant="outlined"]) .base { outline-color: CanvasText; } :host(:disabled) .base, :host([disabled-interactive]) .base, :host(:disabled) ::slotted([slot="icon"]), :host([disabled-interactive]) ::slotted([slot="icon"]), :host(:disabled) ::slotted([slot="trailing-icon"]), :host([disabled-interactive]) ::slotted([slot="trailing-icon"]) { color: GrayText; } :host(:disabled[variant="outlined"]) .base, :host([disabled-interactive][variant="outlined"]) .base { outline-color: GrayText; } }`;
|
|
563
|
+
__decorate([e$1(".elevation")], M3eChipElement.prototype, "_elevation", void 0);
|
|
564
|
+
__decorate([e$1(".focus-ring")], M3eChipElement.prototype, "_focusRing", void 0);
|
|
565
|
+
__decorate([e$1(".state-layer")], M3eChipElement.prototype, "_stateLayer", void 0);
|
|
566
|
+
__decorate([e$1(".ripple")], M3eChipElement.prototype, "_ripple", void 0);
|
|
567
|
+
__decorate([n$1({
|
|
568
|
+
reflect: true
|
|
569
|
+
})], M3eChipElement.prototype, "variant", void 0);
|
|
570
|
+
__decorate([n$1()], M3eChipElement.prototype, "value", null);
|
|
571
|
+
M3eChipElement = __decorate([t$2("m3e-chip")], M3eChipElement);
|
|
413
572
|
|
|
414
573
|
/**
|
|
415
574
|
* A chip users interact with to perform a smart or automated action that can span multiple applications.
|
|
@@ -482,14 +641,12 @@ M3eChipElement = __decorate([
|
|
|
482
641
|
* @cssprop --m3e-outlined-chip-disabled-outline-opacity - Opacity applied to disabled outline.
|
|
483
642
|
*/
|
|
484
643
|
let M3eAssistChipElement = class M3eAssistChipElement extends FormSubmitter(AttachInternals(LinkButton(KeyboardClick(Focusable(DisabledInteractive(Disabled(Role(M3eChipElement, "button")))))), true)) {
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
644
|
+
/** @internal @inheritdoc */
|
|
645
|
+
_renderTrailingIcon() {
|
|
646
|
+
return nothing;
|
|
647
|
+
}
|
|
489
648
|
};
|
|
490
|
-
M3eAssistChipElement = __decorate([
|
|
491
|
-
t$2("m3e-assist-chip")
|
|
492
|
-
], M3eAssistChipElement);
|
|
649
|
+
M3eAssistChipElement = __decorate([t$2("m3e-assist-chip")], M3eAssistChipElement);
|
|
493
650
|
|
|
494
651
|
/**
|
|
495
652
|
* A container used to organize chips into a cohesive unit.
|
|
@@ -519,27 +676,14 @@ M3eAssistChipElement = __decorate([
|
|
|
519
676
|
* @cssprop --m3e-chip-set-spacing - The spacing (gap) between chips in the set.
|
|
520
677
|
*/
|
|
521
678
|
let M3eChipSetElement = class M3eChipSetElement extends Vertical(LitElement) {
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
679
|
+
/** @inheritdoc */
|
|
680
|
+
render() {
|
|
681
|
+
return html`<slot></slot>`;
|
|
682
|
+
}
|
|
526
683
|
};
|
|
527
684
|
/** The styles of the element. */
|
|
528
|
-
M3eChipSetElement.styles = css
|
|
529
|
-
|
|
530
|
-
display: inline-flex;
|
|
531
|
-
flex-wrap: wrap;
|
|
532
|
-
vertical-align: middle;
|
|
533
|
-
gap: var(--m3e-chip-set-spacing, 0.5rem);
|
|
534
|
-
outline: none;
|
|
535
|
-
}
|
|
536
|
-
:host([vertical]) {
|
|
537
|
-
flex-direction: column;
|
|
538
|
-
}
|
|
539
|
-
`;
|
|
540
|
-
M3eChipSetElement = __decorate([
|
|
541
|
-
t$2("m3e-chip-set")
|
|
542
|
-
], M3eChipSetElement);
|
|
685
|
+
M3eChipSetElement.styles = css`:host { display: inline-flex; flex-wrap: wrap; vertical-align: middle; gap: var(--m3e-chip-set-spacing, 0.5rem); outline: none; } :host([vertical]) { flex-direction: column; }`;
|
|
686
|
+
M3eChipSetElement = __decorate([t$2("m3e-chip-set")], M3eChipSetElement);
|
|
543
687
|
|
|
544
688
|
var _M3eFilterChipElement_instances, _M3eFilterChipElement_clickHandler, _M3eFilterChipElement_handleClick;
|
|
545
689
|
/**
|
|
@@ -625,166 +769,58 @@ var _M3eFilterChipElement_instances, _M3eFilterChipElement_clickHandler, _M3eFil
|
|
|
625
769
|
* @cssprop --m3e-chip-unselected-trailing-icon-color - Trailing icon color in unselected state.
|
|
626
770
|
*/
|
|
627
771
|
let M3eFilterChipElement = class M3eFilterChipElement extends Selected(KeyboardClick(Focusable(DisabledInteractive(Disabled(AttachInternals(Role(M3eChipElement, "radio"), true)))))) {
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
}
|
|
650
|
-
/** @inheritdoc @private */
|
|
651
|
-
_renderIcon() {
|
|
652
|
-
return html `<div class="icon" aria-hidden="true">
|
|
653
|
-
<svg class="check" viewBox="0 -960 960 960" aria-hidden="true">
|
|
654
|
-
<path fill="currentColor" d="M382-240 154-468l57-57 171 171 367-367 57 57-424 424Z" />
|
|
655
|
-
</svg>
|
|
656
|
-
${super._renderIcon()}
|
|
657
|
-
</div>`;
|
|
772
|
+
constructor() {
|
|
773
|
+
super(...arguments);
|
|
774
|
+
_M3eFilterChipElement_instances.add(this);
|
|
775
|
+
/** @private */
|
|
776
|
+
_M3eFilterChipElement_clickHandler.set(this, e => __classPrivateFieldGet(this, _M3eFilterChipElement_instances, "m", _M3eFilterChipElement_handleClick).call(this, e));
|
|
777
|
+
}
|
|
778
|
+
/** @inheritdoc */
|
|
779
|
+
connectedCallback() {
|
|
780
|
+
super.connectedCallback();
|
|
781
|
+
this.addEventListener("click", __classPrivateFieldGet(this, _M3eFilterChipElement_clickHandler, "f"));
|
|
782
|
+
}
|
|
783
|
+
/** @inheritdoc */
|
|
784
|
+
disconnectedCallback() {
|
|
785
|
+
super.disconnectedCallback();
|
|
786
|
+
this.removeEventListener("click", __classPrivateFieldGet(this, _M3eFilterChipElement_clickHandler, "f"));
|
|
787
|
+
}
|
|
788
|
+
/** @inheritdoc */
|
|
789
|
+
update(changedProperties) {
|
|
790
|
+
super.update(changedProperties);
|
|
791
|
+
if (changedProperties.has("selected")) {
|
|
792
|
+
this.closest("m3e-filter-chip-set")?.[selectionManager].notifySelectionChange(this);
|
|
658
793
|
}
|
|
794
|
+
}
|
|
795
|
+
/** @inheritdoc @private */
|
|
796
|
+
_renderIcon() {
|
|
797
|
+
return html`<div class="icon" aria-hidden="true"><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> ${super._renderIcon()}</div>`;
|
|
798
|
+
}
|
|
659
799
|
};
|
|
660
800
|
_M3eFilterChipElement_clickHandler = new WeakMap();
|
|
661
801
|
_M3eFilterChipElement_instances = new WeakSet();
|
|
662
802
|
_M3eFilterChipElement_handleClick = function _M3eFilterChipElement_handleClick(e) {
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
803
|
+
if (e.defaultPrevented) return;
|
|
804
|
+
const selected = this.selected;
|
|
805
|
+
this.selected = !this.selected;
|
|
806
|
+
if (this.dispatchEvent(new Event("input", {
|
|
807
|
+
bubbles: true,
|
|
808
|
+
composed: true,
|
|
809
|
+
cancelable: true
|
|
810
|
+
}))) {
|
|
811
|
+
this.closest("m3e-filter-chip-set")?.[selectionManager].notifySelectionChange(this);
|
|
812
|
+
this.dispatchEvent(new Event("change", {
|
|
813
|
+
bubbles: true
|
|
814
|
+
}));
|
|
815
|
+
} else {
|
|
816
|
+
this.selected = selected;
|
|
817
|
+
}
|
|
674
818
|
};
|
|
675
819
|
/** The styles of the element. */
|
|
676
|
-
M3eFilterChipElement.styles = [
|
|
677
|
-
|
|
678
|
-
css `
|
|
679
|
-
:host([selected]:not(.-hide-selection)) .wrapper {
|
|
680
|
-
padding-inline-start: var(--m3e-chip-with-icon-padding-start, 0.5rem);
|
|
681
|
-
}
|
|
682
|
-
.icon {
|
|
683
|
-
display: flex;
|
|
684
|
-
align-items: center;
|
|
685
|
-
justify-content: center;
|
|
686
|
-
}
|
|
687
|
-
.check {
|
|
688
|
-
width: 1em;
|
|
689
|
-
font-size: var(--m3e-chip-icon-size, 1.125rem);
|
|
690
|
-
}
|
|
691
|
-
:host(:not(:disabled):not([disabled-interactive])) .check {
|
|
692
|
-
color: var(--m3e-chip-selected-leading-icon-color, ${DesignToken.color.onSecondaryContainer});
|
|
693
|
-
}
|
|
694
|
-
:host(:not([selected])) .check,
|
|
695
|
-
:host(.-hide-selection) .check,
|
|
696
|
-
:host(.-hide-selection:not(.-with-icon)) .icon {
|
|
697
|
-
display: none;
|
|
698
|
-
}
|
|
699
|
-
:host(:not(.-with-icon)) .icon {
|
|
700
|
-
margin-inline-start: calc(0px - var(--m3e-chip-with-icon-padding-start, 0.5rem));
|
|
701
|
-
transition: margin-inline-start ${DesignToken.motion.spring.fastEffects};
|
|
702
|
-
}
|
|
703
|
-
:host([selected]) .icon {
|
|
704
|
-
margin-inline-start: 0;
|
|
705
|
-
}
|
|
706
|
-
:host([selected]:not(.-hide-selection)) ::slotted([slot="icon"]) {
|
|
707
|
-
display: none !important;
|
|
708
|
-
}
|
|
709
|
-
:host(:not(:disabled):not([disabled-interactive]):not([selected])) .base {
|
|
710
|
-
color: var(--m3e-chip-unselected-label-text-color, ${DesignToken.color.onSurfaceVariant});
|
|
711
|
-
--m3e-ripple-color: var(--m3e-chip-unselected-ripple-color, ${DesignToken.color.onSurfaceVariant});
|
|
712
|
-
--m3e-state-layer-focus-color: var(
|
|
713
|
-
--m3e-chip-unselected-state-layer-focus-color,
|
|
714
|
-
${DesignToken.color.onSurfaceVariant}
|
|
715
|
-
);
|
|
716
|
-
--m3e-state-layer-hover-color: var(
|
|
717
|
-
--m3e-chip-unselected-state-layer-hover-color,
|
|
718
|
-
${DesignToken.color.onSurfaceVariant}
|
|
719
|
-
);
|
|
720
|
-
}
|
|
721
|
-
:host(:not(:disabled):not([disabled-interactive]):not([selected])) ::slotted([slot="icon"]) {
|
|
722
|
-
color: var(--m3e-chip-unselected-leading-icon-color, ${DesignToken.color.primary});
|
|
723
|
-
}
|
|
724
|
-
:host(:not(:disabled):not([disabled-interactive]):not([selected])) ::slotted([slot="trailing-icon"]) {
|
|
725
|
-
color: var(--m3e-chip-unselected-trailing-icon-color, ${DesignToken.color.onSurfaceVariant});
|
|
726
|
-
}
|
|
727
|
-
:host(:not(:disabled):not([disabled-interactive])[selected]) .base {
|
|
728
|
-
outline-offset: unset;
|
|
729
|
-
outline-width: var(--m3e-chip-selected-outline-thickness, 0);
|
|
730
|
-
color: var(--m3e-chip-selected-label-text-color, ${DesignToken.color.onSecondaryContainer});
|
|
731
|
-
background-color: var(--m3e-chip-selected-container-color, ${DesignToken.color.secondaryContainer});
|
|
732
|
-
--m3e-state-layer-hover-color: var(
|
|
733
|
-
--m3e-chip-selected-container-hover-color,
|
|
734
|
-
${DesignToken.color.onSecondaryContainer}
|
|
735
|
-
);
|
|
736
|
-
--m3e-state-layer-focus-color: var(
|
|
737
|
-
--m3e-chip-selected-container-focus-color,
|
|
738
|
-
${DesignToken.color.onSecondaryContainer}
|
|
739
|
-
);
|
|
740
|
-
--m3e-elevation-hover-level: var(--m3e-chip-selected-hover-elevation, ${DesignToken.elevation.level1});
|
|
741
|
-
--m3e-ripple-color: var(--m3e-chip-selected-ripple-color, ${DesignToken.color.onSecondaryContainer});
|
|
742
|
-
--m3e-state-layer-focus-color: var(
|
|
743
|
-
--m3e-chip-selected-state-layer-focus-color,
|
|
744
|
-
${DesignToken.color.onSecondaryContainer}
|
|
745
|
-
);
|
|
746
|
-
--m3e-state-layer-hover-color: var(
|
|
747
|
-
--m3e-chip-selected-state-layer-hover-color,
|
|
748
|
-
${DesignToken.color.onSecondaryContainer}
|
|
749
|
-
);
|
|
750
|
-
}
|
|
751
|
-
:host(:not(:disabled):not([disabled-interactive])[selected]) ::slotted([slot="icon"]) {
|
|
752
|
-
color: var(--m3e-chip-selected-leading-icon-color, ${DesignToken.color.onSecondaryContainer});
|
|
753
|
-
}
|
|
754
|
-
:host(:not(:disabled):not([disabled-interactive]):not([selected])) ::slotted([slot="trailing-icon"]) {
|
|
755
|
-
color: var(--m3e-chip-selected-trailing-icon-color, ${DesignToken.color.onSecondaryContainer});
|
|
756
|
-
}
|
|
757
|
-
@media (prefers-reduced-motion) {
|
|
758
|
-
.base,
|
|
759
|
-
:host(:not(.-with-icon)) .icon {
|
|
760
|
-
transition: none;
|
|
761
|
-
}
|
|
762
|
-
}
|
|
763
|
-
@media (forced-colors: active) {
|
|
764
|
-
:host(:not(:disabled):not([disabled-interactive]):not([selected])) .base,
|
|
765
|
-
:host(:not(:disabled):not([disabled-interactive]):not([selected])) ::slotted([slot="icon"]),
|
|
766
|
-
:host(:not(:disabled):not([disabled-interactive]):not([selected])) ::slotted([slot="trailing-icon"]) {
|
|
767
|
-
color: CanvasText;
|
|
768
|
-
}
|
|
769
|
-
:host(:not(:disabled):not([disabled-interactive])[selected]) .base,
|
|
770
|
-
:host(:not(:disabled):not([disabled-interactive])[selected]) ::slotted([slot="icon"]),
|
|
771
|
-
:host(:not(:disabled):not([disabled-interactive])[selected]) ::slotted([slot="trailing-icon"]),
|
|
772
|
-
:host(:not(:disabled):not([disabled-interactive])) .check {
|
|
773
|
-
color: ButtonText;
|
|
774
|
-
}
|
|
775
|
-
:host(:not(:disabled):not([disabled-interactive])[selected]) .base {
|
|
776
|
-
outline-offset: calc(0px - var(--m3e-outlined-chip-outline-thickness, 1px));
|
|
777
|
-
outline-width: var(--m3e-outlined-chip-outline-thickness, 1px);
|
|
778
|
-
outline-color: ButtonText;
|
|
779
|
-
}
|
|
780
|
-
}
|
|
781
|
-
`,
|
|
782
|
-
];
|
|
783
|
-
M3eFilterChipElement = __decorate([
|
|
784
|
-
t$2("m3e-filter-chip")
|
|
785
|
-
], M3eFilterChipElement);
|
|
820
|
+
M3eFilterChipElement.styles = [M3eChipElement.styles, css`:host([selected]:not(.-hide-selection)) .wrapper { padding-inline-start: var(--m3e-chip-with-icon-padding-start, 0.5rem); } .icon { display: flex; align-items: center; justify-content: center; } .check { width: 1em; font-size: var(--m3e-chip-icon-size, 1.125rem); } :host(:not(:disabled):not([disabled-interactive])) .check { color: var(--m3e-chip-selected-leading-icon-color, ${DesignToken.color.onSecondaryContainer}); } :host(:not([selected])) .check, :host(.-hide-selection) .check, :host(.-hide-selection:not(.-with-icon)) .icon { display: none; } :host(:not(.-with-icon)) .icon { margin-inline-start: calc(0px - var(--m3e-chip-with-icon-padding-start, 0.5rem)); transition: margin-inline-start ${DesignToken.motion.spring.fastEffects}; } :host([selected]) .icon { margin-inline-start: 0; } :host([selected]:not(.-hide-selection)) ::slotted([slot="icon"]) { display: none !important; } :host(:not(:disabled):not([disabled-interactive]):not([selected])) .base { color: var(--m3e-chip-unselected-label-text-color, ${DesignToken.color.onSurfaceVariant}); --m3e-ripple-color: var(--m3e-chip-unselected-ripple-color, ${DesignToken.color.onSurfaceVariant}); --m3e-state-layer-focus-color: var( --m3e-chip-unselected-state-layer-focus-color, ${DesignToken.color.onSurfaceVariant} ); --m3e-state-layer-hover-color: var( --m3e-chip-unselected-state-layer-hover-color, ${DesignToken.color.onSurfaceVariant} ); } :host(:not(:disabled):not([disabled-interactive]):not([selected])) ::slotted([slot="icon"]) { color: var(--m3e-chip-unselected-leading-icon-color, ${DesignToken.color.primary}); } :host(:not(:disabled):not([disabled-interactive]):not([selected])) ::slotted([slot="trailing-icon"]) { color: var(--m3e-chip-unselected-trailing-icon-color, ${DesignToken.color.onSurfaceVariant}); } :host(:not(:disabled):not([disabled-interactive])[selected]) .base { outline-offset: unset; outline-width: var(--m3e-chip-selected-outline-thickness, 0); color: var(--m3e-chip-selected-label-text-color, ${DesignToken.color.onSecondaryContainer}); background-color: var(--m3e-chip-selected-container-color, ${DesignToken.color.secondaryContainer}); --m3e-state-layer-hover-color: var( --m3e-chip-selected-container-hover-color, ${DesignToken.color.onSecondaryContainer} ); --m3e-state-layer-focus-color: var( --m3e-chip-selected-container-focus-color, ${DesignToken.color.onSecondaryContainer} ); --m3e-elevation-hover-level: var(--m3e-chip-selected-hover-elevation, ${DesignToken.elevation.level1}); --m3e-ripple-color: var(--m3e-chip-selected-ripple-color, ${DesignToken.color.onSecondaryContainer}); --m3e-state-layer-focus-color: var( --m3e-chip-selected-state-layer-focus-color, ${DesignToken.color.onSecondaryContainer} ); --m3e-state-layer-hover-color: var( --m3e-chip-selected-state-layer-hover-color, ${DesignToken.color.onSecondaryContainer} ); } :host(:not(:disabled):not([disabled-interactive])[selected]) ::slotted([slot="icon"]) { color: var(--m3e-chip-selected-leading-icon-color, ${DesignToken.color.onSecondaryContainer}); } :host(:not(:disabled):not([disabled-interactive]):not([selected])) ::slotted([slot="trailing-icon"]) { color: var(--m3e-chip-selected-trailing-icon-color, ${DesignToken.color.onSecondaryContainer}); } @media (prefers-reduced-motion) { .base, :host(:not(.-with-icon)) .icon { transition: none; } } @media (forced-colors: active) { :host(:not(:disabled):not([disabled-interactive]):not([selected])) .base, :host(:not(:disabled):not([disabled-interactive]):not([selected])) ::slotted([slot="icon"]), :host(:not(:disabled):not([disabled-interactive]):not([selected])) ::slotted([slot="trailing-icon"]) { color: CanvasText; } :host(:not(:disabled):not([disabled-interactive])[selected]) .base, :host(:not(:disabled):not([disabled-interactive])[selected]) ::slotted([slot="icon"]), :host(:not(:disabled):not([disabled-interactive])[selected]) ::slotted([slot="trailing-icon"]), :host(:not(:disabled):not([disabled-interactive])) .check { color: ButtonText; } :host(:not(:disabled):not([disabled-interactive])[selected]) .base { outline-offset: calc(0px - var(--m3e-outlined-chip-outline-thickness, 1px)); outline-width: var(--m3e-outlined-chip-outline-thickness, 1px); outline-color: ButtonText; } }`];
|
|
821
|
+
M3eFilterChipElement = __decorate([t$2("m3e-filter-chip")], M3eFilterChipElement);
|
|
786
822
|
|
|
787
|
-
var _M3eFilterChipSetElement_instances, _M3eFilterChipSetElement_handleSlotChange, _M3eFilterChipSetElement_handleKeyDown, _M3eFilterChipSetElement_handleChange, _M3eFilterChipSetElement_updateChipRole, _a;
|
|
823
|
+
var _M3eFilterChipSetElement_instances, _M3eFilterChipSetElement_directionalitySubscription, _M3eFilterChipSetElement_handleSlotChange, _M3eFilterChipSetElement_handleKeyDown, _M3eFilterChipSetElement_handleChange, _M3eFilterChipSetElement_updateChipRole, _a;
|
|
788
824
|
/**
|
|
789
825
|
* A container that organizes filter chips into a cohesive group, enabling selection and
|
|
790
826
|
* deselection of values used to refine content or trigger contextual behavior.
|
|
@@ -823,127 +859,422 @@ var _M3eFilterChipSetElement_instances, _M3eFilterChipSetElement_handleSlotChang
|
|
|
823
859
|
* @cssprop --m3e-chip-set-spacing - The spacing (gap) between chips in the set.
|
|
824
860
|
*/
|
|
825
861
|
let M3eFilterChipSetElement = class M3eFilterChipSetElement extends Labelled(Dirty(Touched(FormAssociated(Disabled(AttachInternals(Role(M3eChipSetElement, "radiogroup"))))))) {
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
862
|
+
constructor() {
|
|
863
|
+
super(...arguments);
|
|
864
|
+
_M3eFilterChipSetElement_instances.add(this);
|
|
865
|
+
/** @private */
|
|
866
|
+
_M3eFilterChipSetElement_directionalitySubscription.set(this, void 0);
|
|
867
|
+
/** @internal */
|
|
868
|
+
this[_a] = new SelectionManager().onActiveItemChange(() => this[selectionManager].activeItem?.focus()).withWrap().withDirectionality(M3eDirectionality.current);
|
|
869
|
+
/**
|
|
870
|
+
* Whether multiple chips can be selected.
|
|
871
|
+
* @default false
|
|
872
|
+
*/
|
|
873
|
+
this.multi = false;
|
|
874
|
+
/**
|
|
875
|
+
* Whether to hide the selection indicator.
|
|
876
|
+
* @default false
|
|
877
|
+
*/
|
|
878
|
+
this.hideSelectionIndicator = false;
|
|
879
|
+
}
|
|
880
|
+
/** The chips of the set. */
|
|
881
|
+
get chips() {
|
|
882
|
+
return this[selectionManager]?.items ?? [];
|
|
883
|
+
}
|
|
884
|
+
/** The selected chip(s) of the set. */
|
|
885
|
+
get selected() {
|
|
886
|
+
return this[selectionManager]?.selectedItems ?? [];
|
|
887
|
+
}
|
|
888
|
+
/** The selected value(s) of the set. */
|
|
889
|
+
get value() {
|
|
890
|
+
const values = this.selected.map(x => x.value);
|
|
891
|
+
switch (values.length) {
|
|
892
|
+
case 0:
|
|
893
|
+
return null;
|
|
894
|
+
case 1:
|
|
895
|
+
return values[0];
|
|
896
|
+
default:
|
|
897
|
+
return values;
|
|
843
898
|
}
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
899
|
+
}
|
|
900
|
+
/** @inheritdoc @internal */
|
|
901
|
+
get [(_M3eFilterChipSetElement_directionalitySubscription = new WeakMap(), _M3eFilterChipSetElement_instances = new WeakSet(), _a = selectionManager, formValue)]() {
|
|
902
|
+
const values = this.value;
|
|
903
|
+
if (Array.isArray(values)) {
|
|
904
|
+
const data = new FormData();
|
|
905
|
+
for (const value of values) {
|
|
906
|
+
data.append(this.name, value);
|
|
907
|
+
}
|
|
908
|
+
return data;
|
|
847
909
|
}
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
910
|
+
return values;
|
|
911
|
+
}
|
|
912
|
+
/** @inheritdoc */
|
|
913
|
+
connectedCallback() {
|
|
914
|
+
super.connectedCallback();
|
|
915
|
+
__classPrivateFieldSet(this, _M3eFilterChipSetElement_directionalitySubscription, M3eDirectionality.observe(() => this[selectionManager].directionality = M3eDirectionality.current), "f");
|
|
916
|
+
}
|
|
917
|
+
/** @inheritdoc */
|
|
918
|
+
disconnectedCallback() {
|
|
919
|
+
super.disconnectedCallback();
|
|
920
|
+
__classPrivateFieldGet(this, _M3eFilterChipSetElement_directionalitySubscription, "f")?.call(this);
|
|
921
|
+
}
|
|
922
|
+
/** @inheritdoc */
|
|
923
|
+
update(changedProperties) {
|
|
924
|
+
super.update(changedProperties);
|
|
925
|
+
if (changedProperties.has("vertical")) {
|
|
926
|
+
this[selectionManager].vertical = this.vertical;
|
|
851
927
|
}
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
const values = this.selected.map((x) => x.value);
|
|
855
|
-
switch (values.length) {
|
|
856
|
-
case 0:
|
|
857
|
-
return null;
|
|
858
|
-
case 1:
|
|
859
|
-
return values[0];
|
|
860
|
-
default:
|
|
861
|
-
return values;
|
|
862
|
-
}
|
|
928
|
+
if (changedProperties.has("disabled") && (changedProperties.get("disabled") !== undefined || this.disabled)) {
|
|
929
|
+
this[selectionManager].disabled = this.disabled;
|
|
863
930
|
}
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
for (const value of values) {
|
|
870
|
-
data.append(this.name, value);
|
|
871
|
-
}
|
|
872
|
-
return data;
|
|
873
|
-
}
|
|
874
|
-
return values;
|
|
931
|
+
if (changedProperties.has("multi")) {
|
|
932
|
+
this.role = this.multi ? "group" : "radiogroup";
|
|
933
|
+
__classPrivateFieldGet(this, _M3eFilterChipSetElement_instances, "m", _M3eFilterChipSetElement_updateChipRole).call(this);
|
|
934
|
+
this[selectionManager].multi = this.multi;
|
|
935
|
+
this[selectionManager].disableRovingTabIndex(this.multi);
|
|
875
936
|
}
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
if (changedProperties.has("vertical")) {
|
|
880
|
-
this[selectionManager].vertical = this.vertical;
|
|
881
|
-
}
|
|
882
|
-
if (changedProperties.has("disabled") && (changedProperties.get("disabled") !== undefined || this.disabled)) {
|
|
883
|
-
this[selectionManager].disabled = this.disabled;
|
|
884
|
-
}
|
|
885
|
-
if (changedProperties.has("multi")) {
|
|
886
|
-
this.role = this.multi ? "group" : "radiogroup";
|
|
887
|
-
__classPrivateFieldGet(this, _M3eFilterChipSetElement_instances, "m", _M3eFilterChipSetElement_updateChipRole).call(this);
|
|
888
|
-
this[selectionManager].multi = this.multi;
|
|
889
|
-
this[selectionManager].disableRovingTabIndex(this.multi);
|
|
890
|
-
}
|
|
891
|
-
if (changedProperties.has("multi") || changedProperties.has("disabled")) {
|
|
892
|
-
// aria-disabled is not supported on radiogroup roles.
|
|
893
|
-
this.ariaDisabled = this.multi && this.disabled ? "true" : null;
|
|
894
|
-
}
|
|
895
|
-
if (changedProperties.has("hideSelectionIndicator")) {
|
|
896
|
-
this.chips.forEach((x) => x.classList.toggle("-hide-selection", this.hideSelectionIndicator));
|
|
897
|
-
}
|
|
937
|
+
if (changedProperties.has("multi") || changedProperties.has("disabled")) {
|
|
938
|
+
// aria-disabled is not supported on radiogroup roles.
|
|
939
|
+
this.ariaDisabled = this.multi && this.disabled ? "true" : null;
|
|
898
940
|
}
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
return html `<slot
|
|
902
|
-
@slotchange="${__classPrivateFieldGet(this, _M3eFilterChipSetElement_instances, "m", _M3eFilterChipSetElement_handleSlotChange)}"
|
|
903
|
-
@keydown="${__classPrivateFieldGet(this, _M3eFilterChipSetElement_instances, "m", _M3eFilterChipSetElement_handleKeyDown)}"
|
|
904
|
-
@change="${__classPrivateFieldGet(this, _M3eFilterChipSetElement_instances, "m", _M3eFilterChipSetElement_handleChange)}"
|
|
905
|
-
></slot>`;
|
|
941
|
+
if (changedProperties.has("hideSelectionIndicator")) {
|
|
942
|
+
this.chips.forEach(x => x.classList.toggle("-hide-selection", this.hideSelectionIndicator));
|
|
906
943
|
}
|
|
944
|
+
}
|
|
945
|
+
/** @inheritdoc */
|
|
946
|
+
render() {
|
|
947
|
+
return html`<slot @slotchange="${__classPrivateFieldGet(this, _M3eFilterChipSetElement_instances, "m", _M3eFilterChipSetElement_handleSlotChange)}" @keydown="${__classPrivateFieldGet(this, _M3eFilterChipSetElement_instances, "m", _M3eFilterChipSetElement_handleKeyDown)}" @change="${__classPrivateFieldGet(this, _M3eFilterChipSetElement_instances, "m", _M3eFilterChipSetElement_handleChange)}"></slot>`;
|
|
948
|
+
}
|
|
907
949
|
};
|
|
908
950
|
_M3eFilterChipSetElement_handleSlotChange = function _M3eFilterChipSetElement_handleSlotChange() {
|
|
909
|
-
|
|
910
|
-
added
|
|
911
|
-
|
|
951
|
+
const {
|
|
952
|
+
added
|
|
953
|
+
} = this[selectionManager].setItems([...this.querySelectorAll("m3e-filter-chip")]);
|
|
954
|
+
added.forEach(x => x.classList.toggle("-hide-selection", this.hideSelectionIndicator));
|
|
955
|
+
__classPrivateFieldGet(this, _M3eFilterChipSetElement_instances, "m", _M3eFilterChipSetElement_updateChipRole).call(this);
|
|
912
956
|
};
|
|
913
957
|
_M3eFilterChipSetElement_handleKeyDown = function _M3eFilterChipSetElement_handleKeyDown(e) {
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
958
|
+
if (!this.multi) {
|
|
959
|
+
this[selectionManager].onKeyDown(e);
|
|
960
|
+
}
|
|
917
961
|
};
|
|
918
962
|
_M3eFilterChipSetElement_handleChange = function _M3eFilterChipSetElement_handleChange(e) {
|
|
919
|
-
|
|
920
|
-
|
|
963
|
+
e.stopPropagation();
|
|
964
|
+
this.dispatchEvent(new Event("change", {
|
|
965
|
+
bubbles: true
|
|
966
|
+
}));
|
|
921
967
|
};
|
|
922
968
|
_M3eFilterChipSetElement_updateChipRole = function _M3eFilterChipSetElement_updateChipRole() {
|
|
923
|
-
|
|
969
|
+
this.chips.forEach(x => x.role = this.multi ? "button" : "radio");
|
|
924
970
|
};
|
|
925
|
-
__decorate([
|
|
926
|
-
|
|
927
|
-
], M3eFilterChipSetElement.prototype, "multi", void 0);
|
|
928
|
-
__decorate([
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
M3eFilterChipSetElement
|
|
932
|
-
|
|
933
|
-
], M3eFilterChipSetElement);
|
|
971
|
+
__decorate([n$1({
|
|
972
|
+
type: Boolean
|
|
973
|
+
})], M3eFilterChipSetElement.prototype, "multi", void 0);
|
|
974
|
+
__decorate([n$1({
|
|
975
|
+
attribute: "hide-selection-indicator",
|
|
976
|
+
type: Boolean
|
|
977
|
+
})], M3eFilterChipSetElement.prototype, "hideSelectionIndicator", void 0);
|
|
978
|
+
M3eFilterChipSetElement = __decorate([t$2("m3e-filter-chip-set")], M3eFilterChipSetElement);
|
|
934
979
|
|
|
935
980
|
/**
|
|
936
981
|
* @license
|
|
937
982
|
* Copyright 2017 Google LLC
|
|
938
983
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
939
984
|
*/
|
|
940
|
-
const t
|
|
985
|
+
const t = globalThis,
|
|
986
|
+
i = t.trustedTypes,
|
|
987
|
+
s = i ? i.createPolicy("lit-html", {
|
|
988
|
+
createHTML: t => t
|
|
989
|
+
}) : void 0,
|
|
990
|
+
e = "$lit$",
|
|
991
|
+
h = `lit$${Math.random().toFixed(9).slice(2)}$`,
|
|
992
|
+
o$1 = "?" + h,
|
|
993
|
+
n = `<${o$1}>`,
|
|
994
|
+
r = document,
|
|
995
|
+
l = () => r.createComment(""),
|
|
996
|
+
c = t => null === t || "object" != typeof t && "function" != typeof t,
|
|
997
|
+
a = Array.isArray,
|
|
998
|
+
u = t => a(t) || "function" == typeof t?.[Symbol.iterator],
|
|
999
|
+
d = "[ \t\n\f\r]",
|
|
1000
|
+
f = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,
|
|
1001
|
+
v = /-->/g,
|
|
1002
|
+
_ = />/g,
|
|
1003
|
+
m = RegExp(`>|${d}(?:([^\\s"'>=/]+)(${d}*=${d}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`, "g"),
|
|
1004
|
+
p = /'/g,
|
|
1005
|
+
g = /"/g,
|
|
1006
|
+
$ = /^(?:script|style|textarea|title)$/i,
|
|
1007
|
+
T = Symbol.for("lit-noChange"),
|
|
1008
|
+
E = Symbol.for("lit-nothing"),
|
|
1009
|
+
A = new WeakMap(),
|
|
1010
|
+
C = r.createTreeWalker(r, 129);
|
|
1011
|
+
function P(t, i) {
|
|
1012
|
+
if (!a(t) || !t.hasOwnProperty("raw")) throw Error("invalid template strings array");
|
|
1013
|
+
return void 0 !== s ? s.createHTML(i) : i;
|
|
1014
|
+
}
|
|
1015
|
+
const V = (t, i) => {
|
|
1016
|
+
const s = t.length - 1,
|
|
1017
|
+
o = [];
|
|
1018
|
+
let r,
|
|
1019
|
+
l = 2 === i ? "<svg>" : 3 === i ? "<math>" : "",
|
|
1020
|
+
c = f;
|
|
1021
|
+
for (let i = 0; i < s; i++) {
|
|
1022
|
+
const s = t[i];
|
|
1023
|
+
let a,
|
|
1024
|
+
u,
|
|
1025
|
+
d = -1,
|
|
1026
|
+
y = 0;
|
|
1027
|
+
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);
|
|
1028
|
+
const x = c === m && t[i + 1].startsWith("/>") ? " " : "";
|
|
1029
|
+
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);
|
|
1030
|
+
}
|
|
1031
|
+
return [P(t, l + (t[s] || "<?>") + (2 === i ? "</svg>" : 3 === i ? "</math>" : "")), o];
|
|
1032
|
+
};
|
|
1033
|
+
class N {
|
|
1034
|
+
constructor({
|
|
1035
|
+
strings: t,
|
|
1036
|
+
_$litType$: s
|
|
1037
|
+
}, n) {
|
|
1038
|
+
let r;
|
|
1039
|
+
this.parts = [];
|
|
1040
|
+
let c = 0,
|
|
1041
|
+
a = 0;
|
|
1042
|
+
const u = t.length - 1,
|
|
1043
|
+
d = this.parts,
|
|
1044
|
+
[f, v] = V(t, s);
|
|
1045
|
+
if (this.el = N.createElement(f, n), C.currentNode = this.el.content, 2 === s || 3 === s) {
|
|
1046
|
+
const t = this.el.content.firstChild;
|
|
1047
|
+
t.replaceWith(...t.childNodes);
|
|
1048
|
+
}
|
|
1049
|
+
for (; null !== (r = C.nextNode()) && d.length < u;) {
|
|
1050
|
+
if (1 === r.nodeType) {
|
|
1051
|
+
if (r.hasAttributes()) for (const t of r.getAttributeNames()) if (t.endsWith(e)) {
|
|
1052
|
+
const i = v[a++],
|
|
1053
|
+
s = r.getAttribute(t).split(h),
|
|
1054
|
+
e = /([.?@])?(.*)/.exec(i);
|
|
1055
|
+
d.push({
|
|
1056
|
+
type: 1,
|
|
1057
|
+
index: c,
|
|
1058
|
+
name: e[2],
|
|
1059
|
+
strings: s,
|
|
1060
|
+
ctor: "." === e[1] ? H : "?" === e[1] ? I : "@" === e[1] ? L : k
|
|
1061
|
+
}), r.removeAttribute(t);
|
|
1062
|
+
} else t.startsWith(h) && (d.push({
|
|
1063
|
+
type: 6,
|
|
1064
|
+
index: c
|
|
1065
|
+
}), r.removeAttribute(t));
|
|
1066
|
+
if ($.test(r.tagName)) {
|
|
1067
|
+
const t = r.textContent.split(h),
|
|
1068
|
+
s = t.length - 1;
|
|
1069
|
+
if (s > 0) {
|
|
1070
|
+
r.textContent = i ? i.emptyScript : "";
|
|
1071
|
+
for (let i = 0; i < s; i++) r.append(t[i], l()), C.nextNode(), d.push({
|
|
1072
|
+
type: 2,
|
|
1073
|
+
index: ++c
|
|
1074
|
+
});
|
|
1075
|
+
r.append(t[s], l());
|
|
1076
|
+
}
|
|
1077
|
+
}
|
|
1078
|
+
} else if (8 === r.nodeType) if (r.data === o$1) d.push({
|
|
1079
|
+
type: 2,
|
|
1080
|
+
index: c
|
|
1081
|
+
});else {
|
|
1082
|
+
let t = -1;
|
|
1083
|
+
for (; -1 !== (t = r.data.indexOf(h, t + 1));) d.push({
|
|
1084
|
+
type: 7,
|
|
1085
|
+
index: c
|
|
1086
|
+
}), t += h.length - 1;
|
|
1087
|
+
}
|
|
1088
|
+
c++;
|
|
1089
|
+
}
|
|
1090
|
+
}
|
|
1091
|
+
static createElement(t, i) {
|
|
1092
|
+
const s = r.createElement("template");
|
|
1093
|
+
return s.innerHTML = t, s;
|
|
1094
|
+
}
|
|
1095
|
+
}
|
|
1096
|
+
function S(t, i, s = t, e) {
|
|
1097
|
+
if (i === T) return i;
|
|
1098
|
+
let h = void 0 !== e ? s._$Co?.[e] : s._$Cl;
|
|
1099
|
+
const o = c(i) ? void 0 : i._$litDirective$;
|
|
1100
|
+
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;
|
|
1101
|
+
}
|
|
1102
|
+
class M {
|
|
1103
|
+
constructor(t, i) {
|
|
1104
|
+
this._$AV = [], this._$AN = void 0, this._$AD = t, this._$AM = i;
|
|
1105
|
+
}
|
|
1106
|
+
get parentNode() {
|
|
1107
|
+
return this._$AM.parentNode;
|
|
1108
|
+
}
|
|
1109
|
+
get _$AU() {
|
|
1110
|
+
return this._$AM._$AU;
|
|
1111
|
+
}
|
|
1112
|
+
u(t) {
|
|
1113
|
+
const {
|
|
1114
|
+
el: {
|
|
1115
|
+
content: i
|
|
1116
|
+
},
|
|
1117
|
+
parts: s
|
|
1118
|
+
} = this._$AD,
|
|
1119
|
+
e = (t?.creationScope ?? r).importNode(i, true);
|
|
1120
|
+
C.currentNode = e;
|
|
1121
|
+
let h = C.nextNode(),
|
|
1122
|
+
o = 0,
|
|
1123
|
+
n = 0,
|
|
1124
|
+
l = s[0];
|
|
1125
|
+
for (; void 0 !== l;) {
|
|
1126
|
+
if (o === l.index) {
|
|
1127
|
+
let i;
|
|
1128
|
+
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];
|
|
1129
|
+
}
|
|
1130
|
+
o !== l?.index && (h = C.nextNode(), o++);
|
|
1131
|
+
}
|
|
1132
|
+
return C.currentNode = r, e;
|
|
1133
|
+
}
|
|
1134
|
+
p(t) {
|
|
1135
|
+
let i = 0;
|
|
1136
|
+
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++;
|
|
1137
|
+
}
|
|
1138
|
+
}
|
|
1139
|
+
class R {
|
|
1140
|
+
get _$AU() {
|
|
1141
|
+
return this._$AM?._$AU ?? this._$Cv;
|
|
1142
|
+
}
|
|
1143
|
+
constructor(t, i, s, e) {
|
|
1144
|
+
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;
|
|
1145
|
+
}
|
|
1146
|
+
get parentNode() {
|
|
1147
|
+
let t = this._$AA.parentNode;
|
|
1148
|
+
const i = this._$AM;
|
|
1149
|
+
return void 0 !== i && 11 === t?.nodeType && (t = i.parentNode), t;
|
|
1150
|
+
}
|
|
1151
|
+
get startNode() {
|
|
1152
|
+
return this._$AA;
|
|
1153
|
+
}
|
|
1154
|
+
get endNode() {
|
|
1155
|
+
return this._$AB;
|
|
1156
|
+
}
|
|
1157
|
+
_$AI(t, i = this) {
|
|
1158
|
+
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);
|
|
1159
|
+
}
|
|
1160
|
+
O(t) {
|
|
1161
|
+
return this._$AA.parentNode.insertBefore(t, this._$AB);
|
|
1162
|
+
}
|
|
1163
|
+
T(t) {
|
|
1164
|
+
this._$AH !== t && (this._$AR(), this._$AH = this.O(t));
|
|
1165
|
+
}
|
|
1166
|
+
_(t) {
|
|
1167
|
+
this._$AH !== E && c(this._$AH) ? this._$AA.nextSibling.data = t : this.T(r.createTextNode(t)), this._$AH = t;
|
|
1168
|
+
}
|
|
1169
|
+
$(t) {
|
|
1170
|
+
const {
|
|
1171
|
+
values: i,
|
|
1172
|
+
_$litType$: s
|
|
1173
|
+
} = t,
|
|
1174
|
+
e = "number" == typeof s ? this._$AC(t) : (void 0 === s.el && (s.el = N.createElement(P(s.h, s.h[0]), this.options)), s);
|
|
1175
|
+
if (this._$AH?._$AD === e) this._$AH.p(i);else {
|
|
1176
|
+
const t = new M(e, this),
|
|
1177
|
+
s = t.u(this.options);
|
|
1178
|
+
t.p(i), this.T(s), this._$AH = t;
|
|
1179
|
+
}
|
|
1180
|
+
}
|
|
1181
|
+
_$AC(t) {
|
|
1182
|
+
let i = A.get(t.strings);
|
|
1183
|
+
return void 0 === i && A.set(t.strings, i = new N(t)), i;
|
|
1184
|
+
}
|
|
1185
|
+
k(t) {
|
|
1186
|
+
a(this._$AH) || (this._$AH = [], this._$AR());
|
|
1187
|
+
const i = this._$AH;
|
|
1188
|
+
let s,
|
|
1189
|
+
e = 0;
|
|
1190
|
+
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++;
|
|
1191
|
+
e < i.length && (this._$AR(s && s._$AB.nextSibling, e), i.length = e);
|
|
1192
|
+
}
|
|
1193
|
+
_$AR(t = this._$AA.nextSibling, i) {
|
|
1194
|
+
for (this._$AP?.(false, true, i); t !== this._$AB;) {
|
|
1195
|
+
const i = t.nextSibling;
|
|
1196
|
+
t.remove(), t = i;
|
|
1197
|
+
}
|
|
1198
|
+
}
|
|
1199
|
+
setConnected(t) {
|
|
1200
|
+
void 0 === this._$AM && (this._$Cv = t, this._$AP?.(t));
|
|
1201
|
+
}
|
|
1202
|
+
}
|
|
1203
|
+
class k {
|
|
1204
|
+
get tagName() {
|
|
1205
|
+
return this.element.tagName;
|
|
1206
|
+
}
|
|
1207
|
+
get _$AU() {
|
|
1208
|
+
return this._$AM._$AU;
|
|
1209
|
+
}
|
|
1210
|
+
constructor(t, i, s, e, h) {
|
|
1211
|
+
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;
|
|
1212
|
+
}
|
|
1213
|
+
_$AI(t, i = this, s, e) {
|
|
1214
|
+
const h = this.strings;
|
|
1215
|
+
let o = false;
|
|
1216
|
+
if (void 0 === h) t = S(this, t, i, 0), o = !c(t) || t !== this._$AH && t !== T, o && (this._$AH = t);else {
|
|
1217
|
+
const e = t;
|
|
1218
|
+
let n, r;
|
|
1219
|
+
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;
|
|
1220
|
+
}
|
|
1221
|
+
o && !e && this.j(t);
|
|
1222
|
+
}
|
|
1223
|
+
j(t) {
|
|
1224
|
+
t === E ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, t ?? "");
|
|
1225
|
+
}
|
|
1226
|
+
}
|
|
1227
|
+
class H extends k {
|
|
1228
|
+
constructor() {
|
|
1229
|
+
super(...arguments), this.type = 3;
|
|
1230
|
+
}
|
|
1231
|
+
j(t) {
|
|
1232
|
+
this.element[this.name] = t === E ? void 0 : t;
|
|
1233
|
+
}
|
|
1234
|
+
}
|
|
1235
|
+
class I extends k {
|
|
1236
|
+
constructor() {
|
|
1237
|
+
super(...arguments), this.type = 4;
|
|
1238
|
+
}
|
|
1239
|
+
j(t) {
|
|
1240
|
+
this.element.toggleAttribute(this.name, !!t && t !== E);
|
|
1241
|
+
}
|
|
1242
|
+
}
|
|
1243
|
+
class L extends k {
|
|
1244
|
+
constructor(t, i, s, e, h) {
|
|
1245
|
+
super(t, i, s, e, h), this.type = 5;
|
|
1246
|
+
}
|
|
1247
|
+
_$AI(t, i = this) {
|
|
1248
|
+
if ((t = S(this, t, i, 0) ?? E) === T) return;
|
|
1249
|
+
const s = this._$AH,
|
|
1250
|
+
e = t === E && s !== E || t.capture !== s.capture || t.once !== s.once || t.passive !== s.passive,
|
|
1251
|
+
h = t !== E && (s === E || e);
|
|
1252
|
+
e && this.element.removeEventListener(this.name, this, s), h && this.element.addEventListener(this.name, this, t), this._$AH = t;
|
|
1253
|
+
}
|
|
1254
|
+
handleEvent(t) {
|
|
1255
|
+
"function" == typeof this._$AH ? this._$AH.call(this.options?.host ?? this.element, t) : this._$AH.handleEvent(t);
|
|
1256
|
+
}
|
|
1257
|
+
}
|
|
1258
|
+
class z {
|
|
1259
|
+
constructor(t, i, s) {
|
|
1260
|
+
this.element = t, this.type = 6, this._$AN = void 0, this._$AM = i, this.options = s;
|
|
1261
|
+
}
|
|
1262
|
+
get _$AU() {
|
|
1263
|
+
return this._$AM._$AU;
|
|
1264
|
+
}
|
|
1265
|
+
_$AI(t) {
|
|
1266
|
+
S(this, t);
|
|
1267
|
+
}
|
|
1268
|
+
}
|
|
1269
|
+
const j = t.litHtmlPolyfillSupport;
|
|
1270
|
+
j?.(N, R), (t.litHtmlVersions ??= []).push("3.3.1");
|
|
941
1271
|
|
|
942
1272
|
/**
|
|
943
1273
|
* @license
|
|
944
1274
|
* Copyright 2018 Google LLC
|
|
945
1275
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
946
|
-
*/
|
|
1276
|
+
*/
|
|
1277
|
+
const o = o => o ?? E;
|
|
947
1278
|
|
|
948
1279
|
var _M3eInputChipElement_instances, _M3eInputChipElement_handleAvatarSlotChange, _M3eInputChipElement_handleRemoveButtonClick, _M3eInputChipElement_handleKeyDown;
|
|
949
1280
|
/**
|
|
@@ -1017,179 +1348,73 @@ var _M3eInputChipElement_instances, _M3eInputChipElement_handleAvatarSlotChange,
|
|
|
1017
1348
|
* @cssprop --m3e-chip-with-avatar-padding-start - Start padding when an avatar is present.
|
|
1018
1349
|
*/
|
|
1019
1350
|
let M3eInputChipElement = class M3eInputChipElement extends EventAttribute(DisabledInteractive(Disabled(AttachInternals(Role(M3eChipElement, "row"), true))), "remove") {
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
}
|
|
1046
|
-
}
|
|
1047
|
-
/** @inheritdoc */
|
|
1048
|
-
render() {
|
|
1049
|
-
return html `<div class="base">
|
|
1050
|
-
<m3e-elevation
|
|
1051
|
-
class="elevation"
|
|
1052
|
-
for="cell"
|
|
1053
|
-
?disabled="${this.disabled || this.disabledInteractive}"
|
|
1054
|
-
></m3e-elevation>
|
|
1055
|
-
<m3e-state-layer
|
|
1056
|
-
class="state-layer"
|
|
1057
|
-
for="cell"
|
|
1058
|
-
?disabled="${this.disabled || this.disabledInteractive}"
|
|
1059
|
-
></m3e-state-layer>
|
|
1060
|
-
<m3e-focus-ring class="focus-ring" for="cell" ?disabled="${this.disabled}"></m3e-focus-ring>
|
|
1061
|
-
<m3e-ripple class="ripple" for="cell" ?disabled="${this.disabled || this.disabledInteractive}"></m3e-ripple>
|
|
1062
|
-
<div class="wrapper">
|
|
1063
|
-
<div
|
|
1064
|
-
id="cell"
|
|
1065
|
-
class="cell"
|
|
1066
|
-
role="gridcell"
|
|
1067
|
-
tabindex="${o(this.disabled ? undefined : "-1")}"
|
|
1068
|
-
@keydown="${__classPrivateFieldGet(this, _M3eInputChipElement_instances, "m", _M3eInputChipElement_handleKeyDown)}"
|
|
1069
|
-
>
|
|
1070
|
-
<slot name="avatar" @slotchange="${__classPrivateFieldGet(this, _M3eInputChipElement_instances, "m", _M3eInputChipElement_handleAvatarSlotChange)}"></slot>
|
|
1071
|
-
${this._renderIcon()}
|
|
1072
|
-
<div class="label">${this._renderSlot()}</div>
|
|
1073
|
-
<div class="touch" aria-hidden="true"></div>
|
|
1074
|
-
</div>
|
|
1075
|
-
${this._renderTrailingIcon()}
|
|
1076
|
-
</div>
|
|
1077
|
-
</div>`;
|
|
1078
|
-
}
|
|
1079
|
-
/** @internal @inheritdoc */
|
|
1080
|
-
_renderTrailingIcon() {
|
|
1081
|
-
return this.removable
|
|
1082
|
-
? html `<span role="gridcell" class="remove">
|
|
1083
|
-
<m3e-icon-button
|
|
1084
|
-
class="remove-button"
|
|
1085
|
-
aria-label="${this.removeLabel}"
|
|
1086
|
-
size="extra-small"
|
|
1087
|
-
tabindex="-1"
|
|
1088
|
-
?disabled="${this.disabled}"
|
|
1089
|
-
?disabled-interactive="${this.disabledInteractive}"
|
|
1090
|
-
@click="${__classPrivateFieldGet(this, _M3eInputChipElement_instances, "m", _M3eInputChipElement_handleRemoveButtonClick)}"
|
|
1091
|
-
>
|
|
1092
|
-
<slot name="remove-icon">
|
|
1093
|
-
<svg class="remove-icon" viewBox="0 -960 960 960" fill="currentColor">
|
|
1094
|
-
<path
|
|
1095
|
-
d="m256-200-56-56 224-224-224-224 56-56 224 224 224-224 56 56-224 224 224 224-56 56-224-224-224 224Z"
|
|
1096
|
-
/>
|
|
1097
|
-
</svg>
|
|
1098
|
-
</slot>
|
|
1099
|
-
</m3e-icon-button>
|
|
1100
|
-
</span>`
|
|
1101
|
-
: nothing;
|
|
1351
|
+
constructor() {
|
|
1352
|
+
super(...arguments);
|
|
1353
|
+
_M3eInputChipElement_instances.add(this);
|
|
1354
|
+
/**
|
|
1355
|
+
* Whether the chip is removable.
|
|
1356
|
+
* @default false
|
|
1357
|
+
*/
|
|
1358
|
+
this.removable = false;
|
|
1359
|
+
/**
|
|
1360
|
+
* The accessible label given to the button used to remove the chip.
|
|
1361
|
+
* @default "Remove"
|
|
1362
|
+
*/
|
|
1363
|
+
this.removeLabel = "Remove";
|
|
1364
|
+
}
|
|
1365
|
+
/** @inheritdoc */
|
|
1366
|
+
connectedCallback() {
|
|
1367
|
+
super.connectedCallback();
|
|
1368
|
+
this.removeAttribute("tabindex");
|
|
1369
|
+
}
|
|
1370
|
+
/** @inheritdoc */
|
|
1371
|
+
update(changedProperties) {
|
|
1372
|
+
super.update(changedProperties);
|
|
1373
|
+
this.removeAttribute("tabindex");
|
|
1374
|
+
if (changedProperties.has("removable")) {
|
|
1375
|
+
this.classList.toggle("-with-trailing-icon", this.removable);
|
|
1102
1376
|
}
|
|
1377
|
+
}
|
|
1378
|
+
/** @inheritdoc */
|
|
1379
|
+
render() {
|
|
1380
|
+
return html`<div class="base"><m3e-elevation class="elevation" for="cell" ?disabled="${this.disabled || this.disabledInteractive}"></m3e-elevation><m3e-state-layer class="state-layer" for="cell" ?disabled="${this.disabled || this.disabledInteractive}"></m3e-state-layer><m3e-focus-ring class="focus-ring" for="cell" ?disabled="${this.disabled}"></m3e-focus-ring><m3e-ripple class="ripple" for="cell" ?disabled="${this.disabled || this.disabledInteractive}"></m3e-ripple><div class="wrapper"><div id="cell" class="cell" role="gridcell" tabindex="${o(this.disabled ? undefined : "-1")}" @keydown="${__classPrivateFieldGet(this, _M3eInputChipElement_instances, "m", _M3eInputChipElement_handleKeyDown)}"><slot name="avatar" @slotchange="${__classPrivateFieldGet(this, _M3eInputChipElement_instances, "m", _M3eInputChipElement_handleAvatarSlotChange)}"></slot>${this._renderIcon()}<div class="label">${this._renderSlot()}</div><div class="touch" aria-hidden="true"></div></div>${this._renderTrailingIcon()}</div></div>`;
|
|
1381
|
+
}
|
|
1382
|
+
/** @internal @inheritdoc */
|
|
1383
|
+
_renderTrailingIcon() {
|
|
1384
|
+
return this.removable ? html`<span role="gridcell" class="remove"><m3e-icon-button class="remove-button" aria-label="${this.removeLabel}" size="extra-small" tabindex="-1" ?disabled="${this.disabled}" ?disabled-interactive="${this.disabledInteractive}" @click="${__classPrivateFieldGet(this, _M3eInputChipElement_instances, "m", _M3eInputChipElement_handleRemoveButtonClick)}"><slot name="remove-icon"><svg class="remove-icon" viewBox="0 -960 960 960" fill="currentColor"><path d="m256-200-56-56 224-224-224-224 56-56 224 224 224-224 56 56-224 224 224 224-56 56-224-224-224 224Z"/></svg></slot></m3e-icon-button></span>` : nothing;
|
|
1385
|
+
}
|
|
1103
1386
|
};
|
|
1104
1387
|
_M3eInputChipElement_instances = new WeakSet();
|
|
1105
1388
|
_M3eInputChipElement_handleAvatarSlotChange = function _M3eInputChipElement_handleAvatarSlotChange(e) {
|
|
1106
|
-
|
|
1389
|
+
this.classList.toggle("-with-avatar", hasAssignedNodes(e.target));
|
|
1107
1390
|
};
|
|
1108
1391
|
_M3eInputChipElement_handleRemoveButtonClick = function _M3eInputChipElement_handleRemoveButtonClick(e) {
|
|
1109
|
-
|
|
1110
|
-
|
|
1392
|
+
e.stopPropagation();
|
|
1393
|
+
this.dispatchEvent(new Event("remove"));
|
|
1111
1394
|
};
|
|
1112
1395
|
_M3eInputChipElement_handleKeyDown = function _M3eInputChipElement_handleKeyDown(e) {
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
}
|
|
1396
|
+
if (this.removable) {
|
|
1397
|
+
switch (e.key) {
|
|
1398
|
+
case "Backspace":
|
|
1399
|
+
case "Delete":
|
|
1400
|
+
this.dispatchEvent(new Event("remove"));
|
|
1401
|
+
break;
|
|
1120
1402
|
}
|
|
1403
|
+
}
|
|
1121
1404
|
};
|
|
1122
1405
|
/** The styles of the element. */
|
|
1123
|
-
M3eInputChipElement.styles = [
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
.remove-button {
|
|
1134
|
-
--m3e-icon-button-extra-small-container-height: 1.5rem;
|
|
1135
|
-
--m3e-icon-button-extra-small-icon-size: var(--m3e-chip-icon-size, 1.125rem);
|
|
1136
|
-
width: 1.5rem;
|
|
1137
|
-
}
|
|
1138
|
-
.remove-icon {
|
|
1139
|
-
flex: none;
|
|
1140
|
-
width: var(--m3e-chip-icon-size, 1.125rem);
|
|
1141
|
-
height: var(--m3e-chip-icon-size, 1.125rem);
|
|
1142
|
-
}
|
|
1143
|
-
.touch {
|
|
1144
|
-
top: calc(
|
|
1145
|
-
0px - calc(calc(3rem - calc(var(--m3e-chip-container-height, 2rem) + ${DesignToken.density.calc(-2)})) / 2)
|
|
1146
|
-
);
|
|
1147
|
-
}
|
|
1148
|
-
.wrapper {
|
|
1149
|
-
height: 100%;
|
|
1150
|
-
overflow: visible;
|
|
1151
|
-
min-width: 0;
|
|
1152
|
-
}
|
|
1153
|
-
::slotted([slot="avatar"]) {
|
|
1154
|
-
flex: none;
|
|
1155
|
-
font-size: var(--m3e-chip-avatar-size, 1.5rem);
|
|
1156
|
-
}
|
|
1157
|
-
:host(:disabled) ::slotted([slot="avatar"]),
|
|
1158
|
-
:host([disabled-interactive]) ::slotted([slot="avatar"]) {
|
|
1159
|
-
opacity: var(--m3e-chip-disabled-avatar-opacity, 38%);
|
|
1160
|
-
color: var(--m3e-chip-disabled-icon-color, ${DesignToken.color.onSurface});
|
|
1161
|
-
}
|
|
1162
|
-
:host(.-with-avatar) ::slotted([slot="icon"]) {
|
|
1163
|
-
display: none;
|
|
1164
|
-
}
|
|
1165
|
-
:host(.-with-avatar) .wrapper {
|
|
1166
|
-
padding-inline-start: var(--m3e-chip-with-avatar-padding-start, 0.25rem);
|
|
1167
|
-
}
|
|
1168
|
-
@media (forced-colors: active) {
|
|
1169
|
-
:host(:disabled) ::slotted([slot="avatar"]),
|
|
1170
|
-
:host([disabled-interactive]) ::slotted([slot="avatar"]) {
|
|
1171
|
-
color: CanvasText;
|
|
1172
|
-
}
|
|
1173
|
-
}
|
|
1174
|
-
`,
|
|
1175
|
-
];
|
|
1176
|
-
__decorate([
|
|
1177
|
-
e$1(".cell")
|
|
1178
|
-
], M3eInputChipElement.prototype, "cell", void 0);
|
|
1179
|
-
__decorate([
|
|
1180
|
-
e$1(".remove-button")
|
|
1181
|
-
], M3eInputChipElement.prototype, "removeButton", void 0);
|
|
1182
|
-
__decorate([
|
|
1183
|
-
n$1({ type: Boolean })
|
|
1184
|
-
], M3eInputChipElement.prototype, "removable", void 0);
|
|
1185
|
-
__decorate([
|
|
1186
|
-
n$1({ attribute: "remove-label" })
|
|
1187
|
-
], M3eInputChipElement.prototype, "removeLabel", void 0);
|
|
1188
|
-
M3eInputChipElement = __decorate([
|
|
1189
|
-
t$2("m3e-input-chip")
|
|
1190
|
-
], M3eInputChipElement);
|
|
1406
|
+
M3eInputChipElement.styles = [M3eChipElement.styles, css`.cell { display: inline-flex; align-items: center; outline: none; column-gap: var(--m3e-chip-spacing, 0.5rem); min-width: 0; } .remove-button { --m3e-icon-button-extra-small-container-height: 1.5rem; --m3e-icon-button-extra-small-icon-size: var(--m3e-chip-icon-size, 1.125rem); width: 1.5rem; } .remove-icon { flex: none; width: var(--m3e-chip-icon-size, 1.125rem); height: var(--m3e-chip-icon-size, 1.125rem); } .touch { top: calc( 0px - calc(calc(3rem - calc(var(--m3e-chip-container-height, 2rem) + ${DesignToken.density.calc(-2)})) / 2) ); } .wrapper { height: 100%; overflow: visible; min-width: 0; } ::slotted([slot="avatar"]) { flex: none; font-size: var(--m3e-chip-avatar-size, 1.5rem); } :host(:disabled) ::slotted([slot="avatar"]), :host([disabled-interactive]) ::slotted([slot="avatar"]) { opacity: var(--m3e-chip-disabled-avatar-opacity, 38%); color: var(--m3e-chip-disabled-icon-color, ${DesignToken.color.onSurface}); } :host(.-with-avatar) ::slotted([slot="icon"]) { display: none; } :host(.-with-avatar) .wrapper { padding-inline-start: var(--m3e-chip-with-avatar-padding-start, 0.25rem); } @media (forced-colors: active) { :host(:disabled) ::slotted([slot="avatar"]), :host([disabled-interactive]) ::slotted([slot="avatar"]) { color: CanvasText; } }`];
|
|
1407
|
+
__decorate([e$1(".cell")], M3eInputChipElement.prototype, "cell", void 0);
|
|
1408
|
+
__decorate([e$1(".remove-button")], M3eInputChipElement.prototype, "removeButton", void 0);
|
|
1409
|
+
__decorate([n$1({
|
|
1410
|
+
type: Boolean
|
|
1411
|
+
})], M3eInputChipElement.prototype, "removable", void 0);
|
|
1412
|
+
__decorate([n$1({
|
|
1413
|
+
attribute: "remove-label"
|
|
1414
|
+
})], M3eInputChipElement.prototype, "removeLabel", void 0);
|
|
1415
|
+
M3eInputChipElement = __decorate([t$2("m3e-input-chip")], M3eInputChipElement);
|
|
1191
1416
|
|
|
1192
|
-
var _M3eInputChipSetElement_instances, _M3eInputChipSetElement_inputChangeHandler, _M3eInputChipSetElement_inputKeyDownHandler, _M3eInputChipSetElement_focusHandler, _M3eInputChipSetElement_focusInHandler, _M3eInputChipSetElement_focusOutHandler, _M3eInputChipSetElement_chipRemoveHandler, _M3eInputChipSetElement_chipClickHandler, _M3eInputChipSetElement_listManager, _M3eInputChipSetElement_listKeyManager, _M3eInputChipSetElement_ignoreInputChange, _M3eInputChipSetElement_input, _M3eInputChipSetElement_tabindex, _M3eInputChipSetElement_handleKeyDown, _M3eInputChipSetElement_handleSlotChange, _M3eInputChipSetElement_handleInputSlotChange, _M3eInputChipSetElement_handleFocus, _M3eInputChipSetElement_handleFocusIn, _M3eInputChipSetElement_handleFocusOut, _M3eInputChipSetElement_handleChipRemove, _M3eInputChipSetElement_handleChipClick, _M3eInputChipSetElement_handleInputChange, _M3eInputChipSetElement_handleInputKeyDown;
|
|
1417
|
+
var _M3eInputChipSetElement_instances, _M3eInputChipSetElement_directionalitySubscription, _M3eInputChipSetElement_inputChangeHandler, _M3eInputChipSetElement_inputKeyDownHandler, _M3eInputChipSetElement_focusHandler, _M3eInputChipSetElement_focusInHandler, _M3eInputChipSetElement_focusOutHandler, _M3eInputChipSetElement_chipRemoveHandler, _M3eInputChipSetElement_chipClickHandler, _M3eInputChipSetElement_listManager, _M3eInputChipSetElement_listKeyManager, _M3eInputChipSetElement_ignoreInputChange, _M3eInputChipSetElement_input, _M3eInputChipSetElement_tabindex, _M3eInputChipSetElement_handleKeyDown, _M3eInputChipSetElement_handleSlotChange, _M3eInputChipSetElement_handleInputSlotChange, _M3eInputChipSetElement_handleFocus, _M3eInputChipSetElement_handleFocusIn, _M3eInputChipSetElement_handleFocusOut, _M3eInputChipSetElement_handleChipRemove, _M3eInputChipSetElement_handleChipClick, _M3eInputChipSetElement_handleInputChange, _M3eInputChipSetElement_handleInputKeyDown;
|
|
1193
1418
|
/**
|
|
1194
1419
|
* A container that transforms user input into a cohesive set of interactive chips, supporting entry, editing, and removal of discrete values.
|
|
1195
1420
|
*
|
|
@@ -1227,258 +1452,223 @@ var _M3eInputChipSetElement_instances, _M3eInputChipSetElement_inputChangeHandle
|
|
|
1227
1452
|
* @cssprop --m3e-chip-set-spacing - The spacing (gap) between chips in the set.
|
|
1228
1453
|
*/
|
|
1229
1454
|
let M3eInputChipSetElement = class M3eInputChipSetElement extends RequiredConstraintValidation(Required(ConstraintValidation(Dirty(Touched(FormAssociated(Disabled(AttachInternals(Role(M3eChipSetElement, "grid"))))))))) {
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
/**
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
/**
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1455
|
+
constructor() {
|
|
1456
|
+
super(...arguments);
|
|
1457
|
+
_M3eInputChipSetElement_instances.add(this);
|
|
1458
|
+
/** @private */
|
|
1459
|
+
_M3eInputChipSetElement_directionalitySubscription.set(this, void 0);
|
|
1460
|
+
/** @private */
|
|
1461
|
+
_M3eInputChipSetElement_inputChangeHandler.set(this, () => __classPrivateFieldGet(this, _M3eInputChipSetElement_instances, "m", _M3eInputChipSetElement_handleInputChange).call(this));
|
|
1462
|
+
/** @private */
|
|
1463
|
+
_M3eInputChipSetElement_inputKeyDownHandler.set(this, e => __classPrivateFieldGet(this, _M3eInputChipSetElement_instances, "m", _M3eInputChipSetElement_handleInputKeyDown).call(this, e));
|
|
1464
|
+
/** @private */
|
|
1465
|
+
_M3eInputChipSetElement_focusHandler.set(this, () => __classPrivateFieldGet(this, _M3eInputChipSetElement_instances, "m", _M3eInputChipSetElement_handleFocus).call(this));
|
|
1466
|
+
/** @private */
|
|
1467
|
+
_M3eInputChipSetElement_focusInHandler.set(this, () => __classPrivateFieldGet(this, _M3eInputChipSetElement_instances, "m", _M3eInputChipSetElement_handleFocusIn).call(this));
|
|
1468
|
+
/** @private */
|
|
1469
|
+
_M3eInputChipSetElement_focusOutHandler.set(this, () => __classPrivateFieldGet(this, _M3eInputChipSetElement_instances, "m", _M3eInputChipSetElement_handleFocusOut).call(this));
|
|
1470
|
+
/** @private */
|
|
1471
|
+
_M3eInputChipSetElement_chipRemoveHandler.set(this, e => __classPrivateFieldGet(this, _M3eInputChipSetElement_instances, "m", _M3eInputChipSetElement_handleChipRemove).call(this, e));
|
|
1472
|
+
/** @private */
|
|
1473
|
+
_M3eInputChipSetElement_chipClickHandler.set(this, e => __classPrivateFieldGet(this, _M3eInputChipSetElement_instances, "m", _M3eInputChipSetElement_handleChipClick).call(this, e));
|
|
1474
|
+
/** @private */
|
|
1475
|
+
_M3eInputChipSetElement_listManager.set(this, new ListManager());
|
|
1476
|
+
/** @private */
|
|
1477
|
+
_M3eInputChipSetElement_listKeyManager.set(this, new ListKeyManager().onActiveItemChange(() => __classPrivateFieldGet(this, _M3eInputChipSetElement_listKeyManager, "f").activeItem?.focus()).withHomeAndEnd().withSkipPredicate(x => !x.hasAttribute("tabindex")).withDirectionality(M3eDirectionality.current));
|
|
1478
|
+
/** @private */
|
|
1479
|
+
_M3eInputChipSetElement_ignoreInputChange.set(this, false);
|
|
1480
|
+
/** @private */
|
|
1481
|
+
_M3eInputChipSetElement_input.set(this, null);
|
|
1482
|
+
/** @private */
|
|
1483
|
+
_M3eInputChipSetElement_tabindex.set(this, 0);
|
|
1484
|
+
}
|
|
1485
|
+
/** The chips of the set. */
|
|
1486
|
+
get chips() {
|
|
1487
|
+
// NOTE: query is used instead of the internal list management due to
|
|
1488
|
+
// validating required state on change to support form-field integration.
|
|
1489
|
+
return [...this.querySelectorAll("m3e-input-chip")];
|
|
1490
|
+
}
|
|
1491
|
+
/** The values of the set. */
|
|
1492
|
+
get value() {
|
|
1493
|
+
const values = this.chips.map(x => x.value);
|
|
1494
|
+
return values.length == 0 ? null : values;
|
|
1495
|
+
}
|
|
1496
|
+
/** @inheritdoc @internal */
|
|
1497
|
+
get [(_M3eInputChipSetElement_directionalitySubscription = new WeakMap(), _M3eInputChipSetElement_inputChangeHandler = new WeakMap(), _M3eInputChipSetElement_inputKeyDownHandler = new WeakMap(), _M3eInputChipSetElement_focusHandler = new WeakMap(), _M3eInputChipSetElement_focusInHandler = new WeakMap(), _M3eInputChipSetElement_focusOutHandler = new WeakMap(), _M3eInputChipSetElement_chipRemoveHandler = new WeakMap(), _M3eInputChipSetElement_chipClickHandler = new WeakMap(), _M3eInputChipSetElement_listManager = new WeakMap(), _M3eInputChipSetElement_listKeyManager = new WeakMap(), _M3eInputChipSetElement_ignoreInputChange = new WeakMap(), _M3eInputChipSetElement_input = new WeakMap(), _M3eInputChipSetElement_tabindex = new WeakMap(), _M3eInputChipSetElement_instances = new WeakSet(), formValue)]() {
|
|
1498
|
+
const values = this.value;
|
|
1499
|
+
if (!values) return null;
|
|
1500
|
+
const data = new FormData();
|
|
1501
|
+
for (const value of values) {
|
|
1502
|
+
data.append(this.name, value);
|
|
1274
1503
|
}
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1504
|
+
return data;
|
|
1505
|
+
}
|
|
1506
|
+
/** @inheritdoc */
|
|
1507
|
+
get shouldLabelFloat() {
|
|
1508
|
+
return this.chips.length > 0;
|
|
1509
|
+
}
|
|
1510
|
+
/** @inheritdoc */
|
|
1511
|
+
onContainerClick() {
|
|
1512
|
+
__classPrivateFieldGet(this, _M3eInputChipSetElement_input, "f")?.focus();
|
|
1513
|
+
}
|
|
1514
|
+
/** @inheritdoc */
|
|
1515
|
+
connectedCallback() {
|
|
1516
|
+
super.connectedCallback();
|
|
1517
|
+
this.closest("m3e-form-field")?.notifyControlStateChange();
|
|
1518
|
+
__classPrivateFieldSet(this, _M3eInputChipSetElement_tabindex, Number.parseInt(this.getAttribute("tabindex") ?? "0"), "f");
|
|
1519
|
+
this.addEventListener("focus", __classPrivateFieldGet(this, _M3eInputChipSetElement_focusHandler, "f"));
|
|
1520
|
+
this.addEventListener("focusin", __classPrivateFieldGet(this, _M3eInputChipSetElement_focusInHandler, "f"));
|
|
1521
|
+
this.addEventListener("focusout", __classPrivateFieldGet(this, _M3eInputChipSetElement_focusOutHandler, "f"));
|
|
1522
|
+
__classPrivateFieldSet(this, _M3eInputChipSetElement_directionalitySubscription, M3eDirectionality.observe(() => __classPrivateFieldGet(this, _M3eInputChipSetElement_listKeyManager, "f").directionality = M3eDirectionality.current), "f");
|
|
1523
|
+
}
|
|
1524
|
+
/** @inheritdoc */
|
|
1525
|
+
disconnectedCallback() {
|
|
1526
|
+
super.disconnectedCallback();
|
|
1527
|
+
this.removeEventListener("focus", __classPrivateFieldGet(this, _M3eInputChipSetElement_focusHandler, "f"));
|
|
1528
|
+
this.removeEventListener("focusin", __classPrivateFieldGet(this, _M3eInputChipSetElement_focusInHandler, "f"));
|
|
1529
|
+
this.removeEventListener("focusout", __classPrivateFieldGet(this, _M3eInputChipSetElement_focusOutHandler, "f"));
|
|
1530
|
+
__classPrivateFieldGet(this, _M3eInputChipSetElement_directionalitySubscription, "f")?.call(this);
|
|
1531
|
+
}
|
|
1532
|
+
/** @inheritdoc */
|
|
1533
|
+
firstUpdated(_changedProperties) {
|
|
1534
|
+
super.firstUpdated(_changedProperties);
|
|
1535
|
+
if (!this.hasAttribute("tabindex")) {
|
|
1536
|
+
this.setAttribute("tabindex", `${__classPrivateFieldGet(this, _M3eInputChipSetElement_tabindex, "f")}`);
|
|
1278
1537
|
}
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
this.addEventListener("focusin", __classPrivateFieldGet(this, _M3eInputChipSetElement_focusInHandler, "f"));
|
|
1286
|
-
this.addEventListener("focusout", __classPrivateFieldGet(this, _M3eInputChipSetElement_focusOutHandler, "f"));
|
|
1538
|
+
}
|
|
1539
|
+
/** @inheritdoc */
|
|
1540
|
+
update(changedProperties) {
|
|
1541
|
+
super.update(changedProperties);
|
|
1542
|
+
if (changedProperties.has("vertical")) {
|
|
1543
|
+
this.ariaOrientation = null;
|
|
1287
1544
|
}
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
this.removeEventListener("focusout", __classPrivateFieldGet(this, _M3eInputChipSetElement_focusOutHandler, "f"));
|
|
1294
|
-
}
|
|
1295
|
-
/** @inheritdoc */
|
|
1296
|
-
firstUpdated(_changedProperties) {
|
|
1297
|
-
super.firstUpdated(_changedProperties);
|
|
1298
|
-
if (!this.hasAttribute("tabindex")) {
|
|
1299
|
-
this.setAttribute("tabindex", `${__classPrivateFieldGet(this, _M3eInputChipSetElement_tabindex, "f")}`);
|
|
1300
|
-
}
|
|
1301
|
-
}
|
|
1302
|
-
/** @inheritdoc */
|
|
1303
|
-
update(changedProperties) {
|
|
1304
|
-
super.update(changedProperties);
|
|
1305
|
-
if (changedProperties.has("vertical")) {
|
|
1306
|
-
this.ariaOrientation = null;
|
|
1307
|
-
}
|
|
1308
|
-
if (changedProperties.has("disabled")) {
|
|
1309
|
-
__classPrivateFieldGet(this, _M3eInputChipSetElement_listManager, "f").items.forEach((x) => (x.disabled = this.disabled));
|
|
1310
|
-
if (__classPrivateFieldGet(this, _M3eInputChipSetElement_input, "f")) {
|
|
1311
|
-
__classPrivateFieldGet(this, _M3eInputChipSetElement_input, "f").disabled = this.disabled;
|
|
1312
|
-
}
|
|
1313
|
-
}
|
|
1314
|
-
}
|
|
1315
|
-
/** @inheritdoc */
|
|
1316
|
-
render() {
|
|
1317
|
-
return html `<slot @keydown="${__classPrivateFieldGet(this, _M3eInputChipSetElement_instances, "m", _M3eInputChipSetElement_handleKeyDown)}" @slotchange="${__classPrivateFieldGet(this, _M3eInputChipSetElement_instances, "m", _M3eInputChipSetElement_handleSlotChange)}"></slot>
|
|
1318
|
-
<span role="row">
|
|
1319
|
-
<span role="gridcell"><slot name="input" @slotchange="${__classPrivateFieldGet(this, _M3eInputChipSetElement_instances, "m", _M3eInputChipSetElement_handleInputSlotChange)}"></slot></span>
|
|
1320
|
-
</span> `;
|
|
1545
|
+
if (changedProperties.has("disabled")) {
|
|
1546
|
+
__classPrivateFieldGet(this, _M3eInputChipSetElement_listManager, "f").items.forEach(x => x.disabled = this.disabled);
|
|
1547
|
+
if (__classPrivateFieldGet(this, _M3eInputChipSetElement_input, "f")) {
|
|
1548
|
+
__classPrivateFieldGet(this, _M3eInputChipSetElement_input, "f").disabled = this.disabled;
|
|
1549
|
+
}
|
|
1321
1550
|
}
|
|
1551
|
+
}
|
|
1552
|
+
/** @inheritdoc */
|
|
1553
|
+
render() {
|
|
1554
|
+
return html`<slot @keydown="${__classPrivateFieldGet(this, _M3eInputChipSetElement_instances, "m", _M3eInputChipSetElement_handleKeyDown)}" @slotchange="${__classPrivateFieldGet(this, _M3eInputChipSetElement_instances, "m", _M3eInputChipSetElement_handleSlotChange)}"></slot><span role="row"><span role="gridcell"><slot name="input" @slotchange="${__classPrivateFieldGet(this, _M3eInputChipSetElement_instances, "m", _M3eInputChipSetElement_handleInputSlotChange)}"></slot></span></span>`;
|
|
1555
|
+
}
|
|
1322
1556
|
};
|
|
1323
1557
|
_M3eInputChipSetElement_handleKeyDown = function _M3eInputChipSetElement_handleKeyDown(e) {
|
|
1324
|
-
|
|
1558
|
+
__classPrivateFieldGet(this, _M3eInputChipSetElement_listKeyManager, "f").onKeyDown(e);
|
|
1325
1559
|
};
|
|
1326
|
-
_M3eInputChipSetElement_handleSlotChange =
|
|
1327
|
-
/** @private */
|
|
1560
|
+
_M3eInputChipSetElement_handleSlotChange = /** @private */
|
|
1328
1561
|
async function _M3eInputChipSetElement_handleSlotChange() {
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
}
|
|
1337
|
-
chip.addEventListener("remove", __classPrivateFieldGet(this, _M3eInputChipSetElement_chipRemoveHandler, "f"));
|
|
1338
|
-
chip.cell.addEventListener("click", __classPrivateFieldGet(this, _M3eInputChipSetElement_chipClickHandler, "f"));
|
|
1562
|
+
const {
|
|
1563
|
+
added,
|
|
1564
|
+
removed
|
|
1565
|
+
} = __classPrivateFieldGet(this, _M3eInputChipSetElement_listManager, "f").setItems([...this.querySelectorAll("m3e-input-chip")]);
|
|
1566
|
+
for (const chip of added) {
|
|
1567
|
+
if (chip.isUpdatePending) {
|
|
1568
|
+
await chip.updateComplete;
|
|
1339
1569
|
}
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
x.cell.removeEventListener("click", __classPrivateFieldGet(this, _M3eInputChipSetElement_chipClickHandler, "f"));
|
|
1343
|
-
});
|
|
1344
|
-
__classPrivateFieldGet(this, _M3eInputChipSetElement_listKeyManager, "f").setItems(__classPrivateFieldGet(this, _M3eInputChipSetElement_listManager, "f").items.flatMap((x) => (x.removeButton ? [x.cell, x.removeButton] : [x.cell])));
|
|
1345
|
-
if (!__classPrivateFieldGet(this, _M3eInputChipSetElement_listKeyManager, "f").activeItem) {
|
|
1346
|
-
__classPrivateFieldGet(this, _M3eInputChipSetElement_listKeyManager, "f").updateActiveItem(__classPrivateFieldGet(this, _M3eInputChipSetElement_listKeyManager, "f").items.find((x) => x.hasAttribute("tabindex")));
|
|
1570
|
+
if (this.disabled) {
|
|
1571
|
+
chip.disabled = true;
|
|
1347
1572
|
}
|
|
1573
|
+
chip.addEventListener("remove", __classPrivateFieldGet(this, _M3eInputChipSetElement_chipRemoveHandler, "f"));
|
|
1574
|
+
chip.cell.addEventListener("click", __classPrivateFieldGet(this, _M3eInputChipSetElement_chipClickHandler, "f"));
|
|
1575
|
+
}
|
|
1576
|
+
removed.forEach(x => {
|
|
1577
|
+
x.removeEventListener("remove", __classPrivateFieldGet(this, _M3eInputChipSetElement_chipRemoveHandler, "f"));
|
|
1578
|
+
x.cell.removeEventListener("click", __classPrivateFieldGet(this, _M3eInputChipSetElement_chipClickHandler, "f"));
|
|
1579
|
+
});
|
|
1580
|
+
__classPrivateFieldGet(this, _M3eInputChipSetElement_listKeyManager, "f").setItems(__classPrivateFieldGet(this, _M3eInputChipSetElement_listManager, "f").items.flatMap(x => x.removeButton ? [x.cell, x.removeButton] : [x.cell]));
|
|
1581
|
+
if (!__classPrivateFieldGet(this, _M3eInputChipSetElement_listKeyManager, "f").activeItem) {
|
|
1582
|
+
__classPrivateFieldGet(this, _M3eInputChipSetElement_listKeyManager, "f").updateActiveItem(__classPrivateFieldGet(this, _M3eInputChipSetElement_listKeyManager, "f").items.find(x => x.hasAttribute("tabindex")));
|
|
1583
|
+
}
|
|
1348
1584
|
};
|
|
1349
1585
|
_M3eInputChipSetElement_handleInputSlotChange = function _M3eInputChipSetElement_handleInputSlotChange() {
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1586
|
+
const input = this.querySelector("input");
|
|
1587
|
+
if (__classPrivateFieldGet(this, _M3eInputChipSetElement_input, "f")) {
|
|
1588
|
+
__classPrivateFieldGet(this, _M3eInputChipSetElement_input, "f").removeEventListener("change", __classPrivateFieldGet(this, _M3eInputChipSetElement_inputChangeHandler, "f"));
|
|
1589
|
+
__classPrivateFieldGet(this, _M3eInputChipSetElement_input, "f").removeEventListener("keydown", __classPrivateFieldGet(this, _M3eInputChipSetElement_inputKeyDownHandler, "f"));
|
|
1590
|
+
}
|
|
1591
|
+
__classPrivateFieldSet(this, _M3eInputChipSetElement_input, input, "f");
|
|
1592
|
+
if (__classPrivateFieldGet(this, _M3eInputChipSetElement_input, "f")) {
|
|
1593
|
+
__classPrivateFieldGet(this, _M3eInputChipSetElement_input, "f").disabled = this.disabled;
|
|
1594
|
+
__classPrivateFieldGet(this, _M3eInputChipSetElement_input, "f").addEventListener("change", __classPrivateFieldGet(this, _M3eInputChipSetElement_inputChangeHandler, "f"));
|
|
1595
|
+
__classPrivateFieldGet(this, _M3eInputChipSetElement_input, "f").addEventListener("keydown", __classPrivateFieldGet(this, _M3eInputChipSetElement_inputKeyDownHandler, "f"));
|
|
1596
|
+
const property = Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, "value");
|
|
1597
|
+
Object.defineProperty(input, "value", {
|
|
1598
|
+
get: () => property.get?.call(input),
|
|
1599
|
+
set: value => {
|
|
1600
|
+
property.set?.call(input, value);
|
|
1601
|
+
if (__classPrivateFieldGet(this, _M3eInputChipSetElement_input, "f") === input && !__classPrivateFieldGet(this, _M3eInputChipSetElement_ignoreInputChange, "f")) {
|
|
1602
|
+
__classPrivateFieldGet(this, _M3eInputChipSetElement_instances, "m", _M3eInputChipSetElement_handleInputChange).call(this);
|
|
1603
|
+
}
|
|
1604
|
+
}
|
|
1605
|
+
});
|
|
1606
|
+
}
|
|
1371
1607
|
};
|
|
1372
1608
|
_M3eInputChipSetElement_handleFocus = function _M3eInputChipSetElement_handleFocus() {
|
|
1373
|
-
|
|
1609
|
+
setTimeout(() => (__classPrivateFieldGet(this, _M3eInputChipSetElement_listKeyManager, "f").activeItem ?? __classPrivateFieldGet(this, _M3eInputChipSetElement_input, "f"))?.focus());
|
|
1374
1610
|
};
|
|
1375
1611
|
_M3eInputChipSetElement_handleFocusIn = function _M3eInputChipSetElement_handleFocusIn() {
|
|
1376
|
-
|
|
1612
|
+
this.setAttribute("tabindex", "-1");
|
|
1377
1613
|
};
|
|
1378
1614
|
_M3eInputChipSetElement_handleFocusOut = function _M3eInputChipSetElement_handleFocusOut() {
|
|
1379
|
-
|
|
1615
|
+
this.setAttribute("tabindex", `${__classPrivateFieldGet(this, _M3eInputChipSetElement_tabindex, "f")}`);
|
|
1380
1616
|
};
|
|
1381
1617
|
_M3eInputChipSetElement_handleChipRemove = function _M3eInputChipSetElement_handleChipRemove(e) {
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1618
|
+
const chip = e.target;
|
|
1619
|
+
const index = __classPrivateFieldGet(this, _M3eInputChipSetElement_listManager, "f").items.indexOf(chip);
|
|
1620
|
+
const nextChip = __classPrivateFieldGet(this, _M3eInputChipSetElement_listManager, "f").items.find((x, y) => y > index && !x.disabled && x.removable);
|
|
1621
|
+
chip.remove();
|
|
1622
|
+
__classPrivateFieldGet(this, _M3eInputChipSetElement_listKeyManager, "f").setActiveItem(__classPrivateFieldGet(this, _M3eInputChipSetElement_listKeyManager, "f").items.find(x => x === nextChip?.removeButton));
|
|
1623
|
+
if (!__classPrivateFieldGet(this, _M3eInputChipSetElement_listKeyManager, "f").activeItem) {
|
|
1624
|
+
__classPrivateFieldGet(this, _M3eInputChipSetElement_input, "f")?.focus();
|
|
1625
|
+
}
|
|
1626
|
+
this.dispatchEvent(new Event("change", {
|
|
1627
|
+
bubbles: true
|
|
1628
|
+
}));
|
|
1391
1629
|
};
|
|
1392
1630
|
_M3eInputChipSetElement_handleChipClick = function _M3eInputChipSetElement_handleChipClick(e) {
|
|
1393
|
-
|
|
1631
|
+
__classPrivateFieldGet(this, _M3eInputChipSetElement_listKeyManager, "f").updateActiveItem(e.composedPath().find(x => x instanceof M3eInputChipElement)?.cell);
|
|
1394
1632
|
};
|
|
1395
1633
|
_M3eInputChipSetElement_handleInputChange = function _M3eInputChipSetElement_handleInputChange() {
|
|
1634
|
+
const value = __classPrivateFieldGet(this, _M3eInputChipSetElement_input, "f")?.value;
|
|
1635
|
+
if (!value) return;
|
|
1636
|
+
setTimeout(() => {
|
|
1396
1637
|
const value = __classPrivateFieldGet(this, _M3eInputChipSetElement_input, "f")?.value;
|
|
1397
|
-
if (!value)
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
}
|
|
1415
|
-
}
|
|
1416
|
-
this.dispatchEvent(new Event("change", { bubbles: true }));
|
|
1417
|
-
});
|
|
1638
|
+
if (!value) return;
|
|
1639
|
+
const chip = document.createElement("m3e-input-chip");
|
|
1640
|
+
chip.removable = true;
|
|
1641
|
+
chip.appendChild(document.createTextNode(value));
|
|
1642
|
+
this.appendChild(chip);
|
|
1643
|
+
if (__classPrivateFieldGet(this, _M3eInputChipSetElement_input, "f")) {
|
|
1644
|
+
try {
|
|
1645
|
+
__classPrivateFieldSet(this, _M3eInputChipSetElement_ignoreInputChange, true, "f");
|
|
1646
|
+
__classPrivateFieldGet(this, _M3eInputChipSetElement_input, "f").value = "";
|
|
1647
|
+
} finally {
|
|
1648
|
+
__classPrivateFieldSet(this, _M3eInputChipSetElement_ignoreInputChange, false, "f");
|
|
1649
|
+
}
|
|
1650
|
+
}
|
|
1651
|
+
this.dispatchEvent(new Event("change", {
|
|
1652
|
+
bubbles: true
|
|
1653
|
+
}));
|
|
1654
|
+
});
|
|
1418
1655
|
};
|
|
1419
1656
|
_M3eInputChipSetElement_handleInputKeyDown = function _M3eInputChipSetElement_handleInputKeyDown(e) {
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
if (item) {
|
|
1425
|
-
item.dispatchEvent(new Event("remove"));
|
|
1426
|
-
}
|
|
1657
|
+
if (e.key === "Backspace" && !__classPrivateFieldGet(this, _M3eInputChipSetElement_input, "f")?.value) {
|
|
1658
|
+
const item = [...__classPrivateFieldGet(this, _M3eInputChipSetElement_listManager, "f").items].reverse().find(x => !x.disabled && !x.disabledInteractive && x.removable);
|
|
1659
|
+
if (item) {
|
|
1660
|
+
item.dispatchEvent(new Event("remove"));
|
|
1427
1661
|
}
|
|
1662
|
+
}
|
|
1428
1663
|
};
|
|
1429
1664
|
(() => {
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
user-select: none;
|
|
1434
|
-
color: currentColor;
|
|
1435
|
-
transition: opacity ${DesignToken.motion.duration.extraLong1};
|
|
1436
|
-
}
|
|
1437
|
-
m3e-input-chip-set:not(:focus-within) [slot="input"]::placeholder {
|
|
1438
|
-
opacity: 0;
|
|
1439
|
-
transition: 0s;
|
|
1440
|
-
}
|
|
1441
|
-
m3e-input-chip-set:hover [slot="input"]::placeholder {
|
|
1442
|
-
transition: 0s;
|
|
1443
|
-
}
|
|
1444
|
-
@media (prefers-reduced-motion) {
|
|
1445
|
-
m3e-input-chip-set [slot="input"]::placeholder {
|
|
1446
|
-
transition: none !important;
|
|
1447
|
-
}
|
|
1448
|
-
}
|
|
1449
|
-
`.toString());
|
|
1450
|
-
document.adoptedStyleSheets = [...document.adoptedStyleSheets, lightDomStyle];
|
|
1665
|
+
const lightDomStyle = new CSSStyleSheet();
|
|
1666
|
+
lightDomStyle.replaceSync(css`m3e-input-chip-set [slot="input"]::placeholder { user-select: none; color: currentColor; transition: opacity ${DesignToken.motion.duration.extraLong1}; } m3e-input-chip-set:not(:focus-within) [slot="input"]::placeholder { opacity: 0; transition: 0s; } m3e-input-chip-set:hover [slot="input"]::placeholder { transition: 0s; } @media (prefers-reduced-motion) { m3e-input-chip-set [slot="input"]::placeholder { transition: none !important; } }`.toString());
|
|
1667
|
+
document.adoptedStyleSheets = [...document.adoptedStyleSheets, lightDomStyle];
|
|
1451
1668
|
})();
|
|
1452
1669
|
/** The styles of the element. */
|
|
1453
|
-
M3eInputChipSetElement.styles = [
|
|
1454
|
-
|
|
1455
|
-
css `
|
|
1456
|
-
::slotted([slot="input"]) {
|
|
1457
|
-
outline: unset;
|
|
1458
|
-
border: unset;
|
|
1459
|
-
background-color: transparent;
|
|
1460
|
-
box-shadow: none;
|
|
1461
|
-
font-family: inherit;
|
|
1462
|
-
font-size: inherit;
|
|
1463
|
-
line-height: initial;
|
|
1464
|
-
letter-spacing: inherit;
|
|
1465
|
-
color: var(--_form-field-input-color, inherit);
|
|
1466
|
-
flex: 1 1 auto;
|
|
1467
|
-
min-width: 0;
|
|
1468
|
-
padding: unset;
|
|
1469
|
-
}
|
|
1470
|
-
::slotted(m3e-input-chip) {
|
|
1471
|
-
min-width: 0;
|
|
1472
|
-
}
|
|
1473
|
-
span[role="row"],
|
|
1474
|
-
span[role="gridcell"] {
|
|
1475
|
-
display: contents;
|
|
1476
|
-
}
|
|
1477
|
-
`,
|
|
1478
|
-
];
|
|
1479
|
-
M3eInputChipSetElement = __decorate([
|
|
1480
|
-
t$2("m3e-input-chip-set")
|
|
1481
|
-
], M3eInputChipSetElement);
|
|
1670
|
+
M3eInputChipSetElement.styles = [M3eChipSetElement.styles, css`::slotted([slot="input"]) { outline: unset; border: unset; background-color: transparent; box-shadow: none; font-family: inherit; font-size: inherit; line-height: initial; letter-spacing: inherit; color: var(--_form-field-input-color, inherit); flex: 1 1 auto; min-width: 0; padding: unset; } ::slotted(m3e-input-chip) { min-width: 0; } span[role="row"], span[role="gridcell"] { display: contents; }`];
|
|
1671
|
+
M3eInputChipSetElement = __decorate([t$2("m3e-input-chip-set")], M3eInputChipSetElement);
|
|
1482
1672
|
|
|
1483
1673
|
/**
|
|
1484
1674
|
* A chip used to help narrow a user's intent by presenting dynamically generated suggestions, such as
|
|
@@ -1552,14 +1742,12 @@ M3eInputChipSetElement = __decorate([
|
|
|
1552
1742
|
* @cssprop --m3e-outlined-chip-disabled-outline-opacity - Opacity applied to disabled outline.
|
|
1553
1743
|
*/
|
|
1554
1744
|
let M3eSuggestionChipElement = class M3eSuggestionChipElement extends FormSubmitter(AttachInternals(LinkButton(KeyboardClick(Focusable(DisabledInteractive(Disabled(Role(M3eChipElement, "button")))))), true)) {
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1745
|
+
/** @internal @inheritdoc */
|
|
1746
|
+
_renderTrailingIcon() {
|
|
1747
|
+
return nothing;
|
|
1748
|
+
}
|
|
1559
1749
|
};
|
|
1560
|
-
M3eSuggestionChipElement = __decorate([
|
|
1561
|
-
t$2("m3e-suggestion-chip")
|
|
1562
|
-
], M3eSuggestionChipElement);
|
|
1750
|
+
M3eSuggestionChipElement = __decorate([t$2("m3e-suggestion-chip")], M3eSuggestionChipElement);
|
|
1563
1751
|
|
|
1564
1752
|
export { M3eAssistChipElement, M3eChipElement, M3eChipSetElement, M3eFilterChipElement, M3eFilterChipSetElement, M3eInputChipElement, M3eInputChipSetElement, M3eSuggestionChipElement };
|
|
1565
1753
|
//# sourceMappingURL=index.js.map
|