@foodpilot/foods 2.11.3 → 2.11.4
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.
|
@@ -4,7 +4,7 @@ import { ComparisonBlock } from "../ComparisonBlock/ComparisonBlock.js";
|
|
|
4
4
|
import { NumberWithUnit } from "../Number/NumberWithUnit.js";
|
|
5
5
|
const FormUnit = (props) => {
|
|
6
6
|
const theme = useTheme();
|
|
7
|
-
const { value, unit, color, comparison, ...boxProps } = props;
|
|
7
|
+
const { withPlus, value, unit, color, comparison, ...boxProps } = props;
|
|
8
8
|
return /* @__PURE__ */ jsxs(
|
|
9
9
|
Box,
|
|
10
10
|
{
|
|
@@ -17,7 +17,7 @@ const FormUnit = (props) => {
|
|
|
17
17
|
gap: theme.spacing(1),
|
|
18
18
|
...boxProps,
|
|
19
19
|
children: [
|
|
20
|
-
/* @__PURE__ */ jsx(NumberWithUnit, { value, unit, colorOverride: color }),
|
|
20
|
+
/* @__PURE__ */ jsx(NumberWithUnit, { value, unit, colorOverride: color, withPlus }),
|
|
21
21
|
comparison !== void 0 && comparison.toCompareTo !== null && comparison.value !== null && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
22
22
|
/* @__PURE__ */ jsx(Box, { borderLeft: `1px solid ${theme.custom.grey[500]}` }),
|
|
23
23
|
/* @__PURE__ */ jsx(
|
|
@@ -6,5 +6,6 @@ export type NumberWithUnitProps = {
|
|
|
6
6
|
position?: "default-side" | "below-left-aligned" | "below-center-aligned";
|
|
7
7
|
colorOverride?: string;
|
|
8
8
|
hideUnitOnNull?: boolean;
|
|
9
|
+
withPlus?: boolean;
|
|
9
10
|
};
|
|
10
11
|
export declare const NumberWithUnit: (props: NumberWithUnitProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -3,7 +3,15 @@ import { useTheme, Stack, Typography } from "@mui/material";
|
|
|
3
3
|
import { FoodsBadge } from "../Badge/FoodsBadge.js";
|
|
4
4
|
const NumberWithUnit = (props) => {
|
|
5
5
|
const theme = useTheme();
|
|
6
|
-
const {
|
|
6
|
+
const {
|
|
7
|
+
withPlus = false,
|
|
8
|
+
value,
|
|
9
|
+
unit,
|
|
10
|
+
size = "small",
|
|
11
|
+
position = "default-side",
|
|
12
|
+
colorOverride,
|
|
13
|
+
hideUnitOnNull = false
|
|
14
|
+
} = props;
|
|
7
15
|
const fontVariant = `number-${size}`;
|
|
8
16
|
const isSmallVariant = () => {
|
|
9
17
|
return size === "micro" || size === "small";
|
|
@@ -44,7 +52,10 @@ const NumberWithUnit = (props) => {
|
|
|
44
52
|
}
|
|
45
53
|
}
|
|
46
54
|
}
|
|
47
|
-
) : /* @__PURE__ */
|
|
55
|
+
) : /* @__PURE__ */ jsxs(Typography, { variant: fontVariant, color: colorOverride, children: [
|
|
56
|
+
withPlus && Number(value) > 0 ? "+" : "",
|
|
57
|
+
score
|
|
58
|
+
] }),
|
|
48
59
|
shouldHideUnit === false && /* @__PURE__ */ jsx(
|
|
49
60
|
Typography,
|
|
50
61
|
{
|