@sbb-esta/lyne-elements-dev 4.7.0-dev.1773406096 → 4.7.0-dev.1773410336
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/chip/chip-group/chip-group.component.js +56 -42
- package/chip/chip-group.js +3 -1
- package/chip.js +6 -4
- package/chip.pure.js +5 -4
- package/custom-elements.json +3319 -3243
- package/development/chip/chip-group/chip-group.component.d.ts +25 -4
- package/development/chip/chip-group/chip-group.component.d.ts.map +1 -1
- package/development/chip/chip-group/chip-group.component.js +34 -17
- package/development/chip/chip-group.js +4 -2
- package/development/chip.js +4 -2
- package/development/chip.pure.js +3 -2
- package/package.json +2 -2
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
var x = (
|
|
2
|
-
throw TypeError(
|
|
1
|
+
var x = (a) => {
|
|
2
|
+
throw TypeError(a);
|
|
3
3
|
};
|
|
4
|
-
var I = (
|
|
5
|
-
var d = (
|
|
4
|
+
var I = (a, i, l) => i.has(a) || x("Cannot " + l);
|
|
5
|
+
var d = (a, i, l) => (I(a, i, "read from private field"), l ? l.call(a) : i.get(a)), g = (a, i, l) => i.has(a) ? x("Cannot add the same private member more than once") : i instanceof WeakSet ? i.add(a) : i.set(a, l), h = (a, i, l, c) => (I(a, i, "write to private field"), c ? c.call(a, l) : i.set(a, l), l);
|
|
6
6
|
import { __esDecorate as _, __runInitializers as p } from "tslib";
|
|
7
7
|
import { css as B, isServer as O, html as D } from "lit";
|
|
8
8
|
import { property as y } from "lit/decorators.js";
|
|
9
9
|
import { isArrowKeyPressed as K, getNextElementIndex as L } from "../../core/a11y.js";
|
|
10
10
|
import { SbbElement as W } from "../../core/base-elements.js";
|
|
11
|
-
import { SbbLanguageController as
|
|
11
|
+
import { SbbLanguageController as F, SbbPropertyWatcherController as T } from "../../core/controllers.js";
|
|
12
12
|
import { forceType as q } from "../../core/decorators.js";
|
|
13
13
|
import { isLean as V } from "../../core/dom/lean-context.js";
|
|
14
14
|
import { i18nSelectionRequired as M, i18nChipGroupInputDescription as N } from "../../core/i18n.js";
|
|
@@ -16,16 +16,39 @@ import { SbbRequiredMixin as R, SbbDisabledMixin as $, SbbNegativeMixin as j, Sb
|
|
|
16
16
|
import { boxSizingStyles as J } from "../../core/styles.js";
|
|
17
17
|
import { SbbChipElement as P } from "../chip/chip.component.js";
|
|
18
18
|
const H = B`:host{width:100%;display:flex;flex-wrap:wrap;gap:var(--sbb-chip-group-gap);align-items:center;margin-block:var(--sbb-chip-group-margin-block)}:host(:is(:is(:state(size-s),[state--size-s]),:is(:state(empty),[state--empty]))){--sbb-chip-group-margin-block: 0}:host(:is(:state(size-s),[state--size-s]):not(:is(:state(empty),[state--empty]))){--sbb-chip-group-margin-block: .375rem .3125rem}@media(min-width:64rem){:host(:is(:state(size-s),[state--size-s]):not(:is(:state(empty),[state--empty]))){--sbb-chip-group-margin-block: .3125rem .1875rem}}:host(:is(:state(without-label),[state--without-label]):is(:state(size-s),[state--size-s]):not(:is(:state(empty),[state--empty]))){--sbb-chip-group-margin-block: 0 .4375rem}@media(min-width:64rem){:host(:is(:state(without-label),[state--without-label]):is(:state(size-s),[state--size-s]):not(:is(:state(empty),[state--empty]))){--sbb-chip-group-margin-block: 0 .3125rem}}:host(:is(:is(:state(size-l),[state--size-l]),:is(:state(size-m),[state--size-m]))){--sbb-chip-group-margin-block: var(--_sbb-chip-group-margin-block-start-default) 0}@media(min-width:64rem){:host(:is(:is(:state(size-l),[state--size-l]),:is(:state(size-m),[state--size-m]))){--sbb-chip-group-margin-block: var(--_sbb-chip-group-margin-block-start-default-large) 0}}:host(:is(:state(without-label),[state--without-label]):is(:state(size-m),[state--size-m]):not(:is(:state(empty),[state--empty]))){--sbb-chip-group-margin-block: .1875rem .6875rem}@media(min-width:64rem){:host(:is(:state(without-label),[state--without-label]):is(:state(size-m),[state--size-m]):not(:is(:state(empty),[state--empty]))){--sbb-chip-group-margin-block: .1875rem .875rem}}:host(:is(:state(without-label),[state--without-label]):not(:is(:state(empty),[state--empty]),:is(:state(size-s),[state--size-s]),:is(:state(size-m),[state--size-m]),:is(:state(size-l),[state--size-l]))){--sbb-chip-group-margin-block: var(--sbb-chip-group-margin-block-no-label-not-empty)}:host(:not(:is(:state(without-label),[state--without-label])):is(:state(size-m),[state--size-m]):not(:is(:state(empty),[state--empty]))){--sbb-chip-group-margin-block: var(--_sbb-chip-group-margin-block-start-default) var(--_sbb-chip-group-margin-block-start-default-large)}@media(min-width:64rem){:host(:not(:is(:state(without-label),[state--without-label])):is(:state(size-m),[state--size-m]):not(:is(:state(empty),[state--empty]))){--sbb-chip-group-margin-block: var(--_sbb-chip-group-margin-block-start-default-large) var(--_sbb-chip-group-margin-block-start-default-large)}}:host(:not(:is(:state(without-label),[state--without-label]),:is(:state(empty),[state--empty]),:is(:state(size-s),[state--size-s]),:is(:state(size-m),[state--size-m]),:is(:state(size-l),[state--size-l]))){--sbb-chip-group-margin-block: var(--sbb-chip-group-margin-block-with-label-not-empty)}:host(:is(:state(without-label),[state--without-label]):is(:state(size-l),[state--size-l]):not(:is(:state(empty),[state--empty]))){--sbb-chip-group-margin-block: var(--_sbb-chip-group-margin-block-start-default) 1rem}@media(min-width:64rem){:host(:is(:state(without-label),[state--without-label]):is(:state(size-l),[state--size-l]):not(:is(:state(empty),[state--empty]))){--sbb-chip-group-margin-block: var(--_sbb-chip-group-margin-block-start-default-large) 1.25rem}}:host(:not(:is(:state(without-label),[state--without-label])):is(:state(size-l),[state--size-l]):not(:is(:state(empty),[state--empty]))){--sbb-chip-group-margin-block: var(--_sbb-chip-group-margin-block-start-default) .46875rem}@media(min-width:64rem){:host(:not(:is(:state(without-label),[state--without-label])):is(:state(size-l),[state--size-l]):not(:is(:state(empty),[state--empty]))){--sbb-chip-group-margin-block: var(--_sbb-chip-group-margin-block-start-default-large) .46875rem}}::slotted(input){flex:1 1 var(--sbb-chip-group-input-min-width);max-height:1.5rem}::slotted(sbb-chip){max-width:100%}`;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
class Q extends CustomEvent {
|
|
20
|
+
/**
|
|
21
|
+
* @deprecated Use event properties directly.
|
|
22
|
+
*/
|
|
23
|
+
get detail() {
|
|
24
|
+
return this;
|
|
25
|
+
}
|
|
26
|
+
constructor(i) {
|
|
27
|
+
super("chipinputtokenend", {
|
|
28
|
+
cancelable: !0,
|
|
29
|
+
bubbles: !0,
|
|
30
|
+
composed: !0
|
|
31
|
+
}), this.origin = i.origin, this.value = i.value, this.label = i.label;
|
|
32
|
+
}
|
|
33
|
+
/** Set a new value for the chip that will be created */
|
|
34
|
+
setValue(i) {
|
|
35
|
+
this.value = i;
|
|
36
|
+
}
|
|
37
|
+
/** Set a label for the chip that will be created */
|
|
38
|
+
setLabel(i) {
|
|
39
|
+
this.label = i;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
let pt = (() => {
|
|
43
|
+
var u, b, m, r;
|
|
44
|
+
let a = R($(j(U(W)))), i = [], l, c, f = [], v = [], z, w = [], k = [], E, C = [], S = [];
|
|
45
|
+
return r = class extends a {
|
|
23
46
|
constructor() {
|
|
24
47
|
super();
|
|
25
48
|
g(this, u);
|
|
26
|
-
g(this, m);
|
|
27
49
|
g(this, b);
|
|
28
|
-
|
|
50
|
+
g(this, m);
|
|
51
|
+
h(this, u, (p(this, i), p(this, f, null))), h(this, b, (p(this, v), p(this, w, ["Enter"]))), h(this, m, (p(this, k), p(this, C, !1))), this._inputAttributeObserver = (p(this, S), O ? null : new MutationObserver(() => this._reactToInputChanges())), this._language = new F(this), this.addEventListener?.(P.events.requestdelete, (t) => this._deleteChip(t.target)), this.addEventListener?.("keydown", (t) => this._onChipKeyDown(t)), this.addController(new T(this, () => this.closest("sbb-form-field"), {
|
|
29
52
|
size: (t) => this._updateSize(t.size),
|
|
30
53
|
label: (t) => this._updateLabelState(t),
|
|
31
54
|
hiddenLabel: (t) => this._updateLabelState(t)
|
|
@@ -35,13 +58,13 @@ let ht = (() => {
|
|
|
35
58
|
set value(t) {
|
|
36
59
|
t = t ?? [];
|
|
37
60
|
const e = this.value, s = [...e];
|
|
38
|
-
for (const
|
|
39
|
-
s.includes(
|
|
40
|
-
s.forEach((
|
|
41
|
-
const
|
|
42
|
-
for (const
|
|
43
|
-
|
|
44
|
-
|
|
61
|
+
for (const o of t)
|
|
62
|
+
s.includes(o) && s.splice(s.indexOf(o), 1);
|
|
63
|
+
s.forEach((o) => this._chipElements().find((A) => A.value === o)?.remove());
|
|
64
|
+
const n = [...t];
|
|
65
|
+
for (const o of e)
|
|
66
|
+
n.includes(o) && n.splice(n.indexOf(o), 1);
|
|
67
|
+
n.forEach((o) => this._createChipElement(o));
|
|
45
68
|
}
|
|
46
69
|
get value() {
|
|
47
70
|
return this._chipElements().map((t) => t.value);
|
|
@@ -55,17 +78,17 @@ let ht = (() => {
|
|
|
55
78
|
}
|
|
56
79
|
/** The array of keys that will trigger a `chipinputtokenend` event. Default `['Enter']` */
|
|
57
80
|
get separatorKeys() {
|
|
58
|
-
return d(this,
|
|
81
|
+
return d(this, b);
|
|
59
82
|
}
|
|
60
83
|
set separatorKeys(t) {
|
|
61
|
-
h(this,
|
|
84
|
+
h(this, b, t);
|
|
62
85
|
}
|
|
63
86
|
/** Whether to automatically add a chip when the input loses focus if there's a value. */
|
|
64
87
|
get addOnBlur() {
|
|
65
|
-
return d(this,
|
|
88
|
+
return d(this, m);
|
|
66
89
|
}
|
|
67
90
|
set addOnBlur(t) {
|
|
68
|
-
h(this,
|
|
91
|
+
h(this, m, t);
|
|
69
92
|
}
|
|
70
93
|
_updateLabelState(t) {
|
|
71
94
|
this.toggleState("without-label", !t.label || t.hiddenLabel);
|
|
@@ -128,8 +151,8 @@ let ht = (() => {
|
|
|
128
151
|
const e = t.target;
|
|
129
152
|
if (e.localName === "sbb-chip") {
|
|
130
153
|
if (K(t)) {
|
|
131
|
-
const s = this._enabledChipElements(),
|
|
132
|
-
s[
|
|
154
|
+
const s = this._enabledChipElements(), n = L(t, s.indexOf(e), s.length);
|
|
155
|
+
s[n].focus();
|
|
133
156
|
return;
|
|
134
157
|
}
|
|
135
158
|
switch (t.key) {
|
|
@@ -168,22 +191,12 @@ let ht = (() => {
|
|
|
168
191
|
const s = e ?? this._inputElement.value.trim();
|
|
169
192
|
if (!s)
|
|
170
193
|
return;
|
|
171
|
-
const
|
|
194
|
+
const n = new Q({
|
|
172
195
|
origin: t,
|
|
173
196
|
value: s,
|
|
174
|
-
label: (e ? this.displayWith?.(e) : null) ?? void 0
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
};
|
|
178
|
-
this._dispatchChipInputTokenEnd(o) && (this._createChipElement(o.value, o.label), this._inputElement.value = "", this._emitInputEvents());
|
|
179
|
-
}
|
|
180
|
-
_dispatchChipInputTokenEnd(t) {
|
|
181
|
-
return this.dispatchEvent(new CustomEvent("chipinputtokenend", {
|
|
182
|
-
detail: t,
|
|
183
|
-
cancelable: !0,
|
|
184
|
-
bubbles: !0,
|
|
185
|
-
composed: !0
|
|
186
|
-
}));
|
|
197
|
+
label: (e ? this.displayWith?.(e) : null) ?? void 0
|
|
198
|
+
});
|
|
199
|
+
this.dispatchEvent(n) && (this._createChipElement(n.value, n.label), this._inputElement.value = "", this._emitInputEvents());
|
|
187
200
|
}
|
|
188
201
|
_deleteChip(t) {
|
|
189
202
|
const e = this._enabledChipElements();
|
|
@@ -231,11 +244,11 @@ let ht = (() => {
|
|
|
231
244
|
render() {
|
|
232
245
|
return D`<slot @slotchange=${this._setupComponent}></slot>`;
|
|
233
246
|
}
|
|
234
|
-
}, u = new WeakMap(),
|
|
235
|
-
const t = typeof Symbol == "function" && Symbol.metadata ? Object.create(
|
|
247
|
+
}, u = new WeakMap(), b = new WeakMap(), m = new WeakMap(), (() => {
|
|
248
|
+
const t = typeof Symbol == "function" && Symbol.metadata ? Object.create(a[Symbol.metadata] ?? null) : void 0;
|
|
236
249
|
l = [y({ type: Array })], c = [y({ attribute: !1 })], z = [y({ attribute: "separator-keys", type: Array })], E = [q(), y({ attribute: "add-on-blur", type: Boolean })], _(r, null, l, { kind: "setter", name: "value", static: !1, private: !1, access: { has: (e) => "value" in e, set: (e, s) => {
|
|
237
250
|
e.value = s;
|
|
238
|
-
} }, metadata: t }, null,
|
|
251
|
+
} }, metadata: t }, null, i), _(r, null, c, { kind: "accessor", name: "displayWith", static: !1, private: !1, access: { has: (e) => "displayWith" in e, get: (e) => e.displayWith, set: (e, s) => {
|
|
239
252
|
e.displayWith = s;
|
|
240
253
|
} }, metadata: t }, f, v), _(r, null, z, { kind: "accessor", name: "separatorKeys", static: !1, private: !1, access: { has: (e) => "separatorKeys" in e, get: (e) => e.separatorKeys, set: (e, s) => {
|
|
241
254
|
e.separatorKeys = s;
|
|
@@ -249,5 +262,6 @@ let ht = (() => {
|
|
|
249
262
|
}, r;
|
|
250
263
|
})();
|
|
251
264
|
export {
|
|
252
|
-
|
|
265
|
+
pt as SbbChipGroupElement,
|
|
266
|
+
Q as SbbChipInputTokenEndEvent
|
|
253
267
|
};
|
package/chip/chip-group.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { SbbChipGroupElement as e } from "./chip-group/chip-group.component.js";
|
|
2
|
+
import { SbbChipInputTokenEndEvent as p } from "./chip-group/chip-group.component.js";
|
|
2
3
|
e.define();
|
|
3
4
|
console.warn(`The entrypoint '@sbb-esta/elements/chip/chip-group.js' has been deprecated.
|
|
4
5
|
Use either '@sbb-esta/elements/chip.js' or '@sbb-esta/elements/chip.pure.js' instead.`);
|
|
5
6
|
export {
|
|
6
|
-
e as SbbChipGroupElement
|
|
7
|
+
e as SbbChipGroupElement,
|
|
8
|
+
p as SbbChipInputTokenEndEvent
|
|
7
9
|
};
|
package/chip.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { SbbChipGroupElement as e } from "./chip/chip-group/chip-group.component.js";
|
|
2
|
-
import {
|
|
3
|
-
|
|
2
|
+
import { SbbChipInputTokenEndEvent as i } from "./chip/chip-group/chip-group.component.js";
|
|
3
|
+
import { SbbChipElement as o } from "./chip/chip/chip.component.js";
|
|
4
|
+
o.define();
|
|
4
5
|
e.define();
|
|
5
6
|
export {
|
|
6
|
-
|
|
7
|
-
e as SbbChipGroupElement
|
|
7
|
+
o as SbbChipElement,
|
|
8
|
+
e as SbbChipGroupElement,
|
|
9
|
+
i as SbbChipInputTokenEndEvent
|
|
8
10
|
};
|
package/chip.pure.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { SbbChipGroupElement as
|
|
2
|
-
import { SbbChipElement as
|
|
1
|
+
import { SbbChipGroupElement as b, SbbChipInputTokenEndEvent as n } from "./chip/chip-group/chip-group.component.js";
|
|
2
|
+
import { SbbChipElement as t } from "./chip/chip/chip.component.js";
|
|
3
3
|
export {
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
t as SbbChipElement,
|
|
5
|
+
b as SbbChipGroupElement,
|
|
6
|
+
n as SbbChipInputTokenEndEvent
|
|
6
7
|
};
|