@zydon/common 2.8.76 → 2.8.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.
Files changed (55) hide show
  1. package/dist/chunk-CBW32OUQ.js +13 -0
  2. package/dist/chunk-CBW32OUQ.js.map +1 -0
  3. package/dist/chunk-DRGARBKB.js +8 -0
  4. package/dist/chunk-DRGARBKB.js.map +1 -0
  5. package/dist/chunk-FYG3YWFZ.js +4 -0
  6. package/dist/chunk-FYG3YWFZ.js.map +1 -0
  7. package/dist/chunk-J5XGGHQ7.js +8 -0
  8. package/dist/chunk-J5XGGHQ7.js.map +1 -0
  9. package/dist/{chunk-NWT5TUJO.js → chunk-JM3SE72J.js} +2 -2
  10. package/dist/chunk-RMYYQLRJ.js +7 -0
  11. package/dist/chunk-RMYYQLRJ.js.map +1 -0
  12. package/dist/chunk-UC2R4AXD.js +14 -0
  13. package/dist/chunk-UC2R4AXD.js.map +1 -0
  14. package/dist/chunk-Y2SILVOR.js +4 -0
  15. package/dist/chunk-Y2SILVOR.js.map +1 -0
  16. package/dist/components/Analytics/OverviewAnalytics/index.d.ts +54 -0
  17. package/dist/components/Analytics/OverviewAnalytics/index.js +47 -0
  18. package/dist/components/Analytics/OverviewAnalytics/index.js.map +1 -0
  19. package/dist/components/Analytics/index.d.ts +83 -0
  20. package/dist/components/Analytics/index.js +34 -0
  21. package/dist/components/Analytics/index.js.map +1 -0
  22. package/dist/components/Avatar/index.d.ts +1 -1
  23. package/dist/components/AvatarButton/index.js +2 -2
  24. package/dist/components/Common/index.js +2 -2
  25. package/dist/components/DataView/index.d.ts +1 -1
  26. package/dist/components/Drawer/index.js +3 -12
  27. package/dist/components/Drawer/index.js.map +1 -1
  28. package/dist/components/DynamicDataView/index.js +1 -1
  29. package/dist/components/InfoCircle/index.js +3 -7
  30. package/dist/components/InfoCircle/index.js.map +1 -1
  31. package/dist/components/SimpleCard/index.js +1 -7
  32. package/dist/components/SimpleCard/index.js.map +1 -1
  33. package/dist/components/ToggleTheme/index.js +2 -2
  34. package/dist/hooks/useDatagrid.js +1 -6
  35. package/dist/hooks/useDatagrid.js.map +1 -1
  36. package/dist/hooks/useSnackbar.d.ts +1 -1
  37. package/dist/hooks/useThemeToggle.js +2 -2
  38. package/dist/index.d.ts +2 -2
  39. package/dist/index.js +2 -2
  40. package/dist/theme/core/index.d.ts +1 -1
  41. package/dist/theme/styles/index.d.ts +13 -13
  42. package/dist/theme/theme-provider.js +2 -2
  43. package/dist/types/analytics.d.ts +11 -0
  44. package/dist/types/analytics.js +2 -0
  45. package/dist/types/analytics.js.map +1 -0
  46. package/dist/types/overviewAnalytics.d.ts +88 -0
  47. package/dist/types/overviewAnalytics.js +2 -0
  48. package/dist/types/overviewAnalytics.js.map +1 -0
  49. package/dist/utils/buildExportPayload.js +1 -1
  50. package/dist/utils/chart.d.ts +6 -0
  51. package/dist/utils/chart.js +2 -0
  52. package/dist/utils/chart.js.map +1 -0
  53. package/package.json +12 -2
  54. package/dist/{chunk-NWT5TUJO.js.map → chunk-JM3SE72J.js.map} +0 -0
  55. package/dist/{index-5a5e5dc8.d.ts → index-c8f1e6e7.d.ts} +12 -12
