@justeattakeaway/pie-link 0.17.3 → 0.17.5
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 +16 -36
- package/dist/index.d.ts +5 -0
- package/dist/index.js +86 -75
- package/dist/react.d.ts +5 -0
- package/dist/react.js +12 -11
- package/package.json +3 -3
- package/src/defs.ts +16 -0
- package/src/index.ts +16 -15
package/custom-elements.json
CHANGED
|
@@ -59,6 +59,14 @@
|
|
|
59
59
|
"text": "['default', 'reversed']"
|
|
60
60
|
},
|
|
61
61
|
"default": "['default', 'reversed']"
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
"kind": "variable",
|
|
65
|
+
"name": "defaultProps",
|
|
66
|
+
"type": {
|
|
67
|
+
"text": "DefaultProps"
|
|
68
|
+
},
|
|
69
|
+
"default": "{\n tag: 'a',\n variant: 'default',\n size: 'medium',\n underline: 'default',\n iconPlacement: 'leading',\n isBold: false,\n isStandalone: false,\n hasVisited: false,\n type: 'submit',\n}"
|
|
62
70
|
}
|
|
63
71
|
],
|
|
64
72
|
"exports": [
|
|
@@ -109,6 +117,14 @@
|
|
|
109
117
|
"name": "underlineTypes",
|
|
110
118
|
"module": "src/defs.js"
|
|
111
119
|
}
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
"kind": "js",
|
|
123
|
+
"name": "defaultProps",
|
|
124
|
+
"declaration": {
|
|
125
|
+
"name": "defaultProps",
|
|
126
|
+
"module": "src/defs.js"
|
|
127
|
+
}
|
|
112
128
|
}
|
|
113
129
|
]
|
|
114
130
|
},
|
|
@@ -138,7 +154,6 @@
|
|
|
138
154
|
"text": "LinkProps['tag']"
|
|
139
155
|
},
|
|
140
156
|
"privacy": "public",
|
|
141
|
-
"default": "'a'",
|
|
142
157
|
"attribute": "tag"
|
|
143
158
|
},
|
|
144
159
|
{
|
|
@@ -148,7 +163,6 @@
|
|
|
148
163
|
"text": "LinkProps['variant']"
|
|
149
164
|
},
|
|
150
165
|
"privacy": "public",
|
|
151
|
-
"default": "'default'",
|
|
152
166
|
"attribute": "variant"
|
|
153
167
|
},
|
|
154
168
|
{
|
|
@@ -158,7 +172,6 @@
|
|
|
158
172
|
"text": "LinkProps['size']"
|
|
159
173
|
},
|
|
160
174
|
"privacy": "public",
|
|
161
|
-
"default": "'medium'",
|
|
162
175
|
"attribute": "size"
|
|
163
176
|
},
|
|
164
177
|
{
|
|
@@ -168,7 +181,6 @@
|
|
|
168
181
|
"text": "LinkProps['underline']"
|
|
169
182
|
},
|
|
170
183
|
"privacy": "public",
|
|
171
|
-
"default": "'default'",
|
|
172
184
|
"attribute": "underline"
|
|
173
185
|
},
|
|
174
186
|
{
|
|
@@ -178,7 +190,6 @@
|
|
|
178
190
|
"text": "LinkProps['iconPlacement']"
|
|
179
191
|
},
|
|
180
192
|
"privacy": "public",
|
|
181
|
-
"default": "'leading'",
|
|
182
193
|
"attribute": "iconPlacement"
|
|
183
194
|
},
|
|
184
195
|
{
|
|
@@ -214,31 +225,19 @@
|
|
|
214
225
|
{
|
|
215
226
|
"kind": "field",
|
|
216
227
|
"name": "isBold",
|
|
217
|
-
"type": {
|
|
218
|
-
"text": "boolean"
|
|
219
|
-
},
|
|
220
228
|
"privacy": "public",
|
|
221
|
-
"default": "false",
|
|
222
229
|
"attribute": "isBold"
|
|
223
230
|
},
|
|
224
231
|
{
|
|
225
232
|
"kind": "field",
|
|
226
233
|
"name": "isStandalone",
|
|
227
|
-
"type": {
|
|
228
|
-
"text": "boolean"
|
|
229
|
-
},
|
|
230
234
|
"privacy": "public",
|
|
231
|
-
"default": "false",
|
|
232
235
|
"attribute": "isStandalone"
|
|
233
236
|
},
|
|
234
237
|
{
|
|
235
238
|
"kind": "field",
|
|
236
239
|
"name": "hasVisited",
|
|
237
|
-
"type": {
|
|
238
|
-
"text": "boolean"
|
|
239
|
-
},
|
|
240
240
|
"privacy": "public",
|
|
241
|
-
"default": "false",
|
|
242
241
|
"attribute": "hasVisited"
|
|
243
242
|
},
|
|
244
243
|
{
|
|
@@ -248,7 +247,6 @@
|
|
|
248
247
|
"text": "LinkProps['type']"
|
|
249
248
|
},
|
|
250
249
|
"privacy": "public",
|
|
251
|
-
"default": "'submit'",
|
|
252
250
|
"attribute": "type"
|
|
253
251
|
},
|
|
254
252
|
{
|
|
@@ -300,7 +298,6 @@
|
|
|
300
298
|
"type": {
|
|
301
299
|
"text": "LinkProps['tag']"
|
|
302
300
|
},
|
|
303
|
-
"default": "'a'",
|
|
304
301
|
"fieldName": "tag"
|
|
305
302
|
},
|
|
306
303
|
{
|
|
@@ -308,7 +305,6 @@
|
|
|
308
305
|
"type": {
|
|
309
306
|
"text": "LinkProps['variant']"
|
|
310
307
|
},
|
|
311
|
-
"default": "'default'",
|
|
312
308
|
"fieldName": "variant"
|
|
313
309
|
},
|
|
314
310
|
{
|
|
@@ -316,7 +312,6 @@
|
|
|
316
312
|
"type": {
|
|
317
313
|
"text": "LinkProps['size']"
|
|
318
314
|
},
|
|
319
|
-
"default": "'medium'",
|
|
320
315
|
"fieldName": "size"
|
|
321
316
|
},
|
|
322
317
|
{
|
|
@@ -324,7 +319,6 @@
|
|
|
324
319
|
"type": {
|
|
325
320
|
"text": "LinkProps['underline']"
|
|
326
321
|
},
|
|
327
|
-
"default": "'default'",
|
|
328
322
|
"fieldName": "underline"
|
|
329
323
|
},
|
|
330
324
|
{
|
|
@@ -332,7 +326,6 @@
|
|
|
332
326
|
"type": {
|
|
333
327
|
"text": "LinkProps['iconPlacement']"
|
|
334
328
|
},
|
|
335
|
-
"default": "'leading'",
|
|
336
329
|
"fieldName": "iconPlacement"
|
|
337
330
|
},
|
|
338
331
|
{
|
|
@@ -358,26 +351,14 @@
|
|
|
358
351
|
},
|
|
359
352
|
{
|
|
360
353
|
"name": "isBold",
|
|
361
|
-
"type": {
|
|
362
|
-
"text": "boolean"
|
|
363
|
-
},
|
|
364
|
-
"default": "false",
|
|
365
354
|
"fieldName": "isBold"
|
|
366
355
|
},
|
|
367
356
|
{
|
|
368
357
|
"name": "isStandalone",
|
|
369
|
-
"type": {
|
|
370
|
-
"text": "boolean"
|
|
371
|
-
},
|
|
372
|
-
"default": "false",
|
|
373
358
|
"fieldName": "isStandalone"
|
|
374
359
|
},
|
|
375
360
|
{
|
|
376
361
|
"name": "hasVisited",
|
|
377
|
-
"type": {
|
|
378
|
-
"text": "boolean"
|
|
379
|
-
},
|
|
380
|
-
"default": "false",
|
|
381
362
|
"fieldName": "hasVisited"
|
|
382
363
|
},
|
|
383
364
|
{
|
|
@@ -385,7 +366,6 @@
|
|
|
385
366
|
"type": {
|
|
386
367
|
"text": "LinkProps['type']"
|
|
387
368
|
},
|
|
388
|
-
"default": "'submit'",
|
|
389
369
|
"fieldName": "type"
|
|
390
370
|
},
|
|
391
371
|
{
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ComponentDefaultPropsGeneric } from '@justeattakeaway/pie-webc-core';
|
|
1
2
|
import type { CSSResult } from 'lit';
|
|
2
3
|
import type { LitElement } from 'lit';
|
|
3
4
|
import type { TemplateResult } from 'lit';
|
|
@@ -8,6 +9,10 @@ export declare type AriaProps = {
|
|
|
8
9
|
|
|
9
10
|
export declare const buttonTypes: readonly ["submit", "button", "reset", "menu"];
|
|
10
11
|
|
|
12
|
+
export declare type DefaultProps = ComponentDefaultPropsGeneric<LinkProps, 'tag' | 'variant' | 'size' | 'underline' | 'iconPlacement' | 'isBold' | 'isStandalone' | 'hasVisited' | 'type'>;
|
|
13
|
+
|
|
14
|
+
export declare const defaultProps: DefaultProps;
|
|
15
|
+
|
|
11
16
|
export declare const iconPlacements: readonly ["leading", "trailing"];
|
|
12
17
|
|
|
13
18
|
export declare interface LinkProps {
|
package/dist/index.js
CHANGED
|
@@ -1,17 +1,27 @@
|
|
|
1
|
-
import { unsafeCSS as f, LitElement as
|
|
2
|
-
import { property as
|
|
3
|
-
import { validPropertyValues as
|
|
4
|
-
const
|
|
5
|
-
`,
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import { unsafeCSS as f, LitElement as k, html as c, nothing as s } from "lit";
|
|
2
|
+
import { property as n } from "lit/decorators.js";
|
|
3
|
+
import { validPropertyValues as d, defineCustomElement as g } from "@justeattakeaway/pie-webc-core";
|
|
4
|
+
const y = `*,*: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[tag=button]{outline:none;border:none;-webkit-user-select: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)}
|
|
5
|
+
`, m = ["default", "high-visibility", "inverse"], b = ["small", "medium"], x = ["leading", "trailing"], $ = ["a", "button"], z = ["submit", "button", "reset", "menu"], S = ["default", "reversed"], t = {
|
|
6
|
+
tag: "a",
|
|
7
|
+
variant: "default",
|
|
8
|
+
size: "medium",
|
|
9
|
+
underline: "default",
|
|
10
|
+
iconPlacement: "leading",
|
|
11
|
+
isBold: !1,
|
|
12
|
+
isStandalone: !1,
|
|
13
|
+
hasVisited: !1,
|
|
14
|
+
type: "submit"
|
|
10
15
|
};
|
|
11
|
-
|
|
12
|
-
|
|
16
|
+
var B = Object.defineProperty, P = Object.getOwnPropertyDescriptor, o = (h, i, a, p) => {
|
|
17
|
+
for (var l = p > 1 ? void 0 : p ? P(i, a) : i, u = h.length - 1, v; u >= 0; u--)
|
|
18
|
+
(v = h[u]) && (l = (p ? v(i, a, l) : v(l)) || l);
|
|
19
|
+
return p && l && B(i, a, l), l;
|
|
20
|
+
};
|
|
21
|
+
const r = "pie-link";
|
|
22
|
+
class e extends k {
|
|
13
23
|
constructor() {
|
|
14
|
-
super(...arguments), this.tag =
|
|
24
|
+
super(...arguments), this.tag = t.tag, this.variant = t.variant, this.size = t.size, this.underline = t.underline, this.iconPlacement = t.iconPlacement, this.isBold = t.isBold, this.isStandalone = t.isStandalone, this.hasVisited = t.hasVisited, this.type = t.type;
|
|
15
25
|
}
|
|
16
26
|
/**
|
|
17
27
|
* Renders the link content.
|
|
@@ -19,12 +29,12 @@ class t extends v {
|
|
|
19
29
|
* @private
|
|
20
30
|
*/
|
|
21
31
|
renderContent() {
|
|
22
|
-
const { iconPlacement:
|
|
23
|
-
return
|
|
32
|
+
const { iconPlacement: i, isStandalone: a } = this;
|
|
33
|
+
return c`
|
|
24
34
|
<span class="c-link-content">
|
|
25
|
-
${
|
|
35
|
+
${a && i === "leading" ? c`<slot name="icon"></slot>` : s}
|
|
26
36
|
<slot></slot>
|
|
27
|
-
${
|
|
37
|
+
${a && i === "trailing" ? c`<slot name="icon"></slot>` : s}
|
|
28
38
|
</span>`;
|
|
29
39
|
}
|
|
30
40
|
/**
|
|
@@ -33,8 +43,8 @@ class t extends v {
|
|
|
33
43
|
* @private
|
|
34
44
|
*/
|
|
35
45
|
renderButton() {
|
|
36
|
-
var
|
|
37
|
-
return
|
|
46
|
+
var i;
|
|
47
|
+
return c`
|
|
38
48
|
<button
|
|
39
49
|
data-test-id="pie-link"
|
|
40
50
|
class="c-link"
|
|
@@ -46,7 +56,7 @@ class t extends v {
|
|
|
46
56
|
?isStandalone=${this.isStandalone}
|
|
47
57
|
?hasVisited=${this.hasVisited}
|
|
48
58
|
type=${this.type || "submit"}
|
|
49
|
-
aria-label=${((
|
|
59
|
+
aria-label=${((i = this.aria) == null ? void 0 : i.label) || s}>
|
|
50
60
|
${this.renderContent()}
|
|
51
61
|
</button>`;
|
|
52
62
|
}
|
|
@@ -56,8 +66,8 @@ class t extends v {
|
|
|
56
66
|
* @private
|
|
57
67
|
*/
|
|
58
68
|
renderAnchor() {
|
|
59
|
-
var
|
|
60
|
-
return
|
|
69
|
+
var i;
|
|
70
|
+
return c`
|
|
61
71
|
<a
|
|
62
72
|
data-test-id="pie-link"
|
|
63
73
|
class="c-link"
|
|
@@ -71,7 +81,7 @@ class t extends v {
|
|
|
71
81
|
href=${this.href || ""}
|
|
72
82
|
target=${this.target || s}
|
|
73
83
|
rel=${this.rel || s}
|
|
74
|
-
aria-label=${((
|
|
84
|
+
aria-label=${((i = this.aria) == null ? void 0 : i.label) || s}>
|
|
75
85
|
${this.renderContent()}
|
|
76
86
|
</a>`;
|
|
77
87
|
}
|
|
@@ -79,59 +89,60 @@ class t extends v {
|
|
|
79
89
|
return this.tag === "button" ? this.renderButton() : this.renderAnchor();
|
|
80
90
|
}
|
|
81
91
|
}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
],
|
|
87
|
-
|
|
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
|
-
|
|
92
|
+
e.styles = f(y);
|
|
93
|
+
o([
|
|
94
|
+
n(),
|
|
95
|
+
d(r, $, t.tag)
|
|
96
|
+
], e.prototype, "tag", 2);
|
|
97
|
+
o([
|
|
98
|
+
n({ type: String }),
|
|
99
|
+
d(r, m, t.variant)
|
|
100
|
+
], e.prototype, "variant", 2);
|
|
101
|
+
o([
|
|
102
|
+
n({ type: String }),
|
|
103
|
+
d(r, b, t.size)
|
|
104
|
+
], e.prototype, "size", 2);
|
|
105
|
+
o([
|
|
106
|
+
n({ type: String }),
|
|
107
|
+
d(r, S, t.underline)
|
|
108
|
+
], e.prototype, "underline", 2);
|
|
109
|
+
o([
|
|
110
|
+
n({ type: String }),
|
|
111
|
+
d(r, x, t.iconPlacement)
|
|
112
|
+
], e.prototype, "iconPlacement", 2);
|
|
113
|
+
o([
|
|
114
|
+
n({ type: String, reflect: !0 })
|
|
115
|
+
], e.prototype, "href", 2);
|
|
116
|
+
o([
|
|
117
|
+
n({ type: String, reflect: !0 })
|
|
118
|
+
], e.prototype, "target", 2);
|
|
119
|
+
o([
|
|
120
|
+
n({ type: String, reflect: !0 })
|
|
121
|
+
], e.prototype, "rel", 2);
|
|
122
|
+
o([
|
|
123
|
+
n({ type: Boolean })
|
|
124
|
+
], e.prototype, "isBold", 2);
|
|
125
|
+
o([
|
|
126
|
+
n({ type: Boolean })
|
|
127
|
+
], e.prototype, "isStandalone", 2);
|
|
128
|
+
o([
|
|
129
|
+
n({ type: Boolean })
|
|
130
|
+
], e.prototype, "hasVisited", 2);
|
|
131
|
+
o([
|
|
132
|
+
n(),
|
|
133
|
+
d(r, z, t.type)
|
|
134
|
+
], e.prototype, "type", 2);
|
|
135
|
+
o([
|
|
136
|
+
n({ type: Object })
|
|
137
|
+
], e.prototype, "aria", 2);
|
|
138
|
+
g(r, e);
|
|
129
139
|
export {
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
140
|
+
e as PieLink,
|
|
141
|
+
z as buttonTypes,
|
|
142
|
+
t as defaultProps,
|
|
143
|
+
x as iconPlacements,
|
|
144
|
+
b as sizes,
|
|
145
|
+
$ as tags,
|
|
135
146
|
S as underlineTypes,
|
|
136
|
-
|
|
147
|
+
m as variants
|
|
137
148
|
};
|
package/dist/react.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ComponentDefaultPropsGeneric } from '@justeattakeaway/pie-webc-core';
|
|
1
2
|
import type { CSSResult } from 'lit';
|
|
2
3
|
import type { LitElement } from 'lit';
|
|
3
4
|
import * as React_2 from 'react';
|
|
@@ -9,6 +10,10 @@ export declare type AriaProps = {
|
|
|
9
10
|
|
|
10
11
|
export declare const buttonTypes: readonly ["submit", "button", "reset", "menu"];
|
|
11
12
|
|
|
13
|
+
export declare type DefaultProps = ComponentDefaultPropsGeneric<LinkProps, 'tag' | 'variant' | 'size' | 'underline' | 'iconPlacement' | 'isBold' | 'isStandalone' | 'hasVisited' | 'type'>;
|
|
14
|
+
|
|
15
|
+
export declare const defaultProps: DefaultProps;
|
|
16
|
+
|
|
12
17
|
export declare const iconPlacements: readonly ["leading", "trailing"];
|
|
13
18
|
|
|
14
19
|
export declare interface LinkProps {
|
package/dist/react.js
CHANGED
|
@@ -1,23 +1,24 @@
|
|
|
1
1
|
import * as e from "react";
|
|
2
|
-
import { createComponent as
|
|
3
|
-
import { PieLink as
|
|
4
|
-
import { buttonTypes as
|
|
2
|
+
import { createComponent as t } from "@lit/react";
|
|
3
|
+
import { PieLink as i } from "./index.js";
|
|
4
|
+
import { buttonTypes as P, defaultProps as k, iconPlacements as f, sizes as L, tags as d, underlineTypes as u, variants as y } from "./index.js";
|
|
5
5
|
import "lit";
|
|
6
6
|
import "lit/decorators.js";
|
|
7
7
|
import "@justeattakeaway/pie-webc-core";
|
|
8
|
-
const
|
|
8
|
+
const o = t({
|
|
9
9
|
displayName: "PieLink",
|
|
10
|
-
elementClass:
|
|
10
|
+
elementClass: i,
|
|
11
11
|
react: e,
|
|
12
12
|
tagName: "pie-link",
|
|
13
13
|
events: {}
|
|
14
|
-
}), p =
|
|
14
|
+
}), p = o;
|
|
15
15
|
export {
|
|
16
16
|
p as PieLink,
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
P as buttonTypes,
|
|
18
|
+
k as defaultProps,
|
|
19
|
+
f as iconPlacements,
|
|
19
20
|
L as sizes,
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
d as tags,
|
|
22
|
+
u as underlineTypes,
|
|
23
|
+
y as variants
|
|
23
24
|
};
|
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.17.
|
|
4
|
+
"version": "0.17.5",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"module": "dist/index.js",
|
|
@@ -37,12 +37,12 @@
|
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@custom-elements-manifest/analyzer": "0.9.0",
|
|
39
39
|
"@justeattakeaway/pie-components-config": "0.16.0",
|
|
40
|
-
"@justeattakeaway/pie-icons-webc": "0.
|
|
40
|
+
"@justeattakeaway/pie-icons-webc": "0.24.0",
|
|
41
41
|
"@justeattakeaway/pie-wrapper-react": "0.14.0",
|
|
42
42
|
"cem-plugin-module-file-extensions": "0.0.5"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@justeattakeaway/pie-webc-core": "0.
|
|
45
|
+
"@justeattakeaway/pie-webc-core": "0.23.0"
|
|
46
46
|
},
|
|
47
47
|
"volta": {
|
|
48
48
|
"extends": "../../../package.json"
|
package/src/defs.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { type ComponentDefaultPropsGeneric } from '@justeattakeaway/pie-webc-core';
|
|
2
|
+
|
|
1
3
|
export const variants = ['default', 'high-visibility', 'inverse'] as const;
|
|
2
4
|
export const sizes = ['small', 'medium'] as const;
|
|
3
5
|
export const iconPlacements = ['leading', 'trailing'] as const;
|
|
@@ -65,3 +67,17 @@ export interface LinkProps {
|
|
|
65
67
|
*/
|
|
66
68
|
type?: typeof buttonTypes[number];
|
|
67
69
|
}
|
|
70
|
+
|
|
71
|
+
export type DefaultProps = ComponentDefaultPropsGeneric<LinkProps, 'tag' | 'variant' | 'size' | 'underline' | 'iconPlacement' | 'isBold' | 'isStandalone' | 'hasVisited' | 'type'>;
|
|
72
|
+
|
|
73
|
+
export const defaultProps: DefaultProps = {
|
|
74
|
+
tag: 'a',
|
|
75
|
+
variant: 'default',
|
|
76
|
+
size: 'medium',
|
|
77
|
+
underline: 'default',
|
|
78
|
+
iconPlacement: 'leading',
|
|
79
|
+
isBold: false,
|
|
80
|
+
isStandalone: false,
|
|
81
|
+
hasVisited: false,
|
|
82
|
+
type: 'submit',
|
|
83
|
+
};
|
package/src/index.ts
CHANGED
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
buttonTypes,
|
|
14
14
|
underlineTypes,
|
|
15
15
|
type AriaProps,
|
|
16
|
+
defaultProps,
|
|
16
17
|
} from './defs';
|
|
17
18
|
|
|
18
19
|
// Valid values available to consumers
|
|
@@ -28,24 +29,24 @@ const componentSelector = 'pie-link';
|
|
|
28
29
|
|
|
29
30
|
export class PieLink extends LitElement implements LinkProps {
|
|
30
31
|
@property()
|
|
31
|
-
@validPropertyValues(componentSelector, tags,
|
|
32
|
-
public tag: LinkProps['tag'] =
|
|
32
|
+
@validPropertyValues(componentSelector, tags, defaultProps.tag)
|
|
33
|
+
public tag: LinkProps['tag'] = defaultProps.tag;
|
|
33
34
|
|
|
34
35
|
@property({ type: String })
|
|
35
|
-
@validPropertyValues(componentSelector, variants,
|
|
36
|
-
public variant: LinkProps['variant'] =
|
|
36
|
+
@validPropertyValues(componentSelector, variants, defaultProps.variant)
|
|
37
|
+
public variant: LinkProps['variant'] = defaultProps.variant;
|
|
37
38
|
|
|
38
39
|
@property({ type: String })
|
|
39
|
-
@validPropertyValues(componentSelector, sizes,
|
|
40
|
-
public size: LinkProps['size'] =
|
|
40
|
+
@validPropertyValues(componentSelector, sizes, defaultProps.size)
|
|
41
|
+
public size: LinkProps['size'] = defaultProps.size;
|
|
41
42
|
|
|
42
43
|
@property({ type: String })
|
|
43
|
-
@validPropertyValues(componentSelector, underlineTypes,
|
|
44
|
-
public underline: LinkProps['underline'] =
|
|
44
|
+
@validPropertyValues(componentSelector, underlineTypes, defaultProps.underline)
|
|
45
|
+
public underline: LinkProps['underline'] = defaultProps.underline;
|
|
45
46
|
|
|
46
47
|
@property({ type: String })
|
|
47
|
-
@validPropertyValues(componentSelector, iconPlacements,
|
|
48
|
-
public iconPlacement: LinkProps['iconPlacement'] =
|
|
48
|
+
@validPropertyValues(componentSelector, iconPlacements, defaultProps.iconPlacement)
|
|
49
|
+
public iconPlacement: LinkProps['iconPlacement'] = defaultProps.iconPlacement;
|
|
49
50
|
|
|
50
51
|
@property({ type: String, reflect: true })
|
|
51
52
|
public href?: string;
|
|
@@ -57,17 +58,17 @@ export class PieLink extends LitElement implements LinkProps {
|
|
|
57
58
|
public rel?: string;
|
|
58
59
|
|
|
59
60
|
@property({ type: Boolean })
|
|
60
|
-
public isBold =
|
|
61
|
+
public isBold = defaultProps.isBold;
|
|
61
62
|
|
|
62
63
|
@property({ type: Boolean })
|
|
63
|
-
public isStandalone =
|
|
64
|
+
public isStandalone = defaultProps.isStandalone;
|
|
64
65
|
|
|
65
66
|
@property({ type: Boolean })
|
|
66
|
-
public hasVisited =
|
|
67
|
+
public hasVisited = defaultProps.hasVisited;
|
|
67
68
|
|
|
68
69
|
@property()
|
|
69
|
-
@validPropertyValues(componentSelector, buttonTypes,
|
|
70
|
-
public type: LinkProps['type'] =
|
|
70
|
+
@validPropertyValues(componentSelector, buttonTypes, defaultProps.type)
|
|
71
|
+
public type: LinkProps['type'] = defaultProps.type;
|
|
71
72
|
|
|
72
73
|
@property({ type: Object })
|
|
73
74
|
public aria!: AriaProps;
|