@overmap-ai/core 1.0.27 → 1.0.28-integrate-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.
Files changed (91) hide show
  1. package/dist/contexts/sdk/globals.d.ts +4 -0
  2. package/dist/contexts/sdk/sdk.d.ts +1 -5
  3. package/dist/forms/builder/DropDispatch.d.ts +27 -0
  4. package/dist/forms/builder/FieldActions.d.ts +12 -0
  5. package/dist/forms/builder/FieldBuilder.d.ts +23 -0
  6. package/dist/forms/builder/FieldSectionWithActions.d.ts +10 -0
  7. package/dist/forms/builder/FieldWithActions.d.ts +11 -0
  8. package/dist/forms/builder/FieldsEditor.d.ts +2 -0
  9. package/dist/forms/builder/FormBuilder.d.ts +15 -0
  10. package/dist/forms/builder/constants.d.ts +1 -0
  11. package/dist/forms/builder/index.d.ts +2 -0
  12. package/dist/forms/builder/typings.d.ts +12 -0
  13. package/dist/forms/builder/utils.d.ts +14 -0
  14. package/dist/forms/fields/BaseField/BaseField.d.ts +39 -0
  15. package/dist/forms/fields/BaseField/hooks.d.ts +374 -0
  16. package/dist/forms/fields/BaseField/index.d.ts +4 -0
  17. package/dist/forms/fields/BaseField/layouts.d.ts +19 -0
  18. package/dist/forms/fields/BaseField/typings.d.ts +7 -0
  19. package/dist/forms/fields/BooleanField/BooleanField.d.ts +17 -0
  20. package/dist/forms/fields/BooleanField/BooleanInput.d.ts +4 -0
  21. package/dist/forms/fields/BooleanField/index.d.ts +2 -0
  22. package/dist/forms/fields/CustomField/CustomField.d.ts +18 -0
  23. package/dist/forms/fields/CustomField/FieldInputClonerField/FieldInputCloner.d.ts +8 -0
  24. package/dist/forms/fields/CustomField/FieldInputClonerField/FieldInputClonerField.d.ts +18 -0
  25. package/dist/forms/fields/CustomField/FieldInputClonerField/index.d.ts +3 -0
  26. package/dist/forms/fields/CustomField/FieldInputClonerField/typings.d.ts +5 -0
  27. package/dist/forms/fields/CustomField/index.d.ts +1 -0
  28. package/dist/forms/fields/DateField/DateField.d.ts +16 -0
  29. package/dist/forms/fields/DateField/DateInput.d.ts +4 -0
  30. package/dist/forms/fields/DateField/index.d.ts +2 -0
  31. package/dist/forms/fields/FieldSection/FieldSection.d.ts +27 -0
  32. package/dist/forms/fields/FieldSection/FieldSectionLayout.d.ts +7 -0
  33. package/dist/forms/fields/FieldSection/index.d.ts +1 -0
  34. package/dist/forms/fields/MultiStringField/MultiStringField.d.ts +30 -0
  35. package/dist/forms/fields/MultiStringField/MultiStringInput.d.ts +8 -0
  36. package/dist/forms/fields/MultiStringField/index.d.ts +2 -0
  37. package/dist/forms/fields/NumberField/NumberField.d.ts +29 -0
  38. package/dist/forms/fields/NumberField/NumberInput.d.ts +4 -0
  39. package/dist/forms/fields/NumberField/index.d.ts +2 -0
  40. package/dist/forms/fields/SelectField/BaseSelectField.d.ts +27 -0
  41. package/dist/forms/fields/SelectField/MultiSelectField.d.ts +20 -0
  42. package/dist/forms/fields/SelectField/MultiSelectInput.d.ts +4 -0
  43. package/dist/forms/fields/SelectField/SelectField.d.ts +19 -0
  44. package/dist/forms/fields/SelectField/SelectInput.d.ts +4 -0
  45. package/dist/forms/fields/SelectField/index.d.ts +4 -0
  46. package/dist/forms/fields/StringOrTextFields/StringField/StringField.d.ts +18 -0
  47. package/dist/forms/fields/StringOrTextFields/StringField/StringInput.d.ts +4 -0
  48. package/dist/forms/fields/StringOrTextFields/StringField/index.d.ts +2 -0
  49. package/dist/forms/fields/StringOrTextFields/StringOrTextField.d.ts +29 -0
  50. package/dist/forms/fields/StringOrTextFields/TextField/TextField.d.ts +15 -0
  51. package/dist/forms/fields/StringOrTextFields/TextField/TextInput.d.ts +4 -0
  52. package/dist/forms/fields/StringOrTextFields/TextField/index.d.ts +2 -0
  53. package/dist/forms/fields/StringOrTextFields/index.d.ts +2 -0
  54. package/dist/forms/fields/UploadField/UploadField.d.ts +29 -0
  55. package/dist/forms/fields/UploadField/UploadInput.d.ts +4 -0
  56. package/dist/forms/fields/UploadField/index.d.ts +2 -0
  57. package/dist/forms/fields/UploadField/utils.d.ts +1 -0
  58. package/dist/forms/fields/constants.d.ts +20 -0
  59. package/dist/forms/fields/hooks.d.ts +6 -0
  60. package/dist/forms/fields/index.d.ts +11 -0
  61. package/dist/forms/fields/typings.d.ts +23 -0
  62. package/dist/forms/fields/utils.d.ts +14 -0
  63. package/dist/forms/index.d.ts +4 -1
  64. package/dist/forms/renderer/FormBrowser/FormBrowser.d.ts +11 -0
  65. package/dist/forms/renderer/FormRenderer/FormRenderer.d.ts +29 -0
  66. package/dist/forms/renderer/FormSubmissionBrowser/FormSubmissionBrowser.d.ts +28 -0
  67. package/dist/forms/renderer/FormSubmissionViewer/FormSubmissionViewer.d.ts +17 -0
  68. package/dist/forms/renderer/PatchForm/Field.d.ts +15 -0
  69. package/dist/forms/renderer/PatchForm/Provider.d.ts +24 -0
  70. package/dist/forms/renderer/PatchForm/index.d.ts +2 -0
  71. package/dist/forms/renderer/index.d.ts +5 -0
  72. package/dist/forms/typings.d.ts +16 -0
  73. package/dist/forms/utils.d.ts +6 -0
  74. package/dist/index.d.ts +2 -0
  75. package/dist/overmap-core.js +4765 -104
  76. package/dist/overmap-core.js.map +1 -1
  77. package/dist/overmap-core.umd.cjs +4765 -94
  78. package/dist/overmap-core.umd.cjs.map +1 -1
  79. package/dist/sdk/classes/OutboxCoordinator.d.ts +1 -0
  80. package/dist/sdk/services/ComponentService.d.ts +4 -4
  81. package/dist/store/slices/categorySlice.d.ts +21 -21
  82. package/dist/store/slices/issueSlice.d.ts +19 -19
  83. package/dist/store/slices/organizationAccessSlice.d.ts +1 -1
  84. package/dist/store/slices/projectFileSlice.d.ts +20 -20
  85. package/dist/store/slices/userFormSlice.d.ts +10 -10
  86. package/dist/store/slices/workspaceSlice.d.ts +21 -21
  87. package/dist/store/store.d.ts +64 -63
  88. package/dist/style.css +34 -0
  89. package/dist/typings/models/store.d.ts +1 -0
  90. package/dist/utils/optimization.d.ts +2 -2
  91. package/package.json +11 -2
@@ -0,0 +1,17 @@
1
+ import { BaseField, ChildFieldOptions } from "../BaseField";
2
+ import { ChangeEvent, ReactNode } from "react";
3
+ import { ComponentProps } from "../typings";
4
+ import { CheckCircledIcon } from "@radix-ui/react-icons";
5
+ import { ISerializedField, SerializedBooleanField } from "../../typings.ts";
6
+ export declare class BooleanField extends BaseField<boolean, "boolean"> {
7
+ static readonly fieldTypeName = "Checkbox";
8
+ static readonly fieldTypeDescription = "Perfect for both optional and required yes/no questions.";
9
+ readonly onlyValidateAfterTouched = false;
10
+ static Icon: typeof CheckCircledIcon;
11
+ constructor(options: ChildFieldOptions<boolean>);
12
+ protected isBlank(value: boolean): boolean;
13
+ getValueFromChangeEvent(event: ChangeEvent<HTMLInputElement> | boolean): boolean;
14
+ serialize(): SerializedBooleanField;
15
+ static deserialize(data: ISerializedField): BooleanField;
16
+ getInput(props: ComponentProps<BooleanField>): ReactNode;
17
+ }
@@ -0,0 +1,4 @@
1
+ /// <reference types="react" />
2
+ import { BooleanField } from "./BooleanField";
3
+ import { ComponentProps } from "../typings.ts";
4
+ export declare const BooleanInput: import("react").NamedExoticComponent<ComponentProps<BooleanField>>;
@@ -0,0 +1,2 @@
1
+ export * from "./BooleanField";
2
+ export * from "./BooleanInput";
@@ -0,0 +1,18 @@
1
+ import { BaseField, ChildFieldOptions } from "../BaseField";
2
+ import { FC, ReactNode } from "react";
3
+ import { GetInputProps, ISerializedOnlyField } from "../typings";
4
+ import { FieldTypeIdentifier, FieldValue } from "../../typings.ts";
5
+ export type CustomFieldOptions<TValue> = ChildFieldOptions<TValue>;
6
+ export declare class CustomField<TValue extends FieldValue,
7
+ /** The options passed to constructor */
8
+ TFieldOptions extends CustomFieldOptions<TValue>,
9
+ /** The props passed to the custom component */
10
+ TComponentProps extends GetInputProps<CustomField<TValue, TFieldOptions, TComponentProps>>, TIdentifier extends FieldTypeIdentifier = FieldTypeIdentifier> extends BaseField<TValue, TIdentifier> {
11
+ static readonly fieldTypeName = "Custom";
12
+ static readonly fieldTypeDescription = "Allows re-rendering of field already in the form";
13
+ readonly Component: FC<TComponentProps>;
14
+ readonly options: TFieldOptions;
15
+ constructor(options: TFieldOptions, Component: FC<TComponentProps>);
16
+ serialize(): ISerializedOnlyField;
17
+ getInput(props: TComponentProps): ReactNode;
18
+ }
@@ -0,0 +1,8 @@
1
+ /// <reference types="react" />
2
+ import { FieldInputClonerProps } from "./typings.ts";
3
+ /**
4
+ * Used to dynamically "clone" a field's input for use in conditional sections. When a field is selected for a
5
+ * condition, we need to render the same input in the condition section, so the user can input a value for the
6
+ * condition.
7
+ */
8
+ export declare const FieldInputCloner: import("react").NamedExoticComponent<FieldInputClonerProps>;
@@ -0,0 +1,18 @@
1
+ import { CustomField, CustomFieldOptions } from "../CustomField";
2
+ import { FieldInputClonerProps } from "./index";
3
+ import { FieldValue, ISerializedField } from "../../../typings.ts";
4
+ export interface FieldInputClonerFieldOptions extends CustomFieldOptions<unknown> {
5
+ /** Given an identifier, should return the options of the field with the
6
+ * corresponding identifier (the field being cloned) */
7
+ getFieldToClone: (identifier: string) => ISerializedField | null;
8
+ /** The identifier of the field to clone */
9
+ clonedFieldIdentifier: string;
10
+ }
11
+ /**
12
+ * The purpose of this is to display a value input field in the condition of a section. The input field will look like
13
+ * the input field of the condition. For example, when specifying the conditional value of a SelectField, a SelectInput
14
+ * will be rendered.
15
+ */
16
+ export declare class FieldInputClonerField extends CustomField<FieldValue, FieldInputClonerFieldOptions, FieldInputClonerProps> {
17
+ constructor(options: FieldInputClonerFieldOptions);
18
+ }
@@ -0,0 +1,3 @@
1
+ export * from "./FieldInputCloner";
2
+ export * from "./FieldInputClonerField";
3
+ export * from "./typings";
@@ -0,0 +1,5 @@
1
+ import { AnyField, ComponentProps, GetInputProps } from "../../typings";
2
+ import { CustomField } from "../CustomField";
3
+ import { FieldInputClonerFieldOptions } from "./FieldInputClonerField";
4
+ import { FieldValue } from "../../../typings.ts";
5
+ export type FieldInputClonerProps = ComponentProps<CustomField<FieldValue, FieldInputClonerFieldOptions, GetInputProps<AnyField>>>;
@@ -0,0 +1 @@
1
+ export * from "./CustomField";
@@ -0,0 +1,16 @@
1
+ import { BaseField, ChildFieldOptions } from "../BaseField";
2
+ import { GetInputProps } from "../typings";
3
+ import React from "react";
4
+ import { CalendarIcon } from "@radix-ui/react-icons";
5
+ import { ISerializedField, SerializedDateField } from "../../typings.ts";
6
+ export declare class DateField extends BaseField<string, "date"> {
7
+ static readonly fieldTypeName = "Date";
8
+ static readonly fieldTypeDescription = "Allows specifying a date.";
9
+ static Icon: typeof CalendarIcon;
10
+ readonly onlyValidateAfterTouched = false;
11
+ constructor(options: ChildFieldOptions<string>);
12
+ serialize(): SerializedDateField;
13
+ getValueFromChangeEvent(event: React.ChangeEvent<HTMLInputElement>): string;
14
+ static deserialize(data: ISerializedField): DateField;
15
+ getInput(props: GetInputProps<this>): React.ReactNode;
16
+ }
@@ -0,0 +1,4 @@
1
+ /// <reference types="react" />
2
+ import { DateField } from "./DateField";
3
+ import { ComponentProps } from "../typings.ts";
4
+ export declare const DateInput: import("react").NamedExoticComponent<ComponentProps<DateField>>;
@@ -0,0 +1,2 @@
1
+ export * from "./DateField";
2
+ export * from "./DateInput";
@@ -0,0 +1,27 @@
1
+ import React from "react";
2
+ import { BaseSerializedObject, Form, ISerializedField, SerializedCondition, SerializedFieldSection } from "../../typings.ts";
3
+ import { AnyField, GetInputProps } from "../typings.ts";
4
+ import { BaseFormElement } from "../BaseField";
5
+ interface FieldSectionOptions extends Omit<BaseSerializedObject, "type"> {
6
+ label?: string | null;
7
+ conditional?: boolean;
8
+ condition?: SerializedCondition | null;
9
+ fields: AnyField[];
10
+ }
11
+ export declare class FieldSection extends BaseFormElement<"section"> {
12
+ static readonly fieldTypeName = "Section";
13
+ static readonly fieldTypeDescription = "Sections can be useful for grouping fields together. They can also be conditionally shown or hidden.";
14
+ readonly label: string | null;
15
+ readonly fields: AnyField[];
16
+ readonly condition: SerializedCondition | null;
17
+ constructor(options: FieldSectionOptions);
18
+ static getFieldCreationSchema(options: ISerializedField[]): BaseFormElement[];
19
+ static deserialize(data: ISerializedField): FieldSection;
20
+ conditional(): this is {
21
+ condition: SerializedCondition;
22
+ };
23
+ serialize(): SerializedFieldSection;
24
+ getErrors(allValues: Form): Record<string, string>;
25
+ getInput(props: GetInputProps<this>): React.ReactNode;
26
+ }
27
+ export {};
@@ -0,0 +1,7 @@
1
+ /// <reference types="react" />
2
+ import { FieldSection } from ".";
3
+ import { ComponentProps } from "../typings.ts";
4
+ /**
5
+ * Used by FieldSection to render a section of fields.
6
+ */
7
+ export declare const FieldSectionLayout: import("react").NamedExoticComponent<ComponentProps<FieldSection>>;
@@ -0,0 +1 @@
1
+ export * from "./FieldSection";
@@ -0,0 +1,30 @@
1
+ import { BaseField, ChildFieldOptions } from "../BaseField";
2
+ import { GetInputProps, InputFieldLevelValidator } from "../typings.ts";
3
+ import { ChangeEvent, ReactNode } from "react";
4
+ import { ListBulletIcon } from "@radix-ui/react-icons";
5
+ import { ISerializedField, SelectFieldOption, SerializedMultiStringField } from "../../typings.ts";
6
+ type MultiStringFieldOptions = ChildFieldOptions<SelectFieldOption[]> & {
7
+ minimum_length?: number;
8
+ maximum_length?: number;
9
+ };
10
+ /**
11
+ * A field that lets the user input multiple strings. Each string must be unique. Useful for things like:
12
+ * - Specifying the options of a SelectField (used in `SelectField.getFieldCreationSchema`
13
+ * - Listing serial numbers and similar
14
+ */
15
+ export declare class MultiStringField extends BaseField<SelectFieldOption[], "multi-string"> {
16
+ static readonly fieldTypeName = "Multi-string";
17
+ static readonly fieldTypeDescription = "Allows the user to provide multiple unique strings.";
18
+ readonly minLength: number;
19
+ readonly maxLength: number;
20
+ readonly onlyValidateAfterTouched = false;
21
+ static Icon: typeof ListBulletIcon;
22
+ constructor(options: MultiStringFieldOptions);
23
+ getValueFromChangeEvent(event: ChangeEvent<HTMLInputElement> | SelectFieldOption[]): SelectFieldOption[];
24
+ getInput(props: GetInputProps<this>): ReactNode;
25
+ serialize(): SerializedMultiStringField;
26
+ protected isBlank(value: SelectFieldOption[]): boolean;
27
+ getFieldValidators(): InputFieldLevelValidator<SelectFieldOption[]>[];
28
+ static deserialize(data: ISerializedField): MultiStringField;
29
+ }
30
+ export {};
@@ -0,0 +1,8 @@
1
+ import { ComponentProps } from "../typings.ts";
2
+ import React from "react";
3
+ import { MultiStringField } from "./MultiStringField.tsx";
4
+ /**
5
+ * Allows the user to create an array of unique strings and customize the order.
6
+ * User to generate options for the Select field.
7
+ */
8
+ export declare const MultiStringInput: React.NamedExoticComponent<ComponentProps<MultiStringField>>;
@@ -0,0 +1,2 @@
1
+ export * from "./MultiStringField";
2
+ export * from "./MultiStringInput";
@@ -0,0 +1,29 @@
1
+ import { BooleanField } from "../BooleanField";
2
+ import { BaseField, ChildFieldOptions } from "../BaseField";
3
+ import { GetInputProps, InputFieldLevelValidator, InputValidator } from "../typings";
4
+ import { ChangeEvent, ReactNode } from "react";
5
+ import { FontFamilyIcon } from "@radix-ui/react-icons";
6
+ import { ISerializedField, SerializedNumberField } from "../../typings.ts";
7
+ export type NumberFieldValue = number | "";
8
+ export interface NumberFieldOptions extends ChildFieldOptions<NumberFieldValue> {
9
+ maximum?: number;
10
+ minimum?: number;
11
+ integers?: boolean;
12
+ }
13
+ export declare class NumberField extends BaseField<NumberFieldValue, "number"> {
14
+ static readonly fieldTypeName = "Number";
15
+ static readonly fieldTypeDescription = "Allows specifying a number within a given range.";
16
+ readonly minimum: number | undefined;
17
+ readonly maximum: number | undefined;
18
+ readonly integers: boolean;
19
+ static Icon: typeof FontFamilyIcon;
20
+ constructor(options: NumberFieldOptions);
21
+ getValueFromChangeEvent(event: ChangeEvent<HTMLInputElement>): NumberFieldValue;
22
+ static _validateMin: InputValidator<NumberFieldValue>;
23
+ static _validateMax: InputValidator<NumberFieldValue>;
24
+ static getFieldCreationSchema(): (BooleanField | NumberField)[];
25
+ getFieldValidators(): InputFieldLevelValidator<NumberFieldValue>[];
26
+ serialize(): SerializedNumberField;
27
+ static deserialize(data: ISerializedField): NumberField;
28
+ getInput(props: GetInputProps<this>): ReactNode;
29
+ }
@@ -0,0 +1,4 @@
1
+ /// <reference types="react" />
2
+ import { NumberField } from ".";
3
+ import { ComponentProps } from "../typings.ts";
4
+ export declare const NumberInput: import("react").NamedExoticComponent<ComponentProps<NumberField>>;
@@ -0,0 +1,2 @@
1
+ export * from "./NumberField";
2
+ export * from "./NumberInput";
@@ -0,0 +1,27 @@
1
+ import { BaseField, ChildFieldOptions } from "../BaseField";
2
+ import { FieldValue, SelectFieldOption } from "../../typings.ts";
3
+ import { MultiStringField } from "../MultiStringField";
4
+ /**
5
+ * The options passed to the constructor of SelectField.
6
+ */
7
+ export interface BaseSelectFieldOptions<TValue, TIdentifier extends "select" | "multi-select"> extends ChildFieldOptions<TValue> {
8
+ /** When instantiating a SelectField, you can either pass an array of strings or an array of objects. User-created
9
+ * forms only support arrays of strings. For more complex internal purposes, you can provide an array of objects
10
+ * where the `label` is the text to display to the user and the `value` is the value handled by Formik.*/
11
+ options: string[] | SelectFieldOption[];
12
+ type: TIdentifier;
13
+ }
14
+ export declare abstract class BaseSelectField<TValue extends FieldValue, TIdentifier extends "select" | "multi-select"> extends BaseField<TValue, TIdentifier> {
15
+ readonly options: SelectFieldOption[];
16
+ readonly onlyValidateAfterTouched = false;
17
+ protected constructor(options: BaseSelectFieldOptions<TValue, TIdentifier>);
18
+ protected _serialize(): {
19
+ options: SelectFieldOption[];
20
+ label: string;
21
+ required: boolean;
22
+ description?: string | null | undefined;
23
+ identifier: string;
24
+ type: TIdentifier;
25
+ };
26
+ static getFieldCreationSchema(): MultiStringField[];
27
+ }
@@ -0,0 +1,20 @@
1
+ import { ReactNode } from "react";
2
+ import { GetInputProps } from "../typings";
3
+ import { BaseSelectField, BaseSelectFieldOptions } from "./BaseSelectField";
4
+ import { CheckboxIcon } from "@radix-ui/react-icons";
5
+ import { ISerializedField, SelectFieldOptionValue, SerializedMultiSelectField } from "../../typings.ts";
6
+ /**
7
+ * The options passed to the constructor of MultiSelectField.
8
+ */
9
+ export type MultiSelectFieldOptions = Omit<BaseSelectFieldOptions<SelectFieldOptionValue[], "multi-select">, "type">;
10
+ export declare class MultiSelectField extends BaseSelectField<SelectFieldOptionValue[], "multi-select"> {
11
+ static readonly fieldTypeName = "Multi-select";
12
+ static readonly fieldTypeDescription = "Allows the user to select a multiple options from a list of options.";
13
+ static Icon: typeof CheckboxIcon;
14
+ constructor(options: MultiSelectFieldOptions);
15
+ getValueFromChangeEvent(event: React.ChangeEvent<HTMLInputElement> | string[]): string[];
16
+ protected isBlank(value: SelectFieldOptionValue[]): boolean;
17
+ serialize(): SerializedMultiSelectField;
18
+ static deserialize(data: ISerializedField): MultiSelectField;
19
+ getInput(props: GetInputProps<this>): ReactNode;
20
+ }
@@ -0,0 +1,4 @@
1
+ /// <reference types="react" />
2
+ import { ComponentProps } from "../typings";
3
+ import { MultiSelectField } from "./MultiSelectField";
4
+ export declare const MultiSelectInput: import("react").NamedExoticComponent<ComponentProps<MultiSelectField>>;
@@ -0,0 +1,19 @@
1
+ import { ChangeEvent, ReactNode } from "react";
2
+ import { GetInputProps } from "../typings";
3
+ import { BaseSelectField, BaseSelectFieldOptions } from "./BaseSelectField";
4
+ import { DropdownMenuIcon } from "@radix-ui/react-icons";
5
+ import { ISerializedField, SelectFieldOptionValue, SerializedSelectField } from "../../typings.ts";
6
+ /**
7
+ * The options passed to the constructor of SelectField.
8
+ */
9
+ export type SelectFieldOptions = Omit<BaseSelectFieldOptions<SelectFieldOptionValue, "select">, "type">;
10
+ export declare class SelectField extends BaseSelectField<SelectFieldOptionValue, "select"> {
11
+ static readonly fieldTypeName = "Dropdown";
12
+ static readonly fieldTypeDescription = "Allows the user to select a single option from a list of options.";
13
+ static Icon: typeof DropdownMenuIcon;
14
+ constructor(options: SelectFieldOptions);
15
+ getValueFromChangeEvent(event: ChangeEvent<HTMLInputElement> | string): SelectFieldOptionValue;
16
+ serialize(): SerializedSelectField;
17
+ static deserialize(data: ISerializedField): SelectField;
18
+ getInput(props: GetInputProps<this>): ReactNode;
19
+ }
@@ -0,0 +1,4 @@
1
+ /// <reference types="react" />
2
+ import { ComponentProps } from "../typings";
3
+ import { SelectField } from "./SelectField";
4
+ export declare const SelectInput: import("react").NamedExoticComponent<ComponentProps<SelectField>>;
@@ -0,0 +1,4 @@
1
+ export * from "./SelectField";
2
+ export * from "./SelectInput";
3
+ export * from "./MultiSelectInput";
4
+ export * from "./MultiSelectField";
@@ -0,0 +1,18 @@
1
+ import { StringOrTextField, StringOrTextFieldOptions } from "../StringOrTextField";
2
+ import { GetInputProps } from "../../typings";
3
+ import React from "react";
4
+ import { InputIcon } from "@radix-ui/react-icons";
5
+ import { ISerializedField, SerializedStringField, StringInputType } from "../../../typings.ts";
6
+ export interface StringFieldOptions extends Omit<StringOrTextFieldOptions, "type"> {
7
+ inputType?: StringInputType;
8
+ }
9
+ export declare class StringField extends StringOrTextField<"string"> {
10
+ static readonly fieldTypeName = "Short Text";
11
+ static readonly fieldTypeDescription = "Short text fields can hold up to 500 characters on a single line.";
12
+ readonly inputType: StringInputType;
13
+ static Icon: typeof InputIcon;
14
+ constructor(options: StringFieldOptions);
15
+ serialize(): SerializedStringField;
16
+ static deserialize(data: ISerializedField): StringField;
17
+ getInput(props: GetInputProps<this>): React.ReactNode;
18
+ }
@@ -0,0 +1,4 @@
1
+ /// <reference types="react" />
2
+ import { StringField } from "./StringField";
3
+ import { ComponentProps } from "../../typings.ts";
4
+ export declare const StringInput: import("react").NamedExoticComponent<ComponentProps<StringField>>;
@@ -0,0 +1,2 @@
1
+ export * from "./StringField";
2
+ export * from "./StringInput";
@@ -0,0 +1,29 @@
1
+ import { NumberField, NumberFieldValue } from "../NumberField";
2
+ import { BaseField, FieldOptions } from "../BaseField";
3
+ import { InputFieldLevelValidator, InputValidator } from "../typings.ts";
4
+ import { SerializedStringField } from "../../typings.ts";
5
+ export interface StringOrTextFieldOptions extends FieldOptions<string> {
6
+ minLength?: NumberFieldValue;
7
+ maxLength?: NumberFieldValue;
8
+ }
9
+ export type SerializedStringOrTextField<TIdentifier extends "string" | "text"> = Omit<SerializedStringField, "type"> & {
10
+ type: TIdentifier;
11
+ };
12
+ export declare abstract class StringOrTextField<TIdentifier extends "string" | "text"> extends BaseField<string, TIdentifier> {
13
+ readonly minLength?: number;
14
+ readonly maxLength: number;
15
+ protected constructor(options: StringOrTextFieldOptions);
16
+ /**
17
+ * This function validates that the value given for "minimum length" (when creating a new field) is less than or
18
+ * equal to the value given for "maximum length".
19
+ */
20
+ static _validateMin: InputValidator<NumberFieldValue>;
21
+ /**
22
+ * This function validates that the value given for "maximum length" (when creating a new field) is greater than or
23
+ * equal to the value given for "minimum length".
24
+ */
25
+ static _validateMax: InputValidator<NumberFieldValue>;
26
+ static getFieldCreationSchema(): NumberField[];
27
+ getFieldValidators(): InputFieldLevelValidator<string>[];
28
+ protected _serialize(): SerializedStringOrTextField<TIdentifier>;
29
+ }
@@ -0,0 +1,15 @@
1
+ import { StringOrTextField, StringOrTextFieldOptions } from "../StringOrTextField";
2
+ import { GetInputProps } from "../../typings";
3
+ import React from "react";
4
+ import { RowsIcon } from "@radix-ui/react-icons";
5
+ import { ISerializedField, SerializedTextField } from "../../../typings.ts";
6
+ export type TextFieldOptions = Omit<StringOrTextFieldOptions, "type">;
7
+ export declare class TextField extends StringOrTextField<"text"> {
8
+ static readonly fieldTypeName = "Paragraph";
9
+ static readonly fieldTypeDescription = "Paragraph fields can hold up to 5000 characters and can have multiple lines.";
10
+ static Icon: typeof RowsIcon;
11
+ constructor(options: TextFieldOptions);
12
+ serialize(): SerializedTextField;
13
+ static deserialize(data: ISerializedField): TextField;
14
+ getInput(props: GetInputProps<this>): React.ReactNode;
15
+ }
@@ -0,0 +1,4 @@
1
+ /// <reference types="react" />
2
+ import { TextField } from "./TextField";
3
+ import { ComponentProps } from "../../typings.ts";
4
+ export declare const TextInput: import("react").NamedExoticComponent<ComponentProps<TextField>>;
@@ -0,0 +1,2 @@
1
+ export * from "./TextField";
2
+ export * from "./TextInput";
@@ -0,0 +1,2 @@
1
+ export * from "./StringField";
2
+ export * from "./TextField";
@@ -0,0 +1,29 @@
1
+ import { BaseField, ChildFieldOptions } from "../BaseField";
2
+ import { GetInputProps, InputFieldLevelValidator } from "../typings";
3
+ import { ChangeEvent, ReactNode } from "react";
4
+ import { UploadIcon } from "@radix-ui/react-icons";
5
+ import { NumberField } from "../NumberField";
6
+ import { MultiSelectField } from "../SelectField";
7
+ import { ISerializedField, SerializedUploadField } from "../../typings.ts";
8
+ export interface UploadFieldOptions extends ChildFieldOptions<File[]> {
9
+ extensions?: string[];
10
+ maximum_size?: number | string;
11
+ maximum_files?: number | string;
12
+ }
13
+ export declare class UploadField extends BaseField<File[], "upload"> {
14
+ static readonly fieldTypeName = "Upload";
15
+ static readonly fieldTypeDescription = "Allows a file to be uploaded.";
16
+ readonly extensions?: string[];
17
+ readonly maxFileSize: number | undefined;
18
+ readonly maxFiles: number;
19
+ readonly onlyValidateAfterTouched = false;
20
+ static Icon: typeof UploadIcon;
21
+ constructor(options: UploadFieldOptions);
22
+ getValueFromChangeEvent(event: ChangeEvent<HTMLInputElement>): File[];
23
+ protected isBlank(value: File[]): boolean;
24
+ static getFieldCreationSchema(): (NumberField | MultiSelectField)[];
25
+ getFieldValidators(): InputFieldLevelValidator<File[]>[];
26
+ serialize(): SerializedUploadField;
27
+ static deserialize(data: ISerializedField): UploadField;
28
+ getInput(props: GetInputProps<this>): ReactNode;
29
+ }
@@ -0,0 +1,4 @@
1
+ /// <reference types="react" />
2
+ import { UploadField } from "./UploadField";
3
+ import { ComponentProps } from "../typings.ts";
4
+ export declare const NumberInput: import("react").NamedExoticComponent<ComponentProps<UploadField>>;
@@ -0,0 +1,2 @@
1
+ export * from "./UploadField";
2
+ export * from "./UploadInput";
@@ -0,0 +1 @@
1
+ export declare const convertKilobytesToLargestUnit: (kilobytes: number) => string;
@@ -0,0 +1,20 @@
1
+ import { StringField, TextField } from "./StringOrTextFields";
2
+ import { BooleanField } from "./BooleanField";
3
+ import { DateField } from "./DateField";
4
+ import { NumberField } from "./NumberField";
5
+ import { MultiSelectField, SelectField } from "./SelectField";
6
+ import { CustomField } from "./CustomField";
7
+ import { MultiStringField } from "./MultiStringField";
8
+ import { UploadField } from "./UploadField";
9
+ export declare const FieldTypeToClsMapping: {
10
+ readonly date: typeof DateField;
11
+ readonly number: typeof NumberField;
12
+ readonly boolean: typeof BooleanField;
13
+ readonly select: typeof SelectField;
14
+ readonly string: typeof StringField;
15
+ readonly text: typeof TextField;
16
+ readonly custom: typeof CustomField;
17
+ readonly upload: typeof UploadField;
18
+ readonly "multi-string": typeof MultiStringField;
19
+ readonly "multi-select": typeof MultiSelectField;
20
+ };
@@ -0,0 +1,6 @@
1
+ import { GetInputProps } from "./typings";
2
+ import { ReactNode } from "react";
3
+ import { BaseField, BaseFormElement } from "./BaseField";
4
+ import { FieldValue } from "../typings.ts";
5
+ export declare const useFieldInput: <TField extends BaseFormElement<import("../typings.ts").FieldTypeIdentifier> | null>(field: TField, props: TField extends BaseFormElement ? GetInputProps<TField> : null) => ReactNode;
6
+ export declare const useFieldInputs: (fields: BaseFormElement[], props: GetInputProps<BaseField<FieldValue>>) => ReactNode;
@@ -0,0 +1,11 @@
1
+ export * from "./BaseField";
2
+ export * from "./NumberField";
3
+ export * from "./DateField";
4
+ export * from "./StringOrTextFields";
5
+ export * from "./BooleanField";
6
+ export * from "./SelectField";
7
+ export * from "./MultiStringField";
8
+ export * from "./FieldSection";
9
+ export * from "./utils";
10
+ export * from "./hooks";
11
+ export type * from "./typings";
@@ -0,0 +1,23 @@
1
+ import { HTMLProps, ReactNode } from "react";
2
+ import { BaseField, BaseFormElement } from "./BaseField";
3
+ import { Form, ISerializedField, SerializedFieldSection } from "../typings.ts";
4
+ export interface SchemaMeta {
5
+ readonly: boolean;
6
+ }
7
+ export interface ISchema {
8
+ id?: string;
9
+ fields: BaseFormElement[];
10
+ meta: SchemaMeta;
11
+ title: ReactNode;
12
+ description?: ReactNode;
13
+ }
14
+ export type InputFieldLevelValidator<TValue> = (value: TValue | undefined) => string | null | undefined;
15
+ export type InputFormLevelValidator<TValue> = (value: TValue | undefined, allValues: Form) => string | null | undefined;
16
+ export type InputValidator<TValue> = InputFieldLevelValidator<TValue> | InputFormLevelValidator<TValue>;
17
+ export interface ComponentProps<TField extends BaseFormElement> extends Omit<HTMLProps<HTMLElement>, "color" | "size" | "ref" | "type" | "onChange" | "onBlur" | "value" | "defaultValue" | "name" | "dir"> {
18
+ field: TField;
19
+ formId: string;
20
+ }
21
+ export type GetInputProps<TField extends BaseFormElement> = Omit<ComponentProps<TField>, "field">;
22
+ export type AnyField = BaseField<any>;
23
+ export type ISerializedOnlyField = Exclude<ISerializedField, SerializedFieldSection>;
@@ -0,0 +1,14 @@
1
+ import { AnyField, ISchema, ISerializedOnlyField, SchemaMeta } from "./typings";
2
+ import { FieldSection } from "./FieldSection";
3
+ import { FieldValue, ISerializedField, SerializedCondition } from "../typings.ts";
4
+ import { UserFormRevision } from "../../typings";
5
+ /** Deserializes anything but a FieldSection.
6
+ * @see `deserialize` for most use cases
7
+ */
8
+ export declare const deserializeField: (serializedField: ISerializedOnlyField) => AnyField;
9
+ /** Deserializes anything */
10
+ export declare const deserialize: (serialized: ISerializedField) => AnyField | FieldSection;
11
+ export type PartialFormRevision = Pick<UserFormRevision, "title" | "fields" | "description"> & Partial<UserFormRevision>;
12
+ export declare function formRevisionToSchema(formRevision: PartialFormRevision, meta?: Partial<SchemaMeta>): ISchema;
13
+ export declare function valueIsFile(v: FieldValue | Promise<File>[] | undefined): v is File[] | Promise<File>[];
14
+ export declare function isConditionMet<TValue extends FieldValue | Promise<File>[]>(condition: TValue extends FieldValue ? SerializedCondition<TValue> | null : null, value: TValue): boolean;
@@ -1 +1,4 @@
1
- export * from "./typings";
1
+ export type * from "./typings";
2
+ export * from "./builder";
3
+ export * from "./fields";
4
+ export * from "./renderer";
@@ -0,0 +1,11 @@
1
+ /// <reference types="react" />
2
+ import { CachedUserForm } from "../../../typings";
3
+ interface FormBrowserProps {
4
+ /** If `true`, the user can toggle the favorite state of the forms they have access to */
5
+ isFavoriteEditable?: boolean;
6
+ onSelectForm: (form: CachedUserForm) => void;
7
+ /** @default 20 */
8
+ maxResults?: number;
9
+ }
10
+ export declare const FormBrowser: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<FormBrowserProps & import("react").RefAttributes<HTMLDivElement>>>;
11
+ export {};
@@ -0,0 +1,29 @@
1
+ /// <reference types="react" />
2
+ import { ISchema } from "../../fields";
3
+ import { Form } from "../../typings.ts";
4
+ interface FormRendererProps {
5
+ /** The schema of the form the render */
6
+ schema: ISchema;
7
+ /** Initial values of the form */
8
+ values?: Form;
9
+ onSubmit?: (values: Form) => Promise<void> | void;
10
+ /** @default "Submit" */
11
+ submitText?: string;
12
+ /** The text of the cancel button (hidden by default)
13
+ * @default null
14
+ */
15
+ cancelText?: string;
16
+ onCancel?: () => void;
17
+ onDirty?: () => void;
18
+ onDirtyChange?: (dirty: boolean) => void;
19
+ /** Hide the form description
20
+ * @default false */
21
+ hideDescription?: boolean;
22
+ /** Hide the title (and description)
23
+ * @default false
24
+ */
25
+ hideTitle?: boolean;
26
+ className?: string;
27
+ }
28
+ export declare const FormRenderer: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<FormRendererProps & import("react").RefAttributes<HTMLDivElement>>>;
29
+ export {};