@zydon/common 2.3.76 → 2.3.77

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,7 @@
1
+ import { useFormContext, Controller } from 'react-hook-form';
2
+ import c from '@mui/material/TextField';
3
+ import { jsx } from 'react/jsx-runtime';
4
+
5
+ var g=({name:o,helperText:s,rules:a,onChange:e,tabIndex:d,className:f,id:r,...t})=>{let{control:m}=useFormContext();return jsx(Controller,{name:o,control:m,rules:a,render:({field:{ref:u,...l},fieldState:{error:p}})=>jsx(c,{...l,onChange:n=>{l.onChange(n),e&&e(n);},inputRef:u,fullWidth:!0,error:!!p,helperText:p?.message||s,"data-intercom-target":o,...t,InputLabelProps:{...t.InputLabelProps,htmlFor:r},inputProps:{...t.inputProps,tabIndex:d,id:r},className:`field-${o} ${f}`})})},b=g;
6
+
7
+ export { b as a };
@@ -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 T from '@mui/material/CircularProgress';
12
+ import _ 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 k({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=u&&jsx(T,{size:30,color:"primary"}),x=e&&jsx("img",{alt:"avatar",src:R,style:{width:"100%",height:"100%",borderRadius:"50%",objectFit:"cover"}}),I=jsxs(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:[jsx(a,{icon:"ADD_IMAGE",width:32}),jsx(_,{variant:"caption",children:e?"Atualizar foto":"Enviar foto"})]}),D=jsxs(U,{sx:{width:1,height:1,overflow:"hidden",borderRadius:"50%",position:"relative"},children:[P,x,I]});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()}),D]}),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:D,preview:o,closePreviewImage:O,saving:W}=a$1({onFileCropped:n,onImageUploaded:s,onCancel:r}),{error:$}=a$2();return jsxs(Fragment,{children:[jsxs(K,{position:"relative",alignItems:"center",justifyContent:"center",children:[y&&jsx(f,{}),jsx(k,{...w,maxSize:f$1,id:e$1,file:C,onDrop:t=>{if(t.length>0){l(!0);let c=new FileReader;c.addEventListener("load",()=>{let A=c.result?.toString()||"";s(A),n(t[0]);}),c.readAsDataURL(t[0]);}},image:p,tabIndex:b,onDropRejected:(t,c)=>{let A=t[0]?.errors[0]?.code;s(void 0),n(void 0),$(A==="file-too-large"?`Imagem n\xE3o pode ser maior que ${e(f$1)}`:"Erro ao enviar imagem"),g&&g(t,c);}})]}),jsx(a$3,{id:e$1,open:h,onClose:P,label:u,aspectRatio:m,imageSrc:p,onRemove:R,onSave:x,onPreview:I,onInitialized:D,loading:W}),jsx(J,{open:!!o,onClose:O,scroll:"body",PaperProps:{sx:{p:2}},children:o&&jsx("img",{src:o,alt:"Preview"})})]})},uo=Q;
18
+
19
+ export { k as a, uo as b };
@@ -5,8 +5,9 @@ import { IconButtonProps } from '@mui/material/IconButton';
5
5
  interface MoreMenuProps extends IconButtonProps {
6
6
  actions: ReactNode;
7
7
  disablePortal?: boolean;
8
+ actionLabel?: string;
8
9
  }
9
10
 
10
- declare const MoreMenu: ({ actions, disablePortal, ...other }: MoreMenuProps) => react_jsx_runtime.JSX.Element;
11
+ declare const MoreMenu: ({ actions, disablePortal, actionLabel, ...other }: MoreMenuProps) => react_jsx_runtime.JSX.Element;
11
12
 
12
13
  export { MoreMenu as default };
@@ -1,11 +1,12 @@
1
- import { a as a$2 } from '../../chunk-HOMGLSVS.js';
2
- import { a as a$1 } from '../../chunk-JAXAPLBP.js';
1
+ import { a as a$3 } from '../../chunk-HOMGLSVS.js';
2
+ import { a as a$2 } from '../../chunk-JAXAPLBP.js';
3
3
  import '../../chunk-224DGQSM.js';
4
4
  import { a } from '../../chunk-ORYAES3Q.js';
5
- import l from '@mui/material/IconButton';
5
+ import f from '@mui/material/IconButton';
6
6
  import M from '@mui/material/Stack';
7
+ import a$1 from '@mui/material/Tooltip';
7
8
  import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
8
9
 
