@arcblock/ux 2.9.13 → 2.9.15

Sign up to get free protection for your applications and to get access to all the features.
Files changed (158) hide show
  1. package/es/Address/did-address.js +18 -13
  2. package/es/Colors/themes/default.js +0 -1
  3. package/es/Colors/themes/temp.js +10 -1
  4. package/es/ContactForm/index.js +2 -2
  5. package/es/DID/index.js +0 -1
  6. package/es/Dialog/confirm.js +1 -99
  7. package/es/Dialog/dialog.js +4 -7
  8. package/es/Dialog/index.js +1 -1
  9. package/es/Dialog/use-confirm.js +105 -0
  10. package/es/Locale/selector.js +1 -1
  11. package/es/Locale/util.js +10 -5
  12. package/es/NFTDisplay/index.js +0 -1
  13. package/es/Passport/index.js +2 -0
  14. package/es/Passport/passport.js +103 -0
  15. package/es/SessionBlocklet/index.js +1 -1
  16. package/es/SessionUser/components/logged-in.js +1 -1
  17. package/es/SessionUser/components/un-login.js +1 -1
  18. package/es/SessionUser/components/user-info.js +1 -1
  19. package/es/SessionUser/index.js +2 -2
  20. package/es/Tabs/index.js +88 -2
  21. package/es/Theme/theme.js +12 -3
  22. package/es/Util/passport.js +62 -0
  23. package/lib/ActionButton/index.js +6 -7
  24. package/lib/ActivityIndicator/index.js +4 -4
  25. package/lib/Address/compact-text.js +6 -6
  26. package/lib/Address/did-address.js +25 -21
  27. package/lib/Address/index.js +4 -4
  28. package/lib/Address/responsive-did-address.js +4 -4
  29. package/lib/Alert/index.js +5 -6
  30. package/lib/AnimationWaiter/index.js +4 -4
  31. package/lib/Async/index.js +6 -6
  32. package/lib/Avatar/did-motif.js +5 -6
  33. package/lib/Avatar/etherscan-blockies.js +2 -3
  34. package/lib/Avatar/index.js +4 -4
  35. package/lib/Badge/index.js +5 -6
  36. package/lib/Blocklet/blocklet.js +4 -4
  37. package/lib/Blocklet/index.js +3 -4
  38. package/lib/Blocklet/utils.js +3 -5
  39. package/lib/BlockletContext/index.js +1 -2
  40. package/lib/BlockletNFT/index.js +4 -4
  41. package/lib/Button/index.js +1 -2
  42. package/lib/Button/wrap.js +4 -4
  43. package/lib/ButtonGroup/index.js +1 -2
  44. package/lib/ClickToCopy/copy-button.js +4 -4
  45. package/lib/ClickToCopy/index.js +6 -6
  46. package/lib/CodeBlock/LightBox.js +1 -2
  47. package/lib/CodeBlock/index.js +4 -4
  48. package/lib/Colors/themes/default.js +1 -2
  49. package/lib/Colors/themes/temp.js +11 -3
  50. package/lib/ContactForm/index.js +2 -2
  51. package/lib/CookieConsent/index.js +6 -6
  52. package/lib/CountDown/index.js +4 -4
  53. package/lib/DID/index.js +7 -9
  54. package/lib/Datatable/CustomToolbar.js +2 -2
  55. package/lib/Datatable/index.js +49 -49
  56. package/lib/Datatable/utils.js +2 -3
  57. package/lib/Dialog/confirm.js +5 -113
  58. package/lib/Dialog/dialog.js +14 -18
  59. package/lib/Dialog/index.js +3 -4
  60. package/lib/Dialog/use-confirm.js +126 -0
  61. package/lib/Earth/index.js +7 -8
  62. package/lib/Empty/index.js +5 -6
  63. package/lib/Header/auto-hidden.js +5 -6
  64. package/lib/Header/header.js +5 -6
  65. package/lib/Header/responsive-header.js +5 -6
  66. package/lib/Icon/image.js +4 -4
  67. package/lib/Icon/index.js +6 -7
  68. package/lib/Img/index.js +5 -6
  69. package/lib/InfoRow/index.js +5 -6
  70. package/lib/Layout/dashboard/external-link.js +4 -4
  71. package/lib/Layout/dashboard/full-page.js +5 -6
  72. package/lib/Layout/dashboard/index.js +4 -4
  73. package/lib/Layout/dashboard/sidebar.js +5 -6
  74. package/lib/Layout/dashboard-legacy/header.js +4 -4
  75. package/lib/Layout/dashboard-legacy/index.js +4 -4
  76. package/lib/Layout/dashboard-legacy/sidebar.js +4 -4
  77. package/lib/Layout/index.js +4 -4
  78. package/lib/Locale/browser-lang.js +1 -2
  79. package/lib/Locale/context.js +6 -8
  80. package/lib/Locale/languages.js +7 -9
  81. package/lib/Locale/selector.js +5 -5
  82. package/lib/Locale/util.js +12 -11
  83. package/lib/Logo/index.js +4 -4
  84. package/lib/NFTDisplay/aspect-ratio-container.js +5 -6
  85. package/lib/NFTDisplay/broken.js +4 -4
  86. package/lib/NFTDisplay/index.js +5 -7
  87. package/lib/NFTDisplay/svg-embedder/img.js +5 -6
  88. package/lib/NFTDisplay/svg-embedder/inline-svg.js +5 -6
  89. package/lib/NavMenu/nav-menu.js +5 -6
  90. package/lib/NavMenu/style.js +2 -4
  91. package/lib/PageScroller/index.js +6 -7
  92. package/lib/Passport/index.js +9 -0
  93. package/lib/Passport/passport.js +116 -0
  94. package/lib/PoweredByArcBlock/index.js +4 -4
  95. package/lib/PricingTable/PricingPlan.js +1 -2
  96. package/lib/PricingTable/index.js +1 -2
  97. package/lib/QRCode/index.js +5 -6
  98. package/lib/RelativeTime/index.js +4 -4
  99. package/lib/Result/common.js +4 -4
  100. package/lib/Result/index.js +7 -8
  101. package/lib/Result/result.js +5 -6
  102. package/lib/Result/translations.js +2 -3
  103. package/lib/Screenshot/BaseScreenshot/index.js +5 -6
  104. package/lib/Screenshot/BaseScreenshot/shells/Macbook.js +10 -15
  105. package/lib/Screenshot/BaseScreenshot/shells/Phone.js +10 -15
  106. package/lib/Screenshot/index.js +5 -6
  107. package/lib/SessionBlocklet/index.js +5 -5
  108. package/lib/SessionManager/index.js +1 -2
  109. package/lib/SessionUser/components/logged-in.js +5 -5
  110. package/lib/SessionUser/components/session-user-item.js +5 -6
  111. package/lib/SessionUser/components/session-user-switch.js +4 -4
  112. package/lib/SessionUser/components/un-login.js +1 -1
  113. package/lib/SessionUser/components/user-info.js +1 -1
  114. package/lib/SessionUser/index.js +2 -2
  115. package/lib/SessionUser/libs/translation.js +2 -3
  116. package/lib/Spinner/index.js +13 -14
  117. package/lib/SplitButton/index.js +4 -4
  118. package/lib/Switch/index.js +5 -6
  119. package/lib/Tabs/index.js +98 -11
  120. package/lib/Tag/index.js +5 -6
  121. package/lib/TextCollapse/index.js +5 -6
  122. package/lib/Theme/index.js +6 -7
  123. package/lib/Theme/theme.js +18 -11
  124. package/lib/Toast/index.js +12 -13
  125. package/lib/Typography/index.js +4 -4
  126. package/lib/Util/constant.js +10 -20
  127. package/lib/Util/deprecate.js +4 -4
  128. package/lib/Util/index.js +2 -4
  129. package/lib/Util/passport.js +72 -0
  130. package/lib/Util/wallet.js +1 -2
  131. package/lib/Video/index.js +4 -4
  132. package/lib/Wallet/Action.js +4 -4
  133. package/lib/Wallet/Download.js +4 -4
  134. package/lib/WebWalletSWKeeper/index.js +5 -6
  135. package/lib/withTheme/index.js +5 -6
  136. package/lib/withTracker/error_boundary.js +2 -2
  137. package/lib/withTracker/index.js +8 -9
  138. package/package.json +12 -6
  139. package/src/Address/did-address.jsx +15 -12
  140. package/src/Colors/themes/temp.js +9 -0
  141. package/src/Dialog/confirm.jsx +94 -0
  142. package/src/Dialog/{dialog.js → dialog.jsx} +14 -7
  143. package/src/Dialog/index.js +1 -1
  144. package/src/Dialog/use-confirm.jsx +114 -0
  145. package/src/Locale/selector.jsx +1 -1
  146. package/src/Locale/util.js +12 -5
  147. package/src/Passport/index.jsx +3 -0
  148. package/src/Passport/passport.jsx +99 -0
  149. package/src/SessionBlocklet/index.jsx +1 -1
  150. package/src/SessionUser/components/logged-in.jsx +1 -1
  151. package/src/SessionUser/components/un-login.jsx +1 -1
  152. package/src/SessionUser/components/user-info.jsx +1 -1
  153. package/src/SessionUser/index.jsx +1 -1
  154. package/src/Tabs/index.jsx +124 -0
  155. package/src/Theme/theme.js +13 -3
  156. package/src/Util/passport.js +75 -0
  157. package/src/Dialog/confirm.js +0 -201
  158. package/src/Tabs/index.js +0 -45
