@foodpilot/foods 2.25.0 → 2.25.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,11 +1,12 @@
1
- import{jsxs as i,Fragment as n,jsx as a}from"react/jsx-runtime";import{useTheme as r,IconButton as o,Popover as e,Box as l,Typography as t,Stack as c}from"@mui/material";import d from"@mui/icons-material/InfoOutlined";import{useState as s}from"react";const m=m=>{const{title:p,lines:g,totalLabel:h,totalFormattedValue:b,totalUnit:u,totalColor:f,ariaLabel:x}=m,y=r(),[v,C]=s(null),w=null!==v;/* @__PURE__ */
2
- return i(n,{children:[
3
- /* @__PURE__ */a(o,{size:"small",onClick:i=>{C(w?null:i.currentTarget)},"aria-label":x,"aria-expanded":w,sx:{padding:0,marginLeft:y.spacing(.5)},children:/* @__PURE__ */a(d,{fontSize:"small"})}),
4
- /* @__PURE__ */a(e,{open:w,anchorEl:v,onClose:()=>C(null),anchorOrigin:{vertical:"bottom",horizontal:"left"},children:/* @__PURE__ */i(l,{sx:{padding:y.spacing(2),minWidth:y.spacing(32)},children:[
5
- /* @__PURE__ */a(t,{variant:"h4",sx:{marginBottom:y.spacing(1.5)},children:p}),
6
- /* @__PURE__ */a(c,{gap:y.spacing(1),children:g.map(n=>/* @__PURE__ */i(c,{direction:"row",justifyContent:"space-between",gap:2,children:[
7
- /* @__PURE__ */a(t,{variant:"body-medium",children:n.label}),
8
- /* @__PURE__ */a(t,{variant:"body-bold",sx:{color:n.color},children:n.formattedValue})]},n.label))}),
9
- /* @__PURE__ */i(c,{direction:"row",justifyContent:"space-between",sx:{marginTop:y.spacing(2),paddingTop:y.spacing(1),borderTop:`1px solid ${y.custom.grey[500]}`},children:[
10
- /* @__PURE__ */a(t,{variant:"body-bold",children:h}),
11
- /* @__PURE__ */i(t,{variant:"body-bold",sx:{color:f},children:[b," ",u]})]})]})})]})};export{m as ActionPlanIndicatorBreakdownPopover};
1
+ import{jsxs as r,Fragment as e,jsx as o}from"react/jsx-runtime";import{useTheme as a,IconButton as i,Popover as l,Box as t,Typography as n,Stack as c}from"@mui/material";import s from"@mui/icons-material/InfoOutlined";import{useState as d}from"react";const m=m=>{const{title:p,lines:u,totalLabel:g,totalFormattedValue:x,totalUnit:b,totalColor:f,ariaLabel:h}=m,y=a(),[z,v]=d(null),S=null!==z;/* @__PURE__ */
2
+ return r(e,{children:[
3
+ /* @__PURE__ */o(i,{size:"small",onClick:r=>{v(S?null:r.currentTarget)},"aria-label":h,"aria-expanded":S,sx:{padding:0,marginLeft:y.spacing(.5)},children:/* @__PURE__ */o(s,{fontSize:"small"})}),
4
+ /* @__PURE__ */o(l,{open:S,anchorEl:z,onClose:()=>v(null),anchorOrigin:{vertical:"bottom",horizontal:"left"},slotProps:{paper:{sx:{padding:y.spacing(1),borderRadius:y.spacing(1),border:`1px solid ${y.custom.grey[600]}`,boxShadow:"0px 4px 20px 0px rgba(81, 78, 78, 0.12)"}}},children:/* @__PURE__ */r(t,{sx:{display:"flex",flexDirection:"column",gap:y.spacing(.5)},children:[
5
+ /* @__PURE__ */o(n,{variant:"small-regular",sx:{color:y.custom.grey[2e3]},children:p}),
6
+ /* @__PURE__ */o(c,{gap:y.spacing(.5),children:u.map(e=>/* @__PURE__ */r(c,{direction:"row",justifyContent:"space-between",gap:1,children:[
7
+ /* @__PURE__ */o(n,{variant:"body-regular",sx:{fontSize:"0.75rem",color:y.custom.grey[2500]},children:e.label}),
8
+ /* @__PURE__ */o(n,{variant:"body-medium",sx:{fontSize:"0.75rem",color:e.color},children:e.formattedValue})]},e.label))}),
9
+ /* @__PURE__ */o(t,{sx:{borderTop:`1px solid ${y.custom.grey[600]}`}}),
10
+ /* @__PURE__ */r(c,{direction:"row",justifyContent:"space-between",gap:1,children:[
11
+ /* @__PURE__ */o(n,{variant:"body-regular",sx:{fontSize:"0.75rem"},children:g}),
12
+ /* @__PURE__ */r(n,{variant:"body-medium",sx:{fontSize:"0.75rem",color:f},children:[x," ",b]})]})]})})]})};export{m as ActionPlanIndicatorBreakdownPopover};
@@ -1,6 +1,6 @@
1
- import{jsxs as e,jsx as t}from"react/jsx-runtime";import{useTheme as n,Stack as r,Typography as i,Box as a}from"@mui/material";const o=o=>{const{message:c,formattedValue:l,unit:s,valueColor:m}=o,d=n();/* @__PURE__ */
2
- return e(r,{alignItems:"center",justifyContent:"center",sx:{flex:1,minHeight:d.spacing(20),textAlign:"center",gap:d.spacing(2)},children:[
3
- /* @__PURE__ */t(i,{variant:"body-medium",color:"text.secondary",children:c}),
4
- /* @__PURE__ */e(a,{sx:{display:"flex",alignItems:"baseline",gap:d.spacing(1)},children:[
5
- /* @__PURE__ */t(i,{variant:"h1",sx:{color:m},children:l??"—"}),
6
- /* @__PURE__ */t(i,{variant:"h4",color:"text.secondary",children:s})]})]})};export{o as ActionPlanNetImpactBody};
1
+ import{jsxs as e,jsx as r}from"react/jsx-runtime";import{useTheme as t,Stack as i,Typography as n,Box as a}from"@mui/material";const l=l=>{const{message:c,formattedValue:o,unit:s,valueColor:m}=l,g=t();/* @__PURE__ */
2
+ return e(i,{alignItems:"center",justifyContent:"center",sx:{flex:1,minHeight:g.spacing(20),textAlign:"center",padding:g.spacing(2),gap:g.spacing(1)},children:[
3
+ /* @__PURE__ */r(n,{variant:"small-bold",color:"text.primary",children:c}),
4
+ /* @__PURE__ */e(a,{sx:{display:"flex",alignItems:"flex-end",gap:g.spacing(1)},children:[
5
+ /* @__PURE__ */r(n,{variant:"number-big",sx:{color:m??g.palette.text.primary},children:o??"—"}),
6
+ /* @__PURE__ */r(n,{variant:"big-regular",sx:{color:g.custom.grey[2e3]},children:s})]})]})};export{l as ActionPlanNetImpactBody};
@@ -1,2 +1,2 @@
1
1
  import{jsxs as e,jsx as i}from"react/jsx-runtime";import{useTheme as t,Stack as n,Box as r,Typography as o}from"@mui/material";import{FoodsIcon as l}from"../Icons/FoodsIcon.js";const a=a=>{const s=t(),{withPlus:m=!1,value:u,unit:c,size:d="small",position:p="default-side",colorOverride:f,hideUnitOnNull:g=!1,emptyLabel:h,unitVariant:b}=a,y=`number-${d}`,x="micro"===d||"small"===d,v=x?s.custom.numberWithUnit.unitOffset.compact:s.custom.numberWithUnit.unitOffset.regular,z=s.custom.numberWithUnit.emptyIndicator[d],I=null===u&&g,w="string"==typeof u||null===u?u:s.numbers.valueFormatterFn(u),O=b??(x?"small-medium":"body-medium"),U="default-side"===p?null===u?"flex-end":"baseline":"below-center-aligned"===p?"center":"flex-start";/* @__PURE__ */
2
- return e(n,{display:"inline-flex",direction:"default-side"===p?"row":"column",gap:x?s.spacing(.5):s.spacing(1),alignItems:U,children:[null===u?/* @__PURE__ */i(r,{role:void 0===h?void 0:"img","aria-label":h,"aria-hidden":void 0===h,sx:{alignItems:"center",backgroundColor:s.custom.grey[400],borderRadius:s.spacing(.5),color:s.custom.grey[1400],display:"flex",flexShrink:0,height:z.size,justifyContent:"center",width:z.size},children:/* @__PURE__ */i(l,{icon:"empty",size:z.iconSize})}):/* @__PURE__ */e(o,{variant:y,color:f,children:[m&&Number(u)>0?"+":"",w]}),!1===I&&/* @__PURE__ */i(o,{sx:{marginTop:`${v} !important`},variant:O,color:s.custom.grey[1400],children:c})]})};export{a as NumberWithUnit};
2
+ return e(n,{display:"inline-flex",direction:"default-side"===p?"row":"column",gap:x?s.spacing(.5):s.spacing(1),alignItems:U,children:[null===u?/* @__PURE__ */i(r,{role:void 0===h?void 0:"img","aria-label":h,"aria-hidden":void 0===h,sx:{alignItems:"center",backgroundColor:s.custom.grey[400],borderRadius:s.spacing(.5),color:s.custom.grey[1400],display:"flex",flexShrink:0,height:z.size,justifyContent:"center",width:z.size},children:/* @__PURE__ */i(l,{icon:"empty",size:z.iconSize})}):/* @__PURE__ */e(o,{variant:y,color:f,children:[m&&Number(u)>0?"+":"",w]}),!1===I&&/* @__PURE__ */i(o,{sx:{marginTop:`${v} !important`},variant:O,color:s.custom.grey[2500],children:c})]})};export{a as NumberWithUnit};
@@ -1,10 +1,10 @@
1
- import{jsxs as e,jsx as o}from"react/jsx-runtime";import{useTheme as t,Box as i,Typography as n,Divider as r,CircularProgress as l}from"@mui/material";import{Fragment as a}from"react";import{OptionLine as s}from"./Line/OptionLine.js";import{OptionsHeader as c}from"./Header/OptionHeader.js";import{useFoodsSelectContext as d}from"../Context/useSelect.js";import{FoodsBadge as p}from"../../../Badge/FoodsBadge.js";const m=m=>{const g=t(),{selectedOption:x,options:u,getId:f,getName:h,onChange:b,getIcon:y,getGroupName:j,infiniteScroll:C,onScroll:k}=m,{isSearchFound:B,textOptions:I}=d(),S=u.filter(e=>B(h(e))),v=S.filter(e=>null===x||f(e)!==f(x));/* @__PURE__ */
2
- return e(i,{role:"listbox","aria-label":I.placeholder,onScroll:k,sx:{marginBlock:"8px",display:"flex",flexDirection:"column",...C?{height:"280px",overflowY:"auto"}:{}},children:[
3
- /* @__PURE__ */o(c,{selectedOption:x,getName:h,getIcon:y,onChange:b}),0===S.length&&/* @__PURE__ */e(i,{sx:{display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",gap:"8px",marginBlock:"4px"},children:[
1
+ import{jsxs as e,jsx as o}from"react/jsx-runtime";import{useTheme as i,Box as t,Typography as n,Divider as r,CircularProgress as l}from"@mui/material";import{Fragment as a}from"react";import{OptionLine as s}from"./Line/OptionLine.js";import{OptionsHeader as c}from"./Header/OptionHeader.js";import{useFoodsSelectContext as d}from"../Context/useSelect.js";import{FoodsBadge as p}from"../../../Badge/FoodsBadge.js";const m=m=>{const g=i(),{selectedOption:x,options:u,getId:f,getName:h,onChange:b,getIcon:y,getGroupName:j,infiniteScroll:C,onScroll:k}=m,{isSearchFound:B,textOptions:I}=d(),S=u.filter(e=>B(h(e))),v=S.filter(e=>null===x||f(e)!==f(x));/* @__PURE__ */
2
+ return e(t,{role:"listbox","aria-label":I.placeholder,onScroll:k,sx:{marginBlock:"8px",display:"flex",flexDirection:"column",...C?{minHeight:0,overflowY:"auto"}:{}},children:[
3
+ /* @__PURE__ */o(c,{selectedOption:x,getName:h,getIcon:y,onChange:b}),0===S.length&&/* @__PURE__ */e(t,{sx:{display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",gap:"8px",marginBlock:"4px"},children:[
4
4
  /* @__PURE__ */o(p,{icon:"questionMark",size:3,boxProps:{sx:{backgroundColor:g.palette.primary[50],borderRadius:"32px"}}}),
5
- /* @__PURE__ */o(n,{variant:"body-medium",children:I.noResult})]}),v.map((t,l)=>{const c=j?.(t),d=void 0!==c&&(0===l||j?.(v[l-1])!==c);/* @__PURE__ */
6
- return e(a,{children:[d&&/* @__PURE__ */e(i,{role:"presentation",sx:{paddingInline:"5%",paddingBlock:"8px 4px"},children:[l>0&&/* @__PURE__ */o(r,{sx:{marginBottom:"12px"}}),
5
+ /* @__PURE__ */o(n,{variant:"body-medium",children:I.noResult})]}),v.map((i,l)=>{const c=j?.(i),d=void 0!==c&&(0===l||j?.(v[l-1])!==c);/* @__PURE__ */
6
+ return e(a,{children:[d&&/* @__PURE__ */e(t,{role:"presentation",sx:{paddingInline:"5%",paddingBlock:"8px 4px"},children:[l>0&&/* @__PURE__ */o(r,{sx:{marginBottom:"12px"}}),
7
7
  /* @__PURE__ */o(n,{variant:"body-bold",children:c})]}),
8
- /* @__PURE__ */o(s,{isSelected:!1,icon:y?y(t):null,displayText:h(t),onClick:()=>b(t)})]},`select-${l}`)}),!0===C?.isFetchingNextPage&&/* @__PURE__ */e(i,{role:"status","aria-label":C.loadingText??"Loading…",sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:1,padding:1},children:[
8
+ /* @__PURE__ */o(s,{isSelected:!1,icon:y?y(i):null,displayText:h(i),onClick:()=>b(i)})]},`select-${l}`)}),!0===C?.isFetchingNextPage&&/* @__PURE__ */e(t,{role:"status","aria-label":C.loadingText??"Loading…",sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:1,padding:1},children:[
9
9
  /* @__PURE__ */o(l,{size:18}),
10
10
  /* @__PURE__ */o(n,{variant:"small",children:C.loadingText??"Loading…"})]})]})};export{m as SelectOptions};
@@ -1,5 +1,5 @@
1
- import{jsxs as e,jsx as o}from"react/jsx-runtime";import{useTheme as t,Button as i,Typography as r}from"@mui/material";import{useState as n,Fragment as l}from"react";import p from"@mui/icons-material/KeyboardArrowDown";import s from"@mui/icons-material/KeyboardArrowUp";import{SelectOptions as a}from"./Options/SelectOptions.js";import{useFoodsSelectContext as c}from"./Context/useSelect.js";import{AnchoredPopover as d}from"../../Popover/AnchoredPopover.js";const m=m=>{const{textOptions:x,disabled:g,closeOnSelect:h,setSearch:u,disableOnEmpty:f}=c(),w=t(),[b,O]=n(null),v=()=>O(null),y=null!==b,{selectedOption:S,infiniteScroll:I}=m,N=/* @__PURE__ */o(y?s:p,{}),P=y?{border:`2px solid ${w.custom.grey[2800]}`}:{},C=((e,o,t,i,r)=>0===e.length?null!==t?i(t):o:null===t?r:i(t))(m.options,x.emptyOptionsText,S,m.getName,x.placeholder),j=f&&0===m.options.length;/* @__PURE__ */
1
+ import{jsxs as e,jsx as o}from"react/jsx-runtime";import{useTheme as t,Button as i,Typography as r}from"@mui/material";import{useState as n,Fragment as l}from"react";import p from"@mui/icons-material/KeyboardArrowDown";import s from"@mui/icons-material/KeyboardArrowUp";import{SelectOptions as a}from"./Options/SelectOptions.js";import{useFoodsSelectContext as c}from"./Context/useSelect.js";import{AnchoredPopover as d}from"../../Popover/AnchoredPopover.js";const m=m=>{const{textOptions:x,disabled:g,closeOnSelect:h,setSearch:u,disableOnEmpty:f}=c(),w=t(),[b,O]=n(null),y=()=>O(null),v=null!==b,{selectedOption:S,infiniteScroll:I}=m,N=/* @__PURE__ */o(v?s:p,{}),P=v?{border:`2px solid ${w.custom.grey[2800]}`}:{},C=((e,o,t,i,r)=>0===e.length?null!==t?i(t):o:null===t?r:i(t))(m.options,x.emptyOptionsText,S,m.getName,x.placeholder),j=f&&0===m.options.length;/* @__PURE__ */
2
2
  return e(l,{children:[
3
- /* @__PURE__ */e(i,{variant:"select",id:m.id,onClick:e=>y?v():O(e.currentTarget),sx:{...P,width:"100%",height:"40px",display:"flex",alignItems:"center",justifyContent:"space-between",padding:"0px 12px 0px 12px"},disabled:g||j,children:[m.getIcon&&S&&m.getIcon(S),
3
+ /* @__PURE__ */e(i,{variant:"select",id:m.id,onClick:e=>v?y():O(e.currentTarget),sx:{...P,width:"100%",height:"40px",display:"flex",alignItems:"center",justifyContent:"space-between",padding:"0px 12px 0px 12px"},disabled:g||j,children:[m.getIcon&&S&&m.getIcon(S),
4
4
  /* @__PURE__ */o(r,{variant:"body-medium",sx:{width:"100%",textAlign:"left",marginLeft:"8px",overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis"},children:C}),N]}),
5
- /* @__PURE__ */o(d,{sx:{top:"5px"},paperProps:{width:"280px",maxHeight:"300px",...I?{overflow:"hidden"}:{},border:`1px solid ${w.custom.grey[500]}`,borderRadius:"12px",boxShadow:"0px 4px 20px 0px #514E4E1F",...m.BoxOptionsProps},variant:"headless",anchor:b,open:y,onClose:()=>{v(),u("")},anchorPosition:"rightside",children:/* @__PURE__ */o(a,{selectedOption:m.selectedOption,options:m.options,getId:m.getId,getName:m.getName,getIcon:m.getIcon,getGroupName:m.getGroupName,onChange:e=>{m.onChange(e),u(""),!0===h&&v()},infiniteScroll:I,onScroll:I?e=>{if(!0!==I?.hasNextPage||I.isFetchingNextPage)return;const o=e.currentTarget;o.scrollHeight-o.scrollTop-o.clientHeight<=32&&I.onLoadMore()}:void 0})})]})};export{m as Select};
5
+ /* @__PURE__ */o(d,{sx:{top:"5px"},paperProps:{width:"280px",maxHeight:"min(480px, calc(100% - 32px))",...I?{overflow:"hidden",display:"flex",flexDirection:"column"}:{},border:`1px solid ${w.custom.grey[500]}`,borderRadius:"12px",boxShadow:"0px 4px 20px 0px #514E4E1F",...m.BoxOptionsProps},variant:"headless",anchor:b,open:v,onClose:()=>{y(),u("")},anchorPosition:"rightside",children:/* @__PURE__ */o(a,{selectedOption:m.selectedOption,options:m.options,getId:m.getId,getName:m.getName,getIcon:m.getIcon,getGroupName:m.getGroupName,onChange:e=>{m.onChange(e),u(""),!0===h&&y()},infiniteScroll:I,onScroll:I?e=>{if(!0!==I?.hasNextPage||I.isFetchingNextPage)return;const o=e.currentTarget;o.scrollHeight-o.scrollTop-o.clientHeight<=32&&I.onLoadMore()}:void 0})})]})};export{m as Select};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@foodpilot/foods",
3
3
  "private": false,
4
- "version": "2.25.0",
4
+ "version": "2.25.2",
5
5
  "type": "module",
6
6
  "main": "./dist/main.js",
7
7
  "module": "./dist/main.js",