monica-alexandria 3.72.2 → 3.72.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.es.js +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/src/export/components/upload/Upload_.js +14 -7
package/dist/index.es.js
CHANGED
|
@@ -2964,7 +2964,7 @@ object-assign
|
|
|
2964
2964
|
fill: var(--mainLight);
|
|
2965
2965
|
}
|
|
2966
2966
|
}
|
|
2967
|
-
`;function Ud(n){const[r,o]=t(n.files),i=(e,t)=>{n.boomRejected(e,t)},{getRootProps:l,getInputProps:s,isDragActive:u,isDragAccept:d,isDragReject:m}=Hd({accept:n.accept?n.accept:"image/svg, image/jpeg, image/png, image/jpg, video/mp4, video/mpeg, video/webm",onDrop:c((e=>{const t=e.map((e=>{const t=e.name.split(".").pop(),r=n.userId?`${n.userId}.${t}`:e.name;return{...e,preview:URL.createObjectURL(e),name:r,lastModified:e.lastModified,lastModifiedDate:e.lastModifiedDate,type:e.type,webkitRelativePath:e.webkitRelativePath}}));let r=[];t.forEach((e=>{"video"===n.type&&e.size>n.maxSize?i("videoSize",e.name):n.accept&&""!==n.accept&&!n.accept
|
|
2967
|
+
`;function Ud(n){const[r,o]=t(n.files),i=(e,t)=>{n.boomRejected(e,t)},{getRootProps:l,getInputProps:s,isDragActive:u,isDragAccept:d,isDragReject:m}=Hd({accept:n.accept?n.accept:"image/svg, image/jpeg, image/png, image/jpg, video/mp4, video/mpeg, video/webm",onDrop:c((e=>{const t=e.map((e=>{const t=e.name.split(".").pop();console.log("props.userId",n.userId);const r=n.userId?`${n.userId}.${t}`:e.name;return console.log("file",e),{...e,preview:URL.createObjectURL(e),name:r,lastModified:e.lastModified,lastModifiedDate:e.lastModifiedDate,type:e.type,webkitRelativePath:e.webkitRelativePath}}));console.log("FILES",t);let r=[];t.forEach((e=>{"video"===n.type&&e.size>n.maxSize?i("videoSize",e.name):n.accept&&""!==n.accept&&!n.accept.split(",").map((e=>e.trim())).includes(e.type)||"image/png"!==e.type&&"image/jpeg"!==e.type&&"video/mp4"!==e.type&&"video/mpeg"!==e.type&&"image/webm"!==e.type?i("fileMimetype",e.name):e.size>n.maxSize?i("fileSize",e.name):r.push(e)})),r?.length>0&&o(r)}),[n.userId,n.accept,n.maxSize,n.type,i]),onDropRejected:()=>{"video"===n.type?i("videoType",""):"avatar"===n.type||"cover"===n.type?i("imageType",""):"media"===n.type&&i("mediaType","")},maxFiles:n.maxFiles});return a((()=>{n.getFilesFromChild(r)}),[r]),e.createElement(Gd,Bu({className:"Upload",noPadding:n.noPadding},l({isDragActive:u,isDragAccept:d,isDragReject:m})),e.createElement(y,{Icon:n.iconUpload?n.iconUpload:"Upload"}),e.createElement("span",null,n.text),e.createElement("input",s()))}const qd=m.div`
|
|
2968
2968
|
background: ${e=>e.theme.low};
|
|
2969
2969
|
padding: var(--largePads);
|
|
2970
2970
|
border-radius: var(--normalRadius);
|
package/dist/index.js
CHANGED
|
@@ -2964,7 +2964,7 @@ object-assign
|
|
|
2964
2964
|
fill: var(--mainLight);
|
|
2965
2965
|
}
|
|
2966
2966
|
}
|
|
2967
|
-
`;function Fs(t){const[n,r]=e.useState(t.files),o=(e,n)=>{t.boomRejected(e,n)},{getRootProps:i,getInputProps:l,isDragActive:u,isDragAccept:s,isDragReject:d}=Ns({accept:t.accept?t.accept:"image/svg, image/jpeg, image/png, image/jpg, video/mp4, video/mpeg, video/webm",onDrop:e.useCallback((e=>{const n=e.map((e=>{const n=e.name.split(".").pop(),r=t.userId?`${t.userId}.${n}`:e.name;return{...e,preview:URL.createObjectURL(e),name:r,lastModified:e.lastModified,lastModifiedDate:e.lastModifiedDate,type:e.type,webkitRelativePath:e.webkitRelativePath}}));let a=[];n.forEach((e=>{"video"===t.type&&e.size>t.maxSize?o("videoSize",e.name):t.accept&&""!==t.accept&&!t.accept
|
|
2967
|
+
`;function Fs(t){const[n,r]=e.useState(t.files),o=(e,n)=>{t.boomRejected(e,n)},{getRootProps:i,getInputProps:l,isDragActive:u,isDragAccept:s,isDragReject:d}=Ns({accept:t.accept?t.accept:"image/svg, image/jpeg, image/png, image/jpg, video/mp4, video/mpeg, video/webm",onDrop:e.useCallback((e=>{const n=e.map((e=>{const n=e.name.split(".").pop();console.log("props.userId",t.userId);const r=t.userId?`${t.userId}.${n}`:e.name;return console.log("file",e),{...e,preview:URL.createObjectURL(e),name:r,lastModified:e.lastModified,lastModifiedDate:e.lastModifiedDate,type:e.type,webkitRelativePath:e.webkitRelativePath}}));console.log("FILES",n);let a=[];n.forEach((e=>{"video"===t.type&&e.size>t.maxSize?o("videoSize",e.name):t.accept&&""!==t.accept&&!t.accept.split(",").map((e=>e.trim())).includes(e.type)||"image/png"!==e.type&&"image/jpeg"!==e.type&&"video/mp4"!==e.type&&"video/mpeg"!==e.type&&"image/webm"!==e.type?o("fileMimetype",e.name):e.size>t.maxSize?o("fileSize",e.name):a.push(e)})),a?.length>0&&r(a)}),[t.userId,t.accept,t.maxSize,t.type,o]),onDropRejected:()=>{"video"===t.type?o("videoType",""):"avatar"===t.type||"cover"===t.type?o("imageType",""):"media"===t.type&&o("mediaType","")},maxFiles:t.maxFiles});return e.useEffect((()=>{t.getFilesFromChild(n)}),[n]),a.default.createElement(Ps,Tu({className:"Upload",noPadding:t.noPadding},i({isDragActive:u,isDragAccept:s,isDragReject:d})),a.default.createElement(c,{Icon:t.iconUpload?t.iconUpload:"Upload"}),a.default.createElement("span",null,t.text),a.default.createElement("input",l()))}const zs=o.default.div`
|
|
2968
2968
|
background: ${e=>e.theme.low};
|
|
2969
2969
|
padding: var(--largePads);
|
|
2970
2970
|
border-radius: var(--normalRadius);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "monica-alexandria",
|
|
3
|
-
"version": "3.72.
|
|
3
|
+
"version": "3.72.3",
|
|
4
4
|
"description": "A styled-components styles library for Doitforme platorm and universal tweeks to create your own new styled library for your project",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.es.js",
|
|
@@ -49,9 +49,13 @@ export default function Upload_(props) {
|
|
|
49
49
|
// Extract file extension
|
|
50
50
|
const fileExtension = file.name.split('.').pop();
|
|
51
51
|
// Rename file using userId and file extension
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
console.log('props.userId', props.userId);
|
|
52
55
|
|
|
53
56
|
const newName =props.userId ? `${props.userId}.${fileExtension}` : file.name;
|
|
54
57
|
|
|
58
|
+
console.log('file',file);
|
|
55
59
|
// Create a new object with the modified name and preview
|
|
56
60
|
return {
|
|
57
61
|
...file,
|
|
@@ -65,6 +69,9 @@ export default function Upload_(props) {
|
|
|
65
69
|
};
|
|
66
70
|
});
|
|
67
71
|
|
|
72
|
+
|
|
73
|
+
console.log('FILES', files);
|
|
74
|
+
|
|
68
75
|
let tempFiles = [];
|
|
69
76
|
files.forEach((file) => {
|
|
70
77
|
if (props.type === "video" && file.size > props.maxSize) {
|
|
@@ -72,21 +79,21 @@ export default function Upload_(props) {
|
|
|
72
79
|
} else if (
|
|
73
80
|
props.accept &&
|
|
74
81
|
props.accept !== "" &&
|
|
75
|
-
!props.accept
|
|
82
|
+
!props.accept.split(',').map(type => type.trim()).includes(file.type)
|
|
76
83
|
) {
|
|
77
84
|
boomRejected("fileMimetype", file.name);
|
|
78
85
|
}
|
|
79
86
|
else if (
|
|
80
|
-
file
|
|
81
|
-
file
|
|
82
|
-
file
|
|
83
|
-
file
|
|
84
|
-
file
|
|
87
|
+
file.type !== "image/png" &&
|
|
88
|
+
file.type !== "image/jpeg" &&
|
|
89
|
+
file.type !== "video/mp4" &&
|
|
90
|
+
file.type !== "video/mpeg" &&
|
|
91
|
+
file.type !== "image/webm"
|
|
85
92
|
) {
|
|
86
93
|
boomRejected("fileMimetype", file.name);
|
|
87
94
|
}
|
|
88
95
|
else if (file.size > props.maxSize) {
|
|
89
|
-
boomRejected("fileSize", file
|
|
96
|
+
boomRejected("fileSize", file.name);
|
|
90
97
|
} else {
|
|
91
98
|
tempFiles.push(file);
|
|
92
99
|
}
|