@arcblock/ux 3.0.25 → 3.0.27

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/Tag/index.js CHANGED
@@ -5,7 +5,7 @@ import n from "lodash/isUndefined";
5
5
  import { mergeProps as x } from "../Util/index.js";
6
6
  import e from "../Colors/themes/default.js";
7
7
  import { styled as w } from "../Theme/index.js";
8
- const i = {
8
+ const c = {
9
9
  error: {
10
10
  color: e.common.white,
11
11
  backgroundColor: e.error.main
@@ -27,18 +27,18 @@ const i = {
27
27
  backgroundColor: "#222"
28
28
  }
29
29
  };
30
- function a({ ...m }) {
31
- const o = Object.assign({}, m);
30
+ function p({ ...s }) {
31
+ const o = Object.assign({}, s);
32
32
  n(o.type) && (o.type = "primary"), n(o.content) && (o.content = ""), n(o.style) && (o.style = {}), n(o.className) && (o.className = "");
33
- const p = x(o, a, ["style"]), { type: t, content: l, children: y, style: f, className: g, ...d } = p, { palette: s } = b(), c = Object.assign({}, i[t] || i.primary, f);
34
- return s[t] && Object.assign(c, {
35
- color: s[t].contrastText || e.common.white,
36
- backgroundColor: s[t].main
37
- }), /* @__PURE__ */ h(j, { component: "span", className: g, style: c, ...d, children: l || y });
33
+ const m = x(o, p, ["style"]), { type: t, content: l, children: y, style: f, className: g, ...d } = m, { palette: i } = b(), a = Object.assign({}, c[t] || c.primary, f);
34
+ return i[t] && Object.assign(a, {
35
+ color: i[t].contrastText || e.common.white,
36
+ backgroundColor: i[t].main
37
+ }), /* @__PURE__ */ h(j, { component: "span", className: g, style: a, ...d, children: l || y });
38
38
  }
39
- a.propTypes = {
39
+ p.propTypes = {
40
40
  children: r.any.isRequired,
41
- type: r.oneOf(Object.keys(i)),
41
+ type: r.oneOf(Object.keys(c)),
42
42
  content: r.string,
43
43
  className: r.string,
44
44
  style: r.oneOfType([r.object, r.string])
@@ -53,9 +53,9 @@ const j = w(u)`
53
53
  line-height: 20px;
54
54
  font-size: 12px;
55
55
  font-weight: 500;
56
- border-radius: 4px;
56
+ border-radius: ${({ theme: s }) => s.shape.borderRadius * 0.5}px;
57
57
  }
58
58
  `;
59
59
  export {
60
- a as default
60
+ p as default
61
61
  };
@@ -6,18 +6,20 @@ export interface ColorSchemeContextType {
6
6
  changeMode: (mode: PaletteMode) => void;
7
7
  prefer?: Prefer;
8
8
  }
9
- export declare const ColorSchemeContext: import('react').Context<ColorSchemeContextType>;
10
- export declare function useColorScheme(): ColorSchemeContextType;
11
9
  export type UxTheme = ThemeOptions | ((parentTheme: Theme, context?: {
12
10
  mode: PaletteMode;
13
11
  }) => Theme);
14
12
  export type Prefer = 'light' | 'dark' | 'system';
13
+ export declare const ColorSchemeContext: import('react').Context<ColorSchemeContextType>;
14
+ export declare function useColorScheme(): ColorSchemeContextType;
15
15
  interface BaseThemeProviderProps {
16
16
  children?: React.ReactNode;
17
17
  theme?: UxTheme;
18
18
  injectFirst?: boolean;
19
19
  /** 指定一个类名,DarkSchemeStyles 只会作用于带有该类的元素及其后代 */
20
20
  darkSchemeClass?: string;
21
+ /** 禁用样式缓存 */
22
+ disableStyleCache?: boolean;
21
23
  }
22
24
  interface ColorSchemeProviderProps extends BaseThemeProviderProps {
23
25
  prefer?: Prefer;
@@ -1,50 +1,53 @@
1
- import { jsx as m, jsxs as I } from "react/jsx-runtime";
2
- import { createContext as N, use as O, useState as x, useRef as K, useMemo as g, useCallback as B, useEffect as b } from "react";
3
- import { useTheme as R, CssBaseline as V, StyledEngineProvider as W, ThemeProvider as q, GlobalStyles as z } from "@mui/material";
4
- import { deepmerge as Y } from "@mui/utils";
5
- import $ from "lodash/set";
6
- import J from "lodash/isUndefined";
7
- import { useDebounceFn as Q, useCreation as M } from "ahooks";
8
- import { getBlockletThemeOptions as X, BLOCKLET_THEME_PREFER_KEY as h, isValidThemeMode as Z, getDefaultThemePrefer as P } from "@blocklet/theme";
9
- import { useLocationState as ee } from "../hooks/use-location-state.js";
10
- import { createTheme as C, lazyCreateDefaultTheme as te, isUxTheme as oe, isTheme as re } from "./theme.js";
11
- const ne = C(), j = N({});
12
- function A() {
13
- return O(j);
1
+ import { jsx as a, jsxs as K } from "react/jsx-runtime";
2
+ import { createContext as O, use as V, useState as $, useRef as W, useMemo as g, useCallback as y, useEffect as f } from "react";
3
+ import { useTheme as A, CssBaseline as B, StyledEngineProvider as q, ThemeProvider as z, GlobalStyles as Y } from "@mui/material";
4
+ import { deepmerge as J } from "@mui/utils";
5
+ import M from "lodash/set";
6
+ import Q from "lodash/isUndefined";
7
+ import { useDebounceFn as X, useCreation as P } from "ahooks";
8
+ import { getBlockletThemeOptions as Z, BLOCKLET_THEME_PREFER_KEY as h, isValidThemeMode as ee, getDefaultThemePrefer as _ } from "@blocklet/theme";
9
+ import { useLocationState as te } from "../hooks/use-location-state.js";
10
+ import { createTheme as T, lazyCreateDefaultTheme as re, isUxTheme as oe, isTheme as ne } from "./theme.js";
11
+ const se = T(), N = O({});
12
+ function U() {
13
+ return V(N);
14
14
  }
15
- const _ = (i) => i ? i === "system" ? P({ theme: { prefer: "system" } }) : i : P();
16
- function se({ className: i = void 0 }) {
17
- const t = R();
18
- if (t.palette.mode === "dark") {
19
- const n = "transparent", s = t.palette.grey[300], o = (i || "").trim().split(/\s+/).filter(Boolean).map((d) => d.startsWith(".") ? d : `.${d}`).join(" "), u = o ? `${o}::-webkit-scrollbar, ${o} *::-webkit-scrollbar` : "*::-webkit-scrollbar", r = o ? `${o}::-webkit-scrollbar-track, ${o} *::-webkit-scrollbar-track` : "*::-webkit-scrollbar-track", a = o ? `${o}::-webkit-scrollbar-thumb, ${o} *::-webkit-scrollbar-thumb` : "*::-webkit-scrollbar-thumb", c = o ? `${o}, ${o} *` : "*";
20
- return /* @__PURE__ */ m(
21
- z,
15
+ const D = (i) => i ? i === "system" ? _({ theme: { prefer: "system" } }) : i : _();
16
+ function L({ className: i = void 0 }) {
17
+ const r = A();
18
+ if (r.palette.mode === "dark") {
19
+ const n = "transparent", s = r.palette.grey[300], t = (i || "").trim().split(/\s+/).filter(Boolean).map((m) => m.startsWith(".") ? m : `.${m}`).join(" "), d = t ? `${t}::-webkit-scrollbar, ${t} *::-webkit-scrollbar` : "*::-webkit-scrollbar", o = t ? `${t}::-webkit-scrollbar-track, ${t} *::-webkit-scrollbar-track` : "*::-webkit-scrollbar-track", c = t ? `${t}::-webkit-scrollbar-thumb, ${t} *::-webkit-scrollbar-thumb` : "*::-webkit-scrollbar-thumb", u = t ? `${t}::-webkit-scrollbar-corner, ${t} *::-webkit-scrollbar-corner` : "*::-webkit-scrollbar-corner", k = t ? `${t}, ${t} *` : "*";
20
+ return /* @__PURE__ */ a(
21
+ Y,
22
22
  {
23
23
  styles: {
24
24
  // Chrome, Safari, Edge
25
25
  "@supports selector(::-webkit-scrollbar)": {
26
- [u]: {
26
+ [d]: {
27
27
  width: "12px",
28
28
  height: "12px"
29
29
  },
30
- [r]: {
30
+ [o]: {
31
31
  background: n
32
32
  },
33
- [a]: {
33
+ [c]: {
34
34
  background: s,
35
35
  borderRadius: "6px",
36
36
  border: "2px solid",
37
37
  borderColor: n,
38
38
  backgroundClip: "padding-box",
39
39
  "&:hover": {
40
- background: t.palette.grey[400],
40
+ background: r.palette.grey[400],
41
41
  backgroundClip: "padding-box"
42
42
  }
43
+ },
44
+ [u]: {
45
+ background: n
43
46
  }
44
47
  },
45
48
  // Firefox
46
49
  "@supports not selector(::-webkit-scrollbar)": {
47
- [c]: {
50
+ [k]: {
48
51
  scrollbarWidth: "auto",
49
52
  scrollbarColor: `${s} ${n}`
50
53
  }
@@ -55,101 +58,102 @@ function se({ className: i = void 0 }) {
55
58
  }
56
59
  return null;
57
60
  }
58
- let D = !1;
59
- const L = {};
60
- function U({
61
+ let R = !1;
62
+ const j = {};
63
+ function F({
61
64
  children: i = null,
62
- theme: t = ne,
65
+ theme: r = se,
63
66
  injectFirst: n = !0,
64
- darkSchemeClass: s = ""
67
+ darkSchemeClass: s = "",
68
+ disableStyleCache: t = !1
65
69
  }) {
66
- const o = g(() => typeof t == "function" || re(t) ? t : C(t), [t]), u = M(() => D ? null : (D = !0, /* @__PURE__ */ m(V, {})), []), r = M(() => L[s] ? null : (L[s] = !0, /* @__PURE__ */ m(se, { className: s })), [s]);
70
+ const d = g(() => typeof r == "function" || ne(r) ? r : T(r), [r]), o = P(() => t ? /* @__PURE__ */ a(B, {}) : R ? null : (R = !0, /* @__PURE__ */ a(B, {})), [t]), c = P(() => t ? /* @__PURE__ */ a(L, { className: s }) : j[s] ? null : (j[s] = !0, /* @__PURE__ */ a(L, { className: s })), [s, t]);
67
71
  return (
68
72
  // injectFirst 会影响 makeStyles 自定义样式和 mui styles 覆盖问题
69
- /* @__PURE__ */ m(W, { injectFirst: n, children: /* @__PURE__ */ I(q, { theme: o, children: [
70
- u,
71
- r,
73
+ /* @__PURE__ */ a(q, { injectFirst: n, children: /* @__PURE__ */ K(z, { theme: d, children: [
74
+ o,
75
+ c,
72
76
  i
73
77
  ] }) })
74
78
  );
75
79
  }
76
80
  function le({
77
81
  children: i = null,
78
- theme: t = void 0,
82
+ theme: r = void 0,
79
83
  prefer: n = void 0,
80
84
  disableBlockletTheme: s = !1,
81
- ...o
85
+ ...t
82
86
  }) {
83
- const u = A(), [r, a] = x(() => _(n)), [c, d] = x(null), p = R(), k = ee(), f = K(null), S = J(u.toggleMode), { run: w } = Q(
87
+ const d = U(), [o, c] = $(() => D(n)), [u, k] = $(null), m = A(), p = te(), b = W(null), C = Q(d.toggleMode), { run: S } = X(
84
88
  (e) => {
85
- d(e);
89
+ k(e);
86
90
  },
87
91
  {
88
92
  wait: 200
89
93
  }
90
94
  ), v = g(() => {
91
95
  let e = {};
92
- if (t) {
93
- const G = te(r);
94
- if (typeof t == "function") {
95
- const H = G();
96
- oe(p) ? e = { ...t(p, { mode: r }) } : e = { ...t(H, { mode: r }) };
96
+ if (r) {
97
+ const H = re(o);
98
+ if (typeof r == "function") {
99
+ const I = H();
100
+ oe(m) ? e = { ...r(m, { mode: o }) } : e = { ...r(I, { mode: o }) };
97
101
  } else
98
- e = { ...t };
102
+ e = { ...r };
99
103
  }
100
- let l = r;
101
- return c && (l = c.mode || "light", e = Y(e, X(l, c))), $(e, "palette.mode", l), $(e, "mode", l), e;
102
- }, [r, t, p, c]), T = g(() => C({ ...v, disableBlockletTheme: !!c || s }), [v, s, c]), E = B(() => {
103
- const e = r === "light" ? "dark" : "light";
104
- a(e), sessionStorage.removeItem(h), localStorage.setItem(h, e);
105
- }, [r, a]), y = B(
104
+ let l = o;
105
+ return u && (l = u.mode || "light", e = J(e, Z(l, u))), M(e, "palette.mode", l), M(e, "mode", l), e;
106
+ }, [o, r, m, u]), w = g(() => T({ ...v, disableBlockletTheme: !!u || s }), [v, s, u]), E = y(() => {
107
+ const e = o === "light" ? "dark" : "light";
108
+ c(e), sessionStorage.removeItem(h), localStorage.setItem(h, e);
109
+ }, [o, c]), x = y(
106
110
  (e) => {
107
- r !== e && (a(e), sessionStorage.removeItem(h), localStorage.setItem(h, e));
111
+ o !== e && (c(e), sessionStorage.removeItem(h), localStorage.setItem(h, e));
108
112
  },
109
- [r, a]
110
- ), F = g(
113
+ [o, c]
114
+ ), G = g(
111
115
  () => ({
112
- mode: r,
116
+ mode: o,
113
117
  toggleMode: E,
114
- changeMode: y,
118
+ changeMode: x,
115
119
  prefer: n
116
120
  }),
117
- [r, n, E, y]
121
+ [o, n, E, x]
118
122
  );
119
- return b(() => {
120
- a(_(n));
121
- }, [n, a, k.search]), b(() => {
122
- const e = new URLSearchParams(k.search).get("theme");
123
- Z(e) && sessionStorage.setItem(h, e);
124
- }, [k.search]), b(() => {
125
- f.current || (f.current = document.querySelector('meta[name="theme-color"]'));
126
- const e = T.palette.background.default;
127
- if (f.current)
128
- f.current.setAttribute("content", e);
123
+ return f(() => {
124
+ c(D(n));
125
+ }, [n, c, p.search]), f(() => {
126
+ const e = new URLSearchParams(p.search).get("theme");
127
+ ee(e) && sessionStorage.setItem(h, e);
128
+ }, [p.search]), f(() => {
129
+ b.current || (b.current = document.querySelector('meta[name="theme-color"]'));
130
+ const e = w.palette.background.default;
131
+ if (b.current)
132
+ b.current.setAttribute("content", e);
129
133
  else {
130
134
  const l = document.createElement("meta");
131
- l.name = "theme-color", l.content = e, document.head.appendChild(l), f.current = l;
135
+ l.name = "theme-color", l.content = e, document.head.appendChild(l), b.current = l;
132
136
  }
133
- }, [T.palette.background.default]), b(() => {
137
+ }, [w.palette.background.default]), f(() => {
134
138
  const e = (l) => {
135
- l.origin === window.origin && l.data.type === "THEME_BUILDER_CONFIG_CHANGED" && w(l.data.payload);
139
+ l.origin === window.origin && l.data.type === "THEME_BUILDER_CONFIG_CHANGED" && S(l.data.payload);
136
140
  };
137
141
  return window.addEventListener("message", e), () => window.removeEventListener("message", e);
138
- }, [w]), b(() => {
139
- S && (r === "dark" ? document.documentElement.setAttribute("data-theme", "dark") : document.documentElement.removeAttribute("data-theme"));
140
- }, [S, r]), /* @__PURE__ */ m(j, { value: F, children: /* @__PURE__ */ m(U, { theme: T, ...o, children: i }) });
142
+ }, [S]), f(() => {
143
+ C && (o === "dark" ? document.documentElement.setAttribute("data-theme", "dark") : document.documentElement.removeAttribute("data-theme"));
144
+ }, [C, o]), /* @__PURE__ */ a(N, { value: G, children: /* @__PURE__ */ a(F, { theme: w, ...t, children: i }) });
141
145
  }
142
- function pe({
146
+ function ke({
143
147
  children: i = null,
144
- prefer: t = void 0,
148
+ prefer: r = void 0,
145
149
  enableColorScheme: n = !1,
146
150
  ...s
147
151
  }) {
148
- const { toggleMode: o } = A();
149
- return n || t || !o ? /* @__PURE__ */ m(le, { prefer: t, ...s, children: i }) : /* @__PURE__ */ m(U, { ...s, children: i });
152
+ const { toggleMode: t } = U();
153
+ return n || r || !t ? /* @__PURE__ */ a(le, { prefer: r, ...s, children: i }) : /* @__PURE__ */ a(F, { ...s, children: i });
150
154
  }
151
155
  export {
152
- j as ColorSchemeContext,
153
- pe as default,
154
- A as useColorScheme
156
+ N as ColorSchemeContext,
157
+ ke as default,
158
+ U as useColorScheme
155
159
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcblock/ux",
3
- "version": "3.0.25",
3
+ "version": "3.0.27",
4
4
  "description": "Common used react components for arcblock products",
5
5
  "keywords": [
6
6
  "react",
@@ -60,16 +60,16 @@
60
60
  "react": "^19.0.0",
61
61
  "react-router-dom": "^6.22.3"
62
62
  },
63
- "gitHead": "4f1f8b69bdd71bd8dee091312a9923e6fb9b8f41",
63
+ "gitHead": "b1e137e0c74f4b58af16b1d75a65166b163cf65d",
64
64
  "dependencies": {
65
- "@arcblock/bridge": "3.0.25",
65
+ "@arcblock/bridge": "3.0.27",
66
66
  "@arcblock/did": "^1.20.15",
67
67
  "@arcblock/did-motif": "^1.1.14",
68
- "@arcblock/icons": "3.0.25",
69
- "@arcblock/nft-display": "3.0.25",
70
- "@arcblock/react-hooks": "3.0.25",
68
+ "@arcblock/icons": "3.0.27",
69
+ "@arcblock/nft-display": "3.0.27",
70
+ "@arcblock/react-hooks": "3.0.27",
71
71
  "@blocklet/js-sdk": "^1.16.46",
72
- "@blocklet/theme": "3.0.25",
72
+ "@blocklet/theme": "3.0.27",
73
73
  "@fontsource/roboto": "~5.1.1",
74
74
  "@fontsource/ubuntu-mono": "^5.2.6",
75
75
  "@iconify-icons/logos": "^1.2.36",
@@ -120,7 +120,9 @@ export default function CodeBlock({
120
120
  }
121
121
 
122
122
  const fontFamily = 'source-code-pro, Menlo, Monaco, Consolas, Courier New, monospace !important';
123
- const Pre = styled('pre')`
123
+ const Pre = styled('pre', {
124
+ shouldForwardProp: (prop) => prop !== 'sx',
125
+ })`
124
126
  font-family: ${fontFamily};
125
127
  display: block;
126
128
  font-size: 14px;
@@ -130,9 +132,10 @@ const Pre = styled('pre')`
130
132
  word-wrap: break-word;
131
133
  text-align: left;
132
134
  border-radius: 5px;
133
- border: 1px solid #dedede;
134
- background: #222;
135
- color: ${colors.common.white};
135
+ border: 1px solid;
136
+ border-color: ${({ theme }) => theme.palette.divider};
137
+ background: ${({ theme }) => theme.palette.background.default};
138
+ color: ${({ theme }) => theme.palette.common.white};
136
139
  position: relative;
137
140
 
138
141
  .codeblock__inner {
@@ -20,6 +20,7 @@ export function ConfigProvider({
20
20
  prefer,
21
21
  disableBlockletTheme = false,
22
22
  enableColorScheme,
23
+ disableStyleCache,
23
24
  // locale provider
24
25
  locale,
25
26
  fallbackLocale,
@@ -34,7 +35,8 @@ export function ConfigProvider({
34
35
  darkSchemeClass={darkSchemeClass}
35
36
  prefer={prefer}
36
37
  disableBlockletTheme={disableBlockletTheme}
37
- enableColorScheme={enableColorScheme}>
38
+ enableColorScheme={enableColorScheme}
39
+ disableStyleCache={disableStyleCache}>
38
40
  <LocaleProvider
39
41
  locale={locale}
40
42
  fallbackLocale={fallbackLocale}
@@ -0,0 +1,84 @@
1
+ import Modal from '@mui/material/Modal';
2
+ import styled from '@emotion/styled';
3
+ import NFTDisplay, { getNFTData } from '.';
4
+
5
+ export interface NftInfo {
6
+ address: string;
7
+ data: Record<string, any>;
8
+ display: Record<string, any>;
9
+ issuer: string;
10
+ }
11
+
12
+ export default function NftPreview({
13
+ visible,
14
+ onClose,
15
+ nft,
16
+ }: {
17
+ visible: boolean;
18
+ onClose: () => void;
19
+ nft: NftInfo | null;
20
+ }) {
21
+ if (!visible || !nft) {
22
+ return null;
23
+ }
24
+
25
+ return (
26
+ <NftPreviewRoot>
27
+ {/* Preview Modal */}
28
+ <Modal open={visible} onClose={onClose}>
29
+ <ModalRoot onClick={onClose}>
30
+ <NFTDisplay data={getNFTData(nft)} address={nft.address} inset />
31
+ </ModalRoot>
32
+ </Modal>
33
+ </NftPreviewRoot>
34
+ );
35
+ }
36
+
37
+ const NftPreviewRoot = styled.div`
38
+ position: relative;
39
+ width: 100%;
40
+ height: 100%;
41
+ cursor: pointer;
42
+
43
+ &:hover {
44
+ .mask {
45
+ opacity: 1;
46
+ }
47
+ }
48
+
49
+ .mask {
50
+ position: absolute;
51
+ top: 0;
52
+ left: 0;
53
+ display: flex;
54
+ align-items: center;
55
+ justify-content: center;
56
+ width: 100%;
57
+ height: 100%;
58
+ background: rgba(0, 0, 0, 0.6);
59
+ opacity: 0;
60
+ transition: opacity 0.2s;
61
+ }
62
+ `;
63
+
64
+ const ModalRoot = styled.div`
65
+ display: flex;
66
+ justify-content: center;
67
+ align-items: center;
68
+ height: 100vh;
69
+ width: 100vw;
70
+
71
+ img,
72
+ object {
73
+ max-width: 90vw;
74
+ max-height: 75vh;
75
+ }
76
+
77
+ .nft-display--inset {
78
+ > .MuiBox-root,
79
+ .nft-display__loading {
80
+ width: 75vmin;
81
+ height: 75vmin;
82
+ }
83
+ }
84
+ `;
@@ -141,7 +141,7 @@ export const NavMenuItem = styled('li', {
141
141
  '.navmenu-item__desc': {
142
142
  fontSize: '12px',
143
143
  lineHeight: 1,
144
- color: theme.palette.grey[500],
144
+ color: theme.palette.text.secondary,
145
145
  },
146
146
  '&:hover': {
147
147
  background: theme.palette.action.hover,
@@ -73,6 +73,7 @@ export interface RelativeTimeProps {
73
73
  placement?: TooltipProps['placement'];
74
74
  sx?: SxProps;
75
75
  format?: string;
76
+ mode?: 'all' | 'daysLeft'; // all: 显示所有内容,daysLeft: 只显示剩余天数
76
77
  }
77
78
 
78
79
  function useRelativeTime({
@@ -194,7 +195,6 @@ function UTCChip({
194
195
  color: 'inherit',
195
196
  cursor: 'pointer',
196
197
  border: '1px solid',
197
- fontSize: '0.8rem',
198
198
  borderColor: 'divider',
199
199
  borderRadius: '20px',
200
200
  padding: '4px 8px',
@@ -220,6 +220,7 @@ export default function RelativeTime({
220
220
  disableTimezone = false,
221
221
  placement = 'top-end',
222
222
  format = 'lll',
223
+ mode = 'all',
223
224
  ...rest
224
225
  }: RelativeTimeProps) {
225
226
  const { innerContent, popContent, isUtc, setIsUtc, relativeString } = useRelativeTime({
@@ -234,41 +235,54 @@ export default function RelativeTime({
234
235
  format,
235
236
  });
236
237
 
237
- if (type === 'all') {
238
- return (
239
- <Tooltip title={undefined} placement={placement} enterTouchDelay={0}>
240
- <Box
241
- {...rest}
242
- sx={[
243
- {
244
- display: 'inline-flex',
245
- alignItems: 'center',
246
- gap: 0.5,
247
- },
248
- ...(Array.isArray(rest.sx) ? rest.sx : [rest.sx]),
249
- ]}>
250
- <Box component="span" {...rest} sx={{}}>
251
- {innerContent}
252
- </Box>
238
+ const allContent = (
239
+ <Box
240
+ {...rest}
241
+ sx={[
242
+ {
243
+ display: 'inline-flex',
244
+ alignItems: 'center',
245
+ gap: 0.5,
246
+ },
247
+ ...(Array.isArray(rest.sx) ? rest.sx : [rest.sx]),
248
+ ]}>
249
+ <Box component="span" {...rest} sx={{}}>
250
+ {innerContent}
251
+ </Box>
252
+
253
+ <Box component="span" sx={{ color: 'inherit' }}>
254
+ ·
255
+ </Box>
256
+
257
+ <Box component="span" sx={{ color: 'inherit' }}>
258
+ {relativeString}
259
+ </Box>
253
260
 
261
+ {!disableTimezone && (
262
+ <>
254
263
  <Box component="span" sx={{ color: 'inherit' }}>
255
264
  ·
256
265
  </Box>
257
266
 
258
- <Box component="span" sx={{ color: 'text.secondary' }}>
259
- {relativeString}
260
- </Box>
267
+ <UTCChip locale={locale} isUtc={isUtc} setIsUtc={setIsUtc} useShortTimezone={useShortTimezone} />
268
+ </>
269
+ )}
270
+ </Box>
271
+ );
261
272
 
262
- {!disableTimezone && (
263
- <>
264
- <Box component="span" sx={{ color: 'inherit' }}>
265
- ·
266
- </Box>
273
+ // 优先通过 mode 来决定显示什么内容
274
+ if (mode === 'daysLeft') {
275
+ return (
276
+ <Tooltip title={allContent} placement={placement} enterTouchDelay={0}>
277
+ <Box component="span">{relativeString}</Box>
278
+ </Tooltip>
279
+ );
280
+ }
267
281
 
268
- <UTCChip locale={locale} isUtc={isUtc} setIsUtc={setIsUtc} useShortTimezone={useShortTimezone} />
269
- </>
270
- )}
271
- </Box>
282
+ if (type === 'all' && mode === 'all') {
283
+ return (
284
+ <Tooltip title={undefined} placement={placement} enterTouchDelay={0}>
285
+ {allContent}
272
286
  </Tooltip>
273
287
  );
274
288
  }
package/src/Tag/index.jsx CHANGED
@@ -101,6 +101,6 @@ const Span = styled(Typography)`
101
101
  line-height: 20px;
102
102
  font-size: 12px;
103
103
  font-weight: 500;
104
- border-radius: 4px;
104
+ border-radius: ${({ theme }) => theme.shape.borderRadius * 0.5}px;
105
105
  }
106
106
  `;
@@ -4,6 +4,7 @@ export { default as Shadows } from './demo/shadows';
4
4
  export { default as WithCustomKey } from './demo/with-custom-key';
5
5
  export { default as CustomFonts } from './demo/custom-fonts';
6
6
  export { default as UrlTheme } from './demo/url-theme';
7
+ export { default as CodeBlock } from './demo/code-block';
7
8
 
8
9
  export default {
9
10
  title: 'Theme/Theme',