@astral/ui 4.96.0 → 4.98.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.
Files changed (85) hide show
  1. package/components/Link/Link.d.ts +8 -0
  2. package/components/Link/Link.js +12 -2
  3. package/components/Link/constants.d.ts +4 -0
  4. package/components/Link/constants.js +5 -0
  5. package/components/Link/index.d.ts +1 -0
  6. package/components/Link/index.js +1 -0
  7. package/components/Link/public.d.ts +1 -0
  8. package/components/Link/public.js +1 -0
  9. package/components/Link/styles.js +17 -0
  10. package/components/fileUploading/FileInfo/FileInfo.d.ts +5 -1
  11. package/components/fileUploading/FileInfo/FileInfo.js +11 -2
  12. package/components/fileUploading/FileInfo/constants.d.ts +4 -0
  13. package/components/fileUploading/FileInfo/constants.js +5 -0
  14. package/components/fileUploading/FileInfo/index.d.ts +1 -0
  15. package/components/fileUploading/FileInfo/index.js +1 -0
  16. package/components/fileUploading/FileInfo/styles.js +19 -0
  17. package/components/fileUploading/FileUploader/FIleList/styles.js +4 -0
  18. package/components/fileUploading/FileUploaderDropzone/DropzoneWrapper/styles.js +3 -0
  19. package/components/fileUploading/FileUploaderDropzone/FileUploaderContainer/FileUploaderContainer.js +2 -1
  20. package/components/fileUploading/FileUploaderDropzone/FileUploaderContainer/styles.d.ts +5 -0
  21. package/components/fileUploading/FileUploaderDropzone/FileUploaderContainer/styles.js +6 -0
  22. package/components/fileUploading/FileUploaderDropzone/HintPlaceholder/HintPlaceholder.js +3 -3
  23. package/components/fileUploading/FileUploaderDropzone/HintPlaceholder/styles.d.ts +4 -0
  24. package/components/fileUploading/FileUploaderDropzone/HintPlaceholder/styles.js +5 -0
  25. package/components/fileUploading/FileUploaderFile/Actions/Actions.js +4 -2
  26. package/components/fileUploading/FileUploaderFile/FileUploaderFile.js +1 -1
  27. package/components/fileUploading/FileUploaderFile/styles.js +7 -0
  28. package/components/fileUploading/PreviewFileUploaderDropZone/HintPlaceholder/HintPlaceholder.js +2 -2
  29. package/components/fileUploading/PreviewFileUploaderDropZone/HintPlaceholder/styles.d.ts +4 -0
  30. package/components/fileUploading/PreviewFileUploaderDropZone/HintPlaceholder/styles.js +5 -0
  31. package/components/fileUploading/PreviewFileUploaderDropZone/PlaceholderWrapper/styles.js +4 -0
  32. package/components/fileUploading/PreviewFileUploaderFile/FileError/FileError.js +2 -2
  33. package/components/fileUploading/PreviewFileUploaderFile/FileError/styles.d.ts +15 -0
  34. package/components/fileUploading/PreviewFileUploaderFile/FileError/styles.js +17 -4
  35. package/components/fileUploading/PreviewFileUploaderFile/FileLoading/FileLoading.js +1 -1
  36. package/components/fileUploading/PreviewFileUploaderFile/FilePreview/FilePreview.js +4 -9
  37. package/components/fileUploading/PreviewFileUploaderFile/FilePreview/styles.d.ts +1 -0
  38. package/components/fileUploading/PreviewFileUploaderFile/FilePreview/styles.js +39 -13
  39. package/components/fileUploading/PreviewFileUploaderFile/FilePreview/useLogic/useLogic.d.ts +49 -14
  40. package/components/fileUploading/PreviewFileUploaderFile/FilePreview/useLogic/useLogic.js +60 -8
  41. package/components/theme/palette/componentsColors/linkColors/linkColors.d.ts +5 -0
  42. package/components/theme/palette/componentsColors/linkColors/linkColors.js +5 -0
  43. package/node/components/Link/Link.d.ts +8 -0
  44. package/node/components/Link/Link.js +12 -2
  45. package/node/components/Link/constants.d.ts +4 -0
  46. package/node/components/Link/constants.js +8 -0
  47. package/node/components/Link/index.d.ts +1 -0
  48. package/node/components/Link/index.js +3 -1
  49. package/node/components/Link/public.d.ts +1 -0
  50. package/node/components/Link/public.js +3 -1
  51. package/node/components/Link/styles.js +17 -0
  52. package/node/components/fileUploading/FileInfo/FileInfo.d.ts +5 -1
  53. package/node/components/fileUploading/FileInfo/FileInfo.js +11 -2
  54. package/node/components/fileUploading/FileInfo/constants.d.ts +4 -0
  55. package/node/components/fileUploading/FileInfo/constants.js +8 -0
  56. package/node/components/fileUploading/FileInfo/index.d.ts +1 -0
  57. package/node/components/fileUploading/FileInfo/index.js +3 -0
  58. package/node/components/fileUploading/FileInfo/styles.js +19 -0
  59. package/node/components/fileUploading/FileUploader/FIleList/styles.js +4 -0
  60. package/node/components/fileUploading/FileUploaderDropzone/DropzoneWrapper/styles.js +3 -0
  61. package/node/components/fileUploading/FileUploaderDropzone/FileUploaderContainer/FileUploaderContainer.js +2 -1
  62. package/node/components/fileUploading/FileUploaderDropzone/FileUploaderContainer/styles.d.ts +5 -0
  63. package/node/components/fileUploading/FileUploaderDropzone/FileUploaderContainer/styles.js +9 -0
  64. package/node/components/fileUploading/FileUploaderDropzone/HintPlaceholder/HintPlaceholder.js +2 -2
  65. package/node/components/fileUploading/FileUploaderDropzone/HintPlaceholder/styles.d.ts +4 -0
  66. package/node/components/fileUploading/FileUploaderDropzone/HintPlaceholder/styles.js +6 -1
  67. package/node/components/fileUploading/FileUploaderFile/Actions/Actions.js +3 -1
  68. package/node/components/fileUploading/FileUploaderFile/FileUploaderFile.js +1 -1
  69. package/node/components/fileUploading/FileUploaderFile/styles.js +7 -0
  70. package/node/components/fileUploading/PreviewFileUploaderDropZone/HintPlaceholder/HintPlaceholder.js +1 -1
  71. package/node/components/fileUploading/PreviewFileUploaderDropZone/HintPlaceholder/styles.d.ts +4 -0
  72. package/node/components/fileUploading/PreviewFileUploaderDropZone/HintPlaceholder/styles.js +6 -1
  73. package/node/components/fileUploading/PreviewFileUploaderDropZone/PlaceholderWrapper/styles.js +4 -0
  74. package/node/components/fileUploading/PreviewFileUploaderFile/FileError/FileError.js +1 -1
  75. package/node/components/fileUploading/PreviewFileUploaderFile/FileError/styles.d.ts +15 -0
  76. package/node/components/fileUploading/PreviewFileUploaderFile/FileError/styles.js +18 -5
  77. package/node/components/fileUploading/PreviewFileUploaderFile/FileLoading/FileLoading.js +1 -1
  78. package/node/components/fileUploading/PreviewFileUploaderFile/FilePreview/FilePreview.js +3 -8
  79. package/node/components/fileUploading/PreviewFileUploaderFile/FilePreview/styles.d.ts +1 -0
  80. package/node/components/fileUploading/PreviewFileUploaderFile/FilePreview/styles.js +39 -13
  81. package/node/components/fileUploading/PreviewFileUploaderFile/FilePreview/useLogic/useLogic.d.ts +49 -14
  82. package/node/components/fileUploading/PreviewFileUploaderFile/FilePreview/useLogic/useLogic.js +60 -8
  83. package/node/components/theme/palette/componentsColors/linkColors/linkColors.d.ts +5 -0
  84. package/node/components/theme/palette/componentsColors/linkColors/linkColors.js +5 -0
  85. package/package.json +1 -1
