@justeattakeaway/pie-link 1.1.1 → 1.2.0

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/dist/index.js CHANGED
@@ -1,22 +1,16 @@
1
- import { LitElement as m, nothing as v, html as h, unsafeCSS as b } from "lit";
1
+ import { LitElement as m, unsafeCSS as b, nothing as g, html as c } from "lit";
2
2
  import { property as o } from "lit/decorators.js";
3
- import { classMap as u } from "lit/directives/class-map.js";
4
- import { ifDefined as k } from "lit/directives/if-defined.js";
5
- import { validPropertyValues as d, defineCustomElement as x } from "@justeattakeaway/pie-webc-core";
6
- var z = Object.defineProperty, S = (c, e, i, g) => {
7
- for (var r = void 0, s = c.length - 1, p; s >= 0; s--)
8
- (p = c[s]) && (r = p(e, i, r) || r);
9
- return r && z(e, i, r), r;
10
- };
11
- class y extends m {
12
- constructor() {
13
- super(...arguments), this.v = "1.1.1";
3
+ import { classMap as y } from "lit/directives/class-map.js";
4
+ import { ifDefined as d } from "lit/directives/if-defined.js";
5
+ import { validPropertyValues as s, safeCustomElement as x } from "@justeattakeaway/pie-webc-core";
6
+ const h = class h extends m {
7
+ willUpdate() {
8
+ this.getAttribute("v") || this.setAttribute("v", h.v);
14
9
  }
15
- }
16
- S([
17
- o({ type: String, reflect: !0 })
18
- ], y.prototype, "v");
19
- const $ = "*,*:after,*:before{box-sizing:inherit}.c-link{--link-font-family: var(--dt-font-interactive-l-family);--link-font-size: calc(var(--dt-font-size-16) * 1px);--link-line-height: calc(var(--dt-font-size-16-line-height) * 1px);--link-font-weight: var(--dt-font-weight-regular);--link-text-color: var(--dt-color-content-link);--link-text-decoration: var(--dt-font-style-underline);--link-icon-size: 16px;--link-icon-offset-top: var(--dt-spacing-a);display:inline-block;font-family:var(--link-font-family);font-size:var(--link-font-size);line-height:var(--link-line-height);font-weight:var(--link-font-weight);color:var(--link-text-color);text-decoration:var(--link-text-decoration);cursor:pointer}.c-link:hover,.c-link:active{--link-text-decoration: none}.c-link.c-link--high-visibility{--link-text-color: var(--dt-color-content-link-distinct)}.c-link.c-link--inverse{--link-text-color: var(--dt-color-content-link-inverse)}.c-link.c-link--small{--link-font-size: calc(var(--dt-font-size-14) * 1px);--link-line-height: calc(var(--dt-font-size-14-line-height) * 1px);--link-icon-offset-top: 2px}.c-link.c-link--underline-reversed.c-link--standalone{--link-text-decoration: none}.c-link.c-link--underline-reversed.c-link--standalone:hover,.c-link.c-link--underline-reversed.c-link--standalone:active{--link-text-decoration: var(--dt-font-style-underline)}.c-link.c-link--bold{--link-font-weight: var(--dt-font-weight-bold)}.c-link.c-link--standalone{display:block;width:fit-content}.c-link.c-link--hasVisited:visited{color:var(--dt-color-content-link-visited)}.c-link.c-link--hasVisited:visited.c-link--inverse{color:var(--dt-color-content-link-visited-inverse)}.c-link:focus-visible{outline:none;border-radius:2px;box-shadow:0 0 0 2px var(--dt-color-focus-inner),0 0 0 4px var(--dt-color-focus-outer)}button.c-link{outline:none;border:none;-webkit-user-select:none;user-select:none;background:transparent;padding:0}.c-link-content{display:flex;gap:var(--dt-spacing-a)}::slotted(.c-pieIcon),::slotted(svg){display:inline-flex;margin-block-start:var(--link-icon-offset-top);height:var(--link-icon-size);width:var(--link-icon-size)}", P = ["default", "high-visibility", "inverse"], w = ["small", "medium"], B = ["leading", "trailing"], V = ["a", "button"], C = ["submit", "button", "reset", "menu"], _ = ["default", "reversed"], n = {
10
+ };
11
+ h.v = "1.2.0";
12
+ let u = h;
13
+ const z = "*,*:after,*:before{box-sizing:inherit}.c-link{--link-font-family: var(--dt-font-interactive-l-family);--link-font-size: calc(var(--dt-font-size-16) * 1px);--link-line-height: calc(var(--dt-font-size-16-line-height) * 1px);--link-font-weight: var(--dt-font-weight-regular);--link-text-color: var(--dt-color-content-link);--link-text-decoration: var(--dt-font-style-underline);--link-icon-size: 16px;--link-icon-offset-top: var(--dt-spacing-a);display:inline-block;font-family:var(--link-font-family);font-size:var(--link-font-size);line-height:var(--link-line-height);font-weight:var(--link-font-weight);color:var(--link-text-color);text-decoration:var(--link-text-decoration);cursor:pointer}.c-link:hover,.c-link:active{--link-text-decoration: none}.c-link.c-link--high-visibility{--link-text-color: var(--dt-color-content-link-distinct)}.c-link.c-link--inverse{--link-text-color: var(--dt-color-content-link-inverse)}.c-link.c-link--small{--link-font-size: calc(var(--dt-font-size-14) * 1px);--link-line-height: calc(var(--dt-font-size-14-line-height) * 1px);--link-icon-offset-top: 2px}.c-link.c-link--underline-reversed.c-link--standalone{--link-text-decoration: none}.c-link.c-link--underline-reversed.c-link--standalone:hover,.c-link.c-link--underline-reversed.c-link--standalone:active{--link-text-decoration: var(--dt-font-style-underline)}.c-link.c-link--bold{--link-font-weight: var(--dt-font-weight-bold)}.c-link.c-link--standalone{display:block;width:fit-content}.c-link.c-link--hasVisited:visited{color:var(--dt-color-content-link-visited)}.c-link.c-link--hasVisited:visited.c-link--inverse{color:var(--dt-color-content-link-visited-inverse)}.c-link:focus-visible{outline:none;border-radius:2px;box-shadow:0 0 0 2px var(--dt-color-focus-inner),0 0 0 4px var(--dt-color-focus-outer)}button.c-link{outline:none;border:none;-webkit-user-select:none;user-select:none;background:transparent;padding:0}.c-link-content{display:flex;gap:var(--dt-spacing-a)}::slotted(.c-pieIcon),::slotted(svg){display:inline-flex;margin-block-start:var(--link-icon-offset-top);height:var(--link-icon-size);width:var(--link-icon-size)}", S = ["default", "high-visibility", "inverse"], $ = ["small", "medium"], w = ["leading", "trailing"], P = ["a", "button"], B = ["submit", "button", "reset", "menu"], V = ["default", "reversed"], e = {
20
14
  tag: "a",
21
15
  variant: "default",
22
16
  size: "medium",
@@ -27,14 +21,15 @@ const $ = "*,*:after,*:before{box-sizing:inherit}.c-link{--link-font-family: var
27
21
  iconPlacement: "leading",
28
22
  type: "submit"
29
23
  };
30
- var j = Object.defineProperty, l = (c, e, i, g) => {
31
- for (var r = void 0, s = c.length - 1, p; s >= 0; s--)
32
- (p = c[s]) && (r = p(e, i, r) || r);
33
- return r && j(e, i, r), r;
24
+ var C = Object.defineProperty, O = Object.getOwnPropertyDescriptor, i = (l, n, k, p) => {
25
+ for (var r = p > 1 ? void 0 : p ? O(n, k) : n, v = l.length - 1, f; v >= 0; v--)
26
+ (f = l[v]) && (r = (p ? f(n, k, r) : f(r)) || r);
27
+ return p && r && C(n, k, r), r;
34
28
  };
35
- const a = "pie-link", f = class f extends y {
29
+ const a = "pie-link";
30
+ let t = class extends u {
36
31
  constructor() {
37
- super(...arguments), this.tag = n.tag, this.variant = n.variant, this.size = n.size, this.underline = n.underline, this.iconPlacement = n.iconPlacement, this.isBold = n.isBold, this.isStandalone = n.isStandalone, this.hasVisited = n.hasVisited, this.type = n.type;
32
+ super(...arguments), this.tag = e.tag, this.variant = e.variant, this.size = e.size, this.underline = e.underline, this.iconPlacement = e.iconPlacement, this.isBold = e.isBold, this.isStandalone = e.isStandalone, this.hasVisited = e.hasVisited, this.type = e.type;
38
33
  }
39
34
  /**
40
35
  * Renders the link content.
@@ -42,12 +37,12 @@ const a = "pie-link", f = class f extends y {
42
37
  * @private
43
38
  */
44
39
  renderContent() {
45
- const { iconPlacement: e, isStandalone: i } = this;
46
- return h`
40
+ const { iconPlacement: l, isStandalone: n } = this;
41
+ return c`
47
42
  <span class="c-link-content">
48
- ${i && e === "leading" ? h`<slot name="icon"></slot>` : v}
43
+ ${n && l === "leading" ? c`<slot name="icon"></slot>` : g}
49
44
  <slot></slot>
50
- ${i && e === "trailing" ? h`<slot name="icon"></slot>` : v}
45
+ ${n && l === "trailing" ? c`<slot name="icon"></slot>` : g}
51
46
  </span>`;
52
47
  }
53
48
  /**
@@ -55,14 +50,14 @@ const a = "pie-link", f = class f extends y {
55
50
  *
56
51
  * @private
57
52
  */
58
- renderButton(e) {
59
- var i;
60
- return h`
53
+ renderButton(l) {
54
+ var n;
55
+ return c`
61
56
  <button
62
57
  data-test-id="pie-link-button"
63
- class="${u(e)}"
58
+ class="${y(l)}"
64
59
  type=${this.type}
65
- aria-label=${k((i = this.aria) == null ? void 0 : i.label)}>
60
+ aria-label=${d((n = this.aria) == null ? void 0 : n.label)}>
66
61
  ${this.renderContent()}
67
62
  </button>`;
68
63
  }
@@ -71,21 +66,21 @@ const a = "pie-link", f = class f extends y {
71
66
  *
72
67
  * @private
73
68
  */
74
- renderAnchor(e) {
75
- var i;
76
- return h`
69
+ renderAnchor(l) {
70
+ var n;
71
+ return c`
77
72
  <a
78
73
  data-test-id="pie-link-anchor"
79
- class="${u(e)}"
80
- href=${k(this.href)}
81
- target=${k(this.target)}
82
- rel=${k(this.rel)}
83
- aria-label=${k((i = this.aria) == null ? void 0 : i.label)}>
74
+ class="${y(l)}"
75
+ href=${d(this.href)}
76
+ target=${d(this.target)}
77
+ rel=${d(this.rel)}
78
+ aria-label=${d((n = this.aria) == null ? void 0 : n.label)}>
84
79
  ${this.renderContent()}
85
80
  </a>`;
86
81
  }
87
82
  render() {
88
- const e = {
83
+ const l = {
89
84
  "c-link": !0,
90
85
  [`c-link--${this.variant}`]: !0,
91
86
  [`c-link--${this.size}`]: !0,
@@ -94,64 +89,65 @@ const a = "pie-link", f = class f extends y {
94
89
  "c-link--standalone": this.isStandalone,
95
90
  "c-link--hasVisited": this.hasVisited
96
91
  };
97
- return this.tag === "button" ? this.renderButton(e) : this.renderAnchor(e);
92
+ return this.tag === "button" ? this.renderButton(l) : this.renderAnchor(l);
98
93
  }
99
94
  };
100
- f.styles = b($);
101
- let t = f;
102
- l([
95
+ t.styles = b(z);
96
+ i([
103
97
  o({ type: String }),
104
- d(a, V, n.tag)
105
- ], t.prototype, "tag");
106
- l([
98
+ s(a, P, e.tag)
99
+ ], t.prototype, "tag", 2);
100
+ i([
107
101
  o({ type: String }),
108
- d(a, P, n.variant)
109
- ], t.prototype, "variant");
110
- l([
102
+ s(a, S, e.variant)
103
+ ], t.prototype, "variant", 2);
104
+ i([
111
105
  o({ type: String }),
112
- d(a, w, n.size)
113
- ], t.prototype, "size");
114
- l([
106
+ s(a, $, e.size)
107
+ ], t.prototype, "size", 2);
108
+ i([
115
109
  o({ type: String }),
116
- d(a, _, n.underline)
117
- ], t.prototype, "underline");
118
- l([
110
+ s(a, V, e.underline)
111
+ ], t.prototype, "underline", 2);
112
+ i([
119
113
  o({ type: String }),
120
- d(a, B, n.iconPlacement)
121
- ], t.prototype, "iconPlacement");
122
- l([
114
+ s(a, w, e.iconPlacement)
115
+ ], t.prototype, "iconPlacement", 2);
116
+ i([
123
117
  o({ type: String, reflect: !0 })
124
- ], t.prototype, "href");
125
- l([
118
+ ], t.prototype, "href", 2);
119
+ i([
126
120
  o({ type: String, reflect: !0 })
127
- ], t.prototype, "target");
128
- l([
121
+ ], t.prototype, "target", 2);
122
+ i([
129
123
  o({ type: String, reflect: !0 })
130
- ], t.prototype, "rel");
131
- l([
124
+ ], t.prototype, "rel", 2);
125
+ i([
132
126
  o({ type: Boolean })
133
- ], t.prototype, "isBold");
134
- l([
127
+ ], t.prototype, "isBold", 2);
128
+ i([
135
129
  o({ type: Boolean })
136
- ], t.prototype, "isStandalone");
137
- l([
130
+ ], t.prototype, "isStandalone", 2);
131
+ i([
138
132
  o({ type: Boolean })
139
- ], t.prototype, "hasVisited");
140
- l([
133
+ ], t.prototype, "hasVisited", 2);
134
+ i([
141
135
  o({ type: String }),
142
- d(a, C, n.type)
143
- ], t.prototype, "type");
144
- l([
136
+ s(a, B, e.type)
137
+ ], t.prototype, "type", 2);
138
+ i([
145
139
  o({ type: Object })
146
- ], t.prototype, "aria");
147
- x(a, t);
140
+ ], t.prototype, "aria", 2);
141
+ t = i([
142
+ x("pie-link")
143
+ ], t);
148
144
  export {
149
145
  t as PieLink,
150
- C as buttonTypes,
151
- n as defaultProps,
152
- B as iconPlacements,
153
- w as sizes,
154
- V as tags,
155
- _ as underlineTypes,
156
- P as variants
146
+ B as buttonTypes,
147
+ e as defaultProps,
148
+ w as iconPlacements,
149
+ $ as sizes,
150
+ P as tags,
151
+ V as underlineTypes,
152
+ S as variants
157
153
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@justeattakeaway/pie-link",
3
3
  "description": "PIE Design System Link built using Web Components",
4
- "version": "1.1.1",
4
+ "version": "1.2.0",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/justeattakeaway/pie",
@@ -39,15 +39,15 @@
39
39
  "license": "Apache-2.0",
40
40
  "devDependencies": {
41
41
  "@custom-elements-manifest/analyzer": "0.9.0",
42
- "@justeattakeaway/pie-components-config": "0.19.1",
42
+ "@justeattakeaway/pie-components-config": "0.20.1",
43
43
  "@justeattakeaway/pie-css": "0.16.0",
44
- "@justeattakeaway/pie-icons-webc": "1.6.2",
45
- "@justeattakeaway/pie-monorepo-utils": "0.5.0",
44
+ "@justeattakeaway/pie-icons-webc": "1.10.0",
45
+ "@justeattakeaway/pie-monorepo-utils": "0.5.1",
46
46
  "@justeattakeaway/pie-wrapper-react": "0.14.3",
47
47
  "cem-plugin-module-file-extensions": "0.0.5"
48
48
  },
49
49
  "dependencies": {
50
- "@justeattakeaway/pie-webc-core": "0.25.1"
50
+ "@justeattakeaway/pie-webc-core": "0.26.0"
51
51
  },
52
52
  "volta": {
53
53
  "extends": "../../../package.json"
package/src/index.ts CHANGED
@@ -5,7 +5,7 @@ import { PieElement } from '@justeattakeaway/pie-webc-core/src/internals/PieElem
5
5
  import { property } from 'lit/decorators.js';
6
6
  import { classMap, type ClassInfo } from 'lit/directives/class-map.js';
7
7
  import { ifDefined } from 'lit/directives/if-defined.js';
8
- import { validPropertyValues, defineCustomElement } from '@justeattakeaway/pie-webc-core';
8
+ import { safeCustomElement, validPropertyValues } from '@justeattakeaway/pie-webc-core';
9
9
  import styles from './link.scss?inline';
10
10
  import {
11
11
  type LinkProps,
@@ -29,6 +29,7 @@ const componentSelector = 'pie-link';
29
29
  * @slot - Default slot
30
30
  */
31
31
 
32
+ @safeCustomElement('pie-link')
32
33
  export class PieLink extends PieElement implements LinkProps {
33
34
  @property({ type: String })
34
35
  @validPropertyValues(componentSelector, tags, defaultProps.tag)
@@ -146,8 +147,6 @@ export class PieLink extends PieElement implements LinkProps {
146
147
  static styles = unsafeCSS(styles);
147
148
  }
148
149
 
149
- defineCustomElement(componentSelector, PieLink);
150
-
151
150
  declare global {
152
151
  interface HTMLElementTagNameMap {
153
152
  [componentSelector]: PieLink;