@arcblock/ux 3.1.40 → 3.1.42

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.
@@ -1,11 +1,19 @@
1
1
  import { jsx as e } from "react/jsx-runtime";
2
- import { IconButton as n } from "@mui/material";
3
- import { Brightness2Outlined as i, LightModeOutlined as l } from "@mui/icons-material";
4
- import { useColorScheme as s } from "../Theme/theme-provider.js";
5
- function f() {
6
- const { mode: r, toggleMode: o, prefer: t } = s();
7
- return o ? t === "system" || window.blocklet?.theme?.prefer === "system" ? /* @__PURE__ */ e(n, { onClick: o, children: r === "light" ? /* @__PURE__ */ e(i, {}) : /* @__PURE__ */ e(l, {}) }) : null : (process.env.NODE_ENV !== "production" && console.warn("Please ensure the component is wrapped with ConfigProvider context"), null);
2
+ import { IconButton as i } from "@mui/material";
3
+ import { Brightness2Outlined as l, LightModeOutlined as s } from "@mui/icons-material";
4
+ import { useThrottleFn as m } from "ahooks";
5
+ import { useColorScheme as u } from "../Theme/theme-provider.js";
6
+ function g() {
7
+ const { mode: t, toggleMode: o, prefer: r } = u(), { run: n } = m(
8
+ () => {
9
+ o();
10
+ },
11
+ {
12
+ wait: 300
13
+ }
14
+ );
15
+ return o ? r === "system" || window.blocklet?.theme?.prefer === "system" ? /* @__PURE__ */ e(i, { onClick: n, children: t === "light" ? /* @__PURE__ */ e(l, {}) : /* @__PURE__ */ e(s, {}) }) : null : (process.env.NODE_ENV !== "production" && console.warn("Please ensure the component is wrapped with ConfigProvider context"), null);
8
16
  }
9
17
  export {
10
- f as default
18
+ g as default
11
19
  };
@@ -1,5 +1,5 @@
1
- import { jsx as r, jsxs as t, Fragment as y } from "react/jsx-runtime";
2
- import { Box as d, Container as w } from "@mui/material";
1
+ import { jsx as r, jsxs as t, Fragment as w } from "react/jsx-runtime";
2
+ import { Box as d, Container as y } from "@mui/material";
3
3
  import { useRef as v, useState as N, useEffect as k } from "react";
4
4
  import z from "./auto-hidden.js";
5
5
  import { styled as W } from "../Theme/index.js";
@@ -14,24 +14,24 @@ function I({
14
14
  prepend: f = null,
15
15
  align: o = "left",
16
16
  maxWidth: x = !1,
17
- homeLink: i = "/",
17
+ homeLink: a = "/",
18
18
  ...m
19
19
  }) {
20
- const a = v(null), [g, u] = N("0px"), b = { minWidth: g };
20
+ const i = v(null), [g, u] = N("0px"), b = { minWidth: g };
21
21
  return k(() => {
22
22
  const { searchParams: n } = new URL(window.location.href);
23
- n.get("inviter") && window.localStorage.setItem("inviter", n.get("inviter")), a.current && u(`${a.current.offsetWidth}px`);
24
- }, []), /* @__PURE__ */ r(B, { ...m, children: /* @__PURE__ */ t(w, { maxWidth: x, className: "header-container", children: [
23
+ n.get("inviter") && window.localStorage.setItem("inviter", n.get("inviter")), i.current && u(`${i.current.offsetWidth}px`);
24
+ }, []), /* @__PURE__ */ r(B, { ...m, children: /* @__PURE__ */ t(y, { maxWidth: x, className: "header-container", children: [
25
25
  f,
26
26
  /* @__PURE__ */ r("div", { className: "header-brand-wrapper", style: b, children: (() => {
27
- const n = /* @__PURE__ */ t(y, { children: [
28
- e && /* @__PURE__ */ r("div", { className: "header-logo", ref: a, children: e }),
27
+ const n = /* @__PURE__ */ t(w, { children: [
28
+ e && /* @__PURE__ */ r("div", { className: "header-logo", ref: i, children: e }),
29
29
  l && /* @__PURE__ */ r(z, { height: 44, sx: { flexShrink: { xs: 1 } }, children: /* @__PURE__ */ t("div", { className: "header-brand", children: [
30
30
  /* @__PURE__ */ r("div", { className: "header-brand-title", children: /* @__PURE__ */ r("h2", { children: l }) }),
31
31
  /* @__PURE__ */ r("div", { className: "header-brand-desc", children: s })
32
32
  ] }) })
33
33
  ] });
34
- return typeof i == "function" ? i(n) : /* @__PURE__ */ r("a", { href: i, children: n });
34
+ return typeof a == "function" ? a(n) : /* @__PURE__ */ r("a", { href: a, children: n });
35
35
  })() }),
36
36
  /* @__PURE__ */ r("div", { className: "header-brand-addon", children: h }),
37
37
  o === "right" && /* @__PURE__ */ r(
@@ -138,7 +138,7 @@ const B = W(d)`
138
138
  .header-menu {
139
139
  display: inline-block;
140
140
  }
141
- .header-logo {
141
+ .header-brand-wrapper .header-logo {
142
142
  height: 32px;
143
143
  }
144
144
  .header-brand {
@@ -1,22 +1,22 @@
1
1
  import { jsx as o, jsxs as c } from "react/jsx-runtime";
2
2
  import { useState as f } from "react";
3
- import { useReactive as y, useCreation as v } from "ahooks";
4
- import { Close as h, Menu as g } from "@mui/icons-material";
5
- import { Container as b, useTheme as x, useMediaQuery as w, Drawer as P, Button as k } from "@mui/material";
6
- import p from "./header.js";
7
- import { styled as i } from "../Theme/index.js";
8
- function z({ prepend: n, children: r = null, ...s }) {
9
- const a = x(), l = w(a.breakpoints.down("md")), [t, m] = f(!1), u = typeof r == "function" ? r({ isMobile: l, closeMenu: () => m(!1) }) : r, e = y({
3
+ import { useReactive as v, useCreation as g } from "ahooks";
4
+ import { Close as y, Menu as h } from "@mui/icons-material";
5
+ import { Container as x, useTheme as b, useMediaQuery as w, Drawer as P, Button as k } from "@mui/material";
6
+ import u from "./header.js";
7
+ import { styled as s } from "../Theme/index.js";
8
+ function z({ prepend: n, children: r = null, ...i }) {
9
+ const a = b(), l = w(a.breakpoints.down("md")), [t, m] = f(!1), d = typeof r == "function" ? r({ isMobile: l, closeMenu: () => m(!1) }) : r, e = v({
10
10
  changed: !1,
11
11
  value: "",
12
12
  priority: ""
13
13
  });
14
- return v(() => {
14
+ return g(() => {
15
15
  if (document.documentElement?.style) {
16
- const d = () => {
16
+ const p = () => {
17
17
  e.changed && (e.value ? document.documentElement.style.setProperty("overflow", e.value, e.priority) : document.documentElement.style.removeProperty("overflow"), e.value = "", e.priority = "", e.changed = !1);
18
18
  };
19
- return t ? (e.changed = !0, e.value = document.documentElement.style.getPropertyValue("overflow"), e.priority = document.documentElement.style.getPropertyPriority("overflow"), document.documentElement.style.setProperty("overflow", "revert", "important")) : d(), d;
19
+ return t ? (e.changed = !0, e.value = document.documentElement.style.getPropertyValue("overflow"), e.priority = document.documentElement.style.getPropertyPriority("overflow"), document.documentElement.style.setProperty("overflow", "revert", "important")) : p(), p;
20
20
  }
21
21
  return () => {
22
22
  };
@@ -30,12 +30,12 @@ function z({ prepend: n, children: r = null, ...s }) {
30
30
  className: "header-menu",
31
31
  "aria-label": "header menu button",
32
32
  onClick: () => m(!t),
33
- children: t ? /* @__PURE__ */ o(h, {}) : /* @__PURE__ */ o(g, {})
33
+ children: t ? /* @__PURE__ */ o(y, {}) : /* @__PURE__ */ o(h, {})
34
34
  }
35
35
  ),
36
- ...s,
36
+ ...i,
37
37
  children: [
38
- !l && u,
38
+ !l && d,
39
39
  l && /* @__PURE__ */ o(
40
40
  P,
41
41
  {
@@ -53,33 +53,41 @@ function z({ prepend: n, children: r = null, ...s }) {
53
53
  },
54
54
  slotProps: {
55
55
  paper: {
56
- style: {
56
+ sx: {
57
57
  top: 64,
58
58
  bottom: 0,
59
59
  boxShadow: "none",
60
60
  backgroundImage: "none",
61
- backgroundColor: a.palette.background.paper
61
+ backgroundColor: a.palette.background.paper,
62
+ "& .navmenu.navmenu--inline": {
63
+ margin: 0,
64
+ padding: 0
65
+ }
62
66
  }
63
67
  }
64
68
  },
65
- children: /* @__PURE__ */ o(M, { children: u })
69
+ children: /* @__PURE__ */ o(M, { children: d })
66
70
  }
67
71
  )
68
72
  ]
69
73
  }
70
- ) : /* @__PURE__ */ o(p, { prepend: n, ...s });
74
+ ) : /* @__PURE__ */ o(u, { prepend: n, ...i });
71
75
  }
72
- const C = i(p)`
76
+ const C = s(u)`
73
77
  .header-menu {
74
78
  display: none;
75
79
  }
76
80
  ${(n) => n.theme.breakpoints.down("md")} {
77
81
  .header-menu {
78
82
  display: flex;
79
- margin-right: 12px;
83
+ padding-left: 6px;
84
+ padding-right: 6px;
85
+ min-width: 0;
86
+ margin-left: -4px;
87
+ margin-right: 8px;
80
88
  }
81
89
  }
82
- `, M = i(b)`
90
+ `, M = s(x)`
83
91
  padding-top: 8px;
84
92
  padding-bottom: 16px;
85
93
  .navmenu {
@@ -6,8 +6,8 @@ import { Box as w, useTheme as G } from "@mui/material";
6
6
  import B from "./sub-item-group.js";
7
7
  import { Item as K } from "./nav-menu.js";
8
8
  import { styled as C } from "../Theme/index.js";
9
- import { useNavMenuContext as L } from "./nav-menu-context.js";
10
- import { translate as E } from "../Locale/util.js";
9
+ import { useNavMenuContext as E } from "./nav-menu-context.js";
10
+ import { translate as L } from "../Locale/util.js";
11
11
  import { useLocaleContext as _ } from "../Locale/context.js";
12
12
  import M from "./images/nft-studio.svg.js";
13
13
  import O from "./images/creator-studio.svg.js";
@@ -479,7 +479,7 @@ function o({ to: t, children: c, className: a = "", ...u }) {
479
479
  return W(t) ? /* @__PURE__ */ e(p, { to: ee(t, "header"), target: "_blank", rel: "noreferrer noopener", className: a, ...u, children: c }) : /* @__PURE__ */ e(p, { to: t, className: a, ...u, children: c });
480
480
  }
481
481
  function Fe({ className: t = "", type: c, ...a }) {
482
- const { mode: u } = L(), k = G(), { locale: r = "en" } = _() || {}, l = T(null), { palette: f } = k, i = A((n, d = {}) => E(ie, n, r, "en", d)), [N, D] = $(v), m = A(() => {
482
+ const { mode: u } = E(), k = G(), { locale: r = "en" } = _() || {}, l = T(null), { palette: f } = k, i = A((n, d = {}) => L(ie, n, r, "en", d)), [N, D] = $(v), m = A(() => {
483
483
  if (!l.current) return;
484
484
  const n = l.current.querySelectorAll(".navmenu-item__content");
485
485
  let d = v;
@@ -661,12 +661,12 @@ function Fe({ className: t = "", type: c, ...a }) {
661
661
  {
662
662
  label: /* @__PURE__ */ e(o, { to: "https://www.aigne.io/code-smith", ...n, children: "AIGNE CodeSmith" }),
663
663
  description: i("products.aigneCodeSmith.description"),
664
- icon: /* @__PURE__ */ e(s, { color: "#56a596", backgroundColor: "#e9fcf6" })
664
+ icon: /* @__PURE__ */ e(s, { color: "#3E5DF7", backgroundColor: "#e9f0ff" })
665
665
  },
666
666
  {
667
667
  label: /* @__PURE__ */ e(o, { to: "https://www.aigne.io/doc-smith", ...n, children: "AIGNE DocSmith" }),
668
668
  description: i("products.aigneDocSmith.description"),
669
- icon: /* @__PURE__ */ e(s, { color: "#e46f38", backgroundColor: "#f7e0d7" })
669
+ icon: /* @__PURE__ */ e(s, { color: "#02A996", backgroundColor: "#e6f7f5" })
670
670
  },
671
671
  {
672
672
  label: /* @__PURE__ */ e(o, { to: "https://www.aigne.io/web-smith", ...n, children: "AIGNE WebSmith" }),
@@ -158,7 +158,7 @@ const o = i("nav", {
158
158
  // inline 布局中
159
159
  "&.navmenu-item--inline": {
160
160
  margin: 0,
161
- padding: "0 16px",
161
+ padding: 0,
162
162
  minHeight: "48px",
163
163
  lineHeight: "48px",
164
164
  flexWrap: "wrap"
@@ -207,7 +207,6 @@ const o = i("nav", {
207
207
  position: "static",
208
208
  transform: "none",
209
209
  flex: "1 0 100%",
210
- margin: "0 -16px",
211
210
  padding: 0,
212
211
  height: 0,
213
212
  overflow: "hidden",
@@ -220,7 +219,7 @@ const o = i("nav", {
220
219
  },
221
220
  ".navmenu-sub__list": {
222
221
  padding: 0,
223
- paddingLeft: "16px",
222
+ paddingLeft: "24px",
224
223
  boxShadow: "none"
225
224
  },
226
225
  ".navmenu-item__content": {
@@ -1,4 +1,4 @@
1
- const e = "3.1.40", s = { "@blocklet/js-sdk": "^1.16.49-beta-20250823-082650-626c1473" }, t = {
1
+ const e = "3.1.42", s = { "@blocklet/js-sdk": "^1.16.49-beta-20250823-082650-626c1473" }, t = {
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.1.40",
3
+ "version": "3.1.42",
4
4
  "description": "Common used react components for arcblock products",
5
5
  "keywords": [
6
6
  "react",
@@ -68,16 +68,16 @@
68
68
  "react": "^19.0.0",
69
69
  "react-router-dom": "^6.22.3"
70
70
  },
71
- "gitHead": "5e3ea739c926b972f08cf72e113964ef5a82ddf3",
71
+ "gitHead": "747490bf0ea403cb53f961ae64f0544a75c13703",
72
72
  "dependencies": {
73
- "@arcblock/bridge": "3.1.40",
73
+ "@arcblock/bridge": "3.1.42",
74
74
  "@arcblock/did": "^1.21.3",
75
75
  "@arcblock/did-motif": "^1.1.14",
76
- "@arcblock/icons": "3.1.40",
77
- "@arcblock/nft-display": "3.1.40",
78
- "@arcblock/react-hooks": "3.1.40",
76
+ "@arcblock/icons": "3.1.42",
77
+ "@arcblock/nft-display": "3.1.42",
78
+ "@arcblock/react-hooks": "3.1.42",
79
79
  "@blocklet/js-sdk": "^1.16.49-beta-20250823-082650-626c1473",
80
- "@blocklet/theme": "3.1.40",
80
+ "@blocklet/theme": "3.1.42",
81
81
  "@fontsource/roboto": "~5.1.1",
82
82
  "@fontsource/ubuntu-mono": "^5.2.6",
83
83
  "@iconify-icons/logos": "^1.2.36",
@@ -3,10 +3,19 @@ import {
3
3
  LightModeOutlined as LightModeOutlinedIcon,
4
4
  Brightness2Outlined as Brightness2OutlinedIcon,
5
5
  } from '@mui/icons-material';
6
+ import { useThrottleFn } from 'ahooks';
6
7
  import { useColorScheme } from '../Theme/theme-provider';
7
8
 
8
9
  export default function ThemeModeToggle() {
9
10
  const { mode, toggleMode, prefer } = useColorScheme();
11
+ const { run: toggleModeThrottled } = useThrottleFn(
12
+ () => {
13
+ toggleMode();
14
+ },
15
+ {
16
+ wait: 300,
17
+ }
18
+ );
10
19
 
11
20
  if (!toggleMode) {
12
21
  if (process.env.NODE_ENV !== 'production') {
@@ -19,7 +28,7 @@ export default function ThemeModeToggle() {
19
28
  // 跟随系统才显示切换
20
29
  if (prefer === 'system' || window.blocklet?.theme?.prefer === 'system') {
21
30
  return (
22
- <IconButton onClick={toggleMode}>
31
+ <IconButton onClick={toggleModeThrottled}>
23
32
  {mode === 'light' ? <Brightness2OutlinedIcon /> : <LightModeOutlinedIcon />}
24
33
  </IconButton>
25
34
  );
@@ -195,7 +195,7 @@ const Root = styled(Box)`
195
195
  .header-menu {
196
196
  display: inline-block;
197
197
  }
198
- .header-logo {
198
+ .header-brand-wrapper .header-logo {
199
199
  height: 32px;
200
200
  }
201
201
  .header-brand {
@@ -94,12 +94,16 @@ function ResponsiveHeader({ prepend, children = null, ...rest }: ResponsiveHeade
94
94
  }}
95
95
  slotProps={{
96
96
  paper: {
97
- style: {
97
+ sx: {
98
98
  top: 64,
99
99
  bottom: 0,
100
100
  boxShadow: 'none',
101
101
  backgroundImage: 'none',
102
102
  backgroundColor: theme.palette.background.paper,
103
+ '& .navmenu.navmenu--inline': {
104
+ margin: 0,
105
+ padding: 0,
106
+ },
103
107
  },
104
108
  },
105
109
  }}>
@@ -117,7 +121,11 @@ const Root = styled(Header)`
117
121
  ${(props) => props.theme.breakpoints.down('md')} {
118
122
  .header-menu {
119
123
  display: flex;
120
- margin-right: 12px;
124
+ padding-left: 6px;
125
+ padding-right: 6px;
126
+ min-width: 0;
127
+ margin-left: -4px;
128
+ margin-right: 8px;
121
129
  }
122
130
  }
123
131
  `;
@@ -768,7 +768,7 @@ export default function Products({ className = '', type, ...rest }: ProductsProp
768
768
  </SmartLink>
769
769
  ),
770
770
  description: t('products.aigneCodeSmith.description'),
771
- icon: <AigneIcon color="#56a596" backgroundColor="#e9fcf6" />,
771
+ icon: <AigneIcon color="#3E5DF7" backgroundColor="#e9f0ff" />,
772
772
  },
773
773
  {
774
774
  label: (
@@ -777,7 +777,7 @@ export default function Products({ className = '', type, ...rest }: ProductsProp
777
777
  </SmartLink>
778
778
  ),
779
779
  description: t('products.aigneDocSmith.description'),
780
- icon: <AigneIcon color="#e46f38" backgroundColor="#f7e0d7" />,
780
+ icon: <AigneIcon color="#02A996" backgroundColor="#e6f7f5" />,
781
781
  },
782
782
  {
783
783
  label: (
@@ -173,7 +173,7 @@ export const NavMenuItem = styled('li', {
173
173
  // inline 布局中
174
174
  '&.navmenu-item--inline': {
175
175
  margin: 0,
176
- padding: '0 16px',
176
+ padding: 0,
177
177
  minHeight: '48px',
178
178
  lineHeight: '48px',
179
179
  flexWrap: 'wrap',
@@ -225,7 +225,6 @@ export const NavMenuSub = styled(NavMenuItem)(({ theme }) => ({
225
225
  position: 'static',
226
226
  transform: 'none',
227
227
  flex: '1 0 100%',
228
- margin: '0 -16px',
229
228
  padding: 0,
230
229
  height: 0,
231
230
  overflow: 'hidden',
@@ -238,7 +237,7 @@ export const NavMenuSub = styled(NavMenuItem)(({ theme }) => ({
238
237
  },
239
238
  '.navmenu-sub__list': {
240
239
  padding: 0,
241
- paddingLeft: '16px',
240
+ paddingLeft: '24px',
242
241
  boxShadow: 'none',
243
242
  },
244
243
  '.navmenu-item__content': {