@overmap-ai/forms 1.0.0 → 1.0.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.
- package/dist/fields/BooleanField/BooleanField.d.ts +15 -0
- package/dist/fields/DateField/DateField.d.ts +14 -0
- package/dist/fields/MultiStringField/MultiStringField.d.ts +28 -0
- package/dist/fields/NumberField/NumberField.d.ts +28 -0
- package/dist/fields/SelectField/MultiSelectField.d.ts +19 -0
- package/dist/fields/SelectField/SelectField.d.ts +18 -0
- package/dist/fields/StringOrTextFields/StringField/StringField.d.ts +19 -0
- package/dist/fields/StringOrTextFields/TextField/TextField.d.ts +16 -0
- package/package.json +1 -1
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ISerializedField, SerializedBooleanField } from "@overmap-ai/core";
|
|
2
|
+
import { BaseField, ChildFieldOptions } from "../BaseField";
|
|
3
|
+
import { ReactNode } from "react";
|
|
4
|
+
import { ComponentProps } from "../typings";
|
|
5
|
+
import { CheckCircledIcon } from "@overmap-ai/blocks";
|
|
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
|
+
static Icon: typeof CheckCircledIcon;
|
|
10
|
+
constructor(options: ChildFieldOptions<boolean>);
|
|
11
|
+
protected isBlank(value: boolean): boolean;
|
|
12
|
+
serialize(): SerializedBooleanField;
|
|
13
|
+
static deserialize(data: ISerializedField): BooleanField;
|
|
14
|
+
getInput(props: ComponentProps<BooleanField>): ReactNode;
|
|
15
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ISerializedField, SerializedDateField } from "@overmap-ai/core";
|
|
2
|
+
import { BaseField, ChildFieldOptions } from "../BaseField";
|
|
3
|
+
import { GetInputProps } from "../typings";
|
|
4
|
+
import React from "react";
|
|
5
|
+
import { CalendarIcon } from "@overmap-ai/blocks";
|
|
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
|
+
constructor(options: ChildFieldOptions<string>);
|
|
11
|
+
serialize(): SerializedDateField;
|
|
12
|
+
static deserialize(data: ISerializedField): DateField;
|
|
13
|
+
getInput(props: GetInputProps<this>): React.ReactNode;
|
|
14
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { BaseField, ChildFieldOptions } from "../BaseField";
|
|
2
|
+
import { ISerializedField, SelectFieldOption, SerializedMultiStringField } from "@overmap-ai/core";
|
|
3
|
+
import { GetInputProps, InputFieldLevelValidator } from "../typings.ts";
|
|
4
|
+
import { ReactNode } from "react";
|
|
5
|
+
import { ListBulletIcon } from "@overmap-ai/blocks";
|
|
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
|
+
static Icon: typeof ListBulletIcon;
|
|
21
|
+
constructor(options: MultiStringFieldOptions);
|
|
22
|
+
getInput(props: GetInputProps<this>): ReactNode;
|
|
23
|
+
serialize(): SerializedMultiStringField;
|
|
24
|
+
protected isBlank(value: SelectFieldOption[]): boolean;
|
|
25
|
+
getFieldValidators(): InputFieldLevelValidator<SelectFieldOption[]>[];
|
|
26
|
+
static deserialize(data: ISerializedField): MultiStringField;
|
|
27
|
+
}
|
|
28
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { ISerializedField, SerializedNumberField } from "@overmap-ai/core";
|
|
2
|
+
import { BooleanField } from "../BooleanField";
|
|
3
|
+
import { BaseField, ChildFieldOptions } from "../BaseField";
|
|
4
|
+
import { GetInputProps, InputFieldLevelValidator, InputValidator } from "../typings";
|
|
5
|
+
import { ReactNode } from "react";
|
|
6
|
+
import { FontFamilyIcon } from "@overmap-ai/blocks";
|
|
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
|
+
static _validateMin: InputValidator<NumberFieldValue>;
|
|
22
|
+
static _validateMax: InputValidator<NumberFieldValue>;
|
|
23
|
+
static getFieldCreationSchema(): (BooleanField | NumberField)[];
|
|
24
|
+
getFieldValidators(): InputFieldLevelValidator<NumberFieldValue>[];
|
|
25
|
+
serialize(): SerializedNumberField;
|
|
26
|
+
static deserialize(data: ISerializedField): NumberField;
|
|
27
|
+
getInput(props: GetInputProps<this>): ReactNode;
|
|
28
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ISerializedField, SelectFieldOptionValue, SerializedMultiSelectField } from "@overmap-ai/core";
|
|
2
|
+
import { ReactNode } from "react";
|
|
3
|
+
import { GetInputProps } from "../typings";
|
|
4
|
+
import { BaseSelectField, BaseSelectFieldOptions } from "./BaseSelectField";
|
|
5
|
+
import { CheckboxIcon } from "@overmap-ai/blocks";
|
|
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
|
+
protected isBlank(value: SelectFieldOptionValue[]): boolean;
|
|
16
|
+
serialize(): SerializedMultiSelectField;
|
|
17
|
+
static deserialize(data: ISerializedField): MultiSelectField;
|
|
18
|
+
getInput(props: GetInputProps<this>): ReactNode;
|
|
19
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ISerializedField, SelectFieldOptionValue, SerializedSelectField } from "@overmap-ai/core";
|
|
2
|
+
import { ReactNode } from "react";
|
|
3
|
+
import { GetInputProps } from "../typings";
|
|
4
|
+
import { BaseSelectField, BaseSelectFieldOptions } from "./BaseSelectField";
|
|
5
|
+
import { DropdownMenuIcon } from "@overmap-ai/blocks";
|
|
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
|
+
serialize(): SerializedSelectField;
|
|
16
|
+
static deserialize(data: ISerializedField): SelectField;
|
|
17
|
+
getInput(props: GetInputProps<this>): ReactNode;
|
|
18
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ISerializedField, SerializedStringField, StringInputType } from "@overmap-ai/core";
|
|
2
|
+
import { StringOrTextField, StringOrTextFieldOptions } from "../StringOrTextField";
|
|
3
|
+
import { GetInputProps } from "../../typings";
|
|
4
|
+
import React from "react";
|
|
5
|
+
import { InputIcon } from "@overmap-ai/blocks";
|
|
6
|
+
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
|
+
}
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ISerializedField, SerializedTextField } from "@overmap-ai/core";
|
|
2
|
+
import { StringOrTextField, StringOrTextFieldOptions } from "../StringOrTextField";
|
|
3
|
+
import { GetInputProps } from "../../typings";
|
|
4
|
+
import React from "react";
|
|
5
|
+
import { RowsIcon } from "@overmap-ai/blocks";
|
|
6
|
+
export interface TextFieldOptions extends Omit<StringOrTextFieldOptions, "type"> {
|
|
7
|
+
}
|
|
8
|
+
export declare class TextField extends StringOrTextField<"text"> {
|
|
9
|
+
static readonly fieldTypeName = "Paragraph";
|
|
10
|
+
static readonly fieldTypeDescription = "Paragraph fields can hold up to 5000 characters and can have multiple lines.";
|
|
11
|
+
static Icon: typeof RowsIcon;
|
|
12
|
+
constructor(options: TextFieldOptions);
|
|
13
|
+
serialize(): SerializedTextField;
|
|
14
|
+
static deserialize(data: ISerializedField): TextField;
|
|
15
|
+
getInput(props: GetInputProps<this>): React.ReactNode;
|
|
16
|
+
}
|