@arcblock/ux 3.0.8 → 3.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. package/lib/Address/did-address.js +47 -49
  2. package/lib/Address/responsive-did-address.js +53 -57
  3. package/lib/Avatar/index.js +16 -16
  4. package/lib/BlockletV2/blocklet.js +64 -64
  5. package/lib/BlockletV2/components/tooltip-icon.js +26 -27
  6. package/lib/CardSelector/index.js +1 -2
  7. package/lib/ClickToCopy/hook.js +10 -11
  8. package/lib/ClickToCopy/index.js +16 -16
  9. package/lib/Config/theme-mode-toggle.js +7 -8
  10. package/lib/DID/index.js +131 -133
  11. package/lib/DIDConnect/app-info-item.js +18 -18
  12. package/lib/DIDConnect/auth-apps/index.js +83 -84
  13. package/lib/DIDConnect/did-connect-container.js +89 -90
  14. package/lib/DIDConnect/did-connect-footer.js +25 -25
  15. package/lib/DIDConnect/landing-page.js +17 -17
  16. package/lib/DIDConnect/powered-by.js +11 -11
  17. package/lib/DIDConnect/request-storage-access-api-dialog.js +36 -37
  18. package/lib/DIDConnect/with-container.js +66 -68
  19. package/lib/Dialog/use-confirm.js +40 -43
  20. package/lib/Earth/index.js +21 -22
  21. package/lib/Footer/index.js +15 -16
  22. package/lib/Header/responsive-header.js +23 -24
  23. package/lib/Layout/dashboard/index.js +63 -72
  24. package/lib/Layout/dashboard/sidebar.js +20 -21
  25. package/lib/Layout/dashboard-legacy/index.js +52 -52
  26. package/lib/Locale/context.js +36 -37
  27. package/lib/Locale/selector.js +40 -42
  28. package/lib/NFTDisplay/index.js +114 -118
  29. package/lib/NFTDisplay/render-svg.js +12 -12
  30. package/lib/NavMenu/nav-menu.js +159 -161
  31. package/lib/NavMenu/sub-container.js +25 -26
  32. package/lib/PageScroller/index.js +28 -32
  33. package/lib/Passport/passport.js +11 -11
  34. package/lib/PhoneInput/country-select.js +38 -38
  35. package/lib/PhoneInput/index.js +65 -66
  36. package/lib/Screenshot/index.js +26 -27
  37. package/lib/SessionBlocklet/index.js +87 -93
  38. package/lib/SessionPermission/index.js +5 -9
  39. package/lib/SessionUser/components/did-space.js +24 -25
  40. package/lib/SessionUser/components/logged-in.js +122 -127
  41. package/lib/SessionUser/components/quick-login-item.js +41 -42
  42. package/lib/SessionUser/components/session-user-item.js +35 -36
  43. package/lib/SessionUser/components/session-user-switch.js +81 -85
  44. package/lib/SessionUser/components/un-login.js +41 -41
  45. package/lib/SessionUser/components/user-info.js +43 -47
  46. package/lib/SessionUser/index.js +1 -1
  47. package/lib/SessionUser/libs/utils.js +24 -30
  48. package/lib/SharedBridge/index.js +35 -35
  49. package/lib/Theme/index.js +16 -16
  50. package/lib/Theme/theme.js +42 -43
  51. package/lib/Toast/index.js +24 -25
  52. package/lib/Typography/index.js +42 -42
  53. package/lib/UserCard/Content/basic.js +91 -93
  54. package/lib/UserCard/Content/shorten-label.js +9 -9
  55. package/lib/UserCard/components.js +15 -15
  56. package/lib/Util/deprecate.js +1 -1
  57. package/lib/Util/federated.js +28 -32
  58. package/lib/Util/iframe.js +9 -10
  59. package/lib/Util/index.js +134 -135
  60. package/lib/Util/security.js +9 -10
  61. package/lib/Util/wallet.js +6 -9
  62. package/lib/VerificationCode/index.js +26 -28
  63. package/lib/hooks/use-blocklet-logo.js +11 -14
  64. package/lib/ux.css +1 -1
  65. package/lib/withTracker/index.js +13 -14
  66. package/package.json +9 -10
@@ -1,36 +1,36 @@
1
- import { jsxs as m, jsx as e } from "react/jsx-runtime";
2
- import { Box as a } from "@mui/material";
3
- import { useSize as c, useCreation as d } from "ahooks";
4
- import { useRef as x } from "react";
5
- import u from "@arcblock/react-hooks/lib/useBrowser";
6
- import b from "./powered-by.js";
7
- import h from "./app-info-item.js";
8
- import w from "./app-icon.js";
9
- import { hexToRgba as g, getDIDColor as I } from "../Util/index.js";
10
- import { mergeSx as C } from "../Util/style.js";
11
- import { DID_CONNECT_MEDIUM_WIDTH as D } from "../Util/constant.js";
12
- function z({
1
+ import { jsxs as f, jsx as e } from "react/jsx-runtime";
2
+ import { Box as p } from "@mui/material";
3
+ import { useSize as m, useCreation as a } from "ahooks";
4
+ import { useRef as c } from "react";
5
+ import d from "@arcblock/react-hooks/lib/useBrowser";
6
+ import x from "./powered-by.js";
7
+ import u from "./app-info-item.js";
8
+ import b from "./app-icon.js";
9
+ import { hexToRgba as h, getDIDColor as w } from "../Util/index.js";
10
+ import { mergeSx as g } from "../Util/style.js";
11
+ import { DID_CONNECT_MEDIUM_WIDTH as I } from "../Util/constant.js";
12
+ function N({
13
13
  currentAppInfo: r = globalThis.blocklet,
14
- currentAppColor: n = ((s) => (s = globalThis.blocklet) == null ? void 0 : s.appPid)() ? I(((f) => (f = globalThis.blocklet) == null ? void 0 : f.appPid)()) : "#fff",
15
- sx: l = {}
14
+ currentAppColor: n = globalThis.blocklet?.appPid ? w(globalThis.blocklet?.appPid) : "#fff",
15
+ sx: s = {}
16
16
  }) {
17
- const p = u(), t = x(null), o = c(t), i = d(() => o ? o.width < D - 50 : !0, [o, o == null ? void 0 : o.width]);
18
- return /* @__PURE__ */ m(
19
- a,
17
+ const l = d(), t = c(null), o = m(t), i = a(() => o ? o.width < I - 50 : !0, [o, o?.width]);
18
+ return /* @__PURE__ */ f(
19
+ p,
20
20
  {
21
21
  ref: t,
22
- sx: C(
22
+ sx: g(
23
23
  {
24
24
  display: "flex",
25
25
  justifyContent: "space-between",
26
26
  alignItems: "center",
27
27
  gap: 1,
28
28
  fontSize: 12,
29
- backgroundColor: g(n, 0.08),
29
+ backgroundColor: h(n, 0.08),
30
30
  // 需要保持跟 .did-connect__root 的规则一样
31
31
  mx: i ? -2 : -3,
32
32
  // eslint-disable-next-line no-nested-ternary
33
- px: i ? p.arcSphere ? 1 : 2 : 3,
33
+ px: i ? l.arcSphere ? 1 : 2 : 3,
34
34
  py: 1.5,
35
35
  // HACK: 极限条件下,footer 会溢出,使用隐藏的滚动条来处理这种情况(屏幕宽度小于 360 时会出现)
36
36
  overflow: "auto",
@@ -43,26 +43,26 @@ function z({
43
43
  "scrollbar-width": "none"
44
44
  // 隐藏滚动条 (Firefox)
45
45
  },
46
- l
46
+ s
47
47
  ),
48
48
  className: "did-connect__footer",
49
49
  children: [
50
50
  /* @__PURE__ */ e(
51
- h,
51
+ u,
52
52
  {
53
53
  appInfo: r,
54
- appLogo: /* @__PURE__ */ e(w, { appInfo: r, size: 24, sx: { flexShrink: 0 } }),
54
+ appLogo: /* @__PURE__ */ e(b, { appInfo: r, size: 24, sx: { flexShrink: 0 } }),
55
55
  sx: {
56
56
  flex: 1,
57
57
  overflow: "hidden"
58
58
  }
59
59
  }
60
60
  ),
61
- /* @__PURE__ */ e(b, { sx: { maxWidth: "100%", justifyContent: "end" } })
61
+ /* @__PURE__ */ e(x, { sx: { maxWidth: "100%", justifyContent: "end" } })
62
62
  ]
63
63
  }
64
64
  );
65
65
  }
66
66
  export {
67
- z as default
67
+ N as default
68
68
  };
@@ -15,21 +15,21 @@ function K({
15
15
  title: l = void 0,
16
16
  description: s = void 0,
17
17
  actions: h = void 0,
18
- logo: i = void 0,
18
+ logo: o = void 0,
19
19
  logoSize: d = 50,
20
- poweredBy: m = void 0,
20
+ poweredBy: c = void 0,
21
21
  termsOfUse: u = void 0,
22
22
  standalone: y = !1
23
23
  }) {
24
- const o = (globalThis == null ? void 0 : globalThis.blocklet) || (globalThis == null ? void 0 : globalThis.env) || {}, { palette: g } = C(), c = j((r) => r.breakpoints.down("lg")), I = L({
25
- meta: o
26
- }), D = T(() => {
27
- const r = o.appPid, v = B(r), w = v ? void 0 : P(r);
24
+ const i = globalThis?.blocklet || globalThis?.env || {}, { palette: g } = C(), m = j((r) => r.breakpoints.down("lg")), D = L({
25
+ meta: i
26
+ }), I = T(() => {
27
+ const r = i.appPid, v = B(r), w = v ? void 0 : P(r);
28
28
  return v ? M(r) : w.color;
29
- }, [o == null ? void 0 : o.appPid]);
29
+ }, [i?.appPid]);
30
30
  if (!a)
31
31
  return n;
32
- l === void 0 && (l = o.appName), s === void 0 && (s = o.appDescription), i === void 0 && (i = I || ""), typeof i == "string" && (i ? i = /* @__PURE__ */ t(
32
+ l === void 0 && (l = i.appName), s === void 0 && (s = i.appDescription), o === void 0 && (o = D || ""), typeof o == "string" && (o ? o = /* @__PURE__ */ t(
33
33
  e,
34
34
  {
35
35
  sx: {
@@ -38,10 +38,10 @@ function K({
38
38
  objectFit: "contain"
39
39
  },
40
40
  component: "img",
41
- src: i,
42
- alt: `${o.appName}'s logo`
41
+ src: o,
42
+ alt: `${i.appName}'s logo`
43
43
  }
44
- ) : i = /* @__PURE__ */ t(b, { size: d, did: a, src: i, variant: "rounded" })), m === void 0 && (m = /* @__PURE__ */ t(
44
+ ) : o = /* @__PURE__ */ t(b, { size: d, did: a, src: o, variant: "rounded" })), c === void 0 && (c = /* @__PURE__ */ t(
45
45
  E,
46
46
  {
47
47
  linkProps: {
@@ -52,7 +52,7 @@ function K({
52
52
  }
53
53
  }
54
54
  },
55
- showExtra: !c,
55
+ showExtra: !m,
56
56
  sx: {
57
57
  textAlign: "center",
58
58
  fontSize: "12px",
@@ -61,7 +61,7 @@ function K({
61
61
  }
62
62
  ));
63
63
  let p = n;
64
- !n && !c && (p = /* @__PURE__ */ t(
64
+ !n && !m && (p = /* @__PURE__ */ t(
65
65
  e,
66
66
  {
67
67
  sx: {
@@ -73,7 +73,7 @@ function K({
73
73
  ));
74
74
  const k = !!n;
75
75
  let f = !y;
76
- return c && (f = !k), /* @__PURE__ */ x(
76
+ return m && (f = !k), /* @__PURE__ */ x(
77
77
  e,
78
78
  {
79
79
  sx: {
@@ -96,7 +96,7 @@ function K({
96
96
  xs: 5,
97
97
  md: 8
98
98
  },
99
- background: `radial-gradient(circle at bottom right, ${z(D, 0.3)} 10%, ${g.background.default} 50%)`,
99
+ background: `radial-gradient(circle at bottom right, ${z(I, 0.3)} 10%, ${g.background.default} 50%)`,
100
100
  position: "relative"
101
101
  },
102
102
  children: [
@@ -121,7 +121,7 @@ function K({
121
121
  gap: 1.5
122
122
  },
123
123
  children: [
124
- /* @__PURE__ */ t(e, { sx: { display: "flex", alignItems: "center" }, children: i }),
124
+ /* @__PURE__ */ t(e, { sx: { display: "flex", alignItems: "center" }, children: o }),
125
125
  /* @__PURE__ */ t(
126
126
  A,
127
127
  {
@@ -167,7 +167,7 @@ function K({
167
167
  right: 10,
168
168
  textAlign: "center"
169
169
  },
170
- children: m
170
+ children: c
171
171
  }
172
172
  )
173
173
  ]
@@ -1,15 +1,15 @@
1
- import { jsxs as r, jsx as o } from "react/jsx-runtime";
2
- import { useTheme as i, Box as n } from "@mui/material";
1
+ import { jsxs as r, jsx as e } from "react/jsx-runtime";
2
+ import { useTheme as i, Box as t } from "@mui/material";
3
3
  import { Icon as c } from "@iconify/react";
4
4
  import a from "@iconify-icons/mdi/shield-check";
5
5
  import l from "./did-connect-logo.js";
6
6
  import { mergeSx as m } from "../Util/style.js";
7
- function u({ ...e }) {
8
- const { palette: t } = i();
7
+ function u({ ...o }) {
8
+ const { palette: n } = i();
9
9
  return /* @__PURE__ */ r(
10
- n,
10
+ t,
11
11
  {
12
- ...e,
12
+ ...o,
13
13
  sx: m(
14
14
  {
15
15
  display: "flex",
@@ -21,13 +21,13 @@ function u({ ...e }) {
21
21
  fontFamily: "Lexend",
22
22
  whiteSpace: "nowrap"
23
23
  },
24
- e == null ? void 0 : e.sx
24
+ o?.sx
25
25
  ),
26
26
  children: [
27
- /* @__PURE__ */ o(c, { icon: a, color: t.success.main }),
27
+ /* @__PURE__ */ e(c, { icon: a, color: n.success.main }),
28
28
  "Secured by",
29
- /* @__PURE__ */ o(
30
- n,
29
+ /* @__PURE__ */ e(
30
+ t,
31
31
  {
32
32
  component: "a",
33
33
  href: "https://www.didconnect.io/",
@@ -43,7 +43,7 @@ function u({ ...e }) {
43
43
  textDecoration: "underline"
44
44
  }
45
45
  },
46
- children: /* @__PURE__ */ o(l, {})
46
+ children: /* @__PURE__ */ e(l, {})
47
47
  }
48
48
  )
49
49
  ]
@@ -1,13 +1,13 @@
1
- import { jsx as e, jsxs as t, Fragment as m } from "react/jsx-runtime";
2
- import { Box as i, Typography as p, Chip as x, List as R, ListItem as w, Button as q } from "@mui/material";
1
+ import { jsx as e, jsxs as t, Fragment as d } from "react/jsx-runtime";
2
+ import { Box as i, Typography as p, Chip as g, List as R, ListItem as x, Button as q } from "@mui/material";
3
3
  import { Icon as u } from "@iconify/react";
4
4
  import D from "@iconify-icons/tabler/external-link";
5
5
  import L from "@iconify-icons/material-symbols/lock-outline";
6
6
  import B from "@iconify-icons/material-symbols/check-circle";
7
- import y from "@iconify-icons/material-symbols/rocket-launch-rounded";
7
+ import w from "@iconify-icons/material-symbols/rocket-launch-rounded";
8
8
  import { useReactive as F, useMemoizedFn as s } from "ahooks";
9
9
  import { memo as U, useRef as j, useImperativeHandle as M } from "react";
10
- import b from "lodash/noop";
10
+ import y from "lodash/noop";
11
11
  import { translate as W } from "../Locale/util.js";
12
12
  import Y from "./did-connect-container.js";
13
13
  import _ from "../CloseButton/index.js";
@@ -18,12 +18,12 @@ const P = {
18
18
  allow: "Allow",
19
19
  dataUsage: "Your data is only used for identity authentication, and will not be collected or used for any other purpose.",
20
20
  title: "Authorization Request",
21
- clickAllow: ({ allowButton: r }) => /* @__PURE__ */ t(m, { children: [
21
+ clickAllow: ({ allowButton: r }) => /* @__PURE__ */ t(d, { children: [
22
22
  "You only need to click the ",
23
23
  r,
24
24
  " button below, and you will not see this request again."
25
25
  ] }),
26
- reason: ({ site: r }) => /* @__PURE__ */ t(m, { children: [
26
+ reason: ({ site: r }) => /* @__PURE__ */ t(d, { children: [
27
27
  "For a better login experience, we need to apply for the storage permission of the ",
28
28
  r,
29
29
  " site."
@@ -38,12 +38,12 @@ const P = {
38
38
  allow: "允许",
39
39
  dataUsage: "您的数据仅用于身份认证,不会被收集或用于其他用途。",
40
40
  title: "授权请求",
41
- clickAllow: ({ allowButton: r }) => /* @__PURE__ */ t(m, { children: [
41
+ clickAllow: ({ allowButton: r }) => /* @__PURE__ */ t(d, { children: [
42
42
  "您只需要点击下方的 ",
43
43
  r,
44
44
  " 按钮,后续将不会再看到这个请求。"
45
45
  ] }),
46
- reason: ({ site: r }) => /* @__PURE__ */ t(m, { children: [
46
+ reason: ({ site: r }) => /* @__PURE__ */ t(d, { children: [
47
47
  "为了让您获得更好的登录体验,我们需要申请 ",
48
48
  r,
49
49
  " 站点存储权限。"
@@ -57,12 +57,12 @@ const P = {
57
57
  };
58
58
  function T({
59
59
  ref: r = void 0,
60
- locale: k = "en",
60
+ locale: b = "en",
61
61
  src: c,
62
- storageAccessState: f
62
+ storageAccessState: m
63
63
  }) {
64
- const h = j(null), o = F({
65
- callback: b,
64
+ const f = j(null), o = F({
65
+ callback: y,
66
66
  open: !1,
67
67
  get origin() {
68
68
  try {
@@ -78,31 +78,30 @@ function T({
78
78
  return c;
79
79
  }
80
80
  }
81
- }), l = s((n, a = {}) => W(P, n, k, "en", a)), A = s(() => {
82
- o.open = !1, o.callback = b;
83
- }), I = s(() => {
81
+ }), l = s((n, a = {}) => W(P, n, b, "en", a)), k = s(() => {
82
+ o.open = !1, o.callback = y;
83
+ }), A = s(() => {
84
84
  o.open = !0;
85
- }), v = s(() => {
85
+ }), I = s(() => {
86
86
  o.open = !1;
87
- }), C = s(
87
+ }), v = s(
88
88
  async (n) => {
89
- var d;
90
- (await ((d = h.current) == null ? void 0 : d.callIframe("requestStorageAccess"))).value ? n(!0, "broswer") : f === void 0 ? n(!1, "system") : f === "denied" ? n(!1) : (o.open = !0, o.callback = n);
89
+ (await f.current?.callIframe("requestStorageAccess")).value ? n(!0, "broswer") : m === void 0 ? n(!1, "system") : m === "denied" ? n(!1) : (o.open = !0, o.callback = n);
91
90
  }
92
- ), z = s(() => new Promise((n) => {
93
- C((a, d) => {
94
- A(), n({ value: a, origin: d });
91
+ ), C = s(() => new Promise((n) => {
92
+ v((a, S) => {
93
+ k(), n({ value: a, origin: S });
95
94
  });
96
- })), S = s(() => {
95
+ })), z = s(() => {
97
96
  o.open = !1;
98
- }), g = s(() => {
97
+ }), h = s(() => {
99
98
  o.open = !1, o.callback(!1, "system");
100
99
  });
101
100
  return M(r, () => ({
102
- open: I,
103
- close: v,
104
- requestStorageAccess: z
105
- })), /* @__PURE__ */ e(Y, { popup: !0, open: o.open, onClose: g, keepMounted: !0, children: /* @__PURE__ */ t(
101
+ open: A,
102
+ close: I,
103
+ requestStorageAccess: C
104
+ })), /* @__PURE__ */ e(Y, { popup: !0, open: o.open, onClose: h, keepMounted: !0, children: /* @__PURE__ */ t(
106
105
  i,
107
106
  {
108
107
  sx: {
@@ -121,7 +120,7 @@ function T({
121
120
  /* @__PURE__ */ e(
122
121
  _,
123
122
  {
124
- onClose: g,
123
+ onClose: h,
125
124
  sx: {
126
125
  position: "absolute",
127
126
  right: 14,
@@ -160,7 +159,7 @@ function T({
160
159
  /* @__PURE__ */ t(i, { sx: { display: "flex", flexDirection: "column", gap: 1 }, children: [
161
160
  /* @__PURE__ */ e(p, { children: l("reason", {
162
161
  site: /* @__PURE__ */ e(
163
- x,
162
+ g,
164
163
  {
165
164
  clickable: !0,
166
165
  component: "a",
@@ -175,7 +174,7 @@ function T({
175
174
  )
176
175
  }) }),
177
176
  /* @__PURE__ */ e(p, { component: "div", children: l("clickAllow", {
178
- allowButton: /* @__PURE__ */ e(x, { label: l("allow"), size: "small", color: "success" })
177
+ allowButton: /* @__PURE__ */ e(g, { label: l("allow"), size: "small", color: "success" })
179
178
  }) }),
180
179
  /* @__PURE__ */ t(i, { sx: { mt: 2 }, children: [
181
180
  /* @__PURE__ */ t(p, { sx: { display: "flex", alignItems: "center", gap: 1, mb: 0.5 }, children: [
@@ -193,12 +192,12 @@ function T({
193
192
  l("afterAllow.title")
194
193
  ] }),
195
194
  /* @__PURE__ */ t(R, { dense: !0, sx: { py: 0, pl: 2 }, children: [
196
- /* @__PURE__ */ t(w, { sx: { display: "flex", alignItems: "center", gap: 0.8 }, children: [
195
+ /* @__PURE__ */ t(x, { sx: { display: "flex", alignItems: "center", gap: 0.8 }, children: [
197
196
  /* @__PURE__ */ e(
198
197
  i,
199
198
  {
200
199
  component: u,
201
- icon: y,
200
+ icon: w,
202
201
  sx: {
203
202
  fontSize: 20,
204
203
  color: "success.main"
@@ -207,12 +206,12 @@ function T({
207
206
  ),
208
207
  l("afterAllow.list1")
209
208
  ] }),
210
- /* @__PURE__ */ t(w, { sx: { display: "flex", alignItems: "center", gap: 0.8 }, children: [
209
+ /* @__PURE__ */ t(x, { sx: { display: "flex", alignItems: "center", gap: 0.8 }, children: [
211
210
  /* @__PURE__ */ e(
212
211
  i,
213
212
  {
214
213
  component: u,
215
- icon: y,
214
+ icon: w,
216
215
  sx: {
217
216
  fontSize: 20,
218
217
  color: "success.main"
@@ -236,11 +235,11 @@ function T({
236
235
  )
237
236
  ] }),
238
237
  /* @__PURE__ */ e(i, { sx: { display: "flex", justifyContent: "center" }, children: /* @__PURE__ */ t(i, { sx: { position: "relative", display: "inline-block", cursor: "pointer" }, children: [
239
- /* @__PURE__ */ e(q, { variant: "contained", color: "success", onClick: S, sx: { minWidth: 100, letterSpacing: 1 }, children: l("allow") }),
238
+ /* @__PURE__ */ e(q, { variant: "contained", color: "success", onClick: z, sx: { minWidth: 100, letterSpacing: 1 }, children: l("allow") }),
240
239
  /* @__PURE__ */ e(
241
240
  H,
242
241
  {
243
- ref: h,
242
+ ref: f,
244
243
  onClick: ({ value: n, visitorId: a }) => {
245
244
  a && O(a), o.callback(n, "broswer");
246
245
  },