@arcblock/ux 2.1.42 → 2.1.45

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.
@@ -148,7 +148,6 @@ function CodeBlock(_ref) {
148
148
  }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_IconButton.default, {
149
149
  className: "copy-button",
150
150
  onClick: onCopy,
151
- tabIndex: "-1",
152
151
  color: "primary",
153
152
  disabled: copied,
154
153
  children: [!copied && /*#__PURE__*/(0, _jsxRuntime.jsx)(_FileCopy.default, {
@@ -181,4 +180,4 @@ const fontFamily = 'source-code-pro, Menlo, Monaco, Consolas, Courier New, monos
181
180
  const Pre = _styledComponents.default.pre.withConfig({
182
181
  displayName: "CodeBlock__Pre",
183
182
  componentId: "sc-1bpapaq-0"
184
- })(["font-family:", ";display:block;font-size:14px;line-height:1.42857143;margin:0 0 32px;word-break:break-word;word-wrap:break-word;text-align:left;border-radius:5px;border:1px solid #dedede;background:#222;color:#fff;position:relative;.codeblock__inner{display:block;width:100%;max-height:46.25rem;overflow:scroll;}.copy-button{display:none;position:absolute;top:8px;right:24px;padding:4px;border-radius:4px;&,&:hover,&.Mui-disabled{background:", ";}}&:hover{.copy-button{display:block;}}code{counter-reset:line;counter-increment:line;padding:16px;font-family:", ";color:#fff;*{font-family:", ";}}.hljs *{white-space:normal;}"], fontFamily, _Colors.default.primary.main, fontFamily, fontFamily);
183
+ })(["font-family:", ";display:block;font-size:14px;line-height:1.42857143;margin:0 0 32px;word-break:break-word;word-wrap:break-word;text-align:left;border-radius:5px;border:1px solid #dedede;background:#222;color:#fff;position:relative;.codeblock__inner{display:block;width:100%;max-height:46.25rem;overflow:scroll;}.copy-button{display:none;position:absolute;top:8px;right:24px;padding:4px;border-radius:4px;&,&:hover,&.Mui-disabled{background:", ";}}&:hover{.copy-button{display:flex;}}code{counter-reset:line;counter-increment:line;padding:16px;font-family:", ";color:#fff;*{font-family:", ";}}.hljs *{white-space:normal;}"], fontFamily, _Colors.default.primary.main, fontFamily, fontFamily);
@@ -83,8 +83,8 @@ function FixWidthNumber(_ref) {
83
83
 
84
84
  class CountDown extends _react.Component {
85
85
  constructor(props) {
86
+ super(props);
86
87
  const newProps = (0, _Util.mergeProps)(props, CountDown, ['dark', 'endTime', 'style']);
87
- super(newProps);
88
88
  this.state = getRemaining(newProps.endTime);
89
89
  this.timer = null;
90
90
  }
@@ -56,6 +56,24 @@ function Datatable(_ref) {
56
56
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(ReDatatable, _objectSpread({}, props))
57
57
  });
58
58
  }
59
+
60
+ const fixCellProp = (tempObj, cellProps) => {
61
+ const cellStyle = {};
62
+
63
+ if (tempObj.align) {
64
+ cellProps.className = (0, _clsx.default)(cellProps.className, "pc-align-".concat(tempObj.align));
65
+ }
66
+
67
+ if (tempObj.verticalKeyAlign) {
68
+ cellProps.className = (0, _clsx.default)(cellProps.className, "vertical-align-".concat(tempObj.verticalKeyAlign));
69
+ }
70
+
71
+ if (tempObj.minWidth) {
72
+ cellStyle.minWidth = tempObj.minWidth;
73
+ }
74
+
75
+ cellProps.style = Object.assign({}, cellProps.style, cellStyle);
76
+ };
59
77
  /**
60
78
  * @param {Object} props.options The options of mui-datatable,detail see https://github.com/gregnb/mui-datatables/tree/b8d2eee6af4589d254b40918e5d7e70b1ee4baca
61
79
  * @param {Array} props.customButtons Custom buttons for toolbar
@@ -147,14 +165,7 @@ function ReDatatable(_ref2) {
147
165
  cellProps.width = tempObj.width;
148
166
  }
149
167
 
150
- if (tempObj.align) {
151
- cellProps.className = (0, _clsx.default)(cellProps.className, "pc-align-".concat(tempObj.align));
152
- }
153
-
154
- if (tempObj.verticalKeyAlign) {
155
- cellProps.className = (0, _clsx.default)(cellProps.className, "vertical-align-".concat(tempObj.verticalKeyAlign));
156
- }
157
-
168
+ fixCellProp(tempObj, cellProps);
158
169
  return cellProps;
159
170
  }; // Prevent memory xie caused by recursive forwarding of setCellHeaderProps functions
160
171
 
@@ -171,14 +182,7 @@ function ReDatatable(_ref2) {
171
182
  cellProps = _objectSpread(_objectSpread({}, cellProps), setCellProps(...arguments) || {});
172
183
  }
173
184
 
174
- if (tempObj.align) {
175
- cellProps.className = (0, _clsx.default)(cellProps.className, "pc-align-".concat(tempObj.align));
176
- }
177
-
178
- if (tempObj.verticalKeyAlign) {
179
- cellProps.className = (0, _clsx.default)(cellProps.className, "vertical-align-".concat(tempObj.verticalKeyAlign));
180
- }
181
-
185
+ fixCellProp(tempObj, cellProps);
182
186
  return cellProps;
183
187
  };
184
188
 
@@ -31,8 +31,9 @@ function Footer(props) {
31
31
  brand,
32
32
  dark
33
33
  } = newProps;
34
- const endYear = new Date().getFullYear();
35
- const copyYear = endYear === copyStart ? endYear : "".concat(copyStart, "-").concat(endYear);
34
+ const endYearString = "".concat(new Date().getFullYear());
35
+ const copyStartString = "".concat(copyStart);
36
+ const copyYear = endYearString === copyStartString ? endYearString : "".concat(copyStartString, "-").concat(endYearString);
36
37
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(Container, {
37
38
  className: className,
38
39
  style: style,
@@ -73,7 +74,7 @@ function Footer(props) {
73
74
  Footer.propTypes = {
74
75
  dark: _propTypes.default.bool,
75
76
  className: _propTypes.default.string,
76
- copyStart: _propTypes.default.string,
77
+ copyStart: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number]),
77
78
  brand: _propTypes.default.string,
78
79
  style: _propTypes.default.object
79
80
  };
@@ -74,7 +74,7 @@ InfoRow.defaultProps = {
74
74
  const resetName = name.split(' ').map(x => (0, _upperFirst.default)((0, _camelCase.default)(x))).join(' ');
75
75
  return typeof name === 'string' ? resetName : name;
76
76
  },
77
- valueComponent: 'p',
77
+ valueComponent: 'div',
78
78
  layout: 'horizontal'
79
79
  };
80
80
 
@@ -31,7 +31,7 @@ function Metric(_ref) {
31
31
  className: "metric__image",
32
32
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_image.default, {
33
33
  name: icon,
34
- alt: name,
34
+ alt: typeof name === 'string' ? name : '',
35
35
  size: 30,
36
36
  prefix: prefix,
37
37
  color: "#222222"
@@ -59,7 +59,7 @@ function Metric(_ref) {
59
59
  Metric.propTypes = {
60
60
  icon: _propTypes.default.string.isRequired,
61
61
  value: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number]).isRequired,
62
- name: _propTypes.default.string.isRequired,
62
+ name: _propTypes.default.node.isRequired,
63
63
  animated: _propTypes.default.bool,
64
64
  url: _propTypes.default.string,
65
65
  LinkComponent: _propTypes.default.any,
@@ -114,9 +114,10 @@ function NFTDisplay(_ref) {
114
114
  children: children
115
115
  }));
116
116
 
117
- try {
118
- const parsed = (0, _react.useRef)(data); // 如果是 raw data 先解析
117
+ const parsed = (0, _react.useRef)(data);
119
118
 
119
+ try {
120
+ // 如果是 raw data 先解析
120
121
  if (typeof parsed.current === 'string') {
121
122
  parsed.current = JSON.parse(data); // console.log('[debug] parse data')
122
123
  }
@@ -208,7 +209,7 @@ function NFTDisplay(_ref) {
208
209
  const svg = _buffer.Buffer.from(buffer).toString('utf8');
209
210
 
210
211
  if (checkSvg && !(0, _isSvg.default)(svg)) {
211
- throw new Error("Invalid SVG: ".concat(svg));
212
+ throw new Error('Invalid SVG of type svg_gzipped');
212
213
  }
213
214
 
214
215
  const Embedder = getSvgEmbedder(preferredSvgEmbedder);
@@ -220,7 +221,7 @@ function NFTDisplay(_ref) {
220
221
  case 'svg':
221
222
  {
222
223
  if (checkSvg && !(0, _isSvg.default)(content)) {
223
- throw new Error("Invalid SVG: ".concat(content));
224
+ throw new Error('Invalid SVG of type svg');
224
225
  }
225
226
 
226
227
  const Embedder = getSvgEmbedder(preferredSvgEmbedder);
@@ -246,7 +247,12 @@ function NFTDisplay(_ref) {
246
247
  children: [(state.loading || !minimumLoadingReady) && (renderLoading ? renderLoading() : /*#__PURE__*/(0, _jsxRuntime.jsx)(_loading.default, {})), renderNFT()]
247
248
  }));
248
249
  } catch (e) {
249
- console.error(e);
250
+ var _parsed$current;
251
+
252
+ console.error(e === null || e === void 0 ? void 0 : e.message, {
253
+ nftId: address,
254
+ vcId: parsed === null || parsed === void 0 ? void 0 : (_parsed$current = parsed.current) === null || _parsed$current === void 0 ? void 0 : _parsed$current.vcId
255
+ });
250
256
  return wrapRoot(renderError ? renderError() : /*#__PURE__*/(0, _jsxRuntime.jsx)(_broken.default, {}));
251
257
  }
252
258
  }
@@ -26,7 +26,7 @@ function PricingPlan(_ref) {
26
26
  plan
27
27
  } = _ref;
28
28
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(PlanCard, {
29
- shadow: true,
29
+ $shadow: true,
30
30
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
31
31
  className: "card-header",
32
32
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
@@ -77,4 +77,4 @@ PricingPlan.propTypes = {
77
77
  const PlanCard = (0, _styledComponents.default)(_Card.default).withConfig({
78
78
  displayName: "PricingPlan__PlanCard",
79
79
  componentId: "sc-11tuq1x-0"
80
- })(["height:500px;display:flex;flex-direction:column;@media (max-width:320px){margin-top:20px;}&&{", "}.card-header{height:80px;background-color:#f1fbfb;display:flex;flex-flow:column;align-items:center;justify-content:center;.title{font-size:18px;font-weight:600;text-align:center;color:#404040;margin:0;}}.card-content{display:flex;flex-direction:column;justify-content:space-between;align-items:center;flex-grow:1;}.plan-content{display:flex;flex-direction:column;flex-grow:1;.plan-pricing{display:flex;justify-content:center;align-items:baseline;margin-bottom:12px;color:#4e6af6;text-align:center;}.price-number{font-size:30px;font-weight:600;color:#4e6af6;}.plan-services strong{color:#4e6af6;font-weight:500;}}.plan-actions{width:100%;}"], props => props.shadow ? '' : 'box-shadow: 0px 0px 1px 0px rgba(0, 0, 0, 0.1)');
80
+ })(["height:500px;display:flex;flex-direction:column;@media (max-width:320px){margin-top:20px;}&&{", "}.card-header{height:80px;background-color:#f1fbfb;display:flex;flex-flow:column;align-items:center;justify-content:center;.title{font-size:18px;font-weight:600;text-align:center;color:#404040;margin:0;}}.card-content{display:flex;flex-direction:column;justify-content:space-between;align-items:center;flex-grow:1;}.plan-content{display:flex;flex-direction:column;flex-grow:1;.plan-pricing{display:flex;justify-content:center;align-items:baseline;margin-bottom:12px;color:#4e6af6;text-align:center;}.price-number{font-size:30px;font-weight:600;color:#4e6af6;}.plan-services strong{color:#4e6af6;font-weight:500;}}.plan-actions{width:100%;}"], props => props.$shadow ? '' : 'box-shadow: 0px 0px 1px 0px rgba(0, 0, 0, 0.1)');
@@ -29,7 +29,10 @@ function PricingTable(_ref) {
29
29
  container: true,
30
30
  spacing: 2,
31
31
  justifyContent: "center",
32
- children: plans.map(x => /*#__PURE__*/(0, _jsxRuntime.jsx)(_Grid.default, {
32
+ children: plans.map((x, index) =>
33
+ /*#__PURE__*/
34
+ // eslint-disable-next-line react/no-array-index-key
35
+ (0, _jsxRuntime.jsx)(_Grid.default, {
33
36
  item: true,
34
37
  className: "plan-item",
35
38
  xs: 12,
@@ -38,7 +41,7 @@ function PricingTable(_ref) {
38
41
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_PricingPlan.default, {
39
42
  plan: x
40
43
  })
41
- }, x.id))
44
+ }, index))
42
45
  })
