@overmap-ai/core 1.0.31-revamp-forms-builder.2 → 1.0.32

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 (45) hide show
  1. package/dist/forms/builder/FieldActions.d.ts +7 -8
  2. package/dist/forms/builder/FieldBuilder.d.ts +18 -5
  3. package/dist/forms/builder/FieldSectionWithActions.d.ts +2 -2
  4. package/dist/forms/builder/FieldWithActions.d.ts +1 -1
  5. package/dist/forms/builder/FieldsEditor.d.ts +1 -1
  6. package/dist/forms/builder/FormBuilder.d.ts +5 -1
  7. package/dist/forms/builder/constants.d.ts +1 -0
  8. package/dist/forms/builder/utils.d.ts +1 -13
  9. package/dist/forms/fields/BaseField/BaseField.d.ts +5 -15
  10. package/dist/forms/fields/BaseField/hooks.d.ts +1 -2
  11. package/dist/forms/fields/BaseField/layouts.d.ts +2 -7
  12. package/dist/forms/fields/BooleanField/BooleanField.d.ts +0 -6
  13. package/dist/forms/fields/CustomField/CustomField.d.ts +0 -6
  14. package/dist/forms/fields/DateField/DateField.d.ts +0 -6
  15. package/dist/forms/fields/FieldSection/FieldSection.d.ts +6 -12
  16. package/dist/forms/fields/MultiStringField/MultiStringField.d.ts +0 -8
  17. package/dist/forms/fields/NumberField/NumberField.d.ts +3 -18
  18. package/dist/forms/fields/SelectField/BaseSelectField.d.ts +1 -4
  19. package/dist/forms/fields/SelectField/MultiSelectField.d.ts +0 -7
  20. package/dist/forms/fields/SelectField/SelectField.d.ts +0 -7
  21. package/dist/forms/fields/StringOrTextFields/StringField/StringField.d.ts +0 -8
  22. package/dist/forms/fields/StringOrTextFields/StringOrTextField.d.ts +5 -8
  23. package/dist/forms/fields/StringOrTextFields/TextField/TextField.d.ts +0 -7
  24. package/dist/forms/fields/UploadField/UploadField.d.ts +1 -16
  25. package/dist/forms/fields/constants.d.ts +0 -75
  26. package/dist/forms/fields/typings.d.ts +1 -4
  27. package/dist/forms/fields/utils.d.ts +1 -3
  28. package/dist/forms/renderer/PatchForm/Field.d.ts +1 -3
  29. package/dist/forms/renderer/PatchForm/Provider.d.ts +1 -2
  30. package/dist/forms/utils.d.ts +1 -2
  31. package/dist/overmap-core.js +1191 -1492
  32. package/dist/overmap-core.js.map +1 -1
  33. package/dist/overmap-core.umd.cjs +1191 -1492
  34. package/dist/overmap-core.umd.cjs.map +1 -1
  35. package/dist/sdk/services/MainService.d.ts +1 -0
  36. package/dist/sdk/services/OrganizationService.d.ts +3 -1
  37. package/dist/sdk/services/ProjectService.d.ts +1 -0
  38. package/dist/store/slices/organizationAccessSlice.d.ts +1 -5
  39. package/dist/store/slices/organizationSlice.d.ts +1 -0
  40. package/dist/store/slices/projectSlice.d.ts +6 -1
  41. package/dist/style.css +0 -2
  42. package/dist/typings/models/organizations.d.ts +10 -0
  43. package/dist/typings/models/projects.d.ts +1 -0
  44. package/package.json +2 -2
  45. package/dist/forms/builder/componentConstants.d.ts +0 -8
@@ -1,13 +1,12 @@
1
1
  /// <reference types="react" />
2
- import { FieldTypeIdentifier } from "../typings.ts";
2
+ import { DraggableProvidedDragHandleProps } from "@hello-pangea/dnd";
3
+ import { FieldBuilderArgs } from "./FieldBuilder";
3
4
  interface FieldActionsProps {
4
- index: number;
5
- sectionIndex?: number;
6
- type: FieldTypeIdentifier;
7
5
  remove: () => void;
8
- duplicate: () => void;
9
- addAfter?: (type: FieldTypeIdentifier) => void;
10
- move: (direction: "up" | "down") => void;
6
+ dragHandleProps: DraggableProvidedDragHandleProps | null | undefined;
7
+ editProps: FieldBuilderArgs;
8
+ insertAfterProps: FieldBuilderArgs;
9
+ duplicateProps: FieldBuilderArgs;
11
10
  }
