@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,59 +1,56 @@
1
- import { jsxs as d, jsx as o } from "react/jsx-runtime";
2
- import { useRef as R } from "react";
3
- import { useTheme as b, Box as u, IconButton as w, Popper as C, ClickAwayListener as P, Fade as k, Paper as L, List as z, ListItem as A, ListItemButton as M, Typography as S } from "@mui/material";
4
- import { Icon as m } from "@iconify/react";
1
+ import { jsxs as s, jsx as e } from "react/jsx-runtime";
2
+ import { useRef as y } from "react";
3
+ import { useTheme as R, Box as p, IconButton as k, Popper as w, ClickAwayListener as C, Fade as P, Paper as L, List as z, ListItem as A, ListItemButton as M, Typography as S } from "@mui/material";
4
+ import { Icon as u } from "@iconify/react";
5
5
  import T from "iconify-icons-material-symbols-400/dashboard-outline-rounded";
6
6
  import B from "@iconify-icons/material-symbols/widgets-outline-rounded";
7
7
  import { useReactive as E, useMemoizedFn as j } from "ahooks";
8
8
  import F from "../Button/index.js";
9
9
  import { BLOCKLET_SERVICE_PATH_PREFIX as O, NAVIGATION_URL as _ } from "../Util/constant.js";
10
10
  import D from "../SessionPermission/index.js";
