@arcblock/ux 2.10.67 → 2.10.68

Sign up to get free protection for your applications and to get access to all the features.
Files changed (294) hide show
  1. package/lib/Address/did-address.d.ts +6 -5
  2. package/lib/Address/index.d.ts +1 -1
  3. package/lib/Avatar/index.d.ts +10 -8
  4. package/lib/Avatar/index.js +6 -4
  5. package/lib/Blocklet/blocklet.d.ts +4 -4
  6. package/lib/Blocklet/blocklet.js +2 -2
  7. package/lib/BlockletContext/index.d.ts +3 -3
  8. package/lib/BlockletNFT/index.d.ts +6 -6
  9. package/lib/BlockletNFT/index.js +3 -3
  10. package/lib/BlockletV2/blocklet.d.ts +2 -2
  11. package/lib/Button/wrap.d.ts +4 -4
  12. package/lib/Button/wrap.js +2 -2
  13. package/lib/CardSelector/index.js +0 -1
  14. package/lib/Center/index.d.ts +1 -1
  15. package/lib/ClickToCopy/copy-button.d.ts +5 -4
  16. package/lib/ClickToCopy/copy-button.js +0 -1
  17. package/lib/ClickToCopy/hook.d.ts +3 -8
  18. package/lib/ClickToCopy/index.d.ts +6 -4
  19. package/lib/CodeBlock/index.d.ts +3 -1
  20. package/lib/CookieConsent/index.d.ts +8 -29
  21. package/lib/CookieConsent/index.js +3 -17
  22. package/lib/CountDown/index.d.ts +21 -25
  23. package/lib/CountDown/index.js +12 -11
  24. package/lib/DID/index.d.ts +9 -8
  25. package/lib/Datatable/index.d.ts +5 -5
  26. package/lib/Datatable/index.js +5 -5
  27. package/lib/Dialog/confirm.d.ts +6 -6
  28. package/lib/Dialog/confirm.js +3 -3
  29. package/lib/Dialog/types.d.ts +1 -1
  30. package/lib/DidLogo/index.d.ts +5 -25
  31. package/lib/DidLogo/index.js +4 -15
  32. package/lib/DriftBot/index.d.ts +13 -19
  33. package/lib/DriftBot/index.js +5 -6
  34. package/lib/Earth/index.d.ts +28 -10
  35. package/lib/Earth/index.js +12 -52
  36. package/lib/Earth/util.d.ts +10 -5
  37. package/lib/Earth/util.js +1 -0
  38. package/lib/ErrorBoundary/fallback.d.ts +12 -19
  39. package/lib/ErrorBoundary/fallback.js +2 -19
  40. package/lib/ErrorBoundary/index.d.ts +1 -1
  41. package/lib/Footer/index.d.ts +17 -24
  42. package/lib/Footer/index.js +2 -11
  43. package/lib/Header/header.d.ts +2 -2
  44. package/lib/Icon/image.d.ts +3 -2
  45. package/lib/Icon/index.d.ts +6 -4
  46. package/lib/Img/index.d.ts +1 -1
  47. package/lib/Img/index.js +1 -1
  48. package/lib/InfoRow/index.d.ts +9 -32
  49. package/lib/InfoRow/index.js +10 -23
  50. package/lib/Layout/dashboard/external-link.d.ts +13 -14
  51. package/lib/Layout/dashboard/external-link.js +5 -22
  52. package/lib/Layout/dashboard/full-page.d.ts +19 -11
  53. package/lib/Layout/dashboard/full-page.js +2 -6
  54. package/lib/Layout/dashboard/index.d.ts +20 -39
  55. package/lib/Layout/dashboard/index.js +10 -38
  56. package/lib/Layout/dashboard/sidebar.d.ts +17 -20
  57. package/lib/Layout/dashboard/sidebar.js +3 -16
  58. package/lib/Layout/dashboard-legacy/header.d.ts +10 -36
  59. package/lib/Layout/dashboard-legacy/header.js +5 -24
  60. package/lib/Layout/dashboard-legacy/index.d.ts +17 -56
  61. package/lib/Layout/dashboard-legacy/index.js +12 -41
  62. package/lib/Layout/dashboard-legacy/sidebar.d.ts +15 -26
  63. package/lib/Layout/dashboard-legacy/sidebar.js +5 -15
  64. package/lib/Layout/index.d.ts +17 -56
  65. package/lib/Layout/index.js +24 -50
  66. package/lib/LoadingMask/index.d.ts +8 -31
  67. package/lib/LoadingMask/index.js +2 -18
  68. package/lib/Locale/browser-lang.d.ts +4 -1
  69. package/lib/Locale/browser-lang.js +8 -3
  70. package/lib/Locale/context.d.ts +18 -8
  71. package/lib/Locale/context.js +1 -1
  72. package/lib/Locale/languages.d.ts +9 -55
  73. package/lib/Locale/selector.d.ts +10 -26
  74. package/lib/Locale/selector.js +8 -25
  75. package/lib/Locale/util.d.ts +4 -3
  76. package/lib/Locale/util.js +0 -1
  77. package/lib/Logo/index.d.ts +9 -40
  78. package/lib/Logo/index.js +88 -46
  79. package/lib/Metric/index.d.ts +9 -31
  80. package/lib/Metric/index.js +5 -20
  81. package/lib/NFTDisplay/aspect-ratio-container.d.ts +5 -12
  82. package/lib/NFTDisplay/aspect-ratio-container.js +0 -5
  83. package/lib/NFTDisplay/broken.d.ts +3 -13
  84. package/lib/NFTDisplay/broken.js +80 -10
  85. package/lib/NFTDisplay/displayApi.d.ts +1 -1
  86. package/lib/NFTDisplay/index.d.ts +28 -6
  87. package/lib/NFTDisplay/index.js +17 -51
  88. package/lib/NFTDisplay/svg-embedder/img.d.ts +8 -23
  89. package/lib/NFTDisplay/svg-embedder/img.js +3 -17
  90. package/lib/NFTDisplay/svg-embedder/inline-svg.d.ts +7 -13
  91. package/lib/NFTDisplay/svg-embedder/inline-svg.js +1 -8
  92. package/lib/NavMenu/nav-menu.d.ts +2 -0
  93. package/lib/NavMenu/nav-menu.js +0 -1
  94. package/lib/PageScroller/index.d.ts +14 -13
  95. package/lib/PageScroller/index.js +12 -37
  96. package/lib/PageScroller/usePrevValue.d.ts +1 -1
  97. package/lib/PageScroller/usePrevValue.js +1 -2
  98. package/lib/Passport/index.d.ts +1 -1
  99. package/lib/Passport/passport.d.ts +10 -30
  100. package/lib/Passport/passport.js +5 -19
  101. package/lib/PoweredByArcBlock/index.d.ts +4 -14
  102. package/lib/PoweredByArcBlock/index.js +1 -8
  103. package/lib/PricingTable/PricingPlan.d.ts +11 -9
  104. package/lib/PricingTable/PricingPlan.js +0 -4
  105. package/lib/PricingTable/index.d.ts +5 -3
  106. package/lib/PricingTable/index.js +1 -5
  107. package/lib/QRCode/index.d.ts +11 -22
  108. package/lib/QRCode/index.js +1 -15
  109. package/lib/RelativeTime/index.d.ts +12 -40
  110. package/lib/RelativeTime/index.js +7 -27
  111. package/lib/Result/common.d.ts +26 -45
  112. package/lib/Result/common.js +2 -4
  113. package/lib/Result/index.d.ts +5 -18
  114. package/lib/Result/index.js +1 -9
  115. package/lib/Result/result.d.ts +7 -29
  116. package/lib/Result/result.js +2 -17
  117. package/lib/Result/translations.d.ts +2 -54
  118. package/lib/Screenshot/BaseScreenshot/index.d.ts +7 -24
  119. package/lib/Screenshot/BaseScreenshot/index.js +2 -15
  120. package/lib/Screenshot/BaseScreenshot/shells/Macbook.d.ts +25 -19
  121. package/lib/Screenshot/BaseScreenshot/shells/Phone.d.ts +25 -19
  122. package/lib/Screenshot/index.d.ts +84 -28
  123. package/lib/Screenshot/index.js +14 -43
  124. package/lib/SessionBlocklet/index.d.ts +6 -19
  125. package/lib/SessionBlocklet/index.js +3 -14
  126. package/lib/SessionManager/index.d.ts +1 -1
  127. package/lib/SessionPermission/index.d.ts +9 -17
  128. package/lib/SessionPermission/index.js +3 -11
  129. package/lib/SessionUser/components/logged-in.d.ts +9 -31
  130. package/lib/SessionUser/components/logged-in.js +13 -29
  131. package/lib/SessionUser/components/session-user-item.d.ts +8 -1
  132. package/lib/SessionUser/components/session-user-item.js +2 -12
  133. package/lib/SessionUser/components/session-user-switch.d.ts +9 -21
  134. package/lib/SessionUser/components/session-user-switch.js +3 -15
  135. package/lib/SessionUser/components/un-login.d.ts +7 -23
  136. package/lib/SessionUser/components/un-login.js +4 -16
  137. package/lib/SessionUser/components/user-info.d.ts +12 -29
  138. package/lib/SessionUser/components/user-info.js +4 -19
  139. package/lib/SessionUser/index.d.ts +7 -30
  140. package/lib/SessionUser/index.js +5 -26
  141. package/lib/SessionUser/libs/translation.d.ts +2 -31
  142. package/lib/SessionUser/libs/translation.js +1 -0
  143. package/lib/SessionUser/libs/utils.d.ts +10 -9
  144. package/lib/Sparkline/index.d.ts +22 -1
  145. package/lib/Sparkline/index.js +25 -17
  146. package/lib/Spinner/index.d.ts +6 -1
  147. package/lib/Spinner/index.js +4 -11
  148. package/lib/Success/index.d.ts +5 -21
  149. package/lib/Success/index.js +4 -16
  150. package/lib/Tabs/index.d.ts +12 -26
  151. package/lib/Tabs/index.js +7 -37
  152. package/lib/TextCollapse/index.d.ts +10 -10
  153. package/lib/TextCollapse/index.js +4 -21
  154. package/lib/Theme/index.js +0 -2
  155. package/lib/Theme/theme-provider.d.ts +1 -1
  156. package/lib/Theme/theme.d.ts +4 -1
  157. package/lib/Theme/theme.js +1 -2
  158. package/lib/Typography/index.d.ts +5 -24
  159. package/lib/Typography/index.js +5 -17
  160. package/lib/Util/index.d.ts +11 -6
  161. package/lib/Util/index.js +6 -0
  162. package/lib/Video/index.d.ts +12 -16
  163. package/lib/Video/index.js +0 -14
  164. package/lib/Wallet/Action.d.ts +13 -18
  165. package/lib/Wallet/Action.js +0 -7
  166. package/lib/Wallet/Download.d.ts +24 -30
  167. package/lib/Wallet/Download.js +201 -18
  168. package/lib/Wallet/Open.d.ts +5 -15
  169. package/lib/Wallet/Open.js +5 -11
  170. package/lib/WalletOSIcon/index.d.ts +6 -25
  171. package/lib/WalletOSIcon/index.js +3 -16
  172. package/lib/WebWalletSWKeeper/index.d.ts +8 -20
  173. package/lib/WebWalletSWKeeper/index.js +14 -19
  174. package/lib/WechatPrompt/index.js +2 -0
  175. package/lib/global.d.ts +15 -0
  176. package/lib/type.d.ts +12 -3
  177. package/lib/withTheme/index.d.ts +8 -6
  178. package/lib/withTracker/index.d.ts +1 -1
  179. package/lib/withTracker/index.js +3 -0
  180. package/package.json +9 -5
  181. package/src/Address/did-address.tsx +7 -6
  182. package/src/Address/index.tsx +1 -1
  183. package/src/Avatar/index.jsx +6 -4
  184. package/src/Blocklet/blocklet.jsx +2 -2
  185. package/src/BlockletContext/index.tsx +3 -3
  186. package/src/BlockletNFT/index.jsx +3 -3
  187. package/src/BlockletV2/blocklet.tsx +2 -2
  188. package/src/Button/wrap.jsx +2 -2
  189. package/src/CardSelector/index.tsx +0 -1
  190. package/src/Center/index.tsx +1 -1
  191. package/src/ClickToCopy/copy-button.tsx +4 -4
  192. package/src/ClickToCopy/hook.ts +3 -2
  193. package/src/ClickToCopy/index.tsx +6 -5
  194. package/src/CodeBlock/index.tsx +3 -1
  195. package/src/CookieConsent/{index.jsx → index.tsx} +16 -19
  196. package/src/CountDown/{index.jsx → index.tsx} +30 -16
  197. package/src/DID/index.tsx +9 -8
  198. package/src/Datatable/index.jsx +5 -5
  199. package/src/Dialog/confirm.jsx +3 -3
  200. package/src/Dialog/types.d.ts +1 -1
  201. package/src/DidLogo/{index.jsx → index.tsx} +7 -14
  202. package/src/DriftBot/{index.jsx → index.tsx} +13 -11
  203. package/src/Earth/{index.jsx → index.tsx} +94 -66
  204. package/src/Earth/{util.js → util.ts} +20 -17
  205. package/src/ErrorBoundary/{fallback.jsx → fallback.tsx} +20 -21
  206. package/src/Footer/{index.jsx → index.tsx} +17 -14
  207. package/src/Header/header.tsx +2 -3
  208. package/src/Header/responsive-header.tsx +0 -1
  209. package/src/Icon/image.tsx +3 -3
  210. package/src/Icon/index.tsx +7 -4
  211. package/src/Img/index.jsx +1 -1
  212. package/src/InfoRow/{index.jsx → index.tsx} +32 -25
  213. package/src/Layout/dashboard/external-link.tsx +46 -0
  214. package/src/Layout/dashboard/{full-page.jsx → full-page.tsx} +20 -9
  215. package/src/Layout/dashboard/{index.jsx → index.tsx} +42 -44
  216. package/src/Layout/dashboard/{sidebar.jsx → sidebar.tsx} +23 -20
  217. package/src/Layout/dashboard-legacy/{header.jsx → header.tsx} +16 -26
  218. package/src/Layout/dashboard-legacy/{index.jsx → index.tsx} +32 -46
  219. package/src/Layout/dashboard-legacy/{sidebar.jsx → sidebar.tsx} +27 -19
  220. package/src/Layout/{index.jsx → index.tsx} +41 -47
  221. package/src/LoadingMask/{index.jsx → index.tsx} +17 -19
  222. package/src/Locale/{browser-lang.js → browser-lang.ts} +9 -7
  223. package/src/Locale/context.tsx +18 -11
  224. package/src/Locale/{languages.js → languages.ts} +1 -1
  225. package/src/Locale/{selector.jsx → selector.tsx} +32 -29
  226. package/src/Locale/{util.js → util.ts} +9 -2
  227. package/src/Logo/index.tsx +58 -0
  228. package/src/Metric/{index.jsx → index.tsx} +23 -18
  229. package/src/NFTDisplay/{aspect-ratio-container.jsx → aspect-ratio-container.tsx} +9 -7
  230. package/src/NFTDisplay/{broken.jsx → broken.tsx} +7 -12
  231. package/src/NFTDisplay/{displayApi.js → displayApi.ts} +4 -4
  232. package/src/NFTDisplay/{index.jsx → index.tsx} +59 -64
  233. package/src/NFTDisplay/svg-embedder/{img.jsx → img.tsx} +10 -18
  234. package/src/NFTDisplay/svg-embedder/{inline-svg.jsx → inline-svg.tsx} +8 -9
  235. package/src/NavMenu/nav-menu.tsx +2 -3
  236. package/src/PageScroller/{index.jsx → index.tsx} +40 -53
  237. package/src/PageScroller/{usePrevValue.js → usePrevValue.ts} +2 -3
  238. package/src/Passport/{passport.jsx → passport.tsx} +22 -19
  239. package/src/PoweredByArcBlock/{index.jsx → index.tsx} +6 -11
  240. package/src/PricingTable/{PricingPlan.jsx → PricingPlan.tsx} +15 -5
  241. package/src/PricingTable/{index.jsx → index.tsx} +9 -6
  242. package/src/QRCode/{index.jsx → index.tsx} +13 -17
  243. package/src/RelativeTime/{index.jsx → index.tsx} +24 -24
  244. package/src/Result/{common.jsx → common.tsx} +17 -13
  245. package/src/Result/index.tsx +30 -0
  246. package/src/Result/{result.jsx → result.tsx} +8 -17
  247. package/src/Result/{translations.js → translations.ts} +3 -1
  248. package/src/Screenshot/BaseScreenshot/{index.jsx → index.tsx} +9 -15
  249. package/src/Screenshot/BaseScreenshot/shells/{Macbook.jsx → Macbook.tsx} +3 -1
  250. package/src/Screenshot/BaseScreenshot/shells/{Phone.jsx → Phone.tsx} +3 -1
  251. package/src/Screenshot/{index.jsx → index.tsx} +60 -54
  252. package/src/SessionBlocklet/{index.jsx → index.tsx} +8 -14
  253. package/src/SessionPermission/index.tsx +25 -0
  254. package/src/SessionUser/components/{logged-in.jsx → logged-in.tsx} +49 -31
  255. package/src/SessionUser/components/session-user-item.tsx +97 -0
  256. package/src/SessionUser/components/{session-user-switch.jsx → session-user-switch.tsx} +16 -21
  257. package/src/SessionUser/components/{un-login.jsx → un-login.tsx} +10 -15
  258. package/src/SessionUser/components/{user-info.jsx → user-info.tsx} +16 -22
  259. package/src/SessionUser/index.tsx +26 -0
  260. package/src/SessionUser/libs/{translation.js → translation.ts} +3 -1
  261. package/src/SessionUser/libs/utils.ts +39 -0
  262. package/src/Sparkline/{index.jsx → index.tsx} +38 -22
  263. package/src/Spinner/index.tsx +20 -0
  264. package/src/Success/{index.jsx → index.tsx} +7 -13
  265. package/src/Tabs/{index.jsx → index.tsx} +26 -40
  266. package/src/TextCollapse/{index.jsx → index.tsx} +26 -21
  267. package/src/Theme/index.ts +0 -1
  268. package/src/Theme/theme-provider.tsx +1 -1
  269. package/src/Theme/theme.ts +6 -3
  270. package/src/Typography/{index.jsx → index.tsx} +19 -22
  271. package/src/Util/index.ts +14 -8
  272. package/src/Video/{index.jsx → index.tsx} +7 -10
  273. package/src/Wallet/{Action.jsx → Action.tsx} +16 -12
  274. package/src/Wallet/{Download.jsx → Download.tsx} +25 -21
  275. package/src/Wallet/{Open.jsx → Open.tsx} +8 -11
  276. package/src/WalletOSIcon/{index.jsx → index.tsx} +8 -16
  277. package/src/WebWalletSWKeeper/{index.jsx → index.tsx} +21 -24
  278. package/src/WechatPrompt/{index.jsx → index.tsx} +1 -0
  279. package/src/global.d.ts +15 -0
  280. package/src/type.d.ts +12 -3
  281. package/src/withTheme/{index.jsx → index.tsx} +12 -2
  282. package/src/withTracker/{index.jsx → index.tsx} +6 -4
  283. package/src/Layout/dashboard/external-link.jsx +0 -47
  284. package/src/Logo/index.jsx +0 -66
  285. package/src/Result/index.jsx +0 -33
  286. package/src/SessionPermission/index.jsx +0 -28
  287. package/src/SessionUser/components/session-user-item.jsx +0 -93
  288. package/src/SessionUser/index.jsx +0 -38
  289. package/src/SessionUser/libs/utils.js +0 -37
  290. package/src/Spinner/index.jsx +0 -21
  291. /package/src/ErrorBoundary/{index.jsx → index.ts} +0 -0
  292. /package/src/NFTDisplay/{loading.jsx → loading.tsx} +0 -0
  293. /package/src/Passport/{index.jsx → index.ts} +0 -0
  294. /package/src/SessionManager/{index.jsx → index.tsx} +0 -0
