@astral/ui 4.44.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.
@@ -3,5 +3,6 @@ export declare const pageContentClassnames: {
3
3
  content: string;
4
4
  contentHasHeader: string;
5
5
  animation: string;
6
+ withPdfViewer: string;
6
7
  };
7
8
  export declare const PAGE_CONTENT_ANIMATION = "white-flash";
@@ -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
  `;
@@ -3,4 +3,8 @@ export const Wrapper = styled.div `
3
3
  display: flex;
4
4
  flex-direction: column;
5
5
  gap: ${({ theme }) => theme.spacing(4)};
6
+
7
+ ${({ theme }) => theme.breakpoints.down('sm')} {
8
+ gap: 0;
9
+ }
6
10
  `;
@@ -47,4 +47,9 @@ export const StyledDocument = styled(Document, {
47
47
  opacity: 1;
48
48
  }
49
49
  }
50
+
51
+ ${({ theme }) => theme.breakpoints.down('sm')} {
52
+ margin: 0;
53
+ padding: 0;
54
+ }
50
55
  `;
@@ -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)};
@@ -19,4 +19,8 @@ export const ScrollContainer = styled.div `
19
19
  overflow: ${({ $isViewerLite, $enabledZoom }) => $isViewerLite || !$enabledZoom ? 'unset' : 'auto'};
20
20
 
21
21
  height: 100%;
22
+
23
+ ${({ theme }) => theme.breakpoints.down('sm')} {
24
+ scrollbar-gutter: unset;
25
+ }
22
26
  `;
@@ -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();
@@ -3,5 +3,6 @@ export declare const pageContentClassnames: {
3
3
  content: string;
4
4
  contentHasHeader: string;
5
5
  animation: string;
6
+ withPdfViewer: string;
6
7
  };
7
8
  export declare const PAGE_CONTENT_ANIMATION = "white-flash";
@@ -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
  `;
@@ -6,4 +6,8 @@ exports.Wrapper = styled_1.styled.div `
6
6
  display: flex;
7
7
  flex-direction: column;
8
8
  gap: ${({ theme }) => theme.spacing(4)};
9
+
10
+ ${({ theme }) => theme.breakpoints.down('sm')} {
11
+ gap: 0;
12
+ }
9
13
  `;
@@ -50,4 +50,9 @@ exports.StyledDocument = (0, styled_1.styled)(react_pdf_1.Document, {
50
50
  opacity: 1;
51
51
  }
52
52
  }
53
+
54
+ ${({ theme }) => theme.breakpoints.down('sm')} {
55
+ margin: 0;
56
+ padding: 0;
57
+ }
53
58
  `;
@@ -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)();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astral/ui",
3
- "version": "4.44.0",
3
+ "version": "4.45.0",
4
4
  "browser": "./index.js",
5
5
  "main": "./node/index.js",
6
6
  "dependencies": {