@zydon/common 2.3.74 → 2.3.76

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.
@@ -0,0 +1,19 @@
1
+ import { p, f } from './chunk-4VAXJ4XM.js';
2
+ import { a as a$3 } from './chunk-WB44OSQ3.js';
3
+ import { e } from './chunk-ANAHA3L6.js';
4
+ import { i } from './chunk-D27ND54J.js';
5
+ import { a } from './chunk-JAXAPLBP.js';
6
+ import { a as a$2 } from './chunk-KFZEM7KS.js';
7
+ import { a as a$1 } from './chunk-X24QANPC.js';
8
+ import { useState, useEffect } from 'react';
9
+ import { useDropzone } from 'react-dropzone';
10
+ import U from '@mui/material/Box';
11
+ import _ from '@mui/material/CircularProgress';
12
+ import H from '@mui/material/Typography';
13
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
14
+ import J from '@mui/material/Dialog';
15
+ import K from '@mui/material/Stack';
16
+
17
+ function F({sx:n,error:s,file:r,disabled:m,uploading:u,helperText:p$1,...y}){let{getRootProps:C,getInputProps:b,isDragActive:f,isDragReject:g,fileRejections:w}=useDropzone({multiple:!1,disabled:m,accept:{"image/*":[]},...y}),e=!!r,l=g||!!s,[R,h]=useState();useEffect(()=>{typeof r=="string"?h(r):r instanceof File&&h(URL.createObjectURL(r));},[r]);let P=e&&jsx("img",{alt:"avatar",src:R,style:{width:"100%",height:"100%",borderRadius:"50%",objectFit:"cover"}}),x=jsx(U,{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},...l&&{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:u?jsx(_,{size:30,color:"primary"}):jsxs(Fragment,{children:[jsx(a,{icon:"ADD_IMAGE",width:32}),jsx(H,{variant:"caption",children:e?"Atualizar foto":"Enviar foto"})]})}),I=jsxs(U,{sx:{width:1,height:1,overflow:"hidden",borderRadius:"50%",position:"relative"},children:[P,x]});return jsxs(Fragment,{children:[jsxs(U,{...C(),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)}`,...f&&{opacity:.72},...m&&{opacity:.48,pointerEvents:"none"},...l&&{borderColor:"error.main"},...e&&{...l&&{bgcolor:o=>i(o.vars.palette.error.mainChannel,.08)},"&:hover .upload-placeholder":{opacity:1}},...n},children:[jsx("input",{...b()}),I]}),p$1&&p$1,jsx(p,{files:w})]})}var Q=({onFileCropped:n,onImageUploaded:s,onCancel:r,aspect:m,label:u,image:p="",uploading:y,file:C,tabIndex:b,maxSize:f$1,onDropRejected:g,...w})=>{let{id:e$1,setCropModalOpen:l,handleRemove:R,cropModalOpen:h,cancelChanges:P,saveChanges:x,previewImage:I,setCropper:o,preview:D,closePreviewImage:W,saving:$}=a$1({onFileCropped:n,onImageUploaded:s,onCancel:r}),{error:q}=a$2();return jsxs(Fragment,{children:[jsxs(K,{position:"relative",alignItems:"center",justifyContent:"center",children:[y&&jsx(f,{}),jsx(F,{...w,maxSize:f$1,id:e$1,file:C,onDrop:i=>{if(i.length>0){l(!0);let c=new FileReader;c.addEventListener("load",()=>{let A=c.result?.toString()||"";s(A),n(i[0]);}),c.readAsDataURL(i[0]);}},image:p,tabIndex:b,onDropRejected:(i,c)=>{let A=i[0]?.errors[0]?.code;s(void 0),n(void 0),q(A==="file-too-large"?`Imagem n\xE3o pode ser maior que ${e(f$1)}`:"Erro ao enviar imagem"),g&&g(i,c);}})]}),jsx(a$3,{id:e$1,open:h,onClose:P,label:u,aspectRatio:m,imageSrc:p,onRemove:R,onSave:x,onPreview:I,onInitialized:o,loading:$}),jsx(J,{open:!!D,onClose:W,scroll:"body",PaperProps:{sx:{p:2}},children:D&&jsx("img",{src:D,alt:"Preview"})})]})},uo=Q;
18
+
19
+ export { F as a, uo as b };
@@ -4,6 +4,6 @@ import '@mui/material/TextField';
4
4
  import '../../../types/baseField.js';
5
5
  import 'react-hook-form';
6
6
 
7
- declare const InputTags: ({ name, helperText, rules, label, required, }: FieldProps) => react_jsx_runtime.JSX.Element;
7
+ declare const InputTags: ({ name, helperText, rules, id, label, required, }: FieldProps) => react_jsx_runtime.JSX.Element;
8
8
 
9
9
  export { InputTags as default };
@@ -1,9 +1,10 @@
1
1
  import { useFormContext, Controller } from 'react-hook-form';
2
- import b from '@mui/material/Autocomplete';
3
- import h from '@mui/material/Chip';
4
- import I from '@mui/material/TextField';
2
+ import y from '@mui/material/Autocomplete';
3
+ import C from '@mui/material/Chip';
4
+ import F from '@mui/material/TextField';
5
5
  import { jsx } from 'react/jsx-runtime';
6
+ import { createElement } from 'react';
6
7
 
7
- var C=({name:n,helperText:a,rules:i,label:p,required:m})=>{let{control:s}=useFormContext();return jsx(Controller,{name:n,control:s,rules:i,render:({field:{ref:f,value:c,onChange:d},fieldState:{error:u}})=>jsx(b,{multiple:!0,options:[],freeSolo:!0,value:c,onChange:(t,o)=>{let l=o.filter(e=>typeof e=="string"?e.trim().length>0:!0);d(l);},renderTags:(t,o)=>t.map((l,e)=>jsx(h,{variant:"soft",color:"primary",label:l,...o({index:e})},e)),renderInput:t=>jsx(I,{...t,inputRef:f,label:p,placeholder:"| Digite e tecle enter",error:!!u,helperText:u?.message||a,required:m}),"data-intercom-target":n})})},R=C;
8
+ var I=({name:a,helperText:u,rules:i,id:m,label:s,required:f})=>{let{control:d}=useFormContext();return jsx(Controller,{name:a,control:d,rules:i,render:({field:{ref:c,value:n,onChange:g},fieldState:{error:p}})=>jsx(y,{multiple:!0,options:[],freeSolo:!0,value:Array.isArray(n)?n:[],onChange:(t,r)=>{let o=r.filter(e=>typeof e=="string"?e.trim().length>0:!0);g(o);},id:m,renderTags:(t,r)=>t.map((o,e)=>createElement(C,{...r({index:e}),key:`tag-${e}`,variant:"soft",color:"primary",label:o})),renderInput:t=>jsx(F,{...t,inputRef:c,label:s,placeholder:"| Digite e tecle enter",error:!!p,helperText:p?.message||u,required:f}),"data-intercom-target":a})})},k=I;
8
9
 
9
- export { R as default };
10
+ export { k as default };
@@ -1,4 +1,4 @@
1
- import { b } from '../../../chunk-WWK537HP.js';
1
+ import { b } from '../../../chunk-373LAZQA.js';
2
2
  import '../../../chunk-4VAXJ4XM.js';
3
3
  import '../../../chunk-WB44OSQ3.js';
4
4
  import '../../../chunk-K5UDWHUQ.js';
@@ -59,7 +59,7 @@ declare function RejectionFiles({ files }: Props): react_jsx_runtime.JSX.Element
59
59
 
60
60
  declare const Upload: ({ id, disabled, multiple, error, helperText, file, onDelete, files, thumbnail, onRemove, onHandleMainImage, mainUrl, sx, dropZoneProps, placeholderProps, placeholderAlt, uploading, image, tabIndex, preview, onRemoveAll, onUpload, onReorder, ...other }: UploadProps) => react_jsx_runtime.JSX.Element;
61
61
 
62
- declare function UploadAvatar({ sx, error, file: value, disabled, helperText, ...other }: UploadProps): react_jsx_runtime.JSX.Element;
62
+ declare function UploadAvatar({ sx, error, file: value, disabled, uploading, helperText, ...other }: UploadProps): react_jsx_runtime.JSX.Element;
63
63
 
64
64
  declare const UploadAvatarWithCrop: ({ onFileCropped, onImageUploaded, onCancel, aspect, label, image, uploading, file, tabIndex, maxSize, onDropRejected, ...other }: UploadWithCropProps) => react_jsx_runtime.JSX.Element;
65
65
 
@@ -1,4 +1,4 @@
1
- export { a as UploadAvatar, b as UploadAvatarWithCrop } from '../../chunk-WWK537HP.js';
1
+ export { a as UploadAvatar, b as UploadAvatarWithCrop } from '../../chunk-373LAZQA.js';
2
2
  export { c as DeleteButton, a as MultiFilePreview, b as SingleFilePreview, d as Upload, e as UploadWithCrop } from '../../chunk-MMTDVFNL.js';
3
3
  import { o } from '../../chunk-4VAXJ4XM.js';
4
4
  export { p as RejectionFiles } from '../../chunk-4VAXJ4XM.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zydon/common",
3
- "version": "2.3.74",
3
+ "version": "2.3.76",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "module": "./dist/index.js",
@@ -1,18 +0,0 @@
1
- import { p, f } from './chunk-4VAXJ4XM.js';
2
- import { a as a$3 } from './chunk-WB44OSQ3.js';
3
- import { e } from './chunk-ANAHA3L6.js';
4
- import { i } from './chunk-D27ND54J.js';
5
- import { a } from './chunk-JAXAPLBP.js';
6
- import { a as a$2 } from './chunk-KFZEM7KS.js';
7
- import { a as a$1 } from './chunk-X24QANPC.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:e,disabled:d,helperText:m,...f}){let{getRootProps:y,getInputProps:C,isDragActive:b,isDragReject:g,fileRejections:h}=useDropzone({multiple:!1,disabled:d,accept:{"image/*":[]},...f}),r=!!e,t=g||!!s,[w,v]=useState();useEffect(()=>{typeof e=="string"?v(e):e instanceof File&&v(URL.createObjectURL(e));},[e]);let R=r&&jsx("img",{alt:"avatar",src:w,style:{width:"100%",height:"100%",borderRadius:"50%",objectFit:"cover"}}),x=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)},...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(T,{variant:"caption",children:r?"Atualizar foto":"Enviar foto"})]}),P=jsxs(A,{sx:{width:1,height:1,overflow:"hidden",borderRadius:"50%",position:"relative"},children:[R,x]});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"},...r&&{...t&&{bgcolor:o=>i(o.vars.palette.error.mainChannel,.08)},"&:hover .upload-placeholder":{opacity:1}},...n},children:[jsx("input",{...C()}),P]}),m&&m,jsx(p,{files:h})]})}var K=({onFileCropped:n,onImageUploaded:s,onCancel:e$1,aspect:d,label:m,image:f$1="",uploading:y,file:C,tabIndex:b,maxSize:g,onDropRejected:h,...r})=>{let{id:t,setCropModalOpen:w,handleRemove:v,cropModalOpen:R,cancelChanges:x,saveChanges:P,previewImage:o,setCropper:F,preview:I,closePreviewImage:O,saving:W}=a$1({onFileCropped:n,onImageUploaded:s,onCancel:e$1}),{error:$}=a$2();return jsxs(Fragment,{children:[jsxs(J,{position:"relative",alignItems:"center",justifyContent:"center",children:[y&&jsx(f,{}),jsx(M,{...r,maxSize:g,id:t,file:C,onDrop:i=>{if(i.length>0){w(!0);let p=new FileReader;p.addEventListener("load",()=>{let D=p.result?.toString()||"";s(D),n(i[0]);}),p.readAsDataURL(i[0]);}},image:f$1,tabIndex:b,onDropRejected:(i,p)=>{let D=i[0]?.errors[0]?.code;s(void 0),n(void 0),$(D==="file-too-large"?`Imagem n\xE3o pode ser maior que ${e(g)}`:"Erro ao enviar imagem"),h&&h(i,p);}})]}),jsx(a$3,{id:t,open:R,onClose:x,label:m,aspectRatio:d,imageSrc:f$1,onRemove:v,onSave:P,onPreview:o,onInitialized:F,loading:W}),jsx(H,{open:!!I,onClose:O,scroll:"body",PaperProps:{sx:{p:2}},children:I&&jsx("img",{src:I,alt:"Preview"})})]})},ho=K;
17
-
18
- export { M as a, ho as b };