@@ -96,22 +96,18 @@ const DidAddress = /*#__PURE__*/forwardRef(({
96
96
  size: size,
97
97
  ...rest,
98
98
  ref: ref,
99
- children: [prepend, /*#__PURE__*/_jsxs(Tooltip, {
99
+ children: [prepend, /*#__PURE__*/_jsx(Box, {
100
+ sx: {
101
+ display: 'none'
102
+ },
103
+ ref: textRef,
104
+ children: children
105
+ }), /*#__PURE__*/_jsx(Tooltip, {
100
106
  title: copyable ? '' : translations[locale].copied,
101
107
  placement: "bottom",
102
108
  arrow: true,
103
109
  open: copied,
104
- children: [/*#__PURE__*/_jsx(Box, {
105
- ref: textRef,
106
- component: "span",
107
- className: "did-address-text did-address-truncate",
108
- sx: {
109
- display: compact ? 'none' : 'inline',
110
- cursor: copyable ? 'text' : 'pointer'
111
- },
112
- onDoubleClick: copyable ? noop : onCopy,
113
- children: children
114
- }), compact && /*#__PURE__*/_jsx(Box, {
110
+ children: compact ? /*#__PURE__*/_jsx(Box, {
115
111
  component: "span",
116
112
  className: "did-address-text",
117
113
  sx: {
@@ -124,7 +120,16 @@ const DidAddress = /*#__PURE__*/forwardRef(({
124
120
  showCopyButtonInTooltip: showCopyButtonInTooltip,
125
121
  children: children
126
122
  })
127
- })]
123
+ }) : /*#__PURE__*/_jsx(Box, {
124
+ component: "span",
125
+ className: "did-address-text did-address-truncate",
126
+ sx: {
127
+ display: compact ? 'none' : 'inline',
128
+ cursor: copyable ? 'text' : 'pointer'
129
+ },
130
+ onDoubleClick: copyable ? noop : onCopy,
131
+ children: children
132
+ })
128
133
  }), copyElement, append]
129
134
  });
130
135
  });
@@ -74,5 +74,4 @@ const colors = {
74
74
  }
75
75
  // TODO: 等设计规范稳定后, 考虑扩展 trade 相关的常用颜色 (send/receive/exchange/transfer)
76
76
  };
77
-
78
77
  export default colors;
@@ -12,6 +12,15 @@ const colors = {
12
12
  surfaceSuccess: 'rgba(13, 202, 134, 1)',
13
13
  primaryBase: 'rgba(19, 125, 250, 1)',
14
14
  primary100: 'rgba(19, 125, 250, 1)',
15
- gray6: 'rgba(17, 22, 24, 0.06)'
15
+ gray6: 'rgba(17, 22, 24, 0.06)',
16
+ backgroundsBgSubtitle: 'rgba(249, 250, 251, 1)',
17
+ backgroundsBgComponent: 'rgba(241, 243, 245, 1)',
18
+ backgroundsBgField: 'rgba(249, 250, 251, 1)',
19
+ foregroundsFgBase: 'rgba(3, 7, 18, 1)',
20
+ foregroundsFgSubtile: 'rgba(75, 85, 99, 1)',
21
+ strokeBorderBase: 'rgba(229, 231, 235, 1)',
22
+ strokeBorderStrong: 'rgba(209, 213, 219, 1)',
23
+ buttonsButtonNeutral: 'rgba(255, 255, 255, 1)',
24
+ buttonsButtonNeutralHover: 'rgba(243, 244, 246, 1)'
16
25
  };
17
26
  export default colors;
@@ -1,6 +1,6 @@
1
1
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
2
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
3
- function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
2
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
3
+ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
4
4
  /* eslint-disable react/no-unused-prop-types */
5
5
  /* eslint-disable react/static-property-placement */
6
6
  import React from 'react';
package/es/DID/index.js CHANGED
@@ -33,7 +33,6 @@ const isSquareMotif = roleType => {
33
33
  // ASSET
34
34
  17: true // TOKEN
35
35
  };
36
-
37
36
  return !roles[roleType];
38
37
  };
39
38
  const getAvatarSize = (didMotifInfo, isEthDid, size) => {
@@ -1,7 +1,4 @@
1
1
  import PropTypes from 'prop-types';
2
- import { forwardRef, useRef, useImperativeHandle } from 'react';
3
- import { useMemoizedFn, useReactive } from 'ahooks';
4
- import noop from 'lodash/noop';
5
2
  import Button from '../Button';
6
3
  import Dialog from './dialog';
7
4
 
@@ -90,99 +87,4 @@ Confirm.defaultProps = {
90
87
  text: 'Cancel'
91
88
  },
92
89
  PaperProps: {}
93
- };
94
- const ConfirmHolder = /*#__PURE__*/forwardRef((props, ref) => {
95
- const state = useReactive({
96
- show: false,
97
- title: '',
98
- content: '',
99
- onConfirm: noop,
100
- onCancel: noop,
101
- loading: false,
102
- confirmButtonText: 'Confirm',
103
- cancelButtonText: 'Cancel'
104
- });
105
- const open = useMemoizedFn((params = {}) => {
106
- state.show = true;
107
- state.title = params.title;
108
- state.content = params.content;
109
- state.onConfirm = params.onConfirm || noop;
110
- state.onCancel = params.onCancel || noop;
111
- if (params.confirmButtonText) state.confirmButtonText = params.confirmButtonText;
112
- if (params.cancelButtonText) state.cancelButtonText = params.cancelButtonText;
113
- state.loading = false;
114
- });
115
- const reset = useMemoizedFn(() => {
116
- state.title = '';
117
- state.content = '';
118
- state.onConfirm = noop;
119
- state.onCancel = noop;
120
- state.confirmButtonText = 'Confirm';
121
- state.cancelButtonText = 'Cancel';
122
- });
123
- const close = useMemoizedFn(() => {
124
- state.show = false;
125
- setTimeout(() => {
126
- reset();
127
- }, 300);
128
- });
129
- const onCancel = useMemoizedFn(() => {
130
- close();
131
- state?.onCancel();
132
- }, []);
133
- const onConfirm = useMemoizedFn(async () => {
134
- state.loading = true;
135
- try {
136
- await state?.onConfirm(close);
137
- } finally {
138
- state.loading = false;
139
- }
140
- }, []);
141
- useImperativeHandle(ref, () => {
142
- return {
143
- open,
144
- close
145
- };
146
- }, [open, close]);
147
- return /*#__PURE__*/_jsx(Confirm, {
148
- open: state.show,
149
- title: state.title,
150
- onConfirm: onConfirm,
151
- onCancel: onCancel,
152
- confirmButton: {
153
- text: state.confirmButtonText,
154
- props: {
155
- variant: 'contained',
156
- color: 'primary',
157
- loading: state.loading
158
- }
159
- },
160
- cancelButton: {
161
- text: state.cancelButtonText,
162
- props: {
163
- variant: 'outlined',
164
- color: 'primary'
165
- }
166
- },
167
- children: state.content
168
- });
169
- });
170
- export function useConfirm() {
171
- const confirmRef = useRef(null);
172
- const open = useMemoizedFn((...args) => {
173
- confirmRef.current?.open(...args);
174
- });
175
- const close = useMemoizedFn((...args) => {
176
- confirmRef.current?.close(...args);
177
- });
178
- const confirmApi = {
179
- open,
180
- close
181
- };
182
- return {
183
- confirmHolder: /*#__PURE__*/_jsx(ConfirmHolder, {
184
- ref: confirmRef
185
- }),
186
- confirmApi
187
- };
188
- }
90
+ };
@@ -1,10 +1,6 @@
1
1
  import PropTypes from 'prop-types';
2
- import MuiDialog from '@mui/material/Dialog';
3
- import MuiDialogContent from '@mui/material/DialogContent';
4
- import DialogActions from '@mui/material/DialogActions';
5
- import IconButton from '@mui/material/IconButton';
6
- import useMediaQuery from '@mui/material/useMediaQuery';
7
2
  import CloseIcon from '@mui/icons-material/Close';
3
+ import { Typography, Dialog as MuiDialog, DialogContent as MuiDialogContent, DialogActions, IconButton, useMediaQuery } from '@mui/material';
8
4
  import { styled, useTheme } from '../Theme';
9
5
 
10
6
  /**
@@ -24,7 +20,7 @@ import { styled, useTheme } from '../Theme';
24
20
  @property {boolean} [showCloseButton=true] - Whether or not to show the close button.
25
21
  @property {'left'|'center'|'right'} [actionsPosition='right'] - The position of the actions toolbar.
26
22
  @property {PaperStyle} [PaperProps] - Props to be passed down to the dialog paper.
27
- @property {(event: React.SyntheticEvent, reason: string) => void} [onClose] - Callback function fired when the dialog is closed.
23
+ @property {(event: React.SyntheticEvent, reason: string) => void} [onClose] - Callback function fired when the dialog is closed.
28
24
  */
29
25
 
30
26
  /**
@@ -89,7 +85,8 @@ function Dialog({
89
85
  children: [showCloseButton && isMobile && closeButton, prepend && /*#__PURE__*/_jsx("div", {
90
86
  className: "ux-dialog_prepend",
91
87
  children: prepend
92
- }), title && /*#__PURE__*/_jsx("h6", {
88
+ }), title && /*#__PURE__*/_jsx(Typography, {
89
+ variant: "h6",
93
90
  className: "ux-dialog_title",
94
91
  children: title
95
92
  })]
