@foodpilot/foods 2.19.3 → 2.20.1

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.
@@ -1,4 +1,4 @@
1
- import{jsxs as e,Fragment as o,jsx as i}from"react/jsx-runtime";import{ArrowForward as a,ArrowBack as t}from"@mui/icons-material";import{Stack as n,Pagination as r,PaginationItem as l,useTheme as p,Typography as s}from"@mui/material";import{useMaterialReactTable as d,MRT_TableContainer as g,MRT_TablePagination as m}from"material-react-table";import{useMemo as b}from"react";import{FoodsIcon as u}from"../Icons/FoodsIcon.js";import{MRT_GRID_HUB_LAYOUT as c}from"./mrtGridLayout.js";const h={xs:"15px",sm:"32px 40px 40px"},x=(e,o)=>{if(void 0===o)return e;const i=o=>({...e,...o,sx:void 0===o.sx?e.sx:[e.sx,o.sx]});return"function"==typeof o?e=>i(o(e)):i(o)};function P(P){const{appearance:w="default",columns:y,displayColumnDefOptions:C,enableColumnPinning:f,enableColumnResizing:H,maxLinesPerRow:R=2,muiPaginationProps:v,muiPaginationStackProps:T,muiTableBodyCellProps:M,muiTableBodyRowProps:$,muiTableHeadCellProps:k,muiTableHeadRowProps:I,muiTableProps:S,...L}=P,A="hub"===w,z=(e=>{const o=p(),{appearance:i,maxLinePerRow:a}=e,t="hub"===i;return{bodyCell:{padding:t?c.bodyCellPadding:o.spacing(1,2),...t&&{boxSizing:"border-box",height:`${c.rowHeight}px`,maxHeight:`${c.rowHeight}px`},"&:last-child[data-pinned='true']":{width:"1%"},borderInline:`1px solid ${o.custom.grey[500]}`,"& p":{display:"-webkit-box",WebkitLineClamp:a,WebkitBoxOrient:"vertical",overflow:"hidden",whiteSpace:"initial",textOverflow:"ellipsis"}},bodyRow:{minHeight:`${c.rowHeight}px`,...t&&{boxSizing:"border-box",height:`${c.rowHeight}px`,maxHeight:`${c.rowHeight}px`},"&:hover td::after":{backgroundColor:o.custom.grey[300]}},headCell:{backgroundColor:o.custom.grey[200],border:"1px solid "+o.custom.grey[500],"& p":{display:"-webkit-box",WebkitLineClamp:a,WebkitBoxOrient:"vertical",overflow:"hidden",whiteSpace:"initial",...!t&&{lineHeight:"normal"},textOverflow:"ellipsis"},padding:t?c.headerCellPadding:o.spacing(2),minHeight:t?`${c.headerHeight}px`:"48px",justifyContent:"center","&>.Mui-TableHeadCell-Content .MuiDivider-vertical":{opacity:"0"},"& .Mui-TableHeadCell-Content-Labels":{width:"100%","& .Mui-TableHeadCell-Content-Wrapper":{width:"100%"}}},headRow:{boxShadow:"none",...t&&{height:`${c.headerHeight}px`}},table:{"& tr:nth-of-type(even)":{backgroundColor:`${o.custom.grey[200]} !important`},"[data-pinned='true']:before":{display:"none"}},pagination:{"& .MuiPagination-ul":{gap:o.spacing(1),justifyContent:"flex-end"},"& .MuiPaginationItem-root":{...t?o.typography["body-bold"]:o.typography["small-bold"],border:0,color:o.palette.text.primary,height:o.spacing(4),margin:0,minWidth:o.spacing(4),width:o.spacing(4)},"& .MuiPaginationItem-root.Mui-selected":{backgroundColor:o.palette.primary[500],color:o.palette.common.white,"&:hover":{backgroundColor:o.palette.primary[600]}},"& .MuiPaginationItem-root.Mui-focusVisible":{outline:`${o.spacing(.25)} solid ${o.palette.primary[700]}`,outlineOffset:o.spacing(.25)}}}})({appearance:w,maxLinePerRow:b(()=>R,[R])}),B=A?{...C,"mrt-row-actions":{...C?.["mrt-row-actions"],grow:!1,header:"",size:c.actionColumnWidth}}:C,O=b(()=>y.map(e=>({Header:e=>{const{column:o}=e,a=o.columnDef.header;/* @__PURE__ */
2
- return i(s,{variant:A?"small-semibold":"small-bold",component:"p",title:a,children:a})},Cell:e=>"object"==typeof e.cell.getValue()?null:/* @__PURE__ */i(s,{variant:"body",component:"p",children:e.renderedCellValue}),...e,...A&&{grow:!0}})),[y,A]),W={shape:"circular",variant:"text",showFirstButton:!1,showLastButton:!1,showRowsPerPage:!1,sx:z.pagination},j=e=>({...x(W,e),showRowsPerPage:!1}),D=A?"function"==typeof v?e=>j(v(e)):j(v):v??W,G={columns:O,enableDensityToggle:!1,enableToolbarInternalActions:!1,enableColumnActions:!1,enableRowActions:!1,positionActionsColumn:"last",enableRowSelection:!0,enableSelectAll:!0,enablePagination:!0,muiTableBodyCellProps:A?x({sx:z.bodyCell},M):M??{sx:z.bodyCell},muiTableBodyRowProps:A?x({sx:z.bodyRow},$):$??{sx:z.bodyRow},muiTableHeadCellProps:A?x({sx:z.headCell},k):k??{sx:z.headCell},muiTableHeadRowProps:A?x({sx:z.headRow},I):I??{sx:z.headRow},muiTableProps:A?x({sx:z.table},S):S??{sx:z.table},muiSelectCheckboxProps:{},muiSelectAllCheckboxProps:{},paginationDisplayMode:"pages",icons:{ChevronLeftIcon:()=>/* @__PURE__ */i(t,{}),ChevronRightIcon:()=>/* @__PURE__ */i(a,{})},enableColumnPinning:!!A||f,enableColumnResizing:!A&&(H??!0),layoutMode:"grid",...L,displayColumnDefOptions:B,muiPaginationProps:D},V=d(G),F=P.enablePagination??G.enablePagination,q=V.getPageCount(),E=V.getState().pagination.pageIndex,J="function"==typeof G.muiPaginationProps?G.muiPaginationProps({table:V}):G.muiPaginationProps,{showRowsPerPage:K,...N}=J??{},{sx:Q,...U}=T??{},X={margin:A?0:h,...A&&{boxSizing:"border-box",minHeight:`${c.paginationMinHeight}px`,padding:c.paginationPadding},".MuiTablePagination-root":{padding:0},".MuiTablePagination-toolbar":{padding:0}},Y=void 0===Q?X:[X,...Array.isArray(Q)?Q:[Q]];/* @__PURE__ */
1
+ import{jsxs as e,Fragment as o,jsx as i}from"react/jsx-runtime";import{ArrowForward as t,ArrowBack as a}from"@mui/icons-material";import{Stack as n,Pagination as r,PaginationItem as l,useTheme as d,Typography as p}from"@mui/material";import{useMaterialReactTable as s,MRT_TableContainer as g,MRT_TablePagination as m}from"material-react-table";import{useMemo as c}from"react";import{FoodsIcon as b}from"../Icons/FoodsIcon.js";import{MRT_GRID_HUB_LAYOUT as u}from"./mrtGridLayout.js";const h={xs:"15px",sm:"32px 40px 40px"},x=e=>"object"==typeof e&&null!==e&&!Array.isArray(e),y=(e,o)=>Object.entries(o).reduce((e,[o,i])=>{const t=e[o];return e[o]=x(t)&&x(i)?y(t,i):i,e},{...e}),w=(e,o)=>e?"function"==typeof e?w(e(o),o):Array.isArray(e)?e.reduce((e,i)=>y(e,w(i,o)),{}):x(e)?e:{}:{},P=(e,o,i)=>t=>{const a=w(e,t),n=w(o,t);return i?y(n,a):y(a,n)},C=(e,o,i=!1,t=!1)=>{if(void 0===o)return e;const a=o=>({...t?o:e,...t?e:o,sx:void 0===o.sx?e.sx:void 0===e.sx?o.sx:P(e.sx,o.sx,i)});return"function"==typeof o?e=>a(o(e)):a(o)};function f(x){const{appearance:y="default",columns:w,displayColumnDefOptions:P,enableColumnPinning:f,enableColumnResizing:H,maxLinesPerRow:R=2,muiPaginationProps:T,muiPaginationStackProps:v,muiSelectAllCheckboxProps:k,muiSelectCheckboxProps:S,muiTableBodyCellProps:$,muiTableBodyRowProps:A,muiTableHeadCellProps:M,muiTableHeadRowProps:I,muiTableProps:L,...B}=x,z="hub"===y,j=(e=>{const o=d(),{appearance:i,maxLinePerRow:t}=e,a="hub"===i,n=a?[o.custom.strokes.containerDivider.width,o.custom.strokes.containerDivider.style,o.custom.strokes.containerDivider.color].join(" "):`1px solid ${o.custom.grey[500]}`;return{bodyCell:{padding:a?u.bodyCellPadding:o.spacing(1,2),...a&&{boxSizing:"border-box",height:`${u.rowHeight}px`,maxHeight:`${u.rowHeight}px`,paddingBottom:"8px",paddingLeft:"12px",paddingRight:"12px",paddingTop:"8px"},"&:last-child[data-pinned='true']":a?{boxShadow:u.pinnedActionShadow}:{width:"1%"},borderInline:n,"& p":{display:"-webkit-box",WebkitLineClamp:t,WebkitBoxOrient:"vertical",overflow:"hidden",whiteSpace:"initial",textOverflow:"ellipsis"}},bodyRow:{minHeight:`${u.rowHeight}px`,...a&&{boxSizing:"border-box",height:`${u.rowHeight}px`,maxHeight:`${u.rowHeight}px`},"&:hover td::after":{backgroundColor:o.custom.grey[300]}},headCell:{backgroundColor:o.custom.grey[200],border:n,...a&&{"&:last-child[data-pinned='true']":{boxShadow:u.pinnedActionShadow},boxSizing:"border-box",height:`${u.headerHeight}px`,maxHeight:`${u.headerHeight}px`,paddingBottom:"12px",paddingLeft:"12px",paddingRight:"8px",paddingTop:"12px"},"& p":{display:"-webkit-box",WebkitLineClamp:t,WebkitBoxOrient:"vertical",overflow:"hidden",whiteSpace:"initial",...!a&&{lineHeight:"normal"},textOverflow:"ellipsis"},padding:a?u.headerCellPadding:o.spacing(2),minHeight:a?`${u.headerHeight}px`:"48px",justifyContent:"center","&>.Mui-TableHeadCell-Content .MuiDivider-vertical":{opacity:"0"},"& .Mui-TableHeadCell-Content-Labels":{width:"100%","& .Mui-TableHeadCell-Content-Wrapper":{width:"100%"}}},headRow:{boxShadow:"none",...a&&{boxSizing:"border-box",height:`${u.headerHeight}px`,maxHeight:`${u.headerHeight}px`,minHeight:`${u.headerHeight}px`}},table:{...a?{"& tbody tr":{backgroundColor:`${o.palette.common.white} !important`}}:{"& tr:nth-of-type(even)":{backgroundColor:`${o.custom.grey[200]} !important`}},"[data-pinned='true']:before":{display:"none"}},pagination:{"& .MuiPagination-ul":{gap:o.spacing(1),justifyContent:"flex-end"},"& .MuiPaginationItem-root":{...a?o.typography["body-bold"]:o.typography["small-bold"],border:0,color:o.palette.text.primary,height:o.spacing(4),margin:0,minWidth:o.spacing(4),width:o.spacing(4)},"& .MuiPaginationItem-root.Mui-selected":{backgroundColor:o.palette.primary[500],color:o.palette.common.white,"&:hover":{backgroundColor:o.palette.primary[600]}},"& .MuiPaginationItem-root.Mui-focusVisible":{outline:`${o.spacing(.25)} solid ${o.palette.primary[700]}`,outlineOffset:o.spacing(.25)}}}})({appearance:y,maxLinePerRow:c(()=>R,[R])}),D=P?.["mrt-row-select"],O={align:"center",sx:{alignItems:"center",justifyContent:"center",padding:0,paddingBottom:0,paddingLeft:0,paddingRight:0,paddingTop:0}},W={...P,"mrt-row-select":{...D,grow:!1,...z&&{size:u.actionColumnWidth},muiTableBodyCellProps:C(O,D?.muiTableBodyCellProps,!0,!0),muiTableHeadCellProps:C(O,D?.muiTableHeadCellProps,!0,!0)},...z&&{"mrt-row-actions":{...P?.["mrt-row-actions"],grow:!1,header:"",size:u.actionColumnWidth}}},G=c(()=>w.map(e=>({Header:e=>{const{column:o}=e,t=o.columnDef.header;/* @__PURE__ */
2
+ return i(p,{variant:z?"small-semibold":"small-bold",component:"p",title:t,children:t})},Cell:e=>"object"==typeof e.cell.getValue()?null:/* @__PURE__ */i(p,{variant:"body",component:"p",children:e.renderedCellValue}),...e,...z&&{grow:e.grow??!0}})),[w,z]),V={shape:"circular",variant:"text",showFirstButton:!1,showLastButton:!1,showRowsPerPage:!1,sx:j.pagination},F=e=>({...C(V,e,!0),showRowsPerPage:!1}),q=z?"function"==typeof T?e=>F(T(e)):F(T):T??V,E={columns:G,enableDensityToggle:!1,enableToolbarInternalActions:!1,enableColumnActions:!1,enableRowActions:!1,positionActionsColumn:"last",enableRowSelection:!0,enableSelectAll:!0,enablePagination:!0,muiTableBodyCellProps:z?C({sx:j.bodyCell},$,!0):$??{sx:j.bodyCell},muiTableBodyRowProps:z?C({sx:j.bodyRow},A,!0):A??{sx:j.bodyRow},muiTableHeadCellProps:z?C({sx:j.headCell},M,!0):M??{sx:j.headCell},muiTableHeadRowProps:z?C({sx:j.headRow},I,!0):I??{sx:j.headRow},muiTableProps:z?C({sx:j.table},L,!0):L??{sx:j.table},paginationDisplayMode:"pages",icons:{ChevronLeftIcon:()=>/* @__PURE__ */i(a,{}),ChevronRightIcon:()=>/* @__PURE__ */i(t,{})},enableColumnPinning:!!z||f,enableColumnResizing:!z&&(H??!0),layoutMode:"grid",...B,displayColumnDefOptions:W,muiPaginationProps:q,muiSelectAllCheckboxProps:C({sx:{display:"flex",margin:0}},k,!0),muiSelectCheckboxProps:C({sx:{display:"flex",margin:0}},S,!0)},J=s(E),K=x.enablePagination??E.enablePagination,N=J.getPageCount(),Q=J.getState().pagination.pageIndex,U="function"==typeof E.muiPaginationProps?E.muiPaginationProps({table:J}):E.muiPaginationProps,{showRowsPerPage:X,...Y}=U??{},{sx:Z,..._}=v??{},ee={margin:z?0:h,...z&&{boxSizing:"border-box",minHeight:`${u.paginationMinHeight}px`,padding:u.paginationPadding},".MuiTablePagination-root":{padding:0},".MuiTablePagination-toolbar":{padding:0}},oe=void 0===Z?ee:z?[...Array.isArray(Z)?Z:[Z],ee]:[ee,...Array.isArray(Z)?Z:[Z]];/* @__PURE__ */
3
3
  return e(o,{children:[
4
- /* @__PURE__ */i(g,{table:V}),F&&(!A||q>0)&&/* @__PURE__ */i(n,{alignItems:"flex-end","data-appearance":w,"data-testid":"mrt-grid-pagination",...U,sx:Y,children:A?/* @__PURE__ */i(r,{"aria-label":"Table pagination",...N,count:q,getItemAriaLabel:(e,o,i)=>"page"===e?i?`page ${o}`:`Go to page ${o}`:`Go to ${e} page`,onChange:(e,o)=>V.setPageIndex(o-1),page:Math.min(E+1,q),renderItem:e=>/* @__PURE__ */i(l,{...e,slots:{previous:()=>/* @__PURE__ */i(u,{icon:"arrowLeft",size:2}),next:()=>/* @__PURE__ */i(u,{icon:"arrowRight",size:2})}})}):/* @__PURE__ */i(m,{table:V})})]})}export{P as MRTGrid};
4
+ /* @__PURE__ */i(g,{table:J}),K&&(!z||N>0)&&/* @__PURE__ */i(n,{alignItems:"flex-end","data-appearance":y,"data-testid":"mrt-grid-pagination",..._,sx:oe,children:z?/* @__PURE__ */i(r,{"aria-label":"Table pagination",...Y,count:N,getItemAriaLabel:(e,o,i)=>"page"===e?i?`page ${o}`:`Go to page ${o}`:`Go to ${e} page`,onChange:(e,o)=>J.setPageIndex(o-1),page:Math.min(Q+1,N),renderItem:e=>/* @__PURE__ */i(l,{...e,slots:{previous:()=>/* @__PURE__ */i(b,{icon:"arrowLeft",size:2}),next:()=>/* @__PURE__ */i(b,{icon:"arrowRight",size:2})}})}):/* @__PURE__ */i(m,{table:J})})]})}export{f as MRTGrid};
@@ -6,5 +6,6 @@ export declare const MRT_GRID_HUB_LAYOUT: {
6
6
  readonly headerHeight: 64;
7
7
  readonly paginationMinHeight: 104;
8
8
  readonly paginationPadding: "32px 40px 40px";
9
+ readonly pinnedActionShadow: "-4px 0 6px rgba(50, 50, 47, 0.06)";
9
10
  readonly rowHeight: 64;
10
11
  };
@@ -1 +1 @@
1
- const i={actionColumnWidth:60,bodyCellPadding:"8px 12px",headerCellPadding:"12px 8px 12px 12px",headerHeight:64,paginationMinHeight:104,paginationPadding:"32px 40px 40px",rowHeight:64};export{i as MRT_GRID_HUB_LAYOUT};
1
+ const i={actionColumnWidth:60,bodyCellPadding:"8px 12px",headerCellPadding:"12px 8px 12px 12px",headerHeight:64,paginationMinHeight:104,paginationPadding:"32px 40px 40px",pinnedActionShadow:"-4px 0 6px rgba(50, 50, 47, 0.06)",rowHeight:64};export{i as MRT_GRID_HUB_LAYOUT};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@foodpilot/foods",
3
3
  "private": false,
4
- "version": "2.19.3",
4
+ "version": "2.20.1",
5
5
  "type": "module",
6
6
  "main": "./dist/main.js",
7
7
  "module": "./dist/main.js",
@@ -219,7 +219,7 @@
219
219
  "@mui/x-tree-view": "^7.0.0",
220
220
  "i18next": "^23.0.0 || ^25.0.0",
221
221
  "lodash": "^4.18.1",
222
- "material-react-table": "^2.0.0",
222
+ "material-react-table": "^3.2.1",
223
223
  "react": "^18.0.0 || ^19.0.0",
224
224
  "react-dom": "^18.0.0 || ^19.0.0",
225
225
  "react-i18next": "^16.5.4",