@arcblock/ux 2.13.43 → 2.13.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.
@@ -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;
@@ -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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcblock/ux",
3
- "version": "2.13.43",
3
+ "version": "2.13.45",
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": "9b65dc9fcef38218cbf4852cb31a1b76afffab33",
74
+ "gitHead": "5cf352046f4ca17b469e97a54d0c48205454b37c",
75
75
  "dependencies": {
76
76
  "@arcblock/did-motif": "^1.1.13",
77
- "@arcblock/icons": "^2.13.43",
78
- "@arcblock/nft-display": "^2.13.43",
79
- "@arcblock/react-hooks": "^2.13.43",
77
+ "@arcblock/icons": "^2.13.45",
78
+ "@arcblock/nft-display": "^2.13.45",
79
+ "@arcblock/react-hooks": "^2.13.45",
80
80
  "@babel/plugin-syntax-dynamic-import": "^7.8.3",
81
- "@blocklet/theme": "^2.13.43",
81
+ "@blocklet/theme": "^2.13.45",
82
82
  "@fontsource/roboto": "~5.1.1",
83
83
  "@fontsource/ubuntu-mono": "^5.0.18",
84
84
  "@iconify-icons/logos": "^1.2.36",