@zydon/common 2.6.94 → 2.6.95

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 (59) hide show
  1. package/dist/chunk-ORQNUG2V.js +6 -0
  2. package/dist/{chunk-G2EXNBOF.js → chunk-PF7OFL6X.js} +1 -1
  3. package/dist/{chunk-EPSIFEA7.js → chunk-VGB7HPN6.js} +1 -1
  4. package/dist/components/ActionButton/index.js +1 -1
  5. package/dist/components/Autocomplete/index.js +1 -1
  6. package/dist/components/AvatarButton/index.js +5 -5
  7. package/dist/components/BuilderLayout/index.js +1 -1
  8. package/dist/components/BuilderSidebar/index.js +1 -1
  9. package/dist/components/Common/index.js +3 -3
  10. package/dist/components/DataView/index.js +2 -2
  11. package/dist/components/DragButton/index.js +1 -1
  12. package/dist/components/Drawer/index.js +1 -1
  13. package/dist/components/EasyCropModal/index.js +1 -1
  14. package/dist/components/Error/index.js +1 -1
  15. package/dist/components/ExpandableGroup/index.js +1 -1
  16. package/dist/components/FileUpload/hooks/useFileUploadService.d.ts +7 -0
  17. package/dist/components/FileUpload/hooks/useFileUploadService.js +2 -0
  18. package/dist/components/FileUpload/index.d.ts +8 -356
  19. package/dist/components/FileUpload/index.js +14 -12
  20. package/dist/components/FrameSkeleton/index.js +1 -1
  21. package/dist/components/HelpButton/index.js +1 -1
  22. package/dist/components/Icon/index.js +1 -1
  23. package/dist/components/IconButton/index.js +1 -1
  24. package/dist/components/ImageCropModal/index.js +1 -1
  25. package/dist/components/Incrementer/index.js +1 -1
  26. package/dist/components/InfoCircle/index.js +1 -1
  27. package/dist/components/ListBundles/index.js +1 -1
  28. package/dist/components/MenuItem/index.js +1 -1
  29. package/dist/components/Modal/index.js +1 -1
  30. package/dist/components/MoreMenu/index.js +1 -1
  31. package/dist/components/PasswordRules/index.js +1 -1
  32. package/dist/components/PopoverSelect/index.js +1 -1
  33. package/dist/components/SearchInput/index.js +1 -1
  34. package/dist/components/SelectableCards/index.js +1 -1
  35. package/dist/components/SeoPreview/index.js +1 -1
  36. package/dist/components/StateDisplay/index.js +1 -1
  37. package/dist/components/Steps/index.js +1 -1
  38. package/dist/components/StyledTab/index.js +1 -1
  39. package/dist/components/SwapList/index.js +1 -1
  40. package/dist/components/ToggleTheme/index.js +4 -4
  41. package/dist/components/WebhookCard/index.js +1 -1
  42. package/dist/components/carousel/index.js +1 -1
  43. package/dist/components/form/Address/index.js +2 -2
  44. package/dist/components/form/Autocomplete/index.js +1 -1
  45. package/dist/components/form/Incrementer/index.js +1 -1
  46. package/dist/components/form/Password/index.js +1 -1
  47. package/dist/components/form/SelectableCards/index.js +1 -1
  48. package/dist/components/form/UploadAvatarWithCrop/index.js +1 -1
  49. package/dist/components/form/UploadWithCrop/index.js +1 -1
  50. package/dist/components/form/Webhook/index.js +1 -1
  51. package/dist/components/lightbox/index.js +1 -1
  52. package/dist/components/table/index.js +1 -1
  53. package/dist/components/upload/index.js +1 -1
  54. package/dist/hooks/useThemeToggle.js +3 -3
  55. package/dist/index.js +3 -3
  56. package/dist/theme/theme-provider.js +2 -2
  57. package/dist/useFileUploadService-1a2d0cf5.d.ts +358 -0
  58. package/package.json +1 -1
  59. package/dist/{chunk-CASOITDH.js → chunk-L4KD6JF2.js} +1 -1
