@overmap-ai/forms 1.0.39-add-urlfield-with-url-input.0 → 1.0.39-field-groups.0
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/adapters.d.ts +3 -0
- package/dist/form/builder/Root.d.ts +0 -1
- package/dist/form/builder/components/FieldSettingsPopover.d.ts +0 -1
- package/dist/form/builder/context.d.ts +4 -0
- package/dist/form/conditions/OTPFieldCondition/index.d.ts +1 -1
- package/dist/form/conditions/PassFailFieldCondition/index.d.ts +1 -1
- package/dist/form/conditions/URLFieldCondition/index.d.ts +1 -1
- package/dist/form/cva.d.ts +6 -0
- package/dist/form/fields/BaseField/BaseField.d.ts +2 -10
- package/dist/form/fields/BaseField/index.d.ts +1 -1
- package/dist/form/fields/BaseField/typings.d.ts +2 -2
- package/dist/form/fields/BaseFormElement/BaseFormElement.d.ts +2 -2
- package/dist/form/fields/BaseFormElement/index.d.ts +1 -1
- package/dist/form/fields/BaseFormElement/typings.d.ts +0 -7
- package/dist/form/fields/BaseOptionsField/BaseOptionsField.d.ts +0 -1
- package/dist/form/fields/BaseOptionsField/index.d.ts +1 -1
- package/dist/form/fields/BaseStringField/index.d.ts +1 -1
- package/dist/form/fields/BooleanField/BooleanField.d.ts +1 -5
- package/dist/form/fields/BooleanField/index.d.ts +1 -1
- package/dist/form/fields/CheckboxListField/CheckboxListField.d.ts +1 -5
- package/dist/form/fields/CheckboxListField/index.d.ts +1 -1
- package/dist/form/fields/DateField/DateField.d.ts +1 -5
- package/dist/form/fields/DateField/index.d.ts +1 -1
- package/dist/form/fields/FieldSection/FieldSection.d.ts +2 -4
- package/dist/form/fields/FieldSection/index.d.ts +1 -1
- package/dist/form/fields/MultiSelectField/MultiSelectField.d.ts +1 -4
- package/dist/form/fields/MultiSelectField/index.d.ts +1 -1
- package/dist/form/fields/MultiStringField/MultiStringField.d.ts +1 -5
- package/dist/form/fields/MultiStringField/index.d.ts +1 -1
- package/dist/form/fields/NumberField/NumberField.d.ts +1 -4
- package/dist/form/fields/NumberField/index.d.ts +1 -1
- package/dist/form/fields/OTPField/OTPField.d.ts +1 -4
- package/dist/form/fields/PassFailField/PassFailField.d.ts +1 -5
- package/dist/form/fields/PassFailField/index.d.ts +1 -1
- package/dist/form/fields/RadioField/RadioField.d.ts +1 -5
- package/dist/form/fields/RadioField/index.d.ts +1 -1
- package/dist/form/fields/RatingField/RatingField.d.ts +1 -4
- package/dist/form/fields/RatingField/cva.d.ts +3 -0
- package/dist/form/fields/RatingField/index.d.ts +1 -1
- package/dist/form/fields/ScanField/ScanField.d.ts +1 -5
- package/dist/form/fields/ScanField/index.d.ts +1 -1
- package/dist/form/fields/SelectField/SelectField.d.ts +1 -4
- package/dist/form/fields/SelectField/index.d.ts +1 -1
- package/dist/form/fields/StringField/StringField.d.ts +1 -4
- package/dist/form/fields/StringField/index.d.ts +1 -1
- package/dist/form/fields/TextField/TextField.d.ts +1 -4
- package/dist/form/fields/TextField/index.d.ts +1 -1
- package/dist/form/fields/URLField/URLField.d.ts +1 -4
- package/dist/form/fields/URLField/index.d.ts +0 -1
- package/dist/form/fields/UploadField/UploadField.d.ts +1 -5
- package/dist/form/fields/UploadField/index.d.ts +1 -1
- package/dist/form/fields/components/InputWithLabel.d.ts +2 -3
- 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 +15 -29
- package/dist/form/fields/index.d.ts +1 -0
- package/dist/form/fields/typings.d.ts +1 -0
- package/dist/form/index.d.ts +1 -1
- package/dist/form/renderer/FieldsRenderer.d.ts +3 -7
- package/dist/form/schema/FieldSchema.d.ts +1 -1
- package/dist/form/typings.d.ts +4 -2
- package/dist/form/utils.d.ts +2 -3
- package/dist/forms.js +24973 -24940
- package/dist/forms.umd.cjs +61 -61
- package/package.json +2 -2
- package/dist/form/builder/constants.d.ts +0 -1
- package/dist/form/builder/hooks.d.ts +0 -7
- package/dist/form/constants.d.ts +0 -1
- package/dist/form/fields/URLField/constants.d.ts +0 -1
- package/dist/form/schema/context.d.ts +0 -2
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
import { SerializedURLField } from './typings';
|
|
3
3
|
import { BaseField, FieldOptions } from '../BaseField';
|
|
4
|
-
import { FieldRenderProps } from '../BaseFormElement';
|
|
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
|
}
|
|
@@ -3,7 +3,6 @@ import { SerializedUploadField } from './typings';
|
|
|
3
3
|
import { UUIDFile } from '../../UUIDFile';
|
|
4
4
|
import { UUIDPromise } from '../../UUIDPromise';
|
|
5
5
|
import { BaseField, FieldOptions, FieldValidator } from '../BaseField';
|
|
6
|
-
import { FieldRenderProps } from '../BaseFormElement';
|
|
7
6
|
import { MultiSelectField } from '../MultiSelectField';
|
|
8
7
|
import { NumberField } from '../NumberField';
|
|
9
8
|
export interface UploadFieldOptions extends FieldOptions {
|
|
@@ -13,12 +12,9 @@ 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;
|
|
21
|
-
readonly onlyValidateAfterTouched = false;
|
|
22
18
|
constructor(options: UploadFieldOptions);
|
|
23
19
|
static getFieldCreationSchema(parentPath?: string): ({
|
|
24
20
|
field: NumberField;
|
|
@@ -35,7 +31,7 @@ export declare class UploadField extends BaseField<"upload", (UUIDPromise<UUIDFi
|
|
|
35
31
|
static deserialize(data: SerializedUploadField): UploadField;
|
|
36
32
|
serializeValue(_value: (UUIDPromise<UUIDFile> | UUIDFile)[]): never[];
|
|
37
33
|
deserializeValue(_value: never[]): (UUIDPromise<UUIDFile> | UUIDFile)[];
|
|
38
|
-
render(
|
|
34
|
+
render(): ReactNode;
|
|
39
35
|
isSerializedValue(value: unknown): value is never[];
|
|
40
36
|
isValue(value: unknown): value is (UUIDPromise<UUIDFile> | UUIDFile)[];
|
|
41
37
|
areValuesEqual(value1: (UUIDPromise<UUIDFile> | UUIDFile)[], value2: (UUIDPromise<UUIDFile> | UUIDFile)[]): boolean;
|
|
@@ -3,12 +3,11 @@ import { FieldsRendererSize } from '../../renderer';
|
|
|
3
3
|
export interface InputWithLabelProps {
|
|
4
4
|
size: FieldsRendererSize;
|
|
5
5
|
inputId: string;
|
|
6
|
-
labelId: string;
|
|
7
6
|
label: string;
|
|
8
|
-
|
|
7
|
+
required: boolean;
|
|
8
|
+
description?: string | null;
|
|
9
9
|
image: File | Promise<File> | undefined;
|
|
10
10
|
children: ReactNode;
|
|
11
11
|
error: string;
|
|
12
|
-
className?: string;
|
|
13
12
|
}
|
|
14
13
|
export declare const InputWithLabel: import('react').MemoExoticComponent<(props: InputWithLabelProps) => import("react/jsx-runtime").JSX.Element>;
|
|
@@ -1,40 +1,17 @@
|
|
|
1
1
|
import { IconComponent } from '@overmap-ai/blocks';
|
|
2
|
-
import { FieldType } from './typings';
|
|
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 { FieldClass, FieldType } from './typings';
|
|
3
|
+
import { FieldTypeGroup } from './enums';
|
|
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,31 +1,17 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
import { AnyField,
|
|
3
|
-
import {
|
|
4
|
-
export declare const
|
|
5
|
-
export declare const
|
|
2
|
+
import { AnyField, ValueOfField } from './typings';
|
|
3
|
+
import { FieldSection } from './FieldSection';
|
|
4
|
+
export declare const useFieldSectionInputs: (fieldSections: FieldSection[]) => import("react/jsx-runtime").JSX.Element[];
|
|
5
|
+
export declare const useFieldInputs: (fields: AnyField[]) => ReactNode;
|
|
6
|
+
export interface useFieldInputProps<TField extends AnyField> {
|
|
6
7
|
field: TField;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
onBlur: (value: ValueOfField<TField>) => void;
|
|
18
|
-
value: ValueOfField<TField>;
|
|
19
|
-
name: string;
|
|
20
|
-
multiple?: boolean;
|
|
21
|
-
checked?: boolean;
|
|
22
|
-
};
|
|
23
|
-
readonly helpers: import('formik').FieldHelperProps<ValueOfField<TField>>;
|
|
24
|
-
readonly field: TField;
|
|
25
|
-
readonly touched: boolean;
|
|
26
|
-
}, {
|
|
27
|
-
readonly "aria-labelledby": string;
|
|
28
|
-
readonly formId: string;
|
|
29
|
-
readonly index: number;
|
|
30
|
-
readonly disabled?: boolean;
|
|
31
|
-
}];
|
|
8
|
+
}
|
|
9
|
+
export declare const useFieldInput: <TField extends AnyField>(props: useFieldInputProps<TField>) => {
|
|
10
|
+
value: ValueOfField<TField>;
|
|
11
|
+
name: TField["identifier"];
|
|
12
|
+
disabled: boolean | undefined;
|
|
13
|
+
isTouched: boolean;
|
|
14
|
+
error: string;
|
|
15
|
+
onChange: (value: ValueOfField<TField>) => void;
|
|
16
|
+
onBlur: import('react-hook-form').Noop;
|
|
17
|
+
};
|
|
@@ -26,6 +26,7 @@ export type Field = BooleanField | CheckboxListField | PassFailField | DateField
|
|
|
26
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;
|
|
27
27
|
export type FieldType = TypeOfField<Field> | TypeOfField<FieldSection>;
|
|
28
28
|
export type FieldValue = ValueOfField<Field>;
|
|
29
|
+
export type FieldError = string;
|
|
29
30
|
export type SerializedFieldValue = SerializedValueOfField<Field>;
|
|
30
31
|
export type SerializedField = SerializedTextField | SerializedBooleanField | SerializedNumberField | SerializedDateField | SerializedStringField | SerializedURLField | SerializedSelectField | SerializedFieldSection | SerializedMultiStringField | SerializedMultiSelectField | SerializedUploadField | SerializedScanField | SerializedRadioField | SerializedRatingField | SerializedCheckboxListField | SerializedOTPField | SerializedPassFailField;
|
|
31
32
|
export type SerializedOnlyField = Exclude<SerializedField, SerializedFieldSection>;
|
package/dist/form/index.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
export * from './builder';
|
|
2
2
|
export * from './conditions';
|
|
3
|
-
export * from './constants';
|
|
4
3
|
export * from './fields';
|
|
5
4
|
export * from './modifiers';
|
|
6
5
|
export * from './Observable';
|
|
@@ -10,3 +9,4 @@ export type * from './typings';
|
|
|
10
9
|
export * from './utils';
|
|
11
10
|
export * from './UUIDFile';
|
|
12
11
|
export * from './UUIDPromise';
|
|
12
|
+
export { fieldSpacingCva } from './cva';
|
|
@@ -3,20 +3,16 @@ import { FieldValues } from '../typings';
|
|
|
3
3
|
import { FieldsRendererSize } from './typings';
|
|
4
4
|
import { FieldSchema } from '../schema';
|
|
5
5
|
interface FieldsRendererProps {
|
|
6
|
-
|
|
6
|
+
disabled?: boolean;
|
|
7
7
|
fieldSchema: FieldSchema;
|
|
8
8
|
values?: FieldValues;
|
|
9
|
-
onValuesChange?: (
|
|
10
|
-
enableReinitialize?: boolean;
|
|
11
|
-
excludeUnchangedFields?: boolean;
|
|
9
|
+
onValuesChange?: (values: FieldValues) => void;
|
|
12
10
|
hideSubmit?: boolean;
|
|
13
|
-
onSubmit?: (values: FieldValues) =>
|
|
11
|
+
onSubmit?: (values: FieldValues) => void;
|
|
14
12
|
submitText?: string;
|
|
15
13
|
hideCancel?: boolean;
|
|
16
14
|
cancelText?: string;
|
|
17
15
|
onCancel?: () => void;
|
|
18
|
-
onDirty?: () => void;
|
|
19
|
-
onDirtyChange?: (dirty: boolean) => void;
|
|
20
16
|
className?: string;
|
|
21
17
|
buttonProps?: Omit<ButtonProps, "children">;
|
|
22
18
|
size?: FieldsRendererSize;
|
|
@@ -24,7 +24,7 @@ export declare class FieldSchema extends Observable<FieldSchema> implements Fiel
|
|
|
24
24
|
deserializeValues(values: SerializedFieldValues, clean?: boolean): FieldValues;
|
|
25
25
|
serializeValues(values: FieldValues, clean?: boolean): SerializedFieldValues;
|
|
26
26
|
initializeValues(values: FieldValues): FieldValues;
|
|
27
|
-
validateValues(values: FieldValues): import('
|
|
27
|
+
validateValues(values: FieldValues): import('..').FieldErrors;
|
|
28
28
|
deserializeConditions(serializedConditions: SerializedCondition[]): Condition[];
|
|
29
29
|
cleanConditions(conditions: Condition[]): Condition[];
|
|
30
30
|
serializeConditions(conditions: Condition[]): SerializedCondition[];
|
package/dist/form/typings.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import { Field, FieldValue, SerializedFieldValue } from './fields';
|
|
1
|
+
import { Field, FieldError, FieldValue, SerializedFieldValue } from './fields';
|
|
2
2
|
import { UUIDFile } from './UUIDFile';
|
|
3
3
|
import { UUIDPromise } from './UUIDPromise';
|
|
4
4
|
export type FieldValues = Record<Field["identifier"], FieldValue>;
|
|
5
|
+
export type FieldErrors = {
|
|
6
|
+
[identifier: Field["identifier"]]: FieldError | FieldErrors;
|
|
7
|
+
};
|
|
5
8
|
export type FieldFilesAndPromises = Record<Field["identifier"], (UUIDFile | UUIDPromise<UUIDFile>)[]>;
|
|
6
9
|
export type FieldFiles = Record<Field["identifier"], UUIDFile[]>;
|
|
7
10
|
export type SerializedFieldValues = Record<Field["identifier"], SerializedFieldValue>;
|
|
8
|
-
export type Severity = "danger" | "warning" | "info" | "success";
|
package/dist/form/utils.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { FieldFiles, FieldFilesAndPromises, FieldValues } from './typings';
|
|
1
|
+
import { FieldErrors, FieldFiles, FieldFilesAndPromises, FieldValues } from './typings';
|
|
3
2
|
import { AnyFormElement, SerializedFieldSection } from './fields';
|
|
4
|
-
export declare const
|
|
3
|
+
export declare const validateFieldValues: (fields: AnyFormElement[], values: FieldValues) => FieldErrors;
|
|
5
4
|
export declare const separateImagesFromFields: (fields: SerializedFieldSection[]) => Promise<{
|
|
6
5
|
fields: SerializedFieldSection[];
|
|
7
6
|
images: Record<string, File>;
|