@arcblock/ux 3.1.1 → 3.1.2

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.
@@ -5,7 +5,7 @@ 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, notThisText, authorizeText, connectText, cancelText, useAnotherText, slotProps, onConnect, onAuthorize, onSwitchConnect, onCancel, ref, }: {
8
+ export default function AuthApps({ session, requestAppInfo, currentAppInfo, children, userInfo, hideSwitchConnect, hideAuthorize, hideCancel, hideButton, notThisText, authorizeText, connectText, cancelText, useAnotherText, slotProps, onConnect, onAuthorize, onSwitchConnect, onCancel, ref, }: {
9
9
  session: any;
10
10
  requestAppInfo: RequestAppInfo;
11
11
  currentAppInfo: CurrentAppInfo;
@@ -14,6 +14,7 @@ export default function AuthApps({ session, requestAppInfo, currentAppInfo, chil
14
14
  hideSwitchConnect?: boolean;
15
15
  hideAuthorize?: boolean;
16
16
  hideCancel?: boolean;
17
+ hideButton?: boolean;
17
18
  notThisText?: string;
18
19
  authorizeText?: string;
19
20
  connectText?: string;
@@ -1,18 +1,18 @@
1
- import { jsx as e, jsxs as o, Fragment as H } from "react/jsx-runtime";
2
- import { CircularProgress as u, Box as l, Stack as N, Button as h, Typography as q, Link as E } from "@mui/material";
3
- import { useReactive as G, useMemoizedFn as i } from "ahooks";
1
+ import { jsx as e, jsxs as o, Fragment as m } from "react/jsx-runtime";
2
+ import { CircularProgress as u, Box as l, Stack as q, Button as h, Typography as E, Link as G } from "@mui/material";
3
+ import { useReactive as J, useMemoizedFn as i } from "ahooks";
4
4
  import c from "lodash/noop";
5
- import { useImperativeHandle as J } from "react";
6
- import K from "../did-connect-container.js";
7
- import O from "./auth-apps-info.js";
8
- import Q from "../../Center/index.js";
9
- import V from "../landing-page.js";
10
- import { translate as X } from "../../Locale/util.js";
11
- import { useLocaleContext as Y } from "../../Locale/context.js";
12
- import Z from "../../UserCard/index.js";
13
- import { InfoType as _, CardType as $ } from "../../UserCard/types.js";
14
- import { mergeSx as m } from "../../Util/style.js";
15
- const P = {
5
+ import { useImperativeHandle as K } from "react";
6
+ import O from "../did-connect-container.js";
7
+ import Q from "./auth-apps-info.js";
8
+ import V from "../../Center/index.js";
9
+ import X from "../landing-page.js";
10
+ import { translate as Y } from "../../Locale/util.js";
11
+ import { useLocaleContext as Z } from "../../Locale/context.js";
12
+ import _ from "../../UserCard/index.js";
13
+ import { InfoType as $, CardType as P } from "../../UserCard/types.js";
14
+ import { mergeSx as p } from "../../Util/style.js";
15
+ const ee = {
16
16
  en: {
17
17
  notThis: "Not you?",
18
18
  useAnother: "Use another account",
@@ -28,61 +28,62 @@ const P = {
28
28
  cancel: "取消"
29
29
  }
30
30
  };
31
- function pe({
31
+ function fe({
32
32
  session: s,
33
- requestAppInfo: p,
34
- currentAppInfo: f,
35
- children: g = null,
36
- userInfo: x = void 0,
37
- hideSwitchConnect: C = !1,
38
- hideAuthorize: v = !1,
39
- hideCancel: y = !1,
40
- notThisText: z = void 0,
41
- authorizeText: A = void 0,
42
- connectText: b = void 0,
43
- cancelText: k = void 0,
44
- useAnotherText: T = void 0,
33
+ requestAppInfo: f,
34
+ currentAppInfo: g,
35
+ children: x = null,
36
+ userInfo: C = void 0,
37
+ hideSwitchConnect: v = !1,
38
+ hideAuthorize: y = !1,
39
+ hideCancel: z = !1,
40
+ hideButton: A = !1,
41
+ notThisText: b = void 0,
42
+ authorizeText: k = void 0,
43
+ connectText: T = void 0,
44
+ cancelText: w = void 0,
45
+ useAnotherText: D = void 0,
45
46
  slotProps: r = void 0,
46
- onConnect: w = c,
47
- onAuthorize: D = c,
48
- onSwitchConnect: I = c,
49
- onCancel: L = c,
50
- ref: S
47
+ onConnect: I = c,
48
+ onAuthorize: L = c,
49
+ onSwitchConnect: S = c,
50
+ onCancel: W = c,
51
+ ref: j
51
52
  }) {
52
- const n = G({
53
+ const n = J({
53
54
  loading: !1
54
- }), { locale: W = "en" } = Y() || {}, t = i((R, U = {}) => X(P, R, W, "en", U)), a = i(() => {
55
+ }), { locale: B = "en" } = Z() || {}, t = i((H, N = {}) => Y(ee, H, B, "en", N)), a = i(() => {
55
56
  n.loading = !1;
56
- }), j = i(() => {
57
- n.loading = !0, w?.(a);
58
- }), B = i(() => {
59
- n.loading = !0, I?.(a);
60
57
  }), F = i(() => {
61
- n.loading = !0, D?.(a);
58
+ n.loading = !0, I?.(a);
62
59
  }), M = i(() => {
63
- L?.();
60
+ n.loading = !0, S?.(a);
61
+ }), R = i(() => {
62
+ n.loading = !0, L?.(a);
63
+ }), U = i(() => {
64
+ W?.();
64
65
  });
65
- if (J(S, () => ({
66
+ if (K(j, () => ({
66
67
  closeLoading: a
67
68
  })), s.loading || !s.initialized)
68
- return /* @__PURE__ */ e(Q, { children: /* @__PURE__ */ e(u, {}) });
69
- const d = x ?? s?.user;
70
- return /* @__PURE__ */ e(V, { did: window.blocklet?.appPid, standalone: !0, children: /* @__PURE__ */ e(
69
+ return /* @__PURE__ */ e(V, { children: /* @__PURE__ */ e(u, {}) });
70
+ const d = C ?? s?.user;
71
+ return /* @__PURE__ */ e(X, { did: window.blocklet?.appPid, standalone: !0, children: /* @__PURE__ */ e(
71
72
  l,
72
73
  {
73
74
  ...r?.root,
74
- sx: m(
75
+ sx: p(
75
76
  {
76
77
  width: 420,
77
78
  maxWidth: "100%"
78
79
  },
79
80
  r?.root?.sx
80
81
  ),
81
- children: /* @__PURE__ */ e(K, { hideCloseButton: !0, ...r?.didConnectContainer, children: /* @__PURE__ */ o(
82
+ children: /* @__PURE__ */ e(O, { hideCloseButton: !0, ...r?.didConnectContainer, children: /* @__PURE__ */ o(
82
83
  l,
83
84
  {
84
85
  ...r?.contentContainer,
85
- sx: m(
86
+ sx: p(
86
87
  {
87
88
  display: "flex",
88
89
  flexDirection: "column",
@@ -101,69 +102,71 @@ function pe({
101
102
  r?.contentContainer?.sx
102
103
  ),
103
104
  children: [
104
- /* @__PURE__ */ e(O, { requestAppInfo: p, currentAppInfo: f }),
105
- d ? /* @__PURE__ */ o(H, { children: [
106
- /* @__PURE__ */ e(Z, { user: d, showDid: !0, cardType: $.Detailed, infoType: _.Minimal }),
105
+ /* @__PURE__ */ e(Q, { requestAppInfo: f, currentAppInfo: g }),
106
+ d ? /* @__PURE__ */ o(m, { children: [
107
+ /* @__PURE__ */ e(_, { user: d, showDid: !0, cardType: P.Detailed, infoType: $.Minimal }),
107
108
  /* @__PURE__ */ e(l, {})
108
109
  ] }) : null,
109
- g,
110
- /* @__PURE__ */ e(
111
- l,
112
- {
113
- sx: {
114
- border: "1px solid",
115
- borderColor: "divider",
116
- borderRadius: 2,
117
- overflow: "hidden",
118
- my: 1
119
- }
120
- }
121
- ),
122
- /* @__PURE__ */ o(N, { direction: "row", spacing: 2, children: [
123
- y ? null : /* @__PURE__ */ e(
124
- h,
110
+ x,
111
+ A ? null : /* @__PURE__ */ o(m, { children: [
112
+ /* @__PURE__ */ e(
113
+ l,
125
114
  {
126
- color: "inherit",
127
- variant: "outlined",
128
- size: "large",
129
- fullWidth: !0,
130
- onClick: M,
131
115
  sx: {
132
- color: "grey.500"
133
- },
134
- children: k || t("cancel")
116
+ border: "1px solid",
117
+ borderColor: "divider",
118
+ borderRadius: 2,
119
+ overflow: "hidden",
120
+ my: 1
121
+ }
135
122
  }
136
123
  ),
137
- d && !v ? /* @__PURE__ */ o(
138
- h,
139
- {
140
- variant: "contained",
141
- size: "large",
142
- fullWidth: !0,
143
- onClick: F,
144
- disabled: n.loading,
145
- children: [
146
- n.loading ? /* @__PURE__ */ e(u, { size: 20, sx: { mr: 1 } }) : null,
147
- A || t("authorize")
148
- ]
149
- }
150
- ) : /* @__PURE__ */ o(
151
- h,
152
- {
153
- variant: "contained",
154
- size: "large",
155
- fullWidth: !0,
156
- disabled: n.loading,
157
- onClick: j,
158
- children: [
159
- n.loading ? /* @__PURE__ */ e(u, { size: 20, sx: { mr: 1 } }) : null,
160
- b || t("connect")
161
- ]
162
- }
163
- )
124
+ /* @__PURE__ */ o(q, { direction: "row", spacing: 2, children: [
125
+ z ? null : /* @__PURE__ */ e(
126
+ h,
127
+ {
128
+ color: "inherit",
129
+ variant: "outlined",
130
+ size: "large",
131
+ fullWidth: !0,
132
+ onClick: U,
133
+ sx: {
134
+ color: "grey.500"
135
+ },
136
+ children: w || t("cancel")
137
+ }
138
+ ),
139
+ d && !y ? /* @__PURE__ */ o(
140
+ h,
141
+ {
142
+ variant: "contained",
143
+ size: "large",
144
+ fullWidth: !0,
145
+ onClick: R,
146
+ disabled: n.loading,
147
+ children: [
148
+ n.loading ? /* @__PURE__ */ e(u, { size: 20, sx: { mr: 1 } }) : null,
149
+ k || t("authorize")
150
+ ]
151
+ }
152
+ ) : /* @__PURE__ */ o(
153
+ h,
154
+ {
155
+ variant: "contained",
156
+ size: "large",
157
+ fullWidth: !0,
158
+ disabled: n.loading,
159
+ onClick: F,
160
+ children: [
161
+ n.loading ? /* @__PURE__ */ e(u, { size: 20, sx: { mr: 1 } }) : null,
162
+ T || t("connect")
163
+ ]
164
+ }
165
+ )
166
+ ] })
164
167
  ] }),
165
- C || !d ? null : /* @__PURE__ */ e(l, { sx: { textAlign: "center" }, children: /* @__PURE__ */ o(
166
- q,
168
+ v || !d ? null : /* @__PURE__ */ e(l, { sx: { textAlign: "center" }, children: /* @__PURE__ */ o(
169
+ E,
167
170
  {
168
171
  variant: "body2",
169
172
  sx: {
@@ -173,17 +176,17 @@ function pe({
173
176
  gap: 1
174
177
  },
175
178
  children: [
176
- z || t("notThis"),
179
+ b || t("notThis"),
177
180
  " ",
178
181
  /* @__PURE__ */ e(
179
- E,
182
+ G,
180
183
  {
181
184
  underline: "hover",
182
- onClick: B,
185
+ onClick: M,
183
186
  sx: {
184
187
  cursor: "pointer"
185
188
  },
186
- children: T || t("useAnother")
189
+ children: D || t("useAnother")
187
190
  }
188
191
  )
189
192
  ]
@@ -196,5 +199,5 @@ function pe({
196
199
  ) });
197
200
  }
198
201
  export {
199
- pe as default
202
+ fe as default
200
203
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcblock/ux",
3
- "version": "3.1.1",
3
+ "version": "3.1.2",
4
4
  "description": "Common used react components for arcblock products",
5
5
  "keywords": [
6
6
  "react",
@@ -60,16 +60,16 @@
60
60
  "react": "^19.0.0",
61
61
  "react-router-dom": "^6.22.3"
62
62
  },
63
- "gitHead": "858111bd8bce6a904a1ec70982896d815672f2f1",
63
+ "gitHead": "0a05fe684c5dcfb2eb5f0e1343aecdd9778bcbb9",
64
64
  "dependencies": {
65
- "@arcblock/bridge": "3.1.1",
65
+ "@arcblock/bridge": "3.1.2",
66
66
  "@arcblock/did": "^1.21.2",
67
67
  "@arcblock/did-motif": "^1.1.14",
68
- "@arcblock/icons": "3.1.1",
69
- "@arcblock/nft-display": "3.1.1",
70
- "@arcblock/react-hooks": "3.1.1",
68
+ "@arcblock/icons": "3.1.2",
69
+ "@arcblock/nft-display": "3.1.2",
70
+ "@arcblock/react-hooks": "3.1.2",
71
71
  "@blocklet/js-sdk": "^1.16.46",
72
- "@blocklet/theme": "3.1.1",
72
+ "@blocklet/theme": "3.1.2",
73
73
  "@fontsource/roboto": "~5.1.1",
74
74
  "@fontsource/ubuntu-mono": "^5.2.6",
75
75
  "@iconify-icons/logos": "^1.2.36",
@@ -44,6 +44,7 @@ export default function AuthApps({
44
44
  hideSwitchConnect = false,
45
45
  hideAuthorize = false,
46
46
  hideCancel = false,
47
+ hideButton = false,
47
48
 
48
49
  notThisText = undefined,
49
50
  authorizeText = undefined,
@@ -68,6 +69,7 @@ export default function AuthApps({
68
69
  hideSwitchConnect?: boolean;
69
70
  hideAuthorize?: boolean;
70
71
  hideCancel?: boolean;
72
+ hideButton?: boolean;
71
73
 
72
74
  notThisText?: string;
73
75
  authorizeText?: string;
@@ -170,52 +172,56 @@ export default function AuthApps({
170
172
 
171
173
  {children}
172
174
 
173
- <Box
174
- sx={{
175
- border: '1px solid',
176
- borderColor: 'divider',
177
- borderRadius: 2,
178
- overflow: 'hidden',
179
- my: 1,
180
- }}
181
- />
182
-
183
- <Stack direction="row" spacing={2}>
184
- {!hideCancel ? (
185
- <Button
186
- color="inherit"
187
- variant="outlined"
188
- size="large"
189
- fullWidth
190
- onClick={handleCancel}
175
+ {hideButton ? null : (
176
+ <>
177
+ <Box
191
178
  sx={{
192
- color: 'grey.500',
193
- }}>
194
- {cancelText || t('cancel')}
195
- </Button>
196
- ) : null}
197
- {user && !hideAuthorize ? (
198
- <Button
199
- variant="contained"
200
- size="large"
201
- fullWidth
202
- onClick={handleAuthorize}
203
- disabled={currentState.loading}>
204
- {currentState.loading ? <CircularProgress size={20} sx={{ mr: 1 }} /> : null}
205
- {authorizeText || t('authorize')}
206
- </Button>
207
- ) : (
208
- <Button
209
- variant="contained"
210
- size="large"
211
- fullWidth
212
- disabled={currentState.loading}
213
- onClick={handleConnect}>
214
- {currentState.loading ? <CircularProgress size={20} sx={{ mr: 1 }} /> : null}
215
- {connectText || t('connect')}
216
- </Button>
217
- )}
218
- </Stack>
179
+ border: '1px solid',
180
+ borderColor: 'divider',
181
+ borderRadius: 2,
182
+ overflow: 'hidden',
183
+ my: 1,
184
+ }}
185
+ />
186
+
187
+ <Stack direction="row" spacing={2}>
188
+ {!hideCancel ? (
189
+ <Button
190
+ color="inherit"
191
+ variant="outlined"
192
+ size="large"
193
+ fullWidth
194
+ onClick={handleCancel}
195
+ sx={{
196
+ color: 'grey.500',
197
+ }}>
198
+ {cancelText || t('cancel')}
199
+ </Button>
200
+ ) : null}
201
+ {user && !hideAuthorize ? (
202
+ <Button
203
+ variant="contained"
204
+ size="large"
205
+ fullWidth
206
+ onClick={handleAuthorize}
207
+ disabled={currentState.loading}>
208
+ {currentState.loading ? <CircularProgress size={20} sx={{ mr: 1 }} /> : null}
209
+ {authorizeText || t('authorize')}
210
+ </Button>
211
+ ) : (
212
+ <Button
213
+ variant="contained"
214
+ size="large"
215
+ fullWidth
216
+ disabled={currentState.loading}
217
+ onClick={handleConnect}>
218
+ {currentState.loading ? <CircularProgress size={20} sx={{ mr: 1 }} /> : null}
219
+ {connectText || t('connect')}
220
+ </Button>
221
+ )}
222
+ </Stack>
223
+ </>
224
+ )}
219
225
 
220
226
  {hideSwitchConnect || !user ? null : (
221
227
  <Box sx={{ textAlign: 'center' }}>