@ucalgary-design-system/link 1.0.1 → 1.0.2

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 +32 -32
  3. package/package.json +6 -6
package/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # @ucalgary-design-system/link
2
2
 
3
+ ## 1.0.2
4
+
5
+ ### Patch Changes
6
+
7
+ - 5e2ac2d: Made use of new animated underline mixin.
8
+ - Updated dependencies [5e2ac2d]
9
+ - Updated dependencies [31c3e09]
10
+ - Updated dependencies [c1dd26e]
11
+ - @ucalgary-design-system/core@1.0.10
12
+
3
13
  ## 1.0.1
4
14
 
5
15
  ### Patch Changes
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
- import { BaseElement as O, injectGlobalTokens as A } from "@ucalgary-design-system/core";
2
- import { unsafeCSS as x, nothing as M, html as g } from "lit";
1
+ import { BaseElement as C, injectGlobalTokens as A } from "@ucalgary-design-system/core";
2
+ import { unsafeCSS as x, nothing as k, html as E } from "lit";
3
3
  import { ifDefined as S } from "lit/directives/if-defined.js";
4
4
  import "@ucalgary-design-system/icon";
5
5
  /**
@@ -7,7 +7,7 @@ import "@ucalgary-design-system/icon";
7
7
  * Copyright 2017 Google LLC
8
8
  * SPDX-License-Identifier: BSD-3-Clause
9
9
  */
