@arcblock/ux 2.13.13 → 2.13.14

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.
Files changed (55) hide show
  1. package/lib/Address/responsive-did-address.js +3 -1
  2. package/lib/DIDConnect/app-icon.d.ts +8 -0
  3. package/lib/DIDConnect/app-icon.js +31 -0
  4. package/lib/DIDConnect/app-info-item.d.ts +7 -0
  5. package/lib/DIDConnect/app-info-item.js +73 -0
  6. package/lib/DIDConnect/did-connect-footer.d.ts +4 -0
  7. package/lib/DIDConnect/did-connect-footer.js +54 -0
  8. package/lib/DIDConnect/did-connect-logo.d.ts +1 -0
  9. package/lib/DIDConnect/did-connect-logo.js +11 -0
  10. package/lib/DIDConnect/index.d.ts +7 -0
  11. package/lib/DIDConnect/index.js +7 -0
  12. package/lib/DIDConnect/powered-by.d.ts +3 -0
  13. package/lib/DIDConnect/powered-by.js +46 -0
  14. package/lib/DIDConnect/with-container.d.ts +11 -0
  15. package/lib/DIDConnect/with-container.js +273 -0
  16. package/lib/DIDConnect/with-ux-theme.d.ts +1 -0
  17. package/lib/DIDConnect/with-ux-theme.js +23 -0
  18. package/lib/Dialog/confirm.d.ts +6 -1
  19. package/lib/Dialog/confirm.js +7 -3
  20. package/lib/Dialog/use-confirm.js +6 -0
  21. package/lib/Locale/util.d.ts +3 -3
  22. package/lib/Locale/util.js +6 -1
  23. package/lib/LoginButton/index.d.ts +12 -0
  24. package/lib/LoginButton/index.js +74 -0
  25. package/lib/SessionUser/components/un-login.js +42 -31
  26. package/lib/SharedBridge/index.d.ts +16 -0
  27. package/lib/SharedBridge/index.js +109 -0
  28. package/lib/SharedBridge/need-storage-access-api-dialog.d.ts +7 -0
  29. package/lib/SharedBridge/need-storage-access-api-dialog.js +212 -0
  30. package/lib/Theme/index.d.ts +2 -2
  31. package/lib/Theme/index.js +1 -1
  32. package/lib/Util/iframe.d.ts +5 -0
  33. package/lib/Util/iframe.js +24 -0
  34. package/lib/Util/index.d.ts +10 -1
  35. package/lib/Util/index.js +67 -4
  36. package/package.json +7 -6
  37. package/src/Address/responsive-did-address.tsx +11 -1
  38. package/src/DIDConnect/app-icon.tsx +36 -0
  39. package/src/DIDConnect/app-info-item.tsx +82 -0
  40. package/src/DIDConnect/did-connect-footer.tsx +51 -0
  41. package/src/DIDConnect/did-connect-logo.tsx +8 -0
  42. package/src/DIDConnect/index.ts +7 -0
  43. package/src/DIDConnect/powered-by.tsx +48 -0
  44. package/src/DIDConnect/with-container.tsx +307 -0
  45. package/src/DIDConnect/with-ux-theme.tsx +22 -0
  46. package/src/Dialog/confirm.jsx +31 -23
  47. package/src/Dialog/use-confirm.jsx +6 -0
  48. package/src/Locale/util.ts +7 -2
  49. package/src/LoginButton/index.tsx +73 -0
  50. package/src/SessionUser/components/un-login.tsx +34 -27
  51. package/src/SharedBridge/index.tsx +123 -0
  52. package/src/SharedBridge/need-storage-access-api-dialog.tsx +171 -0
  53. package/src/Theme/index.ts +2 -2
  54. package/src/Util/iframe.ts +19 -0
  55. package/src/Util/index.ts +77 -4
