@justeattakeaway/pie-button 0.6.1 → 0.8.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 +29 -7
- package/CHANGELOG.md +19 -0
- package/dist/index.js +80 -0
- 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 +12 -0
- package/dist/types/src/index.d.ts.map +1 -0
- package/package.json +8 -4
- package/src/decorators.ts +5 -5
- package/src/index.ts +19 -3
- package/vite.config.js +15 -8
- package/dist/pie-button.js +0 -70
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,7 +1,29 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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[36mindex.js [39m[1m[2m3.79 kB[22m[1m[22m[2m │ gzip: 1.59 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 10579ms.
|
|
29
|
+
[39m
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.8.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [Updated] - Register approach for button web component ([#346](https://github.com/justeattakeaway/pie/pull/346)) by [@fernandofranca](https://github.com/fernandofranca)
|
|
8
|
+
|
|
9
|
+
[Added] - "types" field in package.json for better DX and IDE TypesScript support
|
|
10
|
+
[Updated] - Provide Vite settings for generating TypeScript declaration files during build
|
|
11
|
+
|
|
12
|
+
## 0.7.0
|
|
13
|
+
|
|
14
|
+
### Minor Changes
|
|
15
|
+
|
|
16
|
+
- [Updated] button to handle custom events ([#309](https://github.com/justeattakeaway/pie/pull/309)) by [@FayeCarter](https://github.com/FayeCarter)
|
|
17
|
+
|
|
18
|
+
### Patch Changes
|
|
19
|
+
|
|
20
|
+
- Add missing Volta settings to package.json ([#322](https://github.com/justeattakeaway/pie/pull/322)) by [@fernandofranca](https://github.com/fernandofranca)
|
|
21
|
+
|
|
3
22
|
## 0.6.1
|
|
4
23
|
|
|
5
24
|
### Patch Changes
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { unsafeCSS as f, LitElement as h, html as g } from "lit";
|
|
2
|
+
import { classMap as m } from "lit/directives/class-map.js";
|
|
3
|
+
import { property as u, 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
|
+
`, p = (o, n) => function(i, t) {
|
|
6
|
+
const e = `#${t}`;
|
|
7
|
+
Object.defineProperty(i, t, {
|
|
8
|
+
get() {
|
|
9
|
+
return this[e];
|
|
10
|
+
},
|
|
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
|
+
`Must be one of: ${o.join(" | ")}.`,
|
|
16
|
+
`Falling back to default value: "${n}"`
|
|
17
|
+
), this[e] = n), this.requestUpdate(t, s);
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
};
|
|
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
|
+
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
|
+
};
|
|
26
|
+
function E(o) {
|
|
27
|
+
return (n) => {
|
|
28
|
+
if (!customElements.get(o))
|
|
29
|
+
return v(o)(n);
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
let l = class extends h {
|
|
33
|
+
constructor() {
|
|
34
|
+
super(...arguments), this.size = a.MEDIUM, this.type = d.SUBMIT, this.variant = b.PRIMARY, this.disabled = !1;
|
|
35
|
+
}
|
|
36
|
+
render() {
|
|
37
|
+
const { size: o, type: n, variant: i, disabled: t } = this, e = {
|
|
38
|
+
"o-btn": !0,
|
|
39
|
+
[`o-btn--${o}`]: o,
|
|
40
|
+
[`o-btn--${i}`]: i,
|
|
41
|
+
"o-btn--is-disabled": t
|
|
42
|
+
}, r = () => {
|
|
43
|
+
const s = new Event("CustomEvent");
|
|
44
|
+
console.info("WC event dispatched"), this.dispatchEvent(s);
|
|
45
|
+
};
|
|
46
|
+
return g`
|
|
47
|
+
<button
|
|
48
|
+
class=${m(e)}
|
|
49
|
+
type=${n}
|
|
50
|
+
?disabled=${t}
|
|
51
|
+
@click="${r}">
|
|
52
|
+
I'm a PIE button
|
|
53
|
+
</button>`;
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
l.styles = f(x);
|
|
57
|
+
c([
|
|
58
|
+
u(),
|
|
59
|
+
p(Object.values(a), a.MEDIUM)
|
|
60
|
+
], l.prototype, "size", 2);
|
|
61
|
+
c([
|
|
62
|
+
u(),
|
|
63
|
+
p(Object.values(d), d.SUBMIT)
|
|
64
|
+
], l.prototype, "type", 2);
|
|
65
|
+
c([
|
|
66
|
+
u(),
|
|
67
|
+
p(Object.values(b), b.PRIMARY)
|
|
68
|
+
], l.prototype, "variant", 2);
|
|
69
|
+
c([
|
|
70
|
+
u()
|
|
71
|
+
], l.prototype, "disabled", 2);
|
|
72
|
+
l = c([
|
|
73
|
+
E("pie-button")
|
|
74
|
+
], l);
|
|
75
|
+
export {
|
|
76
|
+
a as BUTTON_SIZE,
|
|
77
|
+
d as BUTTON_TYPE,
|
|
78
|
+
b as BUTTON_VARIANT,
|
|
79
|
+
l as PieButton
|
|
80
|
+
};
|
|
@@ -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,12 @@
|
|
|
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
|
+
//# 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"}
|
package/package.json
CHANGED
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@justeattakeaway/pie-button",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.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
|
-
"license": "Apache-2.0"
|
|
15
|
+
"license": "Apache-2.0",
|
|
16
|
+
"volta": {
|
|
17
|
+
"extends": "../../../package.json"
|
|
18
|
+
}
|
|
15
19
|
}
|
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
|
@@ -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)
|
|
@@ -36,15 +45,22 @@ export class PieButton extends LitElement {
|
|
|
36
45
|
'o-btn--is-disabled': disabled,
|
|
37
46
|
};
|
|
38
47
|
|
|
48
|
+
const raiseWCEvent = () => {
|
|
49
|
+
const event = new Event('CustomEvent')
|
|
50
|
+
console.info('WC event dispatched')
|
|
51
|
+
this.dispatchEvent(event)
|
|
52
|
+
}
|
|
53
|
+
|
|
39
54
|
return html`
|
|
40
55
|
<button
|
|
41
56
|
class=${classMap(classes)}
|
|
42
57
|
type=${type}
|
|
43
|
-
?disabled=${disabled}
|
|
58
|
+
?disabled=${disabled}
|
|
59
|
+
@click="${raiseWCEvent}">
|
|
44
60
|
I'm a PIE button
|
|
45
61
|
</button>`;
|
|
46
62
|
}
|
|
47
63
|
|
|
48
64
|
// Renders a `CSSResult` generated from SCSS by Vite
|
|
49
65
|
static styles = unsafeCSS(styles);
|
|
50
|
-
}
|
|
66
|
+
}
|
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
|
});
|
package/dist/pie-button.js
DELETED
|
@@ -1,70 +0,0 @@
|
|
|
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
|
-
get() {
|
|
9
|
-
return t[e];
|
|
10
|
-
},
|
|
11
|
-
set(i) {
|
|
12
|
-
const l = t[e];
|
|
13
|
-
o.includes(i) ? t[e] = i : (console.error(
|
|
14
|
-
`[pie-button] Invalid value "${i}" provided for property "${n}".`,
|
|
15
|
-
`Must be one of: ${o.join(" | ")}.`,
|
|
16
|
-
`Falling back to default value: "${r}"`
|
|
17
|
-
), t[e] = r), this.requestUpdate(n, l);
|
|
18
|
-
}
|
|
19
|
-
});
|
|
20
|
-
};
|
|
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
|
-
};
|
|
26
|
-
let s = class extends g {
|
|
27
|
-
constructor() {
|
|
28
|
-
super(...arguments), this.size = c.MEDIUM, this.type = b.SUBMIT, this.variant = d.PRIMARY, this.disabled = !1;
|
|
29
|
-
}
|
|
30
|
-
render() {
|
|
31
|
-
const { size: o, type: r, variant: t, disabled: n } = this, e = {
|
|
32
|
-
"o-btn": !0,
|
|
33
|
-
[`o-btn--${o}`]: o,
|
|
34
|
-
[`o-btn--${t}`]: t,
|
|
35
|
-
"o-btn--is-disabled": n
|
|
36
|
-
};
|
|
37
|
-
return h`
|
|
38
|
-
<button
|
|
39
|
-
class=${m(e)}
|
|
40
|
-
type=${r}
|
|
41
|
-
?disabled=${n}>
|
|
42
|
-
I'm a PIE button
|
|
43
|
-
</button>`;
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
|
-
s.styles = f(x);
|
|
47
|
-
a([
|
|
48
|
-
p(),
|
|
49
|
-
u(Object.values(c), c.MEDIUM)
|
|
50
|
-
], s.prototype, "size", 2);
|
|
51
|
-
a([
|
|
52
|
-
p(),
|
|
53
|
-
u(Object.values(b), b.SUBMIT)
|
|
54
|
-
], s.prototype, "type", 2);
|
|
55
|
-
a([
|
|
56
|
-
p(),
|
|
57
|
-
u(Object.values(d), d.PRIMARY)
|
|
58
|
-
], s.prototype, "variant", 2);
|
|
59
|
-
a([
|
|
60
|
-
p()
|
|
61
|
-
], s.prototype, "disabled", 2);
|
|
62
|
-
s = a([
|
|
63
|
-
v("pie-button")
|
|
64
|
-
], s);
|
|
65
|
-
export {
|
|
66
|
-
c as BUTTON_SIZE,
|
|
67
|
-
b as BUTTON_TYPE,
|
|
68
|
-
d as BUTTON_VARIANT,
|
|
69
|
-
s as PieButton
|
|
70
|
-
};
|