@pezkuwi/react-identicon 3.16.6
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 +34 -0
- package/build/Identicon.d.ts +5 -0
- package/build/Identicon.js +104 -0
- package/build/LICENSE +201 -0
- package/build/README.md +34 -0
- package/build/bundle-pezkuwi-react-identicon.js +2858 -0
- package/build/bundle.d.ts +3 -0
- package/build/bundle.js +3 -0
- package/build/cjs/Identicon.d.ts +5 -0
- package/build/cjs/Identicon.js +108 -0
- package/build/cjs/bundle.d.ts +3 -0
- package/build/cjs/bundle.js +9 -0
- package/build/cjs/icons/Beachball.d.ts +5 -0
- package/build/cjs/icons/Beachball.js +17 -0
- package/build/cjs/icons/Empty.d.ts +5 -0
- package/build/cjs/icons/Empty.js +10 -0
- package/build/cjs/icons/Ethereum.d.ts +5 -0
- package/build/cjs/icons/Ethereum.js +18 -0
- package/build/cjs/icons/Jdenticon.d.ts +5 -0
- package/build/cjs/icons/Jdenticon.js +12 -0
- package/build/cjs/icons/Polkadot.d.ts +5 -0
- package/build/cjs/icons/Polkadot.js +15 -0
- package/build/cjs/icons/index.d.ts +5 -0
- package/build/cjs/icons/index.js +13 -0
- package/build/cjs/index.d.ts +4 -0
- package/build/cjs/index.js +7 -0
- package/build/cjs/package.json +3 -0
- package/build/cjs/packageDetect.d.ts +1 -0
- package/build/cjs/packageDetect.js +7 -0
- package/build/cjs/packageInfo.d.ts +6 -0
- package/build/cjs/packageInfo.js +4 -0
- package/build/cjs/styled.d.ts +1 -0
- package/build/cjs/styled.js +5 -0
- package/build/cjs/types.d.ts +23 -0
- package/build/cjs/types.js +2 -0
- package/build/icons/Beachball.d.ts +5 -0
- package/build/icons/Beachball.js +13 -0
- package/build/icons/Empty.d.ts +5 -0
- package/build/icons/Empty.js +6 -0
- package/build/icons/Ethereum.d.ts +5 -0
- package/build/icons/Ethereum.js +14 -0
- package/build/icons/Jdenticon.d.ts +5 -0
- package/build/icons/Jdenticon.js +8 -0
- package/build/icons/Polkadot.d.ts +5 -0
- package/build/icons/Polkadot.js +11 -0
- package/build/icons/index.d.ts +5 -0
- package/build/icons/index.js +5 -0
- package/build/index.d.ts +4 -0
- package/build/index.js +4 -0
- package/build/package.json +249 -0
- package/build/packageDetect.d.ts +1 -0
- package/build/packageDetect.js +5 -0
- package/build/packageInfo.d.ts +6 -0
- package/build/packageInfo.js +1 -0
- package/build/styled.d.ts +1 -0
- package/build/styled.js +1 -0
- package/build/types.d.ts +23 -0
- package/build/types.js +1 -0
- package/build-tsc/Identicon.d.ts +5 -0
- package/build-tsc/bundle.d.ts +3 -0
- package/build-tsc/icons/Beachball.d.ts +5 -0
- package/build-tsc/icons/Empty.d.ts +5 -0
- package/build-tsc/icons/Ethereum.d.ts +5 -0
- package/build-tsc/icons/Jdenticon.d.ts +5 -0
- package/build-tsc/icons/Polkadot.d.ts +5 -0
- package/build-tsc/icons/index.d.ts +5 -0
- package/build-tsc/index.d.ts +4 -0
- package/build-tsc/packageDetect.d.ts +1 -0
- package/build-tsc/packageInfo.d.ts +6 -0
- package/build-tsc/styled.d.ts +1 -0
- package/build-tsc/types.d.ts +23 -0
- package/build-tsc-cjs/Identicon.js +108 -0
- package/build-tsc-cjs/bundle.js +9 -0
- package/build-tsc-cjs/icons/Beachball.js +17 -0
- package/build-tsc-cjs/icons/Empty.js +10 -0
- package/build-tsc-cjs/icons/Ethereum.js +18 -0
- package/build-tsc-cjs/icons/Jdenticon.js +12 -0
- package/build-tsc-cjs/icons/Polkadot.js +15 -0
- package/build-tsc-cjs/icons/index.js +13 -0
- package/build-tsc-cjs/index.js +7 -0
- package/build-tsc-cjs/packageDetect.js +7 -0
- package/build-tsc-cjs/packageInfo.js +4 -0
- package/build-tsc-cjs/styled.js +5 -0
- package/build-tsc-cjs/types.js +2 -0
- package/build-tsc-esm/Identicon.js +104 -0
- package/build-tsc-esm/bundle.js +3 -0
- package/build-tsc-esm/icons/Beachball.js +13 -0
- package/build-tsc-esm/icons/Empty.js +6 -0
- package/build-tsc-esm/icons/Ethereum.js +14 -0
- package/build-tsc-esm/icons/Jdenticon.js +8 -0
- package/build-tsc-esm/icons/Polkadot.js +11 -0
- package/build-tsc-esm/icons/index.js +5 -0
- package/build-tsc-esm/index.js +4 -0
- package/build-tsc-esm/packageDetect.js +5 -0
- package/build-tsc-esm/packageInfo.js +1 -0
- package/build-tsc-esm/styled.js +1 -0
- package/build-tsc-esm/types.js +1 -0
- package/demo.png +0 -0
- package/index.html +17 -0
- package/package.json +48 -0
- package/src/Identicon.tsx +154 -0
- package/src/bundle.ts +6 -0
- package/src/icons/Beachball.tsx +32 -0
- package/src/icons/Empty.tsx +20 -0
- package/src/icons/Ethereum.tsx +37 -0
- package/src/icons/Jdenticon.tsx +24 -0
- package/src/icons/Polkadot.tsx +59 -0
- package/src/icons/index.ts +8 -0
- package/src/index.ts +10 -0
- package/src/packageDetect.ts +13 -0
- package/src/packageInfo.ts +6 -0
- package/src/styled.ts +4 -0
- package/src/types.ts +30 -0
- package/tsconfig.build.json +12 -0
- package/tsconfig.build.tsbuildinfo +1 -0
|
@@ -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.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
|
+
}
|
|
@@ -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 @@
|
|
|
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' };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { styled } from 'styled-components';
|
package/build/styled.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { styled } from 'styled-components';
|
package/build/types.d.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
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
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -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 Polkadot: React.MemoExoticComponent<typeof Identicon>;
|
|
5
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { styled } from 'styled-components';
|
|
@@ -0,0 +1,23 @@
|
|
|
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';
|
|
@@ -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
|
+
empty: index_js_1.Empty,
|
|
18
|
+
ethereum: index_js_1.Ethereum,
|
|
19
|
+
jdenticon: index_js_1.Jdenticon,
|
|
20
|
+
polkadot: index_js_1.Polkadot,
|
|
21
|
+
substrate: index_js_1.Jdenticon
|
|
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,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);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Polkadot = 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.polkadotIcon)(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.Polkadot = react_1.default.memo(Identicon);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Polkadot = 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 Polkadot_js_1 = require("./Polkadot.js");
|
|
13
|
+
Object.defineProperty(exports, "Polkadot", { enumerable: true, get: function () { return Polkadot_js_1.Polkadot; } });
|
|
@@ -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,7 @@
|
|
|
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]);
|
|
@@ -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; } });
|