@overmap-ai/core 1.0.35 → 1.0.36-add-image-to-forms.1

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.
@@ -1,10 +1,13 @@
1
- /// <reference types="react" />
1
+ import { ChangeEvent } from "react";
2
+ import { FieldTypeIdentifier } from "../typings.ts";
2
3
  interface FieldActionsProps {
3
4
  index: number;
5
+ type: FieldTypeIdentifier;
4
6
  sectionIndex?: number;
5
7
  remove: () => void;
6
8
  duplicate: () => void;
7
9
  move: (direction: "up" | "down") => void;
10
+ upload?: (event: ChangeEvent<HTMLInputElement>) => void;
8
11
  }
9
12
  export declare const FieldActions: import("react").MemoExoticComponent<(props: FieldActionsProps) => import("react/jsx-runtime").JSX.Element>;
10
13
  export {};
@@ -0,0 +1,9 @@
1
+ import { Dispatch, SetStateAction } from "react";
2
+ interface FullScreenImagePreviewProps {
3
+ file: File;
4
+ url: string;
5
+ name: string;
6
+ setShowPreview: Dispatch<SetStateAction<boolean>>;
7
+ }
8
+ export declare const FullScreenImagePreview: import("react").MemoExoticComponent<(props: FullScreenImagePreviewProps) => import("react/jsx-runtime").JSX.Element>;
9
+ export {};
@@ -30,6 +30,7 @@ export declare abstract class BaseField<TValue extends FieldValue, TIdentifier e
30
30
  private readonly formValidators;
31
31
  private readonly fieldValidators;
32
32
  readonly label: string;
33
+ readonly image: File | Promise<File> | undefined;
33
34
  /**
34
35
  * By default, validation doesn't execute on `onChange` events when editing fields
35
36
  * until the field has been `touched`. This can be overridden by setting this to `false`
@@ -7,6 +7,7 @@ interface InputWithLabelProps {
7
7
  inputId: string;
8
8
  labelId: string;
9
9
  label: string;
10
+ image: File | Promise<File> | undefined;
10
11
  children: ReactNode;
11
12
  flexProps?: ComponentProps<typeof Flex>;
12
13
  }
@@ -19,6 +19,7 @@ export declare abstract class BaseSelectField<TValue extends FieldValue, TIdenti
19
19
  options: SelectFieldOption[];
20
20
  label: string;
21
21
  required: boolean;
22
+ image?: File | Promise<File> | undefined;
22
23
  description?: string | null | undefined;
23
24
  identifier: string;
24
25
  type: TIdentifier;
@@ -93,3 +93,6 @@ export declare const FieldTypeToEmptyFieldMapping: {
93
93
  required: boolean;
94
94
  };
95
95
  };
96
+ export declare const maxFileSizeMB = 50;
97
+ export declare const maxFileSizeKB: number;
98
+ export declare const maxFileSizeB: number;
@@ -25,6 +25,7 @@ export interface BaseSerializedObject<TIdentifier extends FieldTypeIdentifier =
25
25
  export interface BaseSerializedField<TIdentifier extends FieldTypeIdentifier = FieldTypeIdentifier> extends BaseSerializedObject<TIdentifier> {
26
26
  label: string;
27
27
  required: boolean;
28
+ image?: File | Promise<File>;
28
29
  }
29
30
  /** All the possible field values */
30
31
  export type FieldValue = string | number | boolean | string[] | SelectFieldOption[] | File[] | Date | Marker | null;
@@ -2,6 +2,8 @@ import { FormikErrors } from "formik";
2
2
  import { BaseFormElement, ISchema } from "./fields";
3
3
  import { Form } from "./typings";
4
4
  import { FormikUserFormRevision } from "./builder";
5
+ import { UserFormRevision } from "../typings";
5
6
  export declare const hasKeys: (errors: object) => boolean;
6
7
  export declare const validateForm: (schema: ISchema, form: Form | FormikUserFormRevision) => FormikErrors<Form> | FormikErrors<import('./builder/typings').NewForm> | undefined;
7
8
  export declare const initialFormValues: (fields: BaseFormElement[], values: Form) => Form;
9
+ export declare const useAttachImagesToFormRevisionFields: (revision: UserFormRevision) => UserFormRevision;