43
46
  });
44
47
  }
@@ -27,7 +27,7 @@ var _Util = require("../Util");
27
27
 
28
28
  var _jsxRuntime = require("react/jsx-runtime");
29
29
 
30
- const _excluded = ["value", "locale", "withoutSuffix", "from", "to"];
30
+ const _excluded = ["value", "locale", "withoutSuffix", "from", "to", "type"];
31
31
 
32
32
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
33
33
 
@@ -78,7 +78,8 @@ function RelativeTime(_ref) {
78
78
  locale,
79
79
  withoutSuffix,
80
80
  from,
81
- to
81
+ to,
82
+ type
82
83
  } = _ref,
83
84
  rest = _objectWithoutProperties(_ref, _excluded);
84
85
 
@@ -87,20 +88,29 @@ function RelativeTime(_ref) {
87
88
  }
88
89
 
89
90
  const localeOption = locale === 'zh' ? 'zh-cn' : 'zh-us';
90
- let innerContent;
91
+ let relativeString;
91
92
 
92
93
  if (from) {
93
- innerContent = (0, _dayjs.default)(value).locale(localeOption).from(from, withoutSuffix);
94
+ relativeString = (0, _dayjs.default)(value).locale(localeOption).from(from, withoutSuffix);
94
95
  } else if (to) {
95
- innerContent = (0, _dayjs.default)(value).locale(localeOption).to(to, withoutSuffix);
96
+ relativeString = (0, _dayjs.default)(value).locale(localeOption).to(to, withoutSuffix);
96
97
  } else {
97
- innerContent = (0, _dayjs.default)(value).locale(localeOption).fromNow(withoutSuffix);
98
+ relativeString = (0, _dayjs.default)(value).locale(localeOption).fromNow(withoutSuffix);
99
+ }
100
+
101
+ const absoluteString = (0, _Util.formatToDatetime)(value, {
102
+ locale: localeOption
103
+ });
104
+ let innerContent = relativeString;
105
+ let popContent = absoluteString;
106
+
107
+ if (type === 'absolute') {
108
+ innerContent = absoluteString;
109
+ popContent = relativeString;
98
110
  }
