@blocklet/ui-react 2.9.91 → 2.10.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/build.config.ts +1 -6
- package/lib/@types/index.d.ts +1 -0
- package/lib/@types/index.js +0 -1
- package/lib/BlockletStudio/index.js +50 -50
- package/lib/ComponentInstaller/index.js +122 -202
- package/lib/ComponentInstaller/installer-item.js +116 -138
- package/lib/ComponentInstaller/locales.js +5 -10
- package/lib/ComponentInstaller/use-component-installed.js +37 -41
- package/lib/ComponentManager/components/add-component.js +58 -67
- package/lib/ComponentManager/components/check-component.js +2 -9
- package/lib/ComponentManager/components/publish-component.js +50 -59
- package/lib/ComponentManager/components/resource-dialog.js +42 -39
- package/lib/ComponentManager/index.js +3 -27
- package/lib/ComponentManager/libs/locales.js +2 -8
- package/lib/Dashboard/index.js +74 -99
- package/lib/Footer/brand.js +21 -43
- package/lib/Footer/copyright.js +15 -24
- package/lib/Footer/index.js +47 -71
- package/lib/Footer/internal-footer.js +72 -100
- package/lib/Footer/layout/plain.js +26 -45
- package/lib/Footer/layout/row.js +12 -29
- package/lib/Footer/layout/standard.js +34 -64
- package/lib/Footer/links.js +74 -104
- package/lib/Footer/social-media.js +35 -42
- package/lib/Header/index.js +69 -117
- package/lib/Icon/index.js +18 -53
- package/{es/UserCenter/components/notification.d.ts → lib/UserCenter/components/config-profile.d.ts} +1 -1
- package/lib/UserCenter/components/config-profile.js +67 -0
- package/lib/UserCenter/components/notification.js +203 -186
- package/lib/UserCenter/components/passport.js +70 -79
- package/lib/UserCenter/components/privacy.js +86 -88
- package/lib/UserCenter/components/settings.js +74 -84
- package/lib/UserCenter/components/storage/connect-to.js +56 -75
- package/lib/UserCenter/components/storage/connected.js +16 -37
- package/lib/UserCenter/components/storage/delete.js +42 -51
- package/lib/UserCenter/components/storage/disconnect.js +15 -29
- package/lib/UserCenter/components/storage/index.js +20 -54
- package/lib/UserCenter/components/storage/item.js +94 -122
- package/lib/UserCenter/components/storage/preview-nft.js +77 -85
- package/lib/UserCenter/components/third-party-login/index.js +49 -61
- package/lib/UserCenter/components/third-party-login/third-party-item.js +159 -176
- package/lib/UserCenter/components/user-center.js +276 -287
- package/lib/UserCenter/components/user-info/index.js +3 -27
- package/lib/UserCenter/components/user-info/user-basic-info.js +134 -129
- package/lib/UserCenter/components/user-info/user-info-item.js +43 -37
- package/lib/UserCenter/components/user-info/user-info.js +41 -74
- package/lib/UserCenter/components/webhook-item.js +184 -177
- package/lib/UserCenter/index.js +1 -13
- package/lib/UserCenter/libs/api.js +4 -16
- package/lib/UserCenter/libs/locales.d.ts +10 -0
- package/lib/UserCenter/libs/locales.js +12 -8
- package/lib/UserCenter/libs/utils.js +7 -17
- package/lib/UserSessions/components/user-session-info.js +88 -85
- package/lib/UserSessions/components/user-sessions.js +177 -213
- package/lib/UserSessions/index.js +1 -13
- package/lib/UserSessions/libs/locales.js +2 -8
- package/lib/UserSessions/libs/utils.js +4 -11
- package/lib/blocklets.js +59 -63
- package/lib/common/header-addons.js +44 -60
- package/lib/common/link-blocker.js +9 -18
- package/lib/common/overridable-theme-provider.js +10 -23
- package/lib/common/wallet-hidden-topbar.js +7 -14
- package/lib/contexts/config-user-space.js +38 -46
- package/lib/hooks/use-mobile.js +5 -13
- package/lib/index.js +10 -100
- package/lib/libs/client.js +2 -8
- package/lib/libs/spaces.js +6 -13
- package/lib/types.js +39 -41
- package/lib/utils.js +25 -44
- package/package.json +8 -38
- package/src/@types/index.ts +1 -0
- package/src/Footer/brand.jsx +6 -1
- package/src/UserCenter/components/config-profile.tsx +70 -0
- package/src/UserCenter/components/notification.tsx +63 -47
- package/src/UserCenter/components/settings.tsx +6 -0
- package/src/UserCenter/libs/locales.ts +10 -0
- package/es/@types/index.d.ts +0 -101
- package/es/@types/index.js +0 -0
- package/es/@types/shims.d.ts +0 -16
- package/es/BlockletStudio/index.d.ts +0 -28
- package/es/BlockletStudio/index.js +0 -114
- package/es/ComponentInstaller/index.d.ts +0 -37
- package/es/ComponentInstaller/index.js +0 -200
- package/es/ComponentInstaller/installer-item.d.ts +0 -21
- package/es/ComponentInstaller/installer-item.js +0 -139
- package/es/ComponentInstaller/locales.d.ts +0 -28
- package/es/ComponentInstaller/locales.js +0 -22
- package/es/ComponentInstaller/use-component-installed.d.ts +0 -12
- package/es/ComponentInstaller/use-component-installed.js +0 -88
- package/es/ComponentManager/components/add-component.d.ts +0 -16
- package/es/ComponentManager/components/add-component.js +0 -114
- package/es/ComponentManager/components/check-component.d.ts +0 -2
- package/es/ComponentManager/components/check-component.js +0 -2
- package/es/ComponentManager/components/publish-component.d.ts +0 -10
- package/es/ComponentManager/components/publish-component.js +0 -76
- package/es/ComponentManager/components/resource-dialog.d.ts +0 -14
- package/es/ComponentManager/components/resource-dialog.js +0 -74
- package/es/ComponentManager/index.d.ts +0 -3
- package/es/ComponentManager/index.js +0 -3
- package/es/ComponentManager/libs/locales.d.ts +0 -14
- package/es/ComponentManager/libs/locales.js +0 -14
- package/es/Dashboard/index.d.ts +0 -40
- package/es/Dashboard/index.js +0 -118
- package/es/Footer/brand.d.ts +0 -22
- package/es/Footer/brand.js +0 -73
- package/es/Footer/copyright.d.ts +0 -18
- package/es/Footer/copyright.js +0 -25
- package/es/Footer/index.d.ts +0 -6
- package/es/Footer/index.js +0 -82
- package/es/Footer/internal-footer.d.ts +0 -29
- package/es/Footer/internal-footer.js +0 -117
- package/es/Footer/layout/plain.d.ts +0 -15
- package/es/Footer/layout/plain.js +0 -39
- package/es/Footer/layout/row.d.ts +0 -18
- package/es/Footer/layout/row.js +0 -41
- package/es/Footer/layout/standard.d.ts +0 -15
- package/es/Footer/layout/standard.js +0 -53
- package/es/Footer/links.d.ts +0 -22
- package/es/Footer/links.js +0 -207
- package/es/Footer/social-media.d.ts +0 -14
- package/es/Footer/social-media.js +0 -60
- package/es/Header/index.d.ts +0 -10
- package/es/Header/index.js +0 -155
- package/es/Icon/index.d.ts +0 -23
- package/es/Icon/index.js +0 -55
- package/es/UserCenter/assets/banner.png +0 -0
- package/es/UserCenter/components/notification.js +0 -248
- package/es/UserCenter/components/passport.d.ts +0 -6
- package/es/UserCenter/components/passport.js +0 -88
- package/es/UserCenter/components/privacy.d.ts +0 -11
- package/es/UserCenter/components/privacy.js +0 -99
- package/es/UserCenter/components/settings.d.ts +0 -9
- package/es/UserCenter/components/settings.js +0 -89
- package/es/UserCenter/components/storage/connect-to.d.ts +0 -7
- package/es/UserCenter/components/storage/connect-to.js +0 -108
- package/es/UserCenter/components/storage/connected.d.ts +0 -7
- package/es/UserCenter/components/storage/connected.js +0 -24
- package/es/UserCenter/components/storage/delete.d.ts +0 -7
- package/es/UserCenter/components/storage/delete.js +0 -62
- package/es/UserCenter/components/storage/disconnect.d.ts +0 -3
- package/es/UserCenter/components/storage/disconnect.js +0 -23
- package/es/UserCenter/components/storage/icons/empty-spaces-nft.svg +0 -58
- package/es/UserCenter/components/storage/icons/long-arrow.svg +0 -5
- package/es/UserCenter/components/storage/icons/space-connected.svg +0 -3
- package/es/UserCenter/components/storage/icons/space-disconnect.svg +0 -3
- package/es/UserCenter/components/storage/index.d.ts +0 -3
- package/es/UserCenter/components/storage/index.js +0 -27
- package/es/UserCenter/components/storage/item.d.ts +0 -9
- package/es/UserCenter/components/storage/item.js +0 -158
- package/es/UserCenter/components/storage/preview-nft.d.ts +0 -6
- package/es/UserCenter/components/storage/preview-nft.js +0 -80
- package/es/UserCenter/components/third-party-login/index.d.ts +0 -5
- package/es/UserCenter/components/third-party-login/index.js +0 -110
- package/es/UserCenter/components/third-party-login/third-party-item.d.ts +0 -13
- package/es/UserCenter/components/third-party-login/third-party-item.js +0 -224
- package/es/UserCenter/components/user-center.d.ts +0 -15
- package/es/UserCenter/components/user-center.js +0 -414
- package/es/UserCenter/components/user-info/index.d.ts +0 -3
- package/es/UserCenter/components/user-info/index.js +0 -3
- package/es/UserCenter/components/user-info/user-basic-info.d.ts +0 -11
- package/es/UserCenter/components/user-info/user-basic-info.js +0 -151
- package/es/UserCenter/components/user-info/user-info-item.d.ts +0 -11
- package/es/UserCenter/components/user-info/user-info-item.js +0 -47
- package/es/UserCenter/components/user-info/user-info.d.ts +0 -6
- package/es/UserCenter/components/user-info/user-info.js +0 -66
- package/es/UserCenter/components/webhook-item.d.ts +0 -3
- package/es/UserCenter/components/webhook-item.js +0 -243
- package/es/UserCenter/index.d.ts +0 -1
- package/es/UserCenter/index.js +0 -1
- package/es/UserCenter/libs/api.d.ts +0 -3
- package/es/UserCenter/libs/api.js +0 -4
- package/es/UserCenter/libs/locales.d.ts +0 -162
- package/es/UserCenter/libs/locales.js +0 -162
- package/es/UserCenter/libs/utils.d.ts +0 -4
- package/es/UserCenter/libs/utils.js +0 -14
- package/es/UserSessions/components/user-session-info.d.ts +0 -6
- package/es/UserSessions/components/user-session-info.js +0 -92
- package/es/UserSessions/components/user-sessions.d.ts +0 -9
- package/es/UserSessions/components/user-sessions.js +0 -265
- package/es/UserSessions/index.d.ts +0 -1
- package/es/UserSessions/index.js +0 -1
- package/es/UserSessions/libs/locales.d.ts +0 -58
- package/es/UserSessions/libs/locales.js +0 -58
- package/es/UserSessions/libs/utils.d.ts +0 -2
- package/es/UserSessions/libs/utils.js +0 -73
- package/es/blocklets.d.ts +0 -16
- package/es/blocklets.js +0 -178
- package/es/common/header-addons.d.ts +0 -21
- package/es/common/header-addons.js +0 -83
- package/es/common/link-blocker.d.ts +0 -7
- package/es/common/link-blocker.js +0 -18
- package/es/common/overridable-theme-provider.d.ts +0 -18
- package/es/common/overridable-theme-provider.js +0 -15
- package/es/common/wallet-hidden-topbar.d.ts +0 -1
- package/es/common/wallet-hidden-topbar.js +0 -14
- package/es/contexts/config-user-space.d.ts +0 -26
- package/es/contexts/config-user-space.js +0 -53
- package/es/hooks/use-mobile.d.ts +0 -4
- package/es/hooks/use-mobile.js +0 -5
- package/es/index.d.ts +0 -10
- package/es/index.js +0 -10
- package/es/libs/client.d.ts +0 -2
- package/es/libs/client.js +0 -2
- package/es/libs/spaces.d.ts +0 -2
- package/es/libs/spaces.js +0 -13
- package/es/types.d.ts +0 -2
- package/es/types.js +0 -43
- package/es/utils.d.ts +0 -8
- package/es/utils.js +0 -78
package/es/Dashboard/index.d.ts
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
export default Dashboard;
|
|
2
|
-
/**
|
|
3
|
-
* 专门用于 (composable) blocklet 的 Dashboard 组件, 解析 blocklet meta 中 section 为 dashboard 的 navigation 数据, 渲染一个 UX Dashboard
|
|
4
|
-
*/
|
|
5
|
-
declare function Dashboard({ meta, fallbackUrl, invalidPathFallback, headerAddons, sessionManagerProps, links, ...rest }: {
|
|
6
|
-
[x: string]: any;
|
|
7
|
-
meta: any;
|
|
8
|
-
fallbackUrl: any;
|
|
9
|
-
invalidPathFallback: any;
|
|
10
|
-
headerAddons: any;
|
|
11
|
-
sessionManagerProps: any;
|
|
12
|
-
links: any;
|
|
13
|
-
}): import("react").JSX.Element | null;
|
|
14
|
-
declare namespace Dashboard {
|
|
15
|
-
namespace propTypes {
|
|
16
|
-
export { BlockletMetaProps as meta };
|
|
17
|
-
export let fallbackUrl: any;
|
|
18
|
-
export let invalidPathFallback: any;
|
|
19
|
-
export let headerAddons: any;
|
|
20
|
-
export { SessionManagerProps as sessionManagerProps };
|
|
21
|
-
export let links: any;
|
|
22
|
-
}
|
|
23
|
-
namespace defaultProps {
|
|
24
|
-
export let meta: {};
|
|
25
|
-
export { publicPath as fallbackUrl };
|
|
26
|
-
let invalidPathFallback_1: null;
|
|
27
|
-
export { invalidPathFallback_1 as invalidPathFallback };
|
|
28
|
-
let headerAddons_1: undefined;
|
|
29
|
-
export { headerAddons_1 as headerAddons };
|
|
30
|
-
export namespace sessionManagerProps {
|
|
31
|
-
let showRole: boolean;
|
|
32
|
-
function onLogout(): void;
|
|
33
|
-
}
|
|
34
|
-
let links_1: never[];
|
|
35
|
-
export { links_1 as links };
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
import { BlockletMetaProps } from '../types';
|
|
39
|
-
import { SessionManagerProps } from '../types';
|
|
40
|
-
import { publicPath } from '../blocklets';
|
package/es/Dashboard/index.js
DELETED
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import "iconify-icon";
|
|
3
|
-
import { useMemo, useLayoutEffect, useContext } from "react";
|
|
4
|
-
import PropTypes from "prop-types";
|
|
5
|
-
import { SessionContext } from "@arcblock/did-connect/lib/Session";
|
|
6
|
-
import { useLocaleContext } from "@arcblock/ux/lib/Locale/context";
|
|
7
|
-
import UxDashboard from "@arcblock/ux/lib/Layout/dashboard";
|
|
8
|
-
import { BlockletMetaProps, SessionManagerProps } from "../types.js";
|
|
9
|
-
import { mapRecursive, flatRecursive, matchPaths } from "../utils.js";
|
|
10
|
-
import { publicPath, formatBlockletInfo, getLocalizedNavigation, filterNavByRole } from "../blocklets.js";
|
|
11
|
-
import HeaderAddons from "../common/header-addons.js";
|
|
12
|
-
import { useWalletHiddenTopbar } from "../common/wallet-hidden-topbar.js";
|
|
13
|
-
function Dashboard({ meta, fallbackUrl, invalidPathFallback, headerAddons, sessionManagerProps, links, ...rest }) {
|
|
14
|
-
useWalletHiddenTopbar();
|
|
15
|
-
const sessionCtx = useContext(SessionContext);
|
|
16
|
-
const user = sessionCtx?.session?.user;
|
|
17
|
-
const userRole = user?.role;
|
|
18
|
-
const { locale } = useLocaleContext() || {};
|
|
19
|
-
const formattedBlocklet = useMemo(() => {
|
|
20
|
-
const blocklet = Object.assign({}, window.blocklet, meta);
|
|
21
|
-
try {
|
|
22
|
-
return formatBlockletInfo(blocklet);
|
|
23
|
-
} catch (e) {
|
|
24
|
-
console.error("Failed to format blocklet info", e, blocklet);
|
|
25
|
-
return blocklet;
|
|
26
|
-
}
|
|
27
|
-
}, [meta]);
|
|
28
|
-
const { localizedNav, flattened, matchedIndex } = useMemo(() => {
|
|
29
|
-
let localizedNav2 = getLocalizedNavigation(formattedBlocklet?.navigation?.dashboard, locale) || [];
|
|
30
|
-
localizedNav2 = filterNavByRole(localizedNav2, userRole);
|
|
31
|
-
localizedNav2 = mapRecursive(
|
|
32
|
-
localizedNav2,
|
|
33
|
-
(item) => ({
|
|
34
|
-
title: item.title,
|
|
35
|
-
url: item.link,
|
|
36
|
-
icon: item.icon ? /* @__PURE__ */ jsx("iconify-icon", { height: "100%", width: "100%", icon: item.icon }) : null,
|
|
37
|
-
// https://github.com/ArcBlock/ux/issues/755#issuecomment-1208692620
|
|
38
|
-
external: true,
|
|
39
|
-
children: item.items
|
|
40
|
-
}),
|
|
41
|
-
"items"
|
|
42
|
-
);
|
|
43
|
-
const flattened2 = flatRecursive(localizedNav2).filter((item) => !!item.url);
|
|
44
|
-
const matchedIndex2 = matchPaths(flattened2.map((item) => item.url));
|
|
45
|
-
if (matchedIndex2 !== -1) {
|
|
46
|
-
flattened2[matchedIndex2].active = true;
|
|
47
|
-
}
|
|
48
|
-
return { localizedNav: localizedNav2, flattened: flattened2, matchedIndex: matchedIndex2 };
|
|
49
|
-
}, [formattedBlocklet, locale, userRole]);
|
|
50
|
-
const allLinks = typeof links === "function" ? links(localizedNav) : [...localizedNav, ...links];
|
|
51
|
-
useLayoutEffect(() => {
|
|
52
|
-
if (!!user && !flattened?.length && fallbackUrl) {
|
|
53
|
-
window.location.href = fallbackUrl;
|
|
54
|
-
}
|
|
55
|
-
}, [fallbackUrl]);
|
|
56
|
-
useLayoutEffect(() => {
|
|
57
|
-
if (!!user && !!flattened?.length && matchedIndex === -1) {
|
|
58
|
-
if (invalidPathFallback) {
|
|
59
|
-
invalidPathFallback();
|
|
60
|
-
} else {
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
}, [invalidPathFallback, flattened, matchedIndex]);
|
|
64
|
-
if (!formattedBlocklet.appName) {
|
|
65
|
-
return null;
|
|
66
|
-
}
|
|
67
|
-
const { appLogo, appLogoRect, appName } = formattedBlocklet;
|
|
68
|
-
const _headerAddons = /* @__PURE__ */ jsx(
|
|
69
|
-
HeaderAddons,
|
|
70
|
-
{
|
|
71
|
-
formattedBlocklet,
|
|
72
|
-
addons: headerAddons,
|
|
73
|
-
sessionManagerProps
|
|
74
|
-
}
|
|
75
|
-
);
|
|
76
|
-
return /* @__PURE__ */ jsx(
|
|
77
|
-
UxDashboard,
|
|
78
|
-
{
|
|
79
|
-
title: appName,
|
|
80
|
-
fullWidth: true,
|
|
81
|
-
sidebarWidth: 128,
|
|
82
|
-
legacy: false,
|
|
83
|
-
links: allLinks,
|
|
84
|
-
...rest,
|
|
85
|
-
headerProps: {
|
|
86
|
-
homeLink: publicPath,
|
|
87
|
-
logo: /* @__PURE__ */ jsx("img", { src: appLogoRect || appLogo, alt: "logo" }),
|
|
88
|
-
addons: _headerAddons,
|
|
89
|
-
...rest.headerProps
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
);
|
|
93
|
-
}
|
|
94
|
-
Dashboard.propTypes = {
|
|
95
|
-
meta: BlockletMetaProps,
|
|
96
|
-
// 如果当前用户没有权限访问任何导航菜单, 则自动跳转到 fallbackUrl, 默认值为 publicPath, 设置为 null 表示禁用自动跳转
|
|
97
|
-
fallbackUrl: PropTypes.string,
|
|
98
|
-
// 当前路径未匹配任何 nav links 时的 fallback, 默认行为跳转到首个可用的 nav link
|
|
99
|
-
invalidPathFallback: PropTypes.func,
|
|
100
|
-
headerAddons: PropTypes.oneOfType([PropTypes.func, PropTypes.node]),
|
|
101
|
-
sessionManagerProps: SessionManagerProps,
|
|
102
|
-
links: PropTypes.oneOfType([PropTypes.array, PropTypes.func])
|
|
103
|
-
};
|
|
104
|
-
Dashboard.defaultProps = {
|
|
105
|
-
meta: {},
|
|
106
|
-
fallbackUrl: publicPath,
|
|
107
|
-
invalidPathFallback: null,
|
|
108
|
-
headerAddons: void 0,
|
|
109
|
-
sessionManagerProps: {
|
|
110
|
-
showRole: true,
|
|
111
|
-
// dashboard 默认退出登录行为: 跳转到 (root) blocklet 首页
|
|
112
|
-
onLogout: () => {
|
|
113
|
-
window.location.href = publicPath;
|
|
114
|
-
}
|
|
115
|
-
},
|
|
116
|
-
links: []
|
|
117
|
-
};
|
|
118
|
-
export default Dashboard;
|
package/es/Footer/brand.d.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
declare function Brand({ name, logo, description, ...rest }: {
|
|
2
|
-
[x: string]: any;
|
|
3
|
-
name: any;
|
|
4
|
-
logo: any;
|
|
5
|
-
description: any;
|
|
6
|
-
}): import("react").JSX.Element | null;
|
|
7
|
-
declare namespace Brand {
|
|
8
|
-
namespace propTypes {
|
|
9
|
-
let name: any;
|
|
10
|
-
let logo: any;
|
|
11
|
-
let description: any;
|
|
12
|
-
}
|
|
13
|
-
namespace defaultProps {
|
|
14
|
-
let name_1: string;
|
|
15
|
-
export { name_1 as name };
|
|
16
|
-
let logo_1: string;
|
|
17
|
-
export { logo_1 as logo };
|
|
18
|
-
let description_1: string;
|
|
19
|
-
export { description_1 as description };
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
export default Brand;
|
package/es/Footer/brand.js
DELETED
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { isValidElement } from "react";
|
|
3
|
-
import PropTypes from "prop-types";
|
|
4
|
-
import { styled } from "@arcblock/ux/lib/Theme";
|
|
5
|
-
export default function Brand({ name, logo, description, ...rest }) {
|
|
6
|
-
if (!name && !logo && !description) {
|
|
7
|
-
return null;
|
|
8
|
-
}
|
|
9
|
-
const logoElement = isValidElement(logo) ? logo : /* @__PURE__ */ jsx("img", { src: logo, alt: name });
|
|
10
|
-
return /* @__PURE__ */ jsxs(Root, { ...rest, children: [
|
|
11
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
12
|
-
logo && /* @__PURE__ */ jsx("div", { className: "footer-brand-logo", children: logoElement }),
|
|
13
|
-
name && /* @__PURE__ */ jsx("div", { className: "footer-brand-name", children: name })
|
|
14
|
-
] }),
|
|
15
|
-
description && /* @__PURE__ */ jsx("div", { className: "footer-brand-desc", children: description })
|
|
16
|
-
] });
|
|
17
|
-
}
|
|
18
|
-
Brand.propTypes = {
|
|
19
|
-
name: PropTypes.node,
|
|
20
|
-
logo: PropTypes.node,
|
|
21
|
-
description: PropTypes.string
|
|
22
|
-
};
|
|
23
|
-
Brand.defaultProps = {
|
|
24
|
-
name: "",
|
|
25
|
-
logo: "",
|
|
26
|
-
description: ""
|
|
27
|
-
};
|
|
28
|
-
const Root = styled("div")`
|
|
29
|
-
display: flex;
|
|
30
|
-
flex-direction: column;
|
|
31
|
-
font-size: 14px;
|
|
32
|
-
a {
|
|
33
|
-
text-decoration: none;
|
|
34
|
-
color: inherit;
|
|
35
|
-
}
|
|
36
|
-
> div:first-of-type {
|
|
37
|
-
display: flex;
|
|
38
|
-
align-items: center;
|
|
39
|
-
}
|
|
40
|
-
.footer-brand-logo {
|
|
41
|
-
display: flex;
|
|
42
|
-
align-items: center;
|
|
43
|
-
margin-right: 16px;
|
|
44
|
-
line-height: 1;
|
|
45
|
-
img,
|
|
46
|
-
svg {
|
|
47
|
-
width: auto;
|
|
48
|
-
height: 44px;
|
|
49
|
-
max-height: 44px;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
.footer-brand-name {
|
|
53
|
-
font-size: 16px;
|
|
54
|
-
font-weight: bold;
|
|
55
|
-
}
|
|
56
|
-
.footer-brand-desc {
|
|
57
|
-
margin-top: 16px;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
${(props) => props.theme.breakpoints.down("sm")} {
|
|
61
|
-
width: auto;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
${(props) => props.theme.breakpoints.down("md")} {
|
|
65
|
-
.footer-brand-logo {
|
|
66
|
-
img,
|
|
67
|
-
svg {
|
|
68
|
-
height: 32px;
|
|
69
|
-
max-height: 32px;
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
`;
|
package/es/Footer/copyright.d.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
declare function Copyright({ owner, year, ...rest }: {
|
|
2
|
-
[x: string]: any;
|
|
3
|
-
owner: any;
|
|
4
|
-
year: any;
|
|
5
|
-
}): import("react").JSX.Element;
|
|
6
|
-
declare namespace Copyright {
|
|
7
|
-
namespace propTypes {
|
|
8
|
-
let owner: any;
|
|
9
|
-
let year: any;
|
|
10
|
-
}
|
|
11
|
-
namespace defaultProps {
|
|
12
|
-
let owner_1: string;
|
|
13
|
-
export { owner_1 as owner };
|
|
14
|
-
let year_1: string;
|
|
15
|
-
export { year_1 as year };
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
export default Copyright;
|
package/es/Footer/copyright.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { styled } from "@arcblock/ux/lib/Theme";
|
|
3
|
-
import PropTypes from "prop-types";
|
|
4
|
-
export default function Copyright({ owner, year, ...rest }) {
|
|
5
|
-
return /* @__PURE__ */ jsxs(Root, { ...rest, children: [
|
|
6
|
-
"Copyright \xA9 ",
|
|
7
|
-
year,
|
|
8
|
-
" ",
|
|
9
|
-
owner
|
|
10
|
-
] });
|
|
11
|
-
}
|
|
12
|
-
Copyright.propTypes = {
|
|
13
|
-
owner: PropTypes.string,
|
|
14
|
-
year: PropTypes.string
|
|
15
|
-
};
|
|
16
|
-
Copyright.defaultProps = {
|
|
17
|
-
owner: "ArcBlock",
|
|
18
|
-
year: `${(/* @__PURE__ */ new Date()).getFullYear()}`
|
|
19
|
-
};
|
|
20
|
-
const Root = styled("p")`
|
|
21
|
-
display: flex;
|
|
22
|
-
align-items: center;
|
|
23
|
-
margin: 0;
|
|
24
|
-
font-size: 13px;
|
|
25
|
-
`;
|
package/es/Footer/index.d.ts
DELETED
package/es/Footer/index.js
DELETED
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useMemo } from "react";
|
|
3
|
-
import PropTypes from "prop-types";
|
|
4
|
-
import { styled } from "@arcblock/ux/lib/Theme";
|
|
5
|
-
import { withErrorBoundary } from "react-error-boundary";
|
|
6
|
-
import { useLocaleContext } from "@arcblock/ux/lib/Locale/context";
|
|
7
|
-
import { ErrorFallback } from "@arcblock/ux/lib/ErrorBoundary";
|
|
8
|
-
import { temp as colors } from "@arcblock/ux/lib/Colors";
|
|
9
|
-
import omit from "lodash/omit";
|
|
10
|
-
import OverridableThemeProvider from "../common/overridable-theme-provider.js";
|
|
11
|
-
import InternalFooter from "./internal-footer.js";
|
|
12
|
-
import { mapRecursive } from "../utils.js";
|
|
13
|
-
import { formatBlockletInfo, getLocalizedNavigation } from "../blocklets.js";
|
|
14
|
-
import { BlockletMetaProps } from "../types.js";
|
|
15
|
-
function Footer({ meta, theme: themeOverrides, ...rest }) {
|
|
16
|
-
const { locale } = useLocaleContext() || {};
|
|
17
|
-
const formattedBlocklet = useMemo(() => {
|
|
18
|
-
const blocklet = Object.assign({}, window.blocklet, meta);
|
|
19
|
-
try {
|
|
20
|
-
return formatBlockletInfo(blocklet);
|
|
21
|
-
} catch (e) {
|
|
22
|
-
console.error("Failed to format blocklet info", e, blocklet);
|
|
23
|
-
return blocklet;
|
|
24
|
-
}
|
|
25
|
-
}, [meta]);
|
|
26
|
-
if (!formattedBlocklet.appName) {
|
|
27
|
-
return null;
|
|
28
|
-
}
|
|
29
|
-
const { appLogo, appLogoRect, appName, appDescription, description, theme, copyright } = formattedBlocklet;
|
|
30
|
-
const localized = {
|
|
31
|
-
footerNav: getLocalizedNavigation(formattedBlocklet?.navigation?.footer, locale) || [],
|
|
32
|
-
socialMedia: getLocalizedNavigation(formattedBlocklet?.navigation?.social, locale) || [],
|
|
33
|
-
links: getLocalizedNavigation(formattedBlocklet?.navigation?.bottom, locale) || []
|
|
34
|
-
};
|
|
35
|
-
const props = {
|
|
36
|
-
brand: {
|
|
37
|
-
name: appName,
|
|
38
|
-
description: appDescription || description,
|
|
39
|
-
logo: appLogoRect || appLogo
|
|
40
|
-
},
|
|
41
|
-
navigation: mapRecursive(
|
|
42
|
-
localized.footerNav,
|
|
43
|
-
(item) => ({
|
|
44
|
-
...item,
|
|
45
|
-
label: item.title,
|
|
46
|
-
link: item.link
|
|
47
|
-
}),
|
|
48
|
-
"items"
|
|
49
|
-
),
|
|
50
|
-
copyright,
|
|
51
|
-
socialMedia: localized.socialMedia,
|
|
52
|
-
links: localized.links.map((item) => ({ ...item, label: item.title }))
|
|
53
|
-
};
|
|
54
|
-
return /* @__PURE__ */ jsx(OverridableThemeProvider, { theme: themeOverrides, children: /* @__PURE__ */ jsx(
|
|
55
|
-
StyledInternalFooter,
|
|
56
|
-
{
|
|
57
|
-
...props,
|
|
58
|
-
...omit(rest, ["bordered"]),
|
|
59
|
-
$bordered: rest?.bordered,
|
|
60
|
-
$bgcolor: theme?.background?.footer
|
|
61
|
-
}
|
|
62
|
-
) });
|
|
63
|
-
}
|
|
64
|
-
Footer.propTypes = {
|
|
65
|
-
meta: BlockletMetaProps,
|
|
66
|
-
// 允许覆盖 footer 内置的 theme
|
|
67
|
-
theme: PropTypes.object
|
|
68
|
-
};
|
|
69
|
-
Footer.defaultProps = {
|
|
70
|
-
meta: {},
|
|
71
|
-
theme: null
|
|
72
|
-
};
|
|
73
|
-
const StyledInternalFooter = styled(InternalFooter)`
|
|
74
|
-
${({ $bordered }) => `border-top: 1px solid ${$bordered ? colors.strokeSep : "#eee"};`}
|
|
75
|
-
color: ${(props) => props.theme.palette.grey[600]};
|
|
76
|
-
${({ $bgcolor }) => $bgcolor && `background-color: ${$bgcolor};`}
|
|
77
|
-
font-family: Inter, Avenir, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif,
|
|
78
|
-
'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol';
|
|
79
|
-
`;
|
|
80
|
-
export default withErrorBoundary(Footer, {
|
|
81
|
-
FallbackComponent: ErrorFallback
|
|
82
|
-
});
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
export default InternalFooter;
|
|
2
|
-
/**
|
|
3
|
-
* 通用的内部 footer 组件, 定义并渲染常见的几种 footer 元素: brand/navigation/social medial 等
|
|
4
|
-
*/
|
|
5
|
-
declare function InternalFooter(props: any): import("react").JSX.Element;
|
|
6
|
-
declare namespace InternalFooter {
|
|
7
|
-
namespace propTypes {
|
|
8
|
-
let brand: any;
|
|
9
|
-
let navigation: any;
|
|
10
|
-
let socialMedia: any;
|
|
11
|
-
let copyright: any;
|
|
12
|
-
let links: any;
|
|
13
|
-
let layout: any;
|
|
14
|
-
}
|
|
15
|
-
namespace defaultProps {
|
|
16
|
-
let brand_1: null;
|
|
17
|
-
export { brand_1 as brand };
|
|
18
|
-
let navigation_1: null;
|
|
19
|
-
export { navigation_1 as navigation };
|
|
20
|
-
let copyright_1: null;
|
|
21
|
-
export { copyright_1 as copyright };
|
|
22
|
-
let socialMedia_1: null;
|
|
23
|
-
export { socialMedia_1 as socialMedia };
|
|
24
|
-
let links_1: null;
|
|
25
|
-
export { links_1 as links };
|
|
26
|
-
let layout_1: string;
|
|
27
|
-
export { layout_1 as layout };
|
|
28
|
-
}
|
|
29
|
-
}
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import PropTypes from "prop-types";
|
|
3
|
-
import Box from "@mui/material/Box";
|
|
4
|
-
import Brand from "./brand.js";
|
|
5
|
-
import Links from "./links.js";
|
|
6
|
-
import SocialMedia from "./social-media.js";
|
|
7
|
-
import Copyright from "./copyright.js";
|
|
8
|
-
import StandardLayout from "./layout/standard.js";
|
|
9
|
-
import PlainLayout from "./layout/plain.js";
|
|
10
|
-
const layouts = [
|
|
11
|
-
{
|
|
12
|
-
name: "plain",
|
|
13
|
-
// navigation 数据为空时, 使用简单布局
|
|
14
|
-
support: (_, data) => !data.navigation?.length && !data.socialMedia?.length,
|
|
15
|
-
component: PlainLayout
|
|
16
|
-
},
|
|
17
|
-
{
|
|
18
|
-
name: "standard",
|
|
19
|
-
// 默认标准布局
|
|
20
|
-
support: () => true,
|
|
21
|
-
component: StandardLayout
|
|
22
|
-
}
|
|
23
|
-
];
|
|
24
|
-
const layoutsKeyByName = layouts.reduce((acc, cur) => ({ ...acc, [cur.name]: cur }), {});
|
|
25
|
-
function InternalFooter(props) {
|
|
26
|
-
const { brand, navigation, socialMedia, copyright, links, layout, ...rest } = props;
|
|
27
|
-
const renderBrand = () => {
|
|
28
|
-
return brand ? /* @__PURE__ */ jsx(Brand, { ...brand }) : null;
|
|
29
|
-
};
|
|
30
|
-
const renderNavigation = () => {
|
|
31
|
-
return navigation?.length ? /* @__PURE__ */ jsx(Links, { links: navigation }) : null;
|
|
32
|
-
};
|
|
33
|
-
const renderSocialMedia = () => {
|
|
34
|
-
return socialMedia?.length ? /* @__PURE__ */ jsx(SocialMedia, { items: socialMedia }) : null;
|
|
35
|
-
};
|
|
36
|
-
const renderCopyright = () => {
|
|
37
|
-
const copyrightOwner = copyright?.owner || brand?.name;
|
|
38
|
-
if (!copyrightOwner) {
|
|
39
|
-
return null;
|
|
40
|
-
}
|
|
41
|
-
return /* @__PURE__ */ jsx(Copyright, { owner: copyrightOwner, year: copyright?.year || void 0 });
|
|
42
|
-
};
|
|
43
|
-
const renderLinks = () => {
|
|
44
|
-
return links?.length ? /* @__PURE__ */ jsx(Links, { flowLayout: true, links }) : null;
|
|
45
|
-
};
|
|
46
|
-
const elements = {
|
|
47
|
-
brand: renderBrand(),
|
|
48
|
-
navigation: renderNavigation(),
|
|
49
|
-
socialMedia: renderSocialMedia(),
|
|
50
|
-
copyright: renderCopyright(),
|
|
51
|
-
links: renderLinks()
|
|
52
|
-
};
|
|
53
|
-
let LayoutComponent = null;
|
|
54
|
-
if (layout === "auto") {
|
|
55
|
-
LayoutComponent = layouts.find((item) => item.support(elements, props)).component;
|
|
56
|
-
} else {
|
|
57
|
-
LayoutComponent = layoutsKeyByName[layout]?.component;
|
|
58
|
-
}
|
|
59
|
-
if (!LayoutComponent) {
|
|
60
|
-
throw new Error(`layout ${layout} is not supported.`);
|
|
61
|
-
}
|
|
62
|
-
return /* @__PURE__ */ jsxs(Box, { position: "relative", ...rest, children: [
|
|
63
|
-
/* @__PURE__ */ jsx(LayoutComponent, { elements, data: props }),
|
|
64
|
-
/* @__PURE__ */ jsx(
|
|
65
|
-
Box,
|
|
66
|
-
{
|
|
67
|
-
position: "absolute",
|
|
68
|
-
right: 16,
|
|
69
|
-
bottom: 0,
|
|
70
|
-
fontSize: 12,
|
|
71
|
-
sx: { color: "transparent", "::selection": { background: "#000", color: "#fff" } },
|
|
72
|
-
children: window?.blocklet?.version
|
|
73
|
-
}
|
|
74
|
-
)
|
|
75
|
-
] });
|
|
76
|
-
}
|
|
77
|
-
InternalFooter.propTypes = {
|
|
78
|
-
brand: PropTypes.shape({
|
|
79
|
-
name: PropTypes.node,
|
|
80
|
-
description: PropTypes.string,
|
|
81
|
-
logo: PropTypes.node
|
|
82
|
-
}),
|
|
83
|
-
navigation: PropTypes.arrayOf(
|
|
84
|
-
PropTypes.shape({
|
|
85
|
-
label: PropTypes.node,
|
|
86
|
-
link: PropTypes.string
|
|
87
|
-
})
|
|
88
|
-
),
|
|
89
|
-
socialMedia: PropTypes.arrayOf(
|
|
90
|
-
PropTypes.shape({
|
|
91
|
-
icon: PropTypes.node,
|
|
92
|
-
link: PropTypes.string
|
|
93
|
-
})
|
|
94
|
-
),
|
|
95
|
-
copyright: PropTypes.shape({
|
|
96
|
-
owner: PropTypes.string,
|
|
97
|
-
year: PropTypes.oneOfType([PropTypes.string, PropTypes.number])
|
|
98
|
-
}),
|
|
99
|
-
// privacy/legal 等链接, 常放于 footer 右下侧或最底部
|
|
100
|
-
links: PropTypes.arrayOf(
|
|
101
|
-
PropTypes.shape({
|
|
102
|
-
label: PropTypes.node,
|
|
103
|
-
link: PropTypes.string
|
|
104
|
-
})
|
|
105
|
-
),
|
|
106
|
-
// 可显式指定 footer layout, 默认根据内容自动决定 layout
|
|
107
|
-
layout: PropTypes.oneOf(["auto", "standard", "plain"])
|
|
108
|
-
};
|
|
109
|
-
InternalFooter.defaultProps = {
|
|
110
|
-
brand: null,
|
|
111
|
-
navigation: null,
|
|
112
|
-
copyright: null,
|
|
113
|
-
socialMedia: null,
|
|
114
|
-
links: null,
|
|
115
|
-
layout: "auto"
|
|
116
|
-
};
|
|
117
|
-
export default InternalFooter;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export default PlainLayout;
|
|
2
|
-
/**
|
|
3
|
-
* footer plain layout
|
|
4
|
-
*/
|
|
5
|
-
declare function PlainLayout({ elements, data, ...rest }: {
|
|
6
|
-
[x: string]: any;
|
|
7
|
-
elements: any;
|
|
8
|
-
data: any;
|
|
9
|
-
}): import("react").JSX.Element;
|
|
10
|
-
declare namespace PlainLayout {
|
|
11
|
-
namespace propTypes {
|
|
12
|
-
let elements: any;
|
|
13
|
-
let data: any;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { cloneElement } from "react";
|
|
3
|
-
import PropTypes from "prop-types";
|
|
4
|
-
import Container from "@mui/material/Container";
|
|
5
|
-
import { styled } from "@arcblock/ux/lib/Theme";
|
|
6
|
-
import Row from "./row.js";
|
|
7
|
-
function PlainLayout({ elements, data, ...rest }) {
|
|
8
|
-
return /* @__PURE__ */ jsx(Root, { ...rest, children: /* @__PURE__ */ jsxs(Container, { className: "plain-layout-container", children: [
|
|
9
|
-
!!data.links && /* @__PURE__ */ jsxs(Row, { sx: { width: 1 }, autoCenter: true, children: [
|
|
10
|
-
elements.copyright,
|
|
11
|
-
elements.links
|
|
12
|
-
] }),
|
|
13
|
-
!data.links && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
14
|
-
cloneElement(elements.brand, { name: null, description: null }),
|
|
15
|
-
elements.copyright
|
|
16
|
-
] })
|
|
17
|
-
] }) });
|
|
18
|
-
}
|
|
19
|
-
PlainLayout.propTypes = {
|
|
20
|
-
elements: PropTypes.shape({
|
|
21
|
-
brand: PropTypes.element,
|
|
22
|
-
navigation: PropTypes.element,
|
|
23
|
-
socialMedia: PropTypes.element,
|
|
24
|
-
copyright: PropTypes.element,
|
|
25
|
-
links: PropTypes.element
|
|
26
|
-
}).isRequired,
|
|
27
|
-
data: PropTypes.object.isRequired
|
|
28
|
-
};
|
|
29
|
-
const Root = styled("div")`
|
|
30
|
-
padding: 24px 0;
|
|
31
|
-
.plain-layout-container {
|
|
32
|
-
display: flex;
|
|
33
|
-
justify-content: space-between;
|
|
34
|
-
align-items: center;
|
|
35
|
-
flex-wrap: wrap;
|
|
36
|
-
gap: 8px;
|
|
37
|
-
}
|
|
38
|
-
`;
|
|
39
|
-
export default PlainLayout;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
declare function Row({ children, autoCenter, ...rest }: {
|
|
2
|
-
[x: string]: any;
|
|
3
|
-
children: any;
|
|
4
|
-
autoCenter: any;
|
|
5
|
-
}): import("react").JSX.Element | null;
|
|
6
|
-
declare namespace Row {
|
|
7
|
-
namespace propTypes {
|
|
8
|
-
let children: any;
|
|
9
|
-
let autoCenter: any;
|
|
10
|
-
}
|
|
11
|
-
namespace defaultProps {
|
|
12
|
-
let children_1: null;
|
|
13
|
-
export { children_1 as children };
|
|
14
|
-
let autoCenter_1: boolean;
|
|
15
|
-
export { autoCenter_1 as autoCenter };
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
export default Row;
|
package/es/Footer/layout/row.js
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import PropTypes from "prop-types";
|
|
3
|
-
import Box from "@mui/material/Box";
|
|
4
|
-
import { styled } from "@arcblock/ux/lib/Theme";
|
|
5
|
-
import clsx from "clsx";
|
|
6
|
-
export default function Row({ children, autoCenter, ...rest }) {
|
|
7
|
-
if (!children) {
|
|
8
|
-
return null;
|
|
9
|
-
}
|
|
10
|
-
return /* @__PURE__ */ jsx(RowRoot, { ...rest, className: clsx(rest.className, { "footer-row-auto-center": autoCenter }), children });
|
|
11
|
-
}
|
|
12
|
-
Row.propTypes = {
|
|
13
|
-
children: PropTypes.any,
|
|
14
|
-
autoCenter: PropTypes.bool
|
|
15
|
-
};
|
|
16
|
-
Row.defaultProps = {
|
|
17
|
-
children: null,
|
|
18
|
-
autoCenter: false
|
|
19
|
-
};
|
|
20
|
-
const RowRoot = styled(Box)`
|
|
21
|
-
display: flex;
|
|
22
|
-
justify-content: space-between;
|
|
23
|
-
& + & {
|
|
24
|
-
margin-top: 24px;
|
|
25
|
-
}
|
|
26
|
-
&.footer-row-auto-center > *:only-child {
|
|
27
|
-
margin: 0 auto;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
${(props) => props.theme.breakpoints.down("md")} {
|
|
31
|
-
align-items: stretch;
|
|
32
|
-
flex-direction: column;
|
|
33
|
-
gap: 16px;
|
|
34
|
-
> * {
|
|
35
|
-
flex: 1 0 100%;
|
|
36
|
-
}
|
|
37
|
-
&.footer-row-auto-center > * {
|
|
38
|
-
margin: 0 auto;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
`;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export default StandardLayout;
|
|
2
|
-
/**
|
|
3
|
-
* footer standard layout
|
|
4
|
-
*/
|
|
5
|
-
declare function StandardLayout({ elements, data, ...rest }: {
|
|
6
|
-
[x: string]: any;
|
|
7
|
-
elements: any;
|
|
8
|
-
data: any;
|
|
9
|
-
}): import("react").JSX.Element;
|
|
10
|
-
declare namespace StandardLayout {
|
|
11
|
-
namespace propTypes {
|
|
12
|
-
let elements: any;
|
|
13
|
-
let data: any;
|
|
14
|
-
}
|
|
15
|
-
}
|