@arcblock/ux 2.6.9 → 2.7.0
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/babel.config.es.js +12 -0
- package/es/ActionButton/index.js +99 -0
- package/es/ActivityIndicator/index.js +180 -0
- package/es/Address/compact-text.js +105 -0
- package/es/Address/did-address.js +211 -0
- package/es/Address/index.js +23 -0
- package/es/Address/responsive-did-address.js +88 -0
- package/es/Alert/index.js +134 -0
- package/es/AnimationWaiter/default-animation.json +1 -0
- package/es/AnimationWaiter/index.js +239 -0
- package/es/Async/index.js +38 -0
- package/es/Avatar/did-motif.js +64 -0
- package/es/Avatar/etherscan-blockies.js +83 -0
- package/es/Avatar/index.js +176 -0
- package/es/Badge/index.js +98 -0
- package/es/Blocklet/blocklet.js +298 -0
- package/es/Blocklet/index.js +4 -0
- package/es/Blocklet/utils.js +52 -0
- package/es/BlockletNFT/index.js +412 -0
- package/es/Button/index.js +8 -0
- package/es/Button/wrap.js +140 -0
- package/es/ButtonGroup/index.js +6 -0
- package/es/CardSelector/index.js +131 -0
- package/es/Center/index.js +41 -0
- package/es/ClickToCopy/copy-button.js +72 -0
- package/es/ClickToCopy/hook.js +39 -0
- package/es/ClickToCopy/index.js +93 -0
- package/es/CodeBlock/LightBox.js +85 -0
- package/es/CodeBlock/index.js +226 -0
- package/es/Colors/index.js +2 -0
- package/es/Colors/themes/default.js +78 -0
- package/es/ContactForm/index.js +230 -0
- package/es/CookieConsent/index.js +113 -0
- package/es/CountDown/index.js +178 -0
- package/es/DID/index.js +105 -0
- package/es/Datatable/CustomToolbar.js +396 -0
- package/es/Datatable/DatatableContext.js +34 -0
- package/es/Datatable/TableSearch.js +165 -0
- package/es/Datatable/index.js +627 -0
- package/es/Datatable/utils.js +132 -0
- package/es/Dialog/confirm.js +90 -0
- package/es/Dialog/dialog.js +192 -0
- package/es/Dialog/index.js +3 -0
- package/es/DidLogo/index.js +31 -0
- package/es/DriftBot/index.js +70 -0
- package/es/Earth/countries.json +8057 -0
- package/es/Earth/index.js +521 -0
- package/es/Earth/util.js +51 -0
- package/es/Empty/index.js +64 -0
- package/es/ErrorBoundary/fallback.js +73 -0
- package/es/ErrorBoundary/index.js +1 -0
- package/es/Footer/index.js +172 -0
- package/es/Header/auto-hidden.js +35 -0
- package/es/Header/header.js +211 -0
- package/es/Header/index.js +2 -0
- package/es/Header/responsive-header.js +111 -0
- package/es/Icon/image.js +65 -0
- package/es/Icon/index.js +84 -0
- package/es/Img/index.js +217 -0
- package/es/InfoRow/index.js +87 -0
- package/es/Layout/dashboard/external-link.js +58 -0
- package/es/Layout/dashboard/full-page.js +53 -0
- package/es/Layout/dashboard/index.js +275 -0
- package/es/Layout/dashboard/sidebar.js +209 -0
- package/es/Layout/dashboard-legacy/header.js +174 -0
- package/es/Layout/dashboard-legacy/index.js +149 -0
- package/es/Layout/dashboard-legacy/sidebar.js +129 -0
- package/es/Layout/index.js +335 -0
- package/es/Locale/browser-lang.js +52 -0
- package/es/Locale/context.js +114 -0
- package/es/Locale/languages.js +60 -0
- package/es/Locale/selector.js +180 -0
- package/es/Locale/util.js +13 -0
- package/es/Logo/images/logo-dark-text.svg +3 -0
- package/es/Logo/images/logo-dark-top.svg +6 -0
- package/es/Logo/images/logo-light-text.svg +3 -0
- package/es/Logo/images/logo-light-top.svg +6 -0
- package/es/Logo/index.js +136 -0
- package/es/Metric/index.js +132 -0
- package/es/NFTDisplay/README.md +59 -0
- package/es/NFTDisplay/aspect-ratio-container.js +39 -0
- package/es/NFTDisplay/broken.js +18 -0
- package/es/NFTDisplay/demo/data/asset-state-display-url.json +7 -0
- package/es/NFTDisplay/demo/data/asset-state-gzipped-svg-1-1.json +10 -0
- package/es/NFTDisplay/demo/data/asset-state-gzipped-svg-374-130.json +10 -0
- package/es/NFTDisplay/demo/data/asset-state-gzipped-svg-with-foreign-object.json +20 -0
- package/es/NFTDisplay/demo/data/asset-state-svg.json +29 -0
- package/es/NFTDisplay/demo/data/asset-state-url.json +10 -0
- package/es/NFTDisplay/index.js +323 -0
- package/es/NFTDisplay/loading.js +18 -0
- package/es/NFTDisplay/svg-embedder/img.js +45 -0
- package/es/NFTDisplay/svg-embedder/inline-svg.js +39 -0
- package/es/NavMenu/index.js +2 -0
- package/es/NavMenu/nav-menu.js +286 -0
- package/es/NavMenu/style.js +176 -0
- package/es/PageScroller/index.js +286 -0
- package/es/PageScroller/story/FifthComponent.js +9 -0
- package/es/PageScroller/story/FirstComponent.js +9 -0
- package/es/PageScroller/story/FourthComponent.js +12 -0
- package/es/PageScroller/story/FullPage.js +47 -0
- package/es/PageScroller/story/PageContain.js +59 -0
- package/es/PageScroller/story/SecondComponent.js +9 -0
- package/es/PageScroller/story/ThirdComponent.js +9 -0
- package/es/PageScroller/story/index.css +115 -0
- package/es/PageScroller/usePrevValue.js +9 -0
- package/es/PricingTable/PricingPlan.js +124 -0
- package/es/PricingTable/index.js +53 -0
- package/es/QRCode/index.js +72 -0
- package/es/RelativeTime/index.js +98 -0
- package/es/Result/common.js +140 -0
- package/es/Result/demo/fixtures/result-image-404.svg +1 -0
- package/es/Result/index.js +33 -0
- package/es/Result/result.js +59 -0
- package/es/Result/translations.js +54 -0
- package/es/Screenshot/BaseScreenshot/index.js +91 -0
- package/es/Screenshot/BaseScreenshot/shells/Macbook.js +51 -0
- package/es/Screenshot/BaseScreenshot/shells/Phone.js +36 -0
- package/es/Screenshot/demo/images/bg-00.jpg +0 -0
- package/es/Screenshot/demo/images/bg-01.jpg +0 -0
- package/es/Screenshot/demo/images/bg-02.jpg +0 -0
- package/es/Screenshot/demo/images/bg-03.jpg +0 -0
- package/es/Screenshot/demo/images/bg-04.jpg +0 -0
- package/es/Screenshot/demo/images/bg-05.jpg +0 -0
- package/es/Screenshot/demo/images/bg-06.jpg +0 -0
- package/es/Screenshot/demo/images/bg-07.jpg +0 -0
- package/es/Screenshot/demo/images/bg-08.jpg +0 -0
- package/es/Screenshot/demo/images/bg-09.jpg +0 -0
- package/es/Screenshot/devices.css +1366 -0
- package/es/Screenshot/index.js +299 -0
- package/es/SessionManager/federated-login-detecter.js +166 -0
- package/es/SessionManager/index.js +468 -0
- package/es/SessionManager/user-popper.js +132 -0
- package/es/Sparkline/index.js +193 -0
- package/es/Spinner/index.js +28 -0
- package/es/SplitButton/index.js +144 -0
- package/es/Switch/index.js +96 -0
- package/es/Tabs/index.js +48 -0
- package/es/Tag/index.js +108 -0
- package/es/TextCollapse/index.js +92 -0
- package/es/Theme/index.js +16 -0
- package/es/Theme/theme-provider.js +39 -0
- package/es/Theme/theme.js +133 -0
- package/es/Toast/index.js +95 -0
- package/es/Util/deprecate.js +28 -0
- package/es/Util/index.js +298 -0
- package/es/Util/wallet.js +32 -0
- package/es/Video/index.js +89 -0
- package/es/Wallet/Action.js +119 -0
- package/es/Wallet/Download.js +331 -0
- package/es/Wallet/Open.js +45 -0
- package/es/Wallet/images/abtwallet.png +0 -0
- package/es/Wallet/images/android_download.svg +23 -0
- package/es/Wallet/images/app-store.svg +20 -0
- package/es/Wallet/images/google-play.svg +70 -0
- package/es/WebWalletSWKeeper/index.js +115 -0
- package/es/WechatPrompt/images/android.png +0 -0
- package/es/WechatPrompt/images/ios.png +0 -0
- package/es/WechatPrompt/index.js +88 -0
- package/es/index.js +38 -0
- package/es/withTheme/index.js +69 -0
- package/es/withTracker/README.md +34 -0
- package/es/withTracker/error_boundary.js +34 -0
- package/es/withTracker/index.js +56 -0
- package/package.json +272 -5
@@ -0,0 +1,286 @@
|
|
1
|
+
import { Children, useEffect, createContext, useContext, useMemo, useState, useRef, useCallback } from 'react';
|
2
|
+
import PropTypes from 'prop-types';
|
3
|
+
import clsx from 'clsx';
|
4
|
+
import ExpandMoreIcon from '@mui/icons-material/ExpandMore';
|
5
|
+
import { HorizontalStyle, InlineStyle } from './style';
|
6
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
7
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
8
|
+
const NavMenuContext = /*#__PURE__*/createContext();
|
9
|
+
|
10
|
+
// 过滤 children 中的 Item/Sub, 忽略其它类型的 element
|
11
|
+
function filterItems(children) {
|
12
|
+
if (children) {
|
13
|
+
return Children.toArray(children).filter(child => child.type === Item || child.type === Sub);
|
14
|
+
}
|
15
|
+
return null;
|
16
|
+
}
|
17
|
+
function useUniqueId(id) {
|
18
|
+
const _id = useRef(id || `navmenu-item-id-${Math.random().toString(36).slice(2)}`);
|
19
|
+
return _id.current;
|
20
|
+
}
|
21
|
+
|
22
|
+
/**
|
23
|
+
* NavMenu, 导航组件, 可用于 header/footer/sidebar
|
24
|
+
*/
|
25
|
+
function NavMenu({
|
26
|
+
items,
|
27
|
+
mode,
|
28
|
+
children,
|
29
|
+
activeId,
|
30
|
+
textColor,
|
31
|
+
activeTextColor,
|
32
|
+
bgColor,
|
33
|
+
onSelected,
|
34
|
+
...rest
|
35
|
+
}) {
|
36
|
+
// eslint-disable-next-line no-param-reassign
|
37
|
+
children = filterItems(children);
|
38
|
+
if (!items?.length && !children?.length) {
|
39
|
+
throw new Error("One of 'items' or 'children' is required by NavMenu component.");
|
40
|
+
}
|
41
|
+
const [state, setState] = useState({
|
42
|
+
activeId,
|
43
|
+
openedIds: []
|
44
|
+
});
|
45
|
+
const activate = useCallback(id => {
|
46
|
+
setState(prev => ({
|
47
|
+
...prev,
|
48
|
+
activeId: id
|
49
|
+
}));
|
50
|
+
onSelected?.(id);
|
51
|
+
}, [onSelected]);
|
52
|
+
const open = useCallback(id => {
|
53
|
+
setState(prev => ({
|
54
|
+
...prev,
|
55
|
+
openedIds: [...prev.openedIds, id]
|
56
|
+
}));
|
57
|
+
}, []);
|
58
|
+
const close = useCallback(id => {
|
59
|
+
setState(prev => ({
|
60
|
+
...prev,
|
61
|
+
openedIds: prev.openedIds.filter(item => item !== id)
|
62
|
+
}));
|
63
|
+
}, []);
|
64
|
+
const contextValue = useMemo(() => {
|
65
|
+
return {
|
66
|
+
...state,
|
67
|
+
mode,
|
68
|
+
activate,
|
69
|
+
open,
|
70
|
+
close
|
71
|
+
};
|
72
|
+
}, [state, mode, activate, open, close]);
|
73
|
+
useEffect(() => {
|
74
|
+
// NavMenu#activeId 和 Item#active prop 都可以用来控制激活状态 (一般不会混用这两种方式)
|
75
|
+
// 如果未传入 NavMenu#activeId, 应该避免设置一个空值的 activeId 状态 (会与 Item#active 冲突)
|
76
|
+
if (activeId !== undefined && activeId !== null) {
|
77
|
+
setState(prev => ({
|
78
|
+
...prev,
|
79
|
+
activeId
|
80
|
+
}));
|
81
|
+
}
|
82
|
+
}, [activeId]);
|
83
|
+
const classes = clsx('navmenu', `navmenu--${mode}`, rest.className);
|
84
|
+
const renderItem = (item, index) => {
|
85
|
+
if (item.children) {
|
86
|
+
return /*#__PURE__*/_jsx(Sub, {
|
87
|
+
id: item.id,
|
88
|
+
icon: item.icon,
|
89
|
+
label: item.label,
|
90
|
+
children: item.children.map(renderItem)
|
91
|
+
}, index);
|
92
|
+
}
|
93
|
+
return (
|
94
|
+
/*#__PURE__*/
|
95
|
+
// eslint-disable-next-line react/no-array-index-key
|
96
|
+
_jsx(Item, {
|
97
|
+
id: item.id,
|
98
|
+
icon: item.icon,
|
99
|
+
label: item.label,
|
100
|
+
active: item.active
|
101
|
+
}, index)
|
102
|
+
);
|
103
|
+
};
|
104
|
+
const StyledRoot = mode === 'inline' ? InlineStyle : HorizontalStyle;
|
105
|
+
return /*#__PURE__*/_jsx(NavMenuContext.Provider, {
|
106
|
+
value: contextValue,
|
107
|
+
children: /*#__PURE__*/_jsx(StyledRoot, {
|
108
|
+
...rest,
|
109
|
+
className: classes,
|
110
|
+
$textColor: textColor,
|
111
|
+
$activeTextColor: activeTextColor,
|
112
|
+
$bgColor: bgColor,
|
113
|
+
children: /*#__PURE__*/_jsx("ul", {
|
114
|
+
className: "navmenu-root",
|
115
|
+
children: items ? items.map(renderItem) : children
|
116
|
+
})
|
117
|
+
})
|
118
|
+
});
|
119
|
+
}
|
120
|
+
NavMenu.propTypes = {
|
121
|
+
items: PropTypes.array,
|
122
|
+
// 默认水平方向布局,
|
123
|
+
// inline 模式: 垂直布局, 且通过 click 事件来收缩/伸展子菜单, 适用于移动端
|
124
|
+
mode: PropTypes.oneOf(['horizontal', 'vertical', 'inline']),
|
125
|
+
children: PropTypes.array,
|
126
|
+
activeId: PropTypes.string,
|
127
|
+
textColor: PropTypes.string,
|
128
|
+
activeTextColor: PropTypes.string,
|
129
|
+
bgColor: PropTypes.string,
|
130
|
+
onSelected: PropTypes.func
|
131
|
+
};
|
132
|
+
NavMenu.defaultProps = {
|
133
|
+
items: null,
|
134
|
+
mode: 'horizontal',
|
135
|
+
children: null,
|
136
|
+
activeId: null,
|
137
|
+
textColor: '#9397a1',
|
138
|
+
activeTextColor: '#25292f',
|
139
|
+
bgColor: '#fff',
|
140
|
+
onSelected: null
|
141
|
+
};
|
142
|
+
|
143
|
+
/**
|
144
|
+
* Item
|
145
|
+
*/
|
146
|
+
function Item({
|
147
|
+
id: _id,
|
148
|
+
icon,
|
149
|
+
label,
|
150
|
+
active,
|
151
|
+
onClick,
|
152
|
+
...rest
|
153
|
+
}) {
|
154
|
+
const id = useUniqueId(_id);
|
155
|
+
const {
|
156
|
+
activeId,
|
157
|
+
activate
|
158
|
+
} = useContext(NavMenuContext);
|
159
|
+
const classes = clsx('navmenu-item', {
|
160
|
+
'navmenu-item--active': activeId === id
|
161
|
+
}, rest.className);
|
162
|
+
useEffect(() => {
|
163
|
+
if (active) {
|
164
|
+
activate(id);
|
165
|
+
}
|
166
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
167
|
+
}, [active]);
|
168
|
+
const handleClick = () => {
|
169
|
+
onClick?.();
|
170
|
+
activate(id);
|
171
|
+
};
|
172
|
+
return (
|
173
|
+
/*#__PURE__*/
|
174
|
+
// eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions
|
175
|
+
_jsxs("li", {
|
176
|
+
...rest,
|
177
|
+
className: classes,
|
178
|
+
onClick: handleClick,
|
179
|
+
children: [icon && /*#__PURE__*/_jsx("span", {
|
180
|
+
className: "navmenu-item-icon",
|
181
|
+
children: icon
|
182
|
+
}), /*#__PURE__*/_jsx("span", {
|
183
|
+
className: "navmenu-item-label",
|
184
|
+
children: label
|
185
|
+
})]
|
186
|
+
})
|
187
|
+
);
|
188
|
+
}
|
189
|
+
Item.propTypes = {
|
190
|
+
id: PropTypes.string,
|
191
|
+
icon: PropTypes.element,
|
192
|
+
label: PropTypes.node,
|
193
|
+
active: PropTypes.bool,
|
194
|
+
onClick: PropTypes.func
|
195
|
+
};
|
196
|
+
Item.defaultProps = {
|
197
|
+
id: null,
|
198
|
+
icon: null,
|
199
|
+
label: '',
|
200
|
+
active: false,
|
201
|
+
onClick: null
|
202
|
+
};
|
203
|
+
|
204
|
+
/**
|
205
|
+
* Sub
|
206
|
+
*/
|
207
|
+
function Sub({
|
208
|
+
id: _id,
|
209
|
+
icon,
|
210
|
+
label,
|
211
|
+
children,
|
212
|
+
expandIcon,
|
213
|
+
...rest
|
214
|
+
}) {
|
215
|
+
const id = useUniqueId(_id);
|
216
|
+
const {
|
217
|
+
openedIds,
|
218
|
+
open,
|
219
|
+
close,
|
220
|
+
mode
|
221
|
+
} = useContext(NavMenuContext);
|
222
|
+
const isOpen = openedIds.includes(id);
|
223
|
+
const classes = clsx('navmenu-sub', {
|
224
|
+
'navmenu-sub--opened': isOpen
|
225
|
+
}, rest.className);
|
226
|
+
const isInlineMode = mode === 'inline';
|
227
|
+
// inline mode 时使用 click 事件控制收缩/伸展子菜单
|
228
|
+
const props = isInlineMode ? {
|
229
|
+
onClick: () => openedIds.includes(id) ? close(id) : open(id)
|
230
|
+
} : {
|
231
|
+
onMouseEnter: () => open(id),
|
232
|
+
onMouseLeave: () => close(id)
|
233
|
+
};
|
234
|
+
// inline mode, 避免点击子菜单项时触发父菜单的 open/close
|
235
|
+
const containerProps = isInlineMode ? {
|
236
|
+
onClick: e => e.stopPropagation()
|
237
|
+
} : {};
|
238
|
+
return /*#__PURE__*/_jsxs("li", {
|
239
|
+
...rest,
|
240
|
+
className: classes,
|
241
|
+
...props,
|
242
|
+
children: [icon && /*#__PURE__*/_jsx("span", {
|
243
|
+
className: "navmenu-sub-icon",
|
244
|
+
children: icon
|
245
|
+
}), /*#__PURE__*/_jsx("span", {
|
246
|
+
className: "navmenu-sub-label",
|
247
|
+
children: label
|
248
|
+
}), expandIcon && /*#__PURE__*/_jsx("span", {
|
249
|
+
className: "navmenu-sub-expand-icon",
|
250
|
+
children: expandIcon?.({
|
251
|
+
isOpen
|
252
|
+
}) || expandIcon
|
253
|
+
}), /*#__PURE__*/_jsx("div", {
|
254
|
+
className: "navmenu-sub-container",
|
255
|
+
...containerProps,
|
256
|
+
children: /*#__PURE__*/_jsx("ul", {
|
257
|
+
className: "navmenu-sub-list",
|
258
|
+
children: filterItems(children)
|
259
|
+
})
|
260
|
+
})]
|
261
|
+
});
|
262
|
+
}
|
263
|
+
Sub.propTypes = {
|
264
|
+
id: PropTypes.string,
|
265
|
+
icon: PropTypes.element,
|
266
|
+
label: PropTypes.node.isRequired,
|
267
|
+
children: PropTypes.array.isRequired,
|
268
|
+
expandIcon: PropTypes.oneOfType([PropTypes.node, PropTypes.func])
|
269
|
+
};
|
270
|
+
Sub.defaultProps = {
|
271
|
+
id: null,
|
272
|
+
icon: null,
|
273
|
+
// eslint-disable-next-line react/prop-types
|
274
|
+
expandIcon: ({
|
275
|
+
isOpen
|
276
|
+
}) => {
|
277
|
+
return /*#__PURE__*/_jsx(ExpandMoreIcon, {
|
278
|
+
style: {
|
279
|
+
transform: `rotate(${isOpen ? 180 : 0}deg)`
|
280
|
+
}
|
281
|
+
});
|
282
|
+
}
|
283
|
+
};
|
284
|
+
NavMenu.Item = Item;
|
285
|
+
NavMenu.Sub = Sub;
|
286
|
+
export default NavMenu;
|
@@ -0,0 +1,176 @@
|
|
1
|
+
import { styled } from '../Theme';
|
2
|
+
const NavMenuBase = styled('nav')`
|
3
|
+
background-color: ${props => props.$bgColor};
|
4
|
+
font-size: 16px;
|
5
|
+
ul {
|
6
|
+
list-style: none;
|
7
|
+
margin: 0;
|
8
|
+
padding: 0;
|
9
|
+
}
|
10
|
+
.navmenu-item,
|
11
|
+
.navmenu-sub {
|
12
|
+
display: flex;
|
13
|
+
align-items: center;
|
14
|
+
}
|
15
|
+
a {
|
16
|
+
color: inherit;
|
17
|
+
text-decoration: none;
|
18
|
+
}
|
19
|
+
/* active/hover */
|
20
|
+
.navmenu-item,
|
21
|
+
.navmenu-sub {
|
22
|
+
color: ${props => props.$textColor};
|
23
|
+
}
|
24
|
+
.navmenu-item--active,
|
25
|
+
.navmenu-item:hover,
|
26
|
+
.navmenu-sub--opened {
|
27
|
+
color: ${props => props.$activeTextColor};
|
28
|
+
}
|
29
|
+
|
30
|
+
.navmenu-item {
|
31
|
+
position: relative;
|
32
|
+
cursor: pointer;
|
33
|
+
transition: color 0.2s ease-in-out;
|
34
|
+
a {
|
35
|
+
white-space: nowrap;
|
36
|
+
}
|
37
|
+
a::before {
|
38
|
+
position: absolute;
|
39
|
+
top: 0;
|
40
|
+
right: 0;
|
41
|
+
bottom: 0;
|
42
|
+
left: 0;
|
43
|
+
background-color: transparent;
|
44
|
+
content: '';
|
45
|
+
}
|
46
|
+
}
|
47
|
+
|
48
|
+
.navmenu-sub {
|
49
|
+
position: relative;
|
50
|
+
cursor: pointer;
|
51
|
+
}
|
52
|
+
/* icon & expand icon */
|
53
|
+
.navmenu-item-icon,
|
54
|
+
.navmenu-sub-icon,
|
55
|
+
.navmenu-sub-expand-icon {
|
56
|
+
display: flex;
|
57
|
+
line-height: 1;
|
58
|
+
}
|
59
|
+
.navmenu-item-icon,
|
60
|
+
.navmenu-sub-icon {
|
61
|
+
margin-right: 4px;
|
62
|
+
}
|
63
|
+
.navmenu-item-icon > *,
|
64
|
+
.navmenu-sub-icon > * {
|
65
|
+
width: auto;
|
66
|
+
height: 22px;
|
67
|
+
max-height: 22px;
|
68
|
+
font-size: 1.5em;
|
69
|
+
}
|
70
|
+
.navmenu-sub-expand-icon {
|
71
|
+
margin-left: 8px;
|
72
|
+
> * {
|
73
|
+
width: 0.8em;
|
74
|
+
height: 0.8em;
|
75
|
+
transition: transform 0.2s ease-in-out;
|
76
|
+
}
|
77
|
+
}
|
78
|
+
`;
|
79
|
+
export const HorizontalStyle = styled(NavMenuBase)`
|
80
|
+
padding: 8px 16px;
|
81
|
+
.navmenu-root {
|
82
|
+
display: flex;
|
83
|
+
align-items: center;
|
84
|
+
}
|
85
|
+
/* 顶级菜单间隔 */
|
86
|
+
.navmenu-root > .navmenu-item,
|
87
|
+
.navmenu-root > .navmenu-sub {
|
88
|
+
margin-left: 24px;
|
89
|
+
}
|
90
|
+
.navmenu-root > .navmenu-item:first-of-type,
|
91
|
+
.navmenu-root > .navmenu-sub:first-of-type {
|
92
|
+
margin-left: 0;
|
93
|
+
}
|
94
|
+
|
95
|
+
/* 子级列表 */
|
96
|
+
.navmenu-sub-container {
|
97
|
+
display: none;
|
98
|
+
position: absolute;
|
99
|
+
top: 100%;
|
100
|
+
}
|
101
|
+
.navmenu-sub-list {
|
102
|
+
padding: 16px;
|
103
|
+
border-radius: 4px;
|
104
|
+
background: #fff;
|
105
|
+
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
|
106
|
+
.navmenu-item + .navmenu-item {
|
107
|
+
margin-top: 8px;
|
108
|
+
}
|
109
|
+
}
|
110
|
+
/* 二级 sub menu */
|
111
|
+
.navmenu-root > .navmenu-sub {
|
112
|
+
> .navmenu-sub-container {
|
113
|
+
left: 50%;
|
114
|
+
transform: translateX(-50%);
|
115
|
+
padding-top: 16px;
|
116
|
+
}
|
117
|
+
&.navmenu-sub--opened > .navmenu-sub-container {
|
118
|
+
display: block;
|
119
|
+
}
|
120
|
+
}
|
121
|
+
`;
|
122
|
+
|
123
|
+
/* inline mode */
|
124
|
+
export const InlineStyle = styled(NavMenuBase)`
|
125
|
+
font-size: 16px;
|
126
|
+
.navmenu-root {
|
127
|
+
display: flex;
|
128
|
+
flex-direction: column;
|
129
|
+
align-items: stretch;
|
130
|
+
}
|
131
|
+
.navmenu-item,
|
132
|
+
.navmenu-sub {
|
133
|
+
padding: 0 16px;
|
134
|
+
}
|
135
|
+
& .navmenu-sub {
|
136
|
+
flex-wrap: wrap;
|
137
|
+
}
|
138
|
+
/* 顶级 */
|
139
|
+
.navmenu-root > .navmenu-item,
|
140
|
+
.navmenu-root > .navmenu-sub {
|
141
|
+
line-height: 48px;
|
142
|
+
border-bottom: 1px solid #eee;
|
143
|
+
}
|
144
|
+
/* icon */
|
145
|
+
.navmenu-item-icon,
|
146
|
+
.navmenu-sub-icon {
|
147
|
+
width: 30px;
|
148
|
+
margin: 0;
|
149
|
+
}
|
150
|
+
.navmenu-sub-expand-icon {
|
151
|
+
margin-left: auto;
|
152
|
+
}
|
153
|
+
/* 子级列表 */
|
154
|
+
.navmenu-sub-container {
|
155
|
+
display: none;
|
156
|
+
flex: 1 0 100%;
|
157
|
+
margin: 0 -16px;
|
158
|
+
padding-bottom: 8px;
|
159
|
+
.navmenu-item,
|
160
|
+
.navmenu-sub {
|
161
|
+
line-height: 32px;
|
162
|
+
}
|
163
|
+
}
|
164
|
+
.navmenu-sub-list {
|
165
|
+
padding-left: 16px;
|
166
|
+
.navmenu-item,
|
167
|
+
.navmenu-sub {
|
168
|
+
padding-left: 30px;
|
169
|
+
font-size: 13px;
|
170
|
+
}
|
171
|
+
}
|
172
|
+
/* 二级 menu */
|
173
|
+
.navmenu-sub--opened > .navmenu-sub-container {
|
174
|
+
display: block;
|
175
|
+
}
|
176
|
+
`;
|