@overmap-ai/forms 1.0.39-react-hook-form.1 → 1.0.39
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/form/builder/Root.d.ts +1 -1
- package/dist/form/builder/components/FieldBuilder.d.ts +1 -1
- package/dist/form/builder/components/FieldSectionDropdownMenu.d.ts +1 -1
- package/dist/form/builder/context.d.ts +2 -0
- package/dist/form/builder/utils.d.ts +2 -2
- package/dist/form/components/DisplayFile.d.ts +2 -2
- package/dist/form/conditions/BaseCondition/BaseCondition.d.ts +2 -2
- package/dist/form/conditions/BooleanFieldCondition/BooleanFieldCondition.d.ts +1 -1
- package/dist/form/conditions/CheckboxListFieldCondition/CheckboxListFieldCondition.d.ts +1 -1
- package/dist/form/conditions/ConditionManager/ConditionManager.d.ts +1 -1
- package/dist/form/conditions/ConditionManager/hooks.d.ts +1 -1
- package/dist/form/conditions/DateFieldCondition/DateFieldCondition.d.ts +2 -2
- package/dist/form/conditions/MultiSelectFieldCondition/MultiSelectFieldCondition.d.ts +1 -1
- package/dist/form/conditions/MultiStringFieldCondition/MultiStringFieldCondition.d.ts +1 -1
- package/dist/form/conditions/NumberFieldCondition/NumberFieldCondition.d.ts +1 -1
- package/dist/form/conditions/OTPFieldCondition/OTPFieldCondition.d.ts +1 -1
- package/dist/form/conditions/PassFailFieldCondition/PassFailFieldCondition.d.ts +1 -1
- package/dist/form/conditions/RadioFieldCondition/RadioFieldCondition.d.ts +1 -1
- package/dist/form/conditions/RatingFieldCondition/RatingFieldCondition.d.ts +1 -1
- package/dist/form/conditions/ScanFieldCondition/ScanFieldCondition.d.ts +1 -1
- package/dist/form/conditions/StringFieldCondition/StringFieldCondition.d.ts +1 -1
- package/dist/form/conditions/TextFieldCondition/TextFieldCondition.d.ts +1 -1
- package/dist/form/conditions/TimeFieldCondition/TimeFieldCondition.d.ts +19 -0
- package/dist/form/conditions/TimeFieldCondition/TimeFieldCondition.test.d.ts +1 -0
- package/dist/form/conditions/TimeFieldCondition/TimeFieldConditionCell.d.ts +6 -0
- package/dist/form/conditions/TimeFieldCondition/index.d.ts +3 -0
- package/dist/form/conditions/TimeFieldCondition/typings.d.ts +4 -0
- package/dist/form/conditions/URLFieldCondition/URLFieldCondition.d.ts +1 -1
- package/dist/form/conditions/UploadFieldCondition/UploadFieldCondition.d.ts +2 -2
- package/dist/form/conditions/components/TimeInputPopover.d.ts +9 -0
- package/dist/form/conditions/components/index.d.ts +1 -0
- package/dist/form/conditions/constants.d.ts +2 -0
- package/dist/form/conditions/index.d.ts +1 -0
- package/dist/form/conditions/typings.d.ts +4 -3
- package/dist/form/conditions/utils.d.ts +1 -1
- package/dist/form/cva.d.ts +6 -0
- package/dist/form/fields/BaseField/BaseField.d.ts +1 -3
- package/dist/form/fields/BaseFormElement/BaseFormElement.d.ts +2 -2
- package/dist/form/fields/BaseFormElement/typings.d.ts +0 -6
- package/dist/form/fields/BaseOptionsField/BaseOptionsField.d.ts +1 -1
- package/dist/form/fields/BaseStringField/BaseStringField.d.ts +1 -1
- package/dist/form/fields/BooleanField/BooleanField.d.ts +2 -5
- package/dist/form/fields/BooleanField/BooleanFieldInput.d.ts +1 -1
- package/dist/form/fields/CheckboxListField/CheckboxListField.d.ts +2 -5
- package/dist/form/fields/DateField/DateField.d.ts +2 -5
- package/dist/form/fields/DateField/DateFieldInput.d.ts +1 -1
- package/dist/form/fields/FieldSection/FieldSection.d.ts +3 -5
- package/dist/form/fields/MultiSelectField/MultiSelectField.d.ts +2 -5
- package/dist/form/fields/MultiSelectField/MultiSelectFieldInput.d.ts +1 -1
- package/dist/form/fields/MultiStringField/MultiStringField.d.ts +2 -5
- package/dist/form/fields/MultiStringField/MultiStringFieldInput.d.ts +1 -1
- package/dist/form/fields/NumberField/NumberField.d.ts +2 -5
- package/dist/form/fields/NumberField/NumberFieldInput.d.ts +1 -1
- package/dist/form/fields/OTPField/OTPField.d.ts +2 -5
- package/dist/form/fields/OTPField/typings.d.ts +1 -1
- package/dist/form/fields/PassFailField/PassFailField.d.ts +2 -5
- package/dist/form/fields/PassFailField/PassFailFieldInput.d.ts +1 -1
- package/dist/form/fields/PassFailField/typings.d.ts +1 -1
- package/dist/form/fields/RadioField/RadioField.d.ts +2 -5
- package/dist/form/fields/RadioField/RadioFieldInput.d.ts +1 -1
- package/dist/form/fields/RatingField/RatingField.d.ts +2 -5
- package/dist/form/fields/RatingField/RatingFieldInput.d.ts +1 -1
- package/dist/form/fields/ScanField/ScanField.d.ts +2 -5
- package/dist/form/fields/ScanField/ScanFieldInput.d.ts +1 -1
- package/dist/form/fields/SelectField/SelectField.d.ts +2 -5
- package/dist/form/fields/SelectField/SelectFieldInput.d.ts +1 -1
- package/dist/form/fields/StringField/StringField.d.ts +2 -5
- package/dist/form/fields/StringField/StringFieldInput.d.ts +1 -1
- package/dist/form/fields/TextField/TextField.d.ts +2 -5
- package/dist/form/fields/TextField/TextFieldInput.d.ts +1 -1
- package/dist/form/fields/TimeField/TimeField.d.ts +21 -0
- package/dist/form/fields/TimeField/TimeField.test.d.ts +1 -0
- package/dist/form/fields/TimeField/TimeFieldControl.d.ts +13 -0
- package/dist/form/fields/TimeField/TimeFieldInput.d.ts +7 -0
- package/dist/form/fields/TimeField/constants.d.ts +2 -0
- package/dist/form/fields/TimeField/index.d.ts +6 -0
- package/dist/form/fields/TimeField/typings.d.ts +11 -0
- package/dist/form/fields/TimeField/utils.d.ts +16 -0
- package/dist/form/fields/URLField/URLField.d.ts +2 -5
- package/dist/form/fields/URLField/URLFieldInput.d.ts +1 -1
- package/dist/form/fields/UploadField/UploadField.d.ts +2 -5
- package/dist/form/fields/UploadField/UploadFieldInput.d.ts +1 -1
- package/dist/form/fields/constants.d.ts +13 -36
- package/dist/form/fields/enums.d.ts +9 -0
- package/dist/form/fields/hooks.d.ts +5 -3
- package/dist/form/fields/index.d.ts +2 -0
- package/dist/form/fields/typings.d.ts +4 -3
- package/dist/form/fields/utils.d.ts +1 -1
- package/dist/form/index.d.ts +1 -0
- package/dist/form/modifiers/index.d.ts +1 -0
- package/dist/form/modifiers/time.d.ts +8 -0
- package/dist/form/renderer/FieldsRenderer.d.ts +1 -1
- package/dist/form/renderer/context.d.ts +1 -1
- package/dist/form/schema/FieldSchema.d.ts +2 -1
- package/dist/form/utils.d.ts +1 -1
- package/dist/forms.js +5641 -5070
- package/dist/forms.umd.cjs +66 -61
- package/package.json +9 -7
- package/dist/form/builder/constants.d.ts +0 -1
- package/dist/form/builder/hooks.d.ts +0 -7
- package/dist/form/schema/context.d.ts +0 -2
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
import { SerializedMultiStringField } from './typings';
|
|
3
2
|
import { BaseField, FieldOptions, FieldValidator } from '../BaseField';
|
|
4
|
-
import {
|
|
3
|
+
import { SerializedMultiStringField } from './typings';
|
|
5
4
|
export interface MultiStringFieldOptions extends FieldOptions {
|
|
6
5
|
minimum_length?: number;
|
|
7
6
|
maximum_length?: number;
|
|
@@ -9,13 +8,11 @@ export interface MultiStringFieldOptions extends FieldOptions {
|
|
|
9
8
|
}
|
|
10
9
|
export declare class MultiStringField extends BaseField<"multi-string", string[], string[], MultiStringField> {
|
|
11
10
|
readonly type = "multi-string";
|
|
12
|
-
static readonly fieldTypeName = "Multi-string";
|
|
13
|
-
static readonly fieldTypeDescription = "Allows the user to provide multiple unique strings.";
|
|
14
11
|
minLength: number;
|
|
15
12
|
maxLength: number;
|
|
16
13
|
placeholder: string;
|
|
17
14
|
constructor(options: MultiStringFieldOptions);
|
|
18
|
-
render(
|
|
15
|
+
render(): ReactNode;
|
|
19
16
|
serialize(): SerializedMultiStringField;
|
|
20
17
|
getOptions(): MultiStringFieldOptions;
|
|
21
18
|
duplicate(identifier: string): MultiStringField;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
import { SerializedNumberField } from './typings';
|
|
3
2
|
import { BaseField, FieldOptions, FieldValidator } from '../BaseField';
|
|
4
|
-
import { FieldRenderProps } from '../BaseFormElement';
|
|
5
3
|
import { BooleanField } from '../BooleanField';
|
|
4
|
+
import { SerializedNumberField } from './typings';
|
|
6
5
|
export type NumberRange = {
|
|
7
6
|
to: number | null;
|
|
8
7
|
from: number | null;
|
|
@@ -15,8 +14,6 @@ export interface NumberFieldOptions extends FieldOptions {
|
|
|
15
14
|
}
|
|
16
15
|
export declare class NumberField extends BaseField<"number", number | null, number | null, NumberField> {
|
|
17
16
|
readonly type = "number";
|
|
18
|
-
static readonly fieldTypeName = "Number";
|
|
19
|
-
static readonly fieldTypeDescription = "Allows specifying a number within a given range.";
|
|
20
17
|
minimum: number | undefined;
|
|
21
18
|
maximum: number | undefined;
|
|
22
19
|
integers: boolean;
|
|
@@ -37,7 +34,7 @@ export declare class NumberField extends BaseField<"number", number | null, numb
|
|
|
37
34
|
static deserialize(data: SerializedNumberField): NumberField;
|
|
38
35
|
serializeValue(value: number | null): number | null;
|
|
39
36
|
deserializeValue(value: number | null): number | null;
|
|
40
|
-
render(
|
|
37
|
+
render(): ReactNode;
|
|
41
38
|
isSerializedValue(value: unknown): value is number;
|
|
42
39
|
isValue(value: unknown): value is number | null;
|
|
43
40
|
areValuesEqual(value1: number | null, value2: number | null): boolean;
|
|
@@ -1,17 +1,14 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
import { OTPFieldValidationType, SerializedOTPField } from './typings';
|
|
3
2
|
import { BaseField, FieldOptions, FieldValidator } from '../BaseField';
|
|
4
|
-
import { FieldRenderProps } from '../BaseFormElement';
|
|
5
3
|
import { NumberField } from '../NumberField';
|
|
6
4
|
import { SelectField } from '../SelectField';
|
|
5
|
+
import { OTPFieldValidationType, SerializedOTPField } from './typings';
|
|
7
6
|
export interface OTPFieldOptions extends FieldOptions {
|
|
8
7
|
length: number;
|
|
9
8
|
validationType: OTPFieldValidationType;
|
|
10
9
|
}
|
|
11
10
|
export declare class OTPField extends BaseField<"otp", string, string, OTPField> {
|
|
12
11
|
readonly type = "otp";
|
|
13
|
-
static readonly fieldTypeName = "OTP";
|
|
14
|
-
static readonly fieldTypeDescription = "Allows specifying a number within a given range.";
|
|
15
12
|
length: number;
|
|
16
13
|
validationType: OTPFieldValidationType;
|
|
17
14
|
constructor(options: OTPFieldOptions);
|
|
@@ -30,7 +27,7 @@ export declare class OTPField extends BaseField<"otp", string, string, OTPField>
|
|
|
30
27
|
static deserialize(data: SerializedOTPField): OTPField;
|
|
31
28
|
serializeValue(value: string): string;
|
|
32
29
|
deserializeValue(value: string): string;
|
|
33
|
-
render(
|
|
30
|
+
render(): ReactNode;
|
|
34
31
|
isSerializedValue(value: unknown): value is string;
|
|
35
32
|
isValue(value: unknown): value is string;
|
|
36
33
|
blankValue(): string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ComponentProps } from 'react';
|
|
2
1
|
import { OneTimePasswordField } from '@overmap-ai/blocks';
|
|
2
|
+
import { ComponentProps } from 'react';
|
|
3
3
|
import { BaseSerializedField } from '../BaseField';
|
|
4
4
|
export type OTPFieldValidationType = NonNullable<ComponentProps<typeof OneTimePasswordField.Root>["validationType"]>;
|
|
5
5
|
export interface SerializedOTPField extends BaseSerializedField<"otp"> {
|
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
import { PassFailFieldStatus, PassFailFieldValue, SerializedPassFailField, SerializedPassFailFieldValue } from './typings';
|
|
3
2
|
import { BaseField, FieldCreationSchemaObject, FieldOptions, FieldValidator } from '../BaseField';
|
|
4
|
-
import {
|
|
3
|
+
import { PassFailFieldStatus, PassFailFieldValue, SerializedPassFailField, SerializedPassFailFieldValue } from './typings';
|
|
5
4
|
export interface PassFailFieldOptions extends FieldOptions {
|
|
6
5
|
showNotesAndFilesOn: PassFailFieldStatus[];
|
|
7
6
|
}
|
|
8
7
|
export declare class PassFailField extends BaseField<"pass-fail", PassFailFieldValue, SerializedPassFailFieldValue, PassFailField> {
|
|
9
8
|
readonly type = "pass-fail";
|
|
10
|
-
static readonly fieldTypeName = "Pass - Fail";
|
|
11
|
-
static readonly fieldTypeDescription = "Track pass, fail, or N/A outcome.";
|
|
12
9
|
showNotesAndFilesOn: PassFailFieldStatus[];
|
|
13
10
|
constructor(options: PassFailFieldOptions);
|
|
14
11
|
static getFieldCreationSchema(parentPath?: string): FieldCreationSchemaObject[];
|
|
@@ -20,7 +17,7 @@ export declare class PassFailField extends BaseField<"pass-fail", PassFailFieldV
|
|
|
20
17
|
static deserialize(data: SerializedPassFailField): PassFailField;
|
|
21
18
|
serializeValue(value: PassFailFieldValue): SerializedPassFailFieldValue;
|
|
22
19
|
deserializeValue(value: SerializedPassFailFieldValue): PassFailFieldValue;
|
|
23
|
-
render(
|
|
20
|
+
render(): ReactNode;
|
|
24
21
|
isSerializedValue(value: unknown): value is SerializedPassFailFieldValue;
|
|
25
22
|
isValue(value: unknown): value is PassFailFieldValue;
|
|
26
23
|
areValuesEqual(value1: PassFailFieldValue, value2: PassFailFieldValue): boolean;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { UUIDFile } from '../../UUIDFile';
|
|
1
2
|
import { UUIDPromise } from '../../UUIDPromise';
|
|
2
3
|
import { BaseSerializedField } from '../BaseField';
|
|
3
|
-
import { UUIDFile } from '../../UUIDFile';
|
|
4
4
|
export type PassFailFieldStatus = "pass" | "fail" | "na";
|
|
5
5
|
export interface PassFailFieldValue {
|
|
6
6
|
status: PassFailFieldStatus | null;
|
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
import { SerializedRadioField } from './typings';
|
|
3
|
-
import { FieldRenderProps } from '../BaseFormElement';
|
|
4
2
|
import { BaseOptionsField, BaseOptionsFieldOptions } from '../BaseOptionsField';
|
|
3
|
+
import { SerializedRadioField } from './typings';
|
|
5
4
|
export interface RadioFieldOptions extends BaseOptionsFieldOptions {
|
|
6
5
|
}
|
|
7
6
|
export declare class RadioField extends BaseOptionsField<"radio", string | null, string | null, RadioField> {
|
|
8
7
|
readonly type = "radio";
|
|
9
|
-
static readonly fieldTypeName = "Option list";
|
|
10
|
-
static readonly fieldTypeDescription = "Allows the user to select a single option from a list of options.";
|
|
11
8
|
constructor(options: RadioFieldOptions);
|
|
12
9
|
serialize(): SerializedRadioField;
|
|
13
10
|
getOptions(): RadioFieldOptions;
|
|
@@ -16,7 +13,7 @@ export declare class RadioField extends BaseOptionsField<"radio", string | null,
|
|
|
16
13
|
static deserialize(data: SerializedRadioField): RadioField;
|
|
17
14
|
serializeValue(value: string | null): string | null;
|
|
18
15
|
deserializeValue(value: string | null): string | null;
|
|
19
|
-
render(
|
|
16
|
+
render(): ReactNode;
|
|
20
17
|
isSerializedValue(value: unknown): value is string | null;
|
|
21
18
|
isValue(value: unknown): value is string | null;
|
|
22
19
|
blankValue(): string | null;
|
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
import { SerializedRatingField } from './typings';
|
|
3
2
|
import { BaseField, FieldOptions, FieldValidator } from '../BaseField';
|
|
4
|
-
import { FieldRenderProps } from '../BaseFormElement';
|
|
5
3
|
import { NumberField } from '../NumberField';
|
|
4
|
+
import { SerializedRatingField } from './typings';
|
|
6
5
|
export interface RatingFieldOptions extends FieldOptions {
|
|
7
6
|
maxRating: number;
|
|
8
7
|
}
|
|
9
8
|
export declare class RatingField extends BaseField<"rating", number | null, number | null, RatingField> {
|
|
10
9
|
readonly type = "rating";
|
|
11
|
-
static readonly fieldTypeName = "Rating";
|
|
12
|
-
static readonly fieldTypeDescription = "Allows users to select a rating value.";
|
|
13
10
|
maxRating: number;
|
|
14
11
|
constructor(options: RatingFieldOptions);
|
|
15
12
|
static getFieldCreationSchema(parentPath?: string): {
|
|
@@ -24,7 +21,7 @@ export declare class RatingField extends BaseField<"rating", number | null, numb
|
|
|
24
21
|
static deserialize(data: SerializedRatingField): RatingField;
|
|
25
22
|
serializeValue(value: number | null): number | null;
|
|
26
23
|
deserializeValue(value: number | null): number | null;
|
|
27
|
-
render(
|
|
24
|
+
render(): ReactNode;
|
|
28
25
|
isSerializedValue(value: unknown): value is number | null;
|
|
29
26
|
isValue(value: unknown): value is number | null;
|
|
30
27
|
areValuesEqual(value1: number | null, value2: number | null): boolean;
|
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
import { SerializedScanField } from './typings';
|
|
3
2
|
import { BaseField, FieldOptions } from '../BaseField';
|
|
4
|
-
import {
|
|
3
|
+
import { SerializedScanField } from './typings';
|
|
5
4
|
export interface ScanFieldOptions extends FieldOptions {
|
|
6
5
|
}
|
|
7
6
|
export declare class ScanField extends BaseField<"qr", string, string, ScanField> {
|
|
8
7
|
readonly type = "qr";
|
|
9
|
-
static readonly fieldTypeName = "Scan";
|
|
10
|
-
static readonly fieldTypeDescription = "Used for scanning/reading QR and barcodes.";
|
|
11
8
|
constructor(options: ScanFieldOptions);
|
|
12
9
|
serialize(): SerializedScanField;
|
|
13
10
|
getOptions(): ScanFieldOptions;
|
|
@@ -16,7 +13,7 @@ export declare class ScanField extends BaseField<"qr", string, string, ScanField
|
|
|
16
13
|
static deserialize(data: SerializedScanField): ScanField;
|
|
17
14
|
serializeValue(value: string): string;
|
|
18
15
|
deserializeValue(value: string): string;
|
|
19
|
-
render(
|
|
16
|
+
render(): ReactNode;
|
|
20
17
|
isSerializedValue(value: unknown): value is string;
|
|
21
18
|
isValue(value: unknown): value is string;
|
|
22
19
|
blankValue(): string;
|
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
import { SerializedSelectField } from './typings';
|
|
3
|
-
import { FieldRenderProps } from '../BaseFormElement';
|
|
4
2
|
import { BaseOptionsField, BaseOptionsFieldOptions } from '../BaseOptionsField';
|
|
3
|
+
import { SerializedSelectField } from './typings';
|
|
5
4
|
export type SelectFieldOptions = BaseOptionsFieldOptions & {
|
|
6
5
|
placeholder?: string;
|
|
7
6
|
};
|
|
8
7
|
export declare class SelectField extends BaseOptionsField<"select", string | null, string | null, SelectField> {
|
|
9
8
|
readonly type = "select";
|
|
10
|
-
static readonly fieldTypeName = "Dropdown";
|
|
11
|
-
static readonly fieldTypeDescription = "Allows the user to select a single option from a list of options.";
|
|
12
9
|
placeholder?: string;
|
|
13
10
|
constructor(options: SelectFieldOptions);
|
|
14
11
|
serialize(): SerializedSelectField;
|
|
@@ -18,7 +15,7 @@ export declare class SelectField extends BaseOptionsField<"select", string | nul
|
|
|
18
15
|
static deserialize(data: SerializedSelectField): SelectField;
|
|
19
16
|
serializeValue(value: string | null): string | null;
|
|
20
17
|
deserializeValue(value: string | null): string | null;
|
|
21
|
-
render(
|
|
18
|
+
render(): ReactNode;
|
|
22
19
|
isSerializedValue(value: unknown): value is string | null;
|
|
23
20
|
isValue(value: unknown): value is string | null;
|
|
24
21
|
blankValue(): string | null;
|
|
@@ -1,18 +1,15 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
import { SerializedStringField } from './typings';
|
|
3
|
-
import { FieldRenderProps } from '../BaseFormElement';
|
|
4
2
|
import { BaseStringField, BaseStringFieldOptions } from '../BaseStringField';
|
|
3
|
+
import { SerializedStringField } from './typings';
|
|
5
4
|
export interface StringFieldOptions extends BaseStringFieldOptions {
|
|
6
5
|
}
|
|
7
6
|
export declare class StringField extends BaseStringField<"string", StringField> {
|
|
8
7
|
readonly type = "string";
|
|
9
|
-
static readonly fieldTypeName = "Short Text";
|
|
10
|
-
static readonly fieldTypeDescription = "Short text fields can hold up to 500 characters on a single line.";
|
|
11
8
|
constructor(options: StringFieldOptions);
|
|
12
9
|
serialize(): SerializedStringField;
|
|
13
10
|
getOptions(): StringFieldOptions;
|
|
14
11
|
duplicate(identifier: string): StringField;
|
|
15
12
|
setOptions(options: Partial<StringFieldOptions>): void;
|
|
16
13
|
static deserialize(data: SerializedStringField): StringField;
|
|
17
|
-
render(
|
|
14
|
+
render(): ReactNode;
|
|
18
15
|
}
|
|
@@ -1,17 +1,14 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
import { SerializedTextField } from './typings';
|
|
3
|
-
import { FieldRenderProps } from '../BaseFormElement';
|
|
4
2
|
import { BaseStringField, BaseStringFieldOptions } from '../BaseStringField';
|
|
3
|
+
import { SerializedTextField } from './typings';
|
|
5
4
|
export type TextFieldOptions = BaseStringFieldOptions;
|
|
6
5
|
export declare class TextField extends BaseStringField<"text", TextField> {
|
|
7
6
|
readonly type = "text";
|
|
8
|
-
static readonly fieldTypeName = "Paragraph";
|
|
9
|
-
static readonly fieldTypeDescription = "Paragraph fields can hold up to 10000 characters and can have multiple lines.";
|
|
10
7
|
constructor(options: TextFieldOptions);
|
|
11
8
|
serialize(): SerializedTextField;
|
|
12
9
|
getOptions(): TextFieldOptions;
|
|
13
10
|
duplicate(identifier: string): TextField;
|
|
14
11
|
setOptions(options: Partial<TextFieldOptions>): void;
|
|
15
12
|
static deserialize(data: SerializedTextField): TextField;
|
|
16
|
-
render(
|
|
13
|
+
render(): ReactNode;
|
|
17
14
|
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { BaseField, FieldOptions } from '../BaseField';
|
|
3
|
+
import { SerializedTimeField, Time } from './typings';
|
|
4
|
+
export type TimeFieldOptions = FieldOptions;
|
|
5
|
+
export declare class TimeField extends BaseField<"time", Time | null, Time | null, TimeField> {
|
|
6
|
+
readonly type = "time";
|
|
7
|
+
constructor(config: TimeFieldOptions);
|
|
8
|
+
static deserialize(data: SerializedTimeField): TimeField;
|
|
9
|
+
getOptions(): TimeFieldOptions;
|
|
10
|
+
duplicate(identifier: string): TimeField;
|
|
11
|
+
setOptions(options: Partial<TimeFieldOptions>): void;
|
|
12
|
+
serializeValue(value: Time | null): Time | null;
|
|
13
|
+
deserializeValue(value: Time | null): Time | null;
|
|
14
|
+
render(): ReactNode;
|
|
15
|
+
isSerializedValue(value: unknown): value is Time | null;
|
|
16
|
+
isValue(value: unknown): value is Time | null;
|
|
17
|
+
blankValue(): Time | null;
|
|
18
|
+
blankSerializedValue(): Time | null;
|
|
19
|
+
areSerializedValuesEqual(value1: Time | null, value2: Time | null): boolean;
|
|
20
|
+
areValuesEqual(value1: Time | null, value2: Time | null): boolean;
|
|
21
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { InputSize } from '@overmap-ai/blocks';
|
|
2
|
+
import { Time } from './typings';
|
|
3
|
+
export interface TimeFieldControlProps {
|
|
4
|
+
value?: Time | null;
|
|
5
|
+
onChange: (value: Time | null) => void;
|
|
6
|
+
onBlur?: () => void;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
size?: InputSize;
|
|
9
|
+
id?: string;
|
|
10
|
+
name?: string;
|
|
11
|
+
compact?: boolean;
|
|
12
|
+
}
|
|
13
|
+
export declare const TimeFieldControl: import('react').NamedExoticComponent<TimeFieldControlProps>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { FieldRenderProps } from '../BaseFormElement';
|
|
2
|
+
import { TimeField } from './TimeField';
|
|
3
|
+
interface TimeFieldInputProps extends FieldRenderProps {
|
|
4
|
+
field: TimeField;
|
|
5
|
+
}
|
|
6
|
+
export declare const TimeFieldInput: import('react').NamedExoticComponent<TimeFieldInputProps>;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { BaseSerializedField } from '../BaseField';
|
|
2
|
+
export interface SerializedTimeField extends BaseSerializedField<"time"> {
|
|
3
|
+
}
|
|
4
|
+
export type UTCOffsetSign = "+" | "-";
|
|
5
|
+
export type UTCOffsetTime = `${string}:${string}`;
|
|
6
|
+
export type UTCOffset = `${UTCOffsetSign}${UTCOffsetTime}`;
|
|
7
|
+
export type Time = `T${UTCOffsetTime}:00${UTCOffset}`;
|
|
8
|
+
export interface TimeRange {
|
|
9
|
+
from: Time | null;
|
|
10
|
+
to: Time | null;
|
|
11
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Time, TimeRange, UTCOffset } from './typings';
|
|
2
|
+
export declare const isUTCOffset: (value: unknown) => value is UTCOffset;
|
|
3
|
+
export declare const getCurrentUTCOffset: () => UTCOffset;
|
|
4
|
+
export declare function getUTCOffsetMinutes(offset: UTCOffset): number;
|
|
5
|
+
export declare const parseTime: (value: string) => {
|
|
6
|
+
hours: number;
|
|
7
|
+
minutes: number;
|
|
8
|
+
utcOffset: `+${string}:${string}` | `-${string}:${string}`;
|
|
9
|
+
} | null;
|
|
10
|
+
export declare const isTime: (value: unknown) => value is Time;
|
|
11
|
+
export declare const createTime: (hours: number, minutes: number, utcOffset?: UTCOffset) => Time;
|
|
12
|
+
export declare const formatUTCOffset: (offset: UTCOffset) => string;
|
|
13
|
+
export declare const getUTCMinuteOfDay: (value: Time) => number;
|
|
14
|
+
export declare const formatTime: (value: Time, offset?: boolean) => string;
|
|
15
|
+
export declare const isTimeRange: (value: Time | TimeRange) => value is TimeRange;
|
|
16
|
+
export declare const isTimeInRange: (value: Time, range: TimeRange) => boolean;
|
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
import { SerializedURLField } from './typings';
|
|
3
2
|
import { BaseField, FieldOptions } from '../BaseField';
|
|
4
|
-
import {
|
|
3
|
+
import { SerializedURLField } from './typings';
|
|
5
4
|
export interface URLFieldOptions extends FieldOptions {
|
|
6
5
|
placeholder?: string;
|
|
7
6
|
}
|
|
8
7
|
export declare class URLField extends BaseField<"url", URL | null, string | null, URLField> {
|
|
9
8
|
readonly type = "url";
|
|
10
|
-
static readonly fieldTypeName = "URL";
|
|
11
|
-
static readonly fieldTypeDescription = "Allows users to enter a URL.";
|
|
12
9
|
placeholder: string;
|
|
13
10
|
constructor(options: URLFieldOptions);
|
|
14
11
|
serialize(): SerializedURLField;
|
|
@@ -24,5 +21,5 @@ export declare class URLField extends BaseField<"url", URL | null, string | null
|
|
|
24
21
|
blankSerializedValue(): string | null;
|
|
25
22
|
areSerializedValuesEqual(value1: string | null, value2: string | null): boolean;
|
|
26
23
|
areValuesEqual(value1: URL | null, value2: URL | null): boolean;
|
|
27
|
-
render(
|
|
24
|
+
render(): ReactNode;
|
|
28
25
|
}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
import { SerializedUploadField } from './typings';
|
|
3
2
|
import { UUIDFile } from '../../UUIDFile';
|
|
4
3
|
import { UUIDPromise } from '../../UUIDPromise';
|
|
5
4
|
import { BaseField, FieldOptions, FieldValidator } from '../BaseField';
|
|
6
|
-
import { FieldRenderProps } from '../BaseFormElement';
|
|
7
5
|
import { MultiSelectField } from '../MultiSelectField';
|
|
8
6
|
import { NumberField } from '../NumberField';
|
|
7
|
+
import { SerializedUploadField } from './typings';
|
|
9
8
|
export interface UploadFieldOptions extends FieldOptions {
|
|
10
9
|
extensions?: string[];
|
|
11
10
|
maximum_size?: number | string;
|
|
@@ -13,8 +12,6 @@ export interface UploadFieldOptions extends FieldOptions {
|
|
|
13
12
|
}
|
|
14
13
|
export declare class UploadField extends BaseField<"upload", (UUIDPromise<UUIDFile> | UUIDFile)[], never[], UploadField> {
|
|
15
14
|
readonly type = "upload";
|
|
16
|
-
static readonly fieldTypeName = "Upload";
|
|
17
|
-
static readonly fieldTypeDescription = "Allows a file to be uploaded.";
|
|
18
15
|
extensions?: string[];
|
|
19
16
|
maxFileSize: number | undefined;
|
|
20
17
|
maxFiles: number;
|
|
@@ -34,7 +31,7 @@ export declare class UploadField extends BaseField<"upload", (UUIDPromise<UUIDFi
|
|
|
34
31
|
static deserialize(data: SerializedUploadField): UploadField;
|
|
35
32
|
serializeValue(_value: (UUIDPromise<UUIDFile> | UUIDFile)[]): never[];
|
|
36
33
|
deserializeValue(_value: never[]): (UUIDPromise<UUIDFile> | UUIDFile)[];
|
|
37
|
-
render(
|
|
34
|
+
render(): ReactNode;
|
|
38
35
|
isSerializedValue(value: unknown): value is never[];
|
|
39
36
|
isValue(value: unknown): value is (UUIDPromise<UUIDFile> | UUIDFile)[];
|
|
40
37
|
areValuesEqual(value1: (UUIDPromise<UUIDFile> | UUIDFile)[], value2: (UUIDPromise<UUIDFile> | UUIDFile)[]): boolean;
|
|
@@ -1,40 +1,17 @@
|
|
|
1
1
|
import { IconComponent } from '@overmap-ai/blocks';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
import { StringField } from './StringField';
|
|
16
|
-
import { TextField } from './TextField';
|
|
17
|
-
import { UploadField } from './UploadField';
|
|
18
|
-
import { URLField } from './URLField';
|
|
19
|
-
export declare const FieldTypeToClsMapping: {
|
|
20
|
-
date: typeof DateField;
|
|
21
|
-
number: typeof NumberField;
|
|
22
|
-
boolean: typeof BooleanField;
|
|
23
|
-
select: typeof SelectField;
|
|
24
|
-
string: typeof StringField;
|
|
25
|
-
url: typeof URLField;
|
|
26
|
-
text: typeof TextField;
|
|
27
|
-
upload: typeof UploadField;
|
|
28
|
-
qr: typeof ScanField;
|
|
29
|
-
"multi-string": typeof MultiStringField;
|
|
30
|
-
"multi-select": typeof MultiSelectField;
|
|
31
|
-
radio: typeof RadioField;
|
|
32
|
-
"checkbox-list": typeof CheckboxListField;
|
|
33
|
-
"pass-fail": typeof PassFailField;
|
|
34
|
-
otp: typeof OTPField;
|
|
35
|
-
rating: typeof RatingField;
|
|
36
|
-
};
|
|
37
|
-
export declare const fieldIcons: Record<FieldType, IconComponent>;
|
|
2
|
+
import { FieldTypeGroup } from './enums';
|
|
3
|
+
import { FieldClass, FieldType } from './typings';
|
|
4
|
+
export declare const FieldTypeToClsMapping: Record<Exclude<FieldType, "section">, FieldClass>;
|
|
5
|
+
export declare const FIELD_TYPES: Exclude<FieldType, "section">[];
|
|
6
|
+
export declare const fieldDataMapping: Record<Exclude<FieldType, "section">, {
|
|
7
|
+
icon: IconComponent;
|
|
8
|
+
name: string;
|
|
9
|
+
description: string;
|
|
10
|
+
group: FieldTypeGroup;
|
|
11
|
+
}>;
|
|
12
|
+
export declare const fieldTypeGroupDataMapping: Record<FieldTypeGroup, {
|
|
13
|
+
name: string;
|
|
14
|
+
}>;
|
|
38
15
|
export declare const maxFileSizeMB = 50;
|
|
39
16
|
export declare const maxFileSizeKB: number;
|
|
40
17
|
export declare const maxFileSizeB: number;
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
export declare const
|
|
2
|
+
import { FieldSection } from './FieldSection';
|
|
3
|
+
import { AnyField, ValueOfField } from './typings';
|
|
4
|
+
export declare const useFieldSectionInputs: (fieldSections: FieldSection[]) => import("react/jsx-runtime").JSX.Element[];
|
|
5
|
+
export declare const useFieldInputs: (fields: AnyField[]) => ReactNode;
|
|
5
6
|
export interface useFieldInputProps<TField extends AnyField> {
|
|
6
7
|
field: TField;
|
|
7
8
|
}
|
|
8
9
|
export declare const useFieldInput: <TField extends AnyField>(props: useFieldInputProps<TField>) => {
|
|
9
10
|
value: ValueOfField<TField>;
|
|
10
11
|
name: TField["identifier"];
|
|
12
|
+
disabled: boolean | undefined;
|
|
11
13
|
isTouched: boolean;
|
|
12
14
|
error: string;
|
|
13
15
|
onChange: (value: ValueOfField<TField>) => void;
|
|
@@ -21,7 +21,9 @@ export * from './ScanField';
|
|
|
21
21
|
export * from './SelectField';
|
|
22
22
|
export * from './StringField';
|
|
23
23
|
export * from './TextField';
|
|
24
|
+
export * from './TimeField';
|
|
24
25
|
export type * from './typings';
|
|
25
26
|
export * from './UploadField';
|
|
26
27
|
export * from './URLField';
|
|
27
28
|
export * from './utils';
|
|
29
|
+
export * from './enums';
|
|
@@ -15,6 +15,7 @@ import { ScanField, SerializedScanField } from './ScanField';
|
|
|
15
15
|
import { SelectField, SerializedSelectField } from './SelectField';
|
|
16
16
|
import { SerializedStringField, StringField } from './StringField';
|
|
17
17
|
import { SerializedTextField, TextField } from './TextField';
|
|
18
|
+
import { SerializedTimeField, TimeField } from './TimeField';
|
|
18
19
|
import { SerializedUploadField, UploadField } from './UploadField';
|
|
19
20
|
import { SerializedURLField, URLField } from './URLField';
|
|
20
21
|
export type AnyFormElement = BaseFormElement<any, any>;
|
|
@@ -22,13 +23,13 @@ export type AnyField = BaseField<any, any, any, any>;
|
|
|
22
23
|
export type TypeOfField<TField extends AnyFormElement> = TField extends BaseFormElement<infer TType, infer _TThis> ? TType : never;
|
|
23
24
|
export type ValueOfField<TField extends AnyField> = TField extends BaseField<infer _TType, infer TValue, infer _TSerializedValue, infer _TThis> ? TValue : never;
|
|
24
25
|
export type SerializedValueOfField<TField extends AnyField> = TField extends BaseField<infer _TType, infer _TValue, infer TSerializedValue, infer _TThis> ? TSerializedValue : never;
|
|
25
|
-
export type Field = BooleanField | CheckboxListField | PassFailField | DateField | MultiSelectField | MultiStringField | NumberField | RadioField | RatingField | ScanField | SelectField | StringField | TextField | UploadField | URLField | OTPField;
|
|
26
|
-
export type FieldClass = typeof BooleanField | typeof CheckboxListField | typeof PassFailField | typeof DateField | typeof MultiSelectField | typeof MultiStringField | typeof NumberField | typeof RadioField | typeof RatingField | typeof ScanField | typeof SelectField | typeof StringField | typeof TextField | typeof UploadField | typeof URLField | typeof OTPField;
|
|
26
|
+
export type Field = BooleanField | CheckboxListField | PassFailField | DateField | MultiSelectField | MultiStringField | NumberField | RadioField | RatingField | ScanField | SelectField | StringField | TextField | UploadField | URLField | OTPField | TimeField;
|
|
27
|
+
export type FieldClass = typeof BooleanField | typeof CheckboxListField | typeof PassFailField | typeof DateField | typeof MultiSelectField | typeof MultiStringField | typeof NumberField | typeof RadioField | typeof RatingField | typeof ScanField | typeof SelectField | typeof StringField | typeof TextField | typeof UploadField | typeof URLField | typeof OTPField | typeof TimeField;
|
|
27
28
|
export type FieldType = TypeOfField<Field> | TypeOfField<FieldSection>;
|
|
28
29
|
export type FieldValue = ValueOfField<Field>;
|
|
29
30
|
export type FieldError = string;
|
|
30
31
|
export type SerializedFieldValue = SerializedValueOfField<Field>;
|
|
31
|
-
export type SerializedField = SerializedTextField | SerializedBooleanField | SerializedNumberField | SerializedDateField | SerializedStringField | SerializedURLField | SerializedSelectField | SerializedFieldSection | SerializedMultiStringField | SerializedMultiSelectField | SerializedUploadField | SerializedScanField | SerializedRadioField | SerializedRatingField | SerializedCheckboxListField | SerializedOTPField | SerializedPassFailField;
|
|
32
|
+
export type SerializedField = SerializedTextField | SerializedBooleanField | SerializedNumberField | SerializedDateField | SerializedStringField | SerializedURLField | SerializedSelectField | SerializedFieldSection | SerializedMultiStringField | SerializedMultiSelectField | SerializedUploadField | SerializedScanField | SerializedRadioField | SerializedRatingField | SerializedCheckboxListField | SerializedOTPField | SerializedPassFailField | SerializedTimeField;
|
|
32
33
|
export type SerializedOnlyField = Exclude<SerializedField, SerializedFieldSection>;
|
|
33
34
|
export interface FieldsManager {
|
|
34
35
|
readonly fields: Field[];
|