@zydon/common 2.5.48 → 2.5.50

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,11 @@
1
+ import { a } from './chunk-24EPSBGG.js';
2
+ import { memo } from 'react';
3
+ import d from '@mui/material/Button';
4
+ import o from '@mui/material/Stack';
5
+ import { useTheme } from '@mui/material/styles';
6
+ import u from '@mui/material/Typography';
7
+ import { jsxs, jsx } from 'react/jsx-runtime';
8
+
9
+ var R=r=>{switch(r){case"success":return jsx(a,{"data-testid":"icon-SUCCESS",icon:"CHECK_CIRCLE",width:120,height:120});case"error":return jsx(a,{"data-testid":"icon-ERROR",icon:"CANCEL_CIRCLE",width:120,height:120});case"info":return jsx(a,{"data-testid":"icon-INFO",icon:"INFO_CIRCLE",width:120,height:120});case"empty":default:return jsx(a,{"data-testid":"icon-DEFAULT",icon:"PACKAGE",width:120,height:120})}},L=(r,e)=>{switch(r){case"success":return e.palette.success.main;case"error":return e.palette.error.main;case"info":return e.palette.primary.main;case"empty":default:return e.palette.text.disabled}},b=({icon:r,title:e,description:i,primaryAction:p,secondaryAction:l,primaryActionLabel:g,secondaryActionLabel:f,onPrimaryAction:n,onSecondaryAction:s,primaryActionProps:C,secondaryActionProps:y,variant:m="default",iconSize:h=120,maxWidth:x=768,sx:S,...w})=>{let E=useTheme(),T=typeof e=="string"?"h3":"div",v=typeof i=="string"?"p":"div",I=L(m,E);return jsxs(o,{alignItems:"center",justifyContent:"center",spacing:3,sx:{height:"100%",textAlign:"center",py:4,px:2,...S},...w,children:[jsx(o,{sx:{color:I,"& svg":{width:h,height:h}},children:r||R(m)}),jsxs(o,{spacing:1,sx:{maxWidth:x},children:[e&&jsx(u,{component:T,variant:"subtitle1",fontWeight:"600",color:"text.primary",sx:{mb:.5},children:e}),i&&jsx(u,{component:v,variant:"body1",color:"text.secondary",sx:{lineHeight:1.6},children:i})]}),(p||l||n||s)&&jsxs(o,{direction:"row",spacing:2,flexWrap:"wrap",justifyContent:"center",children:[l||s&&jsx(d,{variant:"outlined",color:"inherit",onClick:s,sx:{minWidth:120},...y,children:f||"Cancelar"}),p||n&&jsx(d,{variant:"contained",color:"primary",onClick:n,sx:{minWidth:120},...C,children:g||"Confirmar"})]})]})},_=memo(b);
10
+
11
+ export { _ as a };
@@ -1,10 +1,10 @@
1
1
  import { a as a$5 } from '../../chunk-H5L4ARDB.js';
2
- import { a } from '../../chunk-XTIYH2YX.js';
3
- import { e } from '../../chunk-ANAHA3L6.js';
4
2
  import { a as a$3 } from '../../chunk-2FXBVVBD.js';
5
3
  import { a as a$6 } from '../../chunk-G27HQGIC.js';
6
4
  import '../../chunk-7AZX7L27.js';
5
+ import { a } from '../../chunk-XTIYH2YX.js';
7
6
  import '../../chunk-QREMZNLF.js';
7
+ import { e } from '../../chunk-ANAHA3L6.js';
8
8
  import { a as a$2 } from '../../chunk-SVWZMU2S.js';
9
9
  import { x } from '../../chunk-2P4CXK3O.js';
10
10
  import { a as a$7 } from '../../chunk-FK7DDO5L.js';
