@veeqo/ui 12.5.0 → 13.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Alerts/Alert/Alert.cjs +2 -2
- package/dist/components/Alerts/Alert/Alert.cjs.map +1 -1
- package/dist/components/Alerts/Alert/Alert.js +2 -2
- package/dist/components/Alerts/Alert/Alert.js.map +1 -1
- package/dist/components/Flex/FlexCol/FlexCol.d.ts +3 -3
- package/dist/components/Flex/FlexRow/FlexRow.d.ts +3 -3
- package/dist/components/Flex/types.d.ts +13 -4
- package/dist/components/Pagination/styled.d.ts +3 -3
- package/dist/components/UploadFile/UploadFile.cjs +64 -83
- package/dist/components/UploadFile/UploadFile.cjs.map +1 -1
- package/dist/components/UploadFile/UploadFile.js +67 -86
- package/dist/components/UploadFile/UploadFile.js.map +1 -1
- package/dist/components/UploadFile/components/DropCopy/DropCopy.cjs +28 -0
- package/dist/components/UploadFile/components/DropCopy/DropCopy.cjs.map +1 -0
- package/dist/components/UploadFile/components/DropCopy/DropCopy.d.ts +2 -0
- package/dist/components/UploadFile/components/DropCopy/DropCopy.js +22 -0
- package/dist/components/UploadFile/components/DropCopy/DropCopy.js.map +1 -0
- package/dist/components/UploadFile/components/UploadCopy/UploadCopy.cjs +6 -6
- package/dist/components/UploadFile/components/UploadCopy/UploadCopy.cjs.map +1 -1
- package/dist/components/UploadFile/components/UploadCopy/UploadCopy.js +6 -6
- package/dist/components/UploadFile/components/UploadCopy/UploadCopy.js.map +1 -1
- package/dist/components/UploadFile/constants.cjs +71 -8
- package/dist/components/UploadFile/constants.cjs.map +1 -1
- package/dist/components/UploadFile/constants.d.ts +57 -5
- package/dist/components/UploadFile/constants.js +69 -9
- package/dist/components/UploadFile/constants.js.map +1 -1
- package/dist/components/UploadFile/hooks/useUploadFile/index.d.ts +1 -0
- package/dist/components/UploadFile/hooks/useUploadFile/useUploadFile.cjs +65 -0
- package/dist/components/UploadFile/hooks/useUploadFile/useUploadFile.cjs.map +1 -0
- package/dist/components/UploadFile/hooks/useUploadFile/useUploadFile.d.ts +9 -0
- package/dist/components/UploadFile/hooks/useUploadFile/useUploadFile.js +63 -0
- package/dist/components/UploadFile/hooks/useUploadFile/useUploadFile.js.map +1 -0
- package/dist/components/UploadFile/hooks/useValidateInput/index.d.ts +1 -0
- package/dist/components/UploadFile/hooks/useValidateInput/useValidateInput.cjs +48 -0
- package/dist/components/UploadFile/hooks/useValidateInput/useValidateInput.cjs.map +1 -0
- package/dist/components/UploadFile/hooks/useValidateInput/useValidateInput.d.ts +11 -0
- package/dist/components/UploadFile/hooks/useValidateInput/useValidateInput.js +46 -0
- package/dist/components/UploadFile/hooks/useValidateInput/useValidateInput.js.map +1 -0
- package/dist/components/UploadFile/index.d.ts +0 -1
- package/dist/components/UploadFile/mocks/files.d.ts +2 -0
- package/dist/components/UploadFile/mocks/mockUseUploadFile.d.ts +14 -0
- package/dist/components/UploadFile/mocks/utils.d.ts +1 -2
- package/dist/components/UploadFile/styled.cjs +40 -1
- package/dist/components/UploadFile/styled.cjs.map +1 -1
- package/dist/components/UploadFile/styled.d.ts +4 -1
- package/dist/components/UploadFile/styled.js +40 -1
- package/dist/components/UploadFile/styled.js.map +1 -1
- package/dist/components/UploadFile/types.d.ts +15 -1
- package/dist/components/UploadFile/utils/getErrorMessage/getErrorMessage.cjs +27 -0
- package/dist/components/UploadFile/utils/getErrorMessage/getErrorMessage.cjs.map +1 -0
- package/dist/components/UploadFile/utils/getErrorMessage/getErrorMessage.d.ts +8 -0
- package/dist/components/UploadFile/utils/getErrorMessage/getErrorMessage.js +25 -0
- package/dist/components/UploadFile/utils/getErrorMessage/getErrorMessage.js.map +1 -0
- package/dist/components/UploadFile/utils/getErrorMessage/index.d.ts +1 -0
- package/dist/components/UploadFile/utils/getFileSizeString/getFileSizeString.cjs +14 -11
- package/dist/components/UploadFile/utils/getFileSizeString/getFileSizeString.cjs.map +1 -1
- package/dist/components/UploadFile/utils/getFileSizeString/getFileSizeString.d.ts +10 -7
- package/dist/components/UploadFile/utils/getFileSizeString/getFileSizeString.js +14 -11
- package/dist/components/UploadFile/utils/getFileSizeString/getFileSizeString.js.map +1 -1
- package/dist/components/UploadFile/utils/getValidTypesString/getValidTypesString.cjs +16 -30
- package/dist/components/UploadFile/utils/getValidTypesString/getValidTypesString.cjs.map +1 -1
- package/dist/components/UploadFile/utils/getValidTypesString/getValidTypesString.js +16 -30
- package/dist/components/UploadFile/utils/getValidTypesString/getValidTypesString.js.map +1 -1
- package/dist/components/UploadFile/utils/index.d.ts +0 -1
- package/dist/components/UploadedFile/UploadedFile.cjs +78 -0
- package/dist/components/UploadedFile/UploadedFile.cjs.map +1 -0
- package/dist/components/UploadedFile/UploadedFile.d.ts +12 -0
- package/dist/components/UploadedFile/UploadedFile.js +72 -0
- package/dist/components/UploadedFile/UploadedFile.js.map +1 -0
- package/dist/components/UploadedFile/UploadedFile.module.scss.cjs +9 -0
- package/dist/components/UploadedFile/UploadedFile.module.scss.cjs.map +1 -0
- package/dist/components/UploadedFile/UploadedFile.module.scss.js +7 -0
- package/dist/components/UploadedFile/UploadedFile.module.scss.js.map +1 -0
- package/dist/components/UploadedFile/hooks/useFileErrorMessages/index.d.ts +1 -0
- package/dist/components/UploadedFile/hooks/useFileErrorMessages/useFileErrorMessages.cjs +38 -0
- package/dist/components/UploadedFile/hooks/useFileErrorMessages/useFileErrorMessages.cjs.map +1 -0
- package/dist/components/UploadedFile/hooks/useFileErrorMessages/useFileErrorMessages.d.ts +18 -0
- package/dist/components/UploadedFile/hooks/useFileErrorMessages/useFileErrorMessages.js +36 -0
- package/dist/components/UploadedFile/hooks/useFileErrorMessages/useFileErrorMessages.js.map +1 -0
- package/dist/components/UploadedFile/hooks/usePreviewImage/index.d.ts +1 -0
- package/dist/components/UploadedFile/hooks/usePreviewImage/usePreviewImage.cjs +36 -0
- package/dist/components/UploadedFile/hooks/usePreviewImage/usePreviewImage.cjs.map +1 -0
- package/dist/components/UploadedFile/hooks/usePreviewImage/usePreviewImage.d.ts +8 -0
- package/dist/components/UploadedFile/hooks/usePreviewImage/usePreviewImage.js +34 -0
- package/dist/components/UploadedFile/hooks/usePreviewImage/usePreviewImage.js.map +1 -0
- package/dist/components/UploadedFile/index.d.ts +1 -0
- package/dist/components/UploadedFile/utils/convertFileTypeToAcceptedFileType/convertFileTypeToAcceptedFileType.cjs +17 -0
- package/dist/components/UploadedFile/utils/convertFileTypeToAcceptedFileType/convertFileTypeToAcceptedFileType.cjs.map +1 -0
- package/dist/components/UploadedFile/utils/convertFileTypeToAcceptedFileType/convertFileTypeToAcceptedFileType.d.ts +1 -0
- package/dist/components/UploadedFile/utils/convertFileTypeToAcceptedFileType/convertFileTypeToAcceptedFileType.js +15 -0
- package/dist/components/UploadedFile/utils/convertFileTypeToAcceptedFileType/convertFileTypeToAcceptedFileType.js.map +1 -0
- package/dist/components/UploadedFile/utils/convertFileTypeToAcceptedFileType/index.d.ts +1 -0
- package/dist/components/UploadedFile/utils/isImageType/index.d.ts +1 -0
- package/dist/components/UploadedFile/utils/isImageType/isImageType.cjs +14 -0
- package/dist/components/UploadedFile/utils/isImageType/isImageType.cjs.map +1 -0
- package/dist/components/UploadedFile/utils/isImageType/isImageType.d.ts +1 -0
- package/dist/components/UploadedFile/utils/isImageType/isImageType.js +12 -0
- package/dist/components/UploadedFile/utils/isImageType/isImageType.js.map +1 -0
- package/dist/components/ViewsContainer/ViewsContainer.cjs +4 -3
- package/dist/components/ViewsContainer/ViewsContainer.cjs.map +1 -1
- package/dist/components/ViewsContainer/ViewsContainer.js +4 -3
- package/dist/components/ViewsContainer/ViewsContainer.js.map +1 -1
- package/dist/components/ViewsContainer/ViewsContainer.module.scss.cjs +2 -2
- package/dist/components/ViewsContainer/ViewsContainer.module.scss.cjs.map +1 -1
- package/dist/components/ViewsContainer/ViewsContainer.module.scss.js +2 -2
- package/dist/components/ViewsContainer/ViewsContainer.module.scss.js.map +1 -1
- package/dist/components/index.d.ts +3 -1
- package/dist/index.cjs +2 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/components/UploadFile/UploadGraphic.cjs +0 -14
- package/dist/components/UploadFile/UploadGraphic.cjs.map +0 -1
- package/dist/components/UploadFile/UploadGraphic.d.ts +0 -2
- package/dist/components/UploadFile/UploadGraphic.js +0 -8
- package/dist/components/UploadFile/UploadGraphic.js.map +0 -1
- package/dist/components/UploadFile/components/UploadFileErrors/UploadFileErrors.cjs +0 -31
- package/dist/components/UploadFile/components/UploadFileErrors/UploadFileErrors.cjs.map +0 -1
- package/dist/components/UploadFile/components/UploadFileErrors/UploadFileErrors.d.ts +0 -7
- package/dist/components/UploadFile/components/UploadFileErrors/UploadFileErrors.js +0 -25
- package/dist/components/UploadFile/components/UploadFileErrors/UploadFileErrors.js.map +0 -1
- package/dist/components/UploadFile/components/UploadedFile/UploadedFile.cjs +0 -21
- package/dist/components/UploadFile/components/UploadedFile/UploadedFile.cjs.map +0 -1
- package/dist/components/UploadFile/components/UploadedFile/UploadedFile.d.ts +0 -8
- package/dist/components/UploadFile/components/UploadedFile/UploadedFile.js +0 -15
- package/dist/components/UploadFile/components/UploadedFile/UploadedFile.js.map +0 -1
- package/dist/components/UploadFile/components/UploadedFile/styled.cjs +0 -20
- package/dist/components/UploadFile/components/UploadedFile/styled.cjs.map +0 -1
- package/dist/components/UploadFile/components/UploadedFile/styled.d.ts +0 -2
- package/dist/components/UploadFile/components/UploadedFile/styled.js +0 -13
- package/dist/components/UploadFile/components/UploadedFile/styled.js.map +0 -1
- package/dist/components/UploadFile/utils/setInputElFile/setInputElFile.cjs +0 -18
- package/dist/components/UploadFile/utils/setInputElFile/setInputElFile.cjs.map +0 -1
- package/dist/components/UploadFile/utils/setInputElFile/setInputElFile.d.ts +0 -13
- package/dist/components/UploadFile/utils/setInputElFile/setInputElFile.js +0 -16
- package/dist/components/UploadFile/utils/setInputElFile/setInputElFile.js.map +0 -1
|
@@ -1,23 +1,83 @@
|
|
|
1
1
|
var AcceptedFileTypes;
|
|
2
2
|
(function (AcceptedFileTypes) {
|
|
3
|
+
// DATA FILES
|
|
3
4
|
AcceptedFileTypes["CSV"] = ".csv";
|
|
5
|
+
AcceptedFileTypes["JSON"] = ".json";
|
|
6
|
+
AcceptedFileTypes["XML"] = ".xml";
|
|
7
|
+
AcceptedFileTypes["TXT"] = ".txt";
|
|
8
|
+
// DOCUMENTS
|
|
9
|
+
AcceptedFileTypes["PDF"] = ".pdf";
|
|
10
|
+
AcceptedFileTypes["DOC"] = ".doc";
|
|
11
|
+
AcceptedFileTypes["DOCX"] = ".docx";
|
|
12
|
+
AcceptedFileTypes["XLS"] = ".xls";
|
|
13
|
+
AcceptedFileTypes["XLSX"] = ".xlsx";
|
|
14
|
+
AcceptedFileTypes["PPT"] = ".ppt";
|
|
15
|
+
AcceptedFileTypes["PPTX"] = ".pptx";
|
|
16
|
+
AcceptedFileTypes["ODT"] = ".odt";
|
|
17
|
+
AcceptedFileTypes["ODS"] = ".ods";
|
|
18
|
+
AcceptedFileTypes["ODP"] = ".odp";
|
|
19
|
+
AcceptedFileTypes["RTF"] = ".rtf";
|
|
20
|
+
// IMAGES
|
|
4
21
|
AcceptedFileTypes["JPEG"] = ".jpeg";
|
|
5
22
|
AcceptedFileTypes["JPG"] = ".jpg";
|
|
6
|
-
AcceptedFileTypes["GIF"] = ".gif";
|
|
7
23
|
AcceptedFileTypes["PNG"] = ".png";
|
|
24
|
+
AcceptedFileTypes["GIF"] = ".gif";
|
|
25
|
+
AcceptedFileTypes["BMP"] = ".bmp";
|
|
26
|
+
AcceptedFileTypes["WEBP"] = ".webp";
|
|
27
|
+
AcceptedFileTypes["SVG"] = ".svg";
|
|
28
|
+
AcceptedFileTypes["ICO"] = ".ico";
|
|
29
|
+
AcceptedFileTypes["TIFF"] = ".tiff";
|
|
30
|
+
AcceptedFileTypes["TIF"] = ".tif";
|
|
31
|
+
// AUDIO
|
|
32
|
+
AcceptedFileTypes["MP3"] = ".mp3";
|
|
33
|
+
AcceptedFileTypes["WAV"] = ".wav";
|
|
34
|
+
AcceptedFileTypes["OGG"] = ".ogg";
|
|
35
|
+
AcceptedFileTypes["AAC"] = ".aac";
|
|
36
|
+
AcceptedFileTypes["FLAC"] = ".flac";
|
|
37
|
+
AcceptedFileTypes["M4A"] = ".m4a";
|
|
38
|
+
AcceptedFileTypes["WMA"] = ".wma";
|
|
39
|
+
// VIDEO
|
|
40
|
+
AcceptedFileTypes["MP4"] = ".mp4";
|
|
41
|
+
AcceptedFileTypes["AVI"] = ".avi";
|
|
42
|
+
AcceptedFileTypes["MOV"] = ".mov";
|
|
43
|
+
AcceptedFileTypes["WMV"] = ".wmv";
|
|
44
|
+
AcceptedFileTypes["FLV"] = ".flv";
|
|
45
|
+
AcceptedFileTypes["WEBM"] = ".webm";
|
|
46
|
+
AcceptedFileTypes["MKV"] = ".mkv";
|
|
47
|
+
AcceptedFileTypes["M4V"] = ".m4v";
|
|
48
|
+
// ARCHIVES
|
|
49
|
+
AcceptedFileTypes["ZIP"] = ".zip";
|
|
50
|
+
AcceptedFileTypes["RAR"] = ".rar";
|
|
51
|
+
AcceptedFileTypes["SEVEN_Z"] = ".7z";
|
|
52
|
+
AcceptedFileTypes["TAR"] = ".tar";
|
|
53
|
+
AcceptedFileTypes["GZ"] = ".gz";
|
|
8
54
|
})(AcceptedFileTypes || (AcceptedFileTypes = {}));
|
|
9
55
|
var FileSizeUnit;
|
|
10
56
|
(function (FileSizeUnit) {
|
|
11
57
|
FileSizeUnit["KB"] = "KB";
|
|
12
58
|
FileSizeUnit["MB"] = "MB";
|
|
13
59
|
})(FileSizeUnit || (FileSizeUnit = {}));
|
|
14
|
-
var
|
|
15
|
-
(function (
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
60
|
+
var ErrorType;
|
|
61
|
+
(function (ErrorType) {
|
|
62
|
+
ErrorType["critical"] = "CRITICAL";
|
|
63
|
+
ErrorType["warning"] = "WARNING";
|
|
64
|
+
})(ErrorType || (ErrorType = {}));
|
|
65
|
+
var CriticalErrorMessages;
|
|
66
|
+
(function (CriticalErrorMessages) {
|
|
67
|
+
CriticalErrorMessages["INVALID_FORMAT"] = "Invalid format";
|
|
68
|
+
CriticalErrorMessages["FILE_IS_TOO_BIG"] = "File is too big";
|
|
69
|
+
})(CriticalErrorMessages || (CriticalErrorMessages = {}));
|
|
70
|
+
const DEFAULT_MAXIMUM_MULTIPLE_FILES = 10;
|
|
71
|
+
const DEFAULT_MAXIMUM_FILE_BYTES = 1000000;
|
|
72
|
+
var InputErrorStateMessages;
|
|
73
|
+
(function (InputErrorStateMessages) {
|
|
74
|
+
InputErrorStateMessages["VALID"] = "";
|
|
75
|
+
InputErrorStateMessages["INVALID_FORMAT"] = "Please provide a file with a valid format.";
|
|
76
|
+
InputErrorStateMessages["INVALID_FORMATS"] = "Please provide files with a valid format.";
|
|
77
|
+
InputErrorStateMessages["INVALID_SIZE"] = "Please provide file with an acceptable size.";
|
|
78
|
+
InputErrorStateMessages["INVALID_SIZES"] = "Please provide files with an acceptable size.";
|
|
79
|
+
InputErrorStateMessages["INVALID_FORMAT_AND_SIZE"] = "Please provide files with an acceptable size and format.";
|
|
80
|
+
})(InputErrorStateMessages || (InputErrorStateMessages = {}));
|
|
21
81
|
|
|
22
|
-
export { AcceptedFileTypes, FileSizeUnit,
|
|
82
|
+
export { AcceptedFileTypes, CriticalErrorMessages, DEFAULT_MAXIMUM_FILE_BYTES, DEFAULT_MAXIMUM_MULTIPLE_FILES, ErrorType, FileSizeUnit, InputErrorStateMessages };
|
|
23
83
|
//# sourceMappingURL=constants.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sources":["../../../src/components/UploadFile/constants.ts"],"sourcesContent":["export enum AcceptedFileTypes {\n CSV = '.csv',\n JPEG = '.jpeg',\n JPG = '.jpg',\n GIF = '.gif',\n
|
|
1
|
+
{"version":3,"file":"constants.js","sources":["../../../src/components/UploadFile/constants.ts"],"sourcesContent":["export enum AcceptedFileTypes {\n // DATA FILES\n CSV = '.csv',\n JSON = '.json',\n XML = '.xml',\n TXT = '.txt',\n\n // DOCUMENTS\n PDF = '.pdf',\n DOC = '.doc',\n DOCX = '.docx',\n XLS = '.xls',\n XLSX = '.xlsx',\n PPT = '.ppt',\n PPTX = '.pptx',\n ODT = '.odt',\n ODS = '.ods',\n ODP = '.odp',\n RTF = '.rtf',\n\n // IMAGES\n JPEG = '.jpeg',\n JPG = '.jpg',\n PNG = '.png',\n GIF = '.gif',\n BMP = '.bmp',\n WEBP = '.webp',\n SVG = '.svg',\n ICO = '.ico',\n TIFF = '.tiff',\n TIF = '.tif',\n\n // AUDIO\n MP3 = '.mp3',\n WAV = '.wav',\n OGG = '.ogg',\n AAC = '.aac',\n FLAC = '.flac',\n M4A = '.m4a',\n WMA = '.wma',\n\n // VIDEO\n MP4 = '.mp4',\n AVI = '.avi',\n MOV = '.mov',\n WMV = '.wmv',\n FLV = '.flv',\n WEBM = '.webm',\n MKV = '.mkv',\n M4V = '.m4v',\n\n // ARCHIVES\n ZIP = '.zip',\n RAR = '.rar',\n SEVEN_Z = '.7z',\n TAR = '.tar',\n GZ = '.gz',\n}\n\nexport enum FileSizeUnit {\n KB = 'KB',\n MB = 'MB',\n}\n\nexport enum ErrorType {\n critical = 'CRITICAL',\n warning = 'WARNING',\n}\n\nexport enum CriticalErrorMessages {\n INVALID_FORMAT = 'Invalid format',\n FILE_IS_TOO_BIG = 'File is too big',\n}\n\nexport const DEFAULT_MAXIMUM_MULTIPLE_FILES = 10;\n\nexport const DEFAULT_MAXIMUM_FILE_BYTES = 1000000;\n\nexport enum InputErrorStateMessages {\n VALID = '',\n INVALID_FORMAT = 'Please provide a file with a valid format.',\n INVALID_FORMATS = 'Please provide files with a valid format.',\n INVALID_SIZE = 'Please provide file with an acceptable size.',\n INVALID_SIZES = 'Please provide files with an acceptable size.',\n INVALID_FORMAT_AND_S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;AACT,IAAA,YAAA,CAAA,IAAA,CAAA,GAAA,IAAS;AACX,CAAC,EAHW,YAAY,KAAZ,YAAY,GAGvB,EAAA,CAAA,CAAA;IAEW;AAAZ,CAAA,UAAY,SAAS,EAAA;AACnB,IAAA,SAAA,CAAA,UAAA,CAAA,GAAA,UAAqB;AACrB,IAAA,SAAA,CAAA,SAAA,CAAA,GAAA,SAAmB;AACrB,CAAC,EAHW,SAAS,KAAT,SAAS,GAGpB,EAAA,CAAA,CAAA;IAEW;AAAZ,CAAA,UAAY,qBAAqB,EAAA;AAC/B,IAAA,qBAAA,CAAA,gBAAA,CAAA,GAAA,gBAAiC;AACjC,IAAA,qBAAA,CAAA,iBAAA,CAAA,GAAA,iBAAmC;AACrC,CAAC,EAHW,qBAAqB,KAArB,qBAAqB,GAGhC,EAAA,CAAA,CAAA;AAEM,MAAM,8BAA8B,GAAG;AAEvC,MAAM,0BAA0B,GAAG;IAE9B;AAAZ,CAAA,UAAY,uBAAuB,EAAA;AACjC,IAAA,uBAAA,CAAA,OAAA,CAAA,GAAA,EAAU;AACV,IAAA,uBAAA,CAAA,gBAAA,CAAA,GAAA,4CAA6D;AAC7D,IAAA,uBAAA,CAAA,iBAAA,CAAA,GAAA,2CAA6D;AAC7D,IAAA,uBAAA,CAAA,cAAA,CAAA,GAAA,8CAA6D;AAC7D,IAAA,uBAAA,CAAA,eAAA,CAAA,GAAA,+CAA+D;AAC/D,IAAA,uBAAA,CAAA,yBAAA,CAAA,GAAA,0DAAoF;AACtF,CAAC,EAPW,uBAAuB,KAAvB,uBAAuB,GAOlC,EAAA,CAAA,CAAA;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useUploadFile } from './useUploadFile';
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var React = require('react');
|
|
4
|
+
|
|
5
|
+
const useUploadFile = () => {
|
|
6
|
+
const inputRef = React.useRef(null);
|
|
7
|
+
const [fileList, setFileList] = React.useState();
|
|
8
|
+
// Keep inputRef.current.files in sync with fileList
|
|
9
|
+
React.useEffect(() => {
|
|
10
|
+
if (inputRef.current && fileList) {
|
|
11
|
+
// Only update if not already the same (avoid unnecessary assignment)
|
|
12
|
+
if (inputRef.current.files !== fileList) {
|
|
13
|
+
const dt = new DataTransfer();
|
|
14
|
+
Array.from(fileList).forEach((file) => dt.items.add(file));
|
|
15
|
+
inputRef.current.files = dt.files;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
// If fileList is undefined, clear the input
|
|
19
|
+
if (inputRef.current && !fileList) {
|
|
20
|
+
inputRef.current.value = '';
|
|
21
|
+
}
|
|
22
|
+
}, [fileList, inputRef]);
|
|
23
|
+
// Restores the previous file selection when user cancels the file dialog
|
|
24
|
+
const onCancel = React.useCallback(() => {
|
|
25
|
+
// If there are no existing files to restore, just return
|
|
26
|
+
if (!fileList || fileList.length === 0)
|
|
27
|
+
return;
|
|
28
|
+
const newFileList = new DataTransfer();
|
|
29
|
+
Array.from(fileList).forEach((file) => newFileList.items.add(file));
|
|
30
|
+
if (inputRef === null || inputRef === undefined ? undefined : inputRef.current) {
|
|
31
|
+
inputRef.current.files = newFileList.files;
|
|
32
|
+
}
|
|
33
|
+
}, [fileList]);
|
|
34
|
+
const removeFileFromList = React.useCallback((fileToRemove) => {
|
|
35
|
+
if (!fileList)
|
|
36
|
+
return;
|
|
37
|
+
const newFileList = new DataTransfer();
|
|
38
|
+
Array.from(fileList).forEach((file) => {
|
|
39
|
+
if (file.name === fileToRemove.name)
|
|
40
|
+
return; // Skip this file (remove it)
|
|
41
|
+
newFileList.items.add(file);
|
|
42
|
+
});
|
|
43
|
+
if (inputRef === null || inputRef === undefined ? undefined : inputRef.current) {
|
|
44
|
+
inputRef.current.files = newFileList.files;
|
|
45
|
+
}
|
|
46
|
+
setFileList(newFileList.files);
|
|
47
|
+
}, [fileList]);
|
|
48
|
+
const clearFileSelection = React.useCallback(() => {
|
|
49
|
+
var _a;
|
|
50
|
+
if ((_a = inputRef.current) === null || _a === undefined ? undefined : _a.value)
|
|
51
|
+
inputRef.current.value = '';
|
|
52
|
+
setFileList(undefined);
|
|
53
|
+
}, []);
|
|
54
|
+
return {
|
|
55
|
+
clearFileSelection,
|
|
56
|
+
inputRef,
|
|
57
|
+
onCancel,
|
|
58
|
+
removeFileFromList,
|
|
59
|
+
setFileList,
|
|
60
|
+
fileList,
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
exports.useUploadFile = useUploadFile;
|
|
65
|
+
//# sourceMappingURL=useUploadFile.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useUploadFile.cjs","sources":["../../../../../src/components/UploadFile/hooks/useUploadFile/useUploadFile.ts"],"sourcesContent":["import { useCallback, useEffect, useRef, useState } from 'react';\n\nexport const useUploadFile = () => {\n const inputRef = useRef<HTMLInputElement | null>(null);\n\n const [fileList, setFileList] = useState<FileList>();\n\n // Keep inputRef.current.files in sync with fileList\n useEffect(() => {\n if (inputRef.current && fileList) {\n // Only update if not already the same (avoid unnecessary assignment)\n if (inputRef.current.files !== fileList) {\n const dt = new DataTransfer();\n Array.from(fileList).forEach((file) => dt.items.add(file));\n inputRef.current.files = dt.files;\n }\n }\n // If fileList is undefined, clear the input\n if (inputRef.current && !fileList) {\n inputRef.current.value = '';\n }\n }, [fileList, inputRef]);\n\n // Restores the previous file selection when user cancels the file dialog\n const onCancel = useCallback(() => {\n // If there are no existing files to restore, just return\n if (!fileList || fileList.length === 0) return;\n\n const newFileList = new DataTransfer();\n Array.from(fileList).forEach((file) => newFileList.items.add(file));\n\n if (inputRef?.current) {\n inputRef.current.files = newFileList.files;\n }\n }, [fileList]);\n\n const removeFileFromList = useCallback(\n (fileToRemove: File) => {\n if (!fileList) return;\n\n const newFileList = new DataTransfer();\n Array.from(fileList).forEach((file) => {\n if (file.name === fileToRemove.name) return; // Skip this file (remove it)\n newFileList.items.add(file);\n });\n\n if (inputRef?.current) {\n inputRef.current.files = newFileList.files;\n }\n setFileList(newFileList.files);\n },\n [fileList],\n );\n\n const clearFileSelection = useCallback(() => {\n if (inputRef.current?.value) inputRef.current.value = '';\n setFileList(undefined);\n }, []);\n\n return {\n clearFileSelection,\n inputRef,\n onCancel,\n removeFileFromList,\n setFileList,\n fileList,\n };\n};\n"],"names":["useRef","useState","useEffect","useCallback"],"mappings":";;;;AAEO,MAAM,aAAa,GAAG,MAAK;AAChC,IAAA,MAAM,QAAQ,GAAGA,YAAM,CAA0B,IAAI,CAAC;IAEtD,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAGC,cAAQ,EAAY;;IAGpDC,eAAS,CAAC,MAAK;AACb,QAAA,IAAI,QAAQ,CAAC,OAAO,IAAI,QAAQ,EAAE;;AAEhC,YAAA,IAAI,QAAQ,CAAC,OAAO,CAAC,KAAK,KAAK,QAAQ,EAAE;AACvC,gBAAA,MAAM,EAAE,GAAG,IAAI,YAAY,EAAE;gBAC7B,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,KAAK,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;gBAC1D,QAAQ,CAAC,OAAO,CAAC,KAAK,GAAG,EAAE,CAAC,KAAK;AAClC;AACF;;AAED,QAAA,IAAI,QAAQ,CAAC,OAAO,IAAI,CAAC,QAAQ,EAAE;AACjC,YAAA,QAAQ,CAAC,OAAO,CAAC,KAAK,GAAG,EAAE;AAC5B;AACH,KAAC,EAAE,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;;AAGxB,IAAA,MAAM,QAAQ,GAAGC,iBAAW,CAAC,MAAK;;AAEhC,QAAA,IAAI,CAAC,QAAQ,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC;YAAE;AAExC,QAAA,MAAM,WAAW,GAAG,IAAI,YAAY,EAAE;QACtC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,O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;AACH;;;;"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const useUploadFile: () => {
|
|
3
|
+
clearFileSelection: () => void;
|
|
4
|
+
inputRef: import("react").MutableRefObject<HTMLInputElement | null>;
|
|
5
|
+
onCancel: () => void;
|
|
6
|
+
removeFileFromList: (fileToRemove: File) => void;
|
|
7
|
+
setFileList: import("react").Dispatch<import("react").SetStateAction<FileList | undefined>>;
|
|
8
|
+
fileList: FileList | undefined;
|
|
9
|
+
};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { useRef, useState, useEffect, useCallback } from 'react';
|
|
2
|
+
|
|
3
|
+
const useUploadFile = () => {
|
|
4
|
+
const inputRef = useRef(null);
|
|
5
|
+
const [fileList, setFileList] = useState();
|
|
6
|
+
// Keep inputRef.current.files in sync with fileList
|
|
7
|
+
useEffect(() => {
|
|
8
|
+
if (inputRef.current && fileList) {
|
|
9
|
+
// Only update if not already the same (avoid unnecessary assignment)
|
|
10
|
+
if (inputRef.current.files !== fileList) {
|
|
11
|
+
const dt = new DataTransfer();
|
|
12
|
+
Array.from(fileList).forEach((file) => dt.items.add(file));
|
|
13
|
+
inputRef.current.files = dt.files;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
// If fileList is undefined, clear the input
|
|
17
|
+
if (inputRef.current && !fileList) {
|
|
18
|
+
inputRef.current.value = '';
|
|
19
|
+
}
|
|
20
|
+
}, [fileList, inputRef]);
|
|
21
|
+
// Restores the previous file selection when user cancels the file dialog
|
|
22
|
+
const onCancel = useCallback(() => {
|
|
23
|
+
// If there are no existing files to restore, just return
|
|
24
|
+
if (!fileList || fileList.length === 0)
|
|
25
|
+
return;
|
|
26
|
+
const newFileList = new DataTransfer();
|
|
27
|
+
Array.from(fileList).forEach((file) => newFileList.items.add(file));
|
|
28
|
+
if (inputRef === null || inputRef === undefined ? undefined : inputRef.current) {
|
|
29
|
+
inputRef.current.files = newFileList.files;
|
|
30
|
+
}
|
|
31
|
+
}, [fileList]);
|
|
32
|
+
const removeFileFromList = useCallback((fileToRemove) => {
|
|
33
|
+
if (!fileList)
|
|
34
|
+
return;
|
|
35
|
+
const newFileList = new DataTransfer();
|
|
36
|
+
Array.from(fileList).forEach((file) => {
|
|
37
|
+
if (file.name === fileToRemove.name)
|
|
38
|
+
return; // Skip this file (remove it)
|
|
39
|
+
newFileList.items.add(file);
|
|
40
|
+
});
|
|
41
|
+
if (inputRef === null || inputRef === undefined ? undefined : inputRef.current) {
|
|
42
|
+
inputRef.current.files = newFileList.files;
|
|
43
|
+
}
|
|
44
|
+
setFileList(newFileList.files);
|
|
45
|
+
}, [fileList]);
|
|
46
|
+
const clearFileSelection = useCallback(() => {
|
|
47
|
+
var _a;
|
|
48
|
+
if ((_a = inputRef.current) === null || _a === undefined ? undefined : _a.value)
|
|
49
|
+
inputRef.current.value = '';
|
|
50
|
+
setFileList(undefined);
|
|
51
|
+
}, []);
|
|
52
|
+
return {
|
|
53
|
+
clearFileSelection,
|
|
54
|
+
inputRef,
|
|
55
|
+
onCancel,
|
|
56
|
+
removeFileFromList,
|
|
57
|
+
setFileList,
|
|
58
|
+
fileList,
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
export { useUploadFile };
|
|
63
|
+
//# sourceMappingURL=useUploadFile.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useUploadFile.js","sources":["../../../../../src/components/UploadFile/hooks/useUploadFile/useUploadFile.ts"],"sourcesContent":["import { useCallback, useEffect, useRef, useState } from 'react';\n\nexport const useUploadFile = () => {\n const inputRef = useRef<HTMLInputElement | null>(null);\n\n const [fileList, setFileList] = useState<FileList>();\n\n // Keep inputRef.current.files in sync with fileList\n useEffect(() => {\n if (inputRef.current && fileList) {\n // Only update if not already the same (avoid unnecessary assignment)\n if (inputRef.current.files !== fileList) {\n const dt = new DataTransfer();\n Array.from(fileList).forEach((file) => dt.items.add(file));\n inputRef.current.files = dt.files;\n }\n }\n // If fileList is undefined, clear the input\n if (inputRef.current && !fileList) {\n inputRef.current.value = '';\n }\n }, [fileList, inputRef]);\n\n // Restores the previous file selection when user cancels the file dialog\n const onCancel = useCallback(() => {\n // If there are no existing files to restore, just return\n if (!fileList || fileList.length === 0) return;\n\n const newFileList = new DataTransfer();\n Array.from(fileList).forEach((file) => newFileList.items.add(file));\n\n if (inputRef?.current) {\n inputRef.current.files = newFileList.files;\n }\n }, [fileList]);\n\n const removeFileFromList = useCallback(\n (fileToRemove: File) => {\n if (!fileList) return;\n\n const newFileList = new DataTransfer();\n Array.from(fileList).forEach((file) => {\n if (file.name === fileToRemove.name) return; // Skip this file (remove it)\n newFileList.items.add(file);\n });\n\n if (inputRef?.current) {\n inputRef.current.files = newFileList.files;\n }\n setFileList(newFileList.files);\n },\n [fileList],\n );\n\n const clearFileSelection = useCallback(() => {\n if (inputRef.current?.value) inputRef.current.value = '';\n setFileList(undefined);\n }, []);\n\n return {\n clearFileSelection,\n inputRef,\n onCancel,\n removeFileFromList,\n setFileList,\n fileList,\n };\n};\n"],"names":[],"mappings":";;AAEO,MAAM,aAAa,GAAG,MAAK;AAChC,IAAA,MAAM,QAAQ,GAAG,MAAM,CAA0B,IAAI,CAAC;IAEtD,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,QAAQ,EAAY;;IAGpD,SAAS,CAAC,MAAK;AACb,QAAA,IAAI,QAAQ,CAAC,OAAO,IAAI,QAAQ,EAAE;;AAEhC,YAAA,IAAI,QAAQ,CAAC,OAAO,CAAC,KAAK,KAAK,QAAQ,EAAE;AACvC,gBAAA,MAAM,EAAE,GAAG,IAAI,YAAY,EAAE;gBAC7B,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,KAAK,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;gBAC1D,QAAQ,CAAC,OAAO,CAAC,KAAK,GAAG,EAAE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AAC,KAAK;AAC3C;AACD,QAAA,WAAW,CAAC,WAAW,CAAC,KAAK,CAAC;AAChC,KAAC,EACD,CAAC,QAAQ,CAAC,CACX;AAED,IAAA,MAAM,kBAAkB,GAAG,WAAW,CAAC,MAAK;;AAC1C,QAAA,IAAI,CAAA,EAAA,GAAA,QAAQ,CAAC,OAAO,gDAAE,KAAK;AAAE,YAAA,QAAQ,CAAC,OAAO,CAAC,KAAK,GAAG,EAAE;QACxD,WAAW,CAAC,SAAS,CAAC;KACvB,EAAE,EAAE,CAAC;IAEN,OAAO;QACL,kBAAkB;QAClB,QAAQ;QACR,QAAQ;QACR,kBAAkB;QAClB,WAAW;QACX,QAAQ;KACT;AACH;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useValidateInput } from './useValidateInput';
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var React = require('react');
|
|
4
|
+
var constants = require('../../constants.cjs');
|
|
5
|
+
var getErrorMessage = require('../../utils/getErrorMessage/getErrorMessage.cjs');
|
|
6
|
+
|
|
7
|
+
const useValidateInput = ({ fileList, fileTypes, inputRef, maxBytes, errorMessage: customErrorMessage, }) => {
|
|
8
|
+
// Tracks error states within the input element itself, using preset
|
|
9
|
+
// error messages and assigns these to the input component based on the file
|
|
10
|
+
const setInputValidation = React.useCallback(() => {
|
|
11
|
+
var _a, _b, _c, _d;
|
|
12
|
+
let errorMessage = customErrorMessage || constants.InputErrorStateMessages.VALID;
|
|
13
|
+
if (!((_b = (_a = inputRef.current) === null || _a === undefined ? undefined : _a.files) === null || _b === undefined ? undefined : _b.length)) {
|
|
14
|
+
(_c = inputRef.current) === null || _c === undefined ? undefined : _c.setCustomValidity(errorMessage);
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
const results = {
|
|
18
|
+
numberOfInvalidFormatFiles: 0,
|
|
19
|
+
numberOfInvalidSizeFiles: 0,
|
|
20
|
+
totalFiles: inputRef.current.files.length,
|
|
21
|
+
};
|
|
22
|
+
Array.from(inputRef.current.files).forEach((file) => {
|
|
23
|
+
// Check file size
|
|
24
|
+
if (file.size > maxBytes) {
|
|
25
|
+
results.numberOfInvalidSizeFiles += 1;
|
|
26
|
+
}
|
|
27
|
+
// Check file type/format
|
|
28
|
+
const [, extension] = file.type.split('/');
|
|
29
|
+
const isTypeValid = fileTypes.find((validType) => validType.substring(1) === extension);
|
|
30
|
+
if (!isTypeValid) {
|
|
31
|
+
results.numberOfInvalidFormatFiles += 1;
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
// Determine appropriate error message based on validation results
|
|
35
|
+
const hasFormatErrors = results.numberOfInvalidFormatFiles > 0;
|
|
36
|
+
const hasSizeErrors = results.numberOfInvalidSizeFiles > 0;
|
|
37
|
+
const isSingleFile = results.totalFiles === 1;
|
|
38
|
+
errorMessage = getErrorMessage.getErrorMessage({ hasFormatErrors, hasSizeErrors, isSingleFile });
|
|
39
|
+
(_d = inputRef.current) === null || _d === undefined ? undefined : _d.setCustomValidity(errorMessage);
|
|
40
|
+
}, [customErrorMessage, inputRef, maxBytes, fileTypes]);
|
|
41
|
+
// Validate input whenever fileList changes
|
|
42
|
+
React.useEffect(() => {
|
|
43
|
+
setInputValidation();
|
|
44
|
+
}, [fileList, setInputValidation, customErrorMessage]);
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
exports.useValidateInput = useValidateInput;
|
|
48
|
+
//# sourceMappingURL=useValidateInput.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useValidateInput.cjs","sources":["../../../../../src/components/UploadFile/hooks/useValidateInput/useValidateInput.ts"],"sourcesContent":["import { useEffect, useCallback } from 'react';\nimport { AcceptedFileTypes, InputErrorStateMessages } from '../../constants';\nimport { getErrorMessage } from '../../utils/getErrorMessage';\n\ntype UseValidateInputProps = {\n fileTypes: Array<AcceptedFileTypes>;\n maxBytes: number;\n fileList: FileList | undefined;\n inputRef: React.MutableRefObject<HTMLInputElement | null>;\n errorMessage?: string;\n};\n\nexport const useValidateInput = ({\n fileList,\n fileTypes,\n inputRef,\n maxBytes,\n errorMessage: customErrorMessage,\n}: UseValidateInputProps) => {\n // Tracks error states within the input element itself, using preset\n // error messages and assigns these to the input component based on the file\n const setInputValidation = useCallback(() => {\n let errorMessage = customErrorMessage || InputErrorStateMessages.VALID;\n\n if (!inputRef.current?.files?.length) {\n inputRef.current?.setCustomValidity(errorMessage);\n return;\n }\n\n const results = {\n numberOfInvalidFormatFiles: 0,\n numberOfInvalidSizeFiles: 0,\n totalFiles: inputRef.current.files.length,\n };\n\n Array.from(inputRef.current.files).forEach((file) => {\n // Check file size\n if (file.size > maxBytes) {\n results.numberOfInvalidSizeFiles += 1;\n }\n\n // Check file type/format\n const [, extension] = file.type.split('/');\n const isTypeValid = fileTypes.find((validType) => validType.substring(1) === extension);\n if (!isTypeValid) {\n results.numberOfInvalidFormatFiles += 1;\n }\n });\n\n // Determine appropriate error message based on validation results\n const hasFormatErrors = results.numberOfInvalidFormatFiles > 0;\n const hasSizeErrors = results.numberOfInvalidSizeFiles > 0;\n const isSingleFile = results.totalFiles === 1;\n\n errorMessage = getErrorMessage({ hasFormatErrors, hasSizeErrors, isSingleFile });\n\n inputRef.current?.setCustomValidity(errorMessage);\n }, [customErrorMessage, inputRef, maxBytes, fileTypes]);\n\n // Validate input whenever fileList changes\n useEffect(() => {\n setInputValidation();\n }, [fileList, setInputValidation, customErrorMessage]);\n};\n"],"names":["useCallback","InputErrorStateMessages","getErrorMessage","useEffect"],"mappings":";;;;;;AAYa,MAAA,gBAAgB,GAAG,CAAC,EAC/B,QAAQ,EACR,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,YAAY,EAAE,kBAAkB,GACV,KAAI;;;AAG1B,IAAA,MAAM,kBAAkB,GAAGA,iBAAW,CAAC,MAAK;;AAC1C,QAAA,IAAI,YAAY,GAAG,kBAAkB,IAAIC,iCAAuB,CAAC,KAAK;AAEtE,QAA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AO,CAAC,UAAU,KAAK,CAAC;QAE7C,YAAY,GAAGC,+BAAe,CAAC,EAAE,eAAe,EAAE,aAAa,EAAE,YAAY,EAAE,CAAC;QAEhF,CAAA,EAAA,GAAA,QAAQ,CAAC,OAAO,MAAA,IAAA,IAAA,EAAA,KAAA,SAAA,GAAA,SAAA,GAAA,EAAA,CAAE,iBAAiB,CAAC,YAAY,CAAC;KAClD,EAAE,CAAC,kBAAkB,EAAE,QAAQ,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC;;IAGvDC,eAAS,CAAC,MAAK;AACb,QAAA,kBAAkB,EAAE;KACrB,EAAE,CAAC,QAAQ,EAAE,kBAAkB,EAAE,kBAAkB,CAAC,CAAC;AACxD;;;;"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { AcceptedFileTypes } from '../../constants';
|
|
3
|
+
type UseValidateInputProps = {
|
|
4
|
+
fileTypes: Array<AcceptedFileTypes>;
|
|
5
|
+
maxBytes: number;
|
|
6
|
+
fileList: FileList | undefined;
|
|
7
|
+
inputRef: React.MutableRefObject<HTMLInputElement | null>;
|
|
8
|
+
errorMessage?: string;
|
|
9
|
+
};
|
|
10
|
+
export declare const useValidateInput: ({ fileList, fileTypes, inputRef, maxBytes, errorMessage: customErrorMessage, }: UseValidateInputProps) => void;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { useCallback, useEffect } from 'react';
|
|
2
|
+
import { InputErrorStateMessages } from '../../constants.js';
|
|
3
|
+
import { getErrorMessage } from '../../utils/getErrorMessage/getErrorMessage.js';
|
|
4
|
+
|
|
5
|
+
const useValidateInput = ({ fileList, fileTypes, inputRef, maxBytes, errorMessage: customErrorMessage, }) => {
|
|
6
|
+
// Tracks error states within the input element itself, using preset
|
|
7
|
+
// error messages and assigns these to the input component based on the file
|
|
8
|
+
const setInputValidation = useCallback(() => {
|
|
9
|
+
var _a, _b, _c, _d;
|
|
10
|
+
let errorMessage = customErrorMessage || InputErrorStateMessages.VALID;
|
|
11
|
+
if (!((_b = (_a = inputRef.current) === null || _a === undefined ? undefined : _a.files) === null || _b === undefined ? undefined : _b.length)) {
|
|
12
|
+
(_c = inputRef.current) === null || _c === undefined ? undefined : _c.setCustomValidity(errorMessage);
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
const results = {
|
|
16
|
+
numberOfInvalidFormatFiles: 0,
|
|
17
|
+
numberOfInvalidSizeFiles: 0,
|
|
18
|
+
totalFiles: inputRef.current.files.length,
|
|
19
|
+
};
|
|
20
|
+
Array.from(inputRef.current.files).forEach((file) => {
|
|
21
|
+
// Check file size
|
|
22
|
+
if (file.size > maxBytes) {
|
|
23
|
+
results.numberOfInvalidSizeFiles += 1;
|
|
24
|
+
}
|
|
25
|
+
// Check file type/format
|
|
26
|
+
const [, extension] = file.type.split('/');
|
|
27
|
+
const isTypeValid = fileTypes.find((validType) => validType.substring(1) === extension);
|
|
28
|
+
if (!isTypeValid) {
|
|
29
|
+
results.numberOfInvalidFormatFiles += 1;
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
// Determine appropriate error message based on validation results
|
|
33
|
+
const hasFormatErrors = results.numberOfInvalidFormatFiles > 0;
|
|
34
|
+
const hasSizeErrors = results.numberOfInvalidSizeFiles > 0;
|
|
35
|
+
const isSingleFile = results.totalFiles === 1;
|
|
36
|
+
errorMessage = getErrorMessage({ hasFormatErrors, hasSizeErrors, isSingleFile });
|
|
37
|
+
(_d = inputRef.current) === null || _d === undefined ? undefined : _d.setCustomValidity(errorMessage);
|
|
38
|
+
}, [customErrorMessage, inputRef, maxBytes, fileTypes]);
|
|
39
|
+
// Validate input whenever fileList changes
|
|
40
|
+
useEffect(() => {
|
|
41
|
+
setInputValidation();
|
|
42
|
+
}, [fileList, setInputValidation, customErrorMessage]);
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export { useValidateInput };
|
|
46
|
+
//# sourceMappingURL=useValidateInput.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useValidateInput.js","sources":["../../../../../src/components/UploadFile/hooks/useValidateInput/useValidateInput.ts"],"sourcesContent":["import { useEffect, useCallback } from 'react';\nimport { AcceptedFileTypes, InputErrorStateMessages } from '../../constants';\nimport { getErrorMessage } from '../../utils/getErrorMessage';\n\ntype UseValidateInputProps = {\n fileTypes: Array<AcceptedFileTypes>;\n maxBytes: number;\n fileList: FileList | undefined;\n inputRef: React.MutableRefObject<HTMLInputElement | null>;\n errorMessage?: string;\n};\n\nexport const useValidateInput = ({\n fileList,\n fileTypes,\n inputRef,\n maxBytes,\n errorMessage: customErrorMessage,\n}: UseValidateInputProps) => {\n // Tracks error states within the input element itself, using preset\n // error messages and assigns these to the input component based on the file\n const setInputValidation = useCallback(() => {\n let errorMessage = customErrorMessage || InputErrorStateMessages.VALID;\n\n if (!inputRef.current?.files?.length) {\n inputRef.current?.setCustomValidity(errorMessage);\n return;\n }\n\n const results = {\n numberOfInvalidFormatFiles: 0,\n numberOfInvalidSizeFiles: 0,\n totalFiles: inputRef.current.files.length,\n };\n\n Array.from(inputRef.current.files).forEach((file) => {\n // Check file size\n if (file.size > maxBytes) {\n results.numberOfInvalidSizeFiles += 1;\n }\n\n // Check file type/format\n const [, extension] = file.type.split('/');\n const isTypeValid = fileTypes.find((validType) => validType.substring(1) === extension);\n if (!isTypeValid) {\n results.numberOfInvalidFormatFiles += 1;\n }\n });\n\n // Determine appropriate error message based on validation results\n const hasFormatErrors = results.numberOfInvalidFormatFiles > 0;\n const hasSizeErrors = results.numberOfInvalidSizeFiles > 0;\n const isSingleFile = results.totalFiles === 1;\n\n errorMessage = getErrorMessage({ hasFormatErrors, hasSizeErrors, isSingleFile });\n\n inputRef.current?.setCustomValidity(errorMessage);\n }, [customErrorMessage, inputRef, maxBytes, fileTypes]);\n\n // Validate input whenever fileList changes\n useEffect(() => {\n setInputValidation();\n }, [fileList, setInputValidation, customErrorMessage]);\n};\n"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S,CAAC;YACvF,IAAI,CAAC,WAAW,EAAE;AAChB,gBAAA,OAAO,CAAC,0BAA0B,IAAI,CAAC;AACxC;AACH,SAAC,CAAC;;AAGF,QAAA,MAAM,eAAe,GAAG,OAAO,CAAC,0BAA0B,GAAG,CAAC;AAC9D,QAAA,MAAM,aAAa,GAAG,OAAO,CAAC,wBAAwB,GAAG,CAAC;AAC1D,QAAA,MAAM,YAAY,GAAG,OAAO,CAAC,UAAU,KAAK,CAAC;QAE7C,YAAY,GAAG,eAAe,CAAC,EAAE,eAAe,EAAE,aAAa,EAAE,YAAY,EAAE,CAAC;QAEhF,CAAA,EAAA,GAAA,QAAQ,CAAC,OAAO,MAAA,IAAA,IAAA,EAAA,KAAA,SAAA,GAAA,SAAA,GAAA,EAAA,CAAE,iBAAiB,CAAC,YAAY,CAAC;KAClD,EAAE,CAAC,kBAAkB,EAAE,QAAQ,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC;;IAGvD,SAAS,CAAC,MAAK;AACb,QAAA,kBAAkB,EAAE;KACrB,EAAE,CAAC,QAAQ,EAAE,kBAAkB,EAAE,kBAAkB,CAAC,CAAC;AACxD;;;;"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/// <reference types="jest" />
|
|
2
|
+
export declare const mockUseRemoveUploadFile: () => {
|
|
3
|
+
mockRemoveFileFromList: jest.Mock<any, any, any>;
|
|
4
|
+
};
|
|
5
|
+
export declare const mockUseUploadFile: () => {
|
|
6
|
+
mockRemoveFileFromList: jest.Mock<any, any, any>;
|
|
7
|
+
mockClearFileSelection: jest.Mock<any, any, any>;
|
|
8
|
+
mockInputRef: {
|
|
9
|
+
current: null;
|
|
10
|
+
};
|
|
11
|
+
mockOnCancel: jest.Mock<any, any, any>;
|
|
12
|
+
mockSetFileList: jest.Mock<any, any, any>;
|
|
13
|
+
mockFileList: undefined;
|
|
14
|
+
};
|
|
@@ -4,7 +4,6 @@ type MockHelperProps = {
|
|
|
4
4
|
};
|
|
5
5
|
export declare const mockDrop: ({ file, label }: MockHelperProps) => void;
|
|
6
6
|
export declare const mockDragOver: ({ file, label }: MockHelperProps) => void;
|
|
7
|
-
export declare const getDefaultInput: () =>
|
|
7
|
+
export declare const getDefaultInput: () => HTMLInputElement;
|
|
8
8
|
export declare const getStyledDropzoneContainer: () => HTMLElement;
|
|
9
|
-
export declare const getUploadGraphic: () => HTMLElement;
|
|
10
9
|
export {};
|
|
@@ -9,7 +9,46 @@ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'defau
|
|
|
9
9
|
|
|
10
10
|
var styled__default = /*#__PURE__*/_interopDefaultCompat(styled);
|
|
11
11
|
|
|
12
|
-
const DropZoneContainer = styled__default.default.div.withConfig({ displayName: "vui--DropZoneContainer", componentId: "vui--17v0v3c" }) `display:flex;align-items:center;justify-content:center;padding:${sizes.sizes.
|
|
12
|
+
const DropZoneContainer = styled__default.default.div.withConfig({ displayName: "vui--DropZoneContainer", componentId: "vui--17v0v3c" }) `display:flex;align-items:center;justify-content:center;padding:${sizes.sizes.base};border-radius:${radius.radius.base};input[type='file']{position:absolute;opacity:0;width:1px;height:1px;cursor:pointer;}cursor:pointer;border:2px dashed ${colors.colors.neutral.ink.lightest};background-color:${colors.colors.neutral.grey.lightest};:hover{border:2px dashed ${colors.colors.secondary.blue.base};background-color:${colors.colors.secondary.blue.lightest};svg{color:${colors.colors.secondary.blue.base};}}:active,:focus-within{border:2px dashed ${colors.colors.secondary.blue.base};box-shadow:0 0 0 4px ${colors.colors.secondary.blue.light};background-color:${colors.colors.secondary.blue.lightest};svg{color:${colors.colors.secondary.blue.base};}}${({ isDragOver }) => isDragOver &&
|
|
13
|
+
`
|
|
14
|
+
border: 2px dashed ${colors.colors.secondary.blue.base};
|
|
15
|
+
box-shadow: 0 0 0 4px ${colors.colors.secondary.blue.light};
|
|
16
|
+
background-color: ${colors.colors.secondary.blue.lightest};
|
|
17
|
+
|
|
18
|
+
svg {
|
|
19
|
+
color: ${colors.colors.secondary.blue.base};
|
|
20
|
+
}
|
|
21
|
+
`} ${({ hasError, isDragOver }) => hasError &&
|
|
22
|
+
`
|
|
23
|
+
border: 2px dashed ${colors.colors.secondary.red.base};
|
|
24
|
+
|
|
25
|
+
:hover {
|
|
26
|
+
border: 2px dashed ${colors.colors.secondary.red.base};
|
|
27
|
+
background-color: ${colors.colors.secondary.red.lightest};
|
|
28
|
+
|
|
29
|
+
svg {
|
|
30
|
+
color: ${colors.colors.secondary.red.base};
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
:active, :focus-within {
|
|
35
|
+
border: 2px dashed ${colors.colors.secondary.red.base};
|
|
36
|
+
box-shadow: 0 0 0 4px ${colors.colors.secondary.red.light};
|
|
37
|
+
background-color: ${colors.colors.secondary.red.lightest};
|
|
38
|
+
|
|
39
|
+
svg {
|
|
40
|
+
color: ${colors.colors.secondary.red.base};
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
${isDragOver
|
|
45
|
+
? `
|
|
46
|
+
border: 2px dashed ${colors.colors.secondary.red.base};
|
|
47
|
+
box-shadow: 0 0 0 4px ${colors.colors.secondary.red.light};
|
|
48
|
+
background-color: ${colors.colors.secondary.red.lightest};
|
|
49
|
+
`
|
|
50
|
+
: ''}
|
|
51
|
+
`} &:has(input:disabled){cursor:not-allowed;box-shadow:none;background-color:${colors.colors.neutral.grey.light};border-color:${colors.colors.neutral.ink.lightest};color:${colors.colors.neutral.ink.light};svg{color:${colors.colors.neutral.ink.lightest};}}`;
|
|
13
52
|
|
|
14
53
|
exports.DropZoneContainer = DropZoneContainer;
|
|
15
54
|
//# sourceMappingURL=styled.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styled.cjs","sources":["../../../src/components/UploadFile/styled.tsx"],"sourcesContent":["import styled from 'styled-components';\nimport { colors } from '../../theme/modules/colors';\nimport { radius } from '../../theme/modules/radius';\nimport { sizes } from '../../theme/modules/sizes';\n\nexport const DropZoneContainer = styled.div
|
|
1
|
+
{"version":3,"file":"styled.cjs","sources":["../../../src/components/UploadFile/styled.tsx"],"sourcesContent":["import styled from 'styled-components';\nimport { colors } from '../../theme/modules/colors';\nimport { radius } from '../../theme/modules/radius';\nimport { sizes } from '../../theme/modules/sizes';\n\nexport const DropZoneContainer = styled.div<{\n hasError: boolean;\n isDragOver?: boolean;\n}>`\n display: flex;\n align-items: center;\n justify-content: center;\n\n padding: ${sizes.base};\n border-radius: ${radius.base};\n\n input[type='file'] {\n position: absolute;\n opacity: 0;\n width: 1px;\n height: 1px;\n cursor: pointer;\n }\n\n cursor: pointer;\n\n border: 2px dashed ${colors.neutral.ink.lightest};\n background-color: ${colors.neutral.grey.lightest};\n\n :hover {\n border: 2px dashed ${colors.secondary.blue.base};\n background-color: ${colors.secondary.blue.lightest};\n\n svg {\n color: ${colors.secondary.blue.base};\n }\n }\n :active,\n :focus-within {\n border: 2px dashed ${colors.secondary.blue.base};\n box-shadow: 0 0 0 4px ${colors.secondary.blue.light};\n background-color: ${colors.secondary.blue.lightest};\n\n svg {\n color: ${colors.secondary.blue.base};\n }\n }\n\n ${({ isDragOver }) =>\n isDragOver &&\n `\n border: 2px dashed ${colors.secondary.blue.base};\n box-shadow: 0 0 0 4px ${colors.secondary.blue.light};\n background-color: ${colors.secondary.blue.lightest};\n\n svg {\n color: ${colors.secondary.blue.base};\n }\n `}\n\n ${({ hasError, isDragOver }) =>\n hasError &&\n `\n border: 2px dashed ${colors.secondary.red.base};\n\n :hover {\n border: 2px dashed ${colors.secondary.red.base};\n background-color: ${colors.secondary.red.lightest};\n\n svg {\n color: ${colors.secondary.red.base};\n }\n }\n\n :active, :focus-within {\n border: 2px dashed ${colors.secondary.red.base};\n box-shadow: 0 0 0 4px ${colors.secondary.red.light};\n background-color: ${colors.secondary.red.lightest};\n\n svg {\n color: ${colors.secondary.red.base};\n }\n }\n\n ${\n isDragOver\n ? `\n border: 2px dashed ${colors.secondary.red.base};\n box-shadow: 0 0 0 4px ${colors.secondary.red.light};\n background-color: ${colors.secondary.red.lightest};\n `\n : ''\n }\n `}\n\n\n &:has(input:disabled) {\n cursor: not-allowed;\n box-shadow: none;\n background-color: ${colors.neutral.grey.light};\n border-color: ${colors.neutral.ink.lightest};\n color: ${colors.neutral.ink.light};\n\n svg {\n color: ${colors.neutral.ink.lightest};\n }\n }\n`;\n"],"names":["styled","sizes","radius","colors"],"mappings":";;;;;;;;;;;MAKa,iBAAiB,GAAGA,uBAAM,CAAC,GAAG,sJAQ9BC,WAAK,CAAC,IAAI,CACJ,eAAA,EAAAC,aAAM,CAAC,IAAI,CAAA,sHAAA,EAYPC,aAAM,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,CAC5B,kBAAA,EAAAA,aAAM,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,6BAGzBA,aAAM,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAA,kBAAA,EAC3BA,aAAM,CAAC,SAAS,CAAC,IAAI,CAAC,QAAQ,cAGvCA,aAAM,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAA,2CAAA,EAKhBA,aAAM,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CACvB,sBAAA,EAAAA,aAAM,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAA,kBAAA,EAC/BA,aAAM,CAAC,SAAS,CAAC,IAAI,CAAC,QAAQ,CAGvC,WAAA,EAAAA,aAAM,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,MAIrC,CAAC,EAAE,UAAU,EAAE,KACf,UAAU;AACV,IAAA;AACqB,uBAAA,EAAAA,aAAM,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAA;AACvB,0BAAA,EAAAA,aAAM,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAA;AAC/B,sBAAA,EAAAA,aAAM,CAAC,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAA;;;AAGvC,aAAA,EAAAA,aAAM,CAAC,SAAS,CAAC,I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|
|
|
1
|
-
export declare const DropZoneContainer: import("styled-components").StyledComponent<"div", any, {
|
|
1
|
+
export declare const DropZoneContainer: import("styled-components").StyledComponent<"div", any, {
|
|
2
|
+
hasError: boolean;
|
|
3
|
+
isDragOver?: boolean | undefined;
|
|
4
|
+
}, never>;
|
|
@@ -3,7 +3,46 @@ import { colors } from '../../theme/modules/colors.js';
|
|
|
3
3
|
import { radius } from '../../theme/modules/radius.js';
|
|
4
4
|
import { sizes } from '../../theme/modules/sizes.js';
|
|
5
5
|
|
|
6
|
-
const DropZoneContainer = styled.div.withConfig({ displayName: "vui--DropZoneContainer", componentId: "vui--17v0v3c" }) `display:flex;align-items:center;justify-content:center;padding:${sizes.
|
|
6
|
+
const DropZoneContainer = styled.div.withConfig({ displayName: "vui--DropZoneContainer", componentId: "vui--17v0v3c" }) `display:flex;align-items:center;justify-content:center;padding:${sizes.base};border-radius:${radius.base};input[type='file']{position:absolute;opacity:0;width:1px;height:1px;cursor:pointer;}cursor:pointer;border:2px dashed ${colors.neutral.ink.lightest};background-color:${colors.neutral.grey.lightest};:hover{border:2px dashed ${colors.secondary.blue.base};background-color:${colors.secondary.blue.lightest};svg{color:${colors.secondary.blue.base};}}:active,:focus-within{border:2px dashed ${colors.secondary.blue.base};box-shadow:0 0 0 4px ${colors.secondary.blue.light};background-color:${colors.secondary.blue.lightest};svg{color:${colors.secondary.blue.base};}}${({ isDragOver }) => isDragOver &&
|
|
7
|
+
`
|
|
8
|
+
border: 2px dashed ${colors.secondary.blue.base};
|
|
9
|
+
box-shadow: 0 0 0 4px ${colors.secondary.blue.light};
|
|
10
|
+
background-color: ${colors.secondary.blue.lightest};
|
|
11
|
+
|
|
12
|
+
svg {
|
|
13
|
+
color: ${colors.secondary.blue.base};
|
|
14
|
+
}
|
|
15
|
+
`} ${({ hasError, isDragOver }) => hasError &&
|
|
16
|
+
`
|
|
17
|
+
border: 2px dashed ${colors.secondary.red.base};
|
|
18
|
+
|
|
19
|
+
:hover {
|
|
20
|
+
border: 2px dashed ${colors.secondary.red.base};
|
|
21
|
+
background-color: ${colors.secondary.red.lightest};
|
|
22
|
+
|
|
23
|
+
svg {
|
|
24
|
+
color: ${colors.secondary.red.base};
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
:active, :focus-within {
|
|
29
|
+
border: 2px dashed ${colors.secondary.red.base};
|
|
30
|
+
box-shadow: 0 0 0 4px ${colors.secondary.red.light};
|
|
31
|
+
background-color: ${colors.secondary.red.lightest};
|
|
32
|
+
|
|
33
|
+
svg {
|
|
34
|
+
color: ${colors.secondary.red.base};
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
${isDragOver
|
|
39
|
+
? `
|
|
40
|
+
border: 2px dashed ${colors.secondary.red.base};
|
|
41
|
+
box-shadow: 0 0 0 4px ${colors.secondary.red.light};
|
|
42
|
+
background-color: ${colors.secondary.red.lightest};
|
|
43
|
+
`
|
|
44
|
+
: ''}
|
|
45
|
+
`} &:has(input:disabled){cursor:not-allowed;box-shadow:none;background-color:${colors.neutral.grey.light};border-color:${colors.neutral.ink.lightest};color:${colors.neutral.ink.light};svg{color:${colors.neutral.ink.lightest};}}`;
|
|
7
46
|
|
|
8
47
|
export { DropZoneContainer };
|
|
9
48
|
//# sourceMappingURL=styled.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styled.js","sources":["../../../src/components/UploadFile/styled.tsx"],"sourcesContent":["import styled from 'styled-components';\nimport { colors } from '../../theme/modules/colors';\nimport { radius } from '../../theme/modules/radius';\nimport { sizes } from '../../theme/modules/sizes';\n\nexport const DropZoneContainer = styled.div
|
|
1
|
+
{"version":3,"file":"styled.js","sources":["../../../src/components/UploadFile/styled.tsx"],"sourcesContent":["import styled from 'styled-components';\nimport { colors } from '../../theme/modules/colors';\nimport { radius } from '../../theme/modules/radius';\nimport { sizes } from '../../theme/modules/sizes';\n\nexport const DropZoneContainer = styled.div<{\n hasError: boolean;\n isDragOver?: boolean;\n}>`\n display: flex;\n align-items: center;\n justify-content: center;\n\n padding: ${sizes.base};\n border-radius: ${radius.base};\n\n input[type='file'] {\n position: absolute;\n opacity: 0;\n width: 1px;\n height: 1px;\n cursor: pointer;\n }\n\n cursor: pointer;\n\n border: 2px dashed ${colors.neutral.ink.lightest};\n background-color: ${colors.neutral.grey.lightest};\n\n :hover {\n border: 2px dashed ${colors.secondary.blue.base};\n background-color: ${colors.secondary.blue.lightest};\n\n svg {\n color: ${colors.secondary.blue.base};\n }\n }\n :active,\n :focus-within {\n border: 2px dashed ${colors.secondary.blue.base};\n box-shadow: 0 0 0 4px ${colors.secondary.blue.light};\n background-color: ${colors.secondary.blue.lightest};\n\n svg {\n color: ${colors.secondary.blue.base};\n }\n }\n\n ${({ isDragOver }) =>\n isDragOver &&\n `\n border: 2px dashed ${colors.secondary.blue.base};\n box-shadow: 0 0 0 4px ${colors.secondary.blue.light};\n background-color: ${colors.secondary.blue.lightest};\n\n svg {\n color: ${colors.secondary.blue.base};\n }\n `}\n\n ${({ hasError, isDragOver }) =>\n hasError &&\n `\n border: 2px dashed ${colors.secondary.red.base};\n\n :hover {\n border: 2px dashed ${colors.secondary.red.base};\n background-color: ${colors.secondary.red.lightest};\n\n svg {\n color: ${colors.secondary.red.base};\n }\n }\n\n :active, :focus-within {\n border: 2px dashed ${colors.secondary.red.base};\n box-shadow: 0 0 0 4px ${colors.secondary.red.light};\n background-color: ${colors.secondary.red.lightest};\n\n svg {\n color: ${colors.secondary.red.base};\n }\n }\n\n ${\n isDragOver\n ? `\n border: 2px dashed ${colors.secondary.red.base};\n box-shadow: 0 0 0 4px ${colors.secondary.red.light};\n background-color: ${colors.secondary.red.lightest};\n `\n : ''\n }\n `}\n\n\n &:has(input:disabled) {\n cursor: not-allowed;\n box-shadow: none;\n background-color: ${colors.neutral.grey.light};\n border-color: ${colors.neutral.ink.lightest};\n color: ${colors.neutral.ink.light};\n\n svg {\n color: ${colors.neutral.ink.lightest};\n }\n }\n`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