@foodpilot/foods 2.7.17 → 2.8.0

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.
Files changed (24) hide show
  1. package/dist/components/Button/TertiaryToggleButton.d.ts +1 -1
  2. package/dist/components/Button/TertiaryToggleButtonNodeTitle.d.ts +1 -1
  3. package/dist/components/Chart/PolymorphicChart/PolymorphicChart.d.ts +2 -1
  4. package/dist/components/Chart/PolymorphicChart/PolymorphicChart.js +5 -3
  5. package/dist/components/Chart/PolymorphicChart/PolymorphicChartRenderer.d.ts +1 -0
  6. package/dist/components/Chart/PolymorphicChart/PolymorphicChartRenderer.js +9 -8
  7. package/dist/components/Chart/PolymorphicChart/charts/PolymorphicCumulativeChart.d.ts +10 -0
  8. package/dist/components/Chart/PolymorphicChart/charts/PolymorphicCumulativeChart.js +267 -0
  9. package/dist/components/Chart/PolymorphicChart/charts/PolymorphicTable.d.ts +0 -16
  10. package/dist/components/Form/FoodsFormFields/FoodsTextInput.d.ts +2 -1
  11. package/dist/components/Form/FoodsFormFields/FoodsTextInput.js +8 -3
  12. package/dist/components/Input/SearchBox.d.ts +1 -1
  13. package/dist/components/Input/SearchBox.js +14 -63
  14. package/dist/components/Layout/BlockList/Blocks/InnerInputBlocks/index.d.ts +0 -2
  15. package/dist/components/RichTextEditor/components/ColorInput/style/index.d.ts +2 -2
  16. package/dist/components/RichTextEditor/components/Toolbar/style/index.d.ts +1 -1
  17. package/dist/components/Search/FoodsSearch.js +11 -55
  18. package/dist/main.js +0 -4
  19. package/dist/themes/common/components.js +50 -4
  20. package/package.json +1 -1
  21. package/dist/components/Layout/BlockList/Blocks/InnerInputBlocks/NumericalBlock.d.ts +0 -7
  22. package/dist/components/Layout/BlockList/Blocks/InnerInputBlocks/NumericalBlock.js +0 -10
  23. package/dist/components/Layout/BlockList/Blocks/InnerInputBlocks/TextBlock.d.ts +0 -7
  24. package/dist/components/Layout/BlockList/Blocks/InnerInputBlocks/TextBlock.js +0 -10
