@veeqo/ui 12.5.1 → 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/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/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
|
@@ -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"],"names":[],"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,GAAG,WAAW,CAAC,MAAK;;AAC1C,QAAA,IAAI,YAAY,GAAG,kBAAkB,IAAI,uBAAuB,CAAC,KAAK;AAEtE,QAAA,IAAI,EAAC,CAAA,EAAA,GAAA,CAAA,EAAA,GAAA,QAAQ,CAAC,OAAO,MAAA,IAAA,IAAA,EAAA,KAAA,SAAA,GAAA,SAAA,GAAA,EAAA,CAAE,KAAK,MAAA,IAAA,IAAA,EAAA,KAAA,SAAA,GAAA,SAAA,GAAA,EAAA,CAAE,MAAM,CAAA,EAAE;YACpC,CAAA,EAAA,GAAA,QAAQ,CAAC,OAAO,MAAA,IAAA,IAAA,EAAA,KAAA,SAAA,GAAA,SAAA,GAAA,EAAA,CAAE,iBAAiB,CAAC,YAAY,CAAC;YACjD;AACD;AAED,QAAA,MAAM,OAAO,GAAG;AACd,YAAA,0BAA0B,EAAE,CAAC;AAC7B,YAAA,wBAAwB,EAAE,CAAC;AAC3B,YAAA,UAAU,EAAE,QAAQ,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM;SAC1C;AAED,QAAA,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,KAAI;;AAElD,YAAA,IAAI,IAAI,CAAC,IAAI,GAAG,QAAQ,EAAE;AACxB,gBAAA,OAAO,CAAC,wBAAwB,IAAI,CAAC;AACtC;;AAGD,YAAA,MAAM,GAAG,SAAS,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC;YAC1C,MAAM,WAAW,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC,SAAS,KAAK,SAAS,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,SAAS,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,IAAI,CAAC,IAAI,CAAA;;GAEtC,CAEC,CAAA,EAAA,CAAC,EAAE,QAAQ,EAAE,UAAU,EAAE,KACzB,QAAQ;AACR,IAAA;AACqB,uBAAA,EAAAA,aAAM,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAA;;;AAGvB,yBAAA,EAAAA,aAAM,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAA;AAC1B,wBAAA,EAAAA,aAAM,CAAC,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAA;;;AAGtC,eAAA,EAAAA,aAAM,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAA;;;;;AAKf,yBAAA,EAAAA,aAAM,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAA;AACtB,4BAAA,EAAAA,aAAM,CAAC,SAAS,CAAC,GAAG,CAAC,KAAK,CAAA;AAC9B,wBAAA,EAAAA,aAAM,CAAC,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAA;;;AAGtC,eAAA,EAAAA,aAAM,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAA;;;;MAKpC;AACE,UAAE;AACe,uBAAA,EAAAA,aAAM,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAA;AACtB,0BAAA,EAAAA,aAAM,CAAC,SAAS,CAAC,GAAG,CAAC,KAAK,CAAA;AAC9B,sBAAA,EAAAA,aAAM,CAAC,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAA;AAClD,EAAA;AACK,UAAE,EACN;AACD,EAAA,CAAA,CAAA,2EAAA,EAMqBA,aAAM,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAC7B,cAAA,EAAAA,aAAM,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAA,OAAA,EAClCA,aAAM,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAGtB,WAAA,EAAAA,aAAM,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ;;;;"}
|
|
@@ -1 +1,4 @@
|
|
|
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`;\n"],"names":[],"mappings":";;;;;MAKa,iBAAiB,GAAG,MAAM,CAAC,GAAG,sJAQ9B,KAAK,CAAC,IAAI,CACJ,eAAA,EAAA,MAAM,CAAC,IAAI,CAAA,sHAAA,EAYP,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,CAC5B,kBAAA,EAAA,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,6BAGzB,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAA,kBAAA,EAC3B,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,QAAQ,cAGvC,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAA,2CAAA,EAKhB,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CACvB,sBAAA,EAAA,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAA,kBAAA,EAC/B,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,QAAQ,CAGvC,WAAA,EAAA,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,MAIrC,CAAC,EAAE,UAAU,EAAE,KACf,UAAU;AACV,IAAA;AACqB,uBAAA,EAAA,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAA;AACvB,0BAAA,EAAA,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAA;AAC/B,sBAAA,EAAA,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAA;;;AAGvC,aAAA,EAAA,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAA;;GAEtC,CAEC,CAAA,EAAA,CAAC,EAAE,QAAQ,EAAE,UAAU,EAAE,KACzB,QAAQ;AACR,IAAA;AACqB,uBAAA,EAAA,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAA;;;AAGvB,yBAAA,EAAA,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAA;AAC1B,wBAAA,EAAA,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAA;;;AAGtC,eAAA,EAAA,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAA;;;;;AAKf,yBAAA,EAAA,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAA;AACtB,4BAAA,EAAA,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,KAAK,CAAA;AAC9B,wBAAA,EAAA,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAA;;;AAGtC,eAAA,EAAA,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAA;;;;MAKpC;AACE,UAAE;AACe,uBAAA,EAAA,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAA;AACtB,0BAAA,EAAA,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,KAAK,CAAA;AAC9B,sBAAA,EAAA,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAA;AAClD,EAAA;AACK,UAAE,EACN;AACD,EAAA,CAAA,CAAA,2EAAA,EAMqB,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAC7B,cAAA,EAAA,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAA,OAAA,EAClC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAGtB,WAAA,EAAA,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ;;;;"}
|
|
@@ -1,9 +1,23 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { AcceptedFileTypes, FileSizeUnit } from './constants';
|
|
2
|
+
import { AcceptedFileTypes, ErrorType, FileSizeUnit } from './constants';
|
|
3
3
|
export interface UploadFileProps extends React.InputHTMLAttributes<HTMLInputElement> {
|
|
4
4
|
id: string;
|
|
5
5
|
fileTypes: Array<AcceptedFileTypes>;
|
|
6
6
|
label?: string;
|
|
7
7
|
format?: FileSizeUnit;
|
|
8
8
|
maxBytes?: number;
|
|
9
|
+
errorMessage?: string;
|
|
10
|
+
hideUploadedFiles?: boolean;
|
|
11
|
+
onMaxFilesExceeded?: () => void;
|
|
12
|
+
maxFiles?: number;
|
|
13
|
+
disabledMessage?: string;
|
|
14
|
+
isDirty?: boolean;
|
|
9
15
|
}
|
|
16
|
+
export type UploadFileErrors = {
|
|
17
|
+
criticalErrors: Array<UploadFileError>;
|
|
18
|
+
};
|
|
19
|
+
type UploadFileError = {
|
|
20
|
+
errorType: ErrorType;
|
|
21
|
+
errorMessage: string;
|
|
22
|
+
};
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var constants = require('../../constants.cjs');
|
|
4
|
+
|
|
5
|
+
function getErrorMessage({ hasFormatErrors, hasSizeErrors, isSingleFile, }) {
|
|
6
|
+
// both errors
|
|
7
|
+
if (hasFormatErrors && hasSizeErrors) {
|
|
8
|
+
return constants.InputErrorStateMessages.INVALID_FORMAT_AND_SIZE;
|
|
9
|
+
}
|
|
10
|
+
// only format errors
|
|
11
|
+
if (hasFormatErrors) {
|
|
12
|
+
return isSingleFile
|
|
13
|
+
? constants.InputErrorStateMessages.INVALID_FORMAT
|
|
14
|
+
: constants.InputErrorStateMessages.INVALID_FORMATS;
|
|
15
|
+
}
|
|
16
|
+
// only size errors
|
|
17
|
+
if (hasSizeErrors) {
|
|
18
|
+
return isSingleFile
|
|
19
|
+
? constants.InputErrorStateMessages.INVALID_SIZE
|
|
20
|
+
: constants.InputErrorStateMessages.INVALID_SIZES;
|
|
21
|
+
}
|
|
22
|
+
// no errors
|
|
23
|
+
return constants.InputErrorStateMessages.VALID;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
exports.getErrorMessage = getErrorMessage;
|
|
27
|
+
//# sourceMappingURL=getErrorMessage.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getErrorMessage.cjs","sources":["../../../../../src/components/UploadFile/utils/getErrorMessage/getErrorMessage.ts"],"sourcesContent":["import { InputErrorStateMessages } from '../../constants';\n\ntype GetErrorMessageProps = {\n hasFormatErrors: boolean;\n hasSizeErrors: boolean;\n isSingleFile: boolean;\n};\nexport function getErrorMessage({\n hasFormatErrors,\n hasSizeErrors,\n isSingleFile,\n}: GetErrorMessageProps) {\n // both errors\n if (hasFormatErrors && hasSizeErrors) {\n return InputErrorStateMessages.INVALID_FORMAT_AND_SIZE;\n }\n\n // only format errors\n if (hasFormatErrors) {\n return isSingleFile\n ? InputErrorStateMessages.INVALID_FORMAT\n : InputErrorStateMessages.INVALID_FORMATS;\n }\n\n // only size errors\n if (hasSizeErrors) {\n return isSingleFile\n ? InputErrorStateMessages.INVALID_SIZE\n : InputErrorStateMessages.INVALID_SIZES;\n }\n\n // no errors\n return InputErrorStateMessages.VALID;\n}\n"],"names":["InputErrorStateMessages"],"mappings":";;;;AAOM,SAAU,eAAe,CAAC,EAC9B,eAAe,EACf,aAAa,EACb,YAAY,GACS,EAAA;;IAErB,IAAI,eAAe,IAAI,aAAa,EAAE;QACpC,OAAOA,iCAAuB,CAAC,uBAAuB;AACvD;;AAGD,IAAA,IAAI,eAAe,EAAE;AACnB,QAAA,OAAO;cACHA,iCAAuB,CAAC;AAC1B,cAAEA,iCAAuB,CAAC,eAAe;AAC5C;;AAGD,IAAA,IAAI,aAAa,EAAE;AACjB,QAAA,OAAO;cACHA,iCAAuB,CAAC;AAC1B,cAAEA,iCAAuB,CAAC,aAAa;AAC1C;;IAGD,OAAOA,iCAAuB,CAAC,KAAK;AACtC;;;;"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { InputErrorStateMessages } from '../../constants';
|
|
2
|
+
type GetErrorMessageProps = {
|
|
3
|
+
hasFormatErrors: boolean;
|
|
4
|
+
hasSizeErrors: boolean;
|
|
5
|
+
isSingleFile: boolean;
|
|
6
|
+
};
|
|
7
|
+
export declare function getErrorMessage({ hasFormatErrors, hasSizeErrors, isSingleFile, }: GetErrorMessageProps): InputErrorStateMessages;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { InputErrorStateMessages } from '../../constants.js';
|
|
2
|
+
|
|
3
|
+
function getErrorMessage({ hasFormatErrors, hasSizeErrors, isSingleFile, }) {
|
|
4
|
+
// both errors
|
|
5
|
+
if (hasFormatErrors && hasSizeErrors) {
|
|
6
|
+
return InputErrorStateMessages.INVALID_FORMAT_AND_SIZE;
|
|
7
|
+
}
|
|
8
|
+
// only format errors
|
|
9
|
+
if (hasFormatErrors) {
|
|
10
|
+
return isSingleFile
|
|
11
|
+
? InputErrorStateMessages.INVALID_FORMAT
|
|
12
|
+
: InputErrorStateMessages.INVALID_FORMATS;
|
|
13
|
+
}
|
|
14
|
+
// only size errors
|
|
15
|
+
if (hasSizeErrors) {
|
|
16
|
+
return isSingleFile
|
|
17
|
+
? InputErrorStateMessages.INVALID_SIZE
|
|
18
|
+
: InputErrorStateMessages.INVALID_SIZES;
|
|
19
|
+
}
|
|
20
|
+
// no errors
|
|
21
|
+
return InputErrorStateMessages.VALID;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export { getErrorMessage };
|
|
25
|
+
//# sourceMappingURL=getErrorMessage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getErrorMessage.js","sources":["../../../../../src/components/UploadFile/utils/getErrorMessage/getErrorMessage.ts"],"sourcesContent":["import { InputErrorStateMessages } from '../../constants';\n\ntype GetErrorMessageProps = {\n hasFormatErrors: boolean;\n hasSizeErrors: boolean;\n isSingleFile: boolean;\n};\nexport function getErrorMessage({\n hasFormatErrors,\n hasSizeErrors,\n isSingleFile,\n}: GetErrorMessageProps) {\n // both errors\n if (hasFormatErrors && hasSizeErrors) {\n return InputErrorStateMessages.INVALID_FORMAT_AND_SIZE;\n }\n\n // only format errors\n if (hasFormatErrors) {\n return isSingleFile\n ? InputErrorStateMessages.INVALID_FORMAT\n : InputErrorStateMessages.INVALID_FORMATS;\n }\n\n // only size errors\n if (hasSizeErrors) {\n return isSingleFile\n ? InputErrorStateMessages.INVALID_SIZE\n : InputErrorStateMessages.INVALID_SIZES;\n }\n\n // no errors\n return InputErrorStateMessages.VALID;\n}\n"],"names":[],"mappings":";;AAOM,SAAU,eAAe,CAAC,EAC9B,eAAe,EACf,aAAa,EACb,YAAY,GACS,EAAA;;IAErB,IAAI,eAAe,IAAI,aAAa,EAAE;QACpC,OAAO,uBAAuB,CAAC,uBAAuB;AACvD;;AAGD,IAAA,IAAI,eAAe,EAAE;AACnB,QAAA,OAAO;cACH,uBAAuB,CAAC;AAC1B,cAAE,uBAAuB,CAAC,eAAe;AAC5C;;AAGD,IAAA,IAAI,aAAa,EAAE;AACjB,QAAA,OAAO;cACH,uBAAuB,CAAC;AAC1B,cAAE,uBAAuB,CAAC,aAAa;AAC1C;;IAGD,OAAO,uBAAuB,CAAC,KAAK;AACtC;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { getErrorMessage } from './getErrorMessage';
|
|
@@ -3,30 +3,33 @@
|
|
|
3
3
|
var constants = require('../../constants.cjs');
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
7
|
-
* should go inside the accept property
|
|
6
|
+
* Converts a file size in bytes to a human-readable string with the specified format unit.
|
|
8
7
|
*
|
|
9
8
|
* E.g.
|
|
10
9
|
*
|
|
11
10
|
* const maxSizeCopy = getFileSizeString({
|
|
12
|
-
* maxBytes:
|
|
11
|
+
* maxBytes: 10000000,
|
|
13
12
|
* format: FileSizeUnit.MB
|
|
14
13
|
* });
|
|
15
14
|
*
|
|
16
|
-
* Where @constant maxSizeCopy would equal "
|
|
15
|
+
* Where @constant maxSizeCopy would equal "Maximum file size: 10 MB"
|
|
17
16
|
*
|
|
18
|
-
* @param
|
|
19
|
-
*
|
|
17
|
+
* @param maxBytes - The file size in bytes to convert
|
|
18
|
+
* @param format - The unit format to display (KB or MB)
|
|
19
|
+
* @param baseString - Optional prefix string, defaults to "Maximum file size: "
|
|
20
|
+
* @param digits - Number of decimal places to show, defaults to 2 (strips any leading zeros)
|
|
21
|
+
* @returns A formatted string representing the file size
|
|
20
22
|
*/
|
|
21
|
-
const getFileSizeString = ({ maxBytes, format, baseString }) => {
|
|
22
|
-
const base = baseString
|
|
23
|
+
const getFileSizeString = ({ maxBytes, format, baseString, digits = 2, }) => {
|
|
24
|
+
const base = baseString !== null && baseString !== undefined ? baseString : 'Maximum file size: ';
|
|
25
|
+
const getValue = (divisor) => parseFloat((maxBytes / divisor).toFixed(digits));
|
|
23
26
|
switch (format) {
|
|
24
27
|
case constants.FileSizeUnit.KB:
|
|
25
|
-
return `${base}${
|
|
28
|
+
return `${base}${getValue(1000)} KB`;
|
|
26
29
|
case constants.FileSizeUnit.MB:
|
|
27
|
-
return `${base}${
|
|
30
|
+
return `${base}${getValue(1000000)} MB`;
|
|
28
31
|
default:
|
|
29
|
-
return `${base}${
|
|
32
|
+
return `${base}${getValue(1000)} KB`;
|
|
30
33
|
}
|
|
31
34
|
};
|
|
32
35
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getFileSizeString.cjs","sources":["../../../../../src/components/UploadFile/utils/getFileSizeString/getFileSizeString.ts"],"sourcesContent":["import { FileSizeUnit } from '../../constants';\n\ntype GetFileSizeStringProps = {\n maxBytes: number;\n format: FileSizeUnit;\n baseString?: string;\n};\n/**\n *
|
|
1
|
+
{"version":3,"file":"getFileSizeString.cjs","sources":["../../../../../src/components/UploadFile/utils/getFileSizeString/getFileSizeString.ts"],"sourcesContent":["import { FileSizeUnit } from '../../constants';\n\ntype GetFileSizeStringProps = {\n maxBytes: number;\n format: FileSizeUnit;\n baseString?: string;\n digits?: number;\n};\n/**\n * Converts a file size in bytes to a human-readable string with the specified format unit.\n *\n * E.g.\n *\n * const maxSizeCopy = getFileSizeString({\n * maxBytes: 10000000,\n * format: FileSizeUnit.MB\n * });\n *\n * Where @constant maxSizeCopy would equal \"Maximum file size: 10 MB\"\n *\n * @param maxBytes - The file size in bytes to convert\n * @param format - The unit format to display (KB or MB)\n * @param baseString - Optional prefix string, defaults to \"Maximum file size: \"\n * @param digits - Number of decimal places to show, defaults to 2 (strips any leading zeros)\n * @returns A formatted string representing the file size\n */\nexport const getFileSizeString = ({\n maxBytes,\n format,\n baseString,\n digits = 2,\n}: GetFileSizeStringProps) => {\n const base = baseString ?? 'Maximum file size: ';\n const getValue = (divisor: number) => parseFloat((maxBytes / divisor).toFixed(digits));\n switch (format) {\n case FileSizeUnit.KB:\n return `${base}${getValue(1000)} KB`;\n case FileSizeUnit.MB:\n return `${base}${getValue(1000000)} MB`;\n default:\n return `${base}${getValue(1000)} KB`;\n }\n};\n"],"names":["FileSizeUnit"],"mappings":";;;;AAQA;;;;;;;;;;;;;;;;;AAiBG;AACU,MAAA,iBAAiB,GAAG,CAAC,EAChC,QAAQ,EACR,MAAM,EACN,UAAU,EACV,MAAM,GAAG,CAAC,GACa,KAAI;IAC3B,MAAM,IAAI,GAAG,UAAU,KAAA,IAAA,IAAV,UAAU,KAAV,SAAA,GAAA,UAAU,GAAI,qBAAqB;IAChD,MAAM,QAAQ,GAAG,CAAC,OAAe,KAAK,UAAU,CAAC,CAAC,QAAQ,GAAG,OAAO,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;AACtF,IAAA,QAAQ,MAAM;QACZ,KAAKA,sBAAY,CAAC,EAAE;YAClB,OAAO,CAAA,EAAG,IAAI,CAAG,EAAA,QAAQ,CAAC,IAAI,CAAC,KAAK;QACtC,KAAKA,sBAAY,CAAC,EAAE;YAClB,OAAO,CAAA,EAAG,IAAI,CAAG,EAAA,QAAQ,CAAC,OAAO,CAAC,KAAK;AACzC,QAAA;YACE,OAAO,CAAA,EAAG,IAAI,CAAG,EAAA,QAAQ,CAAC,IAAI,CAAC,KAAK;AACvC;AACH;;;;"}
|
|
@@ -3,22 +3,25 @@ type GetFileSizeStringProps = {
|
|
|
3
3
|
maxBytes: number;
|
|
4
4
|
format: FileSizeUnit;
|
|
5
5
|
baseString?: string;
|
|
6
|
+
digits?: number;
|
|
6
7
|
};
|
|
7
8
|
/**
|
|
8
|
-
*
|
|
9
|
-
* should go inside the accept property
|
|
9
|
+
* Converts a file size in bytes to a human-readable string with the specified format unit.
|
|
10
10
|
*
|
|
11
11
|
* E.g.
|
|
12
12
|
*
|
|
13
13
|
* const maxSizeCopy = getFileSizeString({
|
|
14
|
-
* maxBytes:
|
|
14
|
+
* maxBytes: 10000000,
|
|
15
15
|
* format: FileSizeUnit.MB
|
|
16
16
|
* });
|
|
17
17
|
*
|
|
18
|
-
* Where @constant maxSizeCopy would equal "
|
|
18
|
+
* Where @constant maxSizeCopy would equal "Maximum file size: 10 MB"
|
|
19
19
|
*
|
|
20
|
-
* @param
|
|
21
|
-
*
|
|
20
|
+
* @param maxBytes - The file size in bytes to convert
|
|
21
|
+
* @param format - The unit format to display (KB or MB)
|
|
22
|
+
* @param baseString - Optional prefix string, defaults to "Maximum file size: "
|
|
23
|
+
* @param digits - Number of decimal places to show, defaults to 2 (strips any leading zeros)
|
|
24
|
+
* @returns A formatted string representing the file size
|
|
22
25
|
*/
|
|
23
|
-
export declare const getFileSizeString: ({ maxBytes, format, baseString }: GetFileSizeStringProps) => string;
|
|
26
|
+
export declare const getFileSizeString: ({ maxBytes, format, baseString, digits, }: GetFileSizeStringProps) => string;
|
|
24
27
|
export {};
|
|
@@ -1,30 +1,33 @@
|
|
|
1
1
|
import { FileSizeUnit } from '../../constants.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
5
|
-
* should go inside the accept property
|
|
4
|
+
* Converts a file size in bytes to a human-readable string with the specified format unit.
|
|
6
5
|
*
|
|
7
6
|
* E.g.
|
|
8
7
|
*
|
|
9
8
|
* const maxSizeCopy = getFileSizeString({
|
|
10
|
-
* maxBytes:
|
|
9
|
+
* maxBytes: 10000000,
|
|
11
10
|
* format: FileSizeUnit.MB
|
|
12
11
|
* });
|
|
13
12
|
*
|
|
14
|
-
* Where @constant maxSizeCopy would equal "
|
|
13
|
+
* Where @constant maxSizeCopy would equal "Maximum file size: 10 MB"
|
|
15
14
|
*
|
|
16
|
-
* @param
|
|
17
|
-
*
|
|
15
|
+
* @param maxBytes - The file size in bytes to convert
|
|
16
|
+
* @param format - The unit format to display (KB or MB)
|
|
17
|
+
* @param baseString - Optional prefix string, defaults to "Maximum file size: "
|
|
18
|
+
* @param digits - Number of decimal places to show, defaults to 2 (strips any leading zeros)
|
|
19
|
+
* @returns A formatted string representing the file size
|
|
18
20
|
*/
|
|
19
|
-
const getFileSizeString = ({ maxBytes, format, baseString }) => {
|
|
20
|
-
const base = baseString
|
|
21
|
+
const getFileSizeString = ({ maxBytes, format, baseString, digits = 2, }) => {
|
|
22
|
+
const base = baseString !== null && baseString !== undefined ? baseString : 'Maximum file size: ';
|
|
23
|
+
const getValue = (divisor) => parseFloat((maxBytes / divisor).toFixed(digits));
|
|
21
24
|
switch (format) {
|
|
22
25
|
case FileSizeUnit.KB:
|
|
23
|
-
return `${base}${
|
|
26
|
+
return `${base}${getValue(1000)} KB`;
|
|
24
27
|
case FileSizeUnit.MB:
|
|
25
|
-
return `${base}${
|
|
28
|
+
return `${base}${getValue(1000000)} MB`;
|
|
26
29
|
default:
|
|
27
|
-
return `${base}${
|
|
30
|
+
return `${base}${getValue(1000)} KB`;
|
|
28
31
|
}
|
|
29
32
|
};
|
|
30
33
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getFileSizeString.js","sources":["../../../../../src/components/UploadFile/utils/getFileSizeString/getFileSizeString.ts"],"sourcesContent":["import { FileSizeUnit } from '../../constants';\n\ntype GetFileSizeStringProps = {\n maxBytes: number;\n format: FileSizeUnit;\n baseString?: string;\n};\n/**\n *
|
|
1
|
+
{"version":3,"file":"getFileSizeString.js","sources":["../../../../../src/components/UploadFile/utils/getFileSizeString/getFileSizeString.ts"],"sourcesContent":["import { FileSizeUnit } from '../../constants';\n\ntype GetFileSizeStringProps = {\n maxBytes: number;\n format: FileSizeUnit;\n baseString?: string;\n digits?: number;\n};\n/**\n * Converts a file size in bytes to a human-readable string with the specified format unit.\n *\n * E.g.\n *\n * const maxSizeCopy = getFileSizeString({\n * maxBytes: 10000000,\n * format: FileSizeUnit.MB\n * });\n *\n * Where @constant maxSizeCopy would equal \"Maximum file size: 10 MB\"\n *\n * @param maxBytes - The file size in bytes to convert\n * @param format - The unit format to display (KB or MB)\n * @param baseString - Optional prefix string, defaults to \"Maximum file size: \"\n * @param digits - Number of decimal places to show, defaults to 2 (strips any leading zeros)\n * @returns A formatted string representing the file size\n */\nexport const getFileSizeString = ({\n maxBytes,\n format,\n baseString,\n digits = 2,\n}: GetFileSizeStringProps) => {\n const base = baseString ?? 'Maximum file size: ';\n const getValue = (divisor: number) => parseFloat((maxBytes / divisor).toFixed(digits));\n switch (format) {\n case FileSizeUnit.KB:\n return `${base}${getValue(1000)} KB`;\n case FileSizeUnit.MB:\n return `${base}${getValue(1000000)} MB`;\n default:\n return `${base}${getValue(1000)} KB`;\n }\n};\n"],"names":[],"mappings":";;AAQA;;;;;;;;;;;;;;;;;AAiBG;AACU,MAAA,iBAAiB,GAAG,CAAC,EAChC,QAAQ,EACR,MAAM,EACN,UAAU,EACV,MAAM,GAAG,CAAC,GACa,KAAI;IAC3B,MAAM,IAAI,GAAG,UAAU,KAAA,IAAA,IAAV,UAAU,KAAV,SAAA,GAAA,UAAU,GAAI,qBAAqB;IAChD,MAAM,QAAQ,GAAG,CAAC,OAAe,KAAK,UAAU,CAAC,CAAC,QAAQ,GAAG,OAAO,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;AACtF,IAAA,QAAQ,MAAM;QACZ,KAAK,YAAY,CAAC,EAAE;YAClB,OAAO,CAAA,EAAG,IAAI,CAAG,EAAA,QAAQ,CAAC,IAAI,CAAC,KAAK;QACtC,KAAK,YAAY,CAAC,EAAE;YAClB,OAAO,CAAA,EAAG,IAAI,CAAG,EAAA,QAAQ,CAAC,OAAO,CAAC,KAAK;AACzC,QAAA;YACE,OAAO,CAAA,EAAG,IAAI,CAAG,EAAA,QAAQ,CAAC,IAAI,CAAC,KAAK;AACvC;AACH;;;;"}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var constants = require('../../constants.cjs');
|
|
4
|
-
|
|
5
3
|
/**
|
|
6
4
|
* Constructs a user-friendly string of accepted types valid for the UploadFile component based on the
|
|
7
5
|
* fileTypes list passed as parameter.
|
|
@@ -21,34 +19,22 @@ var constants = require('../../constants.cjs');
|
|
|
21
19
|
* the returned string
|
|
22
20
|
*/
|
|
23
21
|
const getValidTypesString = ({ fileTypes, baseString }) => {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
break;
|
|
41
|
-
case constants.AcceptedFileTypes.JPG:
|
|
42
|
-
base += 'JPG';
|
|
43
|
-
break;
|
|
44
|
-
case constants.AcceptedFileTypes.PNG:
|
|
45
|
-
base += 'PNG';
|
|
46
|
-
break;
|
|
47
|
-
}
|
|
48
|
-
if (!isPenultimate && !isLast && list.length > 2)
|
|
49
|
-
base += ', ';
|
|
50
|
-
});
|
|
51
|
-
return base;
|
|
22
|
+
// Remove leading dot and uppercase for display
|
|
23
|
+
const getDisplayType = (fileType) => fileType.replace(/^\./, '').toUpperCase();
|
|
24
|
+
if (!fileTypes.length)
|
|
25
|
+
return baseString !== null && baseString !== undefined ? baseString : '';
|
|
26
|
+
const displayTypes = fileTypes.map(getDisplayType);
|
|
27
|
+
let result = baseString == null ? 'Valid file types: ' : baseString;
|
|
28
|
+
if (displayTypes.length === 1) {
|
|
29
|
+
result += displayTypes[0];
|
|
30
|
+
}
|
|
31
|
+
else if (displayTypes.length === 2) {
|
|
32
|
+
result += `${displayTypes[0]} and ${displayTypes[1]}`;
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
result += `${displayTypes.slice(0, -1).join(', ')} and ${displayTypes[displayTypes.length - 1]}`;
|
|
36
|
+
}
|
|
37
|
+
return result;
|
|
52
38
|
};
|
|
53
39
|
|
|
54
40
|
exports.getValidTypesString = getValidTypesString;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getValidTypesString.cjs","sources":["../../../../../src/components/UploadFile/utils/getValidTypesString/getValidTypesString.ts"],"sourcesContent":["import { AcceptedFileTypes } from '../../constants';\n\ntype GetValidTypesStringProps = {\n fileTypes: Array<AcceptedFileTypes>;\n baseString?: string;\n};\n\n/**\n * Constructs a user-friendly string of accepted types valid for the UploadFile component based on the\n * fileTypes list passed as parameter.\n *\n * E.g.\n *\n * const validTypesCopy = getValidTypesString({\n * fileTypes: [\n * AcceptedFileTypes.CSV,\n * ]\n * });\n *\n * Where @constant validTypesCopy would equal \"Valid types: CSV\"\n *\n * @param fileTypes - A list of file types, each value being of @type AcceptedFileTypes\n * @param baseString - An optional string to override the default value of 'Valid types: ' prefixed to\n * the returned string\n */\nexport const getValidTypesString = ({ fileTypes, baseString }: GetValidTypesStringProps) => {\n
|
|
1
|
+
{"version":3,"file":"getValidTypesString.cjs","sources":["../../../../../src/components/UploadFile/utils/getValidTypesString/getValidTypesString.ts"],"sourcesContent":["import { AcceptedFileTypes } from '../../constants';\n\ntype GetValidTypesStringProps = {\n fileTypes: Array<AcceptedFileTypes>;\n baseString?: string;\n};\n\n/**\n * Constructs a user-friendly string of accepted types valid for the UploadFile component based on the\n * fileTypes list passed as parameter.\n *\n * E.g.\n *\n * const validTypesCopy = getValidTypesString({\n * fileTypes: [\n * AcceptedFileTypes.CSV,\n * ]\n * });\n *\n * Where @constant validTypesCopy would equal \"Valid types: CSV\"\n *\n * @param fileTypes - A list of file types, each value being of @type AcceptedFileTypes\n * @param baseString - An optional string to override the default value of 'Valid types: ' prefixed to\n * the returned string\n */\nexport const getValidTypesString = ({ fileTypes, baseString }: GetValidTypesStringProps) => {\n // Remove leading dot and uppercase for display\n const getDisplayType = (fileType: AcceptedFileTypes) => fileType.replace(/^\\./, '').toUpperCase();\n\n if (!fileTypes.length) return baseString ?? '';\n\n const displayTypes = fileTypes.map(getDisplayType);\n\n let result = baseString == null ? 'Valid file types: ' : baseString;\n\n if (displayTypes.length === 1) {\n result += displayTypes[0];\n } else if (displayTypes.length === 2) {\n result += `${displayTypes[0]} and ${displayTypes[1]}`;\n } else {\n result += `${displayTypes.slice(0, -1).join(', ')} and ${displayTypes[displayTypes.length - 1]}`;\n }\n\n return result;\n};\n"],"names":[],"mappings":";;AAOA;;;;;;;;;;;;;;;;;AAiBG;AACU,MAAA,mBAAmB,GAAG,CAAC,EAAE,SAAS,EAAE,UAAU,EAA4B,KAAI;;AAEzF,IAAA,MAAM,cAAc,GAAG,CAAC,QAA2B,KAAK,QAAQ,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,WAAW,EAAE;IAEjG,IAAI,CAAC,SAAS,CAAC,MAAM;AAAE,QAAA,OAAO,UAAU,KAAV,IAAA,IAAA,UAAU,iBAAV,UAAU,GAAI,EAAE;IAE9C,MAAM,YAAY,GAAG,SAAS,CAAC,GAAG,CAAC,cAAc,CAAC;AAElD,IAAA,IAAI,MAAM,GAAG,UAAU,IAAI,IAAI,GAAG,oBAAoB,GAAG,UAAU;AAEnE,IAAA,IAAI,YAAY,CAAC,MAAM,KAAK,CAAC,EAAE;AAC7B,QAAA,MAAM,IAAI,YAAY,CAAC,CAAC,CAAC;AAC1B;AAAM,SAAA,IAAI,YAAY,CAAC,MAAM,KAAK,CAAC,EAAE;AACpC,QAAA,MAAM,IAAI,CAAA,EAAG,YAAY,CAAC,CAAC,CAAC,CAAQ,KAAA,EAAA,YAAY,CAAC,CAAC,CAAC,CAAA,CAAE;AACtD;AAAM,SAAA;QACL,MAAM,IAAI,CAAG,EAAA,YAAY,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAQ,KAAA,EAAA,YAAY,CAAC,YAAY,CAAC,MAAM,GAAG,CAAC,CAAC,CAAA,CAAE;AACjG;AAED,IAAA,OAAO,MAAM;AACf;;;;"}
|