@@ -0,0 +1,13 @@
1
+ import { a as a$1 } from './chunk-F65ZXAGV.js';
2
+ import { a } from './chunk-2GTD4JW2.js';
3
+ import S from '@mui/material/Drawer';
4
+ import T from '@mui/material/IconButton';
5
+ import l from '@mui/material/Stack';
6
+ import y from '@mui/material/DialogActions';
7
+ import { styled } from '@mui/material/styles';
8
+ import { jsxs, jsx } from 'react/jsx-runtime';
9
+
10
+ var c=styled(l)(({theme:r})=>({alignItems:"center",borderBottom:`1px solid ${r.palette.grey[300]}`,padding:"22px 20px",gap:16})),d=styled(l)(({theme:r})=>({flexDirection:"row",alignItems:"center",gap:8,flex:1,fontSize:r.typography.subtitle1.fontSize,fontWeight:r.typography.subtitle1.fontWeight,fontFamily:r.typography.fontFamily})),m=styled(y)(({theme:r})=>({borderTop:`1px solid ${r.palette.divider}`,backgroundColor:r.palette.background.paper}));var D=({children:r,actionsProps:t})=>jsx(m,{"data-testid":"drawer-actions",...t,children:r}),f=D;var C=({headerTitle:r,headerProps:t,onClose:i,children:w,contentProps:A,maxWidth:h=684,actions:a$2,actionsProps:x,id:p,...b})=>{let u=p||"actions";return jsxs(S,{anchor:"right",id:p,PaperProps:{sx:{width:1,maxWidth:h}},onClose:i,...b,children:[jsxs(c,{direction:"row",...t,children:[jsx(T,{"aria-label":"Fechar gaveta lateral","data-testid":"close-drawer-btn",size:"small",onClick:i,children:jsx(a,{icon:"CLOSE_MARK_BUTTON",width:18})}),jsx(d,{children:r})]}),jsx(a$1,{children:jsx(l,{p:3,...A,children:w})}),a$2&&jsx(f,{actionsProps:{...x,id:u},children:a$2})]})},K=C;
11
+
12
+ export { K as a };
13
+ //# sourceMappingURL=chunk-CBW32OUQ.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/Drawer/index.tsx","../src/components/Drawer/styles.ts","../src/components/Drawer/Actions.tsx"],"names":["MuiDrawer","IconButton","Stack","DialogActions","styled","Header","theme","HeaderTitle","Actions","jsx","children","actionsProps","Actions_default","jsxs","Drawer","headerTitle","headerProps","onClose","contentProps","maxWidth","actions","id","other","DRAWER_ACTIONS","Icon_default","Scrollbar_default","Drawer_default"],"mappings":"gFAAA,OAAOA,MAAe,uBACtB,OAAOC,MAAgB,2BACvB,OAAOC,MAAW,sBCFlB,OAAOC,MAAmB,8BAC1B,OAAOD,MAAW,sBAClB,OAAS,UAAAE,MAAc,uBAEhB,IAAMC,EAASD,EAAOF,CAAK,EAAE,CAAC,CAAE,MAAAI,CAAM,KAAO,CAClD,WAAY,SACZ,aAAc,aAAaA,EAAM,QAAQ,KAAK,GAAG,IACjD,QAAS,YACT,IAAK,EACP,EAAE,EAEWC,EAAcH,EAAOF,CAAK,EAAE,CAAC,CAAE,MAAAI,CAAM,KAAO,CACvD,cAAe,MACf,WAAY,SACZ,IAAK,EACL,KAAM,EACN,SAAUA,EAAM,WAAW,UAAU,SACrC,WAAYA,EAAM,WAAW,UAAU,WACvC,WAAYA,EAAM,WAAW,UAC/B,EAAE,EAEWE,EAAUJ,EAAOD,CAAa,EAAE,CAAC,CAAE,MAAAG,CAAM,KAAO,CAC3D,UAAW,aAAaA,EAAM,QAAQ,UACtC,gBAAiBA,EAAM,QAAQ,WAAW,KAC5C,EAAE,ECdE,cAAAG,MAAA,oBALJ,IAAMD,EAAU,CAAC,CACf,SAAAE,EACA,aAAAC,CACF,IAEIF,EAACD,EAAA,CAAY,cAAY,iBAAkB,GAAGG,EAC3C,SAAAD,EACH,EAIGE,EAAQJ,EFkBT,OAOI,OAAAC,EAPJ,QAAAI,MAAA,oBAvBN,IAAMC,EAAS,CAAC,CACd,YAAAC,EACA,YAAAC,EACA,QAAAC,EACA,SAAAP,EACA,aAAAQ,EACA,SAAAC,EAAW,IACX,QAAAC,EACA,aAAAT,EACA,GAAAU,EACA,GAAGC,CACL,IAAmB,CACjB,IAAMC,EAAiBF,GAAM,UAC7B,OACER,EAACb,EAAA,CACC,OAAO,QACP,GAAIqB,EACJ,WAAY,CACV,GAAI,CAAE,MAAO,EAAG,SAAUF,CAAS,CACrC,EACA,QAASF,EACR,GAAGK,EAEJ,UAAAT,EAACR,EAAA,CAAO,UAAU,MAAO,GAAGW,EAC1B,UAAAP,EAACR,EAAA,CACC,aAAW,wBACX,cAAY,mBACZ,KAAK,QACL,QAASgB,EAET,SAAAR,EAACe,EAAA,CAAK,KAAK,oBAAoB,MAAO,GAAI,EAC5C,EAEAf,EAACF,EAAA,CAAa,SAAAQ,EAAY,GAC5B,EACAN,EAACgB,EAAA,CACC,SAAAhB,EAACP,EAAA,CAAM,EAAG,EAAI,GAAGgB,EACd,SAAAR,EACH,EACF,EAECU,GACCX,EAACG,EAAA,CAAQ,aAAc,CAAE,GAAGD,EAAc,GAAIY,CAAe,EAC1D,SAAAH,EACH,GAEJ,CAEJ,EAEOM,EAAQZ","sourcesContent":["import MuiDrawer from '@mui/material/Drawer';\nimport IconButton from '@mui/material/IconButton';\nimport Stack from '@mui/material/Stack';\n\nimport Icon from '../Icon';\nimport Scrollbar from '../Scrollbar';\n\nimport Actions from './Actions';\nimport { DrawerProps } from './props';\nimport { Header, HeaderTitle } from './styles';\n\nconst Drawer = ({\n headerTitle,\n headerProps,\n onClose,\n children,\n contentProps,\n maxWidth = 684,\n actions,\n actionsProps,\n id,\n ...other\n}: DrawerProps) => {\n const DRAWER_ACTIONS = id || '' + 'actions';\n return (\n <MuiDrawer\n anchor=\"right\"\n id={id}\n PaperProps={{\n sx: { width: 1, maxWidth: maxWidth },\n }}\n onClose={onClose}\n {...other}\n >\n <Header direction=\"row\" {...headerProps}>\n <IconButton\n aria-label=\"Fechar gaveta lateral\"\n data-testid=\"close-drawer-btn\"\n size=\"small\"\n onClick={onClose}\n >\n <Icon icon=\"CLOSE_MARK_BUTTON\" width={18} />\n </IconButton>\n\n <HeaderTitle>{headerTitle}</HeaderTitle>\n </Header>\n <Scrollbar>\n <Stack p={3} {...contentProps}>\n {children}\n </Stack>\n </Scrollbar>\n\n {actions && (\n <Actions actionsProps={{ ...actionsProps, id: DRAWER_ACTIONS }}>\n {actions}\n </Actions>\n )}\n </MuiDrawer>\n );\n};\n\nexport default Drawer;\n","import DialogActions from '@mui/material/DialogActions';\nimport Stack from '@mui/material/Stack';\nimport { styled } from '@mui/material/styles';\n\nexport const Header = styled(Stack)(({ theme }) => ({\n alignItems: 'center',\n borderBottom: `1px solid ${theme.palette.grey[300]}`,\n padding: '22px 20px',\n gap: 16,\n}));\n\nexport const HeaderTitle = styled(Stack)(({ theme }) => ({\n flexDirection: 'row',\n alignItems: 'center',\n gap: 8,\n flex: 1,\n fontSize: theme.typography.subtitle1.fontSize,\n fontWeight: theme.typography.subtitle1.fontWeight,\n fontFamily: theme.typography.fontFamily,\n}));\n\nexport const Actions = styled(DialogActions)(({ theme }) => ({\n borderTop: `1px solid ${theme.palette.divider}`,\n backgroundColor: theme.palette.background.paper,\n}));\n","import { PropsWithChildren } from 'react';\n\nimport { DrawerActionsProps } from './props';\nimport { Actions as ActionsElem } from './styles';\n\nconst Actions = ({\n children,\n actionsProps,\n}: PropsWithChildren<DrawerActionsProps>) => {\n return (\n <ActionsElem data-testid=\"drawer-actions\" {...actionsProps}>\n {children}\n </ActionsElem>\n );\n};\n\nexport default Actions;\n"]}
@@ -0,0 +1,8 @@
1
+ import a from '@mui/material/Stack';
2
+ import { styled } from '@mui/material/styles';
3
+ import { jsx } from 'react/jsx-runtime';
4
+
5
+ var o=styled(a)(({theme:r})=>({backgroundColor:r.palette.background.paper,border:`1px solid ${r.palette.divider}`,borderRadius:12}));var d=({children:r,...p})=>jsx(o,{borderRadius:2,gap:1.25,p:3,...p,children:r}),m=d;
6
+
7
+ export { m as a };
8
+ //# sourceMappingURL=chunk-DRGARBKB.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/SimpleCard/styles.ts","../src/components/SimpleCard/index.tsx"],"names":["Stack","styled","Card","theme","jsx","SimpleCard","children","props","SimpleCard_default"],"mappings":"AAAA,OAAOA,MAA2B,sBAClC,OAAS,UAAAC,MAAc,uBAEhB,IAAMC,EAAOD,EAAOD,CAAK,EAAc,CAAC,CAAE,MAAAG,CAAM,KAAO,CAC5D,gBAAiBA,EAAM,QAAQ,WAAW,MAC1C,OAAQ,aAAaA,EAAM,QAAQ,UACnC,aAAc,EAChB,EAAE,ECDE,cAAAC,MAAA,oBAFJ,IAAMC,EAAa,CAAC,CAAE,SAAAC,EAAU,GAAGC,CAAM,IAErCH,EAACF,EAAA,CAAK,aAAc,EAAG,IAAK,KAAM,EAAG,EAAI,GAAGK,EACzC,SAAAD,EACH,EAIGE,EAAQH","sourcesContent":["import Stack, { StackProps } from '@mui/material/Stack';\nimport { styled } from '@mui/material/styles';\n\nexport const Card = styled(Stack)<StackProps>(({ theme }) => ({\n backgroundColor: theme.palette.background.paper,\n border: `1px solid ${theme.palette.divider}`,\n borderRadius: 12,\n}));\n","import { StackProps } from '@mui/material/Stack';\n\nimport { Card } from './styles';\n\nconst SimpleCard = ({ children, ...props }: StackProps) => {\n return (\n <Card borderRadius={2} gap={1.25} p={3} {...props}>\n {children}\n </Card>\n );\n};\n\nexport default SimpleCard;\n"]}
@@ -0,0 +1,4 @@
1
+ var n=["Jan","Fev","Mar","Abr","Mai","Jun","Jul","Ago","Set","Out","Nov","Dez"],e=["Janeiro","Fevereiro","Mar\xE7o","Abril","Maio","Junho","Julho","Agosto","Setembro","Outubro","Novembro","Dezembro"],s=t=>{let r=String(t).split("-");if(r.length===2){let o=parseInt(r[1],10)-1;return n[o]??t}return t},i=t=>{let r=String(t).split("-");return r.length===3?String(parseInt(r[2],10)):t};
2
+
3
+ export { n as a, e as b, s as c, i as d };
4
+ //# sourceMappingURL=chunk-FYG3YWFZ.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/utils/chart.ts"],"names":["MONTH_SHORT_LABELS","MONTH_FULL_LABELS","formatMonthLabel","label","parts","monthIndex","formatDayLabel"],"mappings":"AAAO,IAAMA,EAAqB,CAChC,MACA,MACA,MACA,MACA,MACA,MACA,MACA,MACA,MACA,MACA,MACA,KACF,EAEaC,EAAoB,CAC/B,UACA,YACA,WACA,QACA,OACA,QACA,QACA,SACA,WACA,UACA,WACA,UACF,EAEaC,EAAoBC,GAA0B,CACzD,IAAMC,EAAQ,OAAOD,CAAK,EAAE,MAAM,GAAG,EAErC,GAAIC,EAAM,SAAW,EAAG,CACtB,IAAMC,EAAa,SAASD,EAAM,CAAC,EAAG,EAAE,EAAI,EAC5C,OAAOJ,EAAmBK,CAAU,GAAKF,EAG3C,OAAOA,CACT,EAEaG,EAAkBH,GAA0B,CACvD,IAAMC,EAAQ,OAAOD,CAAK,EAAE,MAAM,GAAG,EAErC,OAAIC,EAAM,SAAW,EAAU,OAAO,SAASA,EAAM,CAAC,EAAG,EAAE,CAAC,EAErDD,CACT","sourcesContent":["export const MONTH_SHORT_LABELS = [\n 'Jan',\n 'Fev',\n 'Mar',\n 'Abr',\n 'Mai',\n 'Jun',\n 'Jul',\n 'Ago',\n 'Set',\n 'Out',\n 'Nov',\n 'Dez',\n];\n\nexport const MONTH_FULL_LABELS = [\n 'Janeiro',\n 'Fevereiro',\n 'Março',\n 'Abril',\n 'Maio',\n 'Junho',\n 'Julho',\n 'Agosto',\n 'Setembro',\n 'Outubro',\n 'Novembro',\n 'Dezembro',\n];\n\nexport const formatMonthLabel = (label: string): string => {\n const parts = String(label).split('-');\n\n if (parts.length === 2) {\n const monthIndex = parseInt(parts[1], 10) - 1;\n return MONTH_SHORT_LABELS[monthIndex] ?? label;\n }\n\n return label;\n};\n\nexport const formatDayLabel = (label: string): string => {\n const parts = String(label).split('-');\n\n if (parts.length === 3) return String(parseInt(parts[2], 10));\n\n return label;\n};\n"]}
@@ -0,0 +1,8 @@
1
+ import { a } from './chunk-5J35UAV6.js';
2
+ import { a as a$1 } from './chunk-2GTD4JW2.js';
3
+ import { jsx } from 'react/jsx-runtime';
4
+
5
+ var f=({text:i,icon:l="INFO_CIRCLE",width:p,color:c="text.secondary",...e})=>jsx(a,{title:i,...e,children:jsx(a$1,{icon:l,width:p,color:c})}),m=f;
6
+
7
+ export { m as a };
8
+ //# sourceMappingURL=chunk-J5XGGHQ7.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/InfoCircle/index.tsx"],"names":["jsx","InfoCircle","text","icon","width","color","props","Tooltip_default","Icon_default","InfoCircle_default"],"mappings":"gFAcM,cAAAA,MAAA,oBATN,IAAMC,EAAa,CAAC,CAClB,KAAAC,EACA,KAAAC,EAAO,cACP,MAAAC,EACA,MAAAC,EAAQ,iBACR,GAAGC,CACL,IAEIN,EAACO,EAAA,CAAQ,MAAOL,EAAO,GAAGI,EACxB,SAAAN,EAACQ,EAAA,CAAK,KAAML,EAAM,MAAOC,EAAO,MAAOC,EAAO,EAChD,EAIGI,EAAQR","sourcesContent":["import Icon from 'components/Icon';\nimport Tooltip from 'components/Tooltip';\n\nimport { InfoCircleProps } from './props';\n\nconst InfoCircle = ({\n text,\n icon = 'INFO_CIRCLE',\n width,\n color = 'text.secondary',\n ...props\n}: InfoCircleProps) => {\n return (\n <Tooltip title={text} {...props}>\n <Icon icon={icon} width={width} color={color} />\n </Tooltip>\n );\n};\n\nexport default InfoCircle;\n"]}
@@ -1,9 +1,9 @@
1
1
  import { a } from './chunk-373WGZZL.js';
2
+ import { a as a$5 } from './chunk-WUFEPE2G.js';
2
3
  import { c, b as b$1 } from './chunk-BX2DSNRV.js';
3
4
  import { a as a$1, e } from './chunk-X4F3O7PX.js';
4
5
  import { a as a$3, b } from './chunk-Q2AVS24Z.js';
5
6
  import { p, r, a as a$2 } from './chunk-YPL4KIKN.js';
6
- import { a as a$5 } from './chunk-WUFEPE2G.js';
7
7
  import { d, a as a$4 } from './chunk-GLRLKFPS.js';
8
8
  import { useEffect, useMemo } from 'react';
9
9
  import M from '@mui/material/CssBaseline';
@@ -14,4 +14,4 @@ import { jsx, jsxs } from 'react/jsx-runtime';
14
14
  var W=t=>({lighter:lighten(t,.815),light:lighten(t,.225),main:t,dark:darken(t,.15),darker:darken(t,.35),contrastText:"#000"});function x(t,o,r$1="app"){let e$1=W(o.primaryColor),m=F(p);a(m,"dark.palette.primary",e$1),a(m,"light.palette.primary",e$1);let a$4={mode:o.colorScheme,colorSchemes:m,shadows:a$1(o.colorScheme),customShadows:r(o.colorScheme,e$1.main),shape:{borderRadius:8},components:a$2,typography:{...e,fontFamily:d(o.fontFamily)},cssVarPrefix:r$1,shouldSkipGeneratingVar:I},s=a$3(a$4,o);return experimental_extendTheme(s,t,b(o))}function I(t,o){let r=["mixins","overlays","direction","breakpoints","cssVarPrefix","unstable_sxConfig","typography","colorSchemes"],e={global:["tonalOffset","dividerChannel","contrastThreshold"],grey:["A100","A200","A400","A700"],text:["icon"]};if(t[0]==="palette"){let a=t[1],s=e[a]||e.global;return t.some(i=>s?.includes(i))}return t.some(a=>r?.includes(a))}var $=({children:t,primaryColor:o="#4E5BEC",cssVarPrefix:r="app"})=>{let{settings:e}=b$1();useEffect(()=>{localStorage.setItem(`${e.storageKey}`,e.colorScheme),localStorage.setItem(`${e.storageKey}-light`,"light"),localStorage.setItem(`${e.storageKey}-dark`,"dark");},[e.storageKey,e.colorScheme]);let m=useMemo(()=>{let s=x(a$5[1].systemValue,{primaryColor:o,colorScheme:e.colorScheme,contrast:e.contrast,navLayout:e.navLayout,navColor:e.navColor,compactLayout:e.compactLayout,fontFamily:e.fontFamily,storageKey:e.storageKey},r);return s.palette=s.colorSchemes?.[e.colorScheme]?.palette,s},[e,o,r]),a=useMemo(()=>({theme:m,mode:e.colorScheme,defaultMode:e.colorScheme,defaultColorScheme:e.colorScheme,modeStorageKey:e.storageKey,colorSchemeStorageKey:e.storageKey,attribute:a$4.ATTRIBUTE}),[m,e.colorScheme,e.storageKey]);return jsxs(Experimental_CssVarsProvider,{...a,children:[jsx(M,{enableColorScheme:!0}),jsx(B,{children:t})]})},B=({children:t})=>{let{settings:o,updateSettings:r}=b$1(),{mode:e,setMode:m}=useColorScheme();return useEffect(()=>{let a=o.colorScheme;document?.documentElement.setAttribute(a$4.ATTRIBUTE,a),m(a);},[o.colorScheme,m]),useEffect(()=>{e!==o.colorScheme&&r({colorScheme:e==="system"?o.colorScheme:e});},[e,o.colorScheme,r]),t},w=({children:t,cssVarPrefix:o,primaryColor:r="#4E5BEC",fontFamily:e="Public Sans",compactLayout:m=!0,contrast:a="default",navColor:s="integrate",navLayout:i="vertical",colorScheme:A="light"})=>{let k=`${o?`${o}-`:""}${a$4.STORAGE_KEY}`;return jsx(c,{primaryColor:r,fontFamily:e,compactLayout:m,contrast:a,navColor:s,navLayout:i,colorScheme:A,cssVarPrefix:o,storageKey:k,children:jsx($,{primaryColor:r,cssVarPrefix:o,children:t})})};var te=w;
