@justeattakeaway/pie-link 0.8.0 → 0.10.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.d.ts +1 -0
- package/dist/index.js +48 -44
- package/dist/react.d.ts +1 -0
- package/package.json +2 -2
- package/src/index.ts +3 -2
- package/src/link.scss +1 -0
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,29 +1,33 @@
|
|
|
1
|
-
import { unsafeCSS as
|
|
1
|
+
import { unsafeCSS as g, LitElement as k, html as u, nothing as c } from "lit";
|
|
2
2
|
import { property as i } from "lit/decorators.js";
|
|
3
|
-
const
|
|
4
|
-
const
|
|
5
|
-
Object.defineProperty(r,
|
|
3
|
+
const p = (o, t, s) => function(r, l) {
|
|
4
|
+
const a = `#${l}`;
|
|
5
|
+
Object.defineProperty(r, l, {
|
|
6
6
|
get() {
|
|
7
|
-
return this[
|
|
7
|
+
return this[a];
|
|
8
8
|
},
|
|
9
|
-
set(
|
|
10
|
-
const
|
|
11
|
-
t.includes(
|
|
12
|
-
`<${
|
|
9
|
+
set(f) {
|
|
10
|
+
const v = this[a];
|
|
11
|
+
t.includes(f) ? this[a] = f : (console.error(
|
|
12
|
+
`<${o}> Invalid value "${f}" provided for property "${l}".`,
|
|
13
13
|
`Must be one of: ${t.join(" | ")}.`,
|
|
14
|
-
`Falling back to default value: "${
|
|
15
|
-
), this[
|
|
14
|
+
`Falling back to default value: "${s}"`
|
|
15
|
+
), this[a] = s), this.requestUpdate(l, v);
|
|
16
16
|
}
|
|
17
17
|
});
|
|
18
|
-
}, y = `.c-link{--link-font-family: var(--dt-font-interactive-m-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[tag=button]{outline:none;border:none;user-select:none;background:transparent;padding:0}.c-link[variant=high-visibility]{--link-text-color: var(--dt-color-content-link-distinct)}.c-link[variant=inverse]{--link-text-color: var(--dt-color-content-link-inverse)}.c-link[size=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[underline=reversed][isStandalone]{--link-text-decoration: none}.c-link[underline=reversed][isStandalone]:hover,.c-link[underline=reversed][isStandalone]:active{--link-text-decoration: var(--dt-font-style-underline)}.c-link[isBold]{--link-font-weight: var(--dt-font-weight-bold)}.c-link[isStandalone]{display:block}.c-link[hasVisited]:visited{color:var(--dt-color-content-link-visited)}.c-link[hasVisited]:visited[variant=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)}.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)}
|
|
19
|
-
`, m = ["default", "high-visibility", "inverse"], b = ["small", "medium"], $ = ["leading", "trailing"], x = ["a", "button"], S = ["submit", "button", "reset", "menu"], z = ["default", "reversed"];
|
|
20
|
-
var B = Object.defineProperty, P = Object.getOwnPropertyDescriptor, n = (p, t, o, h) => {
|
|
21
|
-
for (var r = h > 1 ? void 0 : h ? P(t, o) : t, s = p.length - 1, l; s >= 0; s--)
|
|
22
|
-
(l = p[s]) && (r = (h ? l(t, o, r) : l(r)) || r);
|
|
23
|
-
return h && r && B(t, o, r), r;
|
|
24
18
|
};
|
|
25
|
-
|
|
26
|
-
|
|
19
|
+
function y(o, t) {
|
|
20
|
+
customElements.get(o) ? console.warn(`PIE Web Component: "${o}" has already been defined. Please ensure the component is only being defined once in your application.`) : customElements.define(o, t);
|
|
21
|
+
}
|
|
22
|
+
const m = `.c-link{--link-font-family: var(--dt-font-interactive-m-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[tag=button]{outline:none;border:none;user-select:none;background:transparent;padding:0}.c-link[variant=high-visibility]{--link-text-color: var(--dt-color-content-link-distinct)}.c-link[variant=inverse]{--link-text-color: var(--dt-color-content-link-inverse)}.c-link[size=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[underline=reversed][isStandalone]{--link-text-decoration: none}.c-link[underline=reversed][isStandalone]:hover,.c-link[underline=reversed][isStandalone]:active{--link-text-decoration: var(--dt-font-style-underline)}.c-link[isBold]{--link-font-weight: var(--dt-font-weight-bold)}.c-link[isStandalone]{display:block;width:fit-content}.c-link[hasVisited]:visited{color:var(--dt-color-content-link-visited)}.c-link[hasVisited]:visited[variant=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)}.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)}
|
|
23
|
+
`, b = ["default", "high-visibility", "inverse"], $ = ["small", "medium"], x = ["leading", "trailing"], z = ["a", "button"], S = ["submit", "button", "reset", "menu"], P = ["default", "reversed"];
|
|
24
|
+
var B = Object.defineProperty, w = Object.getOwnPropertyDescriptor, n = (o, t, s, h) => {
|
|
25
|
+
for (var r = h > 1 ? void 0 : h ? w(t, s) : t, l = o.length - 1, a; l >= 0; l--)
|
|
26
|
+
(a = o[l]) && (r = (h ? a(t, s, r) : a(r)) || r);
|
|
27
|
+
return h && r && B(t, s, r), r;
|
|
28
|
+
};
|
|
29
|
+
const d = "pie-link";
|
|
30
|
+
class e extends k {
|
|
27
31
|
constructor() {
|
|
28
32
|
super(...arguments), this.tag = "a", this.variant = "default", this.size = "medium", this.underline = "default", this.iconPlacement = "leading", this.isBold = !1, this.isStandalone = !1, this.hasVisited = !1, this.type = "submit";
|
|
29
33
|
}
|
|
@@ -33,12 +37,12 @@ class e extends g {
|
|
|
33
37
|
* @private
|
|
34
38
|
*/
|
|
35
39
|
renderContent() {
|
|
36
|
-
const { iconPlacement: t, isStandalone:
|
|
37
|
-
return
|
|
40
|
+
const { iconPlacement: t, isStandalone: s } = this;
|
|
41
|
+
return u`
|
|
38
42
|
<span class="c-link-content">
|
|
39
|
-
${
|
|
43
|
+
${s && t === "leading" ? u`<slot name="icon"></slot>` : c}
|
|
40
44
|
<slot></slot>
|
|
41
|
-
${
|
|
45
|
+
${s && t === "trailing" ? u`<slot name="icon"></slot>` : c}
|
|
42
46
|
</span>`;
|
|
43
47
|
}
|
|
44
48
|
/**
|
|
@@ -48,7 +52,7 @@ class e extends g {
|
|
|
48
52
|
*/
|
|
49
53
|
renderButton() {
|
|
50
54
|
var t;
|
|
51
|
-
return
|
|
55
|
+
return u`
|
|
52
56
|
<button
|
|
53
57
|
data-test-id="pie-link"
|
|
54
58
|
class="c-link"
|
|
@@ -59,8 +63,8 @@ class e extends g {
|
|
|
59
63
|
?isBold=${this.isBold}
|
|
60
64
|
?isStandalone=${this.isStandalone}
|
|
61
65
|
?hasVisited=${this.hasVisited}
|
|
62
|
-
type=${this.type ||
|
|
63
|
-
aria-label=${((t = this.aria) == null ? void 0 : t.label) ||
|
|
66
|
+
type=${this.type || c}
|
|
67
|
+
aria-label=${((t = this.aria) == null ? void 0 : t.label) || c}>
|
|
64
68
|
${this.renderContent()}
|
|
65
69
|
</button>`;
|
|
66
70
|
}
|
|
@@ -71,7 +75,7 @@ class e extends g {
|
|
|
71
75
|
*/
|
|
72
76
|
renderAnchor() {
|
|
73
77
|
var t;
|
|
74
|
-
return
|
|
78
|
+
return u`
|
|
75
79
|
<a
|
|
76
80
|
data-test-id="pie-link"
|
|
77
81
|
class="c-link"
|
|
@@ -82,10 +86,10 @@ class e extends g {
|
|
|
82
86
|
?isBold=${this.isBold}
|
|
83
87
|
?isStandalone=${this.isStandalone}
|
|
84
88
|
?hasVisited=${this.hasVisited}
|
|
85
|
-
href=${this.href ||
|
|
86
|
-
target=${this.target ||
|
|
87
|
-
rel=${this.rel ||
|
|
88
|
-
aria-label=${((t = this.aria) == null ? void 0 : t.label) ||
|
|
89
|
+
href=${this.href || c}
|
|
90
|
+
target=${this.target || c}
|
|
91
|
+
rel=${this.rel || c}
|
|
92
|
+
aria-label=${((t = this.aria) == null ? void 0 : t.label) || c}>
|
|
89
93
|
${this.renderContent()}
|
|
90
94
|
</a>`;
|
|
91
95
|
}
|
|
@@ -93,26 +97,26 @@ class e extends g {
|
|
|
93
97
|
return this.tag === "button" ? this.renderButton() : this.renderAnchor();
|
|
94
98
|
}
|
|
95
99
|
}
|
|
96
|
-
e.styles =
|
|
100
|
+
e.styles = g(m);
|
|
97
101
|
n([
|
|
98
102
|
i(),
|
|
99
|
-
d
|
|
103
|
+
p(d, z, "a")
|
|
100
104
|
], e.prototype, "tag", 2);
|
|
101
105
|
n([
|
|
102
106
|
i({ type: String }),
|
|
103
|
-
d
|
|
107
|
+
p(d, b, "default")
|
|
104
108
|
], e.prototype, "variant", 2);
|
|
105
109
|
n([
|
|
106
110
|
i({ type: String }),
|
|
107
|
-
d
|
|
111
|
+
p(d, $, "medium")
|
|
108
112
|
], e.prototype, "size", 2);
|
|
109
113
|
n([
|
|
110
114
|
i({ type: String }),
|
|
111
|
-
d
|
|
115
|
+
p(d, P, "default")
|
|
112
116
|
], e.prototype, "underline", 2);
|
|
113
117
|
n([
|
|
114
118
|
i({ type: String }),
|
|
115
|
-
d
|
|
119
|
+
p(d, x, "leading")
|
|
116
120
|
], e.prototype, "iconPlacement", 2);
|
|
117
121
|
n([
|
|
118
122
|
i({ type: String, reflect: !0 })
|
|
@@ -134,18 +138,18 @@ n([
|
|
|
134
138
|
], e.prototype, "hasVisited", 2);
|
|
135
139
|
n([
|
|
136
140
|
i(),
|
|
137
|
-
d
|
|
141
|
+
p(d, S, "submit")
|
|
138
142
|
], e.prototype, "type", 2);
|
|
139
143
|
n([
|
|
140
144
|
i({ type: Object })
|
|
141
145
|
], e.prototype, "aria", 2);
|
|
142
|
-
|
|
146
|
+
y(d, e);
|
|
143
147
|
export {
|
|
144
148
|
e as PieLink,
|
|
145
149
|
S as buttonTypes,
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
150
|
+
x as iconPlacements,
|
|
151
|
+
$ as sizes,
|
|
152
|
+
z as tags,
|
|
153
|
+
P as underlineTypes,
|
|
154
|
+
b as variants
|
|
151
155
|
};
|
package/dist/react.d.ts
CHANGED
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.
|
|
4
|
+
"version": "0.10.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"module": "dist/index.js",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"@justeattakeaway/pie-components-config": "0.4.0"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@justeattakeaway/pie-webc-core": "0.
|
|
34
|
+
"@justeattakeaway/pie-webc-core": "0.11.0"
|
|
35
35
|
},
|
|
36
36
|
"volta": {
|
|
37
37
|
"extends": "../../../package.json"
|
package/src/index.ts
CHANGED
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
html, LitElement, unsafeCSS, nothing, TemplateResult,
|
|
3
3
|
} from 'lit';
|
|
4
4
|
import { property } from 'lit/decorators.js';
|
|
5
|
-
import { validPropertyValues } from '@justeattakeaway/pie-webc-core';
|
|
5
|
+
import { validPropertyValues, defineCustomElement } from '@justeattakeaway/pie-webc-core';
|
|
6
6
|
import styles from './link.scss?inline';
|
|
7
7
|
import {
|
|
8
8
|
LinkProps,
|
|
@@ -21,6 +21,7 @@ export * from './defs';
|
|
|
21
21
|
const componentSelector = 'pie-link';
|
|
22
22
|
|
|
23
23
|
/**
|
|
24
|
+
* @tagname pie-link
|
|
24
25
|
* @slot icon - The icon slot
|
|
25
26
|
* @slot - Default slot
|
|
26
27
|
*/
|
|
@@ -144,7 +145,7 @@ export class PieLink extends LitElement implements LinkProps {
|
|
|
144
145
|
static styles = unsafeCSS(styles);
|
|
145
146
|
}
|
|
146
147
|
|
|
147
|
-
|
|
148
|
+
defineCustomElement(componentSelector, PieLink);
|
|
148
149
|
|
|
149
150
|
declare global {
|
|
150
151
|
interface HTMLElementTagNameMap {
|