@data-c/pro 0.2.53 → 0.2.54

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/index.mjs CHANGED
@@ -1,4 +1,1085 @@
1
- import{ColumnsPanelTrigger as at,useGridApiRef as tt}from"@mui/x-data-grid-pro";import{useEffect as re,useMemo as We}from"react";import{Circle as fe}from"@mui/icons-material";import{LinearProgress as Ve,Stack as ze}from"@mui/material";import{DataGridPro as Xe,gridFilteredSortedRowIdsSelector as Ne}from"@mui/x-data-grid-pro";import{ptBR as Ke}from"@mui/x-data-grid-pro/locales";import{Stack as M,Typography as te}from"@mui/material";import{jsx as P,jsxs as oe}from"react/jsx-runtime";function F(){return oe(M,{alignItems:"center",justifyContent:"center",gap:2,padding:2,maxWidth:"400px",minWidth:"200px",children:[P(M,{width:"250px",height:"250px",alignItems:"center",justifyContent:"center",borderRadius:"50%",sx:{background:"linear-gradient(to top, #ffffff, #fdfcfd, #fafafa, #f8f7f8, #f5f5f6);"},children:P("img",{src:"https://datac-site-assets.s3.sa-east-1.amazonaws.com/empty-data.svg",alt:"Imagem de notifica\xE7\xE3o",width:"148px",height:"148px"})}),oe(M,{spacing:1,textAlign:"center",children:[P(te,{variant:"h4",component:"h2",fontWeight:"600",children:"Nenhum registro encontrado"}),P(te,{variant:"body2",whiteSpace:"normal",children:"Tente outra pesquisa ou adicione um novo registro."})]})]})}import{Stack as R,Typography as ue}from"@mui/material";import{jsx as k,jsxs as de}from"react/jsx-runtime";function T({errorMessage:e}){return de(R,{alignItems:"center",justifyContent:"center",gap:2,padding:2,maxWidth:"400px",minWidth:"200px",children:[k(R,{width:"250px",height:"250px",alignItems:"center",justifyContent:"center",borderRadius:"50%",sx:{background:"linear-gradient(to top, #ffffff, #fdfcfd, #fafafa, #f8f7f8, #f5f5f6);"},children:k("img",{src:"https://datac-site-assets.s3.sa-east-1.amazonaws.com/error.svg",alt:"Imagem de erro",width:"148px",height:"148px"})}),de(R,{gap:1,textAlign:"center",children:[k(ue,{variant:"h4",component:"h2",fontWeight:"600",children:"Ops! Algo deu errado"}),k(ue,{variant:"body2",children:e})]})]})}import{createContext as Oe,useContext as He,useState as b}from"react";import{useGridApiRef as Ge}from"@mui/x-data-grid-pro";import{jsx as Ee}from"react/jsx-runtime";var le=Oe({});function y({children:e}){let[a,t]=b({type:"include",ids:new Set}),[o,d]=b(!1),[l,u]=b(!1),f=Ge();function s(){t({type:"include",ids:new Set}),d(!0)}return Ee(le.Provider,{value:{apiRef:f,rowsSelectedId:a,clearCallback:o,breakpoint:l,setClearCallback:d,setBreakpoint:u,setRowsSelectedId:t,clearRowsSelectedId:s},children:e})}function p(){return He(le)}import{jsx as L,jsxs as Ze}from"react/jsx-runtime";var Qe=({apiRef:e})=>Ne(e);function q(e){let{error:a,isLoading:t,isFetching:o,data:d,columns:l,controlledRowsSelectedId:u,onClearRowsSelectedId:f,onRowSelectionChange:s,onCellKeyDown:i,onRowDoubleClick:x,stackProps:c,slots:m,...Fe}=e,{rowsSelectedId:Re,setRowsSelectedId:ee,clearCallback:ae,setClearCallback:Te,apiRef:B}=p(),be=We(()=>n=>n.map(r=>r.headerName==="A\xE7\xF5es"?{...r,minWidth:r.minWidth||80,maxWidth:r.maxWidth||r.width||80,headerClassName:"sticky-header",cellClassName:"sticky-cell"}:{...r,flex:r.flex||1,minWidth:r.minWidth||100,headerClassName:r?.enableStickyColumns?"sticky-header":"",cellClassName:r?.enableStickyColumns?"sticky-cell":""}),[l]);re(()=>{u&&ee(u)},[u]),re(()=>{ae&&(f&&f({type:"include",ids:new Set}),Te(!1))},[ae]);function ye(n,r,ve){switch(r.ctrlKey&&r.code==="KeyE"?"ctrl+e":r.code){case"Enter":r.preventDefault(),i&&i("edit",n.id);break;case"F3":r.preventDefault(),i&&i("edit",n.id);break;case"Delete":r.preventDefault(),i&&i("delete",n.id);break;case"ctrl+e":r.preventDefault(),(Ue=>{B?.current&&B.current.exportDataAsCsv(Ue)})({getRowsToExport:Qe});break;default:break}}function qe(n,r,ve){x&&x("edit",n.id)}return Ze(ze,{height:"100%",minHeight:"500px",position:"relative",...c,children:[!t&&o&&L(Ve,{sx:{position:"absolute",top:0,right:0,left:0,zIndex:999,height:"3px"}}),L(Xe,{apiRef:B,rows:d,columns:be(l),density:"compact",hideFooterPagination:!0,hideFooter:!0,loading:t,rowHeight:43,columnHeaderHeight:43,disableVirtualization:!0,onRowDoubleClick:qe,onCellKeyDown:ye,disableRowSelectionOnClick:!0,rowSelectionModel:Re,onRowSelectionModelChange:(n,r)=>{s&&s(n,r),!u&&ee(n)},slots:{booleanCellFalseIcon:()=>L(fe,{color:"error",sx:{fontSize:"10pt"}}),booleanCellTrueIcon:()=>L(fe,{color:"success",sx:{fontSize:"10pt"}}),noRowsOverlay:()=>!t&&a?L(T,{errorMessage:a}):L(F,{}),...m},slotProps:{loadingOverlay:{variant:"skeleton",noRowsVariant:"skeleton"}},disableColumnFilter:!0,localeText:Ke.components.MuiDataGrid.defaultProps.localeText,sx:{border:"none",borderRadius:0,"--DataGridPro-rowBorderColor":"#edf2f9","--DataGridPro-containerBackground":"#f4f6fa",".MuiDataGridPro-overlayWrapperInner":{display:"flex",alignItems:"center",justifyContent:"center"},".MuiDataGridPro-row":{backgroundColor:"white","&:nth-of-type(even)":{backgroundColor:"#f9fafd"},":hover":{backgroundColor:"#e9e9e9"},"&.Mui-selected":{backgroundColor:"rgb(238, 249, 252)","&:hover":{backgroundColor:"rgb(222, 243, 249)"}}},".MuiDataGridPro-cell":{fontSize:"12px",color:"#0b0e14"},".MuiDataGridPro-columnHeaders":{border:"solid 1px #edf2f9"},".MuiDataGridPro-columnHeaderTitle":{fontSize:"12px",color:"#0b0e14",fontWeight:"600"},"& .sticky-cell":{position:"sticky",right:0,background:"inherit",zIndex:1},"& .sticky-header":{position:"sticky",right:0,background:"inherit",zIndex:2}},...Fe})]})}import{GridActionsCellItem as Je}from"@mui/x-data-grid-pro";import{jsx as $e}from"react/jsx-runtime";function v(e){let{ref:a,...t}=e;return $e(Je,{...t,ref:a})}import{GridActionsCellItem as ua}from"@mui/x-data-grid-pro";import{forwardRef as je,createElement as ea}from"react";var se=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),_e=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(a,t,o)=>o?o.toUpperCase():t.toLowerCase()),U=e=>{let a=_e(e);return a.charAt(0).toUpperCase()+a.slice(1)},A=(...e)=>e.filter((a,t,o)=>!!a&&a.trim()!==""&&o.indexOf(a)===t).join(" ").trim(),ie=e=>{for(let a in e)if(a.startsWith("aria-")||a==="role"||a==="title")return!0};import{forwardRef as Ye,createElement as ne}from"react";var ce={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};var pe=Ye(({color:e="currentColor",size:a=24,strokeWidth:t=2,absoluteStrokeWidth:o,className:d="",children:l,iconNode:u,...f},s)=>ne("svg",{ref:s,...ce,width:a,height:a,stroke:e,strokeWidth:o?Number(t)*24/Number(a):t,className:A("lucide",d),...!l&&!ie(f)&&{"aria-hidden":"true"},...f},[...u.map(([i,x])=>ne(i,x)),...Array.isArray(l)?l:[l]]));var I=(e,a)=>{let t=je(({className:o,...d},l)=>ea(pe,{ref:l,iconNode:a,className:A(`lucide-${se(U(e))}`,`lucide-${e}`,o),...d}));return t.displayName=U(e),t};var aa=[["path",{d:"M15 11a1 1 0 0 0 1 1h2.939a1 1 0 0 1 .75 1.811l-6.835 6.836a1.207 1.207 0 0 1-1.707 0L4.31 13.81a1 1 0 0 1 .75-1.811H8a1 1 0 0 0 1-1V5a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1z",key:"1eaqc3"}]],C=I("arrow-big-down",aa);var ta=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],g=I("pencil",ta);var oa=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],h=I("trash-2",oa);import{jsx as me}from"react/jsx-runtime";function O(e){let{ref:a,...t}=e;return me(ua,{color:"error",label:"Deletar",icon:me(h,{size:16}),...t,ref:a})}import{GridActionsCellItem as da}from"@mui/x-data-grid-pro";import{jsx as Le}from"react/jsx-runtime";function H(e){let{ref:a,...t}=e;return Le(da,{label:"Editar",color:"primary",icon:Le(g,{size:16}),...t,ref:a})}import{useEffect as la}from"react";import{Stack as ra,useMediaQuery as fa,useTheme as sa}from"@mui/material";import{jsx as ia}from"react/jsx-runtime";function G({children:e,breakpoints:a}){let{setBreakpoint:t}=p(),o=sa(),d=fa(o.breakpoints.down(a||"md"));return la(()=>{t(d)},[d]),ia(ra,{flexDirection:"row",alignItems:"center",justifyContent:"flex-end",gap:1,marginLeft:"auto",flexGrow:1,children:e})}import{GridActionsCellItem as ca}from"@mui/x-data-grid-pro";import{jsx as Ie}from"react/jsx-runtime";function E(e){let{ref:a,...t}=e;return Ie(ca,{color:"primary",label:"Transportar",icon:Ie(C,{size:16}),...t,ref:a})}import{Button as na,CircularProgress as xe,IconButton as pa,Tooltip as ma,Box as La}from"@mui/material";import{Fragment as Ia,jsx as S,jsxs as Ce}from"react/jsx-runtime";function w(e){let{isLoading:a,startIcon:t,children:o,title:d,...l}=e,{breakpoint:u}=p();return S(Ia,{children:u?S(ma,{title:o,children:Ce(pa,{...l,color:"primary",disabled:a?!0:l.disabled,children:[t,a&&S(xe,{color:"secondary",size:14,sx:{position:"absolute",top:"25%",bottom:"25%",left:"25%",right:"25%",transform:"translate(-50%, -50%)"}})]})}):S(na,{startIcon:t,disabled:a?!0:l.disabled,sx:{position:"relative",height:"26px",minWidth:"70px",padding:"7px 8px 8px",border:"1px solid rgba(223, 226, 231, 0.8)",borderRadius:"6px",display:"flex",alignItems:"center",overflow:"hidden",whiteSpace:"nowrap",flexShrink:1,transition:"width 0.2s ease"},...l,children:Ce(La,{component:"span",sx:{transition:"opacity 0.2s ease, width 0.2s ease",overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis"},children:[a&&S(xe,{color:"secondary",size:14,sx:{position:"absolute",top:"22%",left:"44%",transform:"translate(-50%, -50%)"}}),o]})})})}import{GridActionsCellItem as xa}from"@mui/x-data-grid-pro";import{jsx as ge}from"react/jsx-runtime";function W(e){let{event:a,onClick:t,...o}=e;return ge(xa,{label:"A\xE7\xE3o",onClick:()=>{},icon:ge("span",{children:"\u{1F527}"})})}import{Delete as Ca}from"@mui/icons-material";import{GridActionsCellItem as ga}from"@mui/x-data-grid-pro";import{jsx as he}from"react/jsx-runtime";function V({onClick:e,...a}){return he(ga,{icon:he(Ca,{}),label:"Delete",color:"primary",onClick:()=>{e&&e("delete")},...a})}import{Edit as ha}from"@mui/icons-material";import{GridActionsCellItem as Sa}from"@mui/x-data-grid-pro";import{jsx as Se}from"react/jsx-runtime";function z({onClick:e,...a}){return Se(Sa,{icon:Se(ha,{}),label:"Edit",color:"primary",onClick:()=>e&&e("edit"),...a})}import{Children as wa,cloneElement as Pa,isValidElement as ka}from"react";import{Fragment as Aa,jsx as Da}from"react/jsx-runtime";function X(e){let{children:a,onClick:t}=e;return Da(Aa,{children:wa.map(a,o=>{if(ka(o))return Pa(o,{onClick:t})})})}import{GetApp as Ba}from"@mui/icons-material";import{GridActionsCellItem as Ma}from"@mui/x-data-grid-pro";import{jsx as we}from"react/jsx-runtime";function N({onClick:e,...a}){return we(Ma,{icon:we(Ba,{}),label:"Transport",color:"primary",onClick:()=>e&&e("transport"),...a})}import{Stack as Fa}from"@mui/material";import{jsx as Ra}from"react/jsx-runtime";function K(e){return Ra(Fa,{direction:"row",width:"100%",flexGrow:1,alignItems:"center",gap:1.5,sx:{background:"#f4f"},...e})}import{FileDownload as Ta}from"@mui/icons-material";import{gridFilteredSortedRowIdsSelector as ba}from"@mui/x-data-grid-pro";import{jsx as Pe}from"react/jsx-runtime";var ya=({apiRef:e})=>ba(e);function Q(){let{apiRef:e}=p(),a=t=>{e?.current&&e.current.exportDataAsCsv(t)};return Pe(w,{startIcon:Pe(Ta,{}),onClick:()=>a({getRowsToExport:ya}),children:"Exportar CSV"})}import{TableFooter as qa}from"@mui/material";import{jsx as va}from"react/jsx-runtime";function Z(e){return va(qa,{...e,sx:{height:"54px",paddingX:"12px",gap:"12px",display:"flex",alignItems:"center",backgroundColor:"white",borderBottomLeftRadius:"8px",borderBottomRightRadius:"8px",borderTop:"1px solid #edf2f9"}})}import{pluralizar as ke}from"@data-c/hooks";import{MenuItem as Ua,Pagination as Oa,Stack as Ae,TextField as Ha,Typography as Ga}from"@mui/material";import{useMemo as De}from"react";import{jsx as D,jsxs as Be}from"react/jsx-runtime";function J(e){let{onChangePageSize:a,onChangePage:t,pagination:o,rowsPerPageOptions:d=[15,50,100,200]}=e,{page:l,pageSize:u=15,totalRecords:f}=o||{},s=De(()=>o?.lastPage?o.lastPage:(f||0)<u?1:Math.max(Math.ceil((f||0)/u)),[f,u]),i=De(()=>{if((f||0)<u)return`Exibindo ${ke(f||0,"registro","registros",!0)}`;let c=u;if(l===s){let m=(f||0)%u;c=m===0?u:m}return`Exibindo ${ke(c||0,"registro","registros",!0)} de ${f}`},[o,s]);return Be(Ae,{width:"100%",direction:"row",alignItems:"center",gap:2,marginLeft:"auto",children:[D(Ga,{variant:"body2",fontSize:"13px",fontWeight:"500",whiteSpace:"nowrap",children:i}),!0&&Be(Ae,{direction:"row",alignItems:"center",gap:2,marginLeft:"auto",children:[D(Ha,{sx:{width:"78px",fontSize:"8pt"},size:"small",value:u||0,select:!0,onChange:c=>{a&&a(parseInt(c.target.value))},children:d.map(c=>D(Ua,{value:c,children:c},c))}),D(Oa,{variant:"outlined",shape:"rounded",count:s||0,showFirstButton:!0,showLastButton:!0,onChange:(c,m)=>{t&&t(m)},page:l||0,color:"primary"})]})]})}import{useEffect as Ea,useRef as Wa,useState as Va}from"react";import{Stack as za}from"@mui/material";import{jsx as Me}from"react/jsx-runtime";function $({children:e,height:a,...t}){let o=Wa(null),[d,l]=Va(500);return Ea(()=>{let u=()=>{let f=o.current;if(!f)return;let s=f.getBoundingClientRect().top;l(window.innerHeight-s)};return u(),window.addEventListener("resize",u),()=>{window.removeEventListener("resize",u)}},[]),Me(za,{ref:o,sx:{backgroundColor:"#f4f6fa",border:"1px solid #edf2f9",borderRadius:2,height:a||`calc(${d}px - 16px)`,...t.sx},...t,children:Me(y,{children:e})})}import{Stack as Xa,Typography as Na}from"@mui/material";import{useMemo as Ka}from"react";import{jsx as Za,jsxs as Qa}from"react/jsx-runtime";function _(e){let{countTitle:a,gender:t}=e,{rowsSelectedId:o}=p(),d=o?.ids.size||0,l=Ka(()=>{if(!a)return"";let u=t==="feminino"?"selecionada":"selecionado",f=t==="feminino"?"selecionadas":"selecionados",s=t==="feminino"?"Nenhuma":"Nenhum";return d===1?`${a} ${u}`:d&&d>1?`${a.split(" ").map(i=>`${i}s`).join(" ")} ${f}`:`${s} ${a} ${u}`},[d]);return Za(Xa,{children:Qa(Na,{variant:"body2",fontSize:"13px",fontWeight:"500",whiteSpace:"nowrap",children:[d&&d>0?d:""," ",l]})})}import{Typography as Ja,useTheme as $a}from"@mui/material";import{jsx as _a}from"react/jsx-runtime";function Y({children:e,titleDivider:a=!1,sx:t}){let o=$a();return _a(Ja,{variant:"h6",whiteSpace:"nowrap",sx:{borderRight:a?`solid 1px ${o.palette.grey[300]}`:"none",paddingRight:1.5,...t},children:e})}import{Paper as Ya,Stack as ja}from"@mui/material";import{jsx as et}from"react/jsx-runtime";function j({children:e}){return et(ja,{component:Ya,elevation:0,gap:1.5,flexDirection:"row",justifyContent:"space-between",alignItems:"center",p:1,borderRadius:"8px 8px 0 0",sx:{width:"100%"},children:e})}var ot={CellActionTransport:N,SelectionCounter:_,CellActionDelete:V,ExportCsvButton:Q,CellActionEdit:z,CellActions:X,CellAction:W,Pagination:J,Actions:G,Toolbar:j,Content:K,Button:w,Footer:Z,Table:q,Title:Y,Root:$,Action:v,ActionEdit:H,ActionDelete:O,ActionTransport:E,ColumnsPanelTrigger:at,useGridApiRef:tt},ut=ot;export{ut as DataTable};
1
+ // src/DataTable/index.ts
2
+ import { ColumnsPanelTrigger, useGridApiRef as useGridApiRef2 } from "@mui/x-data-grid-pro";
3
+
4
+ // src/DataTable/DataTable.tsx
5
+ import { useEffect, useMemo } from "react";
6
+ import { Circle } from "@mui/icons-material";
7
+ import { LinearProgress, Stack as Stack3 } from "@mui/material";
8
+ import {
9
+ DataGridPro,
10
+ gridFilteredSortedRowIdsSelector
11
+ } from "@mui/x-data-grid-pro";
12
+ import { ptBR } from "@mui/x-data-grid-pro/locales";
13
+
14
+ // src/DataTable/DataTableEmptyData.tsx
15
+ import { Stack, Typography } from "@mui/material";
16
+ import { jsx, jsxs } from "react/jsx-runtime";
17
+ function DataTableEmptyData() {
18
+ return /* @__PURE__ */ jsxs(
19
+ Stack,
20
+ {
21
+ alignItems: "center",
22
+ justifyContent: "center",
23
+ gap: 2,
24
+ padding: 2,
25
+ maxWidth: "400px",
26
+ minWidth: "200px",
27
+ children: [
28
+ /* @__PURE__ */ jsx(
29
+ Stack,
30
+ {
31
+ width: "250px",
32
+ height: "250px",
33
+ alignItems: "center",
34
+ justifyContent: "center",
35
+ borderRadius: "50%",
36
+ sx: {
37
+ background: "linear-gradient(to top, #ffffff, #fdfcfd, #fafafa, #f8f7f8, #f5f5f6);"
38
+ },
39
+ children: /* @__PURE__ */ jsx(
40
+ "img",
41
+ {
42
+ src: "https://datac-site-assets.s3.sa-east-1.amazonaws.com/empty-data.svg",
43
+ alt: "Imagem de notifica\xE7\xE3o",
44
+ width: "148px",
45
+ height: "148px"
46
+ }
47
+ )
48
+ }
49
+ ),
50
+ /* @__PURE__ */ jsxs(Stack, { spacing: 1, textAlign: "center", children: [
51
+ /* @__PURE__ */ jsx(Typography, { variant: "h4", component: "h2", fontWeight: "600", children: "Nenhum registro encontrado" }),
52
+ /* @__PURE__ */ jsx(Typography, { variant: "body2", whiteSpace: "normal", children: "Tente outra pesquisa ou adicione um novo registro." })
53
+ ] })
54
+ ]
55
+ }
56
+ );
57
+ }
58
+
59
+ // src/DataTable/DataTableError.tsx
60
+ import { Stack as Stack2, Typography as Typography2 } from "@mui/material";
61
+ import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
62
+ function DataTableError({
63
+ errorMessage
64
+ }) {
65
+ return /* @__PURE__ */ jsxs2(
66
+ Stack2,
67
+ {
68
+ alignItems: "center",
69
+ justifyContent: "center",
70
+ gap: 2,
71
+ padding: 2,
72
+ maxWidth: "400px",
73
+ minWidth: "200px",
74
+ children: [
75
+ /* @__PURE__ */ jsx2(
76
+ Stack2,
77
+ {
78
+ width: "250px",
79
+ height: "250px",
80
+ alignItems: "center",
81
+ justifyContent: "center",
82
+ borderRadius: "50%",
83
+ sx: {
84
+ background: "linear-gradient(to top, #ffffff, #fdfcfd, #fafafa, #f8f7f8, #f5f5f6);"
85
+ },
86
+ children: /* @__PURE__ */ jsx2(
87
+ "img",
88
+ {
89
+ src: "https://datac-site-assets.s3.sa-east-1.amazonaws.com/error.svg",
90
+ alt: "Imagem de erro",
91
+ width: "148px",
92
+ height: "148px"
93
+ }
94
+ )
95
+ }
96
+ ),
97
+ /* @__PURE__ */ jsxs2(Stack2, { gap: 1, textAlign: "center", children: [
98
+ /* @__PURE__ */ jsx2(Typography2, { variant: "h4", component: "h2", fontWeight: "600", children: "Ops! Algo deu errado" }),
99
+ /* @__PURE__ */ jsx2(Typography2, { variant: "body2", children: errorMessage })
100
+ ] })
101
+ ]
102
+ }
103
+ );
104
+ }
105
+
106
+ // src/DataTable/DataTableRootProvider.tsx
107
+ import {
108
+ createContext,
109
+ useContext,
110
+ useState
111
+ } from "react";
112
+ import { useGridApiRef } from "@mui/x-data-grid-pro";
113
+ import { jsx as jsx3 } from "react/jsx-runtime";
114
+ var TableRootContext = createContext({});
115
+ function TableRootProvider({
116
+ children
117
+ }) {
118
+ const [ids, setIds] = useState({
119
+ type: "include",
120
+ ids: /* @__PURE__ */ new Set()
121
+ });
122
+ const [clearCallback, setClearCallback] = useState(false);
123
+ const [breakpoint, setBreakpoint] = useState(false);
124
+ const apiRef = useGridApiRef();
125
+ function handleClearRowsSelectedId() {
126
+ setIds({
127
+ type: "include",
128
+ ids: /* @__PURE__ */ new Set()
129
+ });
130
+ setClearCallback(true);
131
+ }
132
+ return /* @__PURE__ */ jsx3(
133
+ TableRootContext.Provider,
134
+ {
135
+ value: {
136
+ apiRef,
137
+ rowsSelectedId: ids,
138
+ clearCallback,
139
+ breakpoint,
140
+ setClearCallback,
141
+ setBreakpoint,
142
+ setRowsSelectedId: setIds,
143
+ clearRowsSelectedId: handleClearRowsSelectedId
144
+ },
145
+ children
146
+ }
147
+ );
148
+ }
149
+ function useTableRootContext() {
150
+ return useContext(TableRootContext);
151
+ }
152
+
153
+ // src/DataTable/DataTable.tsx
154
+ import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
155
+ var getFilteredRows = ({ apiRef }) => gridFilteredSortedRowIdsSelector(apiRef);
156
+ function Table(props) {
157
+ const {
158
+ error,
159
+ isLoading,
160
+ isFetching,
161
+ data,
162
+ columns,
163
+ controlledRowsSelectedId,
164
+ onClearRowsSelectedId,
165
+ onRowSelectionChange,
166
+ onCellKeyDown,
167
+ onRowDoubleClick,
168
+ stackProps,
169
+ slots,
170
+ ...rest
171
+ } = props;
172
+ const {
173
+ rowsSelectedId,
174
+ setRowsSelectedId,
175
+ clearCallback,
176
+ setClearCallback,
177
+ apiRef
178
+ } = useTableRootContext();
179
+ const parsedColumns = useMemo(() => {
180
+ return (columns2) => {
181
+ return columns2.map((col) => {
182
+ if (col.headerName === "A\xE7\xF5es") {
183
+ return {
184
+ ...col,
185
+ minWidth: col.minWidth || 80,
186
+ maxWidth: col.maxWidth || col.width || 80,
187
+ headerClassName: "sticky-header",
188
+ cellClassName: "sticky-cell"
189
+ };
190
+ }
191
+ return {
192
+ ...col,
193
+ flex: col.flex || 1,
194
+ minWidth: col.minWidth || 100,
195
+ headerClassName: col?.enableStickyColumns ? "sticky-header" : "",
196
+ cellClassName: col?.enableStickyColumns ? "sticky-cell" : ""
197
+ };
198
+ });
199
+ };
200
+ }, [columns]);
201
+ useEffect(() => {
202
+ if (controlledRowsSelectedId) {
203
+ setRowsSelectedId(controlledRowsSelectedId);
204
+ }
205
+ }, [controlledRowsSelectedId]);
206
+ useEffect(() => {
207
+ if (clearCallback) {
208
+ onClearRowsSelectedId && onClearRowsSelectedId({
209
+ type: "include",
210
+ ids: /* @__PURE__ */ new Set()
211
+ });
212
+ setClearCallback(false);
213
+ }
214
+ }, [clearCallback]);
215
+ function handleCellKeyDown(params, event, details) {
216
+ const eventCode = event.ctrlKey && event.code === "KeyE" ? "ctrl+e" : event.code;
217
+ switch (eventCode) {
218
+ case "Enter":
219
+ event.preventDefault();
220
+ if (onCellKeyDown)
221
+ onCellKeyDown("edit", params.id);
222
+ break;
223
+ case "F3":
224
+ event.preventDefault();
225
+ if (onCellKeyDown)
226
+ onCellKeyDown("edit", params.id);
227
+ break;
228
+ case "Delete":
229
+ event.preventDefault();
230
+ if (onCellKeyDown)
231
+ onCellKeyDown("delete", params.id);
232
+ break;
233
+ case "ctrl+e":
234
+ event.preventDefault();
235
+ const handleExport = (options) => {
236
+ if (apiRef?.current) {
237
+ apiRef.current.exportDataAsCsv(options);
238
+ }
239
+ };
240
+ handleExport({ getRowsToExport: getFilteredRows });
241
+ break;
242
+ default:
243
+ break;
244
+ }
245
+ }
246
+ function handleRowDoubleClick(params, _, details) {
247
+ if (onRowDoubleClick)
248
+ onRowDoubleClick("edit", params.id);
249
+ }
250
+ return /* @__PURE__ */ jsxs3(Stack3, { height: "100%", minHeight: "500px", position: "relative", ...stackProps, children: [
251
+ !isLoading && isFetching && /* @__PURE__ */ jsx4(
252
+ LinearProgress,
253
+ {
254
+ sx: {
255
+ position: "absolute",
256
+ top: 0,
257
+ right: 0,
258
+ left: 0,
259
+ zIndex: 999,
260
+ height: "3px"
261
+ }
262
+ }
263
+ ),
264
+ /* @__PURE__ */ jsx4(
265
+ DataGridPro,
266
+ {
267
+ apiRef,
268
+ rows: data,
269
+ columns: parsedColumns(columns),
270
+ density: "compact",
271
+ hideFooterPagination: true,
272
+ hideFooter: true,
273
+ loading: isLoading,
274
+ rowHeight: 43,
275
+ columnHeaderHeight: 43,
276
+ disableVirtualization: true,
277
+ onRowDoubleClick: handleRowDoubleClick,
278
+ onCellKeyDown: handleCellKeyDown,
279
+ disableRowSelectionOnClick: true,
280
+ rowSelectionModel: rowsSelectedId,
281
+ onRowSelectionModelChange: (rowSelectionModel, details) => {
282
+ if (onRowSelectionChange) {
283
+ onRowSelectionChange(rowSelectionModel, details);
284
+ }
285
+ if (controlledRowsSelectedId)
286
+ return;
287
+ setRowsSelectedId(rowSelectionModel);
288
+ },
289
+ slots: {
290
+ booleanCellFalseIcon: () => /* @__PURE__ */ jsx4(Circle, { color: "error", sx: { fontSize: "10pt" } }),
291
+ booleanCellTrueIcon: () => /* @__PURE__ */ jsx4(Circle, { color: "success", sx: { fontSize: "10pt" } }),
292
+ noRowsOverlay: () => !isLoading && !!error ? /* @__PURE__ */ jsx4(DataTableError, { errorMessage: error }) : /* @__PURE__ */ jsx4(DataTableEmptyData, {}),
293
+ ...slots
294
+ },
295
+ slotProps: {
296
+ loadingOverlay: {
297
+ variant: "skeleton",
298
+ noRowsVariant: "skeleton"
299
+ }
300
+ },
301
+ disableColumnFilter: true,
302
+ localeText: ptBR.components.MuiDataGrid.defaultProps.localeText,
303
+ sx: {
304
+ border: "none",
305
+ borderRadius: 0,
306
+ "--DataGrid-rowBorderColor": "#edf2f9",
307
+ "--DataGrid-containerBackground": "#f4f6fa",
308
+ ".MuiDataGrid-overlayWrapperInner": {
309
+ display: "flex",
310
+ alignItems: "center",
311
+ justifyContent: "center"
312
+ },
313
+ ".MuiDataGrid-row": {
314
+ backgroundColor: "white",
315
+ "&:nth-of-type(even)": {
316
+ backgroundColor: "#f9fafd"
317
+ },
318
+ ":hover": {
319
+ backgroundColor: "#e9e9e9"
320
+ },
321
+ "&.Mui-selected": {
322
+ backgroundColor: "rgb(238, 249, 252)",
323
+ "&:hover": {
324
+ backgroundColor: "rgb(222, 243, 249)"
325
+ }
326
+ }
327
+ },
328
+ ".MuiDataGrid-cell": {
329
+ fontSize: "12px",
330
+ color: "#0b0e14"
331
+ },
332
+ ".MuiDataGrid-columnHeaders": {
333
+ border: "solid 1px #edf2f9"
334
+ },
335
+ ".MuiDataGrid-columnHeaderTitle": {
336
+ fontSize: "12px",
337
+ color: "#0b0e14",
338
+ fontWeight: "600"
339
+ },
340
+ "& .sticky-cell": {
341
+ position: "sticky",
342
+ right: 0,
343
+ background: "inherit",
344
+ zIndex: 1
345
+ },
346
+ "& .sticky-header": {
347
+ position: "sticky",
348
+ right: 0,
349
+ background: "inherit",
350
+ zIndex: 2
351
+ }
352
+ },
353
+ ...rest
354
+ }
355
+ )
356
+ ] });
357
+ }
358
+
359
+ // src/DataTable/DataTableAction.tsx
360
+ import {
361
+ GridActionsCellItem
362
+ } from "@mui/x-data-grid-pro";
363
+ import { jsx as jsx5 } from "react/jsx-runtime";
364
+ function DataTableAction(props) {
365
+ const { ref, ...rest } = props;
366
+ return /* @__PURE__ */ jsx5(
367
+ GridActionsCellItem,
368
+ {
369
+ ...rest,
370
+ ref
371
+ }
372
+ );
373
+ }
374
+
375
+ // src/DataTable/DataTableActionDelete.tsx
376
+ import {
377
+ GridActionsCellItem as GridActionsCellItem2
378
+ } from "@mui/x-data-grid-pro";
379
+
380
+ // ../../node_modules/lucide-react/dist/esm/createLucideIcon.js
381
+ import { forwardRef as forwardRef2, createElement as createElement2 } from "react";
382
+
383
+ // ../../node_modules/lucide-react/dist/esm/shared/src/utils.js
384
+ var toKebabCase = (string) => string.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
385
+ var toCamelCase = (string) => string.replace(
386
+ /^([A-Z])|[\s-_]+(\w)/g,
387
+ (match, p1, p2) => p2 ? p2.toUpperCase() : p1.toLowerCase()
388
+ );
389
+ var toPascalCase = (string) => {
390
+ const camelCase = toCamelCase(string);
391
+ return camelCase.charAt(0).toUpperCase() + camelCase.slice(1);
392
+ };
393
+ var mergeClasses = (...classes) => classes.filter((className, index, array) => {
394
+ return Boolean(className) && className.trim() !== "" && array.indexOf(className) === index;
395
+ }).join(" ").trim();
396
+ var hasA11yProp = (props) => {
397
+ for (const prop in props) {
398
+ if (prop.startsWith("aria-") || prop === "role" || prop === "title") {
399
+ return true;
400
+ }
401
+ }
402
+ };
403
+
404
+ // ../../node_modules/lucide-react/dist/esm/Icon.js
405
+ import { forwardRef, createElement } from "react";
406
+
407
+ // ../../node_modules/lucide-react/dist/esm/defaultAttributes.js
408
+ var defaultAttributes = {
409
+ xmlns: "http://www.w3.org/2000/svg",
410
+ width: 24,
411
+ height: 24,
412
+ viewBox: "0 0 24 24",
413
+ fill: "none",
414
+ stroke: "currentColor",
415
+ strokeWidth: 2,
416
+ strokeLinecap: "round",
417
+ strokeLinejoin: "round"
418
+ };
419
+
420
+ // ../../node_modules/lucide-react/dist/esm/Icon.js
421
+ var Icon = forwardRef(
422
+ ({
423
+ color = "currentColor",
424
+ size = 24,
425
+ strokeWidth = 2,
426
+ absoluteStrokeWidth,
427
+ className = "",
428
+ children,
429
+ iconNode,
430
+ ...rest
431
+ }, ref) => createElement(
432
+ "svg",
433
+ {
434
+ ref,
435
+ ...defaultAttributes,
436
+ width: size,
437
+ height: size,
438
+ stroke: color,
439
+ strokeWidth: absoluteStrokeWidth ? Number(strokeWidth) * 24 / Number(size) : strokeWidth,
440
+ className: mergeClasses("lucide", className),
441
+ ...!children && !hasA11yProp(rest) && { "aria-hidden": "true" },
442
+ ...rest
443
+ },
444
+ [
445
+ ...iconNode.map(([tag, attrs]) => createElement(tag, attrs)),
446
+ ...Array.isArray(children) ? children : [children]
447
+ ]
448
+ )
449
+ );
450
+
451
+ // ../../node_modules/lucide-react/dist/esm/createLucideIcon.js
452
+ var createLucideIcon = (iconName, iconNode) => {
453
+ const Component = forwardRef2(
454
+ ({ className, ...props }, ref) => createElement2(Icon, {
455
+ ref,
456
+ iconNode,
457
+ className: mergeClasses(
458
+ `lucide-${toKebabCase(toPascalCase(iconName))}`,
459
+ `lucide-${iconName}`,
460
+ className
461
+ ),
462
+ ...props
463
+ })
464
+ );
465
+ Component.displayName = toPascalCase(iconName);
466
+ return Component;
467
+ };
468
+
469
+ // ../../node_modules/lucide-react/dist/esm/icons/arrow-big-down.js
470
+ var __iconNode = [
471
+ [
472
+ "path",
473
+ {
474
+ d: "M15 11a1 1 0 0 0 1 1h2.939a1 1 0 0 1 .75 1.811l-6.835 6.836a1.207 1.207 0 0 1-1.707 0L4.31 13.81a1 1 0 0 1 .75-1.811H8a1 1 0 0 0 1-1V5a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1z",
475
+ key: "1eaqc3"
476
+ }
477
+ ]
478
+ ];
479
+ var ArrowBigDown = createLucideIcon("arrow-big-down", __iconNode);
480
+
481
+ // ../../node_modules/lucide-react/dist/esm/icons/pencil.js
482
+ var __iconNode2 = [
483
+ [
484
+ "path",
485
+ {
486
+ d: "M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",
487
+ key: "1a8usu"
488
+ }
489
+ ],
490
+ ["path", { d: "m15 5 4 4", key: "1mk7zo" }]
491
+ ];
492
+ var Pencil = createLucideIcon("pencil", __iconNode2);
493
+
494
+ // ../../node_modules/lucide-react/dist/esm/icons/trash-2.js
495
+ var __iconNode3 = [
496
+ ["path", { d: "M10 11v6", key: "nco0om" }],
497
+ ["path", { d: "M14 11v6", key: "outv1u" }],
498
+ ["path", { d: "M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6", key: "miytrc" }],
499
+ ["path", { d: "M3 6h18", key: "d0wm0j" }],
500
+ ["path", { d: "M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2", key: "e791ji" }]
501
+ ];
502
+ var Trash2 = createLucideIcon("trash-2", __iconNode3);
503
+
504
+ // src/DataTable/DataTableActionDelete.tsx
505
+ import { jsx as jsx6 } from "react/jsx-runtime";
506
+ function DataTableActionDelete(props) {
507
+ const { ref, ...rest } = props;
508
+ return /* @__PURE__ */ jsx6(
509
+ GridActionsCellItem2,
510
+ {
511
+ color: "error",
512
+ label: "Deletar",
513
+ icon: /* @__PURE__ */ jsx6(Trash2, { size: 16 }),
514
+ ...rest,
515
+ ref
516
+ }
517
+ );
518
+ }
519
+
520
+ // src/DataTable/DataTableActionEdit.tsx
521
+ import {
522
+ GridActionsCellItem as GridActionsCellItem3
523
+ } from "@mui/x-data-grid-pro";
524
+ import { jsx as jsx7 } from "react/jsx-runtime";
525
+ function DataTableActionEdit(props) {
526
+ const { ref, ...rest } = props;
527
+ return /* @__PURE__ */ jsx7(
528
+ GridActionsCellItem3,
529
+ {
530
+ label: "Editar",
531
+ color: "primary",
532
+ icon: /* @__PURE__ */ jsx7(Pencil, { size: 16 }),
533
+ ...rest,
534
+ ref
535
+ }
536
+ );
537
+ }
538
+
539
+ // src/DataTable/DataTableActions.tsx
540
+ import { useEffect as useEffect2 } from "react";
541
+ import { Stack as Stack4, useMediaQuery, useTheme } from "@mui/material";
542
+ import { jsx as jsx8 } from "react/jsx-runtime";
543
+ function Actions({ children, breakpoints }) {
544
+ const { setBreakpoint } = useTableRootContext();
545
+ const theme = useTheme();
546
+ const breakpoint = useMediaQuery(theme.breakpoints.down(breakpoints || "md"));
547
+ useEffect2(() => {
548
+ setBreakpoint(breakpoint);
549
+ }, [breakpoint]);
550
+ return /* @__PURE__ */ jsx8(
551
+ Stack4,
552
+ {
553
+ flexDirection: "row",
554
+ alignItems: "center",
555
+ justifyContent: "flex-end",
556
+ gap: 1,
557
+ marginLeft: "auto",
558
+ flexGrow: 1,
559
+ children
560
+ }
561
+ );
562
+ }
563
+
564
+ // src/DataTable/DataTableActionTransport.tsx
565
+ import {
566
+ GridActionsCellItem as GridActionsCellItem4
567
+ } from "@mui/x-data-grid-pro";
568
+ import { jsx as jsx9 } from "react/jsx-runtime";
569
+ function DataTableActionTransport(props) {
570
+ const { ref, ...rest } = props;
571
+ return /* @__PURE__ */ jsx9(
572
+ GridActionsCellItem4,
573
+ {
574
+ color: "primary",
575
+ label: "Transportar",
576
+ icon: /* @__PURE__ */ jsx9(ArrowBigDown, { size: 16 }),
577
+ ...rest,
578
+ ref
579
+ }
580
+ );
581
+ }
582
+
583
+ // src/DataTable/DataTableButton.tsx
584
+ import {
585
+ Button as MuiButton,
586
+ CircularProgress,
587
+ IconButton,
588
+ Tooltip,
589
+ Box
590
+ } from "@mui/material";
591
+ import { Fragment, jsx as jsx10, jsxs as jsxs4 } from "react/jsx-runtime";
592
+ function DataTableButton(props) {
593
+ const { isLoading, startIcon, children, title, ...rest } = props;
594
+ const { breakpoint } = useTableRootContext();
595
+ return /* @__PURE__ */ jsx10(Fragment, { children: breakpoint ? /* @__PURE__ */ jsx10(Tooltip, { title: children, children: /* @__PURE__ */ jsxs4(
596
+ IconButton,
597
+ {
598
+ ...rest,
599
+ color: "primary",
600
+ disabled: isLoading ? true : rest.disabled,
601
+ children: [
602
+ startIcon,
603
+ isLoading && /* @__PURE__ */ jsx10(
604
+ CircularProgress,
605
+ {
606
+ color: "secondary",
607
+ size: 14,
608
+ sx: {
609
+ position: "absolute",
610
+ top: "25%",
611
+ bottom: "25%",
612
+ left: "25%",
613
+ right: "25%",
614
+ transform: "translate(-50%, -50%)"
615
+ }
616
+ }
617
+ )
618
+ ]
619
+ }
620
+ ) }) : /* @__PURE__ */ jsx10(
621
+ MuiButton,
622
+ {
623
+ startIcon,
624
+ disabled: isLoading ? true : rest.disabled,
625
+ sx: {
626
+ position: "relative",
627
+ height: "26px",
628
+ minWidth: "70px",
629
+ padding: "7px 8px 8px",
630
+ border: "1px solid rgba(223, 226, 231, 0.8)",
631
+ borderRadius: "6px",
632
+ display: "flex",
633
+ alignItems: "center",
634
+ overflow: "hidden",
635
+ whiteSpace: "nowrap",
636
+ flexShrink: 1,
637
+ transition: "width 0.2s ease"
638
+ },
639
+ ...rest,
640
+ children: /* @__PURE__ */ jsxs4(
641
+ Box,
642
+ {
643
+ component: "span",
644
+ sx: {
645
+ transition: "opacity 0.2s ease, width 0.2s ease",
646
+ overflow: "hidden",
647
+ whiteSpace: "nowrap",
648
+ textOverflow: "ellipsis"
649
+ },
650
+ children: [
651
+ isLoading && /* @__PURE__ */ jsx10(
652
+ CircularProgress,
653
+ {
654
+ color: "secondary",
655
+ size: 14,
656
+ sx: {
657
+ position: "absolute",
658
+ top: "22%",
659
+ left: "44%",
660
+ transform: "translate(-50%, -50%)"
661
+ }
662
+ }
663
+ ),
664
+ children
665
+ ]
666
+ }
667
+ )
668
+ }
669
+ ) });
670
+ }
671
+
672
+ // src/DataTable/DataTableCellAction.tsx
673
+ import { GridActionsCellItem as GridActionsCellItem5 } from "@mui/x-data-grid-pro";
674
+ import { jsx as jsx11 } from "react/jsx-runtime";
675
+ function CellAction(props) {
676
+ const { event, onClick, ...rest } = props;
677
+ return /* @__PURE__ */ jsx11(
678
+ GridActionsCellItem5,
679
+ {
680
+ label: "A\xE7\xE3o",
681
+ onClick: () => {
682
+ },
683
+ icon: /* @__PURE__ */ jsx11("span", { children: "\u{1F527}" })
684
+ }
685
+ );
686
+ }
687
+
688
+ // src/DataTable/DataTableCellActionDelete.tsx
689
+ import { Delete as DeleteIcon } from "@mui/icons-material";
690
+ import { GridActionsCellItem as GridActionsCellItem6 } from "@mui/x-data-grid-pro";
691
+ import { jsx as jsx12 } from "react/jsx-runtime";
692
+ function CellActionDelete({
693
+ onClick,
694
+ ...rest
695
+ }) {
696
+ return /* @__PURE__ */ jsx12(
697
+ GridActionsCellItem6,
698
+ {
699
+ icon: /* @__PURE__ */ jsx12(DeleteIcon, {}),
700
+ label: "Delete",
701
+ color: "primary",
702
+ onClick: () => {
703
+ if (onClick)
704
+ onClick("delete");
705
+ },
706
+ ...rest
707
+ }
708
+ );
709
+ }
710
+
711
+ // src/DataTable/DataTableCellActionEdit.tsx
712
+ import { Edit as EditIcon } from "@mui/icons-material";
713
+ import { GridActionsCellItem as GridActionsCellItem7 } from "@mui/x-data-grid-pro";
714
+ import { jsx as jsx13 } from "react/jsx-runtime";
715
+ function CellActionEdit({
716
+ onClick,
717
+ ...rest
718
+ }) {
719
+ return /* @__PURE__ */ jsx13(
720
+ GridActionsCellItem7,
721
+ {
722
+ icon: /* @__PURE__ */ jsx13(EditIcon, {}),
723
+ label: "Edit",
724
+ color: "primary",
725
+ onClick: () => onClick && onClick("edit"),
726
+ ...rest
727
+ }
728
+ );
729
+ }
730
+
731
+ // src/DataTable/DataTableCellActions.tsx
732
+ import { Children, cloneElement, isValidElement } from "react";
733
+ import { Fragment as Fragment2, jsx as jsx14 } from "react/jsx-runtime";
734
+ function CellActions(props) {
735
+ const { children, onClick: onItemClick } = props;
736
+ return /* @__PURE__ */ jsx14(Fragment2, { children: Children.map(children, (child) => {
737
+ if (isValidElement(child)) {
738
+ return cloneElement(child, {
739
+ onClick: onItemClick
740
+ });
741
+ }
742
+ }) });
743
+ }
744
+
745
+ // src/DataTable/DataTableCellActionTransport.tsx
746
+ import { GetApp as TransportIcon } from "@mui/icons-material";
747
+ import { GridActionsCellItem as GridActionsCellItem8 } from "@mui/x-data-grid-pro";
748
+ import { jsx as jsx15 } from "react/jsx-runtime";
749
+ function CellActionTransport({
750
+ onClick,
751
+ ...rest
752
+ }) {
753
+ return /* @__PURE__ */ jsx15(
754
+ GridActionsCellItem8,
755
+ {
756
+ icon: /* @__PURE__ */ jsx15(TransportIcon, {}),
757
+ label: "Transport",
758
+ color: "primary",
759
+ onClick: () => onClick && onClick("transport"),
760
+ ...rest
761
+ }
762
+ );
763
+ }
764
+
765
+ // src/DataTable/DataTableContent.tsx
766
+ import { Stack as Stack5 } from "@mui/material";
767
+ import { jsx as jsx16 } from "react/jsx-runtime";
768
+ function Content(props) {
769
+ return /* @__PURE__ */ jsx16(
770
+ Stack5,
771
+ {
772
+ direction: "row",
773
+ width: "100%",
774
+ flexGrow: 1,
775
+ alignItems: "center",
776
+ gap: 1.5,
777
+ sx: { background: "#f4f" },
778
+ ...props
779
+ }
780
+ );
781
+ }
782
+
783
+ // src/DataTable/DataTableExportCsvButton.tsx
784
+ import { FileDownload as FileDownloadIcon } from "@mui/icons-material";
785
+ import {
786
+ gridFilteredSortedRowIdsSelector as gridFilteredSortedRowIdsSelector2
787
+ } from "@mui/x-data-grid-pro";
788
+ import { jsx as jsx17 } from "react/jsx-runtime";
789
+ var getFilteredRows2 = ({ apiRef }) => gridFilteredSortedRowIdsSelector2(apiRef);
790
+ function ExportCsvButton() {
791
+ const { apiRef } = useTableRootContext();
792
+ const handleExport = (options) => {
793
+ if (apiRef?.current) {
794
+ apiRef.current.exportDataAsCsv(options);
795
+ }
796
+ };
797
+ return /* @__PURE__ */ jsx17(
798
+ DataTableButton,
799
+ {
800
+ startIcon: /* @__PURE__ */ jsx17(FileDownloadIcon, {}),
801
+ onClick: () => handleExport({ getRowsToExport: getFilteredRows2 }),
802
+ children: "Exportar CSV"
803
+ }
804
+ );
805
+ }
806
+
807
+ // src/DataTable/DataTableFooter.tsx
808
+ import { TableFooter } from "@mui/material";
809
+ import { jsx as jsx18 } from "react/jsx-runtime";
810
+ function Footer(props) {
811
+ return /* @__PURE__ */ jsx18(
812
+ TableFooter,
813
+ {
814
+ ...props,
815
+ sx: {
816
+ height: "54px",
817
+ paddingX: "12px",
818
+ gap: "12px",
819
+ display: "flex",
820
+ alignItems: "center",
821
+ backgroundColor: "white",
822
+ borderBottomLeftRadius: "8px",
823
+ borderBottomRightRadius: "8px",
824
+ borderTop: "1px solid #edf2f9"
825
+ }
826
+ }
827
+ );
828
+ }
829
+
830
+ // src/DataTable/DataTablePagination.tsx
831
+ import {
832
+ pluralizar
833
+ } from "@data-c/hooks";
834
+ import {
835
+ MenuItem,
836
+ Pagination as MuiPagination,
837
+ Stack as Stack6,
838
+ TextField,
839
+ Typography as Typography3
840
+ } from "@mui/material";
841
+ import { useMemo as useMemo2 } from "react";
842
+ import { jsx as jsx19, jsxs as jsxs5 } from "react/jsx-runtime";
843
+ function Pagination(props) {
844
+ const {
845
+ onChangePageSize,
846
+ onChangePage,
847
+ pagination,
848
+ rowsPerPageOptions = [15, 50, 100, 200]
849
+ } = props;
850
+ const { page, pageSize = 15, totalRecords } = pagination || {};
851
+ const pages = useMemo2(() => {
852
+ if (pagination?.lastPage)
853
+ return pagination.lastPage;
854
+ if ((totalRecords || 0) < pageSize)
855
+ return 1;
856
+ return Math.max(Math.ceil((totalRecords || 0) / pageSize));
857
+ }, [totalRecords, pageSize]);
858
+ const totalRecordsLabel = useMemo2(() => {
859
+ if ((totalRecords || 0) < pageSize)
860
+ return `Exibindo ${pluralizar(
861
+ totalRecords || 0,
862
+ "registro",
863
+ "registros",
864
+ true
865
+ )}`;
866
+ let registrosExibidos = pageSize;
867
+ if (page === pages) {
868
+ const ultimaPaginaRegistros = (totalRecords || 0) % pageSize;
869
+ registrosExibidos = ultimaPaginaRegistros === 0 ? pageSize : ultimaPaginaRegistros;
870
+ }
871
+ return `Exibindo ${pluralizar(
872
+ registrosExibidos || 0,
873
+ "registro",
874
+ "registros",
875
+ true
876
+ )} de ${totalRecords}`;
877
+ }, [pagination, pages]);
878
+ const showPagination = true;
879
+ return /* @__PURE__ */ jsxs5(
880
+ Stack6,
881
+ {
882
+ width: "100%",
883
+ direction: "row",
884
+ alignItems: "center",
885
+ gap: 2,
886
+ marginLeft: "auto",
887
+ children: [
888
+ /* @__PURE__ */ jsx19(
889
+ Typography3,
890
+ {
891
+ variant: "body2",
892
+ fontSize: "13px",
893
+ fontWeight: "500",
894
+ whiteSpace: "nowrap",
895
+ children: totalRecordsLabel
896
+ }
897
+ ),
898
+ showPagination && /* @__PURE__ */ jsxs5(Stack6, { direction: "row", alignItems: "center", gap: 2, marginLeft: "auto", children: [
899
+ /* @__PURE__ */ jsx19(
900
+ TextField,
901
+ {
902
+ sx: {
903
+ width: "78px",
904
+ fontSize: "8pt"
905
+ },
906
+ size: "small",
907
+ value: pageSize || 0,
908
+ select: true,
909
+ onChange: (e) => {
910
+ if (onChangePageSize) {
911
+ onChangePageSize(parseInt(e.target.value));
912
+ }
913
+ },
914
+ children: rowsPerPageOptions.map((option) => /* @__PURE__ */ jsx19(MenuItem, { value: option, children: option }, option))
915
+ }
916
+ ),
917
+ /* @__PURE__ */ jsx19(
918
+ MuiPagination,
919
+ {
920
+ variant: "outlined",
921
+ shape: "rounded",
922
+ count: pages || 0,
923
+ showFirstButton: true,
924
+ showLastButton: true,
925
+ onChange: (_, _page) => {
926
+ if (onChangePage)
927
+ onChangePage(_page);
928
+ },
929
+ page: page || 0,
930
+ color: "primary"
931
+ }
932
+ )
933
+ ] })
934
+ ]
935
+ }
936
+ );
937
+ }
938
+
939
+ // src/DataTable/DataTableRoot.tsx
940
+ import { useEffect as useEffect3, useRef, useState as useState2 } from "react";
941
+ import { Stack as Stack7 } from "@mui/material";
942
+ import { jsx as jsx20 } from "react/jsx-runtime";
943
+ function Root({ children, height, ...rest }) {
944
+ const tableContainerRef = useRef(null);
945
+ const [tableHeight, setTableHeight] = useState2(500);
946
+ useEffect3(() => {
947
+ const calculateHeight = () => {
948
+ const container = tableContainerRef.current;
949
+ if (!container)
950
+ return;
951
+ const containerTop = container.getBoundingClientRect().top;
952
+ setTableHeight(window.innerHeight - containerTop);
953
+ };
954
+ calculateHeight();
955
+ window.addEventListener("resize", calculateHeight);
956
+ return () => {
957
+ window.removeEventListener("resize", calculateHeight);
958
+ };
959
+ }, []);
960
+ return /* @__PURE__ */ jsx20(
961
+ Stack7,
962
+ {
963
+ ref: tableContainerRef,
964
+ sx: {
965
+ backgroundColor: "#f4f6fa",
966
+ border: "1px solid #edf2f9",
967
+ borderRadius: 2,
968
+ height: height || `calc(${tableHeight}px - 16px)`,
969
+ ...rest.sx
970
+ },
971
+ ...rest,
972
+ children: /* @__PURE__ */ jsx20(TableRootProvider, { children })
973
+ }
974
+ );
975
+ }
976
+
977
+ // src/DataTable/DataTableSelectionCounter.tsx
978
+ import { Stack as Stack8, Typography as Typography4 } from "@mui/material";
979
+ import { useMemo as useMemo3 } from "react";
980
+ import { jsx as jsx21, jsxs as jsxs6 } from "react/jsx-runtime";
981
+ function SelectionCounter(props) {
982
+ const { countTitle, gender } = props;
983
+ const { rowsSelectedId } = useTableRootContext();
984
+ const countQuantidade = rowsSelectedId?.ids.size || 0;
985
+ const flexSufixCountTitle = useMemo3(() => {
986
+ if (!countTitle)
987
+ return "";
988
+ const selecionadoText = gender === "feminino" ? "selecionada" : "selecionado";
989
+ const selecionadosText = gender === "feminino" ? "selecionadas" : "selecionados";
990
+ const nenhumText = gender === "feminino" ? "Nenhuma" : "Nenhum";
991
+ return countQuantidade === 1 ? `${countTitle} ${selecionadoText}` : countQuantidade && countQuantidade > 1 ? `${countTitle.split(" ").map((item) => `${item}s`).join(" ")} ${selecionadosText}` : `${nenhumText} ${countTitle} ${selecionadoText}`;
992
+ }, [countQuantidade]);
993
+ return /* @__PURE__ */ jsx21(Stack8, { children: /* @__PURE__ */ jsxs6(
994
+ Typography4,
995
+ {
996
+ variant: "body2",
997
+ fontSize: "13px",
998
+ fontWeight: "500",
999
+ whiteSpace: "nowrap",
1000
+ children: [
1001
+ countQuantidade && countQuantidade > 0 ? countQuantidade : "",
1002
+ " ",
1003
+ flexSufixCountTitle
1004
+ ]
1005
+ }
1006
+ ) });
1007
+ }
1008
+
1009
+ // src/DataTable/DataTableTitle.tsx
1010
+ import { Typography as Typography5, useTheme as useTheme2 } from "@mui/material";
1011
+ import { jsx as jsx22 } from "react/jsx-runtime";
1012
+ function Title({
1013
+ children,
1014
+ titleDivider = false,
1015
+ sx
1016
+ }) {
1017
+ const theme = useTheme2();
1018
+ return /* @__PURE__ */ jsx22(
1019
+ Typography5,
1020
+ {
1021
+ variant: "h6",
1022
+ whiteSpace: "nowrap",
1023
+ sx: {
1024
+ borderRight: titleDivider ? `solid 1px ${theme.palette.grey[300]}` : "none",
1025
+ paddingRight: 1.5,
1026
+ ...sx
1027
+ },
1028
+ children
1029
+ }
1030
+ );
1031
+ }
1032
+
1033
+ // src/DataTable/DataTableToolbar.tsx
1034
+ import { Paper, Stack as Stack9 } from "@mui/material";
1035
+ import { jsx as jsx23 } from "react/jsx-runtime";
1036
+ function Toolbar({ children }) {
1037
+ return /* @__PURE__ */ jsx23(
1038
+ Stack9,
1039
+ {
1040
+ component: Paper,
1041
+ elevation: 0,
1042
+ gap: 1.5,
1043
+ flexDirection: "row",
1044
+ justifyContent: "space-between",
1045
+ alignItems: "center",
1046
+ p: 1,
1047
+ borderRadius: "8px 8px 0 0",
1048
+ sx: { width: "100%" },
1049
+ children
1050
+ }
1051
+ );
1052
+ }
1053
+
1054
+ // src/DataTable/index.ts
1055
+ var DataTable = {
1056
+ CellActionTransport,
1057
+ SelectionCounter,
1058
+ CellActionDelete,
1059
+ ExportCsvButton,
1060
+ CellActionEdit,
1061
+ CellActions,
1062
+ CellAction,
1063
+ Pagination,
1064
+ Actions,
1065
+ Toolbar,
1066
+ Content,
1067
+ Button: DataTableButton,
1068
+ Footer,
1069
+ Table,
1070
+ Title,
1071
+ Root,
1072
+ Action: DataTableAction,
1073
+ ActionEdit: DataTableActionEdit,
1074
+ ActionDelete: DataTableActionDelete,
1075
+ ActionTransport: DataTableActionTransport,
1076
+ ColumnsPanelTrigger,
1077
+ useGridApiRef: useGridApiRef2
1078
+ };
1079
+ var DataTable_default = DataTable;
1080
+ export {
1081
+ DataTable_default as DataTable
1082
+ };
2
1083
  /*! Bundled license information:
3
1084
 
4
1085
  lucide-react/dist/esm/shared/src/utils.js: