@foodpilot/foods 2.7.9 → 2.7.10
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/Badge/FoodsBadge.d.ts +1 -0
- package/dist/components/Badge/FoodsBadge.js +1 -1
- package/dist/components/Icons/FoodsIcon.d.ts +1 -0
- package/dist/components/Icons/FoodsIcon.js +6 -4
- package/dist/components/Icons/blankIcon.svg.js +5 -0
- package/dist/components/Navigation/FoodsNavBar/FoodsNavbar.d.ts +22 -2
- package/dist/components/Navigation/FoodsNavBar/FoodsNavbar.js +33 -15
- package/dist/components/Navigation/FoodsNavBar/Sections/UserButtons/Button/CustomRender.d.ts +7 -0
- package/dist/components/Navigation/FoodsNavBar/Sections/UserButtons/Button/CustomRender.js +11 -0
- package/dist/components/Navigation/FoodsNavBar/Sections/UserButtons/Button/DrawerAction.js +9 -0
- package/dist/components/Navigation/FoodsNavBar/Sections/UserButtons/Button/Separator.d.ts +5 -0
- package/dist/components/Navigation/FoodsNavBar/Sections/UserButtons/Button/Separator.js +10 -0
- package/dist/components/Navigation/FoodsNavBar/Sections/UserButtons/Button/TopLinkAction.js +1 -0
- package/dist/components/Navigation/FoodsNavBar/Sections/UserButtons/UserButtons.js +13 -0
- package/dist/components/Navigation/FoodsNavBar/index.d.ts +5 -0
- package/dist/main.js +10 -0
- package/dist/themes/common/components.js +7 -3
- package/package.json +1 -1
|
@@ -5,5 +5,6 @@ export type FoodsBadgeProps = {
|
|
|
5
5
|
icon: FoodsIconProps["icon"];
|
|
6
6
|
boxProps?: BoxProps;
|
|
7
7
|
boxExtraPaddingPx?: number;
|
|
8
|
+
placeholder?: FoodsIconProps["placeholder"];
|
|
8
9
|
};
|
|
9
10
|
export declare const FoodsBadge: (props: FoodsBadgeProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -17,7 +17,7 @@ const FoodsBadge = (props) => {
|
|
|
17
17
|
height: `${widthHeight.height + boxExtraPaddingPx}px`,
|
|
18
18
|
...boxProps.sx
|
|
19
19
|
},
|
|
20
|
-
children: /* @__PURE__ */ jsx(FoodsIcon, { size: widthHeight, icon })
|
|
20
|
+
children: /* @__PURE__ */ jsx(FoodsIcon, { size: widthHeight, icon, placeholder: props.placeholder })
|
|
21
21
|
}
|
|
22
22
|
);
|
|
23
23
|
};
|
|
@@ -2,15 +2,17 @@ import { jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { Box } from "@mui/material";
|
|
3
3
|
import { iconMapping, computeSize } from "./iconConfig.js";
|
|
4
4
|
import { useTheme } from "@mui/material/styles";
|
|
5
|
+
import { ReactComponent as SvgBlankIcon } from "./blankIcon.svg.js";
|
|
5
6
|
const FoodsIcon = (props) => {
|
|
6
7
|
var _a;
|
|
7
|
-
const { icon, size, backgroundColor, color } = props;
|
|
8
|
+
const { icon, size, backgroundColor, color, placeholder = "empty" } = props;
|
|
8
9
|
const theme = useTheme();
|
|
9
|
-
|
|
10
|
+
const placeholderIcon = placeholder === "empty" ? null : placeholder === "defaultIcon" ? iconMapping["default"] : SvgBlankIcon;
|
|
11
|
+
const _Icon = (_a = iconMapping) == null ? void 0 : _a[icon];
|
|
12
|
+
const Icon = _Icon === void 0 ? placeholderIcon : _Icon;
|
|
13
|
+
if (Icon === null) {
|
|
10
14
|
return null;
|
|
11
15
|
}
|
|
12
|
-
const _Icon = (_a = iconMapping) == null ? void 0 : _a[icon];
|
|
13
|
-
const Icon = _Icon === void 0 ? iconMapping["default"] : _Icon;
|
|
14
16
|
const widthHeight = typeof size === "number" ? computeSize(size) : size;
|
|
15
17
|
return backgroundColor ? /* @__PURE__ */ jsx(
|
|
16
18
|
Box,
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
const SvgBlankIcon = (props) => /* @__PURE__ */ React.createElement("svg", { width: 40, height: 40, viewBox: "0 0 40 40", fill: "currentColor", xmlns: "http://www.w3.org/2000/svg", ...props });
|
|
3
|
+
export {
|
|
4
|
+
SvgBlankIcon as ReactComponent
|
|
5
|
+
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
1
2
|
import { NormalCssProperties } from '@mui/material/styles/createMixins';
|
|
2
3
|
export type SidebarOptions = {
|
|
3
4
|
isExpanded?: boolean;
|
|
@@ -9,6 +10,17 @@ export type User = {
|
|
|
9
10
|
lastname: string;
|
|
10
11
|
picture?: string;
|
|
11
12
|
};
|
|
13
|
+
export type CustomRenderCallback = {
|
|
14
|
+
isExpanded: boolean;
|
|
15
|
+
extendSidebar: () => void;
|
|
16
|
+
onMobileDrawerClose?: () => void;
|
|
17
|
+
};
|
|
18
|
+
export type NavbarDrawerItemType = ({
|
|
19
|
+
type: "custom";
|
|
20
|
+
isSelected: boolean;
|
|
21
|
+
} & NavbarCustomType) | ({
|
|
22
|
+
type?: "link";
|
|
23
|
+
} & NavbarLinkType);
|
|
12
24
|
export type NavbarLinkType = {
|
|
13
25
|
icon: JSX.Element;
|
|
14
26
|
isSelected: boolean;
|
|
@@ -19,9 +31,16 @@ export type NavbarLinkType = {
|
|
|
19
31
|
export type NavbarDrawerType = {
|
|
20
32
|
label: string;
|
|
21
33
|
icon: JSX.Element;
|
|
22
|
-
items:
|
|
34
|
+
items: NavbarDrawerItemType[];
|
|
35
|
+
};
|
|
36
|
+
export type NavbarCustomType = {
|
|
37
|
+
render: (options: CustomRenderCallback) => ReactNode;
|
|
23
38
|
};
|
|
24
|
-
export type NavbarButtonType =
|
|
39
|
+
export type NavbarButtonType = {
|
|
40
|
+
type: "separator";
|
|
41
|
+
} | ({
|
|
42
|
+
type: "custom";
|
|
43
|
+
} & NavbarCustomType) | ({
|
|
25
44
|
type: "drawer";
|
|
26
45
|
} & NavbarDrawerType) | ({
|
|
27
46
|
type: "link";
|
|
@@ -43,6 +62,7 @@ export type Organization = {
|
|
|
43
62
|
export type NavigationMode = "mobile" | "tablet" | "desktop";
|
|
44
63
|
export type FoodsNavbarProps = {
|
|
45
64
|
buttons: NavbarButtonType[];
|
|
65
|
+
footerButtons: NavbarButtonType[];
|
|
46
66
|
connectedUser: User;
|
|
47
67
|
organization: Organization;
|
|
48
68
|
sidebarTexts: SidebarTexts;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useTheme, Box } from "@mui/material";
|
|
2
|
+
import { useTheme, Box, Stack } from "@mui/material";
|
|
3
3
|
import { useState, useEffect } from "react";
|
|
4
4
|
import { UserButton } from "./Sections/Profile/UserButton.js";
|
|
5
5
|
import { UserButtons } from "./Sections/UserButtons/UserButtons.js";
|
|
@@ -9,6 +9,7 @@ const FoodsNavbar = (props) => {
|
|
|
9
9
|
const theme = useTheme();
|
|
10
10
|
const {
|
|
11
11
|
buttons,
|
|
12
|
+
footerButtons,
|
|
12
13
|
connectedUser,
|
|
13
14
|
organization,
|
|
14
15
|
sidebarTexts,
|
|
@@ -104,21 +105,38 @@ const FoodsNavbar = (props) => {
|
|
|
104
105
|
{
|
|
105
106
|
sx: {
|
|
106
107
|
gridRow: "2",
|
|
107
|
-
|
|
108
|
+
paddingBlock: theme.spacing(2),
|
|
109
|
+
border: "1px solid red",
|
|
110
|
+
height: "100%"
|
|
108
111
|
},
|
|
109
|
-
children: /* @__PURE__ */
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
112
|
+
children: /* @__PURE__ */ jsxs(Stack, { justifyContent: "space-between", height: "100%", children: [
|
|
113
|
+
/* @__PURE__ */ jsx(
|
|
114
|
+
UserButtons,
|
|
115
|
+
{
|
|
116
|
+
buttons,
|
|
117
|
+
isExpanded: isSidebarExpanded,
|
|
118
|
+
extendSidebar: () => {
|
|
119
|
+
if (navigationMode === "desktop") {
|
|
120
|
+
setSidebarExpanded(true);
|
|
121
|
+
}
|
|
122
|
+
},
|
|
123
|
+
onMobileDrawerClose: navigationMode === "mobile" ? onMobileDrawerClose : void 0
|
|
124
|
+
}
|
|
125
|
+
),
|
|
126
|
+
/* @__PURE__ */ jsx(
|
|
127
|
+
UserButtons,
|
|
128
|
+
{
|
|
129
|
+
buttons: footerButtons,
|
|
130
|
+
isExpanded: isSidebarExpanded,
|
|
131
|
+
extendSidebar: () => {
|
|
132
|
+
if (navigationMode === "desktop") {
|
|
133
|
+
setSidebarExpanded(true);
|
|
134
|
+
}
|
|
135
|
+
},
|
|
136
|
+
onMobileDrawerClose: navigationMode === "mobile" ? onMobileDrawerClose : void 0
|
|
137
|
+
}
|
|
138
|
+
)
|
|
139
|
+
] })
|
|
122
140
|
}
|
|
123
141
|
),
|
|
124
142
|
navigationMode === "desktop" && /* @__PURE__ */ jsx(
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useTheme } from "@mui/material";
|
|
3
|
+
import Stack from "@mui/material/Stack/Stack";
|
|
4
|
+
const CustomRender = (props) => {
|
|
5
|
+
const theme = useTheme();
|
|
6
|
+
const { isExpanded, children } = props;
|
|
7
|
+
return /* @__PURE__ */ jsx(Stack, { paddingInline: isExpanded === false ? theme.spacing(1) : "none", children });
|
|
8
|
+
};
|
|
9
|
+
export {
|
|
10
|
+
CustomRender
|
|
11
|
+
};
|
|
@@ -2,6 +2,7 @@ import { jsxs, jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { useTheme, ButtonGroup, Button, Box, Typography } from "@mui/material";
|
|
3
3
|
import { useState, Fragment } from "react";
|
|
4
4
|
import { LinkAction } from "./LinkAction.js";
|
|
5
|
+
import { CustomRender } from "./CustomRender.js";
|
|
5
6
|
import { FoodsIcon } from "../../../../../Icons/FoodsIcon.js";
|
|
6
7
|
const DrawerAction = (props) => {
|
|
7
8
|
const theme = useTheme();
|
|
@@ -85,6 +86,14 @@ const DrawerAction = (props) => {
|
|
|
85
86
|
}
|
|
86
87
|
),
|
|
87
88
|
isExpanded && isDrawerOpened && /* @__PURE__ */ jsx(Box, { sx: { paddingLeft: "30px" }, children: button.items.map((item, index) => {
|
|
89
|
+
if (item.type === "custom") {
|
|
90
|
+
const component = item.render({
|
|
91
|
+
isExpanded,
|
|
92
|
+
extendSidebar,
|
|
93
|
+
onMobileDrawerClose
|
|
94
|
+
});
|
|
95
|
+
return /* @__PURE__ */ jsx(CustomRender, { isExpanded, children: component });
|
|
96
|
+
}
|
|
88
97
|
return /* @__PURE__ */ jsx(
|
|
89
98
|
LinkAction,
|
|
90
99
|
{
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useTheme, Stack, Box } from "@mui/material";
|
|
3
|
+
const Separator = (props) => {
|
|
4
|
+
const theme = useTheme();
|
|
5
|
+
const { isExpanded } = props;
|
|
6
|
+
return /* @__PURE__ */ jsx(Stack, { marginBlock: theme.spacing(0.5), paddingInline: isExpanded === false ? theme.spacing(2) : "none", children: /* @__PURE__ */ jsx(Box, { borderTop: `1px solid ${theme.custom.grey[2e3]}` }) });
|
|
7
|
+
};
|
|
8
|
+
export {
|
|
9
|
+
Separator
|
|
10
|
+
};
|
|
@@ -3,6 +3,8 @@ import { LinkAction } from "./Button/LinkAction.js";
|
|
|
3
3
|
import { TopLinkAction } from "./Button/TopLinkAction.js";
|
|
4
4
|
import { DrawerAction } from "./Button/DrawerAction.js";
|
|
5
5
|
import { Box } from "@mui/material";
|
|
6
|
+
import { Separator } from "./Button/Separator.js";
|
|
7
|
+
import { CustomRender } from "./Button/CustomRender.js";
|
|
6
8
|
const UserButtons = (props) => {
|
|
7
9
|
const { buttons, isExpanded, extendSidebar, onMobileDrawerClose } = props;
|
|
8
10
|
return /* @__PURE__ */ jsx(
|
|
@@ -14,6 +16,17 @@ const UserButtons = (props) => {
|
|
|
14
16
|
gap: "4px"
|
|
15
17
|
},
|
|
16
18
|
children: buttons.map((button, index) => {
|
|
19
|
+
if (button.type === "custom") {
|
|
20
|
+
const component = button.render({
|
|
21
|
+
isExpanded,
|
|
22
|
+
extendSidebar,
|
|
23
|
+
onMobileDrawerClose
|
|
24
|
+
});
|
|
25
|
+
return /* @__PURE__ */ jsx(CustomRender, { isExpanded, children: component });
|
|
26
|
+
}
|
|
27
|
+
if (button.type === "separator") {
|
|
28
|
+
return /* @__PURE__ */ jsx(Separator, { isExpanded });
|
|
29
|
+
}
|
|
17
30
|
if (button.type === "drawer") {
|
|
18
31
|
return /* @__PURE__ */ jsx(
|
|
19
32
|
DrawerAction,
|
|
@@ -1,2 +1,7 @@
|
|
|
1
1
|
export * from './FoodsNavbar';
|
|
2
2
|
export * from './Plugin/DefaultUserAction';
|
|
3
|
+
export { CustomRender } from './Sections/UserButtons/Button/CustomRender';
|
|
4
|
+
export { DrawerAction } from './Sections/UserButtons/Button/DrawerAction';
|
|
5
|
+
export { LinkAction } from './Sections/UserButtons/Button/LinkAction';
|
|
6
|
+
export { Separator } from './Sections/UserButtons/Button/Separator';
|
|
7
|
+
export { TopLinkAction } from './Sections/UserButtons/Button/TopLinkAction';
|
package/dist/main.js
CHANGED
|
@@ -99,6 +99,11 @@ import { InitHeader } from "./components/Layout/BlockList/Headers/InitHeader.js"
|
|
|
99
99
|
import { LinearProgress } from "./components/LinearProgress.js";
|
|
100
100
|
import { IconThread } from "./components/Navigation/IconThread.js";
|
|
101
101
|
import { HeaderNav, NavBarLink, Navbar, SubMenu, UserNav } from "./components/Navigation/Navbar.js";
|
|
102
|
+
import { CustomRender } from "./components/Navigation/FoodsNavBar/Sections/UserButtons/Button/CustomRender.js";
|
|
103
|
+
import { DrawerAction } from "./components/Navigation/FoodsNavBar/Sections/UserButtons/Button/DrawerAction.js";
|
|
104
|
+
import { LinkAction } from "./components/Navigation/FoodsNavBar/Sections/UserButtons/Button/LinkAction.js";
|
|
105
|
+
import { Separator } from "./components/Navigation/FoodsNavBar/Sections/UserButtons/Button/Separator.js";
|
|
106
|
+
import { TopLinkAction } from "./components/Navigation/FoodsNavBar/Sections/UserButtons/Button/TopLinkAction.js";
|
|
102
107
|
import { FoodsNavbar } from "./components/Navigation/FoodsNavBar/FoodsNavbar.js";
|
|
103
108
|
import { DefaultUserAction } from "./components/Navigation/FoodsNavBar/Plugin/DefaultUserAction.js";
|
|
104
109
|
import { NumberWithUnit } from "./components/Number/NumberWithUnit.js";
|
|
@@ -168,6 +173,7 @@ export {
|
|
|
168
173
|
ComparisonLabel,
|
|
169
174
|
ContextualContentBox,
|
|
170
175
|
CoordinatePopover,
|
|
176
|
+
CustomRender,
|
|
171
177
|
CustomToggleButton,
|
|
172
178
|
CustomToggleButtonNodeTitle,
|
|
173
179
|
CustomTypography,
|
|
@@ -175,6 +181,7 @@ export {
|
|
|
175
181
|
DefaultUserAction,
|
|
176
182
|
DottedBox,
|
|
177
183
|
DoughnutChart,
|
|
184
|
+
DrawerAction,
|
|
178
185
|
EcoScoreCell,
|
|
179
186
|
EditHeader,
|
|
180
187
|
EmptyForm,
|
|
@@ -225,6 +232,7 @@ export {
|
|
|
225
232
|
LightIndicatorBlock,
|
|
226
233
|
LineGroupBox,
|
|
227
234
|
LinearProgress,
|
|
235
|
+
LinkAction,
|
|
228
236
|
ListHeader,
|
|
229
237
|
MRTGrid,
|
|
230
238
|
MultiValueFilter,
|
|
@@ -260,6 +268,7 @@ export {
|
|
|
260
268
|
SectionTabs,
|
|
261
269
|
SeeMoreCard,
|
|
262
270
|
SelectBlock,
|
|
271
|
+
Separator,
|
|
263
272
|
SolidGreyBox,
|
|
264
273
|
SsqCard,
|
|
265
274
|
SubMenu,
|
|
@@ -274,6 +283,7 @@ export {
|
|
|
274
283
|
Textarea,
|
|
275
284
|
ThemedPopover,
|
|
276
285
|
ToggleSwitch,
|
|
286
|
+
TopLinkAction,
|
|
277
287
|
TrajectoryCards,
|
|
278
288
|
TrajectoryChart,
|
|
279
289
|
Typography,
|
|
@@ -104,7 +104,7 @@ const components = {
|
|
|
104
104
|
textTransform: "none",
|
|
105
105
|
fontSize: "0.9rem",
|
|
106
106
|
lineHeight: "1rem",
|
|
107
|
-
borderRadius:
|
|
107
|
+
borderRadius: theme.spacing(1),
|
|
108
108
|
height: "40px",
|
|
109
109
|
fontWeight: 700,
|
|
110
110
|
...ownerState.variant === "primary" && {
|
|
@@ -173,13 +173,11 @@ const components = {
|
|
|
173
173
|
border: `1px solid ${theme.custom.grey[500]}`
|
|
174
174
|
},
|
|
175
175
|
...ownerState.variant === "validate" && {
|
|
176
|
-
borderRadius: "44px",
|
|
177
176
|
color: "#FFFFFF",
|
|
178
177
|
transition: "none",
|
|
179
178
|
background: `linear-gradient(180deg, ${theme.custom.green[500]} 0%, ${theme.custom.green[700]} 100%)`
|
|
180
179
|
},
|
|
181
180
|
...ownerState.variant === "delete" && {
|
|
182
|
-
borderRadius: "44px",
|
|
183
181
|
color: "#FFFFFF",
|
|
184
182
|
transition: "none",
|
|
185
183
|
background: `${theme.custom.red[600]}`
|
|
@@ -475,6 +473,7 @@ const components = {
|
|
|
475
473
|
height: "24px",
|
|
476
474
|
color: theme.custom.grey[2800],
|
|
477
475
|
backgroundColor: "inherit",
|
|
476
|
+
borderRadius: "32px",
|
|
478
477
|
":hover": {
|
|
479
478
|
backgroundColor: theme.custom.grey[600]
|
|
480
479
|
},
|
|
@@ -493,6 +492,7 @@ const components = {
|
|
|
493
492
|
height: "36px",
|
|
494
493
|
color: theme.custom.grey[2800],
|
|
495
494
|
backgroundColor: "inherit",
|
|
495
|
+
borderRadius: "32px",
|
|
496
496
|
":hover": {
|
|
497
497
|
backgroundColor: theme.custom.grey[600]
|
|
498
498
|
},
|
|
@@ -511,6 +511,7 @@ const components = {
|
|
|
511
511
|
height: "44px",
|
|
512
512
|
color: theme.custom.grey[2800],
|
|
513
513
|
backgroundColor: "inherit",
|
|
514
|
+
borderRadius: "32px",
|
|
514
515
|
":hover": {
|
|
515
516
|
backgroundColor: theme.custom.grey[600]
|
|
516
517
|
},
|
|
@@ -530,6 +531,7 @@ const components = {
|
|
|
530
531
|
color: theme.custom.grey[2800],
|
|
531
532
|
background: "linear-gradient(180deg, #FFFFFF 0%, #F6F5F3 154.5%)",
|
|
532
533
|
border: `1px solid ${theme.custom.grey[500]}`,
|
|
534
|
+
borderRadius: "32px",
|
|
533
535
|
":hover": {
|
|
534
536
|
background: "none",
|
|
535
537
|
backgroundColor: theme.custom.grey[400]
|
|
@@ -553,6 +555,7 @@ const components = {
|
|
|
553
555
|
color: theme.custom.grey[2800],
|
|
554
556
|
background: "linear-gradient(180deg, #FFFFFF 0%, #F6F5F3 154.5%)",
|
|
555
557
|
border: `1px solid ${theme.custom.grey[500]}`,
|
|
558
|
+
borderRadius: "32px",
|
|
556
559
|
":hover": {
|
|
557
560
|
background: "none",
|
|
558
561
|
backgroundColor: theme.custom.grey[400]
|
|
@@ -576,6 +579,7 @@ const components = {
|
|
|
576
579
|
color: theme.custom.grey[2800],
|
|
577
580
|
background: "linear-gradient(180deg, #FFFFFF 0%, #F6F5F3 154.5%)",
|
|
578
581
|
border: `1px solid ${theme.custom.grey[500]}`,
|
|
582
|
+
borderRadius: "32px",
|
|
579
583
|
":hover": {
|
|
580
584
|
background: "none",
|
|
581
585
|
backgroundColor: theme.custom.grey[400]
|