@justeattakeaway/pie-button 0.4.0 → 0.5.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/.turbo/turbo-build.log +2 -2
- package/CHANGELOG.md +16 -0
- package/declaration.d.ts +0 -1
- package/dist/pie-button.js +47 -41
- package/package.json +1 -1
- package/src/button.scss +56 -2
- package/src/defs.ts +16 -36
- package/src/index.ts +12 -13
- package/index.html +0 -55
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 c2fea04222d5810e
|
|
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[2m2.73 kB[22m[1m[22m[2m │ gzip: 1.29 kB[22m
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.5.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [Changed] - Replaced hard-coded font values with scss variables ([#226](https://github.com/justeattakeaway/pie/pull/226)) by [@LTurns](https://github.com/LTurns)
|
|
8
|
+
|
|
9
|
+
## 0.5.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- [Changed] - Bring button styles into the component ([#178](https://github.com/justeattakeaway/pie/pull/178)) by [@xander-marjoram](https://github.com/xander-marjoram)
|
|
14
|
+
|
|
15
|
+
- [Added] - Size property to pie-button component ([#178](https://github.com/justeattakeaway/pie/pull/178)) by [@xander-marjoram](https://github.com/xander-marjoram)
|
|
16
|
+
|
|
17
|
+
- [Removed] - index.html file in favour of Storybook ([#178](https://github.com/justeattakeaway/pie/pull/178)) by [@xander-marjoram](https://github.com/xander-marjoram)
|
|
18
|
+
|
|
3
19
|
## 0.4.0
|
|
4
20
|
|
|
5
21
|
### Minor Changes
|
package/declaration.d.ts
CHANGED
package/dist/pie-button.js
CHANGED
|
@@ -1,59 +1,65 @@
|
|
|
1
|
-
import { unsafeCSS as
|
|
2
|
-
import { classMap as
|
|
3
|
-
import { property as
|
|
4
|
-
const v =
|
|
5
|
-
`,
|
|
6
|
-
const
|
|
7
|
-
Object.defineProperty(
|
|
1
|
+
import { unsafeCSS as d, LitElement as m, html as h } from "lit";
|
|
2
|
+
import { classMap as x } from "lit/directives/class-map.js";
|
|
3
|
+
import { property as b, customElement as g } from "lit/decorators.js";
|
|
4
|
+
const v = `.o-btn{border-radius:50rem;border:none;font-family:JetSansDigital;font-weight:700}.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--secondary{background-color:#f5f3f1;color:#242e30}.o-btn--outline{border:1px solid #dbd9d7;background-color:#fff;color:#303d3f}.o-btn--ghost{background-color:#fff;color:#242e30}
|
|
5
|
+
`, f = (t, r) => function(e, n) {
|
|
6
|
+
const o = `_${n}`;
|
|
7
|
+
Object.defineProperty(e, n, {
|
|
8
8
|
get() {
|
|
9
|
-
return
|
|
9
|
+
return e[o];
|
|
10
10
|
},
|
|
11
11
|
set(i) {
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
`[pie-button] Invalid value "${i}" provided for property "${
|
|
15
|
-
`Must be one of: ${
|
|
12
|
+
const p = e[o];
|
|
13
|
+
t.includes(i) ? e[o] = i : (console.error(
|
|
14
|
+
`[pie-button] Invalid value "${i}" provided for property "${n}".`,
|
|
15
|
+
`Must be one of: ${t.join(" | ")}.`,
|
|
16
16
|
`Falling back to default value: "${r}"`
|
|
17
|
-
),
|
|
17
|
+
), e[o] = r), this.requestUpdate(n, p);
|
|
18
18
|
}
|
|
19
19
|
});
|
|
20
20
|
};
|
|
21
|
-
var l = /* @__PURE__ */ ((
|
|
22
|
-
for (var
|
|
23
|
-
(
|
|
24
|
-
return
|
|
21
|
+
var l = /* @__PURE__ */ ((t) => (t.XSMALL = "xsmall", t.SMALL = "small", t.MEDIUM = "medium", t.LARGE = "large", t))(l || {}), a = /* @__PURE__ */ ((t) => (t.SUBMIT = "submit", t.BUTTON = "button", t.RESET = "reset", t.MENU = "menu", t))(a || {}), u = /* @__PURE__ */ ((t) => (t.PRIMARY = "primary", t.SECONDARY = "secondary", t.OUTLINE = "outline", t.GHOST = "ghost", t))(u || {}), M = Object.defineProperty, y = Object.getOwnPropertyDescriptor, c = (t, r, e, n) => {
|
|
22
|
+
for (var o = n > 1 ? void 0 : n ? y(r, e) : r, i = t.length - 1, p; i >= 0; i--)
|
|
23
|
+
(p = t[i]) && (o = (n ? p(r, e, o) : p(o)) || o);
|
|
24
|
+
return n && o && M(r, e, o), o;
|
|
25
25
|
};
|
|
26
|
-
let
|
|
26
|
+
let s = class extends m {
|
|
27
27
|
constructor() {
|
|
28
|
-
super(...arguments), this.type =
|
|
28
|
+
super(...arguments), this.size = l.MEDIUM, this.type = a.SUBMIT, this.variant = u.PRIMARY;
|
|
29
29
|
}
|
|
30
30
|
render() {
|
|
31
|
-
const { type:
|
|
32
|
-
|
|
33
|
-
[`o-btn--${
|
|
34
|
-
|
|
35
|
-
|
|
31
|
+
const { size: t, type: r, variant: e } = this, n = {
|
|
32
|
+
"o-btn": !0,
|
|
33
|
+
[`o-btn--${t}`]: t,
|
|
34
|
+
[`o-btn--${e}`]: e
|
|
35
|
+
};
|
|
36
|
+
return h`
|
|
36
37
|
<button
|
|
37
|
-
class
|
|
38
|
-
type=${
|
|
38
|
+
class=${x(n)}
|
|
39
|
+
type=${r}>
|
|
39
40
|
I'm a PIE button
|
|
40
41
|
</button>`;
|
|
41
42
|
}
|
|
42
43
|
};
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
],
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
],
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
44
|
+
s.styles = d(v);
|
|
45
|
+
c([
|
|
46
|
+
b(),
|
|
47
|
+
f(Object.values(l), l.MEDIUM)
|
|
48
|
+
], s.prototype, "size", 2);
|
|
49
|
+
c([
|
|
50
|
+
b(),
|
|
51
|
+
f(Object.values(a), a.SUBMIT)
|
|
52
|
+
], s.prototype, "type", 2);
|
|
53
|
+
c([
|
|
54
|
+
b(),
|
|
55
|
+
f(Object.values(u), u.PRIMARY)
|
|
56
|
+
], s.prototype, "variant", 2);
|
|
57
|
+
s = c([
|
|
58
|
+
g("pie-button")
|
|
59
|
+
], s);
|
|
55
60
|
export {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
61
|
+
l as BUTTON_SIZE,
|
|
62
|
+
a as BUTTON_TYPE,
|
|
63
|
+
u as BUTTON_VARIANT,
|
|
64
|
+
s as PieButton
|
|
59
65
|
};
|
package/package.json
CHANGED
package/src/button.scss
CHANGED
|
@@ -1,3 +1,57 @@
|
|
|
1
|
-
@use '@justeat/
|
|
1
|
+
@use '@justeat/pie-design-tokens/dist/jet.scss' as dt;
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
.o-btn {
|
|
4
|
+
border-radius: dt.$radius-rounded-e;
|
|
5
|
+
border: none;
|
|
6
|
+
font-family: dt.$font-interactive-m-family;
|
|
7
|
+
font-weight: dt.$font-interactive-m-weight;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.o-btn--xsmall {
|
|
11
|
+
padding: 6px dt.$spacing-b;
|
|
12
|
+
min-height: 32px;
|
|
13
|
+
font-size: dt.$font-size-14 * 1px;
|
|
14
|
+
line-height: dt.$font-size-14-line-height * 1px;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.o-btn--small {
|
|
18
|
+
padding: 8px dt.$spacing-d;
|
|
19
|
+
min-height: 40px;
|
|
20
|
+
font-size: dt.$font-size-19 * 1px;
|
|
21
|
+
line-height: dt.$font-size-19-line-height * 1px;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.o-btn--medium {
|
|
25
|
+
padding: 10px dt.$spacing-e;
|
|
26
|
+
min-height: 48px;
|
|
27
|
+
font-size: dt.$font-size-20 * 1px;
|
|
28
|
+
line-height: dt.$font-size-20-line-height * 1px;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.o-btn--large {
|
|
32
|
+
padding: 14px dt.$spacing-e;
|
|
33
|
+
min-height: 56px;
|
|
34
|
+
font-size: dt.$font-size-20 * 1px;
|
|
35
|
+
line-height: dt.$font-size-20-line-height * 1px;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.o-btn--primary {
|
|
39
|
+
background-color: dt.$color-interactive-brand;
|
|
40
|
+
color: dt.$color-content-interactive-primary;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.o-btn--secondary {
|
|
44
|
+
background-color: dt.$color-interactive-secondary;
|
|
45
|
+
color: dt.$color-content-interactive-secondary;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.o-btn--outline {
|
|
49
|
+
border: 1px solid dt.$color-border-strong;
|
|
50
|
+
background-color: dt.$color-container-default;
|
|
51
|
+
color: dt.$color-content-interactive-tertiary;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.o-btn--ghost {
|
|
55
|
+
background-color: dt.$color-container-default;
|
|
56
|
+
color: dt.$color-content-link;
|
|
57
|
+
}
|
package/src/defs.ts
CHANGED
|
@@ -1,49 +1,29 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Button
|
|
2
|
+
* Button size variants
|
|
3
3
|
*/
|
|
4
|
-
export enum
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Secondary button.
|
|
12
|
-
*/
|
|
13
|
-
SECONDARY = 'secondary',
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Outline button.
|
|
17
|
-
*/
|
|
18
|
-
OUTLINE = 'outline',
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Ghost button.
|
|
22
|
-
*/
|
|
23
|
-
GHOST = 'ghost'
|
|
4
|
+
export enum BUTTON_SIZE {
|
|
5
|
+
XSMALL = 'xsmall',
|
|
6
|
+
SMALL = 'small',
|
|
7
|
+
MEDIUM = 'medium',
|
|
8
|
+
LARGE = 'large'
|
|
24
9
|
}
|
|
25
10
|
|
|
26
11
|
/**
|
|
27
12
|
* Button style variants
|
|
28
13
|
*/
|
|
29
14
|
export enum BUTTON_TYPE {
|
|
30
|
-
/**
|
|
31
|
-
* Submit button.
|
|
32
|
-
*/
|
|
33
15
|
SUBMIT = 'submit',
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Standard button.
|
|
37
|
-
*/
|
|
38
16
|
BUTTON = 'button',
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* Reset button.
|
|
42
|
-
*/
|
|
43
17
|
RESET = 'reset',
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* Menu button.
|
|
47
|
-
*/
|
|
48
18
|
MENU = 'menu'
|
|
49
19
|
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Button style variants
|
|
23
|
+
*/
|
|
24
|
+
export enum BUTTON_VARIANT {
|
|
25
|
+
PRIMARY = 'primary',
|
|
26
|
+
SECONDARY = 'secondary',
|
|
27
|
+
OUTLINE = 'outline',
|
|
28
|
+
GHOST = 'ghost'
|
|
29
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -4,38 +4,37 @@ import { customElement, property } from 'lit/decorators.js';
|
|
|
4
4
|
|
|
5
5
|
import styles from './button.scss?inline';
|
|
6
6
|
import { validPropertyValues } from './decorators';
|
|
7
|
-
import { BUTTON_TYPE, BUTTON_VARIANT } from './defs';
|
|
7
|
+
import { BUTTON_SIZE, BUTTON_TYPE, BUTTON_VARIANT } from './defs';
|
|
8
8
|
|
|
9
9
|
// Valid values available to consumers
|
|
10
|
-
export { BUTTON_TYPE, BUTTON_VARIANT };
|
|
10
|
+
export { BUTTON_SIZE, BUTTON_TYPE, BUTTON_VARIANT };
|
|
11
11
|
|
|
12
12
|
@customElement('pie-button')
|
|
13
13
|
export class PieButton extends LitElement {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
@property()
|
|
15
|
+
@validPropertyValues(Object.values(BUTTON_SIZE), BUTTON_SIZE.MEDIUM)
|
|
16
|
+
size : BUTTON_SIZE = BUTTON_SIZE.MEDIUM;
|
|
17
|
+
|
|
17
18
|
@property()
|
|
18
19
|
@validPropertyValues(Object.values(BUTTON_TYPE), BUTTON_TYPE.SUBMIT)
|
|
19
20
|
type : BUTTON_TYPE = BUTTON_TYPE.SUBMIT;
|
|
20
21
|
|
|
21
|
-
/**
|
|
22
|
-
* The Button style variant to use
|
|
23
|
-
*/
|
|
24
22
|
@property()
|
|
25
23
|
@validPropertyValues(Object.values(BUTTON_VARIANT), BUTTON_VARIANT.PRIMARY)
|
|
26
24
|
variant : BUTTON_VARIANT = BUTTON_VARIANT.PRIMARY;
|
|
27
25
|
|
|
28
26
|
render () {
|
|
29
|
-
const { type, variant } = this;
|
|
27
|
+
const { size, type, variant } = this;
|
|
30
28
|
|
|
31
|
-
const classes =
|
|
32
|
-
|
|
29
|
+
const classes = {
|
|
30
|
+
'o-btn': true,
|
|
31
|
+
[`o-btn--${size}`]: size,
|
|
33
32
|
[`o-btn--${variant}`]: variant
|
|
34
|
-
}
|
|
33
|
+
};
|
|
35
34
|
|
|
36
35
|
return html`
|
|
37
36
|
<button
|
|
38
|
-
class
|
|
37
|
+
class=${classMap(classes)}
|
|
39
38
|
type=${type}>
|
|
40
39
|
I'm a PIE button
|
|
41
40
|
</button>`;
|
package/index.html
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
|
|
4
|
-
<head>
|
|
5
|
-
<meta charset="UTF-8" />
|
|
6
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
|
-
<link rel="stylesheet" href="https://unpkg.com/@justeat/pie-design-tokens@latest/dist/jet.css">
|
|
8
|
-
<link rel="preload" href="https://d30v2pzvrfyzpo.cloudfront.net/fonts/JETSansDigital-Regular-optimised.woff2"
|
|
9
|
-
as="font" type="font/woff2" crossorigin>
|
|
10
|
-
<style>
|
|
11
|
-
@font-face {
|
|
12
|
-
font-family: JETSansDigital;
|
|
13
|
-
src: url('https://d30v2pzvrfyzpo.cloudfront.net/fonts/JETSansDigital-Regular-optimised.woff2') format("woff2"),
|
|
14
|
-
url('https://d30v2pzvrfyzpo.cloudfront.net/fonts/JETSansDigital-Regular-optimised.woff') format("woff");
|
|
15
|
-
font-weight: 400;
|
|
16
|
-
font-display: swap;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
body {
|
|
20
|
-
font-feature-settings: "tnum";
|
|
21
|
-
/* Enable tabular numbers */
|
|
22
|
-
}
|
|
23
|
-
</style>
|
|
24
|
-
<script type="module" src="/src/index.ts"></script>
|
|
25
|
-
</head>
|
|
26
|
-
|
|
27
|
-
<body>
|
|
28
|
-
<!-- This is a temporary file for testing until Storybook is in place -->
|
|
29
|
-
<!-- Run `yarn dev` to serve this file -->
|
|
30
|
-
<pie-button type="button" variant="primary" />
|
|
31
|
-
|
|
32
|
-
<script>
|
|
33
|
-
(function () {
|
|
34
|
-
var boldFontUrls = 'url("https://d30v2pzvrfyzpo.cloudfront.net/fonts/JETSansDigital-Bold-optimised.woff2") format("woff2"), url("https://d30v2pzvrfyzpo.cloudfront.net/fonts/ JETSansDigital-Bold-optimised.woff") format("woff")';
|
|
35
|
-
var extraboldFontUrls = 'url("https://d30v2pzvrfyzpo.cloudfront.net/fonts/JETSansDigital-ExtraBold-optimised.woff2") format("woff2"), url("https://d30v2pzvrfyzpo.cloudfront.net/fonts/ JETSansDigital-ExtraBold-optimised.woff") format("woff")';
|
|
36
|
-
|
|
37
|
-
if ('fonts' in document) {
|
|
38
|
-
var bold = new FontFace('JETSansDigital', boldFontUrls, { weight: '700' });
|
|
39
|
-
var extrabold = new FontFace('JETSansDigital', extraboldFontUrls, { weight: '800' });
|
|
40
|
-
|
|
41
|
-
Promise.all([bold.load(), extrabold.load()])
|
|
42
|
-
.then(function (fonts) {
|
|
43
|
-
fonts.forEach(function (font) {
|
|
44
|
-
document.fonts.add(font);
|
|
45
|
-
});
|
|
46
|
-
})
|
|
47
|
-
.then(function () {
|
|
48
|
-
document.documentElement.classList.add('webfonts-loaded');
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
})();
|
|
52
|
-
</script>
|
|
53
|
-
</body>
|
|
54
|
-
|
|
55
|
-
</html>
|