@blocklet/ui-react 3.1.31 → 3.1.33
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.
- package/lib/Header/index.js +23 -17
- package/package.json +6 -6
- package/src/Header/index.tsx +6 -0
package/lib/Header/index.js
CHANGED
|
@@ -6,14 +6,14 @@ import { ErrorFallback as C } from "@arcblock/ux/lib/ErrorBoundary";
|
|
|
6
6
|
import { styled as H, useTheme as _, deepmerge as w, ThemeProvider as A } from "@arcblock/ux/lib/Theme";
|
|
7
7
|
import { ResponsiveHeader as B } from "@arcblock/ux/lib/Header";
|
|
8
8
|
import L, { Products as R } from "@arcblock/ux/lib/NavMenu";
|
|
9
|
-
import { useLocaleContext as
|
|
10
|
-
import { translate as
|
|
11
|
-
import
|
|
12
|
-
import
|
|
9
|
+
import { useLocaleContext as z } from "@arcblock/ux/lib/Locale/context";
|
|
10
|
+
import { translate as F } from "@arcblock/ux/lib/Locale/util";
|
|
11
|
+
import M from "@arcblock/ux/lib/hooks/use-blocklet-logo";
|
|
12
|
+
import O from "lodash/omit";
|
|
13
13
|
import I from "lodash/isFinite";
|
|
14
|
-
import
|
|
14
|
+
import P from "clsx";
|
|
15
15
|
import W from "../Icon/index.js";
|
|
16
|
-
import { mapRecursive as
|
|
16
|
+
import { mapRecursive as j, flatRecursive as S, matchPaths as U } from "../utils.js";
|
|
17
17
|
import { formatBlockletInfo as G, getLocalizedNavigation as K, publicPath as q } from "../blocklets.js";
|
|
18
18
|
import D from "../common/header-addons.js";
|
|
19
19
|
import { useWalletHiddenTopbar as J } from "../common/wallet-hidden-topbar.js";
|
|
@@ -24,12 +24,18 @@ const V = {
|
|
|
24
24
|
},
|
|
25
25
|
zh: {
|
|
26
26
|
products: "产品"
|
|
27
|
+
},
|
|
28
|
+
"zh-TW": {
|
|
29
|
+
products: "產品"
|
|
30
|
+
},
|
|
31
|
+
ja: {
|
|
32
|
+
products: "製品"
|
|
27
33
|
}
|
|
28
34
|
}, X = (r) => {
|
|
29
35
|
if (!r?.length)
|
|
30
36
|
return { navItems: [], activeId: null };
|
|
31
37
|
let t = 1;
|
|
32
|
-
const c =
|
|
38
|
+
const c = j(r, (e) => {
|
|
33
39
|
const i = e.icon ? /* @__PURE__ */ a(W, { icon: e.icon }) : null;
|
|
34
40
|
if (e.items)
|
|
35
41
|
return {
|
|
@@ -49,7 +55,7 @@ const V = {
|
|
|
49
55
|
description: e.description,
|
|
50
56
|
link: e.link
|
|
51
57
|
};
|
|
52
|
-
}, "items"), l =
|
|
58
|
+
}, "items"), l = S(c), p = U(l.map((e) => e.link));
|
|
53
59
|
return { navItems: c, activeId: p >= 0 ? l[p].id : null };
|
|
54
60
|
};
|
|
55
61
|
function Y({
|
|
@@ -65,14 +71,14 @@ function Y({
|
|
|
65
71
|
...i
|
|
66
72
|
}) {
|
|
67
73
|
J();
|
|
68
|
-
const s = _(), { locale: b } =
|
|
74
|
+
const s = _(), { locale: b } = z() || {}, T = N((o, n = {}) => F(V, o, b, "en", n)), d = f(() => {
|
|
69
75
|
const o = Object.assign({}, window.blocklet, r);
|
|
70
76
|
try {
|
|
71
77
|
return G(o);
|
|
72
78
|
} catch (n) {
|
|
73
79
|
return console.error("Failed to format blocklet info", n, o), o;
|
|
74
80
|
}
|
|
75
|
-
}, [r]), m = f(() => w(s, l), [s, l]),
|
|
81
|
+
}, [r]), m = f(() => w(s, l), [s, l]), x = M({
|
|
76
82
|
meta: r,
|
|
77
83
|
theme: l
|
|
78
84
|
}), { productsOrder: g, productsType: k } = f(() => {
|
|
@@ -90,16 +96,16 @@ function Y({
|
|
|
90
96
|
}, [d]);
|
|
91
97
|
if (!d.appName)
|
|
92
98
|
return null;
|
|
93
|
-
const
|
|
99
|
+
const y = K(d?.navigation?.header, b), v = X(y), { navItems: u, activeId: E } = v;
|
|
94
100
|
return k && Number.isInteger(g) && u.splice(g, 0, {
|
|
95
|
-
label:
|
|
101
|
+
label: T("products"),
|
|
96
102
|
// eslint-disable-next-line react/no-unstable-nested-components
|
|
97
103
|
children: () => /* @__PURE__ */ a(R, { type: k })
|
|
98
104
|
}), /* @__PURE__ */ a(A, { theme: m, children: /* @__PURE__ */ a(
|
|
99
105
|
Z,
|
|
100
106
|
{
|
|
101
107
|
homeLink: c,
|
|
102
|
-
logo: /* @__PURE__ */ a("img", { src:
|
|
108
|
+
logo: /* @__PURE__ */ a("img", { src: x, alt: "logo" }),
|
|
103
109
|
addons: (
|
|
104
110
|
// @ts-ignore
|
|
105
111
|
/* @__PURE__ */ a(
|
|
@@ -112,10 +118,10 @@ function Y({
|
|
|
112
118
|
}
|
|
113
119
|
)
|
|
114
120
|
),
|
|
115
|
-
...
|
|
121
|
+
...O(i, ["bordered"]),
|
|
116
122
|
$bordered: i?.bordered,
|
|
117
123
|
$bgcolor: m.palette.background.default,
|
|
118
|
-
className:
|
|
124
|
+
className: P("blocklet__header", i.className),
|
|
119
125
|
children: p || !u?.length ? null : ({ isMobile: o }) => (
|
|
120
126
|
// @ts-ignore
|
|
121
127
|
/* @__PURE__ */ a(
|
|
@@ -145,9 +151,9 @@ const Z = H(B)`
|
|
|
145
151
|
min-width: 32px;
|
|
146
152
|
}
|
|
147
153
|
}
|
|
148
|
-
`,
|
|
154
|
+
`, xe = $(Q(Y), {
|
|
149
155
|
FallbackComponent: C
|
|
150
156
|
});
|
|
151
157
|
export {
|
|
152
|
-
|
|
158
|
+
xe as default
|
|
153
159
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blocklet/ui-react",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.33",
|
|
4
4
|
"description": "Some useful front-end web components that can be used in Blocklets.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -35,9 +35,9 @@
|
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@abtnode/constant": "^1.16.49-beta-20250823-082650-626c1473",
|
|
37
37
|
"@abtnode/util": "^1.16.49-beta-20250823-082650-626c1473",
|
|
38
|
-
"@arcblock/bridge": "3.1.
|
|
39
|
-
"@arcblock/icons": "3.1.
|
|
40
|
-
"@arcblock/react-hooks": "3.1.
|
|
38
|
+
"@arcblock/bridge": "3.1.33",
|
|
39
|
+
"@arcblock/icons": "3.1.33",
|
|
40
|
+
"@arcblock/react-hooks": "3.1.33",
|
|
41
41
|
"@arcblock/ws": "^1.21.3",
|
|
42
42
|
"@blocklet/constant": "^1.16.49-beta-20250823-082650-626c1473",
|
|
43
43
|
"@blocklet/did-space-react": "^1.1.16",
|
|
@@ -83,7 +83,7 @@
|
|
|
83
83
|
"access": "public"
|
|
84
84
|
},
|
|
85
85
|
"devDependencies": {
|
|
86
|
-
"@arcblock/did-connect-react": "3.1.
|
|
86
|
+
"@arcblock/did-connect-react": "3.1.33",
|
|
87
87
|
"@types/dompurify": "^3.2.0",
|
|
88
88
|
"@types/ua-parser-js": "^0.7.39",
|
|
89
89
|
"@types/validator": "^13.15.2",
|
|
@@ -91,5 +91,5 @@
|
|
|
91
91
|
"jest": "^29.7.0",
|
|
92
92
|
"unbuild": "^2.0.0"
|
|
93
93
|
},
|
|
94
|
-
"gitHead": "
|
|
94
|
+
"gitHead": "14bd43c4a02eb7617981ef48276f2fc493058240"
|
|
95
95
|
}
|