@justeattakeaway/pie-icon-button 0.21.3-next.0 → 0.22.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/README.md +1 -1
- package/dist/index.js +1 -1
- package/dist/react.js +10 -41
- package/package.json +3 -3
- package/src/index.ts +1 -1
package/README.md
CHANGED
|
@@ -60,7 +60,7 @@ import '@justeattakeaway/pie-icon-button';
|
|
|
60
60
|
```js
|
|
61
61
|
// React
|
|
62
62
|
// For React, you will need to import our React-specific component build
|
|
63
|
-
// which wraps the web component using
|
|
63
|
+
// which wraps the web component using @lit/react
|
|
64
64
|
import { PieIconButton } from '@justeattakeaway/pie-icon-button/dist/react';
|
|
65
65
|
```
|
|
66
66
|
|
package/dist/index.js
CHANGED
|
@@ -46,7 +46,7 @@ class c extends m {
|
|
|
46
46
|
* @private
|
|
47
47
|
*/
|
|
48
48
|
renderSpinner() {
|
|
49
|
-
const { variant: o, size: t } = this, e = t === "xsmall" ? "
|
|
49
|
+
const { variant: o, size: t } = this, e = t === "xsmall" ? "small" : "medium";
|
|
50
50
|
let r = "brand";
|
|
51
51
|
return o != null && o.includes("secondary") && (r = "secondary"), (o === "primary" || o === "ghost-inverse") && (r = "inverse"), s`
|
|
52
52
|
<pie-spinner
|
package/dist/react.js
CHANGED
|
@@ -1,50 +1,19 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import * as t from "react";
|
|
2
|
+
import { createComponent as o } from "@lit/react";
|
|
3
|
+
import { PieIconButton as e } from "./index.js";
|
|
4
|
+
import { sizes as u, variants as f } from "./index.js";
|
|
4
5
|
import "lit";
|
|
5
6
|
import "lit/decorators.js";
|
|
6
7
|
import "@justeattakeaway/pie-spinner";
|
|
7
|
-
|
|
8
|
-
* @license
|
|
9
|
-
* Copyright 2018 Google LLC
|
|
10
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
11
|
-
*/
|
|
12
|
-
const N = /* @__PURE__ */ new Set(["children", "localName", "ref", "style", "className"]), v = /* @__PURE__ */ new WeakMap(), b = (t, i, a, l, u) => {
|
|
13
|
-
const m = u == null ? void 0 : u[i];
|
|
14
|
-
m === void 0 || a === l ? (t[i] = a, a == null && i in HTMLElement.prototype && t.removeAttribute(i)) : ((c, r, o) => {
|
|
15
|
-
let s = v.get(c);
|
|
16
|
-
s === void 0 && v.set(c, s = /* @__PURE__ */ new Map());
|
|
17
|
-
let n = s.get(r);
|
|
18
|
-
o !== void 0 ? n === void 0 ? (s.set(r, n = { handleEvent: o }), c.addEventListener(r, n)) : n.handleEvent = o : n !== void 0 && (s.delete(r), c.removeEventListener(r, n));
|
|
19
|
-
})(t, m, a);
|
|
20
|
-
}, h = ({ react: t, tagName: i, elementClass: a, events: l, displayName: u }) => {
|
|
21
|
-
const m = new Set(Object.keys(l ?? {})), c = t.forwardRef((r, o) => {
|
|
22
|
-
const s = t.useRef(null), n = t.useRef(null), f = {}, p = {};
|
|
23
|
-
for (const [e, d] of Object.entries(r))
|
|
24
|
-
N.has(e) ? f[e === "className" ? "class" : e] = d : m.has(e) || e in a.prototype ? p[e] = d : f[e] = d;
|
|
25
|
-
return t.useLayoutEffect(() => {
|
|
26
|
-
if (n.current !== null) {
|
|
27
|
-
for (const e in p)
|
|
28
|
-
b(n.current, e, r[e], s.current ? s.current[e] : void 0, l);
|
|
29
|
-
s.current = r;
|
|
30
|
-
}
|
|
31
|
-
}), t.useLayoutEffect(() => {
|
|
32
|
-
var e;
|
|
33
|
-
(e = n.current) == null || e.removeAttribute("defer-hydration");
|
|
34
|
-
}, []), f.suppressHydrationWarning = !0, t.createElement(i, { ...f, ref: t.useCallback((e) => {
|
|
35
|
-
n.current = e, typeof o == "function" ? o(e) : o !== null && (o.current = e);
|
|
36
|
-
}, [o]) });
|
|
37
|
-
});
|
|
38
|
-
return c.displayName = u ?? a.name, c;
|
|
39
|
-
}, I = h({
|
|
8
|
+
const p = o({
|
|
40
9
|
displayName: "PieIconButton",
|
|
41
|
-
elementClass:
|
|
42
|
-
react:
|
|
10
|
+
elementClass: e,
|
|
11
|
+
react: t,
|
|
43
12
|
tagName: "pie-icon-button",
|
|
44
13
|
events: {}
|
|
45
14
|
});
|
|
46
15
|
export {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
16
|
+
p as PieIconButton,
|
|
17
|
+
u as sizes,
|
|
18
|
+
f as variants
|
|
50
19
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@justeattakeaway/pie-icon-button",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.22.0",
|
|
4
4
|
"description": "PIE Design System Icon Button built using Web Components",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -27,8 +27,8 @@
|
|
|
27
27
|
"license": "Apache-2.0",
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@justeattakeaway/pie-icons-webc": "0.11.1",
|
|
30
|
-
"@justeattakeaway/pie-spinner": "0.
|
|
31
|
-
"@justeattakeaway/pie-webc-core": "0.12.0
|
|
30
|
+
"@justeattakeaway/pie-spinner": "0.3.0",
|
|
31
|
+
"@justeattakeaway/pie-webc-core": "0.12.0"
|
|
32
32
|
},
|
|
33
33
|
"volta": {
|
|
34
34
|
"extends": "../../../package.json"
|
package/src/index.ts
CHANGED
|
@@ -39,7 +39,7 @@ export class PieIconButton extends LitElement implements IconButtonProps {
|
|
|
39
39
|
*/
|
|
40
40
|
private renderSpinner (): TemplateResult {
|
|
41
41
|
const { variant, size } = this;
|
|
42
|
-
const spinnerSize = size === 'xsmall' ? '
|
|
42
|
+
const spinnerSize = size === 'xsmall' ? 'small' : 'medium';
|
|
43
43
|
let spinnerVariant = 'brand';
|
|
44
44
|
if (variant?.includes('secondary')) spinnerVariant = 'secondary';
|
|
45
45
|
if (variant === 'primary' || variant === 'ghost-inverse') spinnerVariant = 'inverse';
|