@hh.ru/magritte-ui-upload 4.2.15 → 4.3.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/FileName.js +1 -1
- package/FileView.js +1 -1
- package/MultiUpload.js +1 -1
- package/Placeholder.d.ts +2 -3
- package/Placeholder.js.map +1 -1
- package/SingleUpload.js +1 -1
- package/Upload.js +1 -1
- package/index.css +37 -37
- package/index.js +1 -1
- package/package.json +2 -3
- package/types.d.ts +3 -4
- package/upload-DFq_qKia.js +10 -0
- package/{upload-PuMFsrcJ.js.map → upload-DFq_qKia.js.map} +1 -1
- package/useDropButtons.d.ts +4 -5
- package/useDropButtons.js +4 -1
- package/useDropButtons.js.map +1 -1
- package/upload-PuMFsrcJ.js +0 -10
package/FileName.js
CHANGED
|
@@ -3,7 +3,7 @@ import { jsxs, jsx } from 'react/jsx-runtime';
|
|
|
3
3
|
import classnames from 'classnames';
|
|
4
4
|
import { Text } from '@hh.ru/magritte-ui-typography';
|
|
5
5
|
|
|
6
|
-
var styles = {"file-name-body":"magritte-file-name-body___PTTMc_4-
|
|
6
|
+
var styles = {"file-name-body":"magritte-file-name-body___PTTMc_4-3-0","fileNameBody":"magritte-file-name-body___PTTMc_4-3-0","file-name-body_medium":"magritte-file-name-body_medium___sfmmq_4-3-0","fileNameBodyMedium":"magritte-file-name-body_medium___sfmmq_4-3-0"};
|
|
7
7
|
|
|
8
8
|
const parse = (file) => {
|
|
9
9
|
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 = {"avatar-and-info":"magritte-avatar-and-info___vt6aT_4-
|
|
13
|
+
var styles = {"avatar-and-info":"magritte-avatar-and-info___vt6aT_4-3-0","avatarAndInfo":"magritte-avatar-and-info___vt6aT_4-3-0","file-info-body":"magritte-file-info-body___HmfXd_4-3-0","fileInfoBody":"magritte-file-info-body___HmfXd_4-3-0","file-info-and-controls":"magritte-file-info-and-controls___61iyY_4-3-0","fileInfoAndControls":"magritte-file-info-and-controls___61iyY_4-3-0","file-info-container":"magritte-file-info-container___WFab8_4-3-0","fileInfoContainer":"magritte-file-info-container___WFab8_4-3-0","file-info":"magritte-file-info___HrqiB_4-3-0","fileInfo":"magritte-file-info___HrqiB_4-3-0","controls":"magritte-controls___WdH7A_4-3-0","divider":"magritte-divider___3-bj9_4-3-0"};
|
|
14
14
|
|
|
15
15
|
const FileView = ({ uploadType, loadedFile, preview, renderFileInfo, onFileDelete, disableCancel, 'aria-label': ariaLabel, isLast = false, }) => {
|
|
16
16
|
const isLoading = Boolean(loadedFile?.loading);
|
package/MultiUpload.js
CHANGED
|
@@ -2,7 +2,7 @@ import './index.css';
|
|
|
2
2
|
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
3
3
|
import { useDropzone } from 'react-dropzone';
|
|
4
4
|
import classnames from 'classnames';
|
|
5
|
-
import { u as useDisabled, D as DisabledContext, s as styles } from './upload-
|
|
5
|
+
import { u as useDisabled, D as DisabledContext, s as styles } from './upload-DFq_qKia.js';
|
|
6
6
|
import { VSpacing } from '@hh.ru/magritte-ui-spacing';
|
|
7
7
|
import { TextDynamic } from '@hh.ru/magritte-ui-typography';
|
|
8
8
|
import { FileViewWithPreview } from './FileViewWithPreview.js';
|
package/Placeholder.d.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { ReactElement } from 'react';
|
|
2
|
-
import { ButtonElement } from '@hh.ru/magritte-ui-button-stack';
|
|
1
|
+
import { ReactElement, ReactNode } from 'react';
|
|
3
2
|
import { UploadTrls } from '@hh.ru/magritte-ui-upload/types';
|
|
4
3
|
interface PlaceholderProps {
|
|
5
4
|
trls: UploadTrls;
|
|
6
|
-
selectFileButton?:
|
|
5
|
+
selectFileButton?: ReactNode;
|
|
7
6
|
}
|
|
8
7
|
declare const Placeholder: ({ trls, selectFileButton }: PlaceholderProps) => ReactElement;
|
|
9
8
|
export { Placeholder };
|
package/Placeholder.js.map
CHANGED
|
@@ -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 {
|
|
1
|
+
{"version":3,"file":"Placeholder.js","sources":["src/Placeholder.tsx"],"sourcesContent":["import { ReactElement, ReactNode } 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 { UploadTrls } from '@hh.ru/magritte-ui-upload/types';\n\ninterface PlaceholderProps {\n trls: UploadTrls;\n selectFileButton?: ReactNode;\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;;;;"}
|
package/SingleUpload.js
CHANGED
|
@@ -2,7 +2,7 @@ import './index.css';
|
|
|
2
2
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
3
3
|
import { useDropzone } from 'react-dropzone';
|
|
4
4
|
import classnames from 'classnames';
|
|
5
|
-
import { u as useDisabled, D as DisabledContext, s as styles } from './upload-
|
|
5
|
+
import { u as useDisabled, D as DisabledContext, s as styles } from './upload-DFq_qKia.js';
|
|
6
6
|
import { Avatar } from '@hh.ru/magritte-ui-avatar';
|
|
7
7
|
import { CrossOutlinedSize24, ExclamationTriangleOutlinedSize32 } from '@hh.ru/magritte-ui-icon/icon';
|
|
8
8
|
import { Loader } from '@hh.ru/magritte-ui-loader';
|
package/Upload.js
CHANGED
|
@@ -4,7 +4,7 @@ import { MultiUpload } from './MultiUpload.js';
|
|
|
4
4
|
import { SingleUpload } from './SingleUpload.js';
|
|
5
5
|
import 'react-dropzone';
|
|
6
6
|
import 'classnames';
|
|
7
|
-
import './upload-
|
|
7
|
+
import './upload-DFq_qKia.js';
|
|
8
8
|
import 'react';
|
|
9
9
|
import '@hh.ru/magritte-ui-spacing';
|
|
10
10
|
import '@hh.ru/magritte-ui-typography';
|
package/index.css
CHANGED
|
@@ -1,46 +1,46 @@
|
|
|
1
|
-
.magritte-file-name-body___PTTMc_4-
|
|
1
|
+
.magritte-file-name-body___PTTMc_4-3-0{
|
|
2
2
|
display:flex;
|
|
3
3
|
width:100%;
|
|
4
4
|
overflow:hidden;
|
|
5
5
|
}
|
|
6
|
-
.magritte-file-name-body_medium___sfmmq_4-
|
|
6
|
+
.magritte-file-name-body_medium___sfmmq_4-3-0{
|
|
7
7
|
justify-content:center;
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
.magritte-avatar-and-info___vt6aT_4-
|
|
10
|
+
.magritte-avatar-and-info___vt6aT_4-3-0{
|
|
11
11
|
display:flex;
|
|
12
12
|
gap:16px;
|
|
13
13
|
width:100%;
|
|
14
14
|
}
|
|
15
|
-
.magritte-file-info-body___HmfXd_4-
|
|
15
|
+
.magritte-file-info-body___HmfXd_4-3-0{
|
|
16
16
|
display:flex;
|
|
17
17
|
flex-grow:1;
|
|
18
18
|
flex-direction:column;
|
|
19
19
|
}
|
|
20
|
-
.magritte-file-info-and-controls___61iyY_4-
|
|
20
|
+
.magritte-file-info-and-controls___61iyY_4-3-0{
|
|
21
21
|
display:flex;
|
|
22
22
|
gap:16px;
|
|
23
23
|
flex-grow:1;
|
|
24
24
|
}
|
|
25
|
-
.magritte-file-info-container___WFab8_4-
|
|
25
|
+
.magritte-file-info-container___WFab8_4-3-0{
|
|
26
26
|
flex-grow:1;
|
|
27
27
|
display:flex;
|
|
28
28
|
flex-direction:column;
|
|
29
29
|
justify-content:center;
|
|
30
30
|
width:50px;
|
|
31
31
|
}
|
|
32
|
-
.magritte-file-info___HrqiB_4-
|
|
32
|
+
.magritte-file-info___HrqiB_4-3-0{
|
|
33
33
|
display:flex;
|
|
34
34
|
gap:4px;
|
|
35
35
|
align-items:center;
|
|
36
36
|
}
|
|
37
|
-
.magritte-controls___WdH7A_4-
|
|
37
|
+
.magritte-controls___WdH7A_4-3-0{
|
|
38
38
|
display:flex;
|
|
39
39
|
align-items:center;
|
|
40
40
|
margin-left:auto;
|
|
41
41
|
margin-right:16px;
|
|
42
42
|
}
|
|
43
|
-
.magritte-divider___3-bj9_4-
|
|
43
|
+
.magritte-divider___3-bj9_4-3-0{
|
|
44
44
|
margin-left:64px;
|
|
45
45
|
}
|
|
46
46
|
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
.magritte-zp-day-theme{
|
|
66
66
|
--magritte-color-stroke-accent-v24-5-0:#7195AF;
|
|
67
67
|
}
|
|
68
|
-
.magritte-root___FV1tC_4-
|
|
68
|
+
.magritte-root___FV1tC_4-3-0{
|
|
69
69
|
position:relative;
|
|
70
70
|
display:flex;
|
|
71
71
|
overflow:hidden;
|
|
@@ -74,65 +74,65 @@
|
|
|
74
74
|
cursor:pointer;
|
|
75
75
|
--border-background-dimension:5px;
|
|
76
76
|
}
|
|
77
|
-
.magritte-root___FV1tC_4-
|
|
77
|
+
.magritte-root___FV1tC_4-3-0:hover .magritte-background___RfZ0U_4-3-0{
|
|
78
78
|
border-color:var(--magritte-color-stroke-accent-v24-5-0);
|
|
79
79
|
}
|
|
80
|
-
.magritte-root___FV1tC_4-
|
|
80
|
+
.magritte-root___FV1tC_4-3-0.magritte-drag-active___dihBL_4-3-0 .magritte-background___RfZ0U_4-3-0{
|
|
81
81
|
border-color:var(--magritte-color-stroke-accent-v24-5-0);
|
|
82
82
|
}
|
|
83
|
-
.magritte-root___FV1tC_4-
|
|
83
|
+
.magritte-root___FV1tC_4-3-0.focus-visible{
|
|
84
84
|
outline:var(--magritte-color-stroke-state-focused-accessible-v24-5-0) solid 4px;
|
|
85
85
|
}
|
|
86
|
-
.magritte-root___FV1tC_4-
|
|
86
|
+
.magritte-root___FV1tC_4-3-0.focus-visible .magritte-background___RfZ0U_4-3-0{
|
|
87
87
|
border-color:var(--magritte-color-stroke-accent-v24-5-0);
|
|
88
88
|
}
|
|
89
|
-
.magritte-root___FV1tC_4-
|
|
90
|
-
.magritte-root___FV1tC_4-
|
|
89
|
+
.magritte-root___FV1tC_4-3-0.magritte-load___MghDA_4-3-0 .magritte-background___RfZ0U_4-3-0,
|
|
90
|
+
.magritte-root___FV1tC_4-3-0.magritte-loading___9E3p-_4-3-0 .magritte-background___RfZ0U_4-3-0{
|
|
91
91
|
border-style:solid;
|
|
92
92
|
border-width:calc(1px + var(--border-background-dimension));
|
|
93
93
|
}
|
|
94
|
-
.magritte-root___FV1tC_4-
|
|
94
|
+
.magritte-root___FV1tC_4-3-0.magritte-invalid___Rt10-_4-3-0.focus-visible{
|
|
95
95
|
outline:var(--magritte-color-component-input-stroke-state-negative-focused-accessible-v24-5-0) solid 4px;
|
|
96
96
|
}
|
|
97
|
-
.magritte-root___FV1tC_4-
|
|
97
|
+
.magritte-root___FV1tC_4-3-0.magritte-invalid___Rt10-_4-3-0 .magritte-background___RfZ0U_4-3-0{
|
|
98
98
|
border-color:var(--magritte-color-stroke-neutral-v24-5-0);
|
|
99
99
|
}
|
|
100
|
-
.magritte-root___FV1tC_4-
|
|
100
|
+
.magritte-root___FV1tC_4-3-0.magritte-disabled___bhw2K_4-3-0{
|
|
101
101
|
cursor:default;
|
|
102
102
|
background-color:var(--magritte-color-background-state-primary-disabled-v24-5-0);
|
|
103
103
|
}
|
|
104
|
-
.magritte-root___FV1tC_4-
|
|
104
|
+
.magritte-root___FV1tC_4-3-0.magritte-disabled___bhw2K_4-3-0 .magritte-background___RfZ0U_4-3-0{
|
|
105
105
|
border-color:var(--magritte-color-stroke-state-neutral-disabled-v24-5-0);
|
|
106
106
|
border-width:calc(2px + var(--border-background-dimension));
|
|
107
107
|
}
|
|
108
108
|
@supports (-moz-appearance: none){
|
|
109
|
-
.magritte-root___FV1tC_4-
|
|
109
|
+
.magritte-root___FV1tC_4-3-0{
|
|
110
110
|
--border-background-dimension:2px;
|
|
111
111
|
}
|
|
112
112
|
}
|
|
113
113
|
@supports (background: -webkit-named-image(i)) and (-webkit-appearance: none){
|
|
114
|
-
.magritte-root___FV1tC_4-
|
|
114
|
+
.magritte-root___FV1tC_4-3-0{
|
|
115
115
|
--border-background-dimension:2px;
|
|
116
116
|
}
|
|
117
117
|
}
|
|
118
|
-
.magritte-root_medium___67WJa_4-
|
|
118
|
+
.magritte-root_medium___67WJa_4-3-0{
|
|
119
119
|
justify-content:center;
|
|
120
120
|
padding:24px;
|
|
121
121
|
}
|
|
122
|
-
.magritte-root_medium___67WJa_4-
|
|
122
|
+
.magritte-root_medium___67WJa_4-3-0 .magritte-body___O7ROl_4-3-0{
|
|
123
123
|
flex-direction:column;
|
|
124
124
|
align-items:center;
|
|
125
125
|
justify-content:center;
|
|
126
126
|
}
|
|
127
|
-
.magritte-root_small___dkUYq_4-
|
|
127
|
+
.magritte-root_small___dkUYq_4-3-0{
|
|
128
128
|
padding-top:16px;
|
|
129
129
|
padding-bottom:16px;
|
|
130
130
|
padding-left:16px;
|
|
131
131
|
}
|
|
132
|
-
.magritte-root_small___dkUYq_4-
|
|
132
|
+
.magritte-root_small___dkUYq_4-3-0 .magritte-body___O7ROl_4-3-0{
|
|
133
133
|
gap:16px;
|
|
134
134
|
}
|
|
135
|
-
.magritte-background___RfZ0U_4-
|
|
135
|
+
.magritte-background___RfZ0U_4-3-0{
|
|
136
136
|
position:absolute;
|
|
137
137
|
border-width:calc(2px + var(--border-background-dimension));
|
|
138
138
|
border-style:dashed;
|
|
@@ -145,15 +145,15 @@
|
|
|
145
145
|
background-position:center;
|
|
146
146
|
background-size:100%;
|
|
147
147
|
}
|
|
148
|
-
.magritte-body___O7ROl_4-
|
|
148
|
+
.magritte-body___O7ROl_4-3-0{
|
|
149
149
|
display:flex;
|
|
150
150
|
width:100%;
|
|
151
151
|
}
|
|
152
|
-
.magritte-loader___XYpWg_4-
|
|
152
|
+
.magritte-loader___XYpWg_4-3-0{
|
|
153
153
|
position:relative;
|
|
154
154
|
display:flex;
|
|
155
155
|
}
|
|
156
|
-
.magritte-cancel___tQ-yX_4-
|
|
156
|
+
.magritte-cancel___tQ-yX_4-3-0{
|
|
157
157
|
position:absolute;
|
|
158
158
|
top:0;
|
|
159
159
|
left:0;
|
|
@@ -163,20 +163,20 @@
|
|
|
163
163
|
align-items:center;
|
|
164
164
|
justify-content:center;
|
|
165
165
|
}
|
|
166
|
-
.magritte-image-controls___vLf94_4-
|
|
166
|
+
.magritte-image-controls___vLf94_4-3-0{
|
|
167
167
|
display:flex;
|
|
168
168
|
gap:12px;
|
|
169
169
|
align-items:flex-end;
|
|
170
170
|
justify-content:flex-end;
|
|
171
171
|
width:100%;
|
|
172
172
|
}
|
|
173
|
-
.magritte-small-controls___Qn9TP_4-
|
|
173
|
+
.magritte-small-controls___Qn9TP_4-3-0{
|
|
174
174
|
display:flex;
|
|
175
175
|
align-items:center;
|
|
176
176
|
margin-left:auto;
|
|
177
177
|
margin-right:20px;
|
|
178
178
|
}
|
|
179
|
-
.magritte-file-list___L9uHt_4-
|
|
179
|
+
.magritte-file-list___L9uHt_4-3-0{
|
|
180
180
|
margin-top:12px;
|
|
181
181
|
box-shadow:inset 0 0 0 1px var(--magritte-color-stroke-neutral-v24-5-0);
|
|
182
182
|
border-radius:24px;
|
|
@@ -185,19 +185,19 @@
|
|
|
185
185
|
padding-bottom:16px;
|
|
186
186
|
padding-left:16px;
|
|
187
187
|
}
|
|
188
|
-
.magritte-file-icon___oetLK_4-
|
|
188
|
+
.magritte-file-icon___oetLK_4-3-0{
|
|
189
189
|
display:inline-flex;
|
|
190
190
|
}
|
|
191
|
-
.magritte-file-info___Y3vyi_4-
|
|
191
|
+
.magritte-file-info___Y3vyi_4-3-0{
|
|
192
192
|
display:inline-flex;
|
|
193
193
|
width:100%;
|
|
194
194
|
flex-direction:column;
|
|
195
195
|
align-items:center;
|
|
196
196
|
}
|
|
197
|
-
.magritte-hidden-file-info___92c69_4-
|
|
197
|
+
.magritte-hidden-file-info___92c69_4-3-0{
|
|
198
198
|
visibility:hidden;
|
|
199
199
|
}
|
|
200
|
-
.magritte-single-small-placeholer___m8Vnt_4-
|
|
200
|
+
.magritte-single-small-placeholer___m8Vnt_4-3-0{
|
|
201
201
|
display:flex;
|
|
202
202
|
flex-direction:column;
|
|
203
203
|
justify-content:center;
|
package/index.js
CHANGED
|
@@ -4,7 +4,7 @@ import 'react/jsx-runtime';
|
|
|
4
4
|
import './MultiUpload.js';
|
|
5
5
|
import 'react-dropzone';
|
|
6
6
|
import 'classnames';
|
|
7
|
-
import './upload-
|
|
7
|
+
import './upload-DFq_qKia.js';
|
|
8
8
|
import 'react';
|
|
9
9
|
import '@hh.ru/magritte-ui-spacing';
|
|
10
10
|
import '@hh.ru/magritte-ui-typography';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hh.ru/magritte-ui-upload",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.3.0",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"types": "index.d.ts",
|
|
6
6
|
"sideEffects": [
|
|
@@ -30,7 +30,6 @@
|
|
|
30
30
|
"@hh.ru/magritte-ui-avatar": "8.1.1",
|
|
31
31
|
"@hh.ru/magritte-ui-breakpoint": "6.0.8",
|
|
32
32
|
"@hh.ru/magritte-ui-button": "7.2.0",
|
|
33
|
-
"@hh.ru/magritte-ui-button-stack": "3.0.8",
|
|
34
33
|
"@hh.ru/magritte-ui-divider": "3.1.0",
|
|
35
34
|
"@hh.ru/magritte-ui-icon": "14.1.0",
|
|
36
35
|
"@hh.ru/magritte-ui-loader": "3.0.1",
|
|
@@ -39,5 +38,5 @@
|
|
|
39
38
|
"@hh.ru/magritte-ui-typography": "5.0.1",
|
|
40
39
|
"react-dropzone": "14.3.5"
|
|
41
40
|
},
|
|
42
|
-
"gitHead": "
|
|
41
|
+
"gitHead": "39bc57d1e73f03a4a6dd01e6a313f819d2922fe3"
|
|
43
42
|
}
|
package/types.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { ReactNode, MouseEvent } from 'react';
|
|
2
2
|
import { DropzoneOptions, DropEvent } from 'react-dropzone';
|
|
3
|
-
import { ButtonElement } from '@hh.ru/magritte-ui-button-stack';
|
|
4
3
|
export interface LoadedFile {
|
|
5
4
|
data: File;
|
|
6
5
|
loading: boolean;
|
|
@@ -30,7 +29,7 @@ export interface UploadProps extends DropzoneOptionsHepler {
|
|
|
30
29
|
/** Переводы для зоны загрузки */
|
|
31
30
|
trls: UploadTrls;
|
|
32
31
|
/** Кнопка вызова диалога выбора файлов */
|
|
33
|
-
selectFileButton?:
|
|
32
|
+
selectFileButton?: ReactNode;
|
|
34
33
|
/** Обработчик события удаления файла */
|
|
35
34
|
onFileDelete: (loadedFile: LoadedFile, fileIndex: number) => void;
|
|
36
35
|
/** Обработчик успешной валидации файлов */
|
|
@@ -50,8 +49,8 @@ export interface UploadProps extends DropzoneOptionsHepler {
|
|
|
50
49
|
/** Флаг включения мультивыбора, работает только для `size="medium"` */
|
|
51
50
|
multiple?: boolean;
|
|
52
51
|
/** Кнопка удаления файла, работает только для `size="medium"` */
|
|
53
|
-
deleteFileButton?:
|
|
52
|
+
deleteFileButton?: ReactNode;
|
|
54
53
|
/** Кнопка замены файла, работает только для `size="medium"` */
|
|
55
|
-
replaceImageButton?:
|
|
54
|
+
replaceImageButton?: ReactNode;
|
|
56
55
|
}
|
|
57
56
|
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import './index.css';
|
|
2
|
+
import { createContext, useContext } from 'react';
|
|
3
|
+
|
|
4
|
+
const DisabledContext = createContext(false);
|
|
5
|
+
const useDisabled = () => useContext(DisabledContext);
|
|
6
|
+
|
|
7
|
+
var styles = {"root":"magritte-root___FV1tC_4-3-0","background":"magritte-background___RfZ0U_4-3-0","drag-active":"magritte-drag-active___dihBL_4-3-0","dragActive":"magritte-drag-active___dihBL_4-3-0","load":"magritte-load___MghDA_4-3-0","loading":"magritte-loading___9E3p-_4-3-0","invalid":"magritte-invalid___Rt10-_4-3-0","disabled":"magritte-disabled___bhw2K_4-3-0","root_medium":"magritte-root_medium___67WJa_4-3-0","rootMedium":"magritte-root_medium___67WJa_4-3-0","body":"magritte-body___O7ROl_4-3-0","root_small":"magritte-root_small___dkUYq_4-3-0","rootSmall":"magritte-root_small___dkUYq_4-3-0","loader":"magritte-loader___XYpWg_4-3-0","cancel":"magritte-cancel___tQ-yX_4-3-0","image-controls":"magritte-image-controls___vLf94_4-3-0","imageControls":"magritte-image-controls___vLf94_4-3-0","small-controls":"magritte-small-controls___Qn9TP_4-3-0","smallControls":"magritte-small-controls___Qn9TP_4-3-0","file-list":"magritte-file-list___L9uHt_4-3-0","fileList":"magritte-file-list___L9uHt_4-3-0","file-icon":"magritte-file-icon___oetLK_4-3-0","fileIcon":"magritte-file-icon___oetLK_4-3-0","file-info":"magritte-file-info___Y3vyi_4-3-0","fileInfo":"magritte-file-info___Y3vyi_4-3-0","hidden-file-info":"magritte-hidden-file-info___92c69_4-3-0","hiddenFileInfo":"magritte-hidden-file-info___92c69_4-3-0","single-small-placeholer":"magritte-single-small-placeholer___m8Vnt_4-3-0","singleSmallPlaceholer":"magritte-single-small-placeholer___m8Vnt_4-3-0"};
|
|
8
|
+
|
|
9
|
+
export { DisabledContext as D, styles as s, useDisabled as u };
|
|
10
|
+
//# sourceMappingURL=upload-DFq_qKia.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"upload-
|
|
1
|
+
{"version":3,"file":"upload-DFq_qKia.js","sources":["../../common/use-disabled/lib/index.js"],"sourcesContent":["import { createContext, useContext } from 'react';\n\nconst DisabledContext = createContext(false);\nconst useDisabled = () => useContext(DisabledContext);\n\nexport { DisabledContext, useDisabled };\n//# sourceMappingURL=index.js.map\n"],"names":[],"mappings":";;AAEK,MAAC,eAAe,GAAG,aAAa,CAAC,KAAK,EAAE;AACxC,MAAC,WAAW,GAAG,MAAM,UAAU,CAAC,eAAe;;;;;;"}
|
package/useDropButtons.d.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { MouseEvent } from 'react';
|
|
2
|
-
import { ButtonElement } from '@hh.ru/magritte-ui-button-stack';
|
|
1
|
+
import { MouseEvent, ReactNode } from 'react';
|
|
3
2
|
interface DropButtons {
|
|
4
|
-
selectFileButton?:
|
|
5
|
-
deleteFileButton?:
|
|
6
|
-
replaceImageButton?:
|
|
3
|
+
selectFileButton?: ReactNode;
|
|
4
|
+
deleteFileButton?: ReactNode;
|
|
5
|
+
replaceImageButton?: ReactNode;
|
|
7
6
|
}
|
|
8
7
|
interface UseDropButtonsProps extends DropButtons {
|
|
9
8
|
onFileDelete?: (event: MouseEvent) => void;
|
package/useDropButtons.js
CHANGED
|
@@ -1,19 +1,22 @@
|
|
|
1
1
|
import './index.css';
|
|
2
|
-
import { cloneElement } from 'react';
|
|
2
|
+
import { isValidElement, cloneElement } from 'react';
|
|
3
3
|
|
|
4
4
|
const useDropButtons = ({ selectFileButton: _selectFileButton, deleteFileButton: _deleteFileButton, replaceImageButton: _replaceImageButton, onFileDelete, }) => {
|
|
5
5
|
const selectFileButton = _selectFileButton &&
|
|
6
|
+
isValidElement(_selectFileButton) &&
|
|
6
7
|
cloneElement(_selectFileButton, {
|
|
7
8
|
key: 'selectFileButton',
|
|
8
9
|
'data-qa': 'magritte-select-file-button',
|
|
9
10
|
});
|
|
10
11
|
const deleteFileButton = _deleteFileButton &&
|
|
12
|
+
isValidElement(_deleteFileButton) &&
|
|
11
13
|
cloneElement(_deleteFileButton, {
|
|
12
14
|
key: 'deleteFileButton',
|
|
13
15
|
'data-qa': 'magritte-delete-file-button',
|
|
14
16
|
onClick: onFileDelete,
|
|
15
17
|
});
|
|
16
18
|
const replaceImageButton = _replaceImageButton &&
|
|
19
|
+
isValidElement(_replaceImageButton) &&
|
|
17
20
|
cloneElement(_replaceImageButton, {
|
|
18
21
|
key: 'replaceImageButton',
|
|
19
22
|
'data-qa': 'magritte-select-replace-image-button',
|
package/useDropButtons.js.map
CHANGED
|
@@ -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';\
|
|
1
|
+
{"version":3,"file":"useDropButtons.js","sources":["src/useDropButtons.tsx"],"sourcesContent":["import { MouseEvent, cloneElement, ComponentProps, ReactNode, isValidElement } from 'react';\n\nimport { Button } from '@hh.ru/magritte-ui-button';\n\ninterface DropButtons {\n selectFileButton?: ReactNode;\n deleteFileButton?: ReactNode;\n replaceImageButton?: ReactNode;\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 isValidElement(_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 isValidElement(_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 isValidElement(_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":";;AAcA,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,cAAc,CAAC,iBAAiB,CAAC;QACjC,YAAY,CAAC,iBAAiB,EAAE;AAC5B,YAAA,GAAG,EAAE,kBAAkB;AACvB,YAAA,SAAS,EAAE,6BAA6B;AACD,SAAA,CAAC,CAAC;IAEjD,MAAM,gBAAgB,GAClB,iBAAiB;QACjB,cAAc,CAAC,iBAAiB,CAAC;QACjC,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,cAAc,CAAC,mBAAmB,CAAC;QACnC,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/upload-PuMFsrcJ.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import './index.css';
|
|
2
|
-
import { createContext, useContext } from 'react';
|
|
3
|
-
|
|
4
|
-
const DisabledContext = createContext(false);
|
|
5
|
-
const useDisabled = () => useContext(DisabledContext);
|
|
6
|
-
|
|
7
|
-
var styles = {"root":"magritte-root___FV1tC_4-2-15","background":"magritte-background___RfZ0U_4-2-15","drag-active":"magritte-drag-active___dihBL_4-2-15","dragActive":"magritte-drag-active___dihBL_4-2-15","load":"magritte-load___MghDA_4-2-15","loading":"magritte-loading___9E3p-_4-2-15","invalid":"magritte-invalid___Rt10-_4-2-15","disabled":"magritte-disabled___bhw2K_4-2-15","root_medium":"magritte-root_medium___67WJa_4-2-15","rootMedium":"magritte-root_medium___67WJa_4-2-15","body":"magritte-body___O7ROl_4-2-15","root_small":"magritte-root_small___dkUYq_4-2-15","rootSmall":"magritte-root_small___dkUYq_4-2-15","loader":"magritte-loader___XYpWg_4-2-15","cancel":"magritte-cancel___tQ-yX_4-2-15","image-controls":"magritte-image-controls___vLf94_4-2-15","imageControls":"magritte-image-controls___vLf94_4-2-15","small-controls":"magritte-small-controls___Qn9TP_4-2-15","smallControls":"magritte-small-controls___Qn9TP_4-2-15","file-list":"magritte-file-list___L9uHt_4-2-15","fileList":"magritte-file-list___L9uHt_4-2-15","file-icon":"magritte-file-icon___oetLK_4-2-15","fileIcon":"magritte-file-icon___oetLK_4-2-15","file-info":"magritte-file-info___Y3vyi_4-2-15","fileInfo":"magritte-file-info___Y3vyi_4-2-15","hidden-file-info":"magritte-hidden-file-info___92c69_4-2-15","hiddenFileInfo":"magritte-hidden-file-info___92c69_4-2-15","single-small-placeholer":"magritte-single-small-placeholer___m8Vnt_4-2-15","singleSmallPlaceholer":"magritte-single-small-placeholer___m8Vnt_4-2-15"};
|
|
8
|
-
|
|
9
|
-
export { DisabledContext as D, styles as s, useDisabled as u };
|
|
10
|
-
//# sourceMappingURL=upload-PuMFsrcJ.js.map
|