@@ -0,0 +1,68 @@
1
+ import * as react from 'react';
2
+ import { ReactNode } from 'react';
3
+ import * as react_jsx_runtime from 'react/jsx-runtime';
4
+ import { ButtonProps } from '@mui/material/Button';
5
+ import { StackProps } from '@mui/material/Stack';
6
+
7
+ interface StateDisplayProps extends Omit<StackProps, 'title'> {
8
+ /**
9
+ * Ícone ou asset customizado para exibir
10
+ */
11
+ icon?: ReactNode;
12
+ /**
13
+ * Título principal do estado
14
+ */
15
+ title?: string | ReactNode;
16
+ /**
17
+ * Descrição ou texto secundário
18
+ */
19
+ description?: string | ReactNode;
20
+ /**
21
+ * Ação principal (botão customizado)
22
+ */
23
+ primaryAction?: ReactNode;
24
+ /**
25
+ * Ação secundária (botão customizado)
26
+ */
27
+ secondaryAction?: ReactNode;
28
+ /**
29
+ * Texto do botão primário (usado apenas se primaryAction não for fornecido)
30
+ */
31
+ primaryActionLabel?: string;
32
+ /**
33
+ * Texto do botão secundário (usado apenas se secondaryAction não for fornecido)
34
+ */
35
+ secondaryActionLabel?: string;
36
+ /**
37
+ * Callback para ação primária
38
+ */
39
+ onPrimaryAction?: () => void;
40
+ /**
41
+ * Callback para ação secundária
42
+ */
43
+ onSecondaryAction?: () => void;
44
+ /**
45
+ * Props do botão primário
46
+ */
47
+ primaryActionProps?: ButtonProps;
48
+ /**
49
+ * Props do botão secundário
50
+ */
51
+ secondaryActionProps?: ButtonProps;
52
+ /**
53
+ * Variante do estado para aplicar estilos específicos
54
+ */
55
+ variant?: 'empty' | 'success' | 'error' | 'info' | 'default';
56
+ /**
57
+ * Tamanho do ícone
58
+ */
59
+ iconSize?: number;
60
+ /**
61
+ * Largura máxima do conteúdo
62
+ */
63
+ maxWidth?: number;
64
+ }
65
+
66
+ declare const _default: react.MemoExoticComponent<({ icon, title, description, primaryAction, secondaryAction, primaryActionLabel, secondaryActionLabel, onPrimaryAction, onSecondaryAction, primaryActionProps, secondaryActionProps, variant, iconSize, maxWidth, sx, ...stackProps }: StateDisplayProps) => react_jsx_runtime.JSX.Element>;
67
+
68
+ export { _default as default };
@@ -0,0 +1,3 @@
1
+ export { a as default } from '../../chunk-NRILCEDT.js';
2
+ import '../../chunk-24EPSBGG.js';
3
+ import '../../chunk-WRWKHENK.js';
@@ -2,8 +2,8 @@ import { b } from '../../../chunk-SFCLGK5I.js';
2
2
  import '../../../chunk-ISYQXE75.js';
3
3
  import '../../../chunk-EVIELOMC.js';
4
4
  import '../../../chunk-RQ5Q6X5Y.js';
5
- import '../../../chunk-ANAHA3L6.js';
6
5
  import '../../../chunk-QREMZNLF.js';
6
+ import '../../../chunk-ANAHA3L6.js';
7
7
  import '../../../chunk-D27ND54J.js';
8
8
  import '../../../chunk-X24QANPC.js';
9
9
  import '../../../chunk-24EPSBGG.js';
@@ -3,8 +3,8 @@ import '../../../chunk-ISYQXE75.js';
3
3
  import '../../../chunk-EVIELOMC.js';
4
4
  import '../../../chunk-RQ5Q6X5Y.js';
5
5
  import '../../../chunk-H5L4ARDB.js';
6
- import '../../../chunk-ANAHA3L6.js';
7
6
  import '../../../chunk-QREMZNLF.js';
7
+ import '../../../chunk-ANAHA3L6.js';
8
8
  import '../../../chunk-SVWZMU2S.js';
9
9
  import '../../../chunk-2P4CXK3O.js';
10
10
  import '../../../chunk-FK7DDO5L.js';
@@ -1,22 +1,21 @@
1
- import { a } from '../../chunk-24EPSBGG.js';
1
+ import { a } from '../../chunk-NRILCEDT.js';
2
+ import '../../chunk-24EPSBGG.js';
2
3
  import '../../chunk-WRWKHENK.js';
