@zydon/common 2.9.30 → 2.9.32

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/README.md CHANGED
@@ -87,7 +87,7 @@ enqueueSnackbar('Mensagem', { variant: 'error' });
87
87
  ### Utils
88
88
  - **file:** utils para lidar com arquivos `(downloadFile)`
89
89
  - **formatNumber:** utils para formatar números `(fNumber, fCurrency, fPercent, fShortenNumber, fData result, fWithDecimalPlacesOrNot)`
90
- - **formatTime:** utils para lidar com datas `(fDate, fDateTime format, fTimestamp, fToNow)` (*Construido utilizando* [date-fns](https://www.npmjs.com/package/date-fns))
90
+ - **formatTime:** utils para lidar com datas `(today, fDate, fDateTime, fTime, fTimestamp, fToNow, fTimeAgo, fExpiration, fIsBetween, fIsAfter, fIsSame, fDateRangeShortLabel, fAdd, fSub, getDifferenceInDays, formatStr)` (*Construido utilizando* [dayjs](https://www.npmjs.com/package/dayjs))
91
91
  - **cssStyles:** utils para lidar com estilos CSS `(bgBlur, bgGradient, textGradient, filterStyles, hideScrollbarY, hideScrollbarX)`
92
92
  - **routes:** utils para lidar com rotas `(getRoot)`
93
93
  - **sort:** utils para lidar com ordenação de arrys de objetos `(sort, updatePosition)`
@@ -0,0 +1,8 @@
1
+ import i from 'dayjs';
2
+ import x from 'dayjs/plugin/duration';
3
+ import D from 'dayjs/plugin/relativeTime';
4
+
5
+ i.extend(x);i.extend(D);var c={dateTime:"DD/MM/YYYY HH:mm",date:"DD/MM/YYYY",time:"HH:mm",split:{dateTime:"DD/MM/YYYY HH:mm",date:"DD/MM/YYYY"},paramCase:{dateTime:"DD/MM/YYYY HH:mm",date:"DD/MM/YYYY"}};function P(r){return i(new Date).startOf("day").format(r)}function b(r,t){return r?i(r).isValid()?i(r).format(t??c.dateTime):"Invalid time value":null}function s(r,t){return r?i(r).isValid()?i(r).format(t??c.date):"Invalid time value":null}function k(r,t){return r?i(r).isValid()?i(r).format(t??c.time):"Invalid time value":null}function m(r){return r?i(r).isValid()?i(r).valueOf():"Invalid time value":null}function F(r){return r?i(r).isValid()?i(r).toNow(!0):"Invalid time value":null}function y(r,t){if(!r)return null;let e=i(r);if(!e.isValid())return "Invalid time value";let n=d(new Date,e)?e:i();if(t==="instant")return `H\xE1 ${n.toNow(!0)}`;let a=i().startOf("day").diff(n.startOf("day"),"day");return a===0?"Hoje":a===1?"Ontem":`H\xE1 ${a} dias`}function M(r,t){if(!r||!i(r).isValid())return null;let e=t==="day"?i(r).endOf("day"):i(r);if(d(new Date,e))return {expired:!0,label:"Expirado",value:y(r,"day"),text:"Expirado"};let n=e.toNow(!0);return {expired:!1,label:"Expira em",value:n,text:`Expira em ${n}`}}function T(r,t,e){if(!r||!t||!e)return !1;let n=m(r),a=m(t),o=m(e);return n&&a&&o?n>=a&&n<=o:!1}function d(r,t){return i(r).isAfter(t)}function f(r,t,e){return !r||!t?!1:i(r).isValid()&&i(t).isValid()?i(r).isSame(t,e??"year"):"Invalid time value"}function g(r,t,e){let n=i(r).isValid()&&i(t).isValid(),a=d(r,t);if(!n||a)return "Invalid time value";let o=`${s(r)} - ${s(t)}`;if(e)return o;let u=f(r,t,"year"),l=f(r,t,"month"),p=f(r,t,"day");return u&&!l?o=`${s(r,"DD MMM")} - ${s(t)}`:u&&l&&!p?o=`${s(r,"DD")} - ${s(t)}`:u&&l&&p&&(o=`${s(t)}`),o}function I({years:r=0,months:t=0,days:e=0,hours:n=0,minutes:a=0,seconds:o=0,milliseconds:u=0}){return i().add(i.duration({years:r,months:t,days:e,hours:n,minutes:a,seconds:o,milliseconds:u})).format()}function H({years:r=0,months:t=0,days:e=0,hours:n=0,minutes:a=0,seconds:o=0,milliseconds:u=0}){return i().subtract(i.duration({years:r,months:t,days:e,hours:n,minutes:a,seconds:o,milliseconds:u})).format()}var $=(r,t)=>!r||!t?null:i(t).diff(i(r),"day");
6
+
7
+ export { c as a, P as b, b as c, s as d, k as e, m as f, F as g, y as h, M as i, T as j, d as k, f as l, g as m, I as n, H as o, $ as p };
8
+ //# sourceMappingURL=chunk-2W5FGLTC.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/utils/formatTime.ts"],"names":["dayjs","duration","relativeTime","formatStr","today","format","fDateTime","date","fDate","fTime","fTimestamp","fToNow","fTimeAgo","unit","target","elapsed","fIsAfter","daysElapsed","fExpiration","limit","value","fIsBetween","inputDate","startDate","endDate","formattedInputDate","formattedStartDate","formattedEndDate","fIsSame","units","fDateRangeShortLabel","initial","isValid","isAfter","label","isSameYear","isSameMonth","isSameDay","fAdd","years","months","days","hours","minutes","seconds","milliseconds","fSub","getDifferenceInDays"],"mappings":"AACA,OAAOA,MAAW,QAClB,OAAOC,MAAc,wBACrB,OAAOC,MAAkB,4BAIzBF,EAAM,OAAOC,CAAQ,EACrBD,EAAM,OAAOE,CAAY,EAYlB,IAAMC,EAAY,CACvB,SAAU,mBACV,KAAM,aACN,KAAM,QACN,MAAO,CACL,SAAU,mBACV,KAAM,YACR,EACA,UAAW,CACT,SAAU,mBACV,KAAM,YACR,CACF,EAEO,SAASC,EAAMC,EAAiB,CACrC,OAAOL,EAAM,IAAI,IAAM,EAAE,QAAQ,KAAK,EAAE,OAAOK,CAAM,CACvD,CAEO,SAASC,EAAUC,EAAwBF,EAAiB,CACjE,OAAKE,EAIWP,EAAMO,CAAI,EAAE,QAAQ,EAGhCP,EAAMO,CAAI,EAAE,OAAOF,GAAUF,EAAU,QAAQ,EAC/C,qBAPK,IAQX,CAEO,SAASK,EAAMD,EAAwBF,EAAiB,CAC7D,OAAKE,EAIWP,EAAMO,CAAI,EAAE,QAAQ,EAGhCP,EAAMO,CAAI,EAAE,OAAOF,GAAUF,EAAU,IAAI,EAC3C,qBAPK,IAQX,CAEO,SAASM,EAAMF,EAAwBF,EAAiB,CAC7D,OAAKE,EAIWP,EAAMO,CAAI,EAAE,QAAQ,EAGhCP,EAAMO,CAAI,EAAE,OAAOF,GAAUF,EAAU,IAAI,EAC3C,qBAPK,IAQX,CAEO,SA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ACjB,EAAkB,CAehB,OAde7C,EAAM,EAClB,IACCA,EAAM,SAAS,CACb,MAAAuC,EACA,OAAAC,EACA,KAAAC,EACA,MAAAC,EACA,QAAAC,EACA,QAAAC,EACA,aAAAC,CACF,CAAC,CACH,EACC,OAAO,CAGZ,CAEO,SAASC,EAAK,CACnB,MAAAP,EAAQ,EACR,OAAAC,EAAS,EACT,KAAAC,EAAO,EACP,MAAAC,EAAQ,EACR,QAAAC,EAAU,EACV,QAAAC,EAAU,EACV,aAAAC,EAAe,CACjB,EAAkB,CAehB,OAde7C,EAAM,EAClB,SACCA,EAAM,SAAS,CACb,MAAAuC,EACA,OAAAC,EACA,KAAAC,EACA,MAAAC,EACA,QAAAC,EACA,QAAAC,EACA,aAAAC,CACF,CAAC,CACH,EACC,OAAO,CAGZ,CAEO,IAAME,EAAsB,CAACxB,EAAkBC,IAChD,CAACD,GAAa,CAACC,EAAgB,KAE5BxB,EAAMwB,CAAO,EAAE,KAAKxB,EAAMuB,CAAS,EAAG,KAAK","sourcesContent":["import type { Dayjs, OpUnitType } from 'dayjs';\nimport dayjs from 'dayjs';\nimport duration from 'dayjs/plugin/duration';\nimport relativeTime from 'dayjs/plugin/relativeTime';\n\n// ----------------------------------------------------------------------\n\ndayjs.extend(duration);\ndayjs.extend(relativeTime);\n\n// ----------------------------------------------------------------------\n\nexport type DatePickerFormat =\n | Dayjs\n | Date\n | string\n | number\n | null\n | undefined;\n\nexport const formatStr = {\n dateTime: 'DD/MM/YYYY HH:mm',\n date: 'DD/MM/YYYY',\n time: 'HH:mm',\n split: {\n dateTime: 'DD/MM/YYYY HH:mm',\n date: 'DD/MM/YYYY',\n },\n paramCase: {\n dateTime: 'DD/MM/YYYY HH:mm',\n date: 'DD/MM/YYYY',\n },\n};\n\nexport function today(format?: string) {\n return dayjs(new Date()).startOf('day').format(format);\n}\n\nexport function fDateTime(date: DatePickerFormat, format?: string) {\n if (!date) {\n return null;\n }\n\n const isValid = dayjs(date).isValid();\n\n return isValid\n ? dayjs(date).format(format ?? formatStr.dateTime)\n : 'Invalid time value';\n}\n\nexport function fDate(date: DatePickerFormat, format?: string) {\n if (!date) {\n return null;\n }\n\n const isValid = dayjs(date).isValid();\n\n return isValid\n ? dayjs(date).format(format ?? formatStr.date)\n : 'Invalid time value';\n}\n\nexport function fTime(date: DatePickerFormat, format?: string) {\n if (!date) {\n return null;\n }\n\n const isValid = dayjs(date).isValid();\n\n return isValid\n ? dayjs(date).format(format ?? formatStr.time)\n : 'Invalid time value';\n}\n\nexport function fTimestamp(date: DatePickerFormat) {\n if (!date) {\n return null;\n }\n\n const isValid = dayjs(date).isValid();\n\n return isValid ? dayjs(date).valueOf() : 'Invalid time value';\n}\n\nexport function fToNow(date: DatePickerFormat) {\n if (!date) {\n return null;\n }\n\n const isValid = dayjs(date).isValid();\n\n return isValid ? dayjs(date).toNow(true) : 'Invalid time value';\n}\n\nexport type TimeUnit = 'instant' | 'day';\n\nexport interface Expiration {\n expired: boolean;\n label: string;\n value: string;\n text: string;\n}\n\nexport function fTimeAgo(date: DatePickerFormat, unit: TimeUnit) {\n if (!date) {\n return null;\n }\n\n const target = dayjs(date);\n\n if (!target.isValid()) {\n return 'Invalid time value';\n }\n\n const elapsed = fIsAfter(new Date(), target) ? target : dayjs();\n\n if (unit === 'instant') {\n return `Há ${elapsed.toNow(true)}`;\n }\n\n const daysElapsed = dayjs()\n .startOf('day')\n .diff(elapsed.startOf('day'), 'day');\n\n if (daysElapsed === 0) {\n return 'Hoje';\n }\n\n if (daysElapsed === 1) {\n return 'Ontem';\n }\n\n return `Há ${daysElapsed} dias`;\n}\n\nexport function fExpiration(\n date: DatePickerFormat,\n unit: TimeUnit,\n): Expiration | null {\n if (!date || !dayjs(date).isValid()) {\n return null;\n }\n\n const limit = unit === 'day' ? dayjs(date).endOf('day') : dayjs(date);\n\n if (fIsAfter(new Date(), limit)) {\n return {\n expired: true,\n label: 'Expirado',\n value: fTimeAgo(date, 'day') as string,\n text: 'Expirado',\n };\n }\n\n const value = limit.toNow(true);\n\n return {\n expired: false,\n label: 'Expira em',\n value,\n text: `Expira em ${value}`,\n };\n}\n\nexport function fIsBetween(\n inputDate: DatePickerFormat,\n startDate: DatePickerFormat,\n endDate: DatePickerFormat,\n) {\n if (!inputDate || !startDate || !endDate) {\n return false;\n }\n\n const formattedInputDate = fTimestamp(inputDate);\n const formattedStartDate = fTimestamp(startDate);\n const formattedEndDate = fTimestamp(endDate);\n\n if (formattedInputDate && formattedStartDate && formattedEndDate) {\n return (\n formattedInputDate >= formattedStartDate &&\n formattedInputDate <= formattedEndDate\n );\n }\n\n return false;\n}\n\nexport function fIsAfter(\n startDate: DatePickerFormat,\n endDate: DatePickerFormat,\n) {\n return dayjs(startDate).isAfter(endDate);\n}\n\nexport function fIsSame(\n startDate: DatePickerFormat,\n endDate: DatePickerFormat,\n units?: OpUnitType,\n) {\n if (!startDate || !endDate) {\n return false;\n }\n\n const isValid = dayjs(startDate).isValid() && dayjs(endDate).isValid();\n\n if (!isValid) {\n return 'Invalid time value';\n }\n\n return dayjs(startDate).isSame(endDate, units ?? 'year');\n}\n\nexport function fDateRangeShortLabel(\n startDate: DatePickerFormat,\n endDate: DatePickerFormat,\n initial?: boolean,\n) {\n const isValid = dayjs(startDate).isValid() && dayjs(endDate).isValid();\n\n const isAfter = fIsAfter(startDate, endDate);\n\n if (!isValid || isAfter) {\n return 'Invalid time value';\n }\n\n let label = `${fDate(startDate)} - ${fDate(endDate)}`;\n\n if (initial) {\n return label;\n }\n\n const isSameYear = fIsSame(startDate, endDate, 'year');\n const isSameMonth = fIsSame(startDate, endDate, 'month');\n const isSameDay = fIsSame(startDate, endDate, 'day');\n\n if (isSameYear && !isSameMonth) {\n label = `${fDate(startDate, 'DD MMM')} - ${fDate(endDate)}`;\n } else if (isSameYear && isSameMonth && !isSameDay) {\n label = `${fDate(startDate, 'DD')} - ${fDate(endDate)}`;\n } else if (isSameYear && isSameMonth && isSameDay) {\n label = `${fDate(endDate)}`;\n }\n\n return label;\n}\n\nexport type DurationProps = {\n years?: number;\n months?: number;\n days?: number;\n hours?: number;\n minutes?: number;\n seconds?: number;\n milliseconds?: number;\n};\n\nexport function fAdd({\n years = 0,\n months = 0,\n days = 0,\n hours = 0,\n minutes = 0,\n seconds = 0,\n milliseconds = 0,\n}: DurationProps) {\n const result = dayjs()\n .add(\n dayjs.duration({\n years,\n months,\n days,\n hours,\n minutes,\n seconds,\n milliseconds,\n }),\n )\n .format();\n\n return result;\n}\n\nexport function fSub({\n years = 0,\n months = 0,\n days = 0,\n hours = 0,\n minutes = 0,\n seconds = 0,\n milliseconds = 0,\n}: DurationProps) {\n const result = dayjs()\n .subtract(\n dayjs.duration({\n years,\n months,\n days,\n hours,\n minutes,\n seconds,\n milliseconds,\n }),\n )\n .format();\n\n return result;\n}\n\nexport const getDifferenceInDays = (startDate?: Date, endDate?: Date) => {\n if (!startDate || !endDate) return null;\n\n return dayjs(endDate).diff(dayjs(startDate), 'day');\n};\n"]}
@@ -0,0 +1,13 @@
1
+ import { a as a$1 } from './chunk-F65ZXAGV.js';
2
+ import { a } from './chunk-VJW7L44O.js';
3
+ import T from '@mui/material/Drawer';
4
+ import k from '@mui/material/IconButton';
5
+ import l from '@mui/material/Stack';
6
+ import D 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(D)(({theme:r})=>({borderTop:`1px solid ${r.palette.divider}`,backgroundColor:r.palette.background.paper}));var P=({children:r,actionsProps:t})=>jsx(m,{"data-testid":"drawer-actions",...t,children:r}),f=P;var H=({headerTitle:r,headerProps:t,onClose:i,children:w,contentProps:A,scrollbarProps:h,maxWidth:x=684,actions:a$2,actionsProps:b,id:p,...u})=>{let y=p||"actions";return jsxs(T,{anchor:"right",id:p,PaperProps:{sx:{width:1,maxWidth:x}},onClose:i,...u,children:[jsxs(c,{direction:"row",...t,children:[jsx(k,{"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,{...h,children:jsx(l,{p:3,...A,children:w})}),a$2&&jsx(f,{actionsProps:{...b,id:y},children:a$2})]})},L=H;
11
+
12
+ export { L as a };
13
+ //# sourceMappingURL=chunk-Y5SAYYIA.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","scrollbarProps","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,EFmBT,OAOI,OAAAC,EAPJ,QAAAI,MAAA,oBAxBN,IAAMC,EAAS,CAAC,CACd,YAAAC,EACA,YAAAC,EACA,QAAAC,EACA,SAAAP,EACA,aAAAQ,EACA,eAAAC,EACA,SAAAC,EAAW,IACX,QAAAC,EACA,aAAAV,EACA,GAAAW,EACA,GAAGC,CACL,IAAmB,CACjB,IAAMC,EAAiBF,GAAM,UAC7B,OACET,EAACb,EAAA,CACC,OAAO,QACP,GAAIsB,EACJ,WAAY,CACV,GAAI,CAAE,MAAO,EAAG,SAAUF,CAAS,CACrC,EACA,QAASH,EACR,GAAGM,EAEJ,UAAAV,EAACR,EAAA,CAAO,UAAU,MAAO,GAAGW,EAC1B,UAAAP,EAACR,EAAA,CACC,aAAW,wBACX,cAAY,mBACZ,KAAK,QACL,QAASgB,EAET,SAAAR,EAACgB,EAAA,CAAK,KAAK,oBAAoB,MAAO,GAAI,EAC5C,EAEAhB,EAACF,EAAA,CAAa,SAAAQ,EAAY,GAC5B,EACAN,EAACiB,EAAA,CAAW,GAAGP,EACb,SAAAV,EAACP,EAAA,CAAM,EAAG,EAAI,GAAGgB,EACd,SAAAR,EACH,EACF,EAECW,GACCZ,EAACG,EAAA,CAAQ,aAAc,CAAE,GAAGD,EAAc,GAAIa,CAAe,EAC1D,SAAAH,EACH,GAEJ,CAEJ,EAEOM,EAAQb","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 scrollbarProps,\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 {...scrollbarProps}>\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"]}
@@ -4,9 +4,9 @@ import { a, m, c as c$1, n } from '../../../chunk-QSIIIIKG.js';
4
4
  import { a as a$7 } from '../../../chunk-DRGARBKB.js';
5
5
  import { a as a$6 } from '../../../chunk-YX5SZL5S.js';
6
6
  import { a as a$4 } from '../../../chunk-PLYIMNOS.js';
7
- import { d as d$2 } from '../../../chunk-A7QSCOUE.js';
7
+ import { d as d$2 } from '../../../chunk-2W5FGLTC.js';
8
8
  import { h, d as d$1, c as c$2 } from '../../../chunk-OF6623HG.js';
9
- import { a as a$3 } from '../../../chunk-ADNBF5AS.js';
9
+ import { a as a$3 } from '../../../chunk-Y5SAYYIA.js';
10
10
  import { d } from '../../../chunk-WRS6EB73.js';
11
11
  import { a as a$2 } from '../../../chunk-IR7WWQME.js';
12
12
  import { a as a$1 } from '../../../chunk-4F2NKGF6.js';
@@ -3,9 +3,9 @@ import { b as b$2, a as a$5 } from '../../../chunk-XL6SZZGI.js';
3
3
  import { a, b as b$1, m, n, c } from '../../../chunk-QSIIIIKG.js';
4
4
  import { a as a$8 } from '../../../chunk-DRGARBKB.js';
5
5
  import { a as a$4 } from '../../../chunk-PLYIMNOS.js';
6
- import { d as d$2 } from '../../../chunk-A7QSCOUE.js';
6
+ import { d as d$2 } from '../../../chunk-2W5FGLTC.js';
7
7
  import { h, d, a as a$6, c as c$1 } from '../../../chunk-OF6623HG.js';
8
- import { a as a$3 } from '../../../chunk-ADNBF5AS.js';
8
+ import { a as a$3 } from '../../../chunk-Y5SAYYIA.js';
9
9
  import { d as d$1 } from '../../../chunk-WRS6EB73.js';
10
10
  import { a as a$2 } from '../../../chunk-IR7WWQME.js';
11
11
  import { a as a$1 } from '../../../chunk-4F2NKGF6.js';
@@ -8,7 +8,7 @@ import { a as a$1 } from '../../chunk-PLYIMNOS.js';
8
8
  import { a as a$8 } from '../../chunk-J7RPKCIN.js';
9
9
  import { a as a$7 } from '../../chunk-XAPSXJZO.js';
10
10
  import { c } from '../../chunk-VGTQYKAC.js';
11
- import { a } from '../../chunk-ADNBF5AS.js';
11
+ import { a } from '../../chunk-Y5SAYYIA.js';
12
12
  import { a as a$3 } from '../../chunk-4F2NKGF6.js';
13
13
  import { a as a$6 } from '../../chunk-CO2KQFUN.js';
14
14
  import '../../chunk-F65ZXAGV.js';
@@ -11,7 +11,7 @@ interface ImageContainerProps {
11
11
 
12
12
  declare const Avatar: react.MemoExoticComponent<react.ForwardRefExoticComponent<Omit<PropsWithChildren<ImageContainerProps & _mui_material_Avatar.AvatarOwnProps & _mui_material_Avatar.AvatarSlotsAndSlotProps & _mui_material_OverridableComponent.CommonProps & Omit<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
13
13
  ref?: ((instance: HTMLDivElement | null) => void) | react.RefObject<HTMLDivElement> | null | undefined;
14
- }, "children" | "className" | "style" | "classes" | "sx" | "variant" | "slots" | "slotProps" | "sizes" | "alt" | "src" | "srcSet" | "imgProps"> & {
14
+ }, "children" | "className" | "style" | "classes" | "sx" | "variant" | "slots" | "slotProps" | "alt" | "src" | "sizes" | "srcSet" | "imgProps"> & {
15
15
  component?: react.ElementType<any, keyof react.JSX.IntrinsicElements> | undefined;
16
16
  }>, "ref"> & react.RefAttributes<HTMLDivElement>>>;
17
17
 
@@ -7,22 +7,22 @@ import { a as a$3 } from '../../chunk-I4PPSW36.js';
7
7
  import '../../chunk-7UJSGCXL.js';
8
8
  import { a as a$2 } from '../../chunk-VJW7L44O.js';
9
9
  import '../../chunk-Z6YXPKWP.js';
10
- import { memo, useEffect, useState, useMemo, useCallback } from 'react';
10
+ import { memo, useRef, useEffect, useState, useMemo, useCallback } from 'react';
11
11
  import { useFormContext, useWatch, useForm, FormProvider } from 'react-hook-form';
12
- import zt from '@mui/material/LinearProgress';
13
- import at from '@mui/material/Typography';
14
- import wt from '@mui/material/Switch';
15
- import It from '@mui/material/TextField';
12
+ import ze from '@mui/material/LinearProgress';
13
+ import se from '@mui/material/Typography';
14
+ import Ie from '@mui/material/Switch';
15
+ import Pe from '@mui/material/TextField';
16
16
  import j from '@mui/material/Box';
17
- import ht from '@mui/material/Button';
18
- import yt from '@mui/material/Chip';
19
- import bt from '@mui/material/Dialog';
20
- import A from '@mui/material/Stack';
17
+ import ye from '@mui/material/Button';
18
+ import be from '@mui/material/Chip';
19
+ import ke from '@mui/material/Dialog';
20
+ import V from '@mui/material/Stack';
21
21
  import { styled } from '@mui/material/styles';
22
22
  import { DataGridPremium, GridToolbarColumnsButton } from '@mui/x-data-grid-premium';
23
23
  import { jsx, jsxs } from 'react/jsx-runtime';
24
24
 
25
- var X=styled(bt)({"& .MuiDialog-paper":{margin:0,borderRadius:0,maxHeight:"100vh",padding:0,height:"100vh",width:"100%",maxWidth:"100%"}}),Z=styled(A)({height:"100%",minHeight:0}),q=styled(yt)(({theme:t})=>({padding:0,"& .MuiChip-label":{color:t.palette.text.secondary,fontWeight:"700"}})),J=styled(ht)(({theme:t})=>({color:t.palette.text.secondary})),Q=styled(j)({flex:1,minHeight:0,padding:0,display:"flex",alignItems:"stretch"}),Y=styled(DataGridPremium)(({theme:t})=>({flex:1,height:"100%",minHeight:320,borderRadius:t.shape.borderRadius,backgroundColor:t.palette.background.paper,"& .MuiDataGrid-columnHeaders":{borderBottom:`1px solid ${t.palette.divider}`,minHeight:48,maxHeight:48},"& .MuiDataGrid-columnHeader":{borderTop:`1px solid ${t.palette.divider} !important`,borderBottom:`1px solid ${t.palette.divider} !important`,minWidth:"120px !important"},"& .MuiDataGrid-cell":{alignItems:"stretch",borderTop:`1px solid ${t.palette.divider}`,minWidth:120,width:"100%",borderLeft:`1px solid ${t.palette.divider}`,padding:0},"& .MuiDataGrid-cell:focus, & .MuiDataGrid-columnHeader:focus":{outline:"none"},"& .MuiDataGrid-withBorderColor":{borderColor:t.palette.divider},"& .MuiDataGrid-virtualScroller":{overflowX:"auto"},"& .MuiDataGrid-footerContainer":{borderTop:`1px solid ${t.palette.divider}`}})),w=styled(j)({display:"flex",alignItems:"center",width:"100%",height:"100%",padding:0,boxSizing:"border-box","& .MuiTypography-root":{width:"100%",overflow:"hidden",textOverflow:"ellipsis"}}),tt=styled(at)(({theme:t})=>({color:t.palette.text.primary})),et=styled(A)(({theme:t})=>({flexDirection:"row",alignItems:"center",justifyContent:"space-between",borderTop:`1px solid ${t.palette.divider}`,padding:t.spacing(2,3),gap:t.spacing(2),flexWrap:"wrap"})),ot=styled(A)(({theme:t})=>({flexDirection:"row",alignItems:"center",gap:t.spacing(.5)}));var nt={"& .MuiOutlinedInput-root":{px:0,borderRadius:0,background:"transparent","& fieldset, &:hover fieldset, &.Mui-focused fieldset":{background:"transparent",borderRadius:0,border:"none"}},"& .MuiInputBase-input":{py:0,height:56,background:"transparent"}},Pt=t=>({disableUnderline:!0,sx:{px:0,"& input":{textAlign:t?"right":"left"}}}),Et=(t,e,a)=>{if(t==null||t==="")return null;if(e.type==="entity"){let l=e.options?.find(T=>T.value?.toString()===t?.toString());if(l)return l.label;let g=e.getSelectedOption?.(a,String(t));if(g)return g.label}if(typeof t=="object"){if("name"in t)return String(t.name);if("label"in t)return String(t.label);if("value"in t)return String(t.value)}return typeof t=="boolean"?t?"Sim":"N\xE3o":String(t)},Mt=({column:t,item:e,fieldPath:a$1,entityValue:l,disabled:g,onSelectOption:T})=>{let i=t.useAutocomplete(),C=i.options,d=l&&!C.some(h=>String(h.value)===l)?i.resolveOption?.(l)??t.getSelectedOption?.(e,l):void 0,n=d?[d,...C]:C;return jsx(w,{children:jsx(a,{fullWidth:!0,name:a$1,value:l,options:n,loading:i.loading,onSearch:i.onSearch,onOpen:i.onOpen,onClose:i.onClose,onScrollEnd:i.onScrollEnd,filterOptions:i.filterOptions,...i.noOptionsText!==void 0&&{noOptionsText:i.noOptionsText},disabled:g,size:"small",placeholder:"Preencher",sx:nt,disableClearable:!0,selectOnFocus:!0,onSelectOption:T})})},Ot=({column:t,item:e,rowIndex:a$1,itemId:l,onFieldChange:g,isFieldDisabled:T})=>{let{setValue:i,control:C}=useFormContext(),d=t.field,n=`items.${a$1}.${String(d)}`,h=useWatch({control:C,name:n,defaultValue:e?.[d]}),s=h===void 0?e?.[d]:h,S=t.readOnly||(T?T({item:e,field:d}):!1),E=String(d)==="id";if(t.readOnly||E){let o=Et(s,t,e);return jsx(w,{children:o?jsx(tt,{variant:"body2",children:o}):jsx(at,{variant:"body2",color:"text.disabled",children:"-"})})}if(t.type==="boolean")return jsx(w,{sx:{justifyContent:"center"},children:jsx(wt,{color:"primary",checked:!!s,inputProps:{"aria-label":t.headerName},onChange:o=>{let c=o.target.checked,p=s;i(n,c,{shouldDirty:!0,shouldTouch:!0});let m=g({itemId:l,field:d,value:c,previousValue:p});m&&typeof m.catch=="function"&&m.catch(()=>{i(n,p,{shouldDirty:!0,shouldTouch:!0});});},disabled:S})});if(t.type==="entity"){let o="";if(s!=null&&s!=="")if(typeof s=="object"){let b=s;"id"in b?o=String(b.id??""):"value"in b&&(o=String(b.value??""));}else o=String(s);let c=b=>{let x=s,B=g({itemId:l,field:d,value:b,previousValue:x});B&&typeof B.catch=="function"&&B.catch(()=>{i(n,x,{shouldDirty:!0,shouldTouch:!0});});};if(t.useAutocomplete)return jsx(Mt,{column:t,item:e,fieldPath:n,entityValue:o,disabled:S,onSelectOption:c});let p=t.options??[],m=o&&!p.some(b=>String(b.value)===o)?t.getSelectedOption?.(e,o):void 0,M=m?[m,...p]:p;return jsx(w,{children:jsx(a,{fullWidth:!0,name:n,value:o,options:M,disabled:S,size:"small",placeholder:"Preencher",sx:nt,disableClearable:!0,onSelectOption:c})})}let y=t.type==="number",R=s??"";return jsx(w,{sx:{justifyContent:y?"flex-end":"flex-start"},children:jsx(It,{fullWidth:!0,size:"small",type:y?"number":"text",placeholder:"Preencher","aria-label":t.headerName,name:n,value:R,variant:"standard",InputProps:{...Pt(y),...y&&{inputProps:{min:0}}},disabled:S,onWheel:o=>{y&&o.target.blur();},onKeyDown:o=>{(o.key===" "||o.key==="Spacebar")&&o.stopPropagation(),y&&(o.key==="-"||o.key==="e")&&o.preventDefault();},onChange:o=>{let c=o.target.value,p=c;if(y)if(c==="")p="";else {let m=Number(c);p=m<0?0:m;}i(n,p,{shouldDirty:!0,shouldTouch:!0}),g({itemId:l,field:d,value:p});}})})},rt=memo(Ot,(t,e)=>t.itemId===e.itemId&&t.rowIndex===e.rowIndex&&t.column===e.column&&t.isFieldDisabled===e.isFieldDisabled);var W="bulk-edit-datagrid-actions",Rt=({setFilterButtonEl:t})=>{let e=useCallback(a=>{t(a);},[t]);return jsx(a$3,{container:W,children:jsx(GridToolbarColumnsButton,{ref:e,slotProps:{button:{color:"inherit",startIcon:jsx(a$2,{icon:"COLUMNS"}),children:"Colunas"}}})})},it=Rt;var dt=({onClose:t,total:e,title:a})=>jsxs(A,{direction:"row",alignItems:"center",gap:3,sx:{px:3,py:0,minHeight:"var(--layout-nav-horizontal-height)"},children:[jsx(J,{variant:"text",size:"small",startIcon:jsx(a$2,{icon:"CHEVRON_LEFT"}),onClick:t,children:"Sair"}),jsxs(A,{flex:1,direction:"row",alignItems:"center",component:"h2",m:0,gap:1,children:[jsx(at,{component:"span",variant:"h6",children:"Editando"}),typeof e=="number"&&jsx(q,{component:"span",disabled:!0,label:e,size:"small",color:"default"}),jsx(at,{component:"span",variant:"h6",children:a})]}),jsx(A,{direction:"row",alignItems:"center",justifyContent:"flex-end",gap:1,id:W})]});var pt=[10,25,50,100],Wt=t=>t.type==="number"?"right":t.type==="boolean"?"center":"left",Vt=({open:t,onClose:e,title:a,header:l,items:g,columns:T,getItemId:i,isLoading:C,page:d,perPage:n,total:h,onPageChange:s,onRowsPerPageChange:S,onFieldChange:E,isFieldDisabled:y,showColumnButton:R,initialState:o})=>{let[c,p]=useState(null),m=g,M=n>0?Math.ceil(h/n):0,b=M>0?M-1:0,x=Math.min(Math.max(d,0),b),B=useMemo(()=>({page:x,pageSize:n}),[n,x]),ut=useMemo(()=>{let r=n?[n,...pt]:pt;return Array.from(new Set(r)).sort((O,v)=>O-v)},[n]),P=useCallback(r=>{r.pageSize!==n&&S(r.pageSize),(r.page!==d||r.pageSize!==n)&&s(r.page,r.pageSize);},[s,S,d,n]),ct=useCallback(r=>{P({page:r,pageSize:n});},[P,n]),mt=useCallback(r=>{P({page:x,pageSize:r});},[P,x]),ft=useMemo(()=>T.map(r=>{let O=Wt(r),v=r.type==="boolean"?100:180;return {field:String(r.field),headerName:r.headerName,flex:1,minWidth:v,disableColumnMenu:!0,headerAlign:O,align:O,renderCell:D=>{let F=D.api.getRowIndexRelativeToVisibleRows(D.id),gt=typeof F=="number"&&F>-1?F:0;return jsx(rt,{column:r,item:D.row,rowIndex:gt,itemId:i(D.row),onFieldChange:E,isFieldDisabled:y})}}}),[T,i,y,E]);return jsx(X,{open:t,onClose:e,fullWidth:!0,children:jsxs(Z,{children:[l??jsx(dt,{onClose:e,total:h,title:a}),C&&jsx(zt,{sx:{height:2}}),jsx(Q,{children:jsx(Y,{columns:ft,rows:m,getRowId:r=>i(r),hideFooterSelectedRowCount:!0,hideFooter:!0,disableRowSelectionOnClick:!0,paginationModel:B,onPaginationModelChange:P,pageSizeOptions:ut,paginationMode:"server",rowCount:h,rowHeight:56,loading:C,slots:{loadingOverlay:a$1,...R&&{toolbar:it}},slotProps:{panel:{anchorEl:c},toolbar:{setFilterButtonEl:p}},initialState:o})}),jsxs(et,{children:[jsxs(ot,{component:"p",children:[jsx(at,{component:"span",variant:"body2",color:"text.disabled",children:"Total de itens:"}),jsx(at,{component:"span",variant:"body2",children:h})]}),jsx(r,{count:h,page:x,rowsPerPage:n,onPageChange:ct,onRowsPerPageChange:mt})]})]})})},Nt=t=>{let{items:e}=t,a=useForm({defaultValues:{items:e}});return useEffect(()=>{a.reset({items:e});},[a,e]),jsx(FormProvider,{...a,children:jsx(Vt,{...t})})},Ge=Nt;
25
+ var X=styled(ke)({"& .MuiDialog-paper":{margin:0,borderRadius:0,maxHeight:"100vh",padding:0,height:"100vh",width:"100%",maxWidth:"100%"}}),Z=styled(V)({height:"100%",minHeight:0}),J=styled(be)(({theme:e})=>({padding:0,"& .MuiChip-label":{color:e.palette.text.secondary,fontWeight:"700"}})),Q=styled(ye)(({theme:e})=>({color:e.palette.text.secondary})),Y=styled(j)({flex:1,minHeight:0,padding:0,display:"flex",alignItems:"stretch"}),ee=styled(DataGridPremium)(({theme:e})=>({flex:1,height:"100%",minHeight:320,borderRadius:e.shape.borderRadius,backgroundColor:e.palette.background.paper,"& .MuiDataGrid-columnHeaders":{borderBottom:`1px solid ${e.palette.divider}`,minHeight:48,maxHeight:48},"& .MuiDataGrid-columnHeader":{borderTop:`1px solid ${e.palette.divider} !important`,borderBottom:`1px solid ${e.palette.divider} !important`,minWidth:"120px !important"},"& .MuiDataGrid-cell":{alignItems:"stretch",borderTop:`1px solid ${e.palette.divider}`,minWidth:120,width:"100%",borderLeft:`1px solid ${e.palette.divider}`,padding:0},"& .MuiDataGrid-cell:focus, & .MuiDataGrid-columnHeader:focus":{outline:"none"},"& .MuiDataGrid-withBorderColor":{borderColor:e.palette.divider},"& .MuiDataGrid-virtualScroller":{overflowX:"auto"},"& .MuiDataGrid-footerContainer":{borderTop:`1px solid ${e.palette.divider}`}})),B=styled(j)({display:"flex",alignItems:"center",width:"100%",height:"100%",padding:0,boxSizing:"border-box","& .MuiTypography-root":{width:"100%",overflow:"hidden",textOverflow:"ellipsis"}}),te=styled(se)(({theme:e})=>({color:e.palette.text.primary})),oe=styled(V)(({theme:e})=>({flexDirection:"row",alignItems:"center",justifyContent:"space-between",borderTop:`1px solid ${e.palette.divider}`,padding:e.spacing(2,3),gap:e.spacing(2),flexWrap:"wrap"})),ne=styled(V)(({theme:e})=>({flexDirection:"row",alignItems:"center",gap:e.spacing(.5)}));var ie={"& .MuiOutlinedInput-root":{px:0,borderRadius:0,background:"transparent","& fieldset, &:hover fieldset, &.Mui-focused fieldset":{background:"transparent",borderRadius:0,border:"none"}},"& .MuiInputBase-input":{py:0,height:56,background:"transparent"}},Ee=e=>({disableUnderline:!0,sx:{px:0,"& input":{textAlign:e?"right":"left"}}}),Me=(e,t,a)=>{if(e==null||e==="")return null;if(t.type==="entity"){let l=t.options?.find(C=>C.value?.toString()===e?.toString());if(l)return l.label;let h=t.getSelectedOption?.(a,String(e));if(h)return h.label}if(typeof e=="object"){if("name"in e)return String(e.name);if("label"in e)return String(e.label);if("value"in e)return String(e.value)}return typeof e=="boolean"?e?"Sim":"N\xE3o":String(e)},Oe=({column:e,item:t,fieldPath:a$1,entityValue:l,disabled:h,onSelectOption:C})=>{let r=e.useAutocomplete(),w=r.options,s=l&&!w.some(y=>String(y.value)===l)?r.resolveOption?.(l)??e.getSelectedOption?.(t,l):void 0,n=s?[s,...w]:w;return jsx(B,{children:jsx(a,{fullWidth:!0,name:a$1,value:l,options:n,loading:r.loading,onSearch:r.onSearch,onOpen:r.onOpen,onClose:r.onClose,onScrollEnd:r.onScrollEnd,filterOptions:r.filterOptions,...r.noOptionsText!==void 0&&{noOptionsText:r.noOptionsText},disabled:h,size:"small",placeholder:"Preencher",sx:ie,disableClearable:!0,selectOnFocus:!0,onSelectOption:C})})},De=({column:e,item:t,rowIndex:a$1,itemId:l,onFieldChange:h,isFieldDisabled:C})=>{let{setValue:r,control:w}=useFormContext(),s=e.field,n=`items.${a$1}.${String(s)}`,y=useWatch({control:w,name:n,defaultValue:t?.[s]}),d=y===void 0?t?.[s]:y,M=useRef(0),b=useRef(null),I=e.readOnly||(C?C({item:t,field:s}):!1),R=String(s)==="id";if(e.readOnly||R){let o=Me(d,e,t);return jsx(B,{children:o?jsx(te,{variant:"body2",children:o}):jsx(se,{variant:"body2",color:"text.disabled",children:"-"})})}if(e.type==="boolean")return jsx(B,{sx:{justifyContent:"center"},children:jsx(Ie,{color:"primary",checked:!!d,inputProps:{"aria-label":e.headerName},onChange:o=>{let f=o.target.checked,p=d;r(n,f,{shouldDirty:!0,shouldTouch:!0});let c=h({itemId:l,field:s,value:f,previousValue:p});c&&typeof c.catch=="function"&&c.catch(()=>{r(n,p,{shouldDirty:!0,shouldTouch:!0});});},disabled:I})});if(e.type==="entity"){let o="";if(d!=null&&d!=="")if(typeof d=="object"){let u=d;"id"in u?o=String(u.id??""):"value"in u&&(o=String(u.value??""));}else o=String(d);let f=u=>{let P=d,S=h({itemId:l,field:s,value:u,previousValue:P});S&&typeof S.catch=="function"&&S.catch(()=>{r(n,P,{shouldDirty:!0,shouldTouch:!0});});};if(e.useAutocomplete)return jsx(Oe,{column:e,item:t,fieldPath:n,entityValue:o,disabled:I,onSelectOption:f});let p=e.options??[],c=o&&!p.some(u=>String(u.value)===o)?e.getSelectedOption?.(t,o):void 0,k=c?[c,...p]:p;return jsx(B,{children:jsx(a,{fullWidth:!0,name:n,value:o,options:k,disabled:I,size:"small",placeholder:"Preencher",sx:ie,disableClearable:!0,onSelectOption:f})})}let x=e.type==="number",v=d??"";return jsx(B,{sx:{justifyContent:x?"flex-end":"flex-start"},children:jsx(Pe,{fullWidth:!0,size:"small",type:x?"number":"text",placeholder:"Preencher","aria-label":e.headerName,name:n,value:v,variant:"standard",InputProps:{...Ee(x),...x&&{inputProps:{min:0}}},disabled:I,onWheel:o=>{x&&o.target.blur();},onKeyDown:o=>{(o.key===" "||o.key==="Spacebar")&&o.stopPropagation(),x&&(o.key==="-"||o.key==="e")&&o.preventDefault();},onChange:o=>{let f=o.target.value,p=f;if(x)if(f==="")p="";else {let P=Number(f);p=P<0?0:P;}r(n,p,{shouldDirty:!0,shouldTouch:!0});let c=M.current+=1,k=b.current?b.current.revertValue:d;b.current={seq:c,revertValue:k};let u=h({itemId:l,field:s,value:p});u&&typeof u.then=="function"&&u.then(()=>{b.current?.seq===c&&(b.current=null);},()=>{b.current?.seq===c&&(b.current=null,r(n,k,{shouldDirty:!0,shouldTouch:!0}));});}})})},ae=memo(De,(e,t)=>e.itemId===t.itemId&&e.rowIndex===t.rowIndex&&e.column===t.column&&e.isFieldDisabled===t.isFieldDisabled);var W="bulk-edit-datagrid-actions",ve=({setFilterButtonEl:e})=>{let t=useCallback(a=>{e(a);},[e]);return jsx(a$3,{container:W,children:jsx(GridToolbarColumnsButton,{ref:t,slotProps:{button:{color:"inherit",startIcon:jsx(a$2,{icon:"COLUMNS"}),children:"Colunas"}}})})},le=ve;var pe=({onClose:e,total:t,title:a})=>jsxs(V,{direction:"row",alignItems:"center",gap:3,sx:{px:3,py:0,minHeight:"var(--layout-nav-horizontal-height)"},children:[jsx(Q,{variant:"text",size:"small",startIcon:jsx(a$2,{icon:"CHEVRON_LEFT"}),onClick:e,children:"Sair"}),jsxs(V,{flex:1,direction:"row",alignItems:"center",component:"h2",m:0,gap:1,children:[jsx(se,{component:"span",variant:"h6",children:"Editando"}),typeof t=="number"&&jsx(J,{component:"span",disabled:!0,label:t,size:"small",color:"default"}),jsx(se,{component:"span",variant:"h6",children:a})]}),jsx(V,{direction:"row",alignItems:"center",justifyContent:"flex-end",gap:1,id:W})]});var ce=[10,25,50,100],We=e=>e.type==="number"?"right":e.type==="boolean"?"center":"left",Ne=({open:e,onClose:t,title:a,header:l,items:h,columns:C,getItemId:r$1,isLoading:w,page:s,perPage:n,total:y,onPageChange:d,onRowsPerPageChange:M,onFieldChange:b,isFieldDisabled:I,showColumnButton:R,initialState:x})=>{let[v,o]=useState(null),f=h,p=n>0?Math.ceil(y/n):0,c=p>0?p-1:0,k=Math.min(Math.max(s,0),c),u=useMemo(()=>({page:k,pageSize:n}),[n,k]),P=useMemo(()=>{let i=n?[n,...ce]:ce;return Array.from(new Set(i)).sort((O,F)=>O-F)},[n]),S=useCallback(i=>{i.pageSize!==n&&M(i.pageSize),(i.page!==s||i.pageSize!==n)&&d(i.page,i.pageSize);},[d,M,s,n]),me=useCallback(i=>{S({page:i,pageSize:n});},[S,n]),fe=useCallback(i=>{S({page:k,pageSize:i});},[S,k]),ge=useMemo(()=>C.map(i=>{let O=We(i),F=i.type==="boolean"?100:180;return {field:String(i.field),headerName:i.headerName,flex:1,minWidth:F,disableColumnMenu:!0,headerAlign:O,align:O,renderCell:D=>{let H=D.api.getRowIndexRelativeToVisibleRows(D.id),he=typeof H=="number"&&H>-1?H:0;return jsx(ae,{column:i,item:D.row,rowIndex:he,itemId:r$1(D.row),onFieldChange:b,isFieldDisabled:I})}}}),[C,r$1,I,b]);return jsx(X,{open:e,onClose:t,fullWidth:!0,children:jsxs(Z,{children:[l??jsx(pe,{onClose:t,total:y,title:a}),w&&jsx(ze,{sx:{height:2}}),jsx(Y,{children:jsx(ee,{columns:ge,rows:f,getRowId:i=>r$1(i),hideFooterSelectedRowCount:!0,hideFooter:!0,disableRowSelectionOnClick:!0,paginationModel:u,onPaginationModelChange:S,pageSizeOptions:P,paginationMode:"server",rowCount:y,rowHeight:56,loading:w,slots:{loadingOverlay:a$1,...R&&{toolbar:le}},slotProps:{panel:{anchorEl:v},toolbar:{setFilterButtonEl:o}},initialState:x})}),jsxs(oe,{children:[jsxs(ne,{component:"p",children:[jsx(se,{component:"span",variant:"body2",color:"text.disabled",children:"Total de itens:"}),jsx(se,{component:"span",variant:"body2",children:y})]}),jsx(r,{count:y,page:k,rowsPerPage:n,onPageChange:me,onRowsPerPageChange:fe})]})]})})},Le=e=>{let{items:t}=e,a=useForm({defaultValues:{items:t}});return useEffect(()=>{a.reset({items:t});},[a,t]),jsx(FormProvider,{...a,children:jsx(Ne,{...e})})},Rt=Le;
26
26
 
27
- export { Ge as default };
27
+ export { Rt as default };
28
28
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/BulkEditModal/index.tsx","../../../src/components/BulkEditModal/BulkEditGridCell.tsx","../../../src/components/BulkEditModal/styles.ts","../../../src/components/BulkEditModal/Header.tsx","../../../src/components/BulkEditModal/Toolbar.tsx"],"names":["useCallback","useEffect","useMemo","useState","FormProvider","useForm","LinearProgress","Typography","memo","useFormContext","useWatch","Switch","TextField","Box","Button","Chip","Dialog","Stack","styled","DataGridPremium","BulkEditDialog","BulkEditContainer","StyledChip","theme","StyledBackButton","GridWrapper","StyledDataGrid","CellContent","ReadOnlyText","Footer","FooterTotal","jsx","AUTOCOMPLETE_SX","getInputProps","isNumber","formatDisplayValue","value","column","item","option","opt","selectedOption","DynamicEntityCell","fieldPath","entityValue","disabled","onSelectOption","autocomplete","baseOptions","options","Autocomplete_default","BulkEditGridCellComponent","rowIndex","itemId","onFieldChange","isFieldDisabled","setValue","control","fieldName","watchedValue","cellValue","isDisabled","isIdField","displayValue","event","previousValue","result","recordValue","handleSelectOption","newValue","inputValue","rawValue","num","BulkEditGridCell","prev","next","GridToolbarColumnsButton","BULK_EDIT_DATAGRID_ACTIONS","BulkEditToolbar","setFilterButtonEl","handleColumnsButtonRef","button","Portal_default","Icon_default","Toolbar_default","jsxs","Header","onClose","total","title","DEFAULT_PAGE_SIZE_OPTIONS","resolveAlignment","BulkEditModalInner","open","header","items","columns","getItemId","isLoading","page","perPage","onPageChange","onRowsPerPageChange","showColumnButton","initialState","filterButtonEl","rows","totalPages","maxPage","safePage","paginationModel","pageSizeOptions","a","b","handlePaginationModelChange","model","handleFooterPageChange","newPage","handleFooterRowsPerPageChange","newRowsPerPage","dataGridColumns","align","baseWidth","params","visibleIndex","row","LoadingOverlay_default","Pagination_default","BulkEditModal","props","formMethods","BulkEditModal_default"],"mappings":"4VAAA,OAAS,eAAAA,EAAa,aAAAC,GAAW,WAAAC,EAAS,YAAAC,OAAgB,QAC1D,OAAS,gBAAAC,GAAc,WAAAC,OAAe,kBACtC,OAAOC,OAAoB,+BAC3B,OAAOC,OAAgB,2BCHvB,OAAS,QAAAC,OAAY,QACrB,OAAS,kBAAAC,GAAgB,YAAAC,OAAgB,kBACzC,OAAOC,OAAY,uBACnB,OAAOC,OAAe,0BACtB,OAAOL,OAAgB,2BCJvB,OAAOM,MAAS,oBACh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AAe,EAClC,QAAS,CACP,kBAAA1B,CACF,CACF,EACA,aAAcyB,EAChB,EACF,EACAnB,EAACxD,GAAA,CACC,UAAAwD,EAACvD,GAAA,CAAY,UAAU,IACrB,UAAAC,EAACxB,GAAA,CAAW,UAAU,OAAO,QAAQ,QAAQ,MAAM,gBAAgB,2BAEnE,EACAwB,EAACxB,GAAA,CAAW,UAAU,OAAO,QAAQ,QAClC,SAAAiF,EACH,GACF,EACAzD,EAACgG,EAAA,CACC,MAAOvC,EACP,KAAMqB,EACN,YAAaT,EACb,aAAcgB,GACd,oBAAqBE,GACvB,GACF,GACF,EACF,CAEJ,EAEMU,GACJC,GACG,CACH,GAAM,CAAE,MAAAlC,CAAM,EAAIkC,EACZC,EAAc7H,GAA4B,CAC9C,cAAe,CAAE,MAAA0F,CAAM,CACzB,CAAC,EAGD,OAAA9F,GAAU,IAAM,CACdiI,EAAY,MAAM,CAAE,MAAAnC,CAAM,CAAC,CAC7B,EAAG,CAACmC,EAAanC,CAAK,CAAC,EAGrBhE,EAAC3B,GAAA,CAAc,GAAG8H,EAChB,SAAAnG,EAAC6D,GAAA,CAA2B,GAAGqC,EAAO,EACxC,CAEJ,EAIOE,GAAQH","sourcesContent":["import { useCallback, useEffect, useMemo, useState } from 'react';\nimport { FormProvider, useForm } from 'react-hook-form';\nimport LinearProgress from '@mui/material/LinearProgress';\nimport Typography from '@mui/material/Typography';\nimport type {\n GridSlots,\n GridSlotsComponentsProps,\n} from '@mui/x-data-grid-premium';\nimport {\n GridAlignment,\n GridColDef,\n GridPaginationModel,\n GridValidRowModel,\n} from '@mui/x-data-grid-premium';\n\nimport LoadingOverlay from 'components/DataGrid/LoadingOverlay';\nimport Pagination from 'components/DataView/Pagination';\n\nimport { BulkEditGridCell } from './BulkEditGridCell';\nimport { Header } from './Header';\nimport { type BulkEditModalInnerProps, type BulkEditModalProps } from './props';\nimport {\n BulkEditContainer,\n BulkEditDialog,\n Footer,\n FooterTotal,\n GridWrapper,\n StyledDataGrid,\n} from './styles';\nimport BulkEditToolbar from './Toolbar';\n\nconst DEFAULT_PAGE_SIZE_OPTIONS = [10, 25, 50, 100];\n\nconst resolveAlignment = <TItem extends Record<string, unknown>>(\n column: BulkEditModalInnerProps<TItem>['columns'][number],\n): GridAlignment => {\n if (column.type === 'number') return 'right';\n if (column.type === 'boolean') return 'center';\n return 'left';\n};\n\nconst BulkEditModalInner = <TItem extends Record<string, unknown>>({\n open,\n onClose,\n title,\n header,\n items,\n columns,\n getItemId,\n isLoading,\n page,\n perPage,\n total,\n onPageChange,\n onRowsPerPageChange,\n onFieldChange,\n isFieldDisabled,\n showColumnButton,\n initialState,\n}: BulkEditModalInnerProps<TItem>) => {\n const [filterButtonEl, setFilterButtonEl] =\n useState<HTMLButtonElement | null>(null);\n const rows = items;\n\n const totalPages = perPage > 0 ? Math.ceil(total / perPage) : 0;\n const maxPage = totalPages > 0 ? totalPages - 1 : 0;\n const safePage = Math.min(Math.max(page, 0), maxPage);\n\n const paginationModel = useMemo(\n () => ({\n page: safePage,\n pageSize: perPage,\n }),\n [perPage, safePage],\n );\n\n const pageSizeOptions = useMemo(() => {\n const options = perPage\n ? [perPage, ...DEFAULT_PAGE_SIZE_OPTIONS]\n : DEFAULT_PAGE_SIZE_OPTIONS;\n return Array.from(new Set(options)).sort((a, b) => a - b);\n }, [perPage]);\n\n const handlePaginationModelChange = useCallback(\n (model: GridPaginationModel) => {\n if (model.pageSize !== perPage) {\n onRowsPerPageChange(model.pageSize);\n }\n\n if (model.page !== page || model.pageSize !== perPage) {\n onPageChange(model.page, model.pageSize);\n }\n },\n [onPageChange, onRowsPerPageChange, page, perPage],\n );\n\n const handleFooterPageChange = useCallback(\n (newPage: number) => {\n handlePaginationModelChange({ page: newPage, pageSize: perPage });\n },\n [handlePaginationModelChange, perPage],\n );\n\n const handleFooterRowsPerPageChange = useCallback(\n (newRowsPerPage: number) => {\n handlePaginationModelChange({ page: safePage, pageSize: newRowsPerPage });\n },\n [handlePaginationModelChange, safePage],\n );\n\n const dataGridColumns = useMemo<GridColDef<GridValidRowModel>[]>(\n () =>\n columns.map(column => {\n const align = resolveAlignment(column);\n const baseWidth = column.type === 'boolean' ? 100 : 180;\n\n return {\n field: String(column.field),\n headerName: column.headerName,\n flex: 1,\n minWidth: baseWidth,\n disableColumnMenu: true,\n headerAlign: align,\n align,\n renderCell: params => {\n const visibleIndex = params.api.getRowIndexRelativeToVisibleRows(\n params.id,\n );\n const rowIndex =\n typeof visibleIndex === 'number' && visibleIndex > -1\n ? visibleIndex\n : 0;\n\n return (\n <BulkEditGridCell\n column={column}\n item={params.row as TItem}\n rowIndex={rowIndex}\n itemId={getItemId(params.row as TItem)}\n onFieldChange={onFieldChange}\n isFieldDisabled={isFieldDisabled}\n />\n );\n },\n };\n }),\n [columns, getItemId, isFieldDisabled, onFieldChange],\n );\n\n return (\n <BulkEditDialog open={open} onClose={onClose} fullWidth>\n <BulkEditContainer>\n {header ?? <Header onClose={onClose} total={total} title={title} />}\n {isLoading && <LinearProgress sx={{ height: 2 }} />}\n\n <GridWrapper>\n <StyledDataGrid\n columns={dataGridColumns}\n rows={rows as unknown as GridValidRowModel[]}\n getRowId={row => getItemId(row as TItem)}\n hideFooterSelectedRowCount\n hideFooter\n disableRowSelectionOnClick\n paginationModel={paginationModel}\n onPaginationModelChange={handlePaginationModelChange}\n pageSizeOptions={pageSizeOptions}\n paginationMode=\"server\"\n rowCount={total}\n rowHeight={56}\n loading={isLoading}\n slots={{\n loadingOverlay: LoadingOverlay,\n ...(showColumnButton && {\n toolbar: BulkEditToolbar as unknown as GridSlots['toolbar'],\n }),\n }}\n slotProps={{\n panel: { anchorEl: filterButtonEl },\n toolbar: {\n setFilterButtonEl,\n } as unknown as GridSlotsComponentsProps['toolbar'],\n }}\n initialState={initialState}\n />\n </GridWrapper>\n <Footer>\n <FooterTotal component=\"p\">\n <Typography component=\"span\" variant=\"body2\" color=\"text.disabled\">\n Total de itens:\n </Typography>\n <Typography component=\"span\" variant=\"body2\">\n {total}\n </Typography>\n </FooterTotal>\n <Pagination\n count={total}\n page={safePage}\n rowsPerPage={perPage}\n onPageChange={handleFooterPageChange}\n onRowsPerPageChange={handleFooterRowsPerPageChange}\n />\n </Footer>\n </BulkEditContainer>\n </BulkEditDialog>\n );\n};\n\nconst BulkEditModal = <TItem extends Record<string, unknown>>(\n props: BulkEditModalProps<TItem>,\n) => {\n const { items } = props;\n const formMethods = useForm<{ items: TItem[] }>({\n defaultValues: { items },\n });\n\n // O desempenho é melhor que values: { items } no useForm\n useEffect(() => {\n formMethods.reset({ items });\n }, [formMethods, items]);\n\n return (\n <FormProvider {...formMethods}>\n <BulkEditModalInner<TItem> {...props} />\n </FormProvider>\n );\n};\n\nexport * from './props';\n\nexport default BulkEditModal;\n","import { memo } from 'react';\nimport { useFormContext, useWatch } from 'react-hook-form';\nimport Switch from '@mui/material/Switch';\nimport TextField from '@mui/material/TextField';\nimport Typography from '@mui/material/Typography';\n\nimport Autocomplete from 'components/form/Autocomplete';\n\nimport {\n BulkEditGridCellProps,\n BulkEditModalColumn,\n BulkEditModalFieldChangeParams,\n DynamicEntityCellProps,\n} from './props';\nimport { CellContent, ReadOnlyText } from './styles';\n\nconst AUTOCOMPLETE_SX = {\n '& .MuiOutlinedInput-root': {\n px: 0,\n borderRadius: 0,\n background: 'transparent',\n '& fieldset, &:hover fieldset, &.Mui-focused fieldset': {\n background: 'transparent',\n borderRadius: 0,\n border: 'none',\n },\n },\n '& .MuiInputBase-input': {\n py: 0,\n height: 56,\n background: 'transparent',\n },\n} as const;\n\nconst getInputProps = (isNumber: boolean) => {\n return {\n disableUnderline: true,\n sx: {\n px: 0,\n '& input': {\n textAlign: isNumber ? 'right' : 'left',\n },\n },\n };\n};\n\nconst formatDisplayValue = <TItem extends Record<string, unknown>>(\n value: unknown,\n column: BulkEditModalColumn<TItem>,\n item: TItem,\n) => {\n if (value === null || value === undefined || value === '') {\n return null;\n }\n\n if (column.type === 'entity') {\n const option = column.options?.find(\n opt => opt.value?.toString() === value?.toString(),\n );\n if (option) {\n return option.label;\n }\n\n const selectedOption = column.getSelectedOption?.(item, String(value));\n if (selectedOption) {\n return selectedOption.label;\n }\n }\n\n if (typeof value === 'object') {\n if ('name' in (value as Record<string, unknown>)) {\n return String((value as { name: unknown }).name);\n }\n if ('label' in (value as Record<string, unknown>)) {\n return String((value as { label: unknown }).label);\n }\n if ('value' in (value as Record<string, unknown>)) {\n return String((value as { value: unknown }).value);\n }\n }\n\n if (typeof value === 'boolean') {\n return value ? 'Sim' : 'Não';\n }\n\n return String(value);\n};\n\nconst DynamicEntityCell = <TItem extends Record<string, unknown>>({\n column,\n item,\n fieldPath,\n entityValue,\n disabled,\n onSelectOption,\n}: DynamicEntityCellProps<TItem>) => {\n const autocomplete = column.useAutocomplete!();\n\n const baseOptions = autocomplete.options;\n const selectedOption =\n entityValue && !baseOptions.some(opt => String(opt.value) === entityValue)\n ? (autocomplete.resolveOption?.(entityValue) ??\n column.getSelectedOption?.(item, entityValue))\n : undefined;\n const options = selectedOption\n ? [selectedOption, ...baseOptions]\n : baseOptions;\n\n return (\n <CellContent>\n <Autocomplete\n fullWidth\n name={fieldPath}\n value={entityValue}\n options={options}\n loading={autocomplete.loading}\n onSearch={autocomplete.onSearch}\n onOpen={autocomplete.onOpen}\n onClose={autocomplete.onClose}\n onScrollEnd={autocomplete.onScrollEnd}\n filterOptions={autocomplete.filterOptions}\n {...(autocomplete.noOptionsText !== undefined && {\n noOptionsText: autocomplete.noOptionsText,\n })}\n disabled={disabled}\n size=\"small\"\n placeholder=\"Preencher\"\n sx={AUTOCOMPLETE_SX}\n disableClearable\n selectOnFocus\n onSelectOption={onSelectOption}\n />\n </CellContent>\n );\n};\n\nconst BulkEditGridCellComponent = <TItem extends Record<string, unknown>>({\n column,\n item,\n rowIndex,\n itemId,\n onFieldChange,\n isFieldDisabled,\n}: BulkEditGridCellProps<TItem>) => {\n const { setValue, control } = useFormContext();\n const fieldName = column.field;\n const fieldPath = `items.${rowIndex}.${String(fieldName)}`;\n const watchedValue = useWatch({\n control,\n name: fieldPath,\n defaultValue: item?.[fieldName],\n });\n const cellValue =\n watchedValue === undefined ? item?.[fieldName] : watchedValue;\n const isDisabled =\n column.readOnly ||\n (isFieldDisabled ? isFieldDisabled({ item, field: fieldName }) : false);\n const isIdField = String(fieldName) === 'id';\n\n if (column.readOnly || isIdField) {\n const displayValue = formatDisplayValue(cellValue, column, item);\n\n return (\n <CellContent>\n {displayValue ? (\n <ReadOnlyText variant=\"body2\">{displayValue}</ReadOnlyText>\n ) : (\n <Typography variant=\"body2\" color=\"text.disabled\">\n -\n </Typography>\n )}\n </CellContent>\n );\n }\n\n if (column.type === 'boolean') {\n return (\n <CellContent sx={{ justifyContent: 'center' }}>\n <Switch\n color=\"primary\"\n checked={Boolean(cellValue)}\n inputProps={{ 'aria-label': column.headerName }}\n onChange={event => {\n const value = event.target.checked;\n const previousValue = cellValue;\n\n setValue(fieldPath, value as TItem[keyof TItem], {\n shouldDirty: true,\n shouldTouch: true,\n });\n\n const result = onFieldChange({\n itemId,\n field: fieldName,\n value,\n previousValue,\n } as BulkEditModalFieldChangeParams<TItem>);\n\n if (\n result &&\n typeof (result as Promise<unknown>).catch === 'function'\n ) {\n (result as Promise<unknown>).catch(() => {\n setValue(fieldPath, previousValue as TItem[keyof TItem], {\n shouldDirty: true,\n shouldTouch: true,\n });\n });\n }\n }}\n disabled={isDisabled}\n />\n </CellContent>\n );\n }\n\n if (column.type === 'entity') {\n let entityValue = '';\n\n if (cellValue !== null && cellValue !== undefined && cellValue !== '') {\n if (typeof cellValue === 'object') {\n const recordValue = cellValue as Record<string, unknown>;\n\n if ('id' in recordValue) {\n entityValue = String(recordValue.id ?? '');\n } else if ('value' in recordValue) {\n entityValue = String(recordValue.value ?? '');\n }\n } else {\n entityValue = String(cellValue);\n }\n }\n\n const handleSelectOption = (newValue: unknown) => {\n const previousValue = cellValue;\n\n const result = onFieldChange({\n itemId,\n field: fieldName,\n value: newValue,\n previousValue,\n } as BulkEditModalFieldChangeParams<TItem>);\n\n if (result && typeof (result as Promise<unknown>).catch === 'function') {\n (result as Promise<unknown>).catch(() => {\n setValue(fieldPath, previousValue as TItem[keyof TItem], {\n shouldDirty: true,\n shouldTouch: true,\n });\n });\n }\n };\n\n if (column.useAutocomplete) {\n return (\n <DynamicEntityCell\n column={column}\n item={item}\n fieldPath={fieldPath}\n entityValue={entityValue}\n disabled={isDisabled}\n onSelectOption={handleSelectOption}\n />\n );\n }\n\n const baseOptions = column.options ?? [];\n const selectedOption =\n entityValue &&\n !baseOptions.some(opt => String(opt.value) === entityValue)\n ? column.getSelectedOption?.(item, entityValue)\n : undefined;\n const options = selectedOption\n ? [selectedOption, ...baseOptions]\n : baseOptions;\n\n return (\n <CellContent>\n <Autocomplete\n fullWidth\n name={fieldPath}\n value={entityValue}\n options={options}\n disabled={isDisabled}\n size=\"small\"\n placeholder=\"Preencher\"\n sx={AUTOCOMPLETE_SX}\n disableClearable\n onSelectOption={handleSelectOption}\n />\n </CellContent>\n );\n }\n\n const isNumber = column.type === 'number';\n const inputValue = cellValue ?? '';\n\n return (\n <CellContent sx={{ justifyContent: isNumber ? 'flex-end' : 'flex-start' }}>\n <TextField\n fullWidth\n size=\"small\"\n type={isNumber ? 'number' : 'text'}\n placeholder=\"Preencher\"\n aria-label={column.headerName}\n name={fieldPath}\n value={inputValue as string | number}\n variant=\"standard\"\n InputProps={{\n ...getInputProps(isNumber),\n ...(isNumber && { inputProps: { min: 0 } }),\n }}\n disabled={isDisabled}\n onWheel={event => {\n if (isNumber) {\n (event.target as HTMLInputElement).blur();\n }\n }}\n onKeyDown={event => {\n if (event.key === ' ' || event.key === 'Spacebar') {\n event.stopPropagation();\n }\n if (isNumber && (event.key === '-' || event.key === 'e')) {\n event.preventDefault();\n }\n }}\n onChange={event => {\n const rawValue = event.target.value;\n let value: string | number = rawValue;\n if (isNumber) {\n if (rawValue === '') {\n value = '';\n } else {\n const num = Number(rawValue);\n value = num < 0 ? 0 : num;\n }\n }\n setValue(fieldPath, value as TItem[keyof TItem], {\n shouldDirty: true,\n shouldTouch: true,\n });\n\n onFieldChange({\n itemId,\n field: fieldName,\n value,\n } as BulkEditModalFieldChangeParams<TItem>);\n }}\n />\n </CellContent>\n );\n};\n\nexport const BulkEditGridCell = memo(\n BulkEditGridCellComponent,\n (prev, next) =>\n prev.itemId === next.itemId &&\n prev.rowIndex === next.rowIndex &&\n prev.column === next.column &&\n prev.isFieldDisabled === next.isFieldDisabled,\n) as typeof BulkEditGridCellComponent;\n","import Box from '@mui/material/Box';\nimport Button, { ButtonProps } from '@mui/material/Button';\nimport Chip, { ChipProps } from '@mui/material/Chip';\nimport Dialog from '@mui/material/Dialog';\nimport Stack, { StackProps } from '@mui/material/Stack';\nimport { styled } from '@mui/material/styles';\nimport Typography from '@mui/material/Typography';\nimport { DataGridPremium } from '@mui/x-data-grid-premium';\n\nexport const BulkEditDialog = styled(Dialog)({\n '& .MuiDialog-paper': {\n margin: 0,\n borderRadius: 0,\n maxHeight: '100vh',\n padding: 0,\n height: '100vh',\n width: '100%',\n maxWidth: '100%',\n },\n});\n\nexport const BulkEditContainer = styled(Stack)({\n height: '100%',\n minHeight: 0,\n});\n\nexport const StyledChip = styled(Chip)<ChipProps>(({ theme }) => ({\n padding: 0,\n '& .MuiChip-label': {\n color: theme.palette.text.secondary,\n fontWeight: '700',\n },\n}));\n\nexport const StyledBackButton = styled(Button)<ButtonProps>(({ theme }) => ({\n color: theme.palette.text.secondary,\n}));\n\nexport const GridWrapper = styled(Box)({\n flex: 1,\n minHeight: 0,\n padding: 0,\n display: 'flex',\n alignItems: 'stretch',\n});\n\nexport const StyledDataGrid = styled(DataGridPremium)(({ theme }) => ({\n flex: 1,\n height: '100%',\n minHeight: 320,\n borderRadius: theme.shape.borderRadius,\n backgroundColor: theme.palette.background.paper,\n '& .MuiDataGrid-columnHeaders': {\n borderBottom: `1px solid ${theme.palette.divider}`,\n minHeight: 48,\n maxHeight: 48,\n },\n '& .MuiDataGrid-columnHeader': {\n borderTop: `1px solid ${theme.palette.divider} !important`,\n borderBottom: `1px solid ${theme.palette.divider} !important`,\n minWidth: '120px !important',\n },\n '& .MuiDataGrid-cell': {\n alignItems: 'stretch',\n borderTop: `1px solid ${theme.palette.divider}`,\n minWidth: 120,\n width: '100%',\n borderLeft: `1px solid ${theme.palette.divider}`,\n padding: 0,\n },\n '& .MuiDataGrid-cell:focus, & .MuiDataGrid-columnHeader:focus': {\n outline: 'none',\n },\n '& .MuiDataGrid-withBorderColor': {\n borderColor: theme.palette.divider,\n },\n '& .MuiDataGrid-virtualScroller': {\n overflowX: 'auto',\n },\n '& .MuiDataGrid-footerContainer': {\n borderTop: `1px solid ${theme.palette.divider}`,\n },\n}));\n\nexport const CellContent = styled(Box)({\n display: 'flex',\n alignItems: 'center',\n width: '100%',\n height: '100%',\n padding: 0,\n boxSizing: 'border-box',\n\n '& .MuiTypography-root': {\n width: '100%',\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n },\n});\n\nexport const ReadOnlyText = styled(Typography)(({ theme }) => ({\n color: theme.palette.text.primary,\n}));\n\nexport const Footer = styled(Stack)(({ theme }) => ({\n flexDirection: 'row',\n alignItems: 'center',\n justifyContent: 'space-between',\n borderTop: `1px solid ${theme.palette.divider}`,\n padding: theme.spacing(2, 3),\n gap: theme.spacing(2),\n flexWrap: 'wrap',\n}));\n\nexport const FooterTotal = styled(Stack)<StackProps>(({ theme }) => ({\n flexDirection: 'row',\n alignItems: 'center',\n gap: theme.spacing(0.5),\n}));\n","import Stack from '@mui/material/Stack';\nimport Typography from '@mui/material/Typography';\n\nimport Icon from 'components/Icon';\n\nimport { HeaderProps } from './props';\nimport { StyledBackButton, StyledChip } from './styles';\nimport { BULK_EDIT_DATAGRID_ACTIONS } from './Toolbar';\n\nexport const Header = ({ onClose, total, title }: HeaderProps) => {\n const showTotal = typeof total === 'number';\n\n return (\n <Stack\n direction=\"row\"\n alignItems=\"center\"\n gap={3}\n sx={{ px: 3, py: 0, minHeight: 'var(--layout-nav-horizontal-height)' }}\n >\n <StyledBackButton\n variant=\"text\"\n size=\"small\"\n startIcon={<Icon icon=\"CHEVRON_LEFT\" />}\n onClick={onClose}\n >\n Sair\n </StyledBackButton>\n\n <Stack\n flex={1}\n direction=\"row\"\n alignItems=\"center\"\n component=\"h2\"\n m={0}\n gap={1}\n >\n <Typography component=\"span\" variant=\"h6\">\n Editando\n </Typography>\n {showTotal && (\n <StyledChip\n component=\"span\"\n disabled\n label={total}\n size=\"small\"\n color=\"default\"\n />\n )}\n <Typography component=\"span\" variant=\"h6\">\n {title}\n </Typography>\n </Stack>\n <Stack\n direction=\"row\"\n alignItems=\"center\"\n justifyContent=\"flex-end\"\n gap={1}\n id={BULK_EDIT_DATAGRID_ACTIONS}\n />\n </Stack>\n );\n};\n","import { useCallback } from 'react';\nimport { GridToolbarColumnsButton } from '@mui/x-data-grid-premium';\n\nimport Icon from 'components/Icon';\nimport Portal from 'components/Portal';\n\nimport { BulkEditToolbarProps } from './props';\n\nexport const BULK_EDIT_DATAGRID_ACTIONS = 'bulk-edit-datagrid-actions';\n\nconst BulkEditToolbar = ({ setFilterButtonEl }: BulkEditToolbarProps) => {\n const handleColumnsButtonRef = useCallback(\n (button: HTMLButtonElement | null) => {\n setFilterButtonEl(button);\n },\n [setFilterButtonEl],\n );\n\n return (\n <Portal container={BULK_EDIT_DATAGRID_ACTIONS}>\n <GridToolbarColumnsButton\n ref={handleColumnsButtonRef}\n slotProps={{\n button: {\n color: 'inherit',\n startIcon: <Icon icon=\"COLUMNS\" />,\n children: 'Colunas',\n },\n }}\n />\n </Portal>\n );\n};\n\nexport default BulkEditToolbar;\n"]}
1
+ {"version":3,"sources":["../../../src/components/BulkEditModal/index.tsx","../../../src/components/BulkEditModal/BulkEditGridCell.tsx","../../../src/components/BulkEditModal/styles.ts","../../../src/components/BulkEditModal/Header.tsx","../../../src/components/BulkEditModal/Toolbar.tsx"],"names":["useCallback","useEffect","useMemo","useState","FormProvider","useForm","LinearProgress","Typography","memo","useRef","useFormContext","useWatch","Switch","TextField","Box","Button","Chip","Dialog","Stack","styled","DataGridPremium","BulkEditDialog","BulkEditContainer","StyledChip","theme","StyledBackButton","GridWrapper","StyledDataGrid","CellContent","ReadOnlyText","Footer","FooterTotal","jsx","AUTOCOMPLETE_SX","getInputProps","isNumber","formatDisplayValue","value","column","item","option","opt","selectedOption","DynamicEntityCell","fieldPath","entityValue","disabled","onSelectOption","autocomplete","baseOptions","options","Autocomplete_default","BulkEditGridCellComponent","rowIndex","itemId","onFieldChange","isFieldDisabled","setValue","control","fieldName","watchedValue","cellValue","changeSeqRef","pendingChangeRef","isDisabled","isIdField","displayValue","event","previousValue","result","recordValue","handleSelectOption","newValue","inputValue","rawValue","num","seq","revertValue","BulkEditGridCell","prev","next","GridToolbarColumnsButton","BULK_EDIT_DATAGRID_ACTIONS","BulkEditToolbar","setFilterButtonEl","handleColumnsButtonRef","button","Portal_default","Icon_default","Toolbar_default","jsxs","Header","onClose","total","title","DEFAULT_PAGE_SIZE_OPTIONS","resolveAlignment","BulkEditModalInner","open","header","items","columns","getItemId","isLoading","page","perPage","onPageChange","onRowsPerPageChange","showColumnButton","initialState","filterButtonEl","rows","totalPages","maxPage","safePage","paginationModel","pageSizeOptions","a","b","handlePaginationModelChange","model","handleFooterPageChange","newPage","handleFooterRowsPerPageChange","newRowsPerPage","dataGridColumns","align","baseWidth","params","visibleIndex","row","LoadingOverlay_default","Pagination_default","BulkEditModal","props","formMethods","BulkEditModal_default"],"mappings":"4VAAA,OAAS,eAAAA,EAAa,aAAAC,GAAW,WAAAC,EAAS,YAAAC,OAAgB,QAC1D,OAAS,gBAAAC,GAAc,WAAAC,OAAe,kBACtC,OAAOC,OAAoB,+BAC3B,OAAOC,OAAgB,2BCHvB,OAAS,QAAAC,GAAM,UAAAC,OAAc,QAC7B,OAAS,kBAAAC,GAAgB,YAAAC,OAAgB,kBACzC,OAAOC,OAAY,uBACnB,OAAOC,OAAe,0BACtB,OAAON,OAAg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Content":["import { useCallback, useEffect, useMemo, useState } from 'react';\nimport { FormProvider, useForm } from 'react-hook-form';\nimport LinearProgress from '@mui/material/LinearProgress';\nimport Typography from '@mui/material/Typography';\nimport type {\n GridSlots,\n GridSlotsComponentsProps,\n} from '@mui/x-data-grid-premium';\nimport {\n GridAlignment,\n GridColDef,\n GridPaginationModel,\n GridValidRowModel,\n} from '@mui/x-data-grid-premium';\n\nimport LoadingOverlay from 'components/DataGrid/LoadingOverlay';\nimport Pagination from 'components/DataView/Pagination';\n\nimport { BulkEditGridCell } from './BulkEditGridCell';\nimport { Header } from './Header';\nimport { type BulkEditModalInnerProps, type BulkEditModalProps } from './props';\nimport {\n BulkEditContainer,\n BulkEditDialog,\n Footer,\n FooterTotal,\n GridWrapper,\n StyledDataGrid,\n} from './styles';\nimport BulkEditToolbar from './Toolbar';\n\nconst DEFAULT_PAGE_SIZE_OPTIONS = [10, 25, 50, 100];\n\nconst resolveAlignment = <TItem extends Record<string, unknown>>(\n column: BulkEditModalInnerProps<TItem>['columns'][number],\n): GridAlignment => {\n if (column.type === 'number') return 'right';\n if (column.type === 'boolean') return 'center';\n return 'left';\n};\n\nconst BulkEditModalInner = <TItem extends Record<string, unknown>>({\n open,\n onClose,\n title,\n header,\n items,\n columns,\n getItemId,\n isLoading,\n page,\n perPage,\n total,\n onPageChange,\n onRowsPerPageChange,\n onFieldChange,\n isFieldDisabled,\n showColumnButton,\n initialState,\n}: BulkEditModalInnerProps<TItem>) => {\n const [filterButtonEl, setFilterButtonEl] =\n useState<HTMLButtonElement | null>(null);\n const rows = items;\n\n const totalPages = perPage > 0 ? Math.ceil(total / perPage) : 0;\n const maxPage = totalPages > 0 ? totalPages - 1 : 0;\n const safePage = Math.min(Math.max(page, 0), maxPage);\n\n const paginationModel = useMemo(\n () => ({\n page: safePage,\n pageSize: perPage,\n }),\n [perPage, safePage],\n );\n\n const pageSizeOptions = useMemo(() => {\n const options = perPage\n ? [perPage, ...DEFAULT_PAGE_SIZE_OPTIONS]\n : DEFAULT_PAGE_SIZE_OPTIONS;\n return Array.from(new Set(options)).sort((a, b) => a - b);\n }, [perPage]);\n\n const handlePaginationModelChange = useCallback(\n (model: GridPaginationModel) => {\n if (model.pageSize !== perPage) {\n onRowsPerPageChange(model.pageSize);\n }\n\n if (model.page !== page || model.pageSize !== perPage) {\n onPageChange(model.page, model.pageSize);\n }\n },\n [onPageChange, onRowsPerPageChange, page, perPage],\n );\n\n const handleFooterPageChange = useCallback(\n (newPage: number) => {\n handlePaginationModelChange({ page: newPage, pageSize: perPage });\n },\n [handlePaginationModelChange, perPage],\n );\n\n const handleFooterRowsPerPageChange = useCallback(\n (newRowsPerPage: number) => {\n handlePaginationModelChange({ page: safePage, pageSize: newRowsPerPage });\n },\n [handlePaginationModelChange, safePage],\n );\n\n const dataGridColumns = useMemo<GridColDef<GridValidRowModel>[]>(\n () =>\n columns.map(column => {\n const align = resolveAlignment(column);\n const baseWidth = column.type === 'boolean' ? 100 : 180;\n\n return {\n field: String(column.field),\n headerName: column.headerName,\n flex: 1,\n minWidth: baseWidth,\n disableColumnMenu: true,\n headerAlign: align,\n align,\n renderCell: params => {\n const visibleIndex = params.api.getRowIndexRelativeToVisibleRows(\n params.id,\n );\n const rowIndex =\n typeof visibleIndex === 'number' && visibleIndex > -1\n ? visibleIndex\n : 0;\n\n return (\n <BulkEditGridCell\n column={column}\n item={params.row as TItem}\n rowIndex={rowIndex}\n itemId={getItemId(params.row as TItem)}\n onFieldChange={onFieldChange}\n isFieldDisabled={isFieldDisabled}\n />\n );\n },\n };\n }),\n [columns, getItemId, isFieldDisabled, onFieldChange],\n );\n\n return (\n <BulkEditDialog open={open} onClose={onClose} fullWidth>\n <BulkEditContainer>\n {header ?? <Header onClose={onClose} total={total} title={title} />}\n {isLoading && <LinearProgress sx={{ height: 2 }} />}\n\n <GridWrapper>\n <StyledDataGrid\n columns={dataGridColumns}\n rows={rows as unknown as GridValidRowModel[]}\n getRowId={row => getItemId(row as TItem)}\n hideFooterSelectedRowCount\n hideFooter\n disableRowSelectionOnClick\n paginationModel={paginationModel}\n onPaginationModelChange={handlePaginationModelChange}\n pageSizeOptions={pageSizeOptions}\n paginationMode=\"server\"\n rowCount={total}\n rowHeight={56}\n loading={isLoading}\n slots={{\n loadingOverlay: LoadingOverlay,\n ...(showColumnButton && {\n toolbar: BulkEditToolbar as unknown as GridSlots['toolbar'],\n }),\n }}\n slotProps={{\n panel: { anchorEl: filterButtonEl },\n toolbar: {\n setFilterButtonEl,\n } as unknown as GridSlotsComponentsProps['toolbar'],\n }}\n initialState={initialState}\n />\n </GridWrapper>\n <Footer>\n <FooterTotal component=\"p\">\n <Typography component=\"span\" variant=\"body2\" color=\"text.disabled\">\n Total de itens:\n </Typography>\n <Typography component=\"span\" variant=\"body2\">\n {total}\n </Typography>\n </FooterTotal>\n <Pagination\n count={total}\n page={safePage}\n rowsPerPage={perPage}\n onPageChange={handleFooterPageChange}\n onRowsPerPageChange={handleFooterRowsPerPageChange}\n />\n </Footer>\n </BulkEditContainer>\n </BulkEditDialog>\n );\n};\n\nconst BulkEditModal = <TItem extends Record<string, unknown>>(\n props: BulkEditModalProps<TItem>,\n) => {\n const { items } = props;\n const formMethods = useForm<{ items: TItem[] }>({\n defaultValues: { items },\n });\n\n // O desempenho é melhor que values: { items } no useForm\n useEffect(() => {\n formMethods.reset({ items });\n }, [formMethods, items]);\n\n return (\n <FormProvider {...formMethods}>\n <BulkEditModalInner<TItem> {...props} />\n </FormProvider>\n );\n};\n\nexport * from './props';\n\nexport default BulkEditModal;\n","import { memo, useRef } from 'react';\nimport { useFormContext, useWatch } from 'react-hook-form';\nimport Switch from '@mui/material/Switch';\nimport TextField from '@mui/material/TextField';\nimport Typography from '@mui/material/Typography';\n\nimport Autocomplete from 'components/form/Autocomplete';\n\nimport {\n BulkEditGridCellProps,\n BulkEditModalColumn,\n BulkEditModalFieldChangeParams,\n DynamicEntityCellProps,\n} from './props';\nimport { CellContent, ReadOnlyText } from './styles';\n\nconst AUTOCOMPLETE_SX = {\n '& .MuiOutlinedInput-root': {\n px: 0,\n borderRadius: 0,\n background: 'transparent',\n '& fieldset, &:hover fieldset, &.Mui-focused fieldset': {\n background: 'transparent',\n borderRadius: 0,\n border: 'none',\n },\n },\n '& .MuiInputBase-input': {\n py: 0,\n height: 56,\n background: 'transparent',\n },\n} as const;\n\nconst getInputProps = (isNumber: boolean) => {\n return {\n disableUnderline: true,\n sx: {\n px: 0,\n '& input': {\n textAlign: isNumber ? 'right' : 'left',\n },\n },\n };\n};\n\nconst formatDisplayValue = <TItem extends Record<string, unknown>>(\n value: unknown,\n column: BulkEditModalColumn<TItem>,\n item: TItem,\n) => {\n if (value === null || value === undefined || value === '') {\n return null;\n }\n\n if (column.type === 'entity') {\n const option = column.options?.find(\n opt => opt.value?.toString() === value?.toString(),\n );\n if (option) {\n return option.label;\n }\n\n const selectedOption = column.getSelectedOption?.(item, String(value));\n if (selectedOption) {\n return selectedOption.label;\n }\n }\n\n if (typeof value === 'object') {\n if ('name' in (value as Record<string, unknown>)) {\n return String((value as { name: unknown }).name);\n }\n if ('label' in (value as Record<string, unknown>)) {\n return String((value as { label: unknown }).label);\n }\n if ('value' in (value as Record<string, unknown>)) {\n return String((value as { value: unknown }).value);\n }\n }\n\n if (typeof value === 'boolean') {\n return value ? 'Sim' : 'Não';\n }\n\n return String(value);\n};\n\nconst DynamicEntityCell = <TItem extends Record<string, unknown>>({\n column,\n item,\n fieldPath,\n entityValue,\n disabled,\n onSelectOption,\n}: DynamicEntityCellProps<TItem>) => {\n const autocomplete = column.useAutocomplete!();\n\n const baseOptions = autocomplete.options;\n const selectedOption =\n entityValue && !baseOptions.some(opt => String(opt.value) === entityValue)\n ? (autocomplete.resolveOption?.(entityValue) ??\n column.getSelectedOption?.(item, entityValue))\n : undefined;\n const options = selectedOption\n ? [selectedOption, ...baseOptions]\n : baseOptions;\n\n return (\n <CellContent>\n <Autocomplete\n fullWidth\n name={fieldPath}\n value={entityValue}\n options={options}\n loading={autocomplete.loading}\n onSearch={autocomplete.onSearch}\n onOpen={autocomplete.onOpen}\n onClose={autocomplete.onClose}\n onScrollEnd={autocomplete.onScrollEnd}\n filterOptions={autocomplete.filterOptions}\n {...(autocomplete.noOptionsText !== undefined && {\n noOptionsText: autocomplete.noOptionsText,\n })}\n disabled={disabled}\n size=\"small\"\n placeholder=\"Preencher\"\n sx={AUTOCOMPLETE_SX}\n disableClearable\n selectOnFocus\n onSelectOption={onSelectOption}\n />\n </CellContent>\n );\n};\n\nconst BulkEditGridCellComponent = <TItem extends Record<string, unknown>>({\n column,\n item,\n rowIndex,\n itemId,\n onFieldChange,\n isFieldDisabled,\n}: BulkEditGridCellProps<TItem>) => {\n const { setValue, control } = useFormContext();\n const fieldName = column.field;\n const fieldPath = `items.${rowIndex}.${String(fieldName)}`;\n const watchedValue = useWatch({\n control,\n name: fieldPath,\n defaultValue: item?.[fieldName],\n });\n const cellValue =\n watchedValue === undefined ? item?.[fieldName] : watchedValue;\n\n const changeSeqRef = useRef(0);\n const pendingChangeRef = useRef<{ seq: number; revertValue: unknown } | null>(\n null,\n );\n const isDisabled =\n column.readOnly ||\n (isFieldDisabled ? isFieldDisabled({ item, field: fieldName }) : false);\n const isIdField = String(fieldName) === 'id';\n\n if (column.readOnly || isIdField) {\n const displayValue = formatDisplayValue(cellValue, column, item);\n\n return (\n <CellContent>\n {displayValue ? (\n <ReadOnlyText variant=\"body2\">{displayValue}</ReadOnlyText>\n ) : (\n <Typography variant=\"body2\" color=\"text.disabled\">\n -\n </Typography>\n )}\n </CellContent>\n );\n }\n\n if (column.type === 'boolean') {\n return (\n <CellContent sx={{ justifyContent: 'center' }}>\n <Switch\n color=\"primary\"\n checked={Boolean(cellValue)}\n inputProps={{ 'aria-label': column.headerName }}\n onChange={event => {\n const value = event.target.checked;\n const previousValue = cellValue;\n\n setValue(fieldPath, value as TItem[keyof TItem], {\n shouldDirty: true,\n shouldTouch: true,\n });\n\n const result = onFieldChange({\n itemId,\n field: fieldName,\n value,\n previousValue,\n } as BulkEditModalFieldChangeParams<TItem>);\n\n if (\n result &&\n typeof (result as Promise<unknown>).catch === 'function'\n ) {\n (result as Promise<unknown>).catch(() => {\n setValue(fieldPath, previousValue as TItem[keyof TItem], {\n shouldDirty: true,\n shouldTouch: true,\n });\n });\n }\n }}\n disabled={isDisabled}\n />\n </CellContent>\n );\n }\n\n if (column.type === 'entity') {\n let entityValue = '';\n\n if (cellValue !== null && cellValue !== undefined && cellValue !== '') {\n if (typeof cellValue === 'object') {\n const recordValue = cellValue as Record<string, unknown>;\n\n if ('id' in recordValue) {\n entityValue = String(recordValue.id ?? '');\n } else if ('value' in recordValue) {\n entityValue = String(recordValue.value ?? '');\n }\n } else {\n entityValue = String(cellValue);\n }\n }\n\n const handleSelectOption = (newValue: unknown) => {\n const previousValue = cellValue;\n\n const result = onFieldChange({\n itemId,\n field: fieldName,\n value: newValue,\n previousValue,\n } as BulkEditModalFieldChangeParams<TItem>);\n\n if (result && typeof (result as Promise<unknown>).catch === 'function') {\n (result as Promise<unknown>).catch(() => {\n setValue(fieldPath, previousValue as TItem[keyof TItem], {\n shouldDirty: true,\n shouldTouch: true,\n });\n });\n }\n };\n\n if (column.useAutocomplete) {\n return (\n <DynamicEntityCell\n column={column}\n item={item}\n fieldPath={fieldPath}\n entityValue={entityValue}\n disabled={isDisabled}\n onSelectOption={handleSelectOption}\n />\n );\n }\n\n const baseOptions = column.options ?? [];\n const selectedOption =\n entityValue && !baseOptions.some(opt => String(opt.value) === entityValue)\n ? column.getSelectedOption?.(item, entityValue)\n : undefined;\n const options = selectedOption\n ? [selectedOption, ...baseOptions]\n : baseOptions;\n\n return (\n <CellContent>\n <Autocomplete\n fullWidth\n name={fieldPath}\n value={entityValue}\n options={options}\n disabled={isDisabled}\n size=\"small\"\n placeholder=\"Preencher\"\n sx={AUTOCOMPLETE_SX}\n disableClearable\n onSelectOption={handleSelectOption}\n />\n </CellContent>\n );\n }\n\n const isNumber = column.type === 'number';\n const inputValue = cellValue ?? '';\n\n return (\n <CellContent sx={{ justifyContent: isNumber ? 'flex-end' : 'flex-start' }}>\n <TextField\n fullWidth\n size=\"small\"\n type={isNumber ? 'number' : 'text'}\n placeholder=\"Preencher\"\n aria-label={column.headerName}\n name={fieldPath}\n value={inputValue as string | number}\n variant=\"standard\"\n InputProps={{\n ...getInputProps(isNumber),\n ...(isNumber && { inputProps: { min: 0 } }),\n }}\n disabled={isDisabled}\n onWheel={event => {\n if (isNumber) {\n (event.target as HTMLInputElement).blur();\n }\n }}\n onKeyDown={event => {\n if (event.key === ' ' || event.key === 'Spacebar') {\n event.stopPropagation();\n }\n if (isNumber && (event.key === '-' || event.key === 'e')) {\n event.preventDefault();\n }\n }}\n onChange={event => {\n const rawValue = event.target.value;\n let value: string | number = rawValue;\n if (isNumber) {\n if (rawValue === '') {\n value = '';\n } else {\n const num = Number(rawValue);\n value = num < 0 ? 0 : num;\n }\n }\n setValue(fieldPath, value as TItem[keyof TItem], {\n shouldDirty: true,\n shouldTouch: true,\n });\n\n const seq = (changeSeqRef.current += 1);\n const revertValue = pendingChangeRef.current\n ? pendingChangeRef.current.revertValue\n : cellValue;\n pendingChangeRef.current = { seq, revertValue };\n\n const result = onFieldChange({\n itemId,\n field: fieldName,\n value,\n } as BulkEditModalFieldChangeParams<TItem>);\n\n if (\n result &&\n typeof (result as Promise<unknown>).then === 'function'\n ) {\n (result as Promise<unknown>).then(\n () => {\n if (pendingChangeRef.current?.seq === seq) {\n pendingChangeRef.current = null;\n }\n },\n () => {\n if (pendingChangeRef.current?.seq !== seq) {\n return;\n }\n\n pendingChangeRef.current = null;\n setValue(fieldPath, revertValue as TItem[keyof TItem], {\n shouldDirty: true,\n shouldTouch: true,\n });\n },\n );\n }\n }}\n />\n </CellContent>\n );\n};\n\nexport const BulkEditGridCell = memo(\n BulkEditGridCellComponent,\n (prev, next) =>\n prev.itemId === next.itemId &&\n prev.rowIndex === next.rowIndex &&\n prev.column === next.column &&\n prev.isFieldDisabled === next.isFieldDisabled,\n) as typeof BulkEditGridCellComponent;\n","import Box from '@mui/material/Box';\nimport Button, { ButtonProps } from '@mui/material/Button';\nimport Chip, { ChipProps } from '@mui/material/Chip';\nimport Dialog from '@mui/material/Dialog';\nimport Stack, { StackProps } from '@mui/material/Stack';\nimport { styled } from '@mui/material/styles';\nimport Typography from '@mui/material/Typography';\nimport { DataGridPremium } from '@mui/x-data-grid-premium';\n\nexport const BulkEditDialog = styled(Dialog)({\n '& .MuiDialog-paper': {\n margin: 0,\n borderRadius: 0,\n maxHeight: '100vh',\n padding: 0,\n height: '100vh',\n width: '100%',\n maxWidth: '100%',\n },\n});\n\nexport const BulkEditContainer = styled(Stack)({\n height: '100%',\n minHeight: 0,\n});\n\nexport const StyledChip = styled(Chip)<ChipProps>(({ theme }) => ({\n padding: 0,\n '& .MuiChip-label': {\n color: theme.palette.text.secondary,\n fontWeight: '700',\n },\n}));\n\nexport const StyledBackButton = styled(Button)<ButtonProps>(({ theme }) => ({\n color: theme.palette.text.secondary,\n}));\n\nexport const GridWrapper = styled(Box)({\n flex: 1,\n minHeight: 0,\n padding: 0,\n display: 'flex',\n alignItems: 'stretch',\n});\n\nexport const StyledDataGrid = styled(DataGridPremium)(({ theme }) => ({\n flex: 1,\n height: '100%',\n minHeight: 320,\n borderRadius: theme.shape.borderRadius,\n backgroundColor: theme.palette.background.paper,\n '& .MuiDataGrid-columnHeaders': {\n borderBottom: `1px solid ${theme.palette.divider}`,\n minHeight: 48,\n maxHeight: 48,\n },\n '& .MuiDataGrid-columnHeader': {\n borderTop: `1px solid ${theme.palette.divider} !important`,\n borderBottom: `1px solid ${theme.palette.divider} !important`,\n minWidth: '120px !important',\n },\n '& .MuiDataGrid-cell': {\n alignItems: 'stretch',\n borderTop: `1px solid ${theme.palette.divider}`,\n minWidth: 120,\n width: '100%',\n borderLeft: `1px solid ${theme.palette.divider}`,\n padding: 0,\n },\n '& .MuiDataGrid-cell:focus, & .MuiDataGrid-columnHeader:focus': {\n outline: 'none',\n },\n '& .MuiDataGrid-withBorderColor': {\n borderColor: theme.palette.divider,\n },\n '& .MuiDataGrid-virtualScroller': {\n overflowX: 'auto',\n },\n '& .MuiDataGrid-footerContainer': {\n borderTop: `1px solid ${theme.palette.divider}`,\n },\n}));\n\nexport const CellContent = styled(Box)({\n display: 'flex',\n alignItems: 'center',\n width: '100%',\n height: '100%',\n padding: 0,\n boxSizing: 'border-box',\n\n '& .MuiTypography-root': {\n width: '100%',\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n },\n});\n\nexport const ReadOnlyText = styled(Typography)(({ theme }) => ({\n color: theme.palette.text.primary,\n}));\n\nexport const Footer = styled(Stack)(({ theme }) => ({\n flexDirection: 'row',\n alignItems: 'center',\n justifyContent: 'space-between',\n borderTop: `1px solid ${theme.palette.divider}`,\n padding: theme.spacing(2, 3),\n gap: theme.spacing(2),\n flexWrap: 'wrap',\n}));\n\nexport const FooterTotal = styled(Stack)<StackProps>(({ theme }) => ({\n flexDirection: 'row',\n alignItems: 'center',\n gap: theme.spacing(0.5),\n}));\n","import Stack from '@mui/material/Stack';\nimport Typography from '@mui/material/Typography';\n\nimport Icon from 'components/Icon';\n\nimport { HeaderProps } from './props';\nimport { StyledBackButton, StyledChip } from './styles';\nimport { BULK_EDIT_DATAGRID_ACTIONS } from './Toolbar';\n\nexport const Header = ({ onClose, total, title }: HeaderProps) => {\n const showTotal = typeof total === 'number';\n\n return (\n <Stack\n direction=\"row\"\n alignItems=\"center\"\n gap={3}\n sx={{ px: 3, py: 0, minHeight: 'var(--layout-nav-horizontal-height)' }}\n >\n <StyledBackButton\n variant=\"text\"\n size=\"small\"\n startIcon={<Icon icon=\"CHEVRON_LEFT\" />}\n onClick={onClose}\n >\n Sair\n </StyledBackButton>\n\n <Stack\n flex={1}\n direction=\"row\"\n alignItems=\"center\"\n component=\"h2\"\n m={0}\n gap={1}\n >\n <Typography component=\"span\" variant=\"h6\">\n Editando\n </Typography>\n {showTotal && (\n <StyledChip\n component=\"span\"\n disabled\n label={total}\n size=\"small\"\n color=\"default\"\n />\n )}\n <Typography component=\"span\" variant=\"h6\">\n {title}\n </Typography>\n </Stack>\n <Stack\n direction=\"row\"\n alignItems=\"center\"\n justifyContent=\"flex-end\"\n gap={1}\n id={BULK_EDIT_DATAGRID_ACTIONS}\n />\n </Stack>\n );\n};\n","import { useCallback } from 'react';\nimport { GridToolbarColumnsButton } from '@mui/x-data-grid-premium';\n\nimport Icon from 'components/Icon';\nimport Portal from 'components/Portal';\n\nimport { BulkEditToolbarProps } from './props';\n\nexport const BULK_EDIT_DATAGRID_ACTIONS = 'bulk-edit-datagrid-actions';\n\nconst BulkEditToolbar = ({ setFilterButtonEl }: BulkEditToolbarProps) => {\n const handleColumnsButtonRef = useCallback(\n (button: HTMLButtonElement | null) => {\n setFilterButtonEl(button);\n },\n [setFilterButtonEl],\n );\n\n return (\n <Portal container={BULK_EDIT_DATAGRID_ACTIONS}>\n <GridToolbarColumnsButton\n ref={handleColumnsButtonRef}\n slotProps={{\n button: {\n color: 'inherit',\n startIcon: <Icon icon=\"COLUMNS\" />,\n children: 'Colunas',\n },\n }}\n />\n </Portal>\n );\n};\n\nexport default BulkEditToolbar;\n"]}
@@ -90,7 +90,7 @@ declare const SelectionOverlay: _emotion_styled.StyledComponent<_mui_material_St
90
90
  }, keyof _mui_material_OverridableComponent.CommonProps | keyof _mui_material_Stack.StackOwnProps> & _mui_system.MUIStyledCommonProps<_mui_material_styles.Theme>, {}, {}>;
91
91
  declare const SelectionCount: _emotion_styled.StyledComponent<_mui_material_Typography.TypographyOwnProps & _mui_material_OverridableComponent.CommonProps & Omit<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & {
92
92
  ref?: ((instance: HTMLSpanElement | null) => void) | react.RefObject<HTMLSpanElement> | null | undefined;
93
- }, "typography" | "zIndex" | "fontFamily" | "fontWeight" | "children" | "pt" | "className" | "style" | "classes" | "sx" | "variant" | "border" | "boxShadow" | "alignContent" | "alignItems" | "alignSelf" | "bottom" | "boxSizing" | "color" | "columnGap" | "display" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "fontSize" | "fontStyle" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "height" | "justifyContent" | "justifyItems" | "justifySelf" | "left" | "letterSpacing" | "lineHeight" | "marginBlockEnd" | "marginBlockStart" | "marginBottom" | "marginInlineEnd" | "marginInlineStart" | "marginLeft" | "marginRight" | "marginTop" | "maxHeight" | "maxWidth" | "minHeight" | "minWidth" | "order" | "paddingBlockEnd" | "paddingBlockStart" | "paddingBottom" | "paddingInlineEnd" | "paddingInlineStart" | "paddingLeft" | "paddingRight" | "paddingTop" | "position" | "right" | "rowGap" | "textAlign" | "textOverflow" | "textTransform" | "top" | "visibility" | "whiteSpace" | "width" | "borderBottom" | "borderColor" | "borderLeft" | "borderRadius" | "borderRight" | "borderTop" | "flex" | "gap" | "gridArea" | "gridColumn" | "gridRow" | "margin" | "marginBlock" | "marginInline" | "overflow" | "padding" | "paddingBlock" | "paddingInline" | "bgcolor" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "marginX" | "my" | "marginY" | "p" | "pr" | "pb" | "pl" | "px" | "paddingX" | "py" | "paddingY" | "displayPrint" | "align" | "gutterBottom" | "noWrap" | "paragraph" | "variantMapping"> & _mui_system.MUIStyledCommonProps<_mui_material_styles.Theme>, {}, {}>;
93
+ }, "fontFamily" | "children" | "pt" | "className" | "style" | "classes" | "sx" | "variant" | "border" | "boxShadow" | "fontWeight" | "zIndex" | "alignContent" | "alignItems" | "alignSelf" | "bottom" | "boxSizing" | "color" | "columnGap" | "display" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "fontSize" | "fontStyle" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "height" | "justifyContent" | "justifyItems" | "justifySelf" | "left" | "letterSpacing" | "lineHeight" | "marginBlockEnd" | "marginBlockStart" | "marginBottom" | "marginInlineEnd" | "marginInlineStart" | "marginLeft" | "marginRight" | "marginTop" | "maxHeight" | "maxWidth" | "minHeight" | "minWidth" | "order" | "paddingBlockEnd" | "paddingBlockStart" | "paddingBottom" | "paddingInlineEnd" | "paddingInlineStart" | "paddingLeft" | "paddingRight" | "paddingTop" | "position" | "right" | "rowGap" | "textAlign" | "textOverflow" | "textTransform" | "top" | "visibility" | "whiteSpace" | "width" | "borderBottom" | "borderColor" | "borderLeft" | "borderRadius" | "borderRight" | "borderTop" | "flex" | "gap" | "gridArea" | "gridColumn" | "gridRow" | "margin" | "marginBlock" | "marginInline" | "overflow" | "padding" | "paddingBlock" | "paddingInline" | "bgcolor" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "marginX" | "my" | "marginY" | "p" | "pr" | "pb" | "pl" | "px" | "paddingX" | "py" | "paddingY" | "typography" | "displayPrint" | "align" | "gutterBottom" | "noWrap" | "paragraph" | "variantMapping"> & _mui_system.MUIStyledCommonProps<_mui_material_styles.Theme>, {}, {}>;
94
94
  declare const SelectionActions: _emotion_styled.StyledComponent<_mui_material_Stack.StackOwnProps & _mui_material_OverridableComponent.CommonProps & Omit<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
95
95
  ref?: ((instance: HTMLDivElement | null) => void) | react.RefObject<HTMLDivElement> | null | undefined;
96
96
  }, keyof _mui_material_OverridableComponent.CommonProps | keyof _mui_material_Stack.StackOwnProps> & _mui_system.MUIStyledCommonProps<_mui_material_styles.Theme>, {}, {}>;
@@ -3,17 +3,32 @@ import { ReactNode } from 'react';
3
3
  import { DialogActionsProps } from '@mui/material/DialogActions';
4
4
  import { DrawerProps as DrawerProps$1 } from '@mui/material/Drawer';
5
5
  import { StackProps } from '@mui/material/Stack';
6
+ import { SxProps, Theme } from '@mui/material/styles';
7
+ import { Props } from 'simplebar-react';
8
+
9
+ type ScrollbarProps = Props & {
10
+ sx?: SxProps<Theme>;
11
+ children?: React.ReactNode;
12
+ fillContent?: boolean;
13
+ naturalScroll?: boolean;
14
+ slotProps?: {
15
+ wrapper?: SxProps<Theme>;
16
+ contentWrapper?: SxProps<Theme>;
17
+ content?: Partial<SxProps<Theme>>;
18
+ };
19
+ };
6
20
 
7
21
  interface DrawerProps extends DrawerProps$1 {
8
22
  headerTitle: ReactNode;
9
23
  headerProps?: StackProps;
10
24
  onClose?: VoidFunction;
11
25
  contentProps?: StackProps;
26
+ scrollbarProps?: ScrollbarProps;
12
27
  maxWidth?: number;
13
28
  actions?: ReactNode;
14
29
  actionsProps?: DialogActionsProps;
15
30
  }
16
31
 
17
- declare const Drawer: ({ headerTitle, headerProps, onClose, children, contentProps, maxWidth, actions, actionsProps, id, ...other }: DrawerProps) => react_jsx_runtime.JSX.Element;
32
+ declare const Drawer: ({ headerTitle, headerProps, onClose, children, contentProps, scrollbarProps, maxWidth, actions, actionsProps, id, ...other }: DrawerProps) => react_jsx_runtime.JSX.Element;
18
33
 
19
34
  export { Drawer as default };
@@ -1,4 +1,4 @@
1
- export { a as default } from '../../chunk-ADNBF5AS.js';
1
+ export { a as default } from '../../chunk-Y5SAYYIA.js';
2
2
  import '../../chunk-F65ZXAGV.js';
3
3
  import '../../chunk-VJW7L44O.js';
4
4
  import '../../chunk-Z6YXPKWP.js';
@@ -1,7 +1,7 @@
1
1
  export { a as FilterOperator, b as SortType } from '../../chunk-P64QBDAO.js';
2
2
  import '../../chunk-4P2L7UJA.js';
3
3
  import { a as a$4 } from '../../chunk-E5SBGF5G.js';
4
- import { d, c } from '../../chunk-A7QSCOUE.js';
4
+ import { d, c } from '../../chunk-2W5FGLTC.js';
5
5
  import { h, a as a$6 } from '../../chunk-OF6623HG.js';
6
6
  import { d as d$1 } from '../../chunk-WRS6EB73.js';
7
7
  import '../../chunk-IR7WWQME.js';
@@ -1,4 +1,4 @@
1
- import { d } from '../../chunk-A7QSCOUE.js';
1
+ import { d } from '../../chunk-2W5FGLTC.js';
2
2
  import s from '@mui/material/Typography';
3
3
  import { jsxs, jsx } from 'react/jsx-runtime';
4
4
 
@@ -12,6 +12,7 @@ declare const useSnackbar: () => {
12
12
  custom: (jsx: (id: string | number) => react.ReactElement<any, string | react.JSXElementConstructor<any>>, data?: ExternalToast | undefined) => string | number;
13
13
  message: (message: string | number | boolean | react.ReactElement<any, string | react.JSXElementConstructor<any>> | Iterable<ReactNode> | react.ReactPortal | (() => ReactNode) | null | undefined, data?: ExternalToast | undefined) => string | number;
14
14
  promise: <ToastData>(promise: Promise<ToastData> | (() => Promise<ToastData>), data?: ({
15
+ cancel?: ReactNode | sonner.Action;
15
16
  className?: string | undefined;
16
17
  style?: react.CSSProperties | undefined;
17
18
  position?: ("top-left" | "top-center" | "top-right" | "bottom-left" | "bottom-center" | "bottom-right") | undefined;
@@ -20,7 +21,6 @@ declare const useSnackbar: () => {
20
21
  icon?: ReactNode;
21
22
  duration?: number | undefined;
22
23
  onDismiss?: ((toast: sonner.ToastT) => void) | undefined;
23
- cancel?: ReactNode | sonner.Action;
24
24
  richColors?: boolean | undefined;
25
25
  invert?: boolean | undefined;
26
26
  closeButton?: boolean | undefined;
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { C as CustomShadows } from './index-5a5e5dc8.js';
2
- export { d as ColorType, k as action, j as background, l as basePalette, o as colorSchemes, h as common, c as components, a as createShadowColor, b as customShadows, n as darkPalette, r as defaultFont, f as error, g as grey, i as info, m as lightPalette, p as primary, u as primaryFont, s as secondary, v as secondaryFont, q as shadows, e as success, t as text, x as typography, w as warning } from './index-5a5e5dc8.js';
1
+ import { C as CustomShadows } from './index-c8f1e6e7.js';
2
+ export { d as ColorType, k as action, j as background, l as basePalette, o as colorSchemes, h as common, c as components, a as createShadowColor, b as customShadows, n as darkPalette, r as defaultFont, f as error, g as grey, i as info, m as lightPalette, p as primary, u as primaryFont, s as secondary, v as secondaryFont, q as shadows, e as success, t as text, x as typography, w as warning } from './index-c8f1e6e7.js';
3
3
  export { S as SettingsContextValue, _ as SettingsProvider, T as ThemeProviderProps, u as useSettingsContext } from './settings-provider-38d09283.js';
4
4
  export { THEME_CONFIG, default as ThemeProvider } from './theme/theme-provider.js';
5
5
  import { S as SettingsState } from './settings-583c107c.js';
@@ -1,4 +1,4 @@
1
- export { d as ColorType, k as action, j as background, l as basePalette, o as colorSchemes, h as common, c as components, a as createShadowColor, b as customShadows, n as darkPalette, r as defaultFont, f as error, g as grey, i as info, m as lightPalette, p as primary, u as primaryFont, s as secondary, v as secondaryFont, q as shadows, e as success, t as text, x as typography, w as warning } from '../../index-5a5e5dc8.js';
1
+ export { d as ColorType, k as action, j as background, l as basePalette, o as colorSchemes, h as common, c as components, a as createShadowColor, b as customShadows, n as darkPalette, r as defaultFont, f as error, g as grey, i as info, m as lightPalette, p as primary, u as primaryFont, s as secondary, v as secondaryFont, q as shadows, e as success, t as text, x as typography, w as warning } from '../../index-c8f1e6e7.js';
2
2
  import '@mui/lab/TimelineConnector';
3
3
  import '@mui/system';
4
4
  import '@mui/lab/TimelineDot';
@@ -173,7 +173,7 @@ declare function paper({ theme, color, dropdown }: PaperProps): {
173
173
  float?: csstype.Property.Float | readonly NonNullable<csstype.Property.Float | undefined>[] | readonly csstype.Property.Float[] | undefined;
174
174
  floodColor?: readonly string[] | csstype.Property.FloodColor | readonly csstype.Property.FloodColor[] | undefined;
175
175
  floodOpacity?: readonly ((string & {}) | csstype.Globals)[] | csstype.Property.FloodOpacity | readonly NonNullable<csstype.Property.FloodOpacity | undefined>[] | undefined;
176
- fontFamily?: csstype.Property.FontFamily | readonly string[] | readonly csstype.Property.FontFamily[] | undefined;
176
+ fontFamily?: readonly string[] | csstype.Property.FontFamily | readonly csstype.Property.FontFamily[] | undefined;
177
177
  fontFeatureSettings?: readonly string[] | csstype.Property.FontFeatureSettings | readonly csstype.Property.FontFeatureSettings[] | undefined;
178
178
  fontKerning?: csstype.Property.FontKerning | readonly NonNullable<csstype.Property.FontKerning | undefined>[] | readonly csstype.Property.FontKerning[] | undefined;
179
179
  fontLanguageOverride?: readonly string[] | csstype.Property.FontLanguageOverride | readonly csstype.Property.FontLanguageOverride[] | undefined;
@@ -197,7 +197,7 @@ declare function paper({ theme, color, dropdown }: PaperProps): {
197
197
  fontVariantNumeric?: readonly string[] | csstype.Property.FontVariantNumeric | readonly csstype.Property.FontVariantNumeric[] | undefined;
198
198
  fontVariantPosition?: csstype.Property.FontVariantPosition | readonly NonNullable<csstype.Property.FontVariantPosition | undefined>[] | readonly csstype.Property.FontVariantPosition[] | undefined;
199
199
  fontVariationSettings?: readonly string[] | csstype.Property.FontVariationSettings | readonly csstype.Property.FontVariationSettings[] | undefined;
200
- fontWeight?: csstype.Property.FontWeight | readonly NonNullable<csstype.Property.FontWeight | undefined>[] | readonly ((string & {}) | csstype.Globals | "bold" | "normal" | "bolder" | "lighter")[] | undefined;
200
+ fontWeight?: csstype.Property.FontWeight | readonly NonNullable<csstype.Property.FontWeight | undefined>[] | readonly ("bold" | (string & {}) | csstype.Globals | "normal" | "bolder" | "lighter")[] | undefined;
201
201
  fontWidth?: readonly string[] | csstype.Property.FontWidth | readonly csstype.Property.FontWidth[] | undefined;
202
202
  forcedColorAdjust?: csstype.Property.ForcedColorAdjust | readonly NonNullable<csstype.Property.ForcedColorAdjust | undefined>[] | readonly csstype.Property.ForcedColorAdjust[] | undefined;
203
203
  gridAutoColumns?: readonly (string | (string & {}))[] | csstype.Property.GridAutoColumns<string | number> | readonly NonNullable<csstype.Property.GridAutoColumns<string | number> | undefined>[] | undefined;
@@ -460,9 +460,9 @@ declare function paper({ theme, color, dropdown }: PaperProps): {
460
460
  x?: readonly (string | (string & {}))[] | csstype.Property.X<string | number> | readonly NonNullable<csstype.Property.X<string | number> | undefined>[] | undefined;
461
461
  y?: readonly (string | (string & {}))[] | csstype.Property.Y<string | number> | readonly NonNullable<csstype.Property.Y<string | number> | undefined>[] | undefined;
462
462
  zIndex?: readonly ((string & {}) | csstype.Globals | "auto")[] | csstype.Property.ZIndex | readonly NonNullable<csstype.Property.ZIndex | undefined>[] | undefined;
463
- zoom?: csstype.Property.Zoom | readonly NonNullable<csstype.Property.Zoom | undefined>[] | readonly ((string & {}) | csstype.Globals | "normal" | "reset")[] | undefined;
463
+ zoom?: csstype.Property.Zoom | readonly NonNullable<csstype.Property.Zoom | undefined>[] | readonly ("reset" | (string & {}) | csstype.Globals | "normal")[] | undefined;
464
464
  all?: csstype.Globals | readonly NonNullable<csstype.Globals | undefined>[] | readonly csstype.Globals[] | undefined;
465
- animation?: csstype.Property.Animation<string & {}> | readonly NonNullable<csstype.Property.Animation<string & {}> | undefined>[] | readonly ((string & {}) | csstype.Globals | "normal" | "reverse" | "none" | "auto" | "alternate" | "alternate-reverse" | "backwards" | "both" | "forwards" | "infinite" | "paused" | "running" | "ease" | "ease-in" | "ease-in-out" | "ease-out" | "step-end" | "step-start" | "linear")[] | undefined;
465
+ animation?: csstype.Property.Animation<string & {}> | readonly NonNullable<csstype.Property.Animation<string & {}> | undefined>[] | readonly ("reverse" | (string & {}) | csstype.Globals | "none" | "auto" | "normal" | "alternate" | "alternate-reverse" | "backwards" | "both" | "forwards" | "infinite" | "paused" | "running" | "ease" | "ease-in" | "ease-in-out" | "ease-out" | "step-end" | "step-start" | "linear")[] | undefined;
466
466
  animationRange?: readonly (string | (string & {}))[] | csstype.Property.AnimationRange<string | number> | readonly NonNullable<csstype.Property.AnimationRange<string | number> | undefined>[] | undefined;
467
467
  background?: readonly (string | (string & {}))[] | csstype.Property.Background<string | number> | readonly NonNullable<csstype.Property.Background<string | number> | undefined>[] | undefined;
468
468
  border?: readonly (string | (string & {}))[] | csstype.Property.Border<string | number> | readonly NonNullable<csstype.Property.Border<string | number> | undefined>[] | undefined;
@@ -474,7 +474,7 @@ declare function paper({ theme, color, dropdown }: PaperProps): {
474
474
  borderBlockWidth?: readonly (string | (string & {}))[] | csstype.Property.BorderBlockWidth<string | number> | readonly NonNullable<csstype.Property.BorderBlockWidth<string | number> | undefined>[] | undefined;
475
475
  borderBottom?: readonly (string | (string & {}))[] | csstype.Property.BorderBottom<string | number> | readonly NonNullable<csstype.Property.BorderBottom<string | number> | undefined>[] | undefined;
476
476
  borderColor?: readonly string[] | csstype.Property.BorderColor | readonly csstype.Property.BorderColor[] | undefined;
477
- borderImage?: csstype.Property.BorderImage | readonly NonNullable<csstype.Property.BorderImage | undefined>[] | readonly ((string & {}) | csstype.Globals | "repeat" | "none" | "round" | "space" | "stretch")[] | undefined;
477
+ borderImage?: csstype.Property.BorderImage | readonly NonNullable<csstype.Property.BorderImage | undefined>[] | readonly ("repeat" | (string & {}) | csstype.Globals | "none" | "round" | "space" | "stretch")[] | undefined;
478
478
  borderInline?: readonly (string | (string & {}))[] | csstype.Property.BorderInline<string | number> | readonly NonNullable<csstype.Property.BorderInline<string | number> | undefined>[] | undefined;
479
479
  borderInlineColor?: readonly string[] | csstype.Property.BorderInlineColor | readonly csstype.Property.BorderInlineColor[] | undefined;
480
480
  borderInlineEnd?: readonly (string | (string & {}))[] | csstype.Property.BorderInlineEnd<string | number> | readonly NonNullable<csstype.Property.BorderInlineEnd<string | number> | undefined>[] | undefined;
@@ -509,7 +509,7 @@ declare function paper({ theme, color, dropdown }: PaperProps): {
509
509
  marginBlock?: readonly (string | (string & {}))[] | csstype.Property.MarginBlock<string | number> | readonly NonNullable<csstype.Property.MarginBlock<string | number> | undefined>[] | undefined;
510
510
  marginInline?: readonly (string | (string & {}))[] | csstype.Property.MarginInline<string | number> | readonly NonNullable<csstype.Property.MarginInline<string | number> | undefined>[] | undefined;
511
511
  mask?: readonly (string | (string & {}))[] | csstype.Property.Mask<string | number> | readonly NonNullable<csstype.Property.Mask<string | number> | undefined>[] | undefined;
512
- maskBorder?: csstype.Property.MaskBorder | readonly NonNullable<csstype.Property.MaskBorder | undefined>[] | readonly ((string & {}) | csstype.Globals | "repeat" | "none" | "round" | "space" | "alpha" | "luminance" | "stretch")[] | undefined;
512
+ maskBorder?: csstype.Property.MaskBorder | readonly NonNullable<csstype.Property.MaskBorder | undefined>[] | readonly ("repeat" | (string & {}) | csstype.Globals | "none" | "round" | "space" | "alpha" | "luminance" | "stretch")[] | undefined;
513
513
  motion?: readonly (string | (string & {}))[] | csstype.Property.Offset<string | number> | readonly NonNullable<csstype.Property.Offset<string | number> | undefined>[] | undefined;
514
514
  offset?: readonly (string | (string & {}))[] | csstype.Property.Offset<string | number> | readonly NonNullable<csstype.Property.Offset<string | number> | undefined>[] | undefined;
515
515
  outline?: readonly (string | (string & {}))[] | csstype.Property.Outline<string | number> | readonly NonNullable<csstype.Property.Outline<string | number> | undefined>[] | undefined;
@@ -758,8 +758,8 @@ declare function paper({ theme, color, dropdown }: PaperProps): {
758
758
  WebkitUserModify?: csstype.Property.WebkitUserModify | readonly NonNullable<csstype.Property.WebkitUserModify | undefined>[] | readonly csstype.Property.WebkitUserModify[] | undefined;
759
759
  WebkitUserSelect?: csstype.Property.WebkitUserSelect | readonly NonNullable<csstype.Property.WebkitUserSelect | undefined>[] | readonly csstype.Property.WebkitUserSelect[] | undefined;
760
760
  WebkitWritingMode?: csstype.Property.WritingMode | readonly NonNullable<csstype.Property.WritingMode | undefined>[] | readonly csstype.Property.WritingMode[] | undefined;
761
- MozAnimation?: csstype.Property.Animation<string & {}> | readonly NonNullable<csstype.Property.Animation<string & {}> | undefined>[] | readonly ((string & {}) | csstype.Globals | "normal" | "reverse" | "none" | "auto" | "alternate" | "alternate-reverse" | "backwards" | "both" | "forwards" | "infinite" | "paused" | "running" | "ease" | "ease-in" | "ease-in-out" | "ease-out" | "step-end" | "step-start" | "linear")[] | undefined;
762
- MozBorderImage?: csstype.Property.BorderImage | readonly NonNullable<csstype.Property.BorderImage | undefined>[] | readonly ((string & {}) | csstype.Globals | "repeat" | "none" | "round" | "space" | "stretch")[] | undefined;
761
+ MozAnimation?: csstype.Property.Animation<string & {}> | readonly NonNullable<csstype.Property.Animation<string & {}> | undefined>[] | readonly ("reverse" | (string & {}) | csstype.Globals | "none" | "auto" | "normal" | "alternate" | "alternate-reverse" | "backwards" | "both" | "forwards" | "infinite" | "paused" | "running" | "ease" | "ease-in" | "ease-in-out" | "ease-out" | "step-end" | "step-start" | "linear")[] | undefined;
762
+ MozBorderImage?: csstype.Property.BorderImage | readonly NonNullable<csstype.Property.BorderImage | undefined>[] | readonly ("repeat" | (string & {}) | csstype.Globals | "none" | "round" | "space" | "stretch")[] | undefined;
763
763
  MozColumnRule?: readonly (string | (string & {}))[] | csstype.Property.ColumnRule<string | number> | readonly NonNullable<csstype.Property.ColumnRule<string | number> | undefined>[] | undefined;
764
764
  MozColumns?: readonly (string | (string & {}))[] | csstype.Property.Columns<string | number> | readonly NonNullable<csstype.Property.Columns<string | number> | undefined>[] | undefined;
765
765
  MozOutlineRadius?: readonly (string | (string & {}))[] | csstype.Property.MozOutlineRadius<string | number> | readonly NonNullable<csstype.Property.MozOutlineRadius<string | number> | undefined>[] | undefined;
@@ -771,16 +771,16 @@ declare function paper({ theme, color, dropdown }: PaperProps): {
771
771
  msScrollSnapX?: readonly string[] | csstype.Property.MsScrollSnapX | readonly csstype.Property.MsScrollSnapX[] | undefined;
772
772
  msScrollSnapY?: readonly string[] | csstype.Property.MsScrollSnapY | readonly csstype.Property.MsScrollSnapY[] | undefined;
773
773
  msTransition?: readonly string[] | csstype.Property.Transition<string & {}> | readonly csstype.Property.Transition<string & {}>[] | undefined;
774
- WebkitAnimation?: csstype.Property.Animation<string & {}> | readonly NonNullable<csstype.Property.Animation<string & {}> | undefined>[] | readonly ((string & {}) | csstype.Globals | "normal" | "reverse" | "none" | "auto" | "alternate" | "alternate-reverse" | "backwards" | "both" | "forwards" | "infinite" | "paused" | "running" | "ease" | "ease-in" | "ease-in-out" | "ease-out" | "step-end" | "step-start" | "linear")[] | undefined;
774
+ WebkitAnimation?: csstype.Property.Animation<string & {}> | readonly NonNullable<csstype.Property.Animation<string & {}> | undefined>[] | readonly ("reverse" | (string & {}) | csstype.Globals | "none" | "auto" | "normal" | "alternate" | "alternate-reverse" | "backwards" | "both" | "forwards" | "infinite" | "paused" | "running" | "ease" | "ease-in" | "ease-in-out" | "ease-out" | "step-end" | "step-start" | "linear")[] | undefined;
775
775
  WebkitBorderBefore?: readonly (string | (string & {}))[] | csstype.Property.WebkitBorderBefore<string | number> | readonly NonNullable<csstype.Property.WebkitBorderBefore<string | number> | undefined>[] | undefined;
776
- WebkitBorderImage?: csstype.Property.BorderImage | readonly NonNullable<csstype.Property.BorderImage | undefined>[] | readonly ((string & {}) | csstype.Globals | "repeat" | "none" | "round" | "space" | "stretch")[] | undefined;
776
+ WebkitBorderImage?: csstype.Property.BorderImage | readonly NonNullable<csstype.Property.BorderImage | undefined>[] | readonly ("repeat" | (string & {}) | csstype.Globals | "none" | "round" | "space" | "stretch")[] | undefined;
777
777
  WebkitBorderRadius?: readonly (string | (string & {}))[] | csstype.Property.BorderRadius<string | number> | readonly NonNullable<csstype.Property.BorderRadius<string | number> | undefined>[] | undefined;
778
778
  WebkitColumnRule?: readonly (string | (string & {}))[] | csstype.Property.ColumnRule<string | number> | readonly NonNullable<csstype.Property.ColumnRule<string | number> | undefined>[] | undefined;
779
779
  WebkitColumns?: readonly (string | (string & {}))[] | csstype.Property.Columns<string | number> | readonly NonNullable<csstype.Property.Columns<string | number> | undefined>[] | undefined;
780
780
  WebkitFlex?: readonly (string | (string & {}))[] | csstype.Property.Flex<string | number> | readonly NonNullable<csstype.Property.Flex<string | number> | undefined>[] | undefined;
781
781
  WebkitFlexFlow?: readonly string[] | csstype.Property.FlexFlow | readonly csstype.Property.FlexFlow[] | undefined;
782
782
  WebkitMask?: readonly (string | (string & {}))[] | csstype.Property.WebkitMask<string | number> | readonly NonNullable<csstype.Property.WebkitMask<string | number> | undefined>[] | undefined;
783
- WebkitMaskBoxImage?: csstype.Property.MaskBorder | readonly NonNullable<csstype.Property.MaskBorder | undefined>[] | readonly ((string & {}) | csstype.Globals | "repeat" | "none" | "round" | "space" | "alpha" | "luminance" | "stretch")[] | undefined;
783
+ WebkitMaskBoxImage?: csstype.Property.MaskBorder | readonly NonNullable<csstype.Property.MaskBorder | undefined>[] | readonly ("repeat" | (string & {}) | csstype.Globals | "none" | "round" | "space" | "alpha" | "luminance" | "stretch")[] | undefined;
784
784
  WebkitTextEmphasis?: readonly string[] | csstype.Property.TextEmphasis | readonly csstype.Property.TextEmphasis[] | undefined;
785
785
  WebkitTextStroke?: readonly (string | (string & {}))[] | csstype.Property.WebkitTextStroke<string | number> | readonly NonNullable<csstype.Property.WebkitTextStroke<string | number> | undefined>[] | undefined;
786
786
  WebkitTransition?: readonly string[] | csstype.Property.Transition<string & {}> | readonly csstype.Property.Transition<string & {}>[] | undefined;
@@ -861,7 +861,7 @@ declare function paper({ theme, color, dropdown }: PaperProps): {
861
861
  MozUserFocus?: csstype.Property.MozUserFocus | readonly NonNullable<csstype.Property.MozUserFocus | undefined>[] | readonly csstype.Property.MozUserFocus[] | undefined;
862
862
  MozUserInput?: csstype.Property.MozUserInput | readonly NonNullable<csstype.Property.MozUserInput | undefined>[] | readonly csstype.Property.MozUserInput[] | undefined;
863
863
  msImeMode?: csstype.Property.ImeMode | readonly NonNullable<csstype.Property.ImeMode | undefined>[] | readonly csstype.Property.ImeMode[] | undefined;
864
- OAnimation?: csstype.Property.Animation<string & {}> | readonly NonNullable<csstype.Property.Animation<string & {}> | undefined>[] | readonly ((string & {}) | csstype.Globals | "normal" | "reverse" | "none" | "auto" | "alternate" | "alternate-reverse" | "backwards" | "both" | "forwards" | "infinite" | "paused" | "running" | "ease" | "ease-in" | "ease-in-out" | "ease-out" | "step-end" | "step-start" | "linear")[] | undefined;
864
+ OAnimation?: csstype.Property.Animation<string & {}> | readonly NonNullable<csstype.Property.Animation<string & {}> | undefined>[] | readonly ("reverse" | (string & {}) | csstype.Globals | "none" | "auto" | "normal" | "alternate" | "alternate-reverse" | "backwards" | "both" | "forwards" | "infinite" | "paused" | "running" | "ease" | "ease-in" | "ease-in-out" | "ease-out" | "step-end" | "step-start" | "linear")[] | undefined;
865
865
  OAnimationDelay?: readonly string[] | csstype.Property.AnimationDelay<string & {}> | readonly csstype.Property.AnimationDelay<string & {}>[] | undefined;
866
866
  OAnimationDirection?: readonly string[] | csstype.Property.AnimationDirection | readonly csstype.Property.AnimationDirection[] | undefined;
867
867
  OAnimationDuration?: readonly string[] | csstype.Property.AnimationDuration<string & {}> | readonly csstype.Property.AnimationDuration<string & {}>[] | undefined;
@@ -871,7 +871,7 @@ declare function paper({ theme, color, dropdown }: PaperProps): {
871
871
  OAnimationPlayState?: readonly string[] | csstype.Property.AnimationPlayState | readonly csstype.Property.AnimationPlayState[] | undefined;
872
872
  OAnimationTimingFunction?: readonly string[] | csstype.Property.AnimationTimingFunction | readonly csstype.Property.AnimationTimingFunction[] | undefined;
873
873
  OBackgroundSize?: readonly (string | (string & {}))[] | csstype.Property.BackgroundSize<string | number> | readonly NonNullable<csstype.Property.BackgroundSize<string | number> | undefined>[] | undefined;
874
- OBorderImage?: csstype.Property.BorderImage | readonly NonNullable<csstype.Property.BorderImage | undefined>[] | readonly ((string & {}) | csstype.Globals | "repeat" | "none" | "round" | "space" | "stretch")[] | undefined;
874
+ OBorderImage?: csstype.Property.BorderImage | readonly NonNullable<csstype.Property.BorderImage | undefined>[] | readonly ("repeat" | (string & {}) | csstype.Globals | "none" | "round" | "space" | "stretch")[] | undefined;
875
875
  OObjectFit?: csstype.Property.ObjectFit | readonly NonNullable<csstype.Property.ObjectFit | undefined>[] | readonly csstype.Property.ObjectFit[] | undefined;
876
876
  OObjectPosition?: readonly (string | (string & {}))[] | csstype.Property.ObjectPosition<string | number> | readonly NonNullable<csstype.Property.ObjectPosition<string | number> | undefined>[] | undefined;
877
877
  OTabSize?: readonly (string | (string & {}))[] | csstype.Property.TabSize<string | number> | readonly NonNullable<csstype.Property.TabSize<string | number> | undefined>[] | undefined;
@@ -20,7 +20,15 @@ declare function fDate(date: DatePickerFormat, format?: string): string | null;
20
20
  declare function fTime(date: DatePickerFormat, format?: string): string | null;
21
21
  declare function fTimestamp(date: DatePickerFormat): number | "Invalid time value" | null;
22
22
  declare function fToNow(date: DatePickerFormat): string | null;
23
- declare function fTimeLeft(date: DatePickerFormat): string | null;
23
+ type TimeUnit = 'instant' | 'day';
24
+ interface Expiration {
25
+ expired: boolean;
26
+ label: string;
27
+ value: string;
28
+ text: string;
29
+ }
30
+ declare function fTimeAgo(date: DatePickerFormat, unit: TimeUnit): string | null;
31
+ declare function fExpiration(date: DatePickerFormat, unit: TimeUnit): Expiration | null;
24
32
  declare function fIsBetween(inputDate: DatePickerFormat, startDate: DatePickerFormat, endDate: DatePickerFormat): boolean;
25
33
  declare function fIsAfter(startDate: DatePickerFormat, endDate: DatePickerFormat): boolean;
26
34
  declare function fIsSame(startDate: DatePickerFormat, endDate: DatePickerFormat, units?: OpUnitType): boolean | "Invalid time value";
@@ -38,4 +46,4 @@ declare function fAdd({ years, months, days, hours, minutes, seconds, millisecon
38
46
  declare function fSub({ years, months, days, hours, minutes, seconds, milliseconds, }: DurationProps): string;
39
47
  declare const getDifferenceInDays: (startDate?: Date, endDate?: Date) => number | null;
40
48
 
41
- export { DatePickerFormat, DurationProps, fAdd, fDate, fDateRangeShortLabel, fDateTime, fIsAfter, fIsBetween, fIsSame, fSub, fTime, fTimeLeft, fTimestamp, fToNow, formatStr, getDifferenceInDays, today };
49
+ export { DatePickerFormat, DurationProps, Expiration, TimeUnit, fAdd, fDate, fDateRangeShortLabel, fDateTime, fExpiration, fIsAfter, fIsBetween, fIsSame, fSub, fTime, fTimeAgo, fTimestamp, fToNow, formatStr, getDifferenceInDays, today };
@@ -1,2 +1,2 @@
1
- export { m as fAdd, d as fDate, l as fDateRangeShortLabel, c as fDateTime, j as fIsAfter, i as fIsBetween, k as fIsSame, n as fSub, e as fTime, h as fTimeLeft, f as fTimestamp, g as fToNow, a as formatStr, o as getDifferenceInDays, b as today } from '../chunk-A7QSCOUE.js';
1
+ export { n as fAdd, d as fDate, m as fDateRangeShortLabel, c as fDateTime, i as fExpiration, k as fIsAfter, j as fIsBetween, l as fIsSame, o as fSub, e as fTime, h as fTimeAgo, f as fTimestamp, g as fToNow, a as formatStr, p as getDifferenceInDays, b as today } from '../chunk-2W5FGLTC.js';
2
2
  //# sourceMappingURL=formatTime.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zydon/common",
3
- "version": "2.9.30",
3
+ "version": "2.9.32",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "module": "./dist/index.js",
@@ -1,8 +0,0 @@
1
- import t from 'dayjs';
2
- import p from 'dayjs/plugin/duration';
3
- import D from 'dayjs/plugin/relativeTime';
4
-
5
- t.extend(p);t.extend(D);var c={dateTime:"DD/MM/YYYY HH:mm",date:"DD/MM/YYYY",time:"HH:mm",split:{dateTime:"DD/MM/YYYY HH:mm",date:"DD/MM/YYYY"},paramCase:{dateTime:"DD/MM/YYYY HH:mm",date:"DD/MM/YYYY"}};function x(r){return t(new Date).startOf("day").format(r)}function P(r,i){return r?t(r).isValid()?t(r).format(i??c.dateTime):"Invalid time value":null}function f(r,i){return r?t(r).isValid()?t(r).format(i??c.date):"Invalid time value":null}function M(r,i){return r?t(r).isValid()?t(r).format(i??c.time):"Invalid time value":null}function m(r){return r?t(r).isValid()?t(r).valueOf():"Invalid time value":null}function k(r){return r?t(r).isValid()?t(r).toNow(!0):"Invalid time value":null}function F(r){if(!r)return null;let i=t(r);if(!i.isValid())return "Invalid time value";let e=t(),n=i.startOf("day").diff(e.startOf("day"),"day");if(n<0)return "vencido";if(n===0)return "hoje";if(n<7)return n===1?"1 dia":`${n} dias`;let a=i.diff(e,"year");if(a>=1)return a===1?"1 ano":`${a} anos`;let o=i.diff(e,"month");if(o>=1)return o===1?"1 m\xEAs":`${o} meses`;let s=Math.floor(n/7);return s===1?"1 semana":`${s} semanas`}function b(r,i,e){if(!r||!i||!e)return !1;let n=m(r),a=m(i),o=m(e);return n&&a&&o?n>=a&&n<=o:!1}function Y(r,i){return t(r).isAfter(i)}function l(r,i,e){return !r||!i?!1:t(r).isValid()&&t(i).isValid()?t(r).isSame(i,e??"year"):"Invalid time value"}function I(r,i,e){let n=t(r).isValid()&&t(i).isValid(),a=Y(r,i);if(!n||a)return "Invalid time value";let o=`${f(r)} - ${f(i)}`;if(e)return o;let s=l(r,i,"year"),u=l(r,i,"month"),d=l(r,i,"day");return s&&!u?o=`${f(r,"DD MMM")} - ${f(i)}`:s&&u&&!d?o=`${f(r,"DD")} - ${f(i)}`:s&&u&&d&&(o=`${f(i)}`),o}function T({years:r=0,months:i=0,days:e=0,hours:n=0,minutes:a=0,seconds:o=0,milliseconds:s=0}){return t().add(t.duration({years:r,months:i,days:e,hours:n,minutes:a,seconds:o,milliseconds:s})).format()}function $({years:r=0,months:i=0,days:e=0,hours:n=0,minutes:a=0,seconds:o=0,milliseconds:s=0}){return t().subtract(t.duration({years:r,months:i,days:e,hours:n,minutes:a,seconds:o,milliseconds:s})).format()}var h=(r,i)=>!r||!i?null:t(i).diff(t(r),"day");
6
-
7
- export { c as a, x as b, P as c, f as d, M as e, m as f, k as g, F as h, b as i, Y as j, l as k, I as l, T as m, $ as n, h as o };
8
- //# sourceMappingURL=chunk-A7QSCOUE.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/utils/formatTime.ts"],"names":["dayjs","duration","relativeTime","formatStr","today","format","fDateTime","date","fDate","fTime","fTimestamp","fToNow","fTimeLeft","target","now","diffDays","diffYears","diffMonths","diffWeeks","fIsBetween","inputDate","startDate","endDate","formattedInputDate","formattedStartDate","formattedEndDate","fIsAfter","fIsSame","units","fDateRangeShortLabel","initial","isValid","isAfter","label","isSameYear","isSameMonth","isSameDay","fAdd","years","months","days","hours","minutes","seconds","milliseconds","fSub","getDifferenceInDays"],"mappings":"AACA,OAAOA,MAAW,QAClB,OAAOC,MAAc,wBACrB,OAAOC,MAAkB,4BAIzBF,EAAM,OAAOC,CAAQ,EACrBD,EAAM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'dayjs';\nimport duration from 'dayjs/plugin/duration';\nimport relativeTime from 'dayjs/plugin/relativeTime';\n\n// ----------------------------------------------------------------------\n\ndayjs.extend(duration);\ndayjs.extend(relativeTime);\n\n// ----------------------------------------------------------------------\n\nexport type DatePickerFormat =\n | Dayjs\n | Date\n | string\n | number\n | null\n | undefined;\n\nexport const formatStr = {\n dateTime: 'DD/MM/YYYY HH:mm',\n date: 'DD/MM/YYYY',\n time: 'HH:mm',\n split: {\n dateTime: 'DD/MM/YYYY HH:mm',\n date: 'DD/MM/YYYY',\n },\n paramCase: {\n dateTime: 'DD/MM/YYYY HH:mm',\n date: 'DD/MM/YYYY',\n },\n};\n\nexport function today(format?: string) {\n return dayjs(new Date()).startOf('day').format(format);\n}\n\nexport function fDateTime(date: DatePickerFormat, format?: string) {\n if (!date) {\n return null;\n }\n\n const isValid = dayjs(date).isValid();\n\n return isValid\n ? dayjs(date).format(format ?? formatStr.dateTime)\n : 'Invalid time value';\n}\n\nexport function fDate(date: DatePickerFormat, format?: string) {\n if (!date) {\n return null;\n }\n\n const isValid = dayjs(date).isValid();\n\n return isValid\n ? dayjs(date).format(format ?? formatStr.date)\n : 'Invalid time value';\n}\n\nexport function fTime(date: DatePickerFormat, format?: string) {\n if (!date) {\n return null;\n }\n\n const isValid = dayjs(date).isValid();\n\n return isValid\n ? dayjs(date).format(format ?? formatStr.time)\n : 'Invalid time value';\n}\n\nexport function fTimestamp(date: DatePickerFormat) {\n if (!date) {\n return null;\n }\n\n const isValid = dayjs(date).isValid();\n\n return isValid ? dayjs(date).valueOf() : 'Invalid time value';\n}\n\nexport function fToNow(date: DatePickerFormat) {\n if (!date) {\n return null;\n }\n\n const isValid = dayjs(date).isValid();\n\n return isValid ? dayjs(date).toNow(true) : 'Invalid time value';\n}\n\nexport function fTimeLeft(date: DatePickerFormat) {\n if (!date) {\n return null;\n }\n\n const target = dayjs(date);\n\n if (!target.isValid()) {\n return 'Invalid time value';\n }\n\n const now = dayjs();\n const diffDays = target.startOf('day').diff(now.startOf('day'), 'day');\n\n if (diffDays < 0) return 'vencido';\n if (diffDays === 0) return 'hoje';\n if (diffDays < 7) return diffDays === 1 ? '1 dia' : `${diffDays} dias`;\n\n const diffYears = target.diff(now, 'year');\n\n if (diffYears >= 1) {\n return diffYears === 1 ? '1 ano' : `${diffYears} anos`;\n }\n\n const diffMonths = target.diff(now, 'month');\n\n if (diffMonths >= 1) {\n return diffMonths === 1 ? '1 mês' : `${diffMonths} meses`;\n }\n\n const diffWeeks = Math.floor(diffDays / 7);\n\n return diffWeeks === 1 ? '1 semana' : `${diffWeeks} semanas`;\n}\n\nexport function fIsBetween(\n inputDate: DatePickerFormat,\n startDate: DatePickerFormat,\n endDate: DatePickerFormat,\n) {\n if (!inputDate || !startDate || !endDate) {\n return false;\n }\n\n const formattedInputDate = fTimestamp(inputDate);\n const formattedStartDate = fTimestamp(startDate);\n const formattedEndDate = fTimestamp(endDate);\n\n if (formattedInputDate && formattedStartDate && formattedEndDate) {\n return (\n formattedInputDate >= formattedStartDate &&\n formattedInputDate <= formattedEndDate\n );\n }\n\n return false;\n}\n\nexport function fIsAfter(\n startDate: DatePickerFormat,\n endDate: DatePickerFormat,\n) {\n return dayjs(startDate).isAfter(endDate);\n}\n\nexport function fIsSame(\n startDate: DatePickerFormat,\n endDate: DatePickerFormat,\n units?: OpUnitType,\n) {\n if (!startDate || !endDate) {\n return false;\n }\n\n const isValid = dayjs(startDate).isValid() && dayjs(endDate).isValid();\n\n if (!isValid) {\n return 'Invalid time value';\n }\n\n return dayjs(startDate).isSame(endDate, units ?? 'year');\n}\n\nexport function fDateRangeShortLabel(\n startDate: DatePickerFormat,\n endDate: DatePickerFormat,\n initial?: boolean,\n) {\n const isValid = dayjs(startDate).isValid() && dayjs(endDate).isValid();\n\n const isAfter = fIsAfter(startDate, endDate);\n\n if (!isValid || isAfter) {\n return 'Invalid time value';\n }\n\n let label = `${fDate(startDate)} - ${fDate(endDate)}`;\n\n if (initial) {\n return label;\n }\n\n const isSameYear = fIsSame(startDate, endDate, 'year');\n const isSameMonth = fIsSame(startDate, endDate, 'month');\n const isSameDay = fIsSame(startDate, endDate, 'day');\n\n if (isSameYear && !isSameMonth) {\n label = `${fDate(startDate, 'DD MMM')} - ${fDate(endDate)}`;\n } else if (isSameYear && isSameMonth && !isSameDay) {\n label = `${fDate(startDate, 'DD')} - ${fDate(endDate)}`;\n } else if (isSameYear && isSameMonth && isSameDay) {\n label = `${fDate(endDate)}`;\n }\n\n return label;\n}\n\nexport type DurationProps = {\n years?: number;\n months?: number;\n days?: number;\n hours?: number;\n minutes?: number;\n seconds?: number;\n milliseconds?: number;\n};\n\nexport function fAdd({\n years = 0,\n months = 0,\n days = 0,\n hours = 0,\n minutes = 0,\n seconds = 0,\n milliseconds = 0,\n}: DurationProps) {\n const result = dayjs()\n .add(\n dayjs.duration({\n years,\n months,\n days,\n hours,\n minutes,\n seconds,\n milliseconds,\n }),\n )\n .format();\n\n return result;\n}\n\nexport function fSub({\n years = 0,\n months = 0,\n days = 0,\n hours = 0,\n minutes = 0,\n seconds = 0,\n milliseconds = 0,\n}: DurationProps) {\n const result = dayjs()\n .subtract(\n dayjs.duration({\n years,\n months,\n days,\n hours,\n minutes,\n seconds,\n milliseconds,\n }),\n )\n .format();\n\n return result;\n}\n\nexport const getDifferenceInDays = (startDate?: Date, endDate?: Date) => {\n if (!startDate || !endDate) return null;\n\n return dayjs(endDate).diff(dayjs(startDate), 'day');\n};\n"]}
@@ -1,13 +0,0 @@
1
- import { a as a$1 } from './chunk-F65ZXAGV.js';
2
- import { a } from './chunk-VJW7L44O.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-ADNBF5AS.js.map
@@ -1 +0,0 @@
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,K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B,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"]}
@@ -286,10 +286,13 @@ declare const components: {
286
286
  MuiTimelineDot: {
287
287
  defaultProps?: Partial<_mui_lab_TimelineDot.TimelineDotProps> | undefined;
288
288
  styleOverrides?: Partial<_mui_material_styles_overrides.OverridesStyleRules<keyof _mui_lab_TimelineDot.TimelineDotClasses, "MuiTimelineDot", {
289
- transitions: _mui_material.Transitions;
289
+ cssVarPrefix: string;
290
+ zIndex: _mui_material.ZIndex;
291
+ direction: _mui_system.Direction;
292
+ opacity: _mui_material.Opacity;
293
+ typography: _mui_material.TypographyVariants;
290
294
  palette: _mui_material.Palette;
291
295
  colorSchemes: Record<_mui_material.SupportedColorScheme, _mui_material.ColorSystem>;
292
- cssVarPrefix: string;
293
296
  vars: _mui_material.ThemeVars;
294
297
  getCssVar: (field: _mui_material.ThemeCssVar, ...vars: _mui_material.ThemeCssVar[]) => string;
295
298
  getColorSchemeSelector: (colorScheme: _mui_material.SupportedColorScheme) => string;
@@ -300,16 +303,13 @@ declare const components: {
300
303
  spacing: _mui_system.Spacing;
301
304
  breakpoints: _mui_system.Breakpoints;
302
305
  shape: _mui_system.Shape;
303
- typography: _mui_material.TypographyVariants;
306
+ transitions: _mui_material.Transitions;
304
307
  shadows: _mui_material.Shadows;
305
308
  mixins: _mui_material.Mixins;
306
- zIndex: _mui_material.ZIndex;
307
- direction: _mui_system.Direction;
308
309
  shouldSkipGeneratingVar: (keys: string[], value: string | number) => boolean;
309
310
  unstable_sxConfig: _mui_system.SxConfig;
310
311
  unstable_sx: (props: _mui_system.SxProps<_mui_material.Theme>) => _mui_styled_engine.CSSObject;
311
312
  applyStyles: _mui_system.ApplyStyles<"light" | "dark">;
312
- opacity: _mui_material.Opacity;
313
313
  overlays: _mui_material.Overlays;
314
314
  customShadows: CustomShadows;
315
315
  unstable_strictMode?: boolean | undefined;
@@ -326,10 +326,13 @@ declare const components: {
326
326
  MuiTimelineConnector: {
327
327
  defaultProps?: Partial<_mui_lab_TimelineConnector.TimelineConnectorProps> | undefined;
328
328
  styleOverrides?: Partial<_mui_material_styles_overrides.OverridesStyleRules<"root", "MuiTimelineConnector", {
329
- transitions: _mui_material.Transitions;
329
+ cssVarPrefix: string;
330
+ zIndex: _mui_material.ZIndex;
331
+ direction: _mui_system.Direction;
332
+ opacity: _mui_material.Opacity;
333
+ typography: _mui_material.TypographyVariants;
330
334
  palette: _mui_material.Palette;
331
335
  colorSchemes: Record<_mui_material.SupportedColorScheme, _mui_material.ColorSystem>;
332
- cssVarPrefix: string;
333
336
  vars: _mui_material.ThemeVars;
334
337
  getCssVar: (field: _mui_material.ThemeCssVar, ...vars: _mui_material.ThemeCssVar[]) => string;
335
338
  getColorSchemeSelector: (colorScheme: _mui_material.SupportedColorScheme) => string;
@@ -340,16 +343,13 @@ declare const components: {
340
343
  spacing: _mui_system.Spacing;
341
344
  breakpoints: _mui_system.Breakpoints;
342
345
  shape: _mui_system.Shape;
343
- typography: _mui_material.TypographyVariants;
346
+ transitions: _mui_material.Transitions;
344
347
  shadows: _mui_material.Shadows;
345
348
  mixins: _mui_material.Mixins;
346
- zIndex: _mui_material.ZIndex;
347
- direction: _mui_system.Direction;
348
349
  shouldSkipGeneratingVar: (keys: string[], value: string | number) => boolean;
349
350
  unstable_sxConfig: _mui_system.SxConfig;
350
351
  unstable_sx: (props: _mui_system.SxProps<_mui_material.Theme>) => _mui_styled_engine.CSSObject;
351
352
  applyStyles: _mui_system.ApplyStyles<"light" | "dark">;
352
- opacity: _mui_material.Opacity;
353
353
  overlays: _mui_material.Overlays;
354
354
  customShadows: CustomShadows;
355
355
  unstable_strictMode?: boolean | undefined;