@hh.ru/magritte-ui-upload 3.0.1 → 3.1.1

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-0-1","fileNameBody":"magritte-file-name-body___PTTMc_3-0-1","file-name-body_medium":"magritte-file-name-body_medium___sfmmq_3-0-1","fileNameBodyMedium":"magritte-file-name-body_medium___sfmmq_3-0-1","file-name":"magritte-file-name___ZSL2g_3-0-1","fileName":"magritte-file-name___ZSL2g_3-0-1"};
5
+ var styles = {"file-name-body":"magritte-file-name-body___PTTMc_3-1-1","fileNameBody":"magritte-file-name-body___PTTMc_3-1-1","file-name-body_medium":"magritte-file-name-body_medium___sfmmq_3-1-1","fileNameBodyMedium":"magritte-file-name-body_medium___sfmmq_3-1-1","file-name":"magritte-file-name___ZSL2g_3-1-1","fileName":"magritte-file-name___ZSL2g_3-1-1"};
6
6
 
7
7
  const parse = (file) => {
8
8
  const name = file.name;
package/FileView.js CHANGED
@@ -10,13 +10,13 @@ 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-0-1","fileInfoBody":"magritte-file-info-body___HmfXd_3-0-1","file-info-and-controls":"magritte-file-info-and-controls___61iyY_3-0-1","fileInfoAndControls":"magritte-file-info-and-controls___61iyY_3-0-1","file-info-container":"magritte-file-info-container___WFab8_3-0-1","fileInfoContainer":"magritte-file-info-container___WFab8_3-0-1","file-info":"magritte-file-info___HrqiB_3-0-1","fileInfo":"magritte-file-info___HrqiB_3-0-1","controls":"magritte-controls___WdH7A_3-0-1"};
13
+ var styles = {"file-info-body":"magritte-file-info-body___HmfXd_3-1-1","fileInfoBody":"magritte-file-info-body___HmfXd_3-1-1","file-info-and-controls":"magritte-file-info-and-controls___61iyY_3-1-1","fileInfoAndControls":"magritte-file-info-and-controls___61iyY_3-1-1","file-info-container":"magritte-file-info-container___WFab8_3-1-1","fileInfoContainer":"magritte-file-info-container___WFab8_3-1-1","file-info":"magritte-file-info___HrqiB_3-1-1","fileInfo":"magritte-file-info___HrqiB_3-1-1","controls":"magritte-controls___WdH7A_3-1-1"};
14
14
 
15
15
  const FileView = ({ uploadType, loadedFile, preview, renderFileInfo, onFileDelete, 'aria-label': ariaLabel, isLast = false, }) => {
16
16
  const isLoading = Boolean(loadedFile?.loading);
17
17
  const isInvalid = Boolean(loadedFile?.error);
18
18
  const isImageType = uploadType === 'image';
19
- return (jsxs(Fragment, { children: [jsx(Avatar, { mode: isImageType && !isLoading ? 'image' : 'icon', style: "secondary", image: preview, size: 48, icon: getUploadIcon(uploadType, loadedFile, true), "aria-label": ariaLabel }), jsxs("div", { className: styles.fileInfoBody, children: [jsxs("div", { className: styles.fileInfoAndControls, children: [jsxs("div", { className: styles.fileInfoContainer, children: [jsx(FileName, { file: loadedFile.data }), jsx(VSpacing, { default: 4 }), jsxs("div", { className: styles.fileInfo, children: [isInvalid && jsx(ExclamationTriangleOutlinedSize16, { initial: "negative" }), isLoading && jsx(Loader, { size: 16 }), !isInvalid && !isLoading && jsx(CheckCircleOutlinedSize16, { initial: "positive" }), renderFileInfo({
19
+ return (jsxs(Fragment, { children: [jsx(Avatar, { mode: isImageType && !isLoading && !isInvalid ? 'image' : 'icon', style: "secondary", image: preview, size: 48, icon: getUploadIcon(uploadType, loadedFile, true), "aria-label": ariaLabel }), jsxs("div", { className: styles.fileInfoBody, children: [jsxs("div", { className: styles.fileInfoAndControls, children: [jsxs("div", { className: styles.fileInfoContainer, children: [jsx(FileName, { file: loadedFile.data }), jsx(VSpacing, { default: 4 }), jsxs("div", { className: styles.fileInfo, children: [isInvalid && jsx(ExclamationTriangleOutlinedSize16, { initial: "negative" }), isLoading && jsx(Loader, { size: 16 }), !isInvalid && !isLoading && jsx(CheckCircleOutlinedSize16, { initial: "positive" }), renderFileInfo({
20
20
  ...loadedFile,
21
21
  fileSizeMB: bytes2mb(loadedFile.data.size),
22
22
  })] })] }), jsxs("div", { className: styles.controls, children: [isLoading && jsx(Action, { icon: CrossOutlinedSize24, mode: "secondary", onClick: onFileDelete }), !isLoading && (jsx(Action, { icon: TrashOutlinedSize24, mode: "secondary", onClick: onFileDelete, "data-qa": "magritte-upload-delete-file-action" }))] })] }), !isLast && (jsxs("div", { children: [jsx(VSpacing, { default: 16 }), jsx(Divider, {}), jsx(VSpacing, { default: 16 })] }))] })] }));
package/FileView.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"FileView.js","sources":["../src/FileView.tsx"],"sourcesContent":["import { ReactElement, MouseEvent } from 'react';\n\nimport { Action } from '@hh.ru/magritte-ui-action';\nimport { Avatar } from '@hh.ru/magritte-ui-avatar';\nimport { Divider } from '@hh.ru/magritte-ui-divider';\nimport {\n CrossOutlinedSize24,\n CheckCircleOutlinedSize16,\n ExclamationTriangleOutlinedSize16,\n TrashOutlinedSize24,\n} from '@hh.ru/magritte-ui-icon/icon';\nimport { Loader } from '@hh.ru/magritte-ui-loader';\nimport { VSpacing } from '@hh.ru/magritte-ui-spacing';\nimport { FileName } from '@hh.ru/magritte-ui-upload/FileName';\nimport { UploadType, LoadedFile, RenderFileInfo } from '@hh.ru/magritte-ui-upload/types';\nimport { getUploadIcon, bytes2mb } from '@hh.ru/magritte-ui-upload/utils';\n\nimport styles from './file-view.less';\n\nexport interface FileViewProps {\n uploadType: UploadType;\n loadedFile: LoadedFile;\n renderFileInfo: RenderFileInfo;\n onFileDelete: (event: MouseEvent) => void;\n preview: string;\n 'aria-label': string;\n isLast?: boolean;\n}\n\nconst FileView = ({\n uploadType,\n loadedFile,\n preview,\n renderFileInfo,\n onFileDelete,\n 'aria-label': ariaLabel,\n isLast = false,\n}: FileViewProps): ReactElement => {\n const isLoading = Boolean(loadedFile?.loading);\n const isInvalid = Boolean(loadedFile?.error);\n const isImageType = uploadType === 'image';\n return (\n <>\n <Avatar\n mode={isImageType && !isLoading ? 'image' : 'icon'}\n style=\"secondary\"\n image={preview}\n size={48}\n icon={getUploadIcon(uploadType, loadedFile, true)}\n aria-label={ariaLabel}\n />\n <div className={styles.fileInfoBody}>\n <div className={styles.fileInfoAndControls}>\n <div className={styles.fileInfoContainer}>\n <FileName file={loadedFile.data} />\n <VSpacing default={4} />\n <div className={styles.fileInfo}>\n {isInvalid && <ExclamationTriangleOutlinedSize16 initial=\"negative\" />}\n {isLoading && <Loader size={16} />}\n {!isInvalid && !isLoading && <CheckCircleOutlinedSize16 initial=\"positive\" />}\n {renderFileInfo({\n ...loadedFile,\n fileSizeMB: bytes2mb(loadedFile.data.size),\n })}\n </div>\n </div>\n <div className={styles.controls}>\n {isLoading && <Action icon={CrossOutlinedSize24} mode=\"secondary\" onClick={onFileDelete} />}\n {!isLoading && (\n <Action\n icon={TrashOutlinedSize24}\n mode=\"secondary\"\n onClick={onFileDelete}\n data-qa=\"magritte-upload-delete-file-action\"\n />\n )}\n </div>\n </div>\n {!isLast && (\n <div>\n <VSpacing default={16} />\n <Divider />\n <VSpacing default={16} />\n </div>\n )}\n </div>\n </>\n );\n};\n\nexport { FileView };\n"],"names":["_jsxs","_Fragment","_jsx"],"mappings":";;;;;;;;;;;;;AA6BM,MAAA,QAAQ,GAAG,CAAC,EACd,UAAU,EACV,UAAU,EACV,OAAO,EACP,cAAc,EACd,YAAY,EACZ,YAAY,EAAE,SAAS,EACvB,MAAM,GAAG,KAAK,GACF,KAAkB;IAC9B,MAAM,SAAS,GAAG,OAAO,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;IAC/C,MAAM,SAAS,GAAG,OAAO,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;AAC7C,IAAA,MAAM,WAAW,GAAG,UAAU,KAAK,OAAO,CAAC;AAC3C,IAAA,QACIA,IAAA,CAAA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SAAS,EAAE,MAAM,CAAC,QAAQ,EAAA,QAAA,EAAA,CAC1B,SAAS,IAAIE,GAAA,CAAC,MAAM,EAAC,EAAA,IAAI,EAAE,mBAAmB,EAAE,IAAI,EAAC,WAAW,EAAC,OAAO,EAAE,YAAY,EAAA,CAAI,EAC1F,CAAC,SAAS,KACPA,IAAC,MAAM,EAAA,EACH,IAAI,EAAE,mBAAmB,EACzB,IAAI,EAAC,WAAW,EAChB,OAAO,EAAE,YAAY,EACb,SAAA,EAAA,oCAAoC,GAC9C,CACL,CAAA,EAAA,CACC,CACJ,EAAA,CAAA,EACL,CAAC,MAAM,KACJF,IACI,CAAA,KAAA,EAAA,EAAA,QAAA,EAAA,CAAAE,GAAA,CAAC,QAAQ,EAAC,EAAA,OAAO,EAAE,EAAE,GAAI,EACzBA,GAAA,CAAC,OAAO,EAAG,EAAA,CAAA,EACXA,IAAC,QAAQ,EAAA,EAAC,OAAO,EAAE,EAAE,EAAI,CAAA,CAAA,EAAA,CACvB,CACT,CACC,EAAA,CAAA,CAAA,EAAA,CACP,EACL;AACN;;;;"}
1
+ {"version":3,"file":"FileView.js","sources":["../src/FileView.tsx"],"sourcesContent":["import { ReactElement, MouseEvent } from 'react';\n\nimport { Action } from '@hh.ru/magritte-ui-action';\nimport { Avatar } from '@hh.ru/magritte-ui-avatar';\nimport { Divider } from '@hh.ru/magritte-ui-divider';\nimport {\n CrossOutlinedSize24,\n CheckCircleOutlinedSize16,\n ExclamationTriangleOutlinedSize16,\n TrashOutlinedSize24,\n} from '@hh.ru/magritte-ui-icon/icon';\nimport { Loader } from '@hh.ru/magritte-ui-loader';\nimport { VSpacing } from '@hh.ru/magritte-ui-spacing';\nimport { FileName } from '@hh.ru/magritte-ui-upload/FileName';\nimport { UploadType, LoadedFile, RenderFileInfo } from '@hh.ru/magritte-ui-upload/types';\nimport { getUploadIcon, bytes2mb } from '@hh.ru/magritte-ui-upload/utils';\n\nimport styles from './file-view.less';\n\nexport interface FileViewProps {\n uploadType: UploadType;\n loadedFile: LoadedFile;\n renderFileInfo: RenderFileInfo;\n onFileDelete: (event: MouseEvent) => void;\n preview: string;\n 'aria-label': string;\n isLast?: boolean;\n}\n\nconst FileView = ({\n uploadType,\n loadedFile,\n preview,\n renderFileInfo,\n onFileDelete,\n 'aria-label': ariaLabel,\n isLast = false,\n}: FileViewProps): ReactElement => {\n const isLoading = Boolean(loadedFile?.loading);\n const isInvalid = Boolean(loadedFile?.error);\n const isImageType = uploadType === 'image';\n return (\n <>\n <Avatar\n mode={isImageType && !isLoading && !isInvalid ? 'image' : 'icon'}\n style=\"secondary\"\n image={preview}\n size={48}\n icon={getUploadIcon(uploadType, loadedFile, true)}\n aria-label={ariaLabel}\n />\n <div className={styles.fileInfoBody}>\n <div className={styles.fileInfoAndControls}>\n <div className={styles.fileInfoContainer}>\n <FileName file={loadedFile.data} />\n <VSpacing default={4} />\n <div className={styles.fileInfo}>\n {isInvalid && <ExclamationTriangleOutlinedSize16 initial=\"negative\" />}\n {isLoading && <Loader size={16} />}\n {!isInvalid && !isLoading && <CheckCircleOutlinedSize16 initial=\"positive\" />}\n {renderFileInfo({\n ...loadedFile,\n fileSizeMB: bytes2mb(loadedFile.data.size),\n })}\n </div>\n </div>\n <div className={styles.controls}>\n {isLoading && <Action icon={CrossOutlinedSize24} mode=\"secondary\" onClick={onFileDelete} />}\n {!isLoading && (\n <Action\n icon={TrashOutlinedSize24}\n mode=\"secondary\"\n onClick={onFileDelete}\n data-qa=\"magritte-upload-delete-file-action\"\n />\n )}\n </div>\n </div>\n {!isLast && (\n <div>\n <VSpacing default={16} />\n <Divider />\n <VSpacing default={16} />\n </div>\n )}\n </div>\n </>\n );\n};\n\nexport { FileView };\n"],"names":["_jsxs","_Fragment","_jsx"],"mappings":";;;;;;;;;;;;;AA6BM,MAAA,QAAQ,GAAG,CAAC,EACd,UAAU,EACV,UAAU,EACV,OAAO,EACP,cAAc,EACd,YAAY,EACZ,YAAY,EAAE,SAAS,EACvB,MAAM,GAAG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AAC,CAAA,yBAAyB,EAAC,EAAA,OAAO,EAAC,UAAU,EAAG,CAAA,EAC5E,cAAc,CAAC;AACZ,gDAAA,GAAG,UAAU;gDACb,UAAU,EAAE,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC;AAC7C,6CAAA,CAAC,IACA,CACJ,EAAA,CAAA,EACNF,IAAK,CAAA,KAAA,EAAA,EAAA,SAAS,EAAE,MAAM,CAAC,QAAQ,EAAA,QAAA,EAAA,CAC1B,SAAS,IAAIE,GAAA,CAAC,MAAM,EAAC,EAAA,IAAI,EAAE,mBAAmB,EAAE,IAAI,EAAC,WAAW,EAAC,OAAO,EAAE,YAAY,EAAA,CAAI,EAC1F,CAAC,SAAS,KACPA,IAAC,MAAM,EAAA,EACH,IAAI,EAAE,mBAAmB,EACzB,IAAI,EAAC,WAAW,EAChB,OAAO,EAAE,YAAY,EACb,SAAA,EAAA,oCAAoC,GAC9C,CACL,CAAA,EAAA,CACC,CACJ,EAAA,CAAA,EACL,CAAC,MAAM,KACJF,IACI,CAAA,KAAA,EAAA,EAAA,QAAA,EAAA,CAAAE,GAAA,CAAC,QAAQ,EAAC,EAAA,OAAO,EAAE,EAAE,GAAI,EACzBA,GAAA,CAAC,OAAO,EAAG,EAAA,CAAA,EACXA,IAAC,QAAQ,EAAA,EAAC,OAAO,EAAE,EAAE,EAAI,CAAA,CAAA,EAAA,CACvB,CACT,CACC,EAAA,CAAA,CAAA,EAAA,CACP,EACL;AACN;;;;"}
@@ -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-0-1"};
16
+ var styles = {"item":"magritte-item___vVDG-_3-1-1"};
17
17
 
18
18
  const FileViewWithPreview = ({ loadedFile, ...otherProps }) => {
19
19
  const uploadType = getFileType(loadedFile.data.type);
package/MultiUpload.js CHANGED
@@ -3,12 +3,12 @@ import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
3
3
  import { useDropzone } from 'react-dropzone';
4
4
  import classnames from 'classnames';
5
5
  import { VSpacing } from '@hh.ru/magritte-ui-spacing';
6
- import { Text } from '@hh.ru/magritte-ui-typography';
7
6
  import { FileViewWithPreview } from './FileViewWithPreview.js';
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-CR54iSr6.js';
11
+ import { s as styles } from './upload-CJaTPbi8.js';
12
12
  import './FileView.js';
13
13
  import '@hh.ru/magritte-ui-action';
14
14
  import '@hh.ru/magritte-ui-avatar';
@@ -18,6 +18,8 @@ import '@hh.ru/magritte-ui-loader';
18
18
  import './FileName.js';
19
19
  import './useFilePreview.js';
20
20
  import 'react';
21
+ import '@hh.ru/magritte-ui-breakpoint';
22
+ import '@hh.ru/magritte-ui-typography';
21
23
 
22
24
  const MultiUpload = ({ files, trls, size, accept = DEFAULT_ACCEPT, selectFileButton: _selectFileButton, renderFileInfo = RenderFileInfoDefault, onDropAccepted: onDropAcceptedExternal, onDropRejected: onDropRejectedExternal, onFileDelete: onFileDeleteExternal, 'aria-label': ariaLabel, ...dropzoneProps }) => {
23
25
  const uploadType = getAvaliableFileTypes(accept);
@@ -34,7 +36,7 @@ const MultiUpload = ({ files, trls, size, accept = DEFAULT_ACCEPT, selectFileBut
34
36
  multiple: true,
35
37
  });
36
38
  const { selectFileButton } = useDropButtons({ selectFileButton: _selectFileButton });
37
- return (jsxs(Fragment, { children: [jsxs("div", { className: classnames(styles.root, styles[`root_${size}`], { [styles.dragActive]: isDragActive }), ...getRootProps(), "data-qa": "magritte-multiple-upload", children: [jsx("input", { ...getInputProps(), "data-qa": "magritte-multiple-upload-input" }), jsx("div", { className: styles.background }), jsxs("div", { className: styles.body, children: [getUploadIcon(uploadType, undefined, false), jsx(VSpacing, { default: 16 }), jsx(Text, { typography: "label-2-regular", children: trls.title }), jsx(VSpacing, { default: 6 }), jsx(Text, { typography: "label-4-regular", style: "secondary", children: trls.subTitle }), selectFileButton && (jsxs(Fragment, { children: [jsx(VSpacing, { default: 16 }), selectFileButton] }))] })] }), files.length > 0 && (jsx("div", { className: styles.fileList, children: files.map((loadedFile, indexFile) => {
39
+ return (jsxs(Fragment, { children: [jsxs("div", { className: classnames(styles.root, styles[`root_${size}`], { [styles.dragActive]: isDragActive }), ...getRootProps(), "data-qa": "magritte-multiple-upload", children: [jsx("input", { ...getInputProps(), "data-qa": "magritte-multiple-upload-input" }), jsx("div", { className: styles.background }), jsxs("div", { className: styles.body, children: [getUploadIcon(uploadType, undefined, false), jsx(VSpacing, { default: 16 }), jsx(Placeholder, { trls: trls, selectFileButton: selectFileButton })] })] }), files.length > 0 && (jsx("div", { className: styles.fileList, children: files.map((loadedFile, indexFile) => {
38
40
  return (jsx(FileViewWithPreview, { loadedFile: loadedFile, renderFileInfo: renderFileInfo, onFileDelete: (event) => {
39
41
  onFileDelete(event, loadedFile, indexFile);
40
42
  }, "aria-label": ariaLabel || '', isLast: files.length - 1 === indexFile }, loadedFile.data.name));
@@ -1 +1 @@
1
- {"version":3,"file":"MultiUpload.js","sources":["../src/MultiUpload.tsx"],"sourcesContent":["import { ReactElement } from 'react';\nimport { useDropzone } from 'react-dropzone';\nimport classnames from 'classnames';\n\nimport { VSpacing } from '@hh.ru/magritte-ui-spacing';\nimport { Text } from '@hh.ru/magritte-ui-typography';\nimport { FileViewWithPreview } from '@hh.ru/magritte-ui-upload/FileViewWithPreview';\nimport { UploadProps } from '@hh.ru/magritte-ui-upload/types';\nimport { useDropActions } from '@hh.ru/magritte-ui-upload/useDropActions';\nimport { useDropButtons } from '@hh.ru/magritte-ui-upload/useDropButtons';\nimport {\n getUploadIcon,\n getAvaliableFileTypes,\n RenderFileInfoDefault,\n DEFAULT_ACCEPT,\n} from '@hh.ru/magritte-ui-upload/utils';\n\nimport styles from './upload.less';\n\nconst MultiUpload = ({\n files,\n trls,\n size,\n accept = DEFAULT_ACCEPT,\n selectFileButton: _selectFileButton,\n renderFileInfo = RenderFileInfoDefault,\n onDropAccepted: onDropAcceptedExternal,\n onDropRejected: onDropRejectedExternal,\n onFileDelete: onFileDeleteExternal,\n 'aria-label': ariaLabel,\n ...dropzoneProps\n}: Omit<UploadProps, 'multiple'>): ReactElement => {\n const uploadType = getAvaliableFileTypes(accept);\n const { onDropAccepted, onDropRejected, onFileDelete } = useDropActions({\n onDropAccepted: onDropAcceptedExternal,\n onDropRejected: onDropRejectedExternal,\n onFileDelete: onFileDeleteExternal,\n });\n const { getRootProps, getInputProps, isDragActive } = useDropzone({\n ...dropzoneProps,\n accept,\n onDropAccepted,\n onDropRejected,\n multiple: true,\n });\n const { selectFileButton } = useDropButtons({ selectFileButton: _selectFileButton });\n return (\n <>\n <div\n className={classnames(styles.root, styles[`root_${size}`], { [styles.dragActive]: isDragActive })}\n {...getRootProps()}\n data-qa=\"magritte-multiple-upload\"\n >\n <input {...getInputProps()} data-qa=\"magritte-multiple-upload-input\" />\n <div className={styles.background} />\n <div className={styles.body}>\n {getUploadIcon(uploadType, undefined, false)}\n <VSpacing default={16} />\n <Text typography=\"label-2-regular\">{trls.title}</Text>\n <VSpacing default={6} />\n <Text typography=\"label-4-regular\" style=\"secondary\">\n {trls.subTitle}\n </Text>\n {selectFileButton && (\n <>\n <VSpacing default={16} />\n {selectFileButton}\n </>\n )}\n </div>\n </div>\n {files.length > 0 && (\n <div className={styles.fileList}>\n {files.map((loadedFile, indexFile) => {\n return (\n <FileViewWithPreview\n key={loadedFile.data.name}\n loadedFile={loadedFile}\n renderFileInfo={renderFileInfo}\n onFileDelete={(event) => {\n onFileDelete(event, loadedFile, indexFile);\n }}\n aria-label={ariaLabel || ''}\n isLast={files.length - 1 === indexFile}\n />\n );\n })}\n </div>\n )}\n </>\n );\n};\n\nexport { MultiUpload };\n"],"names":["_jsxs","_Fragment","_jsx"],"mappings":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PjC,UAAU,CAAC,IAAI,CAAC,IAAI,CAQ3B,EACJ;AACN,iBAAC,CAAC,EAAA,CACA,CACT,CAAA,EAAA,CACF,EACL;AACN;;;;"}
1
+ {"version":3,"file":"MultiUpload.js","sources":["../src/MultiUpload.tsx"],"sourcesContent":["import { ReactElement } from 'react';\nimport { useDropzone } from 'react-dropzone';\nimport classnames from 'classnames';\n\nimport { VSpacing } from '@hh.ru/magritte-ui-spacing';\nimport { FileViewWithPreview } from '@hh.ru/magritte-ui-upload/FileViewWithPreview';\nimport { Placeholder } from '@hh.ru/magritte-ui-upload/Placeholder';\nimport { UploadProps } from '@hh.ru/magritte-ui-upload/types';\nimport { useDropActions } from '@hh.ru/magritte-ui-upload/useDropActions';\nimport { useDropButtons } from '@hh.ru/magritte-ui-upload/useDropButtons';\nimport {\n getUploadIcon,\n getAvaliableFileTypes,\n RenderFileInfoDefault,\n DEFAULT_ACCEPT,\n} from '@hh.ru/magritte-ui-upload/utils';\n\nimport styles from './upload.less';\n\nconst MultiUpload = ({\n files,\n trls,\n size,\n accept = DEFAULT_ACCEPT,\n selectFileButton: _selectFileButton,\n renderFileInfo = RenderFileInfoDefault,\n onDropAccepted: onDropAcceptedExternal,\n onDropRejected: onDropRejectedExternal,\n onFileDelete: onFileDeleteExternal,\n 'aria-label': ariaLabel,\n ...dropzoneProps\n}: Omit<UploadProps, 'multiple'>): ReactElement => {\n const uploadType = getAvaliableFileTypes(accept);\n const { onDropAccepted, onDropRejected, onFileDelete } = useDropActions({\n onDropAccepted: onDropAcceptedExternal,\n onDropRejected: onDropRejectedExternal,\n onFileDelete: onFileDeleteExternal,\n });\n const { getRootProps, getInputProps, isDragActive } = useDropzone({\n ...dropzoneProps,\n accept,\n onDropAccepted,\n onDropRejected,\n multiple: true,\n });\n const { selectFileButton } = useDropButtons({ selectFileButton: _selectFileButton });\n return (\n <>\n <div\n className={classnames(styles.root, styles[`root_${size}`], { [styles.dragActive]: isDragActive })}\n {...getRootProps()}\n data-qa=\"magritte-multiple-upload\"\n >\n <input {...getInputProps()} data-qa=\"magritte-multiple-upload-input\" />\n <div className={styles.background} />\n <div className={styles.body}>\n {getUploadIcon(uploadType, undefined, false)}\n <VSpacing default={16} />\n <Placeholder trls={trls} selectFileButton={selectFileButton} />\n </div>\n </div>\n {files.length > 0 && (\n <div className={styles.fileList}>\n {files.map((loadedFile, indexFile) => {\n return (\n <FileViewWithPreview\n key={loadedFile.data.name}\n loadedFile={loadedFile}\n renderFileInfo={renderFileInfo}\n onFileDelete={(event) => {\n onFileDelete(event, loadedFile, indexFile);\n }}\n aria-label={ariaLabel || ''}\n isLast={files.length - 1 === indexFile}\n />\n );\n })}\n </div>\n )}\n </>\n );\n};\n\nexport { MultiUpload };\n"],"names":["_jsxs","_Fragment","_jsx"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAmBA,MAAM,WAAW,GAAG,CAAC,EACjB,KAAK,EACL,IAAI,EACJ,IAAI,EACJ,MAAM,GAAG,cAAc,EACvB,gBAAgB,EAAE,iBAAiB,EACnC,cAAc,GAAG,qBAAqB,EACtC,cAAc,EAAE,sBAAsB,EACtC,cAAc,EAAE,sBAAsB,EACtC,YAAY,EAAE,oBAAoB,EAClC,YAAY,EAAE,SAAS,EACvB,GAAG,aAAa,EACY,KAAkB;AAC9C,IAAA,MAAM,UAAU,GAAG,qBAAqB,CAAC,MAAM,CAAC,CAAC;IACjD,MAAM,EAAE,cAAc,EAAE,cAAc,EAAE,YAAY,EAAE,GAAG,cAAc,CAAC;AACpE,QAAA,cAAc,EAAE,sBAAsB;AACtC,QAAA,cAAc,EAAE,sBAAsB;AACtC,QAAA,YAAY,EAAE,oBAAoB;AACrC,KAAA,CAAC,CAAC;IACH,MAAM,EAAE,YAAY,EAAE,aAAa,EAAE,YAAY,EAAE,GAAG,WAAW,CAAC;AAC9D,QAAA,GAAG,aAAa;QAChB,MAAM;QACN,cAAc;QACd,cAAc;AACd,QAAA,QAAQ,EAAE,IAAI;AACjB,KAAA,CAAC,C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AAC,KAAK,EAAE,UAAU,EAAE,SAAS,CAAC,CAAC;yBAC9C,EAAA,YAAA,EACW,SAAS,IAAI,EAAE,EAC3B,MAAM,EAAE,KAAK,CAAC,MAAM,GAAG,CAAC,KAAK,SAAS,IAPjC,UAAU,CAAC,IAAI,CAAC,IAAI,CAQ3B,EACJ;AACN,iBAAC,CAAC,EAAA,CACA,CACT,CAAA,EAAA,CACF,EACL;AACN;;;;"}
@@ -0,0 +1,8 @@
1
+ import { ReactElement } from 'react';
2
+ import { ButtonElement, UploadTrls } from '@hh.ru/magritte-ui-upload/types';
3
+ interface PlaceholderProps {
4
+ trls: UploadTrls;
5
+ selectFileButton?: ButtonElement;
6
+ }
7
+ declare const Placeholder: ({ trls, selectFileButton }: PlaceholderProps) => ReactElement;
8
+ export { Placeholder };
package/Placeholder.js ADDED
@@ -0,0 +1,14 @@
1
+ import './index.css';
2
+ import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
3
+ import { useBreakpoint } from '@hh.ru/magritte-ui-breakpoint';
4
+ import { VSpacing } from '@hh.ru/magritte-ui-spacing';
5
+ import { Text } from '@hh.ru/magritte-ui-typography';
6
+
7
+ const Placeholder = ({ trls, selectFileButton }) => {
8
+ const { isMobile } = useBreakpoint();
9
+ const { title, titleMobile, subTitle } = trls;
10
+ return (jsxs(Fragment, { children: [jsx(Text, { typography: "label-2-regular", children: isMobile ? titleMobile || title : title }), jsx(VSpacing, { default: 6 }), jsx(Text, { typography: "label-4-regular", style: "secondary", children: subTitle }), selectFileButton && (jsxs(Fragment, { children: [jsx(VSpacing, { default: 16 }), selectFileButton] }))] }));
11
+ };
12
+
13
+ export { Placeholder };
14
+ //# sourceMappingURL=Placeholder.js.map
@@ -0,0 +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;;;;"}
package/SingleUpload.js CHANGED
@@ -10,13 +10,15 @@ import { VSpacing } from '@hh.ru/magritte-ui-spacing';
10
10
  import { Text } from '@hh.ru/magritte-ui-typography';
11
11
  import { FileName } from './FileName.js';
12
12
  import { FileView } from './FileView.js';
13
+ import { Placeholder } from './Placeholder.js';
13
14
  import { useDropActions } from './useDropActions.js';
14
15
  import { useDropButtons } from './useDropButtons.js';
15
16
  import { useFilePreview } from './useFilePreview.js';
16
17
  import { getAvaliableFileTypes, getUploadIcon, bytes2mb, DEFAULT_ACCEPT, RenderFileInfoDefault } from './utils.js';
17
- import { s as styles } from './upload-CR54iSr6.js';
18
+ import { s as styles } from './upload-CJaTPbi8.js';
18
19
  import '@hh.ru/magritte-ui-action';
19
20
  import '@hh.ru/magritte-ui-divider';
21
+ import '@hh.ru/magritte-ui-breakpoint';
20
22
 
21
23
  const SingleUpload = ({ files, trls, size = 'medium', accept = DEFAULT_ACCEPT, selectFileButton: _selectFileButton, deleteFileButton: _deleteFileButton, replaceImageButton: _replaceImageButton, renderFileInfo = RenderFileInfoDefault, onDropAccepted: onDropAcceptedExternal, onDropRejected: onDropRejectedExternal, onFileDelete: onFileDeleteExternal, 'aria-label': ariaLabel, ...dropzoneProps }) => {
22
24
  const bodyUploadRef = useRef(null);
@@ -72,7 +74,10 @@ const SingleUpload = ({ files, trls, size = 'medium', accept = DEFAULT_ACCEPT, s
72
74
  } }) })] })), isInvalid ? (jsx(ExclamationTriangleOutlinedSize32, { initial: "negative" })) : (getUploadIcon(uploadType, loadedFile, false)), jsx(VSpacing, { default: 16 }), loadedFile && (jsxs(Fragment, { children: [jsx(FileName, { file: loadedFile.data, isSizeMedium: true }), jsx(VSpacing, { default: 6 }), jsx(Text, { typography: "label-4-regular", style: "secondary", children: renderFileInfo({
73
75
  ...loadedFile,
74
76
  fileSizeMB: bytes2mb(loadedFile.data.size),
75
- }) }), !loadedFile.loading && !isImageType && deleteFileButton && (jsxs(Fragment, { children: [jsx(VSpacing, { default: 16 }), deleteFileButton] })), !loadedFile.loading && isImageType && (replaceImageButton || deleteFileButton) && (jsxs("div", { className: styles.imageControls, children: [replaceImageButton, deleteFileButton] }))] })), !loadedFile && (jsxs(Fragment, { children: [jsx(Text, { typography: "label-2-regular", children: trls.title }), jsx(VSpacing, { default: 6 }), jsx(Text, { typography: "label-4-regular", style: "secondary", children: trls.subTitle }), selectFileButton && (jsxs(Fragment, { children: [jsx(VSpacing, { default: 16 }), selectFileButton] }))] }))] }))] })] }));
77
+ }) }), !isLoading && (!isImageType || isInvalid) && deleteFileButton && (jsxs(Fragment, { children: [jsx(VSpacing, { default: 16 }), deleteFileButton] })), !isLoading &&
78
+ isImageType &&
79
+ !isInvalid &&
80
+ (replaceImageButton || deleteFileButton) && (jsxs("div", { className: styles.imageControls, children: [replaceImageButton, deleteFileButton] }))] })), !loadedFile && jsx(Placeholder, { trls: trls, selectFileButton: selectFileButton })] }))] })] }));
76
81
  };
77
82
 
78
83
  export { SingleUpload };
@@ -1 +1 @@
1
- {"version":3,"file":"SingleUpload.js","sources":["../src/SingleUpload.tsx"],"sourcesContent":["import { ReactElement, useRef, useEffect, MouseEvent } from 'react';\nimport { useDropzone } from 'react-dropzone';\nimport classnames from 'classnames';\n\nimport { Avatar } from '@hh.ru/magritte-ui-avatar';\nimport { CrossOutlinedSize24, ExclamationTriangleOutlinedSize32 } from '@hh.ru/magritte-ui-icon/icon';\nimport { Loader } from '@hh.ru/magritte-ui-loader';\nimport { VSpacing } from '@hh.ru/magritte-ui-spacing';\nimport { Text } from '@hh.ru/magritte-ui-typography';\nimport { FileName } from '@hh.ru/magritte-ui-upload/FileName';\nimport { FileView } from '@hh.ru/magritte-ui-upload/FileView';\nimport { UploadProps } from '@hh.ru/magritte-ui-upload/types';\nimport { useDropActions } from '@hh.ru/magritte-ui-upload/useDropActions';\nimport { useDropButtons } from '@hh.ru/magritte-ui-upload/useDropButtons';\nimport { useFilePreview } from '@hh.ru/magritte-ui-upload/useFilePreview';\nimport {\n getUploadIcon,\n bytes2mb,\n getAvaliableFileTypes,\n RenderFileInfoDefault,\n DEFAULT_ACCEPT,\n} from '@hh.ru/magritte-ui-upload/utils';\n\nimport styles from './upload.less';\n\nconst SingleUpload = ({\n files,\n trls,\n size = 'medium',\n accept = DEFAULT_ACCEPT,\n selectFileButton: _selectFileButton,\n deleteFileButton: _deleteFileButton,\n replaceImageButton: _replaceImageButton,\n renderFileInfo = RenderFileInfoDefault,\n onDropAccepted: onDropAcceptedExternal,\n onDropRejected: onDropRejectedExternal,\n onFileDelete: onFileDeleteExternal,\n 'aria-label': ariaLabel,\n ...dropzoneProps\n}: UploadProps): ReactElement => {\n const bodyUploadRef = useRef<HTMLDivElement>(null);\n const uploadType = getAvaliableFileTypes(accept);\n const loadedFile = files.length > 0 ? files[0] : undefined;\n const isLoad = Boolean(loadedFile);\n const isLoading = Boolean(loadedFile?.loading);\n const isInvalid = Boolean(loadedFile?.error);\n const isSizeSmall = size === 'small';\n const isImageType = uploadType === 'image';\n const preview = useFilePreview({ loadedFile, isImageType });\n\n useEffect(() => {\n if (!bodyUploadRef.current) {\n return void 0;\n }\n if (isSizeSmall) {\n return void 0;\n }\n // фиксируем ширину, так как после выбора контент поменяется\n const currentElement = bodyUploadRef.current;\n currentElement.style.minHeight = `${bodyUploadRef.current.offsetHeight}px`;\n return () => {\n currentElement.style.minHeight = 'auto';\n };\n }, [isSizeSmall]);\n\n const { onDropAccepted, onDropRejected, onFileDelete } = useDropActions({\n onDropAccepted: onDropAcceptedExternal,\n onDropRejected: onDropRejectedExternal,\n onFileDelete: onFileDeleteExternal,\n });\n const { getRootProps, getInputProps, isDragActive } = useDropzone({\n ...dropzoneProps,\n accept,\n onDropAccepted,\n onDropRejected,\n multiple: false,\n });\n\n const { selectFileButton, deleteFileButton, replaceImageButton } = useDropButtons({\n selectFileButton: _selectFileButton,\n deleteFileButton: _deleteFileButton,\n replaceImageButton: _replaceImageButton,\n onFileDelete: (event: MouseEvent) => {\n onFileDelete(event, loadedFile, 0);\n },\n });\n\n const backgroundStyles = !isSizeSmall\n ? { backgroundImage: preview !== 'none' ? `url('${preview}')` : preview }\n : {};\n return (\n <div\n className={classnames(\n styles.root,\n styles[`root_${size}`],\n { [styles.dragActive]: isDragActive },\n { [styles.loading]: isLoading },\n { [styles.load]: isLoad },\n { [styles.invalid]: isInvalid }\n )}\n {...getRootProps()}\n data-qa=\"magritte-single-upload\"\n >\n <input {...getInputProps()} data-qa=\"magritte-single-upload-input\" />\n <div className={styles.background} style={backgroundStyles} data-qa=\"magritte-single-upload-background\" />\n <div className={styles.body} ref={bodyUploadRef}>\n {isSizeSmall && (\n <>\n {loadedFile && (\n <FileView\n uploadType={uploadType}\n loadedFile={loadedFile}\n renderFileInfo={renderFileInfo}\n onFileDelete={(event) => {\n onFileDelete(event, loadedFile, 0);\n }}\n preview={preview}\n aria-label={ariaLabel || ''}\n isLast\n />\n )}\n {!loadedFile && (\n <>\n <Avatar\n mode=\"icon\"\n style=\"secondary\"\n size={48}\n icon={getUploadIcon(uploadType, loadedFile, true)}\n aria-label={ariaLabel || ''}\n />\n <div>\n <Text typography=\"label-2-regular\">{trls.title}</Text>\n <VSpacing default={4} />\n <Text typography=\"label-4-regular\" style=\"secondary\">\n {trls.subTitle}\n </Text>\n </div>\n {selectFileButton && <div className={styles.smallControls}>{selectFileButton}</div>}\n </>\n )}\n </>\n )}\n {!isSizeSmall && (\n <>\n {isLoading && (\n <div className={styles.loader}>\n <Loader size={64} />\n <div className={styles.cancel}>\n <CrossOutlinedSize24\n initial=\"accent\"\n onClick={(event) => {\n onFileDelete(event, loadedFile, 0);\n }}\n />\n </div>\n </div>\n )}\n {isInvalid ? (\n <ExclamationTriangleOutlinedSize32 initial=\"negative\" />\n ) : (\n getUploadIcon(uploadType, loadedFile, false)\n )}\n <VSpacing default={16} />\n {loadedFile && (\n <>\n <FileName file={loadedFile.data} isSizeMedium />\n <VSpacing default={6} />\n <Text typography=\"label-4-regular\" style=\"secondary\">\n {renderFileInfo({\n ...loadedFile,\n fileSizeMB: bytes2mb(loadedFile.data.size),\n })}\n </Text>\n {!loadedFile.loading && !isImageType && deleteFileButton && (\n <>\n <VSpacing default={16} />\n {deleteFileButton}\n </>\n )}\n {!loadedFile.loading && isImageType && (replaceImageButton || deleteFileButton) && (\n <div className={styles.imageControls}>\n {replaceImageButton}\n {deleteFileButton}\n </div>\n )}\n </>\n )}\n {!loadedFile && (\n <>\n <Text typography=\"label-2-regular\">{trls.title}</Text>\n <VSpacing default={6} />\n <Text typography=\"label-4-regular\" style=\"secondary\">\n {trls.subTitle}\n </Text>\n {selectFileButton && (\n <>\n <VSpacing default={16} />\n {selectFileButton}\n </>\n )}\n </>\n )}\n </>\n )}\n </div>\n </div>\n );\n};\n\nexport { SingleUpload };\n"],"names":["_jsxs","_jsx","_Fragment"],"mappings":";;;;;;;;;;;;;;;;;;;AAyBM,MAAA,YAAY,GAAG,CAAC,EAClB,KAAK,EACL,IAAI,EACJ,IAAI,GAAG,QAAQ,EACf,MAAM,GAAG,cAAc,EACvB,gBAAgB,EAAE,iBAAiB,EACnC,gBAAgB,EAAE,iBAAiB,EACnC,kBAAkB,EAAE,mBAAmB,EACvC,cAAc,GAAG,qBAAqB,EACtC,cAAc,EAAE,sBAAsB,EACtC,cAAc,EAAE,sBAAsB,EACtC,YAAY,EAAE,oBAAoB,EAClC,YAAY,EAAE,SAAS,EACvB,GAAG,aAAa,EACN,KAAkB;AAC5B,IAAA,MAAM,aAAa,GAAG,MAAM,CAAiB,IAAI,CAAC,CAAC;AACnD,IAAA,MAAM,UAAU,GAAG,qBAAqB,CAAC,MAAM,CAAC,CAAC;AACjD,IAAA,MAAM,UAAU,GAAG,KAAK,CAAC,MAAM,GAAG,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC;AAC3D,IAAA,MAAM,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;IACnC,MAAM,SAAS,GAAG,O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AgB,CAAA,EAAA,CAClB,CACN,EACA,CAAC,UAAU,CAAC,OAAO,IAAI,WAAW,KAAK,kBAAkB,IAAI,gBAAgB,CAAC,KAC3ED,IAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAE,MAAM,CAAC,aAAa,EAAA,QAAA,EAAA,CAC/B,kBAAkB,EAClB,gBAAgB,CAAA,EAAA,CACf,CACT,CAAA,EAAA,CACF,CACN,EACA,CAAC,UAAU,KACRA,4BACIC,GAAC,CAAA,IAAI,EAAC,EAAA,UAAU,EAAC,iBAAiB,EAAE,QAAA,EAAA,IAAI,CAAC,KAAK,EAAQ,CAAA,EACtDA,GAAC,CAAA,QAAQ,IAAC,OAAO,EAAE,CAAC,EAAA,CAAI,EACxBA,GAAA,CAAC,IAAI,EAAA,EAAC,UAAU,EAAC,iBAAiB,EAAC,KAAK,EAAC,WAAW,EAC/C,QAAA,EAAA,IAAI,CAAC,QAAQ,EACX,CAAA,EACN,gBAAgB,KACbD,IAAA,CAAAE,QAAA,EAAA,EAAA,QAAA,EAAA,CACID,GAAC,CAAA,QAAQ,EAAC,EAAA,OAAO,EAAE,EAAE,EAAI,CAAA,EACxB,gBAAgB,CAAA,EAAA,CAClB,CACN,CAAA,EAAA,CACF,CACN,CAAA,EAAA,CACF,CACN,CAAA,EAAA,CACC,CACJ,EAAA,CAAA,EACR;AACN;;;;"}
1
+ {"version":3,"file":"SingleUpload.js","sources":["../src/SingleUpload.tsx"],"sourcesContent":["import { ReactElement, useRef, useEffect, MouseEvent } from 'react';\nimport { useDropzone } from 'react-dropzone';\nimport classnames from 'classnames';\n\nimport { Avatar } from '@hh.ru/magritte-ui-avatar';\nimport { CrossOutlinedSize24, ExclamationTriangleOutlinedSize32 } from '@hh.ru/magritte-ui-icon/icon';\nimport { Loader } from '@hh.ru/magritte-ui-loader';\nimport { VSpacing } from '@hh.ru/magritte-ui-spacing';\nimport { Text } from '@hh.ru/magritte-ui-typography';\nimport { FileName } from '@hh.ru/magritte-ui-upload/FileName';\nimport { FileView } from '@hh.ru/magritte-ui-upload/FileView';\nimport { Placeholder } from '@hh.ru/magritte-ui-upload/Placeholder';\nimport { UploadProps } from '@hh.ru/magritte-ui-upload/types';\nimport { useDropActions } from '@hh.ru/magritte-ui-upload/useDropActions';\nimport { useDropButtons } from '@hh.ru/magritte-ui-upload/useDropButtons';\nimport { useFilePreview } from '@hh.ru/magritte-ui-upload/useFilePreview';\nimport {\n getUploadIcon,\n bytes2mb,\n getAvaliableFileTypes,\n RenderFileInfoDefault,\n DEFAULT_ACCEPT,\n} from '@hh.ru/magritte-ui-upload/utils';\n\nimport styles from './upload.less';\n\nconst SingleUpload = ({\n files,\n trls,\n size = 'medium',\n accept = DEFAULT_ACCEPT,\n selectFileButton: _selectFileButton,\n deleteFileButton: _deleteFileButton,\n replaceImageButton: _replaceImageButton,\n renderFileInfo = RenderFileInfoDefault,\n onDropAccepted: onDropAcceptedExternal,\n onDropRejected: onDropRejectedExternal,\n onFileDelete: onFileDeleteExternal,\n 'aria-label': ariaLabel,\n ...dropzoneProps\n}: UploadProps): ReactElement => {\n const bodyUploadRef = useRef<HTMLDivElement>(null);\n const uploadType = getAvaliableFileTypes(accept);\n const loadedFile = files.length > 0 ? files[0] : undefined;\n const isLoad = Boolean(loadedFile);\n const isLoading = Boolean(loadedFile?.loading);\n const isInvalid = Boolean(loadedFile?.error);\n const isSizeSmall = size === 'small';\n const isImageType = uploadType === 'image';\n const preview = useFilePreview({ loadedFile, isImageType });\n\n useEffect(() => {\n if (!bodyUploadRef.current) {\n return void 0;\n }\n if (isSizeSmall) {\n return void 0;\n }\n // фиксируем ширину, так как после выбора контент поменяется\n const currentElement = bodyUploadRef.current;\n currentElement.style.minHeight = `${bodyUploadRef.current.offsetHeight}px`;\n return () => {\n currentElement.style.minHeight = 'auto';\n };\n }, [isSizeSmall]);\n\n const { onDropAccepted, onDropRejected, onFileDelete } = useDropActions({\n onDropAccepted: onDropAcceptedExternal,\n onDropRejected: onDropRejectedExternal,\n onFileDelete: onFileDeleteExternal,\n });\n const { getRootProps, getInputProps, isDragActive } = useDropzone({\n ...dropzoneProps,\n accept,\n onDropAccepted,\n onDropRejected,\n multiple: false,\n });\n\n const { selectFileButton, deleteFileButton, replaceImageButton } = useDropButtons({\n selectFileButton: _selectFileButton,\n deleteFileButton: _deleteFileButton,\n replaceImageButton: _replaceImageButton,\n onFileDelete: (event: MouseEvent) => {\n onFileDelete(event, loadedFile, 0);\n },\n });\n\n const backgroundStyles = !isSizeSmall\n ? { backgroundImage: preview !== 'none' ? `url('${preview}')` : preview }\n : {};\n return (\n <div\n className={classnames(\n styles.root,\n styles[`root_${size}`],\n { [styles.dragActive]: isDragActive },\n { [styles.loading]: isLoading },\n { [styles.load]: isLoad },\n { [styles.invalid]: isInvalid }\n )}\n {...getRootProps()}\n data-qa=\"magritte-single-upload\"\n >\n <input {...getInputProps()} data-qa=\"magritte-single-upload-input\" />\n <div className={styles.background} style={backgroundStyles} data-qa=\"magritte-single-upload-background\" />\n <div className={styles.body} ref={bodyUploadRef}>\n {isSizeSmall && (\n <>\n {loadedFile && (\n <FileView\n uploadType={uploadType}\n loadedFile={loadedFile}\n renderFileInfo={renderFileInfo}\n onFileDelete={(event) => {\n onFileDelete(event, loadedFile, 0);\n }}\n preview={preview}\n aria-label={ariaLabel || ''}\n isLast\n />\n )}\n {!loadedFile && (\n <>\n <Avatar\n mode=\"icon\"\n style=\"secondary\"\n size={48}\n icon={getUploadIcon(uploadType, loadedFile, true)}\n aria-label={ariaLabel || ''}\n />\n <div>\n <Text typography=\"label-2-regular\">{trls.title}</Text>\n <VSpacing default={4} />\n <Text typography=\"label-4-regular\" style=\"secondary\">\n {trls.subTitle}\n </Text>\n </div>\n {selectFileButton && <div className={styles.smallControls}>{selectFileButton}</div>}\n </>\n )}\n </>\n )}\n {!isSizeSmall && (\n <>\n {isLoading && (\n <div className={styles.loader}>\n <Loader size={64} />\n <div className={styles.cancel}>\n <CrossOutlinedSize24\n initial=\"accent\"\n onClick={(event) => {\n onFileDelete(event, loadedFile, 0);\n }}\n />\n </div>\n </div>\n )}\n {isInvalid ? (\n <ExclamationTriangleOutlinedSize32 initial=\"negative\" />\n ) : (\n getUploadIcon(uploadType, loadedFile, false)\n )}\n <VSpacing default={16} />\n {loadedFile && (\n <>\n <FileName file={loadedFile.data} isSizeMedium />\n <VSpacing default={6} />\n <Text typography=\"label-4-regular\" style=\"secondary\">\n {renderFileInfo({\n ...loadedFile,\n fileSizeMB: bytes2mb(loadedFile.data.size),\n })}\n </Text>\n {!isLoading && (!isImageType || isInvalid) && deleteFileButton && (\n <>\n <VSpacing default={16} />\n {deleteFileButton}\n </>\n )}\n {!isLoading &&\n isImageType &&\n !isInvalid &&\n (replaceImageButton || deleteFileButton) && (\n <div className={styles.imageControls}>\n {replaceImageButton}\n {deleteFileButton}\n </div>\n )}\n </>\n )}\n {!loadedFile && <Placeholder trls={trls} selectFileButton={selectFileButton} />}\n </>\n )}\n </div>\n </div>\n );\n};\n\nexport { SingleUpload };\n"],"names":["_jsxs","_jsx","_Fragment"],"mappings":";;;;;;;;;;;;;;;;;;;;;AA0BM,MAAA,YAAY,GAAG,CAAC,EAClB,KAAK,EACL,IAAI,EACJ,IAAI,GAAG,QAAQ,EACf,MAAM,GAAG,cAAc,EACvB,gBAAgB,EAAE,iBAAiB,EACnC,gBAAgB,EAAE,iBAAiB,EACnC,kBAAkB,EAAE,mBAAmB,EACvC,cAAc,GAAG,qBAAqB,EACtC,cAAc,EAAE,sBAAsB,EACtC,cAAc,EAAE,sBAAsB,EACtC,YAAY,EAAE,oBAAoB,EAClC,YAAY,EAAE,SAAS,EACvB,GAAG,aAAa,EACN,KAAkB;AAC5B,IAAA,MAAM,aAAa,GAAG,MAAM,CAAiB,IAAI,CAAC,CAAC;AACnD,IAAA,MAAM,UAAU,GAAG,qBAAqB,CAAC,MAAM,CAAC,CAAC;AACjD,IAAA,MAAM,UAAU,GAAG,KAAK,CAAC,MAAM,GAAG,CAAC,GAAG,KAAK,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AAK,CAAC,WAAW,IAAI,SAAS,CAAC,IAAI,gBAAgB,KAC1DD,IAAA,CAAAE,QAAA,EAAA,EAAA,QAAA,EAAA,CACID,GAAC,CAAA,QAAQ,EAAC,EAAA,OAAO,EAAE,EAAE,EAAI,CAAA,EACxB,gBAAgB,CAAA,EAAA,CAClB,CACN,EACA,CAAC,SAAS;wCACP,WAAW;AACX,wCAAA,CAAC,SAAS;AACV,yCAAC,kBAAkB,IAAI,gBAAgB,CAAC,KACpCD,cAAK,SAAS,EAAE,MAAM,CAAC,aAAa,EAC/B,QAAA,EAAA,CAAA,kBAAkB,EAClB,gBAAgB,CAAA,EAAA,CACf,CACT,CACN,EAAA,CAAA,CACN,EACA,CAAC,UAAU,IAAIC,GAAA,CAAC,WAAW,EAAC,EAAA,IAAI,EAAE,IAAI,EAAE,gBAAgB,EAAE,gBAAgB,EAAI,CAAA,CAAA,EAAA,CAChF,CACN,CACC,EAAA,CAAA,CAAA,EAAA,CACJ,EACR;AACN;;;;"}
package/Upload.js CHANGED
@@ -5,7 +5,6 @@ import { SingleUpload } from './SingleUpload.js';
5
5
  import 'react-dropzone';
6
6
  import 'classnames';
7
7
  import '@hh.ru/magritte-ui-spacing';
8
- import '@hh.ru/magritte-ui-typography';
9
8
  import './FileViewWithPreview.js';
10
9
  import './FileView.js';
11
10
  import '@hh.ru/magritte-ui-action';
@@ -17,9 +16,12 @@ import './FileName.js';
17
16
  import './utils.js';
18
17
  import './useFilePreview.js';
19
18
  import 'react';
19
+ import './Placeholder.js';
20
+ import '@hh.ru/magritte-ui-breakpoint';
21
+ import '@hh.ru/magritte-ui-typography';
20
22
  import './useDropActions.js';
21
23
  import './useDropButtons.js';
22
- import './upload-CR54iSr6.js';
24
+ import './upload-CJaTPbi8.js';
23
25
 
24
26
  const Upload = ({ multiple, ...uploadProps }) => {
25
27
  if (multiple) {
package/Upload.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"Upload.js","sources":["../src/Upload.tsx"],"sourcesContent":["import { ReactElement } from 'react';\n\nimport { MultiUpload } from '@hh.ru/magritte-ui-upload/MultiUpload';\nimport { SingleUpload } from '@hh.ru/magritte-ui-upload/SingleUpload';\nimport { UploadProps } from '@hh.ru/magritte-ui-upload/types';\n\nconst Upload = ({ multiple, ...uploadProps }: UploadProps): ReactElement => {\n if (multiple) {\n return <MultiUpload {...uploadProps} />;\n }\n return <SingleUpload {...uploadProps} />;\n};\n\nexport { Upload };\n"],"names":["_jsx"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAMM,MAAA,MAAM,GAAG,CAAC,EAAE,QAAQ,EAAE,GAAG,WAAW,EAAe,KAAkB;IACvE,IAAI,QAAQ,EAAE;AACV,QAAA,OAAOA,GAAC,CAAA,WAAW,EAAK,EAAA,GAAA,WAAW,GAAI,CAAC;KAC3C;AACD,IAAA,OAAOA,GAAC,CAAA,YAAY,EAAK,EAAA,GAAA,WAAW,GAAI,CAAC;AAC7C;;;;"}
1
+ {"version":3,"file":"Upload.js","sources":["../src/Upload.tsx"],"sourcesContent":["import { ReactElement } from 'react';\n\nimport { MultiUpload } from '@hh.ru/magritte-ui-upload/MultiUpload';\nimport { SingleUpload } from '@hh.ru/magritte-ui-upload/SingleUpload';\nimport { UploadProps } from '@hh.ru/magritte-ui-upload/types';\n\nconst Upload = ({ multiple, ...uploadProps }: UploadProps): ReactElement => {\n if (multiple) {\n return <MultiUpload {...uploadProps} />;\n }\n return <SingleUpload {...uploadProps} />;\n};\n\nexport { Upload };\n"],"names":["_jsx"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAMM,MAAA,MAAM,GAAG,CAAC,EAAE,QAAQ,EAAE,GAAG,WAAW,EAAe,KAAkB;IACvE,IAAI,QAAQ,EAAE;AACV,QAAA,OAAOA,GAAC,CAAA,WAAW,EAAK,EAAA,GAAA,WAAW,GAAI,CAAC;KAC3C;AACD,IAAA,OAAOA,GAAC,CAAA,YAAY,EAAK,EAAA,GAAA,WAAW,GAAI,CAAC;AAC7C;;;;"}
package/index.css CHANGED
@@ -530,7 +530,7 @@
530
530
  --magritte-typography-_custom-5-italic-text-transform-v20-0-1:none;
531
531
  --magritte-typography-_custom-5-italic-text-decoration-v20-0-1:none;
532
532
  }
533
- .magritte-file-name-body___PTTMc_3-0-1{
533
+ .magritte-file-name-body___PTTMc_3-1-1{
534
534
  display:flex;
535
535
  width:100%;
536
536
  overflow:hidden;
@@ -543,10 +543,10 @@
543
543
  text-transform:var(--magritte-typography-label-2-regular-text-transform-v20-0-1);
544
544
  text-decoration:var(--magritte-typography-label-2-regular-text-decoration-v20-0-1);
545
545
  }
546
- .magritte-file-name-body_medium___sfmmq_3-0-1{
546
+ .magritte-file-name-body_medium___sfmmq_3-1-1{
547
547
  justify-content:center;
548
548
  }
549
- .magritte-file-name___ZSL2g_3-0-1{
549
+ .magritte-file-name___ZSL2g_3-1-1{
550
550
  overflow:hidden;
551
551
  text-overflow:ellipsis;
552
552
  }
@@ -1085,18 +1085,18 @@
1085
1085
  --magritte-typography-_custom-5-italic-text-transform-v20-0-1:none;
1086
1086
  --magritte-typography-_custom-5-italic-text-decoration-v20-0-1:none;
1087
1087
  }
1088
- .magritte-file-info-body___HmfXd_3-0-1{
1088
+ .magritte-file-info-body___HmfXd_3-1-1{
1089
1089
  flex-grow:1;
1090
1090
  }
1091
- .magritte-file-info-and-controls___61iyY_3-0-1{
1091
+ .magritte-file-info-and-controls___61iyY_3-1-1{
1092
1092
  display:flex;
1093
1093
  gap:var(--magritte-static-space-400-v20-0-1);
1094
1094
  }
1095
- .magritte-file-info-container___WFab8_3-0-1{
1095
+ .magritte-file-info-container___WFab8_3-1-1{
1096
1096
  flex-grow:1;
1097
1097
  width:50px;
1098
1098
  }
1099
- .magritte-file-info___HrqiB_3-0-1{
1099
+ .magritte-file-info___HrqiB_3-1-1{
1100
1100
  display:flex;
1101
1101
  gap:var(--magritte-static-space-100-v20-0-1);
1102
1102
  font-family:var(--magritte-typography-label-4-regular-font-family-v20-0-1);
@@ -1108,7 +1108,7 @@
1108
1108
  text-transform:var(--magritte-typography-label-4-regular-text-transform-v20-0-1);
1109
1109
  text-decoration:var(--magritte-typography-label-4-regular-text-decoration-v20-0-1);
1110
1110
  }
1111
- .magritte-controls___WdH7A_3-0-1{
1111
+ .magritte-controls___WdH7A_3-1-1{
1112
1112
  display:flex;
1113
1113
  align-items:center;
1114
1114
  margin-left:auto;
@@ -1648,7 +1648,7 @@
1648
1648
  --magritte-typography-_custom-5-italic-text-transform-v20-0-1:none;
1649
1649
  --magritte-typography-_custom-5-italic-text-decoration-v20-0-1:none;
1650
1650
  }
1651
- .magritte-item___vVDG-_3-0-1{
1651
+ .magritte-item___vVDG-_3-1-1{
1652
1652
  display:flex;
1653
1653
  width:100%;
1654
1654
  gap:var(--magritte-static-space-400-v20-0-1);
@@ -2205,57 +2205,57 @@
2205
2205
  --magritte-typography-_custom-5-italic-text-transform-v20-0-1:none;
2206
2206
  --magritte-typography-_custom-5-italic-text-decoration-v20-0-1:none;
2207
2207
  }
2208
- .magritte-root___FV1tC_3-0-1{
2208
+ .magritte-root___FV1tC_3-1-1{
2209
2209
  position:relative;
2210
2210
  display:flex;
2211
2211
  overflow:hidden;
2212
2212
  border-radius:var(--magritte-static-border-radius-600-v20-0-1);
2213
2213
  background-color:var(--magritte-color-background-primary-v20-0-1);
2214
2214
  }
2215
- .magritte-root___FV1tC_3-0-1:hover{
2215
+ .magritte-root___FV1tC_3-1-1:hover{
2216
2216
  cursor:pointer;
2217
2217
  }
2218
- .magritte-root___FV1tC_3-0-1:hover .magritte-background___RfZ0U_3-0-1{
2218
+ .magritte-root___FV1tC_3-1-1:hover .magritte-background___RfZ0U_3-1-1{
2219
2219
  border-color:var(--magritte-color-stroke-accent-v20-0-1);
2220
2220
  }
2221
- .magritte-root___FV1tC_3-0-1.magritte-drag-active___dihBL_3-0-1 .magritte-background___RfZ0U_3-0-1{
2221
+ .magritte-root___FV1tC_3-1-1.magritte-drag-active___dihBL_3-1-1 .magritte-background___RfZ0U_3-1-1{
2222
2222
  border-color:var(--magritte-color-stroke-accent-v20-0-1);
2223
2223
  }
2224
- .magritte-root___FV1tC_3-0-1.focus-visible{
2224
+ .magritte-root___FV1tC_3-1-1.focus-visible{
2225
2225
  outline:var(--magritte-color-stroke-state-focused-accessible-v20-0-1) solid 4px;
2226
2226
  }
2227
- .magritte-root___FV1tC_3-0-1.focus-visible .magritte-background___RfZ0U_3-0-1{
2227
+ .magritte-root___FV1tC_3-1-1.focus-visible .magritte-background___RfZ0U_3-1-1{
2228
2228
  border-color:var(--magritte-color-stroke-accent-v20-0-1);
2229
2229
  }
2230
- .magritte-root___FV1tC_3-0-1.magritte-load___MghDA_3-0-1 .magritte-background___RfZ0U_3-0-1,
2231
- .magritte-root___FV1tC_3-0-1.magritte-loading___9E3p-_3-0-1 .magritte-background___RfZ0U_3-0-1{
2230
+ .magritte-root___FV1tC_3-1-1.magritte-load___MghDA_3-1-1 .magritte-background___RfZ0U_3-1-1,
2231
+ .magritte-root___FV1tC_3-1-1.magritte-loading___9E3p-_3-1-1 .magritte-background___RfZ0U_3-1-1{
2232
2232
  border-style:solid;
2233
2233
  border-width:7px;
2234
2234
  }
2235
- .magritte-root___FV1tC_3-0-1.magritte-invalid___Rt10-_3-0-1.focus-visible{
2235
+ .magritte-root___FV1tC_3-1-1.magritte-invalid___Rt10-_3-1-1.focus-visible{
2236
2236
  outline:var(--magritte-color-component-input-stroke-state-negative-focused-accessible-v20-0-1) solid 4px;
2237
2237
  }
2238
- .magritte-root___FV1tC_3-0-1.magritte-invalid___Rt10-_3-0-1 .magritte-background___RfZ0U_3-0-1{
2238
+ .magritte-root___FV1tC_3-1-1.magritte-invalid___Rt10-_3-1-1 .magritte-background___RfZ0U_3-1-1{
2239
2239
  border-color:var(--magritte-color-stroke-neutral-v20-0-1);
2240
2240
  }
2241
- .magritte-root_medium___67WJa_3-0-1{
2241
+ .magritte-root_medium___67WJa_3-1-1{
2242
2242
  justify-content:center;
2243
2243
  padding:var(--magritte-static-space-600-v20-0-1);
2244
2244
  }
2245
- .magritte-root_medium___67WJa_3-0-1 .magritte-body___O7ROl_3-0-1{
2245
+ .magritte-root_medium___67WJa_3-1-1 .magritte-body___O7ROl_3-1-1{
2246
2246
  flex-direction:column;
2247
2247
  align-items:center;
2248
2248
  justify-content:center;
2249
2249
  }
2250
- .magritte-root_small___dkUYq_3-0-1{
2250
+ .magritte-root_small___dkUYq_3-1-1{
2251
2251
  padding-top:var(--magritte-static-space-400-v20-0-1);
2252
2252
  padding-bottom:var(--magritte-static-space-400-v20-0-1);
2253
2253
  padding-left:var(--magritte-static-space-400-v20-0-1);
2254
2254
  }
2255
- .magritte-root_small___dkUYq_3-0-1 .magritte-body___O7ROl_3-0-1{
2255
+ .magritte-root_small___dkUYq_3-1-1 .magritte-body___O7ROl_3-1-1{
2256
2256
  gap:var(--magritte-static-space-400-v20-0-1);
2257
2257
  }
2258
- .magritte-background___RfZ0U_3-0-1{
2258
+ .magritte-background___RfZ0U_3-1-1{
2259
2259
  position:absolute;
2260
2260
  border-width:8px;
2261
2261
  border-style:dashed;
@@ -2268,15 +2268,15 @@
2268
2268
  background-position:center;
2269
2269
  background-size:100%;
2270
2270
  }
2271
- .magritte-body___O7ROl_3-0-1{
2271
+ .magritte-body___O7ROl_3-1-1{
2272
2272
  display:flex;
2273
2273
  width:100%;
2274
2274
  }
2275
- .magritte-loader___XYpWg_3-0-1{
2275
+ .magritte-loader___XYpWg_3-1-1{
2276
2276
  position:relative;
2277
2277
  display:flex;
2278
2278
  }
2279
- .magritte-cancel___tQ-yX_3-0-1{
2279
+ .magritte-cancel___tQ-yX_3-1-1{
2280
2280
  position:absolute;
2281
2281
  top:0;
2282
2282
  left:0;
@@ -2286,20 +2286,20 @@
2286
2286
  align-items:center;
2287
2287
  justify-content:center;
2288
2288
  }
2289
- .magritte-image-controls___vLf94_3-0-1{
2289
+ .magritte-image-controls___vLf94_3-1-1{
2290
2290
  display:flex;
2291
2291
  position:absolute;
2292
2292
  right:var(--magritte-static-space-300-v20-0-1);
2293
2293
  bottom:var(--magritte-static-space-300-v20-0-1);
2294
2294
  gap:var(--magritte-static-space-300-v20-0-1);
2295
2295
  }
2296
- .magritte-small-controls___Qn9TP_3-0-1{
2296
+ .magritte-small-controls___Qn9TP_3-1-1{
2297
2297
  display:flex;
2298
2298
  align-items:center;
2299
2299
  margin-left:auto;
2300
2300
  margin-right:var(--magritte-static-space-500-v20-0-1);
2301
2301
  }
2302
- .magritte-file-list___L9uHt_3-0-1{
2302
+ .magritte-file-list___L9uHt_3-1-1{
2303
2303
  margin-top:var(--magritte-static-space-300-v20-0-1);
2304
2304
  box-shadow:inset 0 0 0 1px var(--magritte-color-stroke-neutral-v20-0-1);
2305
2305
  border-radius:var(--magritte-static-border-radius-600-v20-0-1);
package/index.js CHANGED
@@ -5,7 +5,6 @@ import './MultiUpload.js';
5
5
  import 'react-dropzone';
6
6
  import 'classnames';
7
7
  import '@hh.ru/magritte-ui-spacing';
8
- import '@hh.ru/magritte-ui-typography';
9
8
  import './FileViewWithPreview.js';
10
9
  import './FileView.js';
11
10
  import '@hh.ru/magritte-ui-action';
@@ -17,8 +16,11 @@ import './FileName.js';
17
16
  import './utils.js';
18
17
  import './useFilePreview.js';
19
18
  import 'react';
19
+ import './Placeholder.js';
20
+ import '@hh.ru/magritte-ui-breakpoint';
21
+ import '@hh.ru/magritte-ui-typography';
20
22
  import './useDropActions.js';
21
23
  import './useDropButtons.js';
22
- import './upload-CR54iSr6.js';
24
+ import './upload-CJaTPbi8.js';
23
25
  import './SingleUpload.js';
24
26
  //# 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":";;;;;;;;;;;;;;;;;;;;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hh.ru/magritte-ui-upload",
3
- "version": "3.0.1",
3
+ "version": "3.1.1",
4
4
  "main": "index.js",
5
5
  "types": "index.d.ts",
6
6
  "sideEffects": [
@@ -29,6 +29,7 @@
29
29
  "dependencies": {
30
30
  "@hh.ru/magritte-ui-action": "4.4.17",
31
31
  "@hh.ru/magritte-ui-avatar": "5.0.16",
32
+ "@hh.ru/magritte-ui-breakpoint": "4.1.0",
32
33
  "@hh.ru/magritte-ui-button": "5.2.9",
33
34
  "@hh.ru/magritte-ui-divider": "1.1.37",
34
35
  "@hh.ru/magritte-ui-icon": "7.9.6",
@@ -37,5 +38,5 @@
37
38
  "@hh.ru/magritte-ui-typography": "3.0.22",
38
39
  "react-dropzone": "14.3.5"
39
40
  },
40
- "gitHead": "6791e06baab51c0635259c4f3733dac9a14cd99e"
41
+ "gitHead": "96dcc22eb0fbfc2914f3654638372be493c67fd8"
41
42
  }
package/types.d.ts CHANGED
@@ -13,8 +13,9 @@ export type UploadType = 'application' | 'image' | 'video' | 'mixed';
13
13
  export type LoadedFileWithFileSize = LoadedFile & {
14
14
  fileSizeMB: string;
15
15
  };
16
- interface UploadTrls {
16
+ export interface UploadTrls {
17
17
  title: ReactNode;
18
+ titleMobile?: ReactNode;
18
19
  subTitle: ReactNode;
19
20
  }
20
21
  export interface RenderFileInfo {
@@ -0,0 +1,5 @@
1
+ import './index.css';
2
+ var styles = {"root":"magritte-root___FV1tC_3-1-1","background":"magritte-background___RfZ0U_3-1-1","drag-active":"magritte-drag-active___dihBL_3-1-1","dragActive":"magritte-drag-active___dihBL_3-1-1","load":"magritte-load___MghDA_3-1-1","loading":"magritte-loading___9E3p-_3-1-1","invalid":"magritte-invalid___Rt10-_3-1-1","root_medium":"magritte-root_medium___67WJa_3-1-1","rootMedium":"magritte-root_medium___67WJa_3-1-1","body":"magritte-body___O7ROl_3-1-1","root_small":"magritte-root_small___dkUYq_3-1-1","rootSmall":"magritte-root_small___dkUYq_3-1-1","loader":"magritte-loader___XYpWg_3-1-1","cancel":"magritte-cancel___tQ-yX_3-1-1","image-controls":"magritte-image-controls___vLf94_3-1-1","imageControls":"magritte-image-controls___vLf94_3-1-1","small-controls":"magritte-small-controls___Qn9TP_3-1-1","smallControls":"magritte-small-controls___Qn9TP_3-1-1","file-list":"magritte-file-list___L9uHt_3-1-1","fileList":"magritte-file-list___L9uHt_3-1-1"};
3
+
4
+ export { styles as s };
5
+ //# sourceMappingURL=upload-CJaTPbi8.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"upload-CJaTPbi8.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
@@ -1,5 +0,0 @@
1
- import './index.css';
2
- var styles = {"root":"magritte-root___FV1tC_3-0-1","background":"magritte-background___RfZ0U_3-0-1","drag-active":"magritte-drag-active___dihBL_3-0-1","dragActive":"magritte-drag-active___dihBL_3-0-1","load":"magritte-load___MghDA_3-0-1","loading":"magritte-loading___9E3p-_3-0-1","invalid":"magritte-invalid___Rt10-_3-0-1","root_medium":"magritte-root_medium___67WJa_3-0-1","rootMedium":"magritte-root_medium___67WJa_3-0-1","body":"magritte-body___O7ROl_3-0-1","root_small":"magritte-root_small___dkUYq_3-0-1","rootSmall":"magritte-root_small___dkUYq_3-0-1","loader":"magritte-loader___XYpWg_3-0-1","cancel":"magritte-cancel___tQ-yX_3-0-1","image-controls":"magritte-image-controls___vLf94_3-0-1","imageControls":"magritte-image-controls___vLf94_3-0-1","small-controls":"magritte-small-controls___Qn9TP_3-0-1","smallControls":"magritte-small-controls___Qn9TP_3-0-1","file-list":"magritte-file-list___L9uHt_3-0-1","fileList":"magritte-file-list___L9uHt_3-0-1"};
3
-
4
- export { styles as s };
5
- //# sourceMappingURL=upload-CR54iSr6.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"upload-CR54iSr6.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}