@@ -1,4 +1,4 @@
1
1
  // eslint-disable-next-line no-restricted-exports
2
2
  export { default } from './dialog';
3
3
  export { default as Confirm } from './confirm';
4
- export { useConfirm } from './confirm';
4
+ export { default as useConfirm } from './use-confirm';
@@ -0,0 +1,105 @@
1
+ import { forwardRef, useImperativeHandle, useRef, useState } from 'react';
2
+ import { useMemoizedFn, useReactive } from 'ahooks';
3
+ import noop from 'lodash/noop';
4
+ import Confirm from './confirm';
5
+ import { jsx as _jsx } from "react/jsx-runtime";
6
+ const ConfirmHolder = /*#__PURE__*/forwardRef((props, ref) => {
7
+ // HACK: 这里默认值不使用 null,来避免开发环境中的字段必填警告
8
+ const [title, setTitle] = useState('');
9
+ const [content, setContent] = useState('');
10
+ const state = useReactive({
11
+ show: false,
12
+ onConfirm: noop,
13
+ onCancel: noop,
14
+ loading: false,
15
+ confirmButtonText: 'Confirm',
16
+ cancelButtonText: 'Cancel'
17
+ });
18
+ const open = useMemoizedFn((params = {}) => {
19
+ setTitle(params.title);
20
+ setContent(params.content);
21
+ state.onConfirm = params.onConfirm || noop;
22
+ state.onCancel = params.onCancel || noop;
23
+ state.showCancelButton = params.showCancelButton ?? true;
24
+ if (params.confirmButtonText) state.confirmButtonText = params.confirmButtonText;
25
+ if (params.cancelButtonText) state.cancelButtonText = params.cancelButtonText;
26
+ state.loading = false;
27
+ state.show = true;
28
+ });
29
+ const reset = useMemoizedFn(() => {
30
+ setTitle('');
31
+ setContent('');
32
+ state.onConfirm = noop;
33
+ state.onCancel = noop;
34
+ state.confirmButtonText = 'Confirm';
35
+ state.cancelButtonText = 'Cancel';
36
+ });
37
+ const close = useMemoizedFn(() => {
38
+ state.show = false;
39
+ setTimeout(() => {
40
+ reset();
41
+ }, 300);
42
+ });
43
+ const onCancel = useMemoizedFn(() => {
44
+ close();
45
+ state?.onCancel();
46
+ }, []);
47
+ const onConfirm = useMemoizedFn(async () => {
48
+ state.loading = true;
49
+ try {
50
+ await state?.onConfirm(close);
51
+ } finally {
52
+ state.loading = false;
53
+ }
54
+ }, []);
55
+ useImperativeHandle(ref, () => {
56
+ return {
57
+ open,
58
+ close
59
+ };
60
+ }, [open, close]);
61
+ return /*#__PURE__*/_jsx(Confirm, {
62
+ ...props,
63
+ open: state.show,
64
+ title: title,
65
+ onConfirm: onConfirm,
66
+ onCancel: onCancel,
67
+ confirmButton: {
68
+ text: state.confirmButtonText,
69
+ props: {
70
+ variant: 'contained',
71
+ color: 'primary',
72
+ loading: state.loading
73
+ }
74
+ },
75
+ showCancelButton: state.showCancelButton,
76
+ cancelButton: {
77
+ text: state.cancelButtonText,
78
+ props: {
79
+ variant: 'outlined',
80
+ color: 'primary'
81
+ }
82
+ },
83
+ children: content
84
+ });
85
+ });
86
+ export default function useConfirm(props = {}) {
87
+ const confirmRef = useRef(null);
88
+ const open = useMemoizedFn((...args) => {
89
+ confirmRef.current?.open(...args);
90
+ });
91
+ const close = useMemoizedFn((...args) => {
92
+ confirmRef.current?.close(...args);
93
+ });
94
+ const confirmApi = {
95
+ open,
96
+ close
97
+ };
98
+ return {
99
+ confirmHolder: /*#__PURE__*/_jsx(ConfirmHolder, {
100
+ ...props,
101
+ ref: confirmRef
102
+ }),
103
+ confirmApi
104
+ };
105
+ }
@@ -3,8 +3,8 @@ 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
5
  import { Icon as IconifyIcon } from '@iconify/react';
