@arcblock/ux 2.13.37 → 2.13.39

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.
@@ -6,5 +6,7 @@ export interface MetricProps {
6
6
  animated?: false | true;
7
7
  LinkComponent?: React.ElementType;
8
8
  prefix?: string;
9
+ iconColor?: string;
10
+ iconStyle?: React.CSSProperties;
9
11
  }
10
- export default function Metric({ icon, value, name, url, animated, LinkComponent, prefix, }: MetricProps): import("react/jsx-runtime").JSX.Element;
12
+ export default function Metric({ icon, value, name, url, animated, LinkComponent, prefix, iconColor, iconStyle, }: MetricProps): import("react/jsx-runtime").JSX.Element;
@@ -1,6 +1,6 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  /* eslint-disable react/no-danger */
3
- import { Link, useTheme } from '@mui/material';
3
+ import { Link } from '@mui/material';
4
4
  import ImageIcon from '../Icon/image';
5
5
  import { styled } from '../Theme';
6
6
  export default function Metric({
@@ -10,11 +10,10 @@ export default function Metric({
10
10
  url = '',
11
11
  animated = false,
12
12
  LinkComponent = Link,
13
- prefix = '/images'
13
+ prefix = '/images',
14
+ iconColor = '#222222',
15
+ iconStyle = {}
14
16
  }) {
15
- const {
16
- palette
17
- } = useTheme();
18
17
  const metric = /*#__PURE__*/_jsxs(_Fragment, {
19
18
  children: [/*#__PURE__*/_jsx("div", {
20
19
  className: "metric__image",
@@ -23,7 +22,8 @@ export default function Metric({
23
22
  alt: typeof name === 'string' ? name : '',
24
23
  size: 30,
25
24
  prefix: prefix,
26
- color: palette.text.primary
25
+ color: iconColor,
26
+ style: iconStyle
27
27
  })
28
28
  }), /*#__PURE__*/_jsxs("div", {
29
29
  children: [/*#__PURE__*/_jsx("div", {
@@ -91,6 +91,9 @@ function BaseThemeProvider({
91
91
  darkSchemeClass = ''
92
92
  }) {
93
93
  const _theme = useMemo(() => {
94
+ if (typeof theme === 'function') {
95
+ return theme;
96
+ }
94
97
  if (isTheme(theme)) return theme;
95
98
 
96
99
  // 是 ThemeOptions 则创建一个 theme
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcblock/ux",
3
- "version": "2.13.37",
3
+ "version": "2.13.39",
4
4
  "description": "Common used react components for arcblock products",
5
5
  "keywords": [
6
6
  "react",
@@ -71,14 +71,14 @@
71
71
  "react": ">=18.2.0",
72
72
  "react-router-dom": ">=6.22.3"
73
73
  },
74
- "gitHead": "68ffad141209821dc8d24962e4f4930a8d5ccd77",
74
+ "gitHead": "c50c5ab905df69e60880c0f127a4d3e9bfc70c1a",
75
75
  "dependencies": {
76
76
  "@arcblock/did-motif": "^1.1.13",
77
- "@arcblock/icons": "^2.13.37",
78
- "@arcblock/nft-display": "^2.13.37",
79
- "@arcblock/react-hooks": "^2.13.37",
77
+ "@arcblock/icons": "^2.13.39",
78
+ "@arcblock/nft-display": "^2.13.39",
79
+ "@arcblock/react-hooks": "^2.13.39",
80
80
  "@babel/plugin-syntax-dynamic-import": "^7.8.3",
81
- "@blocklet/theme": "^2.13.37",
81
+ "@blocklet/theme": "^2.13.39",
82
82
  "@fontsource/roboto": "~5.1.1",
83
83
  "@fontsource/ubuntu-mono": "^5.0.18",
84
84
  "@iconify-icons/logos": "^1.2.36",
@@ -1,5 +1,5 @@
1
1
  /* eslint-disable react/no-danger */
2
- import { Link, useTheme } from '@mui/material';
2
+ import { Link } from '@mui/material';
3
3
 
4
4
  import ImageIcon from '../Icon/image';
5
5
  import { styled } from '../Theme';
@@ -12,6 +12,8 @@ export interface MetricProps {
12
12
  animated?: false | true;
13
13
  LinkComponent?: React.ElementType;
14
14
  prefix?: string;
15
+ iconColor?: string;
16
+ iconStyle?: React.CSSProperties;
15
17
  }
16
18
 
17
19
  export default function Metric({
@@ -22,8 +24,9 @@ export default function Metric({
22
24
  animated = false,
23
25
  LinkComponent = Link,
24
26
  prefix = '/images',
27
+ iconColor = '#222222',
28
+ iconStyle = {},
25
29
  }: MetricProps) {
26
- const { palette } = useTheme();
27
30
  const metric = (
28
31
  <>
29
32
  <div className="metric__image">
@@ -32,7 +35,8 @@ export default function Metric({
32
35
  alt={typeof name === 'string' ? name : ''}
33
36
  size={30}
34
37
  prefix={prefix}
35
- color={palette.text.primary}
38
+ color={iconColor}
39
+ style={iconStyle}
36
40
  />
37
41
  </div>
38
42
  <div>
@@ -129,6 +129,10 @@ function BaseThemeProvider({
129
129
  darkSchemeClass = '',
130
130
  }: BaseThemeProviderProps) {
131
131
  const _theme = useMemo(() => {
132
+ if (typeof theme === 'function') {
133
+ return theme;
134
+ }
135
+
132
136
  if (isTheme(theme)) return theme;
133
137
 
134
138
  // 是 ThemeOptions 则创建一个 theme