@arcblock/ux 2.10.23 → 2.10.25

Sign up to get free protection for your applications and to get access to all the features.
Files changed (156) hide show
  1. package/babel.config.es.js +1 -0
  2. package/lib/ActionButton/index.js +1 -1
  3. package/lib/ActivityIndicator/index.d.ts +34 -0
  4. package/lib/ActivityIndicator/index.js +1 -1
  5. package/lib/Address/compact-text.js +1 -1
  6. package/lib/Address/did-address.js +1 -1
  7. package/lib/Address/index.js +1 -1
  8. package/lib/Address/responsive-did-address.js +1 -1
  9. package/lib/Alert/index.d.ts +12 -0
  10. package/lib/Alert/index.js +1 -1
  11. package/lib/AnimationWaiter/index.js +1 -1
  12. package/lib/Async/index.js +1 -1
  13. package/lib/Avatar/did-motif.d.ts +29 -0
  14. package/lib/Avatar/did-motif.js +1 -1
  15. package/lib/Avatar/etherscan-blockies.d.ts +5 -0
  16. package/lib/Avatar/index.d.ts +64 -0
  17. package/lib/Avatar/index.js +1 -1
  18. package/lib/Badge/index.d.ts +12 -0
  19. package/lib/Badge/index.js +1 -1
  20. package/lib/Blocklet/blocklet.d.ts +84 -0
  21. package/lib/Blocklet/blocklet.js +1 -1
  22. package/lib/Blocklet/index.d.ts +5 -0
  23. package/lib/Blocklet/utils.d.ts +3 -0
  24. package/lib/BlockletContext/index.js +1 -1
  25. package/lib/BlockletNFT/index.js +1 -1
  26. package/lib/Button/index.d.ts +3 -0
  27. package/lib/Button/wrap.d.ts +27 -0
  28. package/lib/Button/wrap.js +4 -3
  29. package/lib/CardSelector/index.js +1 -1
  30. package/lib/Center/index.js +1 -1
  31. package/lib/ClickToCopy/copy-button.js +1 -1
  32. package/lib/ClickToCopy/index.js +1 -1
  33. package/lib/CodeBlock/index.js +1 -1
  34. package/lib/Colors/index.d.ts +2 -0
  35. package/lib/Colors/themes/default.d.ts +76 -0
  36. package/lib/Colors/themes/temp.d.ts +36 -0
  37. package/lib/ContactForm/index.js +1 -1
  38. package/lib/CookieConsent/index.js +1 -1
  39. package/lib/CountDown/index.js +1 -1
  40. package/lib/DID/index.js +1 -1
  41. package/lib/Datatable/CustomToolbar.d.ts +37 -0
  42. package/lib/Datatable/CustomToolbar.js +1 -1
  43. package/lib/Datatable/DatatableContext.d.ts +4 -0
  44. package/lib/Datatable/DatatableContext.js +1 -1
  45. package/lib/Datatable/TableSearch.d.ts +28 -0
  46. package/lib/Datatable/TableSearch.js +1 -1
  47. package/lib/Datatable/index.d.ts +53 -0
  48. package/lib/Datatable/index.js +11 -3
  49. package/lib/Datatable/utils.d.ts +5 -0
  50. package/lib/Dialog/confirm.d.ts +86 -0
  51. package/lib/Dialog/confirm.js +23 -13
  52. package/lib/Dialog/dialog.d.ts +115 -0
  53. package/lib/Dialog/dialog.js +12 -7
  54. package/lib/Dialog/index.d.ts +3 -0
  55. package/lib/Dialog/use-confirm.d.ts +8 -0
  56. package/lib/Dialog/use-confirm.js +1 -1
  57. package/lib/DidLogo/index.js +1 -1
  58. package/lib/Earth/index.js +1 -1
  59. package/lib/Empty/index.d.ts +39 -0
  60. package/lib/Empty/index.js +1 -1
  61. package/lib/ErrorBoundary/fallback.js +1 -1
  62. package/lib/Footer/index.js +1 -1
  63. package/lib/Header/auto-hidden.js +1 -1
  64. package/lib/Header/header.js +1 -1
  65. package/lib/Header/responsive-header.js +1 -1
  66. package/lib/Icon/image.js +1 -1
  67. package/lib/Icon/index.d.ts +2 -0
  68. package/lib/Icon/index.js +1 -1
  69. package/lib/Img/index.d.ts +77 -0
  70. package/lib/Img/index.js +2 -1
  71. package/lib/InfoRow/index.js +1 -1
  72. package/lib/Layout/dashboard/external-link.js +1 -1
  73. package/lib/Layout/dashboard/full-page.js +1 -1
  74. package/lib/Layout/dashboard/index.js +1 -1
  75. package/lib/Layout/dashboard/sidebar.js +1 -1
  76. package/lib/Layout/dashboard-legacy/header.js +1 -1
  77. package/lib/Layout/dashboard-legacy/index.js +1 -1
  78. package/lib/Layout/dashboard-legacy/sidebar.js +1 -1
  79. package/lib/Layout/index.js +1 -1
  80. package/lib/LoadingMask/index.js +1 -1
  81. package/lib/Locale/context.js +1 -1
  82. package/lib/Locale/selector.js +1 -1
  83. package/lib/Logo/index.d.ts +42 -0
  84. package/lib/Logo/index.js +1 -1
  85. package/lib/Metric/index.js +1 -1
  86. package/lib/NFTDisplay/aspect-ratio-container.js +1 -1
  87. package/lib/NFTDisplay/broken.js +1 -1
  88. package/lib/NFTDisplay/index.js +1 -1
  89. package/lib/NFTDisplay/loading.js +1 -1
  90. package/lib/NFTDisplay/svg-embedder/img.js +1 -1
  91. package/lib/NFTDisplay/svg-embedder/inline-svg.js +1 -1
  92. package/lib/NavMenu/nav-menu.js +1 -1
  93. package/lib/PageScroller/index.js +1 -1
  94. package/lib/PageScroller/story/FullPage.js +1 -1
  95. package/lib/PageScroller/story/PageContain.js +1 -1
  96. package/lib/Passport/passport.js +1 -1
  97. package/lib/PoweredByArcBlock/index.js +1 -1
  98. package/lib/PricingTable/PricingPlan.js +1 -1
  99. package/lib/PricingTable/index.js +1 -1
  100. package/lib/QRCode/index.js +1 -1
  101. package/lib/RelativeTime/index.js +1 -1
  102. package/lib/Result/common.js +1 -1
  103. package/lib/Result/index.js +1 -1
  104. package/lib/Result/result.js +1 -1
  105. package/lib/Screenshot/BaseScreenshot/index.js +1 -1
  106. package/lib/Screenshot/index.js +1 -1
  107. package/lib/SessionBlocklet/index.js +1 -1
  108. package/lib/SessionUser/components/logged-in.js +1 -1
  109. package/lib/SessionUser/components/session-user-item.js +1 -1
  110. package/lib/SessionUser/components/session-user-switch.js +1 -1
  111. package/lib/SessionUser/components/un-login.js +1 -1
  112. package/lib/SessionUser/components/user-info.js +1 -1
  113. package/lib/SessionUser/index.js +1 -1
  114. package/lib/Spinner/index.js +1 -1
  115. package/lib/SplitButton/index.js +8 -8
  116. package/lib/Success/index.js +1 -1
  117. package/lib/Switch/index.d.ts +31 -0
  118. package/lib/Switch/index.js +1 -1
  119. package/lib/Tabs/index.js +1 -1
  120. package/lib/Tag/index.d.ts +14 -0
  121. package/lib/Tag/index.js +11 -7
  122. package/lib/TextCollapse/index.js +1 -1
  123. package/lib/Theme/index.d.ts +14 -0
  124. package/lib/Theme/index.js +9 -0
  125. package/lib/Theme/theme-provider.d.ts +25 -0
  126. package/lib/Theme/theme-provider.js +1 -1
  127. package/lib/Theme/theme.d.ts +17 -0
  128. package/lib/Theme/theme.js +21 -3
  129. package/lib/Toast/index.d.ts +11 -0
  130. package/lib/Toast/index.js +2 -1
  131. package/lib/Typography/index.js +1 -1
  132. package/lib/Util/constant.d.ts +33 -0
  133. package/lib/Util/deprecate.d.ts +5 -0
  134. package/lib/Util/deprecate.js +1 -1
  135. package/lib/Util/index.d.ts +81 -0
  136. package/lib/Util/index.js +3 -1
  137. package/lib/Video/index.js +1 -1
  138. package/lib/Wallet/Action.js +1 -1
  139. package/lib/Wallet/Download.js +1 -1
  140. package/lib/Wallet/Open.js +1 -1
  141. package/lib/WalletOSIcon/index.js +1 -1
  142. package/lib/WebWalletSWKeeper/index.js +1 -1
  143. package/lib/WechatPrompt/index.js +1 -1
  144. package/lib/withTheme/index.js +1 -1
  145. package/lib/withTracker/error_boundary.js +1 -1
  146. package/lib/withTracker/index.js +1 -1
  147. package/package.json +13 -7
  148. package/src/Button/wrap.js +3 -2
  149. package/src/Datatable/index.jsx +9 -2
  150. package/src/Dialog/confirm.jsx +22 -12
  151. package/src/Dialog/dialog.jsx +11 -6
  152. package/src/SplitButton/index.js +7 -7
  153. package/src/Tag/index.js +10 -6
  154. package/src/Theme/index.js +8 -0
  155. package/src/Theme/theme.js +20 -3
  156. package/src/Util/index.js +3 -1