@@ -0,0 +1,6 @@
1
+ import { a } from './chunk-GFJT57TO.js';
2
+ import { useState, useMemo, useCallback, useRef, useEffect } from 'react';
3
+
4
+ var M=(o=>(o.APPLICATION_OCTET_STREAM="application/octet-stream",o.IMAGE_JPEG="image/jpeg",o.IMAGE_JPG="image/jpg",o.IMAGE_PNG="image/png",o.IMAGE_GIF="image/gif",o.IMAGE_WEBP="image/webp",o.IMAGE_SVG="image/svg+xml",o.IMAGE_BMP="image/bmp",o.IMAGE_TIFF="image/tiff",o.IMAGE_ICO="image/x-icon",o.IMAGE_AVIF="image/avif",o.APPLICATION_PDF="application/pdf",o.TEXT_PLAIN="text/plain",o.TEXT_CSV="text/csv",o.APPLICATION_RTF="application/rtf",o.APPLICATION_MSWORD="application/msword",o.APPLICATION_DOCX="application/vnd.openxmlformats-officedocument.wordprocessingml.document",o.APPLICATION_MSEXCEL="application/vnd.ms-excel",o.APPLICATION_XLSX="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",o.APPLICATION_MSPOWERPOINT="application/vnd.ms-powerpoint",o.APPLICATION_PPTX="application/vnd.openxmlformats-officedocument.presentationml.presentation",o.APPLICATION_ODT="application/vnd.oasis.opendocument.text",o.APPLICATION_ODS="application/vnd.oasis.opendocument.spreadsheet",o.APPLICATION_ODP="application/vnd.oasis.opendocument.presentation",o.APPLICATION_XML="application/xml",o.TEXT_XML="text/xml",o.TEXT_HTML="text/html",o.TEXT_CSS="text/css",o.APPLICATION_JSON="application/json",o.TEXT_JAVASCRIPT="text/javascript",o.APPLICATION_ZIP="application/zip",o.APPLICATION_GZIP="application/gzip",o.APPLICATION_RAR="application/vnd.rar",o.APPLICATION_7Z="application/x-7z-compressed",o.AUDIO_MPEG="audio/mpeg",o.AUDIO_WAV="audio/wav",o.AUDIO_OGG="audio/ogg",o.AUDIO_WEBM="audio/webm",o.AUDIO_AAC="audio/aac",o.VIDEO_MP4="video/mp4",o.VIDEO_MPEG="video/mpeg",o.VIDEO_OGG="video/ogg",o.VIDEO_WEBM="video/webm",o.VIDEO_QUICKTIME="video/quicktime",o))(M||{}),R=(e=>(e["application/octet-stream"]="APPLICATION_OCTET_STREAM",e["image/jpeg"]="IMAGE_JPEG",e["image/jpg"]="IMAGE_JPG",e["image/png"]="IMAGE_PNG",e["image/gif"]="IMAGE_GIF",e["image/webp"]="IMAGE_WEBP",e["image/svg+xml"]="IMAGE_SVG",e["image/bmp"]="IMAGE_BMP",e["image/tiff"]="IMAGE_TIFF",e["image/x-icon"]="IMAGE_ICO",e["image/avif"]="IMAGE_AVIF",e["application/pdf"]="APPLICATION_PDF",e["text/plain"]="TEXT_PLAIN",e["text/csv"]="TEXT_CSV",e["application/rtf"]="APPLICATION_RTF",e["application/msword"]="APPLICATION_MSWORD",e["application/vnd.openxmlformats-officedocument.wordprocessingml.document"]="APPLICATION_DOCX",e["application/vnd.ms-excel"]="APPLICATION_MSEXCEL",e["application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"]="APPLICATION_XLSX",e["application/vnd.ms-powerpoint"]="APPLICATION_MSPOWERPOINT",e["application/vnd.openxmlformats-officedocument.presentationml.presentation"]="APPLICATION_PPTX",e["application/vnd.oasis.opendocument.text"]="APPLICATION_ODT",e["application/vnd.oasis.opendocument.spreadsheet"]="APPLICATION_ODS",e["application/vnd.oasis.opendocument.presentation"]="APPLICATION_ODP",e["application/xml"]="APPLICATION_XML",e["text/xml"]="TEXT_XML",e["text/html"]="TEXT_HTML",e["text/css"]="TEXT_CSS",e["application/json"]="APPLICATION_JSON",e["text/javascript"]="TEXT_JAVASCRIPT",e["application/zip"]="APPLICATION_ZIP",e["application/gzip"]="APPLICATION_GZIP",e["application/vnd.rar"]="APPLICATION_RAR",e["application/x-7z-compressed"]="APPLICATION_7Z",e["audio/mpeg"]="AUDIO_MPEG",e["audio/wav"]="AUDIO_WAV",e["audio/ogg"]="AUDIO_OGG",e["audio/webm"]="AUDIO_WEBM",e["audio/aac"]="AUDIO_AAC",e["video/mp4"]="VIDEO_MP4",e["video/mpeg"]="VIDEO_MPEG",e["video/ogg"]="VIDEO_OGG",e["video/webm"]="VIDEO_WEBM",e["video/quicktime"]="VIDEO_QUICKTIME",e))(R||{});var Z=e=>e.startsWith("image/"),B=(e,s=.8)=>new Promise((l,p)=>{let P=document.createElement("canvas"),u=P.getContext("2d"),r=new Image;r.onload=()=>{P.width=r.width,P.height=r.height,u?(u.drawImage(r,0,0),P.toBlob(a=>{if(a){let g=new File([a],e.name.replace(/\.[^/.]+$/,".webp"),{type:"image/webp",lastModified:Date.now()});l(g);}else p(new Error("Falha ao converter para WebP"));},"image/webp",s)):p(new Error("N\xE3o foi poss\xEDvel obter contexto do canvas"));},r.onerror=()=>p(new Error("Falha ao carregar imagem")),r.src=URL.createObjectURL(e);}),H=(e,s=.8,l,p)=>new Promise((P,u)=>{let r=document.createElement("canvas"),a=r.getContext("2d"),g=new Image;g.onload=()=>{let{width:d,height:n}=g;l&&d>l&&(n=n*l/d,d=l),p&&n>p&&(d=d*p/n,n=p),r.width=d,r.height=n,a?(a.imageSmoothingEnabled=!0,a.imageSmoothingQuality="high",a.drawImage(g,0,0,d,n),r.toBlob(E=>{if(E){let _=new File([E],e.name.replace(/\.[^/.]+$/,".webp"),{type:"image/webp",lastModified:Date.now()});P(_);}else u(new Error("Falha ao comprimir imagem"));},"image/webp",s)):u(new Error("N\xE3o foi poss\xEDvel obter contexto do canvas"));},g.onerror=()=>u(new Error("Falha ao carregar imagem")),g.src=URL.createObjectURL(e);}),N=e=>{let s=e.match(/filename\*=UTF-8''([^;]+)|filename="?([^";]+)"?/i);return s?.[1]||s?.[2]||""},G=e=>`UTF-8''${encodeURIComponent(e)}`;var j=({createFilesMutation:e,filesDetails:s})=>{let{showErrorMessage:l}=a(),[p,P]=useState(!1),[u,r]=useState(!1),[a$1,g]=useState(null),[d,n]=useState([]),E=useMemo(()=>d?.[0],[d]),_=u||p,w=useCallback(async I=>{if(!I.length){n([]),r(!1);return}r(!0);try{let c=(await Promise.all(I.map(async({url:A,id:b,name:F})=>{try{if(!A)return null;let i=await fetch(A);if(!i.ok)throw new Error(i.statusText);let t=await i.blob(),m=null;if(!F){let S=i.headers.get("content-disposition")||void 0;if(S){let h=N(S);if(h)try{m=decodeURIComponent(h);}catch{m=h;}}}let x=m||F||b,O=new File([t],x,{type:t.type});return O.id=b,O.url=A,O}catch{return null}}))).filter(Boolean);n(c),r(!1);}catch(f){l(f,"Erro ao carregar arquivos"),n([]),r(!1);}},[l]),D=useRef("");useEffect(()=>{let I=s?.map(({id:f})=>f).join(",")||"";I!==D.current&&(async()=>(D.current=I,await w(s)))();},[s,w]);let z=async I=>{if(!I||!Array.isArray(I))throw new Error("Arquivos inv\xE1lidos");let f=I.filter(c=>c instanceof File);if(f?.length){P(!0);try{let c=f.map(i=>{let t=i.type||"application/octet-stream",m=R[t];if(!m)throw new Error(`Tipo de arquivo n\xE3o suportado: ${t}`);return {file:i,mimeType:t,contentTypeEnum:m}}),A=await e({files:c.map(({file:i,contentTypeEnum:t})=>({content_type:t,name:i.name}))}).unwrap(),b=A.files.map((i,t)=>{let m=c[t].file,x=m;return x.id=i.id,x.url=URL.createObjectURL(m),x});return await(await Promise.all(A.files.map((i,t)=>{let{mimeType:m}=c[t],x=b[t];return fetch(i.url,{method:"PUT",headers:{"Content-Type":m,"Content-Disposition":`inline; filename*=${G(x.name)}`,"X-File-Id":i.id},body:x})}))).forEach(async i=>{if(!i.ok)throw new Error("Erro no upload do arquivo.")}),b}catch(c){throw g(c),l(c,"Erro no upload"),c}finally{P(!1);}}},T=useMemo(()=>a$1&&a$1 instanceof Error?a$1.message:a$1,[a$1]);return {setFilesPreview:n,uploadFiles:z,filesPreview:d,filePreview:E,isLoadingPreview:u,isUploadingFiles:p,isUploadOrLoadingFiles:_,uploadErrorText:T}},ee=j;
5
+
6
+ export { Z as a, B as b, H as c, N as d, G as e, M as f, R as g, ee as h };
@@ -1,4 +1,4 @@
1
- import { b as b$1 } from './chunk-CASOITDH.js';
1
+ import { b as b$1 } from './chunk-L4KD6JF2.js';
2
2
  import { b } from './chunk-FT5VGKNM.js';