6
- import LanguageIcon from '@iconify-icons/material-symbols/language';
7
6
  import CheckIcon from '@iconify-icons/material-symbols/check';
7
+ import LanguageIcon from 'iconify-icons-material-symbols-400/language';
8
8
  import noop from 'lodash/noop';
9
9
  import { getColor, getBackground } from '../Util';
10
10
  import { temp as colors } from '../Colors';
package/es/Locale/util.js CHANGED
@@ -1,16 +1,21 @@
1
+ import get from 'lodash/get';
2
+
1
3
  /* eslint-disable no-prototype-builtins */
2
4
  export const replace = (template, data) => template.replace(/{(\w*)}/g, (m, key) => data.hasOwnProperty(key) ? data[key] : '');
3
5
  export const translate = (translations, key, locale, fallbackLocale = 'en', data = {}) => {
4
- if (!translations[locale] || !translations[locale][key]) {
6
+ const translation = translations[locale];
7
+ const translationValue = get(translation, key);
8
+ const fallbackValue = get(translations[fallbackLocale], key);
9
+ if (!translation || !translationValue) {
5
10
  console.warn(`Warning: no ${key} translation of ${locale}`);
6
- if (fallbackLocale && translations[fallbackLocale]?.[key]) {
7
- return replace(translations[fallbackLocale]?.[key], data);
11
+ if (fallbackLocale && fallbackValue) {
12
+ return replace(fallbackValue, data);
8
13
  }
9
14
  return key;
10
15
  }
11
16
  if (typeof translations[locale] === 'function' || translations[locale].then) {
12
- return replace(translations[fallbackLocale][key], data);
17
+ return replace(fallbackValue, data);
13
18
  }
14
- return replace(translations[locale][key], data);
19
+ return replace(translationValue, data);
15
20
  };
16
21
  export const t = translate;
@@ -82,7 +82,6 @@ function NFTDisplay({
82
82
  parsed.current = JSON.parse(data);
83
83
  // console.log('[debug] parse data')
84
84
  }
85
-
86
85
  const {
87
86
  vcId
88
87
  } = parsed.current;
@@ -0,0 +1,2 @@
1
+ import PassportItem from './passport';
2
+ export default PassportItem;
@@ -0,0 +1,103 @@
1
+ import PropTypes from 'prop-types';
2
+ import upperFirst from 'lodash/upperFirst';
3
+ import { Box } from '@mui/material';
4
+ import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
5
+ import RevokeIcon from '@arcblock/icons/lib/RevokeIcon';
6
+ import { jsx as _jsx } from "react/jsx-runtime";
7
+ import { jsxs as _jsxs } from "react/jsx-runtime";
8
+ export default function Passport({
9
+ passport,
10
+ user,
11
+ color,
12
+ width,
13
+ icon,
14
+ children,
15
+ createPassportSvg,
16
+ ...rest
17
+ }) {
18
+ const {
19
+ t
20
+ } = useLocaleContext();
21
+ return /*#__PURE__*/_jsxs(Box, {
22
+ ...rest,
23
+ sx: {
24
+ display: 'flex',
25
+ alignItems: 'center',
26
+ ...rest?.sx
27
+ },
28
+ children: [/*#__PURE__*/_jsx(Box, {
29
+ className: "passport-item__display"
30
+ // eslint-disable-next-line react/no-danger
31
+ ,
32
+ dangerouslySetInnerHTML: {
33
+ __html: createPassportSvg({
34
+ title: passport.title || passport.name,
35
+ issuer: passport.issuer && passport.issuer.name,
36
+ issuerDid: passport.issuer && passport.issuer.id,
37
+ ownerName: user.fullName,
38
+ ownerDid: user.did,
39
+ ownerAvatarUrl: user.avatar,
40
+ revoked: passport.revoked,
41
+ preferredColor: color,
42
+ width
43
+ })
44
+ }
45
+ }), /*#__PURE__*/_jsxs(Box, {
46
+ className: "passport-item__body",
47
+ sx: {
48
+ p: 0,
49
+ ml: 3,
50
+ mt: 0
51
+ },
52
+ children: [/*#__PURE__*/_jsxs(Box, {
53
+ className: "passport-item__title",
54
+ sx: {
55
+ display: 'flex',
56
+ alignItems: 'center',
57
+ fontWeight: 400,
58
+ fontSize: '16px',
59
+ lineHeight: 1.1875,
60
+ color: '#222222'
61
+ },
62
+ children: [upperFirst(passport.title), /*#__PURE__*/_jsxs(Box, {
63
+ className: "passport-item__status-icon",
64
+ sx: {
65
+ svg: {
66
+ fill: '#bfbfbf',
67
+ height: '1.2em',
68
+ marginLeft: '0.4em'
69
+ }
70
+ },
71
+ children: [icon, passport.revoked && /*#__PURE__*/_jsx(RevokeIcon, {})]
72
+ })]
73
+ }), passport.expirationDate && /*#__PURE__*/_jsx(Box, {
74
+ className: "passport-item__title",
75
+ sx: {
76
+ display: 'flex',
77
+ alignItems: 'center',
78
+ fontWeight: 400,
79
+ fontSize: '16px',
80
+ lineHeight: 1.1875,
81
+ color: '#222222'
82
+ },
83
+ children: t('team.passport.validUntil', {
84
+ date: passport.expirationDate
85
+ })
86
+ }), children]
87
+ })]
88
+ });
89
+ }
90
+ Passport.propTypes = {
91
+ passport: PropTypes.any.isRequired,
92
+ user: PropTypes.any.isRequired,
93
+ color: PropTypes.string.isRequired,
94
+ createPassportSvg: PropTypes.func.isRequired,
95
+ icon: PropTypes.any,
96
+ children: PropTypes.any,
97
+ width: PropTypes.number
98
+ };
99
+ Passport.defaultProps = {
100
+ icon: null,
101
+ children: null,
102
+ width: 150
103
+ };
@@ -2,7 +2,7 @@ import { useRef } from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import { Box, ClickAwayListener, Fade, IconButton, List, ListItem, ListItemButton, Paper, Popper, Typography } from '@mui/material';
4
4
  import { Icon } from '@iconify/react';
5
- import DashboardOutlineRoundedIcon from '@iconify-icons/material-symbols/dashboard-outline-rounded';
5
+ import DashboardOutlineRoundedIcon from 'iconify-icons-material-symbols-400/dashboard-outline-rounded';
6
6
  import WidgetsOutlineRoundedIcon from '@iconify-icons/material-symbols/widgets-outline-rounded';
7
7
  import { useMemoizedFn, useReactive } from 'ahooks';
8
8
  import Button from '../Button';
@@ -219,6 +219,6 @@ function SessionMenuItem({
219
219
  });
220
220
  }
221
221
  SessionMenuItem.propTypes = {
222
- icon: PropTypes.string.isRequired,
222
+ icon: PropTypes.any.isRequired,
223
223
  title: PropTypes.string.isRequired
224
224
  };
@@ -1,7 +1,7 @@
1
1
  import PropTypes from 'prop-types';
2
2
  import { Box, CircularProgress, IconButton } from '@mui/material';
3
3
  import { Icon } from '@iconify/react';
4
- import PersonOutlineRoundedIcon from '@iconify-icons/material-symbols/person-outline-rounded';
4
+ import PersonOutlineRoundedIcon from 'iconify-icons-material-symbols-400/person-outline-rounded';
5
5
  import { useRef } from 'react';
6
6
  import { useMemoizedFn } from 'ahooks';
7
7
  import noop from 'lodash/noop';
@@ -91,7 +91,7 @@ export default function UserInfo({
91
91
  }), /*#__PURE__*/_jsx(Typography, {
92
92
  variant: "h6",
93
93
  sx: {
94
- wordBreak: 'break-all'
94
+ wordBreak: 'break-word'
95
95
  },
96
96
  children: session.user.fullName
97
97
  })]
@@ -34,8 +34,8 @@ SessionUser.propTypes = {
34
34
  user: PropTypes.shape({
35
35
  did: PropTypes.string.isRequired,
36
36
  fullName: PropTypes.string.isRequired,
37
- email: PropTypes.string.isRequired,
38
- avatar: PropTypes.string.isRequired
37
+ avatar: PropTypes.string.isRequired,
38
+ email: PropTypes.string
39
39
  })
40
40
  }).isRequired,
