@arcblock/ux 2.13.12 → 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.
- package/lib/ActivityIndicator/index.js +9 -5
- package/lib/Address/did-address.js +14 -7
- package/lib/Address/responsive-did-address.js +3 -1
- package/lib/BlockletV2/blocklet.js +1 -1
- package/lib/CloseButton/index.js +1 -2
- package/lib/Colors/index.d.ts +1 -3
- package/lib/Colors/index.js +2 -4
- package/lib/Colors/themes/default.d.ts +3 -66
- package/lib/Colors/themes/default.js +4 -74
- package/lib/Colors/themes/did-connect.d.ts +11 -6
- package/lib/Colors/themes/did-connect.js +17 -12
- package/lib/Colors/themes/temp.d.ts +3 -0
- package/lib/Colors/themes/temp.js +3 -0
- package/lib/Config/config-provider.d.ts +4 -5
- package/lib/Config/config-provider.js +7 -26
- package/lib/Config/theme-mode-toggle.js +0 -1
- package/lib/DID/index.js +3 -4
- package/lib/DIDConnect/app-icon.d.ts +8 -0
- package/lib/DIDConnect/app-icon.js +31 -0
- package/lib/DIDConnect/app-info-item.d.ts +7 -0
- package/lib/DIDConnect/app-info-item.js +73 -0
- package/lib/DIDConnect/did-connect-footer.d.ts +4 -0
- package/lib/DIDConnect/did-connect-footer.js +54 -0
- package/lib/DIDConnect/did-connect-logo.d.ts +1 -0
- package/lib/DIDConnect/did-connect-logo.js +11 -0
- package/lib/DIDConnect/index.d.ts +7 -0
- package/lib/DIDConnect/index.js +7 -0
- package/lib/DIDConnect/powered-by.d.ts +3 -0
- package/lib/DIDConnect/powered-by.js +46 -0
- package/lib/DIDConnect/with-container.d.ts +11 -0
- package/lib/DIDConnect/with-container.js +273 -0
- package/lib/DIDConnect/with-ux-theme.d.ts +1 -0
- package/lib/DIDConnect/with-ux-theme.js +23 -0
- package/lib/Datatable/CustomToolbar.js +3 -0
- package/lib/Datatable/index.js +105 -71
- package/lib/Dialog/confirm.d.ts +6 -1
- package/lib/Dialog/confirm.js +7 -3
- package/lib/Dialog/use-confirm.js +6 -0
- package/lib/Footer/index.js +2 -5
- package/lib/Header/header.js +3 -1
- package/lib/Header/responsive-header.js +3 -1
- package/lib/Layout/dashboard/index.js +14 -2
- package/lib/Layout/dashboard/sidebar.js +1 -2
- package/lib/LoadingMask/index.js +4 -3
- package/lib/Locale/selector.js +3 -3
- package/lib/Locale/util.d.ts +3 -3
- package/lib/Locale/util.js +6 -1
- package/lib/LoginButton/index.d.ts +12 -0
- package/lib/LoginButton/index.js +74 -0
- package/lib/NavMenu/nav-menu.js +14 -9
- package/lib/NavMenu/products.js +3 -1
- package/lib/NavMenu/style.js +7 -3
- package/lib/NavMenu/sub-item-group.js +1 -1
- package/lib/PhoneInput/country-select.js +2 -3
- package/lib/SessionBlocklet/index.js +3 -3
- package/lib/SessionUser/components/did-space.js +14 -28
- package/lib/SessionUser/components/logged-in.js +2 -2
- package/lib/SessionUser/components/quick-login-item.js +13 -11
- package/lib/SessionUser/components/session-user-item.js +5 -6
- package/lib/SessionUser/components/session-user-switch.js +15 -13
- package/lib/SessionUser/components/un-login.js +51 -38
- package/lib/SessionUser/components/user-info.js +9 -8
- package/lib/SessionUser/images/did-spaces.svg +7 -13
- package/lib/SharedBridge/index.d.ts +16 -0
- package/lib/SharedBridge/index.js +109 -0
- package/lib/SharedBridge/need-storage-access-api-dialog.d.ts +7 -0
- package/lib/SharedBridge/need-storage-access-api-dialog.js +212 -0
- package/lib/Success/index.js +8 -4
- package/lib/Switch/index.js +3 -3
- package/lib/Tabs/index.js +8 -9
- package/lib/Theme/index.d.ts +2 -2
- package/lib/Theme/index.js +1 -1
- package/lib/Theme/theme-provider.d.ts +5 -1
- package/lib/Theme/theme-provider.js +60 -5
- package/lib/Theme/theme.d.ts +6 -3
- package/lib/Theme/theme.js +55 -19
- package/lib/UserCard/Container/card.js +1 -1
- package/lib/UserCard/Container/dialog.js +1 -1
- package/lib/Util/iframe.d.ts +5 -0
- package/lib/Util/iframe.js +24 -0
- package/lib/Util/index.d.ts +18 -1
- package/lib/Util/index.js +90 -5
- package/lib/type.d.ts +5 -1
- package/package.json +8 -6
- package/src/ActivityIndicator/index.jsx +4 -4
- package/src/Address/did-address.tsx +5 -5
- package/src/Address/responsive-did-address.tsx +11 -1
- package/src/BlockletV2/blocklet.tsx +1 -1
- package/src/CloseButton/index.tsx +1 -2
- package/src/Colors/index.ts +2 -7
- package/src/Colors/themes/default.ts +4 -50
- package/src/Colors/themes/did-connect.ts +13 -6
- package/src/Colors/themes/temp.ts +3 -0
- package/src/Config/config-provider.tsx +17 -30
- package/src/Config/theme-mode-toggle.tsx +1 -1
- package/src/DID/index.tsx +3 -4
- package/src/DIDConnect/app-icon.tsx +36 -0
- package/src/DIDConnect/app-info-item.tsx +82 -0
- package/src/DIDConnect/did-connect-footer.tsx +51 -0
- package/src/DIDConnect/did-connect-logo.tsx +8 -0
- package/src/DIDConnect/index.ts +7 -0
- package/src/DIDConnect/powered-by.tsx +48 -0
- package/src/DIDConnect/with-container.tsx +307 -0
- package/src/DIDConnect/with-ux-theme.tsx +22 -0
- package/src/Datatable/CustomToolbar.jsx +1 -0
- package/src/Datatable/index.jsx +107 -70
- package/src/Dialog/confirm.jsx +31 -23
- package/src/Dialog/use-confirm.jsx +6 -0
- package/src/Footer/index.tsx +2 -2
- package/src/Header/header.tsx +1 -1
- package/src/Header/responsive-header.tsx +2 -0
- package/src/Layout/dashboard/index.tsx +8 -4
- package/src/Layout/dashboard/sidebar.tsx +1 -2
- package/src/LoadingMask/index.tsx +3 -4
- package/src/Locale/selector.tsx +3 -4
- package/src/Locale/util.ts +7 -2
- package/src/LoginButton/index.tsx +73 -0
- package/src/NavMenu/nav-menu.tsx +15 -10
- package/src/NavMenu/products.tsx +1 -1
- package/src/NavMenu/style.ts +5 -2
- package/src/NavMenu/sub-item-group.tsx +1 -1
- package/src/PhoneInput/country-select.tsx +2 -3
- package/src/SessionBlocklet/index.tsx +3 -3
- package/src/SessionUser/components/did-space.tsx +14 -10
- package/src/SessionUser/components/logged-in.tsx +2 -2
- package/src/SessionUser/components/quick-login-item.tsx +11 -12
- package/src/SessionUser/components/session-user-item.tsx +3 -6
- package/src/SessionUser/components/session-user-switch.tsx +13 -12
- package/src/SessionUser/components/un-login.tsx +41 -33
- package/src/SessionUser/components/user-info.tsx +7 -8
- package/src/SessionUser/images/did-spaces.svg +7 -13
- package/src/SharedBridge/index.tsx +123 -0
- package/src/SharedBridge/need-storage-access-api-dialog.tsx +171 -0
- package/src/Success/index.tsx +6 -4
- package/src/Switch/index.jsx +3 -3
- package/src/Tabs/index.tsx +8 -9
- package/src/Theme/index.ts +2 -2
- package/src/Theme/theme-provider.tsx +73 -2
- package/src/Theme/theme.ts +73 -22
- package/src/UserCard/Container/card.tsx +1 -1
- package/src/UserCard/Container/dialog.tsx +1 -1
- package/src/Util/iframe.ts +19 -0
- package/src/Util/index.ts +102 -4
- package/src/type.d.ts +5 -1
package/lib/Datatable/index.js
CHANGED
@@ -503,99 +503,133 @@ const alignCss = css`
|
|
503
503
|
`;
|
504
504
|
const TableContainer = styled('div', {
|
505
505
|
shouldForwardProp: prop => prop !== 'verticalKeyWidth'
|
506
|
-
})
|
507
|
-
|
508
|
-
|
509
|
-
|
506
|
+
})(({
|
507
|
+
theme,
|
508
|
+
verticalKeyWidth
|
509
|
+
}) => {
|
510
|
+
const primaryTextColor = theme.palette.text.primary;
|
511
|
+
const defaultBgColor = theme.palette.background.default;
|
512
|
+
const hoverBgColor = theme.palette.action.hover;
|
513
|
+
const oddRowBgColor = theme.palette.grey[50];
|
514
|
+
const verticalKeyWidthStyle = verticalKeyWidth ? `
|
515
|
+
${theme.breakpoints.down('md')} {
|
516
|
+
[class*='MUIDataTable-responsiveBase'] {
|
517
|
+
tr:not([class*='responsiveSimple']) {
|
518
|
+
td.MuiTableCell-body {
|
519
|
+
> div {
|
520
|
+
&:first-of-type {
|
521
|
+
width: ${verticalKeyWidth + (!/\D/.test(verticalKeyWidth) ? 'px' : '')};
|
522
|
+
}
|
523
|
+
}
|
524
|
+
}
|
525
|
+
}
|
526
|
+
}
|
527
|
+
}
|
528
|
+
` : '';
|
529
|
+
return css`
|
530
|
+
&.datatable-hide-header {
|
531
|
+
thead.MuiTableHead-root {
|
532
|
+
display: none;
|
533
|
+
}
|
510
534
|
}
|
511
|
-
}
|
512
535
|
|
513
|
-
|
514
|
-
|
515
|
-
|
516
|
-
|
517
|
-
|
518
|
-
|
519
|
-
|
520
|
-
|
521
|
-
|
536
|
+
td {
|
537
|
+
&.vertical-align-top {
|
538
|
+
align-items: flex-start;
|
539
|
+
}
|
540
|
+
&.vertical-align-center {
|
541
|
+
align-items: center;
|
542
|
+
}
|
543
|
+
&.vertical-align-bottom {
|
544
|
+
align-items: flex-end;
|
545
|
+
}
|
522
546
|
}
|
523
|
-
}
|
524
547
|
|
525
|
-
height: 100%;
|
526
|
-
> .MuiPaper-root {
|
527
|
-
display: flex;
|
528
|
-
flex-direction: column;
|
529
548
|
height: 100%;
|
530
|
-
|
531
|
-
|
532
|
-
|
533
|
-
|
534
|
-
|
549
|
+
> .MuiPaper-root {
|
550
|
+
display: flex;
|
551
|
+
flex-direction: column;
|
552
|
+
height: 100%;
|
553
|
+
box-shadow: none;
|
554
|
+
background: none;
|
555
|
+
background-color: ${defaultBgColor};
|
535
556
|
}
|
536
|
-
|
537
|
-
|
538
|
-
|
539
|
-
|
540
|
-
|
541
|
-
|
542
|
-
|
543
|
-
|
544
|
-
|
545
|
-
font-size: 14px;
|
557
|
+
${theme.breakpoints.down('md')} {
|
558
|
+
td.MuiTableCell-body {
|
559
|
+
padding-right: 0;
|
560
|
+
}
|
561
|
+
[class*='MUIDataTable-responsiveBase'] {
|
562
|
+
tr:not([class*='responsiveSimple']) {
|
563
|
+
td.MuiTableCell-body {
|
564
|
+
display: flex;
|
565
|
+
> div {
|
546
566
|
width: auto;
|
547
|
-
flex:
|
548
|
-
|
549
|
-
|
550
|
-
|
567
|
+
flex: 1;
|
568
|
+
&:first-of-type {
|
569
|
+
font-weight: bold;
|
570
|
+
font-size: 14px;
|
571
|
+
width: auto;
|
572
|
+
flex: 0 0 auto;
|
573
|
+
padding-right: 16px;
|
574
|
+
&:empty {
|
575
|
+
padding-right: 0;
|
576
|
+
}
|
551
577
|
}
|
552
578
|
}
|
553
579
|
}
|
554
580
|
}
|
555
581
|
}
|
556
582
|
}
|
557
|
-
|
558
|
-
${props => props.theme.breakpoints.up('md')} {
|
559
|
-
${alignCss}
|
560
|
-
}
|
561
|
-
${props => props.theme.breakpoints.up('sm')} {
|
562
|
-
[class*='responsiveSimple'] {
|
583
|
+
${theme.breakpoints.up('md')} {
|
563
584
|
${alignCss}
|
564
585
|
}
|
565
|
-
|
586
|
+
${theme.breakpoints.up('sm')} {
|
587
|
+
[class*='responsiveSimple'] {
|
588
|
+
${alignCss}
|
589
|
+
}
|
590
|
+
}
|
566
591
|
|
567
|
-
|
568
|
-
if (inProps.verticalKeyWidth) {
|
569
|
-
return `
|
570
|
-
${inProps.theme.breakpoints.down('md')} {
|
571
|
-
[class*='MUIDataTable-responsiveBase'] {
|
572
|
-
tr:not([class*='responsiveSimple']) {
|
573
|
-
td.MuiTableCell-body {
|
574
|
-
> div {
|
575
|
-
&:first-of-type {
|
576
|
-
width: ${inProps.verticalKeyWidth + (!/\D/.test(inProps.verticalKeyWidth) ? 'px' : '')};
|
577
|
-
}
|
578
|
-
}
|
579
|
-
}
|
580
|
-
}
|
581
|
-
}
|
582
|
-
}
|
583
|
-
`;
|
584
|
-
}
|
585
|
-
return '';
|
586
|
-
}}
|
592
|
+
${verticalKeyWidthStyle}
|
587
593
|
|
588
|
-
|
589
|
-
|
590
|
-
|
591
|
-
|
594
|
+
.MuiTableCell-head {
|
595
|
+
color: ${primaryTextColor};
|
596
|
+
background-color: ${defaultBgColor};
|
597
|
+
}
|
598
|
+
|
599
|
+
.MuiTableCell-root {
|
600
|
+
color: ${primaryTextColor};
|
601
|
+
}
|
602
|
+
|
603
|
+
.MuiTableRow-root {
|
604
|
+
background-color: ${defaultBgColor};
|
605
|
+
&:nth-of-type(even) {
|
606
|
+
background-color: ${defaultBgColor};
|
607
|
+
}
|
608
|
+
&:hover {
|
609
|
+
background-color: ${hoverBgColor};
|
610
|
+
}
|
611
|
+
&.MuiTableRow-footer {
|
612
|
+
background-color: ${defaultBgColor};
|
592
613
|
}
|
593
614
|
}
|
594
|
-
|
595
|
-
|
615
|
+
|
616
|
+
&.datatable-stripped {
|
617
|
+
.MuiTableRow-root:nth-of-type(odd) {
|
618
|
+
background-color: ${oddRowBgColor};
|
619
|
+
&:hover {
|
620
|
+
background-color: ${hoverBgColor};
|
621
|
+
}
|
622
|
+
&.MuiTableRow-footer {
|
623
|
+
background-color: ${defaultBgColor};
|
624
|
+
}
|
625
|
+
}
|
626
|
+
}
|
627
|
+
`;
|
628
|
+
});
|
596
629
|
const FooterContainer = styled('div')`
|
597
630
|
display: flex;
|
598
631
|
align-items: center;
|
632
|
+
background-color: ${props => props.theme.palette.background.default};
|
599
633
|
.datatable-footer {
|
600
634
|
position: relative;
|
601
635
|
margin-left: auto;
|
package/lib/Dialog/confirm.d.ts
CHANGED
@@ -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;
|
package/lib/Dialog/confirm.js
CHANGED
@@ -15,6 +15,7 @@ import Dialog from './dialog';
|
|
15
15
|
* children?: React.ReactNode,
|
16
16
|
* showCancelButton?: true | false,
|
17
17
|
* showCloseButton?: true | false,
|
18
|
+
* showConfirmButton?: true | false,
|
18
19
|
* fullScreen?: false | true,
|
19
20
|
* confirmButton?: {text: React.ReactNode, props?: ButtonProps}
|
20
21
|
* cancelButton?: {text: React.ReactNode, props?: ButtonProps}
|
@@ -35,6 +36,7 @@ export default function Confirm({
|
|
35
36
|
onCancel,
|
36
37
|
showCloseButton,
|
37
38
|
showCancelButton,
|
39
|
+
showConfirmButton,
|
38
40
|
fullScreen,
|
39
41
|
confirmButton,
|
40
42
|
cancelButton,
|
@@ -74,7 +76,7 @@ export default function Confirm({
|
|
74
76
|
}
|
75
77
|
}
|
76
78
|
},
|
77
|
-
actions: /*#__PURE__*/_jsxs(_Fragment, {
|
79
|
+
actions: showCancelButton || showConfirmButton ? /*#__PURE__*/_jsxs(_Fragment, {
|
78
80
|
children: [showCancelButton && /*#__PURE__*/_jsx(Button, {
|
79
81
|
onClick: e => {
|
80
82
|
e.stopPropagation();
|
@@ -83,7 +85,7 @@ export default function Confirm({
|
|
83
85
|
color: "primary",
|
84
86
|
...cancelButton.props,
|
85
87
|
children: cancelButton.text
|
86
|
-
}), /*#__PURE__*/_jsx(Button, {
|
88
|
+
}), showConfirmButton && /*#__PURE__*/_jsx(Button, {
|
87
89
|
onClick: e => {
|
88
90
|
e.stopPropagation();
|
89
91
|
onConfirm(e);
|
@@ -93,7 +95,7 @@ export default function Confirm({
|
|
93
95
|
...confirmButton.props,
|
94
96
|
children: confirmButton.text
|
95
97
|
})]
|
96
|
-
}),
|
98
|
+
}) : null,
|
97
99
|
children: children
|
98
100
|
});
|
99
101
|
}
|
@@ -104,6 +106,7 @@ Confirm.propTypes = {
|
|
104
106
|
onCancel: PropTypes.func.isRequired,
|
105
107
|
children: PropTypes.node,
|
106
108
|
showCancelButton: PropTypes.bool,
|
109
|
+
showConfirmButton: PropTypes.bool,
|
107
110
|
showCloseButton: PropTypes.bool,
|
108
111
|
fullScreen: PropTypes.bool,
|
109
112
|
// 可以传入 {text: ..., props: ...}
|
@@ -119,6 +122,7 @@ Confirm.propTypes = {
|
|
119
122
|
};
|
120
123
|
Confirm.defaultProps = {
|
121
124
|
showCancelButton: true,
|
125
|
+
showConfirmButton: true,
|
122
126
|
showCloseButton: true,
|
123
127
|
fullScreen: false,
|
124
128
|
confirmButton: {
|
@@ -18,6 +18,7 @@ const ConfirmHolder = /*#__PURE__*/forwardRef((props, ref) => {
|
|
18
18
|
loading: false,
|
19
19
|
showCancelButton: true,
|
20
20
|
showCloseButton: true,
|
21
|
+
showConfirmButton: true,
|
21
22
|
confirmButtonText: 'Confirm',
|
22
23
|
confirmButtonProps: {},
|
23
24
|
cancelButtonText: 'Cancel',
|
@@ -42,6 +43,7 @@ const ConfirmHolder = /*#__PURE__*/forwardRef((props, ref) => {
|
|
42
43
|
state.onCancel = params.onCancel || noop;
|
43
44
|
state.showCloseButton = params.showCloseButton ?? true;
|
44
45
|
state.showCancelButton = params.showCancelButton ?? true;
|
46
|
+
state.showConfirmButton = params.showConfirmButton ?? true;
|
45
47
|
if (params.confirmButtonText) state.confirmButtonText = params.confirmButtonText;
|
46
48
|
if (params.confirmButtonProps) state.confirmButtonProps = params.confirmButtonProps;
|
47
49
|
if (params.cancelButtonText) state.cancelButtonText = params.cancelButtonText;
|
@@ -60,6 +62,9 @@ const ConfirmHolder = /*#__PURE__*/forwardRef((props, ref) => {
|
|
60
62
|
state.confirmButtonProps = {};
|
61
63
|
state.cancelButtonText = 'Cancel';
|
62
64
|
state.cancelButtonProps = {};
|
65
|
+
state.showConfirmButton = true;
|
66
|
+
state.showCancelButton = true;
|
67
|
+
state.showCloseButton = true;
|
63
68
|
});
|
64
69
|
const close = useMemoizedFn(() => {
|
65
70
|
state.show = false;
|
@@ -125,6 +130,7 @@ const ConfirmHolder = /*#__PURE__*/forwardRef((props, ref) => {
|
|
125
130
|
},
|
126
131
|
showCloseButton: state.showCloseButton,
|
127
132
|
showCancelButton: state.showCancelButton,
|
133
|
+
showConfirmButton: state.showConfirmButton,
|
128
134
|
cancelButton: {
|
129
135
|
text: state.cancelButtonText,
|
130
136
|
props: {
|
package/lib/Footer/index.js
CHANGED
@@ -100,7 +100,7 @@ const Container = styled('div', {
|
|
100
100
|
position: relative;
|
101
101
|
margin-top: 64px;
|
102
102
|
padding: 24px 0 32px;
|
103
|
-
border-top: 1px solid ${props => props.
|
103
|
+
border-top: 1px solid ${props => props.theme.palette.divider};
|
104
104
|
box-sizing: border-box;
|
105
105
|
width: 100%;
|
106
106
|
|
@@ -115,10 +115,7 @@ const Container = styled('div', {
|
|
115
115
|
flex-wrap: wrap;
|
116
116
|
|
117
117
|
.footer-item {
|
118
|
-
color: ${
|
119
|
-
theme,
|
120
|
-
dark
|
121
|
-
}) => dark ? theme.palette.grey[500] : theme.palette.grey[900]};
|
118
|
+
color: ${props => props.theme.palette.text.hint};
|
122
119
|
display: flex;
|
123
120
|
align-items: center;
|
124
121
|
flex-wrap: wrap;
|
package/lib/Header/header.js
CHANGED
@@ -99,7 +99,9 @@ function ResponsiveHeader({
|
|
99
99
|
style: {
|
100
100
|
top: 64,
|
101
101
|
bottom: 0,
|
102
|
-
boxShadow: 'none'
|
102
|
+
boxShadow: 'none',
|
103
|
+
backgroundImage: 'none',
|
104
|
+
backgroundColor: theme.palette.background.paper
|
103
105
|
}
|
104
106
|
},
|
105
107
|
children: /*#__PURE__*/_jsx(MenuPanel, {
|
@@ -63,6 +63,7 @@ function Dashboard({
|
|
63
63
|
fullWidth = false,
|
64
64
|
dense = 'auto',
|
65
65
|
footerProps = {},
|
66
|
+
sx,
|
66
67
|
children,
|
67
68
|
...rest
|
68
69
|
}) {
|
@@ -100,6 +101,7 @@ function Dashboard({
|
|
100
101
|
}
|
101
102
|
}, []);
|
102
103
|
return /*#__PURE__*/_jsxs(Wrapper, {
|
104
|
+
sx: sx,
|
103
105
|
...rest,
|
104
106
|
className: classes,
|
105
107
|
sidebarWidth: sidebarWidth,
|
@@ -177,6 +179,7 @@ function Dashboard({
|
|
177
179
|
}),
|
178
180
|
children: children
|
179
181
|
}), footerVisible && /*#__PURE__*/_jsx(Footer, {
|
182
|
+
dark: theme.palette.mode === 'dark',
|
180
183
|
...footerProps
|
181
184
|
})]
|
182
185
|
})]
|
@@ -190,6 +193,9 @@ const Wrapper = styled('div', {
|
|
190
193
|
display: flex;
|
191
194
|
flex-direction: column;
|
192
195
|
height: 100vh;
|
196
|
+
background-color: ${({
|
197
|
+
theme
|
198
|
+
}) => theme.palette.background.default};
|
193
199
|
}
|
194
200
|
.dashboard-body {
|
195
201
|
overflow: hidden;
|
@@ -219,11 +225,17 @@ const Wrapper = styled('div', {
|
|
219
225
|
}
|
220
226
|
&.dashboard-dense {
|
221
227
|
.dashboard-header {
|
222
|
-
border-bottom: 1px solid
|
228
|
+
border-bottom: 1px solid;
|
229
|
+
border-color: ${({
|
230
|
+
theme
|
231
|
+
}) => theme.palette.divider};
|
223
232
|
}
|
224
233
|
.dashboard-sidebar {
|
225
234
|
width: 256px;
|
226
|
-
border-right: 1px solid
|
235
|
+
border-right: 1px solid;
|
236
|
+
border-color: ${({
|
237
|
+
theme
|
238
|
+
}) => theme.palette.divider};
|
227
239
|
}
|
228
240
|
}
|
229
241
|
${props => props.theme.breakpoints.up('md')} {
|
@@ -1,6 +1,5 @@
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
2
2
|
import Typography from '@mui/material/Typography';
|
3
|
-
import { teal } from '@mui/material/colors';
|
4
3
|
import clsx from 'clsx';
|
5
4
|
import { styled } from '../../Theme';
|
6
5
|
import { NavLink } from './external-link';
|
@@ -91,7 +90,7 @@ const Root = styled('div')`
|
|
91
90
|
&.layout-sidebar-link--active {
|
92
91
|
color: ${props => props.theme.palette.primary.main};
|
93
92
|
background: ${gradient};
|
94
|
-
border-left-color: ${
|
93
|
+
border-left-color: ${props => props.theme.palette.primary.main};
|
95
94
|
}
|
96
95
|
}
|
97
96
|
.layout-sidebar-icon {
|
package/lib/LoadingMask/index.js
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
2
2
|
import { Box } from '@mui/material';
|
3
|
-
import { temp as colors } from '../Colors';
|
4
3
|
export default function LoadingMask({
|
5
4
|
size = 64,
|
6
5
|
padding,
|
@@ -38,7 +37,7 @@ export default function LoadingMask({
|
|
38
37
|
height: finialSize,
|
39
38
|
overflow: 'hidden',
|
40
39
|
borderRadius: `${finialRadius}px`,
|
41
|
-
backgroundColor:
|
40
|
+
backgroundColor: 'grey.200',
|
42
41
|
'&::before,&::after': {
|
43
42
|
content: '""',
|
44
43
|
position: 'absolute',
|
@@ -57,7 +56,9 @@ export default function LoadingMask({
|
|
57
56
|
borderRadius: `${finialRadius - finialBorderWidth}px`
|
58
57
|
},
|
59
58
|
'&::before': {
|
60
|
-
background:
|
59
|
+
background: ({
|
60
|
+
palette
|
61
|
+
}) => `conic-gradient(from 45deg, transparent 0%, transparent 50%, ${palette.secondary.main} 90%, ${palette.secondary.main} 100%)`,
|
61
62
|
transform: 'scale(100)',
|
62
63
|
animation: `rotate ${finialDuration}s linear infinite`,
|
63
64
|
'@keyframes rotate': {
|
package/lib/Locale/selector.js
CHANGED
@@ -98,9 +98,9 @@ export default function LocaleSelector(props) {
|
|
98
98
|
children: /*#__PURE__*/_jsx(Box, {
|
99
99
|
className: "locales",
|
100
100
|
sx: {
|
101
|
-
backgroundColor: 'background.
|
101
|
+
backgroundColor: 'background.paper',
|
102
102
|
boxShadow: 2,
|
103
|
-
borderRadius:
|
103
|
+
borderRadius: 1
|
104
104
|
},
|
105
105
|
children: /*#__PURE__*/_jsx(ClickAwayListener, {
|
106
106
|
onClickAway: onClose,
|
@@ -130,7 +130,7 @@ export default function LocaleSelector(props) {
|
|
130
130
|
icon: CheckIcon,
|
131
131
|
className: code === locale ? 'check-icon check-icon-visible' : 'check-icon',
|
132
132
|
sx: {
|
133
|
-
marginRight:
|
133
|
+
marginRight: 1,
|
134
134
|
visibility: code === locale ? 'visible' : 'hidden'
|
135
135
|
}
|
136
136
|
}), name]
|
package/lib/Locale/util.d.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
1
|
import type { Locale, Translations } from '../type';
|
2
|
-
export declare const replace: (template: string, data: Record<string, any>) =>
|
3
|
-
export declare const translate: (translations: Translations, key: string, locale: Locale, fallbackLocale?: string, data?: {}) =>
|
4
|
-
export declare const t: (translations: Translations, key: string, locale: Locale, fallbackLocale?: string, data?: {}) =>
|
2
|
+
export declare const replace: (template: string | Function, data: Record<string, any>) => any;
|
3
|
+
export declare const translate: (translations: Translations, key: string, locale: Locale, fallbackLocale?: string, data?: {}) => any;
|
4
|
+
export declare const t: (translations: Translations, key: string, locale: Locale, fallbackLocale?: string, data?: {}) => any;
|
package/lib/Locale/util.js
CHANGED
@@ -1,6 +1,11 @@
|
|
1
1
|
import get from 'lodash/get';
|
2
2
|
/* eslint-disable no-prototype-builtins */
|
3
|
-
export const replace = (template, data) =>
|
3
|
+
export const replace = (template, data) => {
|
4
|
+
if (typeof template === 'function') {
|
5
|
+
return template(data);
|
6
|
+
}
|
7
|
+
return template.replace(/{(\w*)}/g, (m, key) => data.hasOwnProperty(key) ? data[key] : '');
|
8
|
+
};
|
4
9
|
export const translate = (translations, key, locale, fallbackLocale = 'en', data = {}) => {
|
5
10
|
const translation = translations[locale];
|
6
11
|
const translationValue = get(translation, key);
|
@@ -0,0 +1,12 @@
|
|
1
|
+
import { Locale } from '../type';
|
2
|
+
type LoginButtonProps = {
|
3
|
+
onClick: (options?: {
|
4
|
+
openMode?: 'popup' | 'window';
|
5
|
+
}) => void;
|
6
|
+
render: (options: {
|
7
|
+
onClick: () => void;
|
8
|
+
}) => React.ReactNode;
|
9
|
+
locale?: Locale;
|
10
|
+
};
|
11
|
+
export default function LoginButton({ onClick, render, locale }: LoginButtonProps): string | number | boolean | Iterable<import("react").ReactNode> | import("react/jsx-runtime").JSX.Element | null | undefined;
|
12
|
+
export {};
|
@@ -0,0 +1,74 @@
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
2
|
+
import { Box } from '@mui/material';
|
3
|
+
import { joinURL } from 'ufo';
|
4
|
+
import { useRef, useState } from 'react';
|
5
|
+
import { useMemoizedFn } from 'ahooks';
|
6
|
+
import { useBrowser } from '@arcblock/react-hooks';
|
7
|
+
import SharedBridge from '../SharedBridge';
|
8
|
+
import { setVisitorId } from '../Util';
|
9
|
+
import { getFederatedEnabled, getMaster } from '../Util/federated';
|
10
|
+
import { callIframe } from '../Util/iframe';
|
11
|
+
export default function LoginButton({
|
12
|
+
onClick,
|
13
|
+
render,
|
14
|
+
locale
|
15
|
+
}) {
|
16
|
+
const blocklet = window?.blocklet;
|
17
|
+
const federatedEnabled = getFederatedEnabled(blocklet);
|
18
|
+
const masterSite = getMaster(blocklet);
|
19
|
+
const sharedBridgeRef = useRef(null);
|
20
|
+
const [hasStorageAccess, setHasStorageAccess] = useState(false);
|
21
|
+
const browser = useBrowser();
|
22
|
+
const handleClick = useMemoizedFn(() => {
|
23
|
+
if (hasStorageAccess) {
|
24
|
+
onClick({
|
25
|
+
openMode: 'popup'
|
26
|
+
});
|
27
|
+
} else {
|
28
|
+
onClick();
|
29
|
+
}
|
30
|
+
});
|
31
|
+
const handleLoad = useMemoizedFn(async () => {
|
32
|
+
const {
|
33
|
+
value: visitorId
|
34
|
+
} = await callIframe(sharedBridgeRef.current, 'getVisitorId');
|
35
|
+
if (visitorId) {
|
36
|
+
setHasStorageAccess(true);
|
37
|
+
setVisitorId(visitorId);
|
38
|
+
}
|
39
|
+
});
|
40
|
+
const handleClickBridge = useMemoizedFn(({
|
41
|
+
value,
|
42
|
+
visitorId
|
43
|
+
}) => {
|
44
|
+
if (visitorId) {
|
45
|
+
setVisitorId(visitorId);
|
46
|
+
}
|
47
|
+
if (value) {
|
48
|
+
onClick({
|
49
|
+
openMode: 'popup'
|
50
|
+
});
|
51
|
+
} else {
|
52
|
+
onClick();
|
53
|
+
}
|
54
|
+
});
|
55
|
+
if (browser.arcSphere || browser.wallet) {
|
56
|
+
return render({
|
57
|
+
onClick
|
58
|
+
});
|
59
|
+
}
|
60
|
+
return /*#__PURE__*/_jsxs(Box, {
|
61
|
+
sx: {
|
62
|
+
position: 'relative'
|
63
|
+
},
|
64
|
+
children: [render({
|
65
|
+
onClick: handleClick
|
66
|
+
}), masterSite?.appUrl && federatedEnabled ? /*#__PURE__*/_jsx(SharedBridge, {
|
67
|
+
locale: locale,
|
68
|
+
iframeRef: sharedBridgeRef,
|
69
|
+
onLoad: handleLoad,
|
70
|
+
onClick: handleClickBridge,
|
71
|
+
src: joinURL(masterSite.appUrl, '/.well-known/service/share/shared-bridge.html')
|
72
|
+
}) : null]
|
73
|
+
});
|
74
|
+
}
|
package/lib/NavMenu/nav-menu.js
CHANGED
@@ -8,6 +8,7 @@ import { useCreation, useMemoizedFn, useReactive, useSize, useThrottleFn } from
|
|
8
8
|
import { NavMenuProvider, useNavMenuContext } from './nav-menu-context';
|
9
9
|
import { NavMenuRoot, NavMenuItem, NavMenuSub, NavMenuSubList, NavMenuStyled } from './style';
|
10
10
|
import { SubContainer } from './sub-container';
|
11
|
+
import { useTheme } from '../Theme';
|
11
12
|
|
12
13
|
// 过滤 children 中的 Item/Sub, 忽略其它类型的 element
|
13
14
|
function filterItems(children) {
|
@@ -34,12 +35,16 @@ function NavMenu({
|
|
34
35
|
mode = 'horizontal',
|
35
36
|
children: _childs = null,
|
36
37
|
activeId = null,
|
37
|
-
textColor
|
38
|
-
activeTextColor
|
39
|
-
bgColor
|
38
|
+
textColor,
|
39
|
+
activeTextColor,
|
40
|
+
bgColor,
|
40
41
|
onSelected,
|
41
42
|
...rest
|
42
43
|
}) {
|
44
|
+
const theme = useTheme();
|
45
|
+
const $textColor = useCreation(() => theme.palette.grey[400], [theme]);
|
46
|
+
const $activeTextColor = useCreation(() => theme.palette.text.primary, [theme]);
|
47
|
+
const $bgColor = useCreation(() => theme.palette.background.default, [theme]);
|
43
48
|
// eslint-disable-next-line no-param-reassign
|
44
49
|
const children = filterItems(_childs);
|
45
50
|
if (!items?.length && !children?.length) {
|
@@ -64,14 +69,14 @@ function NavMenu({
|
|
64
69
|
return {
|
65
70
|
...currentState,
|
66
71
|
mode,
|
67
|
-
textColor,
|
68
|
-
activeTextColor,
|
69
|
-
bgColor,
|
72
|
+
textColor: $textColor,
|
73
|
+
activeTextColor: $activeTextColor,
|
74
|
+
bgColor: $bgColor,
|
70
75
|
activate,
|
71
76
|
open,
|
72
77
|
close
|
73
78
|
};
|
74
|
-
}, [currentState.activeId, currentState.hiddenItemCount, currentState.openedIds, mode, textColor, activeTextColor, bgColor, activate, open, close]);
|
79
|
+
}, [currentState.activeId, currentState.hiddenItemCount, currentState.openedIds, mode, $textColor, $activeTextColor, $bgColor, activate, open, close]);
|
75
80
|
const navMenuRef = useRef(null);
|
76
81
|
const itemRefs = useRef([]);
|
77
82
|
const moreIconRef = useRef(null);
|
@@ -193,8 +198,8 @@ function NavMenu({
|
|
193
198
|
children: /*#__PURE__*/_jsx(NavMenuStyled, {
|
194
199
|
...rest,
|
195
200
|
className: classes,
|
196
|
-
$textColor: textColor,
|
197
|
-
$bgColor: bgColor,
|
201
|
+
$textColor: $textColor,
|
202
|
+
$bgColor: $bgColor,
|
198
203
|
children: /*#__PURE__*/_jsxs(NavMenuRoot, {
|
199
204
|
className: clsx('navmenu-root', `navmenu-root--${mode}`),
|
200
205
|
ref: navMenuRef,
|