3
3
  import { useColorScheme } from '@mui/material/styles';
4
4
 
@@ -1,4 +1,4 @@
1
- import { a } from './chunk-G2EXNBOF.js';
1
+ import { a } from './chunk-PF7OFL6X.js';
2
2
  import { forwardRef } from 'react';
3
3
  import r from '@mui/material/Box';
4
4
  import { styled, alpha } from '@mui/material/styles';
@@ -1,4 +1,4 @@
1
1
  export { a as default } from '../../chunk-F5HXBPOO.js';
2
2
  import '../../chunk-BFAYY2AM.js';
3
- import '../../chunk-JJM24URR.js';
4
3
  import '../../chunk-FO7JCJ76.js';
4
+ import '../../chunk-JJM24URR.js';
@@ -1,4 +1,4 @@
1
1
  export { a as default } from '../../chunk-C6ZLQ63H.js';
2
2
  import '../../chunk-BFAYY2AM.js';
3
- import '../../chunk-JJM24URR.js';
4
3
  import '../../chunk-FO7JCJ76.js';
4
+ import '../../chunk-JJM24URR.js';
@@ -1,20 +1,20 @@
1
1
  import { a as a$4 } from '../../chunk-FP2AYD66.js';
2
- import { a as a$5 } from '../../chunk-EPSIFEA7.js';
2
+ import { a as a$5 } from '../../chunk-VGB7HPN6.js';
3
3
  import { a } from '../../chunk-X2EIL7EB.js';
4
4
  import { a as a$2 } from '../../chunk-NF42ENKE.js';
5
5
  import { a as a$3 } from '../../chunk-BFAYY2AM.js';
6
- import '../../chunk-JJM24URR.js';
7
6
  import '../../chunk-FO7JCJ76.js';
7
+ import '../../chunk-JJM24URR.js';
8
8
  import { a as a$1 } from '../../chunk-ORYAES3Q.js';
9
- import '../../chunk-G2EXNBOF.js';
10
- import '../../chunk-CASOITDH.js';
9
+ import '../../chunk-PF7OFL6X.js';
10
+ import '../../chunk-L4KD6JF2.js';
11
11
  import '../../chunk-SO64ZYQB.js';
12
+ import '../../chunk-GUFT6XPG.js';
12
13
  import '../../chunk-FT5VGKNM.js';
13
14
  import '../../chunk-KHS3U6GK.js';
14
15
  import '../../chunk-DXGMZFNS.js';
15
16
  import '../../chunk-CFVUZ4S5.js';
16
17
  import '../../chunk-7KH2T72T.js';
17
- import '../../chunk-GUFT6XPG.js';
18
18
  import '../../chunk-7J53ZUIF.js';
19
19
  import '../../chunk-S7QQBC4I.js';
20
20
  import '../../chunk-QQDMA4TE.js';
@@ -1,7 +1,7 @@
1
1
  import { a as a$1 } from '../../chunk-DSFPGTNS.js';
2
2
  import '../../chunk-BFAYY2AM.js';
3
- import '../../chunk-JJM24URR.js';
4
3
  import '../../chunk-FO7JCJ76.js';