99
111
 
100
112
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Tooltip.default, {
101
- title: (0, _Util.formatToDatetime)(value, {
102
- locale: localeOption
103
- }),
113
+ title: popContent,
104
114
  placement: "top-end",
105
115
  enterTouchDelay: 0,
106
116
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)("span", _objectSpread(_objectSpread({}, rest), {}, {
@@ -114,11 +124,13 @@ RelativeTime.propTypes = {
114
124
  locale: _propTypes.default.string,
115
125
  withoutSuffix: _propTypes.default.bool,
116
126
  from: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number]),
117
- to: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number])
127
+ to: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number]),
128
+ type: _propTypes.default.string
118
129
  };
119
130
  RelativeTime.defaultProps = {
120
131
  locale: 'en',
121
132
  withoutSuffix: false,
122
133
  from: '',
123
- to: ''
134
+ to: '',
135
+ type: 'relative'
124
136
  };
@@ -166,7 +166,9 @@ function Screenshot(props) {
166
166
  className: "device-frame",
167
167
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
168
168
  className: "device-content",
169
- children: findChildren(_react.Children.toArray(children))
169
+ children: findChildren(_react.Children.toArray(children)).map((item, index) => /*#__PURE__*/(0, _react.cloneElement)(item, {
170
+ key: index
171
+ }))
170
172
  })
171
173
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
172
174
  className: "device-stripe"
