@hh.ru/magritte-ui-upload 3.2.2 → 3.2.4

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/FileName.js CHANGED
@@ -2,7 +2,7 @@ import './index.css';
2
2
  import { jsxs, jsx } from 'react/jsx-runtime';
3
3
  import classnames from 'classnames';
4
4
 
5
- var styles = {"file-name-body":"magritte-file-name-body___PTTMc_3-2-2","fileNameBody":"magritte-file-name-body___PTTMc_3-2-2","file-name-body_medium":"magritte-file-name-body_medium___sfmmq_3-2-2","fileNameBodyMedium":"magritte-file-name-body_medium___sfmmq_3-2-2","file-name":"magritte-file-name___ZSL2g_3-2-2","fileName":"magritte-file-name___ZSL2g_3-2-2"};
5
+ var styles = {"file-name-body":"magritte-file-name-body___PTTMc_3-2-4","fileNameBody":"magritte-file-name-body___PTTMc_3-2-4","file-name-body_medium":"magritte-file-name-body_medium___sfmmq_3-2-4","fileNameBodyMedium":"magritte-file-name-body_medium___sfmmq_3-2-4","file-name":"magritte-file-name___ZSL2g_3-2-4","fileName":"magritte-file-name___ZSL2g_3-2-4"};
6
6
 