4
+ import '../../chunk-JJM24URR.js';
5
5
  import a from '@mui/material/Stack';
6
6
  import { styled, alpha } from '@mui/material/styles';
7
7
  import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
@@ -1,7 +1,7 @@
1
1
  import { a as a$1 } from '../../chunk-W3MYAMTH.js';
2
2
  import { a as a$2 } from '../../chunk-BFAYY2AM.js';
3
- import '../../chunk-JJM24URR.js';
4
3
  import '../../chunk-FO7JCJ76.js';
4
+ import '../../chunk-JJM24URR.js';
5
5
  import a from '@mui/material/Stack';
6
6
  import { styled } from '@mui/material/styles';
7
7
  import { jsx, jsxs } from 'react/jsx-runtime';
@@ -1,15 +1,15 @@
1
1
  import { a as a$1 } from '../../chunk-UBRDWK4B.js';
2
2
  import { a } from '../../chunk-BFAYY2AM.js';
3
- import '../../chunk-JJM24URR.js';
4
3
  import '../../chunk-FO7JCJ76.js';
5
- import { c, b as b$2 } from '../../chunk-CASOITDH.js';
4
+ import '../../chunk-JJM24URR.js';
5
+ import { c, b as b$2 } from '../../chunk-L4KD6JF2.js';
6
6
  import '../../chunk-SO64ZYQB.js';
7
+ import '../../chunk-GUFT6XPG.js';
7
8
  import { b as b$1 } from '../../chunk-FT5VGKNM.js';
8
9
  import '../../chunk-KHS3U6GK.js';
9
10
  import '../../chunk-DXGMZFNS.js';
10
11
  import '../../chunk-CFVUZ4S5.js';
11
12
  import '../../chunk-7KH2T72T.js';
12
- import '../../chunk-GUFT6XPG.js';
13
13
  import { k } from '../../chunk-7J53ZUIF.js';
14
14
  import '../../chunk-S7QQBC4I.js';
15
15
  import '../../chunk-QQDMA4TE.js';
@@ -1,6 +1,6 @@
1
1
  import { a as a$5 } from '../../chunk-QAB3RH43.js';
2
- import { a as a$2 } from '../../chunk-5YJTSVA2.js';
3
2
  import { a as a$6 } from '../../chunk-TWGGHTU5.js';
3
+ import { a as a$2 } from '../../chunk-5YJTSVA2.js';
4
4
  import { a } from '../../chunk-NPXVOPB2.js';
5
5
  import { a as a$9 } from '../../chunk-T7AZE2TB.js';
6
6
  import { a as a$7 } from '../../chunk-FK7DDO5L.js';
@@ -9,8 +9,8 @@ import '../../chunk-U26IUEAG.js';
9
9
  import { a as a$4 } from '../../chunk-X2EIL7EB.js';
10
10
  import { a as a$8 } from '../../chunk-26GV7WKC.js';
11
11
  import { a as a$1 } from '../../chunk-BFAYY2AM.js';
12
- import '../../chunk-JJM24URR.js';
13
12
  import '../../chunk-FO7JCJ76.js';
13
+ import '../../chunk-JJM24URR.js';
14
14
  import { a as a$3 } from '../../chunk-ORYAES3Q.js';
15
15
  import { b as b$1 } from '../../chunk-ILHUUK4X.js';
16
16
  import '../../chunk-7J53ZUIF.js';
@@ -1,4 +1,4 @@
1
1
  export { a as default } from '../../chunk-ZQDQI4FF.js';
2
2
  import '../../chunk-BFAYY2AM.js';
3
- import '../../chunk-JJM24URR.js';
4
3
  import '../../chunk-FO7JCJ76.js';
4
+ import '../../chunk-JJM24URR.js';
@@ -1,7 +1,7 @@
1
1
  import { a as a$2 } from '../../chunk-26GV7WKC.js';
2
2
  import { a as a$1 } from '../../chunk-BFAYY2AM.js';
3
- import '../../chunk-JJM24URR.js';
4
3
  import '../../chunk-FO7JCJ76.js';
4
+ import '../../chunk-JJM24URR.js';
5
5
  import g from '@mui/material/Drawer';
6
6
  import x from '@mui/material/IconButton';
7
7
  import a from '@mui/material/Stack';
@@ -2,6 +2,6 @@ export { a as default } from '../../chunk-RQ4T6IDM.js';
2
2
  import '../../chunk-BPY2UXIB.js';
3
3
  import '../../chunk-7AZX7L27.js';
4
4
  import '../../chunk-BFAYY2AM.js';
5
- import '../../chunk-JJM24URR.js';
6
5
  import '../../chunk-FO7JCJ76.js';
6
+ import '../../chunk-JJM24URR.js';
7
7
  import '../../chunk-ILHUUK4X.js';
@@ -1,6 +1,6 @@
1
1
  import { a } from '../../chunk-BFAYY2AM.js';
2
- import '../../chunk-JJM24URR.js';
3
2
  import '../../chunk-FO7JCJ76.js';
3
+ import '../../chunk-JJM24URR.js';
4
4
  import F from '@mui/material/Button';
5
5
  import i from '@mui/material/Stack';
6
6
  import l from '@mui/material/Typography';
@@ -1,7 +1,7 @@
1
1
  import { a } from '../../chunk-W3MYAMTH.js';
2
2
  import { a as a$1 } from '../../chunk-BFAYY2AM.js';
3
- import '../../chunk-JJM24URR.js';
4
3
  import '../../chunk-FO7JCJ76.js';
4
+ import '../../chunk-JJM24URR.js';
5
5
  import s from '@mui/material/IconButton';
6
6
  import n from '@mui/material/Stack';
7
7
  import m from '@mui/material/Typography';
