@ucalgary-design-system/icon 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 +9 -0
  2. package/index.js +46 -646
  3. package/package.json +3 -3
package/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # @ucalgary-design-system/icon
2
2
 
3
+ ## 1.0.4
4
+
5
+ ### Patch Changes
6
+
7
+ - fe87dab: Updated externalized dependencies
8
+ - Updated dependencies [fe87dab]
9
+ - @ucalgary-design-system/core@1.0.4
10
+ - @ucalgary-design-system/tokens@1.0.4
11
+
3
12
  ## 1.0.3
4
13
 
5
14
  ### Patch Changes
package/index.js CHANGED
@@ -1,609 +1,9 @@
1
- import { unsafeCSS as ht, html as ct } from "lit";
2
- import { classMap as dt } from "lit/directives/class-map.js";
3
- import { BaseElement as st } from "@ucalgary-design-system/core";
4
- /**
5
- * @license
6
- * Copyright 2017 Google LLC
7
- * SPDX-License-Identifier: BSD-3-Clause
8
- */
9
- const pt = { CHILD: 2 }, ut = (e) => (...t) => ({ _$litDirective$: e, values: t });
10
- let ft = class {
11
- constructor(t) {
12
- }
13
- get _$AU() {
14
- return this._$AM._$AU;
15
- }
16
- _$AT(t, i, s) {
17
- this._$Ct = t, this._$AM = i, this._$Ci = s;
18
- }
19
- _$AS(t, i) {
20
- return this.update(t, i);
21
- }
22
- update(t, i) {
23
- return this.render(...i);
24
- }
25
- };
26
- /**
27
- * @license
28
- * Copyright 2017 Google LLC
29
- * SPDX-License-Identifier: BSD-3-Clause
30
- */
31
- const U = globalThis, N = U.trustedTypes, J = N ? N.createPolicy("lit-html", { createHTML: (e) => e }) : void 0, rt = "$lit$", $ = `lit$${Math.random().toFixed(9).slice(2)}$`, ot = "?" + $, mt = `<${ot}>`, y = document, H = () => y.createComment(""), P = (e) => e === null || typeof e != "object" && typeof e != "function", V = Array.isArray, $t = (e) => V(e) || typeof (e == null ? void 0 : e[Symbol.iterator]) == "function", z = `[
32
- \f\r]`, E = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, K = /-->/g, Z = />/g, _ = RegExp(`>|${z}(?:([^\\s"'>=/]+)(${z}*=${z}*(?:[^
33
- \f\r"'\`<>=]|("|')|))|$)`, "g"), G = /'/g, Q = /"/g, nt = /^(?:script|style|textarea|title)$/i, w = Symbol.for("lit-noChange"), d = Symbol.for("lit-nothing"), X = /* @__PURE__ */ new WeakMap(), v = y.createTreeWalker(y, 129);
34
- function lt(e, t) {
35
- if (!V(e) || !e.hasOwnProperty("raw")) throw Error("invalid template strings array");
36
- return J !== void 0 ? J.createHTML(t) : t;
37
- }
38
- const gt = (e, t) => {
39
- const i = e.length - 1, s = [];
40
- let r, n = t === 2 ? "<svg>" : t === 3 ? "<math>" : "", o = E;
41
- for (let a = 0; a < i; a++) {
42
- const l = e[a];
43
- let c, p, h = -1, u = 0;
44
- for (; u < l.length && (o.lastIndex = u, p = o.exec(l), p !== null); ) u = o.lastIndex, o === E ? p[1] === "!--" ? o = K : p[1] !== void 0 ? o = Z : p[2] !== void 0 ? (nt.test(p[2]) && (r = RegExp("</" + p[2], "g")), o = _) : p[3] !== void 0 && (o = _) : o === _ ? p[0] === ">" ? (o = r ?? E, h = -1) : p[1] === void 0 ? h = -2 : (h = o.lastIndex - p[2].length, c = p[1], o = p[3] === void 0 ? _ : p[3] === '"' ? Q : G) : o === Q || o === G ? o = _ : o === K || o === Z ? o = E : (o = _, r = void 0);
45
- const m = o === _ && e[a + 1].startsWith("/>") ? " " : "";
46
- n += o === E ? l + mt : h >= 0 ? (s.push(c), l.slice(0, h) + rt + l.slice(h) + $ + m) : l + $ + (h === -2 ? a : m);
47
- }
48
- return [lt(e, n + (e[i] || "<?>") + (t === 2 ? "</svg>" : t === 3 ? "</math>" : "")), s];
49
- };
50
- class O {
51
- constructor({ strings: t, _$litType$: i }, s) {
52
- let r;
53
- this.parts = [];
54
- let n = 0, o = 0;
55
- const a = t.length - 1, l = this.parts, [c, p] = gt(t, i);
56
- if (this.el = O.createElement(c, s), v.currentNode = this.el.content, i === 2 || i === 3) {
57
- const h = this.el.content.firstChild;
58
- h.replaceWith(...h.childNodes);
59
- }
60
- for (; (r = v.nextNode()) !== null && l.length < a; ) {
61
- if (r.nodeType === 1) {
62
- if (r.hasAttributes()) for (const h of r.getAttributeNames()) if (h.endsWith(rt)) {
63
- const u = p[o++], m = r.getAttribute(h).split($), M = /([.?@])?(.*)/.exec(u);
64
- l.push({ type: 1, index: n, name: M[2], strings: m, ctor: M[1] === "." ? vt : M[1] === "?" ? yt : M[1] === "@" ? At : F }), r.removeAttribute(h);
65
- } else h.startsWith($) && (l.push({ type: 6, index: n }), r.removeAttribute(h));
66
- if (nt.test(r.tagName)) {
67
- const h = r.textContent.split($), u = h.length - 1;
68
- if (u > 0) {
69
- r.textContent = N ? N.emptyScript : "";
70
- for (let m = 0; m < u; m++) r.append(h[m], H()), v.nextNode(), l.push({ type: 2, index: ++n });
71
- r.append(h[u], H());
72
- }
73
- }
74
- } else if (r.nodeType === 8) if (r.data === ot) l.push({ type: 2, index: n });
75
- else {
76
- let h = -1;
77
- for (; (h = r.data.indexOf($, h + 1)) !== -1; ) l.push({ type: 7, index: n }), h += $.length - 1;
78
- }
79
- n++;
80
- }
81
- }
82
- static createElement(t, i) {
83
- const s = y.createElement("template");
84
- return s.innerHTML = t, s;
85
- }
86
- }
87
- function b(e, t, i = e, s) {
88
- var o, a;
89
- if (t === w) return t;
90
- let r = s !== void 0 ? (o = i._$Co) == null ? void 0 : o[s] : i._$Cl;
91
- const n = P(t) ? void 0 : t._$litDirective$;
92
- return (r == null ? void 0 : r.constructor) !== n && ((a = r == null ? void 0 : r._$AO) == null || a.call(r, !1), n === void 0 ? r = void 0 : (r = new n(e), r._$AT(e, i, s)), s !== void 0 ? (i._$Co ?? (i._$Co = []))[s] = r : i._$Cl = r), r !== void 0 && (t = b(e, r._$AS(e, t.values), r, s)), t;
93
- }
94
- class _t {
95
- constructor(t, i) {
96
- this._$AV = [], this._$AN = void 0, this._$AD = t, this._$AM = i;
97
- }
98
- get parentNode() {
99
- return this._$AM.parentNode;
100
- }
101
- get _$AU() {
102
- return this._$AM._$AU;
103
- }
104
- u(t) {
105
- const { el: { content: i }, parts: s } = this._$AD, r = ((t == null ? void 0 : t.creationScope) ?? y).importNode(i, !0);
106
- v.currentNode = r;
107
- let n = v.nextNode(), o = 0, a = 0, l = s[0];
108
- for (; l !== void 0; ) {
109
- if (o === l.index) {
110
- let c;
111
- l.type === 2 ? c = new L(n, n.nextSibling, this, t) : l.type === 1 ? c = new l.ctor(n, l.name, l.strings, this, t) : l.type === 6 && (c = new wt(n, this, t)), this._$AV.push(c), l = s[++a];
112
- }
113
- o !== (l == null ? void 0 : l.index) && (n = v.nextNode(), o++);
114
- }
115
- return v.currentNode = y, r;
116
- }
117
- p(t) {
118
- let i = 0;
119
- for (const s of this._$AV) s !== void 0 && (s.strings !== void 0 ? (s._$AI(t, s, i), i += s.strings.length - 2) : s._$AI(t[i])), i++;
120
- }
121
- }
122
- class L {
123
- get _$AU() {
124
- var t;
125
- return ((t = this._$AM) == null ? void 0 : t._$AU) ?? this._$Cv;
126
- }
127
- constructor(t, i, s, r) {
128
- this.type = 2, this._$AH = d, this._$AN = void 0, this._$AA = t, this._$AB = i, this._$AM = s, this.options = r, this._$Cv = (r == null ? void 0 : r.isConnected) ?? !0;
129
- }
130
- get parentNode() {
131
- let t = this._$AA.parentNode;
132
- const i = this._$AM;
133
- return i !== void 0 && (t == null ? void 0 : t.nodeType) === 11 && (t = i.parentNode), t;
134
- }
135
- get startNode() {
136
- return this._$AA;
137
- }
138
- get endNode() {
139
- return this._$AB;
140
- }
141
- _$AI(t, i = this) {
142
- t = b(this, t, i), P(t) ? t === d || t == null || t === "" ? (this._$AH !== d && this._$AR(), this._$AH = d) : t !== this._$AH && t !== w && this._(t) : t._$litType$ !== void 0 ? this.$(t) : t.nodeType !== void 0 ? this.T(t) : $t(t) ? this.k(t) : this._(t);
143
- }
144
- O(t) {
145
- return this._$AA.parentNode.insertBefore(t, this._$AB);
146
- }
147
- T(t) {
148
- this._$AH !== t && (this._$AR(), this._$AH = this.O(t));
149
- }
150
- _(t) {
151
- this._$AH !== d && P(this._$AH) ? this._$AA.nextSibling.data = t : this.T(y.createTextNode(t)), this._$AH = t;
152
- }
153
- $(t) {
154
- var n;
155
- const { values: i, _$litType$: s } = t, r = typeof s == "number" ? this._$AC(t) : (s.el === void 0 && (s.el = O.createElement(lt(s.h, s.h[0]), this.options)), s);
156
- if (((n = this._$AH) == null ? void 0 : n._$AD) === r) this._$AH.p(i);
157
- else {
158
- const o = new _t(r, this), a = o.u(this.options);
159
- o.p(i), this.T(a), this._$AH = o;
160
- }
161
- }
162
- _$AC(t) {
163
- let i = X.get(t.strings);
164
- return i === void 0 && X.set(t.strings, i = new O(t)), i;
165
- }
166
- k(t) {
167
- V(this._$AH) || (this._$AH = [], this._$AR());
168
- const i = this._$AH;
169
- let s, r = 0;
170
- for (const n of t) r === i.length ? i.push(s = new L(this.O(H()), this.O(H()), this, this.options)) : s = i[r], s._$AI(n), r++;
171
- r < i.length && (this._$AR(s && s._$AB.nextSibling, r), i.length = r);
172
- }
173
- _$AR(t = this._$AA.nextSibling, i) {
174
- var s;
175
- for ((s = this._$AP) == null ? void 0 : s.call(this, !1, !0, i); t !== this._$AB; ) {
176
- const r = t.nextSibling;
177
- t.remove(), t = r;
178
- }
179
- }
180
- setConnected(t) {
181
- var i;
182
- this._$AM === void 0 && (this._$Cv = t, (i = this._$AP) == null || i.call(this, t));
183
- }
184
- }
185
- class F {
186
- get tagName() {
187
- return this.element.tagName;
188
- }
189
- get _$AU() {
190
- return this._$AM._$AU;
191
- }
192
- constructor(t, i, s, r, n) {
193
- this.type = 1, this._$AH = d, this._$AN = void 0, this.element = t, this.name = i, this._$AM = r, this.options = n, s.length > 2 || s[0] !== "" || s[1] !== "" ? (this._$AH = Array(s.length - 1).fill(new String()), this.strings = s) : this._$AH = d;
194
- }
195
- _$AI(t, i = this, s, r) {
196
- const n = this.strings;
197
- let o = !1;
198
- if (n === void 0) t = b(this, t, i, 0), o = !P(t) || t !== this._$AH && t !== w, o && (this._$AH = t);
199
- else {
200
- const a = t;
201
- let l, c;
202
- for (t = n[0], l = 0; l < n.length - 1; l++) c = b(this, a[s + l], i, l), c === w && (c = this._$AH[l]), o || (o = !P(c) || c !== this._$AH[l]), c === d ? t = d : t !== d && (t += (c ?? "") + n[l + 1]), this._$AH[l] = c;
203
- }
204
- o && !r && this.j(t);
205
- }
206
- j(t) {
207
- t === d ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, t ?? "");
208
- }
209
- }
210
- class vt extends F {
211
- constructor() {
212
- super(...arguments), this.type = 3;
213
- }
214
- j(t) {
215
- this.element[this.name] = t === d ? void 0 : t;
216
- }
217
- }
218
- class yt extends F {
219
- constructor() {
220
- super(...arguments), this.type = 4;
221
- }
222
- j(t) {
223
- this.element.toggleAttribute(this.name, !!t && t !== d);
224
- }
225
- }
226
- class At extends F {
227
- constructor(t, i, s, r, n) {
228
- super(t, i, s, r, n), this.type = 5;
229
- }
230
- _$AI(t, i = this) {
231
- if ((t = b(this, t, i, 0) ?? d) === w) return;
232
- const s = this._$AH, r = t === d && s !== d || t.capture !== s.capture || t.once !== s.once || t.passive !== s.passive, n = t !== d && (s === d || r);
233
- r && this.element.removeEventListener(this.name, this, s), n && this.element.addEventListener(this.name, this, t), this._$AH = t;
234
- }
235
- handleEvent(t) {
236
- var i;
237
- typeof this._$AH == "function" ? this._$AH.call(((i = this.options) == null ? void 0 : i.host) ?? this.element, t) : this._$AH.handleEvent(t);
238
- }
239
- }
240
- class wt {
241
- constructor(t, i, s) {
242
- this.element = t, this.type = 6, this._$AN = void 0, this._$AM = i, this.options = s;
243
- }
244
- get _$AU() {
245
- return this._$AM._$AU;
246
- }
247
- _$AI(t) {
248
- b(this, t);
249
- }
250
- }
251
- const D = U.litHtmlPolyfillSupport;
252
- D == null || D(O, L), (U.litHtmlVersions ?? (U.litHtmlVersions = [])).push("3.3.1");
253
- /**
254
- * @license
255
- * Copyright 2017 Google LLC
256
- * SPDX-License-Identifier: BSD-3-Clause
257
- */
258
- let j = class extends ft {
259
- constructor(t) {
260
- if (super(t), this.it = d, t.type !== pt.CHILD) throw Error(this.constructor.directiveName + "() can only be used in child bindings");
261
- }
262
- render(t) {
263
- if (t === d || t == null) return this._t = void 0, this.it = t;
264
- if (t === w) return t;
265
- if (typeof t != "string") throw Error(this.constructor.directiveName + "() called with a non-string value");
266
- if (t === this.it) return this._t;
267
- this.it = t;
268
- const i = [t];
269
- return i.raw = i, this._t = { _$litType$: this.constructor.resultType, strings: i, values: [] };
270
- }
271
- };
272
- j.directiveName = "unsafeHTML", j.resultType = 1;
273
- /**
274
- * @license
275
- * Copyright 2017 Google LLC
276
- * SPDX-License-Identifier: BSD-3-Clause
277
- */
278
- let q = class extends j {
279
- };
280
- q.directiveName = "unsafeSVG", q.resultType = 2;
281
- const bt = ut(q);
282
- /**
283
- * @license
284
- * Copyright 2017 Google LLC
285
- * SPDX-License-Identifier: BSD-3-Clause
286
- */
287
- const Ct = (e) => (t, i) => {
288
- i !== void 0 ? i.addInitializer(() => {
289
- customElements.define(e, t);
290
- }) : customElements.define(e, t);
291
- };
292
- /**
293
- * @license
294
- * Copyright 2019 Google LLC
295
- * SPDX-License-Identifier: BSD-3-Clause
296
- */
297
- const T = globalThis, B = T.ShadowRoot && (T.ShadyCSS === void 0 || T.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, at = Symbol(), Y = /* @__PURE__ */ new WeakMap();
298
- let Et = class {
299
- constructor(t, i, s) {
300
- if (this._$cssResult$ = !0, s !== at) throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
301
- this.cssText = t, this.t = i;
302
- }
303
- get styleSheet() {
304
- let t = this.o;
305
- const i = this.t;
306
- if (B && t === void 0) {
307
- const s = i !== void 0 && i.length === 1;
308
- s && (t = Y.get(i)), t === void 0 && ((this.o = t = new CSSStyleSheet()).replaceSync(this.cssText), s && Y.set(i, t));
309
- }
310
- return t;
311
- }
312
- toString() {
313
- return this.cssText;
314
- }
315
- };
316
- const St = (e) => new Et(typeof e == "string" ? e : e + "", void 0, at), Ut = (e, t) => {
317
- if (B) e.adoptedStyleSheets = t.map((i) => i instanceof CSSStyleSheet ? i : i.styleSheet);
318
- else for (const i of t) {
319
- const s = document.createElement("style"), r = T.litNonce;
320
- r !== void 0 && s.setAttribute("nonce", r), s.textContent = i.cssText, e.appendChild(s);
321
- }
322
- }, tt = B ? (e) => e : (e) => e instanceof CSSStyleSheet ? ((t) => {
323
- let i = "";
324
- for (const s of t.cssRules) i += s.cssText;
325
- return St(i);
326
- })(e) : e;
327
- /**
328
- * @license
329
- * Copyright 2017 Google LLC
330
- * SPDX-License-Identifier: BSD-3-Clause
331
- */
332
- const { is: xt, defineProperty: Pt, getOwnPropertyDescriptor: Ot, getOwnPropertyNames: Mt, getOwnPropertySymbols: kt, getPrototypeOf: Tt } = Object, g = globalThis, et = g.trustedTypes, Nt = et ? et.emptyScript : "", I = g.reactiveElementPolyfillSupport, x = (e, t) => e, R = { toAttribute(e, t) {
333
- switch (t) {
334
- case Boolean:
335
- e = e ? Nt : null;
336
- break;
337
- case Object:
338
- case Array:
339
- e = e == null ? e : JSON.stringify(e);
340
- }
341
- return e;
342
- }, fromAttribute(e, t) {
343
- let i = e;
344
- switch (t) {
345
- case Boolean:
346
- i = e !== null;
347
- break;
348
- case Number:
349
- i = e === null ? null : Number(e);
350
- break;
351
- case Object:
352
- case Array:
353
- try {
354
- i = JSON.parse(e);
355
- } catch {
356
- i = null;
357
- }
358
- }
359
- return i;
360
- } }, W = (e, t) => !xt(e, t), it = { attribute: !0, type: String, converter: R, reflect: !1, useDefault: !1, hasChanged: W };
361
- Symbol.metadata ?? (Symbol.metadata = Symbol("metadata")), g.litPropertyMetadata ?? (g.litPropertyMetadata = /* @__PURE__ */ new WeakMap());
362
- class S extends HTMLElement {
363
- static addInitializer(t) {
364
- this._$Ei(), (this.l ?? (this.l = [])).push(t);
365
- }
366
- static get observedAttributes() {
367
- return this.finalize(), this._$Eh && [...this._$Eh.keys()];
368
- }
369
- static createProperty(t, i = it) {
370
- if (i.state && (i.attribute = !1), this._$Ei(), this.prototype.hasOwnProperty(t) && ((i = Object.create(i)).wrapped = !0), this.elementProperties.set(t, i), !i.noAccessor) {
371
- const s = Symbol(), r = this.getPropertyDescriptor(t, s, i);
372
- r !== void 0 && Pt(this.prototype, t, r);
373
- }
374
- }
375
- static getPropertyDescriptor(t, i, s) {
376
- const { get: r, set: n } = Ot(this.prototype, t) ?? { get() {
377
- return this[i];
378
- }, set(o) {
379
- this[i] = o;
380
- } };
381
- return { get: r, set(o) {
382
- const a = r == null ? void 0 : r.call(this);
383
- n == null || n.call(this, o), this.requestUpdate(t, a, s);
384
- }, configurable: !0, enumerable: !0 };
385
- }
386
- static getPropertyOptions(t) {
387
- return this.elementProperties.get(t) ?? it;
388
- }
389
- static _$Ei() {
390
- if (this.hasOwnProperty(x("elementProperties"))) return;
391
- const t = Tt(this);
392
- t.finalize(), t.l !== void 0 && (this.l = [...t.l]), this.elementProperties = new Map(t.elementProperties);
393
- }
394
- static finalize() {
395
- if (this.hasOwnProperty(x("finalized"))) return;
396
- if (this.finalized = !0, this._$Ei(), this.hasOwnProperty(x("properties"))) {
397
- const i = this.properties, s = [...Mt(i), ...kt(i)];
398
- for (const r of s) this.createProperty(r, i[r]);
399
- }
400
- const t = this[Symbol.metadata];
401
- if (t !== null) {
402
- const i = litPropertyMetadata.get(t);
403
- if (i !== void 0) for (const [s, r] of i) this.elementProperties.set(s, r);
404
- }
405
- this._$Eh = /* @__PURE__ */ new Map();
406
- for (const [i, s] of this.elementProperties) {
407
- const r = this._$Eu(i, s);
408
- r !== void 0 && this._$Eh.set(r, i);
409
- }
410
- this.elementStyles = this.finalizeStyles(this.styles);
411
- }
412
- static finalizeStyles(t) {
413
- const i = [];
414
- if (Array.isArray(t)) {
415
- const s = new Set(t.flat(1 / 0).reverse());
416
- for (const r of s) i.unshift(tt(r));
417
- } else t !== void 0 && i.push(tt(t));
418
- return i;
419
- }
420
- static _$Eu(t, i) {
421
- const s = i.attribute;
422
- return s === !1 ? void 0 : typeof s == "string" ? s : typeof t == "string" ? t.toLowerCase() : void 0;
423
- }
424
- constructor() {
425
- super(), this._$Ep = void 0, this.isUpdatePending = !1, this.hasUpdated = !1, this._$Em = null, this._$Ev();
426
- }
427
- _$Ev() {
428
- var t;
429
- this._$ES = new Promise((i) => this.enableUpdating = i), this._$AL = /* @__PURE__ */ new Map(), this._$E_(), this.requestUpdate(), (t = this.constructor.l) == null || t.forEach((i) => i(this));
430
- }
431
- addController(t) {
432
- var i;
433
- (this._$EO ?? (this._$EO = /* @__PURE__ */ new Set())).add(t), this.renderRoot !== void 0 && this.isConnected && ((i = t.hostConnected) == null || i.call(t));
434
- }
435
- removeController(t) {
436
- var i;
437
- (i = this._$EO) == null || i.delete(t);
438
- }
439
- _$E_() {
440
- const t = /* @__PURE__ */ new Map(), i = this.constructor.elementProperties;
441
- for (const s of i.keys()) this.hasOwnProperty(s) && (t.set(s, this[s]), delete this[s]);
442
- t.size > 0 && (this._$Ep = t);
443
- }
444
- createRenderRoot() {
445
- const t = this.shadowRoot ?? this.attachShadow(this.constructor.shadowRootOptions);
446
- return Ut(t, this.constructor.elementStyles), t;
447
- }
448
- connectedCallback() {
449
- var t;
450
- this.renderRoot ?? (this.renderRoot = this.createRenderRoot()), this.enableUpdating(!0), (t = this._$EO) == null || t.forEach((i) => {
451
- var s;
452
- return (s = i.hostConnected) == null ? void 0 : s.call(i);
453
- });
454
- }
455
- enableUpdating(t) {
456
- }
457
- disconnectedCallback() {
458
- var t;
459
- (t = this._$EO) == null || t.forEach((i) => {
460
- var s;
461
- return (s = i.hostDisconnected) == null ? void 0 : s.call(i);
462
- });
463
- }
464
- attributeChangedCallback(t, i, s) {
465
- this._$AK(t, s);
466
- }
467
- _$ET(t, i) {
468
- var n;
469
- const s = this.constructor.elementProperties.get(t), r = this.constructor._$Eu(t, s);
470
- if (r !== void 0 && s.reflect === !0) {
471
- const o = (((n = s.converter) == null ? void 0 : n.toAttribute) !== void 0 ? s.converter : R).toAttribute(i, s.type);
472
- this._$Em = t, o == null ? this.removeAttribute(r) : this.setAttribute(r, o), this._$Em = null;
473
- }
474
- }
475
- _$AK(t, i) {
476
- var n, o;
477
- const s = this.constructor, r = s._$Eh.get(t);
478
- if (r !== void 0 && this._$Em !== r) {
479
- const a = s.getPropertyOptions(r), l = typeof a.converter == "function" ? { fromAttribute: a.converter } : ((n = a.converter) == null ? void 0 : n.fromAttribute) !== void 0 ? a.converter : R;
480
- this._$Em = r;
481
- const c = l.fromAttribute(i, a.type);
482
- this[r] = c ?? ((o = this._$Ej) == null ? void 0 : o.get(r)) ?? c, this._$Em = null;
483
- }
484
- }
485
- requestUpdate(t, i, s) {
486
- var r;
487
- if (t !== void 0) {
488
- const n = this.constructor, o = this[t];
489
- if (s ?? (s = n.getPropertyOptions(t)), !((s.hasChanged ?? W)(o, i) || s.useDefault && s.reflect && o === ((r = this._$Ej) == null ? void 0 : r.get(t)) && !this.hasAttribute(n._$Eu(t, s)))) return;
490
- this.C(t, i, s);
491
- }
492
- this.isUpdatePending === !1 && (this._$ES = this._$EP());
493
- }
494
- C(t, i, { useDefault: s, reflect: r, wrapped: n }, o) {
495
- s && !(this._$Ej ?? (this._$Ej = /* @__PURE__ */ new Map())).has(t) && (this._$Ej.set(t, o ?? i ?? this[t]), n !== !0 || o !== void 0) || (this._$AL.has(t) || (this.hasUpdated || s || (i = void 0), this._$AL.set(t, i)), r === !0 && this._$Em !== t && (this._$Eq ?? (this._$Eq = /* @__PURE__ */ new Set())).add(t));
496
- }
497
- async _$EP() {
498
- this.isUpdatePending = !0;
499
- try {
500
- await this._$ES;
501
- } catch (i) {
502
- Promise.reject(i);
503
- }
504
- const t = this.scheduleUpdate();
505
- return t != null && await t, !this.isUpdatePending;
506
- }
507
- scheduleUpdate() {
508
- return this.performUpdate();
509
- }
510
- performUpdate() {
511
- var s;
512
- if (!this.isUpdatePending) return;
513
- if (!this.hasUpdated) {
514
- if (this.renderRoot ?? (this.renderRoot = this.createRenderRoot()), this._$Ep) {
515
- for (const [n, o] of this._$Ep) this[n] = o;
516
- this._$Ep = void 0;
517
- }
518
- const r = this.constructor.elementProperties;
519
- if (r.size > 0) for (const [n, o] of r) {
520
- const { wrapped: a } = o, l = this[n];
521
- a !== !0 || this._$AL.has(n) || l === void 0 || this.C(n, void 0, o, l);
522
- }
523
- }
524
- let t = !1;
525
- const i = this._$AL;
526
- try {
527
- t = this.shouldUpdate(i), t ? (this.willUpdate(i), (s = this._$EO) == null || s.forEach((r) => {
528
- var n;
529
- return (n = r.hostUpdate) == null ? void 0 : n.call(r);
530
- }), this.update(i)) : this._$EM();
531
- } catch (r) {
532
- throw t = !1, this._$EM(), r;
533
- }
534
- t && this._$AE(i);
535
- }
536
- willUpdate(t) {
537
- }
538
- _$AE(t) {
539
- var i;
540
- (i = this._$EO) == null || i.forEach((s) => {
541
- var r;
542
- return (r = s.hostUpdated) == null ? void 0 : r.call(s);
543
- }), this.hasUpdated || (this.hasUpdated = !0, this.firstUpdated(t)), this.updated(t);
544
- }
545
- _$EM() {
546
- this._$AL = /* @__PURE__ */ new Map(), this.isUpdatePending = !1;
547
- }
548
- get updateComplete() {
549
- return this.getUpdateComplete();
550
- }
551
- getUpdateComplete() {
552
- return this._$ES;
553
- }
554
- shouldUpdate(t) {
555
- return !0;
556
- }
557
- update(t) {
558
- this._$Eq && (this._$Eq = this._$Eq.forEach((i) => this._$ET(i, this[i]))), this._$EM();
559
- }
560
- updated(t) {
561
- }
562
- firstUpdated(t) {
563
- }
564
- }
565
- S.elementStyles = [], S.shadowRootOptions = { mode: "open" }, S[x("elementProperties")] = /* @__PURE__ */ new Map(), S[x("finalized")] = /* @__PURE__ */ new Map(), I == null || I({ ReactiveElement: S }), (g.reactiveElementVersions ?? (g.reactiveElementVersions = [])).push("2.1.1");
566
- /**
567
- * @license
568
- * Copyright 2017 Google LLC
569
- * SPDX-License-Identifier: BSD-3-Clause
570
- */
571
- const Ht = { attribute: !0, type: String, converter: R, reflect: !1, hasChanged: W }, Rt = (e = Ht, t, i) => {
572
- const { kind: s, metadata: r } = i;
573
- let n = globalThis.litPropertyMetadata.get(r);
574
- if (n === void 0 && globalThis.litPropertyMetadata.set(r, n = /* @__PURE__ */ new Map()), s === "setter" && ((e = Object.create(e)).wrapped = !0), n.set(i.name, e), s === "accessor") {
575
- const { name: o } = i;
576
- return { set(a) {
577
- const l = t.get.call(this);
578
- t.set.call(this, a), this.requestUpdate(o, l, e);
579
- }, init(a) {
580
- return a !== void 0 && this.C(o, void 0, e, a), a;
581
- } };
582
- }
583
- if (s === "setter") {
584
- const { name: o } = i;
585
- return function(a) {
586
- const l = this[o];
587
- t.call(this, a), this.requestUpdate(o, l, e);
588
- };
589
- }
590
- throw Error("Unsupported decorator location: " + s);
591
- };
592
- function C(e) {
593
- return (t, i) => typeof i == "object" ? Rt(e, t, i) : ((s, r, n) => {
594
- const o = r.hasOwnProperty(n);
595
- return r.constructor.createProperty(n, s), o ? Object.getOwnPropertyDescriptor(r, n) : void 0;
596
- })(e, t, i);
597
- }
598
- /**
599
- * @license
600
- * Copyright 2017 Google LLC
601
- * SPDX-License-Identifier: BSD-3-Clause
602
- */
603
- function Lt(e) {
604
- return C({ ...e, state: !0, attribute: !1 });
605
- }
606
- const Zt = [
1
+ import { unsafeCSS as d, html as u } from "lit";
2
+ import { unsafeSVG as m } from "lit/directives/unsafe-svg.js";
3
+ import { property as l, state as f, customElement as g } from "lit/decorators.js";
4
+ import { classMap as w } from "lit/directives/class-map.js";
5
+ import { BaseElement as s } from "@ucalgary-design-system/core";
6
+ const L = [
607
7
  "arrowDown",
608
8
  "arrowLeft",
609
9
  "arrowRight",
@@ -698,7 +98,7 @@ const Zt = [
698
98
  "warningTriangleFilled",
699
99
  "zoomIn",
700
100
  "zoomOut"
701
- ], k = {
101
+ ], a = {
702
102
  arrowDown: () => import("./ArrowDown-Cl_pe6x-.js").then((e) => e.default),
703
103
  arrowLeft: () => import("./ArrowLeft-D_pb7-h_.js").then((e) => e.default),
704
104
  arrowRight: () => import("./ArrowRight-0rOUWttV.js").then((e) => e.default),
@@ -794,25 +194,25 @@ const Zt = [
794
194
  zoomIn: () => import("./ZoomIn-BT-hX4R6.js").then((e) => e.default),
795
195
  zoomOut: () => import("./ZoomOut-B6ILbkP8.js").then((e) => e.default)
796
196
  };
797
- async function Ft(e) {
197
+ async function v(e) {
798
198
  try {
799
- return e in k ? await k[e]() : (console.warn(`[ucds-icon] Icon "${e}" was not found. Falling back to questionMark.`), await k.questionMark());
199
+ return e in a ? await a[e]() : (console.warn(`[ucds-icon] Icon "${e}" was not found. Falling back to questionMark.`), await a.questionMark());
800
200
  } catch (t) {
801
- return console.warn(`[ucds-icon] Failed to load "${e}". Falling back to questionMark.`, t), k.questionMark();
201
+ return console.warn(`[ucds-icon] Failed to load "${e}". Falling back to questionMark.`, t), a.questionMark();
802
202
  }
803
203
  }
804
- const zt = ":host{display:inline-flex;align-items:center;justify-content:center;height:-moz-fit-content;height:fit-content;width:-moz-fit-content;width:fit-content}.icon{display:inline-flex;width:24px;height:24px;color:currentColor}.icon svg{width:100%;height:100%;fill:currentColor}.icon--color-primary{color:var(--ucds-color-icon-primary)}.icon--color-primary-inverse{color:var(--ucds-color-icon-primary-inverse)}.icon--color-action-rest{color:var(--ucds-color-action-rest)}.icon--color-berry{color:var(--ucds-color-palette-berry-600)}.icon--color-disabled{color:var(--ucds-color-forms-input-element-disabled)}.icon--size-16{width:16px;height:16px}.icon--size-20{width:20px;height:20px}.icon--size-24{width:24px;height:24px}.icon--size-32{width:32px;height:32px}";
805
- var Dt = Object.defineProperty, It = Object.getOwnPropertyDescriptor, A = (e, t, i, s) => {
806
- for (var r = s > 1 ? void 0 : s ? It(t, i) : t, n = e.length - 1, o; n >= 0; n--)
807
- (o = e[n]) && (r = (s ? o(t, i, r) : o(r)) || r);
808
- return s && r && Dt(t, i, r), r;
204
+ const C = ":host{display:inline-flex;align-items:center;justify-content:center;height:-moz-fit-content;height:fit-content;width:-moz-fit-content;width:fit-content}.icon{display:inline-flex;width:24px;height:24px;color:currentColor}.icon svg{width:100%;height:100%;fill:currentColor}.icon--color-primary{color:var(--ucds-color-icon-primary)}.icon--color-primary-inverse{color:var(--ucds-color-icon-primary-inverse)}.icon--color-action-rest{color:var(--ucds-color-action-rest)}.icon--color-berry{color:var(--ucds-color-palette-berry-600)}.icon--color-disabled{color:var(--ucds-color-forms-input-element-disabled)}.icon--size-16{width:16px;height:16px}.icon--size-20{width:20px;height:20px}.icon--size-24{width:24px;height:24px}.icon--size-32{width:32px;height:32px}";
205
+ var y = Object.defineProperty, k = Object.getOwnPropertyDescriptor, r = (e, t, c, n) => {
206
+ for (var o = n > 1 ? void 0 : n ? k(t, c) : t, h = e.length - 1, p; h >= 0; h--)
207
+ (p = e[h]) && (o = (n ? p(t, c, o) : p(o)) || o);
208
+ return n && o && y(t, c, o), o;
809
209
  };
810
- let f = class extends st {
210
+ let i = class extends s {
811
211
  constructor() {
812
212
  super(...arguments), this.size = "24", this.accessible = !1, this.svg = null;
813
213
  }
814
214
  async willUpdate(e) {
815
- this.name === void 0 && (console.warn("[ucds-icon] No icon name was found. Falling back to questionMark."), this.name = "questionMark"), e.has("name") && this.name && (this.svg = await Ft(this.name));
215
+ this.name === void 0 && (console.warn("[ucds-icon] No icon name was found. Falling back to questionMark."), this.name = "questionMark"), e.has("name") && this.name && (this.svg = await v(this.name));
816
216
  }
817
217
  render() {
818
218
  const e = {
@@ -821,37 +221,37 @@ let f = class extends st {
821
221
  [`icon--size-${this.size}`]: !!this.size
822
222
  };
823
223
  let t = this.svg;
824
- return t && (this.accessible ? this.accessibleLabel ? t = t.replace(/<svg\b([^>]*)>/, `<svg$1 role="img" aria-label="${this.accessibleLabel}">`) : console.warn("[ucds-icon] Icon marked as accessible, but no accessible-label provided.") : t = t.replace(/<svg\b([^>]*)>/, '<svg$1 aria-hidden="true">')), ct`<span class=${dt(e)}>${bt(t)}</span>`;
224
+ return t && (this.accessible ? this.accessibleLabel ? t = t.replace(/<svg\b([^>]*)>/, `<svg$1 role="img" aria-label="${this.accessibleLabel}">`) : console.warn("[ucds-icon] Icon marked as accessible, but no accessible-label provided.") : t = t.replace(/<svg\b([^>]*)>/, '<svg$1 aria-hidden="true">')), u`<span class=${w(e)}>${m(t)}</span>`;
825
225
  }
826
226
  };
827
- f.styles = [
828
- st.styles,
829
- ht(zt)
227
+ i.styles = [
228
+ s.styles,
229
+ d(C)
830
230
  ];
831
- A([
832
- C({ type: String, attribute: "accessible-label" })
833
- ], f.prototype, "accessibleLabel", 2);
834
- A([
835
- C({ type: String })
836
- ], f.prototype, "color", 2);
837
- A([
838
- C({ type: String })
839
- ], f.prototype, "name", 2);
840
- A([
841
- C({ type: String })
842
- ], f.prototype, "size", 2);
843
- A([
844
- C({ type: Boolean })
845
- ], f.prototype, "accessible", 2);
846
- A([
847
- Lt()
848
- ], f.prototype, "svg", 2);
849
- f = A([
850
- Ct("ucds-icon")
851
- ], f);
231
+ r([
232
+ l({ type: String, attribute: "accessible-label" })
233
+ ], i.prototype, "accessibleLabel", 2);
234
+ r([
235
+ l({ type: String })
236
+ ], i.prototype, "color", 2);
237
+ r([
238
+ l({ type: String })
239
+ ], i.prototype, "name", 2);
240
+ r([
241
+ l({ type: String })
242
+ ], i.prototype, "size", 2);
243
+ r([
244
+ l({ type: Boolean })
245
+ ], i.prototype, "accessible", 2);
246
+ r([
247
+ f()
248
+ ], i.prototype, "svg", 2);
249
+ i = r([
250
+ g("ucds-icon")
251
+ ], i);
852
252
  export {
853
- Zt as ICON_NAMES,
854
- f as Icon,
855
- k as iconLoaders,
856
- Ft as loadIcon
253
+ L as ICON_NAMES,
254
+ i as Icon,
255
+ a as iconLoaders,
256
+ v as loadIcon
857
257
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ucalgary-design-system/icon",
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,8 +11,8 @@
11
11
  }
12
12
  },
13
13
  "peerDependencies": {
14
- "@ucalgary-design-system/core": "^1.0.3",
15
- "@ucalgary-design-system/tokens": "^1.0.3",
14
+ "@ucalgary-design-system/core": "^1.0.4",
15
+ "@ucalgary-design-system/tokens": "^1.0.4",
16
16
  "lit": "^3.2.1"
17
17
  },
18
18
  "description": "A web component for Icon",