@justeattakeaway/pie-button 0.7.0 → 0.9.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 +24 -1
- package/CHANGELOG.md +17 -0
- package/dist/{pie-button.js → index.js} +25 -19
- package/dist/types/index.d.ts +1 -0
- package/dist/types/src/decorators.d.ts +9 -0
- package/dist/types/src/decorators.d.ts.map +1 -0
- package/dist/types/src/defs.d.ts +28 -0
- package/dist/types/src/defs.d.ts.map +1 -0
- package/dist/types/src/index.d.ts +17 -0
- package/dist/types/src/index.d.ts.map +1 -0
- package/package.json +4 -3
- package/src/index.ts +18 -3
- package/vite.config.js +15 -8
package/.turbo/turbo-build.log
CHANGED
|
@@ -3,4 +3,27 @@ transforming...
|
|
|
3
3
|
[32m✓[39m 4 modules transformed.
|
|
4
4
|
rendering chunks...
|
|
5
5
|
computing gzip size...
|
|
6
|
-
[2mdist/[22m[
|
|
6
|
+
[2mdist/[22m[36mindex.js [39m[1m[2m3.81 kB[22m[1m[22m[2m │ gzip: 1.60 kB[22m
|
|
7
|
+
[32m
|
|
8
|
+
[36m[vite:dts][32m Start generate declaration files...[39m
|
|
9
|
+
[96m../../../node_modules/@types/react-dom/node_modules/@types/react/index.d.ts[0m:[93m3135[0m:[93m14[0m - [91merror[0m[90m TS2300: [0mDuplicate identifier 'LibraryManagedAttributes'.
|
|
10
|
+
|
|
11
|
+
[7m3135[0m type LibraryManagedAttributes<C, P> = C extends React.MemoExoticComponent<infer T> | React.LazyExoticComponent<infer T>
|
|
12
|
+
[7m [0m [91m ~~~~~~~~~~~~~~~~~~~~~~~~[0m
|
|
13
|
+
|
|
14
|
+
[96m../../../node_modules/@types/react/index.d.ts[0m:[93m3135[0m:[93m14[0m
|
|
15
|
+
[7m3135[0m type LibraryManagedAttributes<C, P> = C extends React.MemoExoticComponent<infer T> | React.LazyExoticComponent<infer T>
|
|
16
|
+
[7m [0m [96m ~~~~~~~~~~~~~~~~~~~~~~~~[0m
|
|
17
|
+
'LibraryManagedAttributes' was also declared here.
|
|
18
|
+
[96m../../../node_modules/@types/react/index.d.ts[0m:[93m3135[0m:[93m14[0m - [91merror[0m[90m TS2300: [0mDuplicate identifier 'LibraryManagedAttributes'.
|
|
19
|
+
|
|
20
|
+
[7m3135[0m type LibraryManagedAttributes<C, P> = C extends React.MemoExoticComponent<infer T> | React.LazyExoticComponent<infer T>
|
|
21
|
+
[7m [0m [91m ~~~~~~~~~~~~~~~~~~~~~~~~[0m
|
|
22
|
+
|
|
23
|
+
[96m../../../node_modules/@types/react-dom/node_modules/@types/react/index.d.ts[0m:[93m3135[0m:[93m14[0m
|
|
24
|
+
[7m3135[0m type LibraryManagedAttributes<C, P> = C extends React.MemoExoticComponent<infer T> | React.LazyExoticComponent<infer T>
|
|
25
|
+
[7m [0m [96m ~~~~~~~~~~~~~~~~~~~~~~~~[0m
|
|
26
|
+
'LibraryManagedAttributes' was also declared here.
|
|
27
|
+
|
|
28
|
+
[32m[36m[vite:dts][32m Declaration files built in 17153ms.
|
|
29
|
+
[39m
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.9.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [Added] - HTMLElementTagNameMap entry for pie-button element ([#364](https://github.com/justeattakeaway/pie/pull/364)) by [@jamieomaguire](https://github.com/jamieomaguire)
|
|
8
|
+
|
|
9
|
+
- [Added] - Slot functionality to pie-button component and associated SB and example app integrations ([#364](https://github.com/justeattakeaway/pie/pull/364)) by [@jamieomaguire](https://github.com/jamieomaguire)
|
|
10
|
+
|
|
11
|
+
## 0.8.0
|
|
12
|
+
|
|
13
|
+
### Minor Changes
|
|
14
|
+
|
|
15
|
+
- [Updated] - Register approach for button web component ([#346](https://github.com/justeattakeaway/pie/pull/346)) by [@fernandofranca](https://github.com/fernandofranca)
|
|
16
|
+
|
|
17
|
+
[Added] - "types" field in package.json for better DX and IDE TypesScript support
|
|
18
|
+
[Updated] - Provide Vite settings for generating TypeScript declaration files during build
|
|
19
|
+
|
|
3
20
|
## 0.7.0
|
|
4
21
|
|
|
5
22
|
### Minor Changes
|
|
@@ -1,8 +1,8 @@
|
|
|
1
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
|
-
import { property as
|
|
3
|
+
import { property as u, 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
|
-
`,
|
|
5
|
+
`, p = (o, n) => function(i, t) {
|
|
6
6
|
const e = `#${t}`;
|
|
7
7
|
Object.defineProperty(i, t, {
|
|
8
8
|
get() {
|
|
@@ -18,14 +18,20 @@ const x = `.o-btn{border-radius:50rem;border:none;font-family:JetSansDigital;fon
|
|
|
18
18
|
}
|
|
19
19
|
});
|
|
20
20
|
};
|
|
21
|
-
var
|
|
21
|
+
var a = /* @__PURE__ */ ((o) => (o.XSMALL = "xsmall", o.SMALL = "small", o.MEDIUM = "medium", o.LARGE = "large", o))(a || {}), 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, c = (o, n, i, t) => {
|
|
22
22
|
for (var e = t > 1 ? void 0 : t ? M(n, i) : n, r = o.length - 1, s; r >= 0; r--)
|
|
23
23
|
(s = o[r]) && (e = (t ? s(n, i, e) : s(e)) || e);
|
|
24
24
|
return t && e && y(n, i, e), e;
|
|
25
25
|
};
|
|
26
|
+
function k(o) {
|
|
27
|
+
return (n) => {
|
|
28
|
+
if (!customElements.get(o))
|
|
29
|
+
return v(o)(n);
|
|
30
|
+
};
|
|
31
|
+
}
|
|
26
32
|
let l = class extends h {
|
|
27
33
|
constructor() {
|
|
28
|
-
super(...arguments), this.size =
|
|
34
|
+
super(...arguments), this.size = a.MEDIUM, this.type = d.SUBMIT, this.variant = b.PRIMARY, this.disabled = !1;
|
|
29
35
|
}
|
|
30
36
|
render() {
|
|
31
37
|
const { size: o, type: n, variant: i, disabled: t } = this, e = {
|
|
@@ -43,31 +49,31 @@ let l = class extends h {
|
|
|
43
49
|
type=${n}
|
|
44
50
|
?disabled=${t}
|
|
45
51
|
@click="${r}">
|
|
46
|
-
|
|
52
|
+
<slot></slot>
|
|
47
53
|
</button>`;
|
|
48
54
|
}
|
|
49
55
|
};
|
|
50
56
|
l.styles = f(x);
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
57
|
+
c([
|
|
58
|
+
u(),
|
|
59
|
+
p(Object.values(a), a.MEDIUM)
|
|
54
60
|
], l.prototype, "size", 2);
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
61
|
+
c([
|
|
62
|
+
u(),
|
|
63
|
+
p(Object.values(d), d.SUBMIT)
|
|
58
64
|
], l.prototype, "type", 2);
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
65
|
+
c([
|
|
66
|
+
u(),
|
|
67
|
+
p(Object.values(b), b.PRIMARY)
|
|
62
68
|
], l.prototype, "variant", 2);
|
|
63
|
-
|
|
64
|
-
|
|
69
|
+
c([
|
|
70
|
+
u({ type: Boolean, reflect: !0 })
|
|
65
71
|
], l.prototype, "disabled", 2);
|
|
66
|
-
l =
|
|
67
|
-
|
|
72
|
+
l = c([
|
|
73
|
+
k("pie-button")
|
|
68
74
|
], l);
|
|
69
75
|
export {
|
|
70
|
-
|
|
76
|
+
a as BUTTON_SIZE,
|
|
71
77
|
d as BUTTON_TYPE,
|
|
72
78
|
b as BUTTON_VARIANT,
|
|
73
79
|
l as PieButton
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './src/index'
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A decorator for specifying a list of valid values for a property.
|
|
3
|
+
* If this property's setter is called with an invalid value, an error is logged and the default value will be assigned instead.
|
|
4
|
+
* @param validValues - The array of valid values
|
|
5
|
+
* @param defaultValue - The value to fall back on
|
|
6
|
+
* @returns
|
|
7
|
+
*/
|
|
8
|
+
export declare const validPropertyValues: (validValues: any[], defaultValue: any) => (target: any, propertyKey: string) => void;
|
|
9
|
+
//# sourceMappingURL=decorators.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"decorators.d.ts","sourceRoot":"","sources":["../../../src/decorators.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB,gBAAiB,GAAG,EAAE,gBAAgB,GAAG,cAC5C,GAAG,eAAe,MAAM,KAAI,IAyBxD,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Button size variants
|
|
3
|
+
*/
|
|
4
|
+
export declare enum BUTTON_SIZE {
|
|
5
|
+
XSMALL = "xsmall",
|
|
6
|
+
SMALL = "small",
|
|
7
|
+
MEDIUM = "medium",
|
|
8
|
+
LARGE = "large"
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Button style variants
|
|
12
|
+
*/
|
|
13
|
+
export declare enum BUTTON_TYPE {
|
|
14
|
+
SUBMIT = "submit",
|
|
15
|
+
BUTTON = "button",
|
|
16
|
+
RESET = "reset",
|
|
17
|
+
MENU = "menu"
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Button style variants
|
|
21
|
+
*/
|
|
22
|
+
export declare enum BUTTON_VARIANT {
|
|
23
|
+
PRIMARY = "primary",
|
|
24
|
+
SECONDARY = "secondary",
|
|
25
|
+
OUTLINE = "outline",
|
|
26
|
+
GHOST = "ghost"
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=defs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"defs.d.ts","sourceRoot":"","sources":["../../../src/defs.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,oBAAY,WAAW;IACnB,MAAM,WAAW;IACjB,KAAK,UAAU;IACf,MAAM,WAAW;IACjB,KAAK,UAAU;CAClB;AAED;;GAEG;AACH,oBAAY,WAAW;IACnB,MAAM,WAAW;IACjB,MAAM,WAAW;IACjB,KAAK,UAAU;IACf,IAAI,SAAS;CAChB;AAED;;GAEG;AACH,oBAAY,cAAc;IACtB,OAAO,YAAY;IACnB,SAAS,cAAc;IACvB,OAAO,YAAY;IACnB,KAAK,UAAU;CAClB"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
import { BUTTON_SIZE, BUTTON_TYPE, BUTTON_VARIANT } from './defs';
|
|
3
|
+
export { BUTTON_SIZE, BUTTON_TYPE, BUTTON_VARIANT };
|
|
4
|
+
export declare class PieButton extends LitElement {
|
|
5
|
+
size: BUTTON_SIZE;
|
|
6
|
+
type: BUTTON_TYPE;
|
|
7
|
+
variant: BUTTON_VARIANT;
|
|
8
|
+
disabled: boolean;
|
|
9
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
10
|
+
static styles: import("lit").CSSResult;
|
|
11
|
+
}
|
|
12
|
+
declare global {
|
|
13
|
+
interface HTMLElementTagNameMap {
|
|
14
|
+
'pie-button': PieButton;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAmB,MAAM,KAAK,CAAC;AAMlD,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AAGlE,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,cAAc,EAAE,CAAC;AAWpD,qBACa,SAAU,SAAQ,UAAU;IAGrC,IAAI,EAAG,WAAW,CAAsB;IAIxC,IAAI,EAAG,WAAW,CAAsB;IAIxC,OAAO,EAAG,cAAc,CAA0B;IAGlD,QAAQ,EAAG,OAAO,CAAS;IAE3B,MAAM;IA2BN,MAAM,CAAC,MAAM,0BAAqB;CACrC;AAED,OAAO,CAAC,MAAM,CAAC;IACX,UAAU,qBAAqB;QAC3B,YAAY,EAAE,SAAS,CAAC;KAC3B;CACJ"}
|
package/package.json
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@justeattakeaway/pie-button",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"description": "PIE design system button built using web components",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"main": "dist/
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"types": "dist/types/index.d.ts",
|
|
7
8
|
"scripts": {
|
|
8
9
|
"build": "run -T vite build",
|
|
9
10
|
"watch": "run -T vite build --watch",
|
|
10
11
|
"dev": "run -T vite",
|
|
11
|
-
"test": "echo \"Error: no test specified\" && exit
|
|
12
|
+
"test": "echo \"Error: no test specified\" && exit 0"
|
|
12
13
|
},
|
|
13
14
|
"author": "JustEatTakeaway - Design System Web Team",
|
|
14
15
|
"license": "Apache-2.0",
|
package/src/index.ts
CHANGED
|
@@ -9,7 +9,16 @@ import { BUTTON_SIZE, BUTTON_TYPE, BUTTON_VARIANT } from './defs';
|
|
|
9
9
|
// Valid values available to consumers
|
|
10
10
|
export { BUTTON_SIZE, BUTTON_TYPE, BUTTON_VARIANT };
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
// TODO: Extract as a utility function in a shared package
|
|
13
|
+
function defineCustomElement(elementName:string) {
|
|
14
|
+
return (elementClass:typeof LitElement) => {
|
|
15
|
+
if(customElements.get(elementName)) return;
|
|
16
|
+
|
|
17
|
+
return customElement(elementName)(elementClass);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
@defineCustomElement('pie-button')
|
|
13
22
|
export class PieButton extends LitElement {
|
|
14
23
|
@property()
|
|
15
24
|
@validPropertyValues(Object.values(BUTTON_SIZE), BUTTON_SIZE.MEDIUM)
|
|
@@ -23,7 +32,7 @@ export class PieButton extends LitElement {
|
|
|
23
32
|
@validPropertyValues(Object.values(BUTTON_VARIANT), BUTTON_VARIANT.PRIMARY)
|
|
24
33
|
variant : BUTTON_VARIANT = BUTTON_VARIANT.PRIMARY;
|
|
25
34
|
|
|
26
|
-
@property()
|
|
35
|
+
@property({type: Boolean, reflect: true})
|
|
27
36
|
disabled : boolean = false;
|
|
28
37
|
|
|
29
38
|
render () {
|
|
@@ -48,10 +57,16 @@ export class PieButton extends LitElement {
|
|
|
48
57
|
type=${type}
|
|
49
58
|
?disabled=${disabled}
|
|
50
59
|
@click="${raiseWCEvent}">
|
|
51
|
-
|
|
60
|
+
<slot></slot>
|
|
52
61
|
</button>`;
|
|
53
62
|
}
|
|
54
63
|
|
|
55
64
|
// Renders a `CSSResult` generated from SCSS by Vite
|
|
56
65
|
static styles = unsafeCSS(styles);
|
|
57
66
|
}
|
|
67
|
+
|
|
68
|
+
declare global {
|
|
69
|
+
interface HTMLElementTagNameMap {
|
|
70
|
+
'pie-button': PieButton;
|
|
71
|
+
}
|
|
72
|
+
}
|
package/vite.config.js
CHANGED
|
@@ -1,14 +1,21 @@
|
|
|
1
|
+
/* eslint-disable import/no-extraneous-dependencies */
|
|
1
2
|
import { defineConfig } from 'vite';
|
|
3
|
+
import dts from 'vite-plugin-dts';
|
|
2
4
|
|
|
3
5
|
// https://vitejs.dev/config/
|
|
4
6
|
export default defineConfig({
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
build: {
|
|
8
|
+
lib: {
|
|
9
|
+
entry: 'src/index.ts',
|
|
10
|
+
fileName: 'index',
|
|
11
|
+
formats: ['es'],
|
|
12
|
+
},
|
|
13
|
+
rollupOptions: {
|
|
14
|
+
external: /^lit/,
|
|
15
|
+
},
|
|
9
16
|
},
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
17
|
+
plugins: [dts({
|
|
18
|
+
insertTypesEntry: true,
|
|
19
|
+
outputDir: 'dist/types',
|
|
20
|
+
})],
|
|
14
21
|
});
|