@@ -1,15 +1,14 @@
1
- export function Link(props: any): import("react/jsx-runtime").JSX.Element;
2
- export function NavLink({ className, ...rest }: {
3
- [x: string]: any;
4
- className: any;
5
- }): import("react/jsx-runtime").JSX.Element;
6
- export namespace NavLink {
7
- namespace propTypes {
8
- let className: PropTypes.Requireable<NonNullable<string | ((...args: any[]) => any) | null | undefined>>;
9
- }
10
- namespace defaultProps {
11
- let className_1: string;
12
- export { className_1 as className };
13
- }
1
+ import { Link as RouterLink } from 'react-router-dom';
2
+ interface ExternalLinkProps extends React.ComponentProps<typeof RouterLink> {
3
+ routerLinkComponent: React.ElementType;
4
+ to: string | object;
5
+ external?: false | true;
14
6
  }
15
- import PropTypes from 'prop-types';
7
+ export interface LinkProps extends Omit<ExternalLinkProps, 'routerLinkComponent'> {
8
+ }
9
+ export declare function Link(props: LinkProps): import("react/jsx-runtime").JSX.Element;
10
+ export interface NavLinkProps extends Omit<ExternalLinkProps, 'routerLinkComponent' | 'className'> {
11
+ className?: string | (() => string);
12
+ }
13
+ export declare function NavLink({ className, ...rest }: NavLinkProps): import("react/jsx-runtime").JSX.Element;
14
+ export {};
@@ -1,13 +1,11 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import PropTypes from 'prop-types';
3
2
  import { Link as RouterLink, NavLink as RouterNavLink } from 'react-router-dom';
4
-
5
3
  // 包裹 router Link/NavLink 组件, 支持 external link (external 为 true 时渲染为 a 标签)
6
4
  function ExternalLink({
7
- children,
8
5
  routerLinkComponent: RouterLinkComponent,
9
6
  to,
10
- external,
7
+ external = false,
8
+ children,
11
9
  ...rest
12
10
  }) {
13
11
  if (external) {
@@ -23,15 +21,6 @@ function ExternalLink({
23
21
  children: children
24
22
  });
25
23
  }
26
- ExternalLink.propTypes = {
27
- children: PropTypes.any.isRequired,
28
- routerLinkComponent: PropTypes.elementType.isRequired,
29
- external: PropTypes.bool,
30
- to: PropTypes.oneOfType([PropTypes.string, PropTypes.object]).isRequired
31
- };
32
- ExternalLink.defaultProps = {
33
- external: false
34
- };
35
24
  export function Link(props) {
36
25
  return /*#__PURE__*/_jsx(ExternalLink, {
37
26
  routerLinkComponent: RouterLink,
@@ -39,20 +28,14 @@ export function Link(props) {
39
28
  });
40
29
  }
41
30
  export function NavLink({
42
- className,
31
+ className = '',
43
32
  ...rest
44
33
  }) {
45
34
  // NavLink#className 支持 function
46
- const classes = rest.external && typeof className === 'function' ? className({}) : className;
35
+ const classes = typeof className === 'function' ? className() : className;
47
36
  return /*#__PURE__*/_jsx(ExternalLink, {
48
37
  routerLinkComponent: RouterNavLink,
49
38
  className: classes,
50
39
  ...rest
51
40
  });
52
- }
53
- NavLink.propTypes = {
54
- className: PropTypes.oneOfType([PropTypes.string, PropTypes.func])
55
- };
56
- NavLink.defaultProps = {
57
- className: ''
58
- };
41
+ }
@@ -1,12 +1,20 @@
1
- export function FullPageProvider({ children, ...rest }: {
2
- [x: string]: any;
3
- children: any;
1
+ type FullPageState = {
2
+ inFullPage: boolean;
3
+ showToggleButton: boolean;
4
+ headerVisibleInFullPage: boolean;
5
+ footerVisibleInFullPage: boolean;
6
+ sidebarVisibleInFullPage: boolean;
7
+ };
8
+ type FullPageContextValue = FullPageState & {
9
+ headerVisible: boolean;
10
+ footerVisible: boolean;
11
+ sidebarVisible: boolean;
12
+ toggleFullPage: () => void;
13
+ configure: (params: Partial<FullPageState>) => void;
14
+ };
15
+ export declare const FullPageContext: import("react").Context<FullPageContextValue>;
16
+ export declare const useFullPage: (initialState?: FullPageState) => FullPageContextValue;
17
+ export declare function FullPageProvider({ children, ...rest }: {
18
+ children?: React.ReactNode;
4
19
  }): import("react/jsx-runtime").JSX.Element;
5
- export namespace FullPageProvider {
6
- namespace propTypes {
7
- let children: PropTypes.Validator<NonNullable<PropTypes.ReactNodeLike>>;
8
- }
9
- }
10
- export const FullPageContext: import("react").Context<any>;
11
- export function useFullPage(initialState: any): any;
12
- import PropTypes from 'prop-types';
20
+ export {};
@@ -1,7 +1,6 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { useState, useContext, createContext, useMemo, useLayoutEffect } from 'react';
3
- import PropTypes from 'prop-types';
4
- export const FullPageContext = /*#__PURE__*/createContext();
3
+ export const FullPageContext = /*#__PURE__*/createContext(null);
5
4
  export const useFullPage = initialState => {
6
5
  const ctx = useContext(FullPageContext);
7
6
  useLayoutEffect(() => {
@@ -47,7 +46,4 @@ export function FullPageProvider({
47
46
  ...rest,
48
47
  children: children
49
48
  });
50
- }
51
- FullPageProvider.propTypes = {
52
- children: PropTypes.node.isRequired
53
- };
49
+ }
@@ -1,40 +1,21 @@
1
- declare function DashboardWrapper({ legacy, ...rest }: {
2
- [x: string]: any;
3
- legacy: any;
4
- }): import("react/jsx-runtime").JSX.Element;
5
- declare namespace DashboardWrapper {
6
- namespace propTypes {
7
- let legacy: PropTypes.Requireable<boolean>;
8
- let footerProps: PropTypes.Requireable<PropTypes.InferProps<{
9
- dark: PropTypes.Requireable<boolean>;
10
- className: PropTypes.Requireable<string>;
11
- copyStart: PropTypes.Requireable<NonNullable<string | number | null | undefined>>;
12
- brand: PropTypes.Requireable<string>;
13
- style: PropTypes.Requireable<object>;
14
- addon: PropTypes.Requireable<PropTypes.ReactNodeLike>;
15
- }>>;
16
- let children: PropTypes.Validator<any>;
17
- let title: PropTypes.Requireable<string>;
18
- let links: PropTypes.Validator<any[]>;
19
- let headerProps: PropTypes.Requireable<object>;
20
- let fullWidth: PropTypes.Requireable<boolean>;
21
- let sidebarWidth: PropTypes.Requireable<number>;
22
- let dense: PropTypes.Requireable<string | boolean>;
23
- }
24
- namespace defaultProps {
25
- let legacy_1: boolean;
26
- export { legacy_1 as legacy };
27
- let title_1: string;
28
- export { title_1 as title };
29
- let headerProps_1: {};
30
- export { headerProps_1 as headerProps };
31
- let fullWidth_1: boolean;
32
- export { fullWidth_1 as fullWidth };
33
- let sidebarWidth_1: number;
34
- export { sidebarWidth_1 as sidebarWidth };
35
- let dense_1: string;
36
- export { dense_1 as dense };
37
- }
1
+ import { type SxProps } from '@mui/material';
2
+ import { type FooterProps } from '../../Footer';
3
+ import { type LinkItem } from './sidebar';
4
+ import { type DashboardProps as DashboardLegacyProps } from '../dashboard-legacy';
5
+ export interface DashboardProps extends React.HTMLAttributes<HTMLDivElement> {
6
+ title?: string;
7
+ headerProps?: object;
8
+ /** 支持分组, links item 如果是数组, 则视为一个 group */
9
+ links?: LinkItem[];
10
+ sidebarWidth?: number;
11
+ fullWidth?: false | true;
12
+ /** sidenav 稠密一些的布局, 纵向空间占用较少, 默认为 auto, 当 links 个数 > 8 时自动启用 */
13
+ dense?: 'auto' | boolean;
14
+ footerProps?: FooterProps;
15
+ sx?: SxProps;
38
16
  }
39
- export default DashboardWrapper;
40
- import PropTypes from 'prop-types';
17
+ export default function DashboardWrapper<T extends boolean = true>({ legacy, ...rest }: T extends true ? {
18
+ legacy?: T;
19
+ } & DashboardLegacyProps : {
20
+ legacy?: T;
21
+ } & DashboardProps): import("react/jsx-runtime").JSX.Element;
@@ -1,6 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useEffect, useMemo } from 'react';
3
- import PropTypes from 'prop-types';
4
3
  import { useLocation, matchPath } from 'react-router-dom';
5
4
  import Helmet from 'react-helmet';
6
5
  import Container from '@mui/material/Container';
@@ -17,10 +16,8 @@ import Sidebar from './sidebar';
17
16
  import { styled, useTheme } from '../../Theme';
18
17
  import { Link } from './external-link';
19
18
  import { FullPageProvider, useFullPage } from './full-page';
20
-
21
19
  // 监听 location 变化并关闭 header 中的 menu (确保 drawer - disablePortal:false, keepMounted:true)
22
20
  // 直接监听 menu 中 link 点击来触发 closeMenu 会有问题 (Suspense & lazy)
23
- // eslint-disable-next-line react/prop-types
24
21
  function NavMenuWrapper({
25
22
  closeMenu,
26
23
  ...rest
@@ -59,13 +56,14 @@ function formatLinks(links, location) {
59
56
  });
60
57
  }
61
58
  function Dashboard({
62
- children,
63
- title,
64
- headerProps,
59
+ title = 'Home',
60
+ headerProps = {},
65
61
  links = [],
66
- fullWidth,
67
- dense,
68
- footerProps,
62
+ sidebarWidth = 120,
63
+ fullWidth = false,
64
+ dense = 'auto',
65
+ footerProps = {},
66
+ children,
69
67
  ...rest
70
68
  }) {
71
69
  const theme = useTheme();
@@ -104,6 +102,7 @@ function Dashboard({
104
102
  return /*#__PURE__*/_jsxs(Wrapper, {
105
103
  ...rest,
106
104
  className: classes,
105
+ sidebarWidth: sidebarWidth,
107
106
  children: [/*#__PURE__*/_jsx(Helmet, {
108
107
  title: title
109
108
  }, title), headerVisible && /*#__PURE__*/_jsx(StyledUxHeader, {
@@ -182,24 +181,6 @@ function Dashboard({
182
181
  })]
183
182
  });
184
183
  }
185
- Dashboard.propTypes = {
186
- children: PropTypes.any.isRequired,
187
- title: PropTypes.string,
188
- // 支持分组, links item 如果是数组, 则视为一个 group
189
- links: PropTypes.array.isRequired,
190
- headerProps: PropTypes.object,
191
- fullWidth: PropTypes.bool,
192
- sidebarWidth: PropTypes.number,
193
- // sidenav 稠密一些的布局, 纵向空间占用较少, 默认为 auto, 当 links 个数 > 8 时自动启用
194
- dense: PropTypes.oneOf([true, false, 'auto'])
195
- };
196
- Dashboard.defaultProps = {
197
- title: 'Home',
198
- headerProps: {},
199
- fullWidth: false,
200
- sidebarWidth: 120,
201
- dense: 'auto'
202
- };
203
184
  const Wrapper = styled('div', {
204
185
  shouldForwardProp: prop => prop !== 'sidebarWidth'
205
186
  })`
@@ -264,7 +245,7 @@ const StyledUxHeader = styled(ResponsiveHeader)`
264
245
 
265
246
  // 兼容旧版 dashboard
266
247
  export default function DashboardWrapper({
267
- legacy,
248
+ legacy = true,
268
249
  ...rest
269
250
  }) {
270
251
  if (legacy) {
@@ -277,13 +258,4 @@ export default function DashboardWrapper({
277
258
  ...rest
278
259
  })
279
260
  });
280
- }
281
- DashboardWrapper.propTypes = {
282
- ...Dashboard.propTypes,
283
- legacy: PropTypes.bool,
284
- footerProps: PropTypes.shape(Footer.propTypes)
285
- };
286
- DashboardWrapper.defaultProps = {
287
- ...Dashboard.defaultProps,
288
- legacy: true
289
- };
261
+ }
@@ -1,21 +1,18 @@
1
- export default Sidebar;
2
- declare function Sidebar({ links, addons, dense, ...rest }: {
3
- [x: string]: any;
4
- links: any;
5
- addons: any;
6
- dense: any;
7
- }): import("react/jsx-runtime").JSX.Element;
8
- declare namespace Sidebar {
9
- namespace propTypes {
10
- let links: PropTypes.Validator<any[]>;
11
- let addons: PropTypes.Requireable<any>;
12
- let dense: PropTypes.Requireable<boolean>;
13
- }
14
- namespace defaultProps {
15
- let addons_1: null;
16
- export { addons_1 as addons };
17
- let dense_1: boolean;
18
- export { dense_1 as dense };
19
- }
1
+ export type LinkItem = {
2
+ url: string;
3
+ title: React.ReactNode;
4
+ icon?: React.ReactNode;
5
+ iconZoom?: number;
6
+ color?: string;
7
+ showBadge?: false | true;
8
+ external?: false | true;
9
+ active?: boolean;
10
+ children?: LinkItem[];
11
+ };
12
+ export interface SidebarProps {
13
+ links: LinkItem[];
14
+ addons?: React.ReactNode;
15
+ dense?: false | true;
20
16
  }
21
- import PropTypes from 'prop-types';
17
+ declare function Sidebar({ links, addons, dense, ...rest }: SidebarProps): import("react/jsx-runtime").JSX.Element;
18
+ export default Sidebar;
@@ -1,6 +1,4 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- /* eslint-disable react/no-array-index-key */
3
- import PropTypes from 'prop-types';
4
2
  import Typography from '@mui/material/Typography';
5
3
  import { teal } from '@mui/material/colors';
6
4
  import clsx from 'clsx';
@@ -25,10 +23,8 @@ function renderItem(item, index) {
25
23
  children: /*#__PURE__*/_jsxs(NavLink, {
26
24
  external: external,
27
25
  to: url,
28
- className: ({
29
- isActive
30
- }) => clsx('layout-sidebar-link', {
31
- 'layout-sidebar-link--active': external ? active : isActive
26
+ className: () => clsx('layout-sidebar-link', {
27
+ 'layout-sidebar-link--active': external ? active : false
32
28
  }),
33
29
  children: [icon && /*#__PURE__*/_jsx("span", {
34
30
  className: `layout-sidebar-icon ${showBadge ? 'layout-sidebar-badge' : ''}`,
@@ -55,7 +51,7 @@ function renderGroup(item, index) {
55
51
  function Sidebar({
56
52
  links,
57
53
  addons,
58
- dense,
54
+ dense = false,
59
55
  ...rest
60
56
  }) {
61
57
  return /*#__PURE__*/_jsxs(Root, {
@@ -72,15 +68,6 @@ function Sidebar({
72
68
  }), addons]
73
69
  });
74
70
  }
75
- Sidebar.propTypes = {
76
- links: PropTypes.array.isRequired,
77
- addons: PropTypes.any,
78
- dense: PropTypes.bool
79
- };
80
- Sidebar.defaultProps = {
81
- addons: null,
82
- dense: false
83
- };
84
71
  const gradient = 'linear-gradient(32deg, rgba(144, 255, 230, 0.1), rgba(144, 255, 230, 0))';
85
72
  const Root = styled('div')`
86
73
  display: flex;
@@ -1,37 +1,11 @@
1
- declare function Header({ children, brand, brandAddon, description, addons, onToggleMenu, homeUrl, logo, ...rest }: {
2
- [x: string]: any;
3
- children: any;
4
- brand: any;
5
- brandAddon: any;
6
- description: any;
7
- addons: any;
8
- onToggleMenu: any;
9
- homeUrl: any;
10
- logo: any;
11
- }): import("react/jsx-runtime").JSX.Element;
12
- declare namespace Header {
13
- namespace propTypes {
14
- let onToggleMenu: PropTypes.Validator<(...args: any[]) => any>;
15
- let brand: PropTypes.Validator<string>;
16
- let brandAddon: PropTypes.Requireable<object>;
17
- let description: PropTypes.Validator<any>;
18
- let children: PropTypes.Requireable<any>;
19
- let addons: PropTypes.Requireable<any>;
20
- let homeUrl: PropTypes.Requireable<string>;
21
- let logo: PropTypes.Requireable<any>;
22
- }
23
- namespace defaultProps {
24
- let children_1: null;
25
- export { children_1 as children };
26
- let addons_1: null;
27
- export { addons_1 as addons };
28
- let brandAddon_1: null;
29
- export { brandAddon_1 as brandAddon };
30
- let homeUrl_1: string;
31
- export { homeUrl_1 as homeUrl };
32
- let logo_1: null;
33
- export { logo_1 as logo };
34
- }
1
+ import { type AppBarProps } from '@mui/material/AppBar';
2
+ export interface HeaderProps extends AppBarProps {
3
+ onToggleMenu: () => void;
4
+ brand?: string;
5
+ description?: React.ReactNode;
6
+ addons?: React.ReactNode;
7
+ brandAddon?: React.ReactNode;
8
+ homeUrl?: string;
9
+ logo?: React.ReactNode;
35
10
  }
36
- export default Header;
37
- import PropTypes from 'prop-types';
11
+ export default function Header({ onToggleMenu, brand, description, addons, brandAddon, homeUrl, logo, children, ...rest }: HeaderProps): import("react/jsx-runtime").JSX.Element;
@@ -1,5 +1,4 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import PropTypes from 'prop-types';
3
2
  import Button from '@mui/material/IconButton';
4
3
  import AppBar from '@mui/material/AppBar';
5
4
  import Toolbar from '@mui/material/Toolbar';
@@ -81,7 +80,6 @@ const StyledAppBar = styled(AppBar)`
81
80
  }
82
81
  }
83
82
  `;
84
-
85
83
  /*
86
84
  自定义 logo 相关:
87
85
  如果为 logo prop 传入一个自定义的 svg, 并且 svg 中的元素通过 id 引用了 defs 中的元素 (比如 linearGradient),
@@ -92,14 +90,14 @@ const StyledAppBar = styled(AppBar)`
92
90
  参考: https://blog.patw.me/archives/1820/inline-svg-same-id-and-display-none-issue/
93
91
  */
94
92
  export default function Header({
95
- children,
93
+ onToggleMenu,
96
94
  brand,
97
- brandAddon,
98
95
  description,
99
96
  addons,
100
- onToggleMenu,
101
- homeUrl,
97
+ brandAddon,
98
+ homeUrl = '/',
102
99
  logo,
100
+ children,
103
101
  ...rest
104
102
  }) {
105
103
  return /*#__PURE__*/_jsx(StyledAppBar, {
@@ -153,21 +151,4 @@ export default function Header({
153
151
  })]
154
152
  })
155
153
  });
156
- }
157
- Header.propTypes = {
158
- onToggleMenu: PropTypes.func.isRequired,
159
- brand: PropTypes.string.isRequired,
160
- brandAddon: PropTypes.object,
161
- description: PropTypes.any.isRequired,
162
- children: PropTypes.any,
163
- addons: PropTypes.any,
164
- homeUrl: PropTypes.string,
165
- logo: PropTypes.any
166
- };
167
- Header.defaultProps = {
168
- children: null,
169
- addons: null,
170
- brandAddon: null,
171
- homeUrl: '/',
172
- logo: null
173
- };
154
+ }
@@ -1,57 +1,18 @@
1
- declare function Dashboard({ children, title, brand, description, brandAddon, headerAddon, images, links, prefix, fullWidth, contentLayout, className, homeUrl, logo, ...rest }: {
2
- [x: string]: any;
3
- children: any;
4
- title: any;
5
- brand: any;
6
- description: any;
7
- brandAddon: any;
8
- headerAddon: any;
9
- images: any;
10
- links: any;
11
- prefix: any;
12
- fullWidth: any;
13
- contentLayout: any;
14
- className: any;
15
- homeUrl: any;
16
- logo: any;
17
- }): import("react/jsx-runtime").JSX.Element;
18
- declare namespace Dashboard {
19
- namespace propTypes {
20
- let children: PropTypes.Validator<any>;
21
- let title: PropTypes.Requireable<string>;
22
- let brand: PropTypes.Validator<string>;
23
- let links: PropTypes.Validator<any[]>;
24
- let images: PropTypes.Validator<object>;
25
- let brandAddon: PropTypes.Requireable<object>;
26
- let description: PropTypes.Validator<any>;
27
- let headerAddon: PropTypes.Requireable<any>;
28
- let prefix: PropTypes.Requireable<string>;
29
- let contentLayout: PropTypes.Requireable<string>;
30
- let fullWidth: PropTypes.Requireable<boolean>;
31
- let className: PropTypes.Requireable<string>;
32
- let homeUrl: PropTypes.Requireable<string>;
33
- let logo: PropTypes.Requireable<any>;
34
- }
35
- namespace defaultProps {
36
- let title_1: string;
37
- export { title_1 as title };
38
- let contentLayout_1: string;
39
- export { contentLayout_1 as contentLayout };
40
- let headerAddon_1: null;
41
- export { headerAddon_1 as headerAddon };
42
- let brandAddon_1: null;
43
- export { brandAddon_1 as brandAddon };
44
- let prefix_1: string;
45
- export { prefix_1 as prefix };
46
- let fullWidth_1: boolean;
47
- export { fullWidth_1 as fullWidth };
48
- let className_1: string;
49
- export { className_1 as className };
50
- let homeUrl_1: string;
51
- export { homeUrl_1 as homeUrl };
52
- let logo_1: null;
53
- export { logo_1 as logo };
54
- }
1
+ import { type SxProps } from '@mui/material';
2
+ import { type LinkItem } from './sidebar';
3
+ export interface DashboardProps extends React.HTMLAttributes<HTMLDivElement> {
4
+ links?: LinkItem[];
5
+ brand?: string;
6
+ description?: React.ReactNode;
7
+ images: Record<string, string>;
8
+ title?: string;
9
+ brandAddon?: React.ReactNode;
10
+ headerAddon?: React.ReactNode;
11
+ prefix?: string;
12
+ fullWidth?: false | true;
13
+ contentLayout?: 'row' | 'column';
14
+ homeUrl?: string;
15
+ logo?: React.ReactNode;
16
+ sx?: SxProps;
55
17
  }
56
- export default Dashboard;
57
- import PropTypes from 'prop-types';
18
+ export default function Dashboard({ links, brand, description, images, title, brandAddon, headerAddon, prefix, fullWidth, contentLayout, className, homeUrl, logo, children, ...rest }: DashboardProps): import("react/jsx-runtime").JSX.Element;
@@ -1,6 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useEffect, useState } from 'react';
3
- import PropTypes from 'prop-types';
4
3
  import Helmet from 'react-helmet';
5
4
  import Container from '@mui/material/Container';
6
5
  import Box from '@mui/material/Box';
@@ -40,20 +39,20 @@ const Wrapper = styled('div')`
40
39
  }
41
40
  `;
42
41
  export default function Dashboard({
43
- children,
44
- title,
45
- brand,
46
- description,
42
+ links = [],
43
+ brand = '',
44
+ description = '',
45
+ images,
46
+ title = 'Home',
47
47
  brandAddon,
48
48
  headerAddon,
49
- images,
50
- links,
51
- prefix,
52
- fullWidth,
53
- contentLayout,
54
- className,
55
- homeUrl,
49
+ prefix = '/images',
50
+ fullWidth = false,
51
+ contentLayout = 'column',
52
+ className = '',
53
+ homeUrl = '/',
56
54
  logo,
55
+ children,
57
56
  ...rest
58
57
  }) {
59
58
  const breakpoint = 960;
@@ -116,32 +115,4 @@ export default function Dashboard({
116
115
  })]
117
116
  })]
118
117
  });
119
- }
120
- Dashboard.propTypes = {
121
- children: PropTypes.any.isRequired,
122
- title: PropTypes.string,
123
- brand: PropTypes.string.isRequired,
124
- links: PropTypes.array.isRequired,
125
- images: PropTypes.object.isRequired,
126
- brandAddon: PropTypes.object,
127
- description: PropTypes.any.isRequired,
128
- headerAddon: PropTypes.any,
129
- prefix: PropTypes.string,
130
- // 兼容旧版的设置,新版使用 fullWidth 进行设置
131
- contentLayout: PropTypes.oneOf(['row', 'column']),
132
- fullWidth: PropTypes.bool,
133
- className: PropTypes.string,
134
- homeUrl: PropTypes.string,
135
- logo: PropTypes.any
136
- };
137
- Dashboard.defaultProps = {
138
- title: 'Home',
139
- contentLayout: 'column',
140
- headerAddon: null,
141
- brandAddon: null,
142
- prefix: '/images',
143
- fullWidth: false,
144
- className: '',
145
- homeUrl: '/',
146
- logo: null
147
- };
118
+ }
@@ -1,27 +1,16 @@
1
- declare function Sidebar({ images, links, prefix, addons, logo, ...rest }: {
2
- [x: string]: any;
3
- images: any;
4
- links: any;
5
- prefix: any;
6
- addons: any;
7
- logo: any;
8
- }): import("react/jsx-runtime").JSX.Element;
9
- declare namespace Sidebar {
10
- namespace propTypes {
11
- let images: PropTypes.Validator<object>;
12
- let links: PropTypes.Validator<any[]>;
13
- let prefix: PropTypes.Requireable<string>;
14
- let addons: PropTypes.Requireable<any>;
15
- let logo: PropTypes.Requireable<any>;
16
- }
17
- namespace defaultProps {
18
- let prefix_1: string;
19
- export { prefix_1 as prefix };
20
- let addons_1: null;
21
- export { addons_1 as addons };
22
- let logo_1: null;
23
- export { logo_1 as logo };
24
- }
1
+ import { type SxProps } from '@mui/material';
2
+ export type LinkItem = {
3
+ url: string;
4
+ title: React.ReactNode;
5
+ name: string;
6
+ showBadge?: false | true;
7
+ };
8
+ export interface SidebarProps extends React.HTMLAttributes<HTMLDivElement> {
9
+ images: Record<string, string>;
10
+ links: LinkItem[];
11
+ prefix: string;
12
+ addons?: React.ReactNode;
13
+ logo?: React.ReactNode;
14
+ sx?: SxProps;
25
15
  }
26
- export default Sidebar;
27
- import PropTypes from 'prop-types';
16
+ export default function Sidebar({ images, links, prefix, addons, logo, ...rest }: SidebarProps): import("react/jsx-runtime").JSX.Element;