@justeattakeaway/pie-link 1.1.1 → 1.2.1
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/custom-elements.json +2 -2
- package/dist/index.js +80 -84
- package/package.json +5 -5
- package/src/index.ts +2 -3
- package/src/link.scss +4 -2
package/custom-elements.json
CHANGED
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"type": {
|
|
67
67
|
"text": "DefaultProps"
|
|
68
68
|
},
|
|
69
|
-
"default": "{\n tag: 'a',\n variant: 'default',\n size: 'medium',\n underline: 'default',\n isBold: false,\n isStandalone: false,\n hasVisited: false,\n iconPlacement: 'leading',\n type: 'submit',\n}"
|
|
69
|
+
"default": "{\r\n tag: 'a',\r\n variant: 'default',\r\n size: 'medium',\r\n underline: 'default',\r\n isBold: false,\r\n isStandalone: false,\r\n hasVisited: false,\r\n iconPlacement: 'leading',\r\n type: 'submit',\r\n}"
|
|
70
70
|
}
|
|
71
71
|
],
|
|
72
72
|
"exports": [
|
|
@@ -244,7 +244,7 @@
|
|
|
244
244
|
"kind": "method",
|
|
245
245
|
"name": "renderContent",
|
|
246
246
|
"privacy": "private",
|
|
247
|
-
"description": "Renders the link content.\nIcons are only shown in block elements"
|
|
247
|
+
"description": "Renders the link content.\r\nIcons are only shown in block elements"
|
|
248
248
|
},
|
|
249
249
|
{
|
|
250
250
|
"kind": "method",
|
package/dist/index.js
CHANGED
|
@@ -1,22 +1,16 @@
|
|
|
1
|
-
import { LitElement as m,
|
|
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
|
|
4
|
-
import { ifDefined as
|
|
5
|
-
import { validPropertyValues as
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
(
|
|
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
|
-
|
|
17
|
-
|
|
18
|
-
|
|
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.1";
|
|
12
|
+
let u = h;
|
|
13
|
+
const z = "*,*:after,*:before{box-sizing:inherit}:host{--link-font-weight: var(--dt-font-weight-regular);--link-text-color: var(--dt-color-content-link)}.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-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
|
|
31
|
-
for (var r = void 0,
|
|
32
|
-
(
|
|
33
|
-
return 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"
|
|
29
|
+
const a = "pie-link";
|
|
30
|
+
let t = class extends u {
|
|
36
31
|
constructor() {
|
|
37
|
-
super(...arguments), this.tag =
|
|
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:
|
|
46
|
-
return
|
|
40
|
+
const { iconPlacement: l, isStandalone: n } = this;
|
|
41
|
+
return c`
|
|
47
42
|
<span class="c-link-content">
|
|
48
|
-
${
|
|
43
|
+
${n && l === "leading" ? c`<slot name="icon"></slot>` : g}
|
|
49
44
|
<slot></slot>
|
|
50
|
-
${
|
|
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(
|
|
59
|
-
var
|
|
60
|
-
return
|
|
53
|
+
renderButton(l) {
|
|
54
|
+
var n;
|
|
55
|
+
return c`
|
|
61
56
|
<button
|
|
62
57
|
data-test-id="pie-link-button"
|
|
63
|
-
class="${
|
|
58
|
+
class="${y(l)}"
|
|
64
59
|
type=${this.type}
|
|
65
|
-
aria-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(
|
|
75
|
-
var
|
|
76
|
-
return
|
|
69
|
+
renderAnchor(l) {
|
|
70
|
+
var n;
|
|
71
|
+
return c`
|
|
77
72
|
<a
|
|
78
73
|
data-test-id="pie-link-anchor"
|
|
79
|
-
class="${
|
|
80
|
-
href=${
|
|
81
|
-
target=${
|
|
82
|
-
rel=${
|
|
83
|
-
aria-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
|
|
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(
|
|
92
|
+
return this.tag === "button" ? this.renderButton(l) : this.renderAnchor(l);
|
|
98
93
|
}
|
|
99
94
|
};
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
l([
|
|
95
|
+
t.styles = b(z);
|
|
96
|
+
i([
|
|
103
97
|
o({ type: String }),
|
|
104
|
-
|
|
105
|
-
], t.prototype, "tag");
|
|
106
|
-
|
|
98
|
+
s(a, P, e.tag)
|
|
99
|
+
], t.prototype, "tag", 2);
|
|
100
|
+
i([
|
|
107
101
|
o({ type: String }),
|
|
108
|
-
|
|
109
|
-
], t.prototype, "variant");
|
|
110
|
-
|
|
102
|
+
s(a, S, e.variant)
|
|
103
|
+
], t.prototype, "variant", 2);
|
|
104
|
+
i([
|
|
111
105
|
o({ type: String }),
|
|
112
|
-
|
|
113
|
-
], t.prototype, "size");
|
|
114
|
-
|
|
106
|
+
s(a, $, e.size)
|
|
107
|
+
], t.prototype, "size", 2);
|
|
108
|
+
i([
|
|
115
109
|
o({ type: String }),
|
|
116
|
-
|
|
117
|
-
], t.prototype, "underline");
|
|
118
|
-
|
|
110
|
+
s(a, V, e.underline)
|
|
111
|
+
], t.prototype, "underline", 2);
|
|
112
|
+
i([
|
|
119
113
|
o({ type: String }),
|
|
120
|
-
|
|
121
|
-
], t.prototype, "iconPlacement");
|
|
122
|
-
|
|
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
|
-
|
|
118
|
+
], t.prototype, "href", 2);
|
|
119
|
+
i([
|
|
126
120
|
o({ type: String, reflect: !0 })
|
|
127
|
-
], t.prototype, "target");
|
|
128
|
-
|
|
121
|
+
], t.prototype, "target", 2);
|
|
122
|
+
i([
|
|
129
123
|
o({ type: String, reflect: !0 })
|
|
130
|
-
], t.prototype, "rel");
|
|
131
|
-
|
|
124
|
+
], t.prototype, "rel", 2);
|
|
125
|
+
i([
|
|
132
126
|
o({ type: Boolean })
|
|
133
|
-
], t.prototype, "isBold");
|
|
134
|
-
|
|
127
|
+
], t.prototype, "isBold", 2);
|
|
128
|
+
i([
|
|
135
129
|
o({ type: Boolean })
|
|
136
|
-
], t.prototype, "isStandalone");
|
|
137
|
-
|
|
130
|
+
], t.prototype, "isStandalone", 2);
|
|
131
|
+
i([
|
|
138
132
|
o({ type: Boolean })
|
|
139
|
-
], t.prototype, "hasVisited");
|
|
140
|
-
|
|
133
|
+
], t.prototype, "hasVisited", 2);
|
|
134
|
+
i([
|
|
141
135
|
o({ type: String }),
|
|
142
|
-
|
|
143
|
-
], t.prototype, "type");
|
|
144
|
-
|
|
136
|
+
s(a, B, e.type)
|
|
137
|
+
], t.prototype, "type", 2);
|
|
138
|
+
i([
|
|
145
139
|
o({ type: Object })
|
|
146
|
-
], t.prototype, "aria");
|
|
147
|
-
|
|
140
|
+
], t.prototype, "aria", 2);
|
|
141
|
+
t = i([
|
|
142
|
+
x("pie-link")
|
|
143
|
+
], t);
|
|
148
144
|
export {
|
|
149
145
|
t as PieLink,
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
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.
|
|
4
|
+
"version": "1.2.1",
|
|
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.
|
|
42
|
+
"@justeattakeaway/pie-components-config": "0.20.1",
|
|
43
43
|
"@justeattakeaway/pie-css": "0.16.0",
|
|
44
|
-
"@justeattakeaway/pie-icons-webc": "1.
|
|
45
|
-
"@justeattakeaway/pie-monorepo-utils": "0.5.
|
|
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.
|
|
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 {
|
|
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;
|
package/src/link.scss
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
@use '@justeattakeaway/pie-css/scss' as p;
|
|
2
2
|
|
|
3
|
+
:host {
|
|
4
|
+
--link-font-weight: var(--dt-font-weight-regular);
|
|
5
|
+
--link-text-color: var(--dt-color-content-link);
|
|
6
|
+
}
|
|
3
7
|
|
|
4
8
|
@mixin link-interactive-states($mode: 'default') {
|
|
5
9
|
&:hover,
|
|
@@ -16,8 +20,6 @@
|
|
|
16
20
|
--link-font-family: var(--dt-font-interactive-l-family);
|
|
17
21
|
--link-font-size: #{p.font-size(--dt-font-size-16)};
|
|
18
22
|
--link-line-height: calc(var(--dt-font-size-16-line-height) * 1px);
|
|
19
|
-
--link-font-weight: var(--dt-font-weight-regular);
|
|
20
|
-
--link-text-color: var(--dt-color-content-link);
|
|
21
23
|
--link-text-decoration: var(--dt-font-style-underline);
|
|
22
24
|
--link-icon-size: 16px;
|
|
23
25
|
--link-icon-offset-top: var(--dt-spacing-a);
|