@@ -3,6 +3,20 @@ export declare const Wrapper: import("@emotion/styled/dist/declarations/src/type
3
3
  theme?: import("@emotion/react").Theme | undefined;
4
4
  as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
5
5
  }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
6
+ export declare const ButtonMobile: import("@emotion/styled/dist/declarations/src/types").StyledComponent<Omit<import("../../..").WithoutEmotionSpecific<import("@mui/material").ButtonProps>, "color" | "component" | "size" | "variant" | "centerRipple" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "TouchRippleProps" | "touchRippleRef" | "disableFocusRipple"> & {
7
+ variant?: "light" | "link" | "text" | "contained" | "outlined" | undefined;
8
+ loading?: boolean | undefined;
9
+ color?: "primary" | "success" | "warning" | "error" | "grey" | undefined;
10
+ component?: import("react").ElementType | undefined;
11
+ selected?: boolean | undefined;
12
+ size?: "large" | "medium" | undefined;
13
+ } & Omit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, ""> & import("react").RefAttributes<HTMLButtonElement> & {
14
+ theme?: import("@emotion/react").Theme | undefined;
15
+ }, {}, {}>;
16
+ export declare const Temp: import("@emotion/styled/dist/declarations/src/types").StyledComponent<{
17
+ theme?: import("@emotion/react").Theme | undefined;
18
+ as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
19
+ }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
6
20
  export declare const Image: import("@emotion/styled/dist/declarations/src/types").StyledComponent<{
7
21
  theme?: import("@emotion/react").Theme | undefined;
8
22
  as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
@@ -31,6 +45,7 @@ export declare const StyledFileInfo: import("@emotion/styled/dist/declarations/s
31
45
  className?: string | undefined;
32
46
  fileName: string;
33
47
  fileSize?: number | undefined;
48
+ isLoading?: boolean | undefined;
34
49
  } & {
35
50
  theme?: import("@emotion/react").Theme | undefined;
36
51
  }, {}, {}>;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Actions = exports.StyledFileInfo = exports.Details = exports.setDefaultImageStyles = exports.Image = exports.Wrapper = void 0;
3
+ exports.Actions = exports.StyledFileInfo = exports.Details = exports.setDefaultImageStyles = exports.Image = exports.Temp = exports.ButtonMobile = exports.Wrapper = void 0;
4
+ const Button_1 = require("../../../Button");
4
5
  const styled_1 = require("../../../styled");
5
6
  const constants_1 = require("../../constants");
6
7
  const FileInfo_1 = require("../../FileInfo");
@@ -9,19 +10,31 @@ exports.Wrapper = styled_1.styled.div `
9
10
  display: flex;
10
11
  flex-direction: column;
11
12
  flex-grow: 1;
13
+ gap: ${({ theme }) => theme.spacing(4)};
12
14
  align-items: center;
13
15
  justify-content: center;
14
16
 
15
17
  width: 100%;
18
+ height: 1000px;
16
19
  padding: ${({ theme }) => theme.spacing(4)};
17
20
 
18
- &:hover {
19
- .${constants_1.previewFileUploaderClassnames.details} {
20
- visibility: visible;
21
- opacity: 1;
21
+ ${({ theme }) => theme.breakpoints.up('sm')} {
22
+ &:hover {
23
+ .${constants_1.previewFileUploaderClassnames.details} {
24
+ visibility: visible;
25
+ opacity: 1;
26
+ }
22
27
  }
23
28
  }
24
29
  `;
30
+ exports.ButtonMobile = (0, styled_1.styled)(Button_1.Button) `
31
+ ${({ theme }) => theme.breakpoints.up('sm')} {
32
+ display: none;
33
+ }
34
+ `;
35
+ exports.Temp = styled_1.styled.div `
36
+ text-align: center;
37
+ `;
25
38
  exports.Image = styled_1.styled.img `
26
39
  display: block;
27
40
 
@@ -10,6 +10,6 @@ const styles_1 = require("./styles");
10
10
  const useLogic_1 = require("./useLogic");
11
11
  const FileLoading = (props) => {
12
12
  const { abortButtonProps, fileName, fileSize, progress } = (0, useLogic_1.useLogic)(props);
13
- return ((0, jsx_runtime_1.jsxs)(styles_1.Wrapper, { children: [(0, jsx_runtime_1.jsx)(Typography_1.Typography, { variant: "h5", children: "\u0418\u0434\u0435\u0442 \u0437\u0430\u0433\u0440\u0443\u0437\u043A\u0430..." }), (0, jsx_runtime_1.jsxs)(styles_1.Content, { children: [(0, jsx_runtime_1.jsx)(FileInfo_1.FileInfo, { fileName: fileName, fileSize: fileSize }), (0, jsx_runtime_1.jsx)(Progress_1.Progress, { progress: progress })] }), (0, jsx_runtime_1.jsx)(Button_1.Button, { variant: "light", color: "grey", ...abortButtonProps, children: "\u041E\u0442\u043C\u0435\u043D\u0438\u0442\u044C \u0437\u0430\u0433\u0440\u0443\u0437\u043A\u0443" })] }));
13
+ return ((0, jsx_runtime_1.jsxs)(styles_1.Wrapper, { children: [(0, jsx_runtime_1.jsx)(Typography_1.Typography, { variant: "h5", children: "\u0418\u0434\u0435\u0442 \u0437\u0430\u0433\u0440\u0443\u0437\u043A\u0430..." }), (0, jsx_runtime_1.jsxs)(styles_1.Content, { children: [(0, jsx_runtime_1.jsx)(FileInfo_1.FileInfo, { fileName: fileName, fileSize: fileSize, isLoading: true }), (0, jsx_runtime_1.jsx)(Progress_1.Progress, { progress: progress })] }), (0, jsx_runtime_1.jsx)(Button_1.Button, { variant: "light", color: "grey", ...abortButtonProps, children: "\u041E\u0442\u043C\u0435\u043D\u0438\u0442\u044C \u0437\u0430\u0433\u0440\u0443\u0437\u043A\u0443" })] }));
14
14
  };
15
15
  exports.FileLoading = FileLoading;
@@ -2,22 +2,17 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.FilePreview = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
- const BinOutlineMd_1 = require("../../../../icons/BinOutlineMd");
6
- const DownloadOutlineMd_1 = require("../../../../icons/DownloadOutlineMd");
7
- const EyeOutlineMd_1 = require("../../../../icons/EyeOutlineMd");
8
5
  const Button_1 = require("../../../Button");
9
6
  const IconButton_1 = require("../../../IconButton");
10
7
  const Tooltip_1 = require("../../../Tooltip");
11
8
  const Typography_1 = require("../../../Typography");
12
- const useViewportType_1 = require("../../../useViewportType");
13
9
  const constants_1 = require("../../constants");
14
10
  const Preview_1 = require("./Preview");
15
11
  const styles_1 = require("./styles");
16
12
  const useLogic_1 = require("./useLogic");
17
13
  const FilePreview = (props) => {
18
- const { viewButtonProps, downloadButtonProps, deleteButtonProps, isImageFile, isPdfFile, isOtherFile, } = (0, useLogic_1.useLogic)(props);
19
- const { file, fileName, fileSize, fileUrl, generateDownloadLink, isHidePersonalData, PdfViewer, isDeletingFile, } = props;
20
- const { isMobile } = (0, useViewportType_1.useViewportType)();
21
- return ((0, jsx_runtime_1.jsxs)(styles_1.Wrapper, { children: [(0, jsx_runtime_1.jsx)(Preview_1.Preview, { isImageFile: isImageFile, isPdfFile: isPdfFile, file: file, fileUrl: fileUrl, generateDownloadLink: generateDownloadLink, isHidePersonalData: isHidePersonalData, PdfViewer: PdfViewer }), (0, jsx_runtime_1.jsxs)(styles_1.Details, { className: constants_1.previewFileUploaderClassnames.details, "$isOtherFile": isOtherFile, children: [isOtherFile && (0, jsx_runtime_1.jsx)(Typography_1.Typography, { variant: "h6", children: "\u0424\u0430\u0439\u043B \u0437\u0430\u0433\u0440\u0443\u0436\u0435\u043D" }), (0, jsx_runtime_1.jsx)(styles_1.StyledFileInfo, { "$isOtherFile": isOtherFile, fileName: fileName, fileSize: fileSize }), (0, jsx_runtime_1.jsx)(styles_1.Actions, { children: isMobile && isOtherFile ? ((0, jsx_runtime_1.jsx)(Button_1.Button, { variant: "light", color: "grey", loading: isDeletingFile, ...deleteButtonProps, children: "\u0423\u0434\u0430\u043B\u0438\u0442\u044C" })) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [!isOtherFile && ((0, jsx_runtime_1.jsx)(Tooltip_1.Tooltip, { title: "\u041F\u043E\u0441\u043C\u043E\u0442\u0440\u0435\u0442\u044C", disableInteractive: true, children: (0, jsx_runtime_1.jsx)(IconButton_1.IconButton, { variant: "light", color: "grey", ...viewButtonProps, children: (0, jsx_runtime_1.jsx)(EyeOutlineMd_1.EyeOutlineMd, {}) }) })), (0, jsx_runtime_1.jsx)(Tooltip_1.Tooltip, { title: "\u0421\u043A\u0430\u0447\u0430\u0442\u044C", disableInteractive: true, children: (0, jsx_runtime_1.jsx)(IconButton_1.IconButton, { component: "a", variant: "light", color: "grey", download: fileName, ...downloadButtonProps, children: (0, jsx_runtime_1.jsx)(DownloadOutlineMd_1.DownloadOutlineMd, {}) }) }), (0, jsx_runtime_1.jsx)(Tooltip_1.Tooltip, { title: "\u0423\u0434\u0430\u043B\u0438\u0442\u044C", disableInteractive: true, children: (0, jsx_runtime_1.jsx)(IconButton_1.IconButton, { variant: "light", color: "grey", loading: isDeletingFile, ...deleteButtonProps, children: (0, jsx_runtime_1.jsx)(BinOutlineMd_1.BinOutlineMd, {}) }) })] })) })] })] }));
14
+ const { getActionsList, isImageFile, isPdfFile, isOtherFile } = (0, useLogic_1.useLogic)(props);
15
+ const { file, fileName, fileSize, fileUrl, generateDownloadLink, isHidePersonalData, PdfViewer, } = props;
16
+ return ((0, jsx_runtime_1.jsxs)(styles_1.Wrapper, { children: [!isOtherFile && ((0, jsx_runtime_1.jsx)(Preview_1.Preview, { isImageFile: isImageFile, isPdfFile: isPdfFile, file: file, fileUrl: fileUrl, generateDownloadLink: generateDownloadLink, isHidePersonalData: isHidePersonalData, PdfViewer: PdfViewer })), (0, jsx_runtime_1.jsxs)(styles_1.Details, { className: constants_1.previewFileUploaderClassnames.details, "$isOtherFile": isOtherFile, children: [isOtherFile && (0, jsx_runtime_1.jsx)(Typography_1.Typography, { variant: "h6", children: "\u0424\u0430\u0439\u043B \u0437\u0430\u0433\u0440\u0443\u0436\u0435\u043D" }), (0, jsx_runtime_1.jsx)(styles_1.StyledFileInfo, { "$isOtherFile": isOtherFile, fileName: fileName, fileSize: fileSize }), (0, jsx_runtime_1.jsx)(styles_1.Actions, { children: getActionsList().map(({ type, ...action }) => ((0, jsx_runtime_1.jsx)(Tooltip_1.Tooltip, { title: action.tooltip, disableInteractive: true, children: type === 'iconButton' ? ((0, jsx_runtime_1.jsx)(IconButton_1.IconButton, { ...action, children: action.icon })) : ((0, jsx_runtime_1.jsx)(Button_1.Button, { ...action, children: 'title' in action ? action.title : '' })) }, action.tooltip))) })] })] }));
22
17
  };
23
18
  exports.FilePreview = FilePreview;
@@ -13,6 +13,7 @@ export declare const StyledFileInfo: import("@emotion/styled/dist/declarations/s
13
13
  className?: string | undefined;
14
14
  fileName: string;
15
15
  fileSize?: number | undefined;
16
+ isLoading?: boolean | undefined;
16
17
  } & {
17
18
  theme?: import("@emotion/react").Theme | undefined;
18
19
  } & {
@@ -23,34 +23,60 @@ exports.Wrapper = styled_1.styled.div `
23
23
  }
