@justeattakeaway/pie-button 0.5.0 → 0.6.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/.turbo/turbo-build.log +2 -2
- package/CHANGELOG.md +12 -0
- package/dist/pie-button.js +42 -37
- package/package.json +1 -1
- package/src/button.scss +62 -12
- package/src/index.ts +9 -4
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
@justeattakeaway/pie-button:build: cache hit, replaying output
|
|
1
|
+
@justeattakeaway/pie-button:build: cache hit, replaying output 95e9489059d5a6b7
|
|
2
2
|
@justeattakeaway/pie-button:build: [36mvite v4.0.4 [32mbuilding for production...[36m[39m
|
|
3
3
|
@justeattakeaway/pie-button:build: transforming...
|
|
4
4
|
@justeattakeaway/pie-button:build: [32m✓[39m 4 modules transformed.
|
|
5
5
|
@justeattakeaway/pie-button:build: rendering chunks...
|
|
6
6
|
@justeattakeaway/pie-button:build: computing gzip size...
|
|
7
|
-
@justeattakeaway/pie-button:build: [2mdist/[22m[36mpie-button.js [39m[1m[
|
|
7
|
+
@justeattakeaway/pie-button:build: [2mdist/[22m[36mpie-button.js [39m[1m[2m3.52 kB[22m[1m[22m[2m │ gzip: 1.49 kB[22m
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.6.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [Added] - state styling to button (focus/hover/active/disabled) ([#234](https://github.com/justeattakeaway/pie/pull/234)) by [@raoufswe](https://github.com/raoufswe)
|
|
8
|
+
|
|
9
|
+
## 0.5.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [Changed] - Replaced hard-coded font values with scss variables ([#226](https://github.com/justeattakeaway/pie/pull/226)) by [@LTurns](https://github.com/LTurns)
|
|
14
|
+
|
|
3
15
|
## 0.5.0
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
package/dist/pie-button.js
CHANGED
|
@@ -1,65 +1,70 @@
|
|
|
1
|
-
import { unsafeCSS as
|
|
2
|
-
import { classMap as
|
|
3
|
-
import { property as
|
|
4
|
-
const
|
|
5
|
-
`,
|
|
6
|
-
const
|
|
7
|
-
Object.defineProperty(
|
|
1
|
+
import { unsafeCSS as f, LitElement as g, html as h } from "lit";
|
|
2
|
+
import { classMap as m } from "lit/directives/class-map.js";
|
|
3
|
+
import { property as p, customElement as v } from "lit/decorators.js";
|
|
4
|
+
const x = `.o-btn{border-radius:50rem;border:none;font-family:JetSansDigital;font-weight:700;cursor:pointer;user-select:none;outline:none}.o-btn:focus-visible{outline:2px solid #4996fd}.o-btn--xsmall{padding:6px 8px;min-height:32px;font-size:14px;line-height:20px}.o-btn--small{padding:8px 16px;min-height:40px;font-size:19px;line-height:28px}.o-btn--medium{padding:10px 24px;min-height:48px;font-size:20px;line-height:28px}.o-btn--large{padding:14px 24px;min-height:56px;font-size:20px;line-height:28px}.o-btn--primary{background-color:#f36805;color:#fff}.o-btn--primary:hover{background-color:#df5f05}.o-btn--primary:active{background-color:#b74e04}.o-btn--secondary{background-color:#f5f3f1;color:#242e30}.o-btn--secondary:hover{background-color:#ede9e5}.o-btn--secondary:active{background-color:#dcd4cd}.o-btn--outline{outline:1px solid #dbd9d7;background-color:#fff;color:#303d3f}.o-btn--outline:hover{background-color:#f5f5f5}.o-btn--outline:active{background-color:#e0e0e0}.o-btn--ghost{background-color:#fff;color:#242e30}.o-btn--ghost:hover{background-color:#f5f5f5}.o-btn--ghost:active{background-color:#e0e0e0}.o-btn.o-btn--is-disabled{background-color:#efedea;color:#8c999b;outline:1px solid #efedea;cursor:default}.o-btn.o-btn--is-disabled.o-btn--ghost{background-color:#fff;outline:none}
|
|
5
|
+
`, u = (o, r) => function(t, n) {
|
|
6
|
+
const e = `_${n}`;
|
|
7
|
+
Object.defineProperty(t, n, {
|
|
8
8
|
get() {
|
|
9
|
-
return e
|
|
9
|
+
return t[e];
|
|
10
10
|
},
|
|
11
11
|
set(i) {
|
|
12
|
-
const
|
|
13
|
-
|
|
12
|
+
const l = t[e];
|
|
13
|
+
o.includes(i) ? t[e] = i : (console.error(
|
|
14
14
|
`[pie-button] Invalid value "${i}" provided for property "${n}".`,
|
|
15
|
-
`Must be one of: ${
|
|
15
|
+
`Must be one of: ${o.join(" | ")}.`,
|
|
16
16
|
`Falling back to default value: "${r}"`
|
|
17
|
-
), e
|
|
17
|
+
), t[e] = r), this.requestUpdate(n, l);
|
|
18
18
|
}
|
|
19
19
|
});
|
|
20
20
|
};
|
|
21
|
-
var
|
|
22
|
-
for (var
|
|
23
|
-
(
|
|
24
|
-
return n &&
|
|
21
|
+
var c = /* @__PURE__ */ ((o) => (o.XSMALL = "xsmall", o.SMALL = "small", o.MEDIUM = "medium", o.LARGE = "large", o))(c || {}), b = /* @__PURE__ */ ((o) => (o.SUBMIT = "submit", o.BUTTON = "button", o.RESET = "reset", o.MENU = "menu", o))(b || {}), d = /* @__PURE__ */ ((o) => (o.PRIMARY = "primary", o.SECONDARY = "secondary", o.OUTLINE = "outline", o.GHOST = "ghost", o))(d || {}), y = Object.defineProperty, M = Object.getOwnPropertyDescriptor, a = (o, r, t, n) => {
|
|
22
|
+
for (var e = n > 1 ? void 0 : n ? M(r, t) : r, i = o.length - 1, l; i >= 0; i--)
|
|
23
|
+
(l = o[i]) && (e = (n ? l(r, t, e) : l(e)) || e);
|
|
24
|
+
return n && e && y(r, t, e), e;
|
|
25
25
|
};
|
|
26
|
-
let s = class extends
|
|
26
|
+
let s = class extends g {
|
|
27
27
|
constructor() {
|
|
28
|
-
super(...arguments), this.size =
|
|
28
|
+
super(...arguments), this.size = c.MEDIUM, this.type = b.SUBMIT, this.variant = d.PRIMARY, this.disabled = !1;
|
|
29
29
|
}
|
|
30
30
|
render() {
|
|
31
|
-
const { size:
|
|
31
|
+
const { size: o, type: r, variant: t, disabled: n } = this, e = {
|
|
32
32
|
"o-btn": !0,
|
|
33
|
+
[`o-btn--${o}`]: o,
|
|
33
34
|
[`o-btn--${t}`]: t,
|
|
34
|
-
|
|
35
|
+
"o-btn--is-disabled": n
|
|
35
36
|
};
|
|
36
37
|
return h`
|
|
37
38
|
<button
|
|
38
|
-
class=${
|
|
39
|
-
type=${r}
|
|
39
|
+
class=${m(e)}
|
|
40
|
+
type=${r}
|
|
41
|
+
?disabled=${n}>
|
|
40
42
|
I'm a PIE button
|
|
41
43
|
</button>`;
|
|
42
44
|
}
|
|
43
45
|
};
|
|
44
|
-
s.styles =
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
46
|
+
s.styles = f(x);
|
|
47
|
+
a([
|
|
48
|
+
p(),
|
|
49
|
+
u(Object.values(c), c.MEDIUM)
|
|
48
50
|
], s.prototype, "size", 2);
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
51
|
+
a([
|
|
52
|
+
p(),
|
|
53
|
+
u(Object.values(b), b.SUBMIT)
|
|
52
54
|
], s.prototype, "type", 2);
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
55
|
+
a([
|
|
56
|
+
p(),
|
|
57
|
+
u(Object.values(d), d.PRIMARY)
|
|
56
58
|
], s.prototype, "variant", 2);
|
|
57
|
-
|
|
58
|
-
|
|
59
|
+
a([
|
|
60
|
+
p()
|
|
61
|
+
], s.prototype, "disabled", 2);
|
|
62
|
+
s = a([
|
|
63
|
+
v("pie-button")
|
|
59
64
|
], s);
|
|
60
65
|
export {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
66
|
+
c as BUTTON_SIZE,
|
|
67
|
+
b as BUTTON_TYPE,
|
|
68
|
+
d as BUTTON_VARIANT,
|
|
64
69
|
s as PieButton
|
|
65
70
|
};
|
package/package.json
CHANGED
package/src/button.scss
CHANGED
|
@@ -5,56 +5,106 @@
|
|
|
5
5
|
border: none;
|
|
6
6
|
font-family: dt.$font-interactive-m-family;
|
|
7
7
|
font-weight: dt.$font-interactive-m-weight;
|
|
8
|
-
}
|
|
9
8
|
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
cursor: pointer;
|
|
10
|
+
user-select: none;
|
|
11
|
+
outline: none;
|
|
12
|
+
|
|
13
|
+
&:focus-visible {
|
|
14
|
+
outline: 2px solid dt.$color-focus;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
12
17
|
|
|
13
18
|
.o-btn--xsmall {
|
|
14
19
|
padding: 6px dt.$spacing-b;
|
|
15
20
|
min-height: 32px;
|
|
16
|
-
font-size:
|
|
17
|
-
line-height:
|
|
21
|
+
font-size: dt.$font-size-14 * 1px;
|
|
22
|
+
line-height: dt.$font-size-14-line-height * 1px;
|
|
18
23
|
}
|
|
19
24
|
|
|
20
25
|
.o-btn--small {
|
|
21
26
|
padding: 8px dt.$spacing-d;
|
|
22
27
|
min-height: 40px;
|
|
23
|
-
font-size:
|
|
24
|
-
line-height:
|
|
28
|
+
font-size: dt.$font-size-19 * 1px;
|
|
29
|
+
line-height: dt.$font-size-19-line-height * 1px;
|
|
25
30
|
}
|
|
26
31
|
|
|
27
32
|
.o-btn--medium {
|
|
28
33
|
padding: 10px dt.$spacing-e;
|
|
29
34
|
min-height: 48px;
|
|
30
|
-
font-size:
|
|
31
|
-
line-height:
|
|
35
|
+
font-size: dt.$font-size-20 * 1px;
|
|
36
|
+
line-height: dt.$font-size-20-line-height * 1px;
|
|
32
37
|
}
|
|
33
38
|
|
|
34
39
|
.o-btn--large {
|
|
35
40
|
padding: 14px dt.$spacing-e;
|
|
36
41
|
min-height: 56px;
|
|
37
|
-
font-size:
|
|
38
|
-
line-height:
|
|
42
|
+
font-size: dt.$font-size-20 * 1px;
|
|
43
|
+
line-height: dt.$font-size-20-line-height * 1px;
|
|
39
44
|
}
|
|
40
45
|
|
|
41
46
|
.o-btn--primary {
|
|
42
47
|
background-color: dt.$color-interactive-brand;
|
|
43
48
|
color: dt.$color-content-interactive-primary;
|
|
49
|
+
|
|
50
|
+
&:hover {
|
|
51
|
+
background-color: darken(dt.$color-interactive-brand, dt.$color-hover-01);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
&:active {
|
|
55
|
+
background-color: darken(dt.$color-interactive-brand, dt.$color-active-01);
|
|
56
|
+
}
|
|
44
57
|
}
|
|
45
58
|
|
|
46
59
|
.o-btn--secondary {
|
|
47
60
|
background-color: dt.$color-interactive-secondary;
|
|
48
61
|
color: dt.$color-content-interactive-secondary;
|
|
62
|
+
|
|
63
|
+
&:hover {
|
|
64
|
+
background-color: darken(dt.$color-interactive-secondary, dt.$color-hover-01);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
&:active {
|
|
68
|
+
background-color: darken(dt.$color-interactive-secondary, dt.$color-active-01);
|
|
69
|
+
}
|
|
49
70
|
}
|
|
50
71
|
|
|
51
72
|
.o-btn--outline {
|
|
52
|
-
|
|
73
|
+
outline: 1px solid dt.$color-border-strong;
|
|
53
74
|
background-color: dt.$color-container-default;
|
|
54
75
|
color: dt.$color-content-interactive-tertiary;
|
|
76
|
+
|
|
77
|
+
&:hover {
|
|
78
|
+
background-color: darken(dt.$color-container-default, dt.$color-hover-01);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
&:active {
|
|
82
|
+
background-color: darken(dt.$color-container-default, dt.$color-active-01);
|
|
83
|
+
}
|
|
55
84
|
}
|
|
56
85
|
|
|
57
86
|
.o-btn--ghost {
|
|
58
87
|
background-color: dt.$color-container-default;
|
|
59
88
|
color: dt.$color-content-link;
|
|
89
|
+
|
|
90
|
+
&:hover {
|
|
91
|
+
background-color: darken(dt.$color-container-default, dt.$color-hover-01);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
&:active {
|
|
95
|
+
background-color: darken(dt.$color-container-default, dt.$color-active-01);
|
|
96
|
+
}
|
|
60
97
|
}
|
|
98
|
+
|
|
99
|
+
.o-btn.o-btn--is-disabled {
|
|
100
|
+
background-color: dt.$color-disabled-01;
|
|
101
|
+
color: dt.$color-content-disabled;
|
|
102
|
+
outline: 1px solid dt.$color-disabled-01;
|
|
103
|
+
|
|
104
|
+
cursor: default;
|
|
105
|
+
|
|
106
|
+
&.o-btn--ghost {
|
|
107
|
+
background-color: dt.$color-container-default;
|
|
108
|
+
outline: none;
|
|
109
|
+
}
|
|
110
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -23,23 +23,28 @@ export class PieButton extends LitElement {
|
|
|
23
23
|
@validPropertyValues(Object.values(BUTTON_VARIANT), BUTTON_VARIANT.PRIMARY)
|
|
24
24
|
variant : BUTTON_VARIANT = BUTTON_VARIANT.PRIMARY;
|
|
25
25
|
|
|
26
|
+
@property()
|
|
27
|
+
disabled : boolean = false;
|
|
28
|
+
|
|
26
29
|
render () {
|
|
27
|
-
const { size, type, variant } = this;
|
|
30
|
+
const { size, type, variant, disabled } = this;
|
|
28
31
|
|
|
29
32
|
const classes = {
|
|
30
33
|
'o-btn': true,
|
|
31
34
|
[`o-btn--${size}`]: size,
|
|
32
|
-
[`o-btn--${variant}`]: variant
|
|
35
|
+
[`o-btn--${variant}`]: variant,
|
|
36
|
+
'o-btn--is-disabled': disabled,
|
|
33
37
|
};
|
|
34
38
|
|
|
35
39
|
return html`
|
|
36
40
|
<button
|
|
37
41
|
class=${classMap(classes)}
|
|
38
|
-
type=${type}
|
|
42
|
+
type=${type}
|
|
43
|
+
?disabled=${disabled}>
|
|
39
44
|
I'm a PIE button
|
|
40
45
|
</button>`;
|
|
41
46
|
}
|
|
42
47
|
|
|
43
48
|
// Renders a `CSSResult` generated from SCSS by Vite
|
|
44
49
|
static styles = unsafeCSS(styles);
|
|
45
|
-
}
|
|
50
|
+
}
|