@ucalgary-design-system/chip-group 1.0.3 → 1.0.4

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.
Files changed (3) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/index.js +27 -331
  3. package/package.json +4 -4
package/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # @ucalgary-design-system/chip-group
2
2
 
3
+ ## 1.0.4
4
+
5
+ ### Patch Changes
6
+
7
+ - fe87dab: Updated externalized dependencies
8
+ - Updated dependencies [fe87dab]
9
+ - @ucalgary-design-system/icon@1.0.4
10
+ - @ucalgary-design-system/core@1.0.4
11
+ - @ucalgary-design-system/tokens@1.0.4
12
+
3
13
  ## 1.0.3
4
14
 
5
15
  ### Patch Changes
package/index.js CHANGED
@@ -1,329 +1,25 @@
1
- import { unsafeCSS as C, html as O } from "lit";
2
- import { BaseElement as b } from "@ucalgary-design-system/core";
3
- /**
4
- * @license
5
- * Copyright 2017 Google LLC
6
- * SPDX-License-Identifier: BSD-3-Clause
7
- */
8
- const U = (r) => (t, e) => {
9
- e !== void 0 ? e.addInitializer(() => {
10
- customElements.define(r, t);
11
- }) : customElements.define(r, t);
1
+ import { unsafeCSS as p, html as a } from "lit";
2
+ import { queryAssignedElements as f, customElement as m } from "lit/decorators.js";
3
+ import { BaseElement as r } from "@ucalgary-design-system/core";
4
+ const u = ":host{display:block}.chip-group{display:flex;flex-direction:row;flex-wrap:wrap;align-items:center;gap:16px}";
5
+ var h = Object.defineProperty, v = Object.getOwnPropertyDescriptor, d = (n, e, t, s) => {
6
+ for (var o = s > 1 ? void 0 : s ? v(e, t) : e, i = n.length - 1, c; i >= 0; i--)
7
+ (c = n[i]) && (o = (s ? c(e, t, o) : c(o)) || o);
8
+ return s && o && h(e, t, o), o;
12
9
  };
13
- /**
14
- * @license
15
- * Copyright 2019 Google LLC
16
- * SPDX-License-Identifier: BSD-3-Clause
17
- */
18
- const u = globalThis, y = u.ShadowRoot && (u.ShadyCSS === void 0 || u.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, g = Symbol(), E = /* @__PURE__ */ new WeakMap();
19
- let A = class {
20
- constructor(t, e, s) {
21
- if (this._$cssResult$ = !0, s !== g) throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
22
- this.cssText = t, this.t = e;
23
- }
24
- get styleSheet() {
25
- let t = this.o;
26
- const e = this.t;
27
- if (y && t === void 0) {
28
- const s = e !== void 0 && e.length === 1;
29
- s && (t = E.get(e)), t === void 0 && ((this.o = t = new CSSStyleSheet()).replaceSync(this.cssText), s && E.set(e, t));
30
- }
31
- return t;
32
- }
33
- toString() {
34
- return this.cssText;
35
- }
36
- };
37
- const R = (r) => new A(typeof r == "string" ? r : r + "", void 0, g), x = (r, t) => {
38
- if (y) r.adoptedStyleSheets = t.map((e) => e instanceof CSSStyleSheet ? e : e.styleSheet);
39
- else for (const e of t) {
40
- const s = document.createElement("style"), i = u.litNonce;
41
- i !== void 0 && s.setAttribute("nonce", i), s.textContent = e.cssText, r.appendChild(s);
42
- }
43
- }, $ = y ? (r) => r : (r) => r instanceof CSSStyleSheet ? ((t) => {
44
- let e = "";
45
- for (const s of t.cssRules) e += s.cssText;
46
- return R(e);
47
- })(r) : r;
48
- /**
49
- * @license
50
- * Copyright 2017 Google LLC
51
- * SPDX-License-Identifier: BSD-3-Clause
52
- */
53
- const { is: M, defineProperty: j, getOwnPropertyDescriptor: k, getOwnPropertyNames: z, getOwnPropertySymbols: T, getPrototypeOf: L } = Object, h = globalThis, S = h.trustedTypes, D = S ? S.emptyScript : "", m = h.reactiveElementPolyfillSupport, d = (r, t) => r, _ = { toAttribute(r, t) {
54
- switch (t) {
55
- case Boolean:
56
- r = r ? D : null;
57
- break;
58
- case Object:
59
- case Array:
60
- r = r == null ? r : JSON.stringify(r);
61
- }
62
- return r;
63
- }, fromAttribute(r, t) {
64
- let e = r;
65
- switch (t) {
66
- case Boolean:
67
- e = r !== null;
68
- break;
69
- case Number:
70
- e = r === null ? null : Number(r);
71
- break;
72
- case Object:
73
- case Array:
74
- try {
75
- e = JSON.parse(r);
76
- } catch {
77
- e = null;
78
- }
79
- }
80
- return e;
81
- } }, w = (r, t) => !M(r, t), v = { attribute: !0, type: String, converter: _, reflect: !1, useDefault: !1, hasChanged: w };
82
- Symbol.metadata ?? (Symbol.metadata = Symbol("metadata")), h.litPropertyMetadata ?? (h.litPropertyMetadata = /* @__PURE__ */ new WeakMap());
83
- class l extends HTMLElement {
84
- static addInitializer(t) {
85
- this._$Ei(), (this.l ?? (this.l = [])).push(t);
86
- }
87
- static get observedAttributes() {
88
- return this.finalize(), this._$Eh && [...this._$Eh.keys()];
89
- }
90
- static createProperty(t, e = v) {
91
- if (e.state && (e.attribute = !1), this._$Ei(), this.prototype.hasOwnProperty(t) && ((e = Object.create(e)).wrapped = !0), this.elementProperties.set(t, e), !e.noAccessor) {
92
- const s = Symbol(), i = this.getPropertyDescriptor(t, s, e);
93
- i !== void 0 && j(this.prototype, t, i);
94
- }
95
- }
96
- static getPropertyDescriptor(t, e, s) {
97
- const { get: i, set: o } = k(this.prototype, t) ?? { get() {
98
- return this[e];
99
- }, set(n) {
100
- this[e] = n;
101
- } };
102
- return { get: i, set(n) {
103
- const a = i == null ? void 0 : i.call(this);
104
- o == null || o.call(this, n), this.requestUpdate(t, a, s);
105
- }, configurable: !0, enumerable: !0 };
106
- }
107
- static getPropertyOptions(t) {
108
- return this.elementProperties.get(t) ?? v;
109
- }
110
- static _$Ei() {
111
- if (this.hasOwnProperty(d("elementProperties"))) return;
112
- const t = L(this);
113
- t.finalize(), t.l !== void 0 && (this.l = [...t.l]), this.elementProperties = new Map(t.elementProperties);
114
- }
115
- static finalize() {
116
- if (this.hasOwnProperty(d("finalized"))) return;
117
- if (this.finalized = !0, this._$Ei(), this.hasOwnProperty(d("properties"))) {
118
- const e = this.properties, s = [...z(e), ...T(e)];
119
- for (const i of s) this.createProperty(i, e[i]);
120
- }
121
- const t = this[Symbol.metadata];
122
- if (t !== null) {
123
- const e = litPropertyMetadata.get(t);
124
- if (e !== void 0) for (const [s, i] of e) this.elementProperties.set(s, i);
125
- }
126
- this._$Eh = /* @__PURE__ */ new Map();
127
- for (const [e, s] of this.elementProperties) {
128
- const i = this._$Eu(e, s);
129
- i !== void 0 && this._$Eh.set(i, e);
130
- }
131
- this.elementStyles = this.finalizeStyles(this.styles);
132
- }
133
- static finalizeStyles(t) {
134
- const e = [];
135
- if (Array.isArray(t)) {
136
- const s = new Set(t.flat(1 / 0).reverse());
137
- for (const i of s) e.unshift($(i));
138
- } else t !== void 0 && e.push($(t));
139
- return e;
140
- }
141
- static _$Eu(t, e) {
142
- const s = e.attribute;
143
- return s === !1 ? void 0 : typeof s == "string" ? s : typeof t == "string" ? t.toLowerCase() : void 0;
144
- }
145
- constructor() {
146
- super(), this._$Ep = void 0, this.isUpdatePending = !1, this.hasUpdated = !1, this._$Em = null, this._$Ev();
147
- }
148
- _$Ev() {
149
- var t;
150
- this._$ES = new Promise((e) => this.enableUpdating = e), this._$AL = /* @__PURE__ */ new Map(), this._$E_(), this.requestUpdate(), (t = this.constructor.l) == null || t.forEach((e) => e(this));
151
- }
152
- addController(t) {
153
- var e;
154
- (this._$EO ?? (this._$EO = /* @__PURE__ */ new Set())).add(t), this.renderRoot !== void 0 && this.isConnected && ((e = t.hostConnected) == null || e.call(t));
155
- }
156
- removeController(t) {
157
- var e;
158
- (e = this._$EO) == null || e.delete(t);
159
- }
160
- _$E_() {
161
- const t = /* @__PURE__ */ new Map(), e = this.constructor.elementProperties;
162
- for (const s of e.keys()) this.hasOwnProperty(s) && (t.set(s, this[s]), delete this[s]);
163
- t.size > 0 && (this._$Ep = t);
164
- }
165
- createRenderRoot() {
166
- const t = this.shadowRoot ?? this.attachShadow(this.constructor.shadowRootOptions);
167
- return x(t, this.constructor.elementStyles), t;
168
- }
169
- connectedCallback() {
170
- var t;
171
- this.renderRoot ?? (this.renderRoot = this.createRenderRoot()), this.enableUpdating(!0), (t = this._$EO) == null || t.forEach((e) => {
172
- var s;
173
- return (s = e.hostConnected) == null ? void 0 : s.call(e);
174
- });
175
- }
176
- enableUpdating(t) {
177
- }
178
- disconnectedCallback() {
179
- var t;
180
- (t = this._$EO) == null || t.forEach((e) => {
181
- var s;
182
- return (s = e.hostDisconnected) == null ? void 0 : s.call(e);
183
- });
184
- }
185
- attributeChangedCallback(t, e, s) {
186
- this._$AK(t, s);
187
- }
188
- _$ET(t, e) {
189
- var o;
190
- const s = this.constructor.elementProperties.get(t), i = this.constructor._$Eu(t, s);
191
- if (i !== void 0 && s.reflect === !0) {
192
- const n = (((o = s.converter) == null ? void 0 : o.toAttribute) !== void 0 ? s.converter : _).toAttribute(e, s.type);
193
- this._$Em = t, n == null ? this.removeAttribute(i) : this.setAttribute(i, n), this._$Em = null;
194
- }
195
- }
196
- _$AK(t, e) {
197
- var o, n;
198
- const s = this.constructor, i = s._$Eh.get(t);
199
- if (i !== void 0 && this._$Em !== i) {
200
- const a = s.getPropertyOptions(i), c = typeof a.converter == "function" ? { fromAttribute: a.converter } : ((o = a.converter) == null ? void 0 : o.fromAttribute) !== void 0 ? a.converter : _;
201
- this._$Em = i;
202
- const p = c.fromAttribute(e, a.type);
203
- this[i] = p ?? ((n = this._$Ej) == null ? void 0 : n.get(i)) ?? p, this._$Em = null;
204
- }
205
- }
206
- requestUpdate(t, e, s) {
207
- var i;
208
- if (t !== void 0) {
209
- const o = this.constructor, n = this[t];
210
- if (s ?? (s = o.getPropertyOptions(t)), !((s.hasChanged ?? w)(n, e) || s.useDefault && s.reflect && n === ((i = this._$Ej) == null ? void 0 : i.get(t)) && !this.hasAttribute(o._$Eu(t, s)))) return;
211
- this.C(t, e, s);
212
- }
213
- this.isUpdatePending === !1 && (this._$ES = this._$EP());
214
- }
215
- C(t, e, { useDefault: s, reflect: i, wrapped: o }, n) {
216
- s && !(this._$Ej ?? (this._$Ej = /* @__PURE__ */ new Map())).has(t) && (this._$Ej.set(t, n ?? e ?? this[t]), o !== !0 || n !== void 0) || (this._$AL.has(t) || (this.hasUpdated || s || (e = void 0), this._$AL.set(t, e)), i === !0 && this._$Em !== t && (this._$Eq ?? (this._$Eq = /* @__PURE__ */ new Set())).add(t));
217
- }
218
- async _$EP() {
219
- this.isUpdatePending = !0;
220
- try {
221
- await this._$ES;
222
- } catch (e) {
223
- Promise.reject(e);
224
- }
225
- const t = this.scheduleUpdate();
226
- return t != null && await t, !this.isUpdatePending;
227
- }
228
- scheduleUpdate() {
229
- return this.performUpdate();
230
- }
231
- performUpdate() {
232
- var s;
233
- if (!this.isUpdatePending) return;
234
- if (!this.hasUpdated) {
235
- if (this.renderRoot ?? (this.renderRoot = this.createRenderRoot()), this._$Ep) {
236
- for (const [o, n] of this._$Ep) this[o] = n;
237
- this._$Ep = void 0;
238
- }
239
- const i = this.constructor.elementProperties;
240
- if (i.size > 0) for (const [o, n] of i) {
241
- const { wrapped: a } = n, c = this[o];
242
- a !== !0 || this._$AL.has(o) || c === void 0 || this.C(o, void 0, n, c);
243
- }
244
- }
245
- let t = !1;
246
- const e = this._$AL;
247
- try {
248
- t = this.shouldUpdate(e), t ? (this.willUpdate(e), (s = this._$EO) == null || s.forEach((i) => {
249
- var o;
250
- return (o = i.hostUpdate) == null ? void 0 : o.call(i);
251
- }), this.update(e)) : this._$EM();
252
- } catch (i) {
253
- throw t = !1, this._$EM(), i;
254
- }
255
- t && this._$AE(e);
256
- }
257
- willUpdate(t) {
258
- }
259
- _$AE(t) {
260
- var e;
261
- (e = this._$EO) == null || e.forEach((s) => {
262
- var i;
263
- return (i = s.hostUpdated) == null ? void 0 : i.call(s);
264
- }), this.hasUpdated || (this.hasUpdated = !0, this.firstUpdated(t)), this.updated(t);
265
- }
266
- _$EM() {
267
- this._$AL = /* @__PURE__ */ new Map(), this.isUpdatePending = !1;
268
- }
269
- get updateComplete() {
270
- return this.getUpdateComplete();
271
- }
272
- getUpdateComplete() {
273
- return this._$ES;
274
- }
275
- shouldUpdate(t) {
276
- return !0;
277
- }
278
- update(t) {
279
- this._$Eq && (this._$Eq = this._$Eq.forEach((e) => this._$ET(e, this[e]))), this._$EM();
280
- }
281
- updated(t) {
282
- }
283
- firstUpdated(t) {
284
- }
285
- }
286
- l.elementStyles = [], l.shadowRootOptions = { mode: "open" }, l[d("elementProperties")] = /* @__PURE__ */ new Map(), l[d("finalized")] = /* @__PURE__ */ new Map(), m == null || m({ ReactiveElement: l }), (h.reactiveElementVersions ?? (h.reactiveElementVersions = [])).push("2.1.1");
287
- /**
288
- * @license
289
- * Copyright 2017 Google LLC
290
- * SPDX-License-Identifier: BSD-3-Clause
291
- */
292
- const N = (r, t, e) => (e.configurable = !0, e.enumerable = !0, Reflect.decorate && typeof t != "object" && Object.defineProperty(r, t, e), e);
293
- /**
294
- * @license
295
- * Copyright 2021 Google LLC
296
- * SPDX-License-Identifier: BSD-3-Clause
297
- */
298
- function q(r) {
299
- return (t, e) => {
300
- const { slot: s, selector: i } = {}, o = "slot" + (s ? `[name=${s}]` : ":not([name])");
301
- return N(t, e, { get() {
302
- var c;
303
- const n = (c = this.renderRoot) == null ? void 0 : c.querySelector(o), a = (n == null ? void 0 : n.assignedElements(r)) ?? [];
304
- return i === void 0 ? a : a.filter((p) => p.matches(i));
305
- } });
306
- };
307
- }
308
- const B = ":host{display:block}.chip-group{display:flex;flex-direction:row;flex-wrap:wrap;align-items:center;gap:16px}";
309
- var H = Object.defineProperty, I = Object.getOwnPropertyDescriptor, P = (r, t, e, s) => {
310
- for (var i = s > 1 ? void 0 : s ? I(t, e) : t, o = r.length - 1, n; o >= 0; o--)
311
- (n = r[o]) && (i = (s ? n(t, e, i) : n(i)) || i);
312
- return s && i && H(t, e, i), i;
313
- };
314
- let f = class extends b {
10
+ let l = class extends r {
315
11
  // Focus the next sibling of the Chip being removed.
316
- _focusNextSiblingOf(r) {
317
- const t = this._defaultSlotNodes, e = t.indexOf(r);
318
- if (e >= 0) {
319
- const s = t[e + 1] || t[e - 1];
12
+ _focusNextSiblingOf(n) {
13
+ const e = this._defaultSlotNodes, t = e.indexOf(n);
14
+ if (t >= 0) {
15
+ const s = e[t + 1] || e[t - 1];
320
16
  s instanceof HTMLElement && s.focus();
321
17
  }
322
18
  }
323
19
  // Capture the removal of a child Chip.
324
- _onChildRemove(r) {
325
- const t = r.detail.element;
326
- this._focusNextSiblingOf(t);
20
+ _onChildRemove(n) {
21
+ const e = n.detail.element;
22
+ this._focusNextSiblingOf(e);
327
23
  }
328
24
  connectedCallback() {
329
25
  super.connectedCallback && super.connectedCallback(), this.addEventListener("chipRemoved", this._onChildRemove);
@@ -332,23 +28,23 @@ let f = class extends b {
332
28
  super.disconnectedCallback && super.disconnectedCallback(), this.removeEventListener("chipRemoved", this._onChildRemove);
333
29
  }
334
30
  render() {
335
- return O`
31
+ return a`
336
32
  <div class="chip-group">
337
33
  <slot></slot>
338
34
  </div>
339
35
  `;
340
36
  }
341
37
  };
342
- f.styles = [
343
- b.styles,
344
- C(B)
38
+ l.styles = [
39
+ r.styles,
40
+ p(u)
345
41
  ];
346
- P([
347
- q()
348
- ], f.prototype, "_defaultSlotNodes", 2);
349
- f = P([
350
- U("ucds-chip-group")
351
- ], f);
42
+ d([
43
+ f()
44
+ ], l.prototype, "_defaultSlotNodes", 2);
45
+ l = d([
46
+ m("ucds-chip-group")
47
+ ], l);
352
48
  export {
353
- f as ChipGroup
49
+ l as ChipGroup
354
50
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ucalgary-design-system/chip-group",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "type": "module",
5
5
  "main": "index.js",
6
6
  "module": "index.js",
@@ -11,9 +11,9 @@
11
11
  }
12
12
  },
13
13
  "peerDependencies": {
14
- "@ucalgary-design-system/core": "^1.0.3",
15
- "@ucalgary-design-system/tokens": "^1.0.3",
16
- "@ucalgary-design-system/icon": "^1.0.3",
14
+ "@ucalgary-design-system/core": "^1.0.4",
15
+ "@ucalgary-design-system/tokens": "^1.0.4",
16
+ "@ucalgary-design-system/icon": "^1.0.4",
17
17
  "lit": "^3.2.1"
18
18
  },
19
19
  "description": "A web component for ChipGroup",