@veeqo/ui 12.4.0-beta-9 → 12.4.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.
Files changed (127) hide show
  1. package/dist/components/UploadFile/UploadFile.cjs +82 -71
  2. package/dist/components/UploadFile/UploadFile.cjs.map +1 -1
  3. package/dist/components/UploadFile/UploadFile.js +85 -74
  4. package/dist/components/UploadFile/UploadFile.js.map +1 -1
  5. package/dist/components/UploadFile/UploadGraphic.cjs +14 -0
  6. package/dist/components/UploadFile/UploadGraphic.cjs.map +1 -0
  7. package/dist/components/UploadFile/UploadGraphic.d.ts +2 -0
  8. package/dist/components/UploadFile/UploadGraphic.js +8 -0
  9. package/dist/components/UploadFile/UploadGraphic.js.map +1 -0
  10. package/dist/components/UploadFile/components/UploadCopy/UploadCopy.cjs +6 -6
  11. package/dist/components/UploadFile/components/UploadCopy/UploadCopy.cjs.map +1 -1
  12. package/dist/components/UploadFile/components/UploadCopy/UploadCopy.js +6 -6
  13. package/dist/components/UploadFile/components/UploadCopy/UploadCopy.js.map +1 -1
  14. package/dist/components/UploadFile/components/UploadFileErrors/UploadFileErrors.cjs +31 -0
  15. package/dist/components/UploadFile/components/UploadFileErrors/UploadFileErrors.cjs.map +1 -0
  16. package/dist/components/UploadFile/components/UploadFileErrors/UploadFileErrors.d.ts +7 -0
  17. package/dist/components/UploadFile/components/UploadFileErrors/UploadFileErrors.js +25 -0
  18. package/dist/components/UploadFile/components/UploadFileErrors/UploadFileErrors.js.map +1 -0
  19. package/dist/components/UploadFile/components/UploadedFile/UploadedFile.cjs +5 -52
  20. package/dist/components/UploadFile/components/UploadedFile/UploadedFile.cjs.map +1 -1
  21. package/dist/components/UploadFile/components/UploadedFile/UploadedFile.d.ts +3 -7
  22. package/dist/components/UploadFile/components/UploadedFile/UploadedFile.js +5 -52
  23. package/dist/components/UploadFile/components/UploadedFile/UploadedFile.js.map +1 -1
  24. package/dist/components/UploadFile/components/UploadedFile/styled.cjs +20 -0
  25. package/dist/components/UploadFile/components/UploadedFile/styled.cjs.map +1 -0
  26. package/dist/components/UploadFile/components/UploadedFile/styled.d.ts +2 -0
  27. package/dist/components/UploadFile/components/UploadedFile/styled.js +13 -0
  28. package/dist/components/UploadFile/components/UploadedFile/styled.js.map +1 -0
  29. package/dist/components/UploadFile/constants.cjs +8 -64
  30. package/dist/components/UploadFile/constants.cjs.map +1 -1
  31. package/dist/components/UploadFile/constants.d.ts +5 -52
  32. package/dist/components/UploadFile/constants.js +9 -63
  33. package/dist/components/UploadFile/constants.js.map +1 -1
  34. package/dist/components/UploadFile/mocks/files.d.ts +0 -2
  35. package/dist/components/UploadFile/mocks/utils.d.ts +2 -1
  36. package/dist/components/UploadFile/styled.cjs +1 -16
  37. package/dist/components/UploadFile/styled.cjs.map +1 -1
  38. package/dist/components/UploadFile/styled.d.ts +1 -4
  39. package/dist/components/UploadFile/styled.js +1 -16
  40. package/dist/components/UploadFile/styled.js.map +1 -1
  41. package/dist/components/UploadFile/types.d.ts +1 -14
  42. package/dist/components/UploadFile/utils/getFileSizeString/getFileSizeString.cjs +11 -14
  43. package/dist/components/UploadFile/utils/getFileSizeString/getFileSizeString.cjs.map +1 -1
  44. package/dist/components/UploadFile/utils/getFileSizeString/getFileSizeString.d.ts +7 -10
  45. package/dist/components/UploadFile/utils/getFileSizeString/getFileSizeString.js +11 -14
  46. package/dist/components/UploadFile/utils/getFileSizeString/getFileSizeString.js.map +1 -1
  47. package/dist/components/UploadFile/utils/getValidTypesString/getValidTypesString.cjs +30 -16
  48. package/dist/components/UploadFile/utils/getValidTypesString/getValidTypesString.cjs.map +1 -1
  49. package/dist/components/UploadFile/utils/getValidTypesString/getValidTypesString.js +30 -16
  50. package/dist/components/UploadFile/utils/getValidTypesString/getValidTypesString.js.map +1 -1
  51. package/dist/components/UploadFile/utils/index.d.ts +1 -0
  52. package/dist/components/UploadFile/utils/setInputElFile/setInputElFile.cjs +18 -0
  53. package/dist/components/UploadFile/utils/setInputElFile/setInputElFile.cjs.map +1 -0
  54. package/dist/components/UploadFile/utils/setInputElFile/setInputElFile.d.ts +13 -0
  55. package/dist/components/UploadFile/utils/setInputElFile/setInputElFile.js +16 -0
  56. package/dist/components/UploadFile/utils/setInputElFile/setInputElFile.js.map +1 -0
  57. package/dist/components/ViewsContainer/ViewsContainer.cjs +37 -10
  58. package/dist/components/ViewsContainer/ViewsContainer.cjs.map +1 -1
  59. package/dist/components/ViewsContainer/ViewsContainer.js +37 -10
  60. package/dist/components/ViewsContainer/ViewsContainer.js.map +1 -1
  61. package/dist/components/ViewsContainer/ViewsContainer.module.scss.cjs +9 -0
  62. package/dist/components/ViewsContainer/ViewsContainer.module.scss.cjs.map +1 -0
  63. package/dist/components/ViewsContainer/ViewsContainer.module.scss.js +7 -0
  64. package/dist/components/ViewsContainer/ViewsContainer.module.scss.js.map +1 -0
  65. package/dist/components/ViewsContainer/hooks/useSetScrollPosition.cjs +73 -45
  66. package/dist/components/ViewsContainer/hooks/useSetScrollPosition.cjs.map +1 -1
  67. package/dist/components/ViewsContainer/hooks/useSetScrollPosition.d.ts +9 -1
  68. package/dist/components/ViewsContainer/hooks/useSetScrollPosition.js +74 -46
  69. package/dist/components/ViewsContainer/hooks/useSetScrollPosition.js.map +1 -1
  70. package/dist/components/ViewsContainer/types.d.ts +18 -0
  71. package/dist/utils/forms/form.module.scss.cjs +2 -2
  72. package/dist/utils/forms/form.module.scss.cjs.map +1 -1
  73. package/dist/utils/forms/form.module.scss.js +2 -2
  74. package/dist/utils/forms/form.module.scss.js.map +1 -1
  75. package/package.json +1 -1
  76. package/dist/components/UploadFile/components/DropCopy/DropCopy.cjs +0 -28
  77. package/dist/components/UploadFile/components/DropCopy/DropCopy.cjs.map +0 -1
  78. package/dist/components/UploadFile/components/DropCopy/DropCopy.d.ts +0 -2
  79. package/dist/components/UploadFile/components/DropCopy/DropCopy.js +0 -22
  80. package/dist/components/UploadFile/components/DropCopy/DropCopy.js.map +0 -1
  81. package/dist/components/UploadFile/components/UploadedFile/UploadedFile.module.scss.cjs +0 -9
  82. package/dist/components/UploadFile/components/UploadedFile/UploadedFile.module.scss.cjs.map +0 -1
  83. package/dist/components/UploadFile/components/UploadedFile/UploadedFile.module.scss.js +0 -7
  84. package/dist/components/UploadFile/components/UploadedFile/UploadedFile.module.scss.js.map +0 -1
  85. package/dist/components/UploadFile/hooks/useFileErrorMessages/index.d.ts +0 -1
  86. package/dist/components/UploadFile/hooks/useFileErrorMessages/useFileErrorMessages.cjs +0 -39
  87. package/dist/components/UploadFile/hooks/useFileErrorMessages/useFileErrorMessages.cjs.map +0 -1
  88. package/dist/components/UploadFile/hooks/useFileErrorMessages/useFileErrorMessages.d.ts +0 -13
  89. package/dist/components/UploadFile/hooks/useFileErrorMessages/useFileErrorMessages.js +0 -37
  90. package/dist/components/UploadFile/hooks/useFileErrorMessages/useFileErrorMessages.js.map +0 -1
  91. package/dist/components/UploadFile/hooks/usePreviewImage/index.d.ts +0 -1
  92. package/dist/components/UploadFile/hooks/usePreviewImage/usePreviewImage.cjs +0 -36
  93. package/dist/components/UploadFile/hooks/usePreviewImage/usePreviewImage.cjs.map +0 -1
  94. package/dist/components/UploadFile/hooks/usePreviewImage/usePreviewImage.d.ts +0 -8
  95. package/dist/components/UploadFile/hooks/usePreviewImage/usePreviewImage.js +0 -34
  96. package/dist/components/UploadFile/hooks/usePreviewImage/usePreviewImage.js.map +0 -1
  97. package/dist/components/UploadFile/hooks/useUploadFile/index.d.ts +0 -1
  98. package/dist/components/UploadFile/hooks/useUploadFile/useUploadFile.cjs +0 -65
  99. package/dist/components/UploadFile/hooks/useUploadFile/useUploadFile.cjs.map +0 -1
  100. package/dist/components/UploadFile/hooks/useUploadFile/useUploadFile.d.ts +0 -9
  101. package/dist/components/UploadFile/hooks/useUploadFile/useUploadFile.js +0 -63
  102. package/dist/components/UploadFile/hooks/useUploadFile/useUploadFile.js.map +0 -1
  103. package/dist/components/UploadFile/hooks/useValidateInput/index.d.ts +0 -1
  104. package/dist/components/UploadFile/hooks/useValidateInput/useValidateInput.cjs +0 -85
  105. package/dist/components/UploadFile/hooks/useValidateInput/useValidateInput.cjs.map +0 -1
  106. package/dist/components/UploadFile/hooks/useValidateInput/useValidateInput.d.ts +0 -13
  107. package/dist/components/UploadFile/hooks/useValidateInput/useValidateInput.js +0 -83
  108. package/dist/components/UploadFile/hooks/useValidateInput/useValidateInput.js.map +0 -1
  109. package/dist/components/UploadFile/mocks/mockUseUploadFile.d.ts +0 -14
  110. package/dist/components/UploadFile/utils/convertFileTypeToAcceptedFileExtension/convertFileTypeToAcceptedFileExtension.d.ts +0 -1
  111. package/dist/components/UploadFile/utils/convertFileTypeToAcceptedFileExtension/convertFileTypeToAcceptedFileType.cjs +0 -17
  112. package/dist/components/UploadFile/utils/convertFileTypeToAcceptedFileExtension/convertFileTypeToAcceptedFileType.cjs.map +0 -1
  113. package/dist/components/UploadFile/utils/convertFileTypeToAcceptedFileExtension/convertFileTypeToAcceptedFileType.d.ts +0 -1
  114. package/dist/components/UploadFile/utils/convertFileTypeToAcceptedFileExtension/convertFileTypeToAcceptedFileType.js +0 -15
  115. package/dist/components/UploadFile/utils/convertFileTypeToAcceptedFileExtension/convertFileTypeToAcceptedFileType.js.map +0 -1
  116. package/dist/components/UploadFile/utils/convertFileTypeToAcceptedFileExtension/index.d.ts +0 -1
  117. package/dist/components/UploadFile/utils/isImageType/index.d.ts +0 -1
  118. package/dist/components/UploadFile/utils/isImageType/isImageType.cjs +0 -14
  119. package/dist/components/UploadFile/utils/isImageType/isImageType.cjs.map +0 -1
  120. package/dist/components/UploadFile/utils/isImageType/isImageType.d.ts +0 -1
  121. package/dist/components/UploadFile/utils/isImageType/isImageType.js +0 -12
  122. package/dist/components/UploadFile/utils/isImageType/isImageType.js.map +0 -1
  123. package/dist/components/ViewsContainer/styled.cjs +0 -37
  124. package/dist/components/ViewsContainer/styled.cjs.map +0 -1
  125. package/dist/components/ViewsContainer/styled.d.ts +0 -34
  126. package/dist/components/ViewsContainer/styled.js +0 -23
  127. package/dist/components/ViewsContainer/styled.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"usePreviewImage.cjs","sources":["../../../../../src/components/UploadFile/hooks/usePreviewImage/usePreviewImage.ts"],"sourcesContent":["import { useState, useEffect } from 'react';\nimport { isImageType } from '../../utils/isImageType';\n\ntype UsePreviewImageProps = {\n file?: File | null;\n};\n\nexport const usePreviewImage = ({ file }: UsePreviewImageProps) => {\n const [previewSrc, setPreviewSrc] = useState('');\n\n useEffect(() => {\n if (!file) {\n setPreviewSrc('');\n return undefined;\n }\n\n if (!isImageType(file)) {\n setPreviewSrc('');\n return undefined;\n }\n\n const fileReader = new FileReader();\n\n fileReader.onload = (event) => {\n const imageUrl = event.target?.result;\n setPreviewSrc(String(imageUrl));\n };\n\n fileReader.readAsDataURL(file);\n\n return () => {\n fileReader.abort();\n };\n }, [file]);\n\n const shouldShowPreview = file ? isImageType(file) : false;\n\n return {\n previewSrc,\n shouldShowPreview,\n };\n};\n"],"names":["useState","useEffect","isImageType"],"mappings":";;;;;MAOa,eAAe,GAAG,CAAC,EAAE,IAAI,EAAwB,KAAI;IAChE,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAGA,cAAQ,CAAC,EAAE,CAAC;IAEhDC,eAAS,CAAC,MAAK;QACb,IAAI,CAAC,IAAI,EAAE;YACT,aAAa,CAAC,EAAE,CAAC;AACjB,YAAA,OAAO,SAAS;AACjB;AAED,QAAA,IAAI,CAACC,uBAAW,CAAC,IAAI,CAAC,EAAE;YACtB,aAAa,CAAC,EAAE,CAAC;AACjB,YAAA,OAAO,SAAS;AACjB;AAED,QAAA,MAAM,UAAU,GAAG,IAAI,UAAU,EAAE;AAEnC,QAAA,UAAU,CAAC,MAAM,GAAG,CAAC,KAAK,KAAI;;YAC5B,MAAM,QAAQ,GAAG,CAAA,EAAA,GAAA,KAAK,CAAC,MAAM,MAAA,IAAA,IAAA,EAAA,KAAA,SAAA,GAAA,SAAA,GAAA,EAAA,CAAE,MAAM;AACrC,YAAA,aAAa,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;AACjC,SAAC;AAED,QAAA,UAAU,CAAC,aAAa,CAAC,IAAI,CAAC;AAE9B,QAAA,OAAO,MAAK;YACV,UAAU,CAAC,KAAK,EAAE;AACpB,SAAC;AACH,KAAC,EAAE,CAAC,IAAI,CAAC,CAAC;AAEV,IAAA,MAAM,iBAAiB,GAAG,IAAI,GAAGA,uBAAW,CAAC,IAAI,CAAC,GAAG,KAAK;IAE1D,OAAO;QACL,UAAU;QACV,iBAAiB;KAClB;AACH;;;;"}
