@justeattakeaway/pie-button 0.12.2 → 0.13.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.
@@ -1,11 +1,14 @@
1
+ [11:03:19 AM] @custom-elements-manifest/analyzer: Created new manifest.
2
+ react wrapper has been added!
1
3
  vite v4.2.1 building for production...
2
4
  transforming...
3
- ✓ 4 modules transformed.
5
+ ✓ 19 modules transformed.
4
6
  rendering chunks...
5
7
  computing gzip size...
6
- dist/index.js 4.32 kB │ gzip: 1.65 kB
8
+ dist/index.js  6.51 kB │ gzip: 1.78 kB
9
+ dist/react.js 59.13 kB │ gzip: 15.94 kB
7
10
  
8
11
  [vite:dts] Start generate declaration files...
9
- ✓ built in 24.29s
10
- [vite:dts] Declaration files built in 23021ms.
12
+ ✓ built in 37.16s
13
+ [vite:dts] Declaration files built in 34280ms.
11
14
  
package/CHANGELOG.md CHANGED
@@ -1,5 +1,26 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.13.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [Changed] - Build script to include generating react wrapper ([#426](https://github.com/justeattakeaway/pie/pull/426)) by [@LTurns](https://github.com/LTurns)
8
+
9
+ - [Changed] - Deleted old prop validation decorator to replace with shared one from the core package ([#491](https://github.com/justeattakeaway/pie/pull/491)) by [@jamieomaguire](https://github.com/jamieomaguire)
10
+
11
+ - [Changed] - Changed styles to use CSS Custom Props and host attrs ([#482](https://github.com/justeattakeaway/pie/pull/482)) by [@ashleynolan](https://github.com/ashleynolan)
12
+
13
+ ### Patch Changes
14
+
15
+ - [Added] - Missing `test:ci` scripts to package.json ([#492](https://github.com/justeattakeaway/pie/pull/492)) by [@siggerzz](https://github.com/siggerzz)
16
+
17
+ - [Fixed] - Resolved TS Build errors ([#482](https://github.com/justeattakeaway/pie/pull/482)) by [@ashleynolan](https://github.com/ashleynolan)
18
+
19
+ - [Updated] - components to use the shared configurations ([#487](https://github.com/justeattakeaway/pie/pull/487)) by [@fernandofranca](https://github.com/fernandofranca)
20
+
21
+ - Updated dependencies [[`090354733`](https://github.com/justeattakeaway/pie/commit/090354733f24f0aa52ce287db7f8d13648414150)]:
22
+ - @justeattakeaway/pie-webc-core@0.2.0
23
+
3
24
  ## 0.12.2
4
25
 
5
26
  ### Patch Changes
package/README.md CHANGED
@@ -45,6 +45,16 @@ Compile and watch for changes (auto-compiles `dist` on save)
45
45
  yarn watch
46
46
  ```
47
47
 
48
+ ### Importing the component
49
+
50
+ ```js
51
+ // default
52
+ import { PieButton } from '@justeattakeaway/pie-button';
53
+
54
+ // react
55
+ import { PieButton } from '@justeattakeaway/pie-button/dist/react';
56
+ ```
57
+
48
58
  ## Props
49
59
 
50
60
  | Property | Type | Default | Description |
package/dist/index.js CHANGED
@@ -1,81 +1,72 @@
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 a, customElement as x } from "lit/decorators.js";
4
- const v = `.o-btn{border-radius:50rem;border:none;font-family:JetSansDigital;cursor:pointer;user-select:none;outline:none}.o-btn:focus-visible{outline:2px solid #4996fd}.o-btn--xsmall{min-block-size:32px;padding:6px 8px;font-size:14px;font-weight:700;line-height:20px}.o-btn--small-productive{min-block-size:40px;padding:8px 16px;font-size:16px;font-weight:700;line-height:24px}.o-btn--small-expressive{min-block-size:40px;padding:6px 16px;font-size:20px;font-weight:700;line-height:28px}.o-btn--medium{min-block-size:48px;padding:10px 24px;font-size:20px;font-weight:700;line-height:28px}.o-btn--large{min-block-size:56px;padding:14px 24px;font-size:20px;font-weight:700;line-height:28px}.o-btn--primary{background-color:#f36805;color:#fff}.o-btn--primary:hover:not(:disabled){background-color:#df5f05}.o-btn--primary:active:not(:disabled){background-color:#b74e04}.o-btn--secondary{background-color:#f5f3f1;color:#242e30}.o-btn--secondary:hover:not(:disabled){background-color:#ede9e5}.o-btn--secondary:active:not(:disabled){background-color:#dcd4cd}.o-btn--outline{background-color:#fff;color:#303d3f;border:1px solid #dbd9d7}.o-btn--outline:hover:not(:disabled){background-color:#f5f5f5}.o-btn--outline:active:not(:disabled){background-color:#e0e0e0}.o-btn--ghost{background-color:#fff;color:#242e30}.o-btn--ghost:hover:not(:disabled){background-color:#f5f5f5}.o-btn--ghost:active:not(:disabled){background-color:#e0e0e0}.o-btn.o-btn--is-disabled{background-color:#efedea;color:#8c999b;border:1px solid #efedea;cursor:not-allowed}.o-btn.o-btn--is-disabled:hover:not(:disabled){background-color:#e6e3de}.o-btn.o-btn--is-disabled:active:not(:disabled){background-color:#d5cfc7}.o-btn.o-btn--is-disabled.o-btn--ghost{background-color:#fff;outline:none}.o-btn--fullWidth{inline-size:100%}
5
- `, u = (o, n) => function(r, t) {
6
- const e = `#${t}`;
7
- Object.defineProperty(r, t, {
1
+ import { unsafeCSS as f, LitElement as g, html as m } from "lit";
2
+ import { property as c } from "lit/decorators.js";
3
+ import "lit/decorators/property.js";
4
+ const u = (t, r, e) => function(n, o) {
5
+ const a = `#${o}`;
6
+ Object.defineProperty(n, o, {
8
7
  get() {
9
- return this[e];
8
+ return this[a];
10
9
  },
11
10
  set(i) {
12
- const d = this[e];
13
- o.includes(i) ? this[e] = i : (console.error(
14
- `[pie-button] Invalid value "${i}" 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, d);
11
+ const p = this[a];
12
+ r.includes(i) ? this[a] = i : (console.error(
13
+ `<${t}> Invalid value "${i}" provided for property "${o}".`,
14
+ `Must be one of: ${r.join(" | ")}.`,
15
+ `Falling back to default value: "${e}"`
16
+ ), this[a] = e), this.requestUpdate(o, p);
18
17
  }
19
18
  });
19
+ }, y = `:host{--btn-border-radius: var(--dt-radius-rounded-e);--btn-font-family: var(--dt-font-interactive-m-family);--btn-font-weight: var(--dt-font-interactive-m-weight);--btn-padding: 10px var(--dt-spacing-e);--btn-min-height: 48px;--btn-font-size: calc(var(--dt-font-size-20) * 1px);--btn-line-height: calc(var(--dt-font-size-20-line-height) * 1px);--btn-bg-color: var(--dt-color-interactive-brand);--btn-text-color: var(--dt-color-content-interactive-primary);--btn-focus: var(--dt-color-focus-outer)}.o-btn{min-block-size:var(--btn-min-block-size);padding:var(--btn-padding);border:none;border-radius:var(--btn-border-radius);outline:none;background-color:var(--btn-bg-color);font-family:var(--btn-font-family);font-size:var(--btn-font-size);font-weight:var(--btn-font-weight);color:var(--btn-text-color);line-height:var(--btn-line-height);cursor:pointer;user-select:none}.o-btn:focus-visible{outline:2px solid var(--btn-focus)}:host([variant=primary]) .o-btn:hover:not(:disabled){background-color:hsl(var(--dt-color-interactive-brand-h),var(--dt-color-interactive-brand-s),calc(var(--dt-color-interactive-brand-l) - var(--dt-color-hover-01)))}:host([variant=primary]) .o-btn:active:not(:disabled){background-color:hsl(var(--dt-color-interactive-brand-h),var(--dt-color-interactive-brand-s),calc(var(--dt-color-interactive-brand-l) - var(--dt-color-active-01)))}:host([variant=secondary]){--btn-bg-color: var(--dt-color-interactive-secondary);--btn-text-color: var(--dt-color-content-interactive-secondary)}:host([variant=secondary]) .o-btn:hover:not(:disabled){background-color:hsl(var(--dt-color-interactive-secondary-h),var(--dt-color-interactive-secondary-s),calc(var(--dt-color-interactive-secondary-l) - var(--dt-color-hover-01)))}:host([variant=secondary]) .o-btn:active:not(:disabled){background-color:hsl(var(--dt-color-interactive-secondary-h),var(--dt-color-interactive-secondary-s),calc(var(--dt-color-interactive-secondary-l) - var(--dt-color-active-01)))}:host([variant=outline]){--btn-bg-color: var(--dt-color-container-default);--btn-text-color: var(--dt-color-content-interactive-tertiary)}:host([variant=outline]) .o-btn{border:1px solid var(--dt-color-border-strong)}:host([variant=outline]) .o-btn:hover:not(:disabled){background-color:hsl(var(--dt-color-container-default-h),var(--dt-color-container-default-s),calc(var(--dt-color-container-default-l) - var(--dt-color-hover-01)))}:host([variant=outline]) .o-btn:active:not(:disabled){background-color:hsl(var(--dt-color-container-default-h),var(--dt-color-container-default-s),calc(var(--dt-color-container-default-l) - var(--dt-color-active-01)))}:host([variant=ghost]){--btn-bg-color: var(--dt-color-container-default);--btn-text-color: var(--dt-color-content-link)}:host([variant=ghost]) .o-btn:hover:not(:disabled){background-color:hsl(var(--dt-color-container-default-h),var(--dt-color-container-default-s),calc(var(--dt-color-container-default-l) - var(--dt-color-hover-01)))}:host([variant=ghost]) .o-btn:active:not(:disabled){background-color:hsl(var(--dt-color-container-default-h),var(--dt-color-container-default-s),calc(var(--dt-color-container-default-l) - var(--dt-color-active-01)))}:host([disabled]){--btn-bg-color: var(--dt-color-disabled-01);--btn-text-color: var(--dt-color-content-disabled)}:host([disabled]) .o-btn{border:1px solid var(--dt-color-disabled-01);cursor:not-allowed}:host([isFullWidth]) .o-btn{inline-size:100%}:host([disabled][variant=ghost]){--btn-bg-color: var(--dt-color-container-default)}:host([disabled][variant=ghost]) .o-btn{outline:none}:host([size=xsmall]){--btn-padding: 6px var(--dt-spacing-b);--btn-min-block-size: 32px;--btn-font-size: calc(var(--dt-font-size-14) * 1px);--btn-line-height: calc(var(--dt-font-size-14-line-height) * 1px)}:host([size=small]){--btn-padding: 8px var(--dt-spacing-d);--btn-min-block-size: 40px;--btn-font-size: calc(var(--dt-font-size-19) * 1px);--btn-line-height: calc(var(--dt-font-size-19-line-height) * 1px)}:host([size=large]){--btn-padding: 14px var(--dt-spacing-e);--btn-min-block-size: 56px;--btn-font-size: calc(var(--dt-font-size-20) * 1px);--btn-line-height: calc(var(--dt-font-size-20-line-height) * 1px)}
20
+ `;
21
+ var s = /* @__PURE__ */ ((t) => (t.XSMALL = "xsmall", t.SMALL_EXPRESSIVE = "small-expressive", t.SMALL_PRODUCTIVE = "small-productive", t.MEDIUM = "medium", t.LARGE = "large", t))(s || {}), v = /* @__PURE__ */ ((t) => (t.SUBMIT = "submit", t.BUTTON = "button", t.RESET = "reset", t.MENU = "menu", t))(v || {}), b = /* @__PURE__ */ ((t) => (t.PRIMARY = "primary", t.SECONDARY = "secondary", t.OUTLINE = "outline", t.GHOST = "ghost", t))(b || {}), x = Object.defineProperty, z = Object.getOwnPropertyDescriptor, d = (t, r, e, n) => {
22
+ for (var o = n > 1 ? void 0 : n ? z(r, e) : r, a = t.length - 1, i; a >= 0; a--)
23
+ (i = t[a]) && (o = (n ? i(r, e, o) : i(o)) || o);
24
+ return n && o && x(r, e, o), o;
20
25
  };
21
- var b = /* @__PURE__ */ ((o) => (o.XSMALL = "xsmall", o.SMALL_EXPRESSIVE = "small-expressive", o.SMALL_PRODUCTIVE = "small-productive", o.MEDIUM = "medium", o.LARGE = "large", o))(b || {}), c = /* @__PURE__ */ ((o) => (o.SUBMIT = "submit", o.BUTTON = "button", o.RESET = "reset", o.MENU = "menu", o))(c || {}), p = /* @__PURE__ */ ((o) => (o.PRIMARY = "primary", o.SECONDARY = "secondary", o.OUTLINE = "outline", o.GHOST = "ghost", o))(p || {}), y = Object.defineProperty, M = Object.getOwnPropertyDescriptor, l = (o, n, r, t) => {
22
- for (var e = t > 1 ? void 0 : t ? M(n, r) : n, i = o.length - 1, d; i >= 0; i--)
23
- (d = o[i]) && (e = (t ? d(n, r, e) : d(e)) || e);
24
- return t && e && y(n, r, e), e;
25
- };
26
- let s = class extends h {
26
+ const h = "pie-button";
27
+ class l extends g {
27
28
  constructor() {
28
- super(...arguments), this.size = b.MEDIUM, this.type = c.SUBMIT, this.variant = p.PRIMARY, this.disabled = !1, this.isFullWidth = !1;
29
+ super(...arguments), this.size = s.MEDIUM, this.type = v.SUBMIT, this.variant = b.PRIMARY, this.disabled = !1, this.isFullWidth = !1;
29
30
  }
30
31
  render() {
31
32
  const {
32
- size: o,
33
- type: n,
34
- variant: r,
35
- disabled: t,
36
- isFullWidth: e
37
- } = this, i = {
38
- "o-btn": !0,
39
- [`o-btn--${o}`]: o,
40
- [`o-btn--${r}`]: r,
41
- "o-btn--is-disabled": t,
42
- "o-btn--fullWidth": e
43
- };
44
- return g`
33
+ type: r,
34
+ disabled: e,
35
+ isFullWidth: n
36
+ } = this;
37
+ return m`
45
38
  <button
46
- class=${m(i)}
47
- type=${n}
48
- ?disabled=${t}
49
- ?isFullWidth=${e}>
39
+ class="o-btn"
40
+ type=${r}
41
+ ?disabled=${e}
42
+ ?isFullWidth=${n}>
50
43
  <slot></slot>
51
44
  </button>`;
52
45
  }
53
- };
54
- s.styles = f(v);
55
- l([
56
- a(),
57
- u(Object.values(b), b.MEDIUM)
58
- ], s.prototype, "size", 2);
59
- l([
60
- a(),
61
- u(Object.values(c), c.SUBMIT)
62
- ], s.prototype, "type", 2);
63
- l([
64
- a(),
65
- u(Object.values(p), p.PRIMARY)
66
- ], s.prototype, "variant", 2);
67
- l([
68
- a({ type: Boolean, reflect: !0 })
69
- ], s.prototype, "disabled", 2);
70
- l([
71
- a({ type: Boolean, reflect: !0 })
72
- ], s.prototype, "isFullWidth", 2);
73
- s = l([
74
- x("pie-button")
75
- ], s);
46
+ }
47
+ l.styles = f(y);
48
+ d([
49
+ c(),
50
+ u(h, Object.values(s), s.MEDIUM)
51
+ ], l.prototype, "size", 2);
52
+ d([
53
+ c(),
54
+ u(h, Object.values(v), v.SUBMIT)
55
+ ], l.prototype, "type", 2);
56
+ d([
57
+ c(),
58
+ u(h, Object.values(b), b.PRIMARY)
59
+ ], l.prototype, "variant", 2);
60
+ d([
61
+ c({ type: Boolean, reflect: !0 })
62
+ ], l.prototype, "disabled", 2);
63
+ d([
64
+ c({ type: Boolean, reflect: !0 })
65
+ ], l.prototype, "isFullWidth", 2);
66
+ customElements.define(h, l);
76
67
  export {
77
- b as BUTTON_SIZE,
78
- c as BUTTON_TYPE,
79
- p as BUTTON_VARIANT,
80
- s as PieButton
68
+ s as BUTTON_SIZE,
69
+ v as BUTTON_TYPE,
70
+ b as BUTTON_VARIANT,
71
+ l as PieButton
81
72
  };