@arcblock/ux 2.13.42 → 2.13.44

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.
@@ -42,7 +42,7 @@ declare namespace AnimationWaiter {
42
42
  namespace defaultProps {
43
43
  let animationData_1: null;
44
44
  export { animationData_1 as animationData };
45
- let size_1: string;
45
+ let size_1: number;
46
46
  export { size_1 as size };
47
47
  let message_1: string;
48
48
  export { message_1 as message };
@@ -1,10 +1,10 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useState, useEffect, useRef } from 'react';
3
+ import { Skeleton } from '@mui/material';
3
4
  import PropTypes from 'prop-types';
4
5
  import Lottie from 'react-lottie-player';
5
6
  import noop from 'lodash/noop';
6
- import lottieJson from './default-animation.json';
7
- import { styled } from '../Theme';
7
+ import { styled, useTheme } from '../Theme';
8
8
 
9
9
  /**
10
10
  * 用于长时间等待的用的动画组件
@@ -35,15 +35,36 @@ export default function AnimationWaiter({
35
35
  increaseSpeed,
36
36
  ...rest
37
37
  }) {
38
+ const theme = useTheme();
38
39
  const [tipsId, setTipsId] = useState(0);
39
40
  const [currentSpeed, setCurrentSpeed] = useState(speed);
40
41
  const [messageId, setMessageId] = useState(0);
42
+ const [defaultAnimation, setDefaultAnimation] = useState(null);
43
+ const [isLoading, setIsLoading] = useState(!animationData);
41
44
  // 动画的开始时间
42
45
  const startTime = useRef(new Date().getTime());
43
46
  if (!Array.isArray(message)) {
44
47
  // eslint-disable-next-line no-param-reassign
45
48
  message = [message];
46
49
  }
50
+
51
+ // 懒加载默认动画
52
+ useEffect(() => {
53
+ if (!animationData) {
54
+ setIsLoading(true);
55
+ const loadAnimation = async () => {
56
+ try {
57
+ const module = await (theme.palette.mode === 'dark' ? import('./dark-animation.json') : import('./default-animation.json'));
58
+ setDefaultAnimation(module.default || module);
59
+ setIsLoading(false);
60
+ } catch (error) {
61
+ console.error('Failed to load animation:', error);
62
+ setIsLoading(false);
63
+ }
64
+ };
65
+ loadAnimation();
66
+ }
67
+ }, [animationData, theme.palette.mode]);
47
68
  useEffect(() => {
48
69
  if (!message) {
49
70
  return;
@@ -108,9 +129,22 @@ export default function AnimationWaiter({
108
129
  };
109
130
  return /*#__PURE__*/_jsxs(Container, {
110
131
  ...rest,
111
- children: [/*#__PURE__*/_jsx(Lottie, {
132
+ children: [isLoading ? /*#__PURE__*/_jsx("div", {
133
+ style: {
134
+ width: size,
135
+ height: size,
136
+ display: 'flex',
137
+ justifyContent: 'center',
138
+ alignItems: 'center'
139
+ },
140
+ children: /*#__PURE__*/_jsx(Skeleton, {
141
+ variant: "rounded",
142
+ width: size * 0.4,
143
+ height: size * 0.4
144
+ })
145
+ }) : /*#__PURE__*/_jsx(Lottie, {
112
146
  loop: true,
113
- animationData: animationData || lottieJson,
147
+ animationData: animationData || defaultAnimation,
114
148
  play: true,
115
149
  speed: currentSpeed,
116
150
  style: {
@@ -158,7 +192,7 @@ AnimationWaiter.propTypes = {
158
192
  };
159
193
  AnimationWaiter.defaultProps = {
160
194
  animationData: null,
161
- size: '',
195
+ size: 256,
162
196
  message: '',
163
197
  messageDuration: 5000,
164
198
  messageLoop: true,
@@ -98,7 +98,9 @@ const Container = styled('div', {
98
98
  shouldForwardProp: prop => prop !== 'dark'
99
99
  })`
100
100
  position: relative;
101
- margin-top: 64px;
101
+ margin-top: ${({
102
+ theme
103
+ }) => theme.spacing(2)};
102
104
  padding: 24px 0 32px;
103
105
  border-top: 1px solid ${props => props.theme.palette.divider};
104
106
  box-sizing: border-box;
package/lib/Img/index.js CHANGED
@@ -122,6 +122,7 @@ function Img({
122
122
  "data-id": "2",
123
123
  ref: ref,
124
124
  style: outerStyle,
125
+ className: "arcblock_ux_img-wrapper",
125
126
  ...rest,
126
127
  sx: mergeSx({
127
128
  [`& .${classes.root}`]: {
@@ -49,6 +49,7 @@ const SessionUserItem = /*#__PURE__*/forwardRef(({
49
49
  size: 36
50
50
  })
51
51
  }), /*#__PURE__*/_jsx(WalletOSIcon, {
52
+ color: palette.text.secondary,
52
53
  loading: sessionItem.__isDefault,
53
54
  provider: sessionItem?.extra?.provider,
54
55
  walletOS: sessionItem?.extra?.walletOS
@@ -1,5 +1,8 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Typography, Box, Grid } from '@mui/material';
2
+ import Typography from '@mui/material/Typography';
3
+ import Box from '@mui/material/Box';
4
+ import Grid from '@mui/material/Grid';
5
+ import useTheme from '@mui/material/styles/useTheme';
3
6
  import { useCreation, useMemoizedFn } from 'ahooks';
4
7
  import styled from '@emotion/styled';
5
8
  import isArray from 'lodash/isArray';
@@ -28,6 +31,15 @@ const IconMap = {
28
31
  function formatLinkDisplay(link) {
29
32
  return withoutProtocol(link);
30
33
  }
34
+
35
+ /**
36
+ * dark mode 下,转换 icon 颜色
37
+ */
38
+ function convertIconColor(isDark) {
39
+ return isDark ? {
40
+ filter: 'brightness(0) saturate(100%) invert(1)'
41
+ } : {};
42
+ }
31
43
  const iconSize = {
32
44
  width: 16,
33
45
  height: 16
@@ -38,13 +50,16 @@ const iconSize = {
38
50
  function TimeZoneField({
39
51
  value
40
52
  }) {
53
+ const theme = useTheme();
54
+ const isDark = theme.palette.mode === 'dark';
41
55
  return /*#__PURE__*/_jsxs(Box, {
42
56
  display: "flex",
43
57
  alignItems: "center",
44
58
  gap: 1,
45
59
  className: "user-card__timezone-field",
46
60
  children: [/*#__PURE__*/_jsx(TimezoneIcon, {
47
- ...iconSize
61
+ ...iconSize,
62
+ style: convertIconColor(isDark)
48
63
  }), /*#__PURE__*/_jsx(Clock, {
49
64
  value: value,
50
65
  variant: "body2",
@@ -56,6 +71,8 @@ function LinkField({
56
71
  value
57
72
  }) {
58
73
  const [useFallback, setUseFallback] = useState(false);
74
+ const theme = useTheme();
75
+ const isDark = theme.palette.mode === 'dark';
59
76
  const faviconUrl = useCreation(() => {
60
77
  try {
61
78
  const url = new URL(value);
@@ -82,7 +99,8 @@ function LinkField({
82
99
  },
83
100
  onError: handleImageError
84
101
  }) : /*#__PURE__*/_jsx(LinkIcon, {
85
- ...iconSize
102
+ ...iconSize,
103
+ style: convertIconColor(isDark)
86
104
  }), /*#__PURE__*/_jsx(LineText, {
87
105
  variant: "body2",
88
106
  color: "grey.800",
@@ -109,16 +127,21 @@ function BasicField({
109
127
  children
110
128
  }) {
111
129
  const Icon = IconMap[field];
130
+ const theme = useTheme();
131
+ const isDark = theme.palette.mode === 'dark';
132
+ const iconColor = convertIconColor(isDark);
112
133
  return /*#__PURE__*/_jsxs(Box, {
113
134
  display: "flex",
114
135
  alignItems: "center",
115
136
  gap: 1,
116
137
  className: `user-card__${field}-field`,
117
138
  children: [Icon ? /*#__PURE__*/_jsx(Icon, {
118
- ...iconSize
139
+ ...iconSize,
140
+ style: iconColor
119
141
  }) : /*#__PURE__*/_jsx(IconifyIcon, {
120
142
  icon: infoCircleIcon,
121
- ...iconSize
143
+ ...iconSize,
144
+ ...iconColor
122
145
  }), /*#__PURE__*/_jsx(LineText, {
123
146
  variant: "body2",
124
147
  color: "grey.800",
@@ -1,6 +1,6 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import React from 'react';
3
- import { Box, Tooltip } from '@mui/material';
3
+ import { Tooltip } from '@mui/material';
4
4
  import Zoom from '@mui/material/Zoom';
5
5
  import { renderAvatar } from '../components';
6
6
  /**
@@ -17,10 +17,7 @@ function TooltipAvatar({
17
17
  avatarProps,
18
18
  onAvatarClick
19
19
  }) {
20
- const avatarElement = /*#__PURE__*/_jsx(Box, {
21
- display: "inline-block",
22
- children: renderAvatar(user, avatarSize, avatarProps, onAvatarClick, shouldShowHoverCard || !!tooltipTitle)
23
- });
20
+ const avatarElement = renderAvatar(user, avatarSize, avatarProps, onAvatarClick, shouldShowHoverCard || !!tooltipTitle);
24
21
  // 使用普通文本Tooltip
25
22
  if (tooltipTitle) {
26
23
  return /*#__PURE__*/_jsx(Tooltip, {
@@ -37,17 +37,21 @@ export const renderAvatar = (user, avatarSize = 48, avatarProps = undefined, onA
37
37
  }
38
38
 
39
39
  // 显示用户头像
40
- return /*#__PURE__*/_jsx(Avatar, {
41
- size: avatarSize,
42
- did: user.did,
43
- variant: "circle",
44
- style: {
45
- cursor: shouldShowHoverCard || onAvatarClick ? 'pointer' : 'default'
46
- },
47
- onClick: onClick,
48
- src: user.avatar,
49
- alt: user.fullName || '',
50
- ...(avatarProps || {})
40
+ return /*#__PURE__*/_jsx(Box, {
41
+ className: "user-card__avatar",
42
+ display: "flex",
43
+ children: /*#__PURE__*/_jsx(Avatar, {
44
+ size: avatarSize,
45
+ did: user.did,
46
+ variant: "circle",
47
+ style: {
48
+ cursor: shouldShowHoverCard || onAvatarClick ? 'pointer' : 'default'
49
+ },
50
+ onClick: onClick,
51
+ src: user.avatar,
52
+ alt: user.fullName || '',
53
+ ...(avatarProps || {})
54
+ })
51
55
  });
52
56
  };
53
57
 
@@ -78,10 +78,12 @@ function UserCard(props) {
78
78
  shouldShowHoverCard: false,
79
79
  user: user,
80
80
  avatarProps: props.popupAvatarProps,
81
- shortenLabelProps: props.popupShortenLabelProps,
81
+ shortenLabelProps: props.popupShortenLabelProps || props.shortenLabelProps,
82
82
  renderFields: props.popupRenderFields,
83
83
  renderName: props.popupRenderName,
84
- infoType: props.popupInfoType || props.infoType
84
+ infoType: props.popupInfoType || props.infoType,
85
+ didProps: props.popupDidProps || props.didProps,
86
+ showDid: props.popupShowDid || props.showDid
85
87
  })
86
88
  });
87
89
  };
@@ -99,6 +99,8 @@ export interface UserCardProps {
99
99
  showHoverCard?: boolean;
100
100
  showDid?: boolean;
101
101
  didProps?: Partial<DIDProps>;
102
+ popupDidProps?: Partial<DIDProps>;
103
+ popupShowDid?: boolean;
102
104
  avatarProps?: Partial<AvatarProps>;
103
105
  popupAvatarProps?: Partial<AvatarProps>;
104
106
  tooltipProps?: Partial<TooltipProps>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcblock/ux",
3
- "version": "2.13.42",
3
+ "version": "2.13.44",
4
4
  "description": "Common used react components for arcblock products",
5
5
  "keywords": [
6
6
  "react",
@@ -71,14 +71,14 @@
71
71
  "react": ">=18.2.0",
72
72
  "react-router-dom": ">=6.22.3"
73
73
  },
74
- "gitHead": "30e0b6eaccfe6847ba5404894e8ce76b352053e6",
74
+ "gitHead": "0ce16241a15426bb4be273eeb7ddaa7aa370ad2e",
75
75
  "dependencies": {
76
76
  "@arcblock/did-motif": "^1.1.13",
77
- "@arcblock/icons": "^2.13.42",
78
- "@arcblock/nft-display": "^2.13.42",
79
- "@arcblock/react-hooks": "^2.13.42",
77
+ "@arcblock/icons": "^2.13.44",
78
+ "@arcblock/nft-display": "^2.13.44",
79
+ "@arcblock/react-hooks": "^2.13.44",
80
80
  "@babel/plugin-syntax-dynamic-import": "^7.8.3",
81
- "@blocklet/theme": "^2.13.42",
81
+ "@blocklet/theme": "^2.13.44",
82
82
  "@fontsource/roboto": "~5.1.1",
83
83
  "@fontsource/ubuntu-mono": "^5.0.18",
84
84
  "@iconify-icons/logos": "^1.2.36",