@@ -5,7 +5,7 @@ import { DetailedHTMLProps, ButtonHTMLAttributes, DO_NOT_USE_OR_YOU_WILL_BE_FIRE
5
5
  import { MUIStyledCommonProps } from '@mui/system';
6
6
  export declare const CustomToggleButton: StyledComponent< ToggleButtonOwnProps & Omit< ButtonBaseOwnProps, "classes"> & CommonProps & Omit<Omit< DetailedHTMLProps<ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & {
7
7
  ref?: ((instance: HTMLButtonElement | null) => void | DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | RefObject<HTMLButtonElement> | null | undefined;
8
- }, "className" | "classes" | "style" | "tabIndex" | "color" | "children" | "onChange" | "onClick" | "sx" | "size" | "disabled" | "value" | "action" | "selected" | "disableFocusRipple" | "disableRipple" | "fullWidth" | "centerRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "onFocusVisible" | "TouchRippleProps" | "touchRippleRef"> & MUIStyledCommonProps<Theme>, {}, {}>;
8
+ }, "className" | "classes" | "style" | "tabIndex" | "color" | "children" | "onChange" | "onClick" | "sx" | "size" | "disabled" | "value" | "action" | "selected" | "fullWidth" | "disableFocusRipple" | "disableRipple" | "centerRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "onFocusVisible" | "TouchRippleProps" | "touchRippleRef"> & MUIStyledCommonProps<Theme>, {}, {}>;
9
9
  type ToggleButtonsPropsWithoutEnforcedKeys = Omit<ToggleButtonProps, "value" | "onClick" | "selected">;
10
10
  export type TertiaryToggleButtonProps = ToggleButtonsPropsWithoutEnforcedKeys & {
11
11
  choices: string[];
@@ -5,7 +5,7 @@ import { CommonProps } from '@mui/material/OverridableComponent';
5
5
  import { MUIStyledCommonProps } from '@mui/system';
6
6
  export declare const CustomToggleButtonNodeTitle: StyledComponent< ToggleButtonOwnProps & Omit< ButtonBaseOwnProps, "classes"> & CommonProps & Omit<Omit< DetailedHTMLProps<ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & {
7
7
  ref?: ((instance: HTMLButtonElement | null) => void | DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | RefObject<HTMLButtonElement> | null | undefined;
8
- }, "className" | "classes" | "style" | "tabIndex" | "color" | "children" | "onChange" | "onClick" | "sx" | "size" | "disabled" | "value" | "action" | "selected" | "disableFocusRipple" | "disableRipple" | "fullWidth" | "centerRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "onFocusVisible" | "TouchRippleProps" | "touchRippleRef"> & MUIStyledCommonProps<Theme>, {}, {}>;
8
+ }, "className" | "classes" | "style" | "tabIndex" | "color" | "children" | "onChange" | "onClick" | "sx" | "size" | "disabled" | "value" | "action" | "selected" | "fullWidth" | "disableFocusRipple" | "disableRipple" | "centerRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "onFocusVisible" | "TouchRippleProps" | "touchRippleRef"> & MUIStyledCommonProps<Theme>, {}, {}>;
9
9
  type ToggleButtonsPropsWithoutEnforcedKeys = Omit<ToggleButtonProps, "value" | "onClick" | "selected">;
10
10
  export type TertiaryToggleButtonPropsNodeTitle = ToggleButtonsPropsWithoutEnforcedKeys & {
11
11
  choices: ReactNode[];
@@ -2,7 +2,7 @@ import { ReactNode } from 'react';
2
2
  import { TypographyProps } from '@mui/material';
3
3
  import { Property } from 'csstype';
4
4
  import { ChartLegend } from '../Legend';
5
- export type ChartType = "donut" | "bar" | "line" | "pie" | "radar" | "table" | "raw";
5
+ export type ChartType = "donut" | "bar" | "line" | "cumulative" | "pie" | "radar" | "table" | "raw";
6
6
  export type AggregationOptions = {
7
7
  showAggregateToggle?: boolean;
8
8
  aggregateToggleLabel?: string;
@@ -35,5 +35,6 @@ export type PolymorphicChartProps = {
35
35
  maxScore?: number | number[];
36
36
  separator?: string;
37
37
  aggregation?: AggregationOptions;
38
+ cumulativeDescriptions?: string[];
38
39
  };
39
40
  export declare const PolymorphicChart: (props: PolymorphicChartProps) => import("react/jsx-runtime").JSX.Element;
@@ -22,7 +22,7 @@ const LEGEND_GAP_SPACING_BOTTOM = 2;
22
22
  const HOVER_ANIMATION_DURATION = "0.2s";
23
23
  const SCALE_NORMAL = 1;
24
24
  const HOVER_OFFSET_DIVISOR = 100;
25
- const CHART_TYPES_WITHOUT_LEGEND = ["table"];
25
+ const CHART_TYPES_WITHOUT_LEGEND = ["table", "cumulative"];
26
26
  const PolymorphicChart = (props) => {
27
27
  const theme = useTheme();
28
28
  const {
@@ -50,7 +50,8 @@ const PolymorphicChart = (props) => {
50
50
  height = DEFAULT_HEIGHT,
51
51
  maxScore,
52
52
  separator,
53
- aggregation
53
+ aggregation,
54
+ cumulativeDescriptions
54
55
  } = props;
55
56
  const {
56
57
  showAggregateToggle = false,
@@ -225,7 +226,8 @@ const PolymorphicChart = (props) => {
225
226
  }
226
227
  },
227
228
  maxScore,
228
- separator
229
+ separator,
230
+ cumulativeDescriptions
229
231
  }
230
232
  ),
231
233
  showCenterContent && !isLoading && /* @__PURE__ */ jsx(
@@ -27,6 +27,7 @@ type PolymorphicChartRendererProps = {
27
27
  onLegendAction?: (index: number) => void;
28
28
  maxScore?: number | number[];
29
29
  separator?: string;
30
+ cumulativeDescriptions?: string[];
30
31
  };
31
32
  export declare const PolymorphicChartRenderer: (props: PolymorphicChartRendererProps) => import("react/jsx-runtime").JSX.Element;
32
33
  export {};
@@ -1,6 +1,7 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { PolymorphicBarChart } from "./charts/PolymorphicBarChart.js";
3
3
  import { PolymorphicLineChart } from "./charts/PolymorphicLineChart.js";
4
+ import { PolymorphicCumulativeChart } from "./charts/PolymorphicCumulativeChart.js";
4
5
  import { PolymorphicPieChart } from "./charts/PolymorphicPieChart.js";
5
6
  import { PolymorphicRadarChart } from "./charts/PolymorphicRadarChart.js";
6
7
  import { PolymorphicTable } from "./charts/PolymorphicTable.js";
@@ -59,27 +60,27 @@ const PolymorphicChartRenderer = (props) => {
59
60
  onMouseEnter: indexOnlyMouseEnter
60
61
  }
61
62
  );
62
- case "radar":
63
+ case "cumulative":
63
64
  return /* @__PURE__ */ jsx(
64
- PolymorphicRadarChart,
65
+ PolymorphicCumulativeChart,
65
66
  {
66
67
  ...restProps,
67
68
  isLoading,
68
- height,
69
- onMouseEnter: indexOnlyMouseEnter
69
+ descriptions: props.cumulativeDescriptions
70
70
  }
71
71
  );
72
- case "table":
72
+ case "radar":
73
73
  return /* @__PURE__ */ jsx(
74
- PolymorphicTable,
74
+ PolymorphicRadarChart,
75
75
  {
76
76
  ...restProps,
77
77
  isLoading,
78
78
  height,
79
- tooltipPos,
80
- onMouseEnter: simpleMouseEnter
79
+ onMouseEnter: indexOnlyMouseEnter
81
80
  }
82
81
  );
82
+ case "table":
83
+ return /* @__PURE__ */ jsx(PolymorphicTable, { ...restProps, isLoading });
83
84
  case "raw":
84
85
  return /* @__PURE__ */ jsx(
85
86
  PolymorphicRawChart,
@@ -0,0 +1,10 @@
1
+ import { DoughnutChartData } from '../../DoughnutChart/utils';
2
+ export type PolymorphicCumulativeChartProps = {
3
+ data: DoughnutChartData[];
4
+ valuesFormatterFn?: (value: number, precision?: number) => string;
5
+ isLoading?: boolean;
6
+ showTooltip?: boolean;
7
+ onLegendAction?: (index: number) => void;
8
+ descriptions?: string[];
9
+ };
10
+ export declare const PolymorphicCumulativeChart: (props: PolymorphicCumulativeChartProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,267 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { useTheme, Box, TableContainer, Table, TableBody, TableRow, TableCell, Skeleton, Stack, Typography } from "@mui/material";
3
+ import { LegendValueBadge } from "../../Legend/LegendValueBadge.js";
4
+ import { FoodsIcon } from "../../../Icons/FoodsIcon.js";
5
+ import { FoodsBadge } from "../../../Badge/FoodsBadge.js";
6
+ import { FoodsTooltip } from "../../../Tooltip/FoodsTooltip.js";
7
+ const CHIP_MIN_WIDTH = 56;
8
+ const PolymorphicCumulativeChart = (props) => {
9
+ const theme = useTheme();
10
+ const {
11
+ data,
12
+ valuesFormatterFn = (value, precision) => theme.numbers.valueFormatterFn(value, precision),
13
+ showTooltip,
14
+ isLoading,
15
+ onLegendAction
16
+ } = props;
17
+ if (isLoading) {
18
+ const rows = Math.max(8, (data == null ? void 0 : data.length) || 12);
19
+ return /* @__PURE__ */ jsx(
20
+ Box,
21
+ {
22
+ position: "relative",
23
+ width: "100%",
24
+ sx: { border: `1px solid ${theme.palette.divider}`, borderRadius: theme.shape.borderRadius },
25
+ children: /* @__PURE__ */ jsx(
26
+ TableContainer,
27
+ {
28
+ sx: { borderRadius: theme.shape.borderRadius, backgroundColor: theme.palette.background.paper },
29
+ children: /* @__PURE__ */ jsx(Table, { children: /* @__PURE__ */ jsx(TableBody, { children: Array.from({ length: rows }).map((_, i) => /* @__PURE__ */ jsxs(
30
+ TableRow,
31
+ {
32
+ sx: { "&:last-child td, &:last-child th": { borderBottom: 0 } },
33
+ children: [
34
+ /* @__PURE__ */ jsx(
35
+ TableCell,
36
+ {
37
+ width: "50%",
38
+ sx: {
39
+ padding: theme.spacing(2),
40
+ borderBottom: `1px solid ${theme.palette.divider}`
41
+ },
42
+ children: /* @__PURE__ */ jsx(
43
+ Skeleton,
44
+ {
45
+ variant: "rounded",
46
+ sx: { maxWidth: "300px" },
47
+ width: "100%",
48
+ height: 18
49
+ }
50
+ )
51
+ }
52
+ ),
53
+ /* @__PURE__ */ jsx(
54
+ TableCell,
55
+ {
56
+ align: "right",
57
+ sx: {
58
+ padding: theme.spacing(2),
59
+ borderBottom: `1px solid ${theme.palette.divider}`
60
+ },
61
+ children: /* @__PURE__ */ jsxs(
62
+ Stack,
63
+ {
64
+ width: "50%",
65
+ direction: "row",
66
+ alignItems: "center",
67
+ spacing: 3,
68
+ justifyContent: "flex-end",
69
+ sx: { width: "100%" },
70
+ children: [
71
+ /* @__PURE__ */ jsx(Skeleton, { variant: "rounded", width: CHIP_MIN_WIDTH, height: 27 }),
72
+ /* @__PURE__ */ jsx(
73
+ Skeleton,
74
+ {
75
+ variant: "rounded",
76
+ width: "100%",
77
+ sx: { maxWidth: "215px" },
78
+ height: 12
79
+ }
80
+ ),
81
+ /* @__PURE__ */ jsx(Skeleton, { variant: "rounded", width: 16, height: 16 })
82
+ ]
83
+ }
84
+ )
85
+ }
86
+ )
87
+ ]
88
+ },
89
+ `sk-row-${i}`
90
+ )) }) })
91
+ }
92
+ )
93
+ }
94
+ );
95
+ }
96
+ const isEmpty = ((data == null ? void 0 : data.length) ?? 0) === 0 || data.every((d) => Number(d.value) === 0);
97
+ if (isEmpty) {
98
+ return /* @__PURE__ */ jsx(
99
+ Box,
100
+ {
101
+ position: "relative",
102
+ width: "100%",
103
+ sx: {
104
+ border: `1px solid ${theme.palette.divider}`,
105
+ borderRadius: theme.shape.borderRadius,
106
+ backgroundColor: theme.palette.background.paper
107
+ },
108
+ children: /* @__PURE__ */ jsx(TableContainer, { sx: { borderRadius: theme.shape.borderRadius }, children: /* @__PURE__ */ jsx(Table, { children: /* @__PURE__ */ jsx(TableBody, { children: /* @__PURE__ */ jsxs(
109
+ TableRow,
110
+ {
111
+ sx: {
112
+ backgroundColor: theme.palette.background.paper,
113
+ "&:last-child td, &:last-child th": { borderBottom: 0 }
114
+ },
115
+ children: [
116
+ /* @__PURE__ */ jsx(TableCell, { sx: { padding: theme.spacing(2), borderBottom: 0 }, children: /* @__PURE__ */ jsx(Stack, { direction: "row", alignItems: "center", spacing: 2, children: /* @__PURE__ */ jsx(
117
+ FoodsBadge,
118
+ {
119
+ size: 4,
120
+ icon: "empty",
121
+ boxProps: {
122
+ sx: {
123
+ borderRadius: "3px",
124
+ backgroundColor: theme.custom.grey[400],
125
+ color: theme.custom.grey[1400]
126
+ }
127
+ }
128
+ }
129
+ ) }) }),
130
+ /* @__PURE__ */ jsx(
131
+ TableCell,
132
+ {
133
+ align: "right",
134
+ sx: {
135
+ padding: theme.spacing(2),
136
+ color: theme.palette.text.secondary,
137
+ borderBottom: 0
138
+ },
139
+ children: "—"
140
+ }
141
+ )
142
+ ]
143
+ }
144
+ ) }) }) })
145
+ }
146
+ );
147
+ }
148
+ const maxVal = data.reduce((acc, d) => Math.max(acc, Number(d.value) || 0), 0);
149
+ return /* @__PURE__ */ jsx(
150
+ Box,
151
+ {
152
+ position: "relative",
153
+ width: "100%",
154
+ sx: {
155
+ border: `1px solid ${theme.palette.divider}`,
156
+ borderRadius: theme.shape.borderRadius,
157
+ backgroundColor: theme.palette.background.paper
158
+ },
159
+ children: /* @__PURE__ */ jsx(TableContainer, { sx: { borderRadius: theme.shape.borderRadius }, children: /* @__PURE__ */ jsx(Table, { children: /* @__PURE__ */ jsx(TableBody, { children: data.map((entry, index) => {
160
+ var _a;
161
+ const rawVal = Number(entry.value) || 0;
162
+ const scale = maxVal > 0 ? rawVal / maxVal * 100 : 0;
163
+ const percentText = `${valuesFormatterFn(rawVal, 1)} %`;
164
+ const description = (_a = props.descriptions) == null ? void 0 : _a[index];
165
+ return /* @__PURE__ */ jsxs(
166
+ TableRow,
167
+ {
168
+ sx: {
169
+ backgroundColor: "transparent",
170
+ "&:last-child td, &:last-child th": { borderBottom: 0 }
171
+ },
172
+ children: [
173
+ /* @__PURE__ */ jsx(
174
+ TableCell,
175
+ {
176
+ sx: {
177
+ padding: theme.spacing(2),
178
+ borderBottom: `1px solid ${theme.palette.divider}`
179
+ },
180
+ children: /* @__PURE__ */ jsx(Typography, { variant: "body2", sx: { fontWeight: 600 }, children: entry.name || `Item ${index + 1}` })
181
+ }
182
+ ),
183
+ /* @__PURE__ */ jsx(
184
+ TableCell,
185
+ {
186
+ align: "right",
187
+ sx: {
188
+ padding: theme.spacing(2),
189
+ borderBottom: `1px solid ${theme.palette.divider}`
190
+ },
191
+ children: /* @__PURE__ */ jsxs(
192
+ Stack,
193
+ {
194
+ direction: "row",
195
+ alignItems: "center",
196
+ spacing: 3,
197
+ justifyContent: "flex-end",
198
+ sx: { width: "100%" },
199
+ children: [
200
+ /* @__PURE__ */ jsx(LegendValueBadge, { children: percentText }),
201
+ /* @__PURE__ */ jsx(
202
+ Box,
203
+ {
204
+ onClick: () => onLegendAction == null ? void 0 : onLegendAction(index),
205
+ sx: {
206
+ position: "relative",
207
+ flex: 1,
208
+ minWidth: 120,
209
+ height: 12,
210
+ borderRadius: 1.5,
211
+ cursor: onLegendAction ? "pointer" : "default"
212
+ },
213
+ children: /* @__PURE__ */ jsx(
214
+ Box,
215
+ {
216
+ sx: {
217
+ position: "absolute",
218
+ top: 0,
219
+ left: 0,
220
+ height: "100%",
221
+ width: `${Math.max(0, Math.min(scale, 100))}%`,
222
+ borderRadius: 1.5,
223
+ backgroundColor: theme.palette.primary.main
224
+ }
225
+ }
226
+ )
227
+ }
228
+ ),
229
+ description && showTooltip && /* @__PURE__ */ jsx(
230
+ FoodsTooltip,
231
+ {
232
+ title: description,
233
+ placement: "top",
234
+ popperZIndex: 2e3,
235
+ width: "unset",
236
+ children: /* @__PURE__ */ jsx(
237
+ Box,
238
+ {
239
+ sx: {
240
+ width: 16,
241
+ height: 16,
242
+ color: theme.palette.text.secondary,
243
+ display: "flex",
244
+ alignItems: "center",
245
+ justifyContent: "center"
246
+ },
247
+ children: /* @__PURE__ */ jsx(FoodsIcon, { size: 2, icon: "information" })
248
+ }
249
+ )
250
+ }
251
+ )
252
+ ]
253
+ }
254
+ )
255
+ }
256
+ )
257
+ ]
258
+ },
259
+ `row-${entry.index ?? index}`
260
+ );
261
+ }) }) }) })
262
+ }
263
+ );
264
+ };
265
+ export {
266
+ PolymorphicCumulativeChart
267
+ };
@@ -1,27 +1,11 @@
1
1
  import { ReactNode } from 'react';
2
- import { Property } from 'csstype';
3
2
  import { DoughnutChartData } from '../../DoughnutChart/utils';
4
- import { RechartsMouseEventHandler } from '../../DoughnutChart/useDoughnutChartInteractions';
5
3
  type PolymorphicTableProps = {
6
4
  data: DoughnutChartData[];
7
- HoveredChartElementIndex: number | null;
8
- spacing?: number;
9
- borderWidth?: number;
10
- borderColor?: Property.Color;
11
- showTooltip?: boolean;
12
- tooltipPos?: {
13
- x: number;
14
- y: number;
15
- angle?: number;
16
- } | undefined;
17
5
  valuesFormatterFn?: (value: number, precision?: number) => string;
18
- language?: string;
19
6
  valuesUnit?: string;
20
7
  icons?: ReactNode[];
21
8
  isLoading?: boolean;
22
- height?: number;
23
- onMouseEnter?: (event: RechartsMouseEventHandler, index: number) => void;
24
- onMouseLeave?: () => void;
25
9
  onLegendAction?: (index: number) => void;
26
10
  };
27
11
  export declare const PolymorphicTable: (props: PolymorphicTableProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,4 +1,4 @@
1
- import { InputBaseProps } from '@mui/material';
1
+ import { InputBaseProps, StackProps } from '@mui/material';
2
2
  import { FoodsIconButtonProps } from '../../Button/FoodsIconButton';
3
3
  type DefaultOption = {
4
4
  label: string;
@@ -17,6 +17,7 @@ type FoodsInputBase = Omit<InputBaseProps, keyof OverridenProps>;
17
17
  export type FoodsTextInputProps = OverridenProps & {
18
18
  ExtraInputProps?: FoodsInputBase;
19
19
  Tooltip?: FoodsIconButtonProps["tooltip"];
20
+ StackProps?: StackProps;
20
21
  };
21
22
  export declare const FoodsTextInput: (props: FoodsTextInputProps) => import("react/jsx-runtime").JSX.Element;
22
23
  export {};
@@ -10,11 +10,12 @@ const FoodsTextInput = (props) => {
10
10
  error = false,
11
11
  disabled = false,
12
12
  ExtraInputProps = {},
13
- Tooltip = {}
13
+ Tooltip = {},
14
+ StackProps: StackProps2 = {}
14
15
  } = props;
15
16
  const theme = useTheme();
16
17
  const { text, props: propsTooltip } = Tooltip;
17
- return /* @__PURE__ */ jsxs(Stack, { gap: theme.spacing(1), children: [
18
+ return /* @__PURE__ */ jsxs(Stack, { gap: theme.spacing(1), ...StackProps2, children: [
18
19
  /* @__PURE__ */ jsxs(Stack, { flexDirection: "row", gap: theme.spacing(1.5), alignItems: "center", children: [
19
20
  /* @__PURE__ */ jsx(
20
21
  TextInput,
@@ -70,7 +71,8 @@ const TextInput = styled(InputBase)(({ theme }) => ({
70
71
  "&.MuiInputBase-root": {
71
72
  backgroundColor: "white",
72
73
  height: "40px",
73
- borderRadius: "24px",
74
+ // borderRadius: "24px",
75
+ borderRadius: theme.spacing(1),
74
76
  paddingRight: "12px",
75
77
  paddingLeft: "20px",
76
78
  border: `1px solid ${theme.custom.grey[500]}`,
@@ -100,6 +102,9 @@ const TextInput = styled(InputBase)(({ theme }) => ({
100
102
  ":hover": {
101
103
  backgroundColor: theme.custom.red[200]
102
104
  }
105
+ },
106
+ "&.Mui-error.Mui-focused": {
107
+ border: `2px solid ${theme.custom.red[600]}`
103
108
  }
104
109
  }));
105
110
  export {
@@ -2,6 +2,6 @@ export interface ISearchBoxProps {
2
2
  placeholder?: string;
3
3
  value: string | null;
4
4
  onChange: (value: string) => void;
5
- variant: "standalone" | "inline";
5
+ variant?: "standalone";
6
6
  }
7
7
  export declare function SearchBox(props: ISearchBoxProps): import("react/jsx-runtime").JSX.Element;
@@ -1,68 +1,19 @@
1
- import { jsxs, jsx } from "react/jsx-runtime";
2
- import { SearchOutlined } from "@mui/icons-material";
3
- import { useTheme, Stack, TextField } from "@mui/material";
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { FoodsTextInput } from "../Form/FoodsFormFields/FoodsTextInput.js";
3
+ import { FoodsIcon } from "../Icons/FoodsIcon.js";
4
4
  function SearchBox(props) {
5
- const theme = useTheme();
6
- const stackStyleStandalone = {
7
- height: "40px",
8
- padding: "0px 6px 0px 20px",
9
- ...theme.custom.searchBox,
10
- minWidth: "350px"
11
- };
12
- const buttonStyleStandalone = {
13
- height: "20px",
14
- padding: "0px",
15
- width: "100%",
16
- "&>.MuiInputBase-root>fieldset": {
17
- border: "none"
18
- },
19
- "&>.MuiInputBase-root>input": {
20
- padding: "0"
21
- }
22
- };
23
- const stackStyleInline = {
24
- height: "48px",
25
- padding: "0px 16px 0px 24px",
26
- borderTop: "1px solid " + theme.custom.grey[500],
27
- borderBottom: "1px solid " + theme.custom.grey[500],
28
- background: theme.custom.grey[200]
29
- };
30
- const buttonStyleInline = {
31
- "&>.MuiInputBase-root>fieldset": {
32
- border: "none"
33
- },
34
- "&>.MuiInputBase-root>input": {
35
- width: "100%",
36
- height: "48px",
37
- padding: "0",
38
- border: "none"
39
- }
40
- };
41
- return /* @__PURE__ */ jsxs(
42
- Stack,
5
+ return /* @__PURE__ */ jsx(
6
+ FoodsTextInput,
43
7
  {
44
- direction: "row",
45
- useFlexGap: true,
46
- gap: "10px",
47
- justifyContent: "space-between",
48
- alignItems: "center",
49
- sx: props.variant === "standalone" ? stackStyleStandalone : stackStyleInline,
50
- children: [
51
- /* @__PURE__ */ jsx(
52
- TextField,
53
- {
54
- label: "",
55
- type: "search",
56
- placeholder: props.placeholder,
57
- value: props.value,
58
- onChange: (e) => {
59
- props.onChange(e.target.value);
60
- },
61
- sx: props.variant === "standalone" ? buttonStyleStandalone : buttonStyleInline
62
- }
63
- ),
64
- /* @__PURE__ */ jsx(SearchOutlined, {})
65
- ]
8
+ value: props.value ?? "",
9
+ onChange: (e) => {
10
+ props.onChange(e);
11
+ },
12
+ ExtraInputProps: {
13
+ type: "search",
14
+ placeholder: props.placeholder,
15
+ endAdornment: /* @__PURE__ */ jsx(FoodsIcon, { size: 2, icon: "search" })
16
+ }
66
17
  }
67
18
  );
68
19
  }
@@ -1,5 +1,3 @@
1
1
  export * from './CheckboxBlock';
2
- export * from './NumericalBlock';
3
2
  export * from './RadioBlock';
4
3
  export * from './SelectBlock';
5
- export * from './TextBlock';
@@ -22,12 +22,12 @@ export declare const ColorInputContainer: StyledComponent< BoxOwnProps<Theme> &
22
22
  }, keyof BoxOwnProps<Theme>> & MUIStyledCommonProps<Theme>, {}, {}>;
23
23
  export declare const ColorButton: StyledComponent< ButtonOwnProps & Omit< ButtonBaseOwnProps, "classes"> & CommonProps & Omit<Omit< DetailedHTMLProps<ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & {
24
24
  ref?: ((instance: HTMLButtonElement | null) => void | DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | RefObject<HTMLButtonElement> | null | undefined;
25
- }, "className" | "classes" | "style" | "tabIndex" | "color" | "children" | "sx" | "size" | "variant" | "href" | "disabled" | "action" | "loading" | "disableElevation" | "disableFocusRipple" | "disableRipple" | "fullWidth" | "centerRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "onFocusVisible" | "TouchRippleProps" | "touchRippleRef" | "endIcon" | "loadingIndicator" | "loadingPosition" | "startIcon"> & MUIStyledCommonProps<Theme> & {
25
+ }, "className" | "classes" | "style" | "tabIndex" | "color" | "children" | "sx" | "size" | "variant" | "href" | "disabled" | "action" | "loading" | "fullWidth" | "disableElevation" | "disableFocusRipple" | "disableRipple" | "centerRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "onFocusVisible" | "TouchRippleProps" | "touchRippleRef" | "endIcon" | "loadingIndicator" | "loadingPosition" | "startIcon"> & MUIStyledCommonProps<Theme> & {
26
26
  currentColor?: string;
27
27
  }, {}, {}>;
28
28
  export declare const ColorButtonBackground: StyledComponent< ButtonOwnProps & Omit< ButtonBaseOwnProps, "classes"> & CommonProps & Omit<Omit< DetailedHTMLProps<ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & {
29
29
  ref?: ((instance: HTMLButtonElement | null) => void | DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | RefObject<HTMLButtonElement> | null | undefined;
30
- }, "className" | "classes" | "style" | "tabIndex" | "color" | "children" | "sx" | "size" | "variant" | "href" | "disabled" | "action" | "loading" | "disableElevation" | "disableFocusRipple" | "disableRipple" | "fullWidth" | "centerRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "onFocusVisible" | "TouchRippleProps" | "touchRippleRef" | "endIcon" | "loadingIndicator" | "loadingPosition" | "startIcon"> & MUIStyledCommonProps<Theme> & {
30
+ }, "className" | "classes" | "style" | "tabIndex" | "color" | "children" | "sx" | "size" | "variant" | "href" | "disabled" | "action" | "loading" | "fullWidth" | "disableElevation" | "disableFocusRipple" | "disableRipple" | "centerRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "onFocusVisible" | "TouchRippleProps" | "touchRippleRef" | "endIcon" | "loadingIndicator" | "loadingPosition" | "startIcon"> & MUIStyledCommonProps<Theme> & {
31
31
  currentColor?: string;
32
32
  }, {}, {}>;
33
33
  export declare const HiddenInput: StyledComponent<MUIStyledCommonProps<Theme>, DetailedHTMLProps<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, {}>;
@@ -5,7 +5,7 @@ import { DetailedHTMLProps, ButtonHTMLAttributes, DO_NOT_USE_OR_YOU_WILL_BE_FIRE
5
5
  import { MUIStyledCommonProps, BoxOwnProps } from '@mui/system';
6
6
  export declare const ToolbarButton: StyledComponent< ButtonOwnProps & Omit< ButtonBaseOwnProps, "classes"> & CommonProps & Omit<Omit< DetailedHTMLProps<ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & {
7
7
  ref?: ((instance: HTMLButtonElement | null) => void | DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | RefObject<HTMLButtonElement> | null | undefined;
8
- }, "className" | "classes" | "style" | "tabIndex" | "color" | "children" | "sx" | "size" | "variant" | "href" | "disabled" | "action" | "loading" | "disableElevation" | "disableFocusRipple" | "disableRipple" | "fullWidth" | "centerRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "onFocusVisible" | "TouchRippleProps" | "touchRippleRef" | "endIcon" | "loadingIndicator" | "loadingPosition" | "startIcon"> & MUIStyledCommonProps<Theme>, {}, {}>;
8
+ }, "className" | "classes" | "style" | "tabIndex" | "color" | "children" | "sx" | "size" | "variant" | "href" | "disabled" | "action" | "loading" | "fullWidth" | "disableElevation" | "disableFocusRipple" | "disableRipple" | "centerRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "onFocusVisible" | "TouchRippleProps" | "touchRippleRef" | "endIcon" | "loadingIndicator" | "loadingPosition" | "startIcon"> & MUIStyledCommonProps<Theme>, {}, {}>;
9
9
  export declare const TextCommandsContainer: StyledComponent< BoxOwnProps<Theme> & Omit<Omit< DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
10
10
  ref?: ((instance: HTMLDivElement | null) => void | DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | RefObject<HTMLDivElement> | null | undefined;
11
11
  }, keyof BoxOwnProps<Theme>> & MUIStyledCommonProps<Theme>, {}, {}>;
@@ -1,64 +1,20 @@
1
- import { jsxs, jsx } from "react/jsx-runtime";
2
- import { useTheme, Box, TextField } from "@mui/material";
1
+ import { jsx } from "react/jsx-runtime";
3
2
  import { FoodsIcon } from "../Icons/FoodsIcon.js";
4
3
  import { useFoodsSelectContext } from "../Select/FoodsSelect/Context/useSelect.js";
4
+ import { FoodsTextInput } from "../Form/FoodsFormFields/FoodsTextInput.js";
5
5
  const FoodsSearch = () => {
6
6
  const { search, setSearch, textOptions } = useFoodsSelectContext();
7
- const theme = useTheme();
8
- return /* @__PURE__ */ jsxs(
9
- Box,
7
+ return /* @__PURE__ */ jsx(
8
+ FoodsTextInput,
10
9
  {
11
- sx: {
12
- display: "flex",
13
- gap: "8px",
14
- justifyContent: "space-between",
15
- alignItems: "center",
16
- width: "100%",
17
- height: "40px",
18
- padding: "0px 20px 0px 20px",
19
- borderRadius: "24px",
20
- border: `1px solid ${theme.custom.grey[500]}`,
21
- background: "white",
22
- boxShadow: "0px 2px 8px 0px " + theme.custom.grey[500]
10
+ value: search,
11
+ onChange: (newValue) => {
12
+ setSearch(newValue);
23
13
  },
24
- children: [
25
- /* @__PURE__ */ jsx(
26
- TextField,
27
- {
28
- label: "",
29
- placeholder: textOptions.searchPlaceholder,
30
- value: search,
31
- onChange: (e) => {
32
- setSearch(e.target.value);
33
- },
34
- sx: {
35
- width: "100%",
36
- "&>.MuiInputBase-root": {
37
- ">fieldset": {
38
- border: "none"
39
- },
40
- ">input": {
41
- padding: 0
42
- }
43
- }
44
- }
45
- }
46
- ),
47
- /* @__PURE__ */ jsxs(
48
- Box,
49
- {
50
- sx: {
51
- display: "flex",
52
- gap: "8px",
53
- alignItems: "center"
54
- },
55
- children: [
56
- search !== "" && /* @__PURE__ */ jsx(Box, { sx: { display: "flex" }, onClick: () => setSearch(""), children: /* @__PURE__ */ jsx(FoodsIcon, { size: 2, icon: "close" }) }),
57
- /* @__PURE__ */ jsx(FoodsIcon, { size: 3, icon: "search" })
58
- ]
59
- }
60
- )
61
- ]
14
+ ExtraInputProps: {
15
+ placeholder: textOptions.searchPlaceholder,
16
+ endAdornment: /* @__PURE__ */ jsx(FoodsIcon, { size: 2, icon: "search" })
17
+ }
62
18
  }
63
19
  );
64
20
  };
package/dist/main.js CHANGED
@@ -89,10 +89,8 @@ import { BlockItemInner } from "./components/Layout/BlockList/Blocks/Container/B
89
89
  import { EmptyForm } from "./components/Layout/BlockList/Blocks/InnerInfoBlocks/EmptyForm.js";
90
90
  import { SuggestionBlock } from "./components/Layout/BlockList/Blocks/InnerInfoBlocks/SuggestionBlock.js";
91
91
  import { CheckboxBlock } from "./components/Layout/BlockList/Blocks/InnerInputBlocks/CheckboxBlock.js";
92
- import { NumericalBlock } from "./components/Layout/BlockList/Blocks/InnerInputBlocks/NumericalBlock.js";
93
92
  import { RadioBlock } from "./components/Layout/BlockList/Blocks/InnerInputBlocks/RadioBlock.js";
94
93
  import { SelectBlock } from "./components/Layout/BlockList/Blocks/InnerInputBlocks/SelectBlock.js";
95
- import { TextBlock } from "./components/Layout/BlockList/Blocks/InnerInputBlocks/TextBlock.js";
96
94
  import { ListHeader } from "./components/Layout/BlockList/Headers/ListHeader.js";
97
95
  import { EditHeader } from "./components/Layout/BlockList/Headers/EditHeader.js";
98
96
  import { InitHeader } from "./components/Layout/BlockList/Headers/InitHeader.js";
@@ -240,7 +238,6 @@ export {
240
238
  Navbar,
241
239
  NumberField,
242
240
  NumberWithUnit,
243
- NumericalBlock,
244
241
  OptionsPopover,
245
242
  FoodsPills as Pills,
246
243
  PointsCell,
@@ -276,7 +273,6 @@ export {
276
273
  TertiaryToggleButton,
277
274
  TertiaryToggleButtonNodeTitle,
278
275
  TextArrowList,
279
- TextBlock,
280
276
  TextField,
281
277
  TextTitle,
282
278
  TextTitleGreyIcon,
@@ -7,6 +7,13 @@ const components = {
7
7
  }
8
8
  }
9
9
  },
10
+ MuiAutocomplete: {
11
+ styleOverrides: {
12
+ root: () => {
13
+ return {};
14
+ }
15
+ }
16
+ },
10
17
  MuiAvatar: {
11
18
  defaultProps: {
12
19
  children: []
@@ -169,7 +176,7 @@ const components = {
169
176
  },
170
177
  ...ownerState.variant === "select" && {
171
178
  backgroundColor: theme.custom.grey[100],
172
- borderRadius: "24px",
179
+ borderRadius: theme.spacing(1),
173
180
  border: `1px solid ${theme.custom.grey[500]}`
174
181
  },
175
182
  ...ownerState.variant === "validate" && {
@@ -633,9 +640,48 @@ const components = {
633
640
  })
634
641
  }
635
642
  },
636
- MuiInputBase: {
637
- styleOverrides: {}
638
- },
643
+ // This should be activated, but there is too many ripple effect on the codebase right now
644
+ // MuiInputBase: {
645
+ // styleOverrides: {
646
+ // root: ({ theme }) => ({
647
+ // backgroundColor: "white",
648
+ // height: "40px",
649
+ // borderRadius: theme.spacing(1),
650
+ // paddingRight: "12px",
651
+ // paddingLeft: "20px",
652
+ // border: `1px solid ${theme.custom.grey[500]}`,
653
+ // "&:hover": {
654
+ // backgroundColor: theme.custom.grey[300],
655
+ // },
656
+ // color: theme.custom.grey[2800],
657
+ // ...theme.typography["body-medium"],
658
+ // "& ::placeholder": {
659
+ // ...theme.typography["body-medium"],
660
+ // color: theme.custom.grey[1400],
661
+ // },
662
+ // "&.Mui-disabled": {
663
+ // backgroundColor: theme.custom.grey[500],
664
+ // "&:hover": {
665
+ // backgroundColor: theme.custom.grey[500],
666
+ // },
667
+ // },
668
+ // "&.Mui-focused": {
669
+ // border: `2px solid ${theme.custom.grey[2800]}`,
670
+ // },
671
+ // "&.Mui-error": {
672
+ // border: `1px solid ${theme.custom.red[600]}`,
673
+ // backgroundColor: theme.custom.red[100],
674
+ // color: theme.custom.red[600],
675
+ // "&:hover": {
676
+ // backgroundColor: theme.custom.red[200],
677
+ // },
678
+ // },
679
+ // "&.Mui-error.Mui-focused": {
680
+ // border: `2px solid ${theme.custom.red[600]}`,
681
+ // },
682
+ // }),
683
+ // },
684
+ // },
639
685
  MuiChip: {
640
686
  styleOverrides: {
641
687
  root: ({ theme, ownerState }) => ({
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@foodpilot/foods",
3
3
  "private": false,
4
- "version": "2.7.17",
4
+ "version": "2.8.0",
5
5
  "type": "module",
6
6
  "main": "./dist/main.js",
7
7
  "module": "./dist/main.js",
@@ -1,7 +0,0 @@
1
- import { BlockOptions } from '../Container/BlockItemInner';
2
- import { RoundInputProps } from '../../../../Input';
3
- type NumericalBlockProps = RoundInputProps & {
4
- blockOptions: BlockOptions;
5
- };
6
- export declare const NumericalBlock: (props: NumericalBlockProps) => import("react/jsx-runtime").JSX.Element;
7
- export {};
@@ -1,10 +0,0 @@
1
- import { jsx, Fragment } from "react/jsx-runtime";
2
- import { BlockItemInner } from "../Container/BlockItemInner.js";
3
- import { RoundInput } from "../../../../Input/RoundInput.js";
4
- const NumericalBlock = (props) => {
5
- const { blockOptions, ...FoodsRoundInputProps } = props;
6
- return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(BlockItemInner, { blockOptions, children: /* @__PURE__ */ jsx(RoundInput, { ...FoodsRoundInputProps, type: "number" }) }) });
7
- };
8
- export {
9
- NumericalBlock
10
- };
@@ -1,7 +0,0 @@
1
- import { BlockOptions } from '../Container/BlockItemInner';
2
- import { RoundInputProps } from '../../../../Input';
3
- type TextBlockProps = RoundInputProps & {
4
- blockOptions: BlockOptions;
5
- };
6
- export declare const TextBlock: (props: TextBlockProps) => import("react/jsx-runtime").JSX.Element;
7
- export {};
@@ -1,10 +0,0 @@
1
- import { jsx, Fragment } from "react/jsx-runtime";
2
- import { BlockItemInner } from "../Container/BlockItemInner.js";
3
- import { RoundInput } from "../../../../Input/RoundInput.js";
4
- const TextBlock = (props) => {
5
- const { blockOptions, ...FoodsRoundInputProps } = props;
6
- return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(BlockItemInner, { blockOptions, children: /* @__PURE__ */ jsx(RoundInput, { ...FoodsRoundInputProps }) }) });
7
- };
8
- export {
9
- TextBlock
10
- };