@arcblock/ux 3.4.11 → 3.4.13

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.
@@ -8,7 +8,8 @@ export type CurrentAppInfo = {
8
8
  appName: string;
9
9
  appUrl: string;
10
10
  };
11
- export default function AuthAppsInfo({ requestAppInfo, currentAppInfo, }: {
11
+ export default function AuthAppsInfo({ requestAppInfo, currentAppInfo, titlePrefix, }: {
12
12
  requestAppInfo: RequestAppInfo;
13
13
  currentAppInfo: CurrentAppInfo;
14
+ titlePrefix?: string;
14
15
  }): import("react/jsx-runtime").JSX.Element;
@@ -1,9 +1,10 @@
1
1
  import { jsxs as r, jsx as t } from "react/jsx-runtime";
2
- import { Box as e, Typography as l } from "@mui/material";
2
+ import { Box as e, Typography as s } from "@mui/material";
3
3
  import o from "../../Img/index.js";
4
- function m({
4
+ function p({
5
5
  requestAppInfo: a,
6
- currentAppInfo: i
6
+ currentAppInfo: i,
7
+ titlePrefix: l = "Authorize"
7
8
  }) {
8
9
  return /* @__PURE__ */ r(
9
10
  e,
@@ -53,14 +54,14 @@ function m({
53
54
  }
54
55
  ),
55
56
  /* @__PURE__ */ r(
56
- l,
57
+ s,
57
58
  {
58
59
  sx: {
59
60
  mb: 1,
60
61
  fontSize: "1.2rem"
61
62
  },
62
63
  children: [
63
- "Authorize",
64
+ l,
64
65
  " ",
65
66
  /* @__PURE__ */ t(e, { component: "span", sx: { color: "primary.main" }, children: a.appName })
66
67
  ]
@@ -71,5 +72,5 @@ function m({
71
72
  );
72
73
  }
73
74
  export {
74
- m as default
75
+ p as default
75
76
  };
@@ -1,11 +1,11 @@
1
- import { BoxProps } from '@mui/material';
1
+ import { BoxProps, ButtonProps } from '@mui/material';
2
2
  import { UserPublicInfo } from '@blocklet/js-sdk';
3
3
  import { Ref } from 'react';
4
4
  import { RequestAppInfo, CurrentAppInfo } from './auth-apps-info';
5
5
  /**
6
6
  * @example app/connect-to-did-space?appPid=zNKp8tdZUanWKnvhwZWvF2hKRutwM9ykLaY8&appDid=zNKp8tdZUanWKnvhwZWvF2hKRutwM9ykLaY8&appName=233&appDescription=456&appUrl=https://bbqaw5mgxc6fnihrwqcejcxvukkdgkk4anwxwk5msvm.did.abtnet.io/zh
7
7
  */
8
- export default function AuthApps({ session, requestAppInfo, currentAppInfo, children, userInfo, hideSwitchConnect, hideAuthorize, hideCancel, hideButton, notThisText, authorizeText, connectText, cancelText, useAnotherText, slotProps, onConnect, onAuthorize, onSwitchConnect, onSwitchPassport, onCancel, ref, disableAuthorizeButton, }: {
8
+ export default function AuthApps({ session, requestAppInfo, currentAppInfo, children, userInfo, hideSwitchConnect, hideAuthorize, hideCancel, hideButton, notThisText, authorizeText, connectText, cancelText, useAnotherText, slotProps, onConnect, onAuthorize, onSwitchConnect, onSwitchPassport, onCancel, ref, disableAuthorizeButton, titlePrefix, }: {
9
9
  session: any;
10
10
  requestAppInfo: RequestAppInfo;
11
11
  currentAppInfo: CurrentAppInfo;
@@ -24,6 +24,9 @@ export default function AuthApps({ session, requestAppInfo, currentAppInfo, chil
24
24
  root?: BoxProps;
25
25
  didConnectContainer?: object;
26
26
  contentContainer?: BoxProps;
27
+ connectButton?: ButtonProps;
28
+ authorizeButton?: ButtonProps;
29
+ cancelButton?: ButtonProps;
27
30
  };
28
31
  onConnect?: (done: () => void) => void;
29
32
  onAuthorize?: (done: () => void) => void;
@@ -34,4 +37,5 @@ export default function AuthApps({ session, requestAppInfo, currentAppInfo, chil
34
37
  closeLoading: () => void;
35
38
  }>;
36
39
  disableAuthorizeButton?: boolean;
40
+ titlePrefix?: string;
37
41
  }): import("react/jsx-runtime").JSX.Element;
@@ -1,19 +1,19 @@
1
- import { jsx as e, jsxs as o, Fragment as p } from "react/jsx-runtime";
2
- import { CircularProgress as u, Box as d, Stack as G, Button as h, Typography as J, Link as K } from "@mui/material";
3
- import { useReactive as O, useMemoizedFn as r } from "ahooks";
1
+ import { jsx as e, jsxs as t, Fragment as p } from "react/jsx-runtime";
2
+ import { CircularProgress as u, Box as d, Stack as K, Button as h, Typography as O, Link as Q } from "@mui/material";
3
+ import { useReactive as V, useMemoizedFn as i } from "ahooks";
4
4
  import c from "lodash/noop";
5
- import { useImperativeHandle as Q } from "react";
6
- import V from "../did-connect-container.js";
7
- import X from "./auth-apps-info.js";
8
- import Y from "../../Center/index.js";
9
- import Z from "../landing-page.js";
10
- import { translate as _ } from "../../Locale/util.js";
11
- import { useLocaleContext as $ } from "../../Locale/context.js";
12
- import ee from "../../UserCard/index.js";
13
- import { InfoType as ne, CardType as oe } from "../../UserCard/types.js";
5
+ import { useImperativeHandle as X } from "react";
6
+ import Y from "../did-connect-container.js";
7
+ import Z from "./auth-apps-info.js";
8
+ import _ from "../../Center/index.js";
9
+ import $ from "../landing-page.js";
10
+ import { translate as P } from "../../Locale/util.js";
11
+ import { useLocaleContext as ee } from "../../Locale/context.js";
12
+ import ne from "../../UserCard/index.js";
13
+ import { InfoType as oe, CardType as te } from "../../UserCard/types.js";
14
14
  import { mergeSx as f } from "../../Util/style.js";
15
- import re from "./switch-role.js";
16
- const ie = {
15
+ import ie from "./switch-role.js";
16
+ const re = {
17
17
  en: {
18
18
  notThis: "Not you?",
19
19
  useAnother: "Use another account",
@@ -29,7 +29,7 @@ const ie = {
29
29
  cancel: "取消"
30
30
  }
31
31
  };
32
- function ye({
32
+ function ze({
33
33
  session: s,
34
34
  requestAppInfo: g,
35
35
  currentAppInfo: x,
@@ -43,51 +43,52 @@ function ye({
43
43
  authorizeText: b = void 0,
44
44
  connectText: k = void 0,
45
45
  cancelText: S = void 0,
46
- useAnotherText: D = void 0,
47
- slotProps: i = void 0,
48
- onConnect: I = c,
49
- onAuthorize: L = c,
50
- onSwitchConnect: R = c,
51
- onSwitchPassport: W = c,
52
- onCancel: j = c,
53
- ref: B,
54
- disableAuthorizeButton: m = !1
46
+ useAnotherText: B = void 0,
47
+ slotProps: o = void 0,
48
+ onConnect: D = c,
49
+ onAuthorize: I = c,
50
+ onSwitchConnect: L = c,
51
+ onSwitchPassport: R = c,
52
+ onCancel: W = c,
53
+ ref: j,
54
+ disableAuthorizeButton: m = !1,
55
+ titlePrefix: F = void 0
55
56
  }) {
56
- const n = O({
57
+ const n = V({
57
58
  loading: !1
58
- }), { locale: F = "en" } = $() || {}, t = r((q, E = {}) => _(ie, q, F, "en", E)), l = r(() => {
59
+ }), { locale: M = "en" } = ee() || {}, r = i((G, J = {}) => P(re, G, M, "en", J)), l = i(() => {
59
60
  n.loading = !1;
60
- }), M = r(() => {
61
+ }), U = i(() => {
62
+ n.loading = !0, D?.(l);
63
+ }), H = i(() => {
64
+ n.loading = !0, L?.(l);
65
+ }), N = i(() => {
61
66
  n.loading = !0, I?.(l);
62
- }), U = r(() => {
67
+ }), q = i(() => {
63
68
  n.loading = !0, R?.(l);
64
- }), H = r(() => {
65
- n.loading = !0, L?.(l);
66
- }), N = r(() => {
67
- n.loading = !0, W?.(l);
68
- }), P = r(() => {
69
- j?.();
69
+ }), E = i(() => {
70
+ W?.();
70
71
  });
71
- if (Q(B, () => ({
72
+ if (X(j, () => ({
72
73
  closeLoading: l
73
74
  })), s.loading || !s.initialized)
74
- return /* @__PURE__ */ e(Y, { children: /* @__PURE__ */ e(u, {}) });
75
+ return /* @__PURE__ */ e(_, { children: /* @__PURE__ */ e(u, {}) });
75
76
  const a = v ?? s?.user;
76
- return /* @__PURE__ */ e(Z, { did: window.blocklet?.appPid, standalone: !0, children: /* @__PURE__ */ e(
77
+ return /* @__PURE__ */ e($, { did: window.blocklet?.appPid, standalone: !0, children: /* @__PURE__ */ e(
77
78
  d,
78
79
  {
79
- ...i?.root,
80
+ ...o?.root,
80
81
  sx: f(
81
82
  {
82
83
  width: 420,
83
84
  maxWidth: "100%"
84
85
  },
85
- i?.root?.sx
86
+ o?.root?.sx
86
87
  ),
87
- children: /* @__PURE__ */ e(V, { hideCloseButton: !0, ...i?.didConnectContainer, children: /* @__PURE__ */ o(
88
+ children: /* @__PURE__ */ e(Y, { hideCloseButton: !0, ...o?.didConnectContainer, children: /* @__PURE__ */ t(
88
89
  d,
89
90
  {
90
- ...i?.contentContainer,
91
+ ...o?.contentContainer,
91
92
  sx: f(
92
93
  {
93
94
  display: "flex",
@@ -104,25 +105,25 @@ function ye({
104
105
  },
105
106
  bgcolor: "background.paper"
106
107
  },
107
- i?.contentContainer?.sx
108
+ o?.contentContainer?.sx
108
109
  ),
109
110
  children: [
110
- /* @__PURE__ */ e(X, { requestAppInfo: g, currentAppInfo: x }),
111
- a ? /* @__PURE__ */ o(p, { children: [
111
+ /* @__PURE__ */ e(Z, { requestAppInfo: g, currentAppInfo: x, titlePrefix: F }),
112
+ a ? /* @__PURE__ */ t(p, { children: [
112
113
  /* @__PURE__ */ e(
113
- ee,
114
+ ne,
114
115
  {
115
116
  user: a,
116
117
  showDid: !0,
117
- cardType: oe.Detailed,
118
- infoType: ne.Minimal,
119
- renderTopRightContent: () => /* @__PURE__ */ e(re, { user: a, switchPassport: N })
118
+ cardType: te.Detailed,
119
+ infoType: oe.Minimal,
120
+ renderTopRightContent: () => /* @__PURE__ */ e(ie, { user: a, switchPassport: q })
120
121
  }
121
122
  ),
122
123
  /* @__PURE__ */ e(d, {})
123
124
  ] }) : null,
124
125
  C,
125
- A ? null : /* @__PURE__ */ o(p, { children: [
126
+ A ? null : /* @__PURE__ */ t(p, { children: [
126
127
  /* @__PURE__ */ e(
127
128
  d,
128
129
  {
@@ -135,7 +136,7 @@ function ye({
135
136
  }
136
137
  }
137
138
  ),
138
- /* @__PURE__ */ o(G, { direction: "row", spacing: 2, children: [
139
+ /* @__PURE__ */ t(K, { direction: "row", spacing: 2, children: [
139
140
  w ? null : /* @__PURE__ */ e(
140
141
  h,
141
142
  {
@@ -143,44 +144,47 @@ function ye({
143
144
  variant: "outlined",
144
145
  size: "large",
145
146
  fullWidth: !0,
146
- onClick: P,
147
+ onClick: E,
147
148
  sx: {
148
149
  color: "grey.500"
149
150
  },
150
- children: S || t("cancel")
151
+ ...o?.cancelButton,
152
+ children: S || r("cancel")
151
153
  }
152
154
  ),
153
- a && !z ? /* @__PURE__ */ o(
155
+ a && !z ? /* @__PURE__ */ t(
154
156
  h,
155
157
  {
156
158
  variant: "contained",
157
159
  size: "large",
158
160
  fullWidth: !0,
159
- onClick: H,
161
+ onClick: N,
160
162
  disabled: n.loading || m,
163
+ ...o?.authorizeButton,
161
164
  children: [
162
165
  n.loading ? /* @__PURE__ */ e(u, { size: 20, sx: { mr: 1 } }) : null,
163
- b || t("authorize")
166
+ b || r("authorize")
164
167
  ]
165
168
  }
166
- ) : /* @__PURE__ */ o(
169
+ ) : /* @__PURE__ */ t(
167
170
  h,
168
171
  {
169
172
  variant: "contained",
170
173
  size: "large",
171
174
  fullWidth: !0,
172
175
  disabled: n.loading || m,
173
- onClick: M,
176
+ onClick: U,
177
+ ...o?.connectButton,
174
178
  children: [
175
179
  n.loading ? /* @__PURE__ */ e(u, { size: 20, sx: { mr: 1 } }) : null,
176
- k || t("connect")
180
+ k || r("connect")
177
181
  ]
178
182
  }
179
183
  )
180
184
  ] })
181
185
  ] }),
182
- y || !a ? null : /* @__PURE__ */ e(d, { sx: { textAlign: "center" }, children: /* @__PURE__ */ o(
183
- J,
186
+ y || !a ? null : /* @__PURE__ */ e(d, { sx: { textAlign: "center" }, children: /* @__PURE__ */ t(
187
+ O,
184
188
  {
185
189
  variant: "body2",
186
190
  sx: {
@@ -190,17 +194,17 @@ function ye({
190
194
  gap: 1
191
195
  },
192
196
  children: [
193
- T || t("notThis"),
197
+ T || r("notThis"),
194
198
  " ",
195
199
  /* @__PURE__ */ e(
196
- K,
200
+ Q,
197
201
  {
198
202
  underline: "hover",
199
- onClick: U,
203
+ onClick: H,
200
204
  sx: {
201
205
  cursor: "pointer"
202
206
  },
203
- children: D || t("useAnother")
207
+ children: B || r("useAnother")
204
208
  }
205
209
  )
206
210
  ]
@@ -213,5 +217,5 @@ function ye({
213
217
  ) });
214
218
  }
215
219
  export {
216
- ye as default
220
+ ze as default
217
221
  };
@@ -1,4 +1,4 @@
1
- const e = "3.4.11", s = { "@blocklet/js-sdk": "^1.17.7" }, n = {
1
+ const e = "3.4.13", s = { "@blocklet/js-sdk": "^1.17.7" }, n = {
2
2
  version: e,
3
3
  dependencies: s
4
4
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcblock/ux",
3
- "version": "3.4.11",
3
+ "version": "3.4.13",
4
4
  "description": "Common used react components for arcblock products",
5
5
  "keywords": [
6
6
  "react",
@@ -74,16 +74,16 @@
74
74
  "react": "^19.0.0",
75
75
  "react-router-dom": "^6.22.3"
76
76
  },
77
- "gitHead": "1cc263e80cb7b98f6ebb02bb8d151fee552e6c76",
77
+ "gitHead": "0ec0dab9e461171384dbed3e114b805771eb1d88",
78
78
  "dependencies": {
79
- "@arcblock/bridge": "3.4.11",
80
- "@arcblock/did": "^1.28.6",
79
+ "@arcblock/bridge": "3.4.13",
80
+ "@arcblock/did": "^1.28.8",
81
81
  "@arcblock/did-motif": "^1.1.14",
82
- "@arcblock/icons": "3.4.11",
83
- "@arcblock/nft-display": "3.4.11",
84
- "@arcblock/react-hooks": "3.4.11",
82
+ "@arcblock/icons": "3.4.13",
83
+ "@arcblock/nft-display": "3.4.13",
84
+ "@arcblock/react-hooks": "3.4.13",
85
85
  "@blocklet/js-sdk": "^1.17.7",
86
- "@blocklet/theme": "3.4.11",
86
+ "@blocklet/theme": "3.4.13",
87
87
  "@fontsource/roboto": "~5.1.1",
88
88
  "@fontsource/ubuntu-mono": "^5.2.6",
89
89
  "@iconify-icons/logos": "^1.2.36",
@@ -91,7 +91,7 @@
91
91
  "@iconify-icons/mdi": "^1.2.48",
92
92
  "@iconify-icons/tabler": "^1.2.95",
93
93
  "@iconify/react": "^5.2.1",
94
- "@ocap/mcrypto": "^1.28.6",
94
+ "@ocap/mcrypto": "^1.28.8",
95
95
  "@solana/qr-code-styling": "^1.6.0",
96
96
  "@types/dompurify": "^3.2.0",
97
97
  "@types/mui-datatables": "^4.3.12",
@@ -16,9 +16,11 @@ export type CurrentAppInfo = {
16
16
  export default function AuthAppsInfo({
17
17
  requestAppInfo,
18
18
  currentAppInfo,
19
+ titlePrefix = 'Authorize',
19
20
  }: {
20
21
  requestAppInfo: RequestAppInfo;
21
22
  currentAppInfo: CurrentAppInfo;
23
+ titlePrefix?: string;
22
24
  }) {
23
25
  return (
24
26
  <Box
@@ -65,7 +67,7 @@ export default function AuthAppsInfo({
65
67
  mb: 1,
66
68
  fontSize: '1.2rem',
67
69
  }}>
68
- Authorize{' '}
70
+ {titlePrefix}{' '}
69
71
  <Box component="span" sx={{ color: 'primary.main' }}>
70
72
  {requestAppInfo.appName}
71
73
  </Box>
@@ -1,4 +1,4 @@
1
- import { Box, BoxProps, Button, CircularProgress, Link, Stack, SxProps, Typography } from '@mui/material';
1
+ import { Box, BoxProps, Button, ButtonProps, CircularProgress, Link, Stack, SxProps, Typography } from '@mui/material';
2
2
  import { useMemoizedFn, useReactive } from 'ahooks';
3
3
  import noop from 'lodash/noop';
4
4
  import type { UserPublicInfo } from '@blocklet/js-sdk';
@@ -63,6 +63,7 @@ export default function AuthApps({
63
63
  ref,
64
64
 
65
65
  disableAuthorizeButton = false,
66
+ titlePrefix = undefined,
66
67
  }: {
67
68
  session: any;
68
69
  requestAppInfo: RequestAppInfo;
@@ -85,6 +86,9 @@ export default function AuthApps({
85
86
  root?: BoxProps;
86
87
  didConnectContainer?: object;
87
88
  contentContainer?: BoxProps;
89
+ connectButton?: ButtonProps;
90
+ authorizeButton?: ButtonProps;
91
+ cancelButton?: ButtonProps;
88
92
  };
89
93
 
90
94
  onConnect?: (done: () => void) => void;
@@ -95,6 +99,7 @@ export default function AuthApps({
95
99
  ref: Ref<{ closeLoading: () => void }>;
96
100
 
97
101
  disableAuthorizeButton?: boolean;
102
+ titlePrefix?: string;
98
103
  }) {
99
104
  const currentState = useReactive({
100
105
  loading: false,
@@ -172,7 +177,7 @@ export default function AuthApps({
172
177
  },
173
178
  slotProps?.contentContainer?.sx as SxProps
174
179
  )}>
175
- <AuthAppsInfo requestAppInfo={requestAppInfo} currentAppInfo={currentAppInfo} />
180
+ <AuthAppsInfo requestAppInfo={requestAppInfo} currentAppInfo={currentAppInfo} titlePrefix={titlePrefix} />
176
181
 
177
182
  {user ? (
178
183
  <>
@@ -211,7 +216,8 @@ export default function AuthApps({
211
216
  onClick={handleCancel}
212
217
  sx={{
213
218
  color: 'grey.500',
214
- }}>
219
+ }}
220
+ {...slotProps?.cancelButton}>
215
221
  {cancelText || t('cancel')}
216
222
  </Button>
217
223
  ) : null}
@@ -221,7 +227,8 @@ export default function AuthApps({
221
227
  size="large"
222
228
  fullWidth
223
229
  onClick={handleAuthorize}
224
- disabled={currentState.loading || disableAuthorizeButton}>
230
+ disabled={currentState.loading || disableAuthorizeButton}
231
+ {...slotProps?.authorizeButton}>
225
232
  {currentState.loading ? <CircularProgress size={20} sx={{ mr: 1 }} /> : null}
226
233
  {authorizeText || t('authorize')}
227
234
  </Button>
@@ -231,7 +238,8 @@ export default function AuthApps({
231
238
  size="large"
232
239
  fullWidth
233
240
  disabled={currentState.loading || disableAuthorizeButton}
234
- onClick={handleConnect}>
241
+ onClick={handleConnect}
242
+ {...slotProps?.connectButton}>
235
243
  {currentState.loading ? <CircularProgress size={20} sx={{ mr: 1 }} /> : null}
236
244
  {connectText || t('connect')}
237
245
  </Button>