@zydon/common 2.1.42 → 2.1.43

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.
@@ -5,12 +5,12 @@ import { a } from './chunk-C7G4JHJP.js';
5
5
  import { a as a$1 } from './chunk-M6QHAL4V.js';
6
6
  import { useState, useEffect } from 'react';
7
7
  import { useDropzone } from 'react-dropzone';
8
- import P from '@mui/material/Box';
9
- import k from '@mui/material/Typography';
8
+ import I from '@mui/material/Box';
9
+ import F from '@mui/material/Typography';
10
10
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
11
11
  import N from '@mui/material/Dialog';
12
12
  import T from '@mui/material/Stack';
13
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(P,{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(k,{variant:"caption",children:r?"Atualizar foto":"Enviar foto"})]}),R=jsxs(P,{sx:{width:1,height:1,overflow:"hidden",borderRadius:"50%",position:"relative"},children:[w,b]});return jsxs(Fragment,{children:[jsxs(P,{...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:I=>{if(I.length>0){r(!0);let x=new FileReader;x.addEventListener("load",()=>{let M=x.result?.toString()||"";s(M),p(void 0);}),x.readAsDataURL(I[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=_;
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
15
 
16
16
  export { j as a, no as b };
@@ -1,4 +1,4 @@
1
- import { b } from '../../../chunk-O72SLDEV.js';
1
+ import { b } from '../../../chunk-L6JOQSV3.js';
2
2
  import '../../../chunk-MJDNBI4A.js';
3
3
  import '../../../chunk-KBGIGYDP.js';
4
4
  import '../../../chunk-MUUKAPQO.js';
@@ -1,4 +1,4 @@
1
- export { a as UploadAvatar, b as UploadAvatarWithCrop, b as UploadWithCrop } from '../../chunk-O72SLDEV.js';
1
+ export { a as UploadAvatar, b as UploadAvatarWithCrop, b as UploadWithCrop } from '../../chunk-L6JOQSV3.js';
2
2
  export { c as DeleteButton, a as MultiFilePreview, b as SingleFilePreview, d as Upload } from '../../chunk-RWZXAZAO.js';
3
3
  export { c as RejectionFiles } from '../../chunk-MJDNBI4A.js';
4
4
  import '../../chunk-KBGIGYDP.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zydon/common",
3
- "version": "2.1.42",
3
+ "version": "2.1.43",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "module": "./dist/index.js",