@@ -1,8 +0,0 @@
1
- type UsePreviewImageProps = {
2
- file?: File | null;
3
- };
4
- export declare const usePreviewImage: ({ file }: UsePreviewImageProps) => {
5
- previewSrc: string;
6
- shouldShowPreview: boolean;
7
- };
8
- export {};
@@ -1,34 +0,0 @@
1
- import { useState, useEffect } from 'react';
2
- import { isImageType } from '../../utils/isImageType/isImageType.js';
3
-
4
- const usePreviewImage = ({ file }) => {
5
- const [previewSrc, setPreviewSrc] = useState('');
6
- useEffect(() => {
7
- if (!file) {
8
- setPreviewSrc('');
9
- return undefined;
10
- }
11
- if (!isImageType(file)) {
12
- setPreviewSrc('');
13
- return undefined;
14
- }
15
- const fileReader = new FileReader();
16
- fileReader.onload = (event) => {
17
- var _a;
18
- const imageUrl = (_a = event.target) === null || _a === undefined ? undefined : _a.result;
19
- setPreviewSrc(String(imageUrl));
20
- };
21
- fileReader.readAsDataURL(file);
22
- return () => {
23
- fileReader.abort();
24
- };
25
- }, [file]);
26
- const shouldShowPreview = file ? isImageType(file) : false;
27
- return {
28
- previewSrc,
29
- shouldShowPreview,
30
- };
31
- };
32
-
33
- export { usePreviewImage };
34
- //# sourceMappingURL=usePreviewImage.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"usePreviewImage.js","sources":["../../../../../src/components/UploadFile/hooks/usePreviewImage/usePreviewImage.ts"],"sourcesContent":["import { useState, useEffect } from 'react';\nimport { isImageType } from '../../utils/isImageType';\n\ntype UsePreviewImageProps = {\n file?: File | null;\n};\n\nexport const usePreviewImage = ({ file }: UsePreviewImageProps) => {\n const [previewSrc, setPreviewSrc] = useState('');\n\n useEffect(() => {\n if (!file) {\n setPreviewSrc('');\n return undefined;\n }\n\n if (!isImageType(file)) {\n setPreviewSrc('');\n return undefined;\n }\n\n const fileReader = new FileReader();\n\n fileReader.onload = (event) => {\n const imageUrl = event.target?.result;\n setPreviewSrc(String(imageUrl));\n };\n\n fileReader.readAsDataURL(file);\n\n return () => {\n fileReader.abort();\n };\n }, [file]);\n\n const shouldShowPreview = file ? isImageType(file) : false;\n\n return {\n previewSrc,\n shouldShowPreview,\n };\n};\n"],"names":[],"mappings":";;;MAOa,eAAe,GAAG,CAAC,EAAE,IAAI,EAAwB,KAAI;IAChE,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,QAAQ,CAAC,EAAE,CAAC;IAEhD,SAAS,CAAC,MAAK;QACb,IAAI,CAAC,IAAI,EAAE;YACT,aAAa,CAAC,EAAE,CAAC;AACjB,YAAA,OAAO,SAAS;AACjB;AAED,QAAA,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE;YACtB,aAAa,CAAC,EAAE,CAAC;AACjB,YAAA,OAAO,SAAS;AACjB;AAED,QAAA,MAAM,UAAU,GAAG,IAAI,UAAU,EAAE;AAEnC,QAAA,UAAU,CAAC,MAAM,GAAG,CAAC,KAAK,KAAI;;YAC5B,MAAM,QAAQ,GAAG,CAAA,EAAA,GAAA,KAAK,CAAC,MAAM,MAAA,IAAA,IAAA,EAAA,KAAA,SAAA,GAAA,SAAA,GAAA,EAAA,CAAE,MAAM;AACrC,YAAA,aAAa,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;AACjC,SAAC;AAED,QAAA,UAAU,CAAC,aAAa,CAAC,IAAI,CAAC;AAE9B,QAAA,OAAO,MAAK;YACV,UAAU,CAAC,KAAK,EAAE;AACpB,SAAC;AACH,KAAC,EAAE,CAAC,IAAI,CAAC,CAAC;AAEV,IAAA,MAAM,iBAAiB,GAAG,IAAI,GAAG,WAAW,CAAC,IAAI,CAAC,GAAG,KAAK;IAE1D,OAAO;QACL,UAAU;QACV,iBAAiB;KAClB;AACH;;;;"}
@@ -1 +0,0 @@
1
- export { useUploadFile } from './useUploadFile';
@@ -1,65 +0,0 @@
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 = (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
- };
48
- const clearFileSelection = () => {
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
@@ -1 +0,0 @@
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 = (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\n const clearFileSelection = () => {\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","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ACH,KAAC,EAAE,CAAC,QAAQ,CAAC,CAAC;AAEd,IAAA,MAAM,kBAAkB,GAAG,CAAC,YAAkB,KAAI;AAChD,QAAA,IAAI,CAAC,QAAQ;YAAE;AAEf,QAAA,MAAM,WAAW,GAAG,IAAI,YAAY,EAAE;QACtC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,KAAI;AACpC,YAAA,IAAI,IAAI,CAAC,IAAI,KAAK,YAAY,CAAC,IAAI;AAAE,gBAAA,OAAO;AAC5C,YAAA,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC;AAC7B,SAAC,CAAC;AAEF,QAAA,IAAI,QAAQ,KAAR,IAAA,IAAA,QAAQ,6BAAR,QAAQ,CAAE,OAAO,EAAE;YACrB,QAAQ,CAAC,OAAO,CAAC,KAAK,GAAG,WAAW,CAAC,KAAK;AAC3C;AACD,QAAA,WAAW,CAAC,WAAW,CAAC,KAAK,CAAC;AAChC,KAAC;IAED,MAAM,kBAAkB,GAAG,MAAK;;AAC9B,QAAA,IAAI,CAAA,EAAA,GAAA,QAAQ,CAAC,OAAO,gDAAE,KAAK;AAAE,YAAA,QAAQ,CAAC,OAAO,CAAC,KAAK,GAAG,EAAE;QACxD,WAAW,CAAC,SAAS,CAAC;AACxB,KAAC;IAED,OAAO;QACL,kBAAkB;QAClB,QAAQ;QACR,QAAQ;QACR,kBAAkB;QAClB,WAAW;QACX,QAAQ;KACT;AACH;;;;"}
@@ -1,9 +0,0 @@
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
- };
@@ -1,63 +0,0 @@
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 = (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
- };
46
- const clearFileSelection = () => {
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
@@ -1 +0,0 @@
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 = (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\n const clearFileSelection = () => {\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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AAO;AAC5C,YAAA,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC;AAC7B,SAAC,CAAC;AAEF,QAAA,IAAI,QAAQ,KAAR,IAAA,IAAA,QAAQ,6BAAR,QAAQ,CAAE,OAAO,EAAE;YACrB,QAAQ,CAAC,OAAO,CAAC,KAAK,GAAG,WAAW,CAAC,KAAK;AAC3C;AACD,QAAA,WAAW,CAAC,WAAW,CAAC,KAAK,CAAC;AAChC,KAAC;IAED,MAAM,kBAAkB,GAAG,MAAK;;AAC9B,QAAA,IAAI,CAAA,EAAA,GAAA,QAAQ,CAAC,OAAO,gDAAE,KAAK;AAAE,YAAA,QAAQ,CAAC,OAAO,CAAC,KAAK,GAAG,EAAE;QACxD,WAAW,CAAC,SAAS,CAAC;AACxB,KAAC;IAED,OAAO;QACL,kBAAkB;QAClB,QAAQ;QACR,QAAQ;QACR,kBAAkB;QAClB,WAAW;QACX,QAAQ;KACT;AACH;;;;"}
@@ -1 +0,0 @@
1
- export { useValidateInput } from './useValidateInput';
@@ -1,85 +0,0 @@
1
- 'use strict';
2
-
3
- var React = require('react');
4
- var constants = require('../../constants.cjs');
5
-
6
- const useValidateInput = ({ fileList, fileTypes, inputRef, maxBytes, customErrorMessage, }) => {
7
- // Tracks error states within the input element itself, using preset
8
- // error messages and assigns these to the input component based on the file
9
- const setInputValidation = React.useCallback(() => {
10
- var _a, _b, _c, _d, _e;
11
- let errorMessage = customErrorMessage !== null && customErrorMessage !== undefined ? customErrorMessage : constants.InputErrorStateMessages.VALID;
12
- if (!((_b = (_a = inputRef.current) === null || _a === undefined ? undefined : _a.files) === null || _b === undefined ? undefined : _b.length)) {
13
- (_c = inputRef.current) === null || _c === undefined ? undefined : _c.setCustomValidity(errorMessage);
14
- return;
15
- }
16
- const results = {
17
- numberOfInvalidFormatFiles: 0,
18
- numberOfInvalidSizeFiles: 0,
19
- totalFiles: inputRef.current.files.length,
20
- };
21
- Array.from(inputRef.current.files).forEach((file) => {
22
- // Check file size
23
- if (file.size > maxBytes) {
24
- results.numberOfInvalidSizeFiles += 1;
25
- }
26
- // Check file type/format
27
- const [, extension] = file.type.split('/');
28
- const isTypeValid = fileTypes.find((validType) => validType.substring(1) === extension);
29
- if (!isTypeValid) {
30
- results.numberOfInvalidFormatFiles += 1;
31
- }
32
- });
33
- // Determine appropriate error message based on validation results
34
- const hasFormatErrors = results.numberOfInvalidFormatFiles > 0;
35
- const hasSizeErrors = results.numberOfInvalidSizeFiles > 0;
36
- const isSingleFile = results.totalFiles === 1;
37
- if (hasFormatErrors && hasSizeErrors) {
38
- // Both format and size errors exist
39
- errorMessage = constants.InputErrorStateMessages.INVALID_FORMAT_AND_SIZE;
40
- }
41
- else if (hasFormatErrors && !hasSizeErrors) {
42
- // Only format errors
43
- if (isSingleFile) {
44
- errorMessage = constants.InputErrorStateMessages.INVALID_FORMAT;
45
- }
46
- else {
47
- errorMessage = constants.InputErrorStateMessages.INVALID_FORMATS;
48
- }
49
- }
50
- else if (!hasFormatErrors && hasSizeErrors) {
51
- // Only size errors
52
- if (isSingleFile) {
53
- errorMessage = constants.InputErrorStateMessages.INVALID_SIZE;
54
- }
55
- else {
56
- errorMessage = constants.InputErrorStateMessages.INVALID_SIZES;
57
- }
58
- }
59
- // If no errors, errorMessage remains VALID
60
- (_d = inputRef.current) === null || _d === undefined ? undefined : _d.setCustomValidity(errorMessage);
61
- (_e = inputRef.current) === null || _e === undefined ? undefined : _e.reportValidity();
62
- }, [customErrorMessage, inputRef, maxBytes, fileTypes]);
63
- // Validate input whenever fileList or the custom error message changes
64
- React.useEffect(() => {
65
- setInputValidation();
66
- }, [fileList, setInputValidation]);
67
- // Used to force a re-render when input validity changes
68
- const [validationCount, setValidationCount] = React.useState(0);
69
- React.useEffect(() => {
70
- const ref = inputRef === null || inputRef === undefined ? undefined : inputRef.current;
71
- if (!ref)
72
- return () => { };
73
- const handleInvalid = () => setValidationCount((v) => v + 1);
74
- ref.addEventListener('invalid', handleInvalid);
75
- return () => {
76
- ref.removeEventListener('invalid', handleInvalid);
77
- };
78
- }, [inputRef]);
79
- return {
80
- validationCount,
81
- };
82
- };
83
-
84
- exports.useValidateInput = useValidateInput;
85
- //# sourceMappingURL=useValidateInput.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useValidateInput.cjs","sources":["../../../../../src/components/UploadFile/hooks/useValidateInput/useValidateInput.ts"],"sourcesContent":["import { useEffect, useCallback, useState } from 'react';\nimport { AcceptedFileTypes, InputErrorStateMessages } from '../../constants';\n\ntype UseValidateInputProps = {\n fileTypes: Array<AcceptedFileTypes>;\n maxBytes: number;\n fileList: FileList | undefined;\n inputRef: React.MutableRefObject<HTMLInputElement | null>;\n customErrorMessage?: string;\n};\n\nexport const useValidateInput = ({\n fileList,\n fileTypes,\n inputRef,\n maxBytes,\n 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 if (hasFormatErrors && hasSizeErrors) {\n // Both format and size errors exist\n errorMessage = InputErrorStateMessages.INVALID_FORMAT_AND_SIZE;\n } else if (hasFormatErrors && !hasSizeErrors) {\n // Only format errors\n if (isSingleFile) {\n errorMessage = InputErrorStateMessages.INVALID_FORMAT;\n } else {\n errorMessage = InputErrorStateMessages.INVALID_FORMATS;\n }\n } else if (!hasFormatErrors && hasSizeErrors) {\n // Only size errors\n if (isSingleFile) {\n errorMessage = InputErrorStateMessages.INVALID_SIZE;\n } else {\n errorMessage = InputErrorStateMessages.INVALID_SIZES;\n }\n }\n // If no errors, errorMessage remains VALID\n\n inputRef.current?.setCustomValidity(errorMessage);\n inputRef.current?.reportValidity();\n }, [customErrorMessage, inputRef, maxBytes, fileTypes]);\n\n // Validate input whenever fileList or the custom error message changes\n useEffect(() => {\n setInputValidation();\n }, [fileList, setInputValidation]);\n\n // Used to force a re-render when input validity changes\n const [validationCount, setValidationCount] = useState(0);\n\n useEffect(() => {\n const ref = inputRef?.current;\n if (!ref) return () => {};\n const handleInvalid = () => setValidationCount((v) => v + 1);\n ref.addEventListener('invalid', handleInvalid);\n return () => {\n ref.removeEventListener('invalid', handleInvalid);\n };\n }, [inputRef]);\n\n return {\n validationCount,\n };\n};\n"],"names":["useCallback","InputErrorStateMessages","useEffect","useState"],"mappings":";;;;;AAWa,MAAA,gBAAgB,GAAG,CAAC,EAC/B,QAAQ,EACR,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,kBAAkB,GACI,KAAI;;;AAG1B,IAAA,MAAM,kBAAkB,GAAGA,iBAAW,CAAC,MAAK;;QAC1C,IAAI,YAAY,GAAG,kBAAkB,KAAlB,IAAA,IAAA,kBAAkB,KAAlB,SAAA,GAAA,kBAAkB,GAAIC,iCAAuB,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,E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AAC,mBAAmB,CAAC,SAAS,EAAE,aAAa,CAAC;AACnD,SAAC;AACH,KAAC,EAAE,CAAC,QAAQ,CAAC,CAAC;IAEd,OAAO;QACL,eAAe;KAChB;AACH;;;;"}
@@ -1,13 +0,0 @@
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
- customErrorMessage?: string;
9
- };
10
- export declare const useValidateInput: ({ fileList, fileTypes, inputRef, maxBytes, customErrorMessage, }: UseValidateInputProps) => {
11
- validationCount: number;
12
- };
13
- export {};
@@ -1,83 +0,0 @@
1
- import { useCallback, useEffect, useState } from 'react';
2
- import { InputErrorStateMessages } from '../../constants.js';
3
-
4
- const useValidateInput = ({ fileList, fileTypes, inputRef, maxBytes, customErrorMessage, }) => {
5
- // Tracks error states within the input element itself, using preset
6
- // error messages and assigns these to the input component based on the file
7
- const setInputValidation = useCallback(() => {
8
- var _a, _b, _c, _d, _e;
9
- let errorMessage = customErrorMessage !== null && customErrorMessage !== undefined ? customErrorMessage : InputErrorStateMessages.VALID;
10
- if (!((_b = (_a = inputRef.current) === null || _a === undefined ? undefined : _a.files) === null || _b === undefined ? undefined : _b.length)) {
11
- (_c = inputRef.current) === null || _c === undefined ? undefined : _c.setCustomValidity(errorMessage);
12
- return;
13
- }
14
- const results = {
15
- numberOfInvalidFormatFiles: 0,
16
- numberOfInvalidSizeFiles: 0,
17
- totalFiles: inputRef.current.files.length,
18
- };
19
- Array.from(inputRef.current.files).forEach((file) => {
20
- // Check file size
21
- if (file.size > maxBytes) {
22
- results.numberOfInvalidSizeFiles += 1;
23
- }
24
- // Check file type/format
25
- const [, extension] = file.type.split('/');
26
- const isTypeValid = fileTypes.find((validType) => validType.substring(1) === extension);
27
- if (!isTypeValid) {
28
- results.numberOfInvalidFormatFiles += 1;
29
- }
30
- });
31
- // Determine appropriate error message based on validation results
32
- const hasFormatErrors = results.numberOfInvalidFormatFiles > 0;
33
- const hasSizeErrors = results.numberOfInvalidSizeFiles > 0;
34
- const isSingleFile = results.totalFiles === 1;
35
- if (hasFormatErrors && hasSizeErrors) {
36
- // Both format and size errors exist
37
- errorMessage = InputErrorStateMessages.INVALID_FORMAT_AND_SIZE;
38
- }
39
- else if (hasFormatErrors && !hasSizeErrors) {
40
- // Only format errors
41
- if (isSingleFile) {
42
- errorMessage = InputErrorStateMessages.INVALID_FORMAT;
43
- }
44
- else {
45
- errorMessage = InputErrorStateMessages.INVALID_FORMATS;
46
- }
47
- }
48
- else if (!hasFormatErrors && hasSizeErrors) {
49
- // Only size errors
50
- if (isSingleFile) {
51
- errorMessage = InputErrorStateMessages.INVALID_SIZE;
52
- }
53
- else {
54
- errorMessage = InputErrorStateMessages.INVALID_SIZES;
55
- }
56
- }
57
- // If no errors, errorMessage remains VALID
58
- (_d = inputRef.current) === null || _d === undefined ? undefined : _d.setCustomValidity(errorMessage);
59
- (_e = inputRef.current) === null || _e === undefined ? undefined : _e.reportValidity();
60
- }, [customErrorMessage, inputRef, maxBytes, fileTypes]);
61
- // Validate input whenever fileList or the custom error message changes
62
- useEffect(() => {
63
- setInputValidation();
64
- }, [fileList, setInputValidation]);
65
- // Used to force a re-render when input validity changes
66
- const [validationCount, setValidationCount] = useState(0);
67
- useEffect(() => {
68
- const ref = inputRef === null || inputRef === undefined ? undefined : inputRef.current;
69
- if (!ref)
70
- return () => { };
71
- const handleInvalid = () => setValidationCount((v) => v + 1);
72
- ref.addEventListener('invalid', handleInvalid);
73
- return () => {
74
- ref.removeEventListener('invalid', handleInvalid);
75
- };
76
- }, [inputRef]);
77
- return {
78
- validationCount,
79
- };
80
- };
81
-
82
- export { useValidateInput };
83
- //# sourceMappingURL=useValidateInput.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useValidateInput.js","sources":["../../../../../src/components/UploadFile/hooks/useValidateInput/useValidateInput.ts"],"sourcesContent":["import { useEffect, useCallback, useState } from 'react';\nimport { AcceptedFileTypes, InputErrorStateMessages } from '../../constants';\n\ntype UseValidateInputProps = {\n fileTypes: Array<AcceptedFileTypes>;\n maxBytes: number;\n fileList: FileList | undefined;\n inputRef: React.MutableRefObject<HTMLInputElement | null>;\n customErrorMessage?: string;\n};\n\nexport const useValidateInput = ({\n fileList,\n fileTypes,\n inputRef,\n maxBytes,\n 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 if (hasFormatErrors && hasSizeErrors) {\n // Both format and size errors exist\n errorMessage = InputErrorStateMessages.INVALID_FORMAT_AND_SIZE;\n } else if (hasFormatErrors && !hasSizeErrors) {\n // Only format errors\n if (isSingleFile) {\n errorMessage = InputErrorStateMessages.INVALID_FORMAT;\n } else {\n errorMessage = InputErrorStateMessages.INVALID_FORMATS;\n }\n } else if (!hasFormatErrors && hasSizeErrors) {\n // Only size errors\n if (isSingleFile) {\n errorMessage = InputErrorStateMessages.INVALID_SIZE;\n } else {\n errorMessage = InputErrorStateMessages.INVALID_SIZES;\n }\n }\n // If no errors, errorMessage remains VALID\n\n inputRef.current?.setCustomValidity(errorMessage);\n inputRef.current?.reportValidity();\n }, [customErrorMessage, inputRef, maxBytes, fileTypes]);\n\n // Validate input whenever fileList or the custom error message changes\n useEffect(() => {\n setInputValidation();\n }, [fileList, setInputValidation]);\n\n // Used to force a re-render when input validity changes\n const [validationCount, setValidationCount] = useState(0);\n\n useEffect(() => {\n const ref = inputRef?.current;\n if (!ref) return () => {};\n const handleInvalid = () => setValidationCount((v) => v + 1);\n ref.addEventListener('invalid', handleInvalid);\n return () => {\n ref.removeEventListener('invalid', handleInvalid);\n };\n }, [inputRef]);\n\n return {\n validationCount,\n };\n};\n"],"names":[],"mappings":";;;AAWa,MAAA,gBAAgB,GAAG,CAAC,EAC/B,QAAQ,EACR,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,kBAAkB,GACI,KAAI;;;AAG1B,IAAA,MAAM,kBAAkB,GAAG,WAAW,CAAC,MAAK;;QAC1C,IAAI,YAAY,GAAG,kBAAkB,KAAlB,IAAA,IAAA,kBAAkB,KAAlB,SAAA,GAAA,kBAAkB,GAAI,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,EA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AG,uBAAuB,CAAC,aAAa;AACrD;AACF;;QAGD,CAAA,EAAA,GAAA,QAAQ,CAAC,OAAO,MAAA,IAAA,IAAA,EAAA,KAAA,SAAA,GAAA,SAAA,GAAA,EAAA,CAAE,iBAAiB,CAAC,YAAY,CAAC;AACjD,QAAA,CAAA,EAAA,GAAA,QAAQ,CAAC,OAAO,MAAE,IAAA,IAAA,EAAA,KAAA,SAAA,GAAA,SAAA,GAAA,EAAA,CAAA,cAAc,EAAE;KACnC,EAAE,CAAC,kBAAkB,EAAE,QAAQ,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC;;IAGvD,SAAS,CAAC,MAAK;AACb,QAAA,kBAAkB,EAAE;AACtB,KAAC,EAAE,CAAC,QAAQ,EAAE,kBAAkB,CAAC,CAAC;;IAGlC,MAAM,CAAC,eAAe,EAAE,kBAAkB,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC;IAEzD,SAAS,CAAC,MAAK;QACb,MAAM,GAAG,GAAG,QAAQ,KAAA,IAAA,IAAR,QAAQ,KAAR,SAAA,GAAA,SAAA,GAAA,QAAQ,CAAE,OAAO;AAC7B,QAAA,IAAI,CAAC,GAAG;AAAE,YAAA,OAAO,MAAO,GAAC;AACzB,QAAA,MAAM,aAAa,GAAG,MAAM,kBAAkB,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;AAC5D,QAAA,GAAG,CAAC,gBAAgB,CAAC,SAAS,EAAE,aAAa,CAAC;AAC9C,QAAA,OAAO,MAAK;AACV,YAAA,GAAG,CAAC,mBAAmB,CAAC,SAAS,EAAE,aAAa,CAAC;AACnD,SAAC;AACH,KAAC,EAAE,CAAC,QAAQ,CAAC,CAAC;IAEd,OAAO;QACL,eAAe;KAChB;AACH;;;;"}
@@ -1,14 +0,0 @@
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
- };
@@ -1 +0,0 @@
1
- export declare const convertFileTypeToAcceptedFileExtension: (fileType: string) => string;
@@ -1,17 +0,0 @@
1
- 'use strict';
2
-
3
- const convertFileTypeToAcceptedFileExtension = (fileType) => {
4
- if (typeof fileType !== 'string' || !fileType.includes('/')) {
5
- throw new Error('Invalid MIME type');
6
- }
7
- // Remove any MIME parameter (e.g., ";charset=UTF-8")
8
- const [typePart] = fileType.split(';');
9
- const [group, type] = typePart.trim().split('/');
10
- if (!group || !type) {
11
- throw new Error('Invalid MIME type');
12
- }
13
- return `.${type}`;
14
- };
15
-
16
- exports.convertFileTypeToAcceptedFileExtension = convertFileTypeToAcceptedFileExtension;
17
- //# sourceMappingURL=convertFileTypeToAcceptedFileType.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"convertFileTypeToAcceptedFileType.cjs","sources":["../../../../../src/components/UploadFile/utils/convertFileTypeToAcceptedFileExtension/convertFileTypeToAcceptedFileType.ts"],"sourcesContent":["export const convertFileTypeToAcceptedFileExtension = (fileType: string) => {\n if (typeof fileType !== 'string' || !fileType.includes('/')) {\n throw new Error('Invalid MIME type');\n }\n // Remove any MIME parameter (e.g., \";charset=UTF-8\")\n const [typePart] = fileType.split(';');\n const [group, type] = typePart.trim().split('/');\n if (!group || !type) {\n throw new Error('Invalid MIME type');\n }\n return `.${type}`;\n};\n"],"names":[],"mappings":";;AAAa,MAAA,sCAAsC,GAAG,CAAC,QAAgB,KAAI;AACzE,IAAA,IAAI,OAAO,QAAQ,KAAK,QAAQ,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;AAC3D,QAAA,MAAM,IAAI,KAAK,CAAC,mBAAmB,CAAC;AACrC;;IAED,MAAM,CAAC,QAAQ,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC;AACtC,IAAA,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,GAAG,QAAQ,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC;AAChD,IAAA,IAAI,CAAC,KAAK,IAAI,CAAC,IAAI,EAAE;AACnB,QAAA,MAAM,IAAI,KAAK,CAAC,mBAAmB,CAAC;AACrC;IACD,OAAO,CAAA,CAAA,EAAI,IAAI,CAAA,CAAE;AACnB;;;;"}
@@ -1 +0,0 @@
1
- export declare const convertFileTypeToAcceptedFileExtension: (fileType: string) => string;
@@ -1,15 +0,0 @@
1
- const convertFileTypeToAcceptedFileExtension = (fileType) => {
2
- if (typeof fileType !== 'string' || !fileType.includes('/')) {
3
- throw new Error('Invalid MIME type');
4
- }
5
- // Remove any MIME parameter (e.g., ";charset=UTF-8")
6
- const [typePart] = fileType.split(';');
7
- const [group, type] = typePart.trim().split('/');
8
- if (!group || !type) {
9
- throw new Error('Invalid MIME type');
10
- }
11
- return `.${type}`;
12
- };
13
-
14
- export { convertFileTypeToAcceptedFileExtension };
15
- //# sourceMappingURL=convertFileTypeToAcceptedFileType.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"convertFileTypeToAcceptedFileType.js","sources":["../../../../../src/components/UploadFile/utils/convertFileTypeToAcceptedFileExtension/convertFileTypeToAcceptedFileType.ts"],"sourcesContent":["export const convertFileTypeToAcceptedFileExtension = (fileType: string) => {\n if (typeof fileType !== 'string' || !fileType.includes('/')) {\n throw new Error('Invalid MIME type');\n }\n // Remove any MIME parameter (e.g., \";charset=UTF-8\")\n const [typePart] = fileType.split(';');\n const [group, type] = typePart.trim().split('/');\n if (!group || !type) {\n throw new Error('Invalid MIME type');\n }\n return `.${type}`;\n};\n"],"names":[],"mappings":"AAAa,MAAA,sCAAsC,GAAG,CAAC,QAAgB,KAAI;AACzE,IAAA,IAAI,OAAO,QAAQ,KAAK,QAAQ,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;AAC3D,QAAA,MAAM,IAAI,KAAK,CAAC,mBAAmB,CAAC;AACrC;;IAED,MAAM,CAAC,QAAQ,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC;AACtC,IAAA,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,GAAG,QAAQ,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC;AAChD,IAAA,IAAI,CAAC,KAAK,IAAI,CAAC,IAAI,EAAE;AACnB,QAAA,MAAM,IAAI,KAAK,CAAC,mBAAmB,CAAC;AACrC;IACD,OAAO,CAAA,CAAA,EAAI,IAAI,CAAA,CAAE;AACnB;;;;"}
@@ -1 +0,0 @@
1
- export { convertFileTypeToAcceptedFileExtension } from './convertFileTypeToAcceptedFileType';
@@ -1 +0,0 @@
1
- export { isImageType } from './isImageType';
@@ -1,14 +0,0 @@
1
- 'use strict';
2
-
3
- const isImageType = (file) => {
4
- if (!file)
5
- return false;
6
- const fileType = file.type.split('/');
7
- if (fileType[0] === 'image') {
8
- return true;
9
- }
10
- return false;
11
- };
12
-
13
- exports.isImageType = isImageType;
14
- //# sourceMappingURL=isImageType.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"isImageType.cjs","sources":["../../../../../src/components/UploadFile/utils/isImageType/isImageType.ts"],"sourcesContent":["export const isImageType = (file?: File | null) => {\n if (!file) return false;\n\n const fileType = file.type.split('/');\n\n if (fileType[0] === 'image') {\n return true;\n }\n\n return false;\n};\n"],"names":[],"mappings":";;AAAa,MAAA,WAAW,GAAG,CAAC,IAAkB,KAAI;AAChD,IAAA,IAAI,CAAC,IAAI;AAAE,QAAA,OAAO,KAAK;IAEvB,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC;AAErC,IAAA,IAAI,QAAQ,CAAC,CAAC,CAAC,KAAK,OAAO,EAAE;AAC3B,QAAA,OAAO,IAAI;AACZ;AAED,IAAA,OAAO,KAAK;AACd;;;;"}
@@ -1 +0,0 @@
1
- export declare const isImageType: (file?: File | null) => boolean;
@@ -1,12 +0,0 @@
1
- const isImageType = (file) => {
2
- if (!file)
3
- return false;
4
- const fileType = file.type.split('/');
5
- if (fileType[0] === 'image') {
6
- return true;
7
- }
8
- return false;
9
- };
10
-
11
- export { isImageType };
12
- //# sourceMappingURL=isImageType.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"isImageType.js","sources":["../../../../../src/components/UploadFile/utils/isImageType/isImageType.ts"],"sourcesContent":["export const isImageType = (file?: File | null) => {\n if (!file) return false;\n\n const fileType = file.type.split('/');\n\n if (fileType[0] === 'image') {\n return true;\n }\n\n return false;\n};\n"],"names":[],"mappings":"AAAa,MAAA,WAAW,GAAG,CAAC,IAAkB,KAAI;AAChD,IAAA,IAAI,CAAC,IAAI;AAAE,QAAA,OAAO,KAAK;IAEvB,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC;AAErC,IAAA,IAAI,QAAQ,CAAC,CAAC,CAAC,KAAK,OAAO,EAAE;AAC3B,QAAA,OAAO,IAAI;AACZ;AAED,IAAA,OAAO,KAAK;AACd;;;;"}
@@ -1,37 +0,0 @@
1
- 'use strict';
2
-
3
- var styled = require('styled-components');
4
- var Stack = require('../Stack/Stack.cjs');
5
- require('../Stack/types.cjs');
6
- var Button = require('../Button/Button.cjs');
7
- require('react');
8
- var LeftArrowIcon = require('../../icons/design-system/components/LeftArrowIcon.cjs');
9
- var RightArrowIcon = require('../../icons/design-system/components/RightArrowIcon.cjs');
10
- var ThreeDotsIcon = require('../../icons/custom/components/ThreeDotsIcon.cjs');
11
- var colors = require('../../theme/modules/colors.cjs');
12
- var index = require('../InputGroup/index.cjs');
13
-
14
- function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
15
-
16
- var styled__default = /*#__PURE__*/_interopDefaultCompat(styled);
17
-
18
- const ViewsWrapper = styled__default.default(Stack.Stack).withConfig({ displayName: "vui--ViewsWrapper", componentId: "vui--x8ukf0" }) `overflow-x:scroll;-ms-overflow-style:none;scrollbar-width:none;::-webkit-scrollbar{display:none;}gap:8px;height:inherit;padding:8px 6px 8px 12px;margin-left:0;`;
19
- const Container = styled__default.default(Stack.Stack).withConfig({ displayName: "vui--Container", componentId: "vui--mlh8wa" }) `background-color:${colors.colors.neutral.grey.lightest};`;
20
- const StyledLeftIcon = styled__default.default(LeftArrowIcon.ReactComponent).withConfig({ displayName: "vui--StyledLeftIcon", componentId: "vui--193620d" }) `color:${colors.colors.neutral.ink.base};`;
21
- const StyledRightIcon = styled__default.default(RightArrowIcon.ReactComponent).withConfig({ displayName: "vui--StyledRightIcon", componentId: "vui--erlipg" }) `color:${colors.colors.neutral.ink.base};`;
22
- const StyledMenuIcon = styled__default.default(ThreeDotsIcon.ThreeDotsIcon).withConfig({ displayName: "vui--StyledMenuIcon", componentId: "vui--eg23b0" }) `color:${colors.colors.neutral.ink.base};`;
23
- const StyledMenuButton = styled__default.default(Button.Button).withConfig({ displayName: "vui--StyledMenuButton", componentId: "vui--1o9jbht" }) `background-color:white;&:hover{background-color:${colors.colors.neutral.grey.lightest};}`;
24
- const StyledLeftButton = styled__default.default(Button.Button).withConfig({ displayName: "vui--StyledLeftButton", componentId: "vui--wtwmiz" }) `background-color:white;&:disabled{background-color:white;${StyledLeftIcon}{color:${colors.colors.neutral.ink.lightest};}}&:hover{background-color:${colors.colors.neutral.grey.lightest};}`;
25
- const StyledRightButton = styled__default.default(Button.Button).withConfig({ displayName: "vui--StyledRightButton", componentId: "vui--1ycuwov" }) `background-color:white;&:disabled{background-color:white;${StyledRightIcon}{color:${colors.colors.neutral.ink.lightest};}}&:hover{background-color:${colors.colors.neutral.grey.lightest};}`;
26
- const StyledInputGroup = styled__default.default(index.InputGroup).withConfig({ displayName: "vui--StyledInputGroup", componentId: "vui--l3ez4z" }) `padding-right:8px;margin-left:0;& > *:first-child:last-child{border-radius:4px !important;}`;
27
-
28
- exports.Container = Container;
29
- exports.StyledInputGroup = StyledInputGroup;
30
- exports.StyledLeftButton = StyledLeftButton;
31
- exports.StyledLeftIcon = StyledLeftIcon;
32
- exports.StyledMenuButton = StyledMenuButton;
33
- exports.StyledMenuIcon = StyledMenuIcon;
34
- exports.StyledRightButton = StyledRightButton;
35
- exports.StyledRightIcon = StyledRightIcon;
36
- exports.ViewsWrapper = ViewsWrapper;
37
- //# sourceMappingURL=styled.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"styled.cjs","sources":["../../../src/components/ViewsContainer/styled.ts"],"sourcesContent":["import styled from 'styled-components';\nimport { Stack } from '../Stack';\nimport { Button } from '../Button';\nimport { LeftArrowIcon, RightArrowIcon, ThreeDotsIcon } from '../../icons';\nimport { colors } from '../../theme/modules/colors';\nimport { InputGroup } from '../InputGroup';\n\nexport const ViewsWrapper = styled(Stack)`\n overflow-x: scroll;\n -ms-overflow-style: none; /* for Internet Explorer, Edge */\n scrollbar-width: none; /* for Firefox */\n\n ::-webkit-scrollbar {\n display: none; /* for Chrome, Safari, and Opera */\n }\n\n gap: 8px;\n height: inherit;\n padding: 8px 6px 8px 12px;\n margin-left: 0;\n`;\n\nexport const Container = styled(Stack)`\n background-color: ${colors.neutral.grey.lightest};\n`;\n\nexport const StyledLeftIcon = styled(LeftArrowIcon)`\n color: ${colors.neutral.ink.base};\n`;\nexport const StyledRightIcon = styled(RightArrowIcon)`\n color: ${colors.neutral.ink.base};\n`;\n\nexport const StyledMenuIcon = styled(ThreeDotsIcon)`\n color: ${colors.neutral.ink.base};\n`;\n\nexport const StyledMenuButton = styled(Button)`\n background-color: white;\n\n &:hover {\n background-color: ${colors.neutral.grey.lightest};\n }\n`;\n\nexport const StyledLeftButton = styled(Button)`\n background-color: white;\n\n &:disabled {\n background-color: white;\n ${StyledLeftIcon} {\n color: ${colors.neutral.ink.lightest};\n }\n }\n\n &:hover {\n background-color: ${colors.neutral.grey.lightest};\n }\n`;\n\nexport const StyledRightButton = styled(Button)`\n background-color: white;\n\n &:disabled {\n background-color: white;\n ${StyledRightIcon} {\n color: ${colors.neutral.ink.lightest};\n }\n }\n\n &:hover {\n background-color: ${colors.neutral.grey.lightest};\n }\n`;\n\nexport const StyledInputGroup = styled(InputGroup)`\n padding-right: 8px;\n margin-left: 0;\n\n & > *:first-child:last-child {\n border-radius: 4px !important;\n }\n`;\n"],"names":["styled","Stack","colors","LeftArrowIcon","RightArrowIcon","ThreeDotsIcon","Button","InputGroup"],"mappings":";;;;;;;;;;;;;;;;;MAOa,YAAY,GAAGA,uBAAM,CAACC,WAAK,CAAC,CAAA,UAAA,CAAA,EAAA,WAAA,EAAA,mBAAA,EAAA,WAAA,EAAA,aAAA,EAAA,CAAA,CAAA,CAAA,+JAAA;AAe5B,MAAA,SAAS,GAAGD,uBAAM,CAACC,WAAK,CAAC,CAChB,UAAA,CAAA,EAAA,WAAA,EAAA,gBAAA,EAAA,WAAA,EAAA,aAAA,EAAA,CAAA,CAAA,CAAA,iBAAA,EAAAC,aAAM,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ;AAGrC,MAAA,cAAc,GAAGF,uBAAM,CAACG,4BAAa,CAAC,CACxC,UAAA,CAAA,EAAA,WAAA,EAAA,qBAAA,EAAA,WAAA,EAAA,cAAA,EAAA,CAAA,CAAA,CAAA,MAAA,EAAAD,aAAM,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI;AAErB,MAAA,eAAe,GAAGF,uBAAM,CAACI,6BAAc,CAAC,CAC1C,UAAA,CAAA,EAAA,WAAA,EAAA,sBAAA,EAAA,WAAA,EAAA,aAAA,EAAA,CAAA,CAAA,CAAA,MAAA,EAAAF,aAAM,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI;AAGrB,MAAA,cAAc,GAAGF,uBAAM,CAACK,2BAAa,CAAC,CACxC,UAAA,CAAA,EAAA,WAAA,EAAA,qBAAA,EA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