@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.
@@ -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[100],
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[100],
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[100] : theme.palette.grey[900]};
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
 
@@ -3,7 +3,7 @@ import { styled } from '../styled';
3
3
  import { ListItemStates } from './constants';
4
4
  export const getBgColor = ({ selected, theme, }) => {
5
5
  if (selected) {
6
- return theme.palette.grey[100];
6
+ return theme.palette.grey[200];
7
7
  }
8
8
  return 'transparent';
9
9
  };
@@ -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();
@@ -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[100],
8
+ backgroundColor: theme.palette.grey[200],
9
9
  },
10
10
  '&:hover': {
11
11
  backgroundColor: theme.palette.background.elementHover,
@@ -46,7 +46,7 @@ export const getPalette = (palette) => {
46
46
  400: '#C7C7C7',
47
47
  300: '#D9D9D9',
48
48
  200: '#E2E2E2',
49
- 100: '#E9E9E9',
49
+ 100: '#F5F5F5',
50
50
  // Необходимо mui при добавлении новых цветов компонентам
51
51
  main: '#1F1F1F',
52
52
  dark: '#0F0F0F',
@@ -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[100],
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[100],
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[100] : theme.palette.grey[900]};
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
 
@@ -9,7 +9,7 @@ const styled_1 = require("../styled");
9
9
  const constants_1 = require("./constants");
10
10
  const getBgColor = ({ selected, theme, }) => {
11
11
  if (selected) {
12
- return theme.palette.grey[100];
12
+ return theme.palette.grey[200];
13
13
  }
14
14
  return 'transparent';
15
15
  };
@@ -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)();
@@ -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[100],
11
+ backgroundColor: theme.palette.grey[200],
12
12
  },
13
13
  '&:hover': {
14
14
  backgroundColor: theme.palette.background.elementHover,
@@ -49,7 +49,7 @@ const getPalette = (palette) => {
49
49
  400: '#C7C7C7',
50
50
  300: '#D9D9D9',
51
51
  200: '#E2E2E2',
52
- 100: '#E9E9E9',
52
+ 100: '#F5F5F5',
53
53
  // Необходимо mui при добавлении новых цветов компонентам
54
54
  main: '#1F1F1F',
55
55
  dark: '#0F0F0F',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astral/ui",
3
- "version": "4.43.0",
3
+ "version": "4.45.0",
4
4
  "browser": "./index.js",
5
5
  "main": "./node/index.js",
6
6
  "dependencies": {