@pezkuwi/react-identicon 3.16.8 → 3.17.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.
Files changed (114) hide show
  1. package/build/Identicon.js +104 -0
  2. package/build/README.md +34 -0
  3. package/{bundle-pezkuwi-react-identicon.js → build/bundle-pezkuwi-react-identicon.js} +62 -50
  4. package/build/bundle.js +3 -0
  5. package/build/cjs/Identicon.d.ts +5 -0
  6. package/build/cjs/Identicon.js +108 -0
  7. package/build/cjs/bundle.d.ts +3 -0
  8. package/build/cjs/bundle.js +9 -0
  9. package/build/cjs/icons/Beachball.js +17 -0
  10. package/build/cjs/icons/Empty.js +10 -0
  11. package/build/cjs/icons/Ethereum.js +18 -0
  12. package/build/cjs/icons/Jdenticon.js +12 -0
  13. package/{icons/Polkadot.d.ts → build/cjs/icons/Pezkuwi.d.ts} +1 -1
  14. package/build/cjs/icons/Pezkuwi.js +15 -0
  15. package/{icons → build/cjs/icons}/index.d.ts +1 -1
  16. package/build/cjs/icons/index.js +13 -0
  17. package/build/cjs/index.js +7 -0
  18. package/build/cjs/packageInfo.js +4 -0
  19. package/build/cjs/styled.js +5 -0
  20. package/{types.d.ts → build/cjs/types.d.ts} +1 -1
  21. package/build/cjs/types.js +2 -0
  22. package/build/icons/Beachball.d.ts +5 -0
  23. package/build/icons/Beachball.js +13 -0
  24. package/build/icons/Empty.d.ts +5 -0
  25. package/build/icons/Empty.js +6 -0
  26. package/build/icons/Ethereum.d.ts +5 -0
  27. package/build/icons/Ethereum.js +14 -0
  28. package/build/icons/Jdenticon.d.ts +5 -0
  29. package/build/icons/Jdenticon.js +8 -0
  30. package/build/icons/Pezkuwi.d.ts +5 -0
  31. package/build/icons/Pezkuwi.js +11 -0
  32. package/build/icons/index.d.ts +5 -0
  33. package/build/icons/index.js +5 -0
  34. package/build/index.d.ts +4 -0
  35. package/build/index.js +4 -0
  36. package/build/package.json +249 -0
  37. package/build/packageDetect.d.ts +1 -0
  38. package/build/packageDetect.js +5 -0
  39. package/build/packageInfo.d.ts +6 -0
  40. package/build/packageInfo.js +1 -0
  41. package/build/styled.d.ts +1 -0
  42. package/build/styled.js +1 -0
  43. package/build/types.d.ts +23 -0
  44. package/build/types.js +1 -0
  45. package/{cjs/icons/Polkadot.d.ts → build-tsc/icons/Pezkuwi.d.ts} +1 -1
  46. package/{cjs → build-tsc}/icons/index.d.ts +1 -1
  47. package/{cjs → build-tsc}/types.d.ts +1 -1
  48. package/{cjs → build-tsc-cjs}/Identicon.js +2 -2
  49. package/{cjs/icons/Polkadot.js → build-tsc-cjs/icons/Pezkuwi.js} +3 -3
  50. package/{cjs → build-tsc-cjs}/icons/index.js +3 -3
  51. package/build-tsc-cjs/packageDetect.js +7 -0
  52. package/{cjs → build-tsc-cjs}/packageInfo.js +1 -1
  53. package/{Identicon.js → build-tsc-esm/Identicon.js} +3 -3
  54. package/{icons/Polkadot.js → build-tsc-esm/icons/Pezkuwi.js} +3 -3
  55. package/{icons → build-tsc-esm/icons}/index.js +1 -1
  56. package/{packageInfo.js → build-tsc-esm/packageInfo.js} +1 -1
  57. package/demo.png +0 -0
  58. package/index.html +17 -0
  59. package/package.json +8 -209
  60. package/src/Identicon.tsx +154 -0
  61. package/src/bundle.ts +6 -0
  62. package/src/icons/Beachball.tsx +32 -0
  63. package/src/icons/Empty.tsx +20 -0
  64. package/src/icons/Ethereum.tsx +37 -0
  65. package/src/icons/Jdenticon.tsx +24 -0
  66. package/src/icons/Pezkuwi.tsx +47 -0
  67. package/src/icons/index.ts +8 -0
  68. package/src/index.ts +10 -0
  69. package/src/packageDetect.ts +13 -0
  70. package/src/packageInfo.ts +6 -0
  71. package/src/styled.ts +4 -0
  72. package/src/types.ts +30 -0
  73. package/tsconfig.build.json +12 -0
  74. package/tsconfig.build.tsbuildinfo +1 -0
  75. /package/{cjs → build}/Identicon.d.ts +0 -0
  76. /package/{LICENSE → build/LICENSE} +0 -0
  77. /package/{cjs → build}/bundle.d.ts +0 -0
  78. /package/{icons → build/cjs/icons}/Beachball.d.ts +0 -0
  79. /package/{icons → build/cjs/icons}/Empty.d.ts +0 -0
  80. /package/{icons → build/cjs/icons}/Ethereum.d.ts +0 -0
  81. /package/{icons → build/cjs/icons}/Jdenticon.d.ts +0 -0
  82. /package/{index.d.ts → build/cjs/index.d.ts} +0 -0
  83. /package/{cjs → build/cjs}/package.json +0 -0
  84. /package/{packageDetect.d.ts → build/cjs/packageDetect.d.ts} +0 -0
  85. /package/{cjs → build/cjs}/packageDetect.js +0 -0
  86. /package/{packageInfo.d.ts → build/cjs/packageInfo.d.ts} +0 -0
  87. /package/{styled.d.ts → build/cjs/styled.d.ts} +0 -0
  88. /package/{Identicon.d.ts → build-tsc/Identicon.d.ts} +0 -0
  89. /package/{bundle.d.ts → build-tsc/bundle.d.ts} +0 -0
  90. /package/{cjs → build-tsc}/icons/Beachball.d.ts +0 -0
  91. /package/{cjs → build-tsc}/icons/Empty.d.ts +0 -0
  92. /package/{cjs → build-tsc}/icons/Ethereum.d.ts +0 -0
  93. /package/{cjs → build-tsc}/icons/Jdenticon.d.ts +0 -0
  94. /package/{cjs → build-tsc}/index.d.ts +0 -0
  95. /package/{cjs → build-tsc}/packageDetect.d.ts +0 -0
  96. /package/{cjs → build-tsc}/packageInfo.d.ts +0 -0
  97. /package/{cjs → build-tsc}/styled.d.ts +0 -0
  98. /package/{cjs → build-tsc-cjs}/bundle.js +0 -0
  99. /package/{cjs → build-tsc-cjs}/icons/Beachball.js +0 -0
  100. /package/{cjs → build-tsc-cjs}/icons/Empty.js +0 -0
  101. /package/{cjs → build-tsc-cjs}/icons/Ethereum.js +0 -0
  102. /package/{cjs → build-tsc-cjs}/icons/Jdenticon.js +0 -0
  103. /package/{cjs → build-tsc-cjs}/index.js +0 -0
  104. /package/{cjs → build-tsc-cjs}/styled.js +0 -0
  105. /package/{cjs → build-tsc-cjs}/types.js +0 -0
  106. /package/{bundle.js → build-tsc-esm/bundle.js} +0 -0
  107. /package/{icons → build-tsc-esm/icons}/Beachball.js +0 -0
  108. /package/{icons → build-tsc-esm/icons}/Empty.js +0 -0
  109. /package/{icons → build-tsc-esm/icons}/Ethereum.js +0 -0
  110. /package/{icons → build-tsc-esm/icons}/Jdenticon.js +0 -0
  111. /package/{index.js → build-tsc-esm/index.js} +0 -0
  112. /package/{packageDetect.js → build-tsc-esm/packageDetect.js} +0 -0
  113. /package/{styled.js → build-tsc-esm/styled.js} +0 -0
  114. /package/{types.js → build-tsc-esm/types.js} +0 -0
@@ -0,0 +1,108 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Identicon = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const jsx_runtime_1 = require("react/jsx-runtime");
6
+ const react_1 = tslib_1.__importDefault(require("react"));
7
+ const react_copy_to_clipboard_1 = tslib_1.__importDefault(require("react-copy-to-clipboard"));
8
+ const ui_settings_1 = require("@pezkuwi/ui-settings");
9
+ const util_1 = require("@pezkuwi/util");
10
+ const util_crypto_1 = require("@pezkuwi/util-crypto");
11
+ const index_js_1 = require("./icons/index.js");
12
+ const styled_js_1 = require("./styled.js");
13
+ const Fallback = index_js_1.Beachball;
14
+ const DEFAULT_SIZE = 64;
15
+ const Components = {
16
+ beachball: index_js_1.Beachball,
17
+ bizinikiwi: index_js_1.Jdenticon,
18
+ empty: index_js_1.Empty,
19
+ ethereum: index_js_1.Ethereum,
20
+ jdenticon: index_js_1.Jdenticon,
21
+ pezkuwi: index_js_1.Pezkuwi
22
+ };
23
+ class BaseIcon extends react_1.default.PureComponent {
24
+ state = {
25
+ address: '',
26
+ publicKey: '0x'
27
+ };
28
+ static prefix = undefined;
29
+ static setDefaultPrefix(prefix) {
30
+ BaseIcon.prefix = prefix;
31
+ }
32
+ static getDerivedStateFromProps({ prefix = BaseIcon.prefix, theme, value }, prevState) {
33
+ if (theme === 'ethereum') {
34
+ const address = (0, util_1.isU8a)(value)
35
+ ? (0, util_crypto_1.ethereumEncode)(value)
36
+ : value || '';
37
+ return { address, publicKey: '' };
38
+ }
39
+ try {
40
+ const address = (0, util_1.isU8a)(value) || (0, util_1.isHex)(value)
41
+ ? (0, util_crypto_1.encodeAddress)(value, prefix)
42
+ : (value || '');
43
+ const publicKey = (0, util_1.u8aToHex)((0, util_crypto_1.decodeAddress)(address, false, prefix));
44
+ return address === prevState.address
45
+ ? null
46
+ : {
47
+ address,
48
+ publicKey
49
+ };
50
+ }
51
+ catch {
52
+ return {
53
+ address: '',
54
+ publicKey: '0x'
55
+ };
56
+ }
57
+ }
58
+ render() {
59
+ const { address } = this.state;
60
+ const wrapped = this.getWrapped(this.state, this.props);
61
+ return !address
62
+ ? wrapped
63
+ : ((0, jsx_runtime_1.jsx)(react_copy_to_clipboard_1.default, { onCopy: this.onCopy, text: address, children: wrapped }));
64
+ }
65
+ getWrapped({ address, publicKey }, { Custom }) {
66
+ const { className = '', isAlternative, isHighlight, size = DEFAULT_SIZE, style = {}, theme = ui_settings_1.settings.icon } = this.props;
67
+ const Component = !address
68
+ ? index_js_1.Empty
69
+ : Custom || Components[theme === 'default' ? ui_settings_1.ICON_DEFAULT_HOST : theme] || Fallback;
70
+ return ((0, jsx_runtime_1.jsx)(StyledDiv, { className: `ui--IdentityIcon ${className}`, style: style, children: (0, jsx_runtime_1.jsx)(Component, { address: address, className: isHighlight ? 'highlight' : '', isAlternative: isAlternative, publicKey: publicKey, size: size }) }, address));
71
+ }
72
+ onCopy = () => {
73
+ const { onCopy } = this.props;
74
+ const { address } = this.state;
75
+ if (address && onCopy) {
76
+ onCopy(address);
77
+ }
78
+ };
79
+ }
80
+ function Icon(props) {
81
+ return (0, jsx_runtime_1.jsx)(BaseIcon, { ...props });
82
+ }
83
+ const StyledDiv = styled_js_1.styled.div `
84
+ cursor: copy;
85
+ display: inline-block;
86
+ line-height: 0;
87
+
88
+ > .container {
89
+ position: relative;
90
+
91
+ > div,
92
+ > svg {
93
+ position: relative;
94
+ }
95
+
96
+ &.highlight:before {
97
+ position: absolute;
98
+ top: 0;
99
+ left: 0;
100
+ right: 0;
101
+ bottom: 0;
102
+ border-radius: 50%;
103
+ box-shadow: 0 0 5px 2px #aaa;
104
+ content: '';
105
+ }
106
+ }
107
+ `;
108
+ exports.Identicon = react_1.default.memo(Icon);
@@ -0,0 +1,3 @@
1
+ export * from './icons/index.js';
2
+ export { Identicon } from './Identicon.js';
3
+ export { packageInfo } from './packageInfo.js';
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.packageInfo = exports.Identicon = void 0;
4
+ const tslib_1 = require("tslib");
5
+ tslib_1.__exportStar(require("./icons/index.js"), exports);
6
+ var Identicon_js_1 = require("./Identicon.js");
7
+ Object.defineProperty(exports, "Identicon", { enumerable: true, get: function () { return Identicon_js_1.Identicon; } });
8
+ var packageInfo_js_1 = require("./packageInfo.js");
9
+ Object.defineProperty(exports, "packageInfo", { enumerable: true, get: function () { return packageInfo_js_1.packageInfo; } });
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Beachball = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const jsx_runtime_1 = require("react/jsx-runtime");
6
+ const react_1 = tslib_1.__importStar(require("react"));
7
+ const ui_shared_1 = require("@pezkuwi/ui-shared");
8
+ function Identicon({ address, className = '', size, style = {} }) {
9
+ const updateElem = (0, react_1.useCallback)((node) => {
10
+ if (node) {
11
+ node.innerHTML = '';
12
+ node.appendChild((0, ui_shared_1.beachballIcon)(address, { isAlternative: false, size }));
13
+ }
14
+ }, [address, size]);
15
+ return ((0, jsx_runtime_1.jsx)("div", { className: className, ref: updateElem, style: style }));
16
+ }
17
+ exports.Beachball = react_1.default.memo(Identicon);
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Empty = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const jsx_runtime_1 = require("react/jsx-runtime");
6
+ const react_1 = tslib_1.__importDefault(require("react"));
7
+ function Identicon({ className = '', size, style = {} }) {
8
+ return ((0, jsx_runtime_1.jsx)("svg", { className: className, height: size, style: style, viewBox: '0 0 64 64', width: size }));
9
+ }
10
+ exports.Empty = react_1.default.memo(Identicon);
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Ethereum = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const jsx_runtime_1 = require("react/jsx-runtime");
6
+ const ethereum_blockies_base64_1 = tslib_1.__importDefault(require("ethereum-blockies-base64"));
7
+ const react_1 = tslib_1.__importStar(require("react"));
8
+ const styled_js_1 = require("../styled.js");
9
+ function Identicon({ address, className = '', size, style = {} }) {
10
+ const imgSrc = (0, react_1.useMemo)(() => (0, ethereum_blockies_base64_1.default)(address), [address]);
11
+ return ((0, jsx_runtime_1.jsx)(StyledImg, { className: className, size: size, src: imgSrc, style: style }));
12
+ }
13
+ const StyledImg = styled_js_1.styled.img(({ size }) => `
14
+ display: block;
15
+ height: ${size}px;
16
+ width: ${size}px;
17
+ `);
18
+ exports.Ethereum = react_1.default.memo(Identicon);
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Jdenticon = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const jsx_runtime_1 = require("react/jsx-runtime");
6
+ const jdenticon = tslib_1.__importStar(require("jdenticon"));
7
+ const react_1 = tslib_1.__importStar(require("react"));
8
+ function Identicon({ className = '', publicKey, size, style = {} }) {
9
+ const html = (0, react_1.useMemo)(() => ({ __html: jdenticon.toSvg(publicKey.substring(2), size) }), [publicKey, size]);
10
+ return ((0, jsx_runtime_1.jsx)("div", { className: className, dangerouslySetInnerHTML: html, style: style }));
11
+ }
12
+ exports.Jdenticon = react_1.default.memo(Identicon);
@@ -1,5 +1,5 @@
1
1
  import type { Props } from '../types.js';
2
2
  import React from 'react';
3
3
  declare function Identicon({ address, className, isAlternative, size, style }: Props): React.ReactElement<Props>;
4
- export declare const Polkadot: React.MemoExoticComponent<typeof Identicon>;
4
+ export declare const Pezkuwi: React.MemoExoticComponent<typeof Identicon>;
5
5
  export {};
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Pezkuwi = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const jsx_runtime_1 = require("react/jsx-runtime");
6
+ const react_1 = tslib_1.__importStar(require("react"));
7
+ const ui_shared_1 = require("@pezkuwi/ui-shared");
8
+ function renderCircle({ cx, cy, fill, r }, key) {
9
+ return ((0, jsx_runtime_1.jsx)("circle", { cx: cx, cy: cy, fill: fill, r: r }, key));
10
+ }
11
+ function Identicon({ address, className = '', isAlternative = false, size, style = {} }) {
12
+ const circles = (0, react_1.useMemo)(() => (0, ui_shared_1.pezkuwiIcon)(address, { isAlternative }), [address, isAlternative]);
13
+ return ((0, jsx_runtime_1.jsx)("svg", { className: className, height: size, id: address, name: address, style: style, viewBox: '0 0 64 64', width: size, children: circles.map(renderCircle) }));
14
+ }
15
+ exports.Pezkuwi = react_1.default.memo(Identicon);
@@ -2,4 +2,4 @@ export { Beachball } from './Beachball.js';
2
2
  export { Empty } from './Empty.js';
3
3
  export { Ethereum } from './Ethereum.js';
4
4
  export { Jdenticon } from './Jdenticon.js';
5
- export { Polkadot } from './Polkadot.js';
5
+ export { Pezkuwi } from './Pezkuwi.js';
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Pezkuwi = exports.Jdenticon = exports.Ethereum = exports.Empty = exports.Beachball = void 0;
4
+ var Beachball_js_1 = require("./Beachball.js");
5
+ Object.defineProperty(exports, "Beachball", { enumerable: true, get: function () { return Beachball_js_1.Beachball; } });
6
+ var Empty_js_1 = require("./Empty.js");
7
+ Object.defineProperty(exports, "Empty", { enumerable: true, get: function () { return Empty_js_1.Empty; } });
8
+ var Ethereum_js_1 = require("./Ethereum.js");
9
+ Object.defineProperty(exports, "Ethereum", { enumerable: true, get: function () { return Ethereum_js_1.Ethereum; } });
10
+ var Jdenticon_js_1 = require("./Jdenticon.js");
11
+ Object.defineProperty(exports, "Jdenticon", { enumerable: true, get: function () { return Jdenticon_js_1.Jdenticon; } });
12
+ var Pezkuwi_js_1 = require("./Pezkuwi.js");
13
+ Object.defineProperty(exports, "Pezkuwi", { enumerable: true, get: function () { return Pezkuwi_js_1.Pezkuwi; } });
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ require("./packageDetect.js");
5
+ const bundle_js_1 = require("./bundle.js");
6
+ tslib_1.__exportStar(require("./bundle.js"), exports);
7
+ exports.default = bundle_js_1.Identicon;
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.packageInfo = void 0;
4
+ exports.packageInfo = { name: '@pezkuwi/react-identicon', path: typeof __dirname === 'string' ? __dirname : 'auto', type: 'cjs', version: '3.17.0' };
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.styled = void 0;
4
+ var styled_components_1 = require("styled-components");
5
+ Object.defineProperty(exports, "styled", { enumerable: true, get: function () { return styled_components_1.styled; } });
@@ -20,4 +20,4 @@ export interface IdentityProps extends BaseProps {
20
20
  theme?: IconTheme;
21
21
  value?: string | Uint8Array | null;
22
22
  }
