@arcblock/ux 2.7.3 → 2.7.5
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/es/Address/responsive-did-address.js +5 -5
- package/es/ClickToCopy/index.js +3 -4
- package/es/Layout/dashboard-legacy/index.js +3 -4
- package/es/Locale/selector.js +2 -0
- package/es/SessionManager/index.js +16 -1
- package/es/Toast/index.js +4 -2
- package/es/WebWalletSWKeeper/index.js +4 -2
- package/es/withTracker/index.js +1 -2
- package/lib/Address/responsive-did-address.js +4 -4
- package/lib/ClickToCopy/index.js +3 -4
- package/lib/Layout/dashboard-legacy/index.js +3 -4
- package/lib/Locale/selector.js +2 -0
- package/lib/SessionManager/index.js +16 -1
- package/lib/Toast/index.js +4 -2
- package/lib/WebWalletSWKeeper/index.js +4 -2
- package/lib/withTracker/index.js +3 -4
- package/package.json +5 -4
- package/src/Address/responsive-did-address.jsx +5 -3
- package/src/ClickToCopy/index.js +3 -2
- package/src/Layout/dashboard-legacy/index.js +3 -2
- package/src/Locale/selector.js +1 -1
- package/src/SessionManager/index.jsx +28 -5
- package/src/Toast/index.js +2 -2
- package/src/WebWalletSWKeeper/index.js +4 -2
- package/src/withTracker/index.js +1 -2
@@ -1,6 +1,6 @@
|
|
1
|
-
import { useState, createRef, useEffect } from 'react';
|
1
|
+
import { useState, createRef, useEffect, useRef } from 'react';
|
2
2
|
import PropTypes from 'prop-types';
|
3
|
-
import
|
3
|
+
import { useSize } from 'ahooks';
|
4
4
|
import { styled } from '../Theme';
|
5
5
|
import DidAddress from './did-address';
|
6
6
|
|
@@ -24,9 +24,9 @@ export default function ResponsiveDidAddress({
|
|
24
24
|
const [compact, setCompact] = useState(false);
|
25
25
|
// did address 完整显示时的宽度
|
26
26
|
const [addressFullWidth, setAddressFullWidth] = useState(null);
|
27
|
-
const
|
28
|
-
|
29
|
-
|
27
|
+
const containerRef = useRef(null);
|
28
|
+
const size = useSize(containerRef);
|
29
|
+
const containerWidth = size?.width || 0;
|
30
30
|
const ref = /*#__PURE__*/createRef();
|
31
31
|
// 存储完整显示时 address 组件的宽度
|
32
32
|
useEffect(() => {
|
package/es/ClickToCopy/index.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
import PropTypes from 'prop-types';
|
2
|
-
import
|
2
|
+
import { useSize } from 'ahooks';
|
3
3
|
import Tooltip from '@mui/material/Tooltip';
|
4
4
|
import useCopy from './hook';
|
5
5
|
import Toast, { ToastProvider } from '../Toast';
|
@@ -31,9 +31,8 @@ export default function ClickToCopy(props) {
|
|
31
31
|
});
|
32
32
|
const _tip = tip || texts.copy;
|
33
33
|
const _copiedTip = copiedTip || texts.copied;
|
34
|
-
const
|
35
|
-
|
36
|
-
} = useWindowSize();
|
34
|
+
const size = useSize(document.body);
|
35
|
+
const width = size?.width || 0;
|
37
36
|
const onCopy = e => {
|
38
37
|
copy(e);
|
39
38
|
if (width < 600) {
|
@@ -4,7 +4,7 @@ import Helmet from 'react-helmet';
|
|
4
4
|
import Container from '@mui/material/Container';
|
5
5
|
import Box from '@mui/material/Box';
|
6
6
|
import Drawer from '@mui/material/Drawer';
|
7
|
-
import
|
7
|
+
import { useSize } from 'ahooks';
|
8
8
|
import Sidebar from './sidebar';
|
9
9
|
import Header from './header';
|
10
10
|
import Footer from '../../Footer';
|
@@ -58,9 +58,8 @@ export default function Dashboard({
|
|
58
58
|
...rest
|
59
59
|
}) {
|
60
60
|
const breakpoint = 960;
|
61
|
-
const
|
62
|
-
|
63
|
-
} = useWindowSize();
|
61
|
+
const size = useSize(document.body);
|
62
|
+
const width = size?.width || 0;
|
64
63
|
const [drawerMode, setDrawerMode] = useState(width >= breakpoint ? 'permanent' : 'temporary');
|
65
64
|
const [drawerOpen, setDrawerOpen] = useState(drawerMode === 'permanent');
|
66
65
|
useEffect(() => {
|
package/es/Locale/selector.js
CHANGED
@@ -81,6 +81,8 @@ export default function LocaleSelector(props) {
|
|
81
81
|
children: [/*#__PURE__*/_jsx(ButtonComponent, {
|
82
82
|
ref: anchorEl,
|
83
83
|
className: "trigger",
|
84
|
+
role: "button",
|
85
|
+
"aria-label": "Locale selector button",
|
84
86
|
children: /*#__PURE__*/_jsxs(Box, {
|
85
87
|
display: "flex",
|
86
88
|
alignItems: "center",
|
@@ -139,7 +139,8 @@ function SessionManager({
|
|
139
139
|
}],
|
140
140
|
variant: "outlined",
|
141
141
|
onClick: _onLogin,
|
142
|
-
|
142
|
+
role: "button",
|
143
|
+
"aria-label": "Login button",
|
143
144
|
...rest,
|
144
145
|
"data-cy": "sessionManager-login",
|
145
146
|
children: [isFirstLoading ? /*#__PURE__*/_jsx(CircularProgress, {}) : /*#__PURE__*/_jsx(AccountIcon, {}), /*#__PURE__*/_jsx("span", {
|
@@ -154,6 +155,8 @@ function SessionManager({
|
|
154
155
|
onClick: _onLogin,
|
155
156
|
"data-cy": "sessionManager-login",
|
156
157
|
size: "medium",
|
158
|
+
role: "button",
|
159
|
+
"aria-label": "Login button",
|
157
160
|
children: isFirstLoading ? /*#__PURE__*/_jsx(CircularProgress, {
|
158
161
|
style: {
|
159
162
|
width: size - 4,
|
@@ -248,6 +251,8 @@ function SessionManager({
|
|
248
251
|
...rest,
|
249
252
|
"data-cy": "sessionManager-logout-popup",
|
250
253
|
size: "medium",
|
254
|
+
role: "button",
|
255
|
+
"aria-label": "User info button",
|
251
256
|
style: {
|
252
257
|
lineHeight: 1
|
253
258
|
},
|
@@ -271,6 +276,8 @@ function SessionManager({
|
|
271
276
|
className: "session-manager-user",
|
272
277
|
children: [/*#__PURE__*/_jsxs("div", {
|
273
278
|
className: "session-manager-user-name",
|
279
|
+
role: "button",
|
280
|
+
"aria-label": "User info panel",
|
274
281
|
children: [/*#__PURE__*/_jsx("span", {
|
275
282
|
children: session.user.fullName
|
276
283
|
}), !!showRole && (currentRole?.title || session.user?.role.toUpperCase()) && /*#__PURE__*/_jsx(Chip, {
|
@@ -288,6 +295,7 @@ function SessionManager({
|
|
288
295
|
})]
|
289
296
|
}), /*#__PURE__*/_jsxs("div", {
|
290
297
|
className: "session-manager-id-list",
|
298
|
+
"aria-label": "User DID list",
|
291
299
|
children: [walletDid && /*#__PURE__*/_jsx("div", {
|
292
300
|
className: "session-manager-id-item",
|
293
301
|
children: /*#__PURE__*/_jsx(DidAddress, {
|
@@ -319,6 +327,7 @@ function SessionManager({
|
|
319
327
|
href: masterSiteInfo.appUrl,
|
320
328
|
underline: "hover",
|
321
329
|
target: "_blank",
|
330
|
+
"aria-label": "Open federated master site url",
|
322
331
|
children: masterSiteInfo.appName
|
323
332
|
})]
|
324
333
|
}), Array.isArray(menu) && menu.map((menuItem, index) => {
|
@@ -346,6 +355,7 @@ function SessionManager({
|
|
346
355
|
className: "session-manager-menu-item",
|
347
356
|
"data-cy": "sessionManager-openInWallet",
|
348
357
|
href: "https://www.abtwallet.io/",
|
358
|
+
"aria-label": translation.openInWallet,
|
349
359
|
target: "_blank",
|
350
360
|
children: [/*#__PURE__*/_jsx(SvgIcon, {
|
351
361
|
component: OpenInIcon,
|
@@ -354,6 +364,7 @@ function SessionManager({
|
|
354
364
|
}), !!switchDid && /*#__PURE__*/_jsxs(MenuItem, {
|
355
365
|
className: "session-manager-menu-item",
|
356
366
|
onClick: _onSwitchDid,
|
367
|
+
"aria-label": translation.switchDid,
|
357
368
|
"data-cy": "sessionManager-switch-trigger",
|
358
369
|
children: [/*#__PURE__*/_jsx(SvgIcon, {
|
359
370
|
component: SwitchDidIcon,
|
@@ -362,6 +373,7 @@ function SessionManager({
|
|
362
373
|
}), !!switchProfile && hasBindWallet && session.provider !== 'federated' && /*#__PURE__*/_jsxs(MenuItem, {
|
363
374
|
className: "session-manager-menu-item",
|
364
375
|
onClick: _onSwitchProfile,
|
376
|
+
"aria-label": translation.switchProfile,
|
365
377
|
"data-cy": "sessionManager-switch-profile-trigger",
|
366
378
|
children: [/*#__PURE__*/_jsx(SvgIcon, {
|
367
379
|
component: SwitchProfileIcon,
|
@@ -370,6 +382,7 @@ function SessionManager({
|
|
370
382
|
}), !!switchPassport && /*#__PURE__*/_jsxs(MenuItem, {
|
371
383
|
className: "session-manager-menu-item",
|
372
384
|
onClick: _onSwitchPassport,
|
385
|
+
"aria-label": translation.switchPassport,
|
373
386
|
"data-cy": "sessionManager-switch-passport-trigger",
|
374
387
|
children: [/*#__PURE__*/_jsx(SvgIcon, {
|
375
388
|
component: SwitchPassportIcon,
|
@@ -378,6 +391,7 @@ function SessionManager({
|
|
378
391
|
}), oauthConfigList.length > 0 && !hasBindAccount && session.provider !== 'federated' && /*#__PURE__*/_jsxs(MenuItem, {
|
379
392
|
className: "session-manager-menu-item",
|
380
393
|
onClick: _onBindWallet,
|
394
|
+
"aria-label": !isRawWalletAccount ? `${translation.bind}DID Wallet` : `${translation.bind}${translation.thirdParty}`,
|
381
395
|
"data-cy": "sessionManager-bind-trigger",
|
382
396
|
children: [/*#__PURE__*/_jsx(SvgIcon, {
|
383
397
|
component: BindWalletIcon,
|
@@ -387,6 +401,7 @@ function SessionManager({
|
|
387
401
|
className: "session-manager-menu-item",
|
388
402
|
onClick: _onLogout,
|
389
403
|
disabled: disableLogout,
|
404
|
+
"aria-label": "Logout account",
|
390
405
|
"data-cy": "sessionManager-logout-trigger",
|
391
406
|
children: [/*#__PURE__*/_jsx(SvgIcon, {
|
392
407
|
component: DisconnectIcon,
|
package/es/Toast/index.js
CHANGED
@@ -28,7 +28,7 @@ let info = noop;
|
|
28
28
|
*/
|
29
29
|
const genFn = (enqueueSnackbar, variant) => (message, opts = {}) => {
|
30
30
|
enqueueSnackbar(message, {
|
31
|
-
autoHideDuration:
|
31
|
+
autoHideDuration: 5000,
|
32
32
|
variant,
|
33
33
|
...opts
|
34
34
|
});
|
@@ -83,7 +83,9 @@ export default {
|
|
83
83
|
/**
|
84
84
|
* @type {EnqueueSnackbarFunc}
|
85
85
|
*/
|
86
|
-
error: (message, options = {
|
86
|
+
error: (message, options = {
|
87
|
+
autoHideDuration: 15000
|
88
|
+
}, ...args) => error(message, options, ...args),
|
87
89
|
/**
|
88
90
|
* @type {EnqueueSnackbarFunc}
|
89
91
|
*/
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { useEffect, useRef } from 'react';
|
2
2
|
import PropTypes from 'prop-types';
|
3
3
|
import useIdle from 'react-use/lib/useIdle';
|
4
|
-
import
|
4
|
+
import { useLocalStorageState } from 'ahooks';
|
5
5
|
import useBrowser from '@arcblock/react-hooks/lib/useBrowser';
|
6
6
|
import { detectWalletExtension } from '@arcblock/ux/lib/Util';
|
7
7
|
import { getWebWalletUrl, checkSameProtocol } from '../Util/wallet';
|
@@ -93,7 +93,9 @@ export const withWebWalletSWKeeper = Component => {
|
|
93
93
|
const browser = useBrowser();
|
94
94
|
// eslint-disable-next-line no-param-reassign
|
95
95
|
webWalletUrl = webWalletUrl || getWebWalletUrl();
|
96
|
-
const [disabled] =
|
96
|
+
const [disabled] = useLocalStorageState(STORAGE_KEY_DISABLED, {
|
97
|
+
defaultValue: 1
|
98
|
+
});
|
97
99
|
const extension = detectWalletExtension();
|
98
100
|
const isSameProtocol = checkSameProtocol(webWalletUrl);
|
99
101
|
const isWalletWebview = browser.wallet;
|
package/es/withTracker/index.js
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
/* eslint-disable import/no-unresolved */
|
2
2
|
import ReactGA from 'react-ga';
|
3
3
|
import * as Sentry from '@sentry/browser';
|
4
|
-
import useDeepCompareEffect from '
|
5
|
-
import useMount from 'react-use/lib/useMount';
|
4
|
+
import { useMount, useDeepCompareEffect } from 'ahooks';
|
6
5
|
import { useLocation } from 'react-router-dom';
|
7
6
|
import ErrorBoundary from './error_boundary';
|
8
7
|
import { jsx as _jsx } from "react/jsx-runtime";
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
exports.default = ResponsiveDidAddress;
|
7
7
|
var _react = require("react");
|
8
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
9
|
-
var
|
9
|
+
var _ahooks = require("ahooks");
|
10
10
|
var _Theme = require("../Theme");
|
11
11
|
var _didAddress = _interopRequireDefault(require("./did-address"));
|
12
12
|
var _jsxRuntime = require("react/jsx-runtime");
|
@@ -41,9 +41,9 @@ function ResponsiveDidAddress(_ref) {
|
|
41
41
|
const [compact, setCompact] = (0, _react.useState)(false);
|
42
42
|
// did address 完整显示时的宽度
|
43
43
|
const [addressFullWidth, setAddressFullWidth] = (0, _react.useState)(null);
|
44
|
-
const
|
45
|
-
|
46
|
-
|
44
|
+
const containerRef = (0, _react.useRef)(null);
|
45
|
+
const size = (0, _ahooks.useSize)(containerRef);
|
46
|
+
const containerWidth = (size === null || size === void 0 ? void 0 : size.width) || 0;
|
47
47
|
const ref = /*#__PURE__*/(0, _react.createRef)();
|
48
48
|
// 存储完整显示时 address 组件的宽度
|
49
49
|
(0, _react.useEffect)(() => {
|
package/lib/ClickToCopy/index.js
CHANGED
@@ -11,7 +11,7 @@ Object.defineProperty(exports, "CopyButton", {
|
|
11
11
|
});
|
12
12
|
exports.default = ClickToCopy;
|
13
13
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
14
|
-
var
|
14
|
+
var _ahooks = require("ahooks");
|
15
15
|
var _Tooltip = _interopRequireDefault(require("@mui/material/Tooltip"));
|
16
16
|
var _hook = _interopRequireDefault(require("./hook"));
|
17
17
|
var _Toast = _interopRequireWildcard(require("../Toast"));
|
@@ -56,9 +56,8 @@ function ClickToCopy(props) {
|
|
56
56
|
});
|
57
57
|
const _tip = tip || texts.copy;
|
58
58
|
const _copiedTip = copiedTip || texts.copied;
|
59
|
-
const
|
60
|
-
|
61
|
-
} = (0, _useWindowSize.default)();
|
59
|
+
const size = (0, _ahooks.useSize)(document.body);
|
60
|
+
const width = (size === null || size === void 0 ? void 0 : size.width) || 0;
|
62
61
|
const onCopy = e => {
|
63
62
|
copy(e);
|
64
63
|
if (width < 600) {
|
@@ -10,7 +10,7 @@ var _reactHelmet = _interopRequireDefault(require("react-helmet"));
|
|
10
10
|
var _Container = _interopRequireDefault(require("@mui/material/Container"));
|
11
11
|
var _Box = _interopRequireDefault(require("@mui/material/Box"));
|
12
12
|
var _Drawer = _interopRequireDefault(require("@mui/material/Drawer"));
|
13
|
-
var
|
13
|
+
var _ahooks = require("ahooks");
|
14
14
|
var _sidebar = _interopRequireDefault(require("./sidebar"));
|
15
15
|
var _header = _interopRequireDefault(require("./header"));
|
16
16
|
var _Footer = _interopRequireDefault(require("../../Footer"));
|
@@ -47,9 +47,8 @@ function Dashboard(_ref) {
|
|
47
47
|
} = _ref,
|
48
48
|
rest = _objectWithoutProperties(_ref, _excluded);
|
49
49
|
const breakpoint = 960;
|
50
|
-
const
|
51
|
-
|
52
|
-
} = (0, _useWindowSize.default)();
|
50
|
+
const size = (0, _ahooks.useSize)(document.body);
|
51
|
+
const width = (size === null || size === void 0 ? void 0 : size.width) || 0;
|
53
52
|
const [drawerMode, setDrawerMode] = (0, _react.useState)(width >= breakpoint ? 'permanent' : 'temporary');
|
54
53
|
const [drawerOpen, setDrawerOpen] = (0, _react.useState)(drawerMode === 'permanent');
|
55
54
|
(0, _react.useEffect)(() => {
|
package/lib/Locale/selector.js
CHANGED
@@ -98,6 +98,8 @@ function LocaleSelector(props) {
|
|
98
98
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(ButtonComponent, {
|
99
99
|
ref: anchorEl,
|
100
100
|
className: "trigger",
|
101
|
+
role: "button",
|
102
|
+
"aria-label": "Locale selector button",
|
101
103
|
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Box.default, {
|
102
104
|
display: "flex",
|
103
105
|
alignItems: "center",
|
@@ -164,7 +164,8 @@ function SessionManager(_ref) {
|
|
164
164
|
}],
|
165
165
|
variant: "outlined",
|
166
166
|
onClick: _onLogin,
|
167
|
-
|
167
|
+
role: "button",
|
168
|
+
"aria-label": "Login button"
|
168
169
|
}, rest), {}, {
|
169
170
|
"data-cy": "sessionManager-login",
|
170
171
|
children: [isFirstLoading ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_CircularProgress.default, {}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_Account.default, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
@@ -179,6 +180,8 @@ function SessionManager(_ref) {
|
|
179
180
|
onClick: _onLogin,
|
180
181
|
"data-cy": "sessionManager-login",
|
181
182
|
size: "medium",
|
183
|
+
role: "button",
|
184
|
+
"aria-label": "Login button",
|
182
185
|
children: isFirstLoading ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_CircularProgress.default, {
|
183
186
|
style: {
|
184
187
|
width: size - 4,
|
@@ -276,6 +279,8 @@ function SessionManager(_ref) {
|
|
276
279
|
}, rest), {}, {
|
277
280
|
"data-cy": "sessionManager-logout-popup",
|
278
281
|
size: "medium",
|
282
|
+
role: "button",
|
283
|
+
"aria-label": "User info button",
|
279
284
|
style: {
|
280
285
|
lineHeight: 1
|
281
286
|
},
|
@@ -299,6 +304,8 @@ function SessionManager(_ref) {
|
|
299
304
|
className: "session-manager-user",
|
300
305
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
301
306
|
className: "session-manager-user-name",
|
307
|
+
role: "button",
|
308
|
+
"aria-label": "User info panel",
|
302
309
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
303
310
|
children: session.user.fullName
|
304
311
|
}), !!showRole && ((currentRole === null || currentRole === void 0 ? void 0 : currentRole.title) || ((_session$user3 = session.user) === null || _session$user3 === void 0 ? void 0 : _session$user3.role.toUpperCase())) && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Chip.default, {
|
@@ -316,6 +323,7 @@ function SessionManager(_ref) {
|
|
316
323
|
})]
|
317
324
|
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
318
325
|
className: "session-manager-id-list",
|
326
|
+
"aria-label": "User DID list",
|
319
327
|
children: [walletDid && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
320
328
|
className: "session-manager-id-item",
|
321
329
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Address.default, {
|
@@ -347,6 +355,7 @@ function SessionManager(_ref) {
|
|
347
355
|
href: masterSiteInfo.appUrl,
|
348
356
|
underline: "hover",
|
349
357
|
target: "_blank",
|
358
|
+
"aria-label": "Open federated master site url",
|
350
359
|
children: masterSiteInfo.appName
|
351
360
|
})]
|
352
361
|
}), Array.isArray(menu) && menu.map((menuItem, index) => {
|
@@ -375,6 +384,7 @@ function SessionManager(_ref) {
|
|
375
384
|
className: "session-manager-menu-item",
|
376
385
|
"data-cy": "sessionManager-openInWallet",
|
377
386
|
href: "https://www.abtwallet.io/",
|
387
|
+
"aria-label": translation.openInWallet,
|
378
388
|
target: "_blank",
|
379
389
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_SvgIcon.default, {
|
380
390
|
component: _OpenIn.default,
|
@@ -383,6 +393,7 @@ function SessionManager(_ref) {
|
|
383
393
|
}), !!switchDid && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_MenuItem.default, {
|
384
394
|
className: "session-manager-menu-item",
|
385
395
|
onClick: _onSwitchDid,
|
396
|
+
"aria-label": translation.switchDid,
|
386
397
|
"data-cy": "sessionManager-switch-trigger",
|
387
398
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_SvgIcon.default, {
|
388
399
|
component: _Switch.default,
|
@@ -391,6 +402,7 @@ function SessionManager(_ref) {
|
|
391
402
|
}), !!switchProfile && hasBindWallet && session.provider !== 'federated' && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_MenuItem.default, {
|
392
403
|
className: "session-manager-menu-item",
|
393
404
|
onClick: _onSwitchProfile,
|
405
|
+
"aria-label": translation.switchProfile,
|
394
406
|
"data-cy": "sessionManager-switch-profile-trigger",
|
395
407
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_SvgIcon.default, {
|
396
408
|
component: _PersonOutline.default,
|
@@ -399,6 +411,7 @@ function SessionManager(_ref) {
|
|
399
411
|
}), !!switchPassport && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_MenuItem.default, {
|
400
412
|
className: "session-manager-menu-item",
|
401
413
|
onClick: _onSwitchPassport,
|
414
|
+
"aria-label": translation.switchPassport,
|
402
415
|
"data-cy": "sessionManager-switch-passport-trigger",
|
403
416
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_SvgIcon.default, {
|
404
417
|
component: _VpnKeyOutlined.default,
|
@@ -407,6 +420,7 @@ function SessionManager(_ref) {
|
|
407
420
|
}), oauthConfigList.length > 0 && !hasBindAccount && session.provider !== 'federated' && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_MenuItem.default, {
|
408
421
|
className: "session-manager-menu-item",
|
409
422
|
onClick: _onBindWallet,
|
423
|
+
"aria-label": !isRawWalletAccount ? "".concat(translation.bind, "DID Wallet") : "".concat(translation.bind).concat(translation.thirdParty),
|
410
424
|
"data-cy": "sessionManager-bind-trigger",
|
411
425
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_SvgIcon.default, {
|
412
426
|
component: _Link2.default,
|
@@ -416,6 +430,7 @@ function SessionManager(_ref) {
|
|
416
430
|
className: "session-manager-menu-item",
|
417
431
|
onClick: _onLogout,
|
418
432
|
disabled: disableLogout,
|
433
|
+
"aria-label": "Logout account",
|
419
434
|
"data-cy": "sessionManager-logout-trigger",
|
420
435
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_SvgIcon.default, {
|
421
436
|
component: _Disconnect.default,
|
package/lib/Toast/index.js
CHANGED
@@ -37,7 +37,7 @@ let _info = noop;
|
|
37
37
|
const genFn = (enqueueSnackbar, variant) => function (message) {
|
38
38
|
let opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
39
39
|
enqueueSnackbar(message, _objectSpread({
|
40
|
-
autoHideDuration:
|
40
|
+
autoHideDuration: 5000,
|
41
41
|
variant
|
42
42
|
}, opts));
|
43
43
|
};
|
@@ -98,7 +98,9 @@ var _default = {
|
|
98
98
|
* @type {EnqueueSnackbarFunc}
|
99
99
|
*/
|
100
100
|
error: function error(message) {
|
101
|
-
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
|
101
|
+
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
|
102
|
+
autoHideDuration: 15000
|
103
|
+
};
|
102
104
|
for (var _len2 = arguments.length, args = new Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
|
103
105
|
args[_key2 - 2] = arguments[_key2];
|
104
106
|
}
|
@@ -7,7 +7,7 @@ exports.withWebWalletSWKeeper = exports.default = void 0;
|
|
7
7
|
var _react = require("react");
|
8
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
9
9
|
var _useIdle = _interopRequireDefault(require("react-use/lib/useIdle"));
|
10
|
-
var
|
10
|
+
var _ahooks = require("ahooks");
|
11
11
|
var _useBrowser = _interopRequireDefault(require("@arcblock/react-hooks/lib/useBrowser"));
|
12
12
|
var _Util = require("@arcblock/ux/lib/Util");
|
13
13
|
var _wallet = require("../Util/wallet");
|
@@ -107,7 +107,9 @@ const withWebWalletSWKeeper = Component => {
|
|
107
107
|
const browser = (0, _useBrowser.default)();
|
108
108
|
// eslint-disable-next-line no-param-reassign
|
109
109
|
webWalletUrl = webWalletUrl || (0, _wallet.getWebWalletUrl)();
|
110
|
-
const [disabled] = (0,
|
110
|
+
const [disabled] = (0, _ahooks.useLocalStorageState)(STORAGE_KEY_DISABLED, {
|
111
|
+
defaultValue: 1
|
112
|
+
});
|
111
113
|
const extension = (0, _Util.detectWalletExtension)();
|
112
114
|
const isSameProtocol = (0, _wallet.checkSameProtocol)(webWalletUrl);
|
113
115
|
const isWalletWebview = browser.wallet;
|
package/lib/withTracker/index.js
CHANGED
@@ -6,8 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
exports.default = void 0;
|
7
7
|
var _reactGa = _interopRequireDefault(require("react-ga"));
|
8
8
|
var Sentry = _interopRequireWildcard(require("@sentry/browser"));
|
9
|
-
var
|
10
|
-
var _useMount = _interopRequireDefault(require("react-use/lib/useMount"));
|
9
|
+
var _ahooks = require("ahooks");
|
11
10
|
var _reactRouterDom = require("react-router-dom");
|
12
11
|
var _error_boundary = _interopRequireDefault(require("./error_boundary"));
|
13
12
|
var _jsxRuntime = require("react/jsx-runtime");
|
@@ -49,10 +48,10 @@ var _default = function _default(WrappedComponent) {
|
|
49
48
|
};
|
50
49
|
return function TrackedComponent(props) {
|
51
50
|
const location = (0, _reactRouterDom.useLocation)();
|
52
|
-
(0,
|
51
|
+
(0, _ahooks.useMount)(() => {
|
53
52
|
trackPage(location.pathname);
|
54
53
|
});
|
55
|
-
(0,
|
54
|
+
(0, _ahooks.useDeepCompareEffect)(() => {
|
56
55
|
trackPage(location.pathname);
|
57
56
|
}, [location.pathname]);
|
58
57
|
if (process.env.NODE_ENV === 'production') {
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@arcblock/ux",
|
3
|
-
"version": "2.7.
|
3
|
+
"version": "2.7.5",
|
4
4
|
"description": "Common used react components for arcblock products",
|
5
5
|
"keywords": [
|
6
6
|
"react",
|
@@ -314,11 +314,11 @@
|
|
314
314
|
"peerDependencies": {
|
315
315
|
"react": ">=18.1.0"
|
316
316
|
},
|
317
|
-
"gitHead": "
|
317
|
+
"gitHead": "5821ccc5b51c313ef45426587eb2357ffe951834",
|
318
318
|
"dependencies": {
|
319
319
|
"@arcblock/did-motif": "^1.1.13",
|
320
|
-
"@arcblock/icons": "^2.7.
|
321
|
-
"@arcblock/react-hooks": "^2.7.
|
320
|
+
"@arcblock/icons": "^2.7.5",
|
321
|
+
"@arcblock/react-hooks": "^2.7.5",
|
322
322
|
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
|
323
323
|
"@emotion/react": "^11.10.4",
|
324
324
|
"@emotion/styled": "^11.10.4",
|
@@ -328,6 +328,7 @@
|
|
328
328
|
"@mui/material": "^5.10.8",
|
329
329
|
"@solana/qr-code-styling": "^1.6.0-beta.0",
|
330
330
|
"@testing-library/react": "^14.0.0",
|
331
|
+
"ahooks": "^3.7.8",
|
331
332
|
"axios": "^0.27.2",
|
332
333
|
"base64-url": "^2.3.3",
|
333
334
|
"copy-to-clipboard": "^3.3.2",
|
@@ -1,6 +1,6 @@
|
|
1
|
-
import { useState, createRef, useEffect } from 'react';
|
1
|
+
import { useState, createRef, useEffect, useRef } from 'react';
|
2
2
|
import PropTypes from 'prop-types';
|
3
|
-
import
|
3
|
+
import { useSize } from 'ahooks';
|
4
4
|
import { styled } from '../Theme';
|
5
5
|
|
6
6
|
import DidAddress from './did-address';
|
@@ -19,7 +19,9 @@ export default function ResponsiveDidAddress({ style, className, component, ...r
|
|
19
19
|
const [compact, setCompact] = useState(false);
|
20
20
|
// did address 完整显示时的宽度
|
21
21
|
const [addressFullWidth, setAddressFullWidth] = useState(null);
|
22
|
-
const
|
22
|
+
const containerRef = useRef(null);
|
23
|
+
const size = useSize(containerRef);
|
24
|
+
const containerWidth = size?.width || 0;
|
23
25
|
const ref = createRef();
|
24
26
|
// 存储完整显示时 address 组件的宽度
|
25
27
|
useEffect(() => {
|
package/src/ClickToCopy/index.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
import PropTypes from 'prop-types';
|
2
|
-
import
|
2
|
+
import { useSize } from 'ahooks';
|
3
3
|
import Tooltip from '@mui/material/Tooltip';
|
4
4
|
|
5
5
|
import useCopy from './hook';
|
@@ -16,7 +16,8 @@ export default function ClickToCopy(props) {
|
|
16
16
|
const _tip = tip || texts.copy;
|
17
17
|
const _copiedTip = copiedTip || texts.copied;
|
18
18
|
|
19
|
-
const
|
19
|
+
const size = useSize(document.body);
|
20
|
+
const width = size?.width || 0;
|
20
21
|
|
21
22
|
const onCopy = (e) => {
|
22
23
|
copy(e);
|
@@ -4,7 +4,7 @@ import Helmet from 'react-helmet';
|
|
4
4
|
import Container from '@mui/material/Container';
|
5
5
|
import Box from '@mui/material/Box';
|
6
6
|
import Drawer from '@mui/material/Drawer';
|
7
|
-
import
|
7
|
+
import { useSize } from 'ahooks';
|
8
8
|
|
9
9
|
import Sidebar from './sidebar';
|
10
10
|
import Header from './header';
|
@@ -59,7 +59,8 @@ export default function Dashboard({
|
|
59
59
|
...rest
|
60
60
|
}) {
|
61
61
|
const breakpoint = 960;
|
62
|
-
const
|
62
|
+
const size = useSize(document.body);
|
63
|
+
const width = size?.width || 0;
|
63
64
|
const [drawerMode, setDrawerMode] = useState(width >= breakpoint ? 'permanent' : 'temporary');
|
64
65
|
const [drawerOpen, setDrawerOpen] = useState(drawerMode === 'permanent');
|
65
66
|
|
package/src/Locale/selector.js
CHANGED
@@ -68,7 +68,7 @@ export default function LocaleSelector(props) {
|
|
68
68
|
|
69
69
|
return (
|
70
70
|
<Div component="div" dark={dark} theme={theme} {...rest} {...handleEventProps}>
|
71
|
-
<ButtonComponent ref={anchorEl} className="trigger">
|
71
|
+
<ButtonComponent ref={anchorEl} className="trigger" role="button" aria-label="Locale selector button">
|
72
72
|
<Box display="flex" alignItems="center">
|
73
73
|
{renderIcon}
|
74
74
|
|
@@ -135,14 +135,22 @@ function SessionManager({
|
|
135
135
|
sx={[{ borderRadius: '100vw' }, dark && { color: '#fff', borderColor: '#fff' }]}
|
136
136
|
variant="outlined"
|
137
137
|
onClick={_onLogin}
|
138
|
-
|
138
|
+
role="button"
|
139
|
+
aria-label="Login button"
|
139
140
|
{...rest}
|
140
141
|
data-cy="sessionManager-login">
|
141
142
|
{isFirstLoading ? <CircularProgress /> : <AccountIcon />}
|
142
143
|
<span style={{ lineHeight: '25px' }}>{translation.connect}</span>
|
143
144
|
</Button>
|
144
145
|
) : (
|
145
|
-
<IconButton
|
146
|
+
<IconButton
|
147
|
+
ref={userAnchorRef}
|
148
|
+
{...rest}
|
149
|
+
onClick={_onLogin}
|
150
|
+
data-cy="sessionManager-login"
|
151
|
+
size="medium"
|
152
|
+
role="button"
|
153
|
+
aria-label="Login button">
|
146
154
|
{isFirstLoading ? (
|
147
155
|
<CircularProgress style={{ width: size - 4, height: size - 4, color: dark ? '#fff' : '' }} />
|
148
156
|
) : (
|
@@ -232,6 +240,8 @@ function SessionManager({
|
|
232
240
|
{...rest}
|
233
241
|
data-cy="sessionManager-logout-popup"
|
234
242
|
size="medium"
|
243
|
+
role="button"
|
244
|
+
aria-label="User info button"
|
235
245
|
style={{ lineHeight: 1 }}>
|
236
246
|
<DidAvatar variant="circle" did={session.user.did} src={avatar} size={size} shape="circle" />
|
237
247
|
</IconButton>
|
@@ -239,7 +249,7 @@ function SessionManager({
|
|
239
249
|
<UserPopper open={userOpen} onClose={onCloseUser} anchorEl={userAnchorRef.current} dark={dark}>
|
240
250
|
<MenuList sx={{ p: 0 }}>
|
241
251
|
<div className="session-manager-user">
|
242
|
-
<div className="session-manager-user-name">
|
252
|
+
<div className="session-manager-user-name" role="button" aria-label="User info panel">
|
243
253
|
<span>{session.user.fullName}</span>
|
244
254
|
{!!showRole && (currentRole?.title || session.user?.role.toUpperCase()) && (
|
245
255
|
<Chip
|
@@ -251,7 +261,7 @@ function SessionManager({
|
|
251
261
|
/>
|
252
262
|
)}
|
253
263
|
</div>
|
254
|
-
<div className="session-manager-id-list">
|
264
|
+
<div className="session-manager-id-list" aria-label="User DID list">
|
255
265
|
{walletDid && (
|
256
266
|
<div className="session-manager-id-item">
|
257
267
|
<DidAddress responsive={false}>{walletDid}</DidAddress>
|
@@ -273,7 +283,12 @@ function SessionManager({
|
|
273
283
|
<MenuItem className="session-manager-menu-item" data-cy="sessionManager-connectWithFederated">
|
274
284
|
<SvgIcon component={ConnectWithoutContactIcon} className="session-manager-menu-icon" />
|
275
285
|
{translation.connectedWith}
|
276
|
-
<Link
|
286
|
+
<Link
|
287
|
+
ml={1}
|
288
|
+
href={masterSiteInfo.appUrl}
|
289
|
+
underline="hover"
|
290
|
+
target="_blank"
|
291
|
+
aria-label="Open federated master site url">
|
277
292
|
{masterSiteInfo.appName}
|
278
293
|
</Link>
|
279
294
|
</MenuItem>
|
@@ -309,6 +324,7 @@ function SessionManager({
|
|
309
324
|
className="session-manager-menu-item"
|
310
325
|
data-cy="sessionManager-openInWallet"
|
311
326
|
href="https://www.abtwallet.io/"
|
327
|
+
aria-label={translation.openInWallet}
|
312
328
|
target="_blank">
|
313
329
|
<SvgIcon component={OpenInIcon} className="session-manager-menu-icon" />
|
314
330
|
{translation.openInWallet}
|
@@ -318,6 +334,7 @@ function SessionManager({
|
|
318
334
|
<MenuItem
|
319
335
|
className="session-manager-menu-item"
|
320
336
|
onClick={_onSwitchDid}
|
337
|
+
aria-label={translation.switchDid}
|
321
338
|
data-cy="sessionManager-switch-trigger">
|
322
339
|
<SvgIcon component={SwitchDidIcon} className="session-manager-menu-icon" />
|
323
340
|
{translation.switchDid}
|
@@ -328,6 +345,7 @@ function SessionManager({
|
|
328
345
|
<MenuItem
|
329
346
|
className="session-manager-menu-item"
|
330
347
|
onClick={_onSwitchProfile}
|
348
|
+
aria-label={translation.switchProfile}
|
331
349
|
data-cy="sessionManager-switch-profile-trigger">
|
332
350
|
<SvgIcon component={SwitchProfileIcon} className="session-manager-menu-icon" />
|
333
351
|
{translation.switchProfile}
|
@@ -337,6 +355,7 @@ function SessionManager({
|
|
337
355
|
<MenuItem
|
338
356
|
className="session-manager-menu-item"
|
339
357
|
onClick={_onSwitchPassport}
|
358
|
+
aria-label={translation.switchPassport}
|
340
359
|
data-cy="sessionManager-switch-passport-trigger">
|
341
360
|
<SvgIcon component={SwitchPassportIcon} className="session-manager-menu-icon" />
|
342
361
|
{translation.switchPassport}
|
@@ -346,6 +365,9 @@ function SessionManager({
|
|
346
365
|
<MenuItem
|
347
366
|
className="session-manager-menu-item"
|
348
367
|
onClick={_onBindWallet}
|
368
|
+
aria-label={
|
369
|
+
!isRawWalletAccount ? `${translation.bind}DID Wallet` : `${translation.bind}${translation.thirdParty}`
|
370
|
+
}
|
349
371
|
data-cy="sessionManager-bind-trigger">
|
350
372
|
<SvgIcon component={BindWalletIcon} className="session-manager-menu-icon" />
|
351
373
|
{!isRawWalletAccount ? `${translation.bind}DID Wallet` : `${translation.bind}${translation.thirdParty}`}
|
@@ -356,6 +378,7 @@ function SessionManager({
|
|
356
378
|
className="session-manager-menu-item"
|
357
379
|
onClick={_onLogout}
|
358
380
|
disabled={disableLogout}
|
381
|
+
aria-label="Logout account"
|
359
382
|
data-cy="sessionManager-logout-trigger">
|
360
383
|
<SvgIcon component={DisconnectIcon} className="session-manager-menu-icon" />
|
361
384
|
{translation.disconnect}
|
package/src/Toast/index.js
CHANGED
@@ -29,7 +29,7 @@ const genFn =
|
|
29
29
|
(enqueueSnackbar, variant) =>
|
30
30
|
(message, opts = {}) => {
|
31
31
|
enqueueSnackbar(message, {
|
32
|
-
autoHideDuration:
|
32
|
+
autoHideDuration: 5000,
|
33
33
|
variant,
|
34
34
|
...opts,
|
35
35
|
});
|
@@ -83,7 +83,7 @@ export default {
|
|
83
83
|
/**
|
84
84
|
* @type {EnqueueSnackbarFunc}
|
85
85
|
*/
|
86
|
-
error: (message, options = {}, ...args) => error(message, options, ...args),
|
86
|
+
error: (message, options = { autoHideDuration: 15000 }, ...args) => error(message, options, ...args),
|
87
87
|
|
88
88
|
/**
|
89
89
|
* @type {EnqueueSnackbarFunc}
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { useEffect, useRef } from 'react';
|
2
2
|
import PropTypes from 'prop-types';
|
3
3
|
import useIdle from 'react-use/lib/useIdle';
|
4
|
-
import
|
4
|
+
import { useLocalStorageState } from 'ahooks';
|
5
5
|
import useBrowser from '@arcblock/react-hooks/lib/useBrowser';
|
6
6
|
import { detectWalletExtension } from '@arcblock/ux/lib/Util';
|
7
7
|
|
@@ -92,7 +92,9 @@ export const withWebWalletSWKeeper = (Component) => {
|
|
92
92
|
const browser = useBrowser();
|
93
93
|
// eslint-disable-next-line no-param-reassign
|
94
94
|
webWalletUrl = webWalletUrl || getWebWalletUrl();
|
95
|
-
const [disabled] =
|
95
|
+
const [disabled] = useLocalStorageState(STORAGE_KEY_DISABLED, {
|
96
|
+
defaultValue: 1,
|
97
|
+
});
|
96
98
|
const extension = detectWalletExtension();
|
97
99
|
const isSameProtocol = checkSameProtocol(webWalletUrl);
|
98
100
|
const isWalletWebview = browser.wallet;
|
package/src/withTracker/index.js
CHANGED
@@ -2,8 +2,7 @@
|
|
2
2
|
import ReactGA from 'react-ga';
|
3
3
|
import * as Sentry from '@sentry/browser';
|
4
4
|
|
5
|
-
import useDeepCompareEffect from '
|
6
|
-
import useMount from 'react-use/lib/useMount';
|
5
|
+
import { useMount, useDeepCompareEffect } from 'ahooks';
|
7
6
|
import { useLocation } from 'react-router-dom';
|
8
7
|
|
9
8
|
import ErrorBoundary from './error_boundary';
|