15
15
 
16
16
  export { x as a, te as b };
17
- //# sourceMappingURL=chunk-NWT5TUJO.js.map
17
+ //# sourceMappingURL=chunk-JM3SE72J.js.map
@@ -0,0 +1,7 @@
1
+ import { useState } from 'react';
2
+ import { useGridApiRef } from '@mui/x-data-grid-premium';
3
+
4
+ var R=({page:c,perPage:g,dir:o,search:p,searchValue:u,sort:d}={page:0,perPage:25})=>{let t=useGridApiRef(),[s,r]=useState({page:c,perPage:g,dir:o,search:p,searchValue:u,sort:d}),i=({pageSize:e=25,page:a=0})=>{r(n=>({...n,page:a,perPage:e}));},l=e=>r(a=>({...a,page:0,search:e})),f=e=>r(a=>({...a,searchValue:e})),h=()=>r(e=>({...e,page:0,search:e.searchValue})),m=(e,a)=>r(n=>({...n,sort:e,dir:a})),P=()=>{t.current&&t.current.setPage(0),i({page:0});};return {...s,apiRef:t,page:s.page||0,perPage:s.perPage||25,handlePaginationModelChange:i,handleSearch:l,handleSort:m,handleSearchValue:f,applySearchValue:h,goToPageFirstPage:P}},M=R;
5
+
6
+ export { M as a };
7
+ //# sourceMappingURL=chunk-RMYYQLRJ.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/hooks/useDatagrid.ts"],"names":["useState","useGridApiRef","useDatagrid","page","perPage","dir","search","searchValue","sort","apiRef","state","setState","handlePaginationModelChange","pageSize","handleSearch","handleSearchValue","applySearchValue","handleSort","field","goToPageFirstPage","useDatagrid_default"],"mappings":"AAAA,OAA2B,YAAAA,MAAgB,QAC3C,OAAS,iBAAAC,MAAqB,2BAY9B,IAAMC,EAAc,CAClB,CAAE,KAAAC,EAAM,QAAAC,EAAS,IAAAC,EAAK,OAAAC,EAAQ,YAAAC,EAAa,KAAAC,CAAK,EAAW,CACzD,KAAM,EACN,QAAS,EACX,IACG,CACH,IAAMC,EAASR,EAAc,EACvB,CAACS,EAAOC,CAAQ,EAAIX,EAAgB,CACxC,KAAAG,EACA,QAAAC,EACA,IAAAC,EACA,OAAAC,EACA,YAAAC,EACA,KAAAC,CACF,CAAC,EAEKI,EAA8B,CAAC,CAAE,SAAAC,EAAW,GAAI,KAAAV,EAAO,CAAE,IAAM,CACnEQ,EAASD,IAAU,CAAE,GAAGA,EAAO,KAAAP,EAAM,QAASU,CAAS,EAAE,CAC3D,EAEMC,EAAgBR,GACpBK,EAASD,IAAU,CAAE,GAAGA,EAAO,KAAM,EAAG,OAAAJ,CAAO,EAAE,EAE7CS,EAAqBT,GACzBK,EAASD,IAAU,CAAE,GAAGA,EAAO,YAAaJ,CAAO,EAAE,EAEjDU,EAAmB,IACvBL,EAASD,IAAU,CAAE,GAAGA,EAAO,KAAM,EAAG,OAAQA,EAAM,WAAY,EAAE,EAEhEO,EAAa,CAACC,EAAgBb,IAClCM,EAASD,IAAU,CAAE,GAAGA,EAAO,KAAMQ,EAAO,IAAAb,CAAI,EAAE,EAE9Cc,EAAoB,IAAM,CAC1BV,EAAO,SAASA,EAAO,QAAQ,QAAQ,CAAC,EAC5CG,EAA4B,CAAE,KAAM,CAAE,CAAC,CACzC,EAEA,MAAO,CACL,GAAGF,EACH,OAAQD,EACR,KAAMC,EAAM,MAAQ,EACpB,QAASA,EAAM,SAAW,GAC1B,4BAAAE,EACA,aAAAE,EACA,WAAAG,EACA,kBAAAF,EACA,iBAAAC,EACA,kBAAAG,CACF,CACF,EAEOC,EAAQlB","sourcesContent":["import { MutableRefObject, useState } from 'react';\nimport { useGridApiRef } from '@mui/x-data-grid-premium';\nimport { GridApiPremium } from '@mui/x-data-grid-premium/models/gridApiPremium';\n\ninterface State {\n page?: number;\n perPage?: number;\n search?: string;\n searchValue?: string;\n sort?: string;\n dir?: 'asc' | 'desc';\n}\n\nconst useDatagrid = (\n { page, perPage, dir, search, searchValue, sort }: State = {\n page: 0,\n perPage: 25,\n },\n) => {\n const apiRef = useGridApiRef();\n const [state, setState] = useState<State>({\n page,\n perPage,\n dir,\n search,\n searchValue,\n sort,\n });\n\n const handlePaginationModelChange = ({ pageSize = 25, page = 0 }) => {\n setState(state => ({ ...state, page, perPage: pageSize }));\n };\n\n const handleSearch = (search: string | undefined) =>\n setState(state => ({ ...state, page: 0, search }));\n\n const handleSearchValue = (search: string | undefined) =>\n setState(state => ({ ...state, searchValue: search }));\n\n const applySearchValue = () =>\n setState(state => ({ ...state, page: 0, search: state.searchValue }));\n\n const handleSort = (field?: string, dir?: 'asc' | 'desc') =>\n setState(state => ({ ...state, sort: field, dir }));\n\n const goToPageFirstPage = () => {\n if (apiRef.current) apiRef.current.setPage(0);\n handlePaginationModelChange({ page: 0 });\n };\n\n return {\n ...state,\n apiRef: apiRef as MutableRefObject<GridApiPremium>,\n page: state.page || 0,\n perPage: state.perPage || 25,\n handlePaginationModelChange,\n handleSearch,\n handleSort,\n handleSearchValue,\n applySearchValue,\n goToPageFirstPage,\n };\n};\n\nexport default useDatagrid;\n"]}
@@ -0,0 +1,14 @@
1
+ import { a } from './chunk-2GTD4JW2.js';
2
+ import e from '@mui/material/Box';
3
+ import f from '@mui/material/Card';
4
+ import b from '@mui/material/CardHeader';
5
+ import w from '@mui/material/Checkbox';
6
+ import r from '@mui/material/Stack';
7
+ import { styled } from '@mui/material/styles';
8
+ import g from '@mui/material/Typography';
9
+ import { jsxs, jsx } from 'react/jsx-runtime';
10
+
11
+ var y=styled(f)(({theme:o})=>({width:"100%",border:`1px solid ${o.palette.divider}`,boxShadow:"none",overflow:"visible"})),k=styled(b)(({theme:o})=>({[o.breakpoints.down("sm")]:{flexWrap:"wrap",gap:o.spacing(2),"& .MuiCardHeader-action":{width:"100%"}}})),S=styled(r)({position:"relative",width:"100%",overflow:"visible","& .recharts-wrapper, & .recharts-wrapper *":{outline:"none !important",boxShadow:"none !important",WebkitTapHighlightColor:"transparent"}}),v=styled(e)(({theme:o})=>({backgroundColor:o.palette.background.paper,border:"1px solid",borderColor:o.palette.divider,borderRadius:o.shape.borderRadius,padding:o.spacing(1.5),boxShadow:o.shadows[3]})),T=styled(e)(({theme:o})=>({width:"100%",height:"1px",backgroundColor:o.palette.divider,marginBottom:o.spacing(1.5)})),D=styled(e,{shouldForwardProp:o=>o!=="dotColor"})(({dotColor:o})=>({width:10,height:10,borderRadius:"50%",backgroundColor:o})),I=styled(r)({flexDirection:"row",flexWrap:"wrap",justifyContent:"center",alignItems:"center",gap:16,marginTop:16}),H=styled(r)({flexDirection:"row",alignItems:"center",cursor:"pointer"}),R=styled(w,{shouldForwardProp:o=>o!=="checkboxColor"})(({checkboxColor:o})=>({color:o,"&.Mui-checked":{color:o},padding:4})),A=styled(r)({flexDirection:"row",alignItems:"flex-start",gap:32,marginBottom:24,flexWrap:"wrap"}),W=styled(e)(({theme:o})=>({width:"1px",height:40,backgroundColor:o.palette.divider,alignSelf:"center"})),z=styled(r)({minHeight:350,alignItems:"center",justifyContent:"center",gap:12});var L=()=>jsxs(r,{minHeight:300,alignItems:"center",justifyContent:"center",gap:1.5,children:[jsx(a,{icon:"CALENDAR_TODAY",width:60,color:"text.secondary"}),jsxs(r,{textAlign:"center",children:[jsx(g,{variant:"subtitle1",fontSize:"subtitle1.fontSize",children:"Nenhum dado dispon\xEDvel ainda"}),jsx(g,{variant:"body2",fontSize:"body2.fontSize",color:"text.secondary",children:"Assim que houver registros, os dados ser\xE3o exibidos aqui."})]})]}),J=L;var M=o=>{let{x:p,y:d,payload:a,tickFormatter:l,index:u=0,maxChars:s=10}=o;if(p==null||d==null||!a)return null;let i=l?l(a.value,u):a.value,C=i.length>s?`${i.slice(0,s)}...`:i;return jsx("g",{transform:`translate(${p},${d})`,children:jsx("text",{x:0,y:0,dy:4,textAnchor:"end",fill:"#637381",fontSize:11,transform:"rotate(-45)",children:C})})},U=M;
12
+
13
+ export { y as a, k as b, S as c, v as d, T as e, D as f, I as g, H as h, R as i, A as j, W as k, z as l, J as m, U as n };
14
+ //# sourceMappingURL=chunk-UC2R4AXD.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/Analytics/ChartStyles/styles.ts","../src/components/Analytics/EmptyState/index.tsx","../src/components/Analytics/RotatedTick/index.tsx"],"names":["Box","MuiCard","MuiCardHeader","MuiCheckbox","Stack","styled","ChartCard","theme","ChartCardHeader","ChartWrapper","TooltipContainer","TooltipDivider","TooltipDot","prop","dotColor","LegendContainer","LegendItem","ColoredCheckbox","checkboxColor","SummaryStack","SummaryDivider","EmptyStateContainer","Typography","jsx","jsxs","EmptyState","Icon_default","EmptyState_default","RotatedTick","props","x","y","payload","tickFormatter","index","maxChars","raw","label","RotatedTick_default"],"mappings":"wCAAA,OAAOA,MAAS,oBAChB,OAAOC,MAAa,qBACpB,OAAOC,MAAmB,2BAC1B,OAAOC,MAAiB,yBACxB,OAAOC,MAAW,sBAClB,OAAS,UAAAC,MAAc,uBAEhB,IAAMC,EAAYD,EAAOJ,CAAO,EAAE,CAAC,CAAE,MAAAM,CAAM,KAAO,CACvD,MAAO,OAEP,OAAQ,aAAaA,EAAM,QAAQ,UAEnC,UAAW,OACX,SAAU,SACZ,EAAE,EAEWC,EAAkBH,EAAOH,CAAa,EAAE,CAAC,CAAE,MAAAK,CAAM,KAAO,CACnE,CAACA,EAAM,YAAY,KAAK,IAAI,CAAC,EAAG,CAC9B,SAAU,OACV,IAAKA,EAAM,QAAQ,CAAC,EAEpB,0BAA2B,CACzB,MAAO,MACT,CACF,CACF,EAAE,EAEWE,EAAeJ,EAAOD,CAAK,EAAE,CACxC,SAAU,WACV,MAAO,OACP,SAAU,UAEV,6CAA8C,CAC5C,QAAS,kBACT,UAAW,kBACX,wBAAyB,aAC3B,CACF,CAAC,EAEYM,EAAmBL,EAAOL,CAAG,EAAE,CAAC,CAAE,MAAAO,CAAM,KAAO,CAC1D,gBAAiBA,EAAM,QAAQ,WAAW,MAC1C,OAAQ,YACR,YAAaA,EAAM,QAAQ,QAC3B,aAAcA,EAAM,MAAM,aAC1B,QAASA,EAAM,QAAQ,GAAG,EAC1B,UAAWA,EAAM,QAAQ,CAAC,CAC5B,EAAE,EAEWI,EAAiBN,EAAOL,CAAG,EAAE,CAAC,CAAE,MAAAO,CAAM,KAAO,CACxD,MAAO,OACP,OAAQ,MACR,gBAAiBA,EAAM,QAAQ,QAC/B,aAAcA,EAAM,QAAQ,GAAG,CACjC,EAAE,EAEWK,EAAaP,EAAOL,EAAK,CACpC,kBAAmBa,GAAQA,IAAS,UACtC,CAAC,EAAwB,CAAC,CAAE,SAAAC,CAAS,KAAO,CAC1C,MAAO,GACP,OAAQ,GACR,aAAc,MACd,gBAAiBA,CACnB,EAAE,EAEWC,EAAkBV,EAAOD,CAAK,EAAE,CAC3C,cAAe,MACf,SAAU,OACV,eAAgB,SAChB,WAAY,SACZ,IAAK,GACL,UAAW,EACb,CAAC,EAEYY,EAAaX,EAAOD,CAAK,EAAE,CACtC,cAAe,MACf,WAAY,SACZ,OAAQ,SACV,CAAC,EAEYa,EAAkBZ,EAAOF,EAAa,CACjD,kBAAmBU,GAAQA,IAAS,eACtC,CAAC,EAA6B,CAAC,CAAE,cAAAK,CAAc,KAAO,CACpD,MAAOA,EACP,gBAAiB,CAAE,MAAOA,CAAc,EACxC,QAAS,CACX,EAAE,EAEWC,EAAed,EAAOD,CAAK,EAAE,CACxC,cAAe,MACf,WAAY,aACZ,IAAK,GACL,aAAc,GACd,SAAU,MACZ,CAAC,EAEYgB,EAAiBf,EAAOL,CAAG,EAAE,CAAC,CAAE,MAAAO,CAAM,KAAO,CACxD,MAAO,MACP,OAAQ,GACR,gBAAiBA,EAAM,QAAQ,QAC/B,UAAW,QACb,EAAE,EAEWc,EAAsBhB,EAAOD,CAAK,EAAE,CAC/C,UAAW,IACX,WAAY,SACZ,eAAgB,SAChB,IAAK,EACP,CAAC,EC3GD,OAAOA,MAAW,sBAClB,OAAOkB,MAAgB,2BAYjB,cAAAC,EAEA,QAAAC,MAFA,oBARN,IAAMC,EAAa,IAEfD,EAACpB,EAAA,CACC,UAAW,IACX,WAAW,SACX,eAAe,SACf,IAAK,IAEL,UAAAmB,EAACG,EAAA,CAAK,KAAK,iBAAiB,MAAO,GAAI,MAAM,iBAAiB,EAE9DF,EAACpB,EAAA,CAAM,UAAU,SACf,UAAAmB,EAACD,EAAA,CAAW,QAAQ,YAAY,SAAS,qBAAqB,2CAE9D,EAEAC,EAACD,EAAA,CACC,QAAQ,QACR,SAAS,iBACT,MAAM,iBACP,wEAED,GACF,GACF,EAIGK,EAAQF,ECnBT,cAAAF,MAAA,oBAXN,IAAMK,EAAeC,GAA4B,CAC/C,GAAM,CAAE,EAAAC,EAAG,EAAAC,EAAG,QAAAC,EAAS,cAAAC,EAAe,MAAAC,EAAQ,EAAG,SAAAC,EAAW,EAAG,EAAIN,EACnE,GAAIC,GAAK,MAAQC,GAAK,MAAQ,CAACC,EAAS,OAAO,KAE/C,IAAMI,EAAMH,EACRA,EAAcD,EAAQ,MAAOE,CAAK,EAClCF,EAAQ,MACNK,EAAQD,EAAI,OAASD,EAAW,GAAGC,EAAI,MAAM,EAAGD,CAAQ,OAASC,EAEvE,OACEb,EAAC,KAAE,UAAW,aAAaO,KAAKC,KAC9B,SAAAR,EAAC,QACC,EAAG,EACH,EAAG,EACH,GAAI,EACJ,WAAW,MACX,KAAK,UACL,SAAU,GACV,UAAU,cAET,SAAAc,EACH,EACF,CAEJ,EAEOC,EAAQV","sourcesContent":["import Box from '@mui/material/Box';\nimport MuiCard from '@mui/material/Card';\nimport MuiCardHeader from '@mui/material/CardHeader';\nimport MuiCheckbox from '@mui/material/Checkbox';\nimport Stack from '@mui/material/Stack';\nimport { styled } from '@mui/material/styles';\n\nexport const ChartCard = styled(MuiCard)(({ theme }) => ({\n width: '100%',\n\n border: `1px solid ${theme.palette.divider}`,\n\n boxShadow: 'none',\n overflow: 'visible',\n}));\n\nexport const ChartCardHeader = styled(MuiCardHeader)(({ theme }) => ({\n [theme.breakpoints.down('sm')]: {\n flexWrap: 'wrap',\n gap: theme.spacing(2),\n\n '& .MuiCardHeader-action': {\n width: '100%',\n },\n },\n}));\n\nexport const ChartWrapper = styled(Stack)({\n position: 'relative',\n width: '100%',\n overflow: 'visible',\n\n '& .recharts-wrapper, & .recharts-wrapper *': {\n outline: 'none !important',\n boxShadow: 'none !important',\n WebkitTapHighlightColor: 'transparent',\n },\n});\n\nexport const TooltipContainer = styled(Box)(({ theme }) => ({\n backgroundColor: theme.palette.background.paper,\n border: '1px solid',\n borderColor: theme.palette.divider,\n borderRadius: theme.shape.borderRadius,\n padding: theme.spacing(1.5),\n boxShadow: theme.shadows[3],\n}));\n\nexport const TooltipDivider = styled(Box)(({ theme }) => ({\n width: '100%',\n height: '1px',\n backgroundColor: theme.palette.divider,\n marginBottom: theme.spacing(1.5),\n}));\n\nexport const TooltipDot = styled(Box, {\n shouldForwardProp: prop => prop !== 'dotColor',\n})<{ dotColor: string }>(({ dotColor }) => ({\n width: 10,\n height: 10,\n borderRadius: '50%',\n backgroundColor: dotColor,\n}));\n\nexport const LegendContainer = styled(Stack)({\n flexDirection: 'row',\n flexWrap: 'wrap',\n justifyContent: 'center',\n alignItems: 'center',\n gap: 16,\n marginTop: 16,\n});\n\nexport const LegendItem = styled(Stack)({\n flexDirection: 'row',\n alignItems: 'center',\n cursor: 'pointer',\n});\n\nexport const ColoredCheckbox = styled(MuiCheckbox, {\n shouldForwardProp: prop => prop !== 'checkboxColor',\n})<{ checkboxColor: string }>(({ checkboxColor }) => ({\n color: checkboxColor,\n '&.Mui-checked': { color: checkboxColor },\n padding: 4,\n}));\n\nexport const SummaryStack = styled(Stack)({\n flexDirection: 'row',\n alignItems: 'flex-start',\n gap: 32,\n marginBottom: 24,\n flexWrap: 'wrap',\n});\n\nexport const SummaryDivider = styled(Box)(({ theme }) => ({\n width: '1px',\n height: 40,\n backgroundColor: theme.palette.divider,\n alignSelf: 'center',\n}));\n\nexport const EmptyStateContainer = styled(Stack)({\n minHeight: 350,\n alignItems: 'center',\n justifyContent: 'center',\n gap: 12,\n});\n","import Stack from '@mui/material/Stack';\nimport Typography from '@mui/material/Typography';\n\nimport Icon from 'components/Icon';\n\nconst EmptyState = () => {\n return (\n <Stack\n minHeight={300}\n alignItems=\"center\"\n justifyContent=\"center\"\n gap={1.5}\n >\n <Icon icon=\"CALENDAR_TODAY\" width={60} color=\"text.secondary\" />\n\n <Stack textAlign=\"center\">\n <Typography variant=\"subtitle1\" fontSize=\"subtitle1.fontSize\">\n Nenhum dado disponível ainda\n </Typography>\n\n <Typography\n variant=\"body2\"\n fontSize=\"body2.fontSize\"\n color=\"text.secondary\"\n >\n Assim que houver registros, os dados serão exibidos aqui.\n </Typography>\n </Stack>\n </Stack>\n );\n};\n\nexport default EmptyState;\n","import { RotatedTickProps } from './props';\n\nconst RotatedTick = (props: RotatedTickProps) => {\n const { x, y, payload, tickFormatter, index = 0, maxChars = 10 } = props;\n if (x == null || y == null || !payload) return null;\n\n const raw = tickFormatter\n ? tickFormatter(payload.value, index)\n : payload.value;\n const label = raw.length > maxChars ? `${raw.slice(0, maxChars)}...` : raw;\n\n return (\n <g transform={`translate(${x},${y})`}>\n <text\n x={0}\n y={0}\n dy={4}\n textAnchor=\"end\"\n fill=\"#637381\"\n fontSize={11}\n transform=\"rotate(-45)\"\n >\n {label}\n </text>\n </g>\n );\n};\n\nexport default RotatedTick;\n"]}
@@ -0,0 +1,4 @@
1
+ var e=(L=>(L.MONTHLY="MONTHLY",L.DAILY="DAILY",L))(e||{}),M={["MONTHLY"]:"Mensal",["DAILY"]:"Di\xE1rio"},D=(L=>(L.XLSX="XLSX",L.PDF="PDF",L))(D||{});
2
+
3
+ export { e as a, M as b, D as c };
4
+ //# sourceMappingURL=chunk-Y2SILVOR.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/types/analytics.ts"],"names":["ViewMode","VIEW_MODE_LABELS","ExportFormat"],"mappings":"AAAO,IAAKA,OACVA,EAAA,QAAU,UACVA,EAAA,MAAQ,QAFEA,OAAA,IAKCC,EAA6C,CACxD,CAAC,SAAgB,EAAG,SACpB,CAAC,OAAc,EAAG,WACpB,EAEYC,OACVA,EAAA,KAAO,OACPA,EAAA,IAAM,MAFIA,OAAA","sourcesContent":["export enum ViewMode {\n MONTHLY = 'MONTHLY',\n DAILY = 'DAILY',\n}\n\nexport const VIEW_MODE_LABELS: Record<ViewMode, string> = {\n [ViewMode.MONTHLY]: 'Mensal',\n [ViewMode.DAILY]: 'Diário',\n};\n\nexport enum ExportFormat {\n XLSX = 'XLSX',\n PDF = 'PDF',\n}\n"]}
@@ -0,0 +1,54 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { ComponentType, ReactNode } from 'react';
3
+ import { ViewMode } from '../../../types/analytics.js';
4
+ import { QuotationDashboardSeriesItem, OverviewDetailBaseProps, OverviewDetailProps, RevenueGoalDashboardSeriesItem, RevenueGoalDashboardKpis, SalesForecastDashboardSeriesItem } from '../../../types/overviewAnalytics.js';
5
+ import { GridQuery } from '../../../types/filter.js';
6
+ import '../../../types/entityMetadata.js';
7
+
8
+ interface OrdersByTypeProps {
9
+ data: QuotationDashboardSeriesItem[];
10
+ viewMode: ViewMode;
11
+ selectedYear: number;
12
+ DetailComponent?: ComponentType<OverviewDetailBaseProps>;
13
+ }
14
+
15
+ declare const OrdersByType: ({ data, viewMode, selectedYear, DetailComponent, }: OrdersByTypeProps) => react_jsx_runtime.JSX.Element;
16
+
17
+ declare const OverviewDetail: ({ open, onClose, title, viewMode, selectedYear, totalValue, periodLabel, suffix, rows, total, isLoading, isFetching, page, perPage, onSearch, onPaginationChange, buildPartnerLink, mobileItemSlot, }: OverviewDetailProps) => react_jsx_runtime.JSX.Element;
18
+
19
+ declare const useOverviewDetailState: (label: string, viewMode: ViewMode) => {
20
+ page: number;
21
+ perPage: number;
22
+ periodLabel: string;
23
+ suffix: string;
24
+ queryParams: GridQuery;
25
+ handleSearch: (search: string | undefined) => void;
26
+ handlePaginationChange: (newPage: number, rowsPerPage: number) => void;
27
+ };
28
+
29
+ declare const getDateRange: (label: string, viewMode: ViewMode) => {
30
+ startDate: string;
31
+ endDate: string;
32
+ };
33
+ declare const getPeriodLabel: (label: string, viewMode: ViewMode) => string;
34
+ declare const getPeriodSuffix: (viewMode: ViewMode) => string;
35
+
36
+ interface SalesEvolutionProps {
37
+ data: RevenueGoalDashboardSeriesItem[];
38
+ kpis?: RevenueGoalDashboardKpis;
39
+ viewMode: ViewMode;
40
+ selectedYear: number;
41
+ editGoalAction?: ReactNode;
42
+ DetailComponent?: ComponentType<OverviewDetailBaseProps>;
43
+ }
44
+
45
+ declare const SalesEvolution: ({ data, kpis, viewMode, selectedYear, editGoalAction, DetailComponent, }: SalesEvolutionProps) => react_jsx_runtime.JSX.Element;
46
+
47
+ interface SalesForecastProps {
48
+ data: SalesForecastDashboardSeriesItem[];
49
+ viewMode: ViewMode;
50
+ }
51
+
52
+ declare const SalesForecast: ({ data, viewMode }: SalesForecastProps) => react_jsx_runtime.JSX.Element;
53
+
54
+ export { OrdersByType, OrdersByTypeProps, OverviewDetail, OverviewDetailBaseProps, OverviewDetailProps, SalesEvolution, SalesEvolutionProps, SalesForecast, SalesForecastProps, getDateRange, getPeriodLabel, getPeriodSuffix, useOverviewDetailState };
@@ -0,0 +1,47 @@
1
+ import { b, c, d as d$3 } from '../../../chunk-FYG3YWFZ.js';
2
+ import { a, m, c as c$1, n } from '../../../chunk-UC2R4AXD.js';
3
+ import { b as b$2 } from '../../../chunk-Y2SILVOR.js';
4
+ import { a as a$7 } from '../../../chunk-DRGARBKB.js';
5
+ import { a as a$6 } from '../../../chunk-J5XGGHQ7.js';
6
+ import { a as a$4 } from '../../../chunk-J5B2YJSR.js';
7
+ import { a as a$3 } from '../../../chunk-CBW32OUQ.js';
8
+ import { d as d$2 } from '../../../chunk-N7IK5EUP.js';
9
+ import { h, d as d$1, c as c$2 } from '../../../chunk-OF6623HG.js';
10
+ import { d } from '../../../chunk-Z275MVEP.js';
11
+ import { a as a$2 } from '../../../chunk-R2BCPHRH.js';
12
+ import { a as a$1 } from '../../../chunk-4F2NKGF6.js';
13
+ import '../../../chunk-NMGWHSNZ.js';
14
+ import '../../../chunk-6U5LS7MP.js';
15
+ import '../../../chunk-LZQ7OFKO.js';
16
+ import '../../../chunk-NIQW2J3M.js';
17
+ import '../../../chunk-PRWQQJDL.js';
18
+ import '../../../chunk-5J35UAV6.js';
19
+ import '../../../chunk-XUDTPZHF.js';
20
+ import '../../../chunk-UVPQR2Q2.js';
21
+ import '../../../chunk-RBTYTONM.js';
22
+ import '../../../chunk-F65ZXAGV.js';
23
+ import '../../../chunk-I4PPSW36.js';
24
+ import '../../../chunk-CO2KQFUN.js';
25
+ import '../../../chunk-2GTD4JW2.js';
26
+ import '../../../chunk-PBLSVXV5.js';
27
+ import '../../../chunk-LQRRMVFN.js';
28
+ import { b as b$1 } from '../../../chunk-2ZJUGM2S.js';
29
+ import '../../../chunk-GLRLKFPS.js';
30
+ import { a as a$5 } from '../../../chunk-RMYYQLRJ.js';
31
+ import { useState, useCallback, useMemo, useRef } from 'react';
32
+ import mt from '@mui/material/CardContent';
33
+ import dt from '@mui/material/CardHeader';
34
+ import L from '@mui/material/Stack';
35
+ import { ResponsiveContainer, BarChart, CartesianGrid, XAxis, YAxis, Tooltip, Bar, ComposedChart, Line } from 'recharts';
36
+ import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
37
+ import ue from '@mui/material/Divider';
38
+ import T from '@mui/material/Typography';
39
+ import He from '@mui/material/Checkbox';
40
+ import Ke from '@mui/material/FormControlLabel';
41
+ import xt from '@mui/material/Link';
42
+ import { styled, alpha } from '@mui/material/styles';
43
+
44
+ var ee={orders:"#22C55E",quotations:"#0EA5E9"};var Yo=({x:e=0,y:o=0,width:t=0,height:r=0,index:a,activeBarIndex:i})=>i!==a?null:jsx("rect",{x:e-6,y:o,width:t+12,height:r+6,fill:"#919EAB",opacity:.16,rx:6}),Re=Yo;var qo=({x:e=0,y:o=0,width:t=0,index:r=0,data:a,visibleSeries:i,isMonthly:n,shouldRotateLabels:l})=>{if(!n||l)return null;let c=a[r];if(!c)return null;let s=0;return i.orders&&(s+=c.order_count??0),i.quotations&&(s+=c.quotation_count??0),s?jsx("text",{x:e+t/2,y:o-8,textAnchor:"middle",fontSize:11,fill:"#212B36",children:s}):null},Oe=qo;var Qo=({active:e,payload:o,label:t,viewMode:r})=>{if(!e||!o?.length)return null;let a=r==="DAILY",i=String(t),n=i.split("-");if(n.length>=2){let s=parseInt(n[1],10)-1,p=b[s];a&&n.length===3?i=`${parseInt(n[2],10)} de ${p} de ${n[0]}`:a||(i=`${p} de ${n[0]}`);}let l=o[0].payload,c=[{name:"Vendas",count:l.order_count??0,value:l.order_value??0,color:o.find(s=>s.dataKey==="order_count")?.color??"#22C55E"},{name:"Or\xE7amentos",count:l.quotation_count??0,value:l.quotation_value??0,color:o.find(s=>s.dataKey==="quotation_count")?.color??"#0EA5E9"}];return jsxs(a$7,{minWidth:{xs:"auto",sm:300},p:1,gap:1,children:[jsx(T,{variant:"body2",fontSize:"body2.fontSize",color:"text.secondary",children:i}),jsx(ue,{}),jsx(L,{children:c.map((s,p)=>jsxs(L,{direction:"row",alignItems:"center",justifyContent:"space-between",gap:2,"data-testid":`tooltip-item-${p}`,children:[jsxs(L,{direction:"row",alignItems:"center",gap:1,children:[jsx(L,{width:6,height:6,borderRadius:"50%",bgcolor:s.color}),jsx(T,{variant:"body2",fontSize:"body2.fontSize",noWrap:!0,children:s.name})]}),jsxs(T,{variant:"body2",fontSize:"body2.fontSize",color:"text.disabled",noWrap:!0,children:[s.count," ",s.count===1?"pedido":"pedidos","\u2002",jsx(T,{component:"span",variant:"body2",fontSize:"body2.fontSize",color:"text.primary",children:h(s.value)})]})]},s.name))})]})},mo=Qo;var at=({data:e,viewMode:o,visibleSeries:t,activeBarIndex:r,onMouseMove:a,onMouseLeave:i,onBarClick:n$1})=>{let l=o==="MONTHLY",[c$2,s]=useState(0),p=useRef(null),m=useCallback(d=>{p.current&&(p.current.disconnect(),p.current=null),d&&(s(d.clientWidth),p.current=new ResizeObserver(()=>s(d.clientWidth)),p.current.observe(d));},[]),y=useMemo(()=>!l||c$2===0||e.length===0?!1:(c$2-60)/e.length<80,[l,c$2,e.length]),C=useMemo(()=>e.some(d=>(d.order_count??0)>0),[e]),h=useMemo(()=>e.some(d=>(d.quotation_count??0)>0),[e]),v=useMemo(()=>{if(!e.length)return [0,1];let d=Math.max(...e.map(f=>(f.order_count??0)+(f.quotation_count??0)));return [0,d>0?d*1.15:1]},[e]),z=useMemo(()=>{let[,d]=v,f=d/6;return [...new Set(Array.from({length:7},(x,M)=>Math.round(f*M)))]},[v]),S=t.quotations&&h,g=t.orders&&C&&!S,B=useMemo(()=>l?c:d$3,[l]);return jsx(c$1,{ref:m,children:jsx(ResponsiveContainer,{width:"100%",height:250,children:jsxs(BarChart,{data:e,margin:{top:20,right:10,bottom:y?-90:0,left:20},barCategoryGap:"20%",style:{cursor:"pointer"},onMouseMove:a,onMouseLeave:i,onClick:d=>{d?.activeTooltipIndex!=null&&n$1?.(Number(d.activeTooltipIndex));},children:[jsx(CartesianGrid,{vertical:!1,strokeDasharray:"3 3",stroke:"#F4F6F8"}),jsx(XAxis,{dataKey:"label",axisLine:!1,tickLine:!1,...y&&{interval:0,height:120},tick:y?jsx(n,{}):{fontSize:12,fill:"#637381"},tickFormatter:B}),jsx(YAxis,{axisLine:!1,tickLine:!1,tick:{fontSize:12,fill:"#637381"},tickFormatter:d=>d$1(d),domain:v,ticks:z}),jsx(Tooltip,{content:jsx(mo,{viewMode:o}),cursor:!1}),jsx(Bar,{dataKey:"order_count",name:"Vendas",fill:ee.orders,stackId:"orders",maxBarSize:48,isAnimationActive:!1,hide:!t.orders,background:jsx(Re,{activeBarIndex:r}),radius:g?[4,4,0,0]:void 0,...g&&{label:{position:"top",fontSize:11,fill:"#212B36",content:jsx(Oe,{data:e,visibleSeries:t,isMonthly:l,shouldRotateLabels:y})}}}),jsx(Bar,{dataKey:"quotation_count",name:"Or\xE7amentos",fill:ee.quotations,stackId:"orders",maxBarSize:48,isAnimationActive:!1,hide:!t.quotations,radius:S?[4,4,0,0]:void 0,...!t.orders&&{background:jsx(Re,{activeBarIndex:r})},...S&&{label:{position:"top",fontSize:11,fill:"#212B36",content:jsx(Oe,{data:e,visibleSeries:t,isMonthly:l,shouldRotateLabels:y})}}})]})})})},uo=at;var st=({visibleSeries:e,onToggleSerie:o})=>jsxs(L,{direction:"row",justifyContent:"center",flexWrap:"wrap",gap:1,children:[jsx(Ke,{control:jsx(He,{checked:e.orders,onChange:()=>o("orders"),sx:{"&.Mui-checked":{color:ee.orders}}}),label:"Vendas"}),jsx(Ke,{control:jsx(He,{checked:e.quotations,onChange:()=>o("quotations"),sx:{"&.Mui-checked":{color:ee.quotations}}}),label:"Or\xE7amentos"})]}),So=st;var ct=({ordersTotal:e,quotationsTotal:o,isMonthly:t})=>{let r=b$1("down","md");return jsxs(L,{direction:{xs:"column",md:"row"},alignItems:{xs:"flex-start",md:"center"},flexWrap:"wrap",gap:3,children:[r&&jsx(ue,{orientation:"horizontal",flexItem:!0,sx:{borderStyle:"dashed",mx:-3}}),jsxs(L,{children:[jsx(T,{variant:"body2",fontSize:"body2.fontSize",color:"text.secondary",children:t?"Vendas no ano":"Vendas no m\xEAs"}),jsxs(T,{variant:"subtitle2",fontSize:"subtitle2.fontSize",children:[e," vendas"]})]}),jsx(ue,{orientation:r?"horizontal":"vertical",flexItem:!0,sx:{borderStyle:r?"solid":"dashed"}}),jsxs(L,{children:[jsx(T,{variant:"body2",fontSize:"body2.fontSize",color:"text.secondary",children:t?"Or\xE7amentos no ano":"Or\xE7amentos no m\xEAs"}),jsxs(T,{variant:"subtitle2",fontSize:"subtitle2.fontSize",children:[o," or\xE7amentos"]})]})]})},Ae=ct;var ft=({data:e,viewMode:o,selectedYear:t,DetailComponent:r})=>{let a$2=o==="MONTHLY",[i,n]=useState({orders:!0,quotations:!0}),[l,c]=useState(null),[s,p]=useState(!1),[m$1,y]=useState(""),[C,h]=useState(0),v=useCallback(f=>{n(x=>({...x,[f]:!x[f]}));},[]),z=useCallback(f=>{f?.activeTooltipIndex!=null&&c(Number(f.activeTooltipIndex));},[]),S=useCallback(()=>c(null),[]),g=useCallback(f=>{let x=e[f];x&&(y(x.label),h(x.order_value),p(!0));},[e]),B=useCallback(()=>{p(!1);},[]),d=useMemo(()=>{let f=e.reduce((M,N)=>M+(N.order_count??0),0),x=e.reduce((M,N)=>M+(N.quotation_count??0),0);return {ordersTotal:f,quotationsTotal:x}},[e]);return jsxs(Fragment,{children:[jsxs(a,{children:[jsx(dt,{title:"Quantidade de pedidos por tipo"}),jsx(mt,{children:jsx(a$1,{isEmpty:e.length===0,empty:jsx(m,{}),children:jsxs(L,{gap:3,children:[jsx(L,{display:{xs:"none",md:"block"},children:jsx(Ae,{isMonthly:a$2,ordersTotal:d.ordersTotal,quotationsTotal:d.quotationsTotal})}),jsx(uo,{data:e,viewMode:o,visibleSeries:i,activeBarIndex:l,onMouseMove:z,onMouseLeave:S,onBarClick:g}),jsx(So,{visibleSeries:i,onToggleSerie:v}),jsx(L,{display:{xs:"block",md:"none"},children:jsx(Ae,{isMonthly:a$2,ordersTotal:d.ordersTotal,quotationsTotal:d.quotationsTotal})})]})})})]}),m$1&&r&&jsx(r,{open:s,onClose:B,label:m$1,viewMode:o,selectedYear:t,totalValue:C})]})},ut=ft;var ht=({title:e,viewMode:o,selectedYear:t,periodLabel:r})=>jsxs(L,{width:"100%",minWidth:0,overflow:"hidden",children:[jsx(T,{variant:"subtitle1",fontSize:"subtitle1.fontSize",noWrap:!0,children:"Detalhes do relat\xF3rio"}),jsxs(L,{direction:"row",alignItems:"center",columnGap:1.5,rowGap:0,flexWrap:"wrap",children:[jsx(T,{variant:"body2",fontSize:"body2.fontSize",color:"text.secondary",flexShrink:0,children:e}),"\u2022",jsx(T,{variant:"body2",fontSize:"body2.fontSize",flexShrink:0,children:b$2[o]}),"\u2022",jsx(T,{variant:"body2",fontSize:"body2.fontSize",flexShrink:0,children:t}),"\u2022",jsx(T,{variant:"body2",fontSize:"body2.fontSize",color:"text.secondary",noWrap:!0,children:r})]})]}),xo=ht;var ko=styled(ue)(()=>({height:30,alignSelf:"center",borderStyle:"dashed"})),zo=styled(L)(({theme:e})=>({position:"relative",display:"flex",flexDirection:"column",padding:e.spacing(2),gap:e.spacing(1),color:e.palette.text.primary,"& a":{textDecoration:"none"},"&+div":{borderTop:`1px dashed ${alpha(e.palette.grey[500],.2)}`}}));var Ct=e=>jsx(L,{justifyContent:"center",height:1,children:jsx(T,{variant:"body2",fontSize:"body2.fontSize",color:"text.primary",children:e.id})}),kt=(e,o)=>jsx(L,{justifyContent:"center",height:1,children:e?.partner?.id&&o?jsx(xt,{component:"a",href:o(e.partner.id),target:"_blank",rel:"noopener noreferrer",variant:"subtitle2",fontSize:"subtitle2.fontSize",sx:{textDecoration:"underline"},noWrap:!0,children:e.partner?.name||"-"}):jsx(T,{variant:"body2",fontSize:"body2.fontSize",color:"text.primary",noWrap:!0,children:e.partner?.name||"-"})}),zt=e=>jsx(L,{justifyContent:"center",height:1,children:jsx(T,{variant:"body2",fontSize:"body2.fontSize",color:"text.primary",children:h(e.total_value)})}),Tt=e=>jsx(L,{justifyContent:"center",height:1,children:e.negotiation_date?jsx(T,{variant:"body2",fontSize:"body2.fontSize",color:"text.primary",children:d$2(e.negotiation_date,"DD/MM/YYYY")}):"-"}),Mt=e=>jsx(L,{justifyContent:"center",height:1,children:e.status||"-"}),Lt=e=>jsx(zo,{children:jsxs(L,{gap:1,children:[jsxs(L,{children:[jsx(T,{variant:"body2",fontSize:"body2.fontSize",color:"text.secondary",children:"Pedido"}),jsx(T,{variant:"subtitle2",fontSize:"subtitle2.fontSize",color:"text.primary",children:e.id})]}),jsxs(L,{children:[jsx(T,{variant:"body2",fontSize:"body2.fontSize",color:"text.secondary",children:"Cliente"}),jsx(T,{variant:"subtitle2",fontSize:"subtitle2.fontSize",color:"primary.main",children:e.partner?.name||"-"})]}),jsxs(L,{direction:"row",alignItems:"center",gap:1,children:[jsxs(L,{flex:1,overflow:"hidden",children:[jsx(T,{variant:"body2",fontSize:"body2.fontSize",color:"text.secondary",noWrap:!0,children:"Valor do pedido"}),jsx(T,{variant:"subtitle2",fontSize:"subtitle2.fontSize",color:"text.primary",noWrap:!0,children:h(e.total_value)})]}),jsx(ue,{orientation:"vertical",flexItem:!0,sx:{borderStyle:"dashed",mx:3}}),jsxs(L,{flex:1,overflow:"hidden",children:[jsx(T,{variant:"body2",fontSize:"body2.fontSize",color:"text.secondary",noWrap:!0,children:"Data"}),jsx(T,{variant:"subtitle2",fontSize:"subtitle2.fontSize",color:"text.primary",noWrap:!0,children:e.negotiation_date?d$2(e.negotiation_date,"DD/MM/YYYY"):"-"})]})]}),jsxs(L,{gap:.5,children:[jsx(T,{variant:"body2",fontSize:"body2.fontSize",color:"text.secondary",children:"Status"}),jsx(T,{variant:"subtitle2",fontSize:"subtitle2.fontSize",color:"text.primary",children:e.status||"-"})]})]})},e.id),Dt=({open:e,onClose:o,title:t,viewMode:r,selectedYear:a,totalValue:i,periodLabel:n,suffix:l,rows:c,total:s,isLoading:p,isFetching:m,page:y,perPage:C,onSearch:h$1,onPaginationChange:v,buildPartnerLink:z,mobileItemSlot:S})=>{let g=b$1("down","sm"),B=jsxs(L,{gap:3,children:[jsxs(L,{direction:{xs:"column",sm:"row"},justifyContent:"space-between",gap:2,children:[jsxs(L,{minWidth:0,direction:"row",alignItems:"center",gap:3,flexWrap:"wrap",children:[jsxs(L,{children:[jsxs(T,{variant:"body2",fontSize:"body2.fontSize",color:"text.secondary",children:["Vendas ",l]}),jsx(T,{variant:"subtitle2",fontSize:"subtitle2.fontSize",color:"text.primary",children:h(i)})]}),jsx(ko,{orientation:"vertical",flexItem:!0}),jsxs(L,{children:[jsxs(T,{variant:"body2",fontSize:"body2.fontSize",color:"text.secondary",children:["Qtd. de pedidos ",l]}),jsx(T,{variant:"subtitle2",fontSize:"subtitle2.fontSize",color:"text.primary",children:s})]})]}),jsx(a$2,{size:"small",placeholder:"Buscar",onSearch:h$1,trigger:"change",iconPosition:"start",sx:{minWidth:200}})]}),jsx(d,{title:"Pedidos",header:jsx(Fragment,{}),headerProps:{p:0},columns:[{field:"external_id",headerName:"Pedido",flex:1,renderCell:({row:f})=>Ct(f)},{field:"partner_name",headerName:"Cliente",flex:1,renderCell:({row:f})=>kt(f,z)},{field:"total_value",headerName:"Valor do pedido",flex:1,renderCell:({row:f})=>zt(f)},{field:"created_at",headerName:"Data",flex:1,renderCell:({row:f})=>Tt(f)},{field:"last_status",headerName:"Status",flex:1,renderCell:({row:f})=>Mt(f)}],rows:c,rowCount:s,mobileRender:f=>S?S(f):Lt(f),loading:p,fetching:m,paginationModel:{page:y,pageSize:C},onPaginationChange:v,paginationMode:"server",disableRowSelectionOnClick:!0,disableColumnMenu:!0,containerProps:{height:400}})]}),d$1=jsx(xo,{title:t,viewMode:r,selectedYear:a,periodLabel:n});return g?jsx(a$3,{open:e,onClose:o,headerTitle:d$1,headerProps:{direction:"row-reverse",sx:{"& > :last-child":{minWidth:0,overflow:"hidden"}}},children:B}):jsx(a$4,{open:e,onClose:o,maxWidth:"lg",dialogTitle:d$1,dialogTitleProps:{sx:{flex:1,overflow:"hidden"}},fullWidth:!0,children:B})},wt=Dt;var We=(e,o)=>{let t=e.split("-");if(o==="DAILY"&&t.length===3){let n=`${t[0]}-${t[1]}-${t[2]}`;return {startDate:n,endDate:n}}let r=parseInt(t[0],10),a=parseInt(t[1],10),i=new Date(r,a,0).getDate();return {startDate:`${t[0]}-${t[1]}-01`,endDate:`${t[0]}-${t[1]}-${String(i).padStart(2,"0")}`}},_e=(e,o)=>{let t=e.split("-"),r=parseInt(t[1],10)-1,a=b[r]??"";if(o==="DAILY"&&t.length===3){let i=parseInt(t[2],10);return `${a} - Dia ${i}`}return a},Ee=e=>e==="MONTHLY"?"no m\xEAs":"no dia";var Rt=(e,o)=>{let{page:t,perPage:r,search:a,handlePaginationModelChange:i,handleSearch:n}=a$5(),{startDate:l,endDate:c}=useMemo(()=>We(e,o),[e,o]),s=useMemo(()=>_e(e,o),[e,o]),p=Ee(o),m=useMemo(()=>({page:t,perPage:r,...a?{search:a}:{},filter:{operator:"AND",groups:[{operator:"AND",conditionals:[{fieldName:"negotiationDate",conditional:"GREATER_THAN_OR_EQUAL",value:[`${l}T00:00:00`]},{fieldName:"negotiationDate",conditional:"LESS_THAN_OR_EQUAL",value:[`${c}T23:59:59`]}]}]}}),[c,t,r,a,l]),y=useCallback((C,h)=>{i({page:C,pageSize:h});},[i]);return {page:t,perPage:r,periodLabel:s,suffix:p,queryParams:m,handleSearch:n,handlePaginationChange:y}},Ot=Rt;var k={sales:"#22C55E",forecast:"#F59E0B",goal:"#212B36"};var It=({x:e=0,y:o=0,width:t=0,height:r=0,index:a,activeBarIndex:i})=>i!==a?null:jsx("rect",{x:e-6,y:o,width:t+6*2,height:r+6,fill:k.sales,opacity:.16,rx:6}),ke=It;var Vt=({active:e,payload:o,label:t,viewMode:r})=>{if(!e||!o?.length)return null;let a=r==="DAILY",i=o[0].payload,n=Number(i.realized)||0,l=Number(i.forecast)||0,c=Number(i.goal)||0,s=c>0?n/c*100:0,p=c>n?c-n:0,m=a?"no dia":"no m\xEAs",y=a?"di\xE1ria":"mensal",C=String(t),h$1=C.split("-");if(h$1.length>=2){let z=parseInt(h$1[1],10)-1,S=b[z];a&&h$1.length===3?C=`${parseInt(h$1[2],10)} de ${S} de ${h$1[0]}`:a||(C=`${S} de ${h$1[0]}`);}let v=[{name:`Realizado ${m}`,value:h(n),color:k.sales},{name:`Previsto ${m}`,value:h(l),color:k.forecast},{name:`Meta ${y}`,value:h(c),color:k.goal},{name:"Atingimento",value:`${s.toFixed(0)}%`,color:"#00B8D9"},{name:`GAP ${m}`,value:h(p),color:"#FF5630"}];return jsxs(a$7,{minWidth:{xs:"auto",sm:400},p:1,gap:1,children:[jsx(T,{variant:"body2",fontSize:"body2.fontSize",color:"text.secondary",children:C}),jsx(ue,{}),jsx(L,{children:v.map((z,S)=>jsxs(L,{direction:"row",alignItems:"center",justifyContent:"space-between",gap:3,"data-testid":`tooltip-item-${S}`,children:[jsxs(L,{direction:"row",alignItems:"center",gap:1,children:[jsx(L,{width:6,height:6,borderRadius:"50%",bgcolor:z.color}),jsx(T,{variant:"body2",fontSize:"body2.fontSize",noWrap:!0,children:z.name})]}),jsx(T,{variant:"body2",fontSize:"body2.fontSize",children:z.value})]},S))})]})},Te=Vt;var Ht=({data:e,visibleSeries:o,yDomain:t,yTicks:r,viewMode:a,activeBarIndex:i,onMouseMove:n,onMouseLeave:l,onBarClick:c})=>{let s=useCallback(p=>d$1(p),[]);return jsx(ResponsiveContainer,{width:"100%",height:350,children:jsxs(ComposedChart,{data:e,margin:{top:20,right:10,bottom:0,left:20},style:{cursor:"pointer"},onMouseMove:n,onMouseLeave:l,onClick:p=>{p?.activeTooltipIndex!=null&&c?.(Number(p.activeTooltipIndex));},children:[jsx(CartesianGrid,{vertical:!1,strokeDasharray:"3 3",stroke:"#F4F6F8"}),jsx(XAxis,{dataKey:"label",axisLine:!1,tickLine:!1,tick:{fontSize:12,fill:"#637381"},tickFormatter:d$3}),jsx(YAxis,{axisLine:!1,tickLine:!1,tick:{fontSize:12,fill:"#637381"},tickFormatter:s,domain:t,ticks:r}),jsx(Tooltip,{content:jsx(Te,{viewMode:a})}),jsx(Bar,{dataKey:"realized",fill:"transparent",isAnimationActive:!1,background:jsx(ke,{activeBarIndex:i})}),o.goal&&jsx(Line,{dataKey:"goal",name:"Meta",stroke:k.goal,strokeWidth:2,strokeDasharray:"8 4",dot:!1,isAnimationActive:!1}),o.realized&&jsx(Line,{dataKey:"realized",name:"Vendas",stroke:k.sales,strokeWidth:2,dot:{fill:k.sales,r:4,strokeWidth:0},isAnimationActive:!1}),o.forecast&&jsx(Line,{dataKey:"forecast",name:"Previsto",stroke:k.forecast,strokeWidth:2,strokeDasharray:"6 3",dot:{fill:k.forecast,r:4,strokeWidth:0},isAnimationActive:!1})]})})},To=Ht;var tr=({data:e,visibleSeries:o,yDomain:t,yTicks:r,shouldRotateLabels:a,activeBarIndex:i,onMouseMove:n$1,onMouseLeave:l,onBarClick:c$1,viewMode:s})=>{let p=useMemo(()=>a?!1:{position:"top",fontSize:12,fill:"#212B36",formatter:m=>h(Number(m))},[a]);return jsx(ResponsiveContainer,{width:"100%",height:300,children:jsxs(ComposedChart,{data:e,margin:{top:20,right:10,bottom:a?-90:0,left:20},barCategoryGap:"20%",style:{cursor:"pointer"},onMouseMove:n$1,onMouseLeave:l,onClick:m=>{m?.activeTooltipIndex!=null&&c$1?.(Number(m.activeTooltipIndex));},children:[jsx(CartesianGrid,{vertical:!1,strokeDasharray:"3 3",stroke:"#F4F6F8"}),jsx(XAxis,{dataKey:"label",axisLine:!1,tickLine:!1,...a&&{interval:0,height:120},tick:a?jsx(n,{}):{fontSize:12,fill:"#637381"},tickFormatter:c}),jsx(YAxis,{axisLine:!1,tickLine:!1,tick:{fontSize:12,fill:"#637381"},tickFormatter:m=>d$1(m),domain:t,ticks:r}),jsx(Tooltip,{content:jsx(Te,{viewMode:s})}),o.goal&&jsx(Line,{dataKey:"goal",name:"Meta",stroke:k.goal,strokeWidth:2,strokeDasharray:"8 4",dot:!1,isAnimationActive:!1}),o.realized&&jsx(Bar,{dataKey:"realized",name:"Vendas",fill:k.sales,maxBarSize:48,isAnimationActive:!1,radius:[4,4,0,0],background:jsx(ke,{activeBarIndex:i}),label:p}),o.forecast&&jsx(Line,{dataKey:"forecast",name:"Previsto",stroke:k.forecast,strokeWidth:2,strokeDasharray:"6 3",dot:{fill:k.forecast,r:4,strokeWidth:0},isAnimationActive:!1})]})})},Lo=tr;var nr=({data:e,viewMode:o,visibleSeries:t,yDomain:r,yTicks:a,formatYAxis:i,onBarClick:n})=>{let[l,c]=useState(null),[s,p]=useState(0),m=useRef(null),y=o==="MONTHLY",C=useMemo(()=>!y||s===0||e.length===0?!1:(s-60)/e.length<60,[s,e.length,y]),h=useCallback(()=>c(null),[]),v=useCallback(S=>{S?.activeTooltipIndex!=null&&c(Number(S.activeTooltipIndex));},[]),z=useCallback(S=>{m.current&&(m.current.disconnect(),m.current=null),S&&(p(S.clientWidth),m.current=new ResizeObserver(()=>p(S.clientWidth)),m.current.observe(S));},[]);return y?jsx(c$1,{ref:z,children:jsx(Lo,{data:e,visibleSeries:t,yDomain:r,yTicks:a,formatYAxis:i,shouldRotateLabels:C,activeBarIndex:l,onMouseMove:v,onMouseLeave:h,onBarClick:n,viewMode:o})}):jsx(c$1,{ref:z,children:jsx(To,{data:e,visibleSeries:t,yDomain:r,yTicks:a,formatYAxis:i,viewMode:o,activeBarIndex:l,onMouseMove:v,onMouseLeave:h,onBarClick:n})})},wo=nr;var lr=({visibleSeries:e,onToggleSerie:o})=>jsxs(L,{direction:"row",justifyContent:"center",flexWrap:"wrap",gap:1,children:[jsx(Ke,{control:jsx(He,{checked:e.realized,onChange:()=>o("realized"),sx:{"&.Mui-checked":{color:k.sales}}}),label:"Vendas"}),jsx(Ke,{control:jsx(He,{checked:e.forecast,onChange:()=>o("forecast"),sx:{"&.Mui-checked":{color:k.forecast}}}),label:"Previsto"}),jsx(Ke,{control:jsx(He,{checked:e.goal,onChange:()=>o("goal"),sx:{"&.Mui-checked":{color:k.goal}}}),label:"Meta"})]}),Bo=lr;var pr=({kpis:e,isMonthly:o,editGoalAction:t})=>{let r=b$1("down","md");return jsxs(L,{direction:{xs:"column",md:"row"},alignItems:{xs:"flex-start",md:"center"},flexWrap:"wrap",gap:3,children:[r&&jsx(ue,{orientation:"horizontal",flexItem:!0,sx:{borderStyle:"dashed",mx:-3}}),jsxs(L,{children:[jsxs(T,{variant:"body2",fontSize:"body2.fontSize",color:"text.secondary",children:["Previsto no ",o?"ano":"m\xEAs"]}),jsx(T,{variant:"subtitle2",fontSize:"subtitle2.fontSize",children:h(e?.forecast)})]}),jsx(ue,{orientation:r?"horizontal":"vertical",flexItem:!0,sx:{borderStyle:r?"solid":"dashed"}}),jsxs(L,{children:[jsxs(T,{variant:"body2",fontSize:"body2.fontSize",color:"text.secondary",children:["Realizado no ",o?"ano":"m\xEAs"]}),jsx(T,{variant:"subtitle2",fontSize:"subtitle2.fontSize",children:h(e?.realized)})]}),jsx(ue,{orientation:r?"horizontal":"vertical",flexItem:!0,sx:{borderStyle:r?"solid":"dashed"}}),jsxs(L,{children:[jsxs(L,{direction:"row",alignItems:"center",gap:3,children:[jsxs(T,{variant:"body2",fontSize:"body2.fontSize",color:"text.secondary",children:["Meta ",o?"anual":"mensal"]}),t]}),jsx(T,{variant:"subtitle2",fontSize:"subtitle2.fontSize",children:h(e?.goal)})]}),jsx(ue,{orientation:r?"horizontal":"vertical",flexItem:!0,sx:{borderStyle:r?"solid":"dashed"}}),jsxs(L,{children:[jsx(T,{variant:"body2",fontSize:"body2.fontSize",color:"text.secondary",children:"Atingimento"}),jsx(T,{variant:"subtitle2",fontSize:"subtitle2.fontSize",children:c$2(e?.achievement??0,{maximumFractionDigits:2,minimumFractionDigits:2})})]}),jsx(ue,{orientation:r?"horizontal":"vertical",flexItem:!0,sx:{borderStyle:r?"solid":"dashed"}}),jsxs(L,{children:[jsxs(L,{direction:"row",gap:.5,children:[jsxs(T,{variant:"body2",fontSize:"body2.fontSize",color:"text.secondary",children:["GAP do ",o?"ano":"m\xEAs"]}),jsx(a$6,{text:"Diferen\xE7a entre o valor realizado e a meta. Um GAP significa que as vendas ainda est\xE3o abaixo do objetivo definido para o per\xEDodo.",width:18,arrow:!0,sx:{mt:-.1}})]}),jsx(T,{variant:"subtitle2",fontSize:"subtitle2.fontSize",children:h(e?.gap)})]})]})},Qe=pr;var fr=({data:e,kpis:o,viewMode:t,selectedYear:r,editGoalAction:a$2,DetailComponent:i})=>{let[n,l]=useState({realized:!0,forecast:!0,goal:!0}),[c,s]=useState(!1),[p,m$1]=useState(""),[y,C]=useState(0),h=t==="MONTHLY",v=useMemo(()=>{if(!e.length)return [0,1];let x=e.flatMap(N=>[Number(N.realized)||0,Number(N.forecast)||0,Number(N.goal)||0]),M=Math.max(...x);return [0,M>0?M*1.15:1]},[e]),z=useMemo(()=>{let[,x]=v,M=x/6,N=Array.from({length:7},($r,$o)=>Math.round(M*$o));return [...new Set(N)]},[v]),S=useCallback(x=>{l(M=>({...M,[x]:!M[x]}));},[]),g=useCallback(x=>S(x),[S]),B=useCallback(x=>{let M=e[x];M&&(m$1(M.label),C(M.realized),s(!0));},[e]),d=useCallback(()=>{s(!1);},[]),f=useCallback(x=>d$1(x),[]);return jsxs(Fragment,{children:[jsxs(a,{children:[jsx(dt,{title:"Evolu\xE7\xE3o de vendas"}),jsx(mt,{children:jsx(a$1,{isEmpty:e.length===0,empty:jsx(m,{}),children:jsxs(L,{gap:3,children:[jsx(L,{display:{xs:"none",md:"block"},children:jsx(Qe,{kpis:o,isMonthly:h,editGoalAction:a$2})}),jsx(wo,{data:e,viewMode:t,visibleSeries:n,yDomain:v,yTicks:z,formatYAxis:f,onBarClick:B}),jsx(Bo,{visibleSeries:n,onToggleSerie:g}),jsx(L,{display:{xs:"block",md:"none"},children:jsx(Qe,{kpis:o,isMonthly:h,editGoalAction:a$2})})]})})})]}),p&&i&&jsx(i,{open:c,onClose:d,label:p,viewMode:t,selectedYear:r,totalValue:y})]})},ur=fr;var ie={realized:"#22C55E",forecast:"#F59E0B"};var hr=({x:e=0,y:o=0,width:t=0,height:r=0,index:a,activeBarIndex:i})=>i!==a?null:jsx("rect",{x:e-6,y:o,width:t+12,height:r+6,fill:"#919EAB",opacity:.16,rx:6}),Ro=hr;var gr=({x:e=0,y:o=0,width:t=0,height:r=0,index:a,activeBarIndex:i,bothRendered:n})=>i!==a?null:jsx("rect",{x:e-6,y:o,width:n?t*2+4+12:t+12,height:r+6,fill:"#919EAB",opacity:.16,rx:6}),Oo=gr;var xr=({active:e,payload:o,label:t,viewMode:r})=>{if(!e||!o?.length)return null;let a=r==="DAILY",i=String(t),n=i.split("-");if(n.length>=2){let l=parseInt(n[1],10)-1,c=b[l];a&&n.length===3?i=`${parseInt(n[2],10)} de ${c} de ${n[0]}`:a||(i=`${c} de ${n[0]}`);}return jsxs(a$7,{minWidth:{xs:"auto",sm:200},p:1,gap:1,children:[jsx(T,{variant:"body2",fontSize:"body2.fontSize",color:"text.secondary",children:i}),jsx(ue,{}),jsx(L,{children:o.map((l,c)=>jsxs(L,{direction:"row",alignItems:"center",justifyContent:"space-between",gap:3,"data-testid":`tooltip-item-${c}`,children:[jsxs(L,{direction:"row",alignItems:"center",gap:1,children:[jsx(L,{width:6,height:6,borderRadius:"50%",bgcolor:l.color}),jsx(T,{variant:"body2",fontSize:"body2.fontSize",noWrap:!0,children:l.name})]}),jsx(T,{variant:"body2",fontSize:"body2.fontSize",children:h(l.value)})]},l.name))})]})},Io=xr;var Pr=({data:e,viewMode:o,visibleSeries:t,activeBarIndex:r,onMouseMove:a,onMouseLeave:i})=>{let n$1=o==="MONTHLY",[l,c$2]=useState(0),s=useRef(null),p=useCallback(g=>{s.current&&(s.current.disconnect(),s.current=null),g&&(c$2(g.clientWidth),s.current=new ResizeObserver(()=>c$2(g.clientWidth)),s.current.observe(g));},[]),m=useMemo(()=>!n$1||l===0||e.length===0?!1:(l-60)/e.length<80,[n$1,l,e.length]),y=useMemo(()=>e.some(g=>g.realized_value>0),[e]),C=useMemo(()=>e.some(g=>g.forecast_value>0),[e]),h=useMemo(()=>{if(!e.length)return [0,1];let g=e.flatMap(d=>[d.realized_value,d.forecast_value]),B=Math.max(...g);return [0,B>0?B*1.15:1]},[e]),v=useMemo(()=>{let[,g]=h,B=g/6;return [...new Set(Array.from({length:7},(d,f)=>Math.round(B*f)))]},[h]),z=useMemo(()=>n$1?c:d$3,[n$1]),S=t.realized&&y&&t.forecast&&C;return jsx(c$1,{ref:p,children:jsx(ResponsiveContainer,{width:"100%",height:250,children:jsxs(BarChart,{data:e,margin:{top:20,right:10,bottom:m?-90:0,left:20},barCategoryGap:"20%",barGap:4,onMouseMove:a,onMouseLeave:i,children:[jsx(CartesianGrid,{vertical:!1,strokeDasharray:"3 3",stroke:"#F4F6F8"}),jsx(XAxis,{dataKey:"label",axisLine:!1,tickLine:!1,...m&&{interval:0,height:120},tick:m?jsx(n,{}):{fontSize:12,fill:"#637381"},tickFormatter:z}),jsx(YAxis,{axisLine:!1,tickLine:!1,tick:{fontSize:12,fill:"#637381"},tickFormatter:g=>d$1(g),domain:h,ticks:v}),jsx(Tooltip,{content:jsx(Io,{viewMode:o}),cursor:!1}),t.realized&&y&&jsx(Bar,{dataKey:"realized_value",name:"Realizado",fill:ie.realized,maxBarSize:32,isAnimationActive:!1,radius:[4,4,0,0],background:jsx(Oo,{activeBarIndex:r,bothRendered:S})}),t.forecast&&C&&jsx(Bar,{dataKey:"forecast_value",name:"Previsto",fill:ie.forecast,maxBarSize:32,isAnimationActive:!1,radius:[4,4,0,0],...!t.realized&&{background:jsx(Ro,{activeBarIndex:r})}})]})})})},Fo=Pr;var Ir=({visibleSeries:e,onToggleSerie:o})=>jsxs(L,{direction:"row",justifyContent:"center",flexWrap:"wrap",gap:1,children:[jsx(Ke,{control:jsx(He,{checked:e.realized,onChange:()=>o("realized"),sx:{"&.Mui-checked":{color:ie.realized}}}),label:"Realizado"}),jsx(Ke,{control:jsx(He,{checked:e.forecast,onChange:()=>o("forecast"),sx:{"&.Mui-checked":{color:ie.forecast}}}),label:"Previsto"})]}),_o=Ir;var Fr=({totalForecast:e,totalRealized:o,percentage:t,isMonthly:r})=>{let a=b$1("down","md");return jsxs(L,{direction:{xs:"column",md:"row"},alignItems:{xs:"flex-start",md:"center"},flexWrap:"wrap",gap:3,children:[a&&jsx(ue,{orientation:"horizontal",flexItem:!0,sx:{borderStyle:"dashed",mx:-3}}),jsxs(L,{children:[jsx(T,{variant:"body2",fontSize:"body2.fontSize",color:"text.secondary",children:r?"Total previsto no ano":"Total previsto no m\xEAs"}),jsx(T,{variant:"subtitle2",fontSize:"subtitle2.fontSize",children:h(e)})]}),jsx(ue,{orientation:a?"horizontal":"vertical",flexItem:!0,sx:{borderStyle:a?"solid":"dashed"}}),jsxs(L,{children:[jsx(T,{variant:"body2",fontSize:"body2.fontSize",color:"text.secondary",children:r?"Total realizado no ano":"Total realizado no m\xEAs"}),jsx(T,{variant:"subtitle2",fontSize:"subtitle2.fontSize",children:h(o)})]}),jsx(ue,{orientation:a?"horizontal":"vertical",flexItem:!0,sx:{borderStyle:a?"solid":"dashed"}}),jsxs(L,{children:[jsx(T,{variant:"body2",fontSize:"body2.fontSize",color:"text.secondary",children:"Atingimento"}),jsxs(T,{variant:"subtitle2",fontSize:"subtitle2.fontSize",children:[t,"%"]})]})]})},eo=Fr;var Er=({data:e,viewMode:o})=>{let t=o==="MONTHLY",[r,a$2]=useState({realized:!0,forecast:!0}),[i,n]=useState(null),l=useCallback(m=>{a$2(y=>({...y,[m]:!y[m]}));},[]),c=useCallback(m=>{m?.activeTooltipIndex!=null&&n(Number(m.activeTooltipIndex));},[]),s=useCallback(()=>n(null),[]),p=useMemo(()=>{let m=e.reduce((h,v)=>h+(v.realized_value??0),0),y=e.reduce((h,v)=>h+(v.forecast_value??0),0),C=y>0?Math.round(m/y*100):0;return {totalRealized:m,totalForecast:y,percentage:C}},[e]);return jsxs(a,{children:[jsx(dt,{title:"Previsto vs. Realizado (Positiva\xE7\xE3o)"}),jsx(mt,{children:jsx(a$1,{isEmpty:e.length===0,empty:jsx(m,{}),children:jsxs(L,{gap:3,children:[jsx(L,{display:{xs:"none",md:"block"},children:jsx(eo,{totalForecast:p.totalForecast,totalRealized:p.totalRealized,percentage:p.percentage,isMonthly:t})}),jsx(Fo,{data:e,viewMode:o,visibleSeries:r,activeBarIndex:i,onMouseMove:c,onMouseLeave:s}),jsx(_o,{visibleSeries:r,onToggleSerie:l}),jsx(L,{display:{xs:"block",md:"none"},children:jsx(eo,{totalForecast:p.totalForecast,totalRealized:p.totalRealized,percentage:p.percentage,isMonthly:t})})]})})})]})},Nr=Er;
45
+
46
+ export { ut as OrdersByType, wt as OverviewDetail, ur as SalesEvolution, Nr as SalesForecast, We as getDateRange, _e as getPeriodLabel, Ee as getPeriodSuffix, Ot as useOverviewDetailState };
47
+ //# sourceMappingURL=index.js.map