@arcblock/ux 2.8.26 → 2.9.1
Sign up to get free protection for your applications and to get access to all the features.
- package/es/Address/did-address.js +33 -21
- package/es/AnimationWaiter/index.js +2 -1
- package/es/Avatar/index.js +1 -1
- package/es/BlockletContext/index.js +1 -1
- package/es/CardSelector/index.js +2 -1
- package/es/Colors/index.js +2 -1
- package/es/Colors/themes/temp.js +17 -0
- package/es/Datatable/TableSearch.js +2 -1
- package/es/Img/index.js +7 -6
- package/es/Locale/selector.js +15 -13
- package/es/NFTDisplay/index.js +2 -1
- package/es/QRCode/index.js +2 -1
- package/es/SessionBlocklet/index.js +169 -0
- package/es/SessionManager/index.js +2 -381
- package/es/SessionPermission/index.js +28 -0
- package/es/SessionUser/components/logged-in.js +224 -0
- package/es/SessionUser/components/session-user-item.js +148 -0
- package/es/SessionUser/components/session-user-switch.js +213 -0
- package/es/SessionUser/components/un-login.js +64 -0
- package/es/SessionUser/components/user-info.js +163 -0
- package/es/SessionUser/index.js +49 -0
- package/es/SessionUser/libs/translation.js +19 -0
- package/es/SessionUser/libs/utils.js +4 -0
- package/es/SplitButton/index.js +2 -1
- package/es/Toast/index.js +1 -1
- package/es/Util/constant.js +10 -0
- package/es/Util/index.js +11 -0
- package/lib/Address/did-address.js +36 -22
- package/lib/AnimationWaiter/index.js +2 -1
- package/lib/Avatar/index.js +1 -1
- package/lib/BlockletContext/index.js +1 -1
- package/lib/CardSelector/index.js +2 -1
- package/lib/Colors/index.js +7 -0
- package/lib/Colors/themes/temp.js +24 -0
- package/lib/Datatable/TableSearch.js +2 -1
- package/lib/Img/index.js +7 -6
- package/lib/Locale/selector.js +14 -13
- package/lib/NFTDisplay/index.js +2 -1
- package/lib/QRCode/index.js +2 -1
- package/lib/SessionBlocklet/index.js +187 -0
- package/lib/SessionManager/index.js +2 -390
- package/lib/SessionPermission/index.js +38 -0
- package/lib/SessionUser/components/logged-in.js +243 -0
- package/lib/SessionUser/components/session-user-item.js +163 -0
- package/lib/SessionUser/components/session-user-switch.js +232 -0
- package/lib/SessionUser/components/un-login.js +72 -0
- package/lib/SessionUser/components/user-info.js +175 -0
- package/lib/SessionUser/index.js +57 -0
- package/lib/SessionUser/libs/translation.js +26 -0
- package/lib/{SessionManager → SessionUser}/libs/utils.js +8 -1
- package/lib/SplitButton/index.js +2 -1
- package/lib/Toast/index.js +5 -5
- package/lib/Util/constant.js +26 -0
- package/lib/Util/index.js +16 -3
- package/package.json +19 -7
- package/src/Address/did-address.jsx +34 -20
- package/src/AnimationWaiter/index.js +2 -1
- package/src/Avatar/index.jsx +1 -1
- package/src/BlockletContext/index.jsx +1 -1
- package/src/CardSelector/index.jsx +2 -1
- package/src/Colors/index.js +1 -0
- package/src/Colors/themes/temp.js +18 -0
- package/src/Datatable/TableSearch.js +3 -1
- package/src/Img/{index.js → index.jsx} +8 -6
- package/src/Locale/selector.jsx +11 -8
- package/src/NFTDisplay/index.js +2 -1
- package/src/QRCode/index.js +2 -1
- package/src/SessionBlocklet/index.jsx +181 -0
- package/src/SessionManager/index.jsx +2 -369
- package/src/SessionPermission/index.jsx +28 -0
- package/src/SessionUser/components/logged-in.jsx +194 -0
- package/src/SessionUser/components/session-user-item.jsx +96 -0
- package/src/SessionUser/components/session-user-switch.jsx +222 -0
- package/src/SessionUser/components/un-login.jsx +55 -0
- package/src/SessionUser/components/user-info.jsx +165 -0
- package/src/SessionUser/index.jsx +38 -0
- package/src/SessionUser/libs/translation.js +19 -0
- package/src/{SessionManager → SessionUser}/libs/utils.js +4 -0
- package/src/SplitButton/index.js +2 -1
- package/src/Toast/index.js +1 -1
- package/src/Util/constant.js +12 -0
- package/src/Util/index.js +13 -0
- package/es/SessionManager/components/account-item.js +0 -212
- package/es/SessionManager/components/add-account-item.js +0 -57
- package/es/SessionManager/components/federated-login-detecter.js +0 -183
- package/es/SessionManager/components/manage-accounts.js +0 -219
- package/es/SessionManager/components/manage-blocklet.js +0 -70
- package/es/SessionManager/components/menu-accordion.js +0 -103
- package/es/SessionManager/components/responsive-popper.js +0 -24
- package/es/SessionManager/components/user-drawer.js +0 -68
- package/es/SessionManager/components/user-info.js +0 -143
- package/es/SessionManager/components/user-popper.js +0 -110
- package/es/SessionManager/hooks/use-config.js +0 -34
- package/es/SessionManager/libs/translation.js +0 -52
- package/es/SessionManager/libs/utils.js +0 -2
- package/lib/SessionManager/components/account-item.js +0 -219
- package/lib/SessionManager/components/add-account-item.js +0 -66
- package/lib/SessionManager/components/federated-login-detecter.js +0 -193
- package/lib/SessionManager/components/manage-accounts.js +0 -232
- package/lib/SessionManager/components/manage-blocklet.js +0 -86
- package/lib/SessionManager/components/menu-accordion.js +0 -111
- package/lib/SessionManager/components/responsive-popper.js +0 -34
- package/lib/SessionManager/components/user-drawer.js +0 -75
- package/lib/SessionManager/components/user-info.js +0 -160
- package/lib/SessionManager/components/user-popper.js +0 -104
- package/lib/SessionManager/hooks/use-config.js +0 -41
- package/lib/SessionManager/libs/translation.js +0 -59
- package/src/SessionManager/components/account-item.jsx +0 -156
- package/src/SessionManager/components/add-account-item.jsx +0 -49
- package/src/SessionManager/components/federated-login-detecter.jsx +0 -167
- package/src/SessionManager/components/manage-accounts.jsx +0 -228
- package/src/SessionManager/components/manage-blocklet.jsx +0 -70
- package/src/SessionManager/components/menu-accordion.jsx +0 -93
- package/src/SessionManager/components/responsive-popper.jsx +0 -26
- package/src/SessionManager/components/user-drawer.jsx +0 -57
- package/src/SessionManager/components/user-info.jsx +0 -117
- package/src/SessionManager/components/user-popper.jsx +0 -95
- package/src/SessionManager/hooks/use-config.js +0 -33
- package/src/SessionManager/libs/translation.js +0 -52
@@ -0,0 +1,57 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.default = SessionUser;
|
7
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
8
|
+
var _noop = _interopRequireDefault(require("lodash/noop"));
|
9
|
+
var _ahooks = require("ahooks");
|
10
|
+
var _loggedIn = _interopRequireDefault(require("./components/logged-in"));
|
11
|
+
var _unLogin = _interopRequireDefault(require("./components/un-login"));
|
12
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
13
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
14
|
+
function SessionUser(_ref) {
|
15
|
+
let {
|
16
|
+
session,
|
17
|
+
onBindWallet,
|
18
|
+
locale,
|
19
|
+
size
|
20
|
+
} = _ref;
|
21
|
+
const isBlocklet = (0, _ahooks.useCreation)(() => {
|
22
|
+
return !!(globalThis !== null && globalThis !== void 0 && globalThis.blocklet);
|
23
|
+
});
|
24
|
+
if (session.user) {
|
25
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_loggedIn.default, {
|
26
|
+
isBlocklet: isBlocklet,
|
27
|
+
session: session,
|
28
|
+
onBindWallet: onBindWallet,
|
29
|
+
locale: locale,
|
30
|
+
size: size
|
31
|
+
});
|
32
|
+
}
|
33
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_unLogin.default, {
|
34
|
+
session: session,
|
35
|
+
isBlocklet: isBlocklet,
|
36
|
+
locale: locale,
|
37
|
+
size: size
|
38
|
+
});
|
39
|
+
}
|
40
|
+
SessionUser.propTypes = {
|
41
|
+
session: _propTypes.default.shape({
|
42
|
+
user: _propTypes.default.shape({
|
43
|
+
did: _propTypes.default.string.isRequired,
|
44
|
+
fullName: _propTypes.default.string.isRequired,
|
45
|
+
email: _propTypes.default.string.isRequired,
|
46
|
+
avatar: _propTypes.default.string.isRequired
|
47
|
+
})
|
48
|
+
}).isRequired,
|
49
|
+
onBindWallet: _propTypes.default.func,
|
50
|
+
locale: _propTypes.default.string,
|
51
|
+
size: _propTypes.default.number
|
52
|
+
};
|
53
|
+
SessionUser.defaultProps = {
|
54
|
+
onBindWallet: _noop.default,
|
55
|
+
locale: 'en',
|
56
|
+
size: 24
|
57
|
+
};
|
@@ -0,0 +1,26 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.translations = void 0;
|
7
|
+
/* eslint-disable import/prefer-default-export */
|
8
|
+
const translations = {
|
9
|
+
en: {
|
10
|
+
connectDIDWallet: 'Connect your DID Wallet for full functionality',
|
11
|
+
switch: 'Switch',
|
12
|
+
profile: 'Profile',
|
13
|
+
dashboard: 'Dashboard',
|
14
|
+
logout: 'Sign Out',
|
15
|
+
addAnotherAccount: 'Add another account'
|
16
|
+
},
|
17
|
+
zh: {
|
18
|
+
connectDIDWallet: '连接你的 DID Wallet 获得更全的功能',
|
19
|
+
switch: '切换',
|
20
|
+
profile: '个人中心',
|
21
|
+
dashboard: '控制台',
|
22
|
+
logout: '退出登录',
|
23
|
+
addAnotherAccount: '添加账户'
|
24
|
+
}
|
25
|
+
};
|
26
|
+
exports.translations = translations;
|
@@ -3,12 +3,19 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
exports.getSourceProvider = exports.getConnectedAccounts = void 0;
|
6
|
+
exports.getSourceProvider = exports.getSourceAppPid = exports.getCurrentAppPid = exports.getConnectedAccounts = void 0;
|
7
7
|
const getSourceProvider = user => {
|
8
8
|
var _user$extraConfigs;
|
9
9
|
return (user === null || user === void 0 ? void 0 : user.sourceProvider) || (user === null || user === void 0 ? void 0 : (_user$extraConfigs = user.extraConfigs) === null || _user$extraConfigs === void 0 ? void 0 : _user$extraConfigs.sourceProvider) || 'wallet';
|
10
10
|
};
|
11
11
|
exports.getSourceProvider = getSourceProvider;
|
12
|
+
const getSourceAppPid = user => user === null || user === void 0 ? void 0 : user.sourceAppPid;
|
13
|
+
exports.getSourceAppPid = getSourceAppPid;
|
14
|
+
const getCurrentAppPid = user => {
|
15
|
+
var _window, _window$blocklet;
|
16
|
+
return (user === null || user === void 0 ? void 0 : user.sourceAppPid) || ((_window = window) === null || _window === void 0 ? void 0 : (_window$blocklet = _window.blocklet) === null || _window$blocklet === void 0 ? void 0 : _window$blocklet.appPid);
|
17
|
+
};
|
18
|
+
exports.getCurrentAppPid = getCurrentAppPid;
|
12
19
|
const getConnectedAccounts = user => {
|
13
20
|
var _user$extraConfigs2;
|
14
21
|
return (user === null || user === void 0 ? void 0 : user.connectedAccounts) || (user === null || user === void 0 ? void 0 : (_user$extraConfigs2 = user.extraConfigs) === null || _user$extraConfigs2 === void 0 ? void 0 : _user$extraConfigs2.connectedAccounts) || [];
|
package/lib/SplitButton/index.js
CHANGED
@@ -14,6 +14,7 @@ var _MenuList = _interopRequireDefault(require("@mui/material/MenuList"));
|
|
14
14
|
var _MenuItem = _interopRequireDefault(require("@mui/material/MenuItem"));
|
15
15
|
var _ButtonGroup = _interopRequireDefault(require("@mui/material/ButtonGroup"));
|
16
16
|
var _Button = _interopRequireDefault(require("@mui/material/Button"));
|
17
|
+
var _noop = _interopRequireDefault(require("lodash/noop"));
|
17
18
|
var _Theme = require("../Theme");
|
18
19
|
var _jsxRuntime = require("react/jsx-runtime");
|
19
20
|
var _templateObject, _templateObject2;
|
@@ -129,7 +130,7 @@ SplitButton.defaultProps = {
|
|
129
130
|
menu: [],
|
130
131
|
children: null,
|
131
132
|
variant: 'contained',
|
132
|
-
onClick:
|
133
|
+
onClick: _noop.default,
|
133
134
|
menuButtonProps: {}
|
134
135
|
};
|
135
136
|
/**
|
package/lib/Toast/index.js
CHANGED
@@ -9,6 +9,7 @@ var _react = require("react");
|
|
9
9
|
var _notistack = require("notistack");
|
10
10
|
var _IconButton = _interopRequireDefault(require("@mui/material/IconButton"));
|
11
11
|
var _Close = _interopRequireDefault(require("@mui/icons-material/Close"));
|
12
|
+
var _noop = _interopRequireDefault(require("lodash/noop"));
|
12
13
|
var _jsxRuntime = require("react/jsx-runtime");
|
13
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
14
15
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
@@ -22,11 +23,10 @@ function _toPrimitive(input, hint) { if (typeof input !== "object" || input ===
|
|
22
23
|
*/ /**
|
23
24
|
* @type {import('notistack').ProviderContext['enqueueSnackbar']}
|
24
25
|
*/
|
25
|
-
|
26
|
-
let
|
27
|
-
let
|
28
|
-
let
|
29
|
-
let _info = noop;
|
26
|
+
let _success = _noop.default;
|
27
|
+
let _error = _noop.default;
|
28
|
+
let _warning = _noop.default;
|
29
|
+
let _info = _noop.default;
|
30
30
|
/**
|
31
31
|
* @description
|
32
32
|
* @param {(message: import('notistack').SnackbarMessage, options?: import('notistack').OptionsObject) => import('notistack').SnackbarKey} enqueueSnackbar
|
@@ -0,0 +1,26 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.SESSION_TOKEN_STORAGE_KEY = exports.RELAY_SOCKET_PREFIX = exports.REFRESH_TOKEN_STORAGE_KEY = exports.PROFILE_URL = exports.NAVIGATION_URL = exports.DEFAULT_WINDOW_TIMEOUT = exports.DEFAULT_TIMEOUT = exports.DASHBOARD_URL = exports.AUTH_SERVICE_PREFIX = exports.API_DID_PREFIX = void 0;
|
7
|
+
const DEFAULT_TIMEOUT = 5 * 60;
|
8
|
+
exports.DEFAULT_TIMEOUT = DEFAULT_TIMEOUT;
|
9
|
+
const DEFAULT_WINDOW_TIMEOUT = 30 * 60;
|
10
|
+
exports.DEFAULT_WINDOW_TIMEOUT = DEFAULT_WINDOW_TIMEOUT;
|
11
|
+
const AUTH_SERVICE_PREFIX = '/.well-known/service';
|
12
|
+
exports.AUTH_SERVICE_PREFIX = AUTH_SERVICE_PREFIX;
|
13
|
+
const SESSION_TOKEN_STORAGE_KEY = 'login_token';
|
14
|
+
exports.SESSION_TOKEN_STORAGE_KEY = SESSION_TOKEN_STORAGE_KEY;
|
15
|
+
const REFRESH_TOKEN_STORAGE_KEY = 'refresh_token';
|
16
|
+
exports.REFRESH_TOKEN_STORAGE_KEY = REFRESH_TOKEN_STORAGE_KEY;
|
17
|
+
const RELAY_SOCKET_PREFIX = '/.well-known/service';
|
18
|
+
exports.RELAY_SOCKET_PREFIX = RELAY_SOCKET_PREFIX;
|
19
|
+
const API_DID_PREFIX = '/api/did';
|
20
|
+
exports.API_DID_PREFIX = API_DID_PREFIX;
|
21
|
+
const DASHBOARD_URL = "".concat(AUTH_SERVICE_PREFIX, "/admin");
|
22
|
+
exports.DASHBOARD_URL = DASHBOARD_URL;
|
23
|
+
const PROFILE_URL = "".concat(AUTH_SERVICE_PREFIX, "/user");
|
24
|
+
exports.PROFILE_URL = PROFILE_URL;
|
25
|
+
const NAVIGATION_URL = "".concat(AUTH_SERVICE_PREFIX, "/admin/navigation");
|
26
|
+
exports.NAVIGATION_URL = NAVIGATION_URL;
|
package/lib/Util/index.js
CHANGED
@@ -11,12 +11,12 @@ exports.getColor = exports.getBackground = exports.formatUptime = void 0;
|
|
11
11
|
exports.getCookieOptions = getCookieOptions;
|
12
12
|
exports.getCopyright = getCopyright;
|
13
13
|
exports.getDateTool = getDateTool;
|
14
|
-
exports.isUrl = exports.isEthereumDid = exports.getUserAvatar = exports.getTimezone = exports.getFontSize = void 0;
|
14
|
+
exports.isUrl = exports.isEthereumDid = exports.getVisitorId = exports.getUserAvatar = exports.getTimezone = exports.getFontSize = void 0;
|
15
15
|
exports.mergeProps = mergeProps;
|
16
16
|
exports.openWebWallet = openWebWallet;
|
17
17
|
exports.parseQuery = parseQuery;
|
18
18
|
exports.setDateTool = setDateTool;
|
19
|
-
exports.str2color = exports.sleep = void 0;
|
19
|
+
exports.str2color = exports.sleep = exports.setVisitorId = void 0;
|
20
20
|
exports.stringifyQuery = stringifyQuery;
|
21
21
|
var _padStart = _interopRequireDefault(require("lodash/padStart"));
|
22
22
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
@@ -352,4 +352,17 @@ exports.sleep = sleep;
|
|
352
352
|
const isUrl = str => {
|
353
353
|
return /^https?:\/\//.test(str);
|
354
354
|
};
|
355
|
-
exports.isUrl = isUrl;
|
355
|
+
exports.isUrl = isUrl;
|
356
|
+
const visitorIdKey = '__visitor_id';
|
357
|
+
const getVisitorId = () => {
|
358
|
+
return localStorage.getItem(visitorIdKey);
|
359
|
+
};
|
360
|
+
exports.getVisitorId = getVisitorId;
|
361
|
+
const setVisitorId = value => {
|
362
|
+
if (value === null) {
|
363
|
+
localStorage.removeItem(visitorIdKey);
|
364
|
+
} else {
|
365
|
+
localStorage.setItem(visitorIdKey, value);
|
366
|
+
}
|
367
|
+
};
|
368
|
+
exports.setVisitorId = setVisitorId;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@arcblock/ux",
|
3
|
-
"version": "2.
|
3
|
+
"version": "2.9.1",
|
4
4
|
"description": "Common used react components for arcblock products",
|
5
5
|
"keywords": [
|
6
6
|
"react",
|
@@ -239,10 +239,22 @@
|
|
239
239
|
"import": "./es/Screenshot/index.js",
|
240
240
|
"require": "./lib/Screenshot/index.js"
|
241
241
|
},
|
242
|
+
"./lib/SessionBlocklet": {
|
243
|
+
"import": "./es/SessionBlocklet/index.js",
|
244
|
+
"require": "./lib/SessionBlocklet/index.js"
|
245
|
+
},
|
242
246
|
"./lib/SessionManager": {
|
243
247
|
"import": "./es/SessionManager/index.js",
|
244
248
|
"require": "./lib/SessionManager/index.js"
|
245
249
|
},
|
250
|
+
"./lib/SessionPermission": {
|
251
|
+
"import": "./es/SessionPermission/index.js",
|
252
|
+
"require": "./lib/SessionPermission/index.js"
|
253
|
+
},
|
254
|
+
"./lib/SessionUser": {
|
255
|
+
"import": "./es/SessionUser/index.js",
|
256
|
+
"require": "./lib/SessionUser/index.js"
|
257
|
+
},
|
246
258
|
"./lib/Sparkline": {
|
247
259
|
"import": "./es/Sparkline/index.js",
|
248
260
|
"require": "./lib/Sparkline/index.js"
|
@@ -324,19 +336,19 @@
|
|
324
336
|
"peerDependencies": {
|
325
337
|
"react": ">=18.1.0"
|
326
338
|
},
|
327
|
-
"gitHead": "
|
339
|
+
"gitHead": "556eab194f020221e2569f142f7c6175d9f02b28",
|
328
340
|
"dependencies": {
|
329
341
|
"@arcblock/did-motif": "^1.1.13",
|
330
|
-
"@arcblock/icons": "^2.
|
331
|
-
"@arcblock/react-hooks": "^2.
|
342
|
+
"@arcblock/icons": "^2.9.1",
|
343
|
+
"@arcblock/react-hooks": "^2.9.1",
|
332
344
|
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
|
333
345
|
"@emotion/react": "^11.10.4",
|
334
346
|
"@emotion/styled": "^11.10.4",
|
335
347
|
"@fontsource/lato": "^4.5.10",
|
336
348
|
"@fontsource/ubuntu-mono": "^4.5.11",
|
337
|
-
"@iconify-icons/
|
338
|
-
"@iconify-icons/
|
339
|
-
"@iconify-icons/mdi": "^1.2.
|
349
|
+
"@iconify-icons/logos": "^1.2.36",
|
350
|
+
"@iconify-icons/material-symbols": "^1.2.58",
|
351
|
+
"@iconify-icons/mdi": "^1.2.48",
|
340
352
|
"@iconify/react": "^4.1.1",
|
341
353
|
"@mui/icons-material": "^5.14.8",
|
342
354
|
"@mui/material": "^5.14.8",
|
@@ -1,11 +1,11 @@
|
|
1
1
|
import React, { useRef, useState, forwardRef } from 'react';
|
2
2
|
import PropTypes from 'prop-types';
|
3
3
|
import '@fontsource/ubuntu-mono/400.css';
|
4
|
-
import Tooltip from '@mui/material/Tooltip';
|
5
4
|
import { green } from '@mui/material/colors';
|
5
|
+
import { Tooltip, Box } from '@mui/material';
|
6
6
|
import copy from 'copy-to-clipboard';
|
7
|
-
import CopyIcon from '@mui/icons-material
|
8
|
-
import
|
7
|
+
import { ContentCopy as CopyIcon, Check as CheckIcon } from '@mui/icons-material';
|
8
|
+
import noop from 'lodash/noop';
|
9
9
|
|
10
10
|
import { styled } from '../Theme';
|
11
11
|
import { getFontSize } from '../Util';
|
@@ -93,19 +93,35 @@ const DidAddress = forwardRef(
|
|
93
93
|
<Root as={component} size={size} {...rest} ref={ref}>
|
94
94
|
{prepend}
|
95
95
|
{/* 注意: 该元素必须渲染(可以隐藏), 以便 compact 模式下复制的文本是完整的 */}
|
96
|
-
<
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
</
|
108
|
-
|
96
|
+
<Tooltip title={copyable ? '' : translations[locale].copied} placement="bottom" arrow open={copied}>
|
97
|
+
<Box
|
98
|
+
ref={textRef}
|
99
|
+
component="span"
|
100
|
+
className="did-address-text did-address-truncate"
|
101
|
+
sx={{
|
102
|
+
display: compact ? 'none' : 'inline',
|
103
|
+
cursor: copyable ? 'text' : 'pointer',
|
104
|
+
}}
|
105
|
+
onDoubleClick={copyable ? noop : onCopy}>
|
106
|
+
{children}
|
107
|
+
</Box>
|
108
|
+
{compact && (
|
109
|
+
<Box
|
110
|
+
component="span"
|
111
|
+
className="did-address-text"
|
112
|
+
sx={{
|
113
|
+
cursor: copyable ? 'text' : 'pointer',
|
114
|
+
}}
|
115
|
+
onDoubleClick={copyable ? noop : onCopy}>
|
116
|
+
<CompactText
|
117
|
+
startChars={startChars}
|
118
|
+
endChars={endChars}
|
119
|
+
showCopyButtonInTooltip={showCopyButtonInTooltip}>
|
120
|
+
{children}
|
121
|
+
</CompactText>
|
122
|
+
</Box>
|
123
|
+
)}
|
124
|
+
</Tooltip>
|
109
125
|
{copyElement}
|
110
126
|
{append}
|
111
127
|
</Root>
|
@@ -149,7 +165,7 @@ DidAddress.defaultProps = {
|
|
149
165
|
locale: 'en',
|
150
166
|
};
|
151
167
|
|
152
|
-
const Root = styled(
|
168
|
+
const Root = styled(Box, { shouldForwardProp: (prop) => prop !== 'inline' })`
|
153
169
|
font-family: 'Ubuntu Mono', monospace;
|
154
170
|
&& {
|
155
171
|
display: ${({ inline }) => (inline ? 'inline-flex' : 'flex')};
|
@@ -175,9 +191,6 @@ const Root = styled('div', { shouldForwardProp: (prop) => prop !== 'inline' })`
|
|
175
191
|
text-overflow: ellipsis;
|
176
192
|
}
|
177
193
|
|
178
|
-
.did-address-copy {
|
179
|
-
flex: 0 0 auto;
|
180
|
-
}
|
181
194
|
.did-address-copy-wrapper {
|
182
195
|
display: flex;
|
183
196
|
justify-content: center;
|
@@ -187,6 +200,7 @@ const Root = styled('div', { shouldForwardProp: (prop) => prop !== 'inline' })`
|
|
187
200
|
margin-left: 8px;
|
188
201
|
}
|
189
202
|
.did-address-copy {
|
203
|
+
flex: 0 0 auto;
|
190
204
|
font-size: 1em;
|
191
205
|
color: #999;
|
192
206
|
cursor: pointer;
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import { useState, useEffect, useRef } from 'react';
|
2
2
|
import PropTypes from 'prop-types';
|
3
3
|
import Lottie from 'react-lottie-player';
|
4
|
+
import noop from 'lodash/noop';
|
4
5
|
|
5
6
|
import lottieJson from './default-animation.json';
|
6
7
|
import { styled } from '../Theme';
|
@@ -73,7 +74,7 @@ export default function AnimationWaiter({
|
|
73
74
|
// tips
|
74
75
|
useEffect(() => {
|
75
76
|
if (!tips.length) {
|
76
|
-
return
|
77
|
+
return noop;
|
77
78
|
}
|
78
79
|
|
79
80
|
const timer = setTimeout(() => {
|
package/src/Avatar/index.jsx
CHANGED
@@ -32,7 +32,7 @@ function BlockletProvider({ children, baseUrl }) {
|
|
32
32
|
setBlockletData(data);
|
33
33
|
} catch {
|
34
34
|
// NOTICE: 如果获取指定 blockletData 失败,则使用 window.blocklet
|
35
|
-
const data =
|
35
|
+
const data = globalThis.blocklet || globalThis.env;
|
36
36
|
setBlockletData(data);
|
37
37
|
}
|
38
38
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import { useState, useEffect, useRef } from 'react';
|
2
2
|
import styled from '@emotion/styled';
|
3
3
|
import PropTypes from 'prop-types';
|
4
|
+
import noop from 'lodash/noop';
|
4
5
|
|
5
6
|
export default function CardSelector({ list, width, height, cardSpace, onSelect, defaultIndex }) {
|
6
7
|
const [selectedId, setSelectedId] = useState(0);
|
@@ -132,6 +133,6 @@ CardSelector.defaultProps = {
|
|
132
133
|
width: 300,
|
133
134
|
height: 400,
|
134
135
|
cardSpace: 40,
|
135
|
-
onSelect:
|
136
|
+
onSelect: noop,
|
136
137
|
defaultIndex: 0,
|
137
138
|
};
|
package/src/Colors/index.js
CHANGED
@@ -0,0 +1,18 @@
|
|
1
|
+
const colors = {
|
2
|
+
lineStep: 'rgba(18, 22, 24, 0.06)',
|
3
|
+
lineBorderStrong: 'rgba(18, 22, 24, 0.12)',
|
4
|
+
lineBorderBase: 'rgba(18, 22, 24, 0.06)',
|
5
|
+
borderBase: 'rgba(18, 22, 24, 0.06)',
|
6
|
+
textMuted: 'rgba(18, 22, 24, 0.36)',
|
7
|
+
textSubtitle: 'rgba(18, 22, 24, 0.6)',
|
8
|
+
textBase: 'rgba(18, 22, 24, 1)',
|
9
|
+
textPrimaryBase: 'rgba(18, 22, 24, 1)',
|
10
|
+
surfaceBgSubtitle: 'rgba(18, 22, 24, 0.03)',
|
11
|
+
surfacePrimarySubtitle: 'rgba(19, 125, 250, 0.06)',
|
12
|
+
surfaceSuccess: 'rgba(13, 202, 134, 1)',
|
13
|
+
primaryBase: 'rgba(19, 125, 250, 1)',
|
14
|
+
primary100: 'rgba(19, 125, 250, 1)',
|
15
|
+
gray6: 'rgba(17, 22, 24, 0.06)',
|
16
|
+
};
|
17
|
+
|
18
|
+
export default colors;
|
@@ -6,6 +6,8 @@ import SearchIcon from '@mui/icons-material/Search';
|
|
6
6
|
import TextField from '@mui/material/TextField';
|
7
7
|
import ClearIcon from '@mui/icons-material/Clear';
|
8
8
|
import clsx from 'clsx';
|
9
|
+
import noop from 'lodash/noop';
|
10
|
+
|
9
11
|
import { useDatatableContext } from './DatatableContext';
|
10
12
|
import { styled } from '../Theme';
|
11
13
|
|
@@ -110,7 +112,7 @@ TableSearch.propTypes = {
|
|
110
112
|
TableSearch.defaultProps = {
|
111
113
|
search: '',
|
112
114
|
searchText: '',
|
113
|
-
onSearchOpen:
|
115
|
+
onSearchOpen: noop,
|
114
116
|
};
|
115
117
|
|
116
118
|
const Container = styled('div')`
|
@@ -1,9 +1,11 @@
|
|
1
1
|
import { useEffect, useMemo, useState } from 'react';
|
2
2
|
import PropTypes from 'prop-types';
|
3
3
|
import { useInView } from 'react-intersection-observer';
|
4
|
-
import
|
5
|
-
import
|
4
|
+
import WarningRoundedIcon from '@iconify-icons/material-symbols/warning-rounded';
|
5
|
+
import ImageRoundedIcon from '@iconify-icons/material-symbols/image-rounded';
|
6
6
|
import { Icon } from '@iconify/react';
|
7
|
+
import noop from 'lodash/noop';
|
8
|
+
|
7
9
|
import { styled } from '../Theme';
|
8
10
|
|
9
11
|
/**
|
@@ -160,12 +162,12 @@ function Img({
|
|
160
162
|
<div className={`image ${className} ${classes.root}`} style={mergedStyle}>
|
161
163
|
{!fallback && imgState === 'error' && (
|
162
164
|
<div className="image--state" title="loading image">
|
163
|
-
<Icon icon={
|
165
|
+
<Icon icon={WarningRoundedIcon} className="image--icon" />
|
164
166
|
</div>
|
165
167
|
)}
|
166
168
|
{!placeholder && imgState === 'loading' && (
|
167
169
|
<div className="image--state" title="Image load error">
|
168
|
-
<Icon icon={
|
170
|
+
<Icon icon={ImageRoundedIcon} className="image--icon" />
|
169
171
|
</div>
|
170
172
|
)}
|
171
173
|
{imgState === 'loaded' && <img className="image--img" src={src} alt={alt} />}
|
@@ -204,8 +206,8 @@ Img.defaultProps = {
|
|
204
206
|
placeholder: null,
|
205
207
|
fallback: null,
|
206
208
|
className: '',
|
207
|
-
onError:
|
208
|
-
onSuccess:
|
209
|
+
onError: noop,
|
210
|
+
onSuccess: noop,
|
209
211
|
};
|
210
212
|
|
211
213
|
export default Img;
|
package/src/Locale/selector.jsx
CHANGED
@@ -2,11 +2,13 @@
|
|
2
2
|
import { useState, useContext, useRef, useMemo } from 'react';
|
3
3
|
import PropTypes from 'prop-types';
|
4
4
|
import { Button, Typography, IconButton, Popper, MenuItem, MenuList, Box, ClickAwayListener } from '@mui/material';
|
5
|
-
import
|
6
|
-
import
|
5
|
+
import { Icon as IconifyIcon } from '@iconify/react';
|
6
|
+
import LanguageIcon from '@iconify-icons/material-symbols/language';
|
7
|
+
import CheckIcon from '@iconify-icons/material-symbols/check';
|
8
|
+
import noop from 'lodash/noop';
|
7
9
|
|
8
10
|
import { getColor, getBackground } from '../Util';
|
9
|
-
|
11
|
+
import { temp as colors } from '../Colors';
|
10
12
|
import { LocaleContext } from './context';
|
11
13
|
import { styled, useTheme } from '../Theme';
|
12
14
|
|
@@ -56,7 +58,7 @@ export default function LocaleSelector(props) {
|
|
56
58
|
return <Icon />;
|
57
59
|
}
|
58
60
|
|
59
|
-
return <
|
61
|
+
return <IconifyIcon icon={LanguageIcon} fontSize={size} color={theme.palette.text.secondary} />;
|
60
62
|
}, [Icon, theme?.palette?.text?.secondary, size]);
|
61
63
|
|
62
64
|
return (
|
@@ -81,9 +83,9 @@ export default function LocaleSelector(props) {
|
|
81
83
|
<MenuList>
|
82
84
|
{languages.map(({ code, name }) => (
|
83
85
|
<MenuItem key={code} className="locale-item" onClick={() => onSelect(code, name)}>
|
84
|
-
<
|
86
|
+
<IconifyIcon
|
87
|
+
icon={CheckIcon}
|
85
88
|
className={code === locale ? 'check-icon check-icon-visible' : 'check-icon'}
|
86
|
-
fontSize="small"
|
87
89
|
/>
|
88
90
|
{name}
|
89
91
|
</MenuItem>
|
@@ -109,7 +111,7 @@ LocaleSelector.defaultProps = {
|
|
109
111
|
showText: true,
|
110
112
|
size: 24,
|
111
113
|
popperProps: {},
|
112
|
-
onChange:
|
114
|
+
onChange: noop,
|
113
115
|
popperType: 'click',
|
114
116
|
icon: null,
|
115
117
|
};
|
@@ -135,7 +137,8 @@ const Div = styled('div', {
|
|
135
137
|
|
136
138
|
.locales {
|
137
139
|
background: ${(props) => getBackground(props)};
|
138
|
-
box-shadow:
|
140
|
+
box-shadow: 0px 8px 16px 0px ${colors.gray6}, 0px 0px 0px 1px ${colors.gray6};
|
141
|
+
border-radius: 8px;
|
139
142
|
}
|
140
143
|
|
141
144
|
.locale-item {
|
package/src/NFTDisplay/index.js
CHANGED
@@ -8,6 +8,7 @@ import pako from 'pako';
|
|
8
8
|
import base64 from 'base64-url';
|
9
9
|
import isSvg from 'is-svg';
|
10
10
|
import { ReactSVG } from 'react-svg';
|
11
|
+
import noop from 'lodash/noop';
|
11
12
|
|
12
13
|
import AspectRatioContainer from './aspect-ratio-container';
|
13
14
|
import ImgSvgEmbedder from './svg-embedder/img';
|
@@ -254,7 +255,7 @@ NFTDisplay.defaultProps = {
|
|
254
255
|
preferredSvgEmbedder: 'img',
|
255
256
|
checkSvg: false,
|
256
257
|
minimumLoadingTime: 0,
|
257
|
-
onCompleted:
|
258
|
+
onCompleted: noop,
|
258
259
|
};
|
259
260
|
|
260
261
|
const Root = styled('div')`
|
package/src/QRCode/index.js
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
import { useRef, useEffect, useMemo, useState } from 'react';
|
2
2
|
import PropTypes from 'prop-types';
|
3
3
|
import QRCodeStyling from '@solana/qr-code-styling';
|
4
|
+
import { Box } from '@mui/material';
|
4
5
|
|
5
6
|
const defaults = {
|
6
7
|
margin: 0,
|
@@ -50,7 +51,7 @@ function QRCode({ data, size, image, config, ...rest }) {
|
|
50
51
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
51
52
|
}, [data, size, image, config]);
|
52
53
|
|
53
|
-
return <
|
54
|
+
return <Box ref={ref} {...rest} />;
|
54
55
|
}
|
55
56
|
|
56
57
|
QRCode.propTypes = {
|