@@ -81,7 +81,9 @@ const ResponsiveDidAddress = /*#__PURE__*/forwardRef(({
81
81
  style: style,
82
82
  className: className,
83
83
  size: size,
84
- inline: rest.inline,
84
+ ...(component === 'span' ? {} : {
85
+ inline: rest.inline
86
+ }),
85
87
  children: [/*#__PURE__*/_jsx(StyledDidAddress, {
86
88
  style: {
87
89
  position: loading ? 'absolute' : 'static',
@@ -0,0 +1,8 @@
1
+ import { SxProps } from '@mui/material';
2
+ type AppIconProps = {
3
+ appInfo: any;
4
+ size?: number;
5
+ sx?: SxProps;
6
+ };
7
+ export default function AppIcon({ appInfo, size, ...rest }: AppIconProps): import("react/jsx-runtime").JSX.Element;
8
+ export {};
@@ -0,0 +1,31 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useState } from 'react';
3
+ import { joinURL } from 'ufo';
4
+ import Img from '../Img';
5
+ import { isUrl } from '../Util';
6
+ import DidAvatar from '../Avatar';
7
+ export default function AppIcon({
8
+ appInfo,
9
+ size = 32,
10
+ ...rest
11
+ }) {
12
+ const [error, setError] = useState(false);
13
+ if (error || !(appInfo.appUrl || appInfo.appLogo)) {
14
+ return /*#__PURE__*/_jsx(DidAvatar, {
15
+ did: appInfo.appPid,
16
+ size: size
17
+ });
18
+ }
19
+ let logoUrl = appInfo.appLogo || '';
20
+ if (!isUrl(logoUrl)) {
21
+ logoUrl = joinURL(appInfo.appUrl || '', logoUrl);
22
+ }
23
+ return /*#__PURE__*/_jsx(Img, {
24
+ src: logoUrl,
25
+ alt: appInfo.appName || 'Blocklet Icon',
26
+ width: size,
27
+ height: size,
28
+ ...rest,
29
+ onError: () => setError(true)
30
+ });
31
+ }
@@ -0,0 +1,7 @@
1
+ import { SxProps } from '@mui/material';
2
+ export default function AppInfoItem({ appInfo, active, appLogo, sx, }: {
3
+ appInfo: any;
4
+ active?: boolean;
5
+ appLogo?: React.ReactNode;
6
+ sx?: SxProps;
7
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,73 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Box, IconButton, Tooltip, useMediaQuery } from '@mui/material';
3
+ import CheckIcon from '@iconify-icons/material-symbols/check';
4
+ import { Icon } from '@iconify/react';
5
+ import DID from '../DID';
6
+ import { mergeSx } from '../Util/style';
7
+ import AppIcon from './app-icon';
8
+ export default function AppInfoItem({
9
+ appInfo,
10
+ active = false,
11
+ appLogo = null,
12
+ sx
13
+ }) {
14
+ const isTinyView = useMediaQuery('(max-width:400px)');
15
+ return /*#__PURE__*/_jsxs(Box, {
16
+ sx: mergeSx({
17
+ display: 'flex',
18
+ alignItems: 'center',
19
+ fontWeight: 600,
20
+ color: 'text.primary',
21
+ '& .app-info-content': {
22
+ paddingLeft: '8px',
23
+ overflow: 'hidden'
24
+ },
25
+ '& .app-info-name': {
26
+ maxWidth: '100%',
27
+ lineHeight: 'normal',
28
+ whiteSpace: 'nowrap',
29
+ overflow: 'hidden',
30
+ textOverflow: 'ellipsis',
31
+ fontSize: '12px',
32
+ color: 'text.primary'
33
+ }
34
+ }, sx),
35
+ children: [appLogo || /*#__PURE__*/_jsx(Box, {
36
+ sx: {
37
+ borderRadius: 1,
38
+ overflow: 'hidden',
39
+ fontSize: 0
40
+ },
41
+ children: /*#__PURE__*/_jsx(AppIcon, {
42
+ appInfo: appInfo
43
+ })
44
+ }), /*#__PURE__*/_jsxs(Box, {
45
+ className: "app-info-content",
46
+ children: [/*#__PURE__*/_jsx(Tooltip, {
47
+ title: appInfo.appName,
48
+ placement: "top",
49
+ children: /*#__PURE__*/_jsx(Box, {
50
+ className: "app-info-name",
51
+ children: appInfo.appName
52
+ })
53
+ }), appInfo.appPid && /*#__PURE__*/_jsx(DID, {
54
+ className: "app-info-did",
55
+ did: appInfo.appPid,
56
+ sx: {
57
+ fontSize: '10px !important'
58
+ },
59
+ copyable: false,
60
+ startChars: isTinyView ? 6 : 8,
61
+ endChars: isTinyView ? 6 : 8,
62
+ size: 12
63
+ })]
64
+ }), active ? /*#__PURE__*/_jsx(IconButton, {
65
+ size: "small",
66
+ color: "success",
67
+ children: /*#__PURE__*/_jsx(Icon, {
68
+ icon: CheckIcon,
69
+ color: "success"
70
+ })
71
+ }) : null]
72
+ });
73
+ }
@@ -0,0 +1,4 @@
1
+ export default function DIDConnectFooter({ currentAppInfo, currentAppColor, }: {
2
+ currentAppInfo?: any;
3
+ currentAppColor?: string;
4
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,54 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Box, useMediaQuery } from '@mui/material';
3
+ import PoweredBy from './powered-by';
4
+ import AppInfoItem from './app-info-item';
5
+ import AppIcon from './app-icon';
6
+ import { getDIDColor, hexToRgba } from '../Util';
7
+ export default function DIDConnectFooter({
8
+ currentAppInfo = globalThis.blocklet,
9
+ currentAppColor = globalThis.blocklet?.appPid ? getDIDColor(globalThis.blocklet?.appPid) : '#fff'
10
+ }) {
11
+ const isSmallView = useMediaQuery('(max-width:640px)');
12
+ return /*#__PURE__*/_jsxs(Box, {
13
+ sx: {
14
+ display: 'flex',
15
+ justifyContent: 'space-between',
16
+ alignItems: 'center',
17
+ gap: 1,
18
+ fontSize: 12,
19
+ backgroundColor: hexToRgba(currentAppColor, 0.08),
20
+ // 需要保持跟 .did-connect__root 的规则一样
21
+ mx: isSmallView ? -2 : -3,
22
+ px: isSmallView ? 2 : 3,
23
+ py: 1.5,
24
+ // HACK: 极限条件下,footer 会溢出,使用隐藏的滚动条来处理这种情况(屏幕宽度小于 360 时会出现)
25
+ overflow: 'auto',
26
+ '&::-webkit-scrollbar': {
27
+ display: 'none' // 隐藏滚动条 (Webkit 浏览器)
28
+ },
29
+ '-ms-overflow-style': 'none',
30
+ // 隐藏滚动条 (IE 浏览器)
31
+ 'scrollbar-width': 'none' // 隐藏滚动条 (Firefox)
32
+ },
33
+ className: "did-connect__footer",
34
+ children: [/*#__PURE__*/_jsx(AppInfoItem, {
35
+ appInfo: currentAppInfo,
36
+ appLogo: /*#__PURE__*/_jsx(AppIcon, {
37
+ appInfo: currentAppInfo,
38
+ size: 24,
39
+ sx: {
40
+ flexShrink: 0
41
+ }
42
+ }),
43
+ sx: {
44
+ flex: 1,
45
+ overflow: 'hidden'
46
+ }
47
+ }), /*#__PURE__*/_jsx(PoweredBy, {
48
+ sx: {
49
+ maxWidth: '100%',
50
+ justifyContent: 'end'
51
+ }
52
+ })]
53
+ });
54
+ }
@@ -0,0 +1 @@
1
+ export default function DidConnectLogo(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,11 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import DidBrandConnect from '@arcblock/icons/lib/DidBrandConnect';
3
+ import { useTheme } from '@mui/material';
4
+ export default function DidConnectLogo() {
5
+ const theme = useTheme();
6
+ return /*#__PURE__*/_jsx(DidBrandConnect, {
7
+ style: {
8
+ filter: theme.palette.mode === 'dark' ? 'invert(1)' : 'none'
9
+ }
10
+ });
11
+ }
@@ -0,0 +1,7 @@
1
+ export { default as DIDConnectFooter } from './did-connect-footer';
2
+ export { default as AppInfoItem } from './app-info-item';
3
+ export { default as AppIcon } from './app-icon';
4
+ export { default as PoweredBy } from './powered-by';
5
+ export { default as withContainer } from './with-container';
6
+ export { default as withUxTheme } from './with-ux-theme';
7
+ export { default as DIDConnectLogo } from './did-connect-logo';
@@ -0,0 +1,7 @@
1
+ export { default as DIDConnectFooter } from './did-connect-footer';
2
+ export { default as AppInfoItem } from './app-info-item';
3
+ export { default as AppIcon } from './app-icon';
4
+ export { default as PoweredBy } from './powered-by';
5
+ export { default as withContainer } from './with-container';
6
+ export { default as withUxTheme } from './with-ux-theme';
7
+ export { default as DIDConnectLogo } from './did-connect-logo';
@@ -0,0 +1,3 @@
1
+ export default function PoweredBy({ ...rest }: {
2
+ [x: string]: any;
3
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,46 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Box, useTheme } from '@mui/material';
3
+ import { Icon } from '@iconify/react';
4
+ import shieldCheckIcon from '@iconify-icons/mdi/shield-check';
5
+ import DidConnectLogo from './did-connect-logo';
6
+ import { mergeSx } from '../Util/style';
7
+ export default function PoweredBy({
8
+ ...rest
9
+ }) {
10
+ const {
11
+ palette
12
+ } = useTheme();
13
+ return /*#__PURE__*/_jsxs(Box, {
14
+ ...rest,
15
+ sx: mergeSx({
16
+ display: 'flex',
17
+ alignItems: 'center',
18
+ justifyContent: 'center',
19
+ color: 'text.secondary',
20
+ gap: 0.5,
21
+ fontSize: 12,
22
+ fontFamily: 'Lexend',
23
+ whiteSpace: 'nowrap'
24
+ }, rest?.sx),
25
+ children: [/*#__PURE__*/_jsx(Icon, {
26
+ icon: shieldCheckIcon,
27
+ color: palette.success.main
28
+ }), "Secured by", /*#__PURE__*/_jsx(Box, {
29
+ component: "a",
30
+ href: "https://www.didconnect.io/",
31
+ target: "_blank",
32
+ rel: "noopener",
33
+ sx: {
34
+ color: 'initial',
35
+ display: 'flex',
36
+ alignItems: 'center',
37
+ gap: 0.5,
38
+ textDecoration: 'none',
39
+ '&:hover': {
40
+ textDecoration: 'underline'
41
+ }
42
+ },
43
+ children: /*#__PURE__*/_jsx(DidConnectLogo, {})
44
+ })]
45
+ });
46
+ }
@@ -0,0 +1,11 @@
1
+ import { Locale } from '../type';
2
+ export default function withContainer(Component: React.ComponentType<any>): ({ popup, open, hideCloseButton, ...rest }: {
3
+ popup?: boolean;
4
+ open?: boolean;
5
+ hideCloseButton?: boolean;
6
+ onClose: () => void;
7
+ blocklet?: any;
8
+ origin?: string;
9
+ host?: string;
10
+ locale?: Locale;
11
+ }) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,273 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { forwardRef, memo, useRef, useState, createElement as _createElement } from 'react';
3
+ import { Dialog, DialogContent, useMediaQuery, Box, Backdrop, SwipeableDrawer, Drawer } from '@mui/material';
4
+ import { useDebounce, useMemoizedFn } from 'ahooks';
5
+ import { useBrowser } from '@arcblock/react-hooks';
6
+ import colorConvert from 'color-convert';
7
+ import { useTheme } from '../Theme';
8
+ import { mergeSx } from '../Util/style';
9
+ import { hexToRgba } from '../Util';
10
+ const BackdropWrap = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((backdropProps, ref) => {
11
+ return /*#__PURE__*/_createElement(Backdrop, {
12
+ open: true,
13
+ ref: ref,
14
+ style: {
15
+ backgroundColor: 'rgba(0, 0, 0, 0.6)',
16
+ backdropFilter: 'blur(3px)',
17
+ touchAction: 'none'
18
+ },
19
+ ...backdropProps,
20
+ key: "background"
21
+ });
22
+ }));
23
+ export default function withContainer(Component) {
24
+ function WithContainerComponent({
25
+ popup = false,
26
+ open = false,
27
+ hideCloseButton = false,
28
+ ...rest
29
+ }) {
30
+ const [color, setColor] = useState('#fff');
31
+ const drawerDragger = useRef(null);
32
+ const browser = useBrowser();
33
+ // 屏宽小于 sm 且在 mobile 设备中全屏显示 dialog (PC 端屏宽小于 sm 的情况正常弹窗, 不全屏显示)
34
+ const matchSm = useMediaQuery('(max-width:640px)');
35
+ let openVariant = 'page';
36
+ if (popup) {
37
+ openVariant = 'dialog';
38
+ if (matchSm && browser.mobile.any) {
39
+ openVariant = 'drawer';
40
+ }
41
+ }
42
+ const theme = useTheme();
43
+
44
+ // 兼容 did-react 版本中存在的 responsive prop, responsive=true 则让 dialog 始终保持 open 状态, 否则遵循外部传入的 open prop
45
+ const isOpen = open;
46
+ const leavingScreenDelay = theme?.transitions?.duration?.leavingScreen || 500; // 默认值是 195
47
+ const debouncedShow = useDebounce(isOpen, {
48
+ wait: leavingScreenDelay
49
+ });
50
+ const removeMagicToken = useMemoizedFn(() => {
51
+ const searchParams = new URLSearchParams(window.location.search);
52
+ if (searchParams.get('magicToken')) {
53
+ searchParams.delete('magicToken');
54
+ }
55
+ window.history.replaceState({}, '', `${window.location.pathname}?${searchParams.toString()}`);
56
+ });
57
+
58
+ // eslint-disable-next-line no-unused-vars
59
+ const handleOnClose = (e, reason) => {
60
+ if (['backdropClick', 'escapeKeyDown'].includes(reason)) return;
61
+ removeMagicToken();
62
+ rest?.onClose();
63
+ };
64
+ const showModal = debouncedShow || isOpen;
65
+ const DrawerComponent = hideCloseButton ? Drawer : SwipeableDrawer;
66
+ const hslColor = colorConvert.hex.hsl(color);
67
+ const [h, s, l] = hslColor;
68
+ const percentageList = [0, 30, 60, 30, 0, 30, 60, 30];
69
+ const maxPercentage = Math.max(...percentageList);
70
+ const minPercentage = Math.min(...percentageList);
71
+ let useAlpha = false;
72
+ if (l * (100 + maxPercentage) / 100 > 100 || l * (100 + minPercentage) / 100 < 0) {
73
+ // 超出范围,使用 alpha 通道变化
74
+ useAlpha = true;
75
+ }
76
+ const colorList = percentageList.map(percentageItem => {
77
+ let finalL = l * (100 + percentageItem) / 100;
78
+ let finalAlpha = 0.6;
79
+ if (useAlpha) {
80
+ finalAlpha = 0.5 * (100 + percentageItem) / 100;
81
+ } else {
82
+ finalL = l * (100 + percentageItem) / 100;
83
+ }
84
+ return `hsla(${h}, ${s}%, ${finalL}%, ${finalAlpha})`;
85
+ });
86
+ const background = `linear-gradient(45deg, ${colorList.join(', ')})`;
87
+ const colorListGlow = percentageList.map(percentageItem => {
88
+ let finalL = l * (100 + percentageItem) / 100;
89
+ let finalAlpha = 0.2;
90
+ if (useAlpha) {
91
+ finalAlpha = 0.3 * (100 + percentageItem) / 100;
92
+ } else {
93
+ finalL = l * (100 + percentageItem) / 100;
94
+ }
95
+ return `hsla(${h}, ${s}%, ${finalL}%, ${finalAlpha})`;
96
+ });
97
+ const backgroundGlow = `linear-gradient(45deg, ${colorListGlow.join(', ')})`;
98
+ const glowStyle = {
99
+ overflow: 'visible',
100
+ '&::before, &::after': {
101
+ content: '""',
102
+ position: 'absolute',
103
+ top: '-3px',
104
+ right: '-3px',
105
+ bottom: '-3px',
106
+ left: '-3px',
107
+ background,
108
+ backgroundSize: '300% 300%',
109
+ backgroundRepeat: 'no-repeat',
110
+ animation: 'glowRotate 10s linear infinite',
111
+ borderRadius: '14px !important',
112
+ zIndex: 0
113
+ },
114
+ '&::after': {
115
+ background: backgroundGlow,
116
+ filter: 'blur(15px)'
117
+ },
118
+ '@keyframes glowRotate': {
119
+ '0%': {
120
+ backgroundPosition: '0 0'
121
+ },
122
+ '50%': {
123
+ backgroundPosition: '100% 0'
124
+ },
125
+ '100%': {
126
+ backgroundPosition: '0 0'
127
+ }
128
+ }
129
+ };
130
+ const wrapOnClose = useMemoizedFn(() => {
131
+ removeMagicToken();
132
+ rest?.onClose();
133
+ });
134
+ if (openVariant === 'page') {
135
+ return /*#__PURE__*/_jsx(Box, {
136
+ className: "did-connect__container-page",
137
+ sx: mergeSx(glowStyle, {
138
+ borderRadius: 1,
139
+ position: 'relative',
140
+ zIndex: 1
141
+ }),
142
+ children: /*#__PURE__*/_jsx(Box, {
143
+ sx: {
144
+ border: `1px solid ${hexToRgba(color, 0.1)}`,
145
+ m: '-1px',
146
+ position: 'relative',
147
+ borderRadius: '12px',
148
+ zIndex: 2,
149
+ overflow: 'hidden'
150
+ },
151
+ children: /*#__PURE__*/_jsx(Component, {
152
+ ...rest,
153
+ onClose: wrapOnClose,
154
+ setColor: setColor,
155
+ hideCloseButton: true,
156
+ mode: openVariant
157
+ })
158
+ })
159
+ });
160
+ }
161
+ if (openVariant === 'drawer') {
162
+ return /*#__PURE__*/_jsxs(DrawerComponent, {
163
+ className: "did-connect__container-drawer",
164
+ disableSwipeToOpen: true,
165
+ open: isOpen,
166
+ anchor: "bottom",
167
+ drawerDragger: drawerDragger.current
168
+ // @ts-ignore
169
+ ,
170
+ onClose: handleOnClose,
171
+ slots: {
172
+ backdrop: BackdropWrap
173
+ },
174
+ PaperProps: {
175
+ sx: {
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
+ }
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__*/_jsx(Box, {
219
+ sx: {
220
+ touchAction: 'none',
221
+ maxWidth: '100%',
222
+ width: 500,
223
+ height: 'auto'
224
+ },
225
+ children: showModal ? /*#__PURE__*/_jsx(Component, {
226
+ ...rest,
227
+ onClose: wrapOnClose,
228
+ setColor: setColor,
229
+ hideCloseButton: true,
230
+ mode: openVariant
231
+ }) : null
232
+ })]
233
+ });
234
+ }
235
+ return /*#__PURE__*/_jsx(Dialog, {
236
+ open: isOpen,
237
+ slots: {
238
+ backdrop: BackdropWrap
239
+ },
240
+ className: "did-connect__container-dialog",
241
+ onClose: handleOnClose,
242
+ PaperProps: {
243
+ sx: {
244
+ // 避免样式被 server 中的定义覆盖
245
+ '&.MuiPaper-rounded': {
246
+ borderRadius: '12px !important'
247
+ },
248
+ position: 'relative',
249
+ ...glowStyle
250
+ }
251
+ },
252
+ children: /*#__PURE__*/_jsx(DialogContent, {
253
+ sx: {
254
+ maxWidth: 'calc(100vw - 18px)',
255
+ maxHeight: 'calc(100vh - 18px)',
256
+ p: '0px !important',
257
+ height: 'auto',
258
+ backgroundColor: 'background.default',
259
+ borderRadius: '12px !important',
260
+ zIndex: 1
261
+ },
262
+ children: showModal ? /*#__PURE__*/_jsx(Component, {
263
+ ...rest,
264
+ onClose: wrapOnClose,
265
+ setColor: setColor,
266
+ hideCloseButton: hideCloseButton,
267
+ mode: openVariant
268
+ }) : null
269
+ })
270
+ });
271
+ }
272
+ return WithContainerComponent;
273
+ }
@@ -0,0 +1 @@
1
+ export default function withUxTheme(Component: React.ComponentType<any>): (props: any) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,23 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { createTheme, useTheme } from '@mui/material';
3
+ import { DID_CONNECT_THEME_LIGHT, DID_CONNECT_THEME_DARK } from '@blocklet/theme';
4
+ import { ThemeProvider } from '../Theme';
5
+
6
+ // DID Connect 使用自己的 Theme 配置,不受 Blocklet theme 影响
7
+ const themeLight = createTheme(DID_CONNECT_THEME_LIGHT);
8
+ const themeDark = createTheme(DID_CONNECT_THEME_DARK);
9
+ export default function withUxTheme(Component) {
10
+ function WithUxThemeComponent(props) {
11
+ const {
12
+ palette
13
+ } = useTheme();
14
+ const theme = palette.mode === 'dark' ? themeDark : themeLight;
15
+ return /*#__PURE__*/_jsx(ThemeProvider, {
16
+ theme: theme,
17
+ children: /*#__PURE__*/_jsx(Component, {
18
+ ...props
19
+ })
20
+ });
21
+ }
22
+ return WithUxThemeComponent;
23
+ }
@@ -9,6 +9,7 @@
9
9
  * children?: React.ReactNode,
10
10
  * showCancelButton?: true | false,
11
11
  * showCloseButton?: true | false,
12
+ * showConfirmButton?: true | false,
12
13
  * fullScreen?: false | true,
13
14
  * confirmButton?: {text: React.ReactNode, props?: ButtonProps}
14
15
  * cancelButton?: {text: React.ReactNode, props?: ButtonProps}
@@ -20,7 +21,7 @@
20
21
  * @param {ConfirmProps} props
21
22
  * @returns {import('react').ReactComponentElement}
22
23
  */
23
- declare function Confirm({ title, children, onConfirm, onCancel, showCloseButton, showCancelButton, fullScreen, confirmButton, cancelButton, PaperProps, ...rest }: ConfirmProps): import("react").ReactComponentElement<any, Pick<any, string | number | symbol>>;
24
+ declare function Confirm({ title, children, onConfirm, onCancel, showCloseButton, showCancelButton, showConfirmButton, fullScreen, confirmButton, cancelButton, PaperProps, ...rest }: ConfirmProps): import("react").ReactComponentElement<any, Pick<any, string | number | symbol>>;
24
25
  declare namespace Confirm {
25
26
  namespace propTypes {
26
27
  let title: PropTypes.Validator<NonNullable<PropTypes.ReactNodeLike>>;
@@ -29,6 +30,7 @@ declare namespace Confirm {
29
30
  let onCancel: PropTypes.Validator<(...args: any[]) => any>;
30
31
  let children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
31
32
  let showCancelButton: PropTypes.Requireable<boolean>;
33
+ let showConfirmButton: PropTypes.Requireable<boolean>;
32
34
  let showCloseButton: PropTypes.Requireable<boolean>;
33
35
  let fullScreen: PropTypes.Requireable<boolean>;
34
36
  let confirmButton: PropTypes.Requireable<PropTypes.InferProps<{
@@ -44,6 +46,8 @@ declare namespace Confirm {
44
46
  namespace defaultProps {
45
47
  let showCancelButton_1: boolean;
46
48
  export { showCancelButton_1 as showCancelButton };
49
+ let showConfirmButton_1: boolean;
50
+ export { showConfirmButton_1 as showConfirmButton };
47
51
  let showCloseButton_1: boolean;
48
52
  export { showCloseButton_1 as showCloseButton };
49
53
  let fullScreen_1: boolean;
@@ -72,6 +76,7 @@ export type ConfirmProps = {
72
76
  children?: React.ReactNode;
73
77
  showCancelButton?: true | false;
74
78
  showCloseButton?: true | false;
79
+ showConfirmButton?: true | false;
75
80
  fullScreen?: false | true;
76
81
  confirmButton?: {
77
82
  text: React.ReactNode;