@blocklet/ui-react 2.9.13 → 2.9.14

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.
Files changed (161) hide show
  1. package/build.config.ts +29 -0
  2. package/es/@types/index.d.ts +63 -0
  3. package/es/@types/index.js +0 -0
  4. package/es/@types/shims.d.ts +12 -0
  5. package/es/Dashboard/index.d.ts +41 -0
  6. package/es/Dashboard/index.js +63 -97
  7. package/es/Footer/brand.d.ts +22 -0
  8. package/es/Footer/brand.js +20 -37
  9. package/es/Footer/copyright.d.ts +18 -0
  10. package/es/Footer/copyright.js +14 -16
  11. package/es/Footer/index.d.ts +6 -0
  12. package/es/Footer/index.js +30 -56
  13. package/es/Footer/internal-footer.d.ts +29 -0
  14. package/es/Footer/internal-footer.js +67 -94
  15. package/es/Footer/layout/plain.d.ts +15 -0
  16. package/es/Footer/layout/plain.js +19 -37
  17. package/es/Footer/layout/row.d.ts +18 -0
  18. package/es/Footer/layout/row.js +9 -19
  19. package/es/Footer/layout/standard.d.ts +15 -0
  20. package/es/Footer/layout/standard.js +29 -57
  21. package/es/Footer/links.d.ts +22 -0
  22. package/es/Footer/links.js +72 -104
  23. package/es/Footer/social-media.d.ts +14 -0
  24. package/es/Footer/social-media.js +35 -35
  25. package/es/Header/index.d.ts +9 -0
  26. package/es/Header/index.js +55 -100
  27. package/es/Icon/index.d.ts +23 -0
  28. package/es/Icon/index.js +23 -58
  29. package/es/UserCenter/assets/banner.png +0 -0
  30. package/es/UserCenter/components/notification.d.ts +5 -0
  31. package/es/UserCenter/components/notification.js +276 -0
  32. package/es/UserCenter/components/passport.d.ts +6 -0
  33. package/es/UserCenter/components/passport.js +69 -0
  34. package/es/UserCenter/components/privacy.d.ts +11 -0
  35. package/es/UserCenter/components/privacy.js +99 -0
  36. package/es/UserCenter/components/settings.d.ts +10 -0
  37. package/es/UserCenter/components/settings.js +68 -0
  38. package/es/UserCenter/components/user-basic-info.d.ts +8 -0
  39. package/es/UserCenter/components/user-basic-info.js +66 -0
  40. package/es/UserCenter/components/user-center.d.ts +9 -0
  41. package/es/UserCenter/components/user-center.js +397 -0
  42. package/es/UserCenter/components/user-info-item.d.ts +10 -0
  43. package/es/UserCenter/components/user-info-item.js +54 -0
  44. package/es/UserCenter/components/user-info.d.ts +6 -0
  45. package/es/UserCenter/components/user-info.js +68 -0
  46. package/es/UserCenter/components/webhook-item.d.ts +3 -0
  47. package/es/UserCenter/components/webhook-item.js +243 -0
  48. package/es/UserCenter/index.d.ts +1 -0
  49. package/es/UserCenter/index.js +1 -0
  50. package/es/UserCenter/libs/client.d.ts +2 -0
  51. package/es/UserCenter/libs/client.js +2 -0
  52. package/es/UserCenter/libs/locales.d.ts +72 -0
  53. package/es/UserCenter/libs/locales.js +72 -0
  54. package/es/UserCenter/libs/utils.d.ts +4 -0
  55. package/es/UserCenter/libs/utils.js +14 -0
  56. package/es/blocklets.d.ts +16 -0
  57. package/es/blocklets.js +56 -45
  58. package/es/common/header-addons.d.ts +22 -0
  59. package/es/common/header-addons.js +41 -59
  60. package/es/common/link-blocker.d.ts +7 -0
  61. package/es/common/link-blocker.js +10 -17
  62. package/es/common/overridable-theme-provider.d.ts +18 -0
  63. package/es/common/overridable-theme-provider.js +6 -16
  64. package/es/common/wallet-hidden-topbar.d.ts +1 -0
  65. package/es/common/wallet-hidden-topbar.js +12 -10
  66. package/es/index.d.ts +5 -0
  67. package/es/index.js +5 -0
  68. package/es/types.d.ts +2 -0
  69. package/es/types.js +17 -11
  70. package/es/utils.d.ts +8 -0
  71. package/es/utils.js +21 -26
  72. package/lib/@types/index.d.ts +63 -0
  73. package/lib/@types/index.js +1 -0
  74. package/lib/@types/shims.d.ts +12 -0
  75. package/lib/Dashboard/index.d.ts +41 -0
  76. package/lib/Dashboard/index.js +44 -71
  77. package/lib/Footer/brand.d.ts +22 -0
  78. package/lib/Footer/brand.js +65 -30
  79. package/lib/Footer/copyright.d.ts +18 -0
  80. package/lib/Footer/copyright.js +18 -23
  81. package/lib/Footer/index.d.ts +6 -0
  82. package/lib/Footer/index.js +33 -42
  83. package/lib/Footer/internal-footer.d.ts +29 -0
  84. package/lib/Footer/internal-footer.js +43 -59
  85. package/lib/Footer/layout/plain.d.ts +15 -0
  86. package/lib/Footer/layout/plain.js +25 -30
  87. package/lib/Footer/layout/row.d.ts +18 -0
  88. package/lib/Footer/layout/row.js +34 -23
  89. package/lib/Footer/layout/standard.d.ts +15 -0
  90. package/lib/Footer/layout/standard.js +35 -41
  91. package/lib/Footer/links.d.ts +22 -0
  92. package/lib/Footer/links.js +163 -60
  93. package/lib/Footer/social-media.d.ts +14 -0
  94. package/lib/Footer/social-media.js +31 -25
  95. package/lib/Header/index.d.ts +9 -0
  96. package/lib/Header/index.js +83 -76
  97. package/lib/Icon/index.d.ts +23 -0
  98. package/lib/Icon/index.js +37 -51
  99. package/lib/UserCenter/assets/banner.png +0 -0
  100. package/lib/UserCenter/components/notification.d.ts +5 -0
  101. package/lib/UserCenter/components/notification.js +261 -0
  102. package/lib/UserCenter/components/passport.d.ts +6 -0
  103. package/lib/UserCenter/components/passport.js +86 -0
  104. package/lib/UserCenter/components/privacy.d.ts +11 -0
  105. package/lib/UserCenter/components/privacy.js +101 -0
  106. package/lib/UserCenter/components/settings.d.ts +10 -0
  107. package/lib/UserCenter/components/settings.js +81 -0
  108. package/lib/UserCenter/components/user-basic-info.d.ts +8 -0
  109. package/lib/UserCenter/components/user-basic-info.js +67 -0
  110. package/lib/UserCenter/components/user-center.d.ts +9 -0
  111. package/lib/UserCenter/components/user-center.js +376 -0
  112. package/lib/UserCenter/components/user-info-item.d.ts +10 -0
  113. package/lib/UserCenter/components/user-info-item.js +46 -0
  114. package/lib/UserCenter/components/user-info.d.ts +6 -0
  115. package/lib/UserCenter/components/user-info.js +94 -0
  116. package/lib/UserCenter/components/webhook-item.d.ts +3 -0
  117. package/lib/UserCenter/components/webhook-item.js +236 -0
  118. package/lib/UserCenter/index.d.ts +1 -0
  119. package/lib/UserCenter/index.js +13 -0
  120. package/lib/UserCenter/libs/client.d.ts +2 -0
  121. package/lib/UserCenter/libs/client.js +8 -0
  122. package/lib/UserCenter/libs/locales.d.ts +72 -0
  123. package/lib/UserCenter/libs/locales.js +78 -0
  124. package/lib/UserCenter/libs/utils.d.ts +4 -0
  125. package/lib/UserCenter/libs/utils.js +25 -0
  126. package/lib/blocklets.d.ts +16 -0
  127. package/lib/blocklets.js +28 -36
  128. package/lib/common/header-addons.d.ts +22 -0
  129. package/lib/common/header-addons.js +24 -36
  130. package/lib/common/link-blocker.d.ts +7 -0
  131. package/lib/common/link-blocker.js +10 -18
  132. package/lib/common/overridable-theme-provider.d.ts +18 -0
  133. package/lib/common/overridable-theme-provider.js +9 -14
  134. package/lib/common/wallet-hidden-topbar.d.ts +1 -0
  135. package/lib/common/wallet-hidden-topbar.js +1 -3
  136. package/lib/index.d.ts +5 -0
  137. package/lib/index.js +52 -0
  138. package/lib/types.d.ts +2 -0
  139. package/lib/types.js +3 -5
  140. package/lib/utils.d.ts +8 -0
  141. package/lib/utils.js +16 -23
  142. package/package.json +17 -11
  143. package/src/@types/index.ts +70 -0
  144. package/src/@types/shims.d.ts +12 -0
  145. package/src/UserCenter/assets/banner.png +0 -0
  146. package/src/UserCenter/components/notification.tsx +275 -0
  147. package/src/UserCenter/components/passport.tsx +83 -0
  148. package/src/UserCenter/components/privacy.tsx +107 -0
  149. package/src/UserCenter/components/settings.tsx +78 -0
  150. package/src/UserCenter/components/user-basic-info.tsx +70 -0
  151. package/src/UserCenter/components/user-center.tsx +410 -0
  152. package/src/UserCenter/components/user-info-item.tsx +50 -0
  153. package/src/UserCenter/components/user-info.tsx +85 -0
  154. package/src/UserCenter/components/webhook-item.tsx +243 -0
  155. package/src/UserCenter/index.tsx +1 -0
  156. package/src/UserCenter/libs/client.ts +3 -0
  157. package/src/UserCenter/libs/locales.ts +72 -0
  158. package/src/UserCenter/libs/utils.ts +21 -0
  159. package/src/blocklets.js +2 -0
  160. package/src/index.ts +9 -0
  161. /package/src/common/{link-blocker.js → link-blocker.jsx} +0 -0