11
- import { getTranslation as f } from "../Util/index.js";
11
+ import { getTranslation as m } from "../Util/index.js";
12
12
  function J({
13
- session: t,
14
- locale: a = "zh",
15
- size: h = 24,
16
- popperType: g = "click",
17
- sx: x,
18
- ...I
13
+ session: r,
14
+ locale: i = "zh",
15
+ size: f = 24,
16
+ popperType: h = "click",
17
+ sx: g,
18
+ ...x
19
19
  }) {
20
- const r = (window == null ? void 0 : window.blocklet) || {}, p = (r.navigation || []).filter((n) => n.section === "sessionManager" && !["/sessionManager"].includes(n.id)).filter((n) => {
21
- var e;
22
- return !!((n == null ? void 0 : n.role) || []).includes(((e = t == null ? void 0 : t.user) == null ? void 0 : e.role) || "guest");
23
- }).map((n) => {
24
- const e = ((r == null ? void 0 : r.componentMountPoints) || []).find((l) => n.component === l.name);
20
+ const c = window?.blocklet || {}, a = (c.navigation || []).filter((n) => n.section === "sessionManager" && !["/sessionManager"].includes(n.id)).filter((n) => !!(n?.role || []).includes(r?.user?.role || "guest")).map((n) => {
21
+ const o = (c?.componentMountPoints || []).find((v) => n.component === v.name);
25
22
  return {
26
23
  ...n,
27
- component: e
24
+ component: o
28
25
  };
29
- }), v = b(), s = R(null), c = E({
26
+ }), b = R(), d = y(null), l = E({
30
27
  open: !1
31
- }), i = j((n = !c.open) => {
32
- c.open = n;
33
- }), y = g === "hover" ? { onMouseEnter: () => i(!0), onMouseLeave: () => i(!1) } : { onClick: () => i() };
34
- return p.length === 0 || !(t != null && t.user) ? null : /* @__PURE__ */ d(
35
- u,
28
+ }), t = j((n = !l.open) => {
29
+ l.open = n;
30
+ }), I = h === "hover" ? { onMouseEnter: () => t(!0), onMouseLeave: () => t(!1) } : { onClick: () => t() };
31
+ return a.length === 0 || !r?.user ? null : /* @__PURE__ */ s(
32
+ p,
36
33
  {
37
- sx: { display: "inline-flex", alignItems: "center", justifyContent: "center", ...x },
34
+ sx: { display: "inline-flex", alignItems: "center", justifyContent: "center", ...g },
35
+ ...x,
38
36
  ...I,
39
- ...y,
40
37
  children: [
41
- /* @__PURE__ */ o(w, { size: "medium", ref: s, children: /* @__PURE__ */ o(m, { icon: T, fontSize: h, style: { transform: "scale(1.08)" } }) }),
42
- /* @__PURE__ */ o(
43
- C,
38
+ /* @__PURE__ */ e(k, { size: "medium", ref: d, children: /* @__PURE__ */ e(u, { icon: T, fontSize: f, style: { transform: "scale(1.08)" } }) }),
39
+ /* @__PURE__ */ e(
40
+ w,
44
41
  {
45
- open: c.open,
46
- anchorEl: s.current,
42
+ open: l.open,
43
+ anchorEl: d.current,
47
44
  transition: !0,
48
45
  placement: "bottom-end",
49
46
  sx: { zIndex: 1600 },
50
- children: ({ TransitionProps: n }) => /* @__PURE__ */ o(
51
- P,
47
+ children: ({ TransitionProps: n }) => /* @__PURE__ */ e(
48
+ C,
52
49
  {
53
- onClickAway: (e) => {
54
- e.preventDefault(), e.stopPropagation(), i(!1);
50
+ onClickAway: (o) => {
51
+ o.preventDefault(), o.stopPropagation(), t(!1);
55
52
  },
56
- children: /* @__PURE__ */ o(k, { ...n, timeout: 350, children: /* @__PURE__ */ d(
53
+ children: /* @__PURE__ */ e(P, { ...n, timeout: 350, children: /* @__PURE__ */ s(
57
54
  L,
58
55
  {
59
56
  variant: "outlined",
@@ -64,7 +61,7 @@ function J({
64
61
  p: 2
65
62
  },
66
63
  children: [
67
- /* @__PURE__ */ o(
64
+ /* @__PURE__ */ e(
68
65
  z,
69
66
  {
70
67
  sx: {
@@ -76,66 +73,63 @@ function J({
76
73
  overflowY: "auto",
77
74
  p: 0
78
75
  },
79
- children: p.map((e) => {
80
- var l;
81
- return /* @__PURE__ */ o(A, { disablePadding: !0, children: /* @__PURE__ */ d(
82
- M,
83
- {
84
- href: f(e.link, a),
85
- sx: {
86
- p: 1,
87
- display: "flex",
88
- flexDirection: "column",
89
- alignItems: "center",
90
- gap: 1,
91
- width: "100%",
92
- height: "100%",
93
- borderRadius: 1,
94
- "&:hover": {
95
- backgroundColor: "action.hover"
76
+ children: a.map((o) => /* @__PURE__ */ e(A, { disablePadding: !0, children: /* @__PURE__ */ s(
77
+ M,
78
+ {
79
+ href: m(o.link, i),
80
+ sx: {
81
+ p: 1,
82
+ display: "flex",
83
+ flexDirection: "column",
84
+ alignItems: "center",
85
+ gap: 1,
86
+ width: "100%",
87
+ height: "100%",
88
+ borderRadius: 1,
89
+ "&:hover": {
90
+ backgroundColor: "action.hover"
91
+ }
92
+ },
93
+ children: [
94
+ o?.component?.did ? /* @__PURE__ */ e(
95
+ p,
96
+ {
97
+ component: "img",
98
+ src: `${O}/blocklet/logo-bundle/${o.component.did}`,
99
+ sx: {
100
+ borderRadius: 1,
101
+ width: 50,
102
+ height: 50,
103
+ objectFit: "contain"
104
+ },
105
+ alt: "SessionBlocklet component icon"
96
106
  }
97
- },
98
- children: [
99
- (l = e == null ? void 0 : e.component) != null && l.did ? /* @__PURE__ */ o(
100
- u,
101
- {
102
- component: "img",
103
- src: `${O}/blocklet/logo-bundle/${e.component.did}`,
104
- sx: {
105
- borderRadius: 1,
106
- width: 50,
107
- height: 50,
108
- objectFit: "contain"
109
- },
110
- alt: "SessionBlocklet component icon"
111
- }
112
- ) : /* @__PURE__ */ o(
113
- m,
114
- {
115
- fontSize: 50,
116
- icon: e.icon || B,
117
- color: v.palette.text.secondary
118
- }
119
- ),
120
- /* @__PURE__ */ o(
121
- S,
122
- {
123
- sx: {
124
- fontSize: "12px",
125
- color: "text.primary",
126
- textAlign: "center",
127
- lineHeight: "normal"
128
- },
129
- children: f(e.title, a)
130
- }
131
- )
132
- ]
133
- }
134
- ) }, e.id);
135
- })
107
+ ) : /* @__PURE__ */ e(
108
+ u,
109
+ {
110
+ fontSize: 50,
111
+ icon: o.icon || B,
112
+ color: b.palette.text.secondary
113
+ }
114
+ ),
115
+ /* @__PURE__ */ e(
116
+ S,
117
+ {
118
+ sx: {
119
+ fontSize: "12px",
120
+ color: "text.primary",
121
+ textAlign: "center",
122
+ lineHeight: "normal"
123
+ },
124
+ children: m(o.title, i)
125
+ }
126
+ )
127
+ ]
128
+ }
129
+ ) }, o.id))
136
130
  }
137
131
  ),
138
- /* @__PURE__ */ o(D, { session: t, children: /* @__PURE__ */ o(F, { variant: "outlined", fullWidth: !0, href: _, sx: { mt: 1 }, children: a === "zh" ? "管理" : "Manage" }) })
132
+ /* @__PURE__ */ e(D, { session: r, children: /* @__PURE__ */ e(F, { variant: "outlined", fullWidth: !0, href: _, sx: { mt: 1 }, children: i === "zh" ? "管理" : "Manage" }) })
139
133
  ]
140
134
  }
141
135
  ) })
@@ -1,12 +1,8 @@
1
- import { useCreation as a } from "ahooks";
2
- function o({ session: r, roles: u = ["owner", "admin"], children: t }) {
3
- var f;
4
- const e = a(() => {
5
- var n;
6
- return u.includes(((n = r == null ? void 0 : r.user) == null ? void 0 : n.role) || "guest");
7
- }, [(f = r == null ? void 0 : r.user) == null ? void 0 : f.role, u]);
8
- return typeof t == "function" ? t({ hasPermission: e }) : e ? t : null;
1
+ import { useCreation as u } from "ahooks";
2
+ function i({ session: e, roles: n = ["owner", "admin"], children: r }) {
3
+ const t = u(() => n.includes(e?.user?.role || "guest"), [e?.user?.role, n]);
4
+ return typeof r == "function" ? r({ hasPermission: t }) : t ? r : null;
9
5
  }
10
6
  export {
11
- o as default
7
+ i as default
12
8
  };
@@ -1,23 +1,22 @@
1
- import { jsxs as a, Fragment as h, jsx as e } from "react/jsx-runtime";
2
- import { useState as y } from "react";
3
- import { useMemoizedFn as s } from "ahooks";
4
- import { useTheme as g, MenuItem as S, Divider as u } from "@mui/material";
5
- import { Icon as D } from "@iconify/react";
6
- import I from "@iconify-icons/material-symbols/lens";
7
- import { translate as v } from "../../Locale/util.js";
8
- import { translations as T } from "../libs/translation.js";
9
- import w from "../images/did-spaces.svg.js";
10
- import { DID_SPACE_URL as z } from "../../Util/constant.js";
11
- import { TBox as k } from "../../MuiWrap/index.js";
12
- import F from "../../Typography/index.js";
13
- function O({ session: m, locale: l = "en", ...c }) {
14
- var p;
15
- const d = s((r, i = {}) => v(T, r, l, "en", i)), t = g(), o = ((p = m.user) == null ? void 0 : p.didSpace) ?? {}, [n, f] = y(0), x = s(({ fontSize: r, initialSize: i }) => {
16
- f(Math.ceil((i - r) / 4));
1
+ import { jsxs as p, Fragment as x, jsx as e } from "react/jsx-runtime";
2
+ import { useState as h } from "react";
3
+ import { useMemoizedFn as a } from "ahooks";
4
+ import { useTheme as y, MenuItem as g, Divider as S } from "@mui/material";
5
+ import { Icon as u } from "@iconify/react";
6
+ import D from "@iconify-icons/material-symbols/lens";
7
+ import { translate as I } from "../../Locale/util.js";
8
+ import { translations as v } from "../libs/translation.js";
9
+ import T from "../images/did-spaces.svg.js";
10
+ import { DID_SPACE_URL as w } from "../../Util/constant.js";
11
+ import { TBox as z } from "../../MuiWrap/index.js";
12
+ import k from "../../Typography/index.js";
13
+ function G({ session: s, locale: m = "en", ...l }) {
14
+ const c = a((r, i = {}) => I(v, r, m, "en", i)), t = y(), o = s.user?.didSpace ?? {}, [n, d] = h(0), f = a(({ fontSize: r, initialSize: i }) => {
15
+ d(Math.ceil((i - r) / 4));
17
16
  });
18
- return /* @__PURE__ */ a(h, { children: [
19
- /* @__PURE__ */ e(k, { component: "a", href: z, sx: { p: 0.5, display: "block", textDecoration: "none" }, ...c, children: /* @__PURE__ */ a(
20
- S,
17
+ return /* @__PURE__ */ p(x, { children: [
18
+ /* @__PURE__ */ e(z, { component: "a", href: w, sx: { p: 0.5, display: "block", textDecoration: "none" }, ...l, children: /* @__PURE__ */ p(
19
+ g,
21
20
  {
22
21
  sx: {
23
22
  display: "flex",
@@ -27,7 +26,7 @@ function O({ session: m, locale: l = "en", ...c }) {
27
26
  },
28
27
  children: [
29
28
  /* @__PURE__ */ e("div", { style: { display: "flex", alignItems: "center" }, children: /* @__PURE__ */ e(
30
- w,
29
+ T,
31
30
  {
32
31
  style: {
33
32
  height: "24px",
@@ -48,14 +47,14 @@ function O({ session: m, locale: l = "en", ...c }) {
48
47
  overflow: "hidden",
49
48
  whiteSpace: "nowrap"
50
49
  },
51
- children: /* @__PURE__ */ e(F, { fontSize: "auto", minFontSize: 1, sx: { marginTop: `${n}px` }, onShrink: x, children: o.did ? o.name : d("disconnected") })
50
+ children: /* @__PURE__ */ e(k, { fontSize: "auto", minFontSize: 1, sx: { marginTop: `${n}px` }, onShrink: f, children: o.did ? o.name : c("disconnected") })
52
51
  }
53
52
  ),
54
53
  /* @__PURE__ */ e(
55
- D,
54
+ u,
56
55
  {
57
56
  style: { marginTop: `${n}px`, flexShrink: 0 },
58
- icon: I,
57
+ icon: D,
59
58
  fontSize: 8,
60
59
  color: o.did ? t.palette.success.main : t.palette.grey[200]
61
60
  }
@@ -63,9 +62,9 @@ function O({ session: m, locale: l = "en", ...c }) {
63
62
  ]
64
63
  }
65
64
  ) }),
66
- /* @__PURE__ */ e(u, {})
65
+ /* @__PURE__ */ e(S, {})
67
66
  ] });
68
67
  }
69
68
  export {
70
- O as default
69
+ G as default
71
70
  };