@@ -0,0 +1,7 @@
1
+ import 'react';
2
+ export { u as default } from '../../../useFileUploadService-1a2d0cf5.js';
3
+ import 'react-dropzone';
4
+ import 'react-easy-crop';
5
+ import '@dnd-kit/core';
6
+ import '@mui/material/Stack';
7
+ import '@mui/material/styles';
@@ -0,0 +1,2 @@
1
+ export { h as default } from '../../../chunk-ORQNUG2V.js';
2
+ import '../../../chunk-GFJT57TO.js';
@@ -1,334 +1,12 @@
1
1
  import * as react from 'react';
2
2
  import * as react_jsx_runtime from 'react/jsx-runtime';
3
- import { DropzoneOptions, DropzoneRootProps, FileRejection, DropzoneInputProps, useDropzone } from 'react-dropzone';
4
- import { Area } from 'react-easy-crop';
5
- import { DraggableAttributes, DraggableSyntheticListeners } from '@dnd-kit/core';
6
- import { StackProps } from '@mui/material/Stack';
7
- import { SxProps, Theme } from '@mui/material/styles';
8
-
9
- interface ExtendFile extends File {
10
- id: string;
11
- url: string;
12
- }
13
- interface FileDetails {
14
- id: string;
15
- url: string;
16
- name?: string;
17
- }
18
- interface FileUpload {
19
- url: string;
20
- file: ExtendFile;
21
- contentType: string;
22
- resourceIds: string[];
23
- }
24
- type CropSize = {
25
- width: number;
26
- height: number;
27
- } | number;
28
- type CreateFilesMutation = (files: ExtendFile[]) => Promise<string[] | undefined>;
29
- interface FileCreateRequest {
30
- files: Array<{
31
- content_type: keyof typeof ContentType;
32
- name: string;
33
- }>;
34
- }
35
- interface FileGetResponse {
36
- id: string;
37
- name: string;
38
- organization_id: string;
39
- url: string;
40
- status: 'PENDING' | 'COMPLETED' | 'FAILED';
41
- content_type: string;
42
- content_length: number;
43
- created_by: string;
44
- created_at: string;
45
- updated_by: string;
46
- updated_at: string;
47
- }
48
- interface FileCreateResponse {
49
- files: FileGetResponse[];
50
- }
51
- interface FileQueryRequest {
52
- ids: string[];
53
- }
54
- interface FileQueryResponse {
55
- files: FileGetResponse[];
56
- }
57
- interface SingleFilePreviewProps extends StackProps {
58
- file: ExtendFile;
59
- aspectRatio?: number;
60
- isLoading?: boolean;
61
- cropSize?: CropSize;
62
- onLoading?: (isLoading: boolean) => void;
63
- isUploading?: boolean;
64
- maxWidth?: number;
65
- maxHeight?: number;
66
- }
67
- interface LoadingPreviewImageProps extends React.ImgHTMLAttributes<HTMLImageElement> {
68
- aspectRatio: number;
69
- maxWidth?: number | string;
70
- maxHeight?: number | string;
71
- isLoading?: boolean;
72
- isUploading?: boolean;
73
- cropSize?: CropSize;
74
- onLoading?: (isLoading: boolean) => void;
75
- alt?: string;
76
- src?: string;
77
- loading: 'lazy';
78
- }
79
- interface PlaceholderProps extends StackProps {
80
- header?: React.ReactNode;
81
- description?: React.ReactNode;
82
- }
83
- interface FileUploadProps {
84
- createFilesMutation: (params: FileCreateRequest) => {
85
- unwrap: () => Promise<FileCreateResponse>;
86
- };
87
- filesDetails: FileDetails[];
88
- }
89
- interface SingleFileUploadProps extends DropzoneOptions {
90
- onRemove?: (file?: ExtendFile) => void;
91
- onFileSelect?: (file: ExtendFile) => void;
92
- createFilesMutation: FileUploadProps['createFilesMutation'];
93
- fileDetails?: FileDetails;
94
- placeholderProps?: PlaceholderProps;
95
- placeholderAlt?: React.ReactNode;
96
- name?: string;
97
- label?: string;
98
- id?: string;
99
- disabled?: boolean;
100
- error?: string;
101
- helperText?: string | React.ReactNode;
102
- sx?: SxProps<Theme>;
103
- dropZoneSxProps?: SxProps<Theme>;
104
- uploading?: boolean;
105
- tabIndex?: number;
106
- maxSize?: number;
107
- }
108
- interface SingleImageUploadProps extends SingleFileUploadProps {
109
- aspectRatio?: number;
110
- enableCrop?: boolean;
111
- convertToWebp?: boolean;
112
- cropSize?: CropSize;
113
- maxWidth?: number;
114
- maxHeight?: number;
115
- compressionQuality?: number;
116
- maxCompressedWidth?: number;
117
- maxCompressedHeight?: number;
118
- }
119
- interface MultiFileUploadProps extends Omit<SingleFileUploadProps, 'filesDetails' | 'onFileSelect'> {
120
- onFilesSelect?: (files: ExtendFile[]) => void;
121
- onRemoveAll?: (files?: ExtendFile[]) => void;
122
- onReorder?: (oldIndex: number, newIndex: number, files: ExtendFile[]) => void;
123
- filesDetails?: FileDetails[];
124
- maxFiles?: number;
125
- thumbnail?: boolean;
126
- }
127
- interface MultiImageUploadProps extends MultiFileUploadProps {
128
- aspectRatio?: number;
129
- enableCrop?: boolean;
130
- convertToWebp?: boolean;
131
- cropSize?: CropSize;
132
- maxWidth?: number;
133
- maxHeight?: number;
134
- compressionQuality?: number;
135
- maxCompressedWidth?: number;
136
- maxCompressedHeight?: number;
137
- }
138
- interface SortableItemProps extends StackProps {
139
- onRemove?: (file?: ExtendFile) => void;
140
- file: ExtendFile;
141
- thumbnail?: boolean;
142
- disableDrag?: boolean;
143
- }
144
- interface MultiFilePreviewProps extends StackProps {
145
- onReorder?: (oldIndex: number, newIndex: number, files: ExtendFile[]) => void;
146
- onRemove?: (file?: ExtendFile) => void;
147
- files: ExtendFile[];
148
- lastNode?: React.ReactNode;
149
- firstNode?: React.ReactNode;
150
- thumbnail: boolean;
151
- slotProps?: {
152
- thumbnail?: Omit<FileThumbnailProps, 'file'>;
153
- };
154
- }
155
- interface StyledDropZoneProps extends StackProps {
156
- isDragActive: boolean;
157
- isError: boolean;
158
- disabled: boolean;
159
- }
160
- type StyledDropZonePropsType = Omit<DropzoneRootProps, 'children' | 'onDrop' | 'onError'> & StyledDropZoneProps;
161
- interface RejectionFilesProps extends StackProps {
162
- files: FileRejection[];
163
- }
164
- interface ThumbnailBadgeProps {
165
- onRemove?: (file?: ExtendFile) => void;
166
- file: ExtendFile;
167
- attributes: DraggableAttributes;
168
- listeners: DraggableSyntheticListeners;
169
- innerWidth: number;
170
- isDragging: boolean;
171
- disableDrag?: boolean;
172
- sx?: SxProps<Theme>;
173
- }
174
- interface DropZoneProps {
175
- sx?: SxProps;
176
- uploading?: boolean;
177
- id?: string;
178
- tabIndex?: number;
179
- getRootProps: () => DropzoneRootProps;
180
- getInputProps: () => DropzoneInputProps;
181
- isDragActive: boolean;
182
- isError: boolean;
183
- disabled?: boolean;
184
- dropZoneSxProps?: SxProps<Theme>;
185
- dropZoneContent?: React.ReactNode;
186
- children?: React.ReactNode;
187
- name?: string;
188
- }
189
- interface HelperTextProps {
190
- helperText?: string | React.ReactNode;
191
- disabled?: boolean;
192
- isError?: boolean;
193
- }
194
- interface UseDropzoneUploaderProps {
195
- onReorder?: (oldIndex: number, newIndex: number, files: ExtendFile[]) => void;
196
- onFileSelect?: (file: ExtendFile) => void;
197
- onFilesSelect?: (files: ExtendFile[]) => void;
198
- onRemove?: (file?: ExtendFile) => void;
199
- uploadFiles: (files: File[]) => Promise<ExtendFile[] | undefined>;
200
- filesPreview?: ExtendFile[];
201
- dropzoneOptions?: Omit<DropzoneOptions, 'onDrop' | 'onDropRejected'>;
202
- enableCrop?: boolean;
203
- customAspectRatio?: number;
204
- convertToWebp?: boolean;
205
- maxFiles?: number;
206
- cropSize?: {
207
- width: number;
208
- height: number;
209
- } | number;
210
- compressionQuality?: number;
211
- maxCompressedWidth?: number;
212
- maxCompressedHeight?: number;
213
- }
214
- interface UseDropzoneUploaderReturn {
215
- file: ExtendFile | null;
216
- files: ExtendFile[];
217
- aspectRatio: number;
218
- dropzoneProps: {
219
- getRootProps: ReturnType<typeof useDropzone>['getRootProps'];
220
- getInputProps: ReturnType<typeof useDropzone>['getInputProps'];
221
- isDragActive: boolean;
222
- isDragReject: boolean;
223
- fileRejections: readonly FileRejection[];
224
- };
225
- cropState: {
226
- cropModalOpen: boolean;
227
- imagePreview: string;
228
- cropLoading: boolean;
229
- setCropModalOpen: React.Dispatch<React.SetStateAction<boolean>>;
230
- onCropInitialized: (croppedArea: Area, croppedAreaPixels: Area) => void;
231
- handleCropSave: () => Promise<void>;
232
- handleCropCancel: () => void;
233
- currentImageIndex: number;
234
- totalPendingImages: number;
235
- };
236
- setInitialFiles?: (files: ExtendFile[]) => void;
237
- handleRemove: (fileToRemove?: ExtendFile) => void;
238
- handleReorder: (oldIndex: number, newIndex: number, files: ExtendFile[]) => void;
239
- }
240
- declare enum ContentType {
241
- APPLICATION_OCTET_STREAM = "application/octet-stream",
242
- IMAGE_JPEG = "image/jpeg",
243
- IMAGE_JPG = "image/jpg",
244
- IMAGE_PNG = "image/png",
245
- IMAGE_GIF = "image/gif",
246
- IMAGE_WEBP = "image/webp",
247
- IMAGE_SVG = "image/svg+xml",
248
- IMAGE_BMP = "image/bmp",
249
- IMAGE_TIFF = "image/tiff",
250
- IMAGE_ICO = "image/x-icon",
251
- IMAGE_AVIF = "image/avif",
252
- APPLICATION_PDF = "application/pdf",
253
- TEXT_PLAIN = "text/plain",
254
- TEXT_CSV = "text/csv",
255
- APPLICATION_RTF = "application/rtf",
256
- APPLICATION_MSWORD = "application/msword",
257
- APPLICATION_DOCX = "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
258
- APPLICATION_MSEXCEL = "application/vnd.ms-excel",
259
- APPLICATION_XLSX = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
260
- APPLICATION_MSPOWERPOINT = "application/vnd.ms-powerpoint",
261
- APPLICATION_PPTX = "application/vnd.openxmlformats-officedocument.presentationml.presentation",
262
- APPLICATION_ODT = "application/vnd.oasis.opendocument.text",
263
- APPLICATION_ODS = "application/vnd.oasis.opendocument.spreadsheet",
264
- APPLICATION_ODP = "application/vnd.oasis.opendocument.presentation",
265
- APPLICATION_XML = "application/xml",
266
- TEXT_XML = "text/xml",
267
- TEXT_HTML = "text/html",
268
- TEXT_CSS = "text/css",
269
- APPLICATION_JSON = "application/json",
270
- TEXT_JAVASCRIPT = "text/javascript",
271
- APPLICATION_ZIP = "application/zip",
272
- APPLICATION_GZIP = "application/gzip",
273
- APPLICATION_RAR = "application/vnd.rar",
274
- APPLICATION_7Z = "application/x-7z-compressed",
275
- AUDIO_MPEG = "audio/mpeg",
276
- AUDIO_WAV = "audio/wav",
277
- AUDIO_OGG = "audio/ogg",
278
- AUDIO_WEBM = "audio/webm",
279
- AUDIO_AAC = "audio/aac",
280
- VIDEO_MP4 = "video/mp4",
281
- VIDEO_MPEG = "video/mpeg",
282
- VIDEO_OGG = "video/ogg",
283
- VIDEO_WEBM = "video/webm",
284
- VIDEO_QUICKTIME = "video/quicktime"
285
- }
286
- declare enum FileContentType {
287
- 'application/octet-stream' = "APPLICATION_OCTET_STREAM",
288
- 'image/jpeg' = "IMAGE_JPEG",
289
- 'image/jpg' = "IMAGE_JPG",
290
- 'image/png' = "IMAGE_PNG",
291
- 'image/gif' = "IMAGE_GIF",
292
- 'image/webp' = "IMAGE_WEBP",
293
- 'image/svg+xml' = "IMAGE_SVG",
294
- 'image/bmp' = "IMAGE_BMP",
295
- 'image/tiff' = "IMAGE_TIFF",
296
- 'image/x-icon' = "IMAGE_ICO",
297
- 'image/avif' = "IMAGE_AVIF",
298
- 'application/pdf' = "APPLICATION_PDF",
299
- 'text/plain' = "TEXT_PLAIN",
300
- 'text/csv' = "TEXT_CSV",
301
- 'application/rtf' = "APPLICATION_RTF",
302
- 'application/msword' = "APPLICATION_MSWORD",
303
- 'application/vnd.openxmlformats-officedocument.wordprocessingml.document' = "APPLICATION_DOCX",
304
- 'application/vnd.ms-excel' = "APPLICATION_MSEXCEL",
305
- 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' = "APPLICATION_XLSX",
306
- 'application/vnd.ms-powerpoint' = "APPLICATION_MSPOWERPOINT",
307
- 'application/vnd.openxmlformats-officedocument.presentationml.presentation' = "APPLICATION_PPTX",
308
- 'application/vnd.oasis.opendocument.text' = "APPLICATION_ODT",
309
- 'application/vnd.oasis.opendocument.spreadsheet' = "APPLICATION_ODS",
310
- 'application/vnd.oasis.opendocument.presentation' = "APPLICATION_ODP",
311
- 'application/xml' = "APPLICATION_XML",
312
- 'text/xml' = "TEXT_XML",
313
- 'text/html' = "TEXT_HTML",
314
- 'text/css' = "TEXT_CSS",
315
- 'application/json' = "APPLICATION_JSON",
316
- 'text/javascript' = "TEXT_JAVASCRIPT",
317
- 'application/zip' = "APPLICATION_ZIP",
318
- 'application/gzip' = "APPLICATION_GZIP",
319
- 'application/vnd.rar' = "APPLICATION_RAR",
320
- 'application/x-7z-compressed' = "APPLICATION_7Z",
321
- 'audio/mpeg' = "AUDIO_MPEG",
322
- 'audio/wav' = "AUDIO_WAV",
323
- 'audio/ogg' = "AUDIO_OGG",
324
- 'audio/webm' = "AUDIO_WEBM",
325
- 'audio/aac' = "AUDIO_AAC",
326
- 'video/mp4' = "VIDEO_MP4",
327
- 'video/mpeg' = "VIDEO_MPEG",
328
- 'video/ogg' = "VIDEO_OGG",
329
- 'video/webm' = "VIDEO_WEBM",
330
- 'video/quicktime' = "VIDEO_QUICKTIME"
331
- }
3
+ import { H as HelperTextProps, M as MultiFilePreviewProps, S as SingleFilePreviewProps, F as FileThumbnailProps, U as UseDropzoneUploaderProps, a as UseDropzoneUploaderReturn, b as MultiFileUploadProps, c as MultiImageUploadProps, d as SingleFileUploadProps, e as SingleImageUploadProps } from '../../useFileUploadService-1a2d0cf5.js';
4
+ export { C as ContentType, j as CreateFilesMutation, i as CropSize, D as DropZoneProps, E as ExtendFile, f as FileContentType, k as FileCreateRequest, m as FileCreateResponse, g as FileDetails, l as FileGetResponse, n as FileQueryRequest, o as FileQueryResponse, h as FileUpload, p as FileUploadProps, L as LoadingPreviewImageProps, P as PlaceholderProps, R as RejectionFilesProps, q as SortableItemProps, r as StyledDropZoneProps, s as StyledDropZonePropsType, T as ThumbnailBadgeProps, u as useFileUploadService } from '../../useFileUploadService-1a2d0cf5.js';
5
+ import 'react-dropzone';
6
+ import 'react-easy-crop';
7
+ import '@dnd-kit/core';
8
+ import '@mui/material/Stack';
9
+ import '@mui/material/styles';
332
10
 
