@foodpilot/foods 0.1.90 → 0.1.92

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.
@@ -0,0 +1,7 @@
1
+ import { TypographyProps } from "@mui/material";
2
+ export type TypographyListProps = {
3
+ value: string[];
4
+ maxLength: number;
5
+ separator?: string;
6
+ } & TypographyProps;
7
+ export declare const TypographyList: (props: TypographyListProps) => import("react/jsx-runtime").JSX.Element;
@@ -1 +1,2 @@
1
1
  export * from "./CustomTypography";
2
+ export * from "./TypographyList";
@@ -1,6 +1,8 @@
1
+ import { ConfirmOptionsType } from "./FoodsFormBase";
1
2
  type ConfirmDialogProps = {
2
3
  open: boolean;
3
4
  onClose: () => void;
5
+ confirmOptions: ConfirmOptionsType;
4
6
  };
5
7
  export declare const ConfirmDialog: (props: ConfirmDialogProps) => import("react/jsx-runtime").JSX.Element;
6
8
  export {};
@@ -1,5 +1,5 @@
1
1
  import { ReactNode } from "react";
2
- export type Page = {
2
+ export type FoodsPage = {
3
3
  title?: string;
4
4
  subtitle?: ReactNode;
5
5
  icon?: JSX.Element;
@@ -14,23 +14,27 @@ export type DisplayTextOptions = {
14
14
  syncingMessage?: string;
15
15
  savingDefaultMessage?: string;
16
16
  };
17
- export type ConfirmOptions = {
18
- title: string;
19
- description: string;
20
- confirmButtonText: string;
21
- cancelButtonText: string;
22
- onConfirm?: () => void;
23
- onCancel?: () => void;
17
+ export type ConfirmOptionsType = {
18
+ titleText: string;
19
+ infoText?: string;
20
+ confirmText: string;
21
+ cancelText: string;
22
+ onConfirm: () => void;
23
+ onCancel: () => void;
24
+ };
25
+ export type ConfirmOptions = ({
26
+ confirmExit: false;
27
+ }) | {
28
+ confirmExit: true;
29
+ confirmOptions: ConfirmOptionsType;
24
30
  };
25
- export type FoodsFormBaseProps = {
31
+ export type FoodsFormBaseProps = ConfirmOptions & {
26
32
  textOptions: DisplayTextOptions;
27
- pages: Page[];
33
+ pages: FoodsPage[];
28
34
  startingPage?: number;
29
35
  onClose?: () => void;
30
36
  onValidate?: () => void;
31
37
  onPageChange?: (newPageIndex: number, previousPageIndex: number) => void;
32
38
  showSync?: boolean;
33
- confirmExit?: boolean;
34
- confirmOptions: ConfirmOptions;
35
39
  };
36
40
  export declare const FoodsFormBase: (props: FoodsFormBaseProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,21 +1,23 @@
1
1
  import { ReactNode } from "react";
2
- import { Page } from "./FoodsFormBase";
2
+ import { FoodsPage } from "./FoodsFormBase";
3
3
  import { PageLocks } from "./usePageLock";
4
4
  import { FoodsFormBaseProps } from "./FoodsFormBase";
5
5
  type FormBasePropsBlackList = Omit<FoodsFormBaseProps, "startingPage">;
6
- type FormBaseContextInitialValues = (PageLocks & FormBasePropsBlackList & {
6
+ type ExtraFormOptions = {
7
7
  isSaving: boolean;
8
8
  setSaving: (isSaving: boolean) => void;
9
- selectedPage: Page;
9
+ selectedPage: FoodsPage;
10
10
  selectedPageIndex: number;
11
11
  setPage: (value: number) => void;
12
12
  maxPage: number;
13
- } & {
14
13
  formSaved: boolean;
15
- saved: (a: boolean) => void;
16
- });
14
+ setFormSaved: (isSaved: boolean) => void;
15
+ openConfirmDialog: () => void;
16
+ };
17
+ type FormBaseContextInitialValues = (PageLocks & FormBasePropsBlackList & ExtraFormOptions);
17
18
  type FormBaseContextProviderProps = FoodsFormBaseProps & {
18
19
  children: ReactNode;
20
+ openConfirmDialog: () => void;
19
21
  };
20
22
  export declare const FormBaseContextProvider: (props: FormBaseContextProviderProps) => import("react/jsx-runtime").JSX.Element;
21
23
  export declare const useFormBaseContext: () => FormBaseContextInitialValues;
@@ -1,2 +1,3 @@
1
1
  export { FoodsFormBase } from "./FoodsFormBase";
2
- export { useFormBaseContext } from "./FormBaseContext";
2
+ export type * from "./FoodsFormBase";
3
+ export { useFormBaseContext, FormBaseContextProvider } from "./FormBaseContext";