@arcblock/ux 2.9.13 → 2.9.14
Sign up to get free protection for your applications and to get access to all the features.
- package/es/Address/did-address.js +18 -13
- package/es/Colors/themes/default.js +0 -1
- package/es/Colors/themes/temp.js +10 -1
- package/es/ContactForm/index.js +2 -2
- package/es/DID/index.js +0 -1
- package/es/Dialog/confirm.js +1 -99
- package/es/Dialog/dialog.js +4 -7
- package/es/Dialog/index.js +1 -1
- package/es/Dialog/use-confirm.js +105 -0
- package/es/Locale/util.js +10 -5
- package/es/NFTDisplay/index.js +0 -1
- package/es/Passport/index.js +2 -0
- package/es/Passport/passport.js +103 -0
- package/es/SessionUser/components/logged-in.js +1 -1
- package/es/SessionUser/components/user-info.js +1 -1
- package/es/SessionUser/index.js +2 -2
- package/es/Tabs/index.js +88 -2
- package/es/Util/passport.js +62 -0
- package/lib/ActionButton/index.js +6 -7
- package/lib/ActivityIndicator/index.js +4 -4
- package/lib/Address/compact-text.js +6 -6
- package/lib/Address/did-address.js +25 -21
- package/lib/Address/index.js +4 -4
- package/lib/Address/responsive-did-address.js +4 -4
- package/lib/Alert/index.js +5 -6
- package/lib/AnimationWaiter/index.js +4 -4
- package/lib/Async/index.js +6 -6
- package/lib/Avatar/did-motif.js +5 -6
- package/lib/Avatar/etherscan-blockies.js +2 -3
- package/lib/Avatar/index.js +4 -4
- package/lib/Badge/index.js +5 -6
- package/lib/Blocklet/blocklet.js +4 -4
- package/lib/Blocklet/index.js +3 -4
- package/lib/Blocklet/utils.js +3 -5
- package/lib/BlockletContext/index.js +1 -2
- package/lib/BlockletNFT/index.js +4 -4
- package/lib/Button/index.js +1 -2
- package/lib/Button/wrap.js +4 -4
- package/lib/ButtonGroup/index.js +1 -2
- package/lib/ClickToCopy/copy-button.js +4 -4
- package/lib/ClickToCopy/index.js +6 -6
- package/lib/CodeBlock/LightBox.js +1 -2
- package/lib/CodeBlock/index.js +4 -4
- package/lib/Colors/themes/default.js +1 -2
- package/lib/Colors/themes/temp.js +11 -3
- package/lib/ContactForm/index.js +2 -2
- package/lib/CookieConsent/index.js +6 -6
- package/lib/CountDown/index.js +4 -4
- package/lib/DID/index.js +7 -9
- package/lib/Datatable/CustomToolbar.js +2 -2
- package/lib/Datatable/index.js +49 -49
- package/lib/Datatable/utils.js +2 -3
- package/lib/Dialog/confirm.js +5 -113
- package/lib/Dialog/dialog.js +14 -18
- package/lib/Dialog/index.js +3 -4
- package/lib/Dialog/use-confirm.js +126 -0
- package/lib/Earth/index.js +7 -8
- package/lib/Empty/index.js +5 -6
- package/lib/Header/auto-hidden.js +5 -6
- package/lib/Header/header.js +5 -6
- package/lib/Header/responsive-header.js +5 -6
- package/lib/Icon/image.js +4 -4
- package/lib/Icon/index.js +6 -7
- package/lib/Img/index.js +5 -6
- package/lib/InfoRow/index.js +5 -6
- package/lib/Layout/dashboard/external-link.js +4 -4
- package/lib/Layout/dashboard/full-page.js +5 -6
- package/lib/Layout/dashboard/index.js +4 -4
- package/lib/Layout/dashboard/sidebar.js +5 -6
- package/lib/Layout/dashboard-legacy/header.js +4 -4
- package/lib/Layout/dashboard-legacy/index.js +4 -4
- package/lib/Layout/dashboard-legacy/sidebar.js +4 -4
- package/lib/Layout/index.js +4 -4
- package/lib/Locale/browser-lang.js +1 -2
- package/lib/Locale/context.js +6 -8
- package/lib/Locale/languages.js +7 -9
- package/lib/Locale/selector.js +4 -4
- package/lib/Locale/util.js +12 -11
- package/lib/Logo/index.js +4 -4
- package/lib/NFTDisplay/aspect-ratio-container.js +5 -6
- package/lib/NFTDisplay/broken.js +4 -4
- package/lib/NFTDisplay/index.js +5 -7
- package/lib/NFTDisplay/svg-embedder/img.js +5 -6
- package/lib/NFTDisplay/svg-embedder/inline-svg.js +5 -6
- package/lib/NavMenu/nav-menu.js +5 -6
- package/lib/NavMenu/style.js +2 -4
- package/lib/PageScroller/index.js +6 -7
- package/lib/Passport/index.js +9 -0
- package/lib/Passport/passport.js +116 -0
- package/lib/PoweredByArcBlock/index.js +4 -4
- package/lib/PricingTable/PricingPlan.js +1 -2
- package/lib/PricingTable/index.js +1 -2
- package/lib/QRCode/index.js +5 -6
- package/lib/RelativeTime/index.js +4 -4
- package/lib/Result/common.js +4 -4
- package/lib/Result/index.js +7 -8
- package/lib/Result/result.js +5 -6
- package/lib/Result/translations.js +2 -3
- package/lib/Screenshot/BaseScreenshot/index.js +5 -6
- package/lib/Screenshot/BaseScreenshot/shells/Macbook.js +10 -15
- package/lib/Screenshot/BaseScreenshot/shells/Phone.js +10 -15
- package/lib/Screenshot/index.js +5 -6
- package/lib/SessionBlocklet/index.js +4 -4
- package/lib/SessionManager/index.js +1 -2
- package/lib/SessionUser/components/logged-in.js +5 -5
- package/lib/SessionUser/components/session-user-item.js +5 -6
- package/lib/SessionUser/components/session-user-switch.js +4 -4
- package/lib/SessionUser/components/user-info.js +1 -1
- package/lib/SessionUser/index.js +2 -2
- package/lib/SessionUser/libs/translation.js +2 -3
- package/lib/Spinner/index.js +13 -14
- package/lib/SplitButton/index.js +4 -4
- package/lib/Switch/index.js +5 -6
- package/lib/Tabs/index.js +98 -11
- package/lib/Tag/index.js +5 -6
- package/lib/TextCollapse/index.js +5 -6
- package/lib/Theme/index.js +6 -7
- package/lib/Theme/theme.js +6 -8
- package/lib/Toast/index.js +12 -13
- package/lib/Typography/index.js +4 -4
- package/lib/Util/constant.js +10 -20
- package/lib/Util/deprecate.js +4 -4
- package/lib/Util/index.js +2 -4
- package/lib/Util/passport.js +72 -0
- package/lib/Util/wallet.js +1 -2
- package/lib/Video/index.js +4 -4
- package/lib/Wallet/Action.js +4 -4
- package/lib/Wallet/Download.js +4 -4
- package/lib/WebWalletSWKeeper/index.js +5 -6
- package/lib/withTheme/index.js +5 -6
- package/lib/withTracker/error_boundary.js +2 -2
- package/lib/withTracker/index.js +8 -9
- package/package.json +9 -4
- package/src/Address/did-address.jsx +15 -12
- package/src/Colors/themes/temp.js +9 -0
- package/src/Dialog/confirm.jsx +94 -0
- package/src/Dialog/{dialog.js → dialog.jsx} +14 -7
- package/src/Dialog/index.js +1 -1
- package/src/Dialog/use-confirm.jsx +114 -0
- package/src/Locale/util.js +12 -5
- package/src/Passport/index.jsx +3 -0
- package/src/Passport/passport.jsx +99 -0
- package/src/SessionUser/components/logged-in.jsx +1 -1
- package/src/SessionUser/components/user-info.jsx +1 -1
- package/src/SessionUser/index.jsx +1 -1
- package/src/Tabs/index.jsx +124 -0
- package/src/Util/passport.js +75 -0
- package/src/Dialog/confirm.js +0 -201
- package/src/Tabs/index.js +0 -45
package/src/Dialog/confirm.js
DELETED
@@ -1,201 +0,0 @@
|
|
1
|
-
import PropTypes from 'prop-types';
|
2
|
-
import { forwardRef, useRef, useImperativeHandle } from 'react';
|
3
|
-
import { useMemoizedFn, useReactive } from 'ahooks';
|
4
|
-
import noop from 'lodash/noop';
|
5
|
-
|
6
|
-
import Button from '../Button';
|
7
|
-
import Dialog from './dialog';
|
8
|
-
|
9
|
-
/**
|
10
|
-
@typedef {Object} ConfirmProps
|
11
|
-
@property {boolean} open
|
12
|
-
@property {React.ReactNode} title
|
13
|
-
@property {React.ReactNode} children
|
14
|
-
@property {() => void | Promise<void>} onConfirm
|
15
|
-
@property {() => void | Promise<void>} onCancel
|
16
|
-
@property {boolean} [showCancelButton=true]
|
17
|
-
@property {{text: string, props?: import('../Button/wrap').ButtonProps}} [confirmButton={text: 'Confirm'}]
|
18
|
-
@property {{text: string, props?: import('../Button/wrap').ButtonProps}} [cancelButton={text: 'Cancel'}]
|
19
|
-
@property {import('@mui/material').PaperProps} [PaperProps={}]
|
20
|
-
*/
|
21
|
-
|
22
|
-
// 注意排在 {...rest} 之后的 props 优先级更高
|
23
|
-
/**
|
24
|
-
*
|
25
|
-
* @param {ConfirmProps} props
|
26
|
-
* @returns {import('react').ReactComponentElement}
|
27
|
-
*/
|
28
|
-
export default function Confirm({
|
29
|
-
title,
|
30
|
-
children,
|
31
|
-
onConfirm,
|
32
|
-
onCancel,
|
33
|
-
showCancelButton,
|
34
|
-
confirmButton,
|
35
|
-
cancelButton,
|
36
|
-
PaperProps,
|
37
|
-
...rest
|
38
|
-
}) {
|
39
|
-
// 去除 dialog 默认的 300 最小高度
|
40
|
-
PaperProps.style = Object.assign(
|
41
|
-
{
|
42
|
-
minHeight: 0,
|
43
|
-
},
|
44
|
-
PaperProps.style
|
45
|
-
);
|
46
|
-
|
47
|
-
return (
|
48
|
-
<Dialog
|
49
|
-
title={title}
|
50
|
-
PaperProps={PaperProps}
|
51
|
-
{...rest}
|
52
|
-
onClose={() => onCancel()}
|
53
|
-
actions={
|
54
|
-
<>
|
55
|
-
{showCancelButton && (
|
56
|
-
<Button onClick={() => onCancel()} color="primary" {...cancelButton.props}>
|
57
|
-
{cancelButton.text}
|
58
|
-
</Button>
|
59
|
-
)}
|
60
|
-
<Button onClick={() => onConfirm()} color="primary" autoFocus {...confirmButton.props}>
|
61
|
-
{confirmButton.text}
|
62
|
-
</Button>
|
63
|
-
</>
|
64
|
-
}>
|
65
|
-
{children}
|
66
|
-
</Dialog>
|
67
|
-
);
|
68
|
-
}
|
69
|
-
|
70
|
-
Confirm.propTypes = {
|
71
|
-
title: PropTypes.node.isRequired,
|
72
|
-
children: PropTypes.node.isRequired,
|
73
|
-
onConfirm: PropTypes.func.isRequired,
|
74
|
-
onCancel: PropTypes.func.isRequired,
|
75
|
-
showCancelButton: PropTypes.bool,
|
76
|
-
// 可以传入 {text: ..., props: ...}
|
77
|
-
confirmButton: PropTypes.shape({
|
78
|
-
text: PropTypes.string.isRequired,
|
79
|
-
props: PropTypes.object,
|
80
|
-
}),
|
81
|
-
cancelButton: PropTypes.shape({
|
82
|
-
text: PropTypes.string.isRequired,
|
83
|
-
props: PropTypes.object,
|
84
|
-
}),
|
85
|
-
PaperProps: PropTypes.object,
|
86
|
-
};
|
87
|
-
|
88
|
-
Confirm.defaultProps = {
|
89
|
-
showCancelButton: true,
|
90
|
-
confirmButton: {
|
91
|
-
text: 'Confirm',
|
92
|
-
},
|
93
|
-
cancelButton: {
|
94
|
-
text: 'Cancel',
|
95
|
-
},
|
96
|
-
PaperProps: {},
|
97
|
-
};
|
98
|
-
|
99
|
-
const ConfirmHolder = forwardRef((props, ref) => {
|
100
|
-
const state = useReactive({
|
101
|
-
show: false,
|
102
|
-
title: '',
|
103
|
-
content: '',
|
104
|
-
onConfirm: noop,
|
105
|
-
onCancel: noop,
|
106
|
-
loading: false,
|
107
|
-
confirmButtonText: 'Confirm',
|
108
|
-
cancelButtonText: 'Cancel',
|
109
|
-
});
|
110
|
-
const open = useMemoizedFn((params = {}) => {
|
111
|
-
state.show = true;
|
112
|
-
state.title = params.title;
|
113
|
-
state.content = params.content;
|
114
|
-
state.onConfirm = params.onConfirm || noop;
|
115
|
-
state.onCancel = params.onCancel || noop;
|
116
|
-
if (params.confirmButtonText) state.confirmButtonText = params.confirmButtonText;
|
117
|
-
if (params.cancelButtonText) state.cancelButtonText = params.cancelButtonText;
|
118
|
-
state.loading = false;
|
119
|
-
});
|
120
|
-
const reset = useMemoizedFn(() => {
|
121
|
-
state.title = '';
|
122
|
-
state.content = '';
|
123
|
-
state.onConfirm = noop;
|
124
|
-
state.onCancel = noop;
|
125
|
-
state.confirmButtonText = 'Confirm';
|
126
|
-
state.cancelButtonText = 'Cancel';
|
127
|
-
});
|
128
|
-
const close = useMemoizedFn(() => {
|
129
|
-
state.show = false;
|
130
|
-
setTimeout(() => {
|
131
|
-
reset();
|
132
|
-
}, 300);
|
133
|
-
});
|
134
|
-
const onCancel = useMemoizedFn(() => {
|
135
|
-
close();
|
136
|
-
state?.onCancel();
|
137
|
-
}, []);
|
138
|
-
const onConfirm = useMemoizedFn(async () => {
|
139
|
-
state.loading = true;
|
140
|
-
try {
|
141
|
-
await state?.onConfirm(close);
|
142
|
-
} finally {
|
143
|
-
state.loading = false;
|
144
|
-
}
|
145
|
-
}, []);
|
146
|
-
useImperativeHandle(
|
147
|
-
ref,
|
148
|
-
() => {
|
149
|
-
return {
|
150
|
-
open,
|
151
|
-
close,
|
152
|
-
};
|
153
|
-
},
|
154
|
-
[open, close]
|
155
|
-
);
|
156
|
-
|
157
|
-
return (
|
158
|
-
<Confirm
|
159
|
-
open={state.show}
|
160
|
-
title={state.title}
|
161
|
-
onConfirm={onConfirm}
|
162
|
-
onCancel={onCancel}
|
163
|
-
confirmButton={{
|
164
|
-
text: state.confirmButtonText,
|
165
|
-
props: {
|
166
|
-
variant: 'contained',
|
167
|
-
color: 'primary',
|
168
|
-
loading: state.loading,
|
169
|
-
},
|
170
|
-
}}
|
171
|
-
cancelButton={{
|
172
|
-
text: state.cancelButtonText,
|
173
|
-
props: {
|
174
|
-
variant: 'outlined',
|
175
|
-
color: 'primary',
|
176
|
-
},
|
177
|
-
}}>
|
178
|
-
{state.content}
|
179
|
-
</Confirm>
|
180
|
-
);
|
181
|
-
});
|
182
|
-
|
183
|
-
export function useConfirm() {
|
184
|
-
const confirmRef = useRef(null);
|
185
|
-
|
186
|
-
const open = useMemoizedFn((...args) => {
|
187
|
-
confirmRef.current?.open(...args);
|
188
|
-
});
|
189
|
-
const close = useMemoizedFn((...args) => {
|
190
|
-
confirmRef.current?.close(...args);
|
191
|
-
});
|
192
|
-
const confirmApi = {
|
193
|
-
open,
|
194
|
-
close,
|
195
|
-
};
|
196
|
-
|
197
|
-
return {
|
198
|
-
confirmHolder: <ConfirmHolder ref={confirmRef} />,
|
199
|
-
confirmApi,
|
200
|
-
};
|
201
|
-
}
|
package/src/Tabs/index.js
DELETED
@@ -1,45 +0,0 @@
|
|
1
|
-
import PropTypes from 'prop-types';
|
2
|
-
import MuiTabs from '@mui/material/Tabs';
|
3
|
-
import MuiTab from '@mui/material/Tab';
|
4
|
-
import { styled } from '../Theme';
|
5
|
-
|
6
|
-
const PREFIX = 'index';
|
7
|
-
|
8
|
-
const classes = {
|
9
|
-
tabs: `${PREFIX}-tabs`,
|
10
|
-
tab: `${PREFIX}-tab`,
|
11
|
-
};
|
12
|
-
|
13
|
-
const StyledMuiTabs = styled(MuiTabs)(({ theme }) => ({
|
14
|
-
[`& .${classes.tabs}`]: {},
|
15
|
-
|
16
|
-
[`& .${classes.tab}`]: {
|
17
|
-
fontSize: '0.875rem',
|
18
|
-
[theme.breakpoints.up('md')]: {
|
19
|
-
fontSize: '1rem',
|
20
|
-
},
|
21
|
-
},
|
22
|
-
}));
|
23
|
-
|
24
|
-
export default function Tabs({ tabs, current, onChange, ...rest }) {
|
25
|
-
return (
|
26
|
-
<StyledMuiTabs
|
27
|
-
scrollButtons="auto"
|
28
|
-
variant="scrollable"
|
29
|
-
value={current}
|
30
|
-
onChange={(_, newValue) => onChange(newValue)}
|
31
|
-
indicatorColor="primary"
|
32
|
-
{...rest}
|
33
|
-
className={[classes.tabs, rest.className || ''].join(' ')}>
|
34
|
-
{tabs.map((x) => (
|
35
|
-
<MuiTab className={classes.tab} key={x.value} value={x.value} label={x.label} icon={x.icon || null} />
|
36
|
-
))}
|
37
|
-
</StyledMuiTabs>
|
38
|
-
);
|
39
|
-
}
|
40
|
-
|
41
|
-
Tabs.propTypes = {
|
42
|
-
tabs: PropTypes.array.isRequired,
|
43
|
-
current: PropTypes.string.isRequired,
|
44
|
-
onChange: PropTypes.func.isRequired,
|
45
|
-
};
|