@arcblock/ux 2.10.65 → 2.10.66
Sign up to get free protection for your applications and to get access to all the features.
- 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/Header/header.d.ts
CHANGED
@@ -1,55 +1,24 @@
|
|
1
|
-
|
1
|
+
import { type Breakpoint } from '@mui/material';
|
2
|
+
export interface HeaderProps extends React.HTMLAttributes<HTMLDivElement> {
|
3
|
+
/** logo img/svg, 可以包裹一个 a 标签 */
|
4
|
+
logo?: React.ReactNode;
|
5
|
+
/** 相当于 Title, 可以包裹一个 a 标签 */
|
6
|
+
brand?: React.ReactNode;
|
7
|
+
/** brand 右侧的内容区域, 可显示一个 badge 或 tag */
|
8
|
+
brandAddon?: React.ReactNode;
|
9
|
+
/** brand 下方的描述 */
|
10
|
+
description?: React.ReactNode;
|
11
|
+
/** 右侧区域, 可以放置 icons/actions/login 等 */
|
12
|
+
addons?: React.ReactNode;
|
13
|
+
/** logo 左侧内容 */
|
14
|
+
prepend?: React.ReactNode;
|
15
|
+
align?: 'left' | 'right';
|
16
|
+
maxWidth?: Breakpoint | false;
|
17
|
+
homeLink?: string | ((brandContent: React.ReactNode) => React.ReactNode);
|
18
|
+
}
|
2
19
|
/**
|
3
20
|
* Header 组件
|
4
21
|
* TODO: Layout/dashboard 可以复用此处的 header
|
5
22
|
*/
|
6
|
-
declare function Header({ logo, brand, brandAddon, description, children, addons, prepend, align, maxWidth, homeLink, ...rest }:
|
7
|
-
|
8
|
-
logo: any;
|
9
|
-
brand: any;
|
10
|
-
brandAddon: any;
|
11
|
-
description: any;
|
12
|
-
children: any;
|
13
|
-
addons: any;
|
14
|
-
prepend: any;
|
15
|
-
align: any;
|
16
|
-
maxWidth: any;
|
17
|
-
homeLink: any;
|
18
|
-
}): import("react/jsx-runtime").JSX.Element;
|
19
|
-
declare namespace Header {
|
20
|
-
namespace propTypes {
|
21
|
-
let logo: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
22
|
-
let brand: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
23
|
-
let brandAddon: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
24
|
-
let description: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
25
|
-
let children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
26
|
-
let addons: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
27
|
-
let prepend: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
28
|
-
let align: PropTypes.Requireable<string>;
|
29
|
-
let maxWidth: PropTypes.Requireable<NonNullable<string | boolean | null | undefined>>;
|
30
|
-
let homeLink: PropTypes.Requireable<NonNullable<string | ((...args: any[]) => any) | null | undefined>>;
|
31
|
-
}
|
32
|
-
namespace defaultProps {
|
33
|
-
let logo_1: null;
|
34
|
-
export { logo_1 as logo };
|
35
|
-
let brand_1: null;
|
36
|
-
export { brand_1 as brand };
|
37
|
-
let brandAddon_1: null;
|
38
|
-
export { brandAddon_1 as brandAddon };
|
39
|
-
let description_1: null;
|
40
|
-
export { description_1 as description };
|
41
|
-
let children_1: null;
|
42
|
-
export { children_1 as children };
|
43
|
-
let addons_1: null;
|
44
|
-
export { addons_1 as addons };
|
45
|
-
let prepend_1: null;
|
46
|
-
export { prepend_1 as prepend };
|
47
|
-
let align_1: string;
|
48
|
-
export { align_1 as align };
|
49
|
-
let maxWidth_1: undefined;
|
50
|
-
export { maxWidth_1 as maxWidth };
|
51
|
-
let homeLink_1: string;
|
52
|
-
export { homeLink_1 as homeLink };
|
53
|
-
}
|
54
|
-
}
|
55
|
-
import PropTypes from 'prop-types';
|
23
|
+
declare function Header({ logo, brand, brandAddon, description, children, addons, prepend, align, maxWidth, homeLink, ...rest }: HeaderProps): import("react/jsx-runtime").JSX.Element;
|
24
|
+
export default Header;
|
package/lib/Header/header.js
CHANGED
@@ -1,28 +1,26 @@
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
2
|
-
import PropTypes from 'prop-types';
|
3
2
|
import { Box, Container } from '@mui/material';
|
4
3
|
import { useRef, useState, useEffect } from 'react';
|
5
4
|
import AutoHidden from './auto-hidden';
|
6
5
|
import { styled } from '../Theme';
|
7
|
-
|
8
6
|
/**
|
9
7
|
* Header 组件
|
10
8
|
* TODO: Layout/dashboard 可以复用此处的 header
|
11
9
|
*/
|
12
10
|
function Header({
|
13
|
-
logo,
|
14
|
-
brand,
|
15
|
-
brandAddon,
|
16
|
-
description,
|
17
|
-
children,
|
18
|
-
addons,
|
19
|
-
prepend,
|
20
|
-
align,
|
11
|
+
logo = null,
|
12
|
+
brand = null,
|
13
|
+
brandAddon = null,
|
14
|
+
description = null,
|
15
|
+
children = null,
|
16
|
+
addons = null,
|
17
|
+
prepend = null,
|
18
|
+
align = 'left',
|
21
19
|
maxWidth,
|
22
|
-
homeLink,
|
20
|
+
homeLink = '/',
|
23
21
|
...rest
|
24
22
|
}) {
|
25
|
-
const logoRef = useRef();
|
23
|
+
const logoRef = useRef(null);
|
26
24
|
const [brandWrapperMinWidth, setBrandWrapperMinWidth] = useState('0px');
|
27
25
|
const style = {
|
28
26
|
minWidth: brandWrapperMinWidth
|
@@ -98,36 +96,6 @@ function Header({
|
|
98
96
|
})
|
99
97
|
});
|
100
98
|
}
|
101
|
-
Header.propTypes = {
|
102
|
-
// logo img/svg, 可以包裹一个 a 标签
|
103
|
-
logo: PropTypes.node,
|
104
|
-
// 相当于 Title, 可以包裹一个 a 标签
|
105
|
-
brand: PropTypes.node,
|
106
|
-
// brand 右侧的内容区域, 可显示一个 badge 或 tag
|
107
|
-
brandAddon: PropTypes.node,
|
108
|
-
// brand 下方的描述
|
109
|
-
description: PropTypes.node,
|
110
|
-
children: PropTypes.node,
|
111
|
-
// 右侧区域, 可以放置 icons/actions/login 等
|
112
|
-
addons: PropTypes.node,
|
113
|
-
// logo 左侧内容
|
114
|
-
prepend: PropTypes.node,
|
115
|
-
align: PropTypes.oneOf(['left', 'right']),
|
116
|
-
maxWidth: PropTypes.oneOfType([PropTypes.string, PropTypes.oneOf(['xs', 'sm', 'md', 'lg', 'xl', false])]),
|
117
|
-
homeLink: PropTypes.oneOfType([PropTypes.string, PropTypes.func])
|
118
|
-
};
|
119
|
-
Header.defaultProps = {
|
120
|
-
logo: null,
|
121
|
-
brand: null,
|
122
|
-
brandAddon: null,
|
123
|
-
description: null,
|
124
|
-
children: null,
|
125
|
-
addons: null,
|
126
|
-
prepend: null,
|
127
|
-
align: 'left',
|
128
|
-
maxWidth: undefined,
|
129
|
-
homeLink: '/'
|
130
|
-
};
|
131
99
|
const Root = styled(Box)`
|
132
100
|
position: relative;
|
133
101
|
z-index: ${props => props.theme.zIndex.appBar};
|
package/lib/Header/index.d.ts
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
export { default as Header } from
|
2
|
-
export { default as ResponsiveHeader } from
|
1
|
+
export { default as Header } from './header';
|
2
|
+
export { default as ResponsiveHeader } from './responsive-header';
|
@@ -1,4 +1,11 @@
|
|
1
|
-
|
1
|
+
import { type HeaderProps } from './header';
|
2
|
+
export interface ResponsiveHeaderProps extends Omit<HeaderProps, 'children'> {
|
3
|
+
menu?: React.ReactNode;
|
4
|
+
children?: React.ReactNode | ((props: {
|
5
|
+
isMobile: boolean;
|
6
|
+
closeMenu: () => void;
|
7
|
+
}) => React.ReactNode);
|
8
|
+
}
|
2
9
|
/**
|
3
10
|
* ResponsiveHeader
|
4
11
|
* - 窄屏下显示 burge menu
|
@@ -6,24 +13,5 @@ export default ResponsiveHeader;
|
|
6
13
|
*
|
7
14
|
* 注意: 暂时不要通过 display: none 隐藏 logo, https://blog.patw.me/archives/1820/inline-svg-same-id-and-display-none-issue/
|
8
15
|
*/
|
9
|
-
declare function ResponsiveHeader({ menu, prepend, children, ...rest }:
|
10
|
-
|
11
|
-
menu: any;
|
12
|
-
prepend: any;
|
13
|
-
children: any;
|
14
|
-
}): import("react/jsx-runtime").JSX.Element;
|
15
|
-
declare namespace ResponsiveHeader {
|
16
|
-
let propTypes: any;
|
17
|
-
let defaultProps: {
|
18
|
-
logo: null;
|
19
|
-
brand: null;
|
20
|
-
brandAddon: null;
|
21
|
-
description: null;
|
22
|
-
children: null;
|
23
|
-
addons: null;
|
24
|
-
prepend: null;
|
25
|
-
align: string;
|
26
|
-
maxWidth: undefined;
|
27
|
-
homeLink: string;
|
28
|
-
};
|
29
|
-
}
|
16
|
+
declare function ResponsiveHeader({ menu, prepend, children, ...rest }: ResponsiveHeaderProps): import("react/jsx-runtime").JSX.Element;
|
17
|
+
export default ResponsiveHeader;
|
@@ -1,6 +1,5 @@
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
2
2
|
import { useState } from 'react';
|
3
|
-
import PropTypes from 'prop-types';
|
4
3
|
import { useCreation, useReactive } from 'ahooks';
|
5
4
|
import MenuIcon from '@mui/icons-material/Menu';
|
6
5
|
import CloseIcon from '@mui/icons-material/Close';
|
@@ -10,7 +9,6 @@ import useMediaQuery from '@mui/material/useMediaQuery';
|
|
10
9
|
import Drawer from '@mui/material/Drawer';
|
11
10
|
import Header from './header';
|
12
11
|
import { styled, useTheme } from '../Theme';
|
13
|
-
|
14
12
|
/**
|
15
13
|
* ResponsiveHeader
|
16
14
|
* - 窄屏下显示 burge menu
|
@@ -90,7 +88,7 @@ function ResponsiveHeader({
|
|
90
88
|
ModalProps: {
|
91
89
|
disablePortal: false,
|
92
90
|
keepMounted: true,
|
93
|
-
BackdropComponent:
|
91
|
+
BackdropComponent: undefined
|
94
92
|
},
|
95
93
|
anchor: "top",
|
96
94
|
sx: {
|
@@ -110,16 +108,6 @@ function ResponsiveHeader({
|
|
110
108
|
})]
|
111
109
|
});
|
112
110
|
}
|
113
|
-
ResponsiveHeader.propTypes = {
|
114
|
-
...Header.PropTypes,
|
115
|
-
// 如果是 function, 则
|
116
|
-
// - 会传入一个 isMobile 参数, isMobile 为 true 时, 表示 children 会显示在 menu 中, 可以根据 isMobile 参数调整要渲染的内容, 比如如果 isMobile 为 true 则使用 inline 模式的 NavMenu (适用于移动端)
|
117
|
-
// - 会传入一个 closeMenu 参数, 可以关闭 menu
|
118
|
-
children: PropTypes.oneOfType([PropTypes.node, PropTypes.func])
|
119
|
-
};
|
120
|
-
ResponsiveHeader.defaultProps = {
|
121
|
-
...Header.defaultProps
|
122
|
-
};
|
123
111
|
const Root = styled(Header)`
|
124
112
|
.header-menu {
|
125
113
|
display: none;
|
package/lib/Icon/image.d.ts
CHANGED
@@ -1,37 +1,9 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
alt
|
6
|
-
|
7
|
-
|
8
|
-
prefix: any;
|
9
|
-
showBadge: any;
|
10
|
-
}): import("react/jsx-runtime").JSX.Element;
|
11
|
-
declare namespace ImageIcon {
|
12
|
-
namespace propTypes {
|
13
|
-
let name: PropTypes.Validator<string>;
|
14
|
-
let size: PropTypes.Requireable<number>;
|
15
|
-
let color: PropTypes.Requireable<string>;
|
16
|
-
let alt: PropTypes.Requireable<string>;
|
17
|
-
let style: PropTypes.Requireable<object>;
|
18
|
-
let prefix: PropTypes.Requireable<string>;
|
19
|
-
let showBadge: PropTypes.Requireable<boolean>;
|
20
|
-
}
|
21
|
-
namespace defaultProps {
|
22
|
-
let size_1: number;
|
23
|
-
export { size_1 as size };
|
24
|
-
let color_1: string;
|
25
|
-
export { color_1 as color };
|
26
|
-
let alt_1: string;
|
27
|
-
export { alt_1 as alt };
|
28
|
-
let style_1: {};
|
29
|
-
export { style_1 as style };
|
30
|
-
let prefix_1: string;
|
31
|
-
export { prefix_1 as prefix };
|
32
|
-
let showBadge_1: boolean;
|
33
|
-
export { showBadge_1 as showBadge };
|
34
|
-
}
|
1
|
+
export interface ImageIconProps extends React.HTMLAttributes<HTMLDivElement> {
|
2
|
+
name: string;
|
3
|
+
size?: number;
|
4
|
+
color?: string;
|
5
|
+
alt?: string;
|
6
|
+
prefix?: string;
|
7
|
+
showBadge?: boolean;
|
35
8
|
}
|
36
|
-
export default ImageIcon;
|
37
|
-
import PropTypes from 'prop-types';
|
9
|
+
export default function ImageIcon({ name, size, alt, color, prefix, showBadge, style, ...rest }: ImageIconProps): import("react/jsx-runtime").JSX.Element;
|
package/lib/Icon/image.js
CHANGED
@@ -1,15 +1,14 @@
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
2
|
-
import PropTypes from 'prop-types';
|
3
2
|
import Img from '../Img';
|
4
3
|
import { styled } from '../Theme';
|
5
4
|
export default function ImageIcon({
|
6
5
|
name,
|
7
|
-
size,
|
8
|
-
alt,
|
9
|
-
color,
|
10
|
-
|
11
|
-
|
12
|
-
|
6
|
+
size = 36,
|
7
|
+
alt = '',
|
8
|
+
color = '#000000',
|
9
|
+
prefix = '/images',
|
10
|
+
showBadge = false,
|
11
|
+
style = {},
|
13
12
|
...rest
|
14
13
|
}) {
|
15
14
|
const src = `${prefix}/${name}-${color.replace(/^#/, '')}.png`;
|
@@ -32,23 +31,6 @@ export default function ImageIcon({
|
|
32
31
|
})]
|
33
32
|
});
|
34
33
|
}
|
35
|
-
ImageIcon.propTypes = {
|
36
|
-
name: PropTypes.string.isRequired,
|
37
|
-
size: PropTypes.number,
|
38
|
-
color: PropTypes.string,
|
39
|
-
alt: PropTypes.string,
|
40
|
-
style: PropTypes.object,
|
41
|
-
prefix: PropTypes.string,
|
42
|
-
showBadge: PropTypes.bool
|
43
|
-
};
|
44
|
-
ImageIcon.defaultProps = {
|
45
|
-
size: 36,
|
46
|
-
color: '#000000',
|
47
|
-
alt: '',
|
48
|
-
style: {},
|
49
|
-
prefix: '/images',
|
50
|
-
showBadge: false
|
51
|
-
};
|
52
34
|
const Div = styled('div')`
|
53
35
|
position: relative;
|
54
36
|
.badge-point {
|
package/lib/Icon/index.d.ts
CHANGED
@@ -1,2 +1,10 @@
|
|
1
|
-
|
1
|
+
export interface IconProps extends React.HTMLAttributes<HTMLElement> {
|
2
|
+
name: string;
|
3
|
+
color?: string;
|
4
|
+
size?: number;
|
5
|
+
variant?: 'light' | 'regular' | 'solid';
|
6
|
+
rounded?: boolean;
|
7
|
+
forwardedRef?: React.ForwardedRef<HTMLElement>;
|
8
|
+
}
|
9
|
+
declare const _default: (props: IconProps & import("react").RefAttributes<HTMLElement>) => import("react/jsx-runtime").JSX.Element;
|
2
10
|
export default _default;
|
package/lib/Icon/index.js
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
2
2
|
import { forwardRef } from 'react';
|
3
|
-
import PropTypes from 'prop-types';
|
4
3
|
import colors from '../Colors';
|
5
4
|
import { styled } from '../Theme';
|
6
5
|
import { withDeprecated } from '../Util/deprecate';
|
@@ -9,16 +8,15 @@ const variants = {
|
|
9
8
|
regular: 'far',
|
10
9
|
solid: 'fas'
|
11
10
|
};
|
12
|
-
|
13
11
|
// eslint-disable-next-line react/prop-types
|
14
12
|
function Icon({
|
15
13
|
name,
|
16
|
-
color,
|
17
|
-
size,
|
18
|
-
variant,
|
19
|
-
rounded,
|
20
|
-
style,
|
21
|
-
className,
|
14
|
+
color = colors.grey[900],
|
15
|
+
size = 24,
|
16
|
+
variant = 'light',
|
17
|
+
rounded = false,
|
18
|
+
style = {},
|
19
|
+
className = '',
|
22
20
|
forwardedRef,
|
23
21
|
...rest
|
24
22
|
}) {
|
@@ -42,23 +40,6 @@ function Icon({
|
|
42
40
|
}
|
43
41
|
return content;
|
44
42
|
}
|
45
|
-
Icon.propTypes = {
|
46
|
-
name: PropTypes.string.isRequired,
|
47
|
-
className: PropTypes.string,
|
48
|
-
color: PropTypes.string,
|
49
|
-
rounded: PropTypes.bool,
|
50
|
-
variant: PropTypes.string,
|
51
|
-
size: PropTypes.number,
|
52
|
-
style: PropTypes.object
|
53
|
-
};
|
54
|
-
Icon.defaultProps = {
|
55
|
-
rounded: false,
|
56
|
-
variant: 'light',
|
57
|
-
color: colors.grey[900],
|
58
|
-
className: '',
|
59
|
-
size: 24,
|
60
|
-
style: {}
|
61
|
-
};
|
62
43
|
const Span = styled('span')`
|
63
44
|
width: ${props => props.size * 2}px;
|
64
45
|
height: ${props => props.size * 2}px;
|
package/lib/NavMenu/index.d.ts
CHANGED
@@ -1 +1 @@
|
|
1
|
-
export { default } from
|
1
|
+
export { default } from './nav-menu';
|
@@ -1,56 +1,42 @@
|
|
1
|
-
export
|
1
|
+
export type ItemOptions = {
|
2
|
+
id?: string;
|
3
|
+
icon?: React.ReactNode;
|
4
|
+
label?: React.ReactNode;
|
5
|
+
active?: boolean;
|
6
|
+
children?: ItemOptions[];
|
7
|
+
};
|
8
|
+
export interface NavMenuProps extends React.HTMLAttributes<HTMLElement> {
|
9
|
+
items?: ItemOptions[];
|
10
|
+
mode?: 'horizontal' | 'vertical' | 'inline';
|
11
|
+
children?: React.ReactNode;
|
12
|
+
activeId?: string | null;
|
13
|
+
textColor?: string;
|
14
|
+
activeTextColor?: string;
|
15
|
+
bgColor?: string;
|
16
|
+
onSelected?: (id: string) => void;
|
17
|
+
}
|
2
18
|
/**
|
3
19
|
* NavMenu, 导航组件, 可用于 header/footer/sidebar
|
4
20
|
*/
|
5
|
-
declare function NavMenu({ items, mode, children, activeId, textColor, activeTextColor, bgColor, onSelected, ...rest }:
|
6
|
-
[x: string]: any;
|
7
|
-
items: any;
|
8
|
-
mode: any;
|
9
|
-
children: any;
|
10
|
-
activeId: any;
|
11
|
-
textColor: any;
|
12
|
-
activeTextColor: any;
|
13
|
-
bgColor: any;
|
14
|
-
onSelected: any;
|
15
|
-
}): import("react/jsx-runtime").JSX.Element;
|
21
|
+
declare function NavMenu({ items, mode, children: _childs, activeId, textColor, activeTextColor, bgColor, onSelected, ...rest }: NavMenuProps): import("react/jsx-runtime").JSX.Element;
|
16
22
|
declare namespace NavMenu {
|
17
|
-
|
18
|
-
|
19
|
-
let mode: PropTypes.Requireable<string>;
|
20
|
-
let children: PropTypes.Requireable<any[]>;
|
21
|
-
let activeId: PropTypes.Requireable<string>;
|
22
|
-
let textColor: PropTypes.Requireable<string>;
|
23
|
-
let activeTextColor: PropTypes.Requireable<string>;
|
24
|
-
let bgColor: PropTypes.Requireable<string>;
|
25
|
-
let onSelected: PropTypes.Requireable<(...args: any[]) => any>;
|
26
|
-
}
|
27
|
-
export namespace defaultProps {
|
28
|
-
let items_1: null;
|
29
|
-
export { items_1 as items };
|
30
|
-
let mode_1: string;
|
31
|
-
export { mode_1 as mode };
|
32
|
-
let children_1: null;
|
33
|
-
export { children_1 as children };
|
34
|
-
let activeId_1: null;
|
35
|
-
export { activeId_1 as activeId };
|
36
|
-
let textColor_1: string;
|
37
|
-
export { textColor_1 as textColor };
|
38
|
-
let activeTextColor_1: string;
|
39
|
-
export { activeTextColor_1 as activeTextColor };
|
40
|
-
let bgColor_1: string;
|
41
|
-
export { bgColor_1 as bgColor };
|
42
|
-
let onSelected_1: null;
|
43
|
-
export { onSelected_1 as onSelected };
|
44
|
-
}
|
45
|
-
export { Item };
|
46
|
-
export { Sub };
|
23
|
+
var Item: import("react").ForwardRefExoticComponent<ItemProps & import("react").RefAttributes<HTMLLIElement>>;
|
24
|
+
var Sub: import("react").ForwardRefExoticComponent<SubProps & import("react").RefAttributes<HTMLLIElement>>;
|
47
25
|
}
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
26
|
+
export interface ItemProps extends React.HTMLAttributes<HTMLLIElement> {
|
27
|
+
id?: string;
|
28
|
+
icon?: React.ReactNode;
|
29
|
+
label?: React.ReactNode;
|
30
|
+
active?: boolean;
|
31
|
+
onClick?: () => void;
|
32
|
+
}
|
33
|
+
export interface SubProps extends React.HTMLAttributes<HTMLLIElement> {
|
34
|
+
id?: string;
|
35
|
+
icon?: React.ReactNode;
|
36
|
+
label?: React.ReactNode;
|
37
|
+
children?: Array<React.ReactElement>;
|
38
|
+
expandIcon?: React.ReactNode | ((props: {
|
39
|
+
isOpen: boolean;
|
40
|
+
}) => React.ReactNode);
|
41
|
+
}
|
42
|
+
export default NavMenu;
|