333
11
  declare const _default$8: react.MemoExoticComponent<({ helperText, disabled, isError }: HelperTextProps) => react_jsx_runtime.JSX.Element | null>;
334
12
 
@@ -336,21 +14,6 @@ declare const _default$7: react.MemoExoticComponent<({ thumbnail, files, onRemov
336
14
 
337
15
  declare const _default$6: react.MemoExoticComponent<({ file, aspectRatio, isUploading, isLoading, onLoading, cropSize, maxWidth, maxHeight, }: SingleFilePreviewProps) => react_jsx_runtime.JSX.Element | null>;
338
16
 
339
- type FileThumbnailProps = StackProps & {
340
- tooltip?: boolean;
341
- file: ExtendFile;
342
- imageView?: boolean;
343
- sx?: SxProps<Theme>;
344
- onDownload?: () => void;
345
- onRemove?: () => void;
346
- slotProps?: {
347
- img?: SxProps<Theme>;
348
- icon?: SxProps<Theme>;
349
- removeBtn?: SxProps<Theme>;
350
- downloadBtn?: SxProps<Theme>;
351
- };
352
- };
353
-
354
17
  declare const fileThumbnailClasses: {
355
18
  root: string;
356
19
  img: string;
@@ -367,17 +30,6 @@ declare function fileNameByUrl(fileUrl: string): string | undefined;
367
30
 
368
31
  declare const useDropzoneUploader: ({ onFilesSelect, onFileSelect, onReorder, onRemove, uploadFiles, filesPreview, dropzoneOptions, enableCrop, customAspectRatio, convertToWebp, cropSize, maxFiles, compressionQuality, maxCompressedWidth, maxCompressedHeight, }: UseDropzoneUploaderProps) => UseDropzoneUploaderReturn;
369
32
 
370
- declare const useFileUploadService: ({ createFilesMutation, filesDetails, }: FileUploadProps) => {
371
- setFilesPreview: react.Dispatch<react.SetStateAction<ExtendFile[]>>;
372
- uploadFiles: (files: File[]) => Promise<ExtendFile[] | undefined>;
373
- filesPreview: ExtendFile[];
374
- filePreview: ExtendFile;
375
- isLoadingPreview: boolean;
376
- isUploadingFiles: boolean;
377
- isUploadOrLoadingFiles: boolean;
378
- uploadErrorText: string;
379
- };
380
-
381
33
  declare const _default$5: react.MemoExoticComponent<({ onRemove, onReorder, onFilesSelect, createFilesMutation, filesDetails, id, disabled, error, helperText, thumbnail, dropZoneSxProps, uploading, tabIndex, maxFiles, placeholderAlt, placeholderProps, ...other }: MultiFileUploadProps) => react_jsx_runtime.JSX.Element>;
382
34
 
383
35
  declare const _default$4: react.MemoExoticComponent<({ onRemove, onReorder, onFilesSelect, createFilesMutation, filesDetails, id, disabled, error, helperText, dropZoneSxProps, placeholderProps, placeholderAlt, uploading, tabIndex, maxFiles, aspectRatio: customAspectRatio, enableCrop, convertToWebp, cropSize, name, label: customLabel, ...other }: MultiImageUploadProps) => react_jsx_runtime.JSX.Element>;
@@ -396,4 +48,4 @@ declare const compressImageWithoutCrop: (file: File, quality?: number, maxWidth?
396
48
  declare const getFileNameFromContentDisposition: (contentDisposition: string) => string;
397
49
  declare const encodeFilenameForHeader: (filename: string) => string;
398
50
 
399
- export { ContentType, CreateFilesMutation, CropSize, DropZoneProps, ExtendFile, FileContentType, FileCreateRequest, FileCreateResponse, FileDetails, FileGetResponse, FileQueryRequest, FileQueryResponse, FileThumbnail, FileThumbnailProps, FileUpload, FileUploadProps, _default$8 as HelperText, HelperTextProps, LoadingPreviewImageProps, _default$7 as MultiFilePreview, MultiFilePreviewProps, MultiFileUploadProps, MultiImageUploadProps, _default$5 as MultipleFileUpload, _default$4 as MultipleImageUpload, PlaceholderProps, RejectionFilesProps, _default$6 as SingleFilePreview, SingleFilePreviewProps, _default$3 as SingleFileUpload, SingleFileUploadProps, _default$2 as SingleImageUpload, SingleImageUploadProps, SortableItemProps, StyledDropZoneProps, StyledDropZonePropsType, ThumbnailBadgeProps, _default$1 as UploadAvatar, _default as UploadSimpleBox, UseDropzoneUploaderProps, UseDropzoneUploaderReturn, compressImageWithoutCrop, convertToWebP, encodeFilenameForHeader, fileFormat, fileNameByUrl, fileThumb, fileThumbnailClasses, fileTypeByUrl, getFileNameFromContentDisposition, isImageFile, useDropzoneUploader, useFileUploadService };
51
+ export { FileThumbnail, FileThumbnailProps, _default$8 as HelperText, HelperTextProps, _default$7 as MultiFilePreview, MultiFilePreviewProps, MultiFileUploadProps, MultiImageUploadProps, _default$5 as MultipleFileUpload, _default$4 as MultipleImageUpload, _default$6 as SingleFilePreview, SingleFilePreviewProps, _default$3 as SingleFileUpload, SingleFileUploadProps, _default$2 as SingleImageUpload, SingleImageUploadProps, _default$1 as UploadAvatar, _default as UploadSimpleBox, UseDropzoneUploaderProps, UseDropzoneUploaderReturn, compressImageWithoutCrop, convertToWebP, encodeFilenameForHeader, fileFormat, fileNameByUrl, fileThumb, fileThumbnailClasses, fileTypeByUrl, getFileNameFromContentDisposition, isImageFile, useDropzoneUploader };