10
- const R = (o) => (t, e) => {
10
+ const M = (o) => (t, e) => {
11
11
  e !== void 0 ? e.addInitializer(() => {
12
12
  customElements.define(o, t);
13
13
  }) : customElements.define(o, t);
@@ -17,16 +17,16 @@ const R = (o) => (t, e) => {
17
17
  * Copyright 2019 Google LLC
18
18
  * SPDX-License-Identifier: BSD-3-Clause
19
19
  */
20
- const y = globalThis, v = y.ShadowRoot && (y.ShadyCSS === void 0 || y.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, U = Symbol(), b = /* @__PURE__ */ new WeakMap();
21
- let j = class {
20
+ const y = globalThis, g = y.ShadowRoot && (y.ShadyCSS === void 0 || y.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, O = Symbol(), b = /* @__PURE__ */ new WeakMap();
21
+ let R = class {
22
22
  constructor(t, e, s) {
23
- if (this._$cssResult$ = !0, s !== U) throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
23
+ if (this._$cssResult$ = !0, s !== O) throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
24
24
  this.cssText = t, this.t = e;
25
25
  }
26
26
  get styleSheet() {
27
27
  let t = this.o;
28
28
  const e = this.t;
29
- if (v && t === void 0) {
29
+ if (g && t === void 0) {
30
30
  const s = e !== void 0 && e.length === 1;
31
31
  s && (t = b.get(e)), t === void 0 && ((this.o = t = new CSSStyleSheet()).replaceSync(this.cssText), s && b.set(e, t));
32
32
  }
@@ -36,16 +36,16 @@ let j = class {
36
36
  return this.cssText;
37
37
  }
38
38
  };
39
- const k = (o) => new j(typeof o == "string" ? o : o + "", void 0, U), z = (o, t) => {
40
- if (v) o.adoptedStyleSheets = t.map((e) => e instanceof CSSStyleSheet ? e : e.styleSheet);
39
+ const z = (o) => new R(typeof o == "string" ? o : o + "", void 0, O), j = (o, t) => {
40
+ if (g) o.adoptedStyleSheets = t.map((e) => e instanceof CSSStyleSheet ? e : e.styleSheet);
41
41
  else for (const e of t) {
42
42
  const s = document.createElement("style"), r = y.litNonce;
43
43
  r !== void 0 && s.setAttribute("nonce", r), s.textContent = e.cssText, o.appendChild(s);
44
44
  }
45
- }, w = v ? (o) => o : (o) => o instanceof CSSStyleSheet ? ((t) => {
45
+ }, w = g ? (o) => o : (o) => o instanceof CSSStyleSheet ? ((t) => {
46
46
  let e = "";
47
47
  for (const s of t.cssRules) e += s.cssText;
48
- return k(e);
48
+ return z(e);
49
49
  })(o) : o;
50
50
  /**
51
51
  * @license
@@ -80,7 +80,7 @@ const { is: T, defineProperty: D, getOwnPropertyDescriptor: L, getOwnPropertyNam
80
80
  }
81
81
  }
82
82
  return e;
83
- } }, _ = (o, t) => !T(o, t), C = { attribute: !0, type: String, converter: m, reflect: !1, useDefault: !1, hasChanged: _ };
83
+ } }, v = (o, t) => !T(o, t), U = { attribute: !0, type: String, converter: m, reflect: !1, useDefault: !1, hasChanged: v };
84
84
  Symbol.metadata ?? (Symbol.metadata = Symbol("metadata")), h.litPropertyMetadata ?? (h.litPropertyMetadata = /* @__PURE__ */ new WeakMap());
85
85
  class p extends HTMLElement {
86
86
  static addInitializer(t) {
@@ -89,7 +89,7 @@ class p extends HTMLElement {
89
89
  static get observedAttributes() {
90
90
  return this.finalize(), this._$Eh && [...this._$Eh.keys()];
91
91
  }
92
- static createProperty(t, e = C) {
92
+ static createProperty(t, e = U) {
93
93
  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) {
94
94
  const s = Symbol(), r = this.getPropertyDescriptor(t, s, e);
95
95
  r !== void 0 && D(this.prototype, t, r);
@@ -107,7 +107,7 @@ class p extends HTMLElement {
107
107
  }, configurable: !0, enumerable: !0 };
108
108
  }
109
109
  static getPropertyOptions(t) {
110
- return this.elementProperties.get(t) ?? C;
110
+ return this.elementProperties.get(t) ?? U;
111
111
  }
112
112
  static _$Ei() {
113
113
  if (this.hasOwnProperty(u("elementProperties"))) return;
@@ -166,7 +166,7 @@ class p extends HTMLElement {
166
166
  }
167
167
  createRenderRoot() {
168
168
  const t = this.shadowRoot ?? this.attachShadow(this.constructor.shadowRootOptions);
169
- return z(t, this.constructor.elementStyles), t;
169
+ return j(t, this.constructor.elementStyles), t;
170
170
  }
171
171
  connectedCallback() {
172
172
  var t;
@@ -201,15 +201,15 @@ class p extends HTMLElement {
201
201
  if (r !== void 0 && this._$Em !== r) {
202
202
  const a = s.getPropertyOptions(r), c = typeof a.converter == "function" ? { fromAttribute: a.converter } : ((i = a.converter) == null ? void 0 : i.fromAttribute) !== void 0 ? a.converter : m;
203
203
  this._$Em = r;
204
- const E = c.fromAttribute(e, a.type);
205
- this[r] = E ?? ((n = this._$Ej) == null ? void 0 : n.get(r)) ?? E, this._$Em = null;
204
+ const _ = c.fromAttribute(e, a.type);
205
+ this[r] = _ ?? ((n = this._$Ej) == null ? void 0 : n.get(r)) ?? _, this._$Em = null;
206
206
  }
207
207
  }
208
208
  requestUpdate(t, e, s) {
209
209
  var r;
210
210
  if (t !== void 0) {
211
211
  const i = this.constructor, n = this[t];
212
- if (s ?? (s = i.getPropertyOptions(t)), !((s.hasChanged ?? _)(n, e) || s.useDefault && s.reflect && n === ((r = this._$Ej) == null ? void 0 : r.get(t)) && !this.hasAttribute(i._$Eu(t, s)))) return;
212
+ if (s ?? (s = i.getPropertyOptions(t)), !((s.hasChanged ?? v)(n, e) || s.useDefault && s.reflect && n === ((r = this._$Ej) == null ? void 0 : r.get(t)) && !this.hasAttribute(i._$Eu(t, s)))) return;
213
213
  this.C(t, e, s);
214
214
  }
215
215
  this.isUpdatePending === !1 && (this._$ES = this._$EP());
@@ -291,7 +291,7 @@ p.elementStyles = [], p.shadowRootOptions = { mode: "open" }, p[u("elementProper
291
291
  * Copyright 2017 Google LLC
292
292
  * SPDX-License-Identifier: BSD-3-Clause
293
293
  */
294
- const X = { attribute: !0, type: String, converter: m, reflect: !1, hasChanged: _ }, J = (o = X, t, e) => {
294
+ const J = { attribute: !0, type: String, converter: m, reflect: !1, hasChanged: v }, K = (o = J, t, e) => {
295
295
  const { kind: s, metadata: r } = e;
296
296
  let i = globalThis.litPropertyMetadata.get(r);
297
297
  if (i === void 0 && globalThis.litPropertyMetadata.set(r, i = /* @__PURE__ */ new Map()), s === "setter" && ((o = Object.create(o)).wrapped = !0), i.set(e.name, o), s === "accessor") {
@@ -313,39 +313,39 @@ const X = { attribute: !0, type: String, converter: m, reflect: !1, hasChanged:
313
313
  throw Error("Unsupported decorator location: " + s);
314
314
  };
315
315
  function f(o) {
316
- return (t, e) => typeof e == "object" ? J(o, t, e) : ((s, r, i) => {
316
+ return (t, e) => typeof e == "object" ? K(o, t, e) : ((s, r, i) => {
317
317
  const n = r.hasOwnProperty(i);
318
318
  return r.constructor.createProperty(i, s), n ? Object.getOwnPropertyDescriptor(r, i) : void 0;
319
319
  })(o, t, e);
320
320
  }
321
- const K = ':host{display:inline-block;width:-moz-fit-content;width:fit-content;color:inherit}@keyframes redraw-underline{0%{transform:scaleX(0)}to{transform:scaleX(1)}}a{display:flex;width:auto;position:relative;gap:4px;align-items:center;color:inherit;font-weight:var(--ucds-font-weight-semibold);text-decoration:none}a .text{position:relative}a .text:after{content:"";position:absolute;left:0;bottom:0;height:1px;width:100%;background:currentColor;transform-origin:left;transform:scaleX(1);transition:none}a.cta ucds-icon{color:currentColor;opacity:0;transition:transform .5s,opacity .5s;position:relative;top:50%;transform:translate(-100%)}a:focus ucds-icon,a:hover ucds-icon{opacity:1;transform:translate(0)}a:focus .text:after,a:hover .text:after{animation:redraw-underline .3s forwards}a:focus-visible{outline:1px solid var(--ucds-color-action-focus);outline-offset:1px;border-radius:2px}a.color-red{color:var(--ucds-color-action-rest)}a.color-red:hover{color:var(--ucds-color-action-hover)}a.color-red:active,a.color-red:focus{color:var(--ucds-color-action-active)}a.color-red:visited{color:var(--ucds-color-action-visited)}a.color-grey{color:var(--ucds-color-text-primary)}a.color-inherit{outline-color:currentColor}';
322
- var V = Object.defineProperty, W = Object.getOwnPropertyDescriptor, d = (o, t, e, s) => {
323
- for (var r = s > 1 ? void 0 : s ? W(t, e) : t, i = o.length - 1, n; i >= 0; i--)
321
+ const V = ":host{display:inline-block;width:-moz-fit-content;width:fit-content;color:inherit}a{display:flex;width:auto;position:relative;gap:4px;align-items:center;color:inherit;font-weight:var(--ucds-font-weight-semibold);text-decoration:none}@keyframes redrawUnderline{0%{background-size:0 1px}to{background-size:100% 1px}}a{text-decoration:none}a .text{background-image:linear-gradient(currentColor,currentColor);background-position:0 calc(100% - 1px);background-repeat:no-repeat;background-size:100% 1px;transition:background-size .3s}a:hover .text,a:focus .text{animation:redrawUnderline .3s forwards}a .text{position:relative}a.cta ucds-icon{color:currentColor;opacity:0;transition:transform .5s,opacity .5s;position:relative;top:50%;transform:translate(-100%)}a:focus ucds-icon,a:hover ucds-icon{opacity:1;transform:translate(0)}a:focus-visible{outline:1px solid var(--ucds-color-action-focus);outline-offset:1px;border-radius:2px}a.color-red{color:var(--ucds-color-action-rest)}a.color-red:hover{color:var(--ucds-color-action-hover)}a.color-red:active,a.color-red:focus{color:var(--ucds-color-action-active)}a.color-red:visited{color:var(--ucds-color-action-visited)}a.color-grey{color:var(--ucds-color-text-primary)}a.color-inherit{outline-color:currentColor}";
322
+ var W = Object.defineProperty, F = Object.getOwnPropertyDescriptor, d = (o, t, e, s) => {
323
+ for (var r = s > 1 ? void 0 : s ? F(t, e) : t, i = o.length - 1, n; i >= 0; i--)
324
324
  (n = o[i]) && (r = (s ? n(t, e, r) : n(r)) || r);
325
- return s && r && V(t, e, r), r;
325
+ return s && r && W(t, e, r), r;
326
326
  };
327
- const F = ["red", "grey", "inherit"];
328
- let l = class extends O {
327
+ const G = ["red", "grey", "inherit"];
328
+ let l = class extends C {
329
329
  constructor() {
330
330
  super(...arguments), this.href = "", this.color = "red";
331
331
  }
332
332
  willUpdate(o) {
333
- o.has("color") && (!this.color || !F.includes(this.color)) && (console.warn(`[ucds-link] Invalid or missing color "${this.color}" passed. Falling back to "red".`), this.color = "red");
333
+ o.has("color") && (!this.color || !G.includes(this.color)) && (console.warn(`[ucds-link] Invalid or missing color "${this.color}" passed. Falling back to "red".`), this.color = "red");
334
334
  }
335
335
  render() {
336
- return g`
336
+ return E`
337
337
  <a href="${this.href}" target="${S(this.target)}" rel="${S(this.rel)}" class="${`color-${this.color}`} ${this.cta ? "cta" : ""}">
338
338
  <span class="text">
339
339
  <slot></slot>
340
340
  </span>
341
- ${this.cta ? g`<ucds-icon name="arrowRight" size="20"></ucds-icon>` : M}
341
+ ${this.cta ? E`<ucds-icon name="arrowRight" size="20"></ucds-icon>` : k}
342
342
  </a>
343
343
  `;
344
344
  }
345
345
  };
346
346
  l.styles = [
347
- O.styles,
348
- x(K)
347
+ C.styles,
348
+ x(V)
349
349
  ];
350
350
  d([
351
351
  f({ type: String })
@@ -363,7 +363,7 @@ d([
363
363
  f({ type: Boolean, reflect: !0 })
364
364
  ], l.prototype, "cta", 2);
365
365
  l = d([
366
- R("ucds-link")
366
+ M("ucds-link")
367
367
  ], l);
368
368
  A();
369
369
  export {
package/package.json CHANGED
@@ -1,6 +1,10 @@
1
1
  {
2
2
  "name": "@ucalgary-design-system/link",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
+ "description": "A web component for Link",
5
+ "publishConfig": {
6
+ "access": "public"
7
+ },
4
8
  "type": "module",
5
9
  "main": "index.js",
6
10
  "module": "index.js",
@@ -11,13 +15,9 @@
11
15
  }
12
16
  },
13
17
  "peerDependencies": {
14
- "@ucalgary-design-system/core": "^1.0.6",
18
+ "@ucalgary-design-system/core": "^1.0.10",
15
19
  "@ucalgary-design-system/tokens": "^1.0.0",
16
20
  "@ucalgary-design-system/icon": "^1.0.5",
17
21
  "lit": "^3.2.1"
18
- },
19
- "description": "A web component for Link",
20
- "publishConfig": {
21
- "access": "public"
22
22
  }
23
23
  }