@justeattakeaway/pie-spinner 0.2.1 → 0.2.2-next.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/dist/index.js CHANGED
@@ -1,38 +1,38 @@
1
- import { unsafeCSS as f, LitElement as u, html as v, nothing as m } from "lit";
1
+ import { unsafeCSS as f, LitElement as h, html as v, nothing as u } from "lit";
2
2
  import { property as c } from "lit/decorators.js";
3
- const b = (r, e, o) => function(s, i) {
3
+ const b = (n, e, o) => function(s, i) {
4
4
  const t = `#${i}`;
5
5
  Object.defineProperty(s, i, {
6
6
  get() {
7
7
  return this[t];
8
8
  },
9
9
  set(l) {
10
- const h = this[t];
11
10
  e.includes(l) ? this[t] = l : (console.error(
12
- `<${r}> Invalid value "${l}" provided for property "${i}".`,
11
+ `<${n}> Invalid value "${l}" provided for property "${i}".`,
13
12
  `Must be one of: ${e.join(" | ")}.`,
14
13
  `Falling back to default value: "${o}"`
15
- ), this[t] = o), this.requestUpdate(i, h);
16
- }
14
+ ), this[t] = o);
15
+ },
16
+ configurable: !0
17
17
  });
18
18
  };
19
- function z(r, e) {
20
- customElements.get(r) ? console.warn(`PIE Web Component: "${r}" has already been defined. Please ensure the component is only being defined once in your application.`) : customElements.define(r, e);
19
+ function m(n, e) {
20
+ customElements.get(n) ? console.warn(`PIE Web Component: "${n}" has already been defined. Please ensure the component is only being defined once in your application.`) : customElements.define(n, e);
21
21
  }
22
22
  const y = `*,*:before,*:after{box-sizing:border-box}@keyframes rotate360{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.c-spinner{--spinner-size: 24px;--spinner-left-color: hsl(var(--spinner-base-color-h), var(--spinner-base-color-s), var(--spinner-base-color-l), 1);--spinner-right-color: hsl(var(--spinner-base-color-h), var(--spinner-base-color-s), var(--spinner-base-color-l), .35);block-size:var(--spinner-size);inline-size:var(--spinner-size);border-radius:var(--dt-radius-rounded-e);border-width:calc(var(--spinner-size) / 8);border-style:solid;border-color:var(--spinner-left-color) var(--spinner-right-color) var(--spinner-right-color) var(--spinner-left-color);will-change:transform;animation:rotate360 1.15s linear infinite;--spinner-base-color-h: var(--dt-color-content-brand-h);--spinner-base-color-s: var(--dt-color-content-brand-s);--spinner-base-color-l: var(--dt-color-content-brand-l)}.c-spinner[variant=secondary]{--spinner-base-color-h: var(--dt-color-content-interactive-secondary-h);--spinner-base-color-s: var(--dt-color-content-interactive-secondary-s);--spinner-base-color-l: var(--dt-color-content-interactive-secondary-l)}.c-spinner[variant=inverse]{--spinner-base-color-h: var(--dt-color-content-inverse-h);--spinner-base-color-s: var(--dt-color-content-inverse-s);--spinner-base-color-l: var(--dt-color-content-inverse-l)}.c-spinner[size=xs]{--spinner-size: 16px}.c-spinner[size=s]{--spinner-size: 20px}.c-spinner[size=l]{--spinner-size: 32px}.c-spinner[size=xl]{--spinner-size: 48px}.c-spinner-label{position:absolute;display:block;height:1px;width:1px;overflow:hidden;padding:1px;white-space:nowrap}
23
- `, x = ["xs", "s", "m", "l", "xl"], g = ["brand", "secondary", "inverse"];
24
- var P = Object.defineProperty, $ = Object.getOwnPropertyDescriptor, p = (r, e, o, n) => {
25
- for (var s = n > 1 ? void 0 : n ? $(e, o) : e, i = r.length - 1, t; i >= 0; i--)
26
- (t = r[i]) && (s = (n ? t(e, o, s) : t(s)) || s);
27
- return n && s && P(e, o, s), s;
23
+ `, z = ["xs", "s", "m", "l", "xl"], x = ["brand", "secondary", "inverse"];
24
+ var g = Object.defineProperty, P = Object.getOwnPropertyDescriptor, p = (n, e, o, r) => {
25
+ for (var s = r > 1 ? void 0 : r ? P(e, o) : e, i = n.length - 1, t; i >= 0; i--)
26
+ (t = n[i]) && (s = (r ? t(e, o, s) : t(s)) || s);
27
+ return r && s && g(e, o, s), s;
28
28
  };
29
29
  const d = "pie-spinner";
30
- class a extends u {
30
+ class a extends h {
31
31
  constructor() {
32
32
  super(...arguments), this.size = "m", this.variant = "brand";
33
33
  }
34
34
  render() {
35
- const { variant: e, size: o, aria: n } = this;
35
+ const { variant: e, size: o, aria: r } = this;
36
36
  return v`
37
37
  <div
38
38
  data-test-id="pie-spinner"
@@ -41,7 +41,7 @@ class a extends u {
41
41
  aria-live="polite"
42
42
  size="${o}"
43
43
  variant="${e}">
44
- ${n != null && n.label ? v`<span class="c-spinner-label">${n.label}</span>` : m}
44
+ ${r != null && r.label ? v`<span class="c-spinner-label">${r.label}</span>` : u}
45
45
  </div>`;
46
46
  }
47
47
  }
@@ -51,15 +51,15 @@ p([
51
51
  ], a.prototype, "aria", 2);
52
52
  p([
53
53
  c(),
54
- b(d, x, "m")
54
+ b(d, z, "m")
55
55
  ], a.prototype, "size", 2);
56
56
  p([
57
57
  c(),
58
- b(d, g, "brand")
58
+ b(d, x, "brand")
59
59
  ], a.prototype, "variant", 2);
60
- z(d, a);
60
+ m(d, a);
61
61
  export {
62
62
  a as PieSpinner,
63
- x as sizes,
64
- g as variants
63
+ z as sizes,
64
+ x as variants
65
65
  };
package/dist/react.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import type { CSSResult } from 'lit';
2
2
  import type { LitElement } from 'lit';
3
- import type { ReactWebComponent } from '@lit-labs/react';
3
+ import type { ReactWebComponent } from '@lit/react';
4
4
  import type { TemplateResult } from 'lit-html';
5
5
 
6
6
  export declare type AriaProps = {
package/dist/react.js CHANGED
@@ -1,6 +1,6 @@
1
- import * as g from "react";
1
+ import * as y from "react";
2
2
  import { PieSpinner as E } from "./index.js";
3
- import { sizes as k, variants as A } from "./index.js";
3
+ import { sizes as k, variants as C } from "./index.js";
4
4
  import "lit";
5
5
  import "lit/decorators.js";
6
6
  /**
@@ -8,65 +8,42 @@ import "lit/decorators.js";
8
8
  * Copyright 2018 Google LLC
9
9
  * SPDX-License-Identifier: BSD-3-Clause
10
10
  */
11
- const S = /* @__PURE__ */ new Set(["children", "localName", "ref", "style", "className"]), w = /* @__PURE__ */ new WeakMap(), b = (t, n, c, d, m) => {
12
- const o = m == null ? void 0 : m[n];
13
- o === void 0 || c === d ? c == null && n in HTMLElement.prototype ? t.removeAttribute(n) : t[n] = c : ((r, i, h) => {
14
- let a = w.get(r);
15
- a === void 0 && w.set(r, a = /* @__PURE__ */ new Map());
16
- let l = a.get(i);
17
- h !== void 0 ? l === void 0 ? (a.set(i, l = { handleEvent: h }), r.addEventListener(i, l)) : l.handleEvent = h : l !== void 0 && (a.delete(i), r.removeEventListener(i, l));
18
- })(t, o, c);
19
- }, M = (t, n) => {
20
- typeof t == "function" ? t(n) : t.current = n;
21
- };
22
- function P(t = window.React, n, c, d, m) {
23
- let o, r, i;
24
- if (n === void 0) {
25
- const p = t;
26
- ({ tagName: r, elementClass: i, events: d, displayName: m } = p), o = p.react;
27
- } else
28
- o = t, i = c, r = n;
29
- const h = o.Component, a = o.createElement, l = new Set(Object.keys(d ?? {}));
30
- class f extends h {
31
- constructor() {
32
- super(...arguments), this.o = null;
33
- }
34
- t(e) {
35
- if (this.o !== null)
36
- for (const u in this.i)
37
- b(this.o, u, this.props[u], e ? e[u] : void 0, d);
38
- }
39
- componentDidMount() {
11
+ const N = /* @__PURE__ */ new Set(["children", "localName", "ref", "style", "className"]), v = /* @__PURE__ */ new WeakMap(), h = (t, c, o, u, l) => {
12
+ const p = l == null ? void 0 : l[c];
13
+ p === void 0 || o === u ? (t[c] = o, o == null && c in HTMLElement.prototype && t.removeAttribute(c)) : ((i, n, s) => {
14
+ let a = v.get(i);
15
+ a === void 0 && v.set(i, a = /* @__PURE__ */ new Map());
16
+ let r = a.get(n);
17
+ s !== void 0 ? r === void 0 ? (a.set(n, r = { handleEvent: s }), i.addEventListener(n, r)) : r.handleEvent = s : r !== void 0 && (a.delete(n), i.removeEventListener(n, r));
18
+ })(t, p, o);
19
+ }, S = ({ react: t, tagName: c, elementClass: o, events: u, displayName: l }) => {
20
+ const p = new Set(Object.keys(u ?? {})), i = t.forwardRef((n, s) => {
21
+ const a = t.useRef(null), r = t.useRef(null), m = {}, d = {};
22
+ for (const [e, f] of Object.entries(n))
23
+ N.has(e) ? m[e === "className" ? "class" : e] = f : p.has(e) || e in o.prototype ? d[e] = f : m[e] = f;
24
+ return t.useLayoutEffect(() => {
25
+ if (r.current !== null) {
26
+ for (const e in d)
27
+ h(r.current, e, n[e], a.current ? a.current[e] : void 0, u);
28
+ a.current = n;
29
+ }
30
+ }), t.useLayoutEffect(() => {
40
31
  var e;
41
- this.t(), (e = this.o) === null || e === void 0 || e.removeAttribute("defer-hydration");
42
- }
43
- componentDidUpdate(e) {
44
- this.t(e);
45
- }
46
- render() {
47
- const { _$Gl: e, ...u } = this.props;
48
- this.h !== e && (this.u = (s) => {
49
- e !== null && M(e, s), this.o = s, this.h = e;
50
- }), this.i = {};
51
- const v = { ref: this.u };
52
- for (const [s, y] of Object.entries(u))
53
- S.has(s) ? v[s === "className" ? "class" : s] = y : l.has(s) || s in i.prototype ? this.i[s] = y : v[s] = y;
54
- return v.suppressHydrationWarning = !0, a(r, v);
55
- }
56
- }
57
- f.displayName = m ?? i.name;
58
- const N = o.forwardRef((p, e) => a(f, { ...p, _$Gl: e }, p == null ? void 0 : p.children));
59
- return N.displayName = f.displayName, N;
60
- }
61
- const R = P({
32
+ (e = r.current) == null || e.removeAttribute("defer-hydration");
33
+ }, []), m.suppressHydrationWarning = !0, t.createElement(c, { ...m, ref: t.useCallback((e) => {
34
+ r.current = e, typeof s == "function" ? s(e) : s !== null && (s.current = e);
35
+ }, [s]) });
36
+ });
37
+ return i.displayName = l ?? o.name, i;
38
+ }, L = S({
62
39
  displayName: "PieSpinner",
63
40
  elementClass: E,
64
- react: g,
41
+ react: y,
65
42
  tagName: "pie-spinner",
66
43
  events: {}
67
44
  });
68
45
  export {
69
- R as PieSpinner,
46
+ L as PieSpinner,
70
47
  k as sizes,
71
- A as variants
48
+ C as variants
72
49
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@justeattakeaway/pie-spinner",
3
3
  "description": "PIE Design System Spinner built using Web Components",
4
- "version": "0.2.1",
4
+ "version": "0.2.2-next.0",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",
@@ -28,10 +28,10 @@
28
28
  "author": "Just Eat Takeaway.com - Design System Team",
29
29
  "license": "Apache-2.0",
30
30
  "devDependencies": {
31
- "@justeattakeaway/pie-components-config": "0.4.0"
31
+ "@justeattakeaway/pie-components-config": "0.6.0"
32
32
  },
33
33
  "dependencies": {
34
- "@justeattakeaway/pie-webc-core": "0.11.0"
34
+ "@justeattakeaway/pie-webc-core": "0.12.0-next.0"
35
35
  },
36
36
  "volta": {
37
37
  "extends": "../../../package.json"