@foodpilot/foods 2.11.8 → 2.11.9
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/Form/FoodsFormBase/FoodsFormBase.d.ts +2 -1
- package/dist/components/Form/FoodsFormBase/FoodsFormBase.js +6 -3
- package/dist/components/Form/FoodsFormBase/FormBaseContext.d.ts +2 -1
- package/dist/components/Form/FoodsFormBase/FormBaseContext.js +6 -4
- package/dist/components/Form/FoodsFormBase/FormTopBar/TopBarFullWidth/CenterPagination.d.ts +1 -0
- package/dist/components/Form/FoodsFormBase/FormTopBar/TopBarFullWidth/LeftName.d.ts +1 -0
- package/dist/components/Form/FoodsFormBase/FormTopBar/TopBarFullWidth/RightSave.d.ts +1 -0
- package/dist/components/Form/FoodsFormBase/FormTopBar/TopBarFullWidth/TopBarFullWidth.d.ts +1 -0
- package/dist/components/Tabs/FoodsTabs/FoodsTabTemplate.js +4 -1
- package/dist/components/Tabs/FoodsTabs/FoodsTabs.js +3 -2
- package/dist/themes/responsive/useResponsiveBreakpoints.d.ts +1 -0
- package/dist/themes/responsive/useResponsiveBreakpoints.js +2 -0
- package/package.json +1 -1
|
@@ -31,8 +31,9 @@ export type ConfirmOptions = {
|
|
|
31
31
|
confirmOptions: ConfirmOptionsType;
|
|
32
32
|
};
|
|
33
33
|
export type FoodsFormBaseProps = ConfirmOptions & {
|
|
34
|
-
textOptions: DisplayTextOptions;
|
|
35
34
|
pages: FoodsPage[];
|
|
35
|
+
children?: ReactNode;
|
|
36
|
+
textOptions: DisplayTextOptions;
|
|
36
37
|
startingPage?: number;
|
|
37
38
|
onClose?: () => void;
|
|
38
39
|
onValidate?: () => void;
|
|
@@ -4,8 +4,10 @@ import { FormBaseContextProvider, useFormBaseContext } from "./FormBaseContext.j
|
|
|
4
4
|
import { FormTopBar } from "./FormTopBar/FormTopBar.js";
|
|
5
5
|
import { MainPageLayout } from "./MainPageLayout.js";
|
|
6
6
|
import { ConfirmDialog } from "./ConfirmDialog.js";
|
|
7
|
-
|
|
7
|
+
import { Stack } from "@mui/material";
|
|
8
|
+
const _FoodsFormBase = (props) => {
|
|
8
9
|
const { confirmExit, formSaved } = useFormBaseContext();
|
|
10
|
+
const { children } = props;
|
|
9
11
|
const listener = (ev) => {
|
|
10
12
|
ev.preventDefault();
|
|
11
13
|
};
|
|
@@ -19,13 +21,14 @@ const _FoodsFormBase = () => {
|
|
|
19
21
|
}, [formSaved, confirmExit]);
|
|
20
22
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
21
23
|
/* @__PURE__ */ jsx(FormTopBar, {}),
|
|
22
|
-
/* @__PURE__ */ jsx(MainPageLayout, {})
|
|
24
|
+
/* @__PURE__ */ jsx(Stack, { children: children === void 0 ? /* @__PURE__ */ jsx(MainPageLayout, {}) : children })
|
|
23
25
|
] });
|
|
24
26
|
};
|
|
25
27
|
const FoodsFormBase = (props) => {
|
|
26
28
|
const [openConfirm, setOpenConfirm] = useState(false);
|
|
29
|
+
const children = props.children;
|
|
27
30
|
return /* @__PURE__ */ jsxs(FormBaseContextProvider, { ...props, openConfirmDialog: () => setOpenConfirm(true), children: [
|
|
28
|
-
/* @__PURE__ */ jsx(_FoodsFormBase, {}),
|
|
31
|
+
/* @__PURE__ */ jsx(_FoodsFormBase, { children }),
|
|
29
32
|
props.confirmExit && /* @__PURE__ */ jsx(
|
|
30
33
|
ConfirmDialog,
|
|
31
34
|
{
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
import { FoodsPage, FoodsFormBaseProps } from './FoodsFormBase';
|
|
3
3
|
import { PageLocks } from './usePageLock';
|
|
4
|
-
type
|
|
4
|
+
export type FormBaseVariant = "outlined" | "full-width";
|
|
5
|
+
type FormBasePropsBlackList = Omit<FoodsFormBaseProps, "startingPage" | "variant">;
|
|
5
6
|
type ExtraFormOptions = {
|
|
6
7
|
isSaving: boolean;
|
|
7
8
|
setSaving: (isSaving: boolean) => void;
|
|
@@ -3,12 +3,12 @@ import { useContext, createContext, useState } from "react";
|
|
|
3
3
|
import { usePageLock } from "./usePageLock.js";
|
|
4
4
|
const FormBaseContext = createContext(null);
|
|
5
5
|
const FormBaseContextProvider = (props) => {
|
|
6
|
-
const { children, startingPage = 0, ...FormBaseProps } = props;
|
|
6
|
+
const { children, pages = [], startingPage = 0, ...FormBaseProps } = props;
|
|
7
7
|
const [isSaving, setSaving] = useState(false);
|
|
8
8
|
const [isError, setError] = useState(false);
|
|
9
9
|
const [selectedPageIndex, setPage] = useState(startingPage);
|
|
10
|
-
const maxPage =
|
|
11
|
-
const selectedPage =
|
|
10
|
+
const maxPage = pages.length;
|
|
11
|
+
const selectedPage = pages[selectedPageIndex] ?? null;
|
|
12
12
|
const pageLock = usePageLock();
|
|
13
13
|
const [formSaved, setFormSaved] = useState(false);
|
|
14
14
|
const items = {
|
|
@@ -23,7 +23,9 @@ const FormBaseContextProvider = (props) => {
|
|
|
23
23
|
formSaved,
|
|
24
24
|
setFormSaved,
|
|
25
25
|
isError,
|
|
26
|
-
setError
|
|
26
|
+
setError,
|
|
27
|
+
// variant,
|
|
28
|
+
pages
|
|
27
29
|
};
|
|
28
30
|
return /* @__PURE__ */ jsx(FormBaseContext.Provider, { value: items, children });
|
|
29
31
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const CenterPagination: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const LeftName: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const RightSave: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const TopBarFullWidth: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -13,6 +13,7 @@ const SpecialTab = styled((props) => {
|
|
|
13
13
|
const typographyTheme = textVariant === "inherit" ? {} : theme.typography[textVariant];
|
|
14
14
|
const globalOverrides = {
|
|
15
15
|
textTransform: "unset",
|
|
16
|
+
maxWidth: "none",
|
|
16
17
|
...typographyTheme
|
|
17
18
|
};
|
|
18
19
|
if (variant === "primary") {
|
|
@@ -49,7 +50,9 @@ const SpecialTab = styled((props) => {
|
|
|
49
50
|
}
|
|
50
51
|
if (variant === "buttons") {
|
|
51
52
|
return {
|
|
52
|
-
minHeight: "
|
|
53
|
+
minHeight: "36px",
|
|
54
|
+
height: "36px",
|
|
55
|
+
borderRadius: theme.spacing(1),
|
|
53
56
|
margin: "4px",
|
|
54
57
|
background: "linear-gradient(180deg, #FFFFFF 0%, #F6F5F3 154.5%)",
|
|
55
58
|
border: `1px solid ${theme.custom.grey[600]}`,
|
|
@@ -113,9 +113,10 @@ const SpecialTabs = styled((props) => {
|
|
|
113
113
|
}
|
|
114
114
|
if (tabVariant === "buttons") {
|
|
115
115
|
return {
|
|
116
|
-
|
|
116
|
+
minHeight: "36px",
|
|
117
|
+
backgroundColor: "inherit",
|
|
117
118
|
".MuiTabs-indicator": {
|
|
118
|
-
backgroundColor: "
|
|
119
|
+
backgroundColor: "inherit"
|
|
119
120
|
},
|
|
120
121
|
...scrollableStyle
|
|
121
122
|
};
|
|
@@ -2,11 +2,13 @@ import { useTheme } from "@mui/material/styles";
|
|
|
2
2
|
import { useMediaQuery } from "@mui/material";
|
|
3
3
|
const useResponsiveBreakpoints = () => {
|
|
4
4
|
const theme = useTheme();
|
|
5
|
+
const isExtraSmall = useMediaQuery(theme.breakpoints.down("sm"));
|
|
5
6
|
const isMobile = useMediaQuery(theme.breakpoints.down("md"));
|
|
6
7
|
const isTablet = useMediaQuery(theme.breakpoints.between("md", "lg"));
|
|
7
8
|
const isDesktop = useMediaQuery(theme.breakpoints.between("lg", "xl"));
|
|
8
9
|
const isUltrawide = useMediaQuery(theme.breakpoints.up("xl"));
|
|
9
10
|
return {
|
|
11
|
+
isExtraSmall,
|
|
10
12
|
isMobile,
|
|
11
13
|
isTablet,
|
|
12
14
|
isDesktop,
|