@pezkuwi/react-identicon 3.16.6 → 3.16.8
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/package.json +209 -8
- package/build/Identicon.js +0 -104
- package/build/README.md +0 -34
- package/build/bundle.js +0 -3
- package/build/cjs/Identicon.d.ts +0 -5
- package/build/cjs/Identicon.js +0 -108
- package/build/cjs/bundle.d.ts +0 -3
- package/build/cjs/bundle.js +0 -9
- package/build/cjs/icons/Beachball.js +0 -17
- package/build/cjs/icons/Empty.js +0 -10
- package/build/cjs/icons/Ethereum.js +0 -18
- package/build/cjs/icons/Jdenticon.js +0 -12
- package/build/cjs/icons/Polkadot.js +0 -15
- package/build/cjs/icons/index.js +0 -13
- package/build/cjs/index.js +0 -7
- package/build/cjs/packageInfo.js +0 -4
- package/build/cjs/styled.js +0 -5
- package/build/cjs/types.js +0 -2
- package/build/icons/Beachball.d.ts +0 -5
- package/build/icons/Beachball.js +0 -13
- package/build/icons/Empty.d.ts +0 -5
- package/build/icons/Empty.js +0 -6
- package/build/icons/Ethereum.d.ts +0 -5
- package/build/icons/Ethereum.js +0 -14
- package/build/icons/Jdenticon.d.ts +0 -5
- package/build/icons/Jdenticon.js +0 -8
- package/build/icons/Polkadot.d.ts +0 -5
- package/build/icons/Polkadot.js +0 -11
- package/build/icons/index.d.ts +0 -5
- package/build/icons/index.js +0 -5
- package/build/index.d.ts +0 -4
- package/build/index.js +0 -4
- package/build/package.json +0 -249
- package/build/packageDetect.d.ts +0 -1
- package/build/packageDetect.js +0 -5
- package/build/packageInfo.d.ts +0 -6
- package/build/packageInfo.js +0 -1
- package/build/styled.d.ts +0 -1
- package/build/styled.js +0 -1
- package/build/types.d.ts +0 -23
- package/build/types.js +0 -1
- package/build-tsc-cjs/packageDetect.js +0 -7
- package/demo.png +0 -0
- package/index.html +0 -17
- package/src/Identicon.tsx +0 -154
- package/src/bundle.ts +0 -6
- package/src/icons/Beachball.tsx +0 -32
- package/src/icons/Empty.tsx +0 -20
- package/src/icons/Ethereum.tsx +0 -37
- package/src/icons/Jdenticon.tsx +0 -24
- package/src/icons/Polkadot.tsx +0 -59
- package/src/icons/index.ts +0 -8
- package/src/index.ts +0 -10
- package/src/packageDetect.ts +0 -13
- package/src/packageInfo.ts +0 -6
- package/src/styled.ts +0 -4
- package/src/types.ts +0 -30
- package/tsconfig.build.json +0 -12
- package/tsconfig.build.tsbuildinfo +0 -1
- /package/{build-tsc/Identicon.d.ts → Identicon.d.ts} +0 -0
- /package/{build-tsc-esm/Identicon.js → Identicon.js} +0 -0
- /package/{build/LICENSE → LICENSE} +0 -0
- /package/{build/bundle-pezkuwi-react-identicon.js → bundle-pezkuwi-react-identicon.js} +0 -0
- /package/{build-tsc/bundle.d.ts → bundle.d.ts} +0 -0
- /package/{build-tsc-esm/bundle.js → bundle.js} +0 -0
- /package/{build → cjs}/Identicon.d.ts +0 -0
- /package/{build-tsc-cjs → cjs}/Identicon.js +0 -0
- /package/{build → cjs}/bundle.d.ts +0 -0
- /package/{build-tsc-cjs → cjs}/bundle.js +0 -0
- /package/{build-tsc → cjs}/icons/Beachball.d.ts +0 -0
- /package/{build-tsc-cjs → cjs}/icons/Beachball.js +0 -0
- /package/{build-tsc → cjs}/icons/Empty.d.ts +0 -0
- /package/{build-tsc-cjs → cjs}/icons/Empty.js +0 -0
- /package/{build-tsc → cjs}/icons/Ethereum.d.ts +0 -0
- /package/{build-tsc-cjs → cjs}/icons/Ethereum.js +0 -0
- /package/{build-tsc → cjs}/icons/Jdenticon.d.ts +0 -0
- /package/{build-tsc-cjs → cjs}/icons/Jdenticon.js +0 -0
- /package/{build-tsc → cjs}/icons/Polkadot.d.ts +0 -0
- /package/{build-tsc-cjs → cjs}/icons/Polkadot.js +0 -0
- /package/{build-tsc → cjs}/icons/index.d.ts +0 -0
- /package/{build-tsc-cjs → cjs}/icons/index.js +0 -0
- /package/{build-tsc → cjs}/index.d.ts +0 -0
- /package/{build-tsc-cjs → cjs}/index.js +0 -0
- /package/{build/cjs → cjs}/package.json +0 -0
- /package/{build-tsc → cjs}/packageDetect.d.ts +0 -0
- /package/{build/cjs → cjs}/packageDetect.js +0 -0
- /package/{build-tsc → cjs}/packageInfo.d.ts +0 -0
- /package/{build-tsc-cjs → cjs}/packageInfo.js +0 -0
- /package/{build-tsc → cjs}/styled.d.ts +0 -0
- /package/{build-tsc-cjs → cjs}/styled.js +0 -0
- /package/{build-tsc → cjs}/types.d.ts +0 -0
- /package/{build-tsc-cjs → cjs}/types.js +0 -0
- /package/{build/cjs/icons → icons}/Beachball.d.ts +0 -0
- /package/{build-tsc-esm/icons → icons}/Beachball.js +0 -0
- /package/{build/cjs/icons → icons}/Empty.d.ts +0 -0
- /package/{build-tsc-esm/icons → icons}/Empty.js +0 -0
- /package/{build/cjs/icons → icons}/Ethereum.d.ts +0 -0
- /package/{build-tsc-esm/icons → icons}/Ethereum.js +0 -0
- /package/{build/cjs/icons → icons}/Jdenticon.d.ts +0 -0
- /package/{build-tsc-esm/icons → icons}/Jdenticon.js +0 -0
- /package/{build/cjs/icons → icons}/Polkadot.d.ts +0 -0
- /package/{build-tsc-esm/icons → icons}/Polkadot.js +0 -0
- /package/{build/cjs/icons → icons}/index.d.ts +0 -0
- /package/{build-tsc-esm/icons → icons}/index.js +0 -0
- /package/{build/cjs/index.d.ts → index.d.ts} +0 -0
- /package/{build-tsc-esm/index.js → index.js} +0 -0
- /package/{build/cjs/packageDetect.d.ts → packageDetect.d.ts} +0 -0
- /package/{build-tsc-esm/packageDetect.js → packageDetect.js} +0 -0
- /package/{build/cjs/packageInfo.d.ts → packageInfo.d.ts} +0 -0
- /package/{build-tsc-esm/packageInfo.js → packageInfo.js} +0 -0
- /package/{build/cjs/styled.d.ts → styled.d.ts} +0 -0
- /package/{build-tsc-esm/styled.js → styled.js} +0 -0
- /package/{build/cjs/types.d.ts → types.d.ts} +0 -0
- /package/{build-tsc-esm/types.js → types.js} +0 -0
package/build/icons/Ethereum.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
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);
|
package/build/icons/Jdenticon.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
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);
|
|
@@ -1,5 +0,0 @@
|
|
|
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 Polkadot: React.MemoExoticComponent<typeof Identicon>;
|
|
5
|
-
export {};
|
package/build/icons/Polkadot.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import React, { useMemo } from 'react';
|
|
3
|
-
import { polkadotIcon } 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(() => polkadotIcon(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 Polkadot = React.memo(Identicon);
|
package/build/icons/index.d.ts
DELETED
package/build/icons/index.js
DELETED
package/build/index.d.ts
DELETED
package/build/index.js
DELETED
package/build/package.json
DELETED
|
@@ -1,249 +0,0 @@
|
|
|
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.16.6",
|
|
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/Polkadot": {
|
|
127
|
-
"module": {
|
|
128
|
-
"types": "./icons/Polkadot.d.ts",
|
|
129
|
-
"default": "./icons/Polkadot.js"
|
|
130
|
-
},
|
|
131
|
-
"require": {
|
|
132
|
-
"types": "./cjs/icons/Polkadot.d.ts",
|
|
133
|
-
"default": "./cjs/icons/Polkadot.js"
|
|
134
|
-
},
|
|
135
|
-
"default": {
|
|
136
|
-
"types": "./icons/Polkadot.d.ts",
|
|
137
|
-
"default": "./icons/Polkadot.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
|
-
}
|
package/build/packageDetect.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/build/packageDetect.js
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
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]);
|
package/build/packageInfo.d.ts
DELETED
package/build/packageInfo.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export const packageInfo = { name: '@pezkuwi/react-identicon', path: (import.meta && import.meta.url) ? new URL(import.meta.url).pathname.substring(0, new URL(import.meta.url).pathname.lastIndexOf('/') + 1) : 'auto', type: 'esm', version: '3.16.6' };
|
package/build/styled.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { styled } from 'styled-components';
|
package/build/styled.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { styled } from 'styled-components';
|
package/build/types.d.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import type React from 'react';
|
|
2
|
-
import type { Prefix } from '@pezkuwi/util-crypto/address/types';
|
|
3
|
-
export interface BaseProps {
|
|
4
|
-
className?: string;
|
|
5
|
-
style?: React.CSSProperties;
|
|
6
|
-
}
|
|
7
|
-
export interface Props extends BaseProps {
|
|
8
|
-
address: string;
|
|
9
|
-
isAlternative?: boolean | undefined;
|
|
10
|
-
publicKey: string;
|
|
11
|
-
size: number;
|
|
12
|
-
}
|
|
13
|
-
export interface IdentityProps extends BaseProps {
|
|
14
|
-
Custom?: React.ComponentType<Props>;
|
|
15
|
-
isAlternative?: boolean;
|
|
16
|
-
isHighlight?: boolean;
|
|
17
|
-
onCopy?: (value: string) => void;
|
|
18
|
-
prefix?: Prefix;
|
|
19
|
-
size?: number;
|
|
20
|
-
theme?: IconTheme;
|
|
21
|
-
value?: string | Uint8Array | null;
|
|
22
|
-
}
|
|
23
|
-
export type IconTheme = 'beachball' | 'empty' | 'ethereum' | 'jdenticon' | 'polkadot' | 'substrate';
|
package/build/types.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const packageInfo_1 = require("@pezkuwi/ui-settings/packageInfo");
|
|
4
|
-
const packageInfo_2 = require("@pezkuwi/ui-shared/packageInfo");
|
|
5
|
-
const util_1 = require("@pezkuwi/util");
|
|
6
|
-
const packageInfo_js_1 = require("./packageInfo.js");
|
|
7
|
-
(0, util_1.detectPackage)(packageInfo_js_1.packageInfo, null, [packageInfo_1.packageInfo, packageInfo_2.packageInfo]);
|
package/demo.png
DELETED
|
Binary file
|
package/index.html
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
<html>
|
|
2
|
-
<head>
|
|
3
|
-
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css" />
|
|
4
|
-
<style>
|
|
5
|
-
#demo {
|
|
6
|
-
padding: 0.5em;
|
|
7
|
-
}
|
|
8
|
-
.padded {
|
|
9
|
-
margin: 0.5em !important;
|
|
10
|
-
}
|
|
11
|
-
</style>
|
|
12
|
-
</head>
|
|
13
|
-
<body>
|
|
14
|
-
<div id="demo"></div>
|
|
15
|
-
<script src="./build/Demo.js"></script>
|
|
16
|
-
</body>
|
|
17
|
-
</html>
|
package/src/Identicon.tsx
DELETED
|
@@ -1,154 +0,0 @@
|
|
|
1
|
-
// Copyright 2017-2025 @pezkuwi/react-identicon authors & contributors
|
|
2
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
|
|
4
|
-
import type { Prefix } from '@pezkuwi/util-crypto/address/types';
|
|
5
|
-
import type { IdentityProps as Props, Props as ComponentProps } from './types.js';
|
|
6
|
-
|
|
7
|
-
import React from 'react';
|
|
8
|
-
import CopyToClipboard from 'react-copy-to-clipboard';
|
|
9
|
-
|
|
10
|
-
import { ICON_DEFAULT_HOST, settings } from '@pezkuwi/ui-settings';
|
|
11
|
-
import { isHex, isU8a, u8aToHex } from '@pezkuwi/util';
|
|
12
|
-
import { decodeAddress, encodeAddress, ethereumEncode } from '@pezkuwi/util-crypto';
|
|
13
|
-
|
|
14
|
-
import { Beachball, Empty, Ethereum, Jdenticon, Polkadot } from './icons/index.js';
|
|
15
|
-
import { styled } from './styled.js';
|
|
16
|
-
|
|
17
|
-
const Fallback = Beachball;
|
|
18
|
-
|
|
19
|
-
interface State {
|
|
20
|
-
address: string;
|
|
21
|
-
publicKey: string;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
const DEFAULT_SIZE = 64;
|
|
25
|
-
const Components: Record<string, React.ComponentType<ComponentProps>> = {
|
|
26
|
-
beachball: Beachball,
|
|
27
|
-
empty: Empty,
|
|
28
|
-
ethereum: Ethereum,
|
|
29
|
-
jdenticon: Jdenticon,
|
|
30
|
-
polkadot: Polkadot,
|
|
31
|
-
substrate: Jdenticon
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
class BaseIcon extends React.PureComponent<Props, State> {
|
|
35
|
-
public override state: State = {
|
|
36
|
-
address: '',
|
|
37
|
-
publicKey: '0x'
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
private static prefix?: Prefix = undefined;
|
|
41
|
-
|
|
42
|
-
public static setDefaultPrefix (prefix: Prefix): void {
|
|
43
|
-
BaseIcon.prefix = prefix;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
public static getDerivedStateFromProps ({ prefix = BaseIcon.prefix, theme, value }: Props, prevState: State): State | null {
|
|
47
|
-
if (theme === 'ethereum') {
|
|
48
|
-
const address = isU8a(value)
|
|
49
|
-
? ethereumEncode(value)
|
|
50
|
-
: value || '';
|
|
51
|
-
|
|
52
|
-
return { address, publicKey: '' };
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
try {
|
|
56
|
-
const address = isU8a(value) || isHex(value)
|
|
57
|
-
? encodeAddress(value, prefix)
|
|
58
|
-
: (value || '');
|
|
59
|
-
const publicKey = u8aToHex(decodeAddress(address, false, prefix));
|
|
60
|
-
|
|
61
|
-
return address === prevState.address
|
|
62
|
-
? null
|
|
63
|
-
: {
|
|
64
|
-
address,
|
|
65
|
-
publicKey
|
|
66
|
-
};
|
|
67
|
-
} catch {
|
|
68
|
-
return {
|
|
69
|
-
address: '',
|
|
70
|
-
publicKey: '0x'
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
public override render (): React.ReactNode {
|
|
76
|
-
const { address } = this.state;
|
|
77
|
-
const wrapped = this.getWrapped(this.state, this.props);
|
|
78
|
-
|
|
79
|
-
return !address
|
|
80
|
-
? wrapped
|
|
81
|
-
: (
|
|
82
|
-
<CopyToClipboard
|
|
83
|
-
onCopy={this.onCopy}
|
|
84
|
-
text={address}
|
|
85
|
-
>
|
|
86
|
-
{wrapped}
|
|
87
|
-
</CopyToClipboard>
|
|
88
|
-
);
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
private getWrapped ({ address, publicKey }: State, { Custom }: Props): React.ReactNode {
|
|
92
|
-
const { className = '', isAlternative, isHighlight, size = DEFAULT_SIZE, style = {}, theme = settings.icon } = this.props;
|
|
93
|
-
const Component = !address
|
|
94
|
-
? Empty
|
|
95
|
-
: Custom || Components[theme === 'default' ? ICON_DEFAULT_HOST : theme] || Fallback;
|
|
96
|
-
|
|
97
|
-
return (
|
|
98
|
-
<StyledDiv
|
|
99
|
-
className={`ui--IdentityIcon ${className}`}
|
|
100
|
-
key={address}
|
|
101
|
-
style={style}
|
|
102
|
-
>
|
|
103
|
-
<Component
|
|
104
|
-
address={address}
|
|
105
|
-
className={isHighlight ? 'highlight' : ''}
|
|
106
|
-
isAlternative={isAlternative}
|
|
107
|
-
publicKey={publicKey}
|
|
108
|
-
size={size}
|
|
109
|
-
/>
|
|
110
|
-
</StyledDiv>
|
|
111
|
-
);
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
private onCopy = (): void => {
|
|
115
|
-
const { onCopy } = this.props;
|
|
116
|
-
const { address } = this.state;
|
|
117
|
-
|
|
118
|
-
if (address && onCopy) {
|
|
119
|
-
onCopy(address);
|
|
120
|
-
}
|
|
121
|
-
};
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
function Icon (props: Props): React.ReactElement<Props> {
|
|
125
|
-
return <BaseIcon {...props} />;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
const StyledDiv = styled.div`
|
|
129
|
-
cursor: copy;
|
|
130
|
-
display: inline-block;
|
|
131
|
-
line-height: 0;
|
|
132
|
-
|
|
133
|
-
> .container {
|
|
134
|
-
position: relative;
|
|
135
|
-
|
|
136
|
-
> div,
|
|
137
|
-
> svg {
|
|
138
|
-
position: relative;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
&.highlight:before {
|
|
142
|
-
position: absolute;
|
|
143
|
-
top: 0;
|
|
144
|
-
left: 0;
|
|
145
|
-
right: 0;
|
|
146
|
-
bottom: 0;
|
|
147
|
-
border-radius: 50%;
|
|
148
|
-
box-shadow: 0 0 5px 2px #aaa;
|
|
149
|
-
content: '';
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
`;
|
|
153
|
-
|
|
154
|
-
export const Identicon = React.memo(Icon);
|
package/src/bundle.ts
DELETED
package/src/icons/Beachball.tsx
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
// Copyright 2017-2025 @pezkuwi/react-identicon authors & contributors
|
|
2
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
|
|
4
|
-
import type { Props } from '../types.js';
|
|
5
|
-
|
|
6
|
-
import React, { useCallback } from 'react';
|
|
7
|
-
|
|
8
|
-
import { beachballIcon } from '@pezkuwi/ui-shared';
|
|
9
|
-
|
|
10
|
-
function Identicon ({ address, className = '', size, style = {} }: Props): React.ReactElement<Props> {
|
|
11
|
-
const updateElem = useCallback(
|
|
12
|
-
(node: HTMLDivElement): void => {
|
|
13
|
-
if (node) {
|
|
14
|
-
node.innerHTML = '';
|
|
15
|
-
node.appendChild(
|
|
16
|
-
beachballIcon(address, { isAlternative: false, size })
|
|
17
|
-
);
|
|
18
|
-
}
|
|
19
|
-
},
|
|
20
|
-
[address, size]
|
|
21
|
-
);
|
|
22
|
-
|
|
23
|
-
return (
|
|
24
|
-
<div
|
|
25
|
-
className={className}
|
|
26
|
-
ref={updateElem}
|
|
27
|
-
style={style}
|
|
28
|
-
/>
|
|
29
|
-
);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export const Beachball = React.memo(Identicon);
|
package/src/icons/Empty.tsx
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
// Copyright 2017-2025 @pezkuwi/react-identicon authors & contributors
|
|
2
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
|
|
4
|
-
import type { Props } from '../types.js';
|
|
5
|
-
|
|
6
|
-
import React from 'react';
|
|
7
|
-
|
|
8
|
-
function Identicon ({ className = '', size, style = {} }: Props): React.ReactElement<Props> {
|
|
9
|
-
return (
|
|
10
|
-
<svg
|
|
11
|
-
className={className}
|
|
12
|
-
height={size}
|
|
13
|
-
style={style}
|
|
14
|
-
viewBox='0 0 64 64'
|
|
15
|
-
width={size}
|
|
16
|
-
/>
|
|
17
|
-
);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export const Empty = React.memo(Identicon);
|
package/src/icons/Ethereum.tsx
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
// Copyright 2017-2025 @pezkuwi/react-identicon authors & contributors
|
|
2
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
|
|
4
|
-
import type { Props } from '../types.js';
|
|
5
|
-
|
|
6
|
-
import makeBlockie from 'ethereum-blockies-base64';
|
|
7
|
-
import React, { useMemo } from 'react';
|
|
8
|
-
|
|
9
|
-
import { styled } from '../styled.js';
|
|
10
|
-
|
|
11
|
-
interface ImgProps {
|
|
12
|
-
size: number;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
function Identicon ({ address, className = '', size, style = {} }: Props): React.ReactElement<Props> {
|
|
16
|
-
const imgSrc = useMemo(
|
|
17
|
-
() => makeBlockie(address),
|
|
18
|
-
[address]
|
|
19
|
-
);
|
|
20
|
-
|
|
21
|
-
return (
|
|
22
|
-
<StyledImg
|
|
23
|
-
className={className}
|
|
24
|
-
size={size}
|
|
25
|
-
src={imgSrc}
|
|
26
|
-
style={style}
|
|
27
|
-
/>
|
|
28
|
-
);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
const StyledImg = styled.img<ImgProps>(({ size }) => `
|
|
32
|
-
display: block;
|
|
33
|
-
height: ${size}px;
|
|
34
|
-
width: ${size}px;
|
|
35
|
-
`);
|
|
36
|
-
|
|
37
|
-
export const Ethereum = React.memo(Identicon);
|