@foodpilot/foods 2.20.0 → 2.20.2
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
|
|
2
|
-
return i(
|
|
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:
|
|
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};
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
import{jsx as e}from"react/jsx-runtime";import{useTheme as
|
|
2
|
-
return e("next"===c||"previous"===c?t:"start-ellipsis"===c||"end-ellipsis"===c?s:i,{...d,sx:{...g}})};export{m as FoodsPaginationItem};
|
|
1
|
+
import{jsx as e}from"react/jsx-runtime";import{useTheme as r,alpha as o}from"@mui/material";import{PageUpAndDownItem as t}from"./PageItems/PageUpAndDownItem.js";import{EllipsisItem as s}from"./PageItems/EllipsisItem.js";import{PageItem as i}from"./PageItems/PageItem.js";const m=m=>{const a=r(),{type:c}=m,{sx:u,currentPage:g,...n}=m,d={zIndex:5,background:"white",padding:0,fontWeight:"700",":hover":{background:a.custom.grey[1400]},"&.Mui-selected":{backgroundColor:a.custom.grey[2800],color:"white"},"&.Mui-selected:hover":{background:a.custom.grey[2800]},"&.Mui-disabled":{opacity:1,color:o(a.custom.grey[2800],.36)},borderRadius:"25px",borderColor:a.custom.grey[600],...u};return"next"===c||"previous"===c?/* @__PURE__ */e(t,{...n,sx:{...d}}):"start-ellipsis"===c||"end-ellipsis"===c?/* @__PURE__ */e(s,{...n,sx:{...d}}):/* @__PURE__ */e(i,{...n,currentPage:g,sx:{...d}})};export{m as FoodsPaginationItem};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{jsx as e,jsxs as o}from"react/jsx-runtime";import{useTheme as r,Box as t,PaginationItem as i,Stack as
|
|
2
|
-
return e(
|
|
3
|
-
/* @__PURE__ */e(
|
|
1
|
+
import{jsx as e,jsxs as o}from"react/jsx-runtime";import{useTheme as r,Box as t,PaginationItem as i,Stack as s,Typography as d}from"@mui/material";import{FoodsTooltip as n}from"../../Tooltip/FoodsTooltip.js";import{FoodsTags as c}from"../../Tags/FoodsTags.js";const a=a=>{const l=r(),{selected:m,currentPage:u,...g}=a,{isComplete:p=!1}=u||{},b=!1===p?{}:{border:"none",background:l.custom.green[600],color:"white","&.Mui-selected":{background:l.custom.green[600]},":hover":{background:l.custom.green[700]},"&.Mui-selected:hover":{background:l.custom.green[700]}},h=u?.label,v=u?.isComplete,x=u?.isCompleteLabel;/* @__PURE__ */
|
|
2
|
+
return e(n,{width:"auto",title:void 0!==h&&/* @__PURE__ */o(s,{width:"100%",justifyContent:"center",alignItems:"center",gap:l.spacing(1),children:[
|
|
3
|
+
/* @__PURE__ */e(d,{variant:"body-medium",children:h}),!0===v&&void 0!==x&&/* @__PURE__ */e(c,{variant:"tags-green",startIcon:"check",label:x,disabled:!0})]}),children:/* @__PURE__ */e(t,{border:m?`2px solid ${l.custom.grey[2800]}`:void 0,borderRadius:m?"25px":void 0,paddingBlock:"2px",sx:{position:"relative",zIndex:5},children:/* @__PURE__ */e(i,{...g,selected:m,sx:{...a.sx,...b}})})})};export{a as PageItem};
|