@justeattakeaway/pie-link 0.18.0 → 0.18.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.
- package/dist/index.js +72 -73
- package/dist/react.js +11 -16
- package/package.json +5 -5
- package/src/react.ts +1 -1
package/dist/index.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { property as
|
|
1
|
+
import { LitElement as y, html as c, nothing as v, unsafeCSS as g } from "lit";
|
|
2
|
+
import { property as n } from "lit/decorators.js";
|
|
3
3
|
import { classMap as u } from "lit/directives/class-map.js";
|
|
4
4
|
import { ifDefined as d } from "lit/directives/if-defined.js";
|
|
5
5
|
import { validPropertyValues as a, defineCustomElement as m } from "@justeattakeaway/pie-webc-core";
|
|
6
|
-
const b =
|
|
7
|
-
`, x = ["default", "high-visibility", "inverse"], z = ["small", "medium"], S = ["leading", "trailing"], P = ["a", "button"], $ = ["submit", "button", "reset", "menu"], w = ["default", "reversed"], t = {
|
|
6
|
+
const b = "*,*: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)}", x = ["default", "high-visibility", "inverse"], z = ["small", "medium"], S = ["leading", "trailing"], $ = ["a", "button"], w = ["submit", "button", "reset", "menu"], B = ["default", "reversed"], e = {
|
|
8
7
|
tag: "a",
|
|
9
8
|
variant: "default",
|
|
10
9
|
size: "medium",
|
|
@@ -15,15 +14,14 @@ const b = `*,*:after,*:before{box-sizing:inherit}.c-link{--link-font-family: var
|
|
|
15
14
|
iconPlacement: "leading",
|
|
16
15
|
type: "submit"
|
|
17
16
|
};
|
|
18
|
-
var
|
|
19
|
-
for (var
|
|
20
|
-
(f = h[
|
|
21
|
-
return
|
|
17
|
+
var P = Object.defineProperty, i = (h, o, l, V) => {
|
|
18
|
+
for (var s = void 0, p = h.length - 1, f; p >= 0; p--)
|
|
19
|
+
(f = h[p]) && (s = f(o, l, s) || s);
|
|
20
|
+
return s && P(o, l, s), s;
|
|
22
21
|
};
|
|
23
|
-
const
|
|
24
|
-
class e extends g {
|
|
22
|
+
const r = "pie-link", k = class k extends y {
|
|
25
23
|
constructor() {
|
|
26
|
-
super(...arguments), this.tag =
|
|
24
|
+
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;
|
|
27
25
|
}
|
|
28
26
|
/**
|
|
29
27
|
* Renders the link content.
|
|
@@ -31,12 +29,12 @@ class e extends g {
|
|
|
31
29
|
* @private
|
|
32
30
|
*/
|
|
33
31
|
renderContent() {
|
|
34
|
-
const { iconPlacement:
|
|
32
|
+
const { iconPlacement: o, isStandalone: l } = this;
|
|
35
33
|
return c`
|
|
36
34
|
<span class="c-link-content">
|
|
37
|
-
${l &&
|
|
35
|
+
${l && o === "leading" ? c`<slot name="icon"></slot>` : v}
|
|
38
36
|
<slot></slot>
|
|
39
|
-
${l &&
|
|
37
|
+
${l && o === "trailing" ? c`<slot name="icon"></slot>` : v}
|
|
40
38
|
</span>`;
|
|
41
39
|
}
|
|
42
40
|
/**
|
|
@@ -44,12 +42,12 @@ class e extends g {
|
|
|
44
42
|
*
|
|
45
43
|
* @private
|
|
46
44
|
*/
|
|
47
|
-
renderButton(
|
|
45
|
+
renderButton(o) {
|
|
48
46
|
var l;
|
|
49
47
|
return c`
|
|
50
48
|
<button
|
|
51
49
|
data-test-id="pie-link"
|
|
52
|
-
class="${u(
|
|
50
|
+
class="${u(o)}"
|
|
53
51
|
type=${this.type}
|
|
54
52
|
aria-label=${d((l = this.aria) == null ? void 0 : l.label)}>
|
|
55
53
|
${this.renderContent()}
|
|
@@ -60,12 +58,12 @@ class e extends g {
|
|
|
60
58
|
*
|
|
61
59
|
* @private
|
|
62
60
|
*/
|
|
63
|
-
renderAnchor(
|
|
61
|
+
renderAnchor(o) {
|
|
64
62
|
var l;
|
|
65
63
|
return c`
|
|
66
64
|
<a
|
|
67
65
|
data-test-id="pie-link"
|
|
68
|
-
class="${u(
|
|
66
|
+
class="${u(o)}"
|
|
69
67
|
href=${d(this.href)}
|
|
70
68
|
target=${d(this.target)}
|
|
71
69
|
rel=${d(this.rel)}
|
|
@@ -74,7 +72,7 @@ class e extends g {
|
|
|
74
72
|
</a>`;
|
|
75
73
|
}
|
|
76
74
|
render() {
|
|
77
|
-
const
|
|
75
|
+
const o = {
|
|
78
76
|
"c-link": !0,
|
|
79
77
|
[`c-link--${this.variant}`]: !0,
|
|
80
78
|
[`c-link--${this.size}`]: !0,
|
|
@@ -83,63 +81,64 @@ class e extends g {
|
|
|
83
81
|
"c-link--standalone": this.isStandalone,
|
|
84
82
|
"c-link--hasVisited": this.hasVisited
|
|
85
83
|
};
|
|
86
|
-
return this.tag === "button" ? this.renderButton(
|
|
84
|
+
return this.tag === "button" ? this.renderButton(o) : this.renderAnchor(o);
|
|
87
85
|
}
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
86
|
+
};
|
|
87
|
+
k.styles = g(b);
|
|
88
|
+
let t = k;
|
|
89
|
+
i([
|
|
90
|
+
n(),
|
|
91
|
+
a(r, $, e.tag)
|
|
92
|
+
], t.prototype, "tag");
|
|
93
|
+
i([
|
|
94
|
+
n({ type: String }),
|
|
95
|
+
a(r, x, e.variant)
|
|
96
|
+
], t.prototype, "variant");
|
|
97
|
+
i([
|
|
98
|
+
n({ type: String }),
|
|
99
|
+
a(r, z, e.size)
|
|
100
|
+
], t.prototype, "size");
|
|
101
|
+
i([
|
|
102
|
+
n({ type: String }),
|
|
103
|
+
a(r, B, e.underline)
|
|
104
|
+
], t.prototype, "underline");
|
|
105
|
+
i([
|
|
106
|
+
n({ type: String }),
|
|
107
|
+
a(r, S, e.iconPlacement)
|
|
108
|
+
], t.prototype, "iconPlacement");
|
|
109
|
+
i([
|
|
110
|
+
n({ type: String, reflect: !0 })
|
|
111
|
+
], t.prototype, "href");
|
|
112
|
+
i([
|
|
113
|
+
n({ type: String, reflect: !0 })
|
|
114
|
+
], t.prototype, "target");
|
|
115
|
+
i([
|
|
116
|
+
n({ type: String, reflect: !0 })
|
|
117
|
+
], t.prototype, "rel");
|
|
118
|
+
i([
|
|
119
|
+
n({ type: Boolean })
|
|
120
|
+
], t.prototype, "isBold");
|
|
121
|
+
i([
|
|
122
|
+
n({ type: Boolean })
|
|
123
|
+
], t.prototype, "isStandalone");
|
|
124
|
+
i([
|
|
125
|
+
n({ type: Boolean })
|
|
126
|
+
], t.prototype, "hasVisited");
|
|
127
|
+
i([
|
|
128
|
+
n({ type: String }),
|
|
129
|
+
a(r, w, e.type)
|
|
130
|
+
], t.prototype, "type");
|
|
131
|
+
i([
|
|
132
|
+
n({ type: Object })
|
|
133
|
+
], t.prototype, "aria");
|
|
134
|
+
m(r, t);
|
|
136
135
|
export {
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
136
|
+
t as PieLink,
|
|
137
|
+
w as buttonTypes,
|
|
138
|
+
e as defaultProps,
|
|
140
139
|
S as iconPlacements,
|
|
141
140
|
z as sizes,
|
|
142
|
-
|
|
143
|
-
|
|
141
|
+
$ as tags,
|
|
142
|
+
B as underlineTypes,
|
|
144
143
|
x as variants
|
|
145
144
|
};
|
package/dist/react.js
CHANGED
|
@@ -1,26 +1,21 @@
|
|
|
1
1
|
import * as e from "react";
|
|
2
2
|
import { createComponent as t } from "@lit/react";
|
|
3
3
|
import { PieLink as i } from "./index.js";
|
|
4
|
-
import { buttonTypes as
|
|
5
|
-
|
|
6
|
-
import "lit/decorators.js";
|
|
7
|
-
import "lit/directives/class-map.js";
|
|
8
|
-
import "lit/directives/if-defined.js";
|
|
9
|
-
import "@justeattakeaway/pie-webc-core";
|
|
10
|
-
const o = t({
|
|
4
|
+
import { buttonTypes as p, defaultProps as c, iconPlacements as l, sizes as P, tags as k, underlineTypes as f, variants as L } from "./index.js";
|
|
5
|
+
const n = t({
|
|
11
6
|
displayName: "PieLink",
|
|
12
7
|
elementClass: i,
|
|
13
8
|
react: e,
|
|
14
9
|
tagName: "pie-link",
|
|
15
10
|
events: {}
|
|
16
|
-
}),
|
|
11
|
+
}), s = n;
|
|
17
12
|
export {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
13
|
+
s as PieLink,
|
|
14
|
+
p as buttonTypes,
|
|
15
|
+
c as defaultProps,
|
|
16
|
+
l as iconPlacements,
|
|
17
|
+
P as sizes,
|
|
18
|
+
k as tags,
|
|
19
|
+
f as underlineTypes,
|
|
20
|
+
L as variants
|
|
26
21
|
};
|
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": "0.18.
|
|
4
|
+
"version": "0.18.2",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"module": "dist/index.js",
|
|
@@ -37,13 +37,13 @@
|
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@custom-elements-manifest/analyzer": "0.9.0",
|
|
39
39
|
"@justeattakeaway/pie-components-config": "0.18.0",
|
|
40
|
-
"@justeattakeaway/pie-css": "0.
|
|
41
|
-
"@justeattakeaway/pie-icons-webc": "0.25.
|
|
42
|
-
"@justeattakeaway/pie-wrapper-react": "0.14.
|
|
40
|
+
"@justeattakeaway/pie-css": "0.13.1",
|
|
41
|
+
"@justeattakeaway/pie-icons-webc": "0.25.3",
|
|
42
|
+
"@justeattakeaway/pie-wrapper-react": "0.14.2",
|
|
43
43
|
"cem-plugin-module-file-extensions": "0.0.5"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@justeattakeaway/pie-webc-core": "0.24.
|
|
46
|
+
"@justeattakeaway/pie-webc-core": "0.24.2"
|
|
47
47
|
},
|
|
48
48
|
"volta": {
|
|
49
49
|
"extends": "../../../package.json"
|
package/src/react.ts
CHANGED