@zydon/common 2.1.44 → 2.1.45
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/chunk-KFZEM7KS.js +5 -0
- package/dist/chunk-NFKMPFE4.js +18 -0
- package/dist/components/form/UploadAvatarWithCrop/index.js +2 -1
- package/dist/components/form/UploadWithCrop/index.js +11 -10
- package/dist/components/upload/index.d.ts +1 -1
- package/dist/components/upload/index.js +2 -1
- package/dist/hooks/useSnackbar.js +1 -5
- package/package.json +1 -1
- package/dist/chunk-G6AUZCBF.js +0 -16
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { c, f } from './chunk-26TNPA2R.js';
|
|
2
|
+
import { a as a$3 } from './chunk-2GACKA32.js';
|
|
3
|
+
import { e } from './chunk-SKUW6ZCP.js';
|
|
4
|
+
import { i } from './chunk-D27ND54J.js';
|
|
5
|
+
import { a } from './chunk-WRRNM2I3.js';
|
|
6
|
+
import { a as a$2 } from './chunk-KFZEM7KS.js';
|
|
7
|
+
import { a as a$1 } from './chunk-M6QHAL4V.js';
|
|
8
|
+
import { useState, useEffect } from 'react';
|
|
9
|
+
import { useDropzone } from 'react-dropzone';
|
|
10
|
+
import A from '@mui/material/Box';
|
|
11
|
+
import T from '@mui/material/Typography';
|
|
12
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
13
|
+
import H from '@mui/material/Dialog';
|
|
14
|
+
import J from '@mui/material/Stack';
|
|
15
|
+
|
|
16
|
+
function M({sx:n,error:s,file:r,disabled:d,helperText:m,...f}){let{getRootProps:y,getInputProps:C,isDragActive:b,isDragReject:g,fileRejections:h}=useDropzone({multiple:!1,disabled:d,accept:{"image/*":[]},...f}),e=!!r,t=g||!!s,[w,v]=useState("");useEffect(()=>{typeof r=="string"?v(r):r instanceof File&&v(URL.createObjectURL(r));},[r]);let x=e&&jsx("img",{alt:"avatar",src:w,style:{width:"100%",height:"100%",borderRadius:"50%",objectFit:"cover"}}),P=jsxs(A,{className:"upload-placeholder",sx:{top:0,gap:1,left:0,width:1,height:1,zIndex:9,display:"flex",borderRadius:"50%",position:"absolute",alignItems:"center",color:"text.disabled",flexDirection:"column",justifyContent:"center",bgcolor:o=>i(o.vars.palette.grey["500Channel"],.08),transition:o=>o.transitions.create(["opacity"],{duration:o.transitions.duration.shorter}),"&:hover":{opacity:.72},...t&&{color:"error.main",bgcolor:o=>i(o.vars.palette.error.mainChannel,.08)},...e&&{zIndex:9,opacity:0,color:"common.white",bgcolor:o=>i(o.vars.palette.grey["900Channel"],.64)}},children:[jsx(a,{icon:"ADD_IMAGE",width:32}),jsx(T,{variant:"caption",children:e?"Atualizar foto":"Enviar foto"})]}),R=jsxs(A,{sx:{width:1,height:1,overflow:"hidden",borderRadius:"50%",position:"relative"},children:[x,P]});return jsxs(Fragment,{children:[jsxs(A,{...y(),sx:{p:1,m:"auto",width:144,height:144,cursor:"pointer",overflow:"hidden",borderRadius:"50%",border:o=>`1px dashed ${i(o.vars.palette.grey["500Channel"],.2)}`,...b&&{opacity:.72},...d&&{opacity:.48,pointerEvents:"none"},...t&&{borderColor:"error.main"},...e&&{...t&&{bgcolor:o=>i(o.vars.palette.error.mainChannel,.08)},"&:hover .upload-placeholder":{opacity:1}},...n},children:[jsx("input",{...C()}),R]}),m&&m,jsx(c,{files:h})]})}var K=({onFileCropped:n,onImageUploaded:s,onCancel:r,aspect:d,label:m,image:f$1="",uploading:y,file:C,tabIndex:b,maxSize:g,onDropRejected:h,...e$1})=>{let{id:t,setCropModalOpen:w,handleRemove:v,cropModalOpen:x,cancelChanges:P,saveChanges:R,previewImage:o,setCropper:O,preview:I,closePreviewImage:W,saving:$}=a$1({onFileCropped:n,onImageUploaded:s,onCancel:r}),{error:q}=a$2();return jsxs(Fragment,{children:[jsxs(J,{position:"relative",alignItems:"center",justifyContent:"center",children:[y&&jsx(f,{}),jsx(M,{...e$1,maxSize:g,id:t,file:C,onDrop:a=>{if(a.length>0){w(!0);let p=new FileReader;p.addEventListener("load",()=>{let D=p.result?.toString()||"";s(D),n(a[0]);}),p.readAsDataURL(a[0]);}},image:f$1,tabIndex:b,onDropRejected:(a,p)=>{let D=a[0]?.errors[0]?.code;s(void 0),n(void 0),q(D==="file-too-large"?`Imagem n\xE3o pode ser maior que ${e(g)}`:"Erro ao enviar imagem"),h&&h(a,p);}})]}),jsx(a$3,{id:t,open:x,onClose:P,label:m,aspectRatio:d,imageSrc:f$1,onRemove:v,onSave:R,onPreview:o,onInitialized:O,loading:$}),jsx(H,{open:!!I,onClose:W,scroll:"body",PaperProps:{sx:{p:2}},children:I&&jsx("img",{src:I,alt:"Preview"})})]})},go=K;
|
|
17
|
+
|
|
18
|
+
export { M as a, go as b };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { b } from '../../../chunk-
|
|
1
|
+
import { b } from '../../../chunk-NFKMPFE4.js';
|
|
2
2
|
import '../../../chunk-26TNPA2R.js';
|
|
3
3
|
import '../../../chunk-2GACKA32.js';
|
|
4
4
|
import '../../../chunk-QRDCZ4VF.js';
|
|
@@ -7,6 +7,7 @@ import '../../../chunk-SKUW6ZCP.js';
|
|
|
7
7
|
import '../../../chunk-D27ND54J.js';
|
|
8
8
|
import '../../../chunk-WRRNM2I3.js';
|
|
9
9
|
import '../../../chunk-7IM2VT47.js';
|
|
10
|
+
import '../../../chunk-KFZEM7KS.js';
|
|
10
11
|
import { a } from '../../../chunk-GA4A5P3S.js';
|
|
11
12
|
import '../../../chunk-M6QHAL4V.js';
|
|
12
13
|
import '../../../chunk-W3MYAMTH.js';
|
|
@@ -1,24 +1,25 @@
|
|
|
1
1
|
import { d as d$1 } from '../../../chunk-IDRYLZ5Z.js';
|
|
2
|
-
import { d, e } from '../../../chunk-26TNPA2R.js';
|
|
3
|
-
import { a as a$
|
|
2
|
+
import { d, e as e$1 } from '../../../chunk-26TNPA2R.js';
|
|
3
|
+
import { a as a$5 } from '../../../chunk-2GACKA32.js';
|
|
4
4
|
import '../../../chunk-QRDCZ4VF.js';
|
|
5
5
|
import '../../../chunk-T7I256S6.js';
|
|
6
|
-
import '../../../chunk-SKUW6ZCP.js';
|
|
7
|
-
import { a as a$
|
|
6
|
+
import { e } from '../../../chunk-SKUW6ZCP.js';
|
|
7
|
+
import { a as a$3 } from '../../../chunk-YWEB6IAI.js';
|
|
8
8
|
import '../../../chunk-D27ND54J.js';
|
|
9
|
-
import { a as a$
|
|
9
|
+
import { a as a$4 } from '../../../chunk-WRRNM2I3.js';
|
|
10
10
|
import '../../../chunk-7IM2VT47.js';
|
|
11
|
+
import { a as a$2 } from '../../../chunk-KFZEM7KS.js';
|
|
11
12
|
import { a } from '../../../chunk-GA4A5P3S.js';
|
|
12
13
|
import { a as a$1 } from '../../../chunk-M6QHAL4V.js';
|
|
13
14
|
import '../../../chunk-W3MYAMTH.js';
|
|
14
15
|
import '../../../chunk-2D6XUBFQ.js';
|
|
15
16
|
import '../../../chunk-ILHUUK4X.js';
|
|
16
17
|
import { useFormContext, Controller } from 'react-hook-form';
|
|
17
|
-
import
|
|
18
|
-
import
|
|
19
|
-
import
|
|
18
|
+
import J from '@mui/material/FormHelperText';
|
|
19
|
+
import T from '@mui/material/Button';
|
|
20
|
+
import z from '@mui/material/Dialog';
|
|
20
21
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
21
22
|
|
|
22
|
-
var
|
|
23
|
+
var G=({onFileCropped:e$2,onImageUploaded:t,onCancel:l,aspect:u,label:v,image:i="",uploading:p,file:m,tabIndex:s,maxSize:d$2,onDropRejected:c,...h})=>{let{id:f,setCropModalOpen:U,handleRemove:C,toggleCropModalOpen:r,cropModalOpen:g,cancelChanges:F,saveChanges:_,previewImage:k,setCropper:H,preview:I,closePreviewImage:L,saving:N}=a$1({onFileCropped:e$2,onImageUploaded:t,onCancel:l}),{error:q}=a$2();return jsxs(Fragment,{children:[jsxs(d,{children:[p&&jsx(a$3,{}),jsx(d$1,{...h,maxSize:d$2,id:f,file:m,onDrop:a=>{if(a.length>0){U(!0);let n=new FileReader;n.addEventListener("load",()=>{let P=n.result?.toString()||"";t(P),e$2(void 0);}),n.readAsDataURL(a[0]);}},image:i,tabIndex:s,onDropRejected:(a,n)=>{let P=a[0]?.errors[0]?.code;t(void 0),e$2(void 0),q(P==="file-too-large"?`Imagem n\xE3o pode ser maior que ${e(d$2)}`:"Erro ao enviar imagem"),c&&c(a,n);}}),(m||i)&&jsxs(e$1,{className:"actions",children:[jsx(T,{color:"inherit",startIcon:jsx(a$4,{icon:"DELETE_MARK_BUTTON_02",color:"error.main"}),onClick:C,children:"Remover"}),jsx(T,{color:"inherit",startIcon:jsx(a$4,{icon:"SEARCH_IMAGE",color:"primary.maon"}),onClick:r,children:"Editar"})]})]}),jsx(a$5,{id:f,open:g,onClose:F,label:v,aspectRatio:u,imageSrc:i,onRemove:C,onSave:_,onPreview:k,onInitialized:H,loading:N}),jsx(z,{open:!!I,onClose:L,scroll:"body",PaperProps:{sx:{p:2}},children:I&&jsx("img",{src:I,alt:"Preview"})})]})},y=G;var Q=({name:e,rules:t,helperText:l,aspect:u,label:v,image:i,onFileCropped:p,onImageUploaded:m,onCancel:s,...d})=>{let{control:c}=useFormContext(),{uploadFile:h,file:f,setFileValue:U}=a(e);return jsx(Controller,{name:e,control:c,rules:t,render:({field:{value:C},fieldState:{error:r}})=>jsx(y,{accept:{"image/*":[]},file:C?f:void 0,onFileCropped:g=>{h(g),p&&p(g);},onImageUploaded:m,onCancel:()=>{U(void 0),s&&s();},error:!!r,disableMultiple:!0,helperText:(!!r||l)&&jsx(J,{error:!!r,sx:{px:2},children:r?r?.message:l}),aspect:u,label:v,image:i,...d})})},fo=Q;
|
|
23
24
|
|
|
24
|
-
export {
|
|
25
|
+
export { fo as default };
|
|
@@ -61,7 +61,7 @@ declare const Upload: ({ id, disabled, multiple, error, helperText, file, onDele
|
|
|
61
61
|
|
|
62
62
|
declare function UploadAvatar({ sx, error, file: value, disabled, helperText, ...other }: UploadProps): react_jsx_runtime.JSX.Element;
|
|
63
63
|
|
|
64
|
-
declare const UploadAvatarWithCrop: ({ onFileCropped, onImageUploaded, onCancel, aspect, label, image, uploading, file, tabIndex, ...other }: UploadWithCropProps) => react_jsx_runtime.JSX.Element;
|
|
64
|
+
declare const UploadAvatarWithCrop: ({ onFileCropped, onImageUploaded, onCancel, aspect, label, image, uploading, file, tabIndex, maxSize, onDropRejected, ...other }: UploadWithCropProps) => react_jsx_runtime.JSX.Element;
|
|
65
65
|
|
|
66
66
|
declare function UploadBox({ error, disabled, sx, ...other }: UploadProps): react_jsx_runtime.JSX.Element;
|
|
67
67
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { a as UploadAvatar, b as UploadAvatarWithCrop, b as UploadWithCrop } from '../../chunk-
|
|
1
|
+
export { a as UploadAvatar, b as UploadAvatarWithCrop, b as UploadWithCrop } from '../../chunk-NFKMPFE4.js';
|
|
2
2
|
export { c as DeleteButton, a as MultiFilePreview, b as SingleFilePreview, d as Upload } from '../../chunk-IDRYLZ5Z.js';
|
|
3
3
|
export { c as RejectionFiles } from '../../chunk-26TNPA2R.js';
|
|
4
4
|
import '../../chunk-2GACKA32.js';
|
|
@@ -8,6 +8,7 @@ import '../../chunk-SKUW6ZCP.js';
|
|
|
8
8
|
import { i } from '../../chunk-D27ND54J.js';
|
|
9
9
|
import '../../chunk-WRRNM2I3.js';
|
|
10
10
|
import '../../chunk-7IM2VT47.js';
|
|
11
|
+
import '../../chunk-KFZEM7KS.js';
|
|
11
12
|
import '../../chunk-M6QHAL4V.js';
|
|
12
13
|
import '../../chunk-W3MYAMTH.js';
|
|
13
14
|
import '../../chunk-2D6XUBFQ.js';
|
package/package.json
CHANGED
package/dist/chunk-G6AUZCBF.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { c, f } from './chunk-26TNPA2R.js';
|
|
2
|
-
import { a as a$2 } from './chunk-2GACKA32.js';
|
|
3
|
-
import { i } from './chunk-D27ND54J.js';
|
|
4
|
-
import { a } from './chunk-WRRNM2I3.js';
|
|
5
|
-
import { a as a$1 } from './chunk-M6QHAL4V.js';
|
|
6
|
-
import { useState, useEffect } from 'react';
|
|
7
|
-
import { useDropzone } from 'react-dropzone';
|
|
8
|
-
import I from '@mui/material/Box';
|
|
9
|
-
import F from '@mui/material/Typography';
|
|
10
|
-
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
11
|
-
import N from '@mui/material/Dialog';
|
|
12
|
-
import T from '@mui/material/Stack';
|
|
13
|
-
|
|
14
|
-
function j({sx:p,error:s,file:e,disabled:l,helperText:c$1,...d}){let{getRootProps:g,getInputProps:v,isDragActive:u,isDragReject:y,fileRejections:m}=useDropzone({multiple:!1,disabled:l,accept:{"image/*":[]},...d}),r=!!e,i$1=y||!!s,[C,f]=useState("");useEffect(()=>{typeof e=="string"?f(e):e instanceof File&&f(URL.createObjectURL(e));},[e]);let w=r&&jsx("img",{alt:"avatar",src:C,style:{width:"100%",height:"100%",borderRadius:"50%",objectFit:"cover"}}),b=jsxs(I,{className:"upload-placeholder",sx:{top:0,gap:1,left:0,width:1,height:1,zIndex:9,display:"flex",borderRadius:"50%",position:"absolute",alignItems:"center",color:"text.disabled",flexDirection:"column",justifyContent:"center",bgcolor:o=>i(o.vars.palette.grey["500Channel"],.08),transition:o=>o.transitions.create(["opacity"],{duration:o.transitions.duration.shorter}),"&:hover":{opacity:.72},...i$1&&{color:"error.main",bgcolor:o=>i(o.vars.palette.error.mainChannel,.08)},...r&&{zIndex:9,opacity:0,color:"common.white",bgcolor:o=>i(o.vars.palette.grey["900Channel"],.64)}},children:[jsx(a,{icon:"ADD_IMAGE",width:32}),jsx(F,{variant:"caption",children:r?"Atualizar foto":"Enviar foto"})]}),R=jsxs(I,{sx:{width:1,height:1,overflow:"hidden",borderRadius:"50%",position:"relative"},children:[w,b]});return jsxs(Fragment,{children:[jsxs(I,{...g(),sx:{p:1,m:"auto",width:144,height:144,cursor:"pointer",overflow:"hidden",borderRadius:"50%",border:o=>`1px dashed ${i(o.vars.palette.grey["500Channel"],.2)}`,...u&&{opacity:.72},...l&&{opacity:.48,pointerEvents:"none"},...i$1&&{borderColor:"error.main"},...r&&{...i$1&&{bgcolor:o=>i(o.vars.palette.error.mainChannel,.08)},"&:hover .upload-placeholder":{opacity:1}},...p},children:[jsx("input",{...v()}),R]}),c$1&&c$1,jsx(c,{files:m})]})}var _=({onFileCropped:p,onImageUploaded:s,onCancel:e,aspect:l,label:c,image:d="",uploading:g,file:v,tabIndex:u,...y})=>{let{id:m,setCropModalOpen:r,handleRemove:i,cropModalOpen:C,cancelChanges:f$1,saveChanges:w,previewImage:b,setCropper:R,preview:o,closePreviewImage:L,saving:B}=a$1({onFileCropped:p,onImageUploaded:s,onCancel:e});return jsxs(Fragment,{children:[jsxs(T,{position:"relative",alignItems:"center",justifyContent:"center",children:[g&&jsx(f,{}),jsx(j,{...y,id:m,file:v,onDrop:x=>{if(x.length>0){r(!0);let P=new FileReader;P.addEventListener("load",()=>{let M=P.result?.toString()||"";s(M),p(x[0]);}),P.readAsDataURL(x[0]);}},image:d,tabIndex:u})]}),jsx(a$2,{id:m,open:C,onClose:f$1,label:c,aspectRatio:l,imageSrc:d,onRemove:i,onSave:w,onPreview:b,onInitialized:R,loading:B}),jsx(N,{open:!!o,onClose:L,scroll:"body",PaperProps:{sx:{p:2}},children:o&&jsx("img",{src:o,alt:"Preview"})})]})},no=_;
|
|
15
|
-
|
|
16
|
-
export { j as a, no as b };
|