@justeattakeaway/pie-link 1.3.3 → 1.3.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.
- package/dist/index.js +41 -41
- package/package.json +1 -1
- package/src/link.scss +18 -8
package/dist/index.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { LitElement as b, unsafeCSS as m, nothing as
|
|
1
|
+
import { LitElement as b, unsafeCSS as m, nothing as g, html as d } from "lit";
|
|
2
2
|
import { property as i } from "lit/decorators.js";
|
|
3
|
-
import { classMap as
|
|
3
|
+
import { classMap as u } from "lit/directives/class-map.js";
|
|
4
4
|
import { ifDefined as s } from "lit/directives/if-defined.js";
|
|
5
5
|
import { validPropertyValues as a, safeCustomElement as x } from "@justeattakeaway/pie-webc-core";
|
|
6
|
-
const
|
|
6
|
+
const k = class k extends b {
|
|
7
7
|
willUpdate() {
|
|
8
|
-
this.getAttribute("v") || this.setAttribute("v",
|
|
8
|
+
this.getAttribute("v") || this.setAttribute("v", k.v);
|
|
9
9
|
}
|
|
10
10
|
};
|
|
11
|
-
|
|
12
|
-
let
|
|
13
|
-
const z = "*,*:after,*:before{box-sizing:inherit}:host{display:inline-block;--link-font-weight: var(--dt-font-weight
|
|
11
|
+
k.v = "1.3.4";
|
|
12
|
+
let y = k;
|
|
13
|
+
const z = "*,*:after,*:before{box-sizing:inherit}:host{display:inline-block;--link-font-weight: var(--dt-font-body-l-link-weight);--link-text-color: var(--dt-color-content-link);--link-text-decoration: var(--dt-font-body-l-link-text-decoration)}:host([isstandalone]){display:block}.c-link{--link-font-family: var(--dt-font-interactive-l-family);--link-font-size: calc(var(--dt-font-body-l-link-size) * 1px);--link-line-height: calc(var(--dt-font-body-l-link-line-height) * 1px);--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-body-s-link-size) * 1px);--link-line-height: calc(var(--dt-font-body-s-link-line-height) * 1px);--link-font-weight: var(--dt-font-body-s-link-weight);--link-text-decoration: var(--dt-font-body-s-link-text-decoration);--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-body-l-link-text-decoration)}.c-link.c-link--bold{--link-font-size: calc(var(--dt-font-body-strong-l-link-size) * 1px);--link-line-height: calc(var(--dt-font-body-strong-l-link-line-height) * 1px);--link-font-weight: var(--dt-font-body-strong-l-link-weight)}.c-link.c-link--bold.c-link--small{--link-font-size: calc(var(--dt-font-body-strong-s-link-size) * 1px);--link-line-height: calc(var(--dt-font-body-strong-s-link-line-height) * 1px);--link-font-weight: var(--dt-font-body-strong-s-link-weight)}.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)}", w = ["default", "high-visibility", "inverse"], S = ["small", "medium"], $ = ["leading", "trailing"], P = ["a", "button"], B = ["submit", "button", "reset", "menu"], V = ["default", "reversed"], n = {
|
|
14
14
|
tag: "a",
|
|
15
15
|
variant: "default",
|
|
16
16
|
size: "medium",
|
|
@@ -21,15 +21,15 @@ const z = "*,*:after,*:before{box-sizing:inherit}:host{display:inline-block;--li
|
|
|
21
21
|
iconPlacement: "leading",
|
|
22
22
|
type: "submit"
|
|
23
23
|
};
|
|
24
|
-
var C = Object.defineProperty, O = Object.getOwnPropertyDescriptor,
|
|
25
|
-
for (var r = p > 1 ? void 0 : p ? O(o,
|
|
26
|
-
(v = l[f]) && (r = (p ? v(o,
|
|
27
|
-
return p && r && C(o,
|
|
24
|
+
var C = Object.defineProperty, O = Object.getOwnPropertyDescriptor, e = (l, o, h, p) => {
|
|
25
|
+
for (var r = p > 1 ? void 0 : p ? O(o, h) : o, f = l.length - 1, v; f >= 0; f--)
|
|
26
|
+
(v = l[f]) && (r = (p ? v(o, h, r) : v(r)) || r);
|
|
27
|
+
return p && r && C(o, h, r), r;
|
|
28
28
|
};
|
|
29
29
|
const c = "pie-link";
|
|
30
|
-
let t = class extends
|
|
30
|
+
let t = class extends y {
|
|
31
31
|
constructor() {
|
|
32
|
-
super(...arguments), this.tag =
|
|
32
|
+
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;
|
|
33
33
|
}
|
|
34
34
|
/**
|
|
35
35
|
* Renders the link content.
|
|
@@ -40,9 +40,9 @@ let t = class extends u {
|
|
|
40
40
|
const { iconPlacement: l, isStandalone: o } = this;
|
|
41
41
|
return d`
|
|
42
42
|
<span class="c-link-content">
|
|
43
|
-
${o && l === "leading" ? d`<slot name="icon"></slot>` :
|
|
43
|
+
${o && l === "leading" ? d`<slot name="icon"></slot>` : g}
|
|
44
44
|
<slot></slot>
|
|
45
|
-
${o && l === "trailing" ? d`<slot name="icon"></slot>` :
|
|
45
|
+
${o && l === "trailing" ? d`<slot name="icon"></slot>` : g}
|
|
46
46
|
</span>`;
|
|
47
47
|
}
|
|
48
48
|
/**
|
|
@@ -55,7 +55,7 @@ let t = class extends u {
|
|
|
55
55
|
return d`
|
|
56
56
|
<button
|
|
57
57
|
data-test-id="pie-link-button"
|
|
58
|
-
class="${
|
|
58
|
+
class="${u(l)}"
|
|
59
59
|
type=${this.type}
|
|
60
60
|
aria-label=${s((o = this.aria) == null ? void 0 : o.label)}
|
|
61
61
|
part="base">
|
|
@@ -72,7 +72,7 @@ let t = class extends u {
|
|
|
72
72
|
return d`
|
|
73
73
|
<a
|
|
74
74
|
data-test-id="pie-link-anchor"
|
|
75
|
-
class="${
|
|
75
|
+
class="${u(l)}"
|
|
76
76
|
href=${s(this.href)}
|
|
77
77
|
target=${s(this.target)}
|
|
78
78
|
rel=${s(this.rel)}
|
|
@@ -96,64 +96,64 @@ let t = class extends u {
|
|
|
96
96
|
}
|
|
97
97
|
};
|
|
98
98
|
t.styles = m(z);
|
|
99
|
-
|
|
99
|
+
e([
|
|
100
100
|
i({ type: String }),
|
|
101
|
-
a(c, P,
|
|
101
|
+
a(c, P, n.tag)
|
|
102
102
|
], t.prototype, "tag", 2);
|
|
103
|
-
|
|
103
|
+
e([
|
|
104
104
|
i({ type: String }),
|
|
105
|
-
a(c,
|
|
105
|
+
a(c, w, n.variant)
|
|
106
106
|
], t.prototype, "variant", 2);
|
|
107
|
-
|
|
107
|
+
e([
|
|
108
108
|
i({ type: String }),
|
|
109
|
-
a(c,
|
|
109
|
+
a(c, S, n.size)
|
|
110
110
|
], t.prototype, "size", 2);
|
|
111
|
-
|
|
111
|
+
e([
|
|
112
112
|
i({ type: String }),
|
|
113
|
-
a(c, V,
|
|
113
|
+
a(c, V, n.underline)
|
|
114
114
|
], t.prototype, "underline", 2);
|
|
115
|
-
|
|
115
|
+
e([
|
|
116
116
|
i({ type: String }),
|
|
117
|
-
a(c, $,
|
|
117
|
+
a(c, $, n.iconPlacement)
|
|
118
118
|
], t.prototype, "iconPlacement", 2);
|
|
119
|
-
|
|
119
|
+
e([
|
|
120
120
|
i({ type: String, reflect: !0 })
|
|
121
121
|
], t.prototype, "href", 2);
|
|
122
|
-
|
|
122
|
+
e([
|
|
123
123
|
i({ type: String, reflect: !0 })
|
|
124
124
|
], t.prototype, "target", 2);
|
|
125
|
-
|
|
125
|
+
e([
|
|
126
126
|
i({ type: String, reflect: !0 })
|
|
127
127
|
], t.prototype, "rel", 2);
|
|
128
|
-
|
|
128
|
+
e([
|
|
129
129
|
i({ type: String })
|
|
130
130
|
], t.prototype, "download", 2);
|
|
131
|
-
|
|
131
|
+
e([
|
|
132
132
|
i({ type: Boolean })
|
|
133
133
|
], t.prototype, "isBold", 2);
|
|
134
|
-
|
|
134
|
+
e([
|
|
135
135
|
i({ type: Boolean, reflect: !0 })
|
|
136
136
|
], t.prototype, "isStandalone", 2);
|
|
137
|
-
|
|
137
|
+
e([
|
|
138
138
|
i({ type: Boolean })
|
|
139
139
|
], t.prototype, "hasVisited", 2);
|
|
140
|
-
|
|
140
|
+
e([
|
|
141
141
|
i({ type: String }),
|
|
142
|
-
a(c, B,
|
|
142
|
+
a(c, B, n.type)
|
|
143
143
|
], t.prototype, "type", 2);
|
|
144
|
-
|
|
144
|
+
e([
|
|
145
145
|
i({ type: Object })
|
|
146
146
|
], t.prototype, "aria", 2);
|
|
147
|
-
t =
|
|
147
|
+
t = e([
|
|
148
148
|
x("pie-link")
|
|
149
149
|
], t);
|
|
150
150
|
export {
|
|
151
151
|
t as PieLink,
|
|
152
152
|
B as buttonTypes,
|
|
153
|
-
|
|
153
|
+
n as defaultProps,
|
|
154
154
|
$ as iconPlacements,
|
|
155
|
-
|
|
155
|
+
S as sizes,
|
|
156
156
|
P as tags,
|
|
157
157
|
V as underlineTypes,
|
|
158
|
-
|
|
158
|
+
w as variants
|
|
159
159
|
};
|
package/package.json
CHANGED
package/src/link.scss
CHANGED
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
:host {
|
|
4
4
|
display: inline-block;
|
|
5
5
|
|
|
6
|
-
--link-font-weight: var(--dt-font-weight
|
|
6
|
+
--link-font-weight: var(--dt-font-body-l-link-weight);
|
|
7
7
|
--link-text-color: var(--dt-color-content-link);
|
|
8
|
-
--link-text-decoration: var(--dt-font-
|
|
8
|
+
--link-text-decoration: var(--dt-font-body-l-link-text-decoration);
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
:host([isstandalone]) {
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
&:hover,
|
|
17
17
|
&:active {
|
|
18
18
|
@if $mode == 'reversed' {
|
|
19
|
-
--link-text-decoration: var(--dt-font-
|
|
19
|
+
--link-text-decoration: var(--dt-font-body-l-link-text-decoration);
|
|
20
20
|
} @else {
|
|
21
21
|
--link-text-decoration: none;
|
|
22
22
|
}
|
|
@@ -25,8 +25,8 @@
|
|
|
25
25
|
|
|
26
26
|
.c-link {
|
|
27
27
|
--link-font-family: var(--dt-font-interactive-l-family);
|
|
28
|
-
--link-font-size: #{p.font-size(--dt-font-size
|
|
29
|
-
--link-line-height: calc(var(--dt-font-
|
|
28
|
+
--link-font-size: #{p.font-size(--dt-font-body-l-link-size)};
|
|
29
|
+
--link-line-height: calc(var(--dt-font-body-l-link-line-height) * 1px);
|
|
30
30
|
--link-icon-size: 16px;
|
|
31
31
|
--link-icon-offset-top: var(--dt-spacing-a);
|
|
32
32
|
|
|
@@ -54,8 +54,10 @@
|
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
&.c-link--small {
|
|
57
|
-
--link-font-size: #{p.font-size(--dt-font-size
|
|
58
|
-
--link-line-height: calc(var(--dt-font-
|
|
57
|
+
--link-font-size: #{p.font-size(--dt-font-body-s-link-size)};
|
|
58
|
+
--link-line-height: calc(var(--dt-font-body-s-link-line-height) * 1px);
|
|
59
|
+
--link-font-weight: var(--dt-font-body-s-link-weight);
|
|
60
|
+
--link-text-decoration: var(--dt-font-body-s-link-text-decoration);
|
|
59
61
|
--link-icon-offset-top: 2px;
|
|
60
62
|
}
|
|
61
63
|
|
|
@@ -70,7 +72,15 @@
|
|
|
70
72
|
}
|
|
71
73
|
|
|
72
74
|
&.c-link--bold {
|
|
73
|
-
--link-font-
|
|
75
|
+
--link-font-size: #{p.font-size(--dt-font-body-strong-l-link-size)};
|
|
76
|
+
--link-line-height: calc(var(--dt-font-body-strong-l-link-line-height) * 1px);
|
|
77
|
+
--link-font-weight: var(--dt-font-body-strong-l-link-weight);
|
|
78
|
+
|
|
79
|
+
&.c-link--small {
|
|
80
|
+
--link-font-size: #{p.font-size(--dt-font-body-strong-s-link-size)};
|
|
81
|
+
--link-line-height: calc(var(--dt-font-body-strong-s-link-line-height) * 1px);
|
|
82
|
+
--link-font-weight: var(--dt-font-body-strong-s-link-weight);
|
|
83
|
+
}
|
|
74
84
|
}
|
|
75
85
|
|
|
76
86
|
&.c-link--standalone {
|