9
- var f=({actions:p,disablePortal:i,...m})=>{let{open:r,onClose:u,onOpen:c}=a();return jsxs(Fragment,{children:[jsx(l,{...m,color:r?"inherit":"default",onClick:c,children:jsx(a$1,{icon:"MORE_BOLD"})}),jsx(a$2,{open:r,onClose:u,arrow:"right-top",disablePortal:i,children:jsx(M,{component:"ul",gap:.5,minWidth:160,children:p})})]})},B=f;
10
+ var s=({actions:i,disablePortal:m,actionLabel:r="A\xE7\xF5es",...l})=>{let{open:t,onClose:u,onOpen:c}=a();return jsxs(Fragment,{children:[jsx(a$1,{title:r,children:jsx(f,{...l,"aria-label":r,color:t?"inherit":"default",onClick:c,children:jsx(a$2,{icon:"MORE_BOLD"})})}),jsx(a$3,{open:t,onClose:u,arrow:"right-top",disablePortal:m,children:jsx(M,{component:"ul",gap:.5,minWidth:160,children:i})})]})},O=s;
10
11
 
11
- export { B as default };
12
+ export { O as default };
@@ -1,5 +1,5 @@
1
1
  import { a as a$1 } from '../../../chunk-2NMLQNWC.js';
2
- import { a as a$2 } from '../../../chunk-VTHBHXM2.js';
2
+ import { a as a$2 } from '../../../chunk-7KPKMP7S.js';
3
3
  import { a as a$3 } from '../../../chunk-SQ6BPK55.js';
4
4
  import '../../../chunk-ORLVNXTG.js';
5
5
  import '../../../chunk-GXFOLM7Q.js';
@@ -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 Field: ({ name, helperText, rules, onChange, tabIndex, className, ...other }: FieldProps) => react_jsx_runtime.JSX.Element;
7
+ declare const Field: ({ name, helperText, rules, onChange, tabIndex, className, id, ...other }: FieldProps) => react_jsx_runtime.JSX.Element;
8
8
 
9
9
  export { Field as default };
@@ -1 +1 @@
1
- export { a as default } from '../../../chunk-VTHBHXM2.js';
1
+ export { a as default } from '../../../chunk-7KPKMP7S.js';
@@ -1,4 +1,4 @@
1
- import { a } from '../../../chunk-VTHBHXM2.js';
1
+ import { a } from '../../../chunk-7KPKMP7S.js';
2
2
  import { d } from '../../../chunk-KOELUX3V.js';
3
3
  import { a as a$1 } from '../../../chunk-JAXAPLBP.js';
4
4
  import '../../../chunk-224DGQSM.js';
@@ -1,4 +1,4 @@
1
- import { b } from '../../../chunk-373LAZQA.js';
1
+ import { b } from '../../../chunk-OQ3EUAKX.js';
2
2
  import '../../../chunk-4VAXJ4XM.js';
3
3
  import '../../../chunk-WB44OSQ3.js';
4
4
  import '../../../chunk-K5UDWHUQ.js';
@@ -1,4 +1,4 @@
1
- import { a } from '../../../chunk-VTHBHXM2.js';
1
+ import { a } from '../../../chunk-7KPKMP7S.js';
2
2
  import { a as a$2 } from '../../../chunk-SQ6BPK55.js';
3
3
  import { a as a$3 } from '../../../chunk-QVOENOD3.js';
4
4
  import '../../../chunk-GXFOLM7Q.js';
@@ -1,4 +1,4 @@
1
- export { a as UploadAvatar, b as UploadAvatarWithCrop } from '../../chunk-373LAZQA.js';
1
+ export { a as UploadAvatar, b as UploadAvatarWithCrop } from '../../chunk-OQ3EUAKX.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.76",
3
+ "version": "2.3.77",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "module": "./dist/index.js",
@@ -1,19 +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 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 };
@@ -1,7 +0,0 @@
1
- import { useFormContext, Controller } from 'react-hook-form';
2
- import F from '@mui/material/TextField';
3
- import { jsx } from 'react/jsx-runtime';
4
-
5
- var P=({name:e,helperText:p,rules:s,onChange:o,tabIndex:d,className:f,...t})=>{let{control:m}=useFormContext();return jsx(Controller,{name:e,control:m,rules:s,render:({field:{ref:a,...r},fieldState:{error:l}})=>jsx(F,{...r,onChange:i=>{r.onChange(i),o&&o(i);},inputRef:a,fullWidth:!0,error:!!l,helperText:l?.message||p,"data-intercom-target":e,...t,inputProps:{...t.inputProps,tabIndex:d},className:`field-${e} ${f}`})})},C=P;
6
-
7
- export { C as a };