@mainframework/dropzone 1.0.13 → 1.0.15
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/LICENSE +20 -20
- package/README.md +114 -114
- package/dist/esm/shared/components/FileSelector/FileSelector.d.ts +1 -1
- package/dist/esm/shared/components/FileSelector/tailwind.css +2 -1
- package/dist/esm/shared/hooks/useCustomCallback.d.ts +1 -1
- package/dist/esm/shared/hooks/useFileSelector.d.ts +7 -4
- package/dist/esm/shared/types/types.d.ts +7 -0
- package/dist/esm/shared/utils/dragAndDrop.d.ts +2 -0
- package/dist/esm/shared/utils/mergeStyles.d.ts +2 -0
- package/dist/esm/shared/utils/processUploadedFiles.d.ts +13 -7
- package/package.json +94 -86
- package/dist/esm/index.js +0 -2
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/shared/components/FileSelector/FileSelector.js +0 -37
- package/dist/esm/shared/components/FileSelector/FileSelector.js.map +0 -1
- package/dist/esm/shared/components/FileSelector/index.js +0 -2
- package/dist/esm/shared/components/FileSelector/index.js.map +0 -1
- package/dist/esm/shared/hooks/useCustomCallback.js +0 -14
- package/dist/esm/shared/hooks/useCustomCallback.js.map +0 -1
- package/dist/esm/shared/hooks/useFileSelector.js +0 -178
- package/dist/esm/shared/hooks/useFileSelector.js.map +0 -1
- package/dist/esm/shared/types/types.js +0 -2
- package/dist/esm/shared/types/types.js.map +0 -1
- package/dist/esm/shared/utils/equalityChecks.d.ts +0 -1
- package/dist/esm/shared/utils/equalityChecks.js +0 -41
- package/dist/esm/shared/utils/equalityChecks.js.map +0 -1
- package/dist/esm/shared/utils/processUploadedFiles.js +0 -127
- package/dist/esm/shared/utils/processUploadedFiles.js.map +0 -1
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2022 Igor Gaponov (gapon2401)
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022 Igor Gaponov (gapon2401)
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
21
|
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,114 +1,114 @@
|
|
|
1
|
-
### A React package, that allows for the selection of files, through drag and drop or the File Dialog api. Re-rendering is kept to a minimum, helping with application performance
|
|
2
|
-
|
|
3
|
-
### Installation:
|
|
4
|
-
|
|
5
|
-
npm i @mainframework/dropzone
|
|
6
|
-
yarn @mainframework/dropzone
|
|
7
|
-
|
|
8
|
-
### Configuration and properties
|
|
9
|
-
|
|
10
|
-
`Hook config properties`
|
|
11
|
-
{
|
|
12
|
-
maximumUploadCount:5, //Defaults to 30
|
|
13
|
-
maximumFileSize = maxFileSize, //Defaults to 5 mb's
|
|
14
|
-
acceptedTypes = defaultTypeExtensions, //See the default extensions above
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
`Hook - returned properties`
|
|
18
|
-
|
|
19
|
-
```JS | TS
|
|
20
|
-
{
|
|
21
|
-
//Properties
|
|
22
|
-
validFiles, //These are the valid files selected
|
|
23
|
-
invalidFiles, //The invalid files a user attempted to select
|
|
24
|
-
|
|
25
|
-
//Methods
|
|
26
|
-
clearCache, // This will clear out the valid and invalid files
|
|
27
|
-
getValidFileStreams, //This will provde the actual File | Blobs that are within the valid Files
|
|
28
|
-
onCancel, //This will call clearCache
|
|
29
|
-
onIdChange, //Use this, if you want to change the name of a File.
|
|
30
|
-
onRemoveFile, //Remove a file from the valid files array
|
|
31
|
-
setMaximumFileSizeExceeded, //Use this for any errors generated, regarding the maximum file size
|
|
32
|
-
setMaximumUploadsExceeded, //Use this for any errors generated regarding the maximum number of uploads
|
|
33
|
-
|
|
34
|
-
//Component - Export the FileSelector: Use this ready made comopnent.
|
|
35
|
-
FileSelector: () => (
|
|
36
|
-
<FileSelector
|
|
37
|
-
inputId={"SomeID"} //Optional
|
|
38
|
-
messageParagraph={"A message to display in the dropzone"} //Optional - Defaults to "Drag 'n' drop some files here, or click to select files"
|
|
39
|
-
inputClassName={"some css classes"} //Optional - You can add your own css. The default is hidden, a tailwindcss class
|
|
40
|
-
clickableAreaClassName={"some css classes"} //Optional - You can add your own css. The default is composed of some tailwindclasses. It's either or.
|
|
41
|
-
dropZoneWrapperClassName={"some css classes"} //Optional - You can add your own css. The default is composed of some tailwindclasses. It's either or.
|
|
42
|
-
messageParagraphClassName={"some css classes"} //Optional - You can add your own css. The default is composed of some tailwindclasses. It's either or.
|
|
43
|
-
onChange={onInputChange}
|
|
44
|
-
onDragOver={onDragOver}
|
|
45
|
-
onDrop={onDrop}
|
|
46
|
-
onDragEnter={onDragEnter}
|
|
47
|
-
onDragLeave={onDragLeave}
|
|
48
|
-
/>
|
|
49
|
-
),
|
|
50
|
-
}
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
```JS | TS
|
|
54
|
-
//Here are the default upload types the pacakge will handle. You can send in your own, so long as it's in the following format.
|
|
55
|
-
export const defaultTypeExtensions: Record<string, string> = {
|
|
56
|
-
"image/png": ".png",
|
|
57
|
-
"image/jpeg": ".jpeg",
|
|
58
|
-
"image/jpg": ".jpg",
|
|
59
|
-
"image/svg+xml": ".svg",
|
|
60
|
-
"application/pdf": ".pdf",
|
|
61
|
-
"application/msword": ".doc",
|
|
62
|
-
"application/vnd.openxmlformats-officedocument.wordprocessingml.document": ".docx",
|
|
63
|
-
};
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
### Hook configuration
|
|
67
|
-
|
|
68
|
-
```JS | TS
|
|
69
|
-
//Here you can set the following properties for the FileSelector. These are all optional
|
|
70
|
-
const { validFiles, onIdChange, onCancel, onRemoveFile, FileSelector } = useFileSelector({
|
|
71
|
-
acceptTypes: ".png" //Defaults to ".png, .jpg, .jpeg, .pdf, .svg, image/svg+xml, application/msword, application/vnd.openxmlformats-officedocument.wordprocessingml.document"
|
|
72
|
-
maximumUploadCount:5, //Defaults to 30
|
|
73
|
-
maximumFileSize = 5e6, //Defaults to 5 mb's
|
|
74
|
-
acceptedTypes = defaultTypeExtensions, //See the default extensions above
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
```
|
|
78
|
-
|
|
79
|
-
### Usage
|
|
80
|
-
|
|
81
|
-
### App.tsx
|
|
82
|
-
|
|
83
|
-
Once the package is installed, import the hook
|
|
84
|
-
|
|
85
|
-
```JS | TS
|
|
86
|
-
import { useFileSelector } from "@mainframework/dropzone";
|
|
87
|
-
|
|
88
|
-
export const App = ()=>{
|
|
89
|
-
//Note: You can set the following props for the hook maximumUploadCount, maximumFileSize, acceptedTypes
|
|
90
|
-
const { validFiles, onIdChange, onCancel, onRemoveFile, FileSelector } = useFileSelector();
|
|
91
|
-
|
|
92
|
-
const onSelect = () => {
|
|
93
|
-
if (Array.isArray(validFiles)) {
|
|
94
|
-
//This will be used to select the files. Won't be used here
|
|
95
|
-
}
|
|
96
|
-
};
|
|
97
|
-
|
|
98
|
-
return (
|
|
99
|
-
<>
|
|
100
|
-
<FileSelector /> {/*This is the component that will display the dropzone*/}
|
|
101
|
-
|
|
102
|
-
{validFiles.length > 0 && (
|
|
103
|
-
<PreviewImages //<---PreviewImages is a component where you render the images. It's up to you to provide this functionality
|
|
104
|
-
validFiles={validFiles}
|
|
105
|
-
onChange={onIdChange}
|
|
106
|
-
onSelect={onSelect}
|
|
107
|
-
onCancel={onCancel}
|
|
108
|
-
onRemoveFile={onRemoveFile}
|
|
109
|
-
/>
|
|
110
|
-
)}
|
|
111
|
-
</>
|
|
112
|
-
);
|
|
113
|
-
}
|
|
114
|
-
```
|
|
1
|
+
### A React package, that allows for the selection of files, through drag and drop or the File Dialog api. Re-rendering is kept to a minimum, helping with application performance
|
|
2
|
+
|
|
3
|
+
### Installation:
|
|
4
|
+
|
|
5
|
+
npm i @mainframework/dropzone
|
|
6
|
+
yarn @mainframework/dropzone
|
|
7
|
+
|
|
8
|
+
### Configuration and properties
|
|
9
|
+
|
|
10
|
+
`Hook config properties`
|
|
11
|
+
{
|
|
12
|
+
maximumUploadCount:5, //Defaults to 30
|
|
13
|
+
maximumFileSize = maxFileSize, //Defaults to 5 mb's
|
|
14
|
+
acceptedTypes = defaultTypeExtensions, //See the default extensions above
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
`Hook - returned properties`
|
|
18
|
+
|
|
19
|
+
```JS | TS
|
|
20
|
+
{
|
|
21
|
+
//Properties
|
|
22
|
+
validFiles, //These are the valid files selected
|
|
23
|
+
invalidFiles, //The invalid files a user attempted to select
|
|
24
|
+
|
|
25
|
+
//Methods
|
|
26
|
+
clearCache, // This will clear out the valid and invalid files
|
|
27
|
+
getValidFileStreams, //This will provde the actual File | Blobs that are within the valid Files
|
|
28
|
+
onCancel, //This will call clearCache
|
|
29
|
+
onIdChange, //Use this, if you want to change the name of a File.
|
|
30
|
+
onRemoveFile, //Remove a file from the valid files array
|
|
31
|
+
setMaximumFileSizeExceeded, //Use this for any errors generated, regarding the maximum file size
|
|
32
|
+
setMaximumUploadsExceeded, //Use this for any errors generated regarding the maximum number of uploads
|
|
33
|
+
|
|
34
|
+
//Component - Export the FileSelector: Use this ready made comopnent.
|
|
35
|
+
FileSelector: () => (
|
|
36
|
+
<FileSelector
|
|
37
|
+
inputId={"SomeID"} //Optional
|
|
38
|
+
messageParagraph={"A message to display in the dropzone"} //Optional - Defaults to "Drag 'n' drop some files here, or click to select files"
|
|
39
|
+
inputClassName={"some css classes"} //Optional - You can add your own css. The default is hidden, a tailwindcss class
|
|
40
|
+
clickableAreaClassName={"some css classes"} //Optional - You can add your own css. The default is composed of some tailwindclasses. It's either or.
|
|
41
|
+
dropZoneWrapperClassName={"some css classes"} //Optional - You can add your own css. The default is composed of some tailwindclasses. It's either or.
|
|
42
|
+
messageParagraphClassName={"some css classes"} //Optional - You can add your own css. The default is composed of some tailwindclasses. It's either or.
|
|
43
|
+
onChange={onInputChange}
|
|
44
|
+
onDragOver={onDragOver}
|
|
45
|
+
onDrop={onDrop}
|
|
46
|
+
onDragEnter={onDragEnter}
|
|
47
|
+
onDragLeave={onDragLeave}
|
|
48
|
+
/>
|
|
49
|
+
),
|
|
50
|
+
}
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
```JS | TS
|
|
54
|
+
//Here are the default upload types the pacakge will handle. You can send in your own, so long as it's in the following format.
|
|
55
|
+
export const defaultTypeExtensions: Record<string, string> = {
|
|
56
|
+
"image/png": ".png",
|
|
57
|
+
"image/jpeg": ".jpeg",
|
|
58
|
+
"image/jpg": ".jpg",
|
|
59
|
+
"image/svg+xml": ".svg",
|
|
60
|
+
"application/pdf": ".pdf",
|
|
61
|
+
"application/msword": ".doc",
|
|
62
|
+
"application/vnd.openxmlformats-officedocument.wordprocessingml.document": ".docx",
|
|
63
|
+
};
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### Hook configuration
|
|
67
|
+
|
|
68
|
+
```JS | TS
|
|
69
|
+
//Here you can set the following properties for the FileSelector. These are all optional
|
|
70
|
+
const { validFiles, onIdChange, onCancel, onRemoveFile, FileSelector } = useFileSelector({
|
|
71
|
+
acceptTypes: ".png" //Defaults to ".png, .jpg, .jpeg, .pdf, .svg, image/svg+xml, application/msword, application/vnd.openxmlformats-officedocument.wordprocessingml.document"
|
|
72
|
+
maximumUploadCount:5, //Defaults to 30
|
|
73
|
+
maximumFileSize = 5e6, //Defaults to 5 mb's
|
|
74
|
+
acceptedTypes = defaultTypeExtensions, //See the default extensions above
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### Usage
|
|
80
|
+
|
|
81
|
+
### App.tsx
|
|
82
|
+
|
|
83
|
+
Once the package is installed, import the hook
|
|
84
|
+
|
|
85
|
+
```JS | TS
|
|
86
|
+
import { useFileSelector } from "@mainframework/dropzone";
|
|
87
|
+
|
|
88
|
+
export const App = ()=>{
|
|
89
|
+
//Note: You can set the following props for the hook maximumUploadCount, maximumFileSize, acceptedTypes
|
|
90
|
+
const { validFiles, onIdChange, onCancel, onRemoveFile, FileSelector } = useFileSelector();
|
|
91
|
+
|
|
92
|
+
const onSelect = () => {
|
|
93
|
+
if (Array.isArray(validFiles)) {
|
|
94
|
+
//This will be used to select the files. Won't be used here
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
return (
|
|
99
|
+
<>
|
|
100
|
+
<FileSelector /> {/*This is the component that will display the dropzone*/}
|
|
101
|
+
|
|
102
|
+
{validFiles.length > 0 && (
|
|
103
|
+
<PreviewImages //<---PreviewImages is a component where you render the images. It's up to you to provide this functionality
|
|
104
|
+
validFiles={validFiles}
|
|
105
|
+
onChange={onIdChange}
|
|
106
|
+
onSelect={onSelect}
|
|
107
|
+
onCancel={onCancel}
|
|
108
|
+
onRemoveFile={onRemoveFile}
|
|
109
|
+
/>
|
|
110
|
+
)}
|
|
111
|
+
</>
|
|
112
|
+
);
|
|
113
|
+
}
|
|
114
|
+
```
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { FileSelectorProps } from "../../types/types";
|
|
2
2
|
import "./tailwind.css";
|
|
3
|
-
export declare const FileSelector: ({ inputId, acceptTypes, messageParagraph, inputClassName, clickableAreaClassName, dropZoneWrapperClassName, messageParagraphClassName, onChange, onDragOver, onDrop, onDragEnter, onDragLeave, }: FileSelectorProps) => import("react/jsx-runtime").JSX.Element
|
|
3
|
+
export declare const FileSelector: import("react").MemoExoticComponent<({ inputId, acceptTypes, messageParagraph, inputClassName, clickableAreaClassName, dropZoneWrapperClassName, messageParagraphClassName, ariaLabel, ariaDescribedBy, ariaLabelButton, ariaLabelledBy, onChange, onDragOver, onDrop, onDragEnter, onDragLeave, }: FileSelectorProps) => import("react/jsx-runtime").JSX.Element>;
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
/*! tailwindcss v4.1.18 | MIT License | https://tailwindcss.com */
|
|
2
|
+
@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-border-style:solid;--tw-font-weight:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000}}}@layer theme{:root,:host{--font-sans:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";--font-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;--color-yellow-400:oklch(85.2% .199 91.936);--color-gray-300:oklch(87.2% .01 258.338);--color-gray-400:oklch(70.7% .022 261.325);--color-gray-500:oklch(55.1% .027 264.364);--color-gray-600:oklch(44.6% .03 256.802);--spacing:.25rem;--font-weight-bold:700;--radius-md:.375rem;--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab, red, red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.flex{display:flex}.h-full{height:100%}.min-h-0{min-height:calc(var(--spacing)*0)}.min-h-\[120px\]{min-height:120px}.w-full{width:100%}.flex-1{flex:1}.transform{transform:var(--tw-rotate-x,)var(--tw-rotate-y,)var(--tw-rotate-z,)var(--tw-skew-x,)var(--tw-skew-y,)}.cursor-pointer{cursor:pointer}.flex-col{flex-direction:column}.rounded-md{border-radius:var(--radius-md)}.border{border-style:var(--tw-border-style);border-width:1px}.border-2{border-style:var(--tw-border-style);border-width:2px}.border-dashed{--tw-border-style:dashed;border-style:dashed}.border-gray-300{border-color:var(--color-gray-300)}.border-gray-500{border-color:var(--color-gray-500)}.border-yellow-400{border-color:var(--color-yellow-400)}.bg-inherit{background-color:inherit}.p-4{padding:calc(var(--spacing)*4)}.px-4{padding-inline:calc(var(--spacing)*4)}.py-2{padding-block:calc(var(--spacing)*2)}.text-center{text-align:center}.font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.text-gray-600{color:var(--color-gray-600)}.text-inherit{color:inherit}.shadow-md{--tw-shadow:0 4px 6px -1px var(--tw-shadow-color,#0000001a),0 2px 4px -2px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}@media (hover:hover){.hover\:border-gray-400:hover{border-color:var(--color-gray-400)}}}.no-scrollbar::-webkit-scrollbar{display:none}.no-scrollbar{-ms-overflow-style:none;scrollbar-width:none}.hiddenInput{display:none}.glow-border{border:2px dotted #0000;border-image:linear-gradient(45deg,#0ff,#f0f) 1;box-shadow:0 0 10px #00ffffb3}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const useCustomCallback: <T extends (...args: any[]) =>
|
|
1
|
+
export declare const useCustomCallback: <T extends (...args: any[]) => any>(callback: T, dependencies: unknown[]) => T;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ErrorMessage, FileData, IFileUploaderProps } from "../types/types";
|
|
2
|
-
export declare const useFileSelector: ({
|
|
1
|
+
import { ErrorMessage, FileData, FileSelectorProps, IFileUploaderProps } from "../types/types";
|
|
2
|
+
export declare const useFileSelector: ({ maximumUploadCount, maximumFileSize, acceptedTypes, }?: IFileUploaderProps) => {
|
|
3
3
|
validFiles: FileData[];
|
|
4
4
|
invalidFiles: File[];
|
|
5
5
|
clearCache: () => void;
|
|
@@ -8,10 +8,13 @@ export declare const useFileSelector: ({ acceptTypes, maximumUploadCount, maximu
|
|
|
8
8
|
onIdChange: (index: number, id: string, files: FileData[]) => void;
|
|
9
9
|
onRemoveFile: (index: number) => void;
|
|
10
10
|
clearBlobs: () => void;
|
|
11
|
-
clearBlob: (
|
|
11
|
+
clearBlob: (file: File) => void;
|
|
12
12
|
maxUploadError: ErrorMessage;
|
|
13
13
|
maxFileSizeError: ErrorMessage;
|
|
14
14
|
setMaximumFileSizeExceeded: (status?: boolean) => void;
|
|
15
15
|
setMaximumUploadsExceeded: (status?: boolean, fileCount?: number, maximumUploads?: number) => void;
|
|
16
|
-
FileSelector:
|
|
16
|
+
FileSelector: {
|
|
17
|
+
(props: Omit<FileSelectorProps, "onChange" | "onDragOver" | "onDrop" | "onDragEnter" | "onDragLeave">): import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
displayName: string;
|
|
19
|
+
};
|
|
17
20
|
};
|
|
@@ -7,6 +7,13 @@ export interface FileSelectorProps {
|
|
|
7
7
|
clickableAreaClassName?: string;
|
|
8
8
|
dropZoneWrapperClassName?: string;
|
|
9
9
|
messageParagraphClassName?: string;
|
|
10
|
+
/** Accessible name for the drop zone region (default: "File upload") */
|
|
11
|
+
ariaLabel?: string;
|
|
12
|
+
/** ID of element that describes the drop zone (e.g. help text) */
|
|
13
|
+
ariaDescribedBy?: string;
|
|
14
|
+
/** Accessible label for the file input button when messageParagraph is not sufficient */
|
|
15
|
+
ariaLabelButton?: string;
|
|
16
|
+
ariaLabelledBy?: string;
|
|
10
17
|
onChange: (e: ChangeEvent<HTMLInputElement>) => void;
|
|
11
18
|
onDragOver: (e: DragEvent<HTMLButtonElement>) => void;
|
|
12
19
|
onDrop: (e: DragEvent<HTMLButtonElement>) => void;
|
|
@@ -2,16 +2,22 @@ export declare const defaultTypeExtensions: Record<string, string>;
|
|
|
2
2
|
export declare const maximumUploadCount = 30;
|
|
3
3
|
export declare const maximumFileSize = 5000000;
|
|
4
4
|
export declare const printableMaximumFileSize = "5 Megabytes";
|
|
5
|
-
|
|
6
|
-
export declare const hasSurpassedMaxSize: (file: File | Blob, maxSize?: number) => boolean;
|
|
7
|
-
export declare const checkFilesMaximumSize: (files: (File | Blob)[], maxFileSize?: number) => boolean;
|
|
5
|
+
type TypeExtensions = Readonly<Record<string, string>>;
|
|
8
6
|
export declare const createUrlString: (file: File) => string;
|
|
9
|
-
export declare const clearBlobFromMemory: (
|
|
10
|
-
export declare const
|
|
7
|
+
export declare const clearBlobFromMemory: (file: File) => void;
|
|
8
|
+
export declare const createUrlStringWithAutoCleanup: (file: File, autoCleanupMs?: number) => {
|
|
9
|
+
url: string;
|
|
10
|
+
cancel: () => void;
|
|
11
|
+
};
|
|
12
|
+
export declare const isValidFileType: (file: File, acceptedTypes?: TypeExtensions) => boolean;
|
|
13
|
+
export declare const hasSurpassedMaxSize: (file: File | Blob, maxSize?: number) => boolean;
|
|
14
|
+
export declare const checkFilesMaximumSize: (files: readonly (File | Blob)[], max?: number) => boolean;
|
|
15
|
+
export declare const SvgXmlnsAttributeCheck: (file: File, allowableTypes?: TypeExtensions) => Promise<{
|
|
11
16
|
id: string;
|
|
12
17
|
type: string;
|
|
13
18
|
file: File;
|
|
14
19
|
url: string;
|
|
15
|
-
}>;
|
|
16
|
-
export declare const renameFile: (file:
|
|
20
|
+
} | null>;
|
|
21
|
+
export declare const renameFile: (file: Blob, name: string) => File;
|
|
17
22
|
export declare const checkFile: (id: string, file: File | Blob) => File | Blob;
|
|
23
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,86 +1,94 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@mainframework/dropzone",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "A file selection package, without all of the re-rendering issues that come with other dropzone packages",
|
|
5
|
-
"main": "./dist/cjs/index.js",
|
|
6
|
-
"module": "./dist/esm/index.js",
|
|
7
|
-
"types": "./dist/esm/index.d.ts",
|
|
8
|
-
"repository": {
|
|
9
|
-
"type": "git",
|
|
10
|
-
"url": "git+https://github.com/TerrySlack/mainframework-dropzone.git"
|
|
11
|
-
},
|
|
12
|
-
"bugs": {
|
|
13
|
-
"url": "https://github.com/TerrySlack/mainframework-dropzone/issues"
|
|
14
|
-
},
|
|
15
|
-
"homepage": "https://github.com/TerrySlack/mainframework-dropzone#readme",
|
|
16
|
-
"scripts": {
|
|
17
|
-
"build:css:dev": "npx tailwindcss -i ./src/index.css -o ./src/shared/components/FileSelector/tailwind.css --watch",
|
|
18
|
-
"build:css:prod": "npx tailwindcss -i ./src/index.css -o ./src/shared/components/FileSelector/tailwind.css --minify
|
|
19
|
-
"husky": "husky",
|
|
20
|
-
"clean": "rimraf dist",
|
|
21
|
-
"lint": "eslint --ext 'ts,tsx' --max-warnings=0 --fix",
|
|
22
|
-
"lint-staged": "lint-staged",
|
|
23
|
-
"prebuild": "yarn husky && yarn clean",
|
|
24
|
-
"copy:css": "copyfiles -a -u 4 src/shared/components/FileSelector/tailwind.css dist/esm/shared/components/FileSelector/",
|
|
25
|
-
"build": "cross-env yarn prebuild && yarn build:css:prod && yarn build:esm && yarn copy:css",
|
|
26
|
-
"build:esm": "tsc",
|
|
27
|
-
"build:cjs": "tsc --module commonjs --outDir dist/cjs",
|
|
28
|
-
"test": "jest --config jestconfig.json"
|
|
29
|
-
},
|
|
30
|
-
"peerDependencies": {
|
|
31
|
-
"react": ">=
|
|
32
|
-
},
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
"
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
"
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
"@
|
|
65
|
-
"@
|
|
66
|
-
"
|
|
67
|
-
"
|
|
68
|
-
"
|
|
69
|
-
"
|
|
70
|
-
"
|
|
71
|
-
"
|
|
72
|
-
"
|
|
73
|
-
"
|
|
74
|
-
"
|
|
75
|
-
"
|
|
76
|
-
"
|
|
77
|
-
"
|
|
78
|
-
"
|
|
79
|
-
"
|
|
80
|
-
"
|
|
81
|
-
"
|
|
82
|
-
"
|
|
83
|
-
"
|
|
84
|
-
"
|
|
85
|
-
|
|
86
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "@mainframework/dropzone",
|
|
3
|
+
"version": "1.0.15",
|
|
4
|
+
"description": "A file selection package, without all of the re-rendering issues that come with other dropzone packages",
|
|
5
|
+
"main": "./dist/cjs/index.js",
|
|
6
|
+
"module": "./dist/esm/index.js",
|
|
7
|
+
"types": "./dist/esm/index.d.ts",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/TerrySlack/mainframework-dropzone.git"
|
|
11
|
+
},
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/TerrySlack/mainframework-dropzone/issues"
|
|
14
|
+
},
|
|
15
|
+
"homepage": "https://github.com/TerrySlack/mainframework-dropzone#readme",
|
|
16
|
+
"scripts": {
|
|
17
|
+
"build:css:dev": "npx @tailwindcss/cli -i ./src/index.css -o ./src/shared/components/FileSelector/tailwind.css --watch",
|
|
18
|
+
"build:css:prod": "npx @tailwindcss/cli -i ./src/index.css -o ./src/shared/components/FileSelector/tailwind.css --minify",
|
|
19
|
+
"husky": "husky",
|
|
20
|
+
"clean": "rimraf dist",
|
|
21
|
+
"lint": "eslint --ext 'ts,tsx' --max-warnings=0 --fix",
|
|
22
|
+
"lint-staged": "lint-staged",
|
|
23
|
+
"prebuild": "yarn husky && yarn clean",
|
|
24
|
+
"copy:css": "copyfiles -a -u 4 src/shared/components/FileSelector/tailwind.css dist/esm/shared/components/FileSelector/",
|
|
25
|
+
"build": "cross-env yarn prebuild && yarn build:css:prod && yarn build:esm && yarn copy:css",
|
|
26
|
+
"build:esm": "tsc",
|
|
27
|
+
"build:cjs": "tsc --module commonjs --outDir dist/cjs",
|
|
28
|
+
"test": "jest --config jestconfig.json"
|
|
29
|
+
},
|
|
30
|
+
"peerDependencies": {
|
|
31
|
+
"react": ">=19"
|
|
32
|
+
},
|
|
33
|
+
"peerDependenciesMeta": {
|
|
34
|
+
"react": {
|
|
35
|
+
"optional": false
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
"files": [
|
|
39
|
+
"dist",
|
|
40
|
+
"LICENSE",
|
|
41
|
+
"README.md"
|
|
42
|
+
],
|
|
43
|
+
"keywords": [
|
|
44
|
+
"react",
|
|
45
|
+
"typescript",
|
|
46
|
+
"file selection",
|
|
47
|
+
"file dialog",
|
|
48
|
+
"dropzone"
|
|
49
|
+
],
|
|
50
|
+
"author": "Terry Slack",
|
|
51
|
+
"license": "MIT",
|
|
52
|
+
"husky": {
|
|
53
|
+
"hooks": {
|
|
54
|
+
"pre-commit": "npm run lint-staged && git add --all"
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
"lint-staged": {
|
|
58
|
+
"*.(ts|tsx)": [
|
|
59
|
+
"eslint --fix",
|
|
60
|
+
"prettier --write"
|
|
61
|
+
]
|
|
62
|
+
},
|
|
63
|
+
"devDependencies": {
|
|
64
|
+
"@mainframework/is-deep-equal": "^1.0.9",
|
|
65
|
+
"@tailwindcss/aspect-ratio": "^0.4.2",
|
|
66
|
+
"@tailwindcss/cli": "^4.1.18",
|
|
67
|
+
"@tailwindcss/forms": "^0.5.11",
|
|
68
|
+
"@testing-library/react": "^16.3.2",
|
|
69
|
+
"@types/jest": "^30.0.0",
|
|
70
|
+
"@types/react": "^19.2.13",
|
|
71
|
+
"clsx": "^2.1.1",
|
|
72
|
+
"copyfiles": "^2.4.1",
|
|
73
|
+
"cross-env": "^10.1.0",
|
|
74
|
+
"eslint": "^9.39.2",
|
|
75
|
+
"eslint-config-prettier": "^10.1.8",
|
|
76
|
+
"eslint-plugin-prettier": "^5.5.5",
|
|
77
|
+
"eslint-plugin-react": "^7.37.5",
|
|
78
|
+
"eslint-plugin-react-hooks": "^7.0.1",
|
|
79
|
+
"husky": "^9.1.7",
|
|
80
|
+
"jest": "^30.2.0",
|
|
81
|
+
"jest-canvas-mock": "^2.5.2",
|
|
82
|
+
"jest-environment-jsdom": "^30.2.0",
|
|
83
|
+
"lint-staged": "^16.2.7",
|
|
84
|
+
"prettier": "^3.8.1",
|
|
85
|
+
"react": "^19.2.4",
|
|
86
|
+
"rimraf": "^6.1.2",
|
|
87
|
+
"tailwind-merge": "^3.4.0",
|
|
88
|
+
"tailwindcss": "^4.1.18",
|
|
89
|
+
"ts-jest": "^29.4.6",
|
|
90
|
+
"tslib": "^2.8.1",
|
|
91
|
+
"typescript": "^5.9.3",
|
|
92
|
+
"typescript-eslint": "^8.54.0"
|
|
93
|
+
}
|
|
94
|
+
}
|
package/dist/esm/index.js
DELETED
package/dist/esm/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC"}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useEffect, useRef } from "react";
|
|
3
|
-
import "./tailwind.css";
|
|
4
|
-
var defaultAcceptTypes = ".png, .jpg, .jpeg, .pdf, .svg, image/svg+xml, application/msword, application/vnd.openxmlformats-officedocument.wordprocessingml.document";
|
|
5
|
-
export var FileSelector = function (_a) {
|
|
6
|
-
var inputId = _a.inputId, acceptTypes = _a.acceptTypes, messageParagraph = _a.messageParagraph, inputClassName = _a.inputClassName, clickableAreaClassName = _a.clickableAreaClassName, dropZoneWrapperClassName = _a.dropZoneWrapperClassName, messageParagraphClassName = _a.messageParagraphClassName, onChange = _a.onChange, onDragOver = _a.onDragOver, onDrop = _a.onDrop, onDragEnter = _a.onDragEnter, onDragLeave = _a.onDragLeave;
|
|
7
|
-
var fileInputRef = useRef(null);
|
|
8
|
-
var refCallback = function (ref) {
|
|
9
|
-
fileInputRef.current = ref;
|
|
10
|
-
};
|
|
11
|
-
var dropZoneButtonClickRef = useRef(function (e) {
|
|
12
|
-
var _a;
|
|
13
|
-
e.preventDefault();
|
|
14
|
-
(_a = fileInputRef.current) === null || _a === void 0 ? void 0 : _a.click();
|
|
15
|
-
});
|
|
16
|
-
//Css classes
|
|
17
|
-
var inputClassesRef = useRef("hiddenInput ".concat(inputClassName !== null && inputClassName !== void 0 ? inputClassName : ""));
|
|
18
|
-
var clickableAreaClassNameRef = useRef("".concat(clickableAreaClassName !== null && clickableAreaClassName !== void 0 ? clickableAreaClassName : "dropzone border-dashed border-2 border-silver-600 p-4 rounded-md text-center cursor-pointer bg-inherit hover:border-yellow-400 text-white font-bold py-2 px-4"));
|
|
19
|
-
var dropZoneWrapperClassNameRef = useRef("".concat(dropZoneWrapperClassName !== null && dropZoneWrapperClassName !== void 0 ? dropZoneWrapperClassName : "p-4 border border-gray-300 rounded-md shadow-md"));
|
|
20
|
-
var messageParagraphClassNameRef = useRef("".concat(messageParagraphClassName !== null && messageParagraphClassName !== void 0 ? messageParagraphClassName : "text-center text-silver-600"));
|
|
21
|
-
var messageParagraphRef = useRef("".concat(messageParagraph !== null && messageParagraph !== void 0 ? messageParagraph : "Drag 'n' drop some files here, or click to select files"));
|
|
22
|
-
useEffect(function () {
|
|
23
|
-
//Wire up the drag and drop
|
|
24
|
-
var preventDefault = function (event) {
|
|
25
|
-
event.preventDefault();
|
|
26
|
-
};
|
|
27
|
-
document.addEventListener("dragover", preventDefault);
|
|
28
|
-
document.addEventListener("drop", preventDefault);
|
|
29
|
-
return function () {
|
|
30
|
-
//Clean up
|
|
31
|
-
document.removeEventListener("dragover", preventDefault);
|
|
32
|
-
document.removeEventListener("drop", preventDefault);
|
|
33
|
-
};
|
|
34
|
-
}, []);
|
|
35
|
-
return (_jsxs("div", { className: dropZoneWrapperClassNameRef.current, draggable: false, children: [_jsx("button", { type: "button", className: clickableAreaClassNameRef.current, onDragOver: onDragOver, onDrop: onDrop, onDragEnter: onDragEnter, onDragLeave: onDragLeave, onClick: dropZoneButtonClickRef.current, draggable: true, children: _jsx("p", { className: messageParagraphClassNameRef.current, children: messageParagraphRef.current }) }), _jsx("input", { ref: refCallback, id: inputId, type: "file", className: inputClassesRef.current, onChange: onChange, accept: acceptTypes !== null && acceptTypes !== void 0 ? acceptTypes : defaultAcceptTypes, multiple: true })] }));
|
|
36
|
-
};
|
|
37
|
-
//# sourceMappingURL=FileSelector.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"FileSelector.js","sourceRoot":"","sources":["../../../../../src/shared/components/FileSelector/FileSelector.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAe,SAAS,EAAE,MAAM,EAAc,MAAM,OAAO,CAAC;AAGnE,OAAO,gBAAgB,CAAC;AACxB,IAAM,kBAAkB,GACtB,2IAA2I,CAAC;AAC9I,MAAM,CAAC,IAAM,YAAY,GAAG,UAAC,EAaT;QAZlB,OAAO,aAAA,EACP,WAAW,iBAAA,EACX,gBAAgB,sBAAA,EAChB,cAAc,oBAA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AAc,CAAC,CAAC;QACtD,QAAQ,CAAC,gBAAgB,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;QAElD,OAAO;YACL,UAAU;YACV,QAAQ,CAAC,mBAAmB,CAAC,UAAU,EAAE,cAAc,CAAC,CAAC;YACzD,QAAQ,CAAC,mBAAmB,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;QACvD,CAAC,CAAC;IACJ,CAAC,EAAE,EAAE,CAAC,CAAC;IACP,OAAO,CACL,eAAK,SAAS,EAAE,2BAA2B,CAAC,OAAO,EAAE,SAAS,EAAE,KAAK,aACnE,iBACE,IAAI,EAAC,QAAQ,EACb,SAAS,EAAE,yBAAyB,CAAC,OAAO,EAC5C,UAAU,EAAE,UAAU,EACtB,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,WAAW,EACxB,WAAW,EAAE,WAAW,EACxB,OAAO,EAAE,sBAAsB,CAAC,OAAO,EACvC,SAAS,kBAET,YAAG,SAAS,EAAE,4BAA4B,CAAC,OAAO,YAAG,mBAAmB,CAAC,OAAO,GAAK,GAC9E,EAET,gBACE,GAAG,EAAE,WAAW,EAChB,EAAE,EAAE,OAAO,EACX,IAAI,EAAC,MAAM,EACX,SAAS,EAAE,eAAe,CAAC,OAAO,EAClC,QAAQ,EAAE,QAAQ,EAClB,MAAM,EAAE,WAAW,aAAX,WAAW,cAAX,WAAW,GAAI,kBAAkB,EACzC,QAAQ,SACR,IACE,CACP,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/shared/components/FileSelector/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { useCallback, useRef } from "react";
|
|
2
|
-
import { isEqual } from "../utils/equalityChecks";
|
|
3
|
-
//Need any here to get around TS not liking uknown. I don't know the shape of a function coming into this hook
|
|
4
|
-
export var useCustomCallback = function (callback, dependencies) {
|
|
5
|
-
var refDependencies = useRef([]);
|
|
6
|
-
if (refDependencies.current.length === 0 ||
|
|
7
|
-
!dependencies.every(function (dep, index) { return isEqual(dep, refDependencies.current[index]); })) {
|
|
8
|
-
//add the callback as a dependency to address the eslint error: react-hooks/exhaustive-deps
|
|
9
|
-
dependencies.push(callback);
|
|
10
|
-
refDependencies.current = dependencies;
|
|
11
|
-
}
|
|
12
|
-
return useCallback(callback, refDependencies.current);
|
|
13
|
-
};
|
|
14
|
-
//# sourceMappingURL=useCustomCallback.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useCustomCallback.js","sourceRoot":"","sources":["../../../../src/shared/hooks/useCustomCallback.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAE5C,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAElD,gHAAgH;AAChH,MAAM,CAAC,IAAM,iBAAiB,GAAG,UAAwC,QAAW,EAAE,YAAuB;IAC3G,IAAM,eAAe,GAAG,MAAM,CAAY,EAAE,CAAC,CAAC;IAE9C,IACE,eAAe,CAAC,OAAO,CAAC,MAAM,KAAK,CAAC;QACpC,CAAC,YAAY,CAAC,KAAK,CAAC,UAAC,GAAG,EAAE,KAAK,IAAK,OAAA,OAAO,CAAC,GAAG,EAAE,eAAe,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,EAA5C,CAA4C,CAAC,EACjF,CAAC;QACD,2FAA2F;QAC3F,YAAY,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC5B,eAAe,CAAC,OAAO,GAAG,YAAY,CAAC;IACzC,CAAC;IACD,OAAO,WAAW,CAAC,QAAQ,EAAE,eAAe,CAAC,OAAO,CAAC,CAAC;AACxD,CAAC,CAAC"}
|
|
@@ -1,178 +0,0 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
-
import { useCallback, useRef, useState } from "react";
|
|
14
|
-
import { defaultTypeExtensions, maximumUploadCount as maxUploadCount, maximumFileSize as maxFileSize, printableMaximumFileSize, checkFilesMaximumSize, isValidFileType, SvgXmlnsAttributeCheck, checkFile, clearBlobFromMemory, } from "../utils/processUploadedFiles";
|
|
15
|
-
import { useCustomCallback } from "./useCustomCallback";
|
|
16
|
-
import { FileSelector } from "../components/FileSelector";
|
|
17
|
-
export var useFileSelector = function (_a) {
|
|
18
|
-
var _b = _a === void 0 ? {} : _a, acceptTypes = _b.acceptTypes, _c = _b.maximumUploadCount, maximumUploadCount = _c === void 0 ? maxUploadCount : _c, _d = _b.maximumFileSize, maximumFileSize = _d === void 0 ? maxFileSize : _d, _e = _b.acceptedTypes, acceptedTypes = _e === void 0 ? defaultTypeExtensions : _e;
|
|
19
|
-
//State
|
|
20
|
-
//Trigger a re-render
|
|
21
|
-
var _f = useState(0), setUpdateTrigger = _f[1];
|
|
22
|
-
var _g = useState([]), validFiles = _g[0], SetValidFiles = _g[1];
|
|
23
|
-
var _h = useState([]), invalidFiles = _h[0], SetInvalidFiles = _h[1];
|
|
24
|
-
//Refs
|
|
25
|
-
var maxUploadErrorRef = useRef({
|
|
26
|
-
status: false,
|
|
27
|
-
message: "",
|
|
28
|
-
});
|
|
29
|
-
var maxFileSizeErrorRef = useRef({
|
|
30
|
-
status: false,
|
|
31
|
-
message: "",
|
|
32
|
-
});
|
|
33
|
-
var setMaximumUploadsExceeded = useCallback(function (status, fileCount, maximumUploads) {
|
|
34
|
-
if (status === void 0) { status = false; }
|
|
35
|
-
maxUploadErrorRef.current.status = status;
|
|
36
|
-
maxUploadErrorRef.current.message = status
|
|
37
|
-
? "You have attempted to upload ".concat(fileCount, " files. The maximum allowable uploads for this feature is ").concat(maximumUploads)
|
|
38
|
-
: "";
|
|
39
|
-
setUpdateTrigger(function (state) { return (state += 1); });
|
|
40
|
-
}, []);
|
|
41
|
-
var setMaximumFileSizeExceeded = useCallback(function (status) {
|
|
42
|
-
if (status === void 0) { status = false; }
|
|
43
|
-
maxFileSizeErrorRef.current.status = status;
|
|
44
|
-
maxFileSizeErrorRef.current.message = status
|
|
45
|
-
? "You have attempted upload a file(s) that exceeds the maximum size of ".concat(printableMaximumFileSize)
|
|
46
|
-
: "";
|
|
47
|
-
setUpdateTrigger(function (state) { return (state += 1); });
|
|
48
|
-
}, []);
|
|
49
|
-
var clearCache = useCallback(function () {
|
|
50
|
-
//Clear any blobs held in memor
|
|
51
|
-
clearBlobs();
|
|
52
|
-
SetInvalidFiles([]);
|
|
53
|
-
SetValidFiles([]);
|
|
54
|
-
}, []);
|
|
55
|
-
var onCancel = useCallback(function () {
|
|
56
|
-
clearCache();
|
|
57
|
-
}, [clearCache]);
|
|
58
|
-
var getValidFileStreams = useCallback(function () { return (validFiles.length ? validFiles.map(function (_a) {
|
|
59
|
-
var file = _a.file;
|
|
60
|
-
return file;
|
|
61
|
-
}) : []); }, [validFiles]);
|
|
62
|
-
//Main Engine to deal with files
|
|
63
|
-
var processFiles = useCustomCallback(function (files) {
|
|
64
|
-
var maxFileSizeCheck = checkFilesMaximumSize(files, maximumFileSize) && !maxFileSizeErrorRef.current.status;
|
|
65
|
-
var maxUploadCountCheck = typeof maximumUploadCount !== "undefined"
|
|
66
|
-
? !maxUploadErrorRef.current.status && files.length > maximumUploadCount
|
|
67
|
-
: false;
|
|
68
|
-
if (maxFileSizeCheck || maxUploadCountCheck) {
|
|
69
|
-
if (maxFileSizeCheck)
|
|
70
|
-
setMaximumFileSizeExceeded(true);
|
|
71
|
-
if (maxUploadCountCheck)
|
|
72
|
-
setMaximumUploadsExceeded(true, files.length, maximumUploadCount);
|
|
73
|
-
onCancel();
|
|
74
|
-
}
|
|
75
|
-
else {
|
|
76
|
-
var _a = files.reduce(function (acc, file) {
|
|
77
|
-
if (isValidFileType(file, acceptedTypes))
|
|
78
|
-
acc.valid.push(SvgXmlnsAttributeCheck(file, defaultTypeExtensions));
|
|
79
|
-
else
|
|
80
|
-
acc.invalid.push(file);
|
|
81
|
-
return acc;
|
|
82
|
-
}, { valid: [], invalid: [] }), valid = _a.valid, invalid = _a.invalid;
|
|
83
|
-
if (valid.length > 0) {
|
|
84
|
-
Promise.all(valid).then(function (results) {
|
|
85
|
-
//validFiles.next(results);
|
|
86
|
-
SetValidFiles(results);
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
if (invalid.length > 0) {
|
|
90
|
-
//invalidFiles.next(invalid);
|
|
91
|
-
SetInvalidFiles(invalid);
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
}, [SvgXmlnsAttributeCheck, checkFilesMaximumSize, setMaximumFileSizeExceeded, setMaximumUploadsExceeded]);
|
|
95
|
-
var onRemoveFile = useCustomCallback(function (index) {
|
|
96
|
-
//
|
|
97
|
-
var updatedValidFiles = validFiles.reduce(function (acc, file, i) {
|
|
98
|
-
if (i === index) {
|
|
99
|
-
clearBlobFromMemory(file.url);
|
|
100
|
-
}
|
|
101
|
-
else {
|
|
102
|
-
acc.push(file);
|
|
103
|
-
}
|
|
104
|
-
return acc;
|
|
105
|
-
}, []);
|
|
106
|
-
SetValidFiles(updatedValidFiles);
|
|
107
|
-
}, [validFiles]);
|
|
108
|
-
var onIdChange = useCallback(function (index, id, files) {
|
|
109
|
-
var updatedValidFiles = files.map(function (fileData, i) {
|
|
110
|
-
if (i === index) {
|
|
111
|
-
var renamedFile = checkFile(id, fileData.file);
|
|
112
|
-
return __assign(__assign({}, fileData), { file: renamedFile, id: id });
|
|
113
|
-
}
|
|
114
|
-
return fileData;
|
|
115
|
-
});
|
|
116
|
-
SetValidFiles(updatedValidFiles);
|
|
117
|
-
}, []);
|
|
118
|
-
var onInputChange = useCallback(function (event) {
|
|
119
|
-
var files = Array.from(event.target.files || []);
|
|
120
|
-
processFiles(files);
|
|
121
|
-
}, [processFiles]);
|
|
122
|
-
//Drag and Drop
|
|
123
|
-
var onDrop = useCallback(function (e) {
|
|
124
|
-
e.preventDefault();
|
|
125
|
-
processFiles(Array.from(e.dataTransfer.files));
|
|
126
|
-
}, [processFiles]);
|
|
127
|
-
var onDragOver = useCallback(function (e) {
|
|
128
|
-
e.preventDefault();
|
|
129
|
-
e.dataTransfer.dropEffect = "copy";
|
|
130
|
-
}, []);
|
|
131
|
-
var onDragEnter = useCallback(function (e) {
|
|
132
|
-
e.preventDefault();
|
|
133
|
-
var classList = e.currentTarget.classList;
|
|
134
|
-
classList.add("border-yellow-400");
|
|
135
|
-
classList.remove("border-silver-600");
|
|
136
|
-
}, []);
|
|
137
|
-
var onDragLeave = useCallback(function (e) {
|
|
138
|
-
e.preventDefault();
|
|
139
|
-
var currentTarget = e.currentTarget;
|
|
140
|
-
var timeoutId = setTimeout(function () {
|
|
141
|
-
if (currentTarget && !currentTarget.contains(e.relatedTarget)) {
|
|
142
|
-
var classList = currentTarget.classList;
|
|
143
|
-
classList.remove("border-yellow-400");
|
|
144
|
-
classList.add("border-silver-600");
|
|
145
|
-
}
|
|
146
|
-
clearTimeout(timeoutId);
|
|
147
|
-
}, 200);
|
|
148
|
-
}, []);
|
|
149
|
-
var clearBlobs = useCustomCallback(function () {
|
|
150
|
-
//Remove any blobs created in memory
|
|
151
|
-
validFiles.forEach(function (_a) {
|
|
152
|
-
var url = _a.url;
|
|
153
|
-
clearBlobFromMemory(url);
|
|
154
|
-
});
|
|
155
|
-
}, [validFiles]);
|
|
156
|
-
var FileSelectorRef = useRef(function () { return (_jsx(FileSelector, { acceptTypes: acceptTypes, onChange: onInputChange, onDragOver: onDragOver, onDrop: onDrop, onDragEnter: onDragEnter, onDragLeave: onDragLeave })); });
|
|
157
|
-
return {
|
|
158
|
-
//Properties
|
|
159
|
-
validFiles: validFiles,
|
|
160
|
-
invalidFiles: invalidFiles,
|
|
161
|
-
//Methods
|
|
162
|
-
clearCache: clearCache,
|
|
163
|
-
getValidFileStreams: getValidFileStreams,
|
|
164
|
-
onCancel: onCancel,
|
|
165
|
-
onIdChange: onIdChange,
|
|
166
|
-
onRemoveFile: onRemoveFile,
|
|
167
|
-
clearBlobs: clearBlobs,
|
|
168
|
-
clearBlob: clearBlobFromMemory,
|
|
169
|
-
//Errors
|
|
170
|
-
maxUploadError: maxUploadErrorRef.current,
|
|
171
|
-
maxFileSizeError: maxFileSizeErrorRef.current,
|
|
172
|
-
setMaximumFileSizeExceeded: setMaximumFileSizeExceeded,
|
|
173
|
-
setMaximumUploadsExceeded: setMaximumUploadsExceeded,
|
|
174
|
-
//Component - Export the FileSelector
|
|
175
|
-
FileSelector: FileSelectorRef.current,
|
|
176
|
-
};
|
|
177
|
-
};
|
|
178
|
-
//# sourceMappingURL=useFileSelector.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useFileSelector.js","sourceRoot":"","sources":["../../../../src/shared/hooks/useFileSelector.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,QAAQ,EAA0B,MAAM,OAAO,CAAC;AAE9E,OAAO,EACL,qBAAqB,EACrB,kBAAkB,IAAI,cAAc,EACpC,eAAe,IAAI,WAAW,EAC9B,wBAAwB,EACxB,qBAAqB,EACrB,eAAe,EACf,sBAAsB,EACtB,SAAS,EACT,mBAAmB,GACpB,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE1D,MAAM,CAAC,IAAM,eAAe,G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C,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC;IAEjB,IAAM,eAAe,GAAG,MAAM,CAAC,cAAM,OAAA,CACnC,KAAC,YAAY,IACX,WAAW,EAAE,WAAW,EACxB,QAAQ,EAAE,aAAa,EACvB,UAAU,EAAE,UAAU,EACtB,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,WAAW,EACxB,WAAW,EAAE,WAAW,GACxB,CACH,EAToC,CASpC,CAAC,CAAC;IAEH,OAAO;QACL,YAAY;QACZ,UAAU,YAAA;QACV,YAAY,cAAA;QAEZ,SAAS;QACT,UAAU,YAAA;QACV,mBAAmB,qBAAA;QACnB,QAAQ,UAAA;QACR,UAAU,YAAA;QACV,YAAY,cAAA;QACZ,UAAU,YAAA;QACV,SAAS,EAAE,mBAAmB;QAE9B,QAAQ;QACR,cAAc,EAAE,iBAAiB,CAAC,OAAO;QACzC,gBAAgB,EAAE,mBAAmB,CAAC,OAAO;QAC7C,0BAA0B,4BAAA;QAC1B,yBAAyB,2BAAA;QAEzB,qCAAqC;QACrC,YAAY,EAAE,eAAe,CAAC,OAAO;KACtC,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/shared/types/types.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const isEqual: (a: unknown, b: unknown) => boolean;
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
export var isEqual = function (a, b) {
|
|
2
|
-
if (typeof a !== typeof b) {
|
|
3
|
-
return false; // Types are different
|
|
4
|
-
}
|
|
5
|
-
if (typeof a !== "object" || a === null) {
|
|
6
|
-
return a === b; // For non-object types, perform simple comparison
|
|
7
|
-
}
|
|
8
|
-
if (Array.isArray(a) && Array.isArray(b)) {
|
|
9
|
-
if (a.length !== b.length) {
|
|
10
|
-
return false; // Arrays have different lengths
|
|
11
|
-
}
|
|
12
|
-
var i = 0;
|
|
13
|
-
while (i < a.length) {
|
|
14
|
-
if (!isEqual(a[i], b[i])) {
|
|
15
|
-
return false; // Array elements are different
|
|
16
|
-
}
|
|
17
|
-
i += 1;
|
|
18
|
-
}
|
|
19
|
-
return true; // All array elements are equal
|
|
20
|
-
}
|
|
21
|
-
if (Array.isArray(a) || Array.isArray(b)) {
|
|
22
|
-
return false; // One is an array and the other is not, they can't be equal
|
|
23
|
-
}
|
|
24
|
-
var objA = a;
|
|
25
|
-
var objB = b;
|
|
26
|
-
var keysA = Object.keys(objA);
|
|
27
|
-
var keysB = Object.keys(objB);
|
|
28
|
-
if (keysA.length !== keysB.length) {
|
|
29
|
-
return false; // Objects have different number of keys
|
|
30
|
-
}
|
|
31
|
-
var j = 0;
|
|
32
|
-
while (j < keysA.length) {
|
|
33
|
-
var key = keysA[j];
|
|
34
|
-
if (!keysB.includes(key) || !isEqual(objA[key], objB[key])) {
|
|
35
|
-
return false; // Keys are different or their values are not equal
|
|
36
|
-
}
|
|
37
|
-
j += 1;
|
|
38
|
-
}
|
|
39
|
-
return true; // All keys and their values are equal
|
|
40
|
-
};
|
|
41
|
-
//# sourceMappingURL=equalityChecks.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"equalityChecks.js","sourceRoot":"","sources":["../../../../src/shared/utils/equalityChecks.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,IAAM,OAAO,GAAG,UAAC,CAAU,EAAE,CAAU;IAC5C,IAAI,OAAO,CAAC,KAAK,OAAO,CAAC,EAAE,CAAC;QAC1B,OAAO,KAAK,CAAC,CAAC,sBAAsB;IACtC,CAAC;IAED,IAAI,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC;QACxC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,kDAAkD;IACpE,CAAC;IAED,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE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C3D,OAAO,KAAK,CAAC,CAAC,mDAAmD;QACnE,CAAC;QACD,CAAC,IAAI,CAAC,CAAC;IACT,CAAC;IAED,OAAO,IAAI,CAAC,CAAC,sCAAsC;AACrD,CAAC,CAAC"}
|
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
11
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
12
|
-
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
13
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
14
|
-
function step(op) {
|
|
15
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
16
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
17
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
18
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
19
|
-
switch (op[0]) {
|
|
20
|
-
case 0: case 1: t = op; break;
|
|
21
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
22
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
23
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
24
|
-
default:
|
|
25
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
26
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
27
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
28
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
29
|
-
if (t[2]) _.ops.pop();
|
|
30
|
-
_.trys.pop(); continue;
|
|
31
|
-
}
|
|
32
|
-
op = body.call(thisArg, _);
|
|
33
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
34
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
38
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
39
|
-
if (ar || !(i in from)) {
|
|
40
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
41
|
-
ar[i] = from[i];
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
45
|
-
};
|
|
46
|
-
//Use this to quickly get the file extensions
|
|
47
|
-
//TODO: This needs to be updatable by a dev, programmatically.
|
|
48
|
-
export var defaultTypeExtensions = {
|
|
49
|
-
"image/png": ".png",
|
|
50
|
-
"image/jpeg": ".jpeg",
|
|
51
|
-
"image/jpg": ".jpg",
|
|
52
|
-
"image/svg+xml": ".svg",
|
|
53
|
-
"application/pdf": ".pdf",
|
|
54
|
-
"application/msword": ".doc",
|
|
55
|
-
"application/vnd.openxmlformats-officedocument.wordprocessingml.document": ".docx",
|
|
56
|
-
};
|
|
57
|
-
//This is the attribute that should be present in all svg files
|
|
58
|
-
var xmlns = "<svg xmlns='http://www.w3.org/2000/svg' ";
|
|
59
|
-
export var maximumUploadCount = 30;
|
|
60
|
-
export var maximumFileSize = 5e6; //5 mb's
|
|
61
|
-
export var printableMaximumFileSize = "5 Megabytes";
|
|
62
|
-
export var isValidFileType = function (file, acceptedTypes) {
|
|
63
|
-
if (acceptedTypes === void 0) { acceptedTypes = defaultTypeExtensions; }
|
|
64
|
-
return Boolean(acceptedTypes[file.type]);
|
|
65
|
-
};
|
|
66
|
-
export var hasSurpassedMaxSize = function (file, maxSize) {
|
|
67
|
-
if (maxSize === void 0) { maxSize = maximumFileSize; }
|
|
68
|
-
return file.size > maxSize;
|
|
69
|
-
};
|
|
70
|
-
export var checkFilesMaximumSize = function (files, maxFileSize) {
|
|
71
|
-
if (maxFileSize === void 0) { maxFileSize = maximumFileSize; }
|
|
72
|
-
return files.every(function (file) { return hasSurpassedMaxSize(file, maxFileSize); });
|
|
73
|
-
};
|
|
74
|
-
export var createUrlString = function (file) { return URL.createObjectURL(file); };
|
|
75
|
-
export var clearBlobFromMemory = function (url) {
|
|
76
|
-
URL.revokeObjectURL(url);
|
|
77
|
-
};
|
|
78
|
-
var createDocumentData = function (file, allowableTypes) {
|
|
79
|
-
if (allowableTypes === void 0) { allowableTypes = defaultTypeExtensions; }
|
|
80
|
-
return ({
|
|
81
|
-
id: file.name.split(".")[0],
|
|
82
|
-
type: allowableTypes[file.type],
|
|
83
|
-
file: file,
|
|
84
|
-
url: createUrlString(file),
|
|
85
|
-
});
|
|
86
|
-
};
|
|
87
|
-
export var SvgXmlnsAttributeCheck = function (file_1) {
|
|
88
|
-
var args_1 = [];
|
|
89
|
-
for (var _i = 1; _i < arguments.length; _i++) {
|
|
90
|
-
args_1[_i - 1] = arguments[_i];
|
|
91
|
-
}
|
|
92
|
-
return __awaiter(void 0, __spreadArray([file_1], args_1, true), void 0, function (file, allowableTypes) {
|
|
93
|
-
var text, svgWithXmlns;
|
|
94
|
-
if (allowableTypes === void 0) { allowableTypes = defaultTypeExtensions; }
|
|
95
|
-
return __generator(this, function (_a) {
|
|
96
|
-
switch (_a.label) {
|
|
97
|
-
case 0:
|
|
98
|
-
if (file.type !== "image/svg+xml")
|
|
99
|
-
return [2 /*return*/, createDocumentData(file, allowableTypes)];
|
|
100
|
-
return [4 /*yield*/, file.text()];
|
|
101
|
-
case 1:
|
|
102
|
-
text = _a.sent();
|
|
103
|
-
if (text.includes("xmlns"))
|
|
104
|
-
return [2 /*return*/, createDocumentData(file, allowableTypes)];
|
|
105
|
-
svgWithXmlns = text.replace("<svg ", xmlns);
|
|
106
|
-
return [2 /*return*/, createDocumentData(new File([svgWithXmlns], file.name, {
|
|
107
|
-
type: file.type,
|
|
108
|
-
}), allowableTypes)];
|
|
109
|
-
}
|
|
110
|
-
});
|
|
111
|
-
});
|
|
112
|
-
};
|
|
113
|
-
export var renameFile = function (file, newName) {
|
|
114
|
-
return new File([file], "".concat(newName), { type: file.type });
|
|
115
|
-
};
|
|
116
|
-
export var checkFile = function (id, file) {
|
|
117
|
-
//Blobs don't have a name, so we need to convert it to a file, then we can rename it
|
|
118
|
-
if (file instanceof Blob) {
|
|
119
|
-
return id.length > 0 ? renameFile(file, id) : file;
|
|
120
|
-
}
|
|
121
|
-
//It's a file, let's process it.
|
|
122
|
-
if (id.length === 0 || id.toLocaleLowerCase() === file.name.toLocaleLowerCase().split(".")[0]) {
|
|
123
|
-
return file;
|
|
124
|
-
}
|
|
125
|
-
return renameFile(file, id);
|
|
126
|
-
};
|
|
127
|
-
//# sourceMappingURL=processUploadedFiles.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"processUploadedFiles.js","sourceRoot":"","sources":["../../../../src/shared/utils/processUploadedFiles.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6CAA6C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