@zydon/common 2.2.12 → 2.2.14
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-MW4PGDC4.js +18 -0
- package/dist/components/form/Switch/index.d.ts +2 -1
- package/dist/components/form/Switch/index.js +2 -2
- package/dist/components/form/UploadAvatarWithCrop/index.js +1 -1
- package/dist/components/upload/index.js +1 -1
- package/dist/types/switchProps.d.ts +2 -0
- package/package.json +1 -1
- package/dist/chunk-3YZHNOL6.js +0 -18
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { c, f } from './chunk-XQYZ3UC2.js';
|
|
2
|
+
import { a as a$3 } from './chunk-KVL7ASVR.js';
|
|
3
|
+
import { e } from './chunk-ANAHA3L6.js';
|
|
4
|
+
import { i } from './chunk-D27ND54J.js';
|
|
5
|
+
import { a } from './chunk-4Z2JJGWA.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: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(c,{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 };
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { SwitchProps } from '../../../types/switchProps.js';
|
|
3
3
|
import '@mui/material/FormControlLabel';
|
|
4
|
+
import '@mui/material/Switch';
|
|
4
5
|
import '../../../types/baseField.js';
|
|
5
6
|
import 'react-hook-form';
|
|
6
7
|
|
|
7
|
-
declare const Switch: ({ name, helperText, onChange, tabIndex, size, label, ...other }: SwitchProps) => react_jsx_runtime.JSX.Element;
|
|
8
|
+
declare const Switch: ({ name, helperText, onChange, tabIndex, size, label, sx, ...other }: SwitchProps) => react_jsx_runtime.JSX.Element;
|
|
8
9
|
|
|
9
10
|
export { Switch as default };
|
|
@@ -4,6 +4,6 @@ import F from '@mui/material/FormHelperText';
|
|
|
4
4
|
import S from '@mui/material/Switch';
|
|
5
5
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
6
6
|
|
|
7
|
-
var h=({name:p,helperText:n,onChange:l,tabIndex:c,size:d,label:i,...
|
|
7
|
+
var h=({name:p,helperText:n,onChange:l,tabIndex:c,size:d,label:i,sx:a,...s})=>{let{control:u}=useFormContext(),m=r=>jsx(S,{...r,checked:r.value,onChange:(o,t)=>{r.onChange(o),l&&l(o,t);},inputProps:{tabIndex:c},size:d,sx:a});return jsx(Controller,{name:p,control:u,render:({field:r,fieldState:{error:o}})=>jsxs("div",{children:[i?jsx(C,{label:i,control:m(r),...s}):m(r),(!!o||n)&&jsx(F,{error:!!o,sx:t=>({mx:"14px",color:s.disabled?t.palette.grey[500]:void 0}),children:o?o?.message:n})]})})},V=h;
|
|
8
8
|
|
|
9
|
-
export {
|
|
9
|
+
export { V as default };
|
|
@@ -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-MW4PGDC4.js';
|
|
2
2
|
export { c as DeleteButton, a as MultiFilePreview, b as SingleFilePreview, d as Upload } from '../../chunk-JBH4Q2LO.js';
|
|
3
3
|
export { c as RejectionFiles } from '../../chunk-XQYZ3UC2.js';
|
|
4
4
|
import '../../chunk-KVL7ASVR.js';
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { FormControlLabelProps } from '@mui/material/FormControlLabel';
|
|
2
|
+
import { SwitchProps as SwitchProps$1 } from '@mui/material/Switch';
|
|
2
3
|
import { BaseField } from './baseField.js';
|
|
3
4
|
import 'react-hook-form';
|
|
4
5
|
|
|
5
6
|
interface Props extends Omit<FormControlLabelProps, 'control'> {
|
|
6
7
|
helperText?: React.ReactNode;
|
|
7
8
|
size?: 'small' | 'medium';
|
|
9
|
+
sx?: SwitchProps$1['sx'];
|
|
8
10
|
}
|
|
9
11
|
type SwitchProps = BaseField<Props>;
|
|
10
12
|
|
package/package.json
CHANGED
package/dist/chunk-3YZHNOL6.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { c, f } from './chunk-XQYZ3UC2.js';
|
|
2
|
-
import { a as a$3 } from './chunk-KVL7ASVR.js';
|
|
3
|
-
import { e } from './chunk-ANAHA3L6.js';
|
|
4
|
-
import { i } from './chunk-D27ND54J.js';
|
|
5
|
-
import { a } from './chunk-4Z2JJGWA.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: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(c,{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 };
|