7
7
  const parse = (file) => {
8
8
  const name = file.name;
package/FileView.js CHANGED
@@ -10,7 +10,7 @@ import { FileName } from './FileName.js';
10
10
  import { getUploadIcon, bytes2mb } from './utils.js';
11
11
  import 'classnames';
12
12
 
13
- var styles = {"file-info-body":"magritte-file-info-body___HmfXd_3-2-2","fileInfoBody":"magritte-file-info-body___HmfXd_3-2-2","file-info-and-controls":"magritte-file-info-and-controls___61iyY_3-2-2","fileInfoAndControls":"magritte-file-info-and-controls___61iyY_3-2-2","file-info-container":"magritte-file-info-container___WFab8_3-2-2","fileInfoContainer":"magritte-file-info-container___WFab8_3-2-2","file-info":"magritte-file-info___HrqiB_3-2-2","fileInfo":"magritte-file-info___HrqiB_3-2-2","controls":"magritte-controls___WdH7A_3-2-2"};
13
+ var styles = {"file-info-body":"magritte-file-info-body___HmfXd_3-2-4","fileInfoBody":"magritte-file-info-body___HmfXd_3-2-4","file-info-and-controls":"magritte-file-info-and-controls___61iyY_3-2-4","fileInfoAndControls":"magritte-file-info-and-controls___61iyY_3-2-4","file-info-container":"magritte-file-info-container___WFab8_3-2-4","fileInfoContainer":"magritte-file-info-container___WFab8_3-2-4","file-info":"magritte-file-info___HrqiB_3-2-4","fileInfo":"magritte-file-info___HrqiB_3-2-4","controls":"magritte-controls___WdH7A_3-2-4"};
14
14
 
15
15
  const FileView = ({ uploadType, loadedFile, preview, renderFileInfo, onFileDelete, 'aria-label': ariaLabel, isLast = false, }) => {
16
16
  const isLoading = Boolean(loadedFile?.loading);
@@ -13,7 +13,7 @@ import './FileName.js';
13
13
  import 'classnames';
14
14
  import 'react';
15
15
 
16
- var styles = {"item":"magritte-item___vVDG-_3-2-2"};
16
+ var styles = {"item":"magritte-item___vVDG-_3-2-4"};
17
17
 
18
18
  const FileViewWithPreview = ({ loadedFile, ...otherProps }) => {
19
19
  const uploadType = getFileType(loadedFile.data.type);
package/MultiUpload.js CHANGED
@@ -8,7 +8,7 @@ import { Placeholder } from './Placeholder.js';
8
8
  import { useDropActions } from './useDropActions.js';
9
9
  import { useDropButtons } from './useDropButtons.js';
10
10
  import { getAvaliableFileTypes, getUploadIcon, DEFAULT_ACCEPT, RenderFileInfoDefault } from './utils.js';
11
- import { s as styles } from './upload-BSffvIL5.js';
11
+ import { s as styles } from './upload-BCv6pgSa.js';
12
12
  import './FileView.js';
13
13
  import '@hh.ru/magritte-ui-action';
14
14
  import '@hh.ru/magritte-ui-avatar';
package/Placeholder.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { ReactElement } from 'react';
2
- import { ButtonElement, UploadTrls } from '@hh.ru/magritte-ui-upload/types';
2
+ import { ButtonElement } from '@hh.ru/magritte-ui-button-stack';
3
+ import { UploadTrls } from '@hh.ru/magritte-ui-upload/types';
3
4
  interface PlaceholderProps {
4
5
  trls: UploadTrls;
5
6
  selectFileButton?: ButtonElement;
@@ -1 +1 @@
1
- {"version":3,"file":"Placeholder.js","sources":["../src/Placeholder.tsx"],"sourcesContent":["import { ReactElement } from 'react';\n\nimport { useBreakpoint } from '@hh.ru/magritte-ui-breakpoint';\nimport { VSpacing } from '@hh.ru/magritte-ui-spacing';\nimport { Text } from '@hh.ru/magritte-ui-typography';\nimport { ButtonElement, UploadTrls } from '@hh.ru/magritte-ui-upload/types';\n\ninterface PlaceholderProps {\n trls: UploadTrls;\n selectFileButton?: ButtonElement;\n}\n\nconst Placeholder = ({ trls, selectFileButton }: PlaceholderProps): ReactElement => {\n const { isMobile } = useBreakpoint();\n const { title, titleMobile, subTitle } = trls;\n return (\n <>\n <Text typography=\"label-2-regular\">{isMobile ? titleMobile || title : title}</Text>\n <VSpacing default={6} />\n <Text typography=\"label-4-regular\" style=\"secondary\">\n {subTitle}\n </Text>\n {selectFileButton && (\n <>\n <VSpacing default={16} />\n {selectFileButton}\n </>\n )}\n </>\n );\n};\n\nexport { Placeholder };\n"],"names":["_jsxs","_Fragment","_jsx"],"mappings":";;;;;AAYM,MAAA,WAAW,GAAG,CAAC,EAAE,IAAI,EAAE,gBAAgB,EAAoB,KAAkB;AAC/E,IAAA,MAAM,EAAE,QAAQ,EAAE,GAAG,aAAa,EAAE,CAAC;IACrC,MAAM,EAAE,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,GAAG,IAAI,CAAC;AAC9C,IAAA,QACIA,IAAA,CAAAC,QAAA,EAAA,EAAA,QAAA,EAAA,CACIC,GAAC,CAAA,IAAI,EAAC,EAAA,UAAU,EAAC,iBAAiB,EAAE,QAAA,EAAA,QAAQ,GAAG,WAAW,IAAI,KAAK,GAAG,KAAK,EAAQ,CAAA,EACnFA,GAAC,CAAA,QAAQ,EAAC,EAAA,OAAO,EAAE,CAAC,EAAI,CAAA,EACxBA,GAAC,CAAA,IAAI,EAAC,EAAA,UAAU,EAAC,iBAAiB,EAAC,KAAK,EAAC,WAAW,EAC/C,QAAA,EAAA,QAAQ,EACN,CAAA,EACN,gBAAgB,KACbF,IAAA,CAAAC,QAAA,EAAA,EAAA,QAAA,EAAA,CACIC,GAAC,CAAA,QAAQ,EAAC,EAAA,OAAO,EAAE,EAAE,EAAI,CAAA,EACxB,gBAAgB,CAAA,EAAA,CAClB,CACN,CAAA,EAAA,CACF,EACL;AACN;;;;"}
1
+ {"version":3,"file":"Placeholder.js","sources":["../src/Placeholder.tsx"],"sourcesContent":["import { ReactElement } from 'react';\n\nimport { useBreakpoint } from '@hh.ru/magritte-ui-breakpoint';\nimport { ButtonElement } from '@hh.ru/magritte-ui-button-stack';\nimport { VSpacing } from '@hh.ru/magritte-ui-spacing';\nimport { Text } from '@hh.ru/magritte-ui-typography';\nimport { UploadTrls } from '@hh.ru/magritte-ui-upload/types';\n\ninterface PlaceholderProps {\n trls: UploadTrls;\n selectFileButton?: ButtonElement;\n}\n\nconst Placeholder = ({ trls, selectFileButton }: PlaceholderProps): ReactElement => {\n const { isMobile } = useBreakpoint();\n const { title, titleMobile, subTitle } = trls;\n return (\n <>\n <Text typography=\"label-2-regular\">{isMobile ? titleMobile || title : title}</Text>\n <VSpacing default={6} />\n <Text typography=\"label-4-regular\" style=\"secondary\">\n {subTitle}\n </Text>\n {selectFileButton && (\n <>\n <VSpacing default={16} />\n {selectFileButton}\n </>\n )}\n </>\n );\n};\n\nexport { Placeholder };\n"],"names":["_jsxs","_Fragment","_jsx"],"mappings":";;;;;AAaM,MAAA,WAAW,GAAG,CAAC,EAAE,IAAI,EAAE,gBAAgB,EAAoB,KAAkB;AAC/E,IAAA,MAAM,EAAE,QAAQ,EAAE,GAAG,aAAa,EAAE,CAAC;IACrC,MAAM,EAAE,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,GAAG,IAAI,CAAC;AAC9C,IAAA,QACIA,IAAA,CAAAC,QAAA,EAAA,EAAA,QAAA,EAAA,CACIC,GAAC,CAAA,IAAI,EAAC,EAAA,UAAU,EAAC,iBAAiB,EAAE,QAAA,EAAA,QAAQ,GAAG,WAAW,IAAI,KAAK,GAAG,KAAK,EAAQ,CAAA,EACnFA,GAAC,CAAA,QAAQ,EAAC,EAAA,OAAO,EAAE,CAAC,EAAI,CAAA,EACxBA,GAAC,CAAA,IAAI,EAAC,EAAA,UAAU,EAAC,iBAAiB,EAAC,KAAK,EAAC,WAAW,EAC/C,QAAA,EAAA,QAAQ,EACN,CAAA,EACN,gBAAgB,KACbF,IAAA,CAAAC,QAAA,EAAA,EAAA,QAAA,EAAA,CACIC,GAAC,CAAA,QAAQ,EAAC,EAAA,OAAO,EAAE,EAAE,EAAI,CAAA,EACxB,gBAAgB,CAAA,EAAA,CAClB,CACN,CAAA,EAAA,CACF,EACL;AACN;;;;"}
package/SingleUpload.js CHANGED
@@ -15,7 +15,7 @@ import { useDropActions } from './useDropActions.js';
15
15
  import { useDropButtons } from './useDropButtons.js';
16
16
  import { useFilePreview } from './useFilePreview.js';
17
17
  import { getAvaliableFileTypes, getUploadIcon, bytes2mb, DEFAULT_ACCEPT, RenderFileInfoDefault } from './utils.js';
18
- import { s as styles } from './upload-BSffvIL5.js';
18
+ import { s as styles } from './upload-BCv6pgSa.js';
19
19
  import '@hh.ru/magritte-ui-action';
20
20
  import '@hh.ru/magritte-ui-divider';
21
21
  import '@hh.ru/magritte-ui-breakpoint';
package/Upload.js CHANGED
@@ -21,7 +21,7 @@ import '@hh.ru/magritte-ui-breakpoint';
21
21
  import '@hh.ru/magritte-ui-typography';
22
22
  import './useDropActions.js';
23
23
  import './useDropButtons.js';
24
- import './upload-BSffvIL5.js';
24
+ import './upload-BCv6pgSa.js';
25
25
 
26
26
  const Upload = ({ multiple, noDragEventsBubbling = true, ...uploadProps }) => {
27
27
  if (multiple) {
package/index.css CHANGED
@@ -1,178 +1,178 @@
1
1
  :root{
2
- --magritte-typography-label-2-regular-font-family-v21-0-0:"hh sans";
3
- --magritte-typography-label-2-regular-font-weight-v21-0-0:400;
4
- --magritte-typography-label-2-regular-line-height-v21-0-0:22px;
5
- --magritte-typography-label-2-regular-font-size-v21-0-0:16px;
6
- --magritte-typography-label-2-regular-letter-spacing-v21-0-0:0em;
7
- --magritte-typography-label-2-regular-text-indent-v21-0-0:0px;
8
- --magritte-typography-label-2-regular-text-transform-v21-0-0:none;
9
- --magritte-typography-label-2-regular-text-decoration-v21-0-0:none;
10
- }
11
- .magritte-file-name-body___PTTMc_3-2-2{
2
+ --magritte-typography-label-2-regular-font-family-v21-1-0:"hh sans";
3
+ --magritte-typography-label-2-regular-font-weight-v21-1-0:400;
4
+ --magritte-typography-label-2-regular-line-height-v21-1-0:22px;
5
+ --magritte-typography-label-2-regular-font-size-v21-1-0:16px;
6
+ --magritte-typography-label-2-regular-letter-spacing-v21-1-0:0em;
7
+ --magritte-typography-label-2-regular-text-indent-v21-1-0:0px;
8
+ --magritte-typography-label-2-regular-text-transform-v21-1-0:none;
9
+ --magritte-typography-label-2-regular-text-decoration-v21-1-0:none;
10
+ }
11
+ .magritte-file-name-body___PTTMc_3-2-4{
12
12
  display:flex;
13
13
  width:100%;
14
14
  overflow:hidden;
15
- font-family:var(--magritte-typography-label-2-regular-font-family-v21-0-0);
16
- font-weight:var(--magritte-typography-label-2-regular-font-weight-v21-0-0);
17
- line-height:var(--magritte-typography-label-2-regular-line-height-v21-0-0);
18
- font-size:var(--magritte-typography-label-2-regular-font-size-v21-0-0);
19
- letter-spacing:var(--magritte-typography-label-2-regular-letter-spacing-v21-0-0);
20
- text-indent:var(--magritte-typography-label-2-regular-text-indent-v21-0-0);
21
- text-transform:var(--magritte-typography-label-2-regular-text-transform-v21-0-0);
22
- text-decoration:var(--magritte-typography-label-2-regular-text-decoration-v21-0-0);
23
- }
24
- .magritte-file-name-body_medium___sfmmq_3-2-2{
15
+ font-family:var(--magritte-typography-label-2-regular-font-family-v21-1-0);
16
+ font-weight:var(--magritte-typography-label-2-regular-font-weight-v21-1-0);
17
+ line-height:var(--magritte-typography-label-2-regular-line-height-v21-1-0);
18
+ font-size:var(--magritte-typography-label-2-regular-font-size-v21-1-0);
19
+ letter-spacing:var(--magritte-typography-label-2-regular-letter-spacing-v21-1-0);
20
+ text-indent:var(--magritte-typography-label-2-regular-text-indent-v21-1-0);
21
+ text-transform:var(--magritte-typography-label-2-regular-text-transform-v21-1-0);
22
+ text-decoration:var(--magritte-typography-label-2-regular-text-decoration-v21-1-0);
23
+ }
24
+ .magritte-file-name-body_medium___sfmmq_3-2-4{
25
25
  justify-content:center;
26
26
  }
27
- .magritte-file-name___ZSL2g_3-2-2{
27
+ .magritte-file-name___ZSL2g_3-2-4{
28
28
  overflow:hidden;
29
29
  text-overflow:ellipsis;
30
30
  }
31
31
 
32
32
  :root{
33
- --magritte-typography-label-4-regular-font-family-v21-0-0:"hh sans";
34
- --magritte-typography-label-4-regular-font-weight-v21-0-0:400;
35
- --magritte-typography-label-4-regular-line-height-v21-0-0:18px;
36
- --magritte-typography-label-4-regular-font-size-v21-0-0:12px;
37
- --magritte-typography-label-4-regular-letter-spacing-v21-0-0:0.01em;
38
- --magritte-typography-label-4-regular-text-indent-v21-0-0:0px;
39
- --magritte-typography-label-4-regular-text-transform-v21-0-0:none;
40
- --magritte-typography-label-4-regular-text-decoration-v21-0-0:none;
41
- --magritte-static-space-100-v21-0-0:4px;
42
- --magritte-static-space-400-v21-0-0:16px;
43
- }
44
- .magritte-file-info-body___HmfXd_3-2-2{
33
+ --magritte-typography-label-4-regular-font-family-v21-1-0:"hh sans";
34
+ --magritte-typography-label-4-regular-font-weight-v21-1-0:400;
35
+ --magritte-typography-label-4-regular-line-height-v21-1-0:18px;
36
+ --magritte-typography-label-4-regular-font-size-v21-1-0:12px;
37
+ --magritte-typography-label-4-regular-letter-spacing-v21-1-0:0.01em;
38
+ --magritte-typography-label-4-regular-text-indent-v21-1-0:0px;
39
+ --magritte-typography-label-4-regular-text-transform-v21-1-0:none;
40
+ --magritte-typography-label-4-regular-text-decoration-v21-1-0:none;
41
+ --magritte-static-space-100-v21-1-0:4px;
42
+ --magritte-static-space-400-v21-1-0:16px;
43
+ }
44
+ .magritte-file-info-body___HmfXd_3-2-4{
45
45
  flex-grow:1;
46
46
  }
47
- .magritte-file-info-and-controls___61iyY_3-2-2{
47
+ .magritte-file-info-and-controls___61iyY_3-2-4{
48
48
  display:flex;
49
- gap:var(--magritte-static-space-400-v21-0-0);
49
+ gap:var(--magritte-static-space-400-v21-1-0);
50
50
  }
51
- .magritte-file-info-container___WFab8_3-2-2{
51
+ .magritte-file-info-container___WFab8_3-2-4{
52
52
  flex-grow:1;
53
53
  width:50px;
54
54
  }
55
- .magritte-file-info___HrqiB_3-2-2{
55
+ .magritte-file-info___HrqiB_3-2-4{
56
56
  display:flex;
57
- gap:var(--magritte-static-space-100-v21-0-0);
58
- font-family:var(--magritte-typography-label-4-regular-font-family-v21-0-0);
59
- font-weight:var(--magritte-typography-label-4-regular-font-weight-v21-0-0);
60
- line-height:var(--magritte-typography-label-4-regular-line-height-v21-0-0);
61
- font-size:var(--magritte-typography-label-4-regular-font-size-v21-0-0);
62
- letter-spacing:var(--magritte-typography-label-4-regular-letter-spacing-v21-0-0);
63
- text-indent:var(--magritte-typography-label-4-regular-text-indent-v21-0-0);
64
- text-transform:var(--magritte-typography-label-4-regular-text-transform-v21-0-0);
65
- text-decoration:var(--magritte-typography-label-4-regular-text-decoration-v21-0-0);
66
- }
67
- .magritte-controls___WdH7A_3-2-2{
57
+ gap:var(--magritte-static-space-100-v21-1-0);
58
+ font-family:var(--magritte-typography-label-4-regular-font-family-v21-1-0);
59
+ font-weight:var(--magritte-typography-label-4-regular-font-weight-v21-1-0);
60
+ line-height:var(--magritte-typography-label-4-regular-line-height-v21-1-0);
61
+ font-size:var(--magritte-typography-label-4-regular-font-size-v21-1-0);
62
+ letter-spacing:var(--magritte-typography-label-4-regular-letter-spacing-v21-1-0);
63
+ text-indent:var(--magritte-typography-label-4-regular-text-indent-v21-1-0);
64
+ text-transform:var(--magritte-typography-label-4-regular-text-transform-v21-1-0);
65
+ text-decoration:var(--magritte-typography-label-4-regular-text-decoration-v21-1-0);
66
+ }
67
+ .magritte-controls___WdH7A_3-2-4{
68
68
  display:flex;
69
69
  align-items:center;
70
70
  margin-left:auto;
71
- margin-right:var(--magritte-static-space-400-v21-0-0);
71
+ margin-right:var(--magritte-static-space-400-v21-1-0);
72
72
  }
73
73
 
74
74
  :root{
75
- --magritte-static-space-400-v21-0-0:16px;
75
+ --magritte-static-space-400-v21-1-0:16px;
76
76
  }
77
- .magritte-item___vVDG-_3-2-2{
77
+ .magritte-item___vVDG-_3-2-4{
78
78
  display:flex;
79
79
  width:100%;
80
- gap:var(--magritte-static-space-400-v21-0-0);
80
+ gap:var(--magritte-static-space-400-v21-1-0);
81
81
  }
82
82
 
83
83
  :root{
84
- --magritte-color-background-primary-v21-0-0:#ffffff;
85
- --magritte-color-stroke-neutral-v21-0-0:#DCE3EB;
86
- --magritte-color-stroke-accent-v21-0-0:#0070ff;
87
- --magritte-color-stroke-state-focused-accessible-v21-0-0:#0070ff7a;
88
- --magritte-color-component-input-stroke-state-negative-focused-accessible-v21-0-0:#ff4d3a7a;
84
+ --magritte-color-background-primary-v21-1-0:#ffffff;
85
+ --magritte-color-stroke-neutral-v21-1-0:#DCE3EB;
86
+ --magritte-color-stroke-accent-v21-1-0:#0070ff;
87
+ --magritte-color-stroke-state-focused-accessible-v21-1-0:#0070ff7a;
88
+ --magritte-color-component-input-stroke-state-negative-focused-accessible-v21-1-0:#ff4d3a7a;
89
89
  }
90
90
  :root{
91
- --magritte-static-space-300-v21-0-0:12px;
92
- --magritte-static-space-400-v21-0-0:16px;
93
- --magritte-static-space-500-v21-0-0:20px;
94
- --magritte-static-space-600-v21-0-0:24px;
95
- --magritte-static-border-radius-600-v21-0-0:24px;
91
+ --magritte-static-space-300-v21-1-0:12px;
92
+ --magritte-static-space-400-v21-1-0:16px;
93
+ --magritte-static-space-500-v21-1-0:20px;
94
+ --magritte-static-space-600-v21-1-0:24px;
95
+ --magritte-static-border-radius-600-v21-1-0:24px;
96
96
  }
97
97
  .magritte-night-theme{
98
- --magritte-color-background-primary-v21-0-0:#1B1B1B;
99
- --magritte-color-stroke-neutral-v21-0-0:#303030;
100
- --magritte-color-stroke-accent-v21-0-0:#2b7fff;
101
- --magritte-color-stroke-state-focused-accessible-v21-0-0:#0070ff7a;
102
- --magritte-color-component-input-stroke-state-negative-focused-accessible-v21-0-0:#ff4d3a7a;
98
+ --magritte-color-background-primary-v21-1-0:#1B1B1B;
99
+ --magritte-color-stroke-neutral-v21-1-0:#303030;
100
+ --magritte-color-stroke-accent-v21-1-0:#2b7fff;
101
+ --magritte-color-stroke-state-focused-accessible-v21-1-0:#0070ff7a;
102
+ --magritte-color-component-input-stroke-state-negative-focused-accessible-v21-1-0:#ff4d3a7a;
103
103
  }
104
- .magritte-root___FV1tC_3-2-2{
104
+ .magritte-root___FV1tC_3-2-4{
105
105
  position:relative;
106
106
  display:flex;
107
107
  overflow:hidden;
108
- border-radius:var(--magritte-static-border-radius-600-v21-0-0);
109
- background-color:var(--magritte-color-background-primary-v21-0-0);
108
+ border-radius:var(--magritte-static-border-radius-600-v21-1-0);
109
+ background-color:var(--magritte-color-background-primary-v21-1-0);
110
110
  }
111
- .magritte-root___FV1tC_3-2-2:hover{
111
+ .magritte-root___FV1tC_3-2-4:hover{
112
112
  cursor:pointer;
113
113
  }
114
- .magritte-root___FV1tC_3-2-2:hover .magritte-background___RfZ0U_3-2-2{
115
- border-color:var(--magritte-color-stroke-accent-v21-0-0);
114
+ .magritte-root___FV1tC_3-2-4:hover .magritte-background___RfZ0U_3-2-4{
115
+ border-color:var(--magritte-color-stroke-accent-v21-1-0);
116
116
  }
117
- .magritte-root___FV1tC_3-2-2.magritte-drag-active___dihBL_3-2-2 .magritte-background___RfZ0U_3-2-2{
118
- border-color:var(--magritte-color-stroke-accent-v21-0-0);
117
+ .magritte-root___FV1tC_3-2-4.magritte-drag-active___dihBL_3-2-4 .magritte-background___RfZ0U_3-2-4{
118
+ border-color:var(--magritte-color-stroke-accent-v21-1-0);
119
119
  }
120
- .magritte-root___FV1tC_3-2-2.focus-visible{
121
- outline:var(--magritte-color-stroke-state-focused-accessible-v21-0-0) solid 4px;
120
+ .magritte-root___FV1tC_3-2-4.focus-visible{
121
+ outline:var(--magritte-color-stroke-state-focused-accessible-v21-1-0) solid 4px;
122
122
  }
123
- .magritte-root___FV1tC_3-2-2.focus-visible .magritte-background___RfZ0U_3-2-2{
124
- border-color:var(--magritte-color-stroke-accent-v21-0-0);
123
+ .magritte-root___FV1tC_3-2-4.focus-visible .magritte-background___RfZ0U_3-2-4{
124
+ border-color:var(--magritte-color-stroke-accent-v21-1-0);
125
125
  }
126
- .magritte-root___FV1tC_3-2-2.magritte-load___MghDA_3-2-2 .magritte-background___RfZ0U_3-2-2,
127
- .magritte-root___FV1tC_3-2-2.magritte-loading___9E3p-_3-2-2 .magritte-background___RfZ0U_3-2-2{
126
+ .magritte-root___FV1tC_3-2-4.magritte-load___MghDA_3-2-4 .magritte-background___RfZ0U_3-2-4,
127
+ .magritte-root___FV1tC_3-2-4.magritte-loading___9E3p-_3-2-4 .magritte-background___RfZ0U_3-2-4{
128
128
  border-style:solid;
129
129
  border-width:7px;
130
130
  }
131
- .magritte-root___FV1tC_3-2-2.magritte-invalid___Rt10-_3-2-2.focus-visible{
132
- outline:var(--magritte-color-component-input-stroke-state-negative-focused-accessible-v21-0-0) solid 4px;
131
+ .magritte-root___FV1tC_3-2-4.magritte-invalid___Rt10-_3-2-4.focus-visible{
132
+ outline:var(--magritte-color-component-input-stroke-state-negative-focused-accessible-v21-1-0) solid 4px;
133
133
  }
134
- .magritte-root___FV1tC_3-2-2.magritte-invalid___Rt10-_3-2-2 .magritte-background___RfZ0U_3-2-2{
135
- border-color:var(--magritte-color-stroke-neutral-v21-0-0);
134
+ .magritte-root___FV1tC_3-2-4.magritte-invalid___Rt10-_3-2-4 .magritte-background___RfZ0U_3-2-4{
135
+ border-color:var(--magritte-color-stroke-neutral-v21-1-0);
136
136
  }
137
- .magritte-root_medium___67WJa_3-2-2{
137
+ .magritte-root_medium___67WJa_3-2-4{
138
138
  justify-content:center;
139
- padding:var(--magritte-static-space-600-v21-0-0);
139
+ padding:var(--magritte-static-space-600-v21-1-0);
140
140
  }
141
- .magritte-root_medium___67WJa_3-2-2 .magritte-body___O7ROl_3-2-2{
141
+ .magritte-root_medium___67WJa_3-2-4 .magritte-body___O7ROl_3-2-4{
142
142
  flex-direction:column;
143
143
  align-items:center;
144
144
  justify-content:center;
145
145
  }
146
- .magritte-root_small___dkUYq_3-2-2{
147
- padding-top:var(--magritte-static-space-400-v21-0-0);
148
- padding-bottom:var(--magritte-static-space-400-v21-0-0);
149
- padding-left:var(--magritte-static-space-400-v21-0-0);
146
+ .magritte-root_small___dkUYq_3-2-4{
147
+ padding-top:var(--magritte-static-space-400-v21-1-0);
148
+ padding-bottom:var(--magritte-static-space-400-v21-1-0);
149
+ padding-left:var(--magritte-static-space-400-v21-1-0);
150
150
  }
151
- .magritte-root_small___dkUYq_3-2-2 .magritte-body___O7ROl_3-2-2{
152
- gap:var(--magritte-static-space-400-v21-0-0);
151
+ .magritte-root_small___dkUYq_3-2-4 .magritte-body___O7ROl_3-2-4{
152
+ gap:var(--magritte-static-space-400-v21-1-0);
153
153
  }
154
- .magritte-background___RfZ0U_3-2-2{
154
+ .magritte-background___RfZ0U_3-2-4{
155
155
  position:absolute;
156
156
  border-width:8px;
157
157
  border-style:dashed;
158
- border-color:var(--magritte-color-stroke-neutral-v21-0-0);
158
+ border-color:var(--magritte-color-stroke-neutral-v21-1-0);
159
159
  top:-6px;
160
160
  bottom:-6px;
161
161
  left:-6px;
162
162
  right:-6px;
163
- border-radius:calc(var(--magritte-static-border-radius-600-v21-0-0) + 6px);
163
+ border-radius:calc(var(--magritte-static-border-radius-600-v21-1-0) + 6px);
164
164
  background-position:center;
165
165
  background-size:100%;
166
166
  }
167
- .magritte-body___O7ROl_3-2-2{
167
+ .magritte-body___O7ROl_3-2-4{
168
168
  display:flex;
169
169
  width:100%;
170
170
  }
171
- .magritte-loader___XYpWg_3-2-2{
171
+ .magritte-loader___XYpWg_3-2-4{
172
172
  position:relative;
173
173
  display:flex;
174
174
  }
175
- .magritte-cancel___tQ-yX_3-2-2{
175
+ .magritte-cancel___tQ-yX_3-2-4{
176
176
  position:absolute;
177
177
  top:0;
178
178
  left:0;
@@ -182,25 +182,25 @@
182
182
  align-items:center;
183
183
  justify-content:center;
184
184
  }
185
- .magritte-image-controls___vLf94_3-2-2{
185
+ .magritte-image-controls___vLf94_3-2-4{
186
186
  display:flex;
187
187
  position:absolute;
188
- right:var(--magritte-static-space-300-v21-0-0);
189
- bottom:var(--magritte-static-space-300-v21-0-0);
190
- gap:var(--magritte-static-space-300-v21-0-0);
188
+ right:var(--magritte-static-space-300-v21-1-0);
189
+ bottom:var(--magritte-static-space-300-v21-1-0);
190
+ gap:var(--magritte-static-space-300-v21-1-0);
191
191
  }
192
- .magritte-small-controls___Qn9TP_3-2-2{
192
+ .magritte-small-controls___Qn9TP_3-2-4{
193
193
  display:flex;
194
194
  align-items:center;
195
195
  margin-left:auto;
196
- margin-right:var(--magritte-static-space-500-v21-0-0);
196
+ margin-right:var(--magritte-static-space-500-v21-1-0);
197
197
  }
198
- .magritte-file-list___L9uHt_3-2-2{
199
- margin-top:var(--magritte-static-space-300-v21-0-0);
200
- box-shadow:inset 0 0 0 1px var(--magritte-color-stroke-neutral-v21-0-0);
201
- border-radius:var(--magritte-static-border-radius-600-v21-0-0);
202
- padding-top:var(--magritte-static-space-400-v21-0-0);
198
+ .magritte-file-list___L9uHt_3-2-4{
199
+ margin-top:var(--magritte-static-space-300-v21-1-0);
200
+ box-shadow:inset 0 0 0 1px var(--magritte-color-stroke-neutral-v21-1-0);
201
+ border-radius:var(--magritte-static-border-radius-600-v21-1-0);
202
+ padding-top:var(--magritte-static-space-400-v21-1-0);
203
203
  padding-right:0;
204
- padding-bottom:var(--magritte-static-space-400-v21-0-0);
205
- padding-left:var(--magritte-static-space-400-v21-0-0);
204
+ padding-bottom:var(--magritte-static-space-400-v21-1-0);
205
+ padding-left:var(--magritte-static-space-400-v21-1-0);
206
206
  }
package/index.d.ts CHANGED
@@ -1,2 +1,3 @@
1
+ export * from '@hh.ru/magritte-ui-theme-provider';
1
2
  export * from '@hh.ru/magritte-ui-upload/Upload';
2
3
  export * from '@hh.ru/magritte-ui-upload/types';
package/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import './index.css';
2
+ export * from '@hh.ru/magritte-ui-theme-provider';
2
3
  export { Upload } from './Upload.js';
3
4
  import 'react/jsx-runtime';
4
5
  import './MultiUpload.js';
@@ -21,6 +22,6 @@ import '@hh.ru/magritte-ui-breakpoint';
21
22
  import '@hh.ru/magritte-ui-typography';
22
23
  import './useDropActions.js';
23
24
  import './useDropButtons.js';
24
- import './upload-BSffvIL5.js';
25
+ import './upload-BCv6pgSa.js';
25
26
  import './SingleUpload.js';
26
27
  //# sourceMappingURL=index.js.map
package/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,5 @@
1
+ import { ForwardRefExoticComponent } from 'react';
2
+ export type * from '@hh.ru/magritte-ui-upload/types';
3
+ declare const ThemeProvider: any;
4
+ export { ThemeProvider };
5
+ export declare const Upload: ForwardRefExoticComponent<Record<string, unknown>>;
package/index.mock.js ADDED
@@ -0,0 +1,11 @@
1
+ import './index.css';
2
+ import { mockComponent } from '@hh.ru/magritte-ui-mock-component';
3
+
4
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
5
+ const { ThemeProvider } = jest.requireActual('@hh.ru/magritte-ui-theme-provider/index');
6
+ const Upload = mockComponent('Upload', undefined, {
7
+ withChildren: false,
8
+ });
9
+
10
+ export { ThemeProvider, Upload };
11
+ //# sourceMappingURL=index.mock.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mock.js","sources":["../src/index.mock.ts"],"sourcesContent":["import { ForwardRefExoticComponent } from 'react';\n\nimport { mockComponent } from '@hh.ru/magritte-ui-mock-component';\n\nexport type * from '@hh.ru/magritte-ui-upload/types';\n\n// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\nconst { ThemeProvider } = jest.requireActual('@hh.ru/magritte-ui-theme-provider/index');\n\nexport { ThemeProvider };\n\nexport const Upload: ForwardRefExoticComponent<Record<string, unknown>> = mockComponent('Upload', undefined, {\n withChildren: false,\n});\n"],"names":[],"mappings":";;AAMA;AACM,MAAA,EAAE,aAAa,EAAE,GAAG,IAAI,CAAC,aAAa,CAAC,yCAAyC,EAAE;MAI3E,MAAM,GAAuD,aAAa,CAAC,QAAQ,EAAE,SAAS,EAAE;AACzG,IAAA,YAAY,EAAE,KAAK;AACtB,CAAA;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hh.ru/magritte-ui-upload",
3
- "version": "3.2.2",
3
+ "version": "3.2.4",
4
4
  "main": "index.js",
5
5
  "types": "index.d.ts",
6
6
  "sideEffects": [
@@ -27,16 +27,19 @@
27
27
  "react": ">=18.2.0"
28
28
  },
29
29
  "dependencies": {
30
- "@hh.ru/magritte-ui-action": "4.4.23",
31
- "@hh.ru/magritte-ui-avatar": "5.1.1",
30
+ "@hh.ru/magritte-ui-action": "4.4.24",
31
+ "@hh.ru/magritte-ui-avatar": "5.1.2",
32
32
  "@hh.ru/magritte-ui-breakpoint": "5.0.0",
33
- "@hh.ru/magritte-ui-button": "5.2.15",
34
- "@hh.ru/magritte-ui-divider": "1.1.40",
35
- "@hh.ru/magritte-ui-icon": "7.9.11",
36
- "@hh.ru/magritte-ui-loader": "1.3.16",
37
- "@hh.ru/magritte-ui-spacing": "2.0.38",
38
- "@hh.ru/magritte-ui-typography": "3.0.26",
33
+ "@hh.ru/magritte-ui-button": "5.2.16",
34
+ "@hh.ru/magritte-ui-button-stack": "2.1.35",
35
+ "@hh.ru/magritte-ui-divider": "1.1.41",
36
+ "@hh.ru/magritte-ui-icon": "7.9.12",
37
+ "@hh.ru/magritte-ui-loader": "1.3.17",
38
+ "@hh.ru/magritte-ui-mock-component": "1.0.12",
39
+ "@hh.ru/magritte-ui-spacing": "2.0.39",
40
+ "@hh.ru/magritte-ui-theme-provider": "1.1.37",
41
+ "@hh.ru/magritte-ui-typography": "3.0.27",
39
42
  "react-dropzone": "14.3.5"
40
43
  },
41
- "gitHead": "d969104667bac3470d222588ac719c4fc9cd06d6"
44
+ "gitHead": "6ae3dbd40e749f4dfd123c76295ec05afc2c79e0"
42
45
  }
package/types.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { ReactNode, ComponentProps, ReactElement, MouseEvent } from 'react';
1
+ import { ReactNode, MouseEvent } from 'react';
2
2
  import { DropzoneOptions, DropEvent } from 'react-dropzone';
3
- import { Button } from '@hh.ru/magritte-ui-button';
3
+ import { ButtonElement } from '@hh.ru/magritte-ui-button-stack';
4
4
  export interface LoadedFile {
5
5
  data: File;
6
6
  loading: boolean;
@@ -8,7 +8,6 @@ export interface LoadedFile {
8
8
  loadTime?: number;
9
9
  loadPercentage?: number;
10
10
  }
11
- export type ButtonElement = ReactElement<ComponentProps<typeof Button>>;
12
11
  export type UploadType = 'application' | 'image' | 'video' | 'mixed';
13
12
  export type LoadedFileWithFileSize = LoadedFile & {
14
13
  fileSizeMB: string;
@@ -0,0 +1,5 @@
1
+ import './index.css';
2
+ var styles = {"root":"magritte-root___FV1tC_3-2-4","background":"magritte-background___RfZ0U_3-2-4","drag-active":"magritte-drag-active___dihBL_3-2-4","dragActive":"magritte-drag-active___dihBL_3-2-4","load":"magritte-load___MghDA_3-2-4","loading":"magritte-loading___9E3p-_3-2-4","invalid":"magritte-invalid___Rt10-_3-2-4","root_medium":"magritte-root_medium___67WJa_3-2-4","rootMedium":"magritte-root_medium___67WJa_3-2-4","body":"magritte-body___O7ROl_3-2-4","root_small":"magritte-root_small___dkUYq_3-2-4","rootSmall":"magritte-root_small___dkUYq_3-2-4","loader":"magritte-loader___XYpWg_3-2-4","cancel":"magritte-cancel___tQ-yX_3-2-4","image-controls":"magritte-image-controls___vLf94_3-2-4","imageControls":"magritte-image-controls___vLf94_3-2-4","small-controls":"magritte-small-controls___Qn9TP_3-2-4","smallControls":"magritte-small-controls___Qn9TP_3-2-4","file-list":"magritte-file-list___L9uHt_3-2-4","fileList":"magritte-file-list___L9uHt_3-2-4"};
3
+
4
+ export { styles as s };
5
+ //# sourceMappingURL=upload-BCv6pgSa.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"upload-BCv6pgSa.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
@@ -1,5 +1,5 @@
1
1
  import { MouseEvent } from 'react';
2
- import { ButtonElement } from '@hh.ru/magritte-ui-upload/types';
2
+ import { ButtonElement } from '@hh.ru/magritte-ui-button-stack';
3
3
  interface DropButtons {
4
4
  selectFileButton?: ButtonElement;
5
5
  deleteFileButton?: ButtonElement;
@@ -1 +1 @@
1
- {"version":3,"file":"useDropButtons.js","sources":["../src/useDropButtons.tsx"],"sourcesContent":["import { MouseEvent, cloneElement, ComponentProps } from 'react';\n\nimport { Button } from '@hh.ru/magritte-ui-button';\nimport { ButtonElement } from '@hh.ru/magritte-ui-upload/types';\n\ninterface DropButtons {\n selectFileButton?: ButtonElement;\n deleteFileButton?: ButtonElement;\n replaceImageButton?: ButtonElement;\n}\n\ninterface UseDropButtonsProps extends DropButtons {\n onFileDelete?: (event: MouseEvent) => void;\n}\n\nconst useDropButtons = ({\n selectFileButton: _selectFileButton,\n deleteFileButton: _deleteFileButton,\n replaceImageButton: _replaceImageButton,\n onFileDelete,\n}: UseDropButtonsProps): DropButtons => {\n const selectFileButton =\n _selectFileButton &&\n cloneElement(_selectFileButton, {\n key: 'selectFileButton',\n 'data-qa': 'magritte-select-file-button',\n } as Partial<ComponentProps<typeof Button>>);\n\n const deleteFileButton =\n _deleteFileButton &&\n cloneElement(_deleteFileButton, {\n key: 'deleteFileButton',\n 'data-qa': 'magritte-delete-file-button',\n onClick: onFileDelete,\n } as Partial<ComponentProps<typeof Button>>);\n\n const replaceImageButton =\n _replaceImageButton &&\n cloneElement(_replaceImageButton, {\n key: 'replaceImageButton',\n 'data-qa': 'magritte-select-replace-image-button',\n } as Partial<ComponentProps<typeof Button>>);\n\n return { selectFileButton, deleteFileButton, replaceImageButton };\n};\n\nexport { useDropButtons };\n"],"names":[],"mappings":";;AAeA,MAAM,cAAc,GAAG,CAAC,EACpB,gBAAgB,EAAE,iBAAiB,EACnC,gBAAgB,EAAE,iBAAiB,EACnC,kBAAkB,EAAE,mBAAmB,EACvC,YAAY,GACM,KAAiB;IACnC,MAAM,gBAAgB,GAClB,iBAAiB;QACjB,YAAY,CAAC,iBAAiB,EAAE;AAC5B,YAAA,GAAG,EAAE,kBAAkB;AACvB,YAAA,SAAS,EAAE,6BAA6B;AACD,SAAA,CAAC,CAAC;IAEjD,MAAM,gBAAgB,GAClB,iBAAiB;QACjB,YAAY,CAAC,iBAAiB,EAAE;AAC5B,YAAA,GAAG,EAAE,kBAAkB;AACvB,YAAA,SAAS,EAAE,6BAA6B;AACxC,YAAA,OAAO,EAAE,YAAY;AACkB,SAAA,CAAC,CAAC;IAEjD,MAAM,kBAAkB,GACpB,mBAAmB;QACnB,YAAY,CAAC,mBAAmB,EAAE;AAC9B,YAAA,GAAG,EAAE,oBAAoB;AACzB,YAAA,SAAS,EAAE,sCAAsC;AACV,SAAA,CAAC,CAAC;AAEjD,IAAA,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,CAAC;AACtE;;;;"}
1
+ {"version":3,"file":"useDropButtons.js","sources":["../src/useDropButtons.tsx"],"sourcesContent":["import { MouseEvent, cloneElement, ComponentProps } from 'react';\n\nimport { Button } from '@hh.ru/magritte-ui-button';\nimport { ButtonElement } from '@hh.ru/magritte-ui-button-stack';\n\ninterface DropButtons {\n selectFileButton?: ButtonElement;\n deleteFileButton?: ButtonElement;\n replaceImageButton?: ButtonElement;\n}\n\ninterface UseDropButtonsProps extends DropButtons {\n onFileDelete?: (event: MouseEvent) => void;\n}\n\nconst useDropButtons = ({\n selectFileButton: _selectFileButton,\n deleteFileButton: _deleteFileButton,\n replaceImageButton: _replaceImageButton,\n onFileDelete,\n}: UseDropButtonsProps): DropButtons => {\n const selectFileButton =\n _selectFileButton &&\n cloneElement(_selectFileButton, {\n key: 'selectFileButton',\n 'data-qa': 'magritte-select-file-button',\n } as Partial<ComponentProps<typeof Button>>);\n\n const deleteFileButton =\n _deleteFileButton &&\n cloneElement(_deleteFileButton, {\n key: 'deleteFileButton',\n 'data-qa': 'magritte-delete-file-button',\n onClick: onFileDelete,\n } as Partial<ComponentProps<typeof Button>>);\n\n const replaceImageButton =\n _replaceImageButton &&\n cloneElement(_replaceImageButton, {\n key: 'replaceImageButton',\n 'data-qa': 'magritte-select-replace-image-button',\n } as Partial<ComponentProps<typeof Button>>);\n\n return { selectFileButton, deleteFileButton, replaceImageButton };\n};\n\nexport { useDropButtons };\n"],"names":[],"mappings":";;AAeA,MAAM,cAAc,GAAG,CAAC,EACpB,gBAAgB,EAAE,iBAAiB,EACnC,gBAAgB,EAAE,iBAAiB,EACnC,kBAAkB,EAAE,mBAAmB,EACvC,YAAY,GACM,KAAiB;IACnC,MAAM,gBAAgB,GAClB,iBAAiB;QACjB,YAAY,CAAC,iBAAiB,EAAE;AAC5B,YAAA,GAAG,EAAE,kBAAkB;AACvB,YAAA,SAAS,EAAE,6BAA6B;AACD,SAAA,CAAC,CAAC;IAEjD,MAAM,gBAAgB,GAClB,iBAAiB;QACjB,YAAY,CAAC,iBAAiB,EAAE;AAC5B,YAAA,GAAG,EAAE,kBAAkB;AACvB,YAAA,SAAS,EAAE,6BAA6B;AACxC,YAAA,OAAO,EAAE,YAAY;AACkB,SAAA,CAAC,CAAC;IAEjD,MAAM,kBAAkB,GACpB,mBAAmB;QACnB,YAAY,CAAC,mBAAmB,EAAE;AAC9B,YAAA,GAAG,EAAE,oBAAoB;AACzB,YAAA,SAAS,EAAE,sCAAsC;AACV,SAAA,CAAC,CAAC;AAEjD,IAAA,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,CAAC;AACtE;;;;"}
package/useFilePreview.js CHANGED
@@ -6,7 +6,7 @@ const useFilePreview = ({ loadedFile, isImageType }) => {
6
6
  if (!loadedFile || !isImageType) {
7
7
  return 'none';
8
8
  }
9
- if (loadedFile.loading) {
9
+ if (loadedFile.loading || loadedFile.error) {
10
10
  return 'none';
11
11
  }
12
12
  return URL.createObjectURL(loadedFile.data);
@@ -1 +1 @@
1
- {"version":3,"file":"useFilePreview.js","sources":["../src/useFilePreview.tsx"],"sourcesContent":["import { useMemo } from 'react';\n\nimport { LoadedFile } from '@hh.ru/magritte-ui-upload/types';\n\ninterface UseFilePreviewProps {\n loadedFile: LoadedFile | undefined;\n isImageType: boolean;\n}\n\nconst useFilePreview = ({ loadedFile, isImageType }: UseFilePreviewProps): string => {\n return useMemo(() => {\n if (!loadedFile || !isImageType) {\n return 'none';\n }\n if (loadedFile.loading) {\n return 'none';\n }\n return URL.createObjectURL(loadedFile.data);\n }, [loadedFile, isImageType]);\n};\n\nexport { useFilePreview };\n"],"names":[],"mappings":";;AASM,MAAA,cAAc,GAAG,CAAC,EAAE,UAAU,EAAE,WAAW,EAAuB,KAAY;IAChF,OAAO,OAAO,CAAC,MAAK;AAChB,QAAA,IAAI,CAAC,UAAU,IAAI,CAAC,WAAW,EAAE;AAC7B,YAAA,OAAO,MAAM,CAAC;SACjB;AACD,QAAA,IAAI,UAAU,CAAC,OAAO,EAAE;AACpB,YAAA,OAAO,MAAM,CAAC;SACjB;QACD,OAAO,GAAG,CAAC,eAAe,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;AAChD,KAAC,EAAE,CAAC,UAAU,EAAE,WAAW,CAAC,CAAC,CAAC;AAClC;;;;"}
1
+ {"version":3,"file":"useFilePreview.js","sources":["../src/useFilePreview.tsx"],"sourcesContent":["import { useMemo } from 'react';\n\nimport { LoadedFile } from '@hh.ru/magritte-ui-upload/types';\n\ninterface UseFilePreviewProps {\n loadedFile: LoadedFile | undefined;\n isImageType: boolean;\n}\n\nconst useFilePreview = ({ loadedFile, isImageType }: UseFilePreviewProps): string => {\n return useMemo(() => {\n if (!loadedFile || !isImageType) {\n return 'none';\n }\n if (loadedFile.loading || loadedFile.error) {\n return 'none';\n }\n return URL.createObjectURL(loadedFile.data);\n }, [loadedFile, isImageType]);\n};\n\nexport { useFilePreview };\n"],"names":[],"mappings":";;AASM,MAAA,cAAc,GAAG,CAAC,EAAE,UAAU,EAAE,WAAW,EAAuB,KAAY;IAChF,OAAO,OAAO,CAAC,MAAK;AAChB,QAAA,IAAI,CAAC,UAAU,IAAI,CAAC,WAAW,EAAE;AAC7B,YAAA,OAAO,MAAM,CAAC;SACjB;QACD,IAAI,UAAU,CAAC,OAAO,IAAI,UAAU,CAAC,KAAK,EAAE;AACxC,YAAA,OAAO,MAAM,CAAC;SACjB;QACD,OAAO,GAAG,CAAC,eAAe,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;AAChD,KAAC,EAAE,CAAC,UAAU,EAAE,WAAW,CAAC,CAAC,CAAC;AAClC;;;;"}
@@ -1,5 +0,0 @@
1
- import './index.css';
2
- var styles = {"root":"magritte-root___FV1tC_3-2-2","background":"magritte-background___RfZ0U_3-2-2","drag-active":"magritte-drag-active___dihBL_3-2-2","dragActive":"magritte-drag-active___dihBL_3-2-2","load":"magritte-load___MghDA_3-2-2","loading":"magritte-loading___9E3p-_3-2-2","invalid":"magritte-invalid___Rt10-_3-2-2","root_medium":"magritte-root_medium___67WJa_3-2-2","rootMedium":"magritte-root_medium___67WJa_3-2-2","body":"magritte-body___O7ROl_3-2-2","root_small":"magritte-root_small___dkUYq_3-2-2","rootSmall":"magritte-root_small___dkUYq_3-2-2","loader":"magritte-loader___XYpWg_3-2-2","cancel":"magritte-cancel___tQ-yX_3-2-2","image-controls":"magritte-image-controls___vLf94_3-2-2","imageControls":"magritte-image-controls___vLf94_3-2-2","small-controls":"magritte-small-controls___Qn9TP_3-2-2","smallControls":"magritte-small-controls___Qn9TP_3-2-2","file-list":"magritte-file-list___L9uHt_3-2-2","fileList":"magritte-file-list___L9uHt_3-2-2"};
3
-
4
- export { styles as s };
5
- //# sourceMappingURL=upload-BSffvIL5.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"upload-BSffvIL5.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}