3
- import U from '@mui/material/TableCell';
4
- import J from '@mui/material/TableRow';
5
- import { jsxs, jsx } from 'react/jsx-runtime';
6
- import Y from '@mui/material/Box';
7
- import Z from '@mui/material/Checkbox';
8
- import V from '@mui/material/TableHead';
9
- import ee from '@mui/material/TableSortLabel';
10
- import { memo, useState, useCallback } from 'react';
11
- import M from '@mui/material/Button';
12
- import P from '@mui/material/Stack';
13
- import { useTheme } from '@mui/material/styles';
14
- import W from '@mui/material/Typography';
15
- import fe from '@mui/material/FormControlLabel';
16
- import ue from '@mui/material/Switch';
17
- import be from '@mui/material/TablePagination';
18
- import h from '@mui/material/Skeleton';
4
+ import S from '@mui/material/TableCell';
5
+ import F from '@mui/material/TableRow';
6
+ import { jsx, jsxs } from 'react/jsx-runtime';
7
+ import q from '@mui/material/Box';
8
+ import J from '@mui/material/Checkbox';
9
+ import Q from '@mui/material/TableHead';
10
+ import Y from '@mui/material/TableSortLabel';
11
+ import oe from '@mui/material/FormControlLabel';
12
+ import re from '@mui/material/Switch';
13
+ import ae from '@mui/material/TablePagination';
14
+ import pe from '@mui/material/Stack';
15
+ import me from '@mui/material/Typography';
16
+ import g from '@mui/material/Skeleton';
17
+ import { useState, useCallback } from 'react';
19
18
 