@@ -0,0 +1,33 @@
1
+ export const DEFAULT_TIMEOUT: number;
2
+ export const DEFAULT_WINDOW_TIMEOUT: number;
3
+ export const WELLKNOWN_SERVICE_PATH_PREFIX: "/.well-known/service";
4
+ export const AUTH_SERVICE_PREFIX: "/.well-known/service";
5
+ export const SESSION_TOKEN_STORAGE_KEY: "login_token";
6
+ export const REFRESH_TOKEN_STORAGE_KEY: "refresh_token";
7
+ export const RELAY_SOCKET_PREFIX: "/.well-known/service";
8
+ export const API_DID_PREFIX: "/api/did";
9
+ export const DASHBOARD_URL: "/.well-known/service/admin";
10
+ export const PROFILE_URL: "/.well-known/service/user";
11
+ export const NAVIGATION_URL: "/.well-known/service/admin/navigation";
12
+ export const DID_PREFIX: "did:abt:";
13
+ export namespace PASSPORT_STATUS {
14
+ let VALID: string;
15
+ let REVOKED: string;
16
+ }
17
+ export namespace LOGIN_PROVIDER {
18
+ let AUTH0: string;
19
+ let APPLE: string;
20
+ let GITHUB: string;
21
+ let GOOGLE: string;
22
+ let WALLET: string;
23
+ let NFT: string;
24
+ }
25
+ export const LOGIN_PROVIDER_NAME: {
26
+ [x: string]: string;
27
+ };
28
+ export namespace OAUTH_PROVIDER {
29
+ let auth0: string;
30
+ let apple: string;
31
+ let github: string;
32
+ let google: string;
33
+ }
@@ -0,0 +1,5 @@
1
+ export function warn(name: any, alternative: any): void;
2
+ export function withDeprecated(Component: any, { name, alternative }: {
3
+ name: any;
4
+ alternative: any;
5
+ }): (props: any) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
@@ -1,5 +1,5 @@
1
- import { useEffect } from 'react';
2
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useEffect } from 'react';
3
3
  const warn = (name, alternative) => {
4
4
  if (process.env.NODE_ENV === 'production') {
5
5
  return;
@@ -0,0 +1,81 @@
1
+ export function parseQuery(str: any): any;
2
+ export function stringifyQuery(params?: {}): string;
3
+ /**
4
+ * @param {number} opts.expireInDays
5
+ * @param {string} opts.path
6
+ * @param {domain} opts.domain
7
+ * @param {boolean} opts.returnDomain if === false, opts.domain will be skipped
8
+ */
9
+ export function getCookieOptions(expireInDays?: number): {
10
+ expires: number;
11
+ path: any;
12
+ domain: any;
13
+ sameSite: any;
14
+ secure: boolean;
15
+ };
16
+ export function mergeProps(props: any, component: any, jsonAttrs?: any[]): any;
17
+ export function getCopyright(startYear?: number): string;
18
+ /**
19
+ * Set the date tool library which support for format() and locale() functions,
20
+ * moment and dayjs are recommended.
21
+ * @param {object} the date tool library
22
+ */
23
+ export function setDateTool(tool: any): void;
24
+ export function getDateTool(): any;
25
+ /**
26
+ * Format the time string as `ll` format: MMM D, YYYY
27
+ * Ensure that the setDateTool() function is called first to set the time tool library.
28
+ * @param {string} date date string
29
+ * @param {object} option
30
+ * @param {string} option.locale, default: en
31
+ * @param {string} option.tz, default: timzone
32
+ * @returns formatted date string
33
+ */
34
+ export function formatToDate(date: string, { locale, tz }?: {
35
+ locale: string;
36
+ tz: string;
37
+ }): any;
38
+ /**
39
+ * Format the time string as `lll` format: MMM D, YYYY h:mm A
40
+ * Ensure that the setDateTool() function is called first to set the time tool library.
41
+ * @param {string} date date string
42
+ * @param {object} option
43
+ * @param {string} option.locale, default: en
44
+ * @param {string} option.tz, default: timzone
45
+ * @returns formatted date string
46
+ */
47
+ export function formatToDatetime(date: string, { locale, tz }?: {
48
+ locale: string;
49
+ tz: string;
50
+ }): any;
51
+ export function detectWalletExtension(): any;
52
+ export function openWebWallet({ webWalletUrl, action, locale, url, windowFeatures }: {
53
+ webWalletUrl: any;
54
+ action?: string;
55
+ locale?: string;
56
+ url: any;
57
+ windowFeatures: any;
58
+ }): void;
59
+ export function getColor(props: any): any;
60
+ export function getBackground(props: any): any;
61
+ export function getTimezone(): string;
62
+ export function str2color(str: any): string;
63
+ export function formatUptime(uptime: any): string;
64
+ export function getFontSize(size: any): string;
65
+ export function isEthereumDid(did: any): boolean;
66
+ export function appendParams(url: string, params: {
67
+ imageFilter: "crop" | "resize";
68
+ w?: number;
69
+ h?: number;
70
+ r?: 0 | 90 | 180 | 270;
71
+ }): string;
72
+ export function getUserAvatar(avatar: any, size?: number): any;
73
+ export function sleep(time?: number): Promise<any>;
74
+ export function isUrl(str: any): boolean;
75
+ export function getVisitorId(): string;
76
+ export function setVisitorId(value: any): void;
77
+ export function getDIDColor(did: any): any;
78
+ export function getTranslation(translations: any | string, locale: string, { fallbackLocale, defaultValue }?: {
79
+ fallbackLocale?: string;
80
+ defaultValue?: string;
81
+ }): string;
package/lib/Util/index.js CHANGED
@@ -38,7 +38,9 @@ export function getCookieOptions(expireInDays = 1) {
38
38
  expires: opts.expireInDays,
39
39
  path: opts.path,
40
40
  domain: opts.domain || '',
41
- sameSite: opts.sameSite || 'lax'
41
+ sameSite: opts.sameSite || 'Lax',
42
+ // 允许自定义设置为 false,默认是 true
43
+ secure: opts.secure !== false
42
44
  };
43
45
  if (typeof window === 'undefined' || opts.domain || opts.returnDomain === false) {
44
46
  if (opts.returnDomain === false) {
@@ -1,10 +1,10 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
1
2
  import { useState } from 'react';
2
3
  import PropTypes from 'prop-types';
3
4
  import Player from 'react-player';
4
5
  import CircularProgress from '@mui/material/CircularProgress';
5
6
  import { mergeProps } from '../Util';
6
7
  import { styled } from '../Theme';
7
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
8
8
  const {
9
9
  string,
10
10
  number,
@@ -1,3 +1,4 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
1
2
  import PropTypes from 'prop-types';
2
3
  import Typography from '@mui/material/Typography';
3
4
  import logo from './images/abtwallet.png';
@@ -5,7 +6,6 @@ import { mergeProps } from '../Util';
5
6
  import colors from '../Colors';
6
7
  import Button from '../Button';
7
8
  import { styled } from '../Theme';
8
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
9
9
  export default function WalletAction(props) {
10
10
  const newProps = mergeProps(props, WalletAction, ['style']);
11
11
  const {
@@ -1,3 +1,4 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
1
2
  import React from "react";
2
3
  import PropTypes from 'prop-types';
3
4
  import Typography from '@mui/material/Typography';
@@ -205,7 +206,6 @@ AndroidDownloadIcon.defaultProps = {
205
206
  import Button from '../Button';
206
207
  import { mergeProps } from '../Util';
207
208
  import { styled } from '../Theme';
208
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
209
209
  export default function WalletDownload(props) {
210
210
  const browser = useBrowser();
211
211
  const newProps = mergeProps(props, WalletDownload, ['style']);
@@ -1,8 +1,8 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
1
2
  import PropTypes from 'prop-types';
2
3
  import useBrowser from '@arcblock/react-hooks/lib/useBrowser';
3
4
  import Fab from '@mui/material/Fab';
4
5
  import { styled } from '../Theme';
5
- import { jsx as _jsx } from "react/jsx-runtime";
6
6
  export default function OpenInWallet({
7
7
  locale,
8
8
  link
@@ -1,3 +1,4 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
1
2
  import PropTypes from 'prop-types';
2
3
  import { Icon } from '@iconify/react';
3
4
  import ApiIcon from '@iconify-icons/mdi/api';
@@ -8,7 +9,6 @@ import QuestionMarkRoundedIcon from '@iconify-icons/material-symbols/question-ma
8
9
  // import Auth0Icon from '@iconify-icons/logos/auth0-icon';
9
10
  import MailOutlineRoundedIcon from '@iconify-icons/material-symbols/mail-outline-rounded';
10
11
  import { LOGIN_PROVIDER } from '../Util/constant';
11
- import { jsx as _jsx } from "react/jsx-runtime";
12
12
  export default function WalletOSIcon({
13
13
  loading,
14
14
  walletOS,
@@ -1,3 +1,4 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
1
2
  import { useEffect, useRef } from 'react';
2
3
  import PropTypes from 'prop-types';
3
4
  import useIdle from 'react-use/lib/useIdle';
@@ -7,7 +8,6 @@ import { detectWalletExtension } from '@arcblock/ux/lib/Util';
7
8
  import { getWebWalletUrl, checkSameProtocol } from '../Util/wallet';
8
9
 
9
10
  // 默认最大空闲时间: 30min
10
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
11
11
  const DEFAULT_MAX_IDLE_TIME = 1000 * 60 * 30;
12
12
  // 可使用 localStorage.setItem('wallet_sw_keeper_disabled', 1) 来禁用嵌入 wallet iframe
13
13
  const STORAGE_KEY_DISABLED = 'wallet_sw_keeper_disabled';
@@ -1,10 +1,10 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
1
2
  import Typography from '@mui/material/Typography';
2
3
  import Dialog from '@mui/material/Dialog';
3
4
  import useBrowser from '@arcblock/react-hooks/lib/useBrowser';
4
5
  import IosImage from './images/ios.png';
5
6
  import AndroidImage from './images/android.png';
6
7
  import { styled } from '../Theme';
7
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
8
8
  export default function WechatPrompt() {
9
9
  const browser = useBrowser();
10
10
  if (!browser.mobile.any) {
@@ -1,8 +1,8 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
1
2
  import { useEffect } from 'react';
2
3
  import { Global, css } from '@emotion/react';
3
4
  import CssBaseline from '@mui/material/CssBaseline';
4
5
  import { createTheme, ThemeProvider } from '../Theme';
5
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
6
6
  function withTheme(Component, {
7
7
  mode = 'light',
8
8
  pageWidth = 'md',
@@ -1,8 +1,8 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
1
2
  /* eslint-disable import/no-unresolved */
2
3
  import { Component } from 'react';
3
4
  import * as Sentry from '@sentry/browser';
4
5
  import Alert from '../Alert';
5
- import { jsx as _jsx } from "react/jsx-runtime";
6
6
  export default class ErrorBoundary extends Component {
7
7
  constructor(props) {
8
8
  super(props);
@@ -1,10 +1,10 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
1
2
  /* eslint-disable import/no-unresolved */
2
3
  import ReactGA from 'react-ga';
3
4
  import * as Sentry from '@sentry/browser';
4
5
  import { useMount, useDeepCompareEffect } from 'ahooks';
5
6
  import { useLocation } from 'react-router-dom';
6
7
  import ErrorBoundary from './error_boundary';
7
- import { jsx as _jsx } from "react/jsx-runtime";
8
8
  export default ((WrappedComponent, options = {}) => {
9
9
  const {
10
10
  appVersion,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcblock/ux",
3
- "version": "2.10.23",
3
+ "version": "2.10.25",
4
4
  "description": "Common used react components for arcblock products",
5
5
  "keywords": [
6
6
  "react",
@@ -19,7 +19,10 @@
19
19
  "scripts": {
20
20
  "lint": "eslint src tests --ext js --ext jsx",
21
21
  "lint:fix": "npm run lint -- --fix",
22
- "build": "babel --config-file ./babel.config.es.js src --out-dir lib --copy-files --no-copy-ignored",
22
+ "build": "npm run build:clean && npm run build:lib && npm run build:types",
23
+ "build:clean": "rm -rf lib",
24
+ "build:lib": "babel --config-file ./babel.config.es.js src --out-dir lib --copy-files --no-copy-ignored",
25
+ "build:types": "tsc",
23
26
  "watch": "babel --config-file ./babel.config.es.js src --out-dir lib -w --copy-files --no-copy-ignored",
24
27
  "precommit": "CI=1 npm run lint",
25
28
  "prepush": "CI=1 npm run lint",
@@ -39,12 +42,14 @@
39
42
  "@babel/plugin-proposal-class-properties": "^7.18.6",
40
43
  "@babel/preset-env": "^7.19.3",
41
44
  "@babel/preset-react": "^7.18.6",
45
+ "@types/react": "^18.3.4",
42
46
  "babel-plugin-inline-react-svg": "^1.1.2",
43
47
  "eslint-plugin-react-hooks": "^4.6.0",
44
48
  "glob": "^10.3.3",
45
49
  "jest": "^28.1.3",
46
50
  "jest-environment-jsdom": "^29.5.0",
47
- "moment-timezone": "^0.5.37"
51
+ "moment-timezone": "^0.5.37",
52
+ "typescript": "^5.5.4"
48
53
  },
49
54
  "peerDependencies": {
50
55
  "@emotion/react": "^11.10.4",
@@ -54,12 +59,12 @@
54
59
  "react": ">=18.2.0",
55
60
  "react-router-dom": ">=6.22.3"
56
61
  },
57
- "gitHead": "388c83a3db6cd8b28fd0922710ab4f63c33152bf",
62
+ "gitHead": "c08068e4f1992102d89bc2fc54c93a864453bf24",
58
63
  "dependencies": {
59
64
  "@arcblock/did-motif": "^1.1.13",
60
- "@arcblock/icons": "^2.10.23",
61
- "@arcblock/nft-display": "^2.10.23",
62
- "@arcblock/react-hooks": "^2.10.23",
65
+ "@arcblock/icons": "^2.10.25",
66
+ "@arcblock/nft-display": "^2.10.25",
67
+ "@arcblock/react-hooks": "^2.10.25",
63
68
  "@babel/plugin-syntax-dynamic-import": "^7.8.3",
64
69
  "@fontsource/inter": "^5.0.16",
65
70
  "@fontsource/ubuntu-mono": "^5.0.18",
@@ -69,6 +74,7 @@
69
74
  "@iconify/react": "^4.1.1",
70
75
  "@solana/qr-code-styling": "^1.6.0-beta.0",
71
76
  "@testing-library/react": "^14.0.0",
77
+ "@types/mui-datatables": "^4.3.12",
72
78
  "ahooks": "^3.7.10",
73
79
  "axios": "^1.7.2",
74
80
  "base64-url": "^2.3.3",
@@ -19,12 +19,13 @@ const extendedColors = {
19
19
  };
20
20
 
21
21
  /**
22
+ * @typedef {import('@mui/material').ButtonProps} MuiButtonProps
22
23
  * @typedef {{
23
24
  * rounded?: boolean,
24
25
  * loading?: boolean,
25
26
  * forwardedRef?: import('react').ForwardedRef<any>,
26
- * color?: 'default' | 'inherit' | 'primary' | 'secondary' | 'danger' | 'warning' | 'reverse' | 'did'
27
- * } & import('@mui/material').ButtonProps} ButtonProps
27
+ * color?: MuiButtonProps['color'] | 'reverse' | 'did'
28
+ * } & Omit<MuiButtonProps, 'color'>} ButtonProps
28
29
  */
29
30
 
30
31
  /**
@@ -17,6 +17,7 @@ import { styled } from '../Theme';
17
17
  * @typedef {{
18
18
  * icon: import('react').ReactElement,
19
19
  * title: string,
20
+ * onClick?: () => void
20
21
  * }} DataTableCustomButton
21
22
  */
22
23
 
@@ -38,6 +39,12 @@ import { styled } from '../Theme';
38
39
  * @typedef {Pick<import('mui-datatables').MUIDataTableState, 'count' | 'page' | 'rowsPerPage' | 'searchText' | 'sortOrder' | 'filterList'>} DataTableState
39
40
  */
40
41
 
42
+ /**
43
+ * @typedef {Object} ModifiedMUIDataTableProps
44
+ * @property {string} [title] - The title of the table (optional).
45
+ * @property {...import('mui-datatables').MUIDataTableProps} [rest] - Other props from MUIDataTableProps.
46
+ */
47
+
41
48
  /**
42
49
  * @typedef {{
43
50
  * data: Array<object | number[] | string[]>,
@@ -53,10 +60,10 @@ import { styled } from '../Theme';
53
60
  * verticalKeyWidth?: number | string,
54
61
  * hideTableHeader?: boolean,
55
62
  * components?: import('react').ReactElement,
56
- * emptyNode?: import('react').ReactElement,
63
+ * emptyNode?: import('react').ReactNode,
57
64
  * durable?: string,
58
65
  * durableKeys?: 'page' | 'rowsPerPage' | 'searchText' | 'sortOrder'
59
- * } & import('mui-datatables').MUIDataTableProps} DataTableProps
66
+ * } & ModifiedMUIDataTableProps} DataTableProps
60
67
  */
61
68
 
62
69
  const FilterLine = styled('div')`
@@ -5,17 +5,22 @@ import Button from '../Button';
5
5
  import Dialog from './dialog';
6
6
 
7
7
  /**
8
- @typedef {Object} ConfirmProps
9
- @property {boolean} open
10
- @property {React.ReactNode} title
11
- @property {React.ReactNode} children
12
- @property {() => void | Promise<void>} onConfirm
13
- @property {() => void | Promise<void>} onCancel
14
- @property {boolean} [showCancelButton=true]
15
- @property {{text: string, props?: import('../Button/wrap').ButtonProps}} [confirmButton={text: 'Confirm'}]
16
- @property {{text: string, props?: import('../Button/wrap').ButtonProps}} [cancelButton={text: 'Cancel'}]
17
- @property {import('@mui/material').PaperProps} [PaperProps={}]
18
- */
8
+ * @typedef {import('../Button/wrap').ButtonProps} ButtonProps
9
+ * @typedef {import('@mui/material').PaperProps} PaperProps
10
+ * @typedef {{
11
+ * title: React.ReactNode,
12
+ * open: boolean,
13
+ * children: React.ReactNode,
14
+ * onConfirm: () => void | Promise<void>,
15
+ * onCancel: () => void | Promise<void>,
16
+ * showCancelButton?: boolean,
17
+ * showCloseButton?: boolean,
18
+ * fullScreen?: boolean,
19
+ * confirmButton?: {text: string, props?: ButtonProps}
20
+ * cancelButton?: {text: string, props?: ButtonProps}
21
+ * PaperProps?: PaperProps
22
+ * }} ConfirmProps
23
+ */
19
24
 
20
25
  // 注意排在 {...rest} 之后的 props 优先级更高
21
26
  /**
@@ -30,6 +35,7 @@ export default function Confirm({
30
35
  onCancel,
31
36
  showCloseButton,
32
37
  showCancelButton,
38
+ fullScreen,
33
39
  confirmButton,
34
40
  cancelButton,
35
41
  PaperProps,
@@ -58,6 +64,7 @@ export default function Confirm({
58
64
  {...rest}
59
65
  onClose={handleClose}
60
66
  showCloseButton={showCloseButton}
67
+ fullScreen={fullScreen}
61
68
  slotProps={{
62
69
  header: {
63
70
  sx: {
@@ -105,11 +112,13 @@ export default function Confirm({
105
112
 
106
113
  Confirm.propTypes = {
107
114
  title: PropTypes.node.isRequired,
115
+ open: PropTypes.bool.isRequired,
108
116
  children: PropTypes.node.isRequired,
109
117
  onConfirm: PropTypes.func.isRequired,
110
118
  onCancel: PropTypes.func.isRequired,
111
119
  showCancelButton: PropTypes.bool,
112
120
  showCloseButton: PropTypes.bool,
121
+ fullScreen: PropTypes.bool,
113
122
  // 可以传入 {text: ..., props: ...}
114
123
  confirmButton: PropTypes.shape({
115
124
  text: PropTypes.string.isRequired,
@@ -123,8 +132,9 @@ Confirm.propTypes = {
123
132
  };
124
133
 
125
134
  Confirm.defaultProps = {
126
- showCloseButton: true,
127
135
  showCancelButton: true,
136
+ showCloseButton: true,
137
+ fullScreen: false,
128
138
  confirmButton: {
129
139
  text: 'Confirm',
130
140
  },
@@ -13,14 +13,15 @@ import {
13
13
  import { styled, useTheme } from '../Theme';
14
14
 
15
15
  /**
16
- @typedef {import('@mui/material').PaperProps & {
17
- minWidth: number | string,
18
- minHeight: number | string,
19
- }} PaperStyle
20
- */
16
+ * @typedef {import('@mui/material').DialogProps} MuiDialogProps
17
+ * @typedef {import('@mui/material').PaperProps & {
18
+ * minWidth?: number | string,
19
+ * minHeight?: number | string,
20
+ * }} PaperStyle
21
+ */
21
22
 
22
23
  /**
23
- @typedef {Object} DialogProps
24
+ @typedef {Object} UxDialogProps
24
25
  @property {React.ReactNode} children - The content of the dialog.
25
26
  @property {React.ReactNode} [title] - The title of the dialog.
26
27
  @property {React.ReactNode} [prepend] - Content to be displayed before the dialog title.
@@ -32,6 +33,10 @@ import { styled, useTheme } from '../Theme';
32
33
  @property {(event: React.SyntheticEvent, reason: string) => void} [onClose] - Callback function fired when the dialog is closed.
33
34
  */
34
35
 
36
+ /**
37
+ * @typedef {MuiDialogProps & UxDialogProps} DialogProps
38
+ */
39
+
35
40
  /**
36
41
  * Dialog
37
42
  *
@@ -13,13 +13,12 @@ import noop from 'lodash/noop';
13
13
  import { styled } from '../Theme';
14
14
 
15
15
  /**
16
+ * @typedef {import('@mui/material').MenuItem} MenuItem
17
+ * @typedef {import('@mui/material').MenuItemProps} MenuItemProps
16
18
  * SplitButton 组件 Props
17
19
  * @typedef {{
18
- * size?: 'small' | 'medium' | 'large';
19
- * color?: 'primary' | 'secondary' | 'inherit';
20
- * menu?: Array<import('@mui/material').MenuItem> | import('@mui/material').MenuItem;
20
+ * menu?: React.ReactElement<MenuItemProps, MenuItem>[] | React.ReactElement<MenuItemProps, MenuItem>;
21
21
  * children?: JSX.Element | (() => JSX.Element);
22
- * variant?: 'outlined' | 'contained';
23
22
  * onClick?: () => void;
24
23
  * menuButtonProps?: import('@mui/material').ButtonProps;
25
24
  * } & import('@mui/material').ButtonGroupProps } SplitButtonProps
@@ -84,8 +83,8 @@ export default function SplitButton(props) {
84
83
  }
85
84
 
86
85
  SplitButton.propTypes = {
87
- size: PropTypes.oneOf(['small', 'medium', 'large']),
88
- color: PropTypes.oneOf(['primary', 'secondary', 'inherit']),
86
+ size: PropTypes.string,
87
+ color: PropTypes.string,
89
88
  menu: PropTypes.oneOfType([PropTypes.node, PropTypes.array]),
90
89
  // 也可以是用于渲染主按钮的 function
91
90
  children: PropTypes.node,
@@ -103,8 +102,9 @@ SplitButton.defaultProps = {
103
102
  onClick: noop,
104
103
  menuButtonProps: {},
105
104
  };
105
+
106
106
  /**
107
- * @type {import('@mui/material').MenuItem}
107
+ * @type {MenuItem}
108
108
  */
109
109
  SplitButton.Item = MenuItem;
110
110
 
package/src/Tag/index.js CHANGED
@@ -30,13 +30,15 @@ const types = {
30
30
  };
31
31
 
32
32
  /**
33
+ * @typedef {import('@mui/material/Typography').TypographyProps} TypographyProps
33
34
  * @typedef {{
34
- * type: 'error' | 'warning' | 'success' | 'primary' | 'reverse',
35
- * content: string,
36
- * className: string;
35
+ * type?: 'error' | 'warning' | 'success' | 'primary' | 'reverse',
36
+ * content?: string,
37
+ * className?: string;
37
38
  * children: import('react').ReactNode,
38
- * style: import('react').CSSProperties
39
- * }} TagProps
39
+ * style?: import('react').CSSProperties
40
+ * }} TagOwnProps
41
+ * @typedef { TypographyProps & TagOwnProps} TagProps
40
42
  */
41
43
 
42
44
  /**
@@ -81,7 +83,9 @@ Tag.defaultProps = {
81
83
  style: {},
82
84
  };
83
85
 
84
- /** @type {React.ForwardRefExoticComponent<React.PropsWithoutRef<TagProps> & React.RefAttributes<HTMLSpanElement>>} */
86
+ /**
87
+ * @type {React.ForwardRefExoticComponent<React.PropsWithoutRef<TagProps> & React.RefAttributes<HTMLSpanElement>>}
88
+ */
85
89
  const TagComponent = forwardRef((props, ref) => <Tag {...props} forwardedRef={ref} />);
86
90
  export default TagComponent;
87
91
 
@@ -6,6 +6,14 @@ export { useTheme };
6
6
 
7
7
  const isTransientProp = (prop) => prop.startsWith('$');
8
8
 
9
+ /**
10
+ * @typedef {import('@mui/material/styles').Theme} Theme
11
+ * @typedef {import('@mui/material/styles').CreateMUIStyled<Theme>} Styled
12
+ */
13
+
14
+ /**
15
+ * @type {Styled}
16
+ */
9
17
  export const styled = (component, options = {}) => {
10
18
  return muiStyled(component, {
11
19
  ...options,
@@ -12,11 +12,28 @@ import '@fontsource/inter/latin-ext-700.css';
12
12
 
13
13
  import colors from '../Colors';
14
14
 
15
+ /**
16
+ * @typedef {import('@mui/material/styles').Theme} Theme
17
+ * @typedef {import('@mui/material/styles').TypographyVariantsOptions} TypographyVariantsOptions
18
+ * @typedef {import('@mui/material/styles').Components} Components
19
+ */
20
+
15
21
  const muiDarkTheme = _createTheme({ palette: { mode: 'dark' } });
16
22
 
17
23
  // https://material-ui.com/customization/default-theme/
18
- // eslint-disable-next-line import/prefer-default-export
19
- export const create = ({ mode = 'light', pageWidth = 'md', palette, typography, overrides, ...rest } = {}) => {
24
+ /**
25
+ * @description
26
+ * @export
27
+ * @param {{
28
+ * mode?: string,
29
+ * pageWidth?: string,
30
+ * palette?: import('@mui/material/styles').PaletteOptions,
31
+ * typography?: TypographyVariantsOptions,
32
+ * overrides?: Components<Omit<Theme, 'components'>>,
33
+ * }} options
34
+ * @return {Theme}
35
+ */
36
+ export const create = ({ mode = 'light', pageWidth = 'md', palette, typography, overrides = {}, ...rest } = {}) => {
20
37
  // palette 考虑 light & dark mode, dark mode 需要持续完善
21
38
  // - 能配合 ColorModeContext 使用
22
39
  // - 为 dark mode 系统的设计整个 palette, 不要单个 color 设置
@@ -78,7 +95,7 @@ export const create = ({ mode = 'light', pageWidth = 'md', palette, typography,
78
95
  fontWeight: 700,
79
96
  },
80
97
  },
81
- typography || {}
98
+ typography
82
99
  ),
83
100
  components: {
84
101
  MuiButton: {
package/src/Util/index.js CHANGED
@@ -47,7 +47,9 @@ export function getCookieOptions(expireInDays = 1) {
47
47
  expires: opts.expireInDays,
48
48
  path: opts.path,
49
49
  domain: opts.domain || '',
50
- sameSite: opts.sameSite || 'lax',
50
+ sameSite: opts.sameSite || 'Lax',
51
+ // 允许自定义设置为 false,默认是 true
52
+ secure: opts.secure !== false,
51
53
  };
52
54
  if (typeof window === 'undefined' || opts.domain || opts.returnDomain === false) {
53
55
  if (opts.returnDomain === false) {