41
41
  onBindWallet: PropTypes.func,
package/es/Tabs/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import PropTypes from 'prop-types';
2
- import MuiTabs from '@mui/material/Tabs';
3
- import MuiTab from '@mui/material/Tab';
2
+ import { Tabs as MuiTabs, Tab as MuiTab } from '@mui/material';
3
+ import { temp as colors } from '../Colors';
4
4
  import { styled } from '../Theme';
5
5
  import { jsx as _jsx } from "react/jsx-runtime";
6
6
  const PREFIX = 'index';
@@ -19,12 +19,98 @@ const StyledMuiTabs = styled(MuiTabs)(({
19
19
  }
20
20
  }
21
21
  }));
22
+ function CardTabs({
23
+ tabs,
24
+ current,
25
+ onChange,
26
+ ...rest
27
+ }) {
28
+ return /*#__PURE__*/_jsx(MuiTabs, {
29
+ scrollButtons: "auto",
30
+ value: current,
31
+ onChange: (_, newValue) => onChange(newValue),
32
+ ...rest,
33
+ variant: "scrollable",
34
+ sx: {
35
+ minHeight: 'auto',
36
+ '.MuiTabs-scrollButtons.Mui-disabled': {
37
+ opacity: 0.3,
38
+ cursor: 'not-allowed',
39
+ pointerEvents: 'auto'
40
+ },
41
+ '.MuiTabs-scroller': {
42
+ borderRadius: '100vw'
43
+ },
44
+ '.MuiTabs-flexContainer': {
45
+ borderRadius: '100vw',
46
+ backgroundColor: colors.backgroundsBgComponent,
47
+ padding: 0.5,
48
+ display: 'inline-flex',
49
+ columnGap: 0.25
50
+ },
51
+ '.MuiTab-root': {
52
+ borderRadius: '100vw',
53
+ border: '1px solid transparent',
54
+ minHeight: 'auto',
55
+ lineHeight: 1,
56
+ py: 1,
57
+ color: colors.foregroundsFgSubtile,
58
+ fontSize: '13px',
59
+ fontWeight: 'normal',
60
+ textTransform: 'capitalize',
61
+ transition: 'background-color 0.2s ease',
62
+ '&.Mui-selected, &:hover': {
63
+ backgroundColor: 'white',
64
+ borderColor: colors.lineBorderBase,
65
+ color: colors.foregroundsFgBase
66
+ }
67
+ },
68
+ '.MuiTabs-indicator': {
69
+ display: 'none'
70
+ },
71
+ ...rest.sx
72
+ },
73
+ children: tabs.map(x => /*#__PURE__*/_jsx(MuiTab, {
74
+ className: classes.tab,
75
+ value: x.value,
76
+ label: x.label,
77
+ icon: x.icon || null
78
+ }, x.value))
79
+ });
80
+ }
81
+ CardTabs.propTypes = {
82
+ tabs: PropTypes.array.isRequired,
83
+ current: PropTypes.string.isRequired,
84
+ onChange: PropTypes.func.isRequired
85
+ };
86
+
87
+ /**
88
+ * @typedef {import('@mui/material').TabsProps & {
89
+ * tabs: string[];
90
+ * onChange: (value) => {};
91
+ * variant: 'card' | 'fullWidth' | 'scrollable' | 'standard'
92
+ * }} TabsProps
93
+ */
94
+
95
+ /**
96
+ * @description
97
+ * @param { TabsProps} props
98
+ * @return {import('react').ReactNode}
99
+ */
100
+
22
101
  export default function Tabs({
23
102
  tabs,
24
103
  current,
25
104
  onChange,
26
105
  ...rest
27
106
  }) {
107
+ if (rest.variant === 'card') {
108
+ return /*#__PURE__*/_jsx(CardTabs, {
109
+ tabs: tabs,
110
+ current: current,
111
+ onChange: onChange
112
+ });
113
+ }
28
114
  return /*#__PURE__*/_jsx(StyledMuiTabs, {
29
115
  scrollButtons: "auto",
30
116
  variant: "scrollable",