@@ -0,0 +1,29 @@
1
+ import { defineBuildConfig, BuildEntry } from 'unbuild';
2
+
3
+ const pattern = ['**/*.js', '**/*.jsx', '**/*.ts', '**/*.tsx', '**/*.png', '!**/*.stories.js', '!**/demo'];
4
+
5
+ const shared: BuildEntry = {
6
+ builder: 'mkdist',
7
+ input: './src',
8
+ pattern,
9
+ ext: 'js',
10
+ esbuild: {
11
+ jsx: 'automatic',
12
+ },
13
+ declaration: true,
14
+ };
15
+ export default defineBuildConfig({
16
+ failOnWarn: false,
17
+ entries: [
18
+ {
19
+ ...shared,
20
+ outDir: './es',
21
+ format: 'esm',
22
+ },
23
+ {
24
+ ...shared,
25
+ outDir: './lib',
26
+ format: 'cjs',
27
+ },
28
+ ],
29
+ });
@@ -0,0 +1,63 @@
1
+ import type { Axios } from 'axios';
2
+ export type SessionContext = {
3
+ session: Session;
4
+ api: Axios;
5
+ };
6
+ export type User = {
7
+ did: string;
8
+ fullName: string;
9
+ role: string;
10
+ avatar: string;
11
+ email?: string;
12
+ phone?: string;
13
+ sourceProvider?: string;
14
+ lastLoginAt?: string;
15
+ lastLoginIp?: string;
16
+ createdAt?: string;
17
+ passports?: any[];
18
+ };
19
+ export type UserCenterTab = {
20
+ value: string;
21
+ label: string;
22
+ url: string;
23
+ protected: boolean;
24
+ icon?: string;
25
+ };
26
+ export type Session = {
27
+ loading: boolean;
28
+ user: User;
29
+ login: any;
30
+ logout: any;
31
+ switch: any;
32
+ switchDid: any;
33
+ switchProfile: any;
34
+ switchPassport: any;
35
+ };
36
+ export type WebhookType = 'slack' | 'api';
37
+ export type WebhookItemData = {
38
+ type: WebhookType;
39
+ url: string;
40
+ };
41
+ export type WebhookItemProps = {
42
+ onTest: (params: WebhookItemData) => void;
43
+ onSave: (params: WebhookItemData) => void;
44
+ onDelete?: (params: WebhookItemData) => void;
45
+ onCancel?: () => void;
46
+ edit: boolean;
47
+ type?: WebhookType;
48
+ url?: string;
49
+ };
50
+ export type CreatePassportProps = {
51
+ issuer: string;
52
+ title: string;
53
+ issuerDid: string;
54
+ issuerAvatarUrl: string;
55
+ ownerDid: string;
56
+ ownerName: string;
57
+ ownerAvatarUrl: string;
58
+ preferredColor?: string;
59
+ revoked?: boolean;
60
+ isDataUrl?: boolean;
61
+ width?: string;
62
+ height?: string;
63
+ };
File without changes
@@ -0,0 +1,12 @@
1
+ declare module '@arcblock/ux/*';
2
+ declare module '@arcblock/did-connect/*';
3
+
4
+ declare module '@abtnode/constant';
5
+ declare module 'is-url';
6
+ declare module 'url-join';
7
+
8
+ declare module '*.png';
9
+
10
+ declare interface Window {
11
+ blocklet: any;
12
+ }
@@ -0,0 +1,41 @@
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 };
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_1 {
31
+ let showRole: boolean;
32
+ function onLogout(): void;
33
+ }
34
+ export { sessionManagerProps_1 as sessionManagerProps };
35
+ let links_1: never[];
36
+ export { links_1 as links };
37
+ }
38
+ }
39
+ import { blockletMetaProps } from '../types';
40
+ import { sessionManagerProps } from '../types';
41
+ import { publicPath } from '../blocklets';
@@ -1,90 +1,58 @@
1
- import 'iconify-icon';
2
-
3
- /* eslint-disable no-shadow */
4
- import { useMemo, useLayoutEffect, useContext } from 'react';
5
- import PropTypes from 'prop-types';
6
- import { SessionContext } from '@arcblock/did-connect/lib/Session';
7
- import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
8
- import UxDashboard from '@arcblock/ux/lib/Layout/dashboard';
9
- import { blockletMetaProps, sessionManagerProps } from '../types';
10
- import { mapRecursive, flatRecursive, matchPaths } from '../utils';
11
- import { publicPath, formatBlockletInfo, getLocalizedNavigation, filterNavByRole } from '../blocklets';
12
- import HeaderAddons from '../common/header-addons';
13
- import { useWalletHiddenTopbar } from '../common/wallet-hidden-topbar';
14
-
15
- /**
16
- * 专门用于 (composable) blocklet 的 Dashboard 组件, 解析 blocklet meta 中 section 为 dashboard 的 navigation 数据, 渲染一个 UX Dashboard
17
- */
18
- // eslint-disable-next-line no-shadow
19
- import { jsx as _jsx } from "react/jsx-runtime";
20
- function Dashboard({
21
- meta,
22
- fallbackUrl,
23
- invalidPathFallback,
24
- headerAddons,
25
- sessionManagerProps,
26
- links,
27
- ...rest
28
- }) {
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: sessionManagerProps2, links, ...rest }) {
29
14
  useWalletHiddenTopbar();
30
15
  const sessionCtx = useContext(SessionContext);
31
16
  const user = sessionCtx?.session?.user;
32
17
  const userRole = user?.role;
33
- const {
34
- locale
35
- } = useLocaleContext() || {};
18
+ const { locale } = useLocaleContext() || {};
36
19
  const formattedBlocklet = useMemo(() => {
37
20
  const blocklet = Object.assign({}, window.blocklet, meta);
38
21
  try {
39
22
  return formatBlockletInfo(blocklet);
40
23
  } catch (e) {
41
- console.error('Failed to format blocklet info', e, blocklet);
24
+ console.error("Failed to format blocklet info", e, blocklet);
42
25
  return blocklet;
43
26
  }
44
27
  }, [meta]);
45
- const {
46
- localizedNav,
47
- flattened,
48
- matchedIndex
49
- } = useMemo(() => {
50
- let localizedNav = getLocalizedNavigation(formattedBlocklet?.navigation?.dashboard, locale) || [];
51
- // 根据 role 筛选 nav 数据
52
- localizedNav = filterNavByRole(localizedNav, userRole);
53
- // nav 数据处理成 ux dashboard 需要的格式
54
- localizedNav = mapRecursive(localizedNav, item => ({
55
- title: item.title,
56
- url: item.link,
57
- icon: item.icon ? /*#__PURE__*/_jsx("iconify-icon", {
58
- icon: item.icon
59
- }) : null,
60
- // https://github.com/ArcBlock/ux/issues/755#issuecomment-1208692620
61
- external: true,
62
- children: item.items
63
- }), 'items');
64
- // 展平后使用 matchPaths 检测 link#active 状态
65
- const flattened = flatRecursive(localizedNav).filter(item => !!item.url);
66
- const matchedIndex = matchPaths(flattened.map(item => item.url));
67
- if (matchedIndex !== -1) {
68
- flattened[matchedIndex].active = true;
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", { 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;
69
47
  }
70
- return {
71
- localizedNav,
72
- flattened,
73
- matchedIndex
74
- };
48
+ return { localizedNav: localizedNav2, flattened: flattened2, matchedIndex: matchedIndex2 };
75
49
  }, [formattedBlocklet, locale, userRole]);
76
- const allLinks = typeof links === 'function' ? links(localizedNav) : [...localizedNav, ...links];
77
-
78
- // 页面初始化时, 如果当前用户没有权限访问任何导航菜单 (比如登录时未提供 VC 导致无权限), 则跳转到 fallbackUrl
79
- // 未认证 (user 为空) 时不做处理, 这种情况的页面跳转逻辑一般由应用自行处理
50
+ const allLinks = typeof links === "function" ? links(localizedNav) : [...localizedNav, ...links];
80
51
  useLayoutEffect(() => {
81
52
  if (!!user && !flattened?.length && fallbackUrl) {
82
53
  window.location.href = fallbackUrl;
83
54
  }
84
- // eslint-disable-next-line react-hooks/exhaustive-deps
85
55
  }, [fallbackUrl]);
86
-
87
- // 导航菜单变动且存在可用菜单但无匹配项时 (如切换 passport), 跳转到首个菜单项
88
56
  useLayoutEffect(() => {
89
57
  if (!!user && !!flattened?.length && matchedIndex === -1) {
90
58
  if (invalidPathFallback) {
@@ -93,38 +61,36 @@ function Dashboard({
93
61
  window.location.href = flattened[0]?.url || publicPath;
94
62
  }
95
63
  }
96
- // eslint-disable-next-line react-hooks/exhaustive-deps
97
64
  }, [invalidPathFallback, flattened, matchedIndex]);
98
65
  if (!formattedBlocklet.appName) {
99
66
  return null;
100
67
  }
101
- const {
102
- appLogo,
103
- appLogoRect,
104
- appName
105
- } = formattedBlocklet;
106
- const _headerAddons = /*#__PURE__*/_jsx(HeaderAddons, {
107
- formattedBlocklet: formattedBlocklet,
108
- addons: headerAddons,
109
- sessionManagerProps: sessionManagerProps
110
- });
111
- return /*#__PURE__*/_jsx(UxDashboard, {
112
- title: appName,
113
- fullWidth: true,
114
- sidebarWidth: 128,
115
- legacy: false,
116
- links: allLinks,
117
- ...rest,
118
- headerProps: {
119
- homeLink: publicPath,
120
- logo: /*#__PURE__*/_jsx("img", {
121
- src: appLogoRect || appLogo,
122
- alt: "logo"
123
- }),
124
- addons: _headerAddons,
125
- ...rest.headerProps
68
+ const { appLogo, appLogoRect, appName } = formattedBlocklet;
69
+ const _headerAddons = /* @__PURE__ */ jsx(
70
+ HeaderAddons,
71
+ {
72
+ formattedBlocklet,
73
+ addons: headerAddons,
74
+ sessionManagerProps: sessionManagerProps2
75
+ }
76
+ );
77
+ return /* @__PURE__ */ jsx(
78
+ UxDashboard,
79
+ {
80
+ title: appName,
81
+ fullWidth: true,
82
+ sidebarWidth: 128,
83
+ legacy: false,
84
+ links: allLinks,
85
+ ...rest,
86
+ headerProps: {
87
+ homeLink: publicPath,
88
+ logo: /* @__PURE__ */ jsx("img", { src: appLogoRect || appLogo, alt: "logo" }),
89
+ addons: _headerAddons,
90
+ ...rest.headerProps
91
+ }
126
92
  }
127
- });
93
+ );
128
94
  }
129
95
  Dashboard.propTypes = {
130
96
  meta: blockletMetaProps,
@@ -140,7 +106,7 @@ Dashboard.defaultProps = {
140
106
  meta: {},
141
107
  fallbackUrl: publicPath,
142
108
  invalidPathFallback: null,
143
- headerAddons: undefined,
109
+ headerAddons: void 0,
144
110
  sessionManagerProps: {
145
111
  showRole: true,
146
112
  // dashboard 默认退出登录行为: 跳转到 (root) blocklet 首页
@@ -150,4 +116,4 @@ Dashboard.defaultProps = {
150
116
  },
151
117
  links: []
152
118
  };
153
- export default Dashboard;
119
+ export default Dashboard;
@@ -0,0 +1,22 @@
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;
@@ -1,36 +1,19 @@
1
- import { isValidElement } from 'react';
2
- import PropTypes from 'prop-types';
3
- import { styled } from '@arcblock/ux/lib/Theme';
4
- import { jsx as _jsx } from "react/jsx-runtime";
5
- import { jsxs as _jsxs } from "react/jsx-runtime";
6
- export default function Brand({
7
- name,
8
- logo,
9
- description,
10
- ...rest
11
- }) {
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 }) {
12
6
  if (!name && !logo && !description) {
13
7
  return null;
14
8
  }
15
- const logoElement = /*#__PURE__*/isValidElement(logo) ? logo : /*#__PURE__*/_jsx("img", {
16
- src: logo,
17
- alt: name
18
- });
19
- return /*#__PURE__*/_jsxs(Root, {
20
- ...rest,
21
- children: [/*#__PURE__*/_jsxs("div", {
22
- children: [logo && /*#__PURE__*/_jsx("div", {
23
- className: "footer-brand-logo",
24
- children: logoElement
25
- }), name && /*#__PURE__*/_jsx("div", {
26
- className: "footer-brand-name",
27
- children: name
28
- })]
29
- }), description && /*#__PURE__*/_jsx("div", {
30
- className: "footer-brand-desc",
31
- children: description
32
- })]
33
- });
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
+ ] });
34
17
  }
35
18
  Brand.propTypes = {
36
19
  name: PropTypes.node,
@@ -38,11 +21,11 @@ Brand.propTypes = {
38
21
  description: PropTypes.string
39
22
  };
40
23
  Brand.defaultProps = {
41
- name: '',
42
- logo: '',
43
- description: ''
24
+ name: "",
25
+ logo: "",
26
+ description: ""
44
27
  };
45
- const Root = styled('div')`
28
+ const Root = styled("div")`
46
29
  display: flex;
47
30
  flex-direction: column;
48
31
  font-size: 14px;
@@ -74,11 +57,11 @@ const Root = styled('div')`
74
57
  margin-top: 16px;
75
58
  }
76
59
 
77
- ${props => props.theme.breakpoints.down('sm')} {
60
+ ${(props) => props.theme.breakpoints.down("sm")} {
78
61
  width: auto;
79
62
  }
80
63
 
81
- ${props => props.theme.breakpoints.down('md')} {
64
+ ${(props) => props.theme.breakpoints.down("md")} {
82
65
  .footer-brand-logo {
83
66
  img,
84
67
  svg {
@@ -87,4 +70,4 @@ const Root = styled('div')`
87
70
  }
88
71
  }