24
24
  `;
25
25
  exports.Details = styled_1.styled.div `
26
- position: absolute;
27
- inset: 0;
26
+ ${({ theme }) => theme.breakpoints.up('sm')} {
27
+ position: absolute;
28
+ inset: 0;
28
29
 
29
- overflow: hidden;
30
- display: flex;
31
- flex-direction: column;
32
- gap: ${({ theme, $isOtherFile }) => (!$isOtherFile ? theme.spacing(4) : 0)};
33
- align-items: center;
34
- justify-content: center;
30
+ overflow: hidden;
31
+ display: flex;
32
+ flex-direction: column;
33
+ gap: ${({ theme, $isOtherFile }) => (!$isOtherFile ? theme.spacing(4) : 0)};
34
+ align-items: center;
35
+ justify-content: center;
35
36
 
36
- padding: ${({ theme }) => theme.spacing(4)};
37
+ padding: ${({ theme }) => theme.spacing(4)};
37
38
 
38
- visibility: ${({ $isOtherFile }) => ($isOtherFile ? 'visible' : 'hidden')};
39
- opacity: ${({ $isOtherFile }) => ($isOtherFile ? 1 : 0)};
40
- background-color: ${({ theme, $isOtherFile }) => !$isOtherFile ? theme.palette.background.modalShadow : 'none'};
39
+ visibility: ${({ $isOtherFile }) => ($isOtherFile ? 'visible' : 'hidden')};
40
+ opacity: ${({ $isOtherFile }) => ($isOtherFile ? 1 : 0)};
41
+ background-color: ${({ theme, $isOtherFile }) => !$isOtherFile ? theme.palette.background.modalShadow : 'none'};
41
42
 
42
- transition: ${({ theme }) => {
43
+ transition: ${({ theme }) => {
43
44
  return theme.transitions.create(['opacity', 'visibility'], {
44
45
  duration: theme.transitions.duration.standard,
45
46
  });
46
47
  }};
48
+ }
49
+
50
+ ${({ theme, $isOtherFile }) => !$isOtherFile && theme.breakpoints.down('sm')} {
51
+ position: absolute;
52
+ top: 0;
53
+ right: 0;
54
+
55
+ overflow: hidden;
56
+
57
+ padding: ${({ theme }) => theme.spacing(4)};
58
+
59
+ visibility: visible;
60
+ opacity: 1;
61
+ }
62
+
63
+ ${({ theme, $isOtherFile }) => $isOtherFile && theme.breakpoints.down('sm')} {
64
+ text-align: center;
65
+ }
47
66
  `;
48
67
  exports.StyledFileInfo = (0, styled_1.styled)(FileInfo_1.FileInfo) `
68
+ align-items: center;
49
69
  justify-content: center;
50
70
 
51
71
  margin: ${({ theme, $isOtherFile }) => $isOtherFile ? theme.spacing(6, 0, 11) : 0};
52
72
 
53
73
  color: ${({ theme, $isOtherFile }) => !$isOtherFile ? theme.palette.primary.contrastText : 'none'};
74
+
75
+ ${({ theme }) => theme.breakpoints.down('sm')} {
76
+ display: ${({ $isOtherFile }) => !$isOtherFile && 'none'};
77
+
78
+ margin: ${({ theme, $isOtherFile }) => $isOtherFile ? theme.spacing(6, 0, 8) : 0};
79
+ }
54
80
  `;
55
81
  exports.Actions = styled_1.styled.div `
56
82
  display: flex;
@@ -1,26 +1,61 @@
1
1
  /// <reference types="react" />
2
2
  import { type FilePreviewProps } from '../FilePreview';
3
3
  type UseLogicParams = FilePreviewProps;
4
- export declare const useLogic: ({ fileId, file, fileUrl, generateDownloadLink, onDelete, onView, fileType, }: UseLogicParams) => {
5
- deleteButtonProps: {
4
+ export declare const useLogic: ({ fileId, file, fileUrl, fileName, generateDownloadLink, onDelete, onView, fileType, isDeletingFile, }: UseLogicParams) => {
5
+ isImageFile: boolean;
6
+ isPdfFile: boolean;
7
+ /**
8
+ * Формат файла отличающийся от pdf и изображения
9
+ */
10
+ isOtherFile: boolean;
11
+ getActionsList: () => {
12
+ type: string;
13
+ tooltip: string;
14
+ title: string;
15
+ variant: "light";
16
+ color: "grey";
17
+ icon: import("react").FunctionComponentElement<import("../../../..").SvgIconProps>;
18
+ loading: boolean | undefined;
6
19
  onClick: () => void;
7
- };
8
- downloadButtonProps: {
9
- href: string;
10
- };
11
- viewButtonProps: {
20
+ }[] | ({
12
21
  component: import("react").ElementType;
13
22
  href: string;
14
23
  target: string;
15
24
  rel: string;
25
+ type: string;
26
+ tooltip: string;
27
+ variant: "light";
28
+ color: "grey";
29
+ icon: import("react").FunctionComponentElement<import("../../../..").SvgIconProps>;
16
30
  } | {
17
31
  onClick: () => void | undefined;
18
- };
19
- isImageFile: boolean;
20
- isPdfFile: boolean;
21
- /**
22
- * Формат файла отличающийся от pdf и изображения
23
- */
24
- isOtherFile: boolean;
32
+ type: string;
33
+ tooltip: string;
34
+ variant: "light";
35
+ color: "grey";
36
+ icon: import("react").FunctionComponentElement<import("../../../..").SvgIconProps>;
37
+ } | {
38
+ type: string;
39
+ tooltip: string;
40
+ component: "a";
41
+ variant: "light";
42
+ color: "grey";
43
+ icon: import("react").FunctionComponentElement<import("../../../..").SvgIconProps>;
44
+ download: string;
45
+ href: string;
46
+ loading?: undefined;
47
+ onClick?: undefined;
48
+ } | {
49
+ type: string;
50
+ tooltip: string;
51
+ variant: "light";
52
+ color: "grey";
53
+ icon: import("react").FunctionComponentElement<import("../../../..").SvgIconProps>;
54
+ loading: boolean | undefined;
55
+ onClick: () => void;
56
+ component?: undefined;
57
+ download?: undefined;
58
+ href?: undefined;
59
+ })[];
25
60
  };
26
61
  export {};
@@ -1,13 +1,19 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.useLogic = void 0;
4
+ const react_1 = require("react");
5
+ const BinOutlineMd_1 = require("../../../../../icons/BinOutlineMd");
6
+ const DownloadOutlineMd_1 = require("../../../../../icons/DownloadOutlineMd");
7
+ const EyeOutlineMd_1 = require("../../../../../icons/EyeOutlineMd");
4
8
  const ErrorService_1 = require("../../../../services/ErrorService");
9
+ const useViewportType_1 = require("../../../../useViewportType");
5
10
  const constants_1 = require("../../../constants");
6
11
  const useGenerateLocalFileURL_1 = require("../../../hooks/useGenerateLocalFileURL");
7
12
  const MimeTypeRegistry_1 = require("../../../services/MimeTypeRegistry");
8
13
  const generateAttrLinkNewTab_1 = require("../../../utils/generateAttrLinkNewTab");
9
- const useLogic = ({ fileId, file, fileUrl, generateDownloadLink, onDelete, onView, fileType, }) => {
14
+ const useLogic = ({ fileId, file, fileUrl, fileName, generateDownloadLink, onDelete, onView, fileType, isDeletingFile, }) => {
10
15
  const { generateUrl } = (0, useGenerateLocalFileURL_1.useGenerateLocalFileURL)();
16
+ const { isMobile } = (0, useViewportType_1.useViewportType)();
11
17
  const isPdfFile = MimeTypeRegistry_1.MimeTypeRegistry.getInstance()
12
18
  .getExtensionsByMimeType((file?.type || fileType))
13
19
  ?.includes('pdf') || false;
@@ -53,20 +59,66 @@ const useLogic = ({ fileId, file, fileUrl, generateDownloadLink, onDelete, onVie
53
59
  },
54
60
  };
55
61
  };
62
+ const getViewActionsList = () => {
63
+ return isOtherFile
64
+ ? []
65
+ : [
66
+ {
67
+ type: 'iconButton',
68
+ tooltip: 'Посмотреть',
69
+ variant: 'light',
70
+ color: 'grey',
71
+ icon: (0, react_1.createElement)(EyeOutlineMd_1.EyeOutlineMd),
72
+ ...getPropsViewButton(),
73
+ },
74
+ ];
75
+ };
76
+ const getActionsList = () => {
77
+ if (isMobile) {
78
+ return [
79
+ {
80
+ type: isOtherFile ? 'button' : 'iconButton',
81
+ tooltip: 'Удалить',
82
+ title: 'Удалить',
83
+ variant: 'light',
84
+ color: 'grey',
85
+ icon: (0, react_1.createElement)(BinOutlineMd_1.BinOutlineMd),
86
+ loading: isDeletingFile,
87
+ onClick: handleDelete,
88
+ },
89
+ ];
90
+ }
91
+ return [
92
+ ...getViewActionsList(),
93
+ {
94
+ type: 'iconButton',
95
+ tooltip: 'Скачать',
96
+ component: 'a',
97
+ variant: 'light',
98
+ color: 'grey',
99
+ icon: (0, react_1.createElement)(DownloadOutlineMd_1.DownloadOutlineMd),
100
+ download: fileName,
101
+ href: downloadLink,
102
+ },
103
+ {
104
+ type: 'iconButton',
105
+ tooltip: 'Удалить',
106
+ variant: 'light',
107
+ color: 'grey',
108
+ icon: (0, react_1.createElement)(BinOutlineMd_1.BinOutlineMd),
109
+ loading: isDeletingFile,
110
+ onClick: handleDelete,
111
+ },
112
+ ];
113
+ };
56
114
  return {
57
- deleteButtonProps: {
58
- onClick: handleDelete,
59
- },
60
- downloadButtonProps: {
61
- href: downloadLink,
62
- },
63
- viewButtonProps: getPropsViewButton(),
64
115
  isImageFile,
65
116
  isPdfFile,
66
117
  /**
67
118
  * Формат файла отличающийся от pdf и изображения
68
119
  */
69
120
  isOtherFile,
121
+ getActionsList,
70
122
  };
71
123
  };
72
124
  exports.useLogic = useLogic;
@@ -3,5 +3,10 @@ export type LinkColors = {
3
3
  hover: string;
4
4
  visited: string;
5
5
  active: string;
6
+ contrast: {
7
+ main: string;
8
+ hover: string;
9
+ visited: string;
10
+ };
6
11
  };
7
12
  export declare const linkColors: LinkColors;
@@ -6,4 +6,9 @@ exports.linkColors = {
6
6
  hover: '#268FF9',
7
7
  visited: '#762376',
8
8
  active: '#072D57',
9
+ contrast: {
10
+ main: '#6EB3F8',
11
+ hover: '#499CEF',
12
+ visited: '#C084FC',
13
+ },
9
14
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astral/ui",
3
- "version": "4.96.0",
3
+ "version": "4.98.0",
4
4
  "browser": "./index.js",
5
5
  "main": "./node/index.js",
6
6
  "dependencies": {