@justeattakeaway/pie-card 0.17.0 → 0.17.2
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 +27 -26
- package/dist/react.js +7 -6
- package/package.json +3 -3
- package/src/index.ts +4 -3
- package/src/react.ts +2 -3
package/dist/index.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import { unsafeCSS as
|
|
1
|
+
import { unsafeCSS as u, LitElement as p, html as g, nothing as s } from "lit";
|
|
2
|
+
import { ifDefined as h } from "lit/directives/if-defined.js";
|
|
2
3
|
import { property as d } from "lit/decorators.js";
|
|
3
|
-
import { validPropertyValues as b, defineCustomElement as
|
|
4
|
-
const
|
|
5
|
-
`,
|
|
6
|
-
var
|
|
7
|
-
for (var r = e > 1 ? void 0 : e ?
|
|
8
|
-
(
|
|
9
|
-
return e && r &&
|
|
4
|
+
import { validPropertyValues as b, defineCustomElement as m } from "@justeattakeaway/pie-webc-core";
|
|
5
|
+
const y = `.c-card[isdraggable]{cursor:grab}.c-card[isdraggable]:active{cursor:grabbing}*,*:before,*:after{box-sizing:border-box}.c-card{--card-bg-color: var(--dt-color-container-default);--card-color: var(--dt-color-content-default);--card-radius: var(--dt-radius-rounded-c);--card-border-color: transparent;display:block;position:relative;color:var(--card-color);background-color:var(--card-bg-color);border:1px solid var(--card-border-color);border-radius:var(--card-radius);cursor:pointer;user-select:none;outline:none;text-decoration:none}.c-card[variant=default]{box-shadow:var(--dt-elevation-card)}.c-card[variant=default]:hover:not([disabled]){--hover-modifier: calc(-1 * var(--dt-color-hover-01));--card-bg-color: hsl(var(--dt-color-container-default-h), var(--dt-color-container-default-s), calc(var(--dt-color-container-default-l) + var(--hover-modifier)))}.c-card[variant=default]:active:not([disabled]){--active-modifier: calc(-1 * var(--dt-color-active-01));--card-bg-color: hsl(var(--dt-color-container-default-h), var(--dt-color-container-default-s), calc(var(--dt-color-container-default-l) + var(--active-modifier)))}.c-card[variant=outline]{border-color:var(--dt-color-border-strong)}.c-card[variant=outline]:hover:not([disabled]){--hover-modifier: calc(-1 * var(--dt-color-hover-01));--card-bg-color: hsl(var(--dt-color-container-default-h), var(--dt-color-container-default-s), calc(var(--dt-color-container-default-l) + var(--hover-modifier)))}.c-card[variant=outline]:active:not([disabled]){--active-modifier: calc(-1 * var(--dt-color-active-01));--card-bg-color: hsl(var(--dt-color-container-default-h), var(--dt-color-container-default-s), calc(var(--dt-color-container-default-l) + var(--active-modifier)))}.c-card[variant=inverse]{--card-bg-color: var(--dt-color-container-dark);--card-color: var(--dt-color-content-inverse);box-shadow:var(--dt-elevation-dark-card)}.c-card[variant=inverse]:hover:not([disabled]){--hover-modifier: var(--dt-color-hover-01);--card-bg-color: hsl(var(--dt-color-container-dark-h), var(--dt-color-container-dark-s), calc(var(--dt-color-container-dark-l) + var(--hover-modifier)))}.c-card[variant=inverse]:active:not([disabled]){--active-modifier: var(--dt-color-active-01);--card-bg-color: hsl(var(--dt-color-container-dark-h), var(--dt-color-container-dark-s), calc(var(--dt-color-container-dark-l) + var(--active-modifier)))}.c-card[variant=outline-inverse]{--card-bg-color: var(--dt-color-container-dark);--card-color: var(--dt-color-content-inverse);border-color:var(--dt-color-border-inverse)}.c-card[variant=outline-inverse]:hover:not([disabled]){--hover-modifier: var(--dt-color-hover-01);--card-bg-color: hsl(var(--dt-color-container-dark-h), var(--dt-color-container-dark-s), calc(var(--dt-color-container-dark-l) + var(--hover-modifier)))}.c-card[variant=outline-inverse]:active:not([disabled]){--active-modifier: var(--dt-color-active-01);--card-bg-color: hsl(var(--dt-color-container-dark-h), var(--dt-color-container-dark-s), calc(var(--dt-color-container-dark-l) + var(--active-modifier)))}.c-card[disabled]{--card-bg-color: var(--dt-color-disabled-01);cursor:not-allowed}.c-card[disabled] ::slotted(*){color:var(--dt-color-content-disabled)}.c-card[disabled] img{opacity:.5}.c-card[disabled][variant=inverse],.c-card[disabled][variant=outline-inverse]{--card-bg-color: var(--dt-color-disabled-01-inverse)}.c-card:focus-visible{box-shadow:0 0 0 2px var(--dt-color-focus-inner),0 0 0 4px var(--dt-color-focus-outer);outline:none}
|
|
6
|
+
`, $ = ["default", "outline", "inverse", "outline-inverse"], S = ["a", "button"], f = ["a", "b", "c", "d", "e", "f", "g"], k = f.flatMap((i) => [i, ...f.map((o) => `${i},${o}`)]);
|
|
7
|
+
var x = Object.defineProperty, C = Object.getOwnPropertyDescriptor, c = (i, o, a, e) => {
|
|
8
|
+
for (var r = e > 1 ? void 0 : e ? C(o, a) : o, l = i.length - 1, n; l >= 0; l--)
|
|
9
|
+
(n = i[l]) && (r = (e ? n(o, a, r) : n(r)) || r);
|
|
10
|
+
return e && r && x(o, a, r), r;
|
|
10
11
|
};
|
|
11
12
|
const v = "pie-card";
|
|
12
13
|
class t extends p {
|
|
@@ -29,13 +30,13 @@ class t extends p {
|
|
|
29
30
|
?isDraggable="${this.isDraggable}"
|
|
30
31
|
variant=${this.variant || "default"}
|
|
31
32
|
?disabled=${this.disabled}
|
|
32
|
-
href=${this.href ||
|
|
33
|
-
target=${this.target ||
|
|
34
|
-
rel=${this.rel ||
|
|
33
|
+
href=${this.href || ""}
|
|
34
|
+
target=${this.target || s}
|
|
35
|
+
rel=${this.rel || s}
|
|
35
36
|
role="link"
|
|
36
|
-
aria-label=${((a = this.aria) == null ? void 0 : a.label) ||
|
|
37
|
+
aria-label=${((a = this.aria) == null ? void 0 : a.label) || s}
|
|
37
38
|
aria-disabled=${this.disabled ? "true" : "false"}
|
|
38
|
-
style=${o
|
|
39
|
+
style=${h(o)}>
|
|
39
40
|
<slot></slot>
|
|
40
41
|
</div>
|
|
41
42
|
</a>`;
|
|
@@ -64,34 +65,34 @@ class t extends p {
|
|
|
64
65
|
disabled: a,
|
|
65
66
|
tag: e,
|
|
66
67
|
aria: r,
|
|
67
|
-
isDraggable:
|
|
68
|
-
} = this,
|
|
68
|
+
isDraggable: l
|
|
69
|
+
} = this, n = this.generatePaddingCSS();
|
|
69
70
|
return e === "a" ? this.renderAnchor() : g`
|
|
70
71
|
<div
|
|
71
72
|
class="c-card"
|
|
72
73
|
data-test-id="pie-card"
|
|
73
74
|
tag=${e || "button"}
|
|
74
|
-
?isDraggable="${
|
|
75
|
+
?isDraggable="${l}"
|
|
75
76
|
variant=${o || "default"}
|
|
76
77
|
?disabled=${a}
|
|
77
78
|
role="button"
|
|
78
79
|
tabindex="0"
|
|
79
|
-
aria-label=${(r == null ? void 0 : r.label) ||
|
|
80
|
+
aria-label=${(r == null ? void 0 : r.label) || s}
|
|
80
81
|
aria-disabled=${a ? "true" : "false"}
|
|
81
|
-
style=${
|
|
82
|
+
style=${n || ""}>
|
|
82
83
|
<slot></slot>
|
|
83
84
|
</div>
|
|
84
85
|
</div>`;
|
|
85
86
|
}
|
|
86
87
|
}
|
|
87
|
-
t.styles =
|
|
88
|
+
t.styles = u(y);
|
|
88
89
|
c([
|
|
89
90
|
d(),
|
|
90
|
-
b(v,
|
|
91
|
+
b(v, S, "button")
|
|
91
92
|
], t.prototype, "tag", 2);
|
|
92
93
|
c([
|
|
93
94
|
d(),
|
|
94
|
-
b(v,
|
|
95
|
+
b(v, $, "default")
|
|
95
96
|
], t.prototype, "variant", 2);
|
|
96
97
|
c([
|
|
97
98
|
d({ type: String, reflect: !0 })
|
|
@@ -113,12 +114,12 @@ c([
|
|
|
113
114
|
], t.prototype, "isDraggable", 2);
|
|
114
115
|
c([
|
|
115
116
|
d({ type: String }),
|
|
116
|
-
b(v,
|
|
117
|
+
b(v, k, void 0)
|
|
117
118
|
], t.prototype, "padding", 2);
|
|
118
|
-
|
|
119
|
+
m(v, t);
|
|
119
120
|
export {
|
|
120
121
|
t as PieCard,
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
122
|
+
k as paddingValues,
|
|
123
|
+
S as tags,
|
|
124
|
+
$ as variants
|
|
124
125
|
};
|
package/dist/react.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import * as a from "react";
|
|
2
2
|
import { createComponent as e } from "@lit/react";
|
|
3
3
|
import { PieCard as r } from "./index.js";
|
|
4
|
-
import { paddingValues as
|
|
4
|
+
import { paddingValues as P, tags as f, variants as l } from "./index.js";
|
|
5
5
|
import "lit";
|
|
6
|
+
import "lit/directives/if-defined.js";
|
|
6
7
|
import "lit/decorators.js";
|
|
7
8
|
import "@justeattakeaway/pie-webc-core";
|
|
8
9
|
const t = e({
|
|
@@ -11,10 +12,10 @@ const t = e({
|
|
|
11
12
|
react: a,
|
|
12
13
|
tagName: "pie-card",
|
|
13
14
|
events: {}
|
|
14
|
-
}),
|
|
15
|
+
}), n = t;
|
|
15
16
|
export {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
n as PieCard,
|
|
18
|
+
P as paddingValues,
|
|
19
|
+
f as tags,
|
|
20
|
+
l as variants
|
|
20
21
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@justeattakeaway/pie-card",
|
|
3
|
-
"version": "0.17.
|
|
3
|
+
"version": "0.17.2",
|
|
4
4
|
"description": "PIE Design System Card built using Web Components",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -33,11 +33,11 @@
|
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@custom-elements-manifest/analyzer": "0.9.0",
|
|
35
35
|
"@justeattakeaway/pie-components-config": "0.9.0",
|
|
36
|
-
"@justeattakeaway/pie-wrapper-react": "0.
|
|
36
|
+
"@justeattakeaway/pie-wrapper-react": "0.14.0",
|
|
37
37
|
"cem-plugin-module-file-extensions": "0.0.5"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@justeattakeaway/pie-webc-core": "0.17.
|
|
40
|
+
"@justeattakeaway/pie-webc-core": "0.17.1"
|
|
41
41
|
},
|
|
42
42
|
"volta": {
|
|
43
43
|
"extends": "../../../package.json"
|
package/src/index.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
html, LitElement, unsafeCSS, nothing, TemplateResult,
|
|
3
3
|
} from 'lit';
|
|
4
|
+
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
4
5
|
import { property } from 'lit/decorators.js';
|
|
5
6
|
import { validPropertyValues, defineCustomElement } from '@justeattakeaway/pie-webc-core';
|
|
6
7
|
import styles from './card.scss?inline';
|
|
@@ -66,13 +67,13 @@ export class PieCard extends LitElement implements CardProps {
|
|
|
66
67
|
?isDraggable="${this.isDraggable}"
|
|
67
68
|
variant=${this.variant || 'default'}
|
|
68
69
|
?disabled=${this.disabled}
|
|
69
|
-
href=${this.href ||
|
|
70
|
+
href=${this.href || ''}
|
|
70
71
|
target=${this.target || nothing}
|
|
71
72
|
rel=${this.rel || nothing}
|
|
72
73
|
role="link"
|
|
73
74
|
aria-label=${this.aria?.label || nothing}
|
|
74
75
|
aria-disabled=${this.disabled ? 'true' : 'false'}
|
|
75
|
-
style=${paddingCSS
|
|
76
|
+
style=${ifDefined(paddingCSS)}>
|
|
76
77
|
<slot></slot>
|
|
77
78
|
</div>
|
|
78
79
|
</a>`;
|
|
@@ -142,7 +143,7 @@ export class PieCard extends LitElement implements CardProps {
|
|
|
142
143
|
tabindex="0"
|
|
143
144
|
aria-label=${aria?.label || nothing}
|
|
144
145
|
aria-disabled=${disabled ? 'true' : 'false'}
|
|
145
|
-
style=${paddingCSS ||
|
|
146
|
+
style=${paddingCSS || ''}>
|
|
146
147
|
<slot></slot>
|
|
147
148
|
</div>
|
|
148
149
|
</div>`;
|
package/src/react.ts
CHANGED
|
@@ -15,6 +15,5 @@ const PieCardReact = createComponent({
|
|
|
15
15
|
|
|
16
16
|
type ReactBaseType = React.AnchorHTMLAttributes<HTMLAnchorElement> & React.ButtonHTMLAttributes<HTMLButtonElement>
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
export const PieCard = PieCardReact as React.ForwardRefExoticComponent<React.PropsWithoutRef<CardProps> & React.RefAttributes<PieCardLit> & ReactBaseType>;
|
|
18
|
+
export const PieCard = PieCardReact as React.ForwardRefExoticComponent<React.PropsWithoutRef<CardProps>
|
|
19
|
+
& React.RefAttributes<PieCardLit> & ReactBaseType>;
|