@zydon/common 2.5.17 → 2.5.19

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.
@@ -1,4 +1,4 @@
1
- import { a as a$1 } from './chunk-7TFD7ZIP.js';
1
+ import { a as a$1 } from './chunk-7AZX7L27.js';
2
2
  import { a } from './chunk-5NOG7L7I.js';
3
3
  import { b } from './chunk-ILHUUK4X.js';
4
4
  import P from '@mui/lab/LoadingButton';
@@ -0,0 +1,9 @@
1
+ import { useRef, useState, useEffect, useMemo } from 'react';
2
+ import P from 'react-easy-crop';
3
+ import x from '@mui/material/Stack';
4
+ import { styled, alpha } from '@mui/material/styles';
5
+ import { jsx } from 'react/jsx-runtime';
6
+
7
+ var c=styled(x)(({theme:n})=>({"& .reactEasyCrop_Container":{position:"relative"},"& .reactEasyCrop_CropArea":{border:`2px solid ${n.palette.primary.main}`,borderColor:alpha(n.palette.primary.main,.75)},"& .reactEasyCrop_CropAreaRound":{border:`2px solid ${n.palette.primary.main}`,borderColor:alpha(n.palette.primary.main,.75)}}));var R=({onInitialized:n,aspectRatio:i=1,imageSrc:C="",zoom:f=1,crop:h,cropShape:u="rect",cropSize:o,rotation:y=0,onZoomChange:a,onCropChange:b,onRotationChange:g})=>{let w=e=>{if(e>4){a(4);return}if(e<.1){a(.1);return}a(e);},s=useRef(null),[r,E]=useState(550);useEffect(()=>{let e=()=>{let t=s.current?.clientWidth||550;E(Math.min(t,550));};return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]);let v=useMemo(()=>{let e=typeof o=="number"?o:o?.width,t=typeof o=="number"?o:o?.height;if(e=e||r,t=t||r,e<=r&&t<=r)return {width:e,height:t};let p=i,m=p>1;return e=m?r:r*p,t=m?r/p:r,{width:e,height:t}},[i,r,o]);return jsx(c,{ref:s,children:jsx(P,{image:C,crop:h,zoom:f,aspect:i,onCropChange:b,onZoomChange:w,onCropComplete:n,restrictPosition:!1,cropSize:v,cropShape:u,zoomWithScroll:!1,objectFit:"contain",minZoom:.1,maxZoom:4,style:{containerStyle:{width:r,height:r,position:"relative"}},rotation:y,onRotationChange:g})})},D=R;
8
+
9
+ export { D as a };
@@ -0,0 +1,6 @@
1
+ import { useCallback } from 'react';
2
+ import { toast } from 'sonner';
3
+
4
+ var c=(s,t)=>{try{return "message"in s?s.message||t:"data"in s&&s.data&&typeof s.data=="object"&&"message"in s.data&&typeof s.data.message=="string"?s.data.message:t}catch{return t}},o=()=>{let s=useCallback(a=>{toast.success(a);},[]),t=useCallback((a,i)=>{toast.error(c(a,i));},[]);return {showSuccessMessage:s,showErrorMessage:t}},m=o;
5
+
6
+ export { m as a };
@@ -0,0 +1,34 @@
1
+ import { c, g, p, n, d, e as e$1, a as a$6, b, h, i as i$1, l, m as m$1, j as j$1, k } from './chunk-ISYQXE75.js';
2
+ import { a as a$5 } from './chunk-2E4HVMRH.js';
3
+ import { a as a$1 } from './chunk-H5L4ARDB.js';
4
+ import { e } from './chunk-ANAHA3L6.js';
5
+ import { a as a$7 } from './chunk-JEBRSFLS.js';
6
+ import { x } from './chunk-2P4CXK3O.js';
7
+ import { a as a$4 } from './chunk-FK7DDO5L.js';
8
+ import { i, o } from './chunk-D27ND54J.js';
9
+ import { a as a$2 } from './chunk-X24QANPC.js';
10
+ import { j } from './chunk-DMQW3LDF.js';
11
+ import { a } from './chunk-MAK4JF5M.js';
12
+ import { a as a$3 } from './chunk-KFZEM7KS.js';
13
+ import { useSensors, useSensor, PointerSensor, KeyboardSensor, DndContext, closestCenter } from '@dnd-kit/core';
14
+ import { restrictToHorizontalAxis, restrictToParentElement, restrictToWindowEdges } from '@dnd-kit/modifiers';
15
+ import { sortableKeyboardCoordinates, SortableContext, horizontalListSortingStrategy, useSortable } from '@dnd-kit/sortable';
16
+ import { AnimatePresence, m } from 'framer-motion';
17
+ import Ho from '@mui/material/ButtonBase';
18
+ import Go from '@mui/material/IconButton';
19
+ import { styled, alpha, useTheme } from '@mui/material/styles';
20
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
21
+ import No from '@mui/material/Box';
22
+ import G from '@mui/material/Stack';
23
+ import Qo from '@mui/material/Tooltip';
24
+ import to from '@mui/material/Typography';
25
+ import Yo from '@mui/material/Badge';
26
+ import { useDropzone } from 'react-dropzone';
27
+ import Wo from '@mui/material/Button';
28
+ import _r from '@mui/material/FormHelperText';
29
+ import { memo } from 'react';
30
+ import Er from '@mui/material/Dialog';
31
+
32
+ function To({sx:o$1,...r}){let t=useTheme();return jsx(Ho,{sx:{p:0,top:0,right:0,width:1,height:1,zIndex:9,opacity:0,position:"absolute",color:"common.white",borderRadius:"inherit",transition:t.transitions.create(["opacity"]),"&:hover":{...o({color:i(t.vars.palette.grey["900Channel"],.64)}),opacity:1},...o$1},...r,children:jsx(a,{icon:"ARROW_DOWN_CICLE",width:24})})}function Eo({sx:o,...r}){return jsx(Go,{size:"small",sx:{p:.35,top:4,right:4,position:"absolute",color:"common.white",bgcolor:t=>i(t.vars.palette.grey["900Channel"],.48),"&:hover":{bgcolor:t=>i(t.vars.palette.grey["900Channel"],.72)},...o},...r,children:jsx(a,{icon:"CLOSE_MARK_BUTTON",width:12})})}var A={root:"mnl__file__thumbnail__root",img:"mnl__file__thumbnail__img",icon:"mnl__file__thumbnail__icon",removeBtn:"mnl__file__thumbnail__remove__button",downloadBtn:"mnl__file__thumbnail__download__button"};function F({sx:o,file:r,tooltip:t,onRemove:i,imageView:m,slotProps:e,onDownload:p,...l}){let u=typeof r=="string"?r:URL.createObjectURL(r),{name:d,path:a$1}=c(r),n=a$6(a$1||u),g=jsx(No,{component:"img",src:u,className:A.img,sx:{width:1,height:1,objectFit:"cover",borderRadius:"inherit",...e?.img}}),h=jsx(a,{icon:b(n),sx:{width:32,height:32,flexShrink:0,...o}}),f=jsxs(G,{component:"span",className:A.root,sx:{width:36,height:36,flexShrink:0,borderRadius:1.25,alignItems:"center",position:"relative",display:"inline-flex",justifyContent:"center",...o},...l,children:[n==="image"&&m?g:h,i&&jsx(Eo,{onClick:i,className:A.removeBtn,sx:e?.removeBtn}),p&&jsx(To,{onClick:p,className:A.downloadBtn,sx:e?.downloadBtn})]});return t?jsx(Qo,{arrow:!0,title:d,slotProps:{popper:{modifiers:[{name:"offset",options:{offset:[0,-12]}}]}},children:f}):f}var or=({onRemove:o,onHandleMainImage:r,key:t,sx:i,file:m,disableDrag:e,attributes:p,listeners:l,mainUrl:u,innerWidth:d,isDragging:a$1})=>{let n=m===u;return jsx(Yo,{anchorOrigin:{vertical:"top",horizontal:"left"},badgeContent:r&&jsx(m$1,{isMainImage:n,size:"small",onClick:()=>r(m),"aria-label":n?"Remover imagem principal":"Definir como imagem principal",children:jsx(a,{icon:n?"STAR_02":"STAR",width:12})}),children:jsxs(j$1,{width:d,isDragging:a$1,"data-testid":`preview-multi-img-${t}`,...j().inUp,sx:i,children:[jsx(a$7,{disableDrag:e,...p,...l}),jsx(F,{imageView:!0,file:m,sx:{position:"absolute",right:10,top:10}}),o&&jsx(k,{size:"small","aria-label":"Remover imagem",onClick:()=>o(m),children:jsx(a,{icon:"DELETE_MARK_BUTTON_02",width:16})})]})},`badge-${t}`)},Fo=or;var ir=({file:o,thumbnail:r,onRemove:t,onHandleMainImage:i,mainUrl:m,sx:e$1,disableDrag:p=!1})=>{let{key:l$1,name:u="",size:d=0}=c(o),a$1=typeof o=="string",n=p?60:80,{attributes:g,listeners:h$1,setNodeRef:f,transform:b,transition:v,isDragging:R}=useSortable({id:l$1,disabled:p}),S={transform:x.Transform.toString(b),transition:v,display:"inline-block",alignItems:"center",justifyContent:"center",width:`${n+8}px`,height:"68px"};return r?jsx(h,{ref:f,style:S,children:jsx(Fo,{innerWidth:n,isDragging:R,sx:e$1,file:o,disableDrag:p,attributes:g,listeners:h$1,mainUrl:m,onRemove:t,onHandleMainImage:i},l$1)}):jsx(h,{ref:f,style:{...S,height:"80px",width:`${n+38}px`},children:jsxs(i$1,{width:n+30,isDragging:R,"data-testid":`preview-multi-img-${l$1}`,...j().inUp,sx:e$1,children:[jsx(a$7,{disableDrag:p,...g,...h$1}),jsx(F,{file:o}),jsxs(G,{flexGrow:1,sx:{minWidth:0,width:"100%"},children:[jsx(to,{variant:"subtitle2",noWrap:!0,children:a$1?o:u}),jsx(to,{variant:"caption",sx:{color:"text.secondary"},children:a$1?"":e(d)})]}),t&&jsx(l,{size:"small","aria-label":"Remover arquivo",onClick:()=>t(o),children:jsx(a,{icon:"DELETE_MARK_BUTTON_02",width:16})})]})})},Ao=ir;var ro=({thumbnail:o,files:r,onRemove:t,onReorder:i,onHandleMainImage:m,mainUrl:e,sx:p})=>{let l=useSensors(useSensor(PointerSensor,{activationConstraint:{distance:8}}),useSensor(KeyboardSensor,{coordinateGetter:sortableKeyboardCoordinates}));if(!r?.length)return null;let u=a=>{let{active:n,over:g}=a;if(!(!n||!g||n.id===g.id)&&i){let h=r.findIndex(b=>{let{key:v}=c(b);return v===n.id}),f=r.findIndex(b=>{let{key:v}=c(b);return v===g.id});h!==-1&&f!==-1&&i(h,f);}},d=jsx(AnimatePresence,{initial:!1,children:r.map(a=>jsx(Ao,{file:a,thumbnail:o,onRemove:t,onHandleMainImage:m,mainUrl:e,sx:p,disableDrag:!i},c(a).key))});return i?jsx(DndContext,{sensors:l,collisionDetection:closestCenter,onDragEnd:u,modifiers:[restrictToHorizontalAxis,restrictToParentElement,restrictToWindowEdges],children:jsx(SortableContext,{items:r.map(a=>c(a).key),strategy:horizontalListSortingStrategy,children:d})}):d};function Lo({file:o}){let r=typeof o=="string"?o:o.name,t=typeof o=="string"?o:URL.createObjectURL(o);return jsx(No,{sx:{p:1,top:0,left:0,width:1,height:1,position:"absolute"},children:jsx(No,{component:"img",alt:r,src:t,sx:{width:1,height:1,borderRadius:1,objectFit:"cover"}})})}function Et({sx:o,...r}){return jsx(Go,{size:"small",sx:{top:16,right:16,zIndex:9,position:"absolute",color:t=>i(t.vars.palette.common.whiteChannel,.8),bgcolor:t=>i(t.vars.palette.grey["900Channel"],.72),"&:hover":{bgcolor:t=>i(t.vars.palette.grey["900Channel"],.48)},...o},...r,"aria-label":"Remover arquivo",children:jsx(a,{icon:"DELETE_MARK_BUTTON_02",width:18})})}var xr=({header:o,description:r,sx:t,...i})=>jsxs(G,{spacing:5,alignItems:"center",justifyContent:"center",direction:{xs:"column",md:"row"},sx:{width:1,textAlign:{xs:"center",md:"left"},...t},...i,children:[jsx(a$1,{sx:{width:220}}),jsxs("div",{children:[jsx(to,{gutterBottom:!0,variant:"h5",children:o||"Soltar ou selecionar arquivos"}),jsx(to,{variant:"body2",sx:{color:"text.secondary"},children:r||jsxs(Fragment,{children:["Solte os arquivos aqui ou clique",jsx(to,{variant:"body2",component:"span",sx:{mx:.5,color:"primary.main",textDecoration:"underline"},children:"procurar"}),"na sua m\xE1quina"]})})]})]}),io=memo(xr);var Mo=styled(No,{shouldForwardProp:o=>!["isDragActive","isError","disabled"].includes(o)})(({theme:o,isDragActive:r,isError:t,disabled:i})=>({outline:"none",cursor:"pointer",overflow:"hidden",position:"relative",padding:o.spacing(5),borderRadius:o.shape.borderRadius,transition:o.transitions.create("padding"),backgroundColor:o.palette.background.neutral,border:`1px dashed ${alpha(o.palette.grey[500],.32)}`,...r&&{opacity:.72},...t&&{color:o.palette.error.main,backgroundColor:o.palette.error.lighter,borderColor:o.palette.error.light},...i&&{opacity:.48,pointerEvents:"none"},"&:hover":{opacity:.72}}));var Rr=({sx:o,id:r,tabIndex:t,uploading:i,getRootProps:m,getInputProps:e,isDragActive:p,isError:l,disabled:u,dropZoneSxProps:d$1,dropZoneContent:a,children:n,...g})=>jsxs(d,{children:[i&&jsx(a$4,{"data-testid":"uploading-progress-bar"}),jsxs(No,{sx:{width:1,position:"relative",...o},children:[jsxs(Mo,{...m(),"data-testid":"drop-zone-styled-area",isError:l,isDragActive:p,disabled:!!u,sx:d$1,...g,children:[jsx("input",{...e(),id:r,tabIndex:t}),a]}),n]})]}),ao=Rr;var Tr=({id:o,disabled:r,multiple:t=!1,error:i,helperText:m$1,file:e$1,onDelete:p$1,files:l,thumbnail:u,onRemove:d,onHandleMainImage:a$1,mainUrl:n$1,sx:g$1,dropZoneProps:h,placeholderProps:f,placeholderAlt:b,uploading:v,image:R,tabIndex:S,preview:V="image",onRemoveAll:N,onUpload:w,onReorder:L,...J})=>{let{getRootProps:M,getInputProps:B,isDragActive:P,isDragReject:k,fileRejections:po}=useDropzone({multiple:t,disabled:r,...J}),Q=!!e$1&&!t,X=Q||R,mo=l&&t&&l.length>0,lo=typeof e$1=="string",co=k||!!i;if(V==="file")return jsxs(ao,{id:o,uploading:v,disabled:r,dropZoneSxProps:h,tabIndex:S,getRootProps:M,getInputProps:B,isDragActive:P,isError:co,dropZoneContent:jsxs(Fragment,{children:[!Q&&jsx(io,{}),Q&&jsxs(G,{component:m.div,...j().inUp,spacing:2,direction:"row",alignItems:"center",sx:{my:1,px:1,py:.75,borderRadius:.75,border:U=>`solid 1px ${U.palette.divider}`,...g$1},children:[jsx(F,{file:e$1}),jsxs(G,{flexGrow:1,sx:{minWidth:0},children:[jsx(to,{variant:"subtitle2",noWrap:!0,children:lo?e$1:e$1.name}),jsx(to,{variant:"caption",sx:{color:"text.secondary"},children:lo?"":e(e$1.size)})]}),p$1&&jsx(g,{edge:"end",size:"small",disabled:r,"aria-label":"Remover arquivo",onClick:U=>{U.stopPropagation(),p$1();},children:jsx(a,{icon:"DELETE_MARK_BUTTON_02",width:16})})]})]}),children:[m$1&&m$1,jsx(p,{files:po}),mo&&jsxs(Fragment,{children:[jsx(No,{sx:{my:3},children:jsx(ro,{files:l,thumbnail:u,onRemove:d,onHandleMainImage:a$1,mainUrl:n$1,onReorder:L})}),jsxs(G,{direction:"row",justifyContent:"flex-end",spacing:1.5,children:[N&&jsx(Wo,{color:"inherit",variant:"outlined",size:"small",onClick:N,children:"Remover todos"}),w&&jsx(Wo,{size:"small",variant:"contained",onClick:w,children:"Enviar arquivos"})]})]})]});let go=X?{opacity:0}:void 0;return jsxs(ao,{id:o,uploading:v,disabled:r,dropZoneSxProps:h,tabIndex:S,getRootProps:M,getInputProps:B,isDragActive:P,isError:co,dropZoneContent:jsxs(Fragment,{children:[b?jsx(G,{sx:go,children:b}):jsx(io,{sx:go,header:f?.title,description:f?.description}),X&&jsx(Lo,{file:e$1||R||""})]}),children:[m$1&&jsx(_r,{error:!!i,sx:U=>({mx:"14px",color:r?U.palette.grey[500]:void 0}),children:m$1}),jsx(p,{files:po}),X&&p$1&&jsx(n,{size:"small",onClick:p$1,disabled:r,"aria-label":"Remover arquivo",children:jsx(a,{icon:"DELETE_MARK_BUTTON_02",width:16})}),mo&&jsx(Fragment,{children:jsx(No,{sx:{my:3,ml:.5},children:jsx(ro,{files:l,thumbnail:u,onRemove:d,onHandleMainImage:a$1,mainUrl:n$1,onReorder:L})})})]})},Ko=Tr;var Fr=({onFileCropped:o,onImageUploaded:r,onCancel:t,aspect:i,label:m,image:e$2="",uploading:p,file:l,tabIndex:u,maxSize:d$1,onDropRejected:a$1,...n})=>{let{id:g,setCropModalOpen:h,handleRemove:f,toggleCropModalOpen:b,cropModalOpen:v,cancelChanges:R,saveChanges:S,previewImage:V,setCropper:N,preview:w,closePreviewImage:L,saving:J}=a$2({onFileCropped:o,onImageUploaded:r,onCancel:t}),{error:M}=a$3();return jsxs(Fragment,{children:[jsxs(d,{children:[p&&jsx(a$4,{}),jsx(Ko,{...n,maxSize:d$1,id:g,file:l,onDrop:B=>{if(B.length>0){h(!0);let P=new FileReader;P.addEventListener("load",()=>{let k=P.result?.toString()||"";r(k),o(void 0);}),P.readAsDataURL(B[0]);}},image:e$2,tabIndex:u,onDropRejected:(B,P)=>{let k=B[0]?.errors[0]?.code;r(void 0),o(void 0),M(k==="file-too-large"?`Imagem n\xE3o pode ser maior que ${e(d$1)}`:"Erro ao enviar imagem"),a$1&&a$1(B,P);}}),(l||e$2)&&jsxs(e$1,{className:"actions",children:[jsx(Wo,{color:"inherit",startIcon:jsx(a,{icon:"DELETE_MARK_BUTTON_02",color:"error.main"}),onClick:f,children:"Remover"}),jsx(Wo,{color:"inherit",startIcon:jsx(a,{icon:"SEARCH_IMAGE",color:"primary.maon"}),onClick:b,children:"Editar"})]})]}),jsx(a$5,{id:g,open:v,onClose:R,label:m,aspectRatio:i,imageSrc:e$2,onRemove:f,onSave:S,onPreview:V,onInitialized:N,loading:J}),jsx(Er,{open:!!w,onClose:L,scroll:"body",PaperProps:{sx:{p:2}},children:w&&jsx("img",{src:w,alt:"Preview"})})]})},Se=Fr;
33
+
34
+ export { ro as a, Lo as b, Et as c, Ko as d, Se as e };
@@ -1 +1 @@
1
- export { a as default } from '../../chunk-7TFD7ZIP.js';
1
+ export { a as default } from '../../chunk-7AZX7L27.js';
@@ -1,5 +1,5 @@
1
- export { a as default } from '../../chunk-COTMNI3C.js';
2
- import '../../chunk-7TFD7ZIP.js';
1
+ export { a as default } from '../../chunk-4GES2XPG.js';
2
+ import '../../chunk-7AZX7L27.js';
3
3
  import '../../chunk-5NOG7L7I.js';
