@arcblock/ux 2.12.60 → 2.12.62
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/Config/config-provider.js +5 -1
- package/lib/NavMenu/nav-menu.js +1 -0
- package/lib/NavMenu/products.js +1 -1
- package/lib/NavMenu/style.js +2 -0
- package/lib/NavMenu/sub-container.d.ts +2 -1
- package/lib/NavMenu/sub-container.js +11 -2
- package/package.json +5 -5
- package/src/Config/config-provider.tsx +2 -1
- package/src/NavMenu/nav-menu.tsx +1 -1
- package/src/NavMenu/products.tsx +1 -1
- package/src/NavMenu/style.ts +1 -0
- package/src/NavMenu/sub-container.tsx +16 -2
@@ -2,6 +2,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { createContext, useContext, useMemo, useState, useCallback, useEffect } from 'react';
|
3
3
|
import useMediaQuery from '@mui/material/useMediaQuery';
|
4
4
|
import set from 'lodash/set';
|
5
|
+
import { ThemeProvider as EmotionThemeProvider } from '@emotion/react';
|
5
6
|
import { LocaleProvider, useLocaleContext } from '../Locale/context';
|
6
7
|
import ThemeProvider from '../Theme/theme-provider';
|
7
8
|
import { createTheme, useTheme } from '../Theme';
|
@@ -85,7 +86,10 @@ export function ConfigProvider({
|
|
85
86
|
children: /*#__PURE__*/_jsx(ThemeProvider, {
|
86
87
|
theme: theme,
|
87
88
|
injectFirst: injectFirst,
|
88
|
-
children:
|
89
|
+
children: /*#__PURE__*/_jsx(EmotionThemeProvider, {
|
90
|
+
theme: theme,
|
91
|
+
children: children
|
92
|
+
})
|
89
93
|
})
|
90
94
|
})
|
91
95
|
});
|
package/lib/NavMenu/nav-menu.js
CHANGED
package/lib/NavMenu/products.js
CHANGED
@@ -1562,7 +1562,7 @@ export default function Products({
|
|
1562
1562
|
icon: /*#__PURE__*/_jsx(BlockletServerSvg, {})
|
1563
1563
|
}, {
|
1564
1564
|
label: /*#__PURE__*/_jsx(Link, {
|
1565
|
-
to: `https://www.arcblock.io/content/collections/${locale}/
|
1565
|
+
to: `https://www.arcblock.io/content/collections/${locale}/ocap`,
|
1566
1566
|
target: "_blank",
|
1567
1567
|
rel: "noreferrer noopener",
|
1568
1568
|
children: "\u041E\u0421\u0410\u0420"
|
package/lib/NavMenu/style.js
CHANGED
@@ -45,6 +45,8 @@ export const NavMenuItem = styled('li', {
|
|
45
45
|
transition: theme.transitions.create('color', {
|
46
46
|
duration: theme.transitions.duration.standard
|
47
47
|
}),
|
48
|
+
'-webkit-tap-highlight-color': 'transparent',
|
49
|
+
// 禁用触摸反馈
|
48
50
|
// 间距调整
|
49
51
|
'&:first-of-type': {
|
50
52
|
paddingLeft: 0
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import React from 'react';
|
2
2
|
interface SubContainerProps extends React.HTMLAttributes<HTMLDivElement> {
|
3
3
|
children: React.ReactNode;
|
4
|
+
inline?: false | true;
|
4
5
|
}
|
5
|
-
export declare function SubContainer({ children, ...props }: SubContainerProps): import("react/jsx-runtime").JSX.Element;
|
6
|
+
export declare function SubContainer({ children, inline, ...props }: SubContainerProps): import("react/jsx-runtime").JSX.Element;
|
6
7
|
export default SubContainer;
|
@@ -6,6 +6,7 @@ const paddingTop = 8;
|
|
6
6
|
// 下拉子菜单容器
|
7
7
|
export function SubContainer({
|
8
8
|
children,
|
9
|
+
inline = false,
|
9
10
|
...props
|
10
11
|
}) {
|
11
12
|
const rootRef = useRef(null);
|
@@ -16,6 +17,14 @@ export function SubContainer({
|
|
16
17
|
const {
|
17
18
|
run: updatePosition
|
18
19
|
} = useThrottleFn(() => {
|
20
|
+
// 移动端无需计算
|
21
|
+
if (inline) {
|
22
|
+
setPosition(0);
|
23
|
+
if (!positionUpdated) {
|
24
|
+
setPositionUpdated(true);
|
25
|
+
}
|
26
|
+
return;
|
27
|
+
}
|
19
28
|
if (!rootRef.current || !contentRef.current) return;
|
20
29
|
const anchor = rootRef.current.parentElement; // 以父容器作为参照
|
21
30
|
if (!anchor) return;
|
@@ -91,8 +100,8 @@ export function SubContainer({
|
|
91
100
|
...props,
|
92
101
|
children: /*#__PURE__*/_jsx("div", {
|
93
102
|
style: {
|
94
|
-
display: 'inline-block',
|
95
|
-
boxShadow: '0px 40px 60px rgba(0, 0, 0, 0.08)'
|
103
|
+
display: inline ? 'block' : 'inline-block',
|
104
|
+
boxShadow: inline ? 'none' : '0px 40px 60px rgba(0, 0, 0, 0.08)'
|
96
105
|
},
|
97
106
|
ref: contentRef,
|
98
107
|
children: children
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@arcblock/ux",
|
3
|
-
"version": "2.12.
|
3
|
+
"version": "2.12.62",
|
4
4
|
"description": "Common used react components for arcblock products",
|
5
5
|
"keywords": [
|
6
6
|
"react",
|
@@ -70,12 +70,12 @@
|
|
70
70
|
"react": ">=18.2.0",
|
71
71
|
"react-router-dom": ">=6.22.3"
|
72
72
|
},
|
73
|
-
"gitHead": "
|
73
|
+
"gitHead": "30267c6d2ad1fdc5ce8c13c6d2323c8b7c58ee65",
|
74
74
|
"dependencies": {
|
75
75
|
"@arcblock/did-motif": "^1.1.13",
|
76
|
-
"@arcblock/icons": "^2.12.
|
77
|
-
"@arcblock/nft-display": "^2.12.
|
78
|
-
"@arcblock/react-hooks": "^2.12.
|
76
|
+
"@arcblock/icons": "^2.12.62",
|
77
|
+
"@arcblock/nft-display": "^2.12.62",
|
78
|
+
"@arcblock/react-hooks": "^2.12.62",
|
79
79
|
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
|
80
80
|
"@fontsource/roboto": "^5.2.5",
|
81
81
|
"@fontsource/ubuntu-mono": "^5.0.18",
|
@@ -2,6 +2,7 @@ import { createContext, useContext, ReactNode, useMemo, useState, useCallback, u
|
|
2
2
|
import type { ThemeOptions } from '@mui/material/styles';
|
3
3
|
import useMediaQuery from '@mui/material/useMediaQuery';
|
4
4
|
import set from 'lodash/set';
|
5
|
+
import { ThemeProvider as EmotionThemeProvider } from '@emotion/react';
|
5
6
|
import { LocaleProvider, LocaleProviderProps, useLocaleContext } from '../Locale/context';
|
6
7
|
import ThemeProvider, { ThemeProviderProps } from '../Theme/theme-provider';
|
7
8
|
import { createTheme, useTheme } from '../Theme';
|
@@ -113,7 +114,7 @@ export function ConfigProvider({
|
|
113
114
|
onLoadingTranslation={onLoadingTranslation}
|
114
115
|
languages={languages}>
|
115
116
|
<ThemeProvider theme={theme} injectFirst={injectFirst}>
|
116
|
-
{children}
|
117
|
+
<EmotionThemeProvider theme={theme}>{children}</EmotionThemeProvider>
|
117
118
|
</ThemeProvider>
|
118
119
|
</LocaleProvider>
|
119
120
|
</ConfigContext.Provider>
|
package/src/NavMenu/nav-menu.tsx
CHANGED
@@ -395,7 +395,7 @@ export const Sub = forwardRef<HTMLLIElement, SubProps>(
|
|
395
395
|
{typeof expandIcon === 'function' ? expandIcon({ isOpen }) : expandIcon}
|
396
396
|
</span>
|
397
397
|
)}
|
398
|
-
<SubContainer {...containerProps}>
|
398
|
+
<SubContainer inline={isInlineMode} {...containerProps}>
|
399
399
|
{typeof children === 'function' ? (
|
400
400
|
children({ isOpen }) // 自定义渲染
|
401
401
|
) : (
|
package/src/NavMenu/products.tsx
CHANGED
@@ -344,7 +344,7 @@ export default function Products({ className, isOpen, ...rest }: ProductsProps)
|
|
344
344
|
{
|
345
345
|
label: (
|
346
346
|
<Link
|
347
|
-
to={`https://www.arcblock.io/content/collections/${locale}/
|
347
|
+
to={`https://www.arcblock.io/content/collections/${locale}/ocap`}
|
348
348
|
target="_blank"
|
349
349
|
rel="noreferrer noopener">
|
350
350
|
ОСАР
|
package/src/NavMenu/style.ts
CHANGED
@@ -49,6 +49,7 @@ export const NavMenuItem = styled('li', {
|
|
49
49
|
transition: theme.transitions.create('color', {
|
50
50
|
duration: theme.transitions.duration.standard,
|
51
51
|
}),
|
52
|
+
'-webkit-tap-highlight-color': 'transparent', // 禁用触摸反馈
|
52
53
|
// 间距调整
|
53
54
|
'&:first-of-type': {
|
54
55
|
paddingLeft: 0,
|
@@ -3,12 +3,13 @@ import React, { useEffect, useRef, useState } from 'react';
|
|
3
3
|
|
4
4
|
interface SubContainerProps extends React.HTMLAttributes<HTMLDivElement> {
|
5
5
|
children: React.ReactNode;
|
6
|
+
inline?: false | true;
|
6
7
|
}
|
7
8
|
|
8
9
|
const paddingTop = 8;
|
9
10
|
|
10
11
|
// 下拉子菜单容器
|
11
|
-
export function SubContainer({ children, ...props }: SubContainerProps) {
|
12
|
+
export function SubContainer({ children, inline = false, ...props }: SubContainerProps) {
|
12
13
|
const rootRef = useRef<HTMLDivElement>(null);
|
13
14
|
const contentRef = useRef<HTMLDivElement>(null);
|
14
15
|
const [positionUpdated, setPositionUpdated] = useState(false);
|
@@ -16,6 +17,14 @@ export function SubContainer({ children, ...props }: SubContainerProps) {
|
|
16
17
|
|
17
18
|
const { run: updatePosition } = useThrottleFn(
|
18
19
|
() => {
|
20
|
+
// 移动端无需计算
|
21
|
+
if (inline) {
|
22
|
+
setPosition(0);
|
23
|
+
if (!positionUpdated) {
|
24
|
+
setPositionUpdated(true);
|
25
|
+
}
|
26
|
+
return;
|
27
|
+
}
|
19
28
|
if (!rootRef.current || !contentRef.current) return;
|
20
29
|
const anchor = rootRef.current.parentElement; // 以父容器作为参照
|
21
30
|
if (!anchor) return;
|
@@ -101,7 +110,12 @@ export function SubContainer({ children, ...props }: SubContainerProps) {
|
|
101
110
|
overflow: positionUpdated ? 'visible' : 'hidden',
|
102
111
|
}}
|
103
112
|
{...props}>
|
104
|
-
<div
|
113
|
+
<div
|
114
|
+
style={{
|
115
|
+
display: inline ? 'block' : 'inline-block',
|
116
|
+
boxShadow: inline ? 'none' : '0px 40px 60px rgba(0, 0, 0, 0.08)',
|
117
|
+
}}
|
118
|
+
ref={contentRef}>
|
105
119
|
{children}
|
106
120
|
</div>
|
107
121
|
</div>
|