@astral/ui 4.43.0 → 4.45.0
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/components/CheckableTag/styles.js +4 -3
- package/components/ListItem/styles.js +1 -1
- package/components/PageContent/constants.d.ts +1 -0
- package/components/PageContent/constants.js +1 -0
- package/components/PageContent/styles.js +13 -0
- package/components/PdfViewer/List/styles.js +4 -0
- package/components/PdfViewer/PdfDocument/styles.js +5 -0
- package/components/PdfViewer/PdfPage/styles.js +10 -0
- package/components/PdfViewer/styles.js +4 -0
- package/components/PdfViewer/useLogic/useLogic.js +15 -1
- package/components/theme/components/MuiListItemButton.js +1 -1
- package/components/theme/palette/palette.js +1 -1
- package/node/components/CheckableTag/styles.js +4 -3
- package/node/components/ListItem/styles.js +1 -1
- package/node/components/PageContent/constants.d.ts +1 -0
- package/node/components/PageContent/constants.js +1 -0
- package/node/components/PageContent/styles.js +13 -0
- package/node/components/PdfViewer/List/styles.js +4 -0
- package/node/components/PdfViewer/PdfDocument/styles.js +5 -0
- package/node/components/PdfViewer/PdfPage/styles.js +10 -0
- package/node/components/PdfViewer/styles.js +4 -0
- package/node/components/PdfViewer/useLogic/useLogic.js +15 -1
- package/node/components/theme/components/MuiListItemButton.js +1 -1
- package/node/components/theme/palette/palette.js +1 -1
- package/package.json +1 -1
|
@@ -51,7 +51,7 @@ const getActiveBgColor = ({ theme, color, isChecked, variant, disabled, }) => {
|
|
|
51
51
|
success: theme.palette.green[700],
|
|
52
52
|
warning: theme.palette.yellow[700],
|
|
53
53
|
grey: theme.palette.grey[400],
|
|
54
|
-
default: theme.palette.grey[
|
|
54
|
+
default: theme.palette.grey[200],
|
|
55
55
|
},
|
|
56
56
|
light: {
|
|
57
57
|
primary: theme.palette.primary[300],
|
|
@@ -59,7 +59,7 @@ const getActiveBgColor = ({ theme, color, isChecked, variant, disabled, }) => {
|
|
|
59
59
|
success: theme.palette.green[300],
|
|
60
60
|
warning: theme.palette.yellow[300],
|
|
61
61
|
grey: theme.palette.grey[300],
|
|
62
|
-
default: theme.palette.grey[
|
|
62
|
+
default: theme.palette.grey[200],
|
|
63
63
|
},
|
|
64
64
|
};
|
|
65
65
|
if (variant && color) {
|
|
@@ -100,9 +100,10 @@ export const StyledTag = styled(Tag, {
|
|
|
100
100
|
cursor: ${({ disabled }) => (disabled ? 'initial' : 'pointer')};
|
|
101
101
|
user-select: none;
|
|
102
102
|
|
|
103
|
+
background-color: ${({ theme, color, variant }) => (variant === 'light' && color === 'grey') && theme.palette.grey[200]};
|
|
103
104
|
${({ $isChecked, disabled, theme }) => $isChecked &&
|
|
104
105
|
`
|
|
105
|
-
background-color: ${disabled ? theme.palette.grey[
|
|
106
|
+
background-color: ${disabled ? theme.palette.grey[200] : theme.palette.grey[900]};
|
|
106
107
|
`}
|
|
107
108
|
border: ${({ theme, variant, $isChecked, color, disabled }) => getBorder({ theme, variant, isChecked: $isChecked, color, disabled })};
|
|
108
109
|
|
|
@@ -4,5 +4,6 @@ export const pageContentClassnames = {
|
|
|
4
4
|
content: createUIKitClassname('page-content__content'),
|
|
5
5
|
contentHasHeader: createUIKitClassname('page-content__content_has-header'),
|
|
6
6
|
animation: createUIKitClassname('page-content_animation'),
|
|
7
|
+
withPdfViewer: createUIKitClassname('page-content_with-pdf-viewer'),
|
|
7
8
|
};
|
|
8
9
|
export const PAGE_CONTENT_ANIMATION = 'white-flash';
|
|
@@ -106,4 +106,17 @@ export const Content = styled.div `
|
|
|
106
106
|
padding: ${({ theme }) => theme.spacing(4, 4, 3)};
|
|
107
107
|
}
|
|
108
108
|
}
|
|
109
|
+
|
|
110
|
+
${({ theme }) => theme.breakpoints.down('sm')} {
|
|
111
|
+
&&.${pageContentClassnames.withPdfViewer} {
|
|
112
|
+
margin: 0;
|
|
113
|
+
padding-top: 0;
|
|
114
|
+
padding-right: 0;
|
|
115
|
+
padding-left: 0;
|
|
116
|
+
|
|
117
|
+
background-color: ${({ theme }) => theme.palette.background.body};
|
|
118
|
+
border: unset;
|
|
119
|
+
border-radius: 0;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
109
122
|
`;
|
|
@@ -21,6 +21,16 @@ export const Wrapper = styled.div `
|
|
|
21
21
|
height: ${({ $height }) => $height}px;
|
|
22
22
|
padding-top: 0;
|
|
23
23
|
}
|
|
24
|
+
|
|
25
|
+
${({ theme }) => theme.breakpoints.down('sm')} {
|
|
26
|
+
border-top: ${({ $isViewerLite, theme }) => ($isViewerLite ? 'unset' : `1px solid ${theme.palette.grey[300]}`)};
|
|
27
|
+
border-radius: ${({ $isViewerLite }) => !$isViewerLite && 0};
|
|
28
|
+
box-shadow: ${({ $isViewerLite }) => !$isViewerLite && 'none'};
|
|
29
|
+
|
|
30
|
+
&:last-child {
|
|
31
|
+
border-bottom: ${({ $isViewerLite, theme }) => ($isViewerLite ? 'unset' : `1px solid ${theme.palette.grey[300]}`)};
|
|
32
|
+
}
|
|
33
|
+
}
|
|
24
34
|
`;
|
|
25
35
|
export const StyledTag = styled(Tag) `
|
|
26
36
|
top: ${({ theme }) => theme.spacing(3)};
|
|
@@ -1,13 +1,27 @@
|
|
|
1
1
|
import { useContext, useEffect, useMemo, useRef, useState } from 'react';
|
|
2
2
|
import { ConfigContext } from '../../ConfigProvider';
|
|
3
|
+
import { pageContentClassnames } from '../../PageContent/constants';
|
|
4
|
+
import { useViewportType } from '../../useViewportType';
|
|
3
5
|
import { useZoom } from '../hooks/useZoom';
|
|
4
6
|
import { getPageHeightList } from '../utils';
|
|
5
7
|
export const useLogic = ({ file, scrollRef, paginationRef, isFullHeight, isCentered, renderPageRange, isHidePersonalData, isViewerLite, enabledZoom = true, options, ...props }) => {
|
|
6
8
|
const [containerWidth, setContainerWidth] = useState(1);
|
|
9
|
+
const { isMobile } = useViewportType();
|
|
7
10
|
const scrollContainerRef = useRef(null);
|
|
11
|
+
useEffect(() => {
|
|
12
|
+
const el = scrollRef?.current;
|
|
13
|
+
if (!el) {
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
const isPageContentScroll = el.classList.contains(pageContentClassnames.content);
|
|
17
|
+
if (!isPageContentScroll) {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
el.classList.add(pageContentClassnames.withPdfViewer);
|
|
21
|
+
}, [scrollRef]);
|
|
8
22
|
const { zoomOut, scale, zoomIn, shouldAnimateZoom } = useZoom({
|
|
9
23
|
scrollContainerRef,
|
|
10
|
-
enabledZoom,
|
|
24
|
+
enabledZoom: enabledZoom && !isMobile,
|
|
11
25
|
});
|
|
12
26
|
const [isError, setIsError] = useState(false);
|
|
13
27
|
const [errorData, setErrorData] = useState();
|
|
@@ -5,7 +5,7 @@ export const MuiListItemButton = {
|
|
|
5
5
|
padding: theme.spacing(2, 3),
|
|
6
6
|
'&.Mui-selected': {
|
|
7
7
|
color: theme.palette.primary[800],
|
|
8
|
-
backgroundColor: theme.palette.grey[
|
|
8
|
+
backgroundColor: theme.palette.grey[200],
|
|
9
9
|
},
|
|
10
10
|
'&:hover': {
|
|
11
11
|
backgroundColor: theme.palette.background.elementHover,
|
|
@@ -54,7 +54,7 @@ const getActiveBgColor = ({ theme, color, isChecked, variant, disabled, }) => {
|
|
|
54
54
|
success: theme.palette.green[700],
|
|
55
55
|
warning: theme.palette.yellow[700],
|
|
56
56
|
grey: theme.palette.grey[400],
|
|
57
|
-
default: theme.palette.grey[
|
|
57
|
+
default: theme.palette.grey[200],
|
|
58
58
|
},
|
|
59
59
|
light: {
|
|
60
60
|
primary: theme.palette.primary[300],
|
|
@@ -62,7 +62,7 @@ const getActiveBgColor = ({ theme, color, isChecked, variant, disabled, }) => {
|
|
|
62
62
|
success: theme.palette.green[300],
|
|
63
63
|
warning: theme.palette.yellow[300],
|
|
64
64
|
grey: theme.palette.grey[300],
|
|
65
|
-
default: theme.palette.grey[
|
|
65
|
+
default: theme.palette.grey[200],
|
|
66
66
|
},
|
|
67
67
|
};
|
|
68
68
|
if (variant && color) {
|
|
@@ -103,9 +103,10 @@ exports.StyledTag = (0, styled_1.styled)(Tag_1.Tag, {
|
|
|
103
103
|
cursor: ${({ disabled }) => (disabled ? 'initial' : 'pointer')};
|
|
104
104
|
user-select: none;
|
|
105
105
|
|
|
106
|
+
background-color: ${({ theme, color, variant }) => (variant === 'light' && color === 'grey') && theme.palette.grey[200]};
|
|
106
107
|
${({ $isChecked, disabled, theme }) => $isChecked &&
|
|
107
108
|
`
|
|
108
|
-
background-color: ${disabled ? theme.palette.grey[
|
|
109
|
+
background-color: ${disabled ? theme.palette.grey[200] : theme.palette.grey[900]};
|
|
109
110
|
`}
|
|
110
111
|
border: ${({ theme, variant, $isChecked, color, disabled }) => getBorder({ theme, variant, isChecked: $isChecked, color, disabled })};
|
|
111
112
|
|
|
@@ -7,5 +7,6 @@ exports.pageContentClassnames = {
|
|
|
7
7
|
content: (0, createUIKitClassname_1.createUIKitClassname)('page-content__content'),
|
|
8
8
|
contentHasHeader: (0, createUIKitClassname_1.createUIKitClassname)('page-content__content_has-header'),
|
|
9
9
|
animation: (0, createUIKitClassname_1.createUIKitClassname)('page-content_animation'),
|
|
10
|
+
withPdfViewer: (0, createUIKitClassname_1.createUIKitClassname)('page-content_with-pdf-viewer'),
|
|
10
11
|
};
|
|
11
12
|
exports.PAGE_CONTENT_ANIMATION = 'white-flash';
|
|
@@ -109,4 +109,17 @@ exports.Content = styled_1.styled.div `
|
|
|
109
109
|
padding: ${({ theme }) => theme.spacing(4, 4, 3)};
|
|
110
110
|
}
|
|
111
111
|
}
|
|
112
|
+
|
|
113
|
+
${({ theme }) => theme.breakpoints.down('sm')} {
|
|
114
|
+
&&.${constants_2.pageContentClassnames.withPdfViewer} {
|
|
115
|
+
margin: 0;
|
|
116
|
+
padding-top: 0;
|
|
117
|
+
padding-right: 0;
|
|
118
|
+
padding-left: 0;
|
|
119
|
+
|
|
120
|
+
background-color: ${({ theme }) => theme.palette.background.body};
|
|
121
|
+
border: unset;
|
|
122
|
+
border-radius: 0;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
112
125
|
`;
|
|
@@ -24,6 +24,16 @@ exports.Wrapper = styled_1.styled.div `
|
|
|
24
24
|
height: ${({ $height }) => $height}px;
|
|
25
25
|
padding-top: 0;
|
|
26
26
|
}
|
|
27
|
+
|
|
28
|
+
${({ theme }) => theme.breakpoints.down('sm')} {
|
|
29
|
+
border-top: ${({ $isViewerLite, theme }) => ($isViewerLite ? 'unset' : `1px solid ${theme.palette.grey[300]}`)};
|
|
30
|
+
border-radius: ${({ $isViewerLite }) => !$isViewerLite && 0};
|
|
31
|
+
box-shadow: ${({ $isViewerLite }) => !$isViewerLite && 'none'};
|
|
32
|
+
|
|
33
|
+
&:last-child {
|
|
34
|
+
border-bottom: ${({ $isViewerLite, theme }) => ($isViewerLite ? 'unset' : `1px solid ${theme.palette.grey[300]}`)};
|
|
35
|
+
}
|
|
36
|
+
}
|
|
27
37
|
`;
|
|
28
38
|
exports.StyledTag = (0, styled_1.styled)(ControlBar_1.StyledTag) `
|
|
29
39
|
top: ${({ theme }) => theme.spacing(3)};
|
|
@@ -22,4 +22,8 @@ exports.ScrollContainer = styled_1.styled.div `
|
|
|
22
22
|
overflow: ${({ $isViewerLite, $enabledZoom }) => $isViewerLite || !$enabledZoom ? 'unset' : 'auto'};
|
|
23
23
|
|
|
24
24
|
height: 100%;
|
|
25
|
+
|
|
26
|
+
${({ theme }) => theme.breakpoints.down('sm')} {
|
|
27
|
+
scrollbar-gutter: unset;
|
|
28
|
+
}
|
|
25
29
|
`;
|
|
@@ -3,14 +3,28 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.useLogic = void 0;
|
|
4
4
|
const react_1 = require("react");
|
|
5
5
|
const ConfigProvider_1 = require("../../ConfigProvider");
|
|
6
|
+
const constants_1 = require("../../PageContent/constants");
|
|
7
|
+
const useViewportType_1 = require("../../useViewportType");
|
|
6
8
|
const useZoom_1 = require("../hooks/useZoom");
|
|
7
9
|
const utils_1 = require("../utils");
|
|
8
10
|
const useLogic = ({ file, scrollRef, paginationRef, isFullHeight, isCentered, renderPageRange, isHidePersonalData, isViewerLite, enabledZoom = true, options, ...props }) => {
|
|
9
11
|
const [containerWidth, setContainerWidth] = (0, react_1.useState)(1);
|
|
12
|
+
const { isMobile } = (0, useViewportType_1.useViewportType)();
|
|
10
13
|
const scrollContainerRef = (0, react_1.useRef)(null);
|
|
14
|
+
(0, react_1.useEffect)(() => {
|
|
15
|
+
const el = scrollRef?.current;
|
|
16
|
+
if (!el) {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
const isPageContentScroll = el.classList.contains(constants_1.pageContentClassnames.content);
|
|
20
|
+
if (!isPageContentScroll) {
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
el.classList.add(constants_1.pageContentClassnames.withPdfViewer);
|
|
24
|
+
}, [scrollRef]);
|
|
11
25
|
const { zoomOut, scale, zoomIn, shouldAnimateZoom } = (0, useZoom_1.useZoom)({
|
|
12
26
|
scrollContainerRef,
|
|
13
|
-
enabledZoom,
|
|
27
|
+
enabledZoom: enabledZoom && !isMobile,
|
|
14
28
|
});
|
|
15
29
|
const [isError, setIsError] = (0, react_1.useState)(false);
|
|
16
30
|
const [errorData, setErrorData] = (0, react_1.useState)();
|
|
@@ -8,7 +8,7 @@ exports.MuiListItemButton = {
|
|
|
8
8
|
padding: theme.spacing(2, 3),
|
|
9
9
|
'&.Mui-selected': {
|
|
10
10
|
color: theme.palette.primary[800],
|
|
11
|
-
backgroundColor: theme.palette.grey[
|
|
11
|
+
backgroundColor: theme.palette.grey[200],
|
|
12
12
|
},
|
|
13
13
|
'&:hover': {
|
|
14
14
|
backgroundColor: theme.palette.background.elementHover,
|