@hh.ru/magritte-ui-upload 4.1.6 → 4.1.7
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 +5 -5
- package/FileView.js.map +1 -1
- package/FileViewWithPreview.js +1 -3
- package/FileViewWithPreview.js.map +1 -1
- package/MultiUpload.js +1 -1
- package/SingleUpload.js +2 -2
- package/SingleUpload.js.map +1 -1
- package/Upload.js +1 -1
- package/index.css +70 -45
- package/index.js +1 -1
- package/package.json +2 -2
- package/upload-DHlgvWib.js +10 -0
- package/{upload-Tejb-jCw.js.map → upload-DHlgvWib.js.map} +1 -1
- package/upload-Tejb-jCw.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-1-
|
|
6
|
+
var styles = {"file-name-body":"magritte-file-name-body___PTTMc_4-1-7","fileNameBody":"magritte-file-name-body___PTTMc_4-1-7","file-name-body_medium":"magritte-file-name-body_medium___sfmmq_4-1-7","fileNameBodyMedium":"magritte-file-name-body_medium___sfmmq_4-1-7"};
|
|
7
7
|
|
|
8
8
|
const parse = (file) => {
|
|
9
9
|
const name = file.name;
|
package/FileView.js
CHANGED
|
@@ -10,16 +10,16 @@ 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_4-1-
|
|
13
|
+
var styles = {"avatar-and-info":"magritte-avatar-and-info___vt6aT_4-1-7","avatarAndInfo":"magritte-avatar-and-info___vt6aT_4-1-7","file-info-body":"magritte-file-info-body___HmfXd_4-1-7","fileInfoBody":"magritte-file-info-body___HmfXd_4-1-7","file-info-and-controls":"magritte-file-info-and-controls___61iyY_4-1-7","fileInfoAndControls":"magritte-file-info-and-controls___61iyY_4-1-7","file-info-container":"magritte-file-info-container___WFab8_4-1-7","fileInfoContainer":"magritte-file-info-container___WFab8_4-1-7","file-info":"magritte-file-info___HrqiB_4-1-7","fileInfo":"magritte-file-info___HrqiB_4-1-7","controls":"magritte-controls___WdH7A_4-1-7","divider":"magritte-divider___3-bj9_4-1-7"};
|
|
14
14
|
|
|
15
15
|
const FileView = ({ uploadType, loadedFile, preview, renderFileInfo, onFileDelete, disableCancel, '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 && !isInvalid ? 'image' : 'icon', style: "secondary", image: preview, size: 48, icon: getUploadIcon(uploadType, loadedFile, true), "aria-label": ariaLabel }),
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
return (jsxs(Fragment, { children: [jsxs("div", { className: styles.avatarAndInfo, children: [jsx(Avatar, { mode: isImageType && !isLoading && !isInvalid ? 'image' : 'icon', style: "secondary", image: preview, size: 48, icon: getUploadIcon(uploadType, loadedFile, true), "aria-label": ariaLabel }), jsx("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, { initialColor: "negative" }), isLoading && jsx(Loader, { size: 16 }), !isInvalid && !isLoading && jsx(CheckCircleOutlinedSize16, { initialColor: "positive" }), jsx(Text, { typography: "label-4-regular", children: renderFileInfo({
|
|
20
|
+
...loadedFile,
|
|
21
|
+
fileSizeMB: bytes2mb(loadedFile.data.size),
|
|
22
|
+
}) })] })] }), jsxs("div", { className: styles.controls, children: [isLoading && !disableCancel && (jsx(CrossOutlinedSize24, { padding: 8, borderRadius: "halfHeight", initialColor: "secondary", onClick: onFileDelete })), !isLoading && (jsx(TrashOutlinedSize24, { padding: 8, borderRadius: "halfHeight", onClick: onFileDelete, "data-qa": "magritte-upload-delete-file-action", initialColor: "secondary" }))] })] }) })] }), !isLast && (jsxs("div", { className: styles.divider, children: [jsx(VSpacing, { default: 16 }), jsx(Divider, {}), jsx(VSpacing, { default: 16 })] }))] }));
|
|
23
23
|
};
|
|
24
24
|
|
|
25
25
|
export { FileView };
|
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 { 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 { Text } from '@hh.ru/magritte-ui-typography';\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 disableCancel?: boolean;\n}\n\nconst FileView = ({\n uploadType,\n loadedFile,\n preview,\n renderFileInfo,\n onFileDelete,\n disableCancel,\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
|
|
1
|
+
{"version":3,"file":"FileView.js","sources":["../src/FileView.tsx"],"sourcesContent":["import { ReactElement, MouseEvent } from 'react';\n\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 { Text } from '@hh.ru/magritte-ui-typography';\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 disableCancel?: boolean;\n}\n\nconst FileView = ({\n uploadType,\n loadedFile,\n preview,\n renderFileInfo,\n onFileDelete,\n disableCancel,\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 <div className={styles.avatarAndInfo}>\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 initialColor=\"negative\" />}\n {isLoading && <Loader size={16} />}\n {!isInvalid && !isLoading && <CheckCircleOutlinedSize16 initialColor=\"positive\" />}\n <Text typography=\"label-4-regular\">\n {renderFileInfo({\n ...loadedFile,\n fileSizeMB: bytes2mb(loadedFile.data.size),\n })}\n </Text>\n </div>\n </div>\n <div className={styles.controls}>\n {isLoading && !disableCancel && (\n <CrossOutlinedSize24\n padding={8}\n borderRadius=\"halfHeight\"\n initialColor=\"secondary\"\n onClick={onFileDelete}\n />\n )}\n {!isLoading && (\n <TrashOutlinedSize24\n padding={8}\n borderRadius=\"halfHeight\"\n onClick={onFileDelete}\n data-qa=\"magritte-upload-delete-file-action\"\n initialColor=\"secondary\"\n />\n )}\n </div>\n </div>\n </div>\n </div>\n {!isLast && (\n <div className={styles.divider}>\n <VSpacing default={16} />\n <Divider />\n <VSpacing default={16} />\n </div>\n )}\n </>\n );\n};\n\nexport { FileView };\n"],"names":["_jsxs","_Fragment","_jsx"],"mappings":";;;;;;;;;;;;;AA8BM,MAAA,QAAQ,GAAG,CAAC,EACd,UAAU,EACV,UAAU,EACV,OAAO,EACP,cAAc,EACd,YAAY,EACZ,aAAa,EACb,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,CAAAC,QAAA,EAAA,EAAA,QAAA,EAAA,CACID,IAAK,CAAA,KAAA,EAAA,EAAA,SAAS,EAAE,MAAM,CAAC,aAAa,EAAA,QAAA,EAA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AAK,SAAS,EAAE,MAAM,CAAC,QAAQ,EAAA,QAAA,EAAA,CAC1B,SAAS,IAAI,CAAC,aAAa,KACxBE,IAAC,mBAAmB,EAAA,EAChB,OAAO,EAAE,CAAC,EACV,YAAY,EAAC,YAAY,EACzB,YAAY,EAAC,WAAW,EACxB,OAAO,EAAE,YAAY,EACvB,CAAA,CACL,EACA,CAAC,SAAS,KACPA,GAAC,CAAA,mBAAmB,IAChB,OAAO,EAAE,CAAC,EACV,YAAY,EAAC,YAAY,EACzB,OAAO,EAAE,YAAY,EAAA,SAAA,EACb,oCAAoC,EAC5C,YAAY,EAAC,WAAW,EAC1B,CAAA,CACL,IACC,CACJ,EAAA,CAAA,EAAA,CACJ,CACJ,EAAA,CAAA,EACL,CAAC,MAAM,KACJF,IAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAE,MAAM,CAAC,OAAO,EAC1B,QAAA,EAAA,CAAAE,GAAA,CAAC,QAAQ,EAAC,EAAA,OAAO,EAAE,EAAE,EAAA,CAAI,EACzBA,GAAA,CAAC,OAAO,EAAA,EAAA,CAAG,EACXA,GAAC,CAAA,QAAQ,EAAC,EAAA,OAAO,EAAE,EAAE,GAAI,CACvB,EAAA,CAAA,CACT,CACF,EAAA,CAAA,EACL;AACN;;;;"}
|
package/FileViewWithPreview.js
CHANGED
|
@@ -13,12 +13,10 @@ import './FileName.js';
|
|
|
13
13
|
import 'classnames';
|
|
14
14
|
import 'react';
|
|
15
15
|
|
|
16
|
-
var styles = {"item":"magritte-item___vVDG-_4-1-6"};
|
|
17
|
-
|
|
18
16
|
const FileViewWithPreview = ({ loadedFile, ...otherProps }) => {
|
|
19
17
|
const uploadType = getFileType(loadedFile.data.type);
|
|
20
18
|
const preview = useFilePreview({ loadedFile, isImageType: uploadType === 'image' });
|
|
21
|
-
return
|
|
19
|
+
return jsx(FileView, { uploadType: uploadType, loadedFile: loadedFile, preview: preview, ...otherProps });
|
|
22
20
|
};
|
|
23
21
|
|
|
24
22
|
export { FileViewWithPreview };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FileViewWithPreview.js","sources":["../src/FileViewWithPreview.tsx"],"sourcesContent":["import { ReactElement } from 'react';\n\nimport { FileView, FileViewProps } from '@hh.ru/magritte-ui-upload/FileView';\nimport { useFilePreview } from '@hh.ru/magritte-ui-upload/useFilePreview';\nimport { getFileType } from '@hh.ru/magritte-ui-upload/utils';\n\
|
|
1
|
+
{"version":3,"file":"FileViewWithPreview.js","sources":["../src/FileViewWithPreview.tsx"],"sourcesContent":["import { ReactElement } from 'react';\n\nimport { FileView, FileViewProps } from '@hh.ru/magritte-ui-upload/FileView';\nimport { useFilePreview } from '@hh.ru/magritte-ui-upload/useFilePreview';\nimport { getFileType } from '@hh.ru/magritte-ui-upload/utils';\n\ntype FileViewWithPreviewProps = Omit<FileViewProps, 'preview' | 'uploadType'>;\n\nconst FileViewWithPreview = ({ loadedFile, ...otherProps }: FileViewWithPreviewProps): ReactElement => {\n const uploadType = getFileType(loadedFile.data.type);\n const preview = useFilePreview({ loadedFile, isImageType: uploadType === 'image' });\n return <FileView uploadType={uploadType} loadedFile={loadedFile} preview={preview} {...otherProps} />;\n};\n\nexport { FileViewWithPreview };\n"],"names":["_jsx"],"mappings":";;;;;;;;;;;;;;AAQM,MAAA,mBAAmB,GAAG,CAAC,EAAE,UAAU,EAAE,GAAG,UAAU,EAA4B,KAAkB;IAClG,MAAM,UAAU,GAAG,WAAW,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACrD,IAAA,MAAM,OAAO,GAAG,cAAc,CAAC,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,KAAK,OAAO,EAAE,CAAC,CAAC;AACpF,IAAA,OAAOA,IAAC,QAAQ,EAAA,EAAC,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,EAAM,GAAA,UAAU,GAAI,CAAC;AAC1G;;;;"}
|
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-DHlgvWib.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/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-DHlgvWib.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';
|
|
@@ -63,7 +63,7 @@ const SingleUpload = ({ files, trls, size = 'medium', accept = DEFAULT_ACCEPT, d
|
|
|
63
63
|
[styles.disabled]: isDisabled,
|
|
64
64
|
}), ...getRootProps(), "data-qa": "magritte-single-upload", children: [jsx("input", { ...getInputProps(), "data-qa": "magritte-single-upload-input", disabled: isDisabled }), jsx("div", { className: styles.background, style: backgroundStyles, "data-qa": "magritte-single-upload-background" }), jsxs(TextDynamic, { className: classnames(styles.body, { [styles.disabled]: isDisabled }), children: [isSizeSmall && (jsxs(Fragment, { children: [loadedFile && (jsx(FileView, { uploadType: uploadType, loadedFile: loadedFile, renderFileInfo: renderFileInfo, onFileDelete: (event) => {
|
|
65
65
|
onFileDelete(event, loadedFile, 0);
|
|
66
|
-
}, preview: preview, disableCancel: disableCancel, "aria-label": ariaLabel || '', isLast: true })), !loadedFile && (jsxs(Fragment, { children: [jsx(Avatar, { mode: "icon", style: "secondary", size: 48, icon: getUploadIcon(uploadType, loadedFile, true), "aria-label": ariaLabel || '' }), jsxs("div", { children: [jsx(Text, { typography: "label-2-regular", children: trls.title }), jsx(VSpacing, { default: 4 }), jsx(Text, { typography: "label-4-regular", style: "secondary", children: trls.subTitle })] }), selectFileButton && jsx("div", { className: styles.smallControls, children: selectFileButton })] }))] })), !isSizeSmall && (jsxs(Fragment, { children: [isLoading && (jsxs(Fragment, { children: [jsx(VSpacing, { default: 12 }), jsxs("div", { className: styles.loader, children: [jsx(Loader, { size: 64 }), !disableCancel && (jsx("div", { className: styles.cancel, children: jsx(CrossOutlinedSize24, { initialColor: "accent", onClick: (event) => {
|
|
66
|
+
}, preview: preview, disableCancel: disableCancel, "aria-label": ariaLabel || '', isLast: true })), !loadedFile && (jsxs(Fragment, { children: [jsx(Avatar, { mode: "icon", style: "secondary", size: 48, icon: getUploadIcon(uploadType, loadedFile, true), "aria-label": ariaLabel || '' }), jsxs("div", { className: styles.singleSmallPlaceholer, children: [jsx(Text, { typography: "label-2-regular", children: trls.title }), jsx(VSpacing, { default: 4 }), jsx(Text, { typography: "label-4-regular", style: "secondary", children: trls.subTitle })] }), selectFileButton && jsx("div", { className: styles.smallControls, children: selectFileButton })] }))] })), !isSizeSmall && (jsxs(Fragment, { children: [isLoading && (jsxs(Fragment, { children: [jsx(VSpacing, { default: 12 }), jsxs("div", { className: styles.loader, children: [jsx(Loader, { size: 64 }), !disableCancel && (jsx("div", { className: styles.cancel, children: jsx(CrossOutlinedSize24, { initialColor: "accent", onClick: (event) => {
|
|
67
67
|
onFileDelete(event, loadedFile, 0);
|
|
68
68
|
} }) }))] })] })), isInvalid ? (jsx(ExclamationTriangleOutlinedSize32, { initialColor: "negative" })) : (jsx("span", { className: classnames(styles.fileIcon, { [styles.hiddenFileInfo]: usePreview }), children: getUploadIcon(uploadType, loadedFile, false) })), jsx(VSpacing, { default: 16 }), loadedFile && (jsxs(Fragment, { children: [jsxs("div", { className: classnames(styles.fileInfo, { [styles.hiddenFileInfo]: usePreview }), children: [jsx(FileName, { file: loadedFile.data, isSizeMedium: true }), jsx(VSpacing, { default: 6 }), jsx(Text, { typography: "label-4-regular", style: "secondary", children: renderFileInfo({
|
|
69
69
|
...loadedFile,
|
package/SingleUpload.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SingleUpload.js","sources":["../src/SingleUpload.tsx"],"sourcesContent":["import { ReactElement, MouseEvent } from 'react';\nimport { useDropzone } from 'react-dropzone';\nimport classnames from 'classnames';\n\nimport { DisabledContext, useDisabled } from '@hh.ru/magritte-common-use-disabled';\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, TextDynamic } 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 disableCancel,\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 disabled,\n ...dropzoneProps\n}: UploadProps): ReactElement => {\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 const usePreview = preview !== 'none';\n const contextDisabled = useDisabled();\n const isDisabled = disabled || contextDisabled;\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 disabled: isDisabled,\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 <DisabledContext.Provider value={isDisabled}>\n <div\n className={classnames(styles.root, styles[`root_${size}`], {\n [styles.dragActive]: isDragActive && isDisabled,\n [styles.loading]: isLoading,\n [styles.load]: isLoad,\n [styles.invalid]: isInvalid,\n [styles.disabled]: isDisabled,\n })}\n {...getRootProps()}\n data-qa=\"magritte-single-upload\"\n >\n <input {...getInputProps()} data-qa=\"magritte-single-upload-input\" disabled={isDisabled} />\n <div\n className={styles.background}\n style={backgroundStyles}\n data-qa=\"magritte-single-upload-background\"\n />\n <TextDynamic className={classnames(styles.body, { [styles.disabled]: isDisabled })}>\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 disableCancel={disableCancel}\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 <>\n <VSpacing default={12} />\n <div className={styles.loader}>\n <Loader size={64} />\n {!disableCancel && (\n <div className={styles.cancel}>\n <CrossOutlinedSize24\n initialColor=\"accent\"\n onClick={(event) => {\n onFileDelete(event, loadedFile, 0);\n }}\n />\n </div>\n )}\n </div>\n </>\n )}\n {isInvalid ? (\n <ExclamationTriangleOutlinedSize32 initialColor=\"negative\" />\n ) : (\n <span className={classnames(styles.fileIcon, { [styles.hiddenFileInfo]: usePreview })}>\n {getUploadIcon(uploadType, loadedFile, false)}\n </span>\n )}\n <VSpacing default={16} />\n {loadedFile && (\n <>\n <div\n className={classnames(styles.fileInfo, { [styles.hiddenFileInfo]: usePreview })}\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 </div>\n {!isLoading && (!isImageType || isInvalid) && deleteFileButton && (\n <>\n <VSpacing default={16} />\n {deleteFileButton}\n </>\n )}\n {!isLoading &&\n isImageType &&\n !isInvalid &&\n (replaceImageButton || deleteFileButton) && (\n <>\n <VSpacing default={16} />\n <div className={styles.imageControls}>\n {replaceImageButton}\n {deleteFileButton}\n </div>\n </>\n )}\n {isLoading && <VSpacing default={12} />}\n </>\n )}\n {!loadedFile && <Placeholder trls={trls} selectFileButton={selectFileButton} />}\n </>\n )}\n </TextDynamic>\n </div>\n </DisabledContext.Provider>\n );\n};\n\nexport { SingleUpload };\n"],"names":["_jsx","_jsxs","_Fragment"],"mappings":";;;;;;;;;;;;;;;;;;;;AA2BM,MAAA,YAAY,GAAG,CAAC,EAClB,KAAK,EACL,IAAI,EACJ,IAAI,GAAG,QAAQ,EACf,MAAM,GAAG,cAAc,EACvB,aAAa,EACb,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,QAAQ,EACR,GAAG,aAAa,EACN,KAAkB;AAC5B,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,OAAO,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;IAC/C,MAAM,SAAS,GAAG,OAAO,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;AAC7C,IAAA,MAAM,WAAW,GAAG,IAAI,KAAK,OAAO,CAAC;AAC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ACC,CAAA,CAAA,EAAA,CACL,EACL,CAAC,SAAS,KAAK,CAAC,WAAW,IAAI,SAAS,CAAC,IAAI,gBAAgB,KAC1DC,IAAA,CAAAC,QAAA,EAAA,EAAA,QAAA,EAAA,CACIF,GAAC,CAAA,QAAQ,EAAC,EAAA,OAAO,EAAE,EAAE,EAAI,CAAA,EACxB,gBAAgB,CAAA,EAAA,CAClB,CACN,EACA,CAAC,SAAS;4CACP,WAAW;AACX,4CAAA,CAAC,SAAS;AACV,6CAAC,kBAAkB,IAAI,gBAAgB,CAAC,KACpCC,IACI,CAAAC,QAAA,EAAA,EAAA,QAAA,EAAA,CAAAF,GAAA,CAAC,QAAQ,EAAA,EAAC,OAAO,EAAE,EAAE,EAAA,CAAI,EACzBC,IAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAE,MAAM,CAAC,aAAa,EAAA,QAAA,EAAA,CAC/B,kBAAkB,EAClB,gBAAgB,CAAA,EAAA,CACf,CACP,EAAA,CAAA,CACN,EACJ,SAAS,IAAID,GAAA,CAAC,QAAQ,EAAA,EAAC,OAAO,EAAE,EAAE,EAAA,CAAI,CACxC,EAAA,CAAA,CACN,EACA,CAAC,UAAU,IAAIA,GAAC,CAAA,WAAW,EAAC,EAAA,IAAI,EAAE,IAAI,EAAE,gBAAgB,EAAE,gBAAgB,EAAI,CAAA,CAAA,EAAA,CAChF,CACN,CAAA,EAAA,CACS,CACZ,EAAA,CAAA,EAAA,CACiB,EAC7B;AACN;;;;"}
|
|
1
|
+
{"version":3,"file":"SingleUpload.js","sources":["../src/SingleUpload.tsx"],"sourcesContent":["import { ReactElement, MouseEvent } from 'react';\nimport { useDropzone } from 'react-dropzone';\nimport classnames from 'classnames';\n\nimport { DisabledContext, useDisabled } from '@hh.ru/magritte-common-use-disabled';\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, TextDynamic } 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 disableCancel,\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 disabled,\n ...dropzoneProps\n}: UploadProps): ReactElement => {\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 const usePreview = preview !== 'none';\n const contextDisabled = useDisabled();\n const isDisabled = disabled || contextDisabled;\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 disabled: isDisabled,\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 <DisabledContext.Provider value={isDisabled}>\n <div\n className={classnames(styles.root, styles[`root_${size}`], {\n [styles.dragActive]: isDragActive && isDisabled,\n [styles.loading]: isLoading,\n [styles.load]: isLoad,\n [styles.invalid]: isInvalid,\n [styles.disabled]: isDisabled,\n })}\n {...getRootProps()}\n data-qa=\"magritte-single-upload\"\n >\n <input {...getInputProps()} data-qa=\"magritte-single-upload-input\" disabled={isDisabled} />\n <div\n className={styles.background}\n style={backgroundStyles}\n data-qa=\"magritte-single-upload-background\"\n />\n <TextDynamic className={classnames(styles.body, { [styles.disabled]: isDisabled })}>\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 disableCancel={disableCancel}\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 className={styles.singleSmallPlaceholer}>\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 <>\n <VSpacing default={12} />\n <div className={styles.loader}>\n <Loader size={64} />\n {!disableCancel && (\n <div className={styles.cancel}>\n <CrossOutlinedSize24\n initialColor=\"accent\"\n onClick={(event) => {\n onFileDelete(event, loadedFile, 0);\n }}\n />\n </div>\n )}\n </div>\n </>\n )}\n {isInvalid ? (\n <ExclamationTriangleOutlinedSize32 initialColor=\"negative\" />\n ) : (\n <span className={classnames(styles.fileIcon, { [styles.hiddenFileInfo]: usePreview })}>\n {getUploadIcon(uploadType, loadedFile, false)}\n </span>\n )}\n <VSpacing default={16} />\n {loadedFile && (\n <>\n <div\n className={classnames(styles.fileInfo, { [styles.hiddenFileInfo]: usePreview })}\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 </div>\n {!isLoading && (!isImageType || isInvalid) && deleteFileButton && (\n <>\n <VSpacing default={16} />\n {deleteFileButton}\n </>\n )}\n {!isLoading &&\n isImageType &&\n !isInvalid &&\n (replaceImageButton || deleteFileButton) && (\n <>\n <VSpacing default={16} />\n <div className={styles.imageControls}>\n {replaceImageButton}\n {deleteFileButton}\n </div>\n </>\n )}\n {isLoading && <VSpacing default={12} />}\n </>\n )}\n {!loadedFile && <Placeholder trls={trls} selectFileButton={selectFileButton} />}\n </>\n )}\n </TextDynamic>\n </div>\n </DisabledContext.Provider>\n );\n};\n\nexport { SingleUpload };\n"],"names":["_jsx","_jsxs","_Fragment"],"mappings":";;;;;;;;;;;;;;;;;;;;AA2BM,MAAA,YAAY,GAAG,CAAC,EAClB,KAAK,EACL,IAAI,EACJ,IAAI,GAAG,QAAQ,EACf,MAAM,GAAG,cAAc,EACvB,aAAa,EACb,gBAAgB,EAAE,iBAAiB,EACnC,gBAAgB,EAAE,iBAAiB,EACnC,kBAAkB,EAAE,mBAAmB,EACvC,cAAc,GAAG,qBAA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,IAAIA,GAAC,CAAA,WAAW,EAAC,EAAA,IAAI,EAAE,IAAI,EAAE,gBAAgB,EAAE,gBAAgB,EAAI,CAAA,CAAA,EAAA,CAChF,CACN,CAAA,EAAA,CACS,CACZ,EAAA,CAAA,EAAA,CACiB,EAC7B;AACN;;;;"}
|
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-DHlgvWib.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,38 +1,47 @@
|
|
|
1
|
-
.magritte-file-name-body___PTTMc_4-1-
|
|
1
|
+
.magritte-file-name-body___PTTMc_4-1-7{
|
|
2
2
|
display:flex;
|
|
3
3
|
width:100%;
|
|
4
4
|
overflow:hidden;
|
|
5
5
|
}
|
|
6
|
-
.magritte-file-name-body_medium___sfmmq_4-1-
|
|
6
|
+
.magritte-file-name-body_medium___sfmmq_4-1-7{
|
|
7
7
|
justify-content:center;
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
.magritte-
|
|
10
|
+
.magritte-avatar-and-info___vt6aT_4-1-7{
|
|
11
|
+
display:flex;
|
|
12
|
+
gap:16px;
|
|
13
|
+
width:100%;
|
|
14
|
+
}
|
|
15
|
+
.magritte-file-info-body___HmfXd_4-1-7{
|
|
16
|
+
display:flex;
|
|
11
17
|
flex-grow:1;
|
|
18
|
+
flex-direction:column;
|
|
12
19
|
}
|
|
13
|
-
.magritte-file-info-and-controls___61iyY_4-1-
|
|
20
|
+
.magritte-file-info-and-controls___61iyY_4-1-7{
|
|
14
21
|
display:flex;
|
|
15
22
|
gap:16px;
|
|
23
|
+
flex-grow:1;
|
|
16
24
|
}
|
|
17
|
-
.magritte-file-info-container___WFab8_4-1-
|
|
25
|
+
.magritte-file-info-container___WFab8_4-1-7{
|
|
18
26
|
flex-grow:1;
|
|
27
|
+
display:flex;
|
|
28
|
+
flex-direction:column;
|
|
29
|
+
justify-content:center;
|
|
19
30
|
width:50px;
|
|
20
31
|
}
|
|
21
|
-
.magritte-file-info___HrqiB_4-1-
|
|
32
|
+
.magritte-file-info___HrqiB_4-1-7{
|
|
22
33
|
display:flex;
|
|
23
34
|
gap:4px;
|
|
35
|
+
align-items:center;
|
|
24
36
|
}
|
|
25
|
-
.magritte-controls___WdH7A_4-1-
|
|
37
|
+
.magritte-controls___WdH7A_4-1-7{
|
|
26
38
|
display:flex;
|
|
27
39
|
align-items:center;
|
|
28
40
|
margin-left:auto;
|
|
29
41
|
margin-right:16px;
|
|
30
42
|
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
display:flex;
|
|
34
|
-
width:100%;
|
|
35
|
-
gap:16px;
|
|
43
|
+
.magritte-divider___3-bj9_4-1-7{
|
|
44
|
+
margin-left:64px;
|
|
36
45
|
}
|
|
37
46
|
|
|
38
47
|
:root{
|
|
@@ -56,84 +65,95 @@
|
|
|
56
65
|
.magritte-zp-day-theme{
|
|
57
66
|
--magritte-color-stroke-accent-v24-3-0:#7195AF;
|
|
58
67
|
}
|
|
59
|
-
.magritte-root___FV1tC_4-1-
|
|
68
|
+
.magritte-root___FV1tC_4-1-7{
|
|
60
69
|
position:relative;
|
|
61
70
|
display:flex;
|
|
62
71
|
overflow:hidden;
|
|
63
72
|
border-radius:24px;
|
|
64
73
|
background-color:var(--magritte-color-background-primary-v24-3-0);
|
|
65
74
|
cursor:pointer;
|
|
75
|
+
--border-background-dimension:5px;
|
|
66
76
|
}
|
|
67
|
-
.magritte-root___FV1tC_4-1-
|
|
77
|
+
.magritte-root___FV1tC_4-1-7:hover .magritte-background___RfZ0U_4-1-7{
|
|
68
78
|
border-color:var(--magritte-color-stroke-accent-v24-3-0);
|
|
69
79
|
}
|
|
70
|
-
.magritte-root___FV1tC_4-1-
|
|
80
|
+
.magritte-root___FV1tC_4-1-7.magritte-drag-active___dihBL_4-1-7 .magritte-background___RfZ0U_4-1-7{
|
|
71
81
|
border-color:var(--magritte-color-stroke-accent-v24-3-0);
|
|
72
82
|
}
|
|
73
|
-
.magritte-root___FV1tC_4-1-
|
|
83
|
+
.magritte-root___FV1tC_4-1-7.focus-visible{
|
|
74
84
|
outline:var(--magritte-color-stroke-state-focused-accessible-v24-3-0) solid 4px;
|
|
75
85
|
}
|
|
76
|
-
.magritte-root___FV1tC_4-1-
|
|
86
|
+
.magritte-root___FV1tC_4-1-7.focus-visible .magritte-background___RfZ0U_4-1-7{
|
|
77
87
|
border-color:var(--magritte-color-stroke-accent-v24-3-0);
|
|
78
88
|
}
|
|
79
|
-
.magritte-root___FV1tC_4-1-
|
|
80
|
-
.magritte-root___FV1tC_4-1-
|
|
89
|
+
.magritte-root___FV1tC_4-1-7.magritte-load___MghDA_4-1-7 .magritte-background___RfZ0U_4-1-7,
|
|
90
|
+
.magritte-root___FV1tC_4-1-7.magritte-loading___9E3p-_4-1-7 .magritte-background___RfZ0U_4-1-7{
|
|
81
91
|
border-style:solid;
|
|
82
|
-
border-width:
|
|
92
|
+
border-width:calc(1px + var(--border-background-dimension));
|
|
83
93
|
}
|
|
84
|
-
.magritte-root___FV1tC_4-1-
|
|
94
|
+
.magritte-root___FV1tC_4-1-7.magritte-invalid___Rt10-_4-1-7.focus-visible{
|
|
85
95
|
outline:var(--magritte-color-component-input-stroke-state-negative-focused-accessible-v24-3-0) solid 4px;
|
|
86
96
|
}
|
|
87
|
-
.magritte-root___FV1tC_4-1-
|
|
97
|
+
.magritte-root___FV1tC_4-1-7.magritte-invalid___Rt10-_4-1-7 .magritte-background___RfZ0U_4-1-7{
|
|
88
98
|
border-color:var(--magritte-color-stroke-neutral-v24-3-0);
|
|
89
99
|
}
|
|
90
|
-
.magritte-root___FV1tC_4-1-
|
|
100
|
+
.magritte-root___FV1tC_4-1-7.magritte-disabled___bhw2K_4-1-7{
|
|
91
101
|
cursor:default;
|
|
92
102
|
background-color:var(--magritte-color-background-state-primary-disabled-v24-3-0);
|
|
93
103
|
}
|
|
94
|
-
.magritte-root___FV1tC_4-1-
|
|
104
|
+
.magritte-root___FV1tC_4-1-7.magritte-disabled___bhw2K_4-1-7 .magritte-background___RfZ0U_4-1-7{
|
|
95
105
|
border-color:var(--magritte-color-stroke-state-neutral-disabled-v24-3-0);
|
|
96
|
-
border-width:
|
|
106
|
+
border-width:calc(2px + var(--border-background-dimension));
|
|
107
|
+
}
|
|
108
|
+
@supports (-moz-appearance: none){
|
|
109
|
+
.magritte-root___FV1tC_4-1-7{
|
|
110
|
+
--border-background-dimension:2px;
|
|
111
|
+
}
|
|
97
112
|
}
|
|
98
|
-
|
|
113
|
+
@supports (background: -webkit-named-image(i)) and (-webkit-appearance: none){
|
|
114
|
+
.magritte-root___FV1tC_4-1-7{
|
|
115
|
+
--border-background-dimension:2px;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
.magritte-root_medium___67WJa_4-1-7{
|
|
99
119
|
justify-content:center;
|
|
100
120
|
padding:24px;
|
|
101
121
|
}
|
|
102
|
-
.magritte-root_medium___67WJa_4-1-
|
|
122
|
+
.magritte-root_medium___67WJa_4-1-7 .magritte-body___O7ROl_4-1-7{
|
|
103
123
|
flex-direction:column;
|
|
104
124
|
align-items:center;
|
|
105
125
|
justify-content:center;
|
|
106
126
|
}
|
|
107
|
-
.magritte-root_small___dkUYq_4-1-
|
|
127
|
+
.magritte-root_small___dkUYq_4-1-7{
|
|
108
128
|
padding-top:16px;
|
|
109
129
|
padding-bottom:16px;
|
|
110
130
|
padding-left:16px;
|
|
111
131
|
}
|
|
112
|
-
.magritte-root_small___dkUYq_4-1-
|
|
132
|
+
.magritte-root_small___dkUYq_4-1-7 .magritte-body___O7ROl_4-1-7{
|
|
113
133
|
gap:16px;
|
|
114
134
|
}
|
|
115
|
-
.magritte-background___RfZ0U_4-1-
|
|
135
|
+
.magritte-background___RfZ0U_4-1-7{
|
|
116
136
|
position:absolute;
|
|
117
|
-
border-width:
|
|
137
|
+
border-width:calc(2px + var(--border-background-dimension));
|
|
118
138
|
border-style:dashed;
|
|
119
139
|
border-color:var(--magritte-color-stroke-neutral-v24-3-0);
|
|
120
|
-
top
|
|
121
|
-
bottom
|
|
122
|
-
left
|
|
123
|
-
right
|
|
124
|
-
border-radius:calc(24px +
|
|
140
|
+
top:calc(-1 * var(--border-background-dimension));
|
|
141
|
+
bottom:calc(-1 * var(--border-background-dimension));
|
|
142
|
+
left:calc(-1 * var(--border-background-dimension));
|
|
143
|
+
right:calc(-1 * var(--border-background-dimension));
|
|
144
|
+
border-radius:calc(24px + var(--border-background-dimension));
|
|
125
145
|
background-position:center;
|
|
126
146
|
background-size:100%;
|
|
127
147
|
}
|
|
128
|
-
.magritte-body___O7ROl_4-1-
|
|
148
|
+
.magritte-body___O7ROl_4-1-7{
|
|
129
149
|
display:flex;
|
|
130
150
|
width:100%;
|
|
131
151
|
}
|
|
132
|
-
.magritte-loader___XYpWg_4-1-
|
|
152
|
+
.magritte-loader___XYpWg_4-1-7{
|
|
133
153
|
position:relative;
|
|
134
154
|
display:flex;
|
|
135
155
|
}
|
|
136
|
-
.magritte-cancel___tQ-yX_4-1-
|
|
156
|
+
.magritte-cancel___tQ-yX_4-1-7{
|
|
137
157
|
position:absolute;
|
|
138
158
|
top:0;
|
|
139
159
|
left:0;
|
|
@@ -143,20 +163,20 @@
|
|
|
143
163
|
align-items:center;
|
|
144
164
|
justify-content:center;
|
|
145
165
|
}
|
|
146
|
-
.magritte-image-controls___vLf94_4-1-
|
|
166
|
+
.magritte-image-controls___vLf94_4-1-7{
|
|
147
167
|
display:flex;
|
|
148
168
|
gap:12px;
|
|
149
169
|
align-items:flex-end;
|
|
150
170
|
justify-content:flex-end;
|
|
151
171
|
width:100%;
|
|
152
172
|
}
|
|
153
|
-
.magritte-small-controls___Qn9TP_4-1-
|
|
173
|
+
.magritte-small-controls___Qn9TP_4-1-7{
|
|
154
174
|
display:flex;
|
|
155
175
|
align-items:center;
|
|
156
176
|
margin-left:auto;
|
|
157
177
|
margin-right:20px;
|
|
158
178
|
}
|
|
159
|
-
.magritte-file-list___L9uHt_4-1-
|
|
179
|
+
.magritte-file-list___L9uHt_4-1-7{
|
|
160
180
|
margin-top:12px;
|
|
161
181
|
box-shadow:inset 0 0 0 1px var(--magritte-color-stroke-neutral-v24-3-0);
|
|
162
182
|
border-radius:24px;
|
|
@@ -165,15 +185,20 @@
|
|
|
165
185
|
padding-bottom:16px;
|
|
166
186
|
padding-left:16px;
|
|
167
187
|
}
|
|
168
|
-
.magritte-file-icon___oetLK_4-1-
|
|
188
|
+
.magritte-file-icon___oetLK_4-1-7{
|
|
169
189
|
display:inline-flex;
|
|
170
190
|
}
|
|
171
|
-
.magritte-file-info___Y3vyi_4-1-
|
|
191
|
+
.magritte-file-info___Y3vyi_4-1-7{
|
|
172
192
|
display:inline-flex;
|
|
173
193
|
width:100%;
|
|
174
194
|
flex-direction:column;
|
|
175
195
|
align-items:center;
|
|
176
196
|
}
|
|
177
|
-
.magritte-hidden-file-info___92c69_4-1-
|
|
197
|
+
.magritte-hidden-file-info___92c69_4-1-7{
|
|
178
198
|
visibility:hidden;
|
|
179
199
|
}
|
|
200
|
+
.magritte-single-small-placeholer___m8Vnt_4-1-7{
|
|
201
|
+
display:flex;
|
|
202
|
+
flex-direction:column;
|
|
203
|
+
justify-content:center;
|
|
204
|
+
}
|
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-DHlgvWib.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.1.
|
|
3
|
+
"version": "4.1.7",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"types": "index.d.ts",
|
|
6
6
|
"sideEffects": [
|
|
@@ -39,5 +39,5 @@
|
|
|
39
39
|
"@hh.ru/magritte-ui-typography": "4.4.4",
|
|
40
40
|
"react-dropzone": "14.3.5"
|
|
41
41
|
},
|
|
42
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "432ae6cd6682a9d47cd9c752dd128119aae6b6b5"
|
|
43
43
|
}
|
|
@@ -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-1-7","background":"magritte-background___RfZ0U_4-1-7","drag-active":"magritte-drag-active___dihBL_4-1-7","dragActive":"magritte-drag-active___dihBL_4-1-7","load":"magritte-load___MghDA_4-1-7","loading":"magritte-loading___9E3p-_4-1-7","invalid":"magritte-invalid___Rt10-_4-1-7","disabled":"magritte-disabled___bhw2K_4-1-7","root_medium":"magritte-root_medium___67WJa_4-1-7","rootMedium":"magritte-root_medium___67WJa_4-1-7","body":"magritte-body___O7ROl_4-1-7","root_small":"magritte-root_small___dkUYq_4-1-7","rootSmall":"magritte-root_small___dkUYq_4-1-7","loader":"magritte-loader___XYpWg_4-1-7","cancel":"magritte-cancel___tQ-yX_4-1-7","image-controls":"magritte-image-controls___vLf94_4-1-7","imageControls":"magritte-image-controls___vLf94_4-1-7","small-controls":"magritte-small-controls___Qn9TP_4-1-7","smallControls":"magritte-small-controls___Qn9TP_4-1-7","file-list":"magritte-file-list___L9uHt_4-1-7","fileList":"magritte-file-list___L9uHt_4-1-7","file-icon":"magritte-file-icon___oetLK_4-1-7","fileIcon":"magritte-file-icon___oetLK_4-1-7","file-info":"magritte-file-info___Y3vyi_4-1-7","fileInfo":"magritte-file-info___Y3vyi_4-1-7","hidden-file-info":"magritte-hidden-file-info___92c69_4-1-7","hiddenFileInfo":"magritte-hidden-file-info___92c69_4-1-7","single-small-placeholer":"magritte-single-small-placeholer___m8Vnt_4-1-7","singleSmallPlaceholer":"magritte-single-small-placeholer___m8Vnt_4-1-7"};
|
|
8
|
+
|
|
9
|
+
export { DisabledContext as D, styles as s, useDisabled as u };
|
|
10
|
+
//# sourceMappingURL=upload-DHlgvWib.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"upload-
|
|
1
|
+
{"version":3,"file":"upload-DHlgvWib.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/upload-Tejb-jCw.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-1-6","background":"magritte-background___RfZ0U_4-1-6","drag-active":"magritte-drag-active___dihBL_4-1-6","dragActive":"magritte-drag-active___dihBL_4-1-6","load":"magritte-load___MghDA_4-1-6","loading":"magritte-loading___9E3p-_4-1-6","invalid":"magritte-invalid___Rt10-_4-1-6","disabled":"magritte-disabled___bhw2K_4-1-6","root_medium":"magritte-root_medium___67WJa_4-1-6","rootMedium":"magritte-root_medium___67WJa_4-1-6","body":"magritte-body___O7ROl_4-1-6","root_small":"magritte-root_small___dkUYq_4-1-6","rootSmall":"magritte-root_small___dkUYq_4-1-6","loader":"magritte-loader___XYpWg_4-1-6","cancel":"magritte-cancel___tQ-yX_4-1-6","image-controls":"magritte-image-controls___vLf94_4-1-6","imageControls":"magritte-image-controls___vLf94_4-1-6","small-controls":"magritte-small-controls___Qn9TP_4-1-6","smallControls":"magritte-small-controls___Qn9TP_4-1-6","file-list":"magritte-file-list___L9uHt_4-1-6","fileList":"magritte-file-list___L9uHt_4-1-6","file-icon":"magritte-file-icon___oetLK_4-1-6","fileIcon":"magritte-file-icon___oetLK_4-1-6","file-info":"magritte-file-info___Y3vyi_4-1-6","fileInfo":"magritte-file-info___Y3vyi_4-1-6","hidden-file-info":"magritte-hidden-file-info___92c69_4-1-6","hiddenFileInfo":"magritte-hidden-file-info___92c69_4-1-6"};
|
|
8
|
-
|
|
9
|
-
export { DisabledContext as D, styles as s, useDisabled as u };
|
|
10
|
-
//# sourceMappingURL=upload-Tejb-jCw.js.map
|