12
- export declare const FieldActions: import("react").MemoExoticComponent<(props: FieldActionsProps) => import("react/jsx-runtime").JSX.Element>;
11
+ export declare const FieldActions: import("react").NamedExoticComponent<FieldActionsProps>;
13
12
  export {};
@@ -1,10 +1,23 @@
1
- import { FC } from "react";
2
1
  import { NestedFieldPath } from "./typings";
3
- import { ISerializedField } from "../typings.ts";
4
- export interface FieldBuilderProps {
2
+ import { FC, Dispatch, SetStateAction } from "react";
3
+ import { FieldTypeIdentifier, Form, ISerializedField } from "../typings.ts";
4
+ interface FieldOptionsFormProps {
5
+ defaultField?: ISerializedField;
6
+ fieldType: FieldTypeIdentifier;
7
+ /** fields that can be used as a condition */
8
+ conditionalSourceFields?: ISerializedField[];
9
+ handleCancel: () => void;
10
+ handleDirtyChange: (dirty: boolean) => void;
11
+ handleCreateField: (form: Form) => void;
12
+ }
13
+ export interface FieldBuilderProps extends Pick<FieldOptionsFormProps, "conditionalSourceFields"> {
5
14
  index: number;
6
15
  parentPath: NestedFieldPath;
7
- initial: ISerializedField;
8
- conditionalSourceFields?: ISerializedField[];
16
+ isOpen: boolean;
17
+ setIsOpen: Dispatch<SetStateAction<boolean>>;
18
+ initial?: ISerializedField;
19
+ editing?: boolean;
9
20
  }
21
+ export type FieldBuilderArgs = Omit<FieldBuilderProps, "children" | "isOpen" | "setIsOpen">;
10
22
  export declare const FieldBuilder: FC<FieldBuilderProps>;
23
+ export {};
@@ -1,10 +1,10 @@
1
1
  /// <reference types="react" />
2
- import { SerializedFieldSection } from "../typings.ts";
3
2
  import { DropState } from "./DropDispatch";
3
+ import { SerializedFieldSection } from "../typings.ts";
4
4
  interface FieldSectionWithActionsProps {
5
5
  field: SerializedFieldSection;
6
6
  index: number;
7
7
  dropState: DropState;
8
8
  }
9
- export declare const FieldSectionWithActions: import("react").MemoExoticComponent<(props: FieldSectionWithActionsProps) => import("react/jsx-runtime").JSX.Element>;
9
+ export declare const FieldSectionWithActions: import("react").NamedExoticComponent<FieldSectionWithActionsProps>;
10
10
  export {};
@@ -7,5 +7,5 @@ interface FieldWithActionsProps {
7
7
  takenLabels: string[];
8
8
  remove: () => void;
9
9
  }
10
- export declare const FieldWithActions: import("react").MemoExoticComponent<(props: FieldWithActionsProps) => import("react/jsx-runtime").JSX.Element>;
10
+ export declare const FieldWithActions: import("react").NamedExoticComponent<FieldWithActionsProps>;
11
11
  export {};
@@ -1,2 +1,2 @@
1
1
  /// <reference types="react" />
2
- export declare const FieldsEditor: import("react").MemoExoticComponent<() => import("react/jsx-runtime").JSX.Element>;
2
+ export declare const FieldsEditor: import("react").NamedExoticComponent<object>;
@@ -1,11 +1,15 @@
1
- /// <reference types="react" />
2
1
  import { FormBuilderSaveHandler } from "./typings";
2
+ import { ReactNode } from "react";
3
3
  import { UserFormRevision } from "../../typings";
4
4
  interface FormBuilderProps {
5
5
  onCancel?: () => void;
6
6
  onSave: FormBuilderSaveHandler;
7
7
  /** A revision of an existing form to edit. To create a new form, pass `undefined`. */
8
8
  revision?: UserFormRevision;
9
+ /** A heading for the `FormBuilder`
10
+ * @default "Create a new form" or "Edit form" if `revision` is passed
11
+ */
12
+ heading?: ReactNode;
9
13
  }
10
14
  export declare const FormBuilder: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<FormBuilderProps & import("react").RefAttributes<HTMLDivElement>>>;
11
15
  export {};
@@ -0,0 +1 @@
1
+ export declare const formId = "form-builder";
@@ -1,7 +1,4 @@
1
1
  import { ISerializedField, SerializedFieldSection } from "../typings.ts";
2
- import { FormikUserFormRevision, NestedFieldPath } from "./typings";
3
- import { FormikHelpers } from "formik";
4
- import { DropState } from "./DropDispatch";
5
2
  import { ISerializedOnlyField } from "../fields";
6
3
  import { UserFormRevision } from "../../typings";
7
4
  export declare const emptySection: (id?: string, fields?: ISerializedOnlyField[]) => SerializedFieldSection;
@@ -13,14 +10,5 @@ export declare function remove<T>(list: T[], index: number): T[];
13
10
  export declare const makeIdentifier: (existing: unknown, label: string) => string;
14
11
  export declare const findFieldByIdentifier: (fields: ISerializedField[], identifier?: string) => ISerializedField | null;
15
12
  export declare const makeConditionalSourceFields: (sections: SerializedFieldSection[], index: number) => (import("../typings.ts").SerializedTextField | import("../typings.ts").SerializedBooleanField | import("../typings.ts").SerializedNumberField | import("../typings.ts").SerializedDateField | import("../typings.ts").SerializedStringField | import("../typings.ts").SerializedSelectField | import("../typings.ts").SerializedMultiStringField | import("../typings.ts").SerializedMultiSelectField | import("../typings.ts").SerializedUploadField)[];
16
- export declare const getTakenFieldLabels: (fields: SerializedFieldSection[]) => string[];
13
+ export declare const getTakenFieldLabels: (fields: ISerializedField[]) => string[];
17
14
  export declare const incrementFieldLabel: (label: string, takenLabels: string[]) => string;
18
- export type NewFieldInitialValues = Omit<ISerializedField, "identifier"> & {
19
- label: string;
20
- };
21
- export declare const createNewField: (parentPath: NestedFieldPath, index: number, initialValues: NewFieldInitialValues, values: FormikUserFormRevision, setFieldValue: FormikHelpers<unknown>["setFieldValue"]) => void;
22
- export declare const createNewEmptySection: (index: number, values: FormikUserFormRevision, setFieldValue: FormikHelpers<unknown>["setFieldValue"]) => void;
23
- export declare const useFieldReordering: () => {
24
- reorderSection: (dropState: DropState, sectionId: string, sectionIndex: number, destinationIndex: number, values: FormikUserFormRevision, setFieldValue: FormikHelpers<unknown>["setFieldValue"]) => void;
25
- reorderField: (srcSection: SerializedFieldSection | undefined, srcSectionIndex: string | number | undefined, srcFieldIndex: number, destSection: SerializedFieldSection | undefined, destSectionIndex: string | number | undefined, destFieldIndex: number, setFieldValue: FormikHelpers<unknown>["setFieldValue"]) => void;
26
- };
@@ -1,9 +1,8 @@
1
1
  import { ChangeEvent, ReactNode } from "react";
2
- import { AnyField, GetInputProps, ISerializedOnlyField, InputFieldLevelValidator, InputFormLevelValidator } from "../typings.ts";
3
- import { BaseSerializedField, BaseSerializedObject, FieldTypeIdentifier, FieldValue, Form, ISerializedField } from "../../typings";
4
- import { FieldSection } from "../FieldSection";
5
2
  import { FieldOptions } from "./typings";
6
- import { FormikUserFormRevision } from "../../builder";
3
+ import { BaseSerializedField, BaseSerializedObject, FieldTypeIdentifier, FieldValue, Form, ISerializedField } from "../../typings.ts";
4
+ import { AnyField, GetInputProps, InputFieldLevelValidator, InputFormLevelValidator, ISerializedOnlyField } from "../typings";
5
+ import { FieldSection } from "../FieldSection";
7
6
  export declare abstract class BaseFormElement<TIdentifier extends FieldTypeIdentifier = FieldTypeIdentifier> {
8
7
  readonly type: TIdentifier;
9
8
  protected readonly identifier: string;
@@ -14,15 +13,6 @@ export declare abstract class BaseFormElement<TIdentifier extends FieldTypeIdent
14
13
  static deserialize(_data: ISerializedField): AnyField | FieldSection;
15
14
  protected _serialize(): BaseSerializedObject<TIdentifier>;
16
15
  }
17
- export declare const emptyBaseField: {
18
- label: string;
19
- required: boolean;
20
- description: string;
21
- };
22
- export interface FieldCreationSchemaObject {
23
- field: AnyField;
24
- showDirectly: boolean;
25
- }
26
16
  export declare abstract class BaseField<TValue extends FieldValue, TIdentifier extends FieldTypeIdentifier = FieldTypeIdentifier> extends BaseFormElement<TIdentifier> {
27
17
  static readonly fieldTypeName: string;
28
18
  static readonly fieldTypeDescription: string;
@@ -38,10 +28,10 @@ export declare abstract class BaseField<TValue extends FieldValue, TIdentifier e
38
28
  */
39
29
  readonly onlyValidateAfterTouched: boolean;
40
30
  protected constructor(options: FieldOptions<TValue>);
41
- static getFieldCreationSchema(): FieldCreationSchemaObject[];
31
+ static getFieldCreationSchema(): AnyField[];
42
32
  protected isBlank(value: TValue | undefined): boolean;
43
33
  getValueFromChangeEvent(event: ChangeEvent<HTMLInputElement>): TValue;
44
- getError(value: TValue, allValues?: Form | FormikUserFormRevision): string | undefined;
34
+ getError(value: TValue, allValues?: Form): string | undefined;
45
35
  protected _serialize(): BaseSerializedField<TIdentifier>;
46
36
  abstract serialize(): ISerializedOnlyField;
47
37
  getFieldValidators(): InputFieldLevelValidator<TValue>[];
@@ -1,9 +1,8 @@
1
+ import { ValueOfField } from "../../typings.ts";
1
2
  import { FocusEventHandler } from "react";
2
3
  import { AnyField, ComponentProps } from "../typings.ts";
3
- import { ValueOfField } from "../../typings.ts";
4
4
  export declare const useFormikInput: <TField extends AnyField>(props: ComponentProps<TField>) => readonly [{
5
5
  readonly helpText: string | null;
6
- readonly size: import("@radix-ui/themes").Responsive<"1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9"> | undefined;
7
6
  readonly severity: "danger" | undefined;
8
7
  readonly inputId: string;
9
8
  readonly labelId: string;
@@ -1,8 +1,7 @@
1
+ import { Flex, Severity, ThemeOptions } from "@overmap-ai/blocks";
1
2
  import { ReactElement, ComponentProps, ReactNode } from "react";
2
- import { Flex, Severity, TextProps, ThemeOptions } from "@overmap-ai/blocks";
3
3
  export type Color = ThemeOptions["accentColor"];
4
4
  interface InputWithLabelProps {
5
- size: TextProps["size"];
6
5
  severity: Severity | undefined;
7
6
  inputId: string;
8
7
  labelId: string;
@@ -11,13 +10,9 @@ interface InputWithLabelProps {
11
10
  flexProps?: ComponentProps<typeof Flex>;
12
11
  }
13
12
  export declare const InputWithLabel: (props: InputWithLabelProps) => import("react/jsx-runtime").JSX.Element;
14
- interface InputWithHelpTextProps {
13
+ interface InputWithLabelAndHelpTextProps {
15
14
  severity: Severity | undefined;
16
15
  helpText: string | null;
17
- children: ReactElement;
18
- }
19
- export declare const InputWithHelpText: (props: InputWithHelpTextProps) => import("react/jsx-runtime").JSX.Element;
20
- interface InputWithLabelAndHelpTextProps extends InputWithHelpTextProps {
21
16
  children: ReactElement<InputWithLabelProps>;
22
17
  }
23
18
  export declare const InputWithLabelAndHelpText: (props: InputWithLabelAndHelpTextProps) => import("react/jsx-runtime").JSX.Element;
@@ -3,12 +3,6 @@ import { ChangeEvent, ReactNode } from "react";
3
3
  import { ComponentProps } from "../typings";
4
4
  import { CheckCircledIcon } from "@radix-ui/react-icons";
5
5
  import { ISerializedField, SerializedBooleanField } from "../../typings.ts";
6
- export declare const emptyBooleanField: {
7
- type: string;
8
- label: string;
9
- required: boolean;
10
- description: string;
11
- };
12
6
  export declare class BooleanField extends BaseField<boolean, "boolean"> {
13
7
  static readonly fieldTypeName = "Checkbox";
14
8
  static readonly fieldTypeDescription = "Perfect for both optional and required yes/no questions.";
@@ -3,12 +3,6 @@ import { FC, ReactNode } from "react";
3
3
  import { GetInputProps, ISerializedOnlyField } from "../typings";
4
4
  import { FieldTypeIdentifier, FieldValue } from "../../typings.ts";
5
5
  export type CustomFieldOptions<TValue> = ChildFieldOptions<TValue>;
6
- export declare const emptyCustomField: {
7
- type: string;
8
- label: string;
9
- required: boolean;
10
- description: string;
11
- };
12
6
  export declare class CustomField<TValue extends FieldValue,
13
7
  /** The options passed to constructor */
14
8
  TFieldOptions extends CustomFieldOptions<TValue>,
@@ -3,12 +3,6 @@ import { GetInputProps } from "../typings";
3
3
  import React from "react";
4
4
  import { CalendarIcon } from "@radix-ui/react-icons";
5
5
  import { ISerializedField, SerializedDateField } from "../../typings.ts";
6
- export declare const emptyDateField: {
7
- type: string;
8
- label: string;
9
- required: boolean;
10
- description: string;
11
- };
12
6
  export declare class DateField extends BaseField<string, "date"> {
13
7
  static readonly fieldTypeName = "Date";
14
8
  static readonly fieldTypeDescription = "Allows specifying a date.";
@@ -1,7 +1,7 @@
1
- import { AnyField, BaseFormElement, BooleanField, GetInputProps } from "../index";
2
- import { ReactNode } from "react";
1
+ import React from "react";
3
2
  import { BaseSerializedObject, Form, ISerializedField, SerializedCondition, SerializedFieldSection } from "../../typings.ts";
4
- import { FormikUserFormRevision } from "../../builder";
3
+ import { AnyField, GetInputProps } from "../typings.ts";
4
+ import { BaseFormElement } from "../BaseField";
5
5
  interface FieldSectionOptions extends Omit<BaseSerializedObject, "type"> {
6
6
  label?: string | null;
7
7
  conditional?: boolean;
@@ -15,19 +15,13 @@ export declare class FieldSection extends BaseFormElement<"section"> {
15
15
  readonly fields: AnyField[];
16
16
  readonly condition: SerializedCondition | null;
17
17
  constructor(options: FieldSectionOptions);
18
- static getFieldCreationSchema(options: ISerializedField[], parentPath?: string): ({
19
- field: BooleanField;
20
- showDirectly: boolean;
21
- } | {
22
- field: FieldSection;
23
- showDirectly: boolean;
24
- })[];
18
+ static getFieldCreationSchema(options: ISerializedField[]): BaseFormElement[];
25
19
  static deserialize(data: ISerializedField): FieldSection;
26
20
  conditional(): this is {
27
21
  condition: SerializedCondition;
28
22
  };
29
23
  serialize(): SerializedFieldSection;
30
- getErrors(allValues: Form | FormikUserFormRevision): Record<string, string>;
31
- getInput(props: GetInputProps<this>): ReactNode;
24
+ getErrors(allValues: Form): Record<string, string>;
25
+ getInput(props: GetInputProps<this>): React.ReactNode;
32
26
  }
33
27
  export {};
@@ -7,14 +7,6 @@ type MultiStringFieldOptions = ChildFieldOptions<SelectFieldOption[]> & {
7
7
  minimum_length?: number;
8
8
  maximum_length?: number;
9
9
  };
10
- export declare const emptyMultiStringField: {
11
- type: string;
12
- minimum_length: number;
13
- maximum_length: null;
14
- label: string;
15
- required: boolean;
16
- description: string;
17
- };
18
10
  /**
19
11
  * A field that lets the user input multiple strings. Each string must be unique. Useful for things like:
20
12
  * - Specifying the options of a SelectField (used in `SelectField.getFieldCreationSchema`
@@ -10,15 +10,6 @@ export interface NumberFieldOptions extends ChildFieldOptions<NumberFieldValue>
10
10
  minimum?: number;
11
11
  integers?: boolean;
12
12
  }
13
- export declare const emptyNumberField: {
14
- type: string;
15
- minimum: number;
16
- maximum: number;
17
- integers: boolean;
18
- label: string;
19
- required: boolean;
20
- description: string;
21
- };
22
13
  export declare class NumberField extends BaseField<NumberFieldValue, "number"> {
23
14
  static readonly fieldTypeName = "Number";
24
15
  static readonly fieldTypeDescription = "Allows specifying a number within a given range.";
@@ -28,15 +19,9 @@ export declare class NumberField extends BaseField<NumberFieldValue, "number"> {
28
19
  static Icon: typeof FontFamilyIcon;
29
20
  constructor(options: NumberFieldOptions);
30
21
  getValueFromChangeEvent(event: ChangeEvent<HTMLInputElement>): NumberFieldValue;
31
- static _validateMin: (path: string) => InputValidator<NumberFieldValue>;
32
- static _validateMax: (path: string) => InputValidator<NumberFieldValue>;
33
- static getFieldCreationSchema(parentPath?: string): ({
34
- field: NumberField;
35
- showDirectly: boolean;
36
- } | {
37
- field: BooleanField;
38
- showDirectly: boolean;
39
- })[];
22
+ static _validateMin: InputValidator<NumberFieldValue>;
23
+ static _validateMax: InputValidator<NumberFieldValue>;
24
+ static getFieldCreationSchema(): (BooleanField | NumberField)[];
40
25
  getFieldValidators(): InputFieldLevelValidator<NumberFieldValue>[];
41
26
  serialize(): SerializedNumberField;
42
27
  static deserialize(data: ISerializedField): NumberField;
@@ -23,8 +23,5 @@ export declare abstract class BaseSelectField<TValue extends FieldValue, TIdenti
23
23
  identifier: string;
24
24
  type: TIdentifier;
25
25
  };
26
- static getFieldCreationSchema(parentPath?: string): {
27
- field: MultiStringField;
28
- showDirectly: boolean;
29
- }[];
26
+ static getFieldCreationSchema(): MultiStringField[];
30
27
  }
@@ -7,13 +7,6 @@ import { ISerializedField, SelectFieldOptionValue, SerializedMultiSelectField }
7
7
  * The options passed to the constructor of MultiSelectField.
8
8
  */
9
9
  export type MultiSelectFieldOptions = Omit<BaseSelectFieldOptions<SelectFieldOptionValue[], "multi-select">, "type">;
10
- export declare const emptyMultiSelectField: {
11
- type: string;
12
- options: never[];
13
- label: string;
14
- required: boolean;
15
- description: string;
16
- };
17
10
  export declare class MultiSelectField extends BaseSelectField<SelectFieldOptionValue[], "multi-select"> {
18
11
  static readonly fieldTypeName = "Multi-select";
19
12
  static readonly fieldTypeDescription = "Allows the user to select a multiple options from a list of options.";
@@ -7,13 +7,6 @@ import { ISerializedField, SelectFieldOptionValue, SerializedSelectField } from
7
7
  * The options passed to the constructor of SelectField.
8
8
  */
9
9
  export type SelectFieldOptions = Omit<BaseSelectFieldOptions<SelectFieldOptionValue, "select">, "type">;
10
- export declare const emptySelectField: {
11
- type: string;
12
- options: never[];
13
- label: string;
14
- required: boolean;
15
- description: string;
16
- };
17
10
  export declare class SelectField extends BaseSelectField<SelectFieldOptionValue, "select"> {
18
11
  static readonly fieldTypeName = "Dropdown";
19
12
  static readonly fieldTypeDescription = "Allows the user to select a single option from a list of options.";
@@ -6,14 +6,6 @@ import { ISerializedField, SerializedStringField, StringInputType } from "../../
6
6
  export interface StringFieldOptions extends Omit<StringOrTextFieldOptions, "type"> {
7
7
  inputType?: StringInputType;
8
8
  }
9
- export declare const emptyStringField: {
10
- type: string;
11
- maximum_length: number;
12
- input_type: string;
13
- label: string;
14
- required: boolean;
15
- description: string;
16
- };
17
9
  export declare class StringField extends StringOrTextField<"string"> {
18
10
  static readonly fieldTypeName = "Short Text";
19
11
  static readonly fieldTypeDescription = "Short text fields can hold up to 500 characters on a single line.";
@@ -14,19 +14,16 @@ export declare abstract class StringOrTextField<TIdentifier extends "string" | "
14
14
  readonly maxLength: number;
15
15
  protected constructor(options: StringOrTextFieldOptions);
16
16
  /**
17
- * This function returns a function that validates that the value given for "minimum length" (when creating a new field) is less than or
17
+ * This function validates that the value given for "minimum length" (when creating a new field) is less than or
18
18
  * equal to the value given for "maximum length".
19
19
  */
20
- static _validateMin: (path: string) => InputValidator<NumberFieldValue>;
20
+ static _validateMin: InputValidator<NumberFieldValue>;
21
21
  /**
22
- * This function returns a function that validates that the value given for "maximum length" (when creating a new field) is greater than or
22
+ * This function validates that the value given for "maximum length" (when creating a new field) is greater than or
23
23
  * equal to the value given for "minimum length".
24
24
  */
25
- static _validateMax: (path: string) => InputValidator<NumberFieldValue>;
26
- static getFieldCreationSchema(parentPath?: string): {
27
- field: NumberField;
28
- showDirectly: boolean;
29
- }[];
25
+ static _validateMax: InputValidator<NumberFieldValue>;
26
+ static getFieldCreationSchema(): NumberField[];
30
27
  getFieldValidators(): InputFieldLevelValidator<string>[];
31
28
  protected _serialize(): SerializedStringOrTextField<TIdentifier>;
32
29
  }
@@ -4,13 +4,6 @@ import React from "react";
4
4
  import { RowsIcon } from "@radix-ui/react-icons";
5
5
  import { ISerializedField, SerializedTextField } from "../../../typings.ts";
6
6
  export type TextFieldOptions = Omit<StringOrTextFieldOptions, "type">;
7
- export declare const emptyTextField: {
8
- type: string;
9
- maximum_length: number;
10
- label: string;
11
- required: boolean;
12
- description: string;
13
- };
14
7
  export declare class TextField extends StringOrTextField<"text"> {
15
8
  static readonly fieldTypeName = "Paragraph";
16
9
  static readonly fieldTypeDescription = "Paragraph fields can hold up to 5000 characters and can have multiple lines.";
@@ -10,15 +10,6 @@ export interface UploadFieldOptions extends ChildFieldOptions<File[]> {
10
10
  maximum_size?: number | string;
11
11
  maximum_files?: number | string;
12
12
  }
13
- export declare const emptyUploadField: {
14
- type: string;
15
- extensions: never[];
16
- maximum_size: undefined;
17
- maximum_files: number;
18
- label: string;
19
- required: boolean;
20
- description: string;
21
- };
22
13
  export declare class UploadField extends BaseField<File[], "upload"> {
23
14
  static readonly fieldTypeName = "Upload";
24
15
  static readonly fieldTypeDescription = "Allows a file to be uploaded.";
@@ -30,13 +21,7 @@ export declare class UploadField extends BaseField<File[], "upload"> {
30
21
  constructor(options: UploadFieldOptions);
31
22
  getValueFromChangeEvent(event: ChangeEvent<HTMLInputElement>): File[];
32
23
  protected isBlank(value: File[]): boolean;
33
- static getFieldCreationSchema(parentPath?: string): ({
34
- field: NumberField;
35
- showDirectly: boolean;
36
- } | {
37
- field: MultiSelectField;
38
- showDirectly: boolean;
39
- })[];
24
+ static getFieldCreationSchema(): (NumberField | MultiSelectField)[];
40
25
  getFieldValidators(): InputFieldLevelValidator<File[]>[];
41
26
  serialize(): SerializedUploadField;
42
27
  static deserialize(data: ISerializedField): UploadField;
@@ -18,78 +18,3 @@ export declare const FieldTypeToClsMapping: {
18
18
  readonly "multi-string": typeof MultiStringField;
19
19
  readonly "multi-select": typeof MultiSelectField;
20
20
  };
21
- export declare const FieldTypeToEmptyFieldMapping: {
22
- readonly date: {
23
- type: string;
24
- label: string;
25
- required: boolean;
26
- description: string;
27
- };
28
- readonly number: {
29
- type: string;
30
- minimum: number;
31
- maximum: number;
32
- integers: boolean;
33
- label: string;
34
- required: boolean;
35
- description: string;
36
- };
37
- readonly boolean: {
38
- type: string;
39
- label: string;
40
- required: boolean;
41
- description: string;
42
- };
43
- readonly select: {
44
- type: string;
45
- options: never[];
46
- label: string;
47
- required: boolean;
48
- description: string;
49
- };
50
- readonly string: {
51
- type: string;
52
- maximum_length: number;
53
- input_type: string;
54
- label: string;
55
- required: boolean;
56
- description: string;
57
- };
58
- readonly text: {
59
- type: string;
60
- maximum_length: number;
61
- label: string;
62
- required: boolean;
63
- description: string;
64
- };
65
- readonly custom: {
66
- type: string;
67
- label: string;
68
- required: boolean;
69
- description: string;
70
- };
71
- readonly upload: {
72
- type: string;
73
- extensions: never[];
74
- maximum_size: undefined;
75
- maximum_files: number;
76
- label: string;
77
- required: boolean;
78
- description: string;
79
- };
80
- readonly "multi-string": {
81
- type: string;
82
- minimum_length: number;
83
- maximum_length: null;
84
- label: string;
85
- required: boolean;
86
- description: string;
87
- };
88
- readonly "multi-select": {
89
- type: string;
90
- options: never[];
91
- label: string;
92
- required: boolean;
93
- description: string;
94
- };
95
- };
@@ -1,8 +1,6 @@
1
1
  import { HTMLProps, ReactNode } from "react";
2
2
  import { BaseField, BaseFormElement } from "./BaseField";
3
3
  import { Form, ISerializedField, SerializedFieldSection } from "../typings.ts";
4
- import { TextProps } from "@overmap-ai/blocks";
5
- import { FormikUserFormRevision } from "../builder";
6
4
  export interface SchemaMeta {
7
5
  readonly: boolean;
8
6
  }
@@ -14,12 +12,11 @@ export interface ISchema {
14
12
  description?: ReactNode;
15
13
  }
16
14
  export type InputFieldLevelValidator<TValue> = (value: TValue | undefined) => string | null | undefined;
17
- export type InputFormLevelValidator<TValue> = (value: TValue | undefined, allValues: Form | FormikUserFormRevision) => string | null | undefined;
15
+ export type InputFormLevelValidator<TValue> = (value: TValue | undefined, allValues: Form) => string | null | undefined;
18
16
  export type InputValidator<TValue> = InputFieldLevelValidator<TValue> | InputFormLevelValidator<TValue>;
19
17
  export interface ComponentProps<TField extends BaseFormElement> extends Omit<HTMLProps<HTMLElement>, "color" | "size" | "ref" | "type" | "onChange" | "onBlur" | "value" | "defaultValue" | "name" | "dir"> {
20
18
  field: TField;
21
19
  formId: string;
22
- size?: TextProps["size"];
23
20
  }
24
21
  export type GetInputProps<TField extends BaseFormElement> = Omit<ComponentProps<TField>, "field">;
25
22
  export type AnyField = BaseField<any>;
@@ -1,8 +1,7 @@
1
1
  import { AnyField, ISchema, ISerializedOnlyField, SchemaMeta } from "./typings";
2
2
  import { FieldSection } from "./FieldSection";
3
- import { FieldValue, Form, ISerializedField, SerializedCondition } from "../typings.ts";
3
+ import { FieldValue, ISerializedField, SerializedCondition } from "../typings.ts";
4
4
  import { UserFormRevision } from "../../typings";
5
- import { FormikUserFormRevision } from "../builder";
6
5
  /** Deserializes anything but a FieldSection.
7
6
  * @see `deserialize` for most use cases
8
7
  */
@@ -12,5 +11,4 @@ export declare const deserialize: (serialized: ISerializedField) => AnyField | F
12
11
  export type PartialFormRevision = Pick<UserFormRevision, "title" | "fields" | "description"> & Partial<UserFormRevision>;
13
12
  export declare function formRevisionToSchema(formRevision: PartialFormRevision, meta?: Partial<SchemaMeta>): ISchema;
14
13
  export declare function valueIsFile(v: FieldValue | Promise<File>[] | undefined): v is File[] | Promise<File>[];
15
- export declare const valueIsFormikUserFormRevision: (form: FormikUserFormRevision | Form) => form is FormikUserFormRevision;
16
14
  export declare function isConditionMet<TValue extends FieldValue | Promise<File>[]>(condition: TValue extends FieldValue ? SerializedCondition<TValue> | null : null, value: TValue): boolean;
@@ -1,9 +1,7 @@
1
1
  import { ReactNode } from "react";
2
- import { FieldMetaProps } from "formik";
3
2
  import { FieldValue } from "../../typings.ts";
4
3
  interface RenderArgs {
5
4
  value: FieldValue;
6
- meta: FieldMetaProps<unknown>;
7
5
  /** Intermediate changes to the field value */
8
6
  setValue: (value: FieldValue) => void;
9
7
  /** EX: when the onBlur event is fired */
@@ -13,5 +11,5 @@ interface PatchFieldProps {
13
11
  name: string;
14
12
  render: (args: RenderArgs) => ReactNode;
15
13
  }
16
- export declare const PatchField: import("react").MemoExoticComponent<(props: PatchFieldProps) => ReactNode>;
14
+ export declare const PatchField: import("react").MemoExoticComponent<(props: PatchFieldProps) => import("react/jsx-runtime").JSX.Element>;
17
15
  export {};
@@ -2,7 +2,6 @@
2
2
  import { FormikErrors } from "formik";
3
3
  import { ISchema } from "../../fields";
4
4
  import { Form } from "../../typings.ts";
5
- import { NewForm } from "../../builder";
6
5
  interface PatchFormProviderProps {
7
6
  children: React.ReactNode;
8
7
  schema: ISchema;
@@ -17,7 +16,7 @@ interface PatchFormProviderProps {
17
16
  * @example ```js
18
17
  * {"field name": "error message"}
19
18
  * ``` */
20
- onError: (error: FormikErrors<Form | NewForm>) => void;
19
+ onError: (error: FormikErrors<Form>) => void;
21
20
  className?: string;
22
21
  }
23
22
  /** Use PatchForms to create patch edits to existing forms rather than editing the entire form. */
@@ -1,7 +1,6 @@
1
1
  import { FormikErrors } from "formik";
2
2
  import { BaseFormElement, ISchema } from "./fields";
3
3
  import { Form } from "./typings.ts";
4
- import { FormikUserFormRevision } from "./builder";
5
4
  export declare const hasKeys: (errors: object) => boolean;
6
- export declare const validateForm: (schema: ISchema, form: Form | FormikUserFormRevision) => FormikErrors<Form> | FormikErrors<import('./builder/typings.ts').NewForm> | undefined;
5
+ export declare const validateForm: (schema: ISchema, form: Form) => FormikErrors<Form> | undefined;
7
6
  export declare const initialFormValues: (fields: BaseFormElement[], values: Form) => Form;