@justeattakeaway/pie-link 0.0.0 → 0.2.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/README.md +10 -4
- package/dist/index.d.ts +52 -0
- package/dist/index.js +81 -7
- package/dist/react.d.ts +55 -0
- package/dist/react.js +49 -43
- package/package.json +7 -2
- package/src/defs.ts +33 -3
- package/src/index.ts +45 -6
- package/src/link.scss +46 -0
- package/.eslintignore +0 -6
- package/.turbo/turbo-build.log +0 -14
- package/dist/types/index.d.ts +0 -1
- package/dist/types/react.d.ts +0 -1
- package/dist/types/src/defs.d.ts +0 -3
- package/dist/types/src/defs.d.ts.map +0 -1
- package/dist/types/src/index.d.ts +0 -14
- package/dist/types/src/index.d.ts.map +0 -1
- package/dist/types/src/react.d.ts +0 -3
- package/dist/types/src/react.d.ts.map +0 -1
- package/playwright/index.html +0 -56
- package/playwright/index.ts +0 -1
- package/playwright-lit-visual.config.ts +0 -4
- package/playwright-lit.config.ts +0 -4
- package/test/accessibility/pie-link.spec.ts +0 -18
- package/test/component/pie-link.spec.ts +0 -20
- package/test/visual/pie-link.spec.ts +0 -14
- package/tsconfig.json +0 -8
- package/vite.config.js +0 -3
package/README.md
CHANGED
|
@@ -57,9 +57,15 @@ import { PieLink } from '@justeattakeaway/pie-link/dist/react';
|
|
|
57
57
|
|
|
58
58
|
## Props
|
|
59
59
|
|
|
60
|
-
| Property
|
|
61
|
-
|
|
62
|
-
|
|
|
60
|
+
| Property | Type | Default | Description |
|
|
61
|
+
| ------------ | ----------- | ------------- | --------------------------------------------------------------------------- |
|
|
62
|
+
| variant | `String` | `default` | Variant of the link, one of variants – default, high-visibility or inverse |
|
|
63
|
+
| size | `String` | `medium` | Size of the link, one of `sizes` – `medium`, `small` |
|
|
64
|
+
| href | `String` | `undefined` | Native html `href` attribute |
|
|
65
|
+
| rel | `String` | `undefined` | Native html `rel` attribute |
|
|
66
|
+
| target | `String` | `undefined` | Native html `target` attribute |
|
|
67
|
+
| isBold | `Boolean` | `false` | If `true`, sets the link text bold |
|
|
68
|
+
| isStandalone | `Boolean` | `false` | If `true`, sets the link as a block element |
|
|
63
69
|
|
|
64
70
|
In your markup or JSX, you can then use these to set the properties for the `pie-link` component:
|
|
65
71
|
|
|
@@ -103,4 +109,4 @@ Under scripts `test:visual` replace the environment variable with the below:
|
|
|
103
109
|
|
|
104
110
|
```bash
|
|
105
111
|
PERCY_TOKEN_PIE_LINK=abcde
|
|
106
|
-
```
|
|
112
|
+
```
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { CSSResult } from 'lit';
|
|
2
|
+
import type { LitElement } from 'lit';
|
|
3
|
+
import type { TemplateResult } from 'lit-html';
|
|
4
|
+
|
|
5
|
+
export declare interface LinkProps {
|
|
6
|
+
/**
|
|
7
|
+
* What style variant the link should be such as default, high-visibility or inverse.
|
|
8
|
+
*/
|
|
9
|
+
variant?: typeof variants[number];
|
|
10
|
+
/**
|
|
11
|
+
* What size the link should be.
|
|
12
|
+
*/
|
|
13
|
+
size?: typeof sizes[number];
|
|
14
|
+
/**
|
|
15
|
+
* The URL that the hyperlink should point to
|
|
16
|
+
*/
|
|
17
|
+
href?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Where to display the linked URL such as _self, _blank, _parent or _top
|
|
20
|
+
*/
|
|
21
|
+
target?: string;
|
|
22
|
+
/**
|
|
23
|
+
* What the relationship of the linked URL is
|
|
24
|
+
*/
|
|
25
|
+
rel?: string;
|
|
26
|
+
/**
|
|
27
|
+
* When true, the link text will be bold.
|
|
28
|
+
*/
|
|
29
|
+
isBold?: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* When true, the link will be treated as a block box
|
|
32
|
+
*/
|
|
33
|
+
isStandalone?: boolean;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export declare class PieLink extends LitElement implements LinkProps {
|
|
37
|
+
variant: LinkProps['variant'];
|
|
38
|
+
size: LinkProps['size'];
|
|
39
|
+
href?: string;
|
|
40
|
+
target?: string;
|
|
41
|
+
rel?: string;
|
|
42
|
+
isBold: boolean;
|
|
43
|
+
isStandalone: boolean;
|
|
44
|
+
render(): TemplateResult<1>;
|
|
45
|
+
static styles: CSSResult;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export declare const sizes: readonly ["small", "medium"];
|
|
49
|
+
|
|
50
|
+
export declare const variants: readonly ["default", "high-visibility", "inverse"];
|
|
51
|
+
|
|
52
|
+
export { }
|
package/dist/index.js
CHANGED
|
@@ -1,12 +1,86 @@
|
|
|
1
|
-
import { unsafeCSS as
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { unsafeCSS as k, LitElement as g, html as m } from "lit";
|
|
2
|
+
import { property as s } from "lit/decorators.js";
|
|
3
|
+
import { ifDefined as d } from "lit/directives/if-defined.js";
|
|
4
|
+
import "lit/decorators/property.js";
|
|
5
|
+
const v = (c, n, r) => function(t, e) {
|
|
6
|
+
const i = `#${e}`;
|
|
7
|
+
Object.defineProperty(t, e, {
|
|
8
|
+
get() {
|
|
9
|
+
return this[i];
|
|
10
|
+
},
|
|
11
|
+
set(f) {
|
|
12
|
+
const h = this[i];
|
|
13
|
+
n.includes(f) ? this[i] = f : (console.error(
|
|
14
|
+
`<${c}> Invalid value "${f}" provided for property "${e}".`,
|
|
15
|
+
`Must be one of: ${n.join(" | ")}.`,
|
|
16
|
+
`Falling back to default value: "${r}"`
|
|
17
|
+
), this[i] = r), this.requestUpdate(e, h);
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
}, u = `.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);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[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)}.c-link[isBold]{--link-font-weight: var(--dt-font-weight-bold)}.c-link[isStandalone]{display:block}
|
|
21
|
+
`, y = ["default", "high-visibility", "inverse"], z = ["small", "medium"];
|
|
22
|
+
var x = Object.defineProperty, S = Object.getOwnPropertyDescriptor, a = (c, n, r, l) => {
|
|
23
|
+
for (var t = l > 1 ? void 0 : l ? S(n, r) : n, e = c.length - 1, i; e >= 0; e--)
|
|
24
|
+
(i = c[e]) && (t = (l ? i(n, r, t) : i(t)) || t);
|
|
25
|
+
return l && t && x(n, r, t), t;
|
|
26
|
+
};
|
|
27
|
+
const p = "pie-link";
|
|
28
|
+
class o extends g {
|
|
29
|
+
constructor() {
|
|
30
|
+
super(...arguments), this.variant = "default", this.size = "medium", this.isBold = !1, this.isStandalone = !1;
|
|
31
|
+
}
|
|
4
32
|
render() {
|
|
5
|
-
|
|
33
|
+
const {
|
|
34
|
+
variant: n,
|
|
35
|
+
size: r,
|
|
36
|
+
href: l,
|
|
37
|
+
target: t,
|
|
38
|
+
rel: e,
|
|
39
|
+
isBold: i,
|
|
40
|
+
isStandalone: f
|
|
41
|
+
} = this;
|
|
42
|
+
return m`
|
|
43
|
+
<a
|
|
44
|
+
data-test-id="pie-link"
|
|
45
|
+
class="c-link"
|
|
46
|
+
variant=${n}
|
|
47
|
+
size=${r}
|
|
48
|
+
href=${d(l)}
|
|
49
|
+
target=${d(t)}
|
|
50
|
+
rel=${d(e)}
|
|
51
|
+
?isBold=${i}
|
|
52
|
+
?isStandalone=${f}>
|
|
53
|
+
<slot></slot>
|
|
54
|
+
</a>`;
|
|
6
55
|
}
|
|
7
56
|
}
|
|
8
|
-
|
|
9
|
-
|
|
57
|
+
o.styles = k(u);
|
|
58
|
+
a([
|
|
59
|
+
s({ type: String }),
|
|
60
|
+
v(p, y, "default")
|
|
61
|
+
], o.prototype, "variant", 2);
|
|
62
|
+
a([
|
|
63
|
+
s({ type: String }),
|
|
64
|
+
v(p, z, "medium")
|
|
65
|
+
], o.prototype, "size", 2);
|
|
66
|
+
a([
|
|
67
|
+
s({ type: String, reflect: !0 })
|
|
68
|
+
], o.prototype, "href", 2);
|
|
69
|
+
a([
|
|
70
|
+
s({ type: String, reflect: !0 })
|
|
71
|
+
], o.prototype, "target", 2);
|
|
72
|
+
a([
|
|
73
|
+
s({ type: String, reflect: !0 })
|
|
74
|
+
], o.prototype, "rel", 2);
|
|
75
|
+
a([
|
|
76
|
+
s({ type: Boolean })
|
|
77
|
+
], o.prototype, "isBold", 2);
|
|
78
|
+
a([
|
|
79
|
+
s({ type: Boolean })
|
|
80
|
+
], o.prototype, "isStandalone", 2);
|
|
81
|
+
customElements.define(p, o);
|
|
10
82
|
export {
|
|
11
|
-
|
|
83
|
+
o as PieLink,
|
|
84
|
+
z as sizes,
|
|
85
|
+
y as variants
|
|
12
86
|
};
|
package/dist/react.d.ts
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { CSSResult } from 'lit';
|
|
2
|
+
import type { LitElement } from 'lit';
|
|
3
|
+
import type { ReactWebComponent } from '@lit-labs/react';
|
|
4
|
+
import type { TemplateResult } from 'lit-html';
|
|
5
|
+
|
|
6
|
+
export declare interface LinkProps {
|
|
7
|
+
/**
|
|
8
|
+
* What style variant the link should be such as default, high-visibility or inverse.
|
|
9
|
+
*/
|
|
10
|
+
variant?: typeof variants[number];
|
|
11
|
+
/**
|
|
12
|
+
* What size the link should be.
|
|
13
|
+
*/
|
|
14
|
+
size?: typeof sizes[number];
|
|
15
|
+
/**
|
|
16
|
+
* The URL that the hyperlink should point to
|
|
17
|
+
*/
|
|
18
|
+
href?: string;
|
|
19
|
+
/**
|
|
20
|
+
* Where to display the linked URL such as _self, _blank, _parent or _top
|
|
21
|
+
*/
|
|
22
|
+
target?: string;
|
|
23
|
+
/**
|
|
24
|
+
* What the relationship of the linked URL is
|
|
25
|
+
*/
|
|
26
|
+
rel?: string;
|
|
27
|
+
/**
|
|
28
|
+
* When true, the link text will be bold.
|
|
29
|
+
*/
|
|
30
|
+
isBold?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* When true, the link will be treated as a block box
|
|
33
|
+
*/
|
|
34
|
+
isStandalone?: boolean;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export declare const PieLink: ReactWebComponent<PieLink_2, {}>;
|
|
38
|
+
|
|
39
|
+
declare class PieLink_2 extends LitElement implements LinkProps {
|
|
40
|
+
variant: LinkProps['variant'];
|
|
41
|
+
size: LinkProps['size'];
|
|
42
|
+
href?: string;
|
|
43
|
+
target?: string;
|
|
44
|
+
rel?: string;
|
|
45
|
+
isBold: boolean;
|
|
46
|
+
isStandalone: boolean;
|
|
47
|
+
render(): TemplateResult<1>;
|
|
48
|
+
static styles: CSSResult;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export declare const sizes: readonly ["small", "medium"];
|
|
52
|
+
|
|
53
|
+
export declare const variants: readonly ["default", "high-visibility", "inverse"];
|
|
54
|
+
|
|
55
|
+
export { }
|
package/dist/react.js
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { PieLink as Lr } from "./index.js";
|
|
2
|
+
import { sizes as Zr, variants as en } from "./index.js";
|
|
2
3
|
import "lit";
|
|
4
|
+
import "lit/decorators.js";
|
|
5
|
+
import "lit/directives/if-defined.js";
|
|
6
|
+
import "lit/decorators/property.js";
|
|
3
7
|
function Nr(g, c) {
|
|
4
8
|
for (var U = 0; U < c.length; U++) {
|
|
5
9
|
const k = c[U];
|
|
@@ -30,7 +34,7 @@ var Ve = { exports: {} }, p = {};
|
|
|
30
34
|
* LICENSE file in the root directory of this source tree.
|
|
31
35
|
*/
|
|
32
36
|
var Ct;
|
|
33
|
-
function
|
|
37
|
+
function xr() {
|
|
34
38
|
if (Ct)
|
|
35
39
|
return p;
|
|
36
40
|
Ct = 1;
|
|
@@ -72,8 +76,8 @@ function Mr() {
|
|
|
72
76
|
if (b === 1)
|
|
73
77
|
v.children = d;
|
|
74
78
|
else if (1 < b) {
|
|
75
|
-
for (var E = Array(b),
|
|
76
|
-
E[
|
|
79
|
+
for (var E = Array(b), x = 0; x < b; x++)
|
|
80
|
+
E[x] = arguments[x + 2];
|
|
77
81
|
v.children = E;
|
|
78
82
|
}
|
|
79
83
|
if (r && r.defaultProps)
|
|
@@ -117,8 +121,8 @@ function Mr() {
|
|
|
117
121
|
}
|
|
118
122
|
}
|
|
119
123
|
if (S)
|
|
120
|
-
return S = r, v = v(S), r = h === "" ? "." + se(S, 0) : h, Q(v) ? (d = "", r != null && (d = r.replace(ve, "$&/") + "/"), ne(v, u, d, "", function(
|
|
121
|
-
return
|
|
124
|
+
return S = r, v = v(S), r = h === "" ? "." + se(S, 0) : h, Q(v) ? (d = "", r != null && (d = r.replace(ve, "$&/") + "/"), ne(v, u, d, "", function(x) {
|
|
125
|
+
return x;
|
|
122
126
|
})) : v != null && (ie(v) && (v = pe(v, d + (!v.key || S && S.key === v.key ? "" : ("" + v.key).replace(ve, "$&/") + "/") + r)), u.push(v)), 1;
|
|
123
127
|
if (S = 0, h = h === "" ? "." : h + ":", Q(r))
|
|
124
128
|
for (var b = 0; b < r.length; b++) {
|
|
@@ -187,8 +191,8 @@ function Mr() {
|
|
|
187
191
|
h.children = d;
|
|
188
192
|
else if (1 < E) {
|
|
189
193
|
b = Array(E);
|
|
190
|
-
for (var
|
|
191
|
-
b[
|
|
194
|
+
for (var x = 0; x < E; x++)
|
|
195
|
+
b[x] = arguments[x + 2];
|
|
192
196
|
h.children = b;
|
|
193
197
|
}
|
|
194
198
|
return { $$typeof: g, type: r.type, key: v, ref: _, props: h, _owner: S };
|
|
@@ -258,7 +262,7 @@ var de = { exports: {} };
|
|
|
258
262
|
*/
|
|
259
263
|
de.exports;
|
|
260
264
|
var St;
|
|
261
|
-
function
|
|
265
|
+
function Mr() {
|
|
262
266
|
return St || (St = 1, function(g, c) {
|
|
263
267
|
process.env.NODE_ENV !== "production" && function() {
|
|
264
268
|
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
|
|
@@ -428,11 +432,11 @@ function xr() {
|
|
|
428
432
|
function E() {
|
|
429
433
|
}
|
|
430
434
|
E.prototype = v.prototype;
|
|
431
|
-
function
|
|
435
|
+
function x(e, t, n) {
|
|
432
436
|
this.props = e, this.context = t, this.refs = h, this.updater = n || u;
|
|
433
437
|
}
|
|
434
|
-
var Te =
|
|
435
|
-
Te.constructor =
|
|
438
|
+
var Te = x.prototype = new E();
|
|
439
|
+
Te.constructor = x, d(Te, v.prototype), Te.isPureReactComponent = !0;
|
|
436
440
|
function Tt() {
|
|
437
441
|
var e = {
|
|
438
442
|
current: null
|
|
@@ -624,7 +628,7 @@ function xr() {
|
|
|
624
628
|
var n = je(e.type, t, e.ref, e._self, e._source, e._owner, e.props);
|
|
625
629
|
return n;
|
|
626
630
|
}
|
|
627
|
-
function
|
|
631
|
+
function xt(e, t, n) {
|
|
628
632
|
if (e == null)
|
|
629
633
|
throw new Error("React.cloneElement(...): The argument must be a React element, but you passed " + e + ".");
|
|
630
634
|
var a, o = d({}, e.props), s = e.key, i = e.ref, l = e._self, y = e._source, m = e._owner;
|
|
@@ -648,7 +652,7 @@ function xr() {
|
|
|
648
652
|
function ae(e) {
|
|
649
653
|
return typeof e == "object" && e !== null && e.$$typeof === k;
|
|
650
654
|
}
|
|
651
|
-
var Ke = ".",
|
|
655
|
+
var Ke = ".", Mt = ":";
|
|
652
656
|
function Ut(e) {
|
|
653
657
|
var t = /[=:]/g, n = {
|
|
654
658
|
"=": "=0",
|
|
@@ -705,7 +709,7 @@ function xr() {
|
|
|
705
709
|
)), t.push(y));
|
|
706
710
|
return 1;
|
|
707
711
|
}
|
|
708
|
-
var w, C, O = 0, $ = a === "" ? Ke : a +
|
|
712
|
+
var w, C, O = 0, $ = a === "" ? Ke : a + Mt;
|
|
709
713
|
if (he(e))
|
|
710
714
|
for (var Oe = 0; Oe < e.length; Oe++)
|
|
711
715
|
w = e[Oe], C = $ + Ae(w, Oe), O += ge(w, t, n, C, o);
|
|
@@ -956,7 +960,7 @@ Your code should look like:
|
|
|
956
960
|
}
|
|
957
961
|
return n;
|
|
958
962
|
}
|
|
959
|
-
function
|
|
963
|
+
function M() {
|
|
960
964
|
var e = K.current;
|
|
961
965
|
return e === null && f(`Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:
|
|
962
966
|
1. You might have mismatching versions of React and the renderer (such as React DOM)
|
|
@@ -965,7 +969,7 @@ Your code should look like:
|
|
|
965
969
|
See https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem.`), e;
|
|
966
970
|
}
|
|
967
971
|
function Xt(e) {
|
|
968
|
-
var t =
|
|
972
|
+
var t = M();
|
|
969
973
|
if (e._context !== void 0) {
|
|
970
974
|
var n = e._context;
|
|
971
975
|
n.Consumer === e ? f("Calling useContext(Context.Consumer) is not supported, may cause bugs, and will be removed in a future major release. Did you mean to call useContext(Context) instead?") : n.Provider === e && f("Calling useContext(Context.Provider) is not supported. Did you mean to call useContext(Context) instead?");
|
|
@@ -973,61 +977,61 @@ See https://reactjs.org/link/invalid-hook-call for tips about how to debug and f
|
|
|
973
977
|
return t.useContext(e);
|
|
974
978
|
}
|
|
975
979
|
function Zt(e) {
|
|
976
|
-
var t =
|
|
980
|
+
var t = M();
|
|
977
981
|
return t.useState(e);
|
|
978
982
|
}
|
|
979
983
|
function er(e, t, n) {
|
|
980
|
-
var a =
|
|
984
|
+
var a = M();
|
|
981
985
|
return a.useReducer(e, t, n);
|
|
982
986
|
}
|
|
983
987
|
function tr(e) {
|
|
984
|
-
var t =
|
|
988
|
+
var t = M();
|
|
985
989
|
return t.useRef(e);
|
|
986
990
|
}
|
|
987
991
|
function rr(e, t) {
|
|
988
|
-
var n =
|
|
992
|
+
var n = M();
|
|
989
993
|
return n.useEffect(e, t);
|
|
990
994
|
}
|
|
991
995
|
function nr(e, t) {
|
|
992
|
-
var n =
|
|
996
|
+
var n = M();
|
|
993
997
|
return n.useInsertionEffect(e, t);
|
|
994
998
|
}
|
|
995
999
|
function ar(e, t) {
|
|
996
|
-
var n =
|
|
1000
|
+
var n = M();
|
|
997
1001
|
return n.useLayoutEffect(e, t);
|
|
998
1002
|
}
|
|
999
1003
|
function or(e, t) {
|
|
1000
|
-
var n =
|
|
1004
|
+
var n = M();
|
|
1001
1005
|
return n.useCallback(e, t);
|
|
1002
1006
|
}
|
|
1003
1007
|
function ur(e, t) {
|
|
1004
|
-
var n =
|
|
1008
|
+
var n = M();
|
|
1005
1009
|
return n.useMemo(e, t);
|
|
1006
1010
|
}
|
|
1007
1011
|
function ir(e, t, n) {
|
|
1008
|
-
var a =
|
|
1012
|
+
var a = M();
|
|
1009
1013
|
return a.useImperativeHandle(e, t, n);
|
|
1010
1014
|
}
|
|
1011
1015
|
function sr(e, t) {
|
|
1012
1016
|
{
|
|
1013
|
-
var n =
|
|
1017
|
+
var n = M();
|
|
1014
1018
|
return n.useDebugValue(e, t);
|
|
1015
1019
|
}
|
|
1016
1020
|
}
|
|
1017
1021
|
function cr() {
|
|
1018
|
-
var e =
|
|
1022
|
+
var e = M();
|
|
1019
1023
|
return e.useTransition();
|
|
1020
1024
|
}
|
|
1021
1025
|
function fr(e) {
|
|
1022
|
-
var t =
|
|
1026
|
+
var t = M();
|
|
1023
1027
|
return t.useDeferredValue(e);
|
|
1024
1028
|
}
|
|
1025
1029
|
function lr() {
|
|
1026
|
-
var e =
|
|
1030
|
+
var e = M();
|
|
1027
1031
|
return e.useId();
|
|
1028
1032
|
}
|
|
1029
1033
|
function dr(e, t, n) {
|
|
1030
|
-
var a =
|
|
1034
|
+
var a = M();
|
|
1031
1035
|
return a.useSyncExternalStore(e, t, n);
|
|
1032
1036
|
}
|
|
1033
1037
|
var le = 0, tt, rt, nt, at, ot, ut, it;
|
|
@@ -1383,7 +1387,7 @@ Check the top-level render call using <` + n + ">.");
|
|
|
1383
1387
|
}), t;
|
|
1384
1388
|
}
|
|
1385
1389
|
function Cr(e, t, n) {
|
|
1386
|
-
for (var a =
|
|
1390
|
+
for (var a = xt.apply(this, arguments), o = 2; o < arguments.length; o++)
|
|
1387
1391
|
yt(arguments[o], a.type);
|
|
1388
1392
|
return ht(a), a;
|
|
1389
1393
|
}
|
|
@@ -1425,7 +1429,7 @@ Check the top-level render call using <` + n + ">.");
|
|
|
1425
1429
|
try {
|
|
1426
1430
|
if (j.isBatchingLegacy = !0, a = e(), !n && j.didScheduleLegacyUpdate) {
|
|
1427
1431
|
var o = j.current;
|
|
1428
|
-
o !== null && (j.didScheduleLegacyUpdate = !1,
|
|
1432
|
+
o !== null && (j.didScheduleLegacyUpdate = !1, Me(o));
|
|
1429
1433
|
}
|
|
1430
1434
|
} catch (C) {
|
|
1431
1435
|
throw Se(t), C;
|
|
@@ -1450,7 +1454,7 @@ Check the top-level render call using <` + n + ">.");
|
|
|
1450
1454
|
var y = a;
|
|
1451
1455
|
if (Se(t), ue === 0) {
|
|
1452
1456
|
var m = j.current;
|
|
1453
|
-
m !== null && (
|
|
1457
|
+
m !== null && (Me(m), j.current = null);
|
|
1454
1458
|
var R = {
|
|
1455
1459
|
then: function(C, O) {
|
|
1456
1460
|
j.current === null ? (j.current = [], Fe(y, C, O)) : C(y);
|
|
@@ -1476,7 +1480,7 @@ Check the top-level render call using <` + n + ">.");
|
|
|
1476
1480
|
var a = j.current;
|
|
1477
1481
|
if (a !== null)
|
|
1478
1482
|
try {
|
|
1479
|
-
|
|
1483
|
+
Me(a), Or(function() {
|
|
1480
1484
|
a.length === 0 ? (j.current = null, t(e)) : Fe(e, t, n);
|
|
1481
1485
|
});
|
|
1482
1486
|
} catch (o) {
|
|
@@ -1486,10 +1490,10 @@ Check the top-level render call using <` + n + ">.");
|
|
|
1486
1490
|
t(e);
|
|
1487
1491
|
}
|
|
1488
1492
|
}
|
|
1489
|
-
var
|
|
1490
|
-
function
|
|
1491
|
-
if (!
|
|
1492
|
-
|
|
1493
|
+
var xe = !1;
|
|
1494
|
+
function Me(e) {
|
|
1495
|
+
if (!xe) {
|
|
1496
|
+
xe = !0;
|
|
1493
1497
|
var t = 0;
|
|
1494
1498
|
try {
|
|
1495
1499
|
for (; t < e.length; t++) {
|
|
@@ -1502,7 +1506,7 @@ Check the top-level render call using <` + n + ">.");
|
|
|
1502
1506
|
} catch (a) {
|
|
1503
1507
|
throw e = e.slice(t + 1), a;
|
|
1504
1508
|
} finally {
|
|
1505
|
-
|
|
1509
|
+
xe = !1;
|
|
1506
1510
|
}
|
|
1507
1511
|
}
|
|
1508
1512
|
}
|
|
@@ -1513,11 +1517,11 @@ Check the top-level render call using <` + n + ">.");
|
|
|
1513
1517
|
toArray: zt,
|
|
1514
1518
|
only: Bt
|
|
1515
1519
|
};
|
|
1516
|
-
c.Children = Ar, c.Component = v, c.Fragment = T, c.Profiler = I, c.PureComponent =
|
|
1520
|
+
c.Children = Ar, c.Component = v, c.Fragment = T, c.Profiler = I, c.PureComponent = x, c.StrictMode = V, c.Suspense = H, c.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = q, c.cloneElement = Pr, c.createContext = Ht, c.createElement = Tr, c.createFactory = jr, c.createRef = Tt, c.forwardRef = Qt, c.isValidElement = ae, c.lazy = Kt, c.memo = Jt, c.startTransition = Sr, c.unstable_act = kr, c.useCallback = or, c.useContext = Xt, c.useDebugValue = sr, c.useDeferredValue = fr, c.useEffect = rr, c.useId = lr, c.useImperativeHandle = ir, c.useInsertionEffect = nr, c.useLayoutEffect = ar, c.useMemo = ur, c.useReducer = er, c.useRef = tr, c.useState = Zt, c.useSyncExternalStore = dr, c.useTransition = cr, c.version = U, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
|
|
1517
1521
|
}();
|
|
1518
1522
|
}(de, de.exports)), de.exports;
|
|
1519
1523
|
}
|
|
1520
|
-
process.env.NODE_ENV === "production" ? Ve.exports =
|
|
1524
|
+
process.env.NODE_ENV === "production" ? Ve.exports = xr() : Ve.exports = Mr();
|
|
1521
1525
|
var kt = Ve.exports;
|
|
1522
1526
|
const Ur = /* @__PURE__ */ Fr(kt), Vr = /* @__PURE__ */ Nr({
|
|
1523
1527
|
__proto__: null,
|
|
@@ -1577,7 +1581,7 @@ function zr(g = window.React, c, U, k, A) {
|
|
|
1577
1581
|
const J = T.forwardRef((D, P) => N(H, { ...D, _$Gl: P }, D == null ? void 0 : D.children));
|
|
1578
1582
|
return J.displayName = H.displayName, J;
|
|
1579
1583
|
}
|
|
1580
|
-
const
|
|
1584
|
+
const Qr = zr({
|
|
1581
1585
|
displayName: "PieLink",
|
|
1582
1586
|
elementClass: Lr,
|
|
1583
1587
|
react: Vr,
|
|
@@ -1585,5 +1589,7 @@ const qr = zr({
|
|
|
1585
1589
|
events: {}
|
|
1586
1590
|
});
|
|
1587
1591
|
export {
|
|
1588
|
-
|
|
1592
|
+
Qr as PieLink,
|
|
1593
|
+
Zr as sizes,
|
|
1594
|
+
en as variants
|
|
1589
1595
|
};
|
package/package.json
CHANGED
|
@@ -1,11 +1,16 @@
|
|
|
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.2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"module": "dist/index.js",
|
|
8
|
-
"types": "dist/
|
|
8
|
+
"types": "dist/index.d.ts",
|
|
9
|
+
"files": [
|
|
10
|
+
"src",
|
|
11
|
+
"dist",
|
|
12
|
+
"**/*.d.ts"
|
|
13
|
+
],
|
|
9
14
|
"scripts": {
|
|
10
15
|
"build": "yarn build:wrapper pie-link && run -T vite build",
|
|
11
16
|
"lint:scripts": "run -T eslint .",
|
package/src/defs.ts
CHANGED
|
@@ -1,3 +1,33 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
export const variants = ['default', 'high-visibility', 'inverse'] as const;
|
|
2
|
+
export const sizes = ['small', 'medium'] as const;
|
|
3
|
+
|
|
4
|
+
export interface LinkProps {
|
|
5
|
+
/**
|
|
6
|
+
* What style variant the link should be such as default, high-visibility or inverse.
|
|
7
|
+
*/
|
|
8
|
+
variant?: typeof variants[number];
|
|
9
|
+
/**
|
|
10
|
+
* What size the link should be.
|
|
11
|
+
*/
|
|
12
|
+
size?: typeof sizes[number];
|
|
13
|
+
/**
|
|
14
|
+
* The URL that the hyperlink should point to
|
|
15
|
+
*/
|
|
16
|
+
href?: string;
|
|
17
|
+
/**
|
|
18
|
+
* Where to display the linked URL such as _self, _blank, _parent or _top
|
|
19
|
+
*/
|
|
20
|
+
target?: string;
|
|
21
|
+
/**
|
|
22
|
+
* What the relationship of the linked URL is
|
|
23
|
+
*/
|
|
24
|
+
rel?: string;
|
|
25
|
+
/**
|
|
26
|
+
* When true, the link text will be bold.
|
|
27
|
+
*/
|
|
28
|
+
isBold?: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* When true, the link will be treated as a block box
|
|
31
|
+
*/
|
|
32
|
+
isStandalone?: boolean;
|
|
33
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -1,18 +1,57 @@
|
|
|
1
1
|
import { LitElement, html, unsafeCSS } from 'lit';
|
|
2
|
-
|
|
2
|
+
import { property } from 'lit/decorators.js';
|
|
3
|
+
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
4
|
+
import { validPropertyValues } from '@justeattakeaway/pie-webc-core';
|
|
3
5
|
import styles from './link.scss?inline';
|
|
4
|
-
import { LinkProps } from './defs';
|
|
6
|
+
import { LinkProps, variants, sizes } from './defs';
|
|
5
7
|
|
|
6
8
|
// Valid values available to consumers
|
|
7
|
-
export
|
|
8
|
-
type LinkProps,
|
|
9
|
-
};
|
|
9
|
+
export * from './defs';
|
|
10
10
|
|
|
11
11
|
const componentSelector = 'pie-link';
|
|
12
12
|
|
|
13
13
|
export class PieLink extends LitElement implements LinkProps {
|
|
14
|
+
@property({ type: String })
|
|
15
|
+
@validPropertyValues(componentSelector, variants, 'default')
|
|
16
|
+
public variant: LinkProps['variant'] = 'default';
|
|
17
|
+
|
|
18
|
+
@property({ type: String })
|
|
19
|
+
@validPropertyValues(componentSelector, sizes, 'medium')
|
|
20
|
+
public size: LinkProps['size'] = 'medium';
|
|
21
|
+
|
|
22
|
+
@property({ type: String, reflect: true })
|
|
23
|
+
public href?: string;
|
|
24
|
+
|
|
25
|
+
@property({ type: String, reflect: true })
|
|
26
|
+
public target?: string;
|
|
27
|
+
|
|
28
|
+
@property({ type: String, reflect: true })
|
|
29
|
+
public rel?: string;
|
|
30
|
+
|
|
31
|
+
@property({ type: Boolean })
|
|
32
|
+
public isBold = false;
|
|
33
|
+
|
|
34
|
+
@property({ type: Boolean })
|
|
35
|
+
public isStandalone = false;
|
|
36
|
+
|
|
14
37
|
render () {
|
|
15
|
-
|
|
38
|
+
const {
|
|
39
|
+
variant, size, href, target, rel, isBold, isStandalone,
|
|
40
|
+
} = this;
|
|
41
|
+
|
|
42
|
+
return html`
|
|
43
|
+
<a
|
|
44
|
+
data-test-id="pie-link"
|
|
45
|
+
class="c-link"
|
|
46
|
+
variant=${variant}
|
|
47
|
+
size=${size}
|
|
48
|
+
href=${ifDefined(href)}
|
|
49
|
+
target=${ifDefined(target)}
|
|
50
|
+
rel=${ifDefined(rel)}
|
|
51
|
+
?isBold=${isBold}
|
|
52
|
+
?isStandalone=${isStandalone}>
|
|
53
|
+
<slot></slot>
|
|
54
|
+
</a>`;
|
|
16
55
|
}
|
|
17
56
|
|
|
18
57
|
// Renders a `CSSResult` generated from SCSS by Vite
|
package/src/link.scss
CHANGED
|
@@ -1 +1,47 @@
|
|
|
1
1
|
@use '@justeattakeaway/pie-css/scss' as p;
|
|
2
|
+
|
|
3
|
+
.c-link {
|
|
4
|
+
--link-font-family: var(--dt-font-interactive-m-family);
|
|
5
|
+
--link-font-size: #{p.font-size(--dt-font-size-16)};
|
|
6
|
+
--link-line-height: calc(var(--dt-font-size-16-line-height) * 1px);
|
|
7
|
+
--link-font-weight: var(--dt-font-weight-regular);
|
|
8
|
+
--link-text-color: var(--dt-color-content-link);
|
|
9
|
+
--link-text-decoration: var(--dt-font-style-underline);
|
|
10
|
+
|
|
11
|
+
font-family: var(--link-font-family);
|
|
12
|
+
font-size: var(--link-font-size);
|
|
13
|
+
line-height: var(--link-line-height);
|
|
14
|
+
font-weight: var(--link-font-weight);
|
|
15
|
+
color: var(--link-text-color);
|
|
16
|
+
text-decoration: var(--link-text-decoration);
|
|
17
|
+
cursor: pointer;
|
|
18
|
+
|
|
19
|
+
&[variant='default'] {
|
|
20
|
+
/* Same as default styles */
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
&[variant='high-visibility'] {
|
|
24
|
+
--link-text-color: var(--dt-color-content-link-distinct);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
&[variant='inverse'] {
|
|
28
|
+
--link-text-color: var(--dt-color-content-link-inverse);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
&[size='small'] {
|
|
32
|
+
--link-font-size: #{p.font-size(--dt-font-size-14)};
|
|
33
|
+
--link-line-height: calc(var(--dt-font-size-14-line-height) * 1px);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
&[size='medium'] {
|
|
37
|
+
/* Same as default styles */
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
&[isBold] {
|
|
41
|
+
--link-font-weight: var(--dt-font-weight-bold);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
&[isStandalone] {
|
|
45
|
+
display: block;
|
|
46
|
+
}
|
|
47
|
+
}
|
package/.eslintignore
DELETED
package/.turbo/turbo-build.log
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
[8:54:51 PM] @custom-elements-manifest/analyzer: Created new manifest.
|
|
2
|
-
react wrapper has been added!
|
|
3
|
-
[36mvite v4.3.9 [32mbuilding for production...[36m[39m
|
|
4
|
-
transforming...
|
|
5
|
-
[32m✓[39m 12 modules transformed.
|
|
6
|
-
rendering chunks...
|
|
7
|
-
computing gzip size...
|
|
8
|
-
[2mdist/[22m[36mindex.js [39m[1m[2m 0.27 kB[22m[1m[22m[2m │ gzip: 0.22 kB[22m
|
|
9
|
-
[2mdist/[22m[36mreact.js [39m[1m[2m58.94 kB[22m[1m[22m[2m │ gzip: 15.90 kB[22m
|
|
10
|
-
[32m
|
|
11
|
-
[36m[vite:dts][32m Start generate declaration files...[39m
|
|
12
|
-
[32m✓ built in 11.55s[39m
|
|
13
|
-
[32m[36m[vite:dts][32m Declaration files built in 10712ms.
|
|
14
|
-
[39m
|
package/dist/types/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './src/index'
|
package/dist/types/react.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './src/react'
|
package/dist/types/src/defs.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"defs.d.ts","sourceRoot":"","sources":["../../../src/defs.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,SAAS;CAAG"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { LitElement } from 'lit';
|
|
2
|
-
import { LinkProps } from './defs';
|
|
3
|
-
export { type LinkProps, };
|
|
4
|
-
declare const componentSelector = "pie-link";
|
|
5
|
-
export declare class PieLink extends LitElement implements LinkProps {
|
|
6
|
-
render(): import("lit-html").TemplateResult<1>;
|
|
7
|
-
static styles: import("lit").CSSResult;
|
|
8
|
-
}
|
|
9
|
-
declare global {
|
|
10
|
-
interface HTMLElementTagNameMap {
|
|
11
|
-
[componentSelector]: PieLink;
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAmB,MAAM,KAAK,CAAC;AAGlD,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAGnC,OAAO,EACH,KAAK,SAAS,GACjB,CAAC;AAEF,QAAA,MAAM,iBAAiB,aAAa,CAAC;AAErC,qBAAa,OAAQ,SAAQ,UAAW,YAAW,SAAS;IACxD,MAAM;IAKN,MAAM,CAAC,MAAM,0BAAqB;CACrC;AAID,OAAO,CAAC,MAAM,CAAC;IACX,UAAU,qBAAqB;QAC3B,CAAC,iBAAiB,CAAC,EAAE,OAAO,CAAC;KAChC;CACJ"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"react.d.ts","sourceRoot":"","sources":["../../../src/react.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,SAAS,CAAC;AAElD,eAAO,MAAM,OAAO,+DAMlB,CAAC"}
|
package/playwright/index.html
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="UTF-8" />
|
|
5
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
-
<link rel="preload" href="https://d30v2pzvrfyzpo.cloudfront.net/fonts/JETSansDigital-Regular-optimised.woff2" as="font" type="font/woff2" crossorigin>
|
|
7
|
-
<link rel="preload" href="https://d30v2pzvrfyzpo.cloudfront.net/fonts/JETSansDigital-Bold-optimised.woff2" as="font" type="font/woff2" crossorigin>
|
|
8
|
-
<link rel="preload" href="https://d30v2pzvrfyzpo.cloudfront.net/fonts/JETSansDigital-ExtraBold-optimised.woff2" as="font" type="font/woff2" crossorigin>
|
|
9
|
-
<style>
|
|
10
|
-
@font-face {
|
|
11
|
-
font-family: JETSansDigital;
|
|
12
|
-
src: url('https://d30v2pzvrfyzpo.cloudfront.net/fonts/JETSansDigital-Regular-optimised.woff2') format("woff2"),
|
|
13
|
-
url('https://d30v2pzvrfyzpo.cloudfront.net/fonts/JETSansDigital-Regular-optimised.woff') format("woff");
|
|
14
|
-
font-weight: 400;
|
|
15
|
-
font-display: swap;
|
|
16
|
-
}
|
|
17
|
-
@font-face {
|
|
18
|
-
font-family: JETSansDigital;
|
|
19
|
-
src: url('https://d30v2pzvrfyzpo.cloudfront.net/fonts/JETSansDigital-Bold-optimised.woff2') format("woff2"),
|
|
20
|
-
url('https://d30v2pzvrfyzpo.cloudfront.net/fonts/JETSansDigital-Bold-optimised.woff') format("woff");
|
|
21
|
-
font-weight: 700;
|
|
22
|
-
font-display: swap;
|
|
23
|
-
}
|
|
24
|
-
@font-face {
|
|
25
|
-
font-family: JETSansDigital;
|
|
26
|
-
src: url('https://d30v2pzvrfyzpo.cloudfront.net/fonts/JETSansDigital-ExtraBold-optimised.woff2') format("woff2"),
|
|
27
|
-
url('https://d30v2pzvrfyzpo.cloudfront.net/fonts/JETSansDigital-ExtraBold-optimised.woff') format("woff");
|
|
28
|
-
font-weight: 800;
|
|
29
|
-
font-display: swap;
|
|
30
|
-
}
|
|
31
|
-
body {
|
|
32
|
-
font-feature-settings: "tnum"; /* Enable tabular numbers */
|
|
33
|
-
}
|
|
34
|
-
/* basic styles to center align components and give them some spacing */
|
|
35
|
-
#root {
|
|
36
|
-
padding: 1em;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
#root > * {
|
|
40
|
-
display: block;
|
|
41
|
-
margin-inline: auto;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
#root > * + * {
|
|
45
|
-
margin-top: 1em;
|
|
46
|
-
}
|
|
47
|
-
</style>
|
|
48
|
-
<title>Testing Page</title>
|
|
49
|
-
<link rel="stylesheet" type="text/css" href="https://unpkg.com/@justeat/pie-design-tokens/dist/jet.css" />
|
|
50
|
-
<link rel="stylesheet" type="text/css" href="https://unpkg.com/@justeat/pie-design-tokens/dist/jet-hsl-colors.css" />
|
|
51
|
-
</head>
|
|
52
|
-
<body>
|
|
53
|
-
<div id="root"></div>
|
|
54
|
-
<script type="module" src="./index.ts"></script>
|
|
55
|
-
</body>
|
|
56
|
-
</html>
|
package/playwright/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
// Import common styles here
|
package/playwright-lit.config.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import { test, expect } from '@justeattakeaway/pie-webc-testing/src/playwright/fixtures.ts';
|
|
3
|
-
import { PieLink, LinkProps } from '@/index';
|
|
4
|
-
|
|
5
|
-
test.describe('PieLink - Accessibility tests', () => {
|
|
6
|
-
test('a11y - should test the PieLink component WCAG compliance', async ({ makeAxeBuilder, mount }) => {
|
|
7
|
-
await mount(
|
|
8
|
-
PieLink,
|
|
9
|
-
{
|
|
10
|
-
props: {} as LinkProps,
|
|
11
|
-
},
|
|
12
|
-
);
|
|
13
|
-
|
|
14
|
-
const results = await makeAxeBuilder().analyze();
|
|
15
|
-
|
|
16
|
-
expect(results.violations).toEqual([]);
|
|
17
|
-
});
|
|
18
|
-
});
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import { test, expect } from '@sand4rt/experimental-ct-web';
|
|
3
|
-
import { PieLink, LinkProps } from '@/index';
|
|
4
|
-
|
|
5
|
-
const componentSelector = '[data-test-id="pie-link"]';
|
|
6
|
-
|
|
7
|
-
test.describe('PieLink - Component tests', () => {
|
|
8
|
-
test('should render successfully', async ({ mount, page }) => {
|
|
9
|
-
// Arrange
|
|
10
|
-
await mount(PieLink, {
|
|
11
|
-
props: {} as LinkProps,
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
// Act
|
|
15
|
-
const link = page.locator(componentSelector);
|
|
16
|
-
|
|
17
|
-
// Assert
|
|
18
|
-
expect(link).toBeVisible();
|
|
19
|
-
});
|
|
20
|
-
});
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import { test } from '@sand4rt/experimental-ct-web';
|
|
3
|
-
import percySnapshot from '@percy/playwright';
|
|
4
|
-
import { PieLink, LinkProps } from '@/index';
|
|
5
|
-
|
|
6
|
-
test.describe('PieLink - Visual tests`', () => {
|
|
7
|
-
test('should display the PieLink component successfully', async ({ page, mount }) => {
|
|
8
|
-
await mount(PieLink, {
|
|
9
|
-
props: {} as LinkProps,
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
await percySnapshot(page, 'PieLink - Visual Test');
|
|
13
|
-
});
|
|
14
|
-
});
|
package/tsconfig.json
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "../../../configs/pie-components-config/tsconfig.json",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"baseUrl": ".",
|
|
5
|
-
"rootDir": ".",
|
|
6
|
-
},
|
|
7
|
-
"include": ["src/**/*.ts","./declaration.d.ts", "test/**/*.ts", "playwright-lit-visual.config.ts", "playwright-lit.config.ts"],
|
|
8
|
-
}
|
package/vite.config.js
DELETED