@mamrp/components 1.7.60 → 1.7.61
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/charts/index.d.mts +0 -0
- package/dist/charts/index.d.ts +0 -0
- package/dist/charts/index.js +0 -0
- package/dist/charts/index.js.map +0 -0
- package/dist/charts/index.mjs +0 -0
- package/dist/charts/index.mjs.map +0 -0
- package/dist/date-pickers/index.d.mts +0 -0
- package/dist/date-pickers/index.d.ts +0 -0
- package/dist/date-pickers/index.js +0 -0
- package/dist/date-pickers/index.js.map +0 -0
- package/dist/date-pickers/index.mjs +0 -0
- package/dist/date-pickers/index.mjs.map +0 -0
- package/dist/index.d.mts +0 -0
- package/dist/index.d.ts +0 -0
- package/dist/index.js +29 -12
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +29 -12
- package/dist/index.mjs.map +1 -1
- package/dist/pagination/index.d.mts +0 -0
- package/dist/pagination/index.d.ts +0 -0
- package/dist/pagination/index.js +0 -0
- package/dist/pagination/index.js.map +0 -0
- package/dist/pagination/index.mjs +0 -0
- package/dist/pagination/index.mjs.map +0 -0
- package/dist/selectors/index.d.mts +0 -0
- package/dist/selectors/index.d.ts +0 -0
- package/dist/selectors/index.js +0 -0
- package/dist/selectors/index.js.map +1 -1
- package/dist/selectors/index.mjs +0 -0
- package/dist/selectors/index.mjs.map +1 -1
- package/package.json +2 -1
package/dist/index.mjs
CHANGED
|
@@ -3747,6 +3747,23 @@ function ImageViewer({
|
|
|
3747
3747
|
}
|
|
3748
3748
|
|
|
3749
3749
|
// src/enhanced-upload-image/index.tsx
|
|
3750
|
+
import heic2any from "heic2any";
|
|
3751
|
+
var isHeic = (file) => file.type === "image/heic" || file.type === "image/heif" || file.name.toLowerCase().endsWith(".heic") || file.name.toLowerCase().endsWith(".heif");
|
|
3752
|
+
var convertHeicToJpeg = async (file) => {
|
|
3753
|
+
const convertedBlob = await heic2any({
|
|
3754
|
+
blob: file,
|
|
3755
|
+
toType: "image/jpeg",
|
|
3756
|
+
quality: 0.9
|
|
3757
|
+
});
|
|
3758
|
+
return new File(
|
|
3759
|
+
[convertedBlob],
|
|
3760
|
+
file.name.replace(/\.(heic|heif)$/i, ".jpg"),
|
|
3761
|
+
{
|
|
3762
|
+
type: "image/jpeg",
|
|
3763
|
+
lastModified: Date.now()
|
|
3764
|
+
}
|
|
3765
|
+
);
|
|
3766
|
+
};
|
|
3750
3767
|
var UploadImage = ({
|
|
3751
3768
|
placeholder,
|
|
3752
3769
|
name,
|
|
@@ -3808,20 +3825,20 @@ var UploadImage = ({
|
|
|
3808
3825
|
});
|
|
3809
3826
|
};
|
|
3810
3827
|
const handleImageChange = async (event) => {
|
|
3811
|
-
|
|
3812
|
-
if (file)
|
|
3813
|
-
|
|
3814
|
-
|
|
3815
|
-
|
|
3816
|
-
|
|
3817
|
-
|
|
3818
|
-
(compressedFile.size / 1024).toFixed(2)
|
|
3819
|
-
);
|
|
3820
|
-
const objectURL = URL.createObjectURL(compressedFile);
|
|
3821
|
-
setSelectedImage(objectURL);
|
|
3822
|
-
setValue(name, compressedFile);
|
|
3828
|
+
let file = event.target.files?.[0];
|
|
3829
|
+
if (!file) return;
|
|
3830
|
+
if (isHeic(file)) {
|
|
3831
|
+
try {
|
|
3832
|
+
file = await convertHeicToJpeg(file);
|
|
3833
|
+
} catch (e) {
|
|
3834
|
+
return;
|
|
3823
3835
|
}
|
|
3824
3836
|
}
|
|
3837
|
+
const compressedFile = await compressImage(file);
|
|
3838
|
+
if (!compressedFile) return;
|
|
3839
|
+
const objectURL = URL.createObjectURL(compressedFile);
|
|
3840
|
+
setSelectedImage(objectURL);
|
|
3841
|
+
setValue(name, compressedFile);
|
|
3825
3842
|
};
|
|
3826
3843
|
const handleRemoveImage = () => {
|
|
3827
3844
|
setSelectedImage(null);
|