4
4
  import '../../chunk-MAK4JF5M.js';
5
5
  import '../../chunk-FUB7WQS5.js';
@@ -1,12 +1,325 @@
1
1
  import * as react from 'react';
2
2
  import * as react_jsx_runtime from 'react/jsx-runtime';
3
- import { H as HelperTextProps, M as MultiFilePreviewProps, S as SingleFilePreviewProps, U as UseDropzoneUploaderProps, a as UseDropzoneUploaderReturn, b as FileUploadProps, E as ExtendFile, c as MultiFileUploadProps, d as MultiImageUploadProps, e as SingleFileUploadProps, f as SingleImageUploadProps } from '../../types-ba102ece.js';
4
- export { C as ContentType, j as CreateFilesMutation, i as CropSize, D as DropZoneProps, g as FileContentType, k as FileCreateRequest, l as FileCreateResponse, o as FileGetResponse, m as FileQueryRequest, n as FileQueryResponse, h as FileUpload, L as LoadingPreviewImageProps, P as PlaceholderProps, R as RejectionFilesProps, p as SortableItemProps, q as StyledDropZoneProps, r as StyledDropZonePropsType, T as ThumbnailBadgeProps } from '../../types-ba102ece.js';
5
- import '@mui/material/Stack';
6
- import '@mui/material/styles';
7
- import 'react-dropzone';
8
- import 'react-easy-crop';
9
- import '@dnd-kit/core';
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
+ }
116
+ interface MultiFileUploadProps extends Omit<SingleFileUploadProps, 'filesDetails' | 'onFileSelect'> {
117
+ onFilesSelect?: (files: ExtendFile[]) => void;
118
+ onRemoveAll?: (files?: ExtendFile[]) => void;
119
+ onReorder?: (oldIndex: number, newIndex: number, files: ExtendFile[]) => void;
120
+ filesDetails?: FileDetails[];
121
+ maxFiles?: number;
122
+ thumbnail?: boolean;
123
+ }
124
+ interface MultiImageUploadProps extends MultiFileUploadProps {
125
+ aspectRatio?: number;
126
+ enableCrop?: boolean;
127
+ convertToWebp?: boolean;
128
+ cropSize?: CropSize;
129
+ maxWidth?: number;
130
+ maxHeight?: number;
131
+ }
132
+ interface SortableItemProps extends StackProps {
133
+ onRemove?: (file?: ExtendFile) => void;
134
+ file: ExtendFile;
135
+ thumbnail?: boolean;
136
+ disableDrag?: boolean;
137
+ }
138
+ interface MultiFilePreviewProps extends StackProps {
139
+ onReorder?: (oldIndex: number, newIndex: number, files: ExtendFile[]) => void;
140
+ onRemove?: (file?: ExtendFile) => void;
141
+ files: ExtendFile[];
142
+ lastNode?: React.ReactNode;
143
+ firstNode?: React.ReactNode;
144
+ thumbnail: boolean;
145
+ slotProps?: {
146
+ thumbnail?: Omit<FileThumbnailProps, 'file'>;
147
+ };
148
+ }
149
+ interface StyledDropZoneProps extends StackProps {
150
+ isDragActive: boolean;
151
+ isError: boolean;
152
+ disabled: boolean;
153
+ }
154
+ type StyledDropZonePropsType = Omit<DropzoneRootProps, 'children' | 'onDrop' | 'onError'> & StyledDropZoneProps;
155
+ interface RejectionFilesProps extends StackProps {
156
+ files: FileRejection[];
157
+ }
158
+ interface ThumbnailBadgeProps {
159
+ onRemove?: (file?: ExtendFile) => void;
160
+ file: ExtendFile;
161
+ attributes: DraggableAttributes;
162
+ listeners: DraggableSyntheticListeners;
163
+ innerWidth: number;
164
+ isDragging: boolean;
165
+ disableDrag?: boolean;
166
+ sx?: SxProps<Theme>;
167
+ }
168
+ interface DropZoneProps {
169
+ sx?: SxProps;
170
+ uploading?: boolean;
171
+ id?: string;
172
+ tabIndex?: number;
173
+ getRootProps: () => DropzoneRootProps;
174
+ getInputProps: () => DropzoneInputProps;
175
+ isDragActive: boolean;
176
+ isError: boolean;
177
+ disabled?: boolean;
178
+ dropZoneSxProps?: SxProps<Theme>;
179
+ dropZoneContent?: React.ReactNode;
180
+ children?: React.ReactNode;
181
+ name?: string;
182
+ }
183
+ interface HelperTextProps {
184
+ helperText?: string | React.ReactNode;
185
+ disabled?: boolean;
186
+ isError?: boolean;
187
+ }
188
+ interface UseDropzoneUploaderProps {
189
+ onReorder?: (oldIndex: number, newIndex: number, files: ExtendFile[]) => void;
190
+ onFileSelect?: (file: ExtendFile) => void;
191
+ onFilesSelect?: (files: ExtendFile[]) => void;
192
+ onRemove?: (file?: ExtendFile) => void;
193
+ uploadFiles: (files: File[]) => Promise<ExtendFile[] | undefined>;
194
+ filesPreview?: ExtendFile[];
195
+ dropzoneOptions?: Omit<DropzoneOptions, 'onDrop' | 'onDropRejected'>;
196
+ enableCrop?: boolean;
197
+ customAspectRatio?: number;
198
+ convertToWebp?: boolean;
199
+ maxFiles?: number;
200
+ cropSize?: {
201
+ width: number;
202
+ height: number;
203
+ } | number;
204
+ }
205
+ interface UseDropzoneUploaderReturn {
206
+ file: ExtendFile | null;
207
+ files: ExtendFile[];
208
+ aspectRatio: number;
209
+ dropzoneProps: {
210
+ getRootProps: ReturnType<typeof useDropzone>['getRootProps'];
211
+ getInputProps: ReturnType<typeof useDropzone>['getInputProps'];
212
+ isDragActive: boolean;
213
+ isDragReject: boolean;
214
+ fileRejections: readonly FileRejection[];
215
+ };
216
+ cropState: {
217
+ cropModalOpen: boolean;
218
+ imagePreview: string;
219
+ cropLoading: boolean;
220
+ setCropModalOpen: React.Dispatch<React.SetStateAction<boolean>>;
221
+ onCropInitialized: (croppedArea: Area, croppedAreaPixels: Area) => void;
222
+ handleCropSave: () => Promise<void>;
223
+ handleCropCancel: () => void;
224
+ currentImageIndex: number;
225
+ totalPendingImages: number;
226
+ };
227
+ setInitialFiles?: (files: ExtendFile[]) => void;
228
+ handleRemove: (fileToRemove?: ExtendFile) => void;
229
+ handleReorder: (oldIndex: number, newIndex: number, files: ExtendFile[]) => void;
230
+ }
231
+ declare enum ContentType {
232
+ APPLICATION_OCTET_STREAM = "application/octet-stream",
233
+ IMAGE_JPEG = "image/jpeg",
234
+ IMAGE_JPG = "image/jpg",
235
+ IMAGE_PNG = "image/png",
236
+ IMAGE_GIF = "image/gif",
237
+ IMAGE_WEBP = "image/webp",
238
+ IMAGE_SVG = "image/svg+xml",
239
+ IMAGE_BMP = "image/bmp",
240
+ IMAGE_TIFF = "image/tiff",
241
+ IMAGE_ICO = "image/x-icon",
242
+ IMAGE_AVIF = "image/avif",
243
+ APPLICATION_PDF = "application/pdf",
244
+ TEXT_PLAIN = "text/plain",
245
+ TEXT_CSV = "text/csv",
246
+ APPLICATION_RTF = "application/rtf",
247
+ APPLICATION_MSWORD = "application/msword",
248
+ APPLICATION_DOCX = "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
249
+ APPLICATION_MSEXCEL = "application/vnd.ms-excel",
250
+ APPLICATION_XLSX = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
251
+ APPLICATION_MSPOWERPOINT = "application/vnd.ms-powerpoint",
252
+ APPLICATION_PPTX = "application/vnd.openxmlformats-officedocument.presentationml.presentation",
253
+ APPLICATION_ODT = "application/vnd.oasis.opendocument.text",
254
+ APPLICATION_ODS = "application/vnd.oasis.opendocument.spreadsheet",
255
+ APPLICATION_ODP = "application/vnd.oasis.opendocument.presentation",
256
+ APPLICATION_XML = "application/xml",
257
+ TEXT_XML = "text/xml",
258
+ TEXT_HTML = "text/html",
259
+ TEXT_CSS = "text/css",
260
+ APPLICATION_JSON = "application/json",
261
+ TEXT_JAVASCRIPT = "text/javascript",
262
+ APPLICATION_ZIP = "application/zip",
263
+ APPLICATION_GZIP = "application/gzip",
264
+ APPLICATION_RAR = "application/vnd.rar",
265
+ APPLICATION_7Z = "application/x-7z-compressed",
266
+ AUDIO_MPEG = "audio/mpeg",
267
+ AUDIO_WAV = "audio/wav",
268
+ AUDIO_OGG = "audio/ogg",
269
+ AUDIO_WEBM = "audio/webm",
270
+ AUDIO_AAC = "audio/aac",
271
+ VIDEO_MP4 = "video/mp4",
272
+ VIDEO_MPEG = "video/mpeg",
273
+ VIDEO_OGG = "video/ogg",
274
+ VIDEO_WEBM = "video/webm",
275
+ VIDEO_QUICKTIME = "video/quicktime"
276
+ }
277
+ declare enum FileContentType {
278
+ 'application/octet-stream' = "APPLICATION_OCTET_STREAM",
279
+ 'image/jpeg' = "IMAGE_JPEG",
280
+ 'image/jpg' = "IMAGE_JPG",
281
+ 'image/png' = "IMAGE_PNG",
282
+ 'image/gif' = "IMAGE_GIF",
283
+ 'image/webp' = "IMAGE_WEBP",
284
+ 'image/svg+xml' = "IMAGE_SVG",
285
+ 'image/bmp' = "IMAGE_BMP",
286
+ 'image/tiff' = "IMAGE_TIFF",
287
+ 'image/x-icon' = "IMAGE_ICO",
288
+ 'image/avif' = "IMAGE_AVIF",
289
+ 'application/pdf' = "APPLICATION_PDF",
290
+ 'text/plain' = "TEXT_PLAIN",
291
+ 'text/csv' = "TEXT_CSV",
292
+ 'application/rtf' = "APPLICATION_RTF",
293
+ 'application/msword' = "APPLICATION_MSWORD",
294
+ 'application/vnd.openxmlformats-officedocument.wordprocessingml.document' = "APPLICATION_DOCX",
295
+ 'application/vnd.ms-excel' = "APPLICATION_MSEXCEL",
296
+ 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' = "APPLICATION_XLSX",
297
+ 'application/vnd.ms-powerpoint' = "APPLICATION_MSPOWERPOINT",
298
+ 'application/vnd.openxmlformats-officedocument.presentationml.presentation' = "APPLICATION_PPTX",
299
+ 'application/vnd.oasis.opendocument.text' = "APPLICATION_ODT",
300
+ 'application/vnd.oasis.opendocument.spreadsheet' = "APPLICATION_ODS",
301
+ 'application/vnd.oasis.opendocument.presentation' = "APPLICATION_ODP",
302
+ 'application/xml' = "APPLICATION_XML",
303
+ 'text/xml' = "TEXT_XML",
304
+ 'text/html' = "TEXT_HTML",
305
+ 'text/css' = "TEXT_CSS",
306
+ 'application/json' = "APPLICATION_JSON",
307
+ 'text/javascript' = "TEXT_JAVASCRIPT",
308
+ 'application/zip' = "APPLICATION_ZIP",
309
+ 'application/gzip' = "APPLICATION_GZIP",
310
+ 'application/vnd.rar' = "APPLICATION_RAR",
311
+ 'application/x-7z-compressed' = "APPLICATION_7Z",
312
+ 'audio/mpeg' = "AUDIO_MPEG",
313
+ 'audio/wav' = "AUDIO_WAV",
314
+ 'audio/ogg' = "AUDIO_OGG",
315
+ 'audio/webm' = "AUDIO_WEBM",
316
+ 'audio/aac' = "AUDIO_AAC",
317
+ 'video/mp4' = "VIDEO_MP4",
318
+ 'video/mpeg' = "VIDEO_MPEG",
319
+ 'video/ogg' = "VIDEO_OGG",
320
+ 'video/webm' = "VIDEO_WEBM",
321
+ 'video/quicktime' = "VIDEO_QUICKTIME"
322
+ }
10
323
 
