@foodpilot/foods 2.11.40 → 2.11.42

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.
@@ -36,5 +36,6 @@ export type PolymorphicChartProps = {
36
36
  separator?: string;
37
37
  aggregation?: AggregationOptions;
38
38
  cumulativeDescriptions?: string[];
39
+ chartWidth?: number;
39
40
  };
40
41
  export declare const PolymorphicChart: (props: PolymorphicChartProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,9 +1,9 @@
1
- import{jsxs as e,jsx as t}from"react/jsx-runtime";import{useRef as r,useState as a,useMemo as o}from"react";import{useTheme as n,useMediaQuery as i,Stack as s,Box as l,Skeleton as h}from"@mui/material";import{extractPaletteFromTheme as m,createPalette as c}from"../Legend/utils.js";import{prepareChartData as d,calculateSumValues as u,formatDisplayValue as p}from"../DoughnutChart/utils.js";import{useDoughnutChartInteractions as g}from"../DoughnutChart/useDoughnutChartInteractions.js";import{DoughnutChartContent as f}from"../DoughnutChart/DoughnutChartContent.js";import{PolymorphicChartRenderer as b}from"./PolymorphicChartRenderer.js";import v from"i18next";import{ToggleSwitch as y}from"../../ToggleSwitch/ToggleSwitch.js";import{Legend as w}from"../Legend/Legend.js";const x=2,L=0,C=2,T="900px",k=300,I="0.2s",N=["table","cumulative"],j=j=>{const F=n(),{chartType:A,values:E,labels:O,colors:D,legend:M,children:V,valuesUnit:H,className:S,valuesFormatterFn:$=F.numbers.valueFormatterFn,createPalette:P=!0,isLoading:W=!1,displayTotal:z=!0,fullWidthLegend:U=!1,displayTotalVariant:R="number-big",spacing:Y=x,borderWidth:q=L,borderColor:B,hoverOffset:G=C,icons:J,showTooltip:K=!0,width:Q=T,height:X=k,maxScore:Z,separator:_,aggregation:ee,cumulativeDescriptions:te}=j,{showAggregateToggle:re=!1,aggregateToggleLabel:ae="",othersCategoryLabel:oe="",othersThresholdPercent:ne=1}=ee??{},ie=r(null),se=r(null),le=!N.includes(A),he=v.language,me=i(F.breakpoints.down("md")),ce=m(F,100,700),de=M?.position??"bottom",ue=M?{...M,mode:"raw"===A||void 0!==Z?"raw":M.mode}:void 0,[pe,ge]=a(!1),fe="raw"!==A&&"table"!==A,{effValues:be,effLabels:ve,keptIndices:ye,hasOthers:we}=o(()=>{const e=Array.isArray(E)?E:[],t=Array.isArray(O)?O:[];if(!fe||!re||!pe)return{effValues:e,effLabels:t,keptIndices:e.map((e,t)=>t),hasOthers:!1};const r=e.reduce((e,t)=>e+(Number.isFinite(t)?Number(t):0),0);if(r<=0)return{effValues:e,effLabels:t,keptIndices:e.map((e,t)=>t),hasOthers:!1};const a=Math.max(0,ne)/100,o=[],n=[];if(e.forEach((e,t)=>{Math.abs(Number(e))/r<a?o.push(t):n.push(t)}),o.length<2)return{effValues:e,effLabels:t,keptIndices:e.map((e,t)=>t),hasOthers:!1};const i=o.reduce((t,r)=>t+(Number(e[r])||0),0);return{effValues:[...n.map(t=>Number(e[t])||0),i],effLabels:[...n.map(e=>t[e]??""),oe],keptIndices:n,hasOthers:!0}},[fe,re,pe,E,O,ne,oe]),xe=o(()=>{if(!fe)return 0;const e=Array.isArray(E)?E:[],t=e.reduce((e,t)=>e+(Number.isFinite(t)?Number(t):0),0);if(t<=0)return 0;const r=Math.max(0,ne)/100;let a=0;return e.forEach(e=>{Math.abs(Number(e))/t<r&&(a+=1)}),a},[fe,E,ne]),Le=D&&D.length?D:ce;let Ce=[];if(we){const e=ye.map(e=>Le[e%Le.length]);Ce=[...e,F.custom.dataviz.extra[16].main]}else Ce=P?c(Le,be):be.map((e,t)=>Le[t%Le.length]);const Te=d(be,ve,Ce),ke=u(E,z),Ie=p(V,z,ke,$),{HoveredChartElementIndex:Ne,tooltipPos:je,handleLegendHover:Fe,handleMouseEnter:Ae,handleMouseOut:Ee}=g(Te,ie),Oe="donut"===A,De=!W&&K,Me=0===Te.length&&!W;/* @__PURE__ */
2
- return e(s,{direction:"bottom"===de||me?"column":"row",gap:"bottom"===de?F.spacing(2):F.spacing(4),className:`polymorphic-chart polymorphic-chart-${A} ${S}`,ref:se,sx:{maxWidth:Q,width:"100%",minHeight:"100%"},children:[
3
- /* @__PURE__ */e(s,{sx:"raw"===A?{minHeight:"100%"}:{flex:1},children:[
4
- /* @__PURE__ */e(l,{position:"relative",margin:"raw"===A?0:"28px auto",sx:{"& *":{outline:"none"},".cell-hovered":{animation:`cell-hovered ${I} ease-in-out forwards`,transformOrigin:"center"},".cell-idle":{transform:"scale(1)",transformOrigin:"center",animation:`cell-idle ${I} ease-in-out forwards`},"@keyframes cell-hovered":{"0%":{transform:"scale(1)"},"100%":{transform:`scale(${1+G/100})`},"@keyframes cell-idle":{"0%":{transform:`scale(${1+G/100})`},"100%":{transform:"scale(1)"}}},height:"raw"===A?"100%":"inherit",width:"100%",pointerEvents:W?"none":"auto"},className:"polymorphic-chart-wrapper",id:"polymorphic-chart-wrapper",ref:ie,children:[
5
- /* @__PURE__ */t(b,{chartType:A,data:Te,HoveredChartElementIndex:Ne,spacing:Y,borderWidth:q,borderColor:B,showTooltip:De,tooltipPos:je,valuesFormatterFn:$,language:he,valuesUnit:H,icons:J,isLoading:W,height:X,onMouseEnter:Ae,onMouseLeave:Ee,onLegendAction:e=>{M?.actions?.[e]&&M.actions[e]?.()},maxScore:Z,separator:_,cumulativeDescriptions:te}),Oe&&!W&&/* @__PURE__ */t(f,{isLoading:W,isEmpty:Me,displayValue:Ie,displayTotalVariant:R,valuesUnit:H,displayTotal:z})]}),fe&&xe>=2&&re&&!Me&&/* @__PURE__ */t(l,{sx:{display:"flex",justifyContent:"center",width:"100%",zIndex:2,transform:"translateY(0%)",pointerEvents:"auto"},children:W?/* @__PURE__ */e(s,{direction:"row",alignItems:"center",justifyContent:"center",spacing:F.spacing(1.25),height:F.spacing(4.5),children:[
1
+ import{jsxs as e,jsx as t}from"react/jsx-runtime";import{useRef as r,useState as a,useMemo as o}from"react";import{useTheme as i,useMediaQuery as n,Stack as s,Box as l,Skeleton as h}from"@mui/material";import{extractPaletteFromTheme as m,createPalette as c}from"../Legend/utils.js";import{prepareChartData as d,calculateSumValues as u,formatDisplayValue as p}from"../DoughnutChart/utils.js";import{useDoughnutChartInteractions as g}from"../DoughnutChart/useDoughnutChartInteractions.js";import{DoughnutChartContent as f}from"../DoughnutChart/DoughnutChartContent.js";import{PolymorphicChartRenderer as b}from"./PolymorphicChartRenderer.js";import v from"i18next";import{ToggleSwitch as y}from"../../ToggleSwitch/ToggleSwitch.js";import{Legend as w}from"../Legend/Legend.js";const x=2,L=0,C=2,T="900px",k=300,I="0.2s",N=["table","cumulative"],j=j=>{const F=i(),{chartType:A,values:E,labels:O,colors:D,legend:M,children:V,valuesUnit:S,className:H,valuesFormatterFn:W=F.numbers.valueFormatterFn,createPalette:$=!0,isLoading:P=!1,displayTotal:z=!0,fullWidthLegend:U=!1,displayTotalVariant:R="number-big",spacing:Y=x,borderWidth:q=L,borderColor:B,hoverOffset:G=C,icons:J,showTooltip:K=!0,width:Q=T,height:X=k,maxScore:Z,separator:_,aggregation:ee,cumulativeDescriptions:te,chartWidth:re}=j,{showAggregateToggle:ae=!1,aggregateToggleLabel:oe="",othersCategoryLabel:ie="",othersThresholdPercent:ne=1}=ee??{},se=r(null),le=r(null),he=!N.includes(A),me=v.language,ce=n(F.breakpoints.down("md")),de=m(F,100,700),ue=M?.position??"bottom",pe=M?{...M,mode:"raw"===A||void 0!==Z?"raw":M.mode}:void 0,[ge,fe]=a(!1),be="raw"!==A&&"table"!==A,{effValues:ve,effLabels:ye,keptIndices:we,hasOthers:xe}=o(()=>{const e=Array.isArray(E)?E:[],t=Array.isArray(O)?O:[];if(!be||!ae||!ge)return{effValues:e,effLabels:t,keptIndices:e.map((e,t)=>t),hasOthers:!1};const r=e.reduce((e,t)=>e+(Number.isFinite(t)?Number(t):0),0);if(r<=0)return{effValues:e,effLabels:t,keptIndices:e.map((e,t)=>t),hasOthers:!1};const a=Math.max(0,ne)/100,o=[],i=[];if(e.forEach((e,t)=>{Math.abs(Number(e))/r<a?o.push(t):i.push(t)}),o.length<2)return{effValues:e,effLabels:t,keptIndices:e.map((e,t)=>t),hasOthers:!1};const n=o.reduce((t,r)=>t+(Number(e[r])||0),0);return{effValues:[...i.map(t=>Number(e[t])||0),n],effLabels:[...i.map(e=>t[e]??""),ie],keptIndices:i,hasOthers:!0}},[be,ae,ge,E,O,ne,ie]),Le=o(()=>{if(!be)return 0;const e=Array.isArray(E)?E:[],t=e.reduce((e,t)=>e+(Number.isFinite(t)?Number(t):0),0);if(t<=0)return 0;const r=Math.max(0,ne)/100;let a=0;return e.forEach(e=>{Math.abs(Number(e))/t<r&&(a+=1)}),a},[be,E,ne]),Ce=D&&D.length?D:de;let Te=[];if(xe){const e=we.map(e=>Ce[e%Ce.length]);Te=[...e,F.custom.dataviz.extra[16].main]}else Te=$?c(Ce,ve):ve.map((e,t)=>Ce[t%Ce.length]);const ke=d(ve,ye,Te),Ie=u(E,z),Ne=p(V,z,Ie,W),{HoveredChartElementIndex:je,tooltipPos:Fe,handleLegendHover:Ae,handleMouseEnter:Ee,handleMouseOut:Oe}=g(ke,se),De="donut"===A,Me=!P&&K,Ve=0===ke.length&&!P;/* @__PURE__ */
2
+ return e(s,{direction:"bottom"===ue||ce?"column":"row",gap:"bottom"===ue?F.spacing(2):F.spacing(4),className:`polymorphic-chart polymorphic-chart-${A} ${H}`,ref:le,sx:{maxWidth:Q,width:"100%",minHeight:"100%"},children:[
3
+ /* @__PURE__ */e(s,{sx:"raw"===A?{minHeight:"100%"}:re?{width:re,minWidth:re,flexShrink:0}:{flex:1},children:[
4
+ /* @__PURE__ */e(l,{position:"relative",margin:"raw"===A?0:"28px auto",sx:{"& *":{outline:"none"},".cell-hovered":{animation:`cell-hovered ${I} ease-in-out forwards`,transformOrigin:"center"},".cell-idle":{transform:"scale(1)",transformOrigin:"center",animation:`cell-idle ${I} ease-in-out forwards`},"@keyframes cell-hovered":{"0%":{transform:"scale(1)"},"100%":{transform:`scale(${1+G/100})`},"@keyframes cell-idle":{"0%":{transform:`scale(${1+G/100})`},"100%":{transform:"scale(1)"}}},height:"raw"===A?"100%":"inherit",width:"100%",pointerEvents:P?"none":"auto"},className:"polymorphic-chart-wrapper",id:"polymorphic-chart-wrapper",ref:se,children:[
5
+ /* @__PURE__ */t(b,{chartType:A,data:ke,HoveredChartElementIndex:je,spacing:Y,borderWidth:q,borderColor:B,showTooltip:Me,tooltipPos:Fe,valuesFormatterFn:W,language:me,valuesUnit:S,icons:J,isLoading:P,height:X,onMouseEnter:Ee,onMouseLeave:Oe,onLegendAction:e=>{M?.actions?.[e]&&M.actions[e]?.()},maxScore:Z,separator:_,cumulativeDescriptions:te}),De&&!P&&/* @__PURE__ */t(f,{isLoading:P,isEmpty:Ve,displayValue:Ne,displayTotalVariant:R,valuesUnit:S,displayTotal:z})]}),be&&Le>=2&&ae&&!Ve&&/* @__PURE__ */t(l,{sx:{display:"flex",justifyContent:"center",width:"100%",zIndex:2,transform:"translateY(0%)",pointerEvents:"auto"},children:P?/* @__PURE__ */e(s,{direction:"row",alignItems:"center",justifyContent:"center",spacing:F.spacing(1.25),height:F.spacing(4.5),children:[
6
6
  /* @__PURE__ */t(h,{variant:"rounded",width:36,height:26,animation:"pulse"}),
7
- /* @__PURE__ */t(h,{width:150,height:24,animation:"pulse"})]}):/* @__PURE__ */t(y,{label:ae,checked:pe,onChange:e=>ge(e.target.checked),toggleSize:"small"})})]}),
8
- /* @__PURE__ */t(l,{display:"flex",width:U?"100%":"inherit",sx:{width:U?"100%":"inherit",flex:1},children:ue&&le&&(()=>{const e=Array.from(ve.keys()),r=fe&&pe?e.filter(e=>(ve[e]??"").trim().length>0):e,a=r.map(e=>ve[e]??""),o=r.map(e=>be[e]??0),n=r.map(e=>Ce[e]);/* @__PURE__ */
9
- return t(w,{labels:a,hoveredDatasetIndex:Ne,onLegendHover:Fe,values:o,colors:n,legend:ue,isLoading:W,icons:J,chartRef:ie,maxScore:Z,separator:_,threshold:ne,valuesFormatterFn:$})})()})]})};export{j as PolymorphicChart};
7
+ /* @__PURE__ */t(h,{width:150,height:24,animation:"pulse"})]}):/* @__PURE__ */t(y,{label:oe,checked:ge,onChange:e=>fe(e.target.checked),toggleSize:"small"})})]}),
8
+ /* @__PURE__ */t(l,{display:"flex",width:U?"100%":"inherit",sx:{width:U?"100%":"inherit",flex:1},children:pe&&he&&(()=>{const e=Array.from(ye.keys()),r=be&&ge?e.filter(e=>(ye[e]??"").trim().length>0):e,a=r.map(e=>ye[e]??""),o=r.map(e=>ve[e]??0),i=r.map(e=>Te[e]);/* @__PURE__ */
9
+ return t(w,{labels:a,hoveredDatasetIndex:je,onLegendHover:Ae,values:o,colors:i,legend:pe,isLoading:P,icons:J,chartRef:se,maxScore:Z,separator:_,threshold:ne,valuesFormatterFn:W})})()})]})};export{j as PolymorphicChart};
@@ -1,7 +1,7 @@
1
- import{jsx as e,jsxs as t}from"react/jsx-runtime";import{useTheme as o,Box as i,Stack as n}from"@mui/material";import{useState as r,useEffect as s}from"react";import{UserButton as d}from"./Sections/Profile/UserButton.js";import{UserButtons as a}from"./Sections/UserButtons/UserButtons.js";import{Organization as p}from"./Sections/Organization/Organization.js";import{ExpandButton as l}from"./Sections/ExpandButton/ExpandButton.js";const x=x=>{const c=o(),{buttons:g,footerButtons:m=[],connectedUser:u,organization:b,sidebarTexts:h,sidebarOptions:f={},userActions:w,logoutAction:k,sidebarStatusHandler:S,navigationMode:B="desktop",onMobileDrawerClose:E}=x,{isExpanded:v=!1,notExpandedSize:j="80px",expandedSize:y="280px"}=f,z=()=>"mobile"===B||"tablet"!==B&&v,[C,R]=r(z());s(()=>{R(z())},[B,v]),s(()=>{"mobile"!==B&&S(C)},[C,S,B]);const O="mobile"===B?y:"tablet"===B?j:C?y:j;/* @__PURE__ */
2
- return e(i,{sx:{background:"linear-gradient(180deg, #484945 0%, #2A2B27 100%)",width:O,height:"100%",transition:"desktop"===B?"width 0.3s ease":"none",position:"relative","&:after":"mobile"!==B?{width:"30px",height:"30px",content:'""',background:`radial-gradient(transparent 15px, ${c.custom.grey[2600]} 16px)`,clipPath:"inset(0 15px 15px 0)",position:"absolute",top:0,left:O,transition:"desktop"===B?"left .3s ease":"none",zIndex:1}:{}},children:/* @__PURE__ */t(i,{sx:{overflow:"hidden",display:"grid",gridTemplateRows:"desktop"===B?"80px 1fr 36px 80px":"80px 1fr 80px",minHeight:"100vh",height:"100%",width:"100%","& > * > *":C?{paddingLeft:"20px",paddingRight:"20px"}:{}},children:[
3
- /* @__PURE__ */e(i,{sx:{gridRow:"1",borderBottom:`1px solid ${c.custom.grey[2300]}`},children:/* @__PURE__ */e(p,{name:`${b.name}`,picture:b.picture,popover:b.popover,isExtended:C})}),
4
- /* @__PURE__ */e(i,{sx:{gridRow:"2",paddingBlock:c.spacing(2),height:"100%"},children:/* @__PURE__ */t(n,{justifyContent:"space-between",height:"100%",children:[
5
- /* @__PURE__ */e(a,{buttons:g,isExpanded:C,extendSidebar:()=>{"desktop"===B&&R(!0)},onMobileDrawerClose:"mobile"===B?E:void 0}),
6
- /* @__PURE__ */e(a,{buttons:m,isExpanded:C,extendSidebar:()=>{"desktop"===B&&R(!0)},onMobileDrawerClose:"mobile"===B?E:void 0})]})}),"desktop"===B&&/* @__PURE__ */e(i,{sx:{gridRow:"3",backgroundColor:c.custom.grey[3e3]},children:/* @__PURE__ */e(l,{isExpanded:C,toggleSidebar:()=>R(!C),textOptions:h})}),
7
- /* @__PURE__ */e(i,{sx:{gridRow:"desktop"===B?"4":"3",backgroundColor:c.custom.grey[3e3]},children:/* @__PURE__ */e(d,{user:u,userActions:w,isExpanded:C,textOptions:h,logout:k})})]})})};export{x as FoodsNavbar};
1
+ import{jsx as e,jsxs as t}from"react/jsx-runtime";import{useTheme as o,Box as i,Stack as n}from"@mui/material";import{useState as r,useEffect as s}from"react";import{UserButton as d}from"./Sections/Profile/UserButton.js";import{UserButtons as a}from"./Sections/UserButtons/UserButtons.js";import{Organization as p}from"./Sections/Organization/Organization.js";import{ExpandButton as l}from"./Sections/ExpandButton/ExpandButton.js";import{NAVBAR_EXPANDED_INLINE_PADDING as x}from"./constants.js";const c=c=>{const g=o(),{buttons:m,footerButtons:u=[],connectedUser:b,organization:h,sidebarTexts:f,sidebarOptions:w={},userActions:k,logoutAction:S,sidebarStatusHandler:B,navigationMode:E="desktop",onMobileDrawerClose:v}=c,{isExpanded:j=!1,notExpandedSize:y="80px",expandedSize:z="280px"}=w,C=()=>"mobile"===E||"tablet"!==E&&j,[O,R]=r(C());s(()=>{R(C())},[E,j]),s(()=>{"mobile"!==E&&B(O)},[O,B,E]);const A="mobile"===E?z:"tablet"===E?y:O?z:y;/* @__PURE__ */
2
+ return e(i,{sx:{background:"linear-gradient(180deg, #484945 0%, #2A2B27 100%)",width:A,height:"100%",transition:"desktop"===E?"width 0.3s ease":"none",position:"relative","&:after":"mobile"!==E?{width:"30px",height:"30px",content:'""',background:`radial-gradient(transparent 15px, ${g.custom.grey[2600]} 16px)`,clipPath:"inset(0 15px 15px 0)",position:"absolute",top:0,left:A,transition:"desktop"===E?"left .3s ease":"none",zIndex:1}:{}},children:/* @__PURE__ */t(i,{sx:{overflow:"hidden",display:"grid",gridTemplateRows:"desktop"===E?"80px 1fr 36px 80px":"80px 1fr 80px",minHeight:"100vh",height:"100%",width:"100%"},children:[
3
+ /* @__PURE__ */e(i,{sx:{gridRow:"1",borderBottom:`1px solid ${g.custom.grey[2300]}`,paddingInline:O?x:0},children:/* @__PURE__ */e(p,{name:`${h.name}`,picture:h.picture,popover:h.popover,isExtended:O})}),
4
+ /* @__PURE__ */e(i,{sx:{gridRow:"2",paddingBlock:g.spacing(2),paddingInline:O?x:0,height:"100%"},children:/* @__PURE__ */t(n,{justifyContent:"space-between",height:"100%",children:[
5
+ /* @__PURE__ */e(a,{buttons:m,isExpanded:O,extendSidebar:()=>{"desktop"===E&&R(!0)},onMobileDrawerClose:"mobile"===E?v:void 0}),
6
+ /* @__PURE__ */e(a,{buttons:u,isExpanded:O,extendSidebar:()=>{"desktop"===E&&R(!0)},onMobileDrawerClose:"mobile"===E?v:void 0})]})}),"desktop"===E&&/* @__PURE__ */e(i,{sx:{gridRow:"3",backgroundColor:g.custom.grey[3e3]},children:/* @__PURE__ */e(l,{isExpanded:O,toggleSidebar:()=>R(!O),textOptions:f})}),
7
+ /* @__PURE__ */e(i,{sx:{gridRow:"desktop"===E?"4":"3",backgroundColor:g.custom.grey[3e3],paddingInline:O?x:0},children:/* @__PURE__ */e(d,{user:b,userActions:k,isExpanded:O,textOptions:f,logout:S})})]})})};export{c as FoodsNavbar};
@@ -1,4 +1,4 @@
1
- import{jsxs as e,jsx as o,Fragment as t}from"react/jsx-runtime";import{useTheme as r,Box as i,Typography as n}from"@mui/material";import{FoodsIcon as s}from"../../../../Icons/FoodsIcon.js";const c=c=>{const l=r(),{isExpanded:d,toggleSidebar:a,textOptions:m}=c;/* @__PURE__ */
2
- return e(i,{sx:{display:"flex",alignItems:"center",width:"100%",height:"32px",...d?{justifyContent:"space-between"}:{justifyContent:"center"},borderBlock:"1px solid",borderColor:l.custom.grey[2700],"& > *":{color:l.custom.grey[100]},"&:hover > *":{cursor:"pointer",color:l.custom.grey[1e3]}},onClick:a,children:[!d&&/* @__PURE__ */o(s,{size:1,icon:"openPanel"}),d&&/* @__PURE__ */e(t,{children:[
3
- /* @__PURE__ */o(n,{title:m.shortenSidebar,variant:"small-bold",sx:{color:l.custom.grey[100],overflow:"hidden",width:"fit-content",maxWidth:"218px",whiteSpace:"nowrap"},children:m.shortenSidebar}),
4
- /* @__PURE__ */o(s,{size:1,icon:"closePanel"})]})]})};export{c as ExpandButton};
1
+ import{jsxs as e,jsx as o,Fragment as t}from"react/jsx-runtime";import{useTheme as r,Box as n,Typography as i}from"@mui/material";import{NAVBAR_EXPANDED_INLINE_PADDING as s}from"../../constants.js";import{FoodsIcon as c}from"../../../../Icons/FoodsIcon.js";const l=l=>{const d=r(),{isExpanded:a,toggleSidebar:m,textOptions:p}=l;/* @__PURE__ */
2
+ return e(n,{sx:{display:"flex",alignItems:"center",width:"100%",height:"32px",paddingInline:a?s:0,...a?{justifyContent:"space-between"}:{justifyContent:"center"},borderBlock:"1px solid",borderColor:d.custom.grey[2700],"& > *":{color:d.custom.grey[100]},"&:hover > *":{cursor:"pointer",color:d.custom.grey[1e3]}},onClick:m,children:[!a&&/* @__PURE__ */o(c,{size:1,icon:"openPanel"}),a&&/* @__PURE__ */e(t,{children:[
3
+ /* @__PURE__ */o(i,{title:p.shortenSidebar,variant:"small-bold",sx:{color:d.custom.grey[100],overflow:"hidden",width:"fit-content",maxWidth:"218px",whiteSpace:"nowrap"},children:p.shortenSidebar}),
4
+ /* @__PURE__ */o(c,{size:1,icon:"closePanel"})]})]})};export{l as ExpandButton};
@@ -1,6 +1,6 @@
1
- import{jsxs as e,Fragment as r,jsx as o}from"react/jsx-runtime";import{useTheme as i,Box as t,Avatar as n,Typography as l,Stack as c}from"@mui/material";import{useState as a}from"react";import{ButtonPopover as s}from"./ButtonPopover.js";import{FoodsIcon as d}from"../../../../Icons/FoodsIcon.js";const p=p=>{const{isExtended:h,name:m,picture:x,popover:f}=p,g=i(),[u,v]=a(null),w={closePopover:()=>v(null)},b=f?.renderPopover?f.renderPopover(w):f?.element;/* @__PURE__ */
1
+ import{jsxs as e,Fragment as r,jsx as o}from"react/jsx-runtime";import{useTheme as t,Box as n,Button as i,Avatar as l,Typography as a}from"@mui/material";import{useState as d}from"react";import{ButtonPopover as s}from"./ButtonPopover.js";import{NAVBAR_ACTION_BUTTON_PADDING_BLOCK as c,NAVBAR_ACTION_BUTTON_PADDING_INLINE as p,NAVBAR_ACTION_BUTTON_MIN_HEIGHT as m,NAVBAR_COLLAPSED_ACTION_BUTTON_PADDING as h,NAVBAR_COLLAPSED_ACTION_BUTTON_SIZE as g}from"../../constants.js";import{FoodsIcon as x}from"../../../../Icons/FoodsIcon.js";const u=u=>{const{isExtended:f,name:w,picture:v,popover:b}=u,y=t(),[k,C]=d(null),j=Boolean(k),I={closePopover:()=>C(null)},W=b?.renderPopover?b.renderPopover(I):b?.element;/* @__PURE__ */
2
2
  return e(r,{children:[
3
- /* @__PURE__ */e(t,{sx:{height:"100%",width:"100%",display:"flex",alignItems:"center",justifyContent:h?"space-between":"center",color:g.custom.grey[100]},onClick:e=>{void 0!==f&&v(e.currentTarget)},children:[
4
- /* @__PURE__ */e(t,{lang:window.navigator.language,sx:{display:"flex",flexDirection:"row",alignItems:"center",gap:g.spacing(2),hyphens:"auto",overflowWrap:"break-word",wordBreak:"break-word",maxWidth:"100%",flex:h?"1":"0"},children:[
5
- /* @__PURE__ */o(n,{alt:"app-logo",src:x||"",sx:{width:"48px",height:"48px"},children:x??m.charAt(0)}),h&&/* @__PURE__ */o(l,{variant:"body-bold",sx:{color:g.custom.grey[100],display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden",textOverflow:"ellipsis"},children:m})]}),h&&/* @__PURE__ */o(c,{sx:{cursor:"pointer"},children:/* @__PURE__ */o(d,{size:2,icon:"actions"})})]}),
6
- /* @__PURE__ */o(t,{sx:{flex:1},children:/* @__PURE__ */o(s,{anchor:u,setAnchor:v,paperOverrides:void 0,children:b})})]})};export{p as Organization};
3
+ /* @__PURE__ */o(n,{sx:{height:"100%",width:"100%",display:"flex",alignItems:"center",justifyContent:f?"flex-start":"center"},children:/* @__PURE__ */e(i,{fullWidth:f,sx:{justifyContent:f?"space-between":"center",alignItems:"center",color:y.custom.grey[100],border:"1px solid transparent",borderRadius:"12px",...f?{minHeight:m,paddingInline:p,paddingBlock:c}:{width:g,minWidth:g,height:g,padding:h},textTransform:"none","&:hover":{borderColor:y.custom.grey[600],backgroundColor:y.custom.grey[2e3]},"&:active":{backgroundColor:y.custom.grey[2500]}},onClick:e=>{void 0!==b&&C(e.currentTarget)},children:[
4
+ /* @__PURE__ */e(n,{lang:window.navigator.language,sx:{display:"flex",flexDirection:"row",alignItems:"center",gap:y.spacing(2),hyphens:"auto",overflowWrap:"break-word",wordBreak:"break-word",maxWidth:"100%",flex:f?"1":"0"},children:[
5
+ /* @__PURE__ */o(l,{alt:"app-logo",src:v||"",sx:{width:"40px",height:"40px"},children:v??w.charAt(0)}),f&&/* @__PURE__ */o(a,{variant:"body-bold",sx:{color:y.custom.grey[100],display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden",textOverflow:"ellipsis",textAlign:"left"},children:w})]}),f&&/* @__PURE__ */o(x,{size:2,icon:j?"arrowUpShort":"arrowDownShort"})]})}),
6
+ /* @__PURE__ */o(s,{anchor:k,setAnchor:C,paperOverrides:void 0,children:W})]})};export{u as Organization};
@@ -1,6 +1,6 @@
1
- import{jsxs as e,jsx as t}from"react/jsx-runtime";import{useState as o}from"react";import{useTheme as r,Box as i,Button as n,Avatar as l,Typography as s}from"@mui/material";import{UserPopover as c}from"./UserPopover.js";import{FoodsIcon as a}from"../../../../Icons/FoodsIcon.js";const p=e=>e.firstname.charAt(0).concat(e.lastname.charAt(0)),m=m=>{const{user:d,userActions:x,isExpanded:u,textOptions:f,logout:h}=m,g=r(),[y,b]=o(null),v=Boolean(y),w=`${d.firstname} ${d.lastname}`,A=d.firstname.replaceAll(" "," "),O=d.lastname.replaceAll(" "," ");/* @__PURE__ */
2
- return e(i,{sx:{height:"100%",width:"100%",display:"flex",alignItems:"center",color:g.custom.grey[100]},children:[
3
- /* @__PURE__ */e(n,{fullWidth:!0,sx:{"&:hover":{textDecoration:"none"},color:g.custom.grey[100],justifyContent:u?"space-between":"center"},onClick:e=>b(e.currentTarget),children:[
1
+ import{jsxs as e,jsx as t}from"react/jsx-runtime";import{useState as r}from"react";import{useTheme as o,Box as i,Button as n,Avatar as s,Typography as l}from"@mui/material";import{UserPopover as a}from"./UserPopover.js";import{NAVBAR_ACTION_BUTTON_PADDING_BLOCK as c,NAVBAR_ACTION_BUTTON_PADDING_INLINE as d,NAVBAR_ACTION_BUTTON_MIN_HEIGHT as p,NAVBAR_COLLAPSED_ACTION_BUTTON_PADDING as m,NAVBAR_COLLAPSED_ACTION_BUTTON_SIZE as u}from"../../constants.js";import{FoodsIcon as x}from"../../../../Icons/FoodsIcon.js";const h=e=>e.firstname.charAt(0).concat(e.lastname.charAt(0)),f=f=>{const{user:g,userActions:b,isExpanded:y,textOptions:w,logout:v}=f,C=o(),[k,j]=r(null),A=Boolean(k),I=`${g.firstname} ${g.lastname}`,O=g.firstname.replaceAll(" "," "),W=g.lastname.replaceAll(" "," ");/* @__PURE__ */
2
+ return e(i,{sx:{height:"100%",width:"100%",display:"flex",alignItems:"center",justifyContent:y?"flex-start":"center",color:C.custom.grey[100]},children:[
3
+ /* @__PURE__ */e(n,{fullWidth:y,sx:{border:"1px solid transparent",borderRadius:"12px",...y?{minHeight:p,paddingInline:d,paddingBlock:c}:{width:u,minWidth:u,height:u,padding:m},textTransform:"none","&:hover":{borderColor:C.custom.grey[600],backgroundColor:C.custom.grey[2e3],textDecoration:"none"},"&:active":{backgroundColor:C.custom.grey[2500]},color:C.custom.grey[100],justifyContent:y?"space-between":"center"},onClick:e=>j(e.currentTarget),children:[
4
4
  /* @__PURE__ */e(i,{sx:{display:"flex",flexDirection:"row",alignItems:"center",gap:"16px"},children:[
5
- /* @__PURE__ */t(l,{alt:"profile-picture",src:d.picture||"",children:d.picture??p(d)}),u&&/* @__PURE__ */e(s,{title:w,variant:"body-bold",sx:{color:g.custom.grey[100],textOverflow:"ellipsis",overflow:"hidden",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",width:"fit-content",maxWidth:"150px"},children:[A," ",O]})]}),u&&/* @__PURE__ */t(a,{size:2,icon:"actions"})]}),
6
- /* @__PURE__ */t(c,{isExpanded:u,userActions:x,isPopoverOpen:v,anchor:y,onClose:()=>b(null),logout:h,textOptions:f})]})};export{m as UserButton};
5
+ /* @__PURE__ */t(s,{alt:"profile-picture",src:g.picture||"",children:g.picture??h(g)}),y&&/* @__PURE__ */e(l,{title:I,variant:"body-bold",sx:{color:C.custom.grey[100],textOverflow:"ellipsis",overflow:"hidden",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",width:"fit-content",maxWidth:"150px"},children:[O," ",W]})]}),y&&/* @__PURE__ */t(x,{size:2,icon:A?"arrowUpShort":"arrowDownShort"})]}),
6
+ /* @__PURE__ */t(a,{isExpanded:y,userActions:b,isPopoverOpen:A,anchor:k,onClose:()=>j(null),logout:v,textOptions:w})]})};export{f as UserButton};
@@ -1,4 +1,4 @@
1
- import{jsx as r,jsxs as o}from"react/jsx-runtime";import{useTheme as i,Popover as t,Box as n,Button as e,Typography as a}from"@mui/material";import{Logout as s}from"@mui/icons-material";const p=p=>{const l=i(),{anchor:c,isPopoverOpen:x,onClose:d,userActions:m,isExpanded:h,textOptions:g,logout:u}=p;/* @__PURE__ */
2
- return r(t,{open:x,anchorEl:c,onClose:d,anchorOrigin:{vertical:"center",horizontal:"right"},transformOrigin:{vertical:"center",horizontal:"left"},slotProps:{paper:{sx:{padding:{xs:l.spacing(1,1),sm:l.spacing(3,2.5)},borderRadius:"12px",boxShadow:"0px 4px 20px 0px rgba(81, 78, 78, 0.12)",border:`1px solid ${l.custom.grey[500]}`}}},sx:{marginLeft:h?{xs:void 0,sm:l.spacing(4)}:{xs:void 0,sm:l.spacing(2)}},children:/* @__PURE__ */o(n,{sx:{display:"flex",width:"fit-content",flexDirection:"column",margin:"5px auto"},children:[m.map((o,i)=>/* @__PURE__ */r(n,{sx:{padding:"5px 24px"},children:o},i)),m&&m.length>0&&
3
- /* @__PURE__ */r("hr",{style:{width:"100%",border:"1px solid #E7E6E4"}}),
4
- /* @__PURE__ */r(n,{sx:{padding:"5px 24px"},children:/* @__PURE__ */r(e,{variant:"text",startIcon:/* @__PURE__ */r(s,{}),onClick:u,sx:{color:l.palette.primary[700],"&:hover":{color:l.palette.primary[500]}},children:/* @__PURE__ */r(a,{variant:"body-bold",sx:{color:"inherit"},children:g.logout})})})]})})};export{p as UserPopover};
1
+ import{jsx as o,jsxs as r}from"react/jsx-runtime";import{useTheme as i,Popover as n,Box as t,Button as e,Typography as a}from"@mui/material";import{Logout as s}from"@mui/icons-material";import{USER_POPOVER_CONTENT_PADDING_BOTTOM as l,USER_POPOVER_ACTION_PADDING_BLOCK as p,USER_POPOVER_ACTION_PADDING_INLINE as c}from"../../constants.js";const d=d=>{const m=i(),{anchor:x,isPopoverOpen:g,onClose:h,userActions:u,isExpanded:f,textOptions:v,logout:b}=d;/* @__PURE__ */
2
+ return o(n,{open:g,anchorEl:x,onClose:h,anchorOrigin:{vertical:"center",horizontal:"right"},transformOrigin:{vertical:"center",horizontal:"left"},slotProps:{paper:{sx:{padding:{xs:m.spacing(1,1),sm:m.spacing(3,2.5)},borderRadius:"12px",boxShadow:"0px 4px 20px 0px rgba(81, 78, 78, 0.12)",border:`1px solid ${m.custom.grey[500]}`}}},sx:{marginLeft:f?{xs:void 0,sm:m.spacing(4)}:{xs:void 0,sm:m.spacing(2)}},children:/* @__PURE__ */r(t,{sx:{display:"flex",width:"fit-content",flexDirection:"column",margin:"0 auto",paddingBottom:l},children:[u.map((r,i)=>/* @__PURE__ */o(t,{sx:{paddingInline:c,paddingBlock:p},children:r},i)),u&&u.length>0&&
3
+ /* @__PURE__ */o("hr",{style:{width:"100%",border:"1px solid #E7E6E4"}}),
4
+ /* @__PURE__ */o(t,{sx:{paddingInline:c,paddingBlock:p},children:/* @__PURE__ */o(e,{variant:"text",startIcon:/* @__PURE__ */o(s,{}),onClick:b,sx:{color:m.palette.primary[700],"&:hover":{color:m.palette.primary[500]}},children:/* @__PURE__ */o(a,{variant:"body-bold",sx:{color:"inherit"},children:v.logout})})})]})})};export{d as UserPopover};
@@ -1 +1,10 @@
1
1
  export declare const ANIMATION_SIDEBAR_DURATION = 300;
2
+ export declare const NAVBAR_EXPANDED_INLINE_PADDING = "16px";
3
+ export declare const NAVBAR_ACTION_BUTTON_PADDING_INLINE = "8px";
4
+ export declare const NAVBAR_ACTION_BUTTON_PADDING_BLOCK = "5px";
5
+ export declare const NAVBAR_COLLAPSED_ACTION_BUTTON_PADDING = "4px";
6
+ export declare const NAVBAR_COLLAPSED_ACTION_BUTTON_SIZE = "48px";
7
+ export declare const NAVBAR_ACTION_BUTTON_MIN_HEIGHT = "48px";
8
+ export declare const USER_POPOVER_ACTION_PADDING_INLINE = "24px";
9
+ export declare const USER_POPOVER_ACTION_PADDING_BLOCK = "6px";
10
+ export declare const USER_POPOVER_CONTENT_PADDING_BOTTOM = "12px";
@@ -0,0 +1 @@
1
+ const p="16px",x="8px",o="5px",t="4px",c="48px",e="48px",n="24px",r="6px",s="12px";export{e as NAVBAR_ACTION_BUTTON_MIN_HEIGHT,o as NAVBAR_ACTION_BUTTON_PADDING_BLOCK,x as NAVBAR_ACTION_BUTTON_PADDING_INLINE,t as NAVBAR_COLLAPSED_ACTION_BUTTON_PADDING,c as NAVBAR_COLLAPSED_ACTION_BUTTON_SIZE,p as NAVBAR_EXPANDED_INLINE_PADDING,r as USER_POPOVER_ACTION_PADDING_BLOCK,n as USER_POPOVER_ACTION_PADDING_INLINE,s as USER_POPOVER_CONTENT_PADDING_BOTTOM};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@foodpilot/foods",
3
3
  "private": false,
4
- "version": "2.11.40",
4
+ "version": "2.11.42",
5
5
  "type": "module",
6
6
  "main": "./dist/main.js",
7
7
  "module": "./dist/main.js",
@@ -250,7 +250,7 @@
250
250
  "@mui/material": "^6.5.0",
251
251
  "@mui/x-date-pickers": "^8.27.2",
252
252
  "@size-limit/file": "^12.0.0",
253
- "@size-limit/preset-big-lib": "^12.0.0",
253
+ "@size-limit/preset-big-lib": "^11.0.0",
254
254
  "@storybook/react-vite": "^10.2.13",
255
255
  "@types/chroma-js": "^3.1.2",
256
256
  "@types/lodash": "^4.17.24",