20
- var Q=({emptyRows:e,height:o})=>e?jsx(J,{sx:{...o&&{height:o*e}},children:jsx(U,{colSpan:9})}):null,X=Q;var te={border:0,margin:-1,padding:0,width:"1px",height:"1px",overflow:"hidden",position:"absolute",whiteSpace:"nowrap",clip:"rect(0 0 0 0)"},oe=({sx:e,order:o,onSort:t,orderBy:r,headLabel:i,rowCount:l=0,numSelected:p=0,onSelectAllRows:s})=>jsx(V,{sx:e,children:jsxs(J,{children:[s&&jsx(U,{padding:"checkbox",children:jsx(Z,{indeterminate:!!p&&p<l,checked:!!l&&p===l,onChange:a=>s(a.target.checked),inputProps:{name:"select-all-rows","aria-label":"select all rows"}})}),i.map(a=>jsx(U,{align:a.align||"left",sortDirection:r===a.id?o:!1,sx:{width:a.width,minWidth:a.minWidth},children:t?jsxs(ee,{hideSortIcon:!0,active:r===a.id,direction:r===a.id?o:"asc",onClick:()=>t(a.id),children:[a.label,r===a.id?jsx(Y,{sx:{...te},children:o==="desc"?"sorted descending":"sorted ascending"}):null]}):a.label},a.id))]})}),re=oe;var ie=e=>{switch(e){case"success":return jsx(a,{"data-testid":"icon-SUCCESS",icon:"CHECK_CIRCLE",width:120,height:120});case"error":return jsx(a,{"data-testid":"icon-ERROR",icon:"CANCEL_CIRCLE",width:120,height:120});case"info":return jsx(a,{"data-testid":"icon-INFO",icon:"INFO_CIRCLE",width:120,height:120});case"empty":default:return jsx(a,{"data-testid":"icon-DEFAULT",icon:"PACKAGE",width:120,height:120})}},se=(e,o)=>{switch(e){case"success":return o.palette.success.main;case"error":return o.palette.error.main;case"info":return o.palette.primary.main;case"empty":default:return o.palette.text.disabled}},le=({icon:e,title:o,description:t,primaryAction:r,secondaryAction:i,primaryActionLabel:l,secondaryActionLabel:p,onPrimaryAction:s,onSecondaryAction:a,primaryActionProps:x,secondaryActionProps:C,variant:c="default",iconSize:m=120,maxWidth:S=768,sx:k,...v})=>{let E=useTheme(),D=typeof o=="string"?"h3":"div",I=typeof t=="string"?"p":"div",H=se(c,E);return jsxs(P,{alignItems:"center",justifyContent:"center",spacing:3,sx:{height:"100%",textAlign:"center",py:4,px:2,...k},...v,children:[jsx(P,{sx:{color:H,"& svg":{width:m,height:m}},children:e||ie(c)}),jsxs(P,{spacing:1,sx:{maxWidth:S},children:[o&&jsx(W,{component:D,variant:"h5",fontWeight:"600",color:"text.primary",sx:{mb:.5},children:o}),t&&jsx(W,{component:I,variant:"body1",color:"text.secondary",sx:{lineHeight:1.6},children:t})]}),(r||i||s||a)&&jsxs(P,{direction:"row",spacing:2,flexWrap:"wrap",justifyContent:"center",children:[i||a&&jsx(M,{variant:"outlined",color:"inherit",onClick:a,sx:{minWidth:120},...C,children:p||"Cancelar"}),r||s&&jsx(M,{variant:"contained",color:"primary",onClick:s,sx:{minWidth:120},...x,children:l||"Confirmar"})]})]})},A=memo(le);var ce=({notFound:e,sx:o})=>jsx(J,{children:e?jsx(U,{colSpan:12,children:jsx(A,{variant:"empty",title:"Nenhum dado encontrado",description:"N\xE3o h\xE1 registros para exibir",sx:{py:10,borderRadius:2,bgcolor:t=>t.palette.grey[50],border:t=>`dashed 1px ${t.palette.grey[300]}`,...o}})}):jsx(U,{colSpan:12,sx:{p:0}})}),me=ce;var ge=({sx:e,dense:o,onChangeDense:t,rowsPerPageOptions:r=[5,10,25],...i})=>jsxs(Y,{sx:{position:"relative",...e},children:[jsx(be,{rowsPerPageOptions:r,component:"div",...i,sx:{borderTopColor:"transparent"}}),t&&jsx(fe,{label:"Dense",control:jsx(ue,{name:"dense",checked:o,onChange:t}),sx:{pl:2,py:1.5,top:0,position:{sm:"absolute"}}})]}),he=ge;var Ce=({dense:e,action:o,rowCount:t,numSelected:r,onSelectAllRows:i,sx:l,...p})=>r?jsxs(P,{direction:"row",alignItems:"center",sx:{pl:1,pr:2,top:0,left:0,width:1,zIndex:9,height:58,position:"absolute",bgcolor:"primary.lighter",...e&&{height:38},...l},...p,children:[jsx(Z,{indeterminate:!!r&&r<t,checked:!!t&&r===t,onChange:s=>i(s.target.checked)}),jsxs(W,{variant:"subtitle2",sx:{ml:2,flexGrow:1,color:"primary.main",...e&&{ml:3}},children:[r," selected"]}),o&&o]}):null,Pe=Ce;var Ee=({...e})=>jsx(J,{...e,children:jsx(U,{colSpan:12,children:jsxs(P,{spacing:3,direction:"row",alignItems:"center",children:[jsx(h,{sx:{borderRadius:1.5,width:48,height:48,flexShrink:0}}),jsx(h,{sx:{width:1,height:12}}),jsx(h,{sx:{width:180,height:12}}),jsx(h,{sx:{width:160,height:12}}),jsx(h,{sx:{width:140,height:12}}),jsx(h,{sx:{width:120,height:12}})]})})}),De=Ee;var He=e=>{let[o,t]=useState(!!e?.defaultDense),[r,i]=useState(e?.defaultCurrentPage||0),[l,p]=useState(e?.defaultOrderBy||"name"),[s,a]=useState(e?.defaultRowsPerPage||5),[x,C]=useState(e?.defaultOrder||"asc"),[c,m]=useState(e?.defaultSelected||[]),S=useCallback(n=>{n!==""&&(C(l===n&&x==="asc"?"desc":"asc"),p(n));},[x,l]),k=useCallback(n=>{let d=c.includes(n)?c.filter(g=>g!==n):[...c,n];m(d);},[c]),v=useCallback(n=>{i(0),a(parseInt(n.target.value,10));},[]),E=useCallback(n=>{t(n.target.checked);},[]),D=useCallback((n,d)=>{if(n){m(d);return}m([]);},[]),I=useCallback((n,d)=>{i(d);},[]),H=useCallback(()=>{i(0);},[]),G=useCallback(n=>{m([]),r&&n<2&&i(r-1);},[r]),$=useCallback(({totalRowsInPage:n,totalRowsFiltered:d})=>{let g=c.length;if(m([]),r){if(g===n)i(r-1);else if(g===d)i(0);else if(g>n){let q=Math.ceil((d-g)/s)-1;i(q);}}},[r,s,c.length]);return {dense:o,order:x,page:r,orderBy:l,rowsPerPage:s,selected:c,onSelectRow:k,onSelectAllRows:D,onSort:S,onChangePage:I,onChangeDense:E,onResetPage:H,onChangeRowsPerPage:v,onUpdatePageDeleteRow:G,onUpdatePageDeleteRows:$,setPage:i,setDense:t,setOrder:C,setOrderBy:p,setSelected:m,setRowsPerPage:a}},Le=He;function Pt(e,o,t){return e.slice(o*t,o*t+t)}function Rt(e,o,t){return e?Math.max(0,(1+e)*o-t):0}function B(e,o,t){return e[t]?!o[t]||o[t]<e[t]?-1:o[t]>e[t]?1:0:1}function St(e,o){return e==="desc"?(t,r)=>B(t,r,o):(t,r)=>-B(t,r,o)}
19
+ var G=({emptyRows:t,height:o})=>t?jsx(F,{sx:{...o&&{height:o*t}},children:jsx(S,{colSpan:9})}):null,$=G;var Z={border:0,margin:-1,padding:0,width:"1px",height:"1px",overflow:"hidden",position:"absolute",whiteSpace:"nowrap",clip:"rect(0 0 0 0)"},_=({sx:t,order:o,onSort:e,orderBy:r,headLabel:l,rowCount:s=0,numSelected:m=0,onSelectAllRows:c})=>jsx(Q,{sx:t,children:jsxs(F,{children:[c&&jsx(S,{padding:"checkbox",children:jsx(J,{indeterminate:!!m&&m<s,checked:!!s&&m===s,onChange:n=>c(n.target.checked),inputProps:{name:"select-all-rows","aria-label":"select all rows"}})}),l.map(n=>jsx(S,{align:n.align||"left",sortDirection:r===n.id?o:!1,sx:{width:n.width,minWidth:n.minWidth},children:e?jsxs(Y,{hideSortIcon:!0,active:r===n.id,direction:r===n.id?o:"asc",onClick:()=>e(n.id),children:[n.label,r===n.id?jsx(q,{sx:{...Z},children:o==="desc"?"sorted descending":"sorted ascending"}):null]}):n.label},n.id))]})}),B=_;var j=({notFound:t,sx:o})=>jsx(F,{children:t?jsx(S,{colSpan:12,children:jsx(a,{variant:"empty",title:"Nenhum dado encontrado",description:"N\xE3o h\xE1 registros para exibir",sx:{py:10,borderRadius:2,bgcolor:e=>e.palette.grey[50],border:e=>`dashed 1px ${e.palette.grey[300]}`,...o}})}):jsx(S,{colSpan:12,sx:{p:0}})}),ee=j;var ne=({sx:t,dense:o,onChangeDense:e,rowsPerPageOptions:r=[5,10,25],...l})=>jsxs(q,{sx:{position:"relative",...t},children:[jsx(ae,{rowsPerPageOptions:r,component:"div",...l,sx:{borderTopColor:"transparent"}}),e&&jsx(oe,{label:"Dense",control:jsx(re,{name:"dense",checked:o,onChange:e}),sx:{pl:2,py:1.5,top:0,position:{sm:"absolute"}}})]}),le=ne;var ce=({dense:t,action:o,rowCount:e,numSelected:r,onSelectAllRows:l,sx:s,...m})=>r?jsxs(pe,{direction:"row",alignItems:"center",sx:{pl:1,pr:2,top:0,left:0,width:1,zIndex:9,height:58,position:"absolute",bgcolor:"primary.lighter",...t&&{height:38},...s},...m,children:[jsx(J,{indeterminate:!!r&&r<e,checked:!!e&&r===e,onChange:c=>l(c.target.checked)}),jsxs(me,{variant:"subtitle2",sx:{ml:2,flexGrow:1,color:"primary.main",...t&&{ml:3}},children:[r," selected"]}),o&&o]}):null,de=ce;var Te=({...t})=>jsx(F,{...t,children:jsx(S,{colSpan:12,children:jsxs(pe,{spacing:3,direction:"row",alignItems:"center",children:[jsx(g,{sx:{borderRadius:1.5,width:48,height:48,flexShrink:0}}),jsx(g,{sx:{width:1,height:12}}),jsx(g,{sx:{width:180,height:12}}),jsx(g,{sx:{width:160,height:12}}),jsx(g,{sx:{width:140,height:12}}),jsx(g,{sx:{width:120,height:12}})]})})}),he=Te;var we=t=>{let[o,e]=useState(!!t?.defaultDense),[r,l]=useState(t?.defaultCurrentPage||0),[s,m]=useState(t?.defaultOrderBy||"name"),[c,n]=useState(t?.defaultRowsPerPage||5),[w,R]=useState(t?.defaultOrder||"asc"),[b,f]=useState(t?.defaultSelected||[]),H=useCallback(a=>{a!==""&&(R(s===a&&w==="asc"?"desc":"asc"),m(a));},[w,s]),I=useCallback(a=>{let i=b.includes(a)?b.filter(u=>u!==a):[...b,a];f(i);},[b]),L=useCallback(a=>{l(0),n(parseInt(a.target.value,10));},[]),O=useCallback(a=>{e(a.target.checked);},[]),A=useCallback((a,i)=>{if(a){f(i);return}f([]);},[]),M=useCallback((a,i)=>{l(i);},[]),N=useCallback(()=>{l(0);},[]),U=useCallback(a=>{f([]),r&&a<2&&l(r-1);},[r]),K=useCallback(({totalRowsInPage:a,totalRowsFiltered:i})=>{let u=b.length;if(f([]),r){if(u===a)l(r-1);else if(u===i)l(0);else if(u>a){let W=Math.ceil((i-u)/c)-1;l(W);}}},[r,c,b.length]);return {dense:o,order:w,page:r,orderBy:s,rowsPerPage:c,selected:b,onSelectRow:I,onSelectAllRows:A,onSort:H,onChangePage:M,onChangeDense:O,onResetPage:N,onChangeRowsPerPage:L,onUpdatePageDeleteRow:U,onUpdatePageDeleteRows:K,setPage:l,setDense:e,setOrder:R,setOrderBy:m,setSelected:f,setRowsPerPage:n}},Pe=we;function at(t,o,e){return t.slice(o*e,o*e+e)}function nt(t,o,e){return t?Math.max(0,(1+t)*o-e):0}function E(t,o,e){return t[e]?!o[e]||o[e]<t[e]?-1:o[e]>t[e]?1:0:1}function lt(t,o){return t==="desc"?(e,r)=>E(e,r,o):(e,r)=>-E(e,r,o)}
21
20
 