11
324
  declare const _default$8: react.MemoExoticComponent<({ helperText, disabled, isError }: HelperTextProps) => react_jsx_runtime.JSX.Element | null>;
12
325
 
@@ -14,32 +327,61 @@ declare const _default$7: react.MemoExoticComponent<({ thumbnail, files, onRemov
14
327
 
15
328
  declare const _default$6: react.MemoExoticComponent<({ file, aspectRatio, isUploading, isLoading, onLoading, cropSize, maxWidth, maxHeight, }: SingleFilePreviewProps) => react_jsx_runtime.JSX.Element | null>;
16
329
 
17
- declare const useDropzoneUploader: ({ onFilesSelect, onFileSelect, onReorder, onRemove, filesPreview, dropzoneOptions, enableCrop, customAspectRatio, convertToWebp, cropSize, maxFiles, }: UseDropzoneUploaderProps) => UseDropzoneUploaderReturn;
330
+ type FileThumbnailProps = StackProps & {
331
+ tooltip?: boolean;
332
+ file: ExtendFile;
333
+ imageView?: boolean;
334
+ sx?: SxProps<Theme>;
335
+ onDownload?: () => void;
336
+ onRemove?: () => void;
337
+ slotProps?: {
338
+ img?: SxProps<Theme>;
339
+ icon?: SxProps<Theme>;
340
+ removeBtn?: SxProps<Theme>;
341
+ downloadBtn?: SxProps<Theme>;
342
+ };
343
+ };
18
344
 
19
- declare const useFileUploadService: ({ createFilesMutation, filesUrl, }: FileUploadProps) => {
20
- filesPreview: ExtendFile[] | undefined;
21
- filePreview: ExtendFile | undefined;
22
- uploadFiles: (files: Array<File>, callback?: ((files: ExtendFile[]) => void) | undefined) => Promise<string[] | undefined>;
23
- setFilesPreview: react.Dispatch<react.SetStateAction<ExtendFile[] | undefined>>;
24
- isUploadingFiles: boolean;
345
+ declare const fileThumbnailClasses: {
346
+ root: string;
347
+ img: string;
348
+ icon: string;
349
+ removeBtn: string;
350
+ downloadBtn: string;
351
+ };
352
+ declare const FileThumbnail: ({ sx, file, tooltip, onRemove, imageView, slotProps, onDownload, ...other }: FileThumbnailProps) => react_jsx_runtime.JSX.Element;
353
+
354
+ declare function fileFormat(fileUrl: string): string;
355
+ declare function fileThumb(fileUrl: string): string;
356
+ declare function fileTypeByUrl(fileUrl: string): string;
357
+ declare function fileNameByUrl(fileUrl: string): string | undefined;
358
+
359
+ declare const useDropzoneUploader: ({ onFilesSelect, onFileSelect, onReorder, onRemove, uploadFiles, filesPreview, dropzoneOptions, enableCrop, customAspectRatio, convertToWebp, cropSize, maxFiles, }: UseDropzoneUploaderProps) => UseDropzoneUploaderReturn;
360
+
361
+ declare const useFileUploadService: ({ createFilesMutation, filesDetails, }: FileUploadProps) => {
362
+ setFilesPreview: react.Dispatch<react.SetStateAction<ExtendFile[]>>;
363
+ uploadFiles: (files: File[]) => Promise<ExtendFile[] | undefined>;
364
+ filesPreview: ExtendFile[];
365
+ filePreview: ExtendFile;
25
366
  isLoadingPreview: boolean;
367
+ isUploadingFiles: boolean;
26
368
  isUploadOrLoadingFiles: boolean;
27
- uploadFilesError: unknown;
369
+ uploadErrorText: string;
28
370
  };
29
371
 
30
- declare const _default$5: react.MemoExoticComponent<({ onRemove, onReorder, onFilesSelect, id, disabled, error, helperText, files: filesPreview, thumbnail, dropZoneSxProps, uploading, tabIndex, maxFiles, placeholderAlt, placeholderProps, ...other }: MultiFileUploadProps) => react_jsx_runtime.JSX.Element>;
372
+ 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>;
31
373
 
32
- declare const _default$4: react.MemoExoticComponent<({ onFilesSelect, onRemove, onReorder, id, disabled, error, helperText, files: filesPreview, dropZoneSxProps, placeholderProps, placeholderAlt, uploading, tabIndex, maxFiles, aspectRatio: customAspectRatio, enableCrop, convertToWebp, cropSize, name, label: customLabel, ...other }: MultiImageUploadProps) => react_jsx_runtime.JSX.Element>;
374
+ 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>;
33
375
 
34
- declare const _default$3: react.MemoExoticComponent<({ onFileSelect, onRemove, file: filePreview, id, disabled, error, helperText, sx, dropZoneSxProps, uploading, tabIndex, ...other }: SingleFileUploadProps) => react_jsx_runtime.JSX.Element>;
376
+ declare const _default$3: react.MemoExoticComponent<({ onFileSelect, onRemove, createFilesMutation, fileDetails, id, disabled, error, helperText, sx, dropZoneSxProps, uploading, tabIndex, ...other }: SingleFileUploadProps) => react_jsx_runtime.JSX.Element>;
35
377
 
36
- declare const _default$2: react.MemoExoticComponent<({ onRemove, onFileSelect, file: filePreview, id, disabled, error, helperText, dropZoneSxProps, placeholderProps, placeholderAlt, uploading, tabIndex, aspectRatio: customAspectRatio, enableCrop, convertToWebp, name, label, cropSize, sx, maxWidth, maxHeight, ...other }: SingleImageUploadProps) => react_jsx_runtime.JSX.Element>;
378
+ declare const _default$2: react.MemoExoticComponent<({ onRemove, onFileSelect, createFilesMutation, fileDetails, id, disabled, error, helperText, dropZoneSxProps, placeholderProps, placeholderAlt, uploading, tabIndex, aspectRatio: customAspectRatio, enableCrop, convertToWebp, name, label, cropSize, sx, maxWidth, maxHeight, ...other }: SingleImageUploadProps) => react_jsx_runtime.JSX.Element>;
37
379
 
38
- declare const _default$1: react.MemoExoticComponent<({ onFileSelect, onRemove, file: filePreview, disabled, label, id, tabIndex, error, helperText, sx, name, maxSize, uploading, aspectRatio, enableCrop, convertToWebp, cropSize, ...other }: SingleImageUploadProps) => react_jsx_runtime.JSX.Element>;
380
+ declare const _default$1: react.MemoExoticComponent<({ onRemove, onFileSelect, createFilesMutation, fileDetails, disabled, label, id, tabIndex, error, helperText, sx, name, maxSize, uploading, aspectRatio, enableCrop, convertToWebp, cropSize, ...other }: SingleImageUploadProps) => react_jsx_runtime.JSX.Element>;
39
381
 
40
382
  declare const _default: react.MemoExoticComponent<({ error, name, disabled, sx, ...other }: SingleFileUploadProps) => react_jsx_runtime.JSX.Element>;
41
383
 
42
384
  declare const isImageFile: (mimeType: string) => boolean;
43
385
  declare const convertToWebP: (file: File, quality?: number) => Promise<File>;
44
386
 
45
- export { ExtendFile, FileUploadProps, _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, convertToWebP, isImageFile, useDropzoneUploader, useFileUploadService };
387
+ 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, convertToWebP, fileFormat, fileNameByUrl, fileThumb, fileThumbnailClasses, fileTypeByUrl, isImageFile, useDropzoneUploader, useFileUploadService };