@foodpilot/foods 2.20.2 → 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.
- package/dist/components/Cards/TrajectoryCards/Blocks/horizontal/index.js +3 -3
- package/dist/components/Cards/TrajectoryCards/Blocks/types.d.ts +1 -0
- package/dist/components/Cards/TrajectoryCards/Blocks/vertical/index.js +4 -4
- package/dist/components/Cards/TrajectoryCards/TrajectoryCards.js +1 -1
- package/package.json +1 -1
|
@@ -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,
|
|
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:
|
|
6
|
-
/* @__PURE__ */t(m,{item:!0,xs:6,children:[h.endWithAction&&/* @__PURE__ */o(n,{step:h.endWithAction,isLast:!0,valueFormatterFn:
|
|
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
|
|
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(
|
|
4
|
-
/* @__PURE__ */o(
|
|
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
|
|
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};
|