@arcblock/ux 2.10.65 → 2.10.67
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.
- package/lib/ActionButton/index.d.ts +1 -1
- package/lib/Alert/index.d.ts +1 -1
- package/lib/AnimationWaiter/index.d.ts +27 -15
- package/lib/AnimationWaiter/index.js +15 -14
- package/lib/Async/index.d.ts +50 -17
- package/lib/Badge/index.d.ts +1 -1
- package/lib/Badge/index.js +7 -1
- package/lib/BlockletContext/index.d.ts +12 -28
- package/lib/BlockletContext/index.js +3 -21
- package/lib/Button/wrap.d.ts +5 -3
- package/lib/Button/wrap.js +2 -1
- package/lib/ButtonGroup/index.d.ts +12 -2
- package/lib/ButtonGroup/index.js +13 -3
- package/lib/CardSelector/index.d.ts +11 -33
- package/lib/CardSelector/index.js +16 -32
- package/lib/Center/index.d.ts +6 -21
- package/lib/Center/index.js +2 -17
- package/lib/ClickToCopy/copy-button.d.ts +9 -26
- package/lib/ClickToCopy/copy-button.js +5 -17
- package/lib/ClickToCopy/hook.d.ts +11 -5
- package/lib/ClickToCopy/hook.js +3 -3
- package/lib/ClickToCopy/index.d.ts +18 -29
- package/lib/ClickToCopy/index.js +0 -13
- package/lib/CodeBlock/LightBox.d.ts +1 -1
- package/lib/CodeBlock/index.d.ts +7 -26
- package/lib/CodeBlock/index.js +4 -17
- package/lib/Colors/index.d.ts +2 -2
- package/lib/Colors/themes/default.d.ts +54 -61
- package/lib/Colors/themes/temp.d.ts +35 -35
- package/lib/ContactForm/index.d.ts +26 -30
- package/lib/ContactForm/index.js +7 -17
- package/lib/Dialog/confirm.d.ts +3 -3
- package/lib/Dialog/confirm.js +2 -2
- package/lib/Earth/index.d.ts +10 -1
- package/lib/Header/auto-hidden.d.ts +6 -11
- package/lib/Header/auto-hidden.js +0 -5
- package/lib/Header/header.d.ts +20 -51
- package/lib/Header/header.js +10 -42
- package/lib/Header/index.d.ts +2 -2
- package/lib/Header/responsive-header.d.ts +10 -22
- package/lib/Header/responsive-header.js +1 -13
- package/lib/Icon/image.d.ts +8 -36
- package/lib/Icon/image.js +6 -24
- package/lib/Icon/index.d.ts +9 -1
- package/lib/Icon/index.js +6 -25
- package/lib/NavMenu/index.d.ts +1 -1
- package/lib/NavMenu/nav-menu.d.ts +37 -51
- package/lib/NavMenu/nav-menu.js +47 -102
- package/lib/NavMenu/style.d.ts +8 -2
- package/lib/NavMenu/style.js +3 -1
- package/lib/PageScroller/index.d.ts +13 -1
- package/lib/Passport/passport.js +1 -1
- package/lib/PricingTable/index.d.ts +3 -1
- package/lib/RelativeTime/index.d.ts +1 -1
- package/lib/Screenshot/BaseScreenshot/index.js +1 -1
- package/lib/SplitButton/index.d.ts +0 -19
- package/lib/SplitButton/index.js +7 -27
- package/lib/TextCollapse/index.d.ts +10 -1
- package/lib/Theme/index.d.ts +5 -13
- package/lib/Theme/index.js +4 -11
- package/lib/Theme/theme-provider.d.ts +16 -18
- package/lib/Theme/theme.d.ts +37 -11
- package/lib/Theme/theme.js +13 -22
- package/lib/Util/constant.d.ts +31 -31
- package/lib/Util/deprecate.d.ts +7 -5
- package/lib/Util/federated.d.ts +21 -21
- package/lib/Util/federated.js +1 -1
- package/lib/Util/index.d.ts +59 -60
- package/lib/Util/index.js +16 -43
- package/lib/Util/passport.d.ts +6 -6
- package/lib/Util/wallet.d.ts +15 -3
- package/lib/WebWalletSWKeeper/index.js +1 -1
- package/lib/global.d.ts +13 -0
- package/lib/index.d.ts +4 -2
- package/lib/index.js +2 -2
- package/lib/type.d.ts +31 -1
- package/package.json +5 -5
- package/src/AnimationWaiter/index.jsx +15 -14
- package/src/Async/{index.jsx → index.tsx} +13 -4
- package/src/Badge/index.jsx +8 -1
- package/src/BlockletContext/{index.jsx → index.tsx} +17 -22
- package/src/Button/wrap.jsx +2 -1
- package/src/ButtonGroup/index.js +13 -3
- package/src/CardSelector/{index.jsx → index.tsx} +32 -33
- package/src/Center/index.tsx +33 -0
- package/src/ClickToCopy/{copy-button.jsx → copy-button.tsx} +15 -16
- package/src/ClickToCopy/{hook.js → hook.ts} +5 -5
- package/src/ClickToCopy/{index.jsx → index.tsx} +12 -17
- package/src/CodeBlock/{index.jsx → index.tsx} +15 -17
- package/src/ContactForm/{index.jsx → index.tsx} +47 -29
- package/src/Dialog/confirm.jsx +2 -2
- package/src/Header/{auto-hidden.jsx → auto-hidden.tsx} +6 -7
- package/src/Header/{header.jsx → header.tsx} +32 -46
- package/src/Header/{responsive-header.jsx → responsive-header.tsx} +9 -15
- package/src/Icon/{image.jsx → image.tsx} +19 -22
- package/src/Icon/{index.jsx → index.tsx} +22 -24
- package/src/NavMenu/{nav-menu.jsx → nav-menu.tsx} +161 -144
- package/src/NavMenu/{style.js → style.ts} +9 -1
- package/src/Passport/passport.jsx +1 -1
- package/src/Screenshot/BaseScreenshot/index.jsx +1 -1
- package/src/SplitButton/index.tsx +10 -23
- package/src/Theme/{index.js → index.ts} +6 -12
- package/src/Theme/{theme-provider.jsx → theme-provider.tsx} +10 -2
- package/src/Theme/{theme.js → theme.ts} +54 -23
- package/src/Util/{deprecate.jsx → deprecate.tsx} +8 -4
- package/src/Util/{federated.js → federated.ts} +3 -3
- package/src/Util/{index.js → index.ts} +85 -59
- package/src/Util/{passport.js → passport.ts} +2 -2
- package/src/Util/{wallet.js → wallet.ts} +1 -1
- package/src/WebWalletSWKeeper/index.jsx +1 -1
- package/src/global.d.ts +13 -0
- package/src/{index.js → index.ts} +2 -2
- package/src/type.d.ts +31 -1
- package/src/Center/index.jsx +0 -41
- /package/src/CodeBlock/{LightBox.jsx → LightBox.tsx} +0 -0
- /package/src/Colors/{index.js → index.ts} +0 -0
- /package/src/Colors/themes/{default.js → default.ts} +0 -0
- /package/src/Colors/themes/{temp.js → temp.ts} +0 -0
- /package/src/Header/{index.js → index.ts} +0 -0
- /package/src/NavMenu/{index.js → index.ts} +0 -0
- /package/src/Util/{constant.js → constant.ts} +0 -0
package/lib/Alert/index.d.ts
CHANGED
|
@@ -1,27 +1,39 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* 用于长时间等待的用的动画组件
|
|
3
3
|
* 动画会随着时间的变化而逐步加快播放速度,好适应用户的等待心理
|
|
4
|
-
* @param {
|
|
5
|
-
* @param {
|
|
6
|
-
* @param {
|
|
7
|
-
* @param {
|
|
8
|
-
* @param {
|
|
9
|
-
* @param {
|
|
10
|
-
* @param {
|
|
11
|
-
* @param {
|
|
12
|
-
* @param {
|
|
13
|
-
* @param {
|
|
14
|
-
* @
|
|
4
|
+
* @param {object} props - 组件属性
|
|
5
|
+
* @param {object} [props.animationData] - lottie json 动画数据
|
|
6
|
+
* @param {number|string} [props.size] - 动画的尺寸,单位px
|
|
7
|
+
* @param {string|React.ReactNode[]} [props.message] - 动画下方的文字;数组情况下会在一定时间切换文案
|
|
8
|
+
* @param {number} [props.messageDuration=5000] - 动画下方的文字为数组时,每个文案的持续时间(毫秒)
|
|
9
|
+
* @param {boolean} [props.messageLoop=true] - 动画下方的文字为数组时,文案是否循环播放
|
|
10
|
+
* @param {React.ReactNode[]} [props.tips=[]] - 底部的提示元素
|
|
11
|
+
* @param {number} [props.tipsDuration=5000] - 底部提示的切换时间(毫秒)
|
|
12
|
+
* @param {number} [props.speed=1] - 动画默认的播放速度
|
|
13
|
+
* @param {number} [props.maybeDuration=120000] - 整个动画大概的持续时间(毫秒),用于计算增量下的动画速度
|
|
14
|
+
* @param {number} [props.increaseSpeed=0] - 在 maybeDuration 时间下增加的速度
|
|
15
|
+
* @returns {JSX.Element}
|
|
15
16
|
*/
|
|
16
|
-
declare function AnimationWaiter({ animationData, size, message, messageDuration, messageLoop, tips, tipsDuration, maybeDuration, speed, increaseSpeed, ...rest }:
|
|
17
|
+
declare function AnimationWaiter({ animationData, size, message, messageDuration, messageLoop, tips, tipsDuration, maybeDuration, speed, increaseSpeed, ...rest }: {
|
|
18
|
+
animationData?: object | undefined;
|
|
19
|
+
size?: string | number | undefined;
|
|
20
|
+
message?: string | import("react").ReactNode[] | undefined;
|
|
21
|
+
messageDuration?: number | undefined;
|
|
22
|
+
messageLoop?: boolean | undefined;
|
|
23
|
+
tips?: import("react").ReactNode[] | undefined;
|
|
24
|
+
tipsDuration?: number | undefined;
|
|
25
|
+
speed?: number | undefined;
|
|
26
|
+
maybeDuration?: number | undefined;
|
|
27
|
+
increaseSpeed?: number | undefined;
|
|
28
|
+
}): JSX.Element;
|
|
17
29
|
declare namespace AnimationWaiter {
|
|
18
30
|
namespace propTypes {
|
|
19
|
-
let animationData: PropTypes.Requireable<
|
|
31
|
+
let animationData: PropTypes.Requireable<object>;
|
|
20
32
|
let size: PropTypes.Requireable<NonNullable<string | number | null | undefined>>;
|
|
21
|
-
let message: PropTypes.Requireable<
|
|
33
|
+
let message: PropTypes.Requireable<NonNullable<string | PropTypes.ReactNodeLike[] | null | undefined>>;
|
|
22
34
|
let messageDuration: PropTypes.Requireable<number>;
|
|
23
35
|
let messageLoop: PropTypes.Requireable<boolean>;
|
|
24
|
-
let tips: PropTypes.Requireable<
|
|
36
|
+
let tips: PropTypes.Requireable<PropTypes.ReactNodeLike[]>;
|
|
25
37
|
let tipsDuration: PropTypes.Requireable<number>;
|
|
26
38
|
let speed: PropTypes.Requireable<number>;
|
|
27
39
|
let maybeDuration: PropTypes.Requireable<number>;
|
|
@@ -9,17 +9,18 @@ import { styled } from '../Theme';
|
|
|
9
9
|
/**
|
|
10
10
|
* 用于长时间等待的用的动画组件
|
|
11
11
|
* 动画会随着时间的变化而逐步加快播放速度,好适应用户的等待心理
|
|
12
|
-
* @param {
|
|
13
|
-
* @param {
|
|
14
|
-
* @param {
|
|
15
|
-
* @param {
|
|
16
|
-
* @param {
|
|
17
|
-
* @param {
|
|
18
|
-
* @param {
|
|
19
|
-
* @param {
|
|
20
|
-
* @param {
|
|
21
|
-
* @param {
|
|
22
|
-
* @
|
|
12
|
+
* @param {object} props - 组件属性
|
|
13
|
+
* @param {object} [props.animationData] - lottie json 动画数据
|
|
14
|
+
* @param {number|string} [props.size] - 动画的尺寸,单位px
|
|
15
|
+
* @param {string|React.ReactNode[]} [props.message] - 动画下方的文字;数组情况下会在一定时间切换文案
|
|
16
|
+
* @param {number} [props.messageDuration=5000] - 动画下方的文字为数组时,每个文案的持续时间(毫秒)
|
|
17
|
+
* @param {boolean} [props.messageLoop=true] - 动画下方的文字为数组时,文案是否循环播放
|
|
18
|
+
* @param {React.ReactNode[]} [props.tips=[]] - 底部的提示元素
|
|
19
|
+
* @param {number} [props.tipsDuration=5000] - 底部提示的切换时间(毫秒)
|
|
20
|
+
* @param {number} [props.speed=1] - 动画默认的播放速度
|
|
21
|
+
* @param {number} [props.maybeDuration=120000] - 整个动画大概的持续时间(毫秒),用于计算增量下的动画速度
|
|
22
|
+
* @param {number} [props.increaseSpeed=0] - 在 maybeDuration 时间下增加的速度
|
|
23
|
+
* @returns {JSX.Element}
|
|
23
24
|
*/
|
|
24
25
|
export default function AnimationWaiter({
|
|
25
26
|
animationData,
|
|
@@ -144,12 +145,12 @@ export default function AnimationWaiter({
|
|
|
144
145
|
});
|
|
145
146
|
}
|
|
146
147
|
AnimationWaiter.propTypes = {
|
|
147
|
-
animationData: PropTypes.
|
|
148
|
+
animationData: PropTypes.oneOfType([PropTypes.object, PropTypes.oneOf([null])]),
|
|
148
149
|
size: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
149
|
-
message: PropTypes.
|
|
150
|
+
message: PropTypes.oneOfType([PropTypes.string, PropTypes.arrayOf(PropTypes.node)]),
|
|
150
151
|
messageDuration: PropTypes.number,
|
|
151
152
|
messageLoop: PropTypes.bool,
|
|
152
|
-
tips: PropTypes.
|
|
153
|
+
tips: PropTypes.arrayOf(PropTypes.node),
|
|
153
154
|
tipsDuration: PropTypes.number,
|
|
154
155
|
speed: PropTypes.number,
|
|
155
156
|
maybeDuration: PropTypes.number,
|
package/lib/Async/index.d.ts
CHANGED
|
@@ -1,30 +1,63 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
Component: null;
|
|
5
|
-
error: null;
|
|
6
|
-
};
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export default function LoadAsyncComponent<T extends React.ComponentType<any>>(importComponent: () => Promise<Record<string, T>>, key?: string, showProgress?: boolean): {
|
|
3
|
+
new (props: React.ComponentProps<T>): {
|
|
7
4
|
componentDidMount(): void;
|
|
8
|
-
render(): import("react/jsx-runtime").JSX.Element | null;
|
|
5
|
+
render(): string | import("react/jsx-runtime").JSX.Element | null;
|
|
9
6
|
context: unknown;
|
|
10
|
-
setState<K extends
|
|
7
|
+
setState<K extends keyof {
|
|
8
|
+
Component: React.ComponentType<any> | null;
|
|
9
|
+
error: string | null;
|
|
10
|
+
}>(state: {
|
|
11
|
+
Component: React.ComponentType<any> | null;
|
|
12
|
+
error: string | null;
|
|
13
|
+
} | ((prevState: Readonly<{
|
|
14
|
+
Component: React.ComponentType<any> | null;
|
|
15
|
+
error: string | null;
|
|
16
|
+
}>, props: Readonly<React.ComponentProps<T>>) => {
|
|
17
|
+
Component: React.ComponentType<any> | null;
|
|
18
|
+
error: string | null;
|
|
19
|
+
} | Pick<{
|
|
20
|
+
Component: React.ComponentType<any> | null;
|
|
21
|
+
error: string | null;
|
|
22
|
+
}, K> | null) | Pick<{
|
|
23
|
+
Component: React.ComponentType<any> | null;
|
|
24
|
+
error: string | null;
|
|
25
|
+
}, K> | null, callback?: (() => void) | undefined): void;
|
|
11
26
|
forceUpdate(callback?: (() => void) | undefined): void;
|
|
12
|
-
readonly props: Readonly<
|
|
27
|
+
readonly props: Readonly<React.ComponentProps<T>>;
|
|
28
|
+
state: Readonly<{
|
|
29
|
+
Component: React.ComponentType<any> | null;
|
|
30
|
+
error: string | null;
|
|
31
|
+
}>;
|
|
13
32
|
refs: {
|
|
14
33
|
[key: string]: React.ReactInstance;
|
|
15
34
|
};
|
|
16
|
-
shouldComponentUpdate?(nextProps: Readonly<
|
|
35
|
+
shouldComponentUpdate?(nextProps: Readonly<React.ComponentProps<T>>, nextState: Readonly<{
|
|
36
|
+
Component: React.ComponentType<any> | null;
|
|
37
|
+
error: string | null;
|
|
38
|
+
}>, nextContext: any): boolean;
|
|
17
39
|
componentWillUnmount?(): void;
|
|
18
40
|
componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void;
|
|
19
|
-
getSnapshotBeforeUpdate?(prevProps: Readonly<
|
|
20
|
-
|
|
41
|
+
getSnapshotBeforeUpdate?(prevProps: Readonly<React.ComponentProps<T>>, prevState: Readonly<{
|
|
42
|
+
Component: React.ComponentType<any> | null;
|
|
43
|
+
error: string | null;
|
|
44
|
+
}>): any;
|
|
45
|
+
componentDidUpdate?(prevProps: Readonly<React.ComponentProps<T>>, prevState: Readonly<{
|
|
46
|
+
Component: React.ComponentType<any> | null;
|
|
47
|
+
error: string | null;
|
|
48
|
+
}>, snapshot?: any): void;
|
|
21
49
|
componentWillMount?(): void;
|
|
22
50
|
UNSAFE_componentWillMount?(): void;
|
|
23
|
-
componentWillReceiveProps?(nextProps: Readonly<
|
|
24
|
-
UNSAFE_componentWillReceiveProps?(nextProps: Readonly<
|
|
25
|
-
componentWillUpdate?(nextProps: Readonly<
|
|
26
|
-
|
|
51
|
+
componentWillReceiveProps?(nextProps: Readonly<React.ComponentProps<T>>, nextContext: any): void;
|
|
52
|
+
UNSAFE_componentWillReceiveProps?(nextProps: Readonly<React.ComponentProps<T>>, nextContext: any): void;
|
|
53
|
+
componentWillUpdate?(nextProps: Readonly<React.ComponentProps<T>>, nextState: Readonly<{
|
|
54
|
+
Component: React.ComponentType<any> | null;
|
|
55
|
+
error: string | null;
|
|
56
|
+
}>, nextContext: any): void;
|
|
57
|
+
UNSAFE_componentWillUpdate?(nextProps: Readonly<React.ComponentProps<T>>, nextState: Readonly<{
|
|
58
|
+
Component: React.ComponentType<any> | null;
|
|
59
|
+
error: string | null;
|
|
60
|
+
}>, nextContext: any): void;
|
|
27
61
|
};
|
|
28
62
|
contextType?: React.Context<any> | undefined;
|
|
29
63
|
};
|
|
30
|
-
import * as React from 'react';
|
package/lib/Badge/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
declare const _default: (props:
|
|
1
|
+
declare const _default: (props: Omit<BadgeProps, "ref"> & import("react").RefAttributes<HTMLSpanElement>) => import("react/jsx-runtime").JSX.Element;
|
|
2
2
|
export default _default;
|
|
3
3
|
/**
|
|
4
4
|
* Badge component to display notification badge
|
package/lib/Badge/index.js
CHANGED
|
@@ -79,7 +79,13 @@ Badge.defaultProps = {
|
|
|
79
79
|
className: '',
|
|
80
80
|
style: '{}'
|
|
81
81
|
};
|
|
82
|
-
export default withDeprecated(/*#__PURE__*/forwardRef(
|
|
82
|
+
export default withDeprecated(/*#__PURE__*/forwardRef(
|
|
83
|
+
/**
|
|
84
|
+
* @param {BadgeProps} props - Badge组件的属性
|
|
85
|
+
* @param {React.Ref<HTMLSpanElement>} ref - 转发的ref
|
|
86
|
+
* @returns {JSX.Element}
|
|
87
|
+
*/
|
|
88
|
+
(props, ref) => /*#__PURE__*/_jsx(Badge, {
|
|
83
89
|
...props,
|
|
84
90
|
forwardedRef: ref
|
|
85
91
|
})), {
|
|
@@ -1,31 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
export function BlockletProvider({ children, baseUrl, loading }: {
|
|
1
|
+
import type { Blocklet } from '../type';
|
|
2
|
+
declare const BlockletContext: import("react").Context<Blocklet | null>;
|
|
3
|
+
declare const Consumer: import("react").Consumer<Blocklet | null>;
|
|
4
|
+
declare function BlockletProvider({ children, baseUrl, loading, }: {
|
|
5
|
+
children: React.ReactNode;
|
|
6
|
+
/**
|
|
7
|
+
* baseUrl 为 blocklet origin + blocklet prefix
|
|
8
|
+
*/
|
|
10
9
|
baseUrl: string;
|
|
11
|
-
|
|
10
|
+
loading: React.ReactNode;
|
|
12
11
|
}): import("react/jsx-runtime").JSX.Element;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
let baseUrl: PropTypes.Requireable<string>;
|
|
16
|
-
let children: PropTypes.Validator<any>;
|
|
17
|
-
let loading: PropTypes.Requireable<any>;
|
|
18
|
-
}
|
|
19
|
-
namespace defaultProps {
|
|
20
|
-
let baseUrl_1: string;
|
|
21
|
-
export { baseUrl_1 as baseUrl };
|
|
22
|
-
let loading_1: null;
|
|
23
|
-
export { loading_1 as loading };
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
declare const Consumer: import("react").Consumer<any>;
|
|
27
|
-
export function useBlockletContext(): {
|
|
28
|
-
blocklet: any;
|
|
12
|
+
declare function useBlockletContext(): {
|
|
13
|
+
blocklet: Blocklet | null;
|
|
29
14
|
};
|
|
30
|
-
|
|
31
|
-
export { Consumer as BlockletConsumer };
|
|
15
|
+
export { BlockletContext, BlockletProvider, Consumer as BlockletConsumer, useBlockletContext };
|
|
@@ -1,24 +1,15 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
2
|
import { useMemoizedFn, useAsyncEffect } from 'ahooks';
|
|
4
3
|
import { createContext, useContext, useState } from 'react';
|
|
5
|
-
const BlockletContext = /*#__PURE__*/createContext();
|
|
4
|
+
const BlockletContext = /*#__PURE__*/createContext(null);
|
|
6
5
|
const {
|
|
7
6
|
Provider,
|
|
8
7
|
Consumer
|
|
9
8
|
} = BlockletContext;
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
*
|
|
13
|
-
* @param {object} props
|
|
14
|
-
* @param {string} props.baseUrl baseUrl 为 blocklet origin + blocklet prefix
|
|
15
|
-
* @param {any} props.children
|
|
16
|
-
* @returns
|
|
17
|
-
*/
|
|
18
9
|
function BlockletProvider({
|
|
19
10
|
children,
|
|
20
|
-
baseUrl,
|
|
21
|
-
loading
|
|
11
|
+
baseUrl = '',
|
|
12
|
+
loading = null
|
|
22
13
|
}) {
|
|
23
14
|
const [blockletData, setBlockletData] = useState(null);
|
|
24
15
|
const getBlockleData = useMemoizedFn(async () => {
|
|
@@ -53,13 +44,4 @@ function useBlockletContext() {
|
|
|
53
44
|
blocklet
|
|
54
45
|
};
|
|
55
46
|
}
|
|
56
|
-
BlockletProvider.propTypes = {
|
|
57
|
-
baseUrl: PropTypes.string,
|
|
58
|
-
children: PropTypes.any.isRequired,
|
|
59
|
-
loading: PropTypes.any
|
|
60
|
-
};
|
|
61
|
-
BlockletProvider.defaultProps = {
|
|
62
|
-
baseUrl: '',
|
|
63
|
-
loading: null
|
|
64
|
-
};
|
|
65
47
|
export { BlockletContext, BlockletProvider, Consumer as BlockletConsumer, useBlockletContext };
|
package/lib/Button/wrap.d.ts
CHANGED
|
@@ -5,7 +5,8 @@
|
|
|
5
5
|
* loading?: boolean,
|
|
6
6
|
* forwardedRef?: import('react').ForwardedRef<any>,
|
|
7
7
|
* color?: MuiButtonProps['color'] | 'reverse' | 'did'
|
|
8
|
-
* }
|
|
8
|
+
* }} CustomButtonProps
|
|
9
|
+
* @typedef { CustomButtonProps & Omit<MuiButtonProps, 'color'> } ButtonProps
|
|
9
10
|
*/
|
|
10
11
|
/**
|
|
11
12
|
* @typedef {React.ForwardRefExoticComponent<React.PropsWithoutRef<ButtonProps> & React.RefAttributes<HTMLButtonElement>>} ButtonComponent
|
|
@@ -18,10 +19,11 @@
|
|
|
18
19
|
*/
|
|
19
20
|
export default function _default(BaseComponent: import("@mui/material").ExtendButtonBase<import("@mui/material").ButtonTypeMap<{}, "button">>): ButtonComponent;
|
|
20
21
|
export type MuiButtonProps = import("@mui/material").ButtonProps;
|
|
21
|
-
export type
|
|
22
|
+
export type CustomButtonProps = {
|
|
22
23
|
rounded?: boolean;
|
|
23
24
|
loading?: boolean;
|
|
24
25
|
forwardedRef?: import("react").ForwardedRef<any>;
|
|
25
26
|
color?: MuiButtonProps["color"] | "reverse" | "did";
|
|
26
|
-
}
|
|
27
|
+
};
|
|
28
|
+
export type ButtonProps = CustomButtonProps & Omit<MuiButtonProps, "color">;
|
|
27
29
|
export type ButtonComponent = React.ForwardRefExoticComponent<React.PropsWithoutRef<ButtonProps> & React.RefAttributes<HTMLButtonElement>>;
|
package/lib/Button/wrap.js
CHANGED
|
@@ -36,7 +36,8 @@ const extendedColors = {
|
|
|
36
36
|
* loading?: boolean,
|
|
37
37
|
* forwardedRef?: import('react').ForwardedRef<any>,
|
|
38
38
|
* color?: MuiButtonProps['color'] | 'reverse' | 'did'
|
|
39
|
-
* }
|
|
39
|
+
* }} CustomButtonProps
|
|
40
|
+
* @typedef { CustomButtonProps & Omit<MuiButtonProps, 'color'> } ButtonProps
|
|
40
41
|
*/
|
|
41
42
|
|
|
42
43
|
/**
|
|
@@ -1,2 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
1
|
+
export default ButtonGroupComponent;
|
|
2
|
+
export type MuiButtonGroupProps = import("@mui/material").ButtonGroupProps;
|
|
3
|
+
export type ButtonGroupProps = import("../Button/wrap").CustomButtonProps & Omit<MuiButtonGroupProps, "color">;
|
|
4
|
+
/**
|
|
5
|
+
* @typedef {import('@mui/material').ButtonGroupProps} MuiButtonGroupProps
|
|
6
|
+
* @typedef {import('../Button/wrap').CustomButtonProps & Omit<MuiButtonGroupProps, 'color'>} ButtonGroupProps
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* @deprecated 建议直接使用 @mui/material/ButtonGroup
|
|
10
|
+
* @type {React.ForwardRefExoticComponent<React.PropsWithoutRef<ButtonGroupProps> & React.RefAttributes<HTMLButtonElement>>}
|
|
11
|
+
*/
|
|
12
|
+
declare const ButtonGroupComponent: React.ForwardRefExoticComponent<React.PropsWithoutRef<ButtonGroupProps> & React.RefAttributes<HTMLButtonElement>>;
|
package/lib/ButtonGroup/index.js
CHANGED
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
import ButtonGroup from '@mui/material/ButtonGroup';
|
|
2
2
|
import wrap from '../Button/wrap';
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
/**
|
|
5
|
+
* @typedef {import('@mui/material').ButtonGroupProps} MuiButtonGroupProps
|
|
6
|
+
* @typedef {import('../Button/wrap').CustomButtonProps & Omit<MuiButtonGroupProps, 'color'>} ButtonGroupProps
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* @deprecated 建议直接使用 @mui/material/ButtonGroup
|
|
11
|
+
* @type {React.ForwardRefExoticComponent<React.PropsWithoutRef<ButtonGroupProps> & React.RefAttributes<HTMLButtonElement>>}
|
|
12
|
+
*/
|
|
13
|
+
const ButtonGroupComponent = wrap(ButtonGroup);
|
|
14
|
+
|
|
15
|
+
// 该定制组件原本目的是调整 ButtonGroup 的圆角, 但最新设计规范已经不再使用较大的圆角, 改为使用 mui button 默认的圆角
|
|
16
|
+
export default ButtonGroupComponent;
|
|
@@ -1,34 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
list
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
let list: PropTypes.Requireable<any[]>;
|
|
12
|
-
let width: PropTypes.Requireable<number>;
|
|
13
|
-
let height: PropTypes.Requireable<number>;
|
|
14
|
-
let cardSpace: PropTypes.Requireable<number>;
|
|
15
|
-
let onSelect: PropTypes.Requireable<(...args: any[]) => any>;
|
|
16
|
-
let defaultIndex: PropTypes.Requireable<number>;
|
|
17
|
-
}
|
|
18
|
-
namespace defaultProps {
|
|
19
|
-
let list_1: string;
|
|
20
|
-
export { list_1 as list };
|
|
21
|
-
let width_1: number;
|
|
22
|
-
export { width_1 as width };
|
|
23
|
-
let height_1: number;
|
|
24
|
-
export { height_1 as height };
|
|
25
|
-
let cardSpace_1: number;
|
|
26
|
-
export { cardSpace_1 as cardSpace };
|
|
27
|
-
export { noop as onSelect };
|
|
28
|
-
let defaultIndex_1: number;
|
|
29
|
-
export { defaultIndex_1 as defaultIndex };
|
|
30
|
-
}
|
|
1
|
+
export interface CardSelectorProps {
|
|
2
|
+
list?: Array<{
|
|
3
|
+
src: string;
|
|
4
|
+
name: string;
|
|
5
|
+
}> | Array<(i: number) => React.ReactNode>;
|
|
6
|
+
width?: number;
|
|
7
|
+
height?: number;
|
|
8
|
+
cardSpace?: number;
|
|
9
|
+
onSelect?: (index: number) => void;
|
|
10
|
+
defaultIndex?: number;
|
|
31
11
|
}
|
|
32
|
-
export default CardSelector;
|
|
33
|
-
import PropTypes from 'prop-types';
|
|
34
|
-
import noop from 'lodash/noop';
|
|
12
|
+
export default function CardSelector({ list, width, height, cardSpace, onSelect, defaultIndex, }: CardSelectorProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
/* eslint-disable no-unused-vars */
|
|
2
3
|
import { useState, useEffect, useRef } from 'react';
|
|
3
4
|
import styled from '@emotion/styled';
|
|
4
|
-
import PropTypes from 'prop-types';
|
|
5
5
|
import noop from 'lodash/noop';
|
|
6
6
|
export default function CardSelector({
|
|
7
|
-
list,
|
|
8
|
-
width,
|
|
9
|
-
height,
|
|
10
|
-
cardSpace,
|
|
11
|
-
onSelect,
|
|
12
|
-
defaultIndex
|
|
7
|
+
list = [],
|
|
8
|
+
width = 300,
|
|
9
|
+
height = 400,
|
|
10
|
+
cardSpace = 40,
|
|
11
|
+
onSelect = noop,
|
|
12
|
+
defaultIndex = 0
|
|
13
13
|
}) {
|
|
14
14
|
const [selectedId, setSelectedId] = useState(0);
|
|
15
15
|
const [translateX, setTranslateX] = useState(0);
|
|
@@ -21,16 +21,16 @@ export default function CardSelector({
|
|
|
21
21
|
return;
|
|
22
22
|
}
|
|
23
23
|
setSelectedId(i);
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
24
|
+
if (outterCon.current) {
|
|
25
|
+
// 外部容器大小
|
|
26
|
+
const outerWidth = outterCon.current.clientWidth;
|
|
27
|
+
setTranslateX(i * (width + cardSpace) - (outerWidth - width) / 2 + cardSpace * 0.5);
|
|
28
|
+
}
|
|
28
29
|
onSelect(i);
|
|
29
30
|
};
|
|
30
31
|
useEffect(() => {
|
|
31
32
|
selectedItem(defaultIndex);
|
|
32
|
-
|
|
33
|
-
outterCon.current.addEventListener('touchmove', func, {
|
|
33
|
+
outterCon.current?.addEventListener('touchmove', e => e.preventDefault(), {
|
|
34
34
|
passive: false
|
|
35
35
|
});
|
|
36
36
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
@@ -51,7 +51,7 @@ export default function CardSelector({
|
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
53
|
};
|
|
54
|
-
return /*#__PURE__*/_jsx(
|
|
54
|
+
return /*#__PURE__*/_jsx(Container, {
|
|
55
55
|
ref: outterCon,
|
|
56
56
|
onTouchStart: touchstart,
|
|
57
57
|
onTouchEnd: touchend,
|
|
@@ -96,7 +96,7 @@ export default function CardSelector({
|
|
|
96
96
|
})
|
|
97
97
|
});
|
|
98
98
|
}
|
|
99
|
-
const
|
|
99
|
+
const Container = styled.div`
|
|
100
100
|
overflow: hidden;
|
|
101
101
|
mask-image: linear-gradient(to left, transparent, black 3%, black 97%, transparent);
|
|
102
102
|
overflow: hidden;
|
|
@@ -130,20 +130,4 @@ const Contianer = styled.div`
|
|
|
130
130
|
}
|
|
131
131
|
}
|
|
132
132
|
}
|
|
133
|
-
`;
|
|
134
|
-
CardSelector.propTypes = {
|
|
135
|
-
list: PropTypes.array,
|
|
136
|
-
width: PropTypes.number,
|
|
137
|
-
height: PropTypes.number,
|
|
138
|
-
cardSpace: PropTypes.number,
|
|
139
|
-
onSelect: PropTypes.func,
|
|
140
|
-
defaultIndex: PropTypes.number
|
|
141
|
-
};
|
|
142
|
-
CardSelector.defaultProps = {
|
|
143
|
-
list: '',
|
|
144
|
-
width: 300,
|
|
145
|
-
height: 400,
|
|
146
|
-
cardSpace: 40,
|
|
147
|
-
onSelect: noop,
|
|
148
|
-
defaultIndex: 0
|
|
149
|
-
};
|
|
133
|
+
`;
|
package/lib/Center/index.d.ts
CHANGED
|
@@ -1,22 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
declare function Center({ children, relative }: {
|
|
8
|
-
children: any;
|
|
9
|
-
relative?: "screen" | "parent" | undefined;
|
|
1
|
+
export default function Center({ children, relative, }: {
|
|
2
|
+
children: React.ReactNode;
|
|
3
|
+
/**
|
|
4
|
+
* 容器相对尺寸,默认相对屏幕(screen),可设置为父容器(parent)
|
|
5
|
+
*/
|
|
6
|
+
relative?: 'screen' | 'parent';
|
|
10
7
|
}): import("react/jsx-runtime").JSX.Element;
|
|
11
|
-
declare namespace Center {
|
|
12
|
-
namespace propTypes {
|
|
13
|
-
let children: PropTypes.Validator<any>;
|
|
14
|
-
let relative: PropTypes.Requireable<string>;
|
|
15
|
-
}
|
|
16
|
-
namespace defaultProps {
|
|
17
|
-
let relative_1: string;
|
|
18
|
-
export { relative_1 as relative };
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
export default Center;
|
|
22
|
-
import PropTypes from 'prop-types';
|
package/lib/Center/index.js
CHANGED
|
@@ -1,16 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
2
|
import { styled } from '../Theme';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* @param {Object} props 属性
|
|
7
|
-
* @param {*} props.children 子元素
|
|
8
|
-
* @param {'screen'|'parent'} [props.relative='screen'] 容器相对尺寸,默认相对屏幕(screen),可设置为父容器(parent)
|
|
9
|
-
* @returns react component element
|
|
10
|
-
*/
|
|
11
3
|
export default function Center({
|
|
12
4
|
children,
|
|
13
|
-
relative
|
|
5
|
+
relative = 'screen'
|
|
14
6
|
}) {
|
|
15
7
|
let style = {};
|
|
16
8
|
if (relative === 'parent') {
|
|
@@ -32,11 +24,4 @@ const Div = styled('div')`
|
|
|
32
24
|
display: flex;
|
|
33
25
|
justify-content: center;
|
|
34
26
|
align-items: center;
|
|
35
|
-
`;
|
|
36
|
-
Center.propTypes = {
|
|
37
|
-
children: PropTypes.any.isRequired,
|
|
38
|
-
relative: PropTypes.string
|
|
39
|
-
};
|
|
40
|
-
Center.defaultProps = {
|
|
41
|
-
relative: 'screen'
|
|
42
|
-
};
|
|
27
|
+
`;
|
|
@@ -1,27 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
})
|
|
8
|
-
|
|
9
|
-
namespace propTypes {
|
|
10
|
-
let content: PropTypes.Requireable<string>;
|
|
11
|
-
let locale: PropTypes.Requireable<string>;
|
|
12
|
-
let render: PropTypes.Requireable<(...args: any[]) => any>;
|
|
13
|
-
let showTooltip: PropTypes.Requireable<boolean>;
|
|
14
|
-
}
|
|
15
|
-
namespace defaultProps {
|
|
16
|
-
let content_1: string;
|
|
17
|
-
export { content_1 as content };
|
|
18
|
-
let locale_1: string;
|
|
19
|
-
export { locale_1 as locale };
|
|
20
|
-
let render_1: undefined;
|
|
21
|
-
export { render_1 as render };
|
|
22
|
-
let showTooltip_1: boolean;
|
|
23
|
-
export { showTooltip_1 as showTooltip };
|
|
24
|
-
}
|
|
1
|
+
export interface CopyButtonProps extends React.HTMLAttributes<HTMLSpanElement> {
|
|
2
|
+
content?: string;
|
|
3
|
+
locale?: 'en' | 'zh';
|
|
4
|
+
render?: (props: {
|
|
5
|
+
copyButton: React.ReactNode;
|
|
6
|
+
containerRef: React.RefObject<HTMLElement>;
|
|
7
|
+
}) => React.ReactNode;
|
|
8
|
+
showTooltip?: boolean;
|
|
25
9
|
}
|
|
26
|
-
export default CopyButton;
|
|
27
|
-
import PropTypes from 'prop-types';
|
|
10
|
+
export default function CopyButton({ content, locale, render, showTooltip, ...rest }: CopyButtonProps): string | number | boolean | Iterable<import("react").ReactNode> | import("react/jsx-runtime").JSX.Element | null | undefined;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
|
|
2
|
+
/* eslint-disable no-unused-vars */
|
|
3
3
|
import Tooltip from '@mui/material/Tooltip';
|
|
4
4
|
import { green } from '@mui/material/colors';
|
|
5
5
|
import CopyIcon from '@mui/icons-material/ContentCopy';
|
|
6
6
|
import CheckIcon from '@mui/icons-material/Check';
|
|
7
7
|
import useCopy from './hook';
|
|
8
8
|
export default function CopyButton({
|
|
9
|
-
content,
|
|
10
|
-
locale,
|
|
9
|
+
content = '',
|
|
10
|
+
locale = 'en',
|
|
11
11
|
render,
|
|
12
|
-
showTooltip,
|
|
12
|
+
showTooltip = true,
|
|
13
13
|
...rest
|
|
14
14
|
}) {
|
|
15
15
|
const {
|
|
@@ -57,16 +57,4 @@ export default function CopyButton({
|
|
|
57
57
|
});
|
|
58
58
|
}
|
|
59
59
|
return copyButton;
|
|
60
|
-
}
|
|
61
|
-
CopyButton.propTypes = {
|
|
62
|
-
content: PropTypes.string,
|
|
63
|
-
locale: PropTypes.oneOf(['en', 'zh']),
|
|
64
|
-
render: PropTypes.func,
|
|
65
|
-
showTooltip: PropTypes.bool
|
|
66
|
-
};
|
|
67
|
-
CopyButton.defaultProps = {
|
|
68
|
-
content: '',
|
|
69
|
-
locale: 'en',
|
|
70
|
-
render: undefined,
|
|
71
|
-
showTooltip: true
|
|
72
|
-
};
|
|
60
|
+
}
|