23
- export type IconTheme = 'beachball' | 'empty' | 'ethereum' | 'jdenticon' | 'polkadot' | 'substrate';
23
+ export type IconTheme = 'beachball' | 'bizinikiwi' | 'empty' | 'ethereum' | 'jdenticon' | 'pezkuwi';
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,5 @@
1
+ import type { Props } from '../types.js';
2
+ import React from 'react';
3
+ declare function Identicon({ address, className, size, style }: Props): React.ReactElement<Props>;
4
+ export declare const Beachball: React.MemoExoticComponent<typeof Identicon>;
5
+ export {};
@@ -0,0 +1,13 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import React, { useCallback } from 'react';
3
+ import { beachballIcon } from '@pezkuwi/ui-shared';
4
+ function Identicon({ address, className = '', size, style = {} }) {
5
+ const updateElem = useCallback((node) => {
6
+ if (node) {
7
+ node.innerHTML = '';
8
+ node.appendChild(beachballIcon(address, { isAlternative: false, size }));
9
+ }
10
+ }, [address, size]);
11
+ return (_jsx("div", { className: className, ref: updateElem, style: style }));
12
+ }
13
+ export const Beachball = React.memo(Identicon);
@@ -0,0 +1,5 @@
1
+ import type { Props } from '../types.js';
2
+ import React from 'react';
3
+ declare function Identicon({ className, size, style }: Props): React.ReactElement<Props>;
4
+ export declare const Empty: React.MemoExoticComponent<typeof Identicon>;
5
+ export {};
@@ -0,0 +1,6 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import React from 'react';
3
+ function Identicon({ className = '', size, style = {} }) {
4
+ return (_jsx("svg", { className: className, height: size, style: style, viewBox: '0 0 64 64', width: size }));
5
+ }
6
+ export const Empty = React.memo(Identicon);
@@ -0,0 +1,5 @@
1
+ import type { Props } from '../types.js';
2
+ import React from 'react';
3
+ declare function Identicon({ address, className, size, style }: Props): React.ReactElement<Props>;
4
+ export declare const Ethereum: React.MemoExoticComponent<typeof Identicon>;
5
+ export {};
@@ -0,0 +1,14 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import makeBlockie from 'ethereum-blockies-base64';
3
+ import React, { useMemo } from 'react';
4
+ import { styled } from '../styled.js';
5
+ function Identicon({ address, className = '', size, style = {} }) {
6
+ const imgSrc = useMemo(() => makeBlockie(address), [address]);
7
+ return (_jsx(StyledImg, { className: className, size: size, src: imgSrc, style: style }));
8
+ }
9
+ const StyledImg = styled.img(({ size }) => `
10
+ display: block;
11
+ height: ${size}px;
12
+ width: ${size}px;
13
+ `);
14
+ export const Ethereum = React.memo(Identicon);
@@ -0,0 +1,5 @@
1
+ import type { Props } from '../types.js';
2
+ import React from 'react';
3
+ declare function Identicon({ className, publicKey, size, style }: Props): React.ReactElement<Props>;
4
+ export declare const Jdenticon: React.MemoExoticComponent<typeof Identicon>;
5
+ export {};
@@ -0,0 +1,8 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import * as jdenticon from 'jdenticon';
3
+ import React, { useMemo } from 'react';
4
+ function Identicon({ className = '', publicKey, size, style = {} }) {
5
+ const html = useMemo(() => ({ __html: jdenticon.toSvg(publicKey.substring(2), size) }), [publicKey, size]);
6
+ return (_jsx("div", { className: className, dangerouslySetInnerHTML: html, style: style }));
7
+ }
8
+ export const Jdenticon = React.memo(Identicon);
@@ -0,0 +1,5 @@
1
+ import type { Props } from '../types.js';
2
+ import React from 'react';
3
+ declare function Identicon({ address, className, isAlternative, size, style }: Props): React.ReactElement<Props>;
4
+ export declare const Pezkuwi: React.MemoExoticComponent<typeof Identicon>;
5
+ export {};
@@ -0,0 +1,11 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import React, { useMemo } from 'react';
3
+ import { pezkuwiIcon } from '@pezkuwi/ui-shared';
4
+ function renderCircle({ cx, cy, fill, r }, key) {
5
+ return (_jsx("circle", { cx: cx, cy: cy, fill: fill, r: r }, key));
6
+ }
7
+ function Identicon({ address, className = '', isAlternative = false, size, style = {} }) {
8
+ const circles = useMemo(() => pezkuwiIcon(address, { isAlternative }), [address, isAlternative]);
9
+ return (_jsx("svg", { className: className, height: size, id: address, name: address, style: style, viewBox: '0 0 64 64', width: size, children: circles.map(renderCircle) }));
10
+ }
11
+ export const Pezkuwi = React.memo(Identicon);
@@ -0,0 +1,5 @@
1
+ export { Beachball } from './Beachball.js';
2
+ export { Empty } from './Empty.js';
3
+ export { Ethereum } from './Ethereum.js';
4
+ export { Jdenticon } from './Jdenticon.js';
5
+ export { Pezkuwi } from './Pezkuwi.js';
@@ -0,0 +1,5 @@
1
+ export { Beachball } from './Beachball.js';
2
+ export { Empty } from './Empty.js';
3
+ export { Ethereum } from './Ethereum.js';
4
+ export { Jdenticon } from './Jdenticon.js';
5
+ export { Pezkuwi } from './Pezkuwi.js';
@@ -0,0 +1,4 @@
1
+ import './packageDetect.js';
2
+ import { Identicon } from './bundle.js';
3
+ export * from './bundle.js';
4
+ export default Identicon;
package/build/index.js ADDED
@@ -0,0 +1,4 @@
1
+ import './packageDetect.js';
2
+ import { Identicon } from './bundle.js';
3
+ export * from './bundle.js';
4
+ export default Identicon;
@@ -0,0 +1,249 @@
1
+ {
2
+ "author": "Jaco Greeff <jacogr@gmail.com>",
3
+ "bugs": "https://github.com/pezkuwichain/ui/issues",
4
+ "description": "Renders an SVG picture representing an address",
5
+ "engines": {
6
+ "node": ">=18"
7
+ },
8
+ "homepage": "https://github.com/pezkuwichain/ui/tree/master/packages/react-identicon#readme",
9
+ "license": "Apache-2.0",
10
+ "name": "@pezkuwi/react-identicon",
11
+ "repository": {
12
+ "directory": "packages/react-identicon",
13
+ "type": "git",
14
+ "url": "https://github.com/pezkuwichain/ui.git"
15
+ },
16
+ "sideEffects": [
17
+ "./packageDetect.js",
18
+ "./cjs/packageDetect.js"
19
+ ],
20
+ "type": "module",
21
+ "version": "3.17.0",
22
+ "main": "./cjs/index.js",
23
+ "module": "./index.js",
24
+ "types": "./index.d.ts",
25
+ "exports": {
26
+ "./cjs/package.json": "./cjs/package.json",
27
+ "./cjs/*": "./cjs/*.js",
28
+ ".": {
29
+ "module": {
30
+ "types": "./index.d.ts",
31
+ "default": "./index.js"
32
+ },
33
+ "require": {
34
+ "types": "./cjs/index.d.ts",
35
+ "default": "./cjs/index.js"
36
+ },
37
+ "default": {
38
+ "types": "./index.d.ts",
39
+ "default": "./index.js"
40
+ }
41
+ },
42
+ "./bundle": {
43
+ "module": {
44
+ "types": "./bundle.d.ts",
45
+ "default": "./bundle.js"
46
+ },
47
+ "require": {
48
+ "types": "./cjs/bundle.d.ts",
49
+ "default": "./cjs/bundle.js"
50
+ },
51
+ "default": {
52
+ "types": "./bundle.d.ts",
53
+ "default": "./bundle.js"
54
+ }
55
+ },
56
+ "./icons": {
57
+ "module": {
58
+ "types": "./icons/index.d.ts",
59
+ "default": "./icons/index.js"
60
+ },
61
+ "require": {
62
+ "types": "./cjs/icons/index.d.ts",
63
+ "default": "./cjs/icons/index.js"
64
+ },
65
+ "default": {
66
+ "types": "./icons/index.d.ts",
67
+ "default": "./icons/index.js"
68
+ }
69
+ },
70
+ "./icons/Beachball": {
71
+ "module": {
72
+ "types": "./icons/Beachball.d.ts",
73
+ "default": "./icons/Beachball.js"
74
+ },
75
+ "require": {
76
+ "types": "./cjs/icons/Beachball.d.ts",
77
+ "default": "./cjs/icons/Beachball.js"
78
+ },
79
+ "default": {
80
+ "types": "./icons/Beachball.d.ts",
81
+ "default": "./icons/Beachball.js"
82
+ }
83
+ },
84
+ "./icons/Empty": {
85
+ "module": {
86
+ "types": "./icons/Empty.d.ts",
87
+ "default": "./icons/Empty.js"
88
+ },
89
+ "require": {
90
+ "types": "./cjs/icons/Empty.d.ts",
91
+ "default": "./cjs/icons/Empty.js"
92
+ },
93
+ "default": {
94
+ "types": "./icons/Empty.d.ts",
95
+ "default": "./icons/Empty.js"
96
+ }
97
+ },
98
+ "./icons/Ethereum": {
99
+ "module": {
100
+ "types": "./icons/Ethereum.d.ts",
101
+ "default": "./icons/Ethereum.js"
102
+ },
103
+ "require": {
104
+ "types": "./cjs/icons/Ethereum.d.ts",
105
+ "default": "./cjs/icons/Ethereum.js"
106
+ },
107
+ "default": {
108
+ "types": "./icons/Ethereum.d.ts",
109
+ "default": "./icons/Ethereum.js"
110
+ }
111
+ },
112
+ "./icons/Jdenticon": {
113
+ "module": {
114
+ "types": "./icons/Jdenticon.d.ts",
115
+ "default": "./icons/Jdenticon.js"
116
+ },
117
+ "require": {
118
+ "types": "./cjs/icons/Jdenticon.d.ts",
119
+ "default": "./cjs/icons/Jdenticon.js"
120
+ },
121
+ "default": {
122
+ "types": "./icons/Jdenticon.d.ts",
123
+ "default": "./icons/Jdenticon.js"
124
+ }
125
+ },
126
+ "./icons/Pezkuwi": {
127
+ "module": {
128
+ "types": "./icons/Pezkuwi.d.ts",
129
+ "default": "./icons/Pezkuwi.js"
130
+ },
131
+ "require": {
132
+ "types": "./cjs/icons/Pezkuwi.d.ts",
133
+ "default": "./cjs/icons/Pezkuwi.js"
134
+ },
135
+ "default": {
136
+ "types": "./icons/Pezkuwi.d.ts",
137
+ "default": "./icons/Pezkuwi.js"
138
+ }
139
+ },
140
+ "./Identicon": {
141
+ "module": {
142
+ "types": "./Identicon.d.ts",
143
+ "default": "./Identicon.js"
144
+ },
145
+ "require": {
146
+ "types": "./cjs/Identicon.d.ts",
147
+ "default": "./cjs/Identicon.js"
148
+ },
149
+ "default": {
150
+ "types": "./Identicon.d.ts",
151
+ "default": "./Identicon.js"
152
+ }
153
+ },
154
+ "./package.json": {
155
+ "require": "./cjs/package.json",
156
+ "default": "./package.json"
157
+ },
158
+ "./packageDetect": {
159
+ "module": {
160
+ "types": "./packageDetect.d.ts",
161
+ "default": "./packageDetect.js"
162
+ },
163
+ "require": {
164
+ "types": "./cjs/packageDetect.d.ts",
165
+ "default": "./cjs/packageDetect.js"
166
+ },
167
+ "default": {
168
+ "types": "./packageDetect.d.ts",
169
+ "default": "./packageDetect.js"
170
+ }
171
+ },
172
+ "./packageInfo.js": {
173
+ "module": {
174
+ "types": "./packageInfo.d.ts",
175
+ "default": "./packageInfo.js"
176
+ },
177
+ "require": {
178
+ "types": "./cjs/packageInfo.d.ts",
179
+ "default": "./cjs/packageInfo.js"
180
+ },
181
+ "default": {
182
+ "types": "./packageInfo.d.ts",
183
+ "default": "./packageInfo.js"
184
+ }
185
+ },
186
+ "./packageInfo": {
187
+ "module": {
188
+ "types": "./packageInfo.d.ts",
189
+ "default": "./packageInfo.js"
190
+ },
191
+ "require": {
192
+ "types": "./cjs/packageInfo.d.ts",
193
+ "default": "./cjs/packageInfo.js"
194
+ },
195
+ "default": {
196
+ "types": "./packageInfo.d.ts",
197
+ "default": "./packageInfo.js"
198
+ }
199
+ },
200
+ "./styled": {
201
+ "module": {
202
+ "types": "./styled.d.ts",
203
+ "default": "./styled.js"
204
+ },
205
+ "require": {
206
+ "types": "./cjs/styled.d.ts",
207
+ "default": "./cjs/styled.js"
208
+ },
209
+ "default": {
210
+ "types": "./styled.d.ts",
211
+ "default": "./styled.js"
212
+ }
213
+ },
214
+ "./types": {
215
+ "module": {
216
+ "types": "./types.d.ts",
217
+ "default": "./types.js"
218
+ },
219
+ "require": {
220
+ "types": "./cjs/types.d.ts",
221
+ "default": "./cjs/types.js"
222
+ },
223
+ "default": {
224
+ "types": "./types.d.ts",
225
+ "default": "./types.js"
226
+ }
227
+ }
228
+ },
229
+ "dependencies": {
230
+ "@pezkuwi/keyring": "^14.0.5",
231
+ "@pezkuwi/ui-settings": "3.16.6",
232
+ "@pezkuwi/ui-shared": "3.16.6",
233
+ "@pezkuwi/util": "^14.0.5",
234
+ "@pezkuwi/util-crypto": "^14.0.5",
235
+ "ethereum-blockies-base64": "^1.0.2",
236
+ "jdenticon": "3.2.0",
237
+ "react-copy-to-clipboard": "^5.1.0",
238
+ "styled-components": "^6.1.1",
239
+ "tslib": "^2.8.1"
240
+ },
241
+ "peerDependencies": {
242
+ "@pezkuwi/keyring": "*",
243
+ "@pezkuwi/util": "*",
244
+ "@pezkuwi/util-crypto": "*",
245
+ "react": "*",
246
+ "react-dom": "*",
247
+ "react-is": "*"
248
+ }
249
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,5 @@
1
+ import { packageInfo as settingsInfo } from '@pezkuwi/ui-settings/packageInfo';
2
+ import { packageInfo as sharedInfo } from '@pezkuwi/ui-shared/packageInfo';
3
+ import { detectPackage } from '@pezkuwi/util';
4
+ import { packageInfo } from './packageInfo.js';
5
+ detectPackage(packageInfo, null, [settingsInfo, sharedInfo]);
@@ -0,0 +1,6 @@
1
+ export declare const packageInfo: {
2
+ name: string;
3
+ path: string;
4
+ type: string;
5
+ version: string;
6
+ };