89
72
  }
90
- `;
73
+ `;
@@ -0,0 +1,18 @@
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;
@@ -1,27 +1,25 @@
1
- import { styled } from '@arcblock/ux/lib/Theme';
2
- import PropTypes from 'prop-types';
3
- import { jsxs as _jsxs } from "react/jsx-runtime";
4
- export default function Copyright({
5
- owner,
6
- year,
7
- ...rest
8
- }) {
9
- return /*#__PURE__*/_jsxs(Root, {
10
- ...rest,
11
- children: ["Copyright \xA9 ", year, " ", owner]
12
- });
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
+ ] });
13
11
  }
14
12
  Copyright.propTypes = {
15
13
  owner: PropTypes.string,
16
14
  year: PropTypes.string
17
15
  };
18
16
  Copyright.defaultProps = {
19
- owner: 'ArcBlock',
20
- year: `${new Date().getFullYear()}`
17
+ owner: "ArcBlock",
18
+ year: `${(/* @__PURE__ */ new Date()).getFullYear()}`
21
19
  };
22
- const Root = styled('p')`
20
+ const Root = styled("p")`
23
21
  display: flex;
24
22
  align-items: center;
25
23
  margin: 0;
26
24
  font-size: 13px;
27
- `;
25
+ `;
@@ -0,0 +1,6 @@
1
+ declare const _default: import("react").ComponentType<{
2
+ [x: string]: any;
3
+ meta: any;
4
+ theme: any;
5
+ }>;
6
+ export default _default;
@@ -1,48 +1,30 @@
1
- import { useMemo } from 'react';
2
- import PropTypes from 'prop-types';
3
- import { styled } from '@arcblock/ux/lib/Theme';
4
- import { withErrorBoundary } from 'react-error-boundary';
5
- import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
6
- import { ErrorFallback } from '@arcblock/ux/lib/ErrorBoundary';
7
- import OverridableThemeProvider from '../common/overridable-theme-provider';
8
- import InternalFooter from './internal-footer';
9
- import { mapRecursive } from '../utils';
10
- import { formatBlockletInfo, getLocalizedNavigation } from '../blocklets';
11
- import { blockletMetaProps } from '../types';
12
-
13
- /**
14
- * 专门用于 (composable) blocklet 的 Footer 组件, 基于 blocklet meta 中的数据渲染
15
- */
16
- import { jsx as _jsx } from "react/jsx-runtime";
17
- function Footer({
18
- meta,
19
- theme: themeOverrides,
20
- ...rest
21
- }) {
22
- const {
23
- locale
24
- } = useLocaleContext() || {};
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 OverridableThemeProvider from "../common/overridable-theme-provider.js";
9
+ import InternalFooter from "./internal-footer.js";
10
+ import { mapRecursive } from "../utils.js";
11
+ import { formatBlockletInfo, getLocalizedNavigation } from "../blocklets.js";
12
+ import { blockletMetaProps } from "../types.js";
13
+ function Footer({ meta, theme: themeOverrides, ...rest }) {
14
+ const { locale } = useLocaleContext() || {};
25
15
  const formattedBlocklet = useMemo(() => {
26
16
  const blocklet = Object.assign({}, window.blocklet, meta);
27
17
  try {
28
18
  return formatBlockletInfo(blocklet);
29
19
  } catch (e) {
30
- console.error('Failed to format blocklet info', e, blocklet);
20
+ console.error("Failed to format blocklet info", e, blocklet);
31
21
  return blocklet;
32
22
  }
33
23
  }, [meta]);
34
24
  if (!formattedBlocklet.appName) {
35
25
  return null;
36
26
  }
37
- const {
38
- appLogo,
39
- appLogoRect,
40
- appName,
41
- appDescription,
42
- description,
43
- theme,
44
- copyright
45
- } = formattedBlocklet;
27
+ const { appLogo, appLogoRect, appName, appDescription, description, theme, copyright } = formattedBlocklet;
46
28
  const localized = {
47
29
  footerNav: getLocalizedNavigation(formattedBlocklet?.navigation?.footer, locale) || [],
48
30
  socialMedia: getLocalizedNavigation(formattedBlocklet?.navigation?.social, locale) || [],
@@ -54,26 +36,20 @@ function Footer({
54
36
  description: appDescription || description,
55
37
  logo: appLogoRect || appLogo
56
38
  },
57
- navigation: mapRecursive(localized.footerNav, item => ({
58
- ...item,
59
- label: item.title,
60
- link: item.link
61
- }), 'items'),
39
+ navigation: mapRecursive(
40
+ localized.footerNav,
41
+ (item) => ({
42
+ ...item,
43
+ label: item.title,
44
+ link: item.link
45
+ }),
46
+ "items"
47
+ ),
62
48
  copyright,
63
49
  socialMedia: localized.socialMedia,
64
- links: localized.links.map(item => ({
65
- ...item,
66
- label: item.title
67
- }))
50
+ links: localized.links.map((item) => ({ ...item, label: item.title }))
68
51
  };
69
- return /*#__PURE__*/_jsx(OverridableThemeProvider, {
70
- theme: themeOverrides,
71
- children: /*#__PURE__*/_jsx(StyledInternalFooter, {
72
- ...props,
73
- ...rest,
74
- $bgcolor: theme?.background?.footer
75
- })
76
- });
52
+ return /* @__PURE__ */ jsx(OverridableThemeProvider, { theme: themeOverrides, children: /* @__PURE__ */ jsx(StyledInternalFooter, { ...props, ...rest, $bgcolor: theme?.background?.footer }) });
77
53
  }
78
54
  Footer.propTypes = {
79
55
  meta: blockletMetaProps,
@@ -86,13 +62,11 @@ Footer.defaultProps = {
86
62
  };
87
63
  const StyledInternalFooter = styled(InternalFooter)`
88
64
  border-top: 1px solid #eee;
89
- color: ${props => props.theme.palette.grey[600]};
90
- ${({
91
- $bgcolor
92
- }) => $bgcolor && `background-color: ${$bgcolor};`}
65
+ color: ${(props) => props.theme.palette.grey[600]};
66
+ ${({ $bgcolor }) => $bgcolor && `background-color: ${$bgcolor};`}
93
67
  font-family: Lato, Avenir, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif,
94
68
  'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol';
95
69
  `;
96
70
  export default withErrorBoundary(Footer, {
97
71
  FallbackComponent: ErrorFallback
98
- });
72
+ });