@arcblock/ux 2.10.36 → 2.10.37
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/Address/compact-text.d.ts +27 -0
- package/lib/Address/did-address.d.ts +16 -0
- package/lib/Address/index.d.ts +15 -0
- package/lib/Address/responsive-did-address.d.ts +33 -0
- package/lib/AnimationWaiter/index.d.ts +54 -0
- package/lib/Async/index.d.ts +30 -0
- package/lib/BlockletContext/index.d.ts +31 -0
- package/lib/BlockletV2/blocklet.d.ts +18 -0
- package/lib/BlockletV2/blocklet.js +156 -0
- package/lib/BlockletV2/components/icon-text.d.ts +7 -0
- package/lib/BlockletV2/components/icon-text.js +30 -0
- package/lib/BlockletV2/index.d.ts +4 -0
- package/lib/BlockletV2/index.js +4 -0
- package/lib/BlockletV2/utils.d.ts +4 -0
- package/lib/BlockletV2/utils.js +71 -0
- package/lib/Button/wrap.js +2 -2
- package/lib/ButtonGroup/index.d.ts +2 -0
- package/lib/CardSelector/index.d.ts +34 -0
- package/lib/Center/index.d.ts +18 -0
- package/lib/ClickToCopy/copy-button.d.ts +27 -0
- package/lib/ClickToCopy/hook.d.ts +9 -0
- package/lib/ClickToCopy/index.d.ts +32 -0
- package/lib/CodeBlock/LightBox.d.ts +5 -0
- package/lib/CodeBlock/index.d.ts +27 -0
- package/lib/ContactForm/index.d.ts +41 -0
- package/lib/CookieConsent/index.d.ts +34 -0
- package/lib/CountDown/index.d.ts +30 -0
- package/lib/DID/index.d.ts +23 -0
- package/lib/DidLogo/index.d.ts +26 -0
- package/lib/DriftBot/index.d.ts +24 -0
- package/lib/Earth/index.d.ts +2 -0
- package/lib/Earth/util.d.ts +7 -0
- package/lib/ErrorBoundary/fallback.d.ts +21 -0
- package/lib/ErrorBoundary/index.d.ts +1 -0
- package/lib/Footer/index.d.ts +27 -0
- package/lib/Header/auto-hidden.d.ts +14 -0
- package/lib/Header/header.d.ts +55 -0
- package/lib/Header/index.d.ts +2 -0
- package/lib/Header/responsive-header.d.ts +29 -0
- package/lib/Icon/image.d.ts +37 -0
- package/lib/InfoRow/index.d.ts +33 -0
- package/lib/Layout/dashboard/external-link.d.ts +15 -0
- package/lib/Layout/dashboard/full-page.d.ts +12 -0
- package/lib/Layout/dashboard/index.d.ts +40 -0
- package/lib/Layout/dashboard/sidebar.d.ts +21 -0
- package/lib/Layout/dashboard-legacy/header.d.ts +37 -0
- package/lib/Layout/dashboard-legacy/index.d.ts +57 -0
- package/lib/Layout/dashboard-legacy/sidebar.d.ts +27 -0
- package/lib/Layout/index.d.ts +57 -0
- package/lib/LoadingMask/index.d.ts +32 -0
- package/lib/Locale/browser-lang.d.ts +2 -0
- package/lib/Locale/context.d.ts +39 -0
- package/lib/Locale/languages.d.ts +57 -0
- package/lib/Locale/selector.d.ts +27 -0
- package/lib/Locale/util.d.ts +3 -0
- package/lib/Metric/index.d.ts +32 -0
- package/lib/MuiWrap/index.d.ts +3 -2
- package/lib/NFTDisplay/aspect-ratio-container.d.ts +13 -0
- package/lib/NFTDisplay/broken.d.ts +14 -0
- package/lib/NFTDisplay/displayApi.d.ts +2 -0
- package/lib/NFTDisplay/index.d.ts +12 -0
- package/lib/NFTDisplay/loading.d.ts +1 -0
- package/lib/NFTDisplay/svg-embedder/img.d.ts +24 -0
- package/lib/NFTDisplay/svg-embedder/inline-svg.d.ts +14 -0
- package/lib/NavMenu/index.d.ts +1 -0
- package/lib/NavMenu/nav-menu.d.ts +56 -0
- package/lib/NavMenu/style.d.ts +2 -0
- package/lib/PageScroller/index.d.ts +2 -0
- package/lib/PageScroller/story/FifthComponent.d.ts +1 -0
- package/lib/PageScroller/story/FirstComponent.d.ts +1 -0
- package/lib/PageScroller/story/FourthComponent.d.ts +1 -0
- package/lib/PageScroller/story/FullPage.d.ts +1 -0
- package/lib/PageScroller/story/PageContain.d.ts +1 -0
- package/lib/PageScroller/story/SecondComponent.d.ts +1 -0
- package/lib/PageScroller/story/ThirdComponent.d.ts +1 -0
- package/lib/PageScroller/usePrevValue.d.ts +1 -0
- package/lib/Passport/index.d.ts +2 -0
- package/lib/Passport/passport.d.ts +31 -0
- package/lib/PoweredByArcBlock/index.d.ts +15 -0
- package/lib/PricingTable/PricingPlan.d.ts +10 -0
- package/lib/PricingTable/index.d.ts +2 -0
- package/lib/QRCode/index.d.ts +23 -0
- package/lib/RelativeTime/index.d.ts +41 -0
- package/lib/Result/common.d.ts +52 -0
- package/lib/Result/index.d.ts +19 -0
- package/lib/Result/result.d.ts +30 -0
- package/lib/Result/translations.d.ts +55 -0
- package/lib/Screenshot/BaseScreenshot/index.d.ts +25 -0
- package/lib/Screenshot/BaseScreenshot/shells/Macbook.d.ts +21 -0
- package/lib/Screenshot/BaseScreenshot/shells/Phone.d.ts +21 -0
- package/lib/Screenshot/index.d.ts +29 -0
- package/lib/SessionBlocklet/index.d.ts +20 -0
- package/lib/SessionManager/index.d.ts +2 -0
- package/lib/SessionPermission/index.d.ts +18 -0
- package/lib/SessionUser/components/logged-in.d.ts +32 -0
- package/lib/SessionUser/components/session-user-item.d.ts +2 -0
- package/lib/SessionUser/components/session-user-switch.d.ts +22 -0
- package/lib/SessionUser/components/un-login.d.ts +24 -0
- package/lib/SessionUser/components/user-info.d.ts +30 -0
- package/lib/SessionUser/index.d.ts +31 -0
- package/lib/SessionUser/libs/translation.d.ts +31 -0
- package/lib/SessionUser/libs/utils.d.ts +9 -0
- package/lib/Sparkline/index.d.ts +1 -0
- package/lib/Spinner/index.d.ts +2 -0
- package/lib/SplitButton/index.d.ts +2 -1
- package/lib/SplitButton/index.js +1 -1
- package/lib/Success/index.d.ts +22 -0
- package/lib/Tabs/index.d.ts +27 -0
- package/lib/TextCollapse/index.d.ts +2 -0
- package/lib/Typography/index.d.ts +25 -0
- package/lib/Util/federated.d.ts +61 -0
- package/lib/Util/passport.d.ts +33 -0
- package/lib/Util/wallet.d.ts +3 -0
- package/lib/Video/index.d.ts +19 -0
- package/lib/Wallet/Action.d.ts +21 -0
- package/lib/Wallet/Download.d.ts +33 -0
- package/lib/Wallet/Open.d.ts +16 -0
- package/lib/WalletOSIcon/index.d.ts +26 -0
- package/lib/WebWalletSWKeeper/index.d.ts +21 -0
- package/lib/WechatPrompt/index.d.ts +1 -0
- package/lib/index.d.ts +36 -0
- package/lib/withTheme/index.d.ts +7 -0
- package/lib/withTracker/error_boundary.d.ts +9 -0
- package/lib/withTracker/index.d.ts +2 -0
- package/package.json +10 -7
- package/src/BlockletV2/blocklet.tsx +130 -0
- package/src/BlockletV2/components/icon-text.tsx +29 -0
- package/src/BlockletV2/index.ts +5 -0
- package/src/BlockletV2/utils.js +75 -0
- package/src/Button/wrap.js +9 -5
- package/src/MuiWrap/index.tsx +3 -2
- package/src/SplitButton/index.tsx +2 -2
@@ -0,0 +1,27 @@
|
|
1
|
+
/**
|
2
|
+
* 紧凑文本组件 (显示首尾, 中间截断显示省略号), 仅考虑等宽字体的情况
|
3
|
+
*/
|
4
|
+
declare function CompactText({ startChars, endChars, children, showCopyButtonInTooltip }: {
|
5
|
+
startChars: any;
|
6
|
+
endChars: any;
|
7
|
+
children: any;
|
8
|
+
showCopyButtonInTooltip: any;
|
9
|
+
}): import("react/jsx-runtime").JSX.Element;
|
10
|
+
declare namespace CompactText {
|
11
|
+
namespace propTypes {
|
12
|
+
let startChars: PropTypes.Requireable<number>;
|
13
|
+
let endChars: PropTypes.Requireable<number>;
|
14
|
+
let children: PropTypes.Validator<NonNullable<PropTypes.ReactNodeLike>>;
|
15
|
+
let showCopyButtonInTooltip: PropTypes.Requireable<boolean>;
|
16
|
+
}
|
17
|
+
namespace defaultProps {
|
18
|
+
let startChars_1: number;
|
19
|
+
export { startChars_1 as startChars };
|
20
|
+
let endChars_1: number;
|
21
|
+
export { endChars_1 as endChars };
|
22
|
+
let showCopyButtonInTooltip_1: boolean;
|
23
|
+
export { showCopyButtonInTooltip_1 as showCopyButtonInTooltip };
|
24
|
+
}
|
25
|
+
}
|
26
|
+
export default CompactText;
|
27
|
+
import PropTypes from 'prop-types';
|
@@ -0,0 +1,16 @@
|
|
1
|
+
export default DidAddress;
|
2
|
+
/**
|
3
|
+
* DidAddress 组件 (新版设计)
|
4
|
+
*
|
5
|
+
* - 样式调整
|
6
|
+
* - click-to-copy 调整
|
7
|
+
* - 长文本截断处理 (Ellipsis)
|
8
|
+
* - 支持 inline 或 block 的显示方式
|
9
|
+
* - 支持紧凑模式, 该模式下:
|
10
|
+
* - 占用宽度较小, 因此不考虑水平空间不够用的情况, 且忽略末尾省略号
|
11
|
+
* - 对于多层元素结构的 children, 保持元素结构, 将最内层 text 替换为 CompactText 组件
|
12
|
+
* - 为保证 copy 功能正常工作, 原 children 始终渲染, 但在紧凑式下会隐藏
|
13
|
+
* - 可配合 useMediaQuery 使用
|
14
|
+
*/
|
15
|
+
declare const DidAddress: React.ForwardRefExoticComponent<React.RefAttributes<any>>;
|
16
|
+
import React from 'react';
|
@@ -0,0 +1,15 @@
|
|
1
|
+
declare function DidAddressWrapper({ responsive, ...rest }: {
|
2
|
+
[x: string]: any;
|
3
|
+
responsive: any;
|
4
|
+
}): import("react/jsx-runtime").JSX.Element;
|
5
|
+
declare namespace DidAddressWrapper {
|
6
|
+
namespace propTypes {
|
7
|
+
let responsive: PropTypes.Requireable<boolean>;
|
8
|
+
}
|
9
|
+
namespace defaultProps {
|
10
|
+
let responsive_1: boolean;
|
11
|
+
export { responsive_1 as responsive };
|
12
|
+
}
|
13
|
+
}
|
14
|
+
export default DidAddressWrapper;
|
15
|
+
import PropTypes from 'prop-types';
|
@@ -0,0 +1,33 @@
|
|
1
|
+
/**
|
2
|
+
* 根据父容器宽度自动切换 compact 模式
|
3
|
+
*
|
4
|
+
* 实现逻辑:
|
5
|
+
* - DidAddress 外层包裹一个容器, 其宽度自动撑满父容器宽度 (即这个容器需要是块级元素或 100% 宽的 inline-block)
|
6
|
+
* - DidAddress 本身以 inline 形式渲染 (方便探测 did-address 的 full-width)
|
7
|
+
* - 组件 mounted 时记录 did address 的 full-width (非 compact 模式的宽度)
|
8
|
+
* - 监听容器宽度变化, 当容器宽度变化时, 对比容器宽度和 did address full-width, => 切换 compact 模式
|
9
|
+
* - TODO: 初始化时, 在确定是否应该以 compact 模式渲染前, 隐藏显示, 避免闪烁问题
|
10
|
+
*/
|
11
|
+
declare function ResponsiveDidAddress({ style, className, component, ...rest }: {
|
12
|
+
[x: string]: any;
|
13
|
+
style: any;
|
14
|
+
className: any;
|
15
|
+
component: any;
|
16
|
+
}): import("react/jsx-runtime").JSX.Element;
|
17
|
+
declare namespace ResponsiveDidAddress {
|
18
|
+
namespace propTypes {
|
19
|
+
let style: PropTypes.Requireable<object>;
|
20
|
+
let className: PropTypes.Requireable<string>;
|
21
|
+
let component: PropTypes.Requireable<string>;
|
22
|
+
}
|
23
|
+
namespace defaultProps {
|
24
|
+
let style_1: {};
|
25
|
+
export { style_1 as style };
|
26
|
+
let className_1: string;
|
27
|
+
export { className_1 as className };
|
28
|
+
let component_1: string;
|
29
|
+
export { component_1 as component };
|
30
|
+
}
|
31
|
+
}
|
32
|
+
export default ResponsiveDidAddress;
|
33
|
+
import PropTypes from 'prop-types';
|
@@ -0,0 +1,54 @@
|
|
1
|
+
/**
|
2
|
+
* 用于长时间等待的用的动画组件
|
3
|
+
* 动画会随着时间的变化而逐步加快播放速度,好适应用户的等待心理
|
4
|
+
* @param {Object} animationData lottie json 动画数据
|
5
|
+
* @param {Number} size 动画的尺寸,单位px
|
6
|
+
* @param {String|Array} message 动画下方的文字;数组情况下会在一定时间切换文案
|
7
|
+
* @param {Number} messageDuration 动画下方的文字为数组时,每个文案的持续时间;默认5000ms
|
8
|
+
* @param {Number} messageLoop 动画下方的文字为数组时,文案是否循环播放
|
9
|
+
* @param {Array} tips 底部的提示元素
|
10
|
+
* @param {Number} tipsDuration 底部提示的切换时间,单位毫秒,默认3000ms
|
11
|
+
* @param {Number} speed 动画默认的播放速度
|
12
|
+
* @param {Number} maybeDuration 整个动画大概的持续时间,单位毫秒,用于计算增量下的动画速度,默认两分钟(120000ms)
|
13
|
+
* @param {Number} increaseSpeed 在 maybeDuration 时间下增加的速度,默认为0(不增加速度)
|
14
|
+
* @returns element
|
15
|
+
*/
|
16
|
+
declare function AnimationWaiter({ animationData, size, message, messageDuration, messageLoop, tips, tipsDuration, maybeDuration, speed, increaseSpeed, ...rest }: Object): import("react/jsx-runtime").JSX.Element;
|
17
|
+
declare namespace AnimationWaiter {
|
18
|
+
namespace propTypes {
|
19
|
+
let animationData: PropTypes.Requireable<any>;
|
20
|
+
let size: PropTypes.Requireable<NonNullable<string | number | null | undefined>>;
|
21
|
+
let message: PropTypes.Requireable<any>;
|
22
|
+
let messageDuration: PropTypes.Requireable<number>;
|
23
|
+
let messageLoop: PropTypes.Requireable<boolean>;
|
24
|
+
let tips: PropTypes.Requireable<any[]>;
|
25
|
+
let tipsDuration: PropTypes.Requireable<number>;
|
26
|
+
let speed: PropTypes.Requireable<number>;
|
27
|
+
let maybeDuration: PropTypes.Requireable<number>;
|
28
|
+
let increaseSpeed: PropTypes.Requireable<number>;
|
29
|
+
}
|
30
|
+
namespace defaultProps {
|
31
|
+
let animationData_1: null;
|
32
|
+
export { animationData_1 as animationData };
|
33
|
+
let size_1: string;
|
34
|
+
export { size_1 as size };
|
35
|
+
let message_1: string;
|
36
|
+
export { message_1 as message };
|
37
|
+
let messageDuration_1: number;
|
38
|
+
export { messageDuration_1 as messageDuration };
|
39
|
+
let messageLoop_1: boolean;
|
40
|
+
export { messageLoop_1 as messageLoop };
|
41
|
+
let tips_1: never[];
|
42
|
+
export { tips_1 as tips };
|
43
|
+
let tipsDuration_1: number;
|
44
|
+
export { tipsDuration_1 as tipsDuration };
|
45
|
+
let speed_1: number;
|
46
|
+
export { speed_1 as speed };
|
47
|
+
let maybeDuration_1: number;
|
48
|
+
export { maybeDuration_1 as maybeDuration };
|
49
|
+
let increaseSpeed_1: number;
|
50
|
+
export { increaseSpeed_1 as increaseSpeed };
|
51
|
+
}
|
52
|
+
}
|
53
|
+
export default AnimationWaiter;
|
54
|
+
import PropTypes from 'prop-types';
|
@@ -0,0 +1,30 @@
|
|
1
|
+
export default function LoadAsyncComponent(importComponent: any, key?: string, showProgress?: boolean): {
|
2
|
+
new (props: any): {
|
3
|
+
state: {
|
4
|
+
Component: null;
|
5
|
+
error: null;
|
6
|
+
};
|
7
|
+
componentDidMount(): void;
|
8
|
+
render(): import("react/jsx-runtime").JSX.Element | null;
|
9
|
+
context: unknown;
|
10
|
+
setState<K extends string | number | symbol>(state: any, callback?: (() => void) | undefined): void;
|
11
|
+
forceUpdate(callback?: (() => void) | undefined): void;
|
12
|
+
readonly props: Readonly<any>;
|
13
|
+
refs: {
|
14
|
+
[key: string]: React.ReactInstance;
|
15
|
+
};
|
16
|
+
shouldComponentUpdate?(nextProps: Readonly<any>, nextState: Readonly<any>, nextContext: any): boolean;
|
17
|
+
componentWillUnmount?(): void;
|
18
|
+
componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void;
|
19
|
+
getSnapshotBeforeUpdate?(prevProps: Readonly<any>, prevState: Readonly<any>): any;
|
20
|
+
componentDidUpdate?(prevProps: Readonly<any>, prevState: Readonly<any>, snapshot?: any): void;
|
21
|
+
componentWillMount?(): void;
|
22
|
+
UNSAFE_componentWillMount?(): void;
|
23
|
+
componentWillReceiveProps?(nextProps: Readonly<any>, nextContext: any): void;
|
24
|
+
UNSAFE_componentWillReceiveProps?(nextProps: Readonly<any>, nextContext: any): void;
|
25
|
+
componentWillUpdate?(nextProps: Readonly<any>, nextState: Readonly<any>, nextContext: any): void;
|
26
|
+
UNSAFE_componentWillUpdate?(nextProps: Readonly<any>, nextState: Readonly<any>, nextContext: any): void;
|
27
|
+
};
|
28
|
+
contextType?: React.Context<any> | undefined;
|
29
|
+
};
|
30
|
+
import * as React from 'react';
|
@@ -0,0 +1,31 @@
|
|
1
|
+
export const BlockletContext: import("react").Context<any>;
|
2
|
+
/**
|
3
|
+
*
|
4
|
+
* @param {object} props
|
5
|
+
* @param {string} props.baseUrl baseUrl 为 blocklet origin + blocklet prefix
|
6
|
+
* @param {any} props.children
|
7
|
+
* @returns
|
8
|
+
*/
|
9
|
+
export function BlockletProvider({ children, baseUrl, loading }: {
|
10
|
+
baseUrl: string;
|
11
|
+
children: any;
|
12
|
+
}): import("react/jsx-runtime").JSX.Element;
|
13
|
+
export namespace BlockletProvider {
|
14
|
+
namespace propTypes {
|
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;
|
29
|
+
};
|
30
|
+
import PropTypes from 'prop-types';
|
31
|
+
export { Consumer as BlockletConsumer };
|
@@ -0,0 +1,18 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
export interface IBlockletStore extends Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, 'title' | 'className'> {
|
3
|
+
did?: string;
|
4
|
+
title: string;
|
5
|
+
description?: string;
|
6
|
+
cover?: string;
|
7
|
+
avatar: string;
|
8
|
+
author: string;
|
9
|
+
download: string;
|
10
|
+
button?: React.ReactNode;
|
11
|
+
buttonText?: string;
|
12
|
+
buttonDisabled?: boolean;
|
13
|
+
buttonLoading?: boolean;
|
14
|
+
onButtonClick?: Function;
|
15
|
+
onMainClick?: Function;
|
16
|
+
className?: string;
|
17
|
+
}
|
18
|
+
export default function BlockletStore(props: IBlockletStore): import("react/jsx-runtime").JSX.Element;
|
@@ -0,0 +1,156 @@
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
2
|
+
import React, { isValidElement } from 'react';
|
3
|
+
import Download from '@iconify-icons/tabler/cloud-download';
|
4
|
+
import { Icon } from '@iconify/react';
|
5
|
+
import { Card, CardContent, CircularProgress, Stack, Typography } from '@mui/material';
|
6
|
+
import Avatar from '../Avatar';
|
7
|
+
import Button from '../Button';
|
8
|
+
import { useTheme } from '../Theme';
|
9
|
+
import IconText from './components/icon-text';
|
10
|
+
import { formatDownloadCount, strippedString } from './utils';
|
11
|
+
export default function BlockletStore(props) {
|
12
|
+
const {
|
13
|
+
title,
|
14
|
+
description = '',
|
15
|
+
cover = '',
|
16
|
+
avatar,
|
17
|
+
author,
|
18
|
+
download,
|
19
|
+
did,
|
20
|
+
buttonText = 'Install',
|
21
|
+
buttonDisabled,
|
22
|
+
buttonLoading,
|
23
|
+
button,
|
24
|
+
onButtonClick = () => {},
|
25
|
+
onMainClick,
|
26
|
+
className,
|
27
|
+
ref,
|
28
|
+
...rest
|
29
|
+
} = props;
|
30
|
+
const theme = useTheme();
|
31
|
+
const wrapHandler = (handler, stopFn = () => false) => (e, ...args) => {
|
32
|
+
const isFunction = handler instanceof Function;
|
33
|
+
if (stopFn() || isFunction) {
|
34
|
+
e.preventDefault();
|
35
|
+
e.stopPropagation();
|
36
|
+
if (isFunction) {
|
37
|
+
handler(...args);
|
38
|
+
}
|
39
|
+
}
|
40
|
+
};
|
41
|
+
const handleMainClick = onMainClick && wrapHandler(onMainClick);
|
42
|
+
const handleButtonClick = wrapHandler(onButtonClick, () => {
|
43
|
+
// stop click while custom button or buttonDisabled or buttonLoading
|
44
|
+
return !!(button || buttonDisabled || buttonLoading);
|
45
|
+
});
|
46
|
+
const titleProps = /*#__PURE__*/isValidElement(title) ? {
|
47
|
+
children: title
|
48
|
+
} : {
|
49
|
+
title: strippedString(title),
|
50
|
+
dangerouslySetInnerHTML: {
|
51
|
+
__html: title
|
52
|
+
}
|
53
|
+
};
|
54
|
+
const descriptionProps = /*#__PURE__*/isValidElement(description) ? {
|
55
|
+
children: description
|
56
|
+
} : {
|
57
|
+
title: strippedString(description),
|
58
|
+
dangerouslySetInnerHTML: {
|
59
|
+
__html: description
|
60
|
+
}
|
61
|
+
};
|
62
|
+
return /*#__PURE__*/_jsxs(Card, {
|
63
|
+
variant: "outlined",
|
64
|
+
sx: {
|
65
|
+
borderRadius: 2
|
66
|
+
},
|
67
|
+
onClick: handleMainClick,
|
68
|
+
...rest,
|
69
|
+
children: [/*#__PURE__*/_jsx(CardContent, {
|
70
|
+
sx: {
|
71
|
+
display: 'flex',
|
72
|
+
justifyContent: 'space-between'
|
73
|
+
},
|
74
|
+
children: /*#__PURE__*/_jsxs(Stack, {
|
75
|
+
flex: 1,
|
76
|
+
direction: "row",
|
77
|
+
gap: 2,
|
78
|
+
alignItems: "center",
|
79
|
+
overflow: "hidden",
|
80
|
+
children: [/*#__PURE__*/_jsx(Avatar, {
|
81
|
+
src: cover,
|
82
|
+
did: did,
|
83
|
+
size: 40,
|
84
|
+
variant: "rounded"
|
85
|
+
}), /*#__PURE__*/_jsx(Typography, {
|
86
|
+
flex: 1,
|
87
|
+
component: "h6",
|
88
|
+
variant: "h6",
|
89
|
+
sx: {
|
90
|
+
textOverflow: 'ellipsis',
|
91
|
+
whiteSpace: 'nowrap',
|
92
|
+
overflow: 'hidden'
|
93
|
+
},
|
94
|
+
...titleProps
|
95
|
+
}), button || onButtonClick && /*#__PURE__*/_jsxs(Button, {
|
96
|
+
color: "reverse",
|
97
|
+
variant: "outlined",
|
98
|
+
size: "small",
|
99
|
+
disabled: buttonDisabled || buttonLoading,
|
100
|
+
style: {
|
101
|
+
borderColor: theme.palette.grey[300],
|
102
|
+
borderRadius: 8
|
103
|
+
},
|
104
|
+
onClick: handleButtonClick,
|
105
|
+
children: [buttonLoading && /*#__PURE__*/_jsx(CircularProgress, {
|
106
|
+
size: 15,
|
107
|
+
style: {
|
108
|
+
marginRight: 3,
|
109
|
+
color: 'inherit'
|
110
|
+
}
|
111
|
+
}), buttonText]
|
112
|
+
})]
|
113
|
+
})
|
114
|
+
}), /*#__PURE__*/_jsx(CardContent, {
|
115
|
+
sx: {
|
116
|
+
py: 0
|
117
|
+
},
|
118
|
+
children: /*#__PURE__*/_jsx(Typography, {
|
119
|
+
component: "div",
|
120
|
+
variant: "body2",
|
121
|
+
color: "text.secondary",
|
122
|
+
sx: {
|
123
|
+
lineClamp: 2,
|
124
|
+
display: '-webkit-box',
|
125
|
+
WebkitLineClamp: 2,
|
126
|
+
WebkitBoxOrient: 'vertical',
|
127
|
+
overflow: 'hidden',
|
128
|
+
height: 40
|
129
|
+
},
|
130
|
+
...descriptionProps
|
131
|
+
})
|
132
|
+
}), /*#__PURE__*/_jsxs(CardContent, {
|
133
|
+
sx: {
|
134
|
+
display: 'flex',
|
135
|
+
alignItems: 'center',
|
136
|
+
gap: 4,
|
137
|
+
color: 'grey.800'
|
138
|
+
},
|
139
|
+
children: [/*#__PURE__*/_jsx(IconText, {
|
140
|
+
icon: /*#__PURE__*/_jsx(Avatar, {
|
141
|
+
src: avatar,
|
142
|
+
did: did,
|
143
|
+
size: 20,
|
144
|
+
variant: "circle"
|
145
|
+
}),
|
146
|
+
children: author
|
147
|
+
}), /*#__PURE__*/_jsx(IconText, {
|
148
|
+
icon: /*#__PURE__*/_jsx(Icon, {
|
149
|
+
icon: Download
|
150
|
+
}),
|
151
|
+
title: download,
|
152
|
+
children: formatDownloadCount(download)
|
153
|
+
})]
|
154
|
+
})]
|
155
|
+
});
|
156
|
+
}
|
@@ -0,0 +1,7 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
export default function IconText({ icon, children, maxWidth, title, }: {
|
3
|
+
icon?: React.ReactNode;
|
4
|
+
children?: React.ReactNode;
|
5
|
+
maxWidth?: number;
|
6
|
+
title?: string;
|
7
|
+
}): false | "" | 0 | import("react/jsx-runtime").JSX.Element | null | undefined;
|
@@ -0,0 +1,30 @@
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
2
|
+
import { Stack, Typography } from '@mui/material';
|
3
|
+
import React from 'react';
|
4
|
+
export default function IconText({
|
5
|
+
icon,
|
6
|
+
children,
|
7
|
+
maxWidth = 100,
|
8
|
+
title
|
9
|
+
}) {
|
10
|
+
return children && /*#__PURE__*/_jsxs(Stack, {
|
11
|
+
direction: "row",
|
12
|
+
alignItems: "center",
|
13
|
+
gap: 1,
|
14
|
+
sx: {
|
15
|
+
maxWidth,
|
16
|
+
overflow: 'hidden'
|
17
|
+
},
|
18
|
+
children: [icon, /*#__PURE__*/_jsx(Typography, {
|
19
|
+
flex: 1,
|
20
|
+
variant: "body2",
|
21
|
+
sx: {
|
22
|
+
overflow: 'hidden',
|
23
|
+
textOverflow: 'ellipsis',
|
24
|
+
whiteSpace: 'nowrap'
|
25
|
+
},
|
26
|
+
title: title || (typeof children === 'string' ? children : undefined),
|
27
|
+
children: children
|
28
|
+
})]
|
29
|
+
});
|
30
|
+
}
|
@@ -0,0 +1,4 @@
|
|
1
|
+
export default ActionButton;
|
2
|
+
export function strippedString(originalString?: string): string;
|
3
|
+
export function formatDownloadCount(num?: string): string | number;
|
4
|
+
declare const ActionButton: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
@@ -0,0 +1,71 @@
|
|
1
|
+
import { styled } from '../Theme';
|
2
|
+
const ActionButton = styled('div')`
|
3
|
+
background-color: transparent !important;
|
4
|
+
& > :not(.Mui-disabled) {
|
5
|
+
position: relative;
|
6
|
+
z-index: 1;
|
7
|
+
&::before {
|
8
|
+
content: '';
|
9
|
+
position: absolute;
|
10
|
+
height: 100%;
|
11
|
+
width: 100%;
|
12
|
+
left: 0;
|
13
|
+
top: 0;
|
14
|
+
transition: opacity 0.3s;
|
15
|
+
}
|
16
|
+
&:hover::before {
|
17
|
+
opacity: 0;
|
18
|
+
}
|
19
|
+
&::after {
|
20
|
+
content: '';
|
21
|
+
position: absolute;
|
22
|
+
height: 100%;
|
23
|
+
width: 100%;
|
24
|
+
top: 0;
|
25
|
+
left: 0;
|
26
|
+
border-radius: 2px;
|
27
|
+
background-color: ${props => props.theme.palette.primary.main};
|
28
|
+
transform: scale(0.1);
|
29
|
+
opacity: 0;
|
30
|
+
z-index: -1;
|
31
|
+
transition:
|
32
|
+
transform 0.3s,
|
33
|
+
opacity 0.3s,
|
34
|
+
background-color 0.3s;
|
35
|
+
}
|
36
|
+
&:hover::after {
|
37
|
+
opacity: 1;
|
38
|
+
transform-origin: center;
|
39
|
+
transform: scale(1);
|
40
|
+
}
|
41
|
+
}
|
42
|
+
& > :not(.Mui-disabled) {
|
43
|
+
background-color: transparent !important;
|
44
|
+
color: ${props => props.theme.palette.primary.main}!important;
|
45
|
+
}
|
46
|
+
& > :not(.Mui-disabled) {
|
47
|
+
&:hover {
|
48
|
+
color: ${props => props.theme.palette.common.white}!important;
|
49
|
+
}
|
50
|
+
}
|
51
|
+
`;
|
52
|
+
export default ActionButton;
|
53
|
+
export const strippedString = (originalString = '') => {
|
54
|
+
return originalString.replace(/(<([^>]+)>)/gi, '').trim();
|
55
|
+
};
|
56
|
+
export const formatDownloadCount = (num = '') => {
|
57
|
+
const n = parseInt(num, 10);
|
58
|
+
if (Number.isNaN(n)) {
|
59
|
+
return num;
|
60
|
+
}
|
61
|
+
if (n < 1000) {
|
62
|
+
return n;
|
63
|
+
}
|
64
|
+
if (n < 1000000) {
|
65
|
+
return `${(n / 1000).toFixed(1)}k`;
|
66
|
+
}
|
67
|
+
if (n < 1000000000) {
|
68
|
+
return `${(n / 1000000).toFixed(1)}m`;
|
69
|
+
}
|
70
|
+
return `${(n / 1000000000).toFixed(1)}b`;
|
71
|
+
};
|
package/lib/Button/wrap.js
CHANGED
@@ -90,11 +90,11 @@ export default function (BaseComponent) {
|
|
90
90
|
/**
|
91
91
|
* @type {import('react').CSSProperties}
|
92
92
|
*/
|
93
|
-
const styles = Object.assign({},
|
93
|
+
const styles = Object.assign({}, {
|
94
94
|
boxShadow: 'none',
|
95
95
|
textTransform: 'capitalize',
|
96
96
|
...matched
|
97
|
-
});
|
97
|
+
}, style);
|
98
98
|
let _rest = rest;
|
99
99
|
if (!matched) {
|
100
100
|
// mui button 本身支持的 color 交由 mui 处理
|
@@ -0,0 +1,34 @@
|
|
1
|
+
declare function CardSelector({ list, width, height, cardSpace, onSelect, defaultIndex }: {
|
2
|
+
list: any;
|
3
|
+
width: any;
|
4
|
+
height: any;
|
5
|
+
cardSpace: any;
|
6
|
+
onSelect: any;
|
7
|
+
defaultIndex: any;
|
8
|
+
}): import("react/jsx-runtime").JSX.Element;
|
9
|
+
declare namespace CardSelector {
|
10
|
+
namespace propTypes {
|
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
|
+
}
|
31
|
+
}
|
32
|
+
export default CardSelector;
|
33
|
+
import PropTypes from 'prop-types';
|
34
|
+
import noop from 'lodash/noop';
|
@@ -0,0 +1,18 @@
|
|
1
|
+
/**
|
2
|
+
*
|
3
|
+
* @param {string} relative 容器相对尺寸,默认相对屏幕(screen),可设置为父容器(parent)
|
4
|
+
* @returns react component element
|
5
|
+
*/
|
6
|
+
declare function Center({ children, relative }: string): import("react/jsx-runtime").JSX.Element;
|
7
|
+
declare namespace Center {
|
8
|
+
namespace propTypes {
|
9
|
+
let children: PropTypes.Validator<any>;
|
10
|
+
let relative: PropTypes.Requireable<string>;
|
11
|
+
}
|
12
|
+
namespace defaultProps {
|
13
|
+
let relative_1: string;
|
14
|
+
export { relative_1 as relative };
|
15
|
+
}
|
16
|
+
}
|
17
|
+
export default Center;
|
18
|
+
import PropTypes from 'prop-types';
|
@@ -0,0 +1,27 @@
|
|
1
|
+
declare function CopyButton({ content, locale, render, showTooltip, ...rest }: {
|
2
|
+
[x: string]: any;
|
3
|
+
content: any;
|
4
|
+
locale: any;
|
5
|
+
render: any;
|
6
|
+
showTooltip: any;
|
7
|
+
}): any;
|
8
|
+
declare namespace CopyButton {
|
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
|
+
}
|
25
|
+
}
|
26
|
+
export default CopyButton;
|
27
|
+
import PropTypes from 'prop-types';
|
@@ -0,0 +1,32 @@
|
|
1
|
+
declare function ClickToCopy(props: any): import("react/jsx-runtime").JSX.Element;
|
2
|
+
declare namespace ClickToCopy {
|
3
|
+
namespace propTypes {
|
4
|
+
let children: PropTypes.Validator<any>;
|
5
|
+
let content: PropTypes.Requireable<string>;
|
6
|
+
let tip: PropTypes.Requireable<string>;
|
7
|
+
let tipPlacement: PropTypes.Requireable<string>;
|
8
|
+
let copiedTip: PropTypes.Requireable<string>;
|
9
|
+
let locale: PropTypes.Requireable<string>;
|
10
|
+
let style: PropTypes.Requireable<object>;
|
11
|
+
let unstyled: PropTypes.Requireable<boolean>;
|
12
|
+
}
|
13
|
+
namespace defaultProps {
|
14
|
+
let content_1: string;
|
15
|
+
export { content_1 as content };
|
16
|
+
let tip_1: string;
|
17
|
+
export { tip_1 as tip };
|
18
|
+
let copiedTip_1: string;
|
19
|
+
export { copiedTip_1 as copiedTip };
|
20
|
+
let tipPlacement_1: string;
|
21
|
+
export { tipPlacement_1 as tipPlacement };
|
22
|
+
let locale_1: string;
|
23
|
+
export { locale_1 as locale };
|
24
|
+
let style_1: {};
|
25
|
+
export { style_1 as style };
|
26
|
+
let unstyled_1: boolean;
|
27
|
+
export { unstyled_1 as unstyled };
|
28
|
+
}
|
29
|
+
}
|
30
|
+
export default ClickToCopy;
|
31
|
+
export { default as CopyButton } from "./copy-button";
|
32
|
+
import PropTypes from 'prop-types';
|
@@ -0,0 +1,5 @@
|
|
1
|
+
export default LightBox;
|
2
|
+
declare const LightBox: import("@emotion/styled").StyledComponent<{
|
3
|
+
theme?: import("@emotion/react").Theme;
|
4
|
+
as?: import("react").ElementType;
|
5
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|