22
- export { X as TableEmptyRows, re as TableHeadCustom, me as TableNoData, he as TablePaginationCustom, Pe as TableSelectedAction, De as TableSkeleton, Rt as emptyRows, St as getComparator, Pt as rowInPage, Le as useTable };
21
+ export { $ as TableEmptyRows, B as TableHeadCustom, ee as TableNoData, le as TablePaginationCustom, de as TableSelectedAction, he as TableSkeleton, nt as emptyRows, lt as getComparator, at as rowInPage, Pe as useTable };
@@ -5,8 +5,8 @@ export { p as RejectionFiles } from '../../chunk-ISYQXE75.js';
5
5
  import '../../chunk-EVIELOMC.js';
6
6
  import '../../chunk-RQ5Q6X5Y.js';
7
7
  import '../../chunk-H5L4ARDB.js';
8
- import '../../chunk-ANAHA3L6.js';
9
8
  import '../../chunk-QREMZNLF.js';
9
+ import '../../chunk-ANAHA3L6.js';
10
10
  import '../../chunk-SVWZMU2S.js';
11
11
  import '../../chunk-2P4CXK3O.js';
12
12
  import '../../chunk-FK7DDO5L.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zydon/common",
3
- "version": "2.5.48",
3
+ "version": "2.5.50",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "module": "./dist/index.js",