package/lib/Tabs/index.js CHANGED
@@ -58,7 +58,7 @@ function Tabs(_ref2) {
58
58
  rest = _objectWithoutProperties(_ref2, _excluded);
59
59
 
60
60
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledMuiTabs, _objectSpread(_objectSpread({
61
- scrollButtons: "on",
61
+ scrollButtons: "auto",
62
62
  variant: "scrollable",
63
63
  value: current,
64
64
  onChange: (_, newValue) => _onChange(newValue),
@@ -63,7 +63,7 @@ function Video(props) {
63
63
  style: styles,
64
64
  src: url,
65
65
  onLoad: () => setLoaded(true),
66
- allowFullScreen: "true"
66
+ allowFullScreen: true
67
67
  }), !loaded && /*#__PURE__*/(0, _jsxRuntime.jsx)(_CircularProgress.default, {
68
68
  className: "loading-indicator",
69
69
  color: "primary"
@@ -84,7 +84,7 @@ function WalletAction(props) {
84
84
 
85
85
  WalletAction.propTypes = {
86
86
  action: _propTypes.default.string,
87
- size: _propTypes.default.oneOf(['large', 'medium', 'small']),
87
+ size: _propTypes.default.oneOf(['xlarge', 'large', 'medium', 'small']),
88
88
  textLayout: _propTypes.default.oneOf(['vertical', 'horizontal']),
89
89
  style: _propTypes.default.oneOfType([_propTypes.default.object, _propTypes.default.string])
90
90
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcblock/ux",
3
- "version": "2.1.42",
3
+ "version": "2.1.45",
4
4
  "description": "Common used react components for arcblock products",
5
5
  "keywords": [
6
6
  "react",
@@ -52,10 +52,10 @@
52
52
  "react": ">=18.1.0",
53
53
  "react-ga": "^2.7.0"
54
54
  },
55
- "gitHead": "077fc503a95b41c9fe5d8dab0bc8d50300105e46",
55
+ "gitHead": "84b9e6665af4066a5fa3087aeeebcd1414f270f4",
56
56
  "dependencies": {
57
- "@arcblock/icons": "^2.1.42",
58
- "@arcblock/react-hooks": "^2.1.42",
57
+ "@arcblock/icons": "^2.1.45",
58
+ "@arcblock/react-hooks": "^2.1.45",
59
59
  "@babel/plugin-syntax-dynamic-import": "^7.8.3",
60
60
  "@emotion/react": "^11.9.0",
61
61
  "@emotion/styled": "^11.8.1",
@@ -74,7 +74,7 @@ export default function CodeBlock({ code, language, children, ...rest }) {
74
74
  dangerouslySetInnerHTML={{ __html: hljs.highlightAuto(source, [language]).value }}
75
75
  />
76
76
  </span>
77
- <Button className="copy-button" onClick={onCopy} tabIndex="-1" color="primary" disabled={copied}>
77
+ <Button className="copy-button" onClick={onCopy} color="primary" disabled={copied}>
78
78
  {!copied && <CopyIcon style={{ color: '#fff', fontSize: 16 }} />}
79
79
  {copied && <CheckIcon style={{ color: '#fff', fontSize: 16 }} />}
80
80
  </Button>
@@ -134,7 +134,7 @@ const Pre = styled.pre`
134
134
 
135
135
  &:hover {
136
136
  .copy-button {
137
- display: block;
137
+ display: flex;
138
138
  }
139
139
  }
140
140
 
@@ -43,8 +43,8 @@ function FixWidthNumber({ number, label, length = 2 }) {
43
43
 
44
44
  export default class CountDown extends Component {
45
45
  constructor(props) {
46
+ super(props);
46
47
  const newProps = mergeProps(props, CountDown, ['dark', 'endTime', 'style']);
47
- super(newProps);
48
48
  this.state = getRemaining(newProps.endTime);
49
49
  this.timer = null;
50
50
  }
@@ -20,6 +20,24 @@ export default function Datatable({ ...props }) {
20
20
  );
21
21
  }
22
22
 
23
+ const fixCellProp = (tempObj, cellProps) => {
24
+ const cellStyle = {};
25
+
26
+ if (tempObj.align) {
27
+ cellProps.className = clsx(cellProps.className, `pc-align-${tempObj.align}`);
28
+ }
29
+
30
+ if (tempObj.verticalKeyAlign) {
31
+ cellProps.className = clsx(cellProps.className, `vertical-align-${tempObj.verticalKeyAlign}`);
32
+ }
33
+
34
+ if (tempObj.minWidth) {
35
+ cellStyle.minWidth = tempObj.minWidth;
36
+ }
37
+
38
+ cellProps.style = Object.assign({}, cellProps.style, cellStyle);
39
+ };
40
+
23
41
  /**
24
42
  * @param {Object} props.options The options of mui-datatable,detail see https://github.com/gregnb/mui-datatables/tree/b8d2eee6af4589d254b40918e5d7e70b1ee4baca
25
43
  * @param {Array} props.customButtons Custom buttons for toolbar
@@ -102,13 +120,7 @@ function ReDatatable({
102
120
  cellProps.width = tempObj.width;
103
121
  }
104
122
 
105
- if (tempObj.align) {
106
- cellProps.className = clsx(cellProps.className, `pc-align-${tempObj.align}`);
107
- }
108
-
109
- if (tempObj.verticalKeyAlign) {
110
- cellProps.className = clsx(cellProps.className, `vertical-align-${tempObj.verticalKeyAlign}`);
111
- }
123
+ fixCellProp(tempObj, cellProps);
112
124
 
113
125
  return cellProps;
114
126
  };
@@ -130,13 +142,7 @@ function ReDatatable({
130
142
  };
131
143
  }
132
144
 
133
- if (tempObj.align) {
134
- cellProps.className = clsx(cellProps.className, `pc-align-${tempObj.align}`);
135
- }
136
-
137
- if (tempObj.verticalKeyAlign) {
138
- cellProps.className = clsx(cellProps.className, `vertical-align-${tempObj.verticalKeyAlign}`);
139
- }
145
+ fixCellProp(tempObj, cellProps);
140
146
 
141
147
  return cellProps;
142
148
  };
@@ -11,8 +11,9 @@ export default function Footer(props) {
11
11
  const newProps = mergeProps(props, Footer, ['dark', 'style']);
12
12
  const { className, copyStart, style, brand, dark } = newProps;
13
13
 
14
- const endYear = new Date().getFullYear();
15
- const copyYear = endYear === copyStart ? endYear : `${copyStart}-${endYear}`;
14
+ const endYearString = `${new Date().getFullYear()}`;
15
+ const copyStartString = `${copyStart}`;
16
+ const copyYear = endYearString === copyStartString ? endYearString : `${copyStartString}-${endYearString}`;
16
17
 
17
18
  return (
18
19
  <Container className={className} style={style} dark={dark}>
@@ -35,7 +36,7 @@ export default function Footer(props) {
35
36
  Footer.propTypes = {
36
37
  dark: PropTypes.bool,
37
38
  className: PropTypes.string,
38
- copyStart: PropTypes.string,
39
+ copyStart: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
39
40
  brand: PropTypes.string,
40
41
  style: PropTypes.object,
41
42
  };
@@ -40,7 +40,7 @@ InfoRow.defaultProps = {
40
40
 
41
41
  return typeof name === 'string' ? resetName : name;
42
42
  },
43
- valueComponent: 'p',
43
+ valueComponent: 'div',
44
44
  layout: 'horizontal',
45
45
  };
46
46
 
@@ -8,7 +8,7 @@ export default function Metric({ icon, value, name, url, animated, LinkComponent
8
8
  const metric = (
9
9
  <>
10
10
  <div className="metric__image">
11
- <ImageIcon name={icon} alt={name} size={30} prefix={prefix} color="#222222" />
11
+ <ImageIcon name={icon} alt={typeof name === 'string' ? name : ''} size={30} prefix={prefix} color="#222222" />
12
12
  </div>
13
13
  <div>
14
14
  <div
@@ -26,7 +26,7 @@ export default function Metric({ icon, value, name, url, animated, LinkComponent
26
26
  Metric.propTypes = {
27
27
  icon: PropTypes.string.isRequired,
28
28
  value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,
29
- name: PropTypes.string.isRequired,
29
+ name: PropTypes.node.isRequired,
30
30
  animated: PropTypes.bool,
31
31
  url: PropTypes.string,
32
32
  LinkComponent: PropTypes.any,
@@ -69,13 +69,15 @@ function NFTDisplay({
69
69
  </Root>
70
70
  );
71
71
 
72
+ const parsed = useRef(data);
73
+
72
74
  try {
73
- const parsed = useRef(data);
74
75
  // 如果是 raw data 先解析
75
76
  if (typeof parsed.current === 'string') {
76
77
  parsed.current = JSON.parse(data);
77
78
  // console.log('[debug] parse data')
78
79
  }
80
+
79
81
  const { vcId } = parsed.current;
80
82
  // 需要兼容新旧两种类型的数据结构, nft data 有 credentialSubject 属性, 说明是旧 nft data, 否则是新 nft data
81
83
  const display = parsed.current.credentialSubject
@@ -147,14 +149,14 @@ function NFTDisplay({
147
149
  const buffer = pako.ungzip(fromBase64(content), {});
148
150
  const svg = Buffer.from(buffer).toString('utf8');
149
151
  if (checkSvg && !isSvg(svg)) {
150
- throw new Error(`Invalid SVG: ${svg}`);
152
+ throw new Error('Invalid SVG of type svg_gzipped');
151
153
  }
152
154
  const Embedder = getSvgEmbedder(preferredSvgEmbedder);
153
155
  return <Embedder svg={svg} />;
154
156
  }
155
157
  case 'svg': {
156
158
  if (checkSvg && !isSvg(content)) {
157
- throw new Error(`Invalid SVG: ${content}`);
159
+ throw new Error('Invalid SVG of type svg');
158
160
  }
159
161
  const Embedder = getSvgEmbedder(preferredSvgEmbedder);
160
162
  return <Embedder svg={content} />;
@@ -176,7 +178,10 @@ function NFTDisplay({
176
178
  </>
177
179
  );
178
180
  } catch (e) {
179
- console.error(e);
181
+ console.error(e?.message, {
182
+ nftId: address,
183
+ vcId: parsed?.current?.vcId,
184
+ });
180
185
  return wrapRoot(renderError ? renderError() : <DefaultBrokenImage />);
181
186
  }
182
187
  }
@@ -8,7 +8,7 @@ import Typography from '@mui/material/Typography';
8
8
 
9
9
  function PricingPlan({ plan }) {
10
10
  return (
11
- <PlanCard shadow>
11
+ <PlanCard $shadow>
12
12
  <div className="card-header">
13
13
  <div className="title">{plan.name}</div>
14
14
  </div>
@@ -54,7 +54,7 @@ const PlanCard = styled(Card)`
54
54
  }
55
55
 
56
56
  && {
57
- ${(props) => (props.shadow ? '' : 'box-shadow: 0px 0px 1px 0px rgba(0, 0, 0, 0.1)')}
57
+ ${(props) => (props.$shadow ? '' : 'box-shadow: 0px 0px 1px 0px rgba(0, 0, 0, 0.1)')}
58
58
  }
59
59
 
60
60
  .card-header {
@@ -9,8 +9,9 @@ function PricingTable({ plans }) {
9
9
  return (
10
10
  <Div variant="even">
11
11
  <Grid container spacing={2} justifyContent="center">
12
- {plans.map((x) => (
13
- <Grid item className="plan-item" key={x.id} xs={12} sm={6} md={3}>
12
+ {plans.map((x, index) => (
13
+ // eslint-disable-next-line react/no-array-index-key
14
+ <Grid item className="plan-item" key={index} xs={12} sm={6} md={3}>
14
15
  <PricingPlan plan={x} />
15
16
  </Grid>
16
17
  ))}
@@ -34,25 +34,35 @@ dayjs.updateLocale('zh-cn', {
34
34
  });
35
35
  setDateTool(dayjs);
36
36
 
37
- export default function RelativeTime({ value, locale, withoutSuffix, from, to, ...rest }) {
37
+ export default function RelativeTime({ value, locale, withoutSuffix, from, to, type, ...rest }) {
38
38
  if (!value) {
39
39
  return '-';
40
40
  }
41
41
 
42
42
  const localeOption = locale === 'zh' ? 'zh-cn' : 'zh-us';
43
43
 
44
- let innerContent;
44
+ let relativeString;
45
45
 
46
46
  if (from) {
47
- innerContent = dayjs(value).locale(localeOption).from(from, withoutSuffix);
47
+ relativeString = dayjs(value).locale(localeOption).from(from, withoutSuffix);
48
48
  } else if (to) {
49
- innerContent = dayjs(value).locale(localeOption).to(to, withoutSuffix);
49
+ relativeString = dayjs(value).locale(localeOption).to(to, withoutSuffix);
50
50
  } else {
51
- innerContent = dayjs(value).locale(localeOption).fromNow(withoutSuffix);
51
+ relativeString = dayjs(value).locale(localeOption).fromNow(withoutSuffix);
52
+ }
53
+
54
+ const absoluteString = formatToDatetime(value, { locale: localeOption });
55
+
56
+ let innerContent = relativeString;
57
+ let popContent = absoluteString;
58
+
59
+ if (type === 'absolute') {
60
+ innerContent = absoluteString;
61
+ popContent = relativeString;
52
62
  }
53
63
 
54
64
  return (
55
- <Tooltip title={formatToDatetime(value, { locale: localeOption })} placement="top-end" enterTouchDelay={0}>
65
+ <Tooltip title={popContent} placement="top-end" enterTouchDelay={0}>
56
66
  <span {...rest}>{innerContent}</span>
57
67
  </Tooltip>
58
68
  );
@@ -64,6 +74,7 @@ RelativeTime.propTypes = {
64
74
  withoutSuffix: PropTypes.bool,
65
75
  from: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
66
76
  to: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
77
+ type: PropTypes.string,
67
78
  };
68
79
 
69
80
  RelativeTime.defaultProps = {
@@ -71,4 +82,5 @@ RelativeTime.defaultProps = {
71
82
  withoutSuffix: false,
72
83
  from: '',
73
84
  to: '',
85
+ type: 'relative',
74
86
  };
@@ -1,4 +1,4 @@
1
- import { createElement, Children } from 'react';
1
+ import { createElement, Children, cloneElement } from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import styled from 'styled-components';
4
4
 
@@ -130,7 +130,10 @@ function Screenshot(props) {
130
130
  contentRadius={borderRadius}
131
131
  contentZIndex={zIndex}>
132
132
  <div className="device-frame">
133
- <div className="device-content">{findChildren(Children.toArray(children))}</div>
133
+ <div className="device-content">
134
+ {/* eslint-disable-next-line react/no-array-index-key */}
135
+ {findChildren(Children.toArray(children)).map((item, index) => cloneElement(item, { key: index }))}
136
+ </div>
134
137
  </div>
135
138
  <div className="device-stripe" />
136
139
  <div className="device-header" />
package/src/Tabs/index.js CHANGED
@@ -24,7 +24,7 @@ const StyledMuiTabs = styled(MuiTabs)(({ theme }) => ({
24
24
  export default function Tabs({ tabs, current, onChange, ...rest }) {
25
25
  return (
26
26
  <StyledMuiTabs
27
- scrollButtons="on"
27
+ scrollButtons="auto"
28
28
  variant="scrollable"
29
29
  value={current}
30
30
  onChange={(_, newValue) => onChange(newValue)}
@@ -23,7 +23,7 @@ export default function Video(props) {
23
23
  if (url.indexOf('v.qq.com') > 0) {
24
24
  return (
25
25
  <Placeholder style={{ width, height }}>
26
- <iframe title={url} style={styles} src={url} onLoad={() => setLoaded(true)} allowFullScreen="true" />
26
+ <iframe title={url} style={styles} src={url} onLoad={() => setLoaded(true)} allowFullScreen />
27
27
  {!loaded && <CircularProgress className="loading-indicator" color="primary" />}
28
28
  </Placeholder>
29
29
  );
@@ -35,7 +35,7 @@ export default function WalletAction(props) {
35
35
 
36
36
  WalletAction.propTypes = {
37
37
  action: PropTypes.string,
38
- size: PropTypes.oneOf(['large', 'medium', 'small']),
38
+ size: PropTypes.oneOf(['xlarge', 'large', 'medium', 'small']),
39
39
  textLayout: PropTypes.oneOf(['vertical', 'horizontal']),
40
40
  style: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
41
41
  };