@foodpilot/foods 2.20.1 → 2.20.3

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,6 +1,6 @@
1
- import{jsxs as t,Fragment as e,jsx as o}from"react/jsx-runtime";import{Step as n}from"../../components/Step.js";import{Container as i,LeftColumn as r,StyledStartStep as a,StyledWithoutPlanStep as l,RightColumn as m}from"../../styles/index.js";import{StartCurrentComparison as c,LastTargetComparison as s}from"../../components/Comparisons.js";import{TargetToGoalComparaison as p}from"../../components/TargetToGoalComparison.js";const u=u=>{const{steps:h,textOptions:d,improvement:v,completionPercentage:F,valueFormatterFn:A}=u,W=void 0===h.endWithoutAction;/* @__PURE__ */
1
+ import{jsxs as t,Fragment as e,jsx as o}from"react/jsx-runtime";import{Step as n}from"../../components/Step.js";import{Container as i,LeftColumn as r,StyledStartStep as a,StyledWithoutPlanStep as l,RightColumn as m}from"../../styles/index.js";import{StartCurrentComparison as c,LastTargetComparison as s}from"../../components/Comparisons.js";import{TargetToGoalComparaison as p}from"../../components/TargetToGoalComparison.js";const u=u=>{const{steps:h,textOptions:d,improvement:v,completionPercentage:F,valueFormatterFn:W,hideGoalWhenEmpty:A=!1}=u,b=void 0===h.endWithoutAction;/* @__PURE__ */
2
2
  return t(e,{children:[
3
3
  /* @__PURE__ */t(i,{container:!0,children:[
4
4
  /* @__PURE__ */t(r,{item:!0,xs:6,children:[
5
- /* @__PURE__ */o(a,{step:h.start,isLast:!1,fullHeight:!h.endWithoutAction,valueFormatterFn:A,children:h.endWithAction&&/* @__PURE__ */o(c,{targetValue:h.endWithAction.value,currentValue:h.start.value,orientation:"horizontal",improvement:v})}),h.endWithoutAction&&/* @__PURE__ */o(l,{step:h.endWithoutAction,isLast:!1,valueFormatterFn:A,children:h.endWithAction&&/* @__PURE__ */o(s,{targetValue:h.endWithAction.value,currentValue:h.endWithoutAction?.value,orientation:"horizontal",improvement:v,completionPercent:F})})]}),
6
- /* @__PURE__ */t(m,{item:!0,xs:6,children:[h.endWithAction&&/* @__PURE__ */o(n,{step:h.endWithAction,isLast:!0,valueFormatterFn:A}),!1===W&&/* @__PURE__ */o(p,{label:d.goalStep,noObjectiveLabel:d.noGoalLabel,orientation:"horizontal",improvement:v,completionPercent:F,valueFormatterFn:A})]})]}),!0===W&&/* @__PURE__ */o(p,{label:d.goalStep,noObjectiveLabel:d.noGoalLabel,orientation:"horizontal",improvement:v,outsideContainer:!0,completionPercent:F,valueFormatterFn:A})]})};export{u as Horizontal};
5
+ /* @__PURE__ */o(a,{step:h.start,isLast:!1,fullHeight:!h.endWithoutAction,valueFormatterFn:W,children:h.endWithAction&&/* @__PURE__ */o(c,{targetValue:h.endWithAction.value,currentValue:h.start.value,orientation:"horizontal",improvement:v})}),h.endWithoutAction&&/* @__PURE__ */o(l,{step:h.endWithoutAction,isLast:!1,valueFormatterFn:W,children:h.endWithAction&&/* @__PURE__ */o(s,{targetValue:h.endWithAction.value,currentValue:h.endWithoutAction?.value,orientation:"horizontal",improvement:v,completionPercent:F})})]}),
6
+ /* @__PURE__ */t(m,{item:!0,xs:6,children:[h.endWithAction&&/* @__PURE__ */o(n,{step:h.endWithAction,isLast:!0,valueFormatterFn:W}),(null!==F||!A)&&!1===b&&/* @__PURE__ */o(p,{label:d.goalStep,noObjectiveLabel:d.noGoalLabel,orientation:"horizontal",improvement:v,completionPercent:F,valueFormatterFn:W})]})]}),(null!==F||!A)&&!0===b&&/* @__PURE__ */o(p,{label:d.goalStep,noObjectiveLabel:d.noGoalLabel,orientation:"horizontal",improvement:v,outsideContainer:!0,completionPercent:F,valueFormatterFn:W})]})};export{u as Horizontal};
@@ -10,6 +10,7 @@ export type TrajectorySteps = {
10
10
  export type OrientedTrajectoryCardsProps = {
11
11
  completionPercentage: number | null;
12
12
  steps: TrajectorySteps;
13
+ hideGoalWhenEmpty?: boolean;
13
14
  unit?: string;
14
15
  textOptions: TrajectoryStepsText;
15
16
  improvement: Improvement;
@@ -1,5 +1,5 @@
1
- import{jsxs as t,Fragment as e,jsx as o}from"react/jsx-runtime";import{StartCurrentComparison as n}from"../../components/Comparisons.js";import{Container as r,StyledStartStep as i,StyledWithoutPlanStep as a}from"../../styles/index.js";import{useTheme as m}from"@mui/material";import{TargetToGoalComparaison as l}from"../../components/TargetToGoalComparison.js";const c=c=>{const{steps:s,textOptions:p,improvement:u,completionPercentage:v,valueFormatterFn:d}=c,h=m(),F=void 0===s.endWithoutAction,b=void 0===s.endWithoutAction?s.start:s.endWithoutAction;/* @__PURE__ */
1
+ import{jsxs as t,Fragment as e,jsx as o}from"react/jsx-runtime";import{StartCurrentComparison as n}from"../../components/Comparisons.js";import{Container as i,StyledStartStep as r,StyledWithoutPlanStep as a}from"../../styles/index.js";import{useTheme as m}from"@mui/material";import{TargetToGoalComparaison as l}from"../../components/TargetToGoalComparison.js";const c=c=>{const{steps:s,textOptions:p,improvement:u,completionPercentage:v,valueFormatterFn:d,hideGoalWhenEmpty:h=!1}=c,F=m(),W=void 0===s.endWithoutAction,b=void 0===s.endWithoutAction?s.start:s.endWithoutAction;/* @__PURE__ */
2
2
  return t(e,{children:[
3
- /* @__PURE__ */t(r,{container:!0,sx:{background:F?h.palette.primary[50]:void 0},children:[
4
- /* @__PURE__ */o(i,{step:b,isLast:!1,orientation:"vertical",valueFormatterFn:d,children:/* @__PURE__ */o(n,{targetValue:s.endWithAction.value,currentValue:b.value,orientation:"vertical",improvement:u})}),
5
- /* @__PURE__ */o(a,{step:s.endWithAction,isLast:!0,orientation:"vertical",valueFormatterFn:d})]}),null!==v&&/* @__PURE__ */o(l,{label:p.goalStep,noObjectiveLabel:p.noGoalLabel,orientation:"vertical",improvement:u,completionPercent:v,valueFormatterFn:d})]})};export{c as Vertical};
3
+ /* @__PURE__ */t(i,{container:!0,sx:{background:W?F.palette.primary[50]:void 0},children:[
4
+ /* @__PURE__ */o(r,{step:b,isLast:!1,orientation:"vertical",valueFormatterFn:d,children:/* @__PURE__ */o(n,{targetValue:s.endWithAction.value,currentValue:b.value,orientation:"vertical",improvement:u})}),
5
+ /* @__PURE__ */o(a,{step:s.endWithAction,isLast:!0,orientation:"vertical",valueFormatterFn:d})]}),(null!==v||!h)&&/* @__PURE__ */o(l,{label:p.goalStep,noObjectiveLabel:p.noGoalLabel,orientation:"vertical",improvement:u,completionPercent:v,valueFormatterFn:d})]})};export{c as Vertical};
@@ -1 +1 @@
1
- import{jsx as t}from"react/jsx-runtime";import{Box as n}from"@mui/material";import{Horizontal as e}from"./Blocks/horizontal/index.js";import{Vertical as i}from"./Blocks/vertical/index.js";const o=o=>{const{position:r,goal:a=null,unit:u="",textOptions:s={startingStep:"",targetWithoutPlanStep:"",targetWithPlanStep:"",goalStep:""},steps:p,improvement:c,valueFormatterFn:m}=o,d=l(a,p),h={start:{value:p.start,label:s.startingStep,unit:u},endWithAction:{label:s.targetWithPlanStep,value:p.endWithAction,unit:u},endWithoutAction:void 0===p.endWithoutAction?void 0:{value:p.endWithoutAction,unit:u,label:s.targetWithoutPlanStep}};return"vertical"===r?/* @__PURE__ */t(n,{children:/* @__PURE__ */t(i,{improvement:c,steps:h,completionPercentage:d,textOptions:s,valueFormatterFn:m})}):"horizontal"===r?/* @__PURE__ */t(n,{sx:{width:"100%"},children:/* @__PURE__ */t(e,{improvement:c,steps:h,completionPercentage:d,textOptions:s,valueFormatterFn:m})}):void 0},l=(t,n)=>{if(null===t)return null;const{start:e,endWithAction:i,endWithoutAction:o}=n,l=void 0===o?a(t,e):a(o,t);if(null===l)return null;const u=a(o??e,i);if(null===u)return null;const s=r({partial:u,total:l});return Math.round(s)},r=t=>{const{partial:n,total:e}=t;return 0===e?0:n/e*100},a=(t,n)=>null===t||null===n?null:t-n;export{o as TrajectoryCards};
1
+ import{jsx as t}from"react/jsx-runtime";import{Box as e}from"@mui/material";import{Horizontal as n}from"./Blocks/horizontal/index.js";import{Vertical as i}from"./Blocks/vertical/index.js";const o=o=>{const{position:r,goal:a=null,hideGoalWhenEmpty:u=!1,unit:p="",textOptions:s={startingStep:"",targetWithoutPlanStep:"",targetWithPlanStep:"",goalStep:""},steps:m,improvement:c,valueFormatterFn:h}=o,d=l(a,m),v={start:{value:m.start,label:s.startingStep,unit:p},endWithAction:{label:s.targetWithPlanStep,value:m.endWithAction,unit:p},endWithoutAction:void 0===m.endWithoutAction?void 0:{value:m.endWithoutAction,unit:p,label:s.targetWithoutPlanStep}};return"vertical"===r?/* @__PURE__ */t(e,{children:/* @__PURE__ */t(i,{hideGoalWhenEmpty:u,improvement:c,steps:v,completionPercentage:d,textOptions:s,valueFormatterFn:h})}):"horizontal"===r?/* @__PURE__ */t(e,{sx:{width:"100%"},children:/* @__PURE__ */t(n,{hideGoalWhenEmpty:u,improvement:c,steps:v,completionPercentage:d,textOptions:s,valueFormatterFn:h})}):void 0},l=(t,e)=>{if(null===t)return null;const{start:n,endWithAction:i,endWithoutAction:o}=e,l=void 0===o?a(t,n):a(o,t);if(null===l)return null;const u=a(o??n,i);if(null===u)return null;const p=r({partial:u,total:l});return Math.round(p)},r=t=>{const{partial:e,total:n}=t;return 0===n?0:e/n*100},a=(t,e)=>null===t||null===e?null:t-e;export{o as TrajectoryCards};
@@ -1,2 +1 @@
1
- import{jsx as e}from"react/jsx-runtime";import{useTheme as o,alpha as r}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=o(),{type:c}=m,{sx:u,...d}=m,g={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:r(a.custom.grey[2800],.36)},borderRadius:"25px",borderColor:a.custom.grey[600],...u};/* @__PURE__ */
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 n,Typography as s}from"@mui/material";import{FoodsTooltip as d}from"../../Tooltip/FoodsTooltip.js";import{FoodsTags as c}from"../../Tags/FoodsTags.js";const a=a=>{const l=r(),{selected:m,currentPage:u}=a,{isComplete:g=!1}=u||{},p=!1===g?{}:{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]}},b=u?.label,h=u?.isComplete,v=u?.isCompleteLabel;/* @__PURE__ */
2
- return e(d,{width:"auto",title:void 0!==b&&/* @__PURE__ */o(n,{width:"100%",justifyContent:"center",alignItems:"center",gap:l.spacing(1),children:[
3
- /* @__PURE__ */e(s,{variant:"body-medium",children:b}),!0===h&&void 0!==v&&/* @__PURE__ */e(c,{variant:"tags-green",startIcon:"check",label:v,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,{...a,sx:{...a.sx,...p}})})})};export{a as PageItem};
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};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@foodpilot/foods",
3
3
  "private": false,
4
- "version": "2.20.1",
4
+ "version": "2.20.3",
5
5
  "type": "module",
6
6
  "main": "./dist/main.js",
7
7
  "module": "./dist/main.js",