@arcblock/ux 2.13.20 → 2.13.23
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.d.ts +6 -23
- package/lib/Config/config-provider.js +19 -80
- package/lib/Config/theme-mode-toggle.js +2 -2
- package/lib/DIDConnect/did-connect-container.d.ts +23 -0
- package/lib/DIDConnect/did-connect-container.js +270 -0
- package/lib/DIDConnect/did-connect-footer.d.ts +3 -1
- package/lib/DIDConnect/did-connect-footer.js +5 -3
- package/lib/DIDConnect/index.d.ts +1 -0
- package/lib/DIDConnect/index.js +2 -1
- package/lib/NavMenu/images/payment-kit.png +0 -0
- package/lib/NavMenu/products.js +30 -4
- package/lib/NavMenu/style.js +2 -1
- package/lib/PhoneInput/index.js +2 -1
- package/lib/SessionUser/components/quick-login-item.js +4 -4
- package/lib/SessionUser/components/un-login.js +6 -5
- package/lib/SharedBridge/index.js +8 -8
- package/lib/SharedBridge/need-storage-access-api-dialog.d.ts +1 -2
- package/lib/SharedBridge/need-storage-access-api-dialog.js +2 -23
- package/lib/Theme/index.d.ts +1 -0
- package/lib/Theme/index.js +1 -0
- package/lib/Theme/theme-provider.d.ts +27 -12
- package/lib/Theme/theme-provider.js +123 -16
- package/lib/Theme/theme.d.ts +5 -4
- package/lib/Theme/theme.js +6 -5
- package/package.json +6 -6
- package/src/Config/config-provider.tsx +21 -103
- package/src/Config/theme-mode-toggle.tsx +2 -2
- package/src/DIDConnect/did-connect-container.tsx +320 -0
- package/src/DIDConnect/did-connect-footer.tsx +25 -19
- package/src/DIDConnect/index.ts +1 -0
- package/src/NavMenu/images/payment-kit.png +0 -0
- package/src/NavMenu/products.tsx +21 -4
- package/src/NavMenu/style.ts +2 -1
- package/src/PhoneInput/index.tsx +2 -1
- package/src/SessionUser/components/quick-login-item.tsx +3 -3
- package/src/SessionUser/components/un-login.tsx +5 -4
- package/src/SessionUser/components/user-info.tsx +1 -1
- package/src/SharedBridge/index.tsx +4 -12
- package/src/SharedBridge/need-storage-access-api-dialog.tsx +1 -23
- package/src/Theme/index.ts +1 -0
- package/src/Theme/theme-provider.tsx +144 -16
- package/src/Theme/theme.ts +8 -9
@@ -1,34 +1,18 @@
|
|
1
|
-
import { ReactNode } from 'react';
|
2
|
-
import { type PaletteMode } from '@mui/material';
|
1
|
+
import { type ReactNode } from 'react';
|
3
2
|
import { LocaleProviderProps } from '../Locale/context';
|
4
|
-
import { ThemeProviderProps } from '../Theme/theme-provider';
|
5
|
-
|
6
|
-
type Prefer = 'light' | 'dark' | 'system';
|
7
|
-
export interface ConfigContextType {
|
8
|
-
mode: PaletteMode;
|
9
|
-
prefer?: Prefer;
|
10
|
-
themeOptions: UserThemeOptions;
|
11
|
-
toggleMode: () => void;
|
12
|
-
}
|
13
|
-
export interface ConfigProviderProps extends Omit<LocaleProviderProps, 'translations'>, Omit<ThemeProviderProps, 'theme'> {
|
3
|
+
import { type ThemeProviderProps } from '../Theme/theme-provider';
|
4
|
+
export interface ConfigProviderProps extends Omit<LocaleProviderProps, 'translations'>, ThemeProviderProps {
|
14
5
|
children: ReactNode;
|
15
|
-
prefer?: Prefer;
|
16
|
-
theme?: UserThemeOptions | ((config: ThemeConfig) => UserThemeOptions);
|
17
|
-
disableBlockletTheme?: boolean;
|
18
6
|
translations?: Record<string, any>;
|
19
7
|
}
|
20
8
|
/**
|
21
9
|
* 集中化配置
|
22
10
|
*/
|
23
|
-
export declare function ConfigProvider({ children,
|
24
|
-
export declare namespace ConfigProvider {
|
25
|
-
var useConfig: typeof import("./config-provider").useConfig;
|
26
|
-
}
|
11
|
+
export declare function ConfigProvider({ children, theme, injectFirst, darkSchemeClass, prefer, disableBlockletTheme, enableColorScheme, locale, fallbackLocale, translations, languages, onLoadingTranslation, }: ConfigProviderProps): import("react/jsx-runtime").JSX.Element;
|
27
12
|
export declare function useConfig(): {
|
28
|
-
mode: PaletteMode;
|
29
|
-
prefer?: Prefer;
|
30
|
-
themeOptions: UserThemeOptions;
|
13
|
+
mode: import("@mui/material").PaletteMode;
|
31
14
|
toggleMode: () => void;
|
15
|
+
prefer?: import("../Theme").Prefer;
|
32
16
|
locale: import("../type").Locale;
|
33
17
|
changeLocale: (locale: import("../type").Locale) => void;
|
34
18
|
t: (key: string, data?: Record<string, any>) => string;
|
@@ -38,4 +22,3 @@ export declare function useConfig(): {
|
|
38
22
|
}[];
|
39
23
|
theme: import("@mui/material").Theme;
|
40
24
|
};
|
41
|
-
export {};
|
@@ -1,111 +1,50 @@
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
2
|
-
import { createContext, useContext, useMemo, useState, useCallback, useEffect } from 'react';
|
3
|
-
import { BLOCKLET_THEME_PREFER_KEY } from '@blocklet/theme';
|
4
|
-
import set from 'lodash/set';
|
5
|
-
import { ThemeProvider as EmotionThemeProvider } from '@emotion/react';
|
6
2
|
import { LocaleProvider, useLocaleContext } from '../Locale/context';
|
7
|
-
import ThemeProvider from '../Theme/theme-provider';
|
8
|
-
import {
|
9
|
-
const resolveMode = prefer => {
|
10
|
-
if (prefer) {
|
11
|
-
if (prefer === 'system') {
|
12
|
-
// 取系统默认
|
13
|
-
return getDefaultThemePrefer({
|
14
|
-
theme: {
|
15
|
-
prefer: 'system'
|
16
|
-
}
|
17
|
-
});
|
18
|
-
}
|
19
|
-
return prefer;
|
20
|
-
}
|
21
|
-
return getDefaultThemePrefer();
|
22
|
-
};
|
23
|
-
const ConfigContext = /*#__PURE__*/createContext({});
|
3
|
+
import ThemeProvider, { useColorScheme } from '../Theme/theme-provider';
|
4
|
+
import { useTheme } from '../Theme';
|
24
5
|
/**
|
25
6
|
* 集中化配置
|
26
7
|
*/
|
27
8
|
export function ConfigProvider({
|
28
9
|
children,
|
29
|
-
// theme
|
10
|
+
// theme provider
|
11
|
+
theme,
|
12
|
+
injectFirst,
|
13
|
+
darkSchemeClass,
|
30
14
|
prefer,
|
31
|
-
theme: themeOptions,
|
32
15
|
disableBlockletTheme = false,
|
33
|
-
|
34
|
-
// locale
|
16
|
+
enableColorScheme,
|
17
|
+
// locale provider
|
35
18
|
locale,
|
36
19
|
fallbackLocale,
|
37
20
|
translations = {},
|
38
21
|
languages,
|
39
22
|
onLoadingTranslation
|
40
23
|
}) {
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
} else {
|
49
|
-
result = {
|
50
|
-
...themeOptions
|
51
|
-
};
|
52
|
-
}
|
53
|
-
}
|
54
|
-
set(result, 'palette.mode', mode);
|
55
|
-
set(result, 'mode', mode);
|
56
|
-
return result;
|
57
|
-
}, [mode, themeOptions]);
|
58
|
-
const theme = useMemo(() => {
|
59
|
-
return createTheme({
|
60
|
-
..._themeOptions,
|
61
|
-
disableBlockletTheme
|
62
|
-
});
|
63
|
-
}, [_themeOptions, disableBlockletTheme]);
|
64
|
-
const toggleMode = useCallback(() => {
|
65
|
-
const newMode = mode === 'light' ? 'dark' : 'light';
|
66
|
-
setMode(newMode);
|
67
|
-
localStorage.setItem(BLOCKLET_THEME_PREFER_KEY, newMode);
|
68
|
-
}, [mode, setMode]);
|
69
|
-
const config = useMemo(() => ({
|
70
|
-
mode,
|
71
|
-
themeOptions: _themeOptions,
|
72
|
-
toggleMode,
|
73
|
-
prefer
|
74
|
-
}), [mode, prefer, _themeOptions, toggleMode]);
|
75
|
-
|
76
|
-
// change prefer manually
|
77
|
-
useEffect(() => {
|
78
|
-
if (prefer) {
|
79
|
-
setMode(resolveMode(prefer));
|
80
|
-
}
|
81
|
-
}, [prefer, setMode]);
|
82
|
-
return /*#__PURE__*/_jsx(ConfigContext.Provider, {
|
83
|
-
value: config,
|
24
|
+
return /*#__PURE__*/_jsx(ThemeProvider, {
|
25
|
+
theme: theme,
|
26
|
+
injectFirst: injectFirst,
|
27
|
+
darkSchemeClass: darkSchemeClass,
|
28
|
+
prefer: prefer,
|
29
|
+
disableBlockletTheme: disableBlockletTheme,
|
30
|
+
enableColorScheme: enableColorScheme,
|
84
31
|
children: /*#__PURE__*/_jsx(LocaleProvider, {
|
85
32
|
locale: locale,
|
86
33
|
fallbackLocale: fallbackLocale,
|
87
34
|
translations: translations,
|
88
35
|
onLoadingTranslation: onLoadingTranslation,
|
89
36
|
languages: languages,
|
90
|
-
children:
|
91
|
-
theme: theme,
|
92
|
-
injectFirst: injectFirst,
|
93
|
-
children: /*#__PURE__*/_jsx(EmotionThemeProvider, {
|
94
|
-
theme: theme,
|
95
|
-
children: children
|
96
|
-
})
|
97
|
-
})
|
37
|
+
children: children
|
98
38
|
})
|
99
39
|
});
|
100
40
|
}
|
101
41
|
export function useConfig() {
|
102
42
|
const theme = useTheme();
|
103
43
|
const localeCtx = useLocaleContext();
|
104
|
-
const
|
44
|
+
const colorSchemeCtx = useColorScheme();
|
105
45
|
return {
|
106
46
|
theme,
|
107
47
|
...localeCtx,
|
108
|
-
...
|
48
|
+
...colorSchemeCtx
|
109
49
|
};
|
110
|
-
}
|
111
|
-
ConfigProvider.useConfig = useConfig;
|
50
|
+
}
|
@@ -2,13 +2,13 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { IconButton } from '@mui/material';
|
3
3
|
import LightModeOutlinedIcon from '@mui/icons-material/LightModeOutlined';
|
4
4
|
import Brightness2OutlinedIcon from '@mui/icons-material/Brightness2Outlined';
|
5
|
-
import {
|
5
|
+
import { useColorScheme } from '../Theme/theme-provider';
|
6
6
|
export default function ThemeModeToggle() {
|
7
7
|
const {
|
8
8
|
mode,
|
9
9
|
toggleMode,
|
10
10
|
prefer
|
11
|
-
} =
|
11
|
+
} = useColorScheme();
|
12
12
|
if (!toggleMode) {
|
13
13
|
if (process.env.NODE_ENV !== 'production') {
|
14
14
|
console.warn('Please ensure the component is wrapped with ConfigProvider context');
|
@@ -0,0 +1,23 @@
|
|
1
|
+
import { SxProps } from '@mui/material';
|
2
|
+
export default function DIDConnectContainer({ open, popup, hideCloseButton, children, appPid, slotProps, onClose, }: {
|
3
|
+
popup?: boolean;
|
4
|
+
open?: boolean;
|
5
|
+
hideCloseButton?: boolean;
|
6
|
+
children: React.ReactNode;
|
7
|
+
onClose?: () => void;
|
8
|
+
appPid?: string;
|
9
|
+
slotProps?: {
|
10
|
+
footer?: {
|
11
|
+
sx?: SxProps;
|
12
|
+
};
|
13
|
+
containerPage?: {
|
14
|
+
sx?: SxProps;
|
15
|
+
};
|
16
|
+
containerDrawer?: {
|
17
|
+
sx?: SxProps;
|
18
|
+
};
|
19
|
+
containerDialog?: {
|
20
|
+
sx?: SxProps;
|
21
|
+
};
|
22
|
+
};
|
23
|
+
}): import("react/jsx-runtime").JSX.Element;
|
@@ -0,0 +1,270 @@
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
2
|
+
import { forwardRef, memo, useRef, createElement as _createElement } from 'react';
|
3
|
+
import { useBrowser } from '@arcblock/react-hooks';
|
4
|
+
import { Backdrop, Box, Dialog, DialogContent, Drawer, SwipeableDrawer, useMediaQuery } from '@mui/material';
|
5
|
+
import { useCreation, useDebounce } from 'ahooks';
|
6
|
+
import colorConvert from 'color-convert';
|
7
|
+
import { getDIDMotifInfo } from '@arcblock/did-motif';
|
8
|
+
import noop from 'lodash/noop';
|
9
|
+
import { useTheme } from '../Theme';
|
10
|
+
import { mergeSx } from '../Util/style';
|
11
|
+
import { getDIDColor, hexToRgba, isEthereumDid } from '../Util';
|
12
|
+
import DIDConnectFooter from './did-connect-footer';
|
13
|
+
const BackdropWrap = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((backdropProps, ref) => {
|
14
|
+
return /*#__PURE__*/_createElement(Backdrop, {
|
15
|
+
open: true,
|
16
|
+
ref: ref,
|
17
|
+
style: {
|
18
|
+
backgroundColor: 'rgba(0, 0, 0, 0.6)',
|
19
|
+
backdropFilter: 'blur(3px)',
|
20
|
+
touchAction: 'none'
|
21
|
+
},
|
22
|
+
...backdropProps,
|
23
|
+
key: "background"
|
24
|
+
});
|
25
|
+
}));
|
26
|
+
export default function DIDConnectContainer({
|
27
|
+
open = false,
|
28
|
+
popup = false,
|
29
|
+
hideCloseButton = false,
|
30
|
+
children,
|
31
|
+
appPid,
|
32
|
+
slotProps,
|
33
|
+
onClose = noop
|
34
|
+
}) {
|
35
|
+
const color = useCreation(() => {
|
36
|
+
const did = appPid || window.blocklet.appPid;
|
37
|
+
const isEthDid = isEthereumDid(did);
|
38
|
+
const didMotifInfo = isEthDid ? undefined : getDIDMotifInfo(did);
|
39
|
+
if (isEthDid) {
|
40
|
+
return getDIDColor(did);
|
41
|
+
}
|
42
|
+
return didMotifInfo.color;
|
43
|
+
}, []);
|
44
|
+
const drawerDragger = useRef(null);
|
45
|
+
const browser = useBrowser();
|
46
|
+
// 屏宽小于 sm 且在 mobile 设备中全屏显示 dialog (PC 端屏宽小于 sm 的情况正常弹窗, 不全屏显示)
|
47
|
+
const matchSm = useMediaQuery('(max-width:640px)');
|
48
|
+
let openVariant = 'page';
|
49
|
+
if (popup) {
|
50
|
+
openVariant = 'dialog';
|
51
|
+
if (matchSm && browser.mobile.any) {
|
52
|
+
openVariant = 'drawer';
|
53
|
+
}
|
54
|
+
}
|
55
|
+
const theme = useTheme();
|
56
|
+
const leavingScreenDelay = theme?.transitions?.duration?.leavingScreen || 500; // 默认值是 195
|
57
|
+
const debouncedOpen = useDebounce(open, {
|
58
|
+
wait: leavingScreenDelay
|
59
|
+
});
|
60
|
+
|
61
|
+
// eslint-disable-next-line no-unused-vars
|
62
|
+
const handleOnClose = (e, reason) => {
|
63
|
+
if (['backdropClick', 'escapeKeyDown'].includes(reason)) return;
|
64
|
+
onClose();
|
65
|
+
};
|
66
|
+
const showModal = debouncedOpen || open;
|
67
|
+
const DrawerComponent = hideCloseButton ? Drawer : SwipeableDrawer;
|
68
|
+
const hslColor = colorConvert.hex.hsl(color);
|
69
|
+
const [h, s, l] = hslColor;
|
70
|
+
const percentageList = [0, 30, 60, 30, 0, 30, 60, 30];
|
71
|
+
const maxPercentage = Math.max(...percentageList);
|
72
|
+
const minPercentage = Math.min(...percentageList);
|
73
|
+
let useAlpha = false;
|
74
|
+
if (l * (100 + maxPercentage) / 100 > 100 || l * (100 + minPercentage) / 100 < 0) {
|
75
|
+
// 超出范围,使用 alpha 通道变化
|
76
|
+
useAlpha = true;
|
77
|
+
}
|
78
|
+
const colorList = percentageList.map(percentageItem => {
|
79
|
+
let finalL = l * (100 + percentageItem) / 100;
|
80
|
+
let finalAlpha = 0.6;
|
81
|
+
if (useAlpha) {
|
82
|
+
finalAlpha = 0.5 * (100 + percentageItem) / 100;
|
83
|
+
} else {
|
84
|
+
finalL = l * (100 + percentageItem) / 100;
|
85
|
+
}
|
86
|
+
return `hsla(${h}, ${s}%, ${finalL}%, ${finalAlpha})`;
|
87
|
+
});
|
88
|
+
const background = `linear-gradient(45deg, ${colorList.join(', ')})`;
|
89
|
+
const colorListGlow = percentageList.map(percentageItem => {
|
90
|
+
let finalL = l * (100 + percentageItem) / 100;
|
91
|
+
let finalAlpha = 0.2;
|
92
|
+
if (useAlpha) {
|
93
|
+
finalAlpha = 0.3 * (100 + percentageItem) / 100;
|
94
|
+
} else {
|
95
|
+
finalL = l * (100 + percentageItem) / 100;
|
96
|
+
}
|
97
|
+
return `hsla(${h}, ${s}%, ${finalL}%, ${finalAlpha})`;
|
98
|
+
});
|
99
|
+
const backgroundGlow = `linear-gradient(45deg, ${colorListGlow.join(', ')})`;
|
100
|
+
const glowStyle = {
|
101
|
+
overflow: 'visible',
|
102
|
+
'&::before, &::after': {
|
103
|
+
content: '""',
|
104
|
+
position: 'absolute',
|
105
|
+
top: '-3px',
|
106
|
+
right: '-3px',
|
107
|
+
bottom: '-3px',
|
108
|
+
left: '-3px',
|
109
|
+
background,
|
110
|
+
backgroundSize: '300% 300%',
|
111
|
+
backgroundRepeat: 'no-repeat',
|
112
|
+
animation: 'glowRotate 10s linear infinite',
|
113
|
+
borderRadius: '14px !important',
|
114
|
+
zIndex: 0
|
115
|
+
},
|
116
|
+
'&::after': {
|
117
|
+
background: backgroundGlow,
|
118
|
+
filter: 'blur(15px)'
|
119
|
+
},
|
120
|
+
'@keyframes glowRotate': {
|
121
|
+
'0%': {
|
122
|
+
backgroundPosition: '0 0'
|
123
|
+
},
|
124
|
+
'50%': {
|
125
|
+
backgroundPosition: '100% 0'
|
126
|
+
},
|
127
|
+
'100%': {
|
128
|
+
backgroundPosition: '0 0'
|
129
|
+
}
|
130
|
+
}
|
131
|
+
};
|
132
|
+
if (openVariant === 'page') {
|
133
|
+
return /*#__PURE__*/_jsx(Box, {
|
134
|
+
className: "did-connect__container-page",
|
135
|
+
sx: mergeSx({
|
136
|
+
borderRadius: 1,
|
137
|
+
position: 'relative',
|
138
|
+
zIndex: 1,
|
139
|
+
backgroundColor: 'background.default'
|
140
|
+
}, glowStyle, slotProps?.containerPage?.sx),
|
141
|
+
children: /*#__PURE__*/_jsxs(Box, {
|
142
|
+
sx: {
|
143
|
+
border: `1px solid ${hexToRgba(color, 0.1)}`,
|
144
|
+
m: '-1px',
|
145
|
+
position: 'relative',
|
146
|
+
borderRadius: '12px',
|
147
|
+
zIndex: 2,
|
148
|
+
overflow: 'hidden',
|
149
|
+
backgroundColor: 'background.default'
|
150
|
+
},
|
151
|
+
children: [children, /*#__PURE__*/_jsx(DIDConnectFooter, {
|
152
|
+
currentAppColor: color,
|
153
|
+
sx: mergeSx({
|
154
|
+
mx: 0
|
155
|
+
}, slotProps?.footer?.sx)
|
156
|
+
})]
|
157
|
+
})
|
158
|
+
});
|
159
|
+
}
|
160
|
+
if (openVariant === 'drawer') {
|
161
|
+
return /*#__PURE__*/_jsxs(DrawerComponent, {
|
162
|
+
className: "did-connect__container-drawer",
|
163
|
+
disableSwipeToOpen: true,
|
164
|
+
open: open,
|
165
|
+
anchor: "bottom",
|
166
|
+
drawerDragger: drawerDragger.current
|
167
|
+
// @ts-ignore
|
168
|
+
,
|
169
|
+
onClose: handleOnClose,
|
170
|
+
slots: {
|
171
|
+
backdrop: BackdropWrap
|
172
|
+
},
|
173
|
+
PaperProps: {
|
174
|
+
sx: mergeSx({
|
175
|
+
backgroundColor: 'background.default',
|
176
|
+
borderRadius: 3,
|
177
|
+
// 保持跟 DID Wallet 一致
|
178
|
+
borderBottomLeftRadius: 0,
|
179
|
+
borderBottomRightRadius: 0,
|
180
|
+
p: '2px',
|
181
|
+
animation: 'glowBreathe 7s linear infinite',
|
182
|
+
'.did-connect__root': {
|
183
|
+
backgroundColor: 'transparent'
|
184
|
+
},
|
185
|
+
overflow: 'hidden',
|
186
|
+
'@keyframes glowBreathe': {
|
187
|
+
'0%, 100%': {
|
188
|
+
boxShadow: `
|
189
|
+
inset 0 0 7px ${hexToRgba(color, 0.3)},
|
190
|
+
inset 0 0 12px ${hexToRgba(color, 0.3)}`
|
191
|
+
},
|
192
|
+
'50%': {
|
193
|
+
boxShadow: `
|
194
|
+
inset 0 0 18px ${hexToRgba(color, 0.7)},
|
195
|
+
inset 0 0 24px ${hexToRgba(color, 0.5)}`
|
196
|
+
}
|
197
|
+
}
|
198
|
+
}, slotProps?.containerDrawer?.sx)
|
199
|
+
},
|
200
|
+
children: [hideCloseButton ? null : /*#__PURE__*/_jsx(Box, {
|
201
|
+
ref: drawerDragger,
|
202
|
+
sx: {
|
203
|
+
px: 1,
|
204
|
+
pt: 2,
|
205
|
+
m: 'auto',
|
206
|
+
mt: -1,
|
207
|
+
mb: -2,
|
208
|
+
zIndex: 2
|
209
|
+
},
|
210
|
+
children: /*#__PURE__*/_jsx(Box, {
|
211
|
+
sx: {
|
212
|
+
width: '48px',
|
213
|
+
height: '4px',
|
214
|
+
borderRadius: '100vw',
|
215
|
+
backgroundColor: 'rgba(0, 0, 0, 0.2)'
|
216
|
+
}
|
217
|
+
})
|
218
|
+
}), /*#__PURE__*/_jsxs(Box, {
|
219
|
+
sx: {
|
220
|
+
touchAction: 'none',
|
221
|
+
maxWidth: '100%',
|
222
|
+
width: 500,
|
223
|
+
height: 'auto',
|
224
|
+
backgroundColor: 'background.default'
|
225
|
+
},
|
226
|
+
children: [showModal ? children : null, /*#__PURE__*/_jsx(DIDConnectFooter, {
|
227
|
+
currentAppColor: color,
|
228
|
+
sx: mergeSx({
|
229
|
+
mx: 0
|
230
|
+
}, slotProps?.footer?.sx)
|
231
|
+
})]
|
232
|
+
})]
|
233
|
+
});
|
234
|
+
}
|
235
|
+
return /*#__PURE__*/_jsx(Dialog, {
|
236
|
+
open: open,
|
237
|
+
slots: {
|
238
|
+
backdrop: BackdropWrap
|
239
|
+
},
|
240
|
+
className: "did-connect__container-dialog",
|
241
|
+
onClose: handleOnClose,
|
242
|
+
PaperProps: {
|
243
|
+
sx: mergeSx({
|
244
|
+
// 避免样式被 server 中的定义覆盖
|
245
|
+
'&.MuiPaper-rounded': {
|
246
|
+
borderRadius: '12px !important'
|
247
|
+
},
|
248
|
+
position: 'relative',
|
249
|
+
backgroundColor: 'background.default'
|
250
|
+
}, glowStyle, slotProps?.containerDialog?.sx)
|
251
|
+
},
|
252
|
+
children: /*#__PURE__*/_jsxs(DialogContent, {
|
253
|
+
sx: {
|
254
|
+
maxWidth: 'calc(100vw - 18px)',
|
255
|
+
maxHeight: 'calc(100vh - 18px)',
|
256
|
+
p: '0px !important',
|
257
|
+
height: 'auto',
|
258
|
+
borderRadius: '12px !important',
|
259
|
+
zIndex: 1,
|
260
|
+
backgroundColor: 'background.default'
|
261
|
+
},
|
262
|
+
children: [showModal ? children : null, /*#__PURE__*/_jsx(DIDConnectFooter, {
|
263
|
+
currentAppColor: color,
|
264
|
+
sx: mergeSx({
|
265
|
+
mx: 0
|
266
|
+
}, slotProps?.footer?.sx)
|
267
|
+
})]
|
268
|
+
})
|
269
|
+
});
|
270
|
+
}
|
@@ -1,4 +1,6 @@
|
|
1
|
-
|
1
|
+
import { SxProps } from '@mui/material';
|
2
|
+
export default function DIDConnectFooter({ currentAppInfo, currentAppColor, sx, }: {
|
2
3
|
currentAppInfo?: any;
|
3
4
|
currentAppColor?: string;
|
5
|
+
sx?: SxProps;
|
4
6
|
}): import("react/jsx-runtime").JSX.Element;
|
@@ -4,13 +4,15 @@ import PoweredBy from './powered-by';
|
|
4
4
|
import AppInfoItem from './app-info-item';
|
5
5
|
import AppIcon from './app-icon';
|
6
6
|
import { getDIDColor, hexToRgba } from '../Util';
|
7
|
+
import { mergeSx } from '../Util/style';
|
7
8
|
export default function DIDConnectFooter({
|
8
9
|
currentAppInfo = globalThis.blocklet,
|
9
|
-
currentAppColor = globalThis.blocklet?.appPid ? getDIDColor(globalThis.blocklet?.appPid) : '#fff'
|
10
|
+
currentAppColor = globalThis.blocklet?.appPid ? getDIDColor(globalThis.blocklet?.appPid) : '#fff',
|
11
|
+
sx
|
10
12
|
}) {
|
11
13
|
const isSmallView = useMediaQuery('(max-width:640px)');
|
12
14
|
return /*#__PURE__*/_jsxs(Box, {
|
13
|
-
sx: {
|
15
|
+
sx: mergeSx({
|
14
16
|
display: 'flex',
|
15
17
|
justifyContent: 'space-between',
|
16
18
|
alignItems: 'center',
|
@@ -29,7 +31,7 @@ export default function DIDConnectFooter({
|
|
29
31
|
'-ms-overflow-style': 'none',
|
30
32
|
// 隐藏滚动条 (IE 浏览器)
|
31
33
|
'scrollbar-width': 'none' // 隐藏滚动条 (Firefox)
|
32
|
-
},
|
34
|
+
}, sx),
|
33
35
|
className: "did-connect__footer",
|
34
36
|
children: [/*#__PURE__*/_jsx(AppInfoItem, {
|
35
37
|
appInfo: currentAppInfo,
|
@@ -5,3 +5,4 @@ export { default as PoweredBy } from './powered-by';
|
|
5
5
|
export { default as withContainer } from './with-container';
|
6
6
|
export { default as withUxTheme } from './with-ux-theme';
|
7
7
|
export { default as DIDConnectLogo } from './did-connect-logo';
|
8
|
+
export { default as DIDConnectContainer } from './did-connect-container';
|
package/lib/DIDConnect/index.js
CHANGED
@@ -4,4 +4,5 @@ export { default as AppIcon } from './app-icon';
|
|
4
4
|
export { default as PoweredBy } from './powered-by';
|
5
5
|
export { default as withContainer } from './with-container';
|
6
6
|
export { default as withUxTheme } from './with-ux-theme';
|
7
|
-
export { default as DIDConnectLogo } from './did-connect-logo';
|
7
|
+
export { default as DIDConnectLogo } from './did-connect-logo';
|
8
|
+
export { default as DIDConnectContainer } from './did-connect-container';
|
Binary file
|
package/lib/NavMenu/products.js
CHANGED
@@ -3,7 +3,7 @@ import React from "react";
|
|
3
3
|
import { useRef } from 'react';
|
4
4
|
import { Link } from 'react-router-dom';
|
5
5
|
import { useCreation, useMemoizedFn } from 'ahooks';
|
6
|
-
import { Box, Grid } from '@mui/material';
|
6
|
+
import { Box, Grid, useTheme } from '@mui/material';
|
7
7
|
import SubItemGroup from './sub-item-group';
|
8
8
|
import { Item } from './nav-menu';
|
9
9
|
import { styled } from '../Theme';
|
@@ -1273,6 +1273,7 @@ DidConnectSvg.defaultProps = {
|
|
1273
1273
|
fill: "none",
|
1274
1274
|
xmlns: "http://www.w3.org/2000/svg"
|
1275
1275
|
};
|
1276
|
+
import PaymentKitPng from './images/payment-kit.png';
|
1276
1277
|
const translations = {
|
1277
1278
|
en: {
|
1278
1279
|
groups: {
|
@@ -1300,6 +1301,9 @@ const translations = {
|
|
1300
1301
|
alKit: {
|
1301
1302
|
description: 'Boost apps with AI'
|
1302
1303
|
},
|
1304
|
+
paymentKit: {
|
1305
|
+
description: 'Effortless Crypto & Card Payments'
|
1306
|
+
},
|
1303
1307
|
blockletStore: {
|
1304
1308
|
description: 'Discover & deploy apps'
|
1305
1309
|
},
|
@@ -1364,6 +1368,9 @@ const translations = {
|
|
1364
1368
|
alKit: {
|
1365
1369
|
description: 'AI 赋能应用'
|
1366
1370
|
},
|
1371
|
+
paymentKit: {
|
1372
|
+
description: '便捷的加密货币和银行卡支付'
|
1373
|
+
},
|
1367
1374
|
blockletStore: {
|
1368
1375
|
description: '发现和部署应用程序'
|
1369
1376
|
},
|
@@ -1437,6 +1444,9 @@ export default function Products({
|
|
1437
1444
|
const {
|
1438
1445
|
mode
|
1439
1446
|
} = useNavMenuContext();
|
1447
|
+
const {
|
1448
|
+
palette
|
1449
|
+
} = useTheme();
|
1440
1450
|
const wrapperRef = useRef(null);
|
1441
1451
|
const {
|
1442
1452
|
locale = 'en'
|
@@ -1472,7 +1482,11 @@ export default function Products({
|
|
1472
1482
|
children: "AIGNE"
|
1473
1483
|
}),
|
1474
1484
|
description: t('products.aigne.description'),
|
1475
|
-
icon: /*#__PURE__*/_jsx(AigneSvg, {
|
1485
|
+
icon: /*#__PURE__*/_jsx(AigneSvg, {
|
1486
|
+
style: {
|
1487
|
+
filter: palette.mode === 'dark' ? 'invert(1)' : 'none'
|
1488
|
+
}
|
1489
|
+
})
|
1476
1490
|
}, {
|
1477
1491
|
label: /*#__PURE__*/_jsx(Link, {
|
1478
1492
|
to: `https://www.aistro.io/${locale}`,
|
@@ -1504,6 +1518,18 @@ export default function Products({
|
|
1504
1518
|
}),
|
1505
1519
|
description: t('products.alKit.description'),
|
1506
1520
|
icon: /*#__PURE__*/_jsx(AIKitSvg, {})
|
1521
|
+
}, {
|
1522
|
+
label: /*#__PURE__*/_jsx(Link, {
|
1523
|
+
to: `https://www.blocklet.io/${locale}`,
|
1524
|
+
target: "_blank",
|
1525
|
+
rel: "noreferrer noopener",
|
1526
|
+
children: "Payment Kit"
|
1527
|
+
}),
|
1528
|
+
description: t('products.paymentKit.description'),
|
1529
|
+
icon: /*#__PURE__*/_jsx("img", {
|
1530
|
+
src: PaymentKitPng,
|
1531
|
+
alt: "Payment Kit"
|
1532
|
+
})
|
1507
1533
|
}], [{
|
1508
1534
|
label: /*#__PURE__*/_jsx(Link, {
|
1509
1535
|
to: `https://store.blocklet.dev/?locale=${locale}`,
|
@@ -1555,7 +1581,7 @@ export default function Products({
|
|
1555
1581
|
icon: /*#__PURE__*/_jsx(AbtNetworkSvg, {})
|
1556
1582
|
}], [{
|
1557
1583
|
label: /*#__PURE__*/_jsx(Link, {
|
1558
|
-
to: `https://www.
|
1584
|
+
to: `https://www.blocklet.io/${locale}/blocklet-server`,
|
1559
1585
|
target: "_blank",
|
1560
1586
|
rel: "noreferrer noopener",
|
1561
1587
|
children: "Blocklet Server"
|
@@ -1622,7 +1648,7 @@ export default function Products({
|
|
1622
1648
|
icon: /*#__PURE__*/_jsx(DidConnectSvg, {})
|
1623
1649
|
}]]
|
1624
1650
|
}];
|
1625
|
-
}, [t, locale]);
|
1651
|
+
}, [t, locale, palette]);
|
1626
1652
|
return /*#__PURE__*/_jsx(Wrapper, {
|
1627
1653
|
ref: wrapperRef,
|
1628
1654
|
className: `is-${mode} ${className}`,
|
package/lib/NavMenu/style.js
CHANGED
@@ -126,7 +126,8 @@ export const NavMenuItem = styled('li', {
|
|
126
126
|
width: '32px',
|
127
127
|
height: '32px',
|
128
128
|
marginRight: '16px',
|
129
|
-
border: '1px solid
|
129
|
+
border: '1px solid',
|
130
|
+
borderColor: theme.palette.grey[200],
|
130
131
|
borderRadius: '4px',
|
131
132
|
color: theme.palette.grey[500]
|
132
133
|
},
|
package/lib/PhoneInput/index.js
CHANGED
@@ -178,7 +178,8 @@ export default function PhoneInput({
|
|
178
178
|
|
179
179
|
// 预览模式
|
180
180
|
if (preview) {
|
181
|
-
const
|
181
|
+
const phoneWithCode = addCountryCodeToPhone(phone, getDialCodeByCountry(country));
|
182
|
+
const isValid = phone && validatePhoneNumber(phoneWithCode, country);
|
182
183
|
const canDial = allowDial && isValid;
|
183
184
|
return /*#__PURE__*/_jsxs(Box, {
|
184
185
|
display: "flex",
|
@@ -21,18 +21,18 @@ export default function QuickLoginItem({
|
|
21
21
|
borderRadius: 1,
|
22
22
|
p: 2,
|
23
23
|
transition: 'background-color 0.5s',
|
24
|
+
bgcolor: 'background.paper',
|
24
25
|
'&:hover, &:active': {
|
25
|
-
backgroundColor: '
|
26
|
+
backgroundColor: 'action.hover'
|
26
27
|
},
|
27
28
|
display: 'flex',
|
28
29
|
justifyContent: 'space-between',
|
29
30
|
alignItems: 'center',
|
30
31
|
cursor: 'pointer',
|
31
32
|
'&:hover': {
|
32
|
-
backgroundColor: '
|
33
|
+
backgroundColor: 'action.hover'
|
33
34
|
},
|
34
|
-
width: '100%'
|
35
|
-
backgroundColor: 'white'
|
35
|
+
width: '100%'
|
36
36
|
},
|
37
37
|
onClick: onClick,
|
38
38
|
children: [/*#__PURE__*/_jsxs(Box, {
|