@justeattakeaway/pie-button 0.6.1 → 0.7.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 +6 -7
- package/CHANGELOG.md +10 -0
- package/dist/pie-button.js +39 -35
- package/package.json +5 -2
- package/src/decorators.ts +5 -5
- package/src/index.ts +9 -2
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
@justeattakeaway/pie-button:build: [2mdist/[22m[36mpie-button.js [39m[1m[2m3.52 kB[22m[1m[22m[2m │ gzip: 1.49 kB[22m
|
|
1
|
+
[36mvite v4.0.4 [32mbuilding for production...[36m[39m
|
|
2
|
+
transforming...
|
|
3
|
+
[32m✓[39m 4 modules transformed.
|
|
4
|
+
rendering chunks...
|
|
5
|
+
computing gzip size...
|
|
6
|
+
[2mdist/[22m[36mpie-button.js [39m[1m[2m3.69 kB[22m[1m[22m[2m │ gzip: 1.55 kB[22m
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.7.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [Updated] button to handle custom events ([#309](https://github.com/justeattakeaway/pie/pull/309)) by [@FayeCarter](https://github.com/FayeCarter)
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Add missing Volta settings to package.json ([#322](https://github.com/justeattakeaway/pie/pull/322)) by [@fernandofranca](https://github.com/fernandofranca)
|
|
12
|
+
|
|
3
13
|
## 0.6.1
|
|
4
14
|
|
|
5
15
|
### Patch Changes
|
package/dist/pie-button.js
CHANGED
|
@@ -1,70 +1,74 @@
|
|
|
1
|
-
import { unsafeCSS as f, LitElement as
|
|
1
|
+
import { unsafeCSS as f, LitElement as h, html as g } from "lit";
|
|
2
2
|
import { classMap as m } from "lit/directives/class-map.js";
|
|
3
3
|
import { property as p, customElement as v } from "lit/decorators.js";
|
|
4
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,
|
|
6
|
-
const e =
|
|
7
|
-
Object.defineProperty(
|
|
5
|
+
`, u = (o, n) => function(i, t) {
|
|
6
|
+
const e = `#${t}`;
|
|
7
|
+
Object.defineProperty(i, t, {
|
|
8
8
|
get() {
|
|
9
|
-
return
|
|
9
|
+
return this[e];
|
|
10
10
|
},
|
|
11
|
-
set(
|
|
12
|
-
const
|
|
13
|
-
o.includes(
|
|
14
|
-
`[pie-button] Invalid value "${
|
|
11
|
+
set(r) {
|
|
12
|
+
const s = this[e];
|
|
13
|
+
o.includes(r) ? this[e] = r : (console.error(
|
|
14
|
+
`[pie-button] Invalid value "${r}" provided for property "${t}".`,
|
|
15
15
|
`Must be one of: ${o.join(" | ")}.`,
|
|
16
|
-
`Falling back to default value: "${
|
|
17
|
-
),
|
|
16
|
+
`Falling back to default value: "${n}"`
|
|
17
|
+
), this[e] = n), this.requestUpdate(t, s);
|
|
18
18
|
}
|
|
19
19
|
});
|
|
20
20
|
};
|
|
21
|
-
var c = /* @__PURE__ */ ((o) => (o.XSMALL = "xsmall", o.SMALL = "small", o.MEDIUM = "medium", o.LARGE = "large", o))(c || {}),
|
|
22
|
-
for (var e =
|
|
23
|
-
(
|
|
24
|
-
return
|
|
21
|
+
var c = /* @__PURE__ */ ((o) => (o.XSMALL = "xsmall", o.SMALL = "small", o.MEDIUM = "medium", o.LARGE = "large", o))(c || {}), d = /* @__PURE__ */ ((o) => (o.SUBMIT = "submit", o.BUTTON = "button", o.RESET = "reset", o.MENU = "menu", o))(d || {}), b = /* @__PURE__ */ ((o) => (o.PRIMARY = "primary", o.SECONDARY = "secondary", o.OUTLINE = "outline", o.GHOST = "ghost", o))(b || {}), y = Object.defineProperty, M = Object.getOwnPropertyDescriptor, a = (o, n, i, t) => {
|
|
22
|
+
for (var e = t > 1 ? void 0 : t ? M(n, i) : n, r = o.length - 1, s; r >= 0; r--)
|
|
23
|
+
(s = o[r]) && (e = (t ? s(n, i, e) : s(e)) || e);
|
|
24
|
+
return t && e && y(n, i, e), e;
|
|
25
25
|
};
|
|
26
|
-
let
|
|
26
|
+
let l = class extends h {
|
|
27
27
|
constructor() {
|
|
28
|
-
super(...arguments), this.size = c.MEDIUM, this.type =
|
|
28
|
+
super(...arguments), this.size = c.MEDIUM, this.type = d.SUBMIT, this.variant = b.PRIMARY, this.disabled = !1;
|
|
29
29
|
}
|
|
30
30
|
render() {
|
|
31
|
-
const { size: o, type:
|
|
31
|
+
const { size: o, type: n, variant: i, disabled: t } = this, e = {
|
|
32
32
|
"o-btn": !0,
|
|
33
33
|
[`o-btn--${o}`]: o,
|
|
34
|
-
[`o-btn--${
|
|
35
|
-
"o-btn--is-disabled":
|
|
34
|
+
[`o-btn--${i}`]: i,
|
|
35
|
+
"o-btn--is-disabled": t
|
|
36
|
+
}, r = () => {
|
|
37
|
+
const s = new Event("CustomEvent");
|
|
38
|
+
console.info("WC event dispatched"), this.dispatchEvent(s);
|
|
36
39
|
};
|
|
37
|
-
return
|
|
40
|
+
return g`
|
|
38
41
|
<button
|
|
39
42
|
class=${m(e)}
|
|
40
|
-
type=${
|
|
41
|
-
?disabled=${
|
|
43
|
+
type=${n}
|
|
44
|
+
?disabled=${t}
|
|
45
|
+
@click="${r}">
|
|
42
46
|
I'm a PIE button
|
|
43
47
|
</button>`;
|
|
44
48
|
}
|
|
45
49
|
};
|
|
46
|
-
|
|
50
|
+
l.styles = f(x);
|
|
47
51
|
a([
|
|
48
52
|
p(),
|
|
49
53
|
u(Object.values(c), c.MEDIUM)
|
|
50
|
-
],
|
|
54
|
+
], l.prototype, "size", 2);
|
|
51
55
|
a([
|
|
52
56
|
p(),
|
|
53
|
-
u(Object.values(
|
|
54
|
-
],
|
|
57
|
+
u(Object.values(d), d.SUBMIT)
|
|
58
|
+
], l.prototype, "type", 2);
|
|
55
59
|
a([
|
|
56
60
|
p(),
|
|
57
|
-
u(Object.values(
|
|
58
|
-
],
|
|
61
|
+
u(Object.values(b), b.PRIMARY)
|
|
62
|
+
], l.prototype, "variant", 2);
|
|
59
63
|
a([
|
|
60
64
|
p()
|
|
61
|
-
],
|
|
62
|
-
|
|
65
|
+
], l.prototype, "disabled", 2);
|
|
66
|
+
l = a([
|
|
63
67
|
v("pie-button")
|
|
64
|
-
],
|
|
68
|
+
], l);
|
|
65
69
|
export {
|
|
66
70
|
c as BUTTON_SIZE,
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
71
|
+
d as BUTTON_TYPE,
|
|
72
|
+
b as BUTTON_VARIANT,
|
|
73
|
+
l as PieButton
|
|
70
74
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@justeattakeaway/pie-button",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "PIE design system button built using web components",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/pie-button.js",
|
|
@@ -11,5 +11,8 @@
|
|
|
11
11
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
12
12
|
},
|
|
13
13
|
"author": "JustEatTakeaway - Design System Web Team",
|
|
14
|
-
"license": "Apache-2.0"
|
|
14
|
+
"license": "Apache-2.0",
|
|
15
|
+
"volta": {
|
|
16
|
+
"extends": "../../../package.json"
|
|
17
|
+
}
|
|
15
18
|
}
|
package/src/decorators.ts
CHANGED
|
@@ -7,14 +7,14 @@
|
|
|
7
7
|
*/
|
|
8
8
|
export const validPropertyValues = (validValues: any[], defaultValue: any) => {
|
|
9
9
|
return function (target: any, propertyKey: string) : void {
|
|
10
|
-
const privatePropertyKey =
|
|
10
|
+
const privatePropertyKey = `#${propertyKey}`;
|
|
11
11
|
|
|
12
12
|
Object.defineProperty(target, propertyKey, {
|
|
13
13
|
get () : any {
|
|
14
|
-
return
|
|
14
|
+
return this[privatePropertyKey];
|
|
15
15
|
},
|
|
16
16
|
set (value: any) : void {
|
|
17
|
-
const oldValue =
|
|
17
|
+
const oldValue = this[privatePropertyKey];
|
|
18
18
|
|
|
19
19
|
if (!validValues.includes(value)) {
|
|
20
20
|
console.error(
|
|
@@ -22,9 +22,9 @@ export const validPropertyValues = (validValues: any[], defaultValue: any) => {
|
|
|
22
22
|
`Must be one of: ${validValues.join(' | ')}.`,
|
|
23
23
|
`Falling back to default value: "${defaultValue}"`
|
|
24
24
|
);
|
|
25
|
-
|
|
25
|
+
this[privatePropertyKey] = defaultValue;
|
|
26
26
|
} else {
|
|
27
|
-
|
|
27
|
+
this[privatePropertyKey] = value;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
this.requestUpdate(propertyKey, oldValue);
|
package/src/index.ts
CHANGED
|
@@ -36,15 +36,22 @@ export class PieButton extends LitElement {
|
|
|
36
36
|
'o-btn--is-disabled': disabled,
|
|
37
37
|
};
|
|
38
38
|
|
|
39
|
+
const raiseWCEvent = () => {
|
|
40
|
+
const event = new Event('CustomEvent')
|
|
41
|
+
console.info('WC event dispatched')
|
|
42
|
+
this.dispatchEvent(event)
|
|
43
|
+
}
|
|
44
|
+
|
|
39
45
|
return html`
|
|
40
46
|
<button
|
|
41
47
|
class=${classMap(classes)}
|
|
42
48
|
type=${type}
|
|
43
|
-
?disabled=${disabled}
|
|
49
|
+
?disabled=${disabled}
|
|
50
|
+
@click="${raiseWCEvent}">
|
|
44
51
|
I'm a PIE button
|
|
45
52
|
</button>`;
|
|
46
53
|
}
|
|
47
54
|
|
|
48
55
|
// Renders a `CSSResult` generated from SCSS by Vite
|
|
49
56
|
static styles = unsafeCSS(styles);
|
|
50
|
-
}
|
|
57
|
+
}
|