@foodpilot/foods 2.20.0 → 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 t,ArrowBack as a}from"@mui/icons-material";import{Stack as n,Pagination as r,PaginationItem as l,useTheme as p,Typography as d}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),w=(e,o)=>Object.entries(o).reduce((e,[o,i])=>{const t=e[o];return e[o]=x(t)&&x(i)?w(t,i):i,e},{...e}),y=(e,o)=>e?"function"==typeof e?y(e(o),o):Array.isArray(e)?e.reduce((e,i)=>w(e,y(i,o)),{}):x(e)?e:{}:{},P=(e,o,i)=>t=>{const a=y(e,t),n=y(o,t);return i?w(n,a):w(a,n)},C=(e,o,i=!1)=>{if(void 0===o)return e;const t=o=>({...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=>t(o(e)):t(o)};function f(x){const{appearance:w="default",columns:y,displayColumnDefOptions:P,enableColumnPinning:f,enableColumnResizing:H,maxLinesPerRow:v=2,muiPaginationProps:R,muiPaginationStackProps:T,muiTableBodyCellProps:$,muiTableBodyRowProps:k,muiTableHeadCellProps:S,muiTableHeadRowProps:A,muiTableProps:M,...I}=x,L="hub"===w,z=(e=>{const o=p(),{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:w,maxLinePerRow:c(()=>v,[v])}),B=L?{...P,"mrt-row-actions":{...P?.["mrt-row-actions"],grow:!1,header:"",size:u.actionColumnWidth}}:P,j=c(()=>y.map(e=>({Header:e=>{const{column:o}=e,t=o.columnDef.header;/* @__PURE__ */
2
- return i(d,{variant:L?"small-semibold":"small-bold",component:"p",title:t,children:t})},Cell:e=>"object"==typeof e.cell.getValue()?null:/* @__PURE__ */i(d,{variant:"body",component:"p",children:e.renderedCellValue}),...e,...L&&{grow:e.grow??!0}})),[y,L]),D={shape:"circular",variant:"text",showFirstButton:!1,showLastButton:!1,showRowsPerPage:!1,sx:z.pagination},O=e=>({...C(D,e,!0),showRowsPerPage:!1}),W=L?"function"==typeof R?e=>O(R(e)):O(R):R??D,G={columns:j,enableDensityToggle:!1,enableToolbarInternalActions:!1,enableColumnActions:!1,enableRowActions:!1,positionActionsColumn:"last",enableRowSelection:!0,enableSelectAll:!0,enablePagination:!0,muiTableBodyCellProps:L?C({sx:z.bodyCell},$,!0):$??{sx:z.bodyCell},muiTableBodyRowProps:L?C({sx:z.bodyRow},k,!0):k??{sx:z.bodyRow},muiTableHeadCellProps:L?C({sx:z.headCell},S,!0):S??{sx:z.headCell},muiTableHeadRowProps:L?C({sx:z.headRow},A,!0):A??{sx:z.headRow},muiTableProps:L?C({sx:z.table},M,!0):M??{sx:z.table},muiSelectCheckboxProps:{},muiSelectAllCheckboxProps:{},paginationDisplayMode:"pages",icons:{ChevronLeftIcon:()=>/* @__PURE__ */i(a,{}),ChevronRightIcon:()=>/* @__PURE__ */i(t,{})},enableColumnPinning:!!L||f,enableColumnResizing:!L&&(H??!0),layoutMode:"grid",...I,displayColumnDefOptions:B,muiPaginationProps:W},V=s(G),F=x.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:L?0:h,...L&&{boxSizing:"border-box",minHeight:`${u.paginationMinHeight}px`,padding:u.paginationPadding},".MuiTablePagination-root":{padding:0},".MuiTablePagination-toolbar":{padding:0}},Y=void 0===Q?X:L?[...Array.isArray(Q)?Q:[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&&(!L||q>0)&&/* @__PURE__ */i(n,{alignItems:"flex-end","data-appearance":w,"data-testid":"mrt-grid-pagination",...U,sx:Y,children:L?/* @__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(b,{icon:"arrowLeft",size:2}),next:()=>/* @__PURE__ */i(b,{icon:"arrowRight",size:2})}})}):/* @__PURE__ */i(m,{table:V})})]})}export{f 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};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@foodpilot/foods",
3
3
  "private": false,
4
- "version": "2.20.0",
4
+ "version": "2.20.1",
5
5
  "type": "module",
6
6
  "main": "./dist/main.js",
7
7
  "module": "./dist/main.js",