@arcblock/ux 2.10.48 → 2.10.50
Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,7 @@
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
2
2
|
import { useSize } from 'ahooks';
|
3
3
|
import React, { forwardRef, useEffect, useImperativeHandle, useRef, useState } from 'react';
|
4
|
+
import { Box } from '@mui/material';
|
4
5
|
import { styled } from '../Theme';
|
5
6
|
import DidAddress from './did-address';
|
6
7
|
|
@@ -60,7 +61,7 @@ const ResponsiveDidAddress = /*#__PURE__*/forwardRef(({
|
|
60
61
|
});
|
61
62
|
});
|
62
63
|
export default ResponsiveDidAddress;
|
63
|
-
const Root = styled(
|
64
|
+
const Root = styled(Box)`
|
64
65
|
display: block;
|
65
66
|
overflow: hidden;
|
66
67
|
${({
|
package/lib/DID/index.js
CHANGED
@@ -83,7 +83,10 @@ const DID = /*#__PURE__*/forwardRef((props, ref) => {
|
|
83
83
|
append = null,
|
84
84
|
compact = false,
|
85
85
|
startChars = 6,
|
86
|
-
endChars = 6
|
86
|
+
endChars = 6,
|
87
|
+
style,
|
88
|
+
className,
|
89
|
+
sx
|
87
90
|
} = props;
|
88
91
|
const rest = {
|
89
92
|
size,
|
@@ -95,7 +98,10 @@ const DID = /*#__PURE__*/forwardRef((props, ref) => {
|
|
95
98
|
append,
|
96
99
|
compact,
|
97
100
|
startChars,
|
98
|
-
endChars
|
101
|
+
endChars,
|
102
|
+
style,
|
103
|
+
className,
|
104
|
+
sx
|
99
105
|
};
|
100
106
|
const addressRef = useRef(null);
|
101
107
|
const t = useMemoizedFn((key, data = {}) => {
|
@@ -118,16 +124,16 @@ const DID = /*#__PURE__*/forwardRef((props, ref) => {
|
|
118
124
|
const [open, setOpen] = useState(false);
|
119
125
|
const isEthDid = isEthereumDid(did);
|
120
126
|
const didMotifInfo = isEthDid ? undefined : getDIDMotifInfo(did);
|
121
|
-
const getPrepend = avatarSize => [/*#__PURE__*/_jsx("span", {
|
127
|
+
const getPrepend = (avatarSize, keyPrefix) => [/*#__PURE__*/_jsx("span", {
|
122
128
|
style: {
|
123
129
|
flex: '0 0 auto',
|
124
130
|
color: getFontColor(did, didMotifInfo, isEthDid)
|
125
131
|
},
|
126
132
|
children: "DID:"
|
127
|
-
},
|
133
|
+
}, `${keyPrefix}-prefix-did-${avatarSize}`), /*#__PURE__*/_jsx("span", {
|
128
134
|
className: "did-address-text",
|
129
135
|
children: "ABT:"
|
130
|
-
},
|
136
|
+
}, `${keyPrefix}-prefix-abt-${avatarSize}`), showAvatar && /*#__PURE__*/_jsx(Avatar, {
|
131
137
|
src: "",
|
132
138
|
did: did,
|
133
139
|
size: getAvatarSize(didMotifInfo, isEthDid, avatarSize || 18),
|
@@ -139,7 +145,7 @@ const DID = /*#__PURE__*/forwardRef((props, ref) => {
|
|
139
145
|
},
|
140
146
|
blockiesPadding: false,
|
141
147
|
className: "did-address-avatar"
|
142
|
-
},
|
148
|
+
}, `${keyPrefix}-avatar-${avatarSize}`)];
|
143
149
|
const closeQrCode = useMemoizedFn(() => {
|
144
150
|
setOpen(false);
|
145
151
|
});
|
@@ -188,7 +194,7 @@ const DID = /*#__PURE__*/forwardRef((props, ref) => {
|
|
188
194
|
content: `${DID_PREFIX}${did}`,
|
189
195
|
...rest,
|
190
196
|
ref: addressRef,
|
191
|
-
prepend: getPrepend(rest.size),
|
197
|
+
prepend: getPrepend(rest.size, 'address'),
|
192
198
|
append: /*#__PURE__*/_jsxs(_Fragment, {
|
193
199
|
children: [showQrcode ? /*#__PURE__*/_jsx(Box, {
|
194
200
|
id: "did-qrcode-button",
|
@@ -198,13 +204,13 @@ const DID = /*#__PURE__*/forwardRef((props, ref) => {
|
|
198
204
|
sx: {
|
199
205
|
flexShrink: 0,
|
200
206
|
cursor: 'pointer',
|
201
|
-
ml:
|
207
|
+
ml: 0.5,
|
202
208
|
color: 'grey.500'
|
203
209
|
}
|
204
210
|
}) : null, rest.append]
|
205
211
|
}),
|
206
212
|
children: did
|
207
|
-
}), /*#__PURE__*/_jsx(Dialog, {
|
213
|
+
}, "address"), /*#__PURE__*/_jsx(Dialog, {
|
208
214
|
open: open,
|
209
215
|
onClose: closeQrCode,
|
210
216
|
maxWidth: "sm",
|
@@ -243,12 +249,12 @@ const DID = /*#__PURE__*/forwardRef((props, ref) => {
|
|
243
249
|
children: /*#__PURE__*/_jsx(Address, {
|
244
250
|
locale: locale,
|
245
251
|
content: `${DID_PREFIX}${did}`,
|
246
|
-
prepend: getPrepend(16),
|
252
|
+
prepend: getPrepend(16, 'dialog'),
|
247
253
|
...rest,
|
248
254
|
size: 16,
|
249
255
|
copyable: true,
|
250
256
|
children: did
|
251
|
-
})
|
257
|
+
}, "dialog-address")
|
252
258
|
}), /*#__PURE__*/_jsx(Typography, {
|
253
259
|
variant: "body2",
|
254
260
|
sx: {
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@arcblock/ux",
|
3
|
-
"version": "2.10.
|
3
|
+
"version": "2.10.50",
|
4
4
|
"description": "Common used react components for arcblock products",
|
5
5
|
"keywords": [
|
6
6
|
"react",
|
@@ -64,12 +64,12 @@
|
|
64
64
|
"react": ">=18.2.0",
|
65
65
|
"react-router-dom": ">=6.22.3"
|
66
66
|
},
|
67
|
-
"gitHead": "
|
67
|
+
"gitHead": "45f18af9a51b6bcc346c626341942b8cf4fad994",
|
68
68
|
"dependencies": {
|
69
69
|
"@arcblock/did-motif": "^1.1.13",
|
70
|
-
"@arcblock/icons": "^2.10.
|
71
|
-
"@arcblock/nft-display": "^2.10.
|
72
|
-
"@arcblock/react-hooks": "^2.10.
|
70
|
+
"@arcblock/icons": "^2.10.50",
|
71
|
+
"@arcblock/nft-display": "^2.10.50",
|
72
|
+
"@arcblock/react-hooks": "^2.10.50",
|
73
73
|
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
|
74
74
|
"@fontsource/inter": "^5.0.16",
|
75
75
|
"@fontsource/ubuntu-mono": "^5.0.18",
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { useSize } from 'ahooks';
|
2
2
|
import React, { forwardRef, useEffect, useImperativeHandle, useRef, useState } from 'react';
|
3
|
+
import { Box } from '@mui/material';
|
3
4
|
import { styled } from '../Theme';
|
4
|
-
|
5
5
|
import DidAddress, { HTMLDidAddressElement, IDidAddressProps } from './did-address';
|
6
6
|
|
7
7
|
/**
|
@@ -66,7 +66,7 @@ export interface IResponsiveDidAddressProps extends IDidAddressProps {
|
|
66
66
|
component?: React.ElementType;
|
67
67
|
}
|
68
68
|
|
69
|
-
const Root = styled(
|
69
|
+
const Root = styled(Box)`
|
70
70
|
display: block;
|
71
71
|
overflow: hidden;
|
72
72
|
${({ inline }: any) =>
|
package/src/DID/index.tsx
CHANGED
@@ -119,6 +119,9 @@ const DID = forwardRef<HTMLDIDElement, IDIDPropTypes>((props, ref) => {
|
|
119
119
|
compact = false,
|
120
120
|
startChars = 6,
|
121
121
|
endChars = 6,
|
122
|
+
style,
|
123
|
+
className,
|
124
|
+
sx,
|
122
125
|
} = props;
|
123
126
|
|
124
127
|
const rest = {
|
@@ -132,6 +135,9 @@ const DID = forwardRef<HTMLDIDElement, IDIDPropTypes>((props, ref) => {
|
|
132
135
|
compact,
|
133
136
|
startChars,
|
134
137
|
endChars,
|
138
|
+
style,
|
139
|
+
className,
|
140
|
+
sx,
|
135
141
|
};
|
136
142
|
|
137
143
|
const addressRef = useRef<any>(null);
|
@@ -158,16 +164,18 @@ const DID = forwardRef<HTMLDIDElement, IDIDPropTypes>((props, ref) => {
|
|
158
164
|
const isEthDid = isEthereumDid(did);
|
159
165
|
const didMotifInfo = isEthDid ? undefined : getDIDMotifInfo(did);
|
160
166
|
|
161
|
-
const getPrepend = (avatarSize: number) => [
|
162
|
-
<span
|
167
|
+
const getPrepend = (avatarSize: number, keyPrefix: string) => [
|
168
|
+
<span
|
169
|
+
key={`${keyPrefix}-prefix-did-${avatarSize}`}
|
170
|
+
style={{ flex: '0 0 auto', color: getFontColor(did, didMotifInfo, isEthDid) }}>
|
163
171
|
DID:
|
164
172
|
</span>,
|
165
|
-
<span key=
|
173
|
+
<span key={`${keyPrefix}-prefix-abt-${avatarSize}`} className="did-address-text">
|
166
174
|
ABT:
|
167
175
|
</span>,
|
168
176
|
showAvatar && (
|
169
177
|
<Avatar
|
170
|
-
key=
|
178
|
+
key={`${keyPrefix}-avatar-${avatarSize}`}
|
171
179
|
src=""
|
172
180
|
did={did}
|
173
181
|
size={getAvatarSize(didMotifInfo, isEthDid, avatarSize || 18)}
|
@@ -232,11 +240,12 @@ const DID = forwardRef<HTMLDIDElement, IDIDPropTypes>((props, ref) => {
|
|
232
240
|
return (
|
233
241
|
<>
|
234
242
|
<Address
|
243
|
+
key="address"
|
235
244
|
locale={locale}
|
236
245
|
content={`${DID_PREFIX}${did}`}
|
237
246
|
{...rest}
|
238
247
|
ref={addressRef}
|
239
|
-
prepend={getPrepend(rest.size)}
|
248
|
+
prepend={getPrepend(rest.size, 'address')}
|
240
249
|
append={
|
241
250
|
<>
|
242
251
|
{showQrcode ? (
|
@@ -248,7 +257,7 @@ const DID = forwardRef<HTMLDIDElement, IDIDPropTypes>((props, ref) => {
|
|
248
257
|
sx={{
|
249
258
|
flexShrink: 0,
|
250
259
|
cursor: 'pointer',
|
251
|
-
ml:
|
260
|
+
ml: 0.5,
|
252
261
|
color: 'grey.500',
|
253
262
|
}}
|
254
263
|
/>
|
@@ -285,9 +294,10 @@ const DID = forwardRef<HTMLDIDElement, IDIDPropTypes>((props, ref) => {
|
|
285
294
|
/>
|
286
295
|
<Box sx={{ mt: 1.5, textAlign: 'center' }}>
|
287
296
|
<Address
|
297
|
+
key="dialog-address"
|
288
298
|
locale={locale}
|
289
299
|
content={`${DID_PREFIX}${did}`}
|
290
|
-
prepend={getPrepend(16)}
|
300
|
+
prepend={getPrepend(16, 'dialog')}
|
291
301
|
{...rest}
|
292
302
|
size={16}
|
293
303
|
copyable>
|