@justeattakeaway/pie-link 1.0.0 → 1.0.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/dist/index.js +14 -14
- package/package.json +10 -7
- package/src/index.ts +2 -2
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { LitElement as y, html as c, nothing as
|
|
1
|
+
import { LitElement as y, html as c, nothing as u, unsafeCSS as g } from "lit";
|
|
2
2
|
import { property as n } from "lit/decorators.js";
|
|
3
|
-
import { classMap as
|
|
3
|
+
import { classMap as v } 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
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 = {
|
|
@@ -14,12 +14,12 @@ const b = "*,*:after,*:before{box-sizing:inherit}.c-link{--link-font-family: var
|
|
|
14
14
|
iconPlacement: "leading",
|
|
15
15
|
type: "submit"
|
|
16
16
|
};
|
|
17
|
-
var P = Object.defineProperty, i = (
|
|
18
|
-
for (var s = void 0, p =
|
|
19
|
-
(f =
|
|
17
|
+
var P = Object.defineProperty, i = (k, o, l, V) => {
|
|
18
|
+
for (var s = void 0, p = k.length - 1, f; p >= 0; p--)
|
|
19
|
+
(f = k[p]) && (s = f(o, l, s) || s);
|
|
20
20
|
return s && P(o, l, s), s;
|
|
21
21
|
};
|
|
22
|
-
const r = "pie-link",
|
|
22
|
+
const r = "pie-link", h = class h extends y {
|
|
23
23
|
constructor() {
|
|
24
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;
|
|
25
25
|
}
|
|
@@ -32,9 +32,9 @@ const r = "pie-link", k = class k extends y {
|
|
|
32
32
|
const { iconPlacement: o, isStandalone: l } = this;
|
|
33
33
|
return c`
|
|
34
34
|
<span class="c-link-content">
|
|
35
|
-
${l && o === "leading" ? c`<slot name="icon"></slot>` :
|
|
35
|
+
${l && o === "leading" ? c`<slot name="icon"></slot>` : u}
|
|
36
36
|
<slot></slot>
|
|
37
|
-
${l && o === "trailing" ? c`<slot name="icon"></slot>` :
|
|
37
|
+
${l && o === "trailing" ? c`<slot name="icon"></slot>` : u}
|
|
38
38
|
</span>`;
|
|
39
39
|
}
|
|
40
40
|
/**
|
|
@@ -46,8 +46,8 @@ const r = "pie-link", k = class k extends y {
|
|
|
46
46
|
var l;
|
|
47
47
|
return c`
|
|
48
48
|
<button
|
|
49
|
-
data-test-id="pie-link"
|
|
50
|
-
class="${
|
|
49
|
+
data-test-id="pie-link-button"
|
|
50
|
+
class="${v(o)}"
|
|
51
51
|
type=${this.type}
|
|
52
52
|
aria-label=${d((l = this.aria) == null ? void 0 : l.label)}>
|
|
53
53
|
${this.renderContent()}
|
|
@@ -62,8 +62,8 @@ const r = "pie-link", k = class k extends y {
|
|
|
62
62
|
var l;
|
|
63
63
|
return c`
|
|
64
64
|
<a
|
|
65
|
-
data-test-id="pie-link"
|
|
66
|
-
class="${
|
|
65
|
+
data-test-id="pie-link-anchor"
|
|
66
|
+
class="${v(o)}"
|
|
67
67
|
href=${d(this.href)}
|
|
68
68
|
target=${d(this.target)}
|
|
69
69
|
rel=${d(this.rel)}
|
|
@@ -84,8 +84,8 @@ const r = "pie-link", k = class k extends y {
|
|
|
84
84
|
return this.tag === "button" ? this.renderButton(o) : this.renderAnchor(o);
|
|
85
85
|
}
|
|
86
86
|
};
|
|
87
|
-
|
|
88
|
-
let t =
|
|
87
|
+
h.styles = g(b);
|
|
88
|
+
let t = h;
|
|
89
89
|
i([
|
|
90
90
|
n({ type: String }),
|
|
91
91
|
a(r, $, e.tag)
|
package/package.json
CHANGED
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@justeattakeaway/pie-link",
|
|
3
3
|
"description": "PIE Design System Link built using Web Components",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.1",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "https://github.com/justeattakeaway/pie",
|
|
8
|
+
"directory": "packages/components/pie-link"
|
|
9
|
+
},
|
|
10
|
+
"homepage": "https://pie.design/components/link/code/",
|
|
5
11
|
"type": "module",
|
|
6
12
|
"main": "dist/index.js",
|
|
7
13
|
"module": "dist/index.js",
|
|
@@ -24,9 +30,6 @@
|
|
|
24
30
|
"lint:style": "run -T stylelint ./src/**/*.{css,scss}",
|
|
25
31
|
"lint:style:fix": "yarn lint:style --fix",
|
|
26
32
|
"watch": "run -T vite build --watch",
|
|
27
|
-
"test": "echo \"Error: no test specified\" && exit 0",
|
|
28
|
-
"test:ci": "yarn test",
|
|
29
|
-
"test:browsers-setup": "npx playwright-lit-setup",
|
|
30
33
|
"test:browsers": "npx playwright test -c ./playwright-lit.config.ts",
|
|
31
34
|
"test:browsers:ci": "yarn test:browsers",
|
|
32
35
|
"test:visual": "run -T cross-env-shell PERCY_TOKEN=${PERCY_TOKEN_PIE_LINK} percy exec --allowed-hostname cloudfront.net -- npx playwright test -c ./playwright-lit-visual.config.ts",
|
|
@@ -37,9 +40,9 @@
|
|
|
37
40
|
"devDependencies": {
|
|
38
41
|
"@custom-elements-manifest/analyzer": "0.9.0",
|
|
39
42
|
"@justeattakeaway/pie-components-config": "0.18.0",
|
|
40
|
-
"@justeattakeaway/pie-css": "0.
|
|
41
|
-
"@justeattakeaway/pie-icons-webc": "1.
|
|
42
|
-
"@justeattakeaway/pie-wrapper-react": "0.14.
|
|
43
|
+
"@justeattakeaway/pie-css": "0.15.1",
|
|
44
|
+
"@justeattakeaway/pie-icons-webc": "1.5.0",
|
|
45
|
+
"@justeattakeaway/pie-wrapper-react": "0.14.3",
|
|
43
46
|
"cem-plugin-module-file-extensions": "0.0.5"
|
|
44
47
|
},
|
|
45
48
|
"dependencies": {
|
package/src/index.ts
CHANGED
|
@@ -97,7 +97,7 @@ export class PieLink extends LitElement implements LinkProps {
|
|
|
97
97
|
private renderButton (classes: ClassInfo) {
|
|
98
98
|
return html`
|
|
99
99
|
<button
|
|
100
|
-
data-test-id="pie-link"
|
|
100
|
+
data-test-id="pie-link-button"
|
|
101
101
|
class="${classMap(classes)}"
|
|
102
102
|
type=${this.type}
|
|
103
103
|
aria-label=${ifDefined(this.aria?.label)}>
|
|
@@ -113,7 +113,7 @@ export class PieLink extends LitElement implements LinkProps {
|
|
|
113
113
|
private renderAnchor (classes: ClassInfo) {
|
|
114
114
|
return html`
|
|
115
115
|
<a
|
|
116
|
-
data-test-id="pie-link"
|
|
116
|
+
data-test-id="pie-link-anchor"
|
|
117
117
|
class="${classMap(classes)}"
|
|
118
118
|
href=${ifDefined(this.href)}
|
|
119
119
|
target=${ifDefined(this.target)}
|