@blocklet/ui-react 2.13.42 → 2.13.43
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/UserCenter/components/editable-field.d.ts +1 -1
- package/lib/UserCenter/components/editable-field.js +13 -3
- package/lib/UserCenter/components/user-info/link-preview-input.js +4 -1
- package/package.json +4 -4
- package/src/UserCenter/components/editable-field.tsx +13 -2
- package/src/UserCenter/components/user-info/link-preview-input.tsx +6 -1
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useState } from "react";
|
|
3
|
-
import
|
|
2
|
+
import React, { useState } from "react";
|
|
3
|
+
import Box from "@mui/material/Box";
|
|
4
|
+
import TextField from "@mui/material/TextField";
|
|
5
|
+
import Typography from "@mui/material/Typography";
|
|
6
|
+
import Tooltip from "@mui/material/Tooltip";
|
|
7
|
+
import useTheme from "@mui/material/styles/useTheme";
|
|
4
8
|
import { useCreation, useMemoizedFn } from "ahooks";
|
|
5
9
|
import { useLocaleContext } from "@arcblock/ux/lib/Locale/context";
|
|
6
10
|
import { translate } from "@arcblock/ux/lib/Locale/util";
|
|
@@ -58,6 +62,8 @@ function EditableField({
|
|
|
58
62
|
hidePreview = false
|
|
59
63
|
}) {
|
|
60
64
|
const { locale } = useLocaleContext();
|
|
65
|
+
const theme = useTheme();
|
|
66
|
+
const isDark = theme.palette.mode === "dark";
|
|
61
67
|
const t = useMemoizedFn((key, data = {}) => {
|
|
62
68
|
return translate(translations, key, locale, "en", data);
|
|
63
69
|
});
|
|
@@ -194,7 +200,11 @@ function EditableField({
|
|
|
194
200
|
alignItems: "center",
|
|
195
201
|
gap: 1,
|
|
196
202
|
children: [
|
|
197
|
-
icon,
|
|
203
|
+
React.cloneElement(icon, {
|
|
204
|
+
style: {
|
|
205
|
+
filter: isDark ? "brightness(0) saturate(100%) invert(1)" : "none"
|
|
206
|
+
}
|
|
207
|
+
}),
|
|
198
208
|
/* @__PURE__ */ jsxs(Box, { display: "flex", flexDirection: "row", alignItems: "center", width: "90%", children: [
|
|
199
209
|
/* @__PURE__ */ jsx(
|
|
200
210
|
Typography,
|
|
@@ -2,6 +2,7 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { Box, Button, FormControl, IconButton, styled, TextField, Typography } from "@mui/material";
|
|
3
3
|
import RemoveIcon from "@mui/icons-material/Remove";
|
|
4
4
|
import AddIcon from "@mui/icons-material/Add";
|
|
5
|
+
import useTheme from "@mui/material/styles/useTheme";
|
|
5
6
|
import { useEffect, useMemo, useState } from "react";
|
|
6
7
|
import { translate } from "@arcblock/ux/lib/Locale/util";
|
|
7
8
|
import { useMemoizedFn } from "ahooks";
|
|
@@ -115,6 +116,8 @@ function DynamicLinkForm({ links = [], onChange }) {
|
|
|
115
116
|
function FaviconPreview({ link }) {
|
|
116
117
|
const [favicon, setFavicon] = useState("");
|
|
117
118
|
const [iconError, setIconError] = useState(false);
|
|
119
|
+
const theme = useTheme();
|
|
120
|
+
const isDark = theme.palette.mode === "dark";
|
|
118
121
|
useEffect(() => {
|
|
119
122
|
try {
|
|
120
123
|
if (link) {
|
|
@@ -142,7 +145,7 @@ function FaviconPreview({ link }) {
|
|
|
142
145
|
return null;
|
|
143
146
|
}
|
|
144
147
|
if (iconError || !favicon) {
|
|
145
|
-
return /* @__PURE__ */ jsx(LinkIcon, { width: 20, height: 20 });
|
|
148
|
+
return /* @__PURE__ */ jsx(LinkIcon, { width: 20, height: 20, style: { filter: isDark ? "brightness(0) saturate(100%) invert(1)" : "none" } });
|
|
146
149
|
}
|
|
147
150
|
return /* @__PURE__ */ jsx("img", { src: favicon, alt: "Favicon", width: 20, height: 20 });
|
|
148
151
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blocklet/ui-react",
|
|
3
|
-
"version": "2.13.
|
|
3
|
+
"version": "2.13.43",
|
|
4
4
|
"description": "Some useful front-end web components that can be used in Blocklets.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -34,8 +34,8 @@
|
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@abtnode/constant": "^1.16.43",
|
|
36
36
|
"@abtnode/util": "^1.16.43",
|
|
37
|
-
"@arcblock/bridge": "^2.13.
|
|
38
|
-
"@arcblock/react-hooks": "^2.13.
|
|
37
|
+
"@arcblock/bridge": "^2.13.43",
|
|
38
|
+
"@arcblock/react-hooks": "^2.13.43",
|
|
39
39
|
"@arcblock/ws": "^1.20.11",
|
|
40
40
|
"@blocklet/constant": "^1.16.43",
|
|
41
41
|
"@blocklet/did-space-react": "^1.0.53",
|
|
@@ -94,5 +94,5 @@
|
|
|
94
94
|
"jest": "^29.7.0",
|
|
95
95
|
"unbuild": "^2.0.0"
|
|
96
96
|
},
|
|
97
|
-
"gitHead": "
|
|
97
|
+
"gitHead": "9b65dc9fcef38218cbf4852cb31a1b76afffab33"
|
|
98
98
|
}
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import React, { useState } from 'react';
|
|
2
|
-
import
|
|
2
|
+
import Box from '@mui/material/Box';
|
|
3
|
+
import TextField from '@mui/material/TextField';
|
|
4
|
+
import Typography from '@mui/material/Typography';
|
|
5
|
+
import Tooltip from '@mui/material/Tooltip';
|
|
6
|
+
import type { TooltipProps } from '@mui/material/Tooltip';
|
|
7
|
+
import useTheme from '@mui/material/styles/useTheme';
|
|
3
8
|
import { useCreation, useMemoizedFn } from 'ahooks';
|
|
4
9
|
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
5
10
|
import { translate } from '@arcblock/ux/lib/Locale/util';
|
|
@@ -83,6 +88,8 @@ function EditableField({
|
|
|
83
88
|
hidePreview = false,
|
|
84
89
|
}: EditableFieldProps) {
|
|
85
90
|
const { locale } = useLocaleContext();
|
|
91
|
+
const theme = useTheme();
|
|
92
|
+
const isDark = theme.palette.mode === 'dark';
|
|
86
93
|
const t = useMemoizedFn((key, data = {}) => {
|
|
87
94
|
return translate(translations, key, locale, 'en', data);
|
|
88
95
|
});
|
|
@@ -223,7 +230,11 @@ function EditableField({
|
|
|
223
230
|
display="flex"
|
|
224
231
|
alignItems="center"
|
|
225
232
|
gap={1}>
|
|
226
|
-
{icon
|
|
233
|
+
{React.cloneElement(icon as React.ReactElement, {
|
|
234
|
+
style: {
|
|
235
|
+
filter: isDark ? 'brightness(0) saturate(100%) invert(1)' : 'none',
|
|
236
|
+
},
|
|
237
|
+
})}
|
|
227
238
|
<Box display="flex" flexDirection="row" alignItems="center" width="90%">
|
|
228
239
|
<Typography
|
|
229
240
|
sx={{
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Box, Button, FormControl, IconButton, styled, TextField, Typography } from '@mui/material';
|
|
2
2
|
import RemoveIcon from '@mui/icons-material/Remove';
|
|
3
3
|
import AddIcon from '@mui/icons-material/Add';
|
|
4
|
+
import useTheme from '@mui/material/styles/useTheme';
|
|
4
5
|
import { ChangeEvent, useEffect, useMemo, useState } from 'react';
|
|
5
6
|
import { translate } from '@arcblock/ux/lib/Locale/util';
|
|
6
7
|
import { useMemoizedFn } from 'ahooks';
|
|
@@ -147,6 +148,8 @@ function DynamicLinkForm({ links = [], onChange }: { links: string[]; onChange:
|
|
|
147
148
|
function FaviconPreview({ link }: { link: string }) {
|
|
148
149
|
const [favicon, setFavicon] = useState('');
|
|
149
150
|
const [iconError, setIconError] = useState(false); // 控制是否显示默认图标
|
|
151
|
+
const theme = useTheme();
|
|
152
|
+
const isDark = theme.palette.mode === 'dark';
|
|
150
153
|
|
|
151
154
|
useEffect(() => {
|
|
152
155
|
try {
|
|
@@ -180,7 +183,9 @@ function FaviconPreview({ link }: { link: string }) {
|
|
|
180
183
|
}
|
|
181
184
|
|
|
182
185
|
if (iconError || !favicon) {
|
|
183
|
-
return
|
|
186
|
+
return (
|
|
187
|
+
<LinkIcon width={20} height={20} style={{ filter: isDark ? 'brightness(0) saturate(100%) invert(1)' : 'none' }} />
|
|
188
|
+
);
|
|
184
189
|
}
|
|
185
190
|
|
|
186
191
|
return <img src={favicon} alt="Favicon" width={20} height={20} />;
|