@overmap-ai/forms 1.0.38 → 1.0.39-are-values-valid.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.
Files changed (97) hide show
  1. package/dist/form/adapters.d.ts +3 -0
  2. package/dist/form/builder/Root.d.ts +0 -1
  3. package/dist/form/builder/components/FieldSettingsPopover.d.ts +0 -1
  4. package/dist/form/builder/context.d.ts +4 -0
  5. package/dist/form/builder/utils.d.ts +2 -2
  6. package/dist/form/conditions/OTPFieldCondition/index.d.ts +1 -1
  7. package/dist/form/conditions/PassFailFieldCondition/index.d.ts +1 -1
  8. package/dist/form/conditions/TimeFieldCondition/TimeFieldCondition.d.ts +19 -0
  9. package/dist/form/conditions/TimeFieldCondition/TimeFieldCondition.test.d.ts +1 -0
  10. package/dist/form/conditions/TimeFieldCondition/TimeFieldConditionCell.d.ts +6 -0
  11. package/dist/form/conditions/TimeFieldCondition/index.d.ts +3 -0
  12. package/dist/form/conditions/TimeFieldCondition/typings.d.ts +4 -0
  13. package/dist/form/conditions/URLFieldCondition/URLFieldCondition.d.ts +18 -0
  14. package/dist/form/conditions/URLFieldCondition/URLFieldConditionCell.d.ts +6 -0
  15. package/dist/form/conditions/URLFieldCondition/index.d.ts +3 -0
  16. package/dist/form/conditions/URLFieldCondition/typings.d.ts +4 -0
  17. package/dist/form/conditions/components/TimeInputPopover.d.ts +9 -0
  18. package/dist/form/conditions/components/index.d.ts +1 -0
  19. package/dist/form/conditions/constants.d.ts +4 -0
  20. package/dist/form/conditions/index.d.ts +2 -0
  21. package/dist/form/conditions/typings.d.ts +5 -3
  22. package/dist/form/cva.d.ts +6 -0
  23. package/dist/form/fields/BaseField/BaseField.d.ts +2 -10
  24. package/dist/form/fields/BaseField/index.d.ts +1 -1
  25. package/dist/form/fields/BaseField/typings.d.ts +2 -2
  26. package/dist/form/fields/BaseFormElement/BaseFormElement.d.ts +2 -2
  27. package/dist/form/fields/BaseFormElement/index.d.ts +1 -1
  28. package/dist/form/fields/BaseFormElement/typings.d.ts +0 -7
  29. package/dist/form/fields/BaseOptionsField/BaseOptionsField.d.ts +0 -1
  30. package/dist/form/fields/BaseOptionsField/index.d.ts +1 -1
  31. package/dist/form/fields/BaseStringField/index.d.ts +1 -1
  32. package/dist/form/fields/BooleanField/BooleanField.d.ts +1 -5
  33. package/dist/form/fields/BooleanField/index.d.ts +1 -1
  34. package/dist/form/fields/CheckboxListField/CheckboxListField.d.ts +1 -5
  35. package/dist/form/fields/CheckboxListField/index.d.ts +1 -1
  36. package/dist/form/fields/DateField/DateField.d.ts +1 -5
  37. package/dist/form/fields/DateField/index.d.ts +1 -1
  38. package/dist/form/fields/FieldSection/FieldSection.d.ts +2 -4
  39. package/dist/form/fields/FieldSection/index.d.ts +1 -1
  40. package/dist/form/fields/MultiSelectField/MultiSelectField.d.ts +1 -4
  41. package/dist/form/fields/MultiSelectField/index.d.ts +1 -1
  42. package/dist/form/fields/MultiStringField/MultiStringField.d.ts +1 -5
  43. package/dist/form/fields/MultiStringField/index.d.ts +1 -1
  44. package/dist/form/fields/NumberField/NumberField.d.ts +1 -4
  45. package/dist/form/fields/NumberField/index.d.ts +1 -1
  46. package/dist/form/fields/OTPField/OTPField.d.ts +1 -4
  47. package/dist/form/fields/PassFailField/PassFailField.d.ts +1 -5
  48. package/dist/form/fields/PassFailField/index.d.ts +1 -1
  49. package/dist/form/fields/RadioField/RadioField.d.ts +1 -5
  50. package/dist/form/fields/RadioField/index.d.ts +1 -1
  51. package/dist/form/fields/RatingField/RatingField.d.ts +1 -4
  52. package/dist/form/fields/RatingField/cva.d.ts +3 -0
  53. package/dist/form/fields/RatingField/index.d.ts +1 -1
  54. package/dist/form/fields/ScanField/ScanField.d.ts +1 -5
  55. package/dist/form/fields/ScanField/index.d.ts +1 -1
  56. package/dist/form/fields/SelectField/SelectField.d.ts +1 -4
  57. package/dist/form/fields/SelectField/index.d.ts +1 -1
  58. package/dist/form/fields/StringField/StringField.d.ts +1 -4
  59. package/dist/form/fields/StringField/index.d.ts +1 -1
  60. package/dist/form/fields/TextField/TextField.d.ts +1 -4
  61. package/dist/form/fields/TextField/index.d.ts +1 -1
  62. package/dist/form/fields/TimeField/TimeField.d.ts +21 -0
  63. package/dist/form/fields/TimeField/TimeField.test.d.ts +1 -0
  64. package/dist/form/fields/TimeField/TimeFieldControl.d.ts +13 -0
  65. package/dist/form/fields/TimeField/TimeFieldInput.d.ts +7 -0
  66. package/dist/form/fields/TimeField/constants.d.ts +2 -0
  67. package/dist/form/fields/TimeField/index.d.ts +6 -0
  68. package/dist/form/fields/TimeField/typings.d.ts +11 -0
  69. package/dist/form/fields/TimeField/utils.d.ts +16 -0
  70. package/dist/form/fields/URLField/URLField.d.ts +25 -0
  71. package/dist/form/fields/URLField/URLField.test.d.ts +1 -0
  72. package/dist/form/fields/URLField/URLFieldInput.d.ts +7 -0
  73. package/dist/form/fields/URLField/index.d.ts +3 -0
  74. package/dist/form/fields/URLField/typings.d.ts +4 -0
  75. package/dist/form/fields/UploadField/UploadField.d.ts +1 -5
  76. package/dist/form/fields/UploadField/index.d.ts +1 -1
  77. package/dist/form/fields/components/InputWithLabel.d.ts +2 -3
  78. package/dist/form/fields/constants.d.ts +13 -34
  79. package/dist/form/fields/enums.d.ts +9 -0
  80. package/dist/form/fields/hooks.d.ts +15 -29
  81. package/dist/form/fields/index.d.ts +3 -0
  82. package/dist/form/fields/typings.d.ts +6 -3
  83. package/dist/form/index.d.ts +1 -1
  84. package/dist/form/modifiers/index.d.ts +1 -0
  85. package/dist/form/modifiers/time.d.ts +8 -0
  86. package/dist/form/renderer/FieldsRenderer.d.ts +3 -7
  87. package/dist/form/renderer/context.d.ts +1 -1
  88. package/dist/form/schema/FieldSchema.d.ts +2 -1
  89. package/dist/form/typings.d.ts +4 -2
  90. package/dist/form/utils.d.ts +2 -3
  91. package/dist/forms.js +6259 -5552
  92. package/dist/forms.umd.cjs +74 -59
  93. package/package.json +2 -2
  94. package/dist/form/builder/constants.d.ts +0 -1
  95. package/dist/form/builder/hooks.d.ts +0 -7
  96. package/dist/form/constants.d.ts +0 -1
  97. package/dist/form/schema/context.d.ts +0 -2
@@ -1,14 +1,10 @@
1
1
  import { ReactNode } from 'react';
2
2
  import { SerializedRadioField } from './typings';
3
- import { FieldRenderProps } from '../BaseFormElement';
4
3
  import { BaseOptionsField, BaseOptionsFieldOptions } from '../BaseOptionsField';
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
- readonly onlyValidateAfterTouched = false;
10
- static readonly fieldTypeName = "Option list";
11
- static readonly fieldTypeDescription = "Allows the user to select a single option from a list of options.";
12
8
  constructor(options: RadioFieldOptions);
13
9
  serialize(): SerializedRadioField;
14
10
  getOptions(): RadioFieldOptions;
@@ -17,7 +13,7 @@ export declare class RadioField extends BaseOptionsField<"radio", string | null,
17
13
  static deserialize(data: SerializedRadioField): RadioField;
18
14
  serializeValue(value: string | null): string | null;
19
15
  deserializeValue(value: string | null): string | null;
20
- render(props: FieldRenderProps): ReactNode;
16
+ render(): ReactNode;
21
17
  isSerializedValue(value: unknown): value is string | null;
22
18
  isValue(value: unknown): value is string | null;
23
19
  blankValue(): string | null;
@@ -1,3 +1,3 @@
1
1
  export * from './RadioField';
2
2
  export * from './RadioFieldInput';
3
- export * from './typings';
3
+ export type * from './typings';
@@ -1,15 +1,12 @@
1
1
  import { ReactNode } from 'react';
2
2
  import { SerializedRatingField } from './typings';
3
3
  import { BaseField, FieldOptions, FieldValidator } from '../BaseField';
4
- import { FieldRenderProps } from '../BaseFormElement';
5
4
  import { NumberField } from '../NumberField';
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(props: FieldRenderProps): ReactNode;
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;
@@ -0,0 +1,3 @@
1
+ export declare const ratingItemCva: (props?: ({
2
+ size?: "xs" | "sm" | "md" | "lg" | "xl" | null | undefined;
3
+ } & import('class-variance-authority/types').ClassProp) | undefined) => string;
@@ -1,3 +1,3 @@
1
1
  export * from './RatingField';
2
2
  export * from './RatingFieldInput';
3
- export * from './typings';
3
+ export type * from './typings';
@@ -1,14 +1,10 @@
1
1
  import { ReactNode } from 'react';
2
2
  import { SerializedScanField } from './typings';
3
3
  import { BaseField, FieldOptions } from '../BaseField';
4
- import { FieldRenderProps } from '../BaseFormElement';
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
- readonly onlyValidateAfterTouched = false;
12
8
  constructor(options: ScanFieldOptions);
13
9
  serialize(): SerializedScanField;
14
10
  getOptions(): ScanFieldOptions;
@@ -17,7 +13,7 @@ export declare class ScanField extends BaseField<"qr", string, string, ScanField
17
13
  static deserialize(data: SerializedScanField): ScanField;
18
14
  serializeValue(value: string): string;
19
15
  deserializeValue(value: string): string;
20
- render(props: FieldRenderProps): ReactNode;
16
+ render(): ReactNode;
21
17
  isSerializedValue(value: unknown): value is string;
22
18
  isValue(value: unknown): value is string;
23
19
  blankValue(): string;
@@ -1,3 +1,3 @@
1
1
  export * from './ScanField';
2
2
  export * from './ScanFieldInput';
3
- export * from './typings';
3
+ export type * from './typings';
@@ -1,14 +1,11 @@
1
1
  import { ReactNode } from 'react';
2
2
  import { SerializedSelectField } from './typings';
3
- import { FieldRenderProps } from '../BaseFormElement';
4
3
  import { BaseOptionsField, BaseOptionsFieldOptions } from '../BaseOptionsField';
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(props: FieldRenderProps): ReactNode;
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,3 +1,3 @@
1
1
  export * from './SelectField';
2
2
  export * from './SelectFieldInput';
3
- export * from './typings';
3
+ export type * from './typings';
@@ -1,18 +1,15 @@
1
1
  import { ReactNode } from 'react';
2
2
  import { SerializedStringField } from './typings';
3
- import { FieldRenderProps } from '../BaseFormElement';
4
3
  import { BaseStringField, BaseStringFieldOptions } from '../BaseStringField';
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(props: FieldRenderProps): ReactNode;
14
+ render(): ReactNode;
18
15
  }
@@ -1,4 +1,4 @@
1
1
  export * from './constants';
2
2
  export * from './StringField';
3
3
  export * from './StringFieldInput';
4
- export * from './typings';
4
+ export type * from './typings';
@@ -1,17 +1,14 @@
1
1
  import { ReactNode } from 'react';
2
2
  import { SerializedTextField } from './typings';
3
- import { FieldRenderProps } from '../BaseFormElement';
4
3
  import { BaseStringField, BaseStringFieldOptions } from '../BaseStringField';
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(props: FieldRenderProps): ReactNode;
13
+ render(): ReactNode;
17
14
  }
@@ -1,4 +1,4 @@
1
1
  export * from './constants';
2
2
  export * from './TextField';
3
3
  export * from './TextFieldInput';
4
- export * from './typings';
4
+ export type * from './typings';
@@ -0,0 +1,21 @@
1
+ import { ReactNode } from 'react';
2
+ import { SerializedTimeField, Time } from './typings';
3
+ import { BaseField, FieldOptions } from '../BaseField';
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 { TimeField } from './TimeField';
2
+ import { FieldRenderProps } from '../BaseFormElement';
3
+ interface TimeFieldInputProps extends FieldRenderProps {
4
+ field: TimeField;
5
+ }
6
+ export declare const TimeFieldInput: import('react').NamedExoticComponent<TimeFieldInputProps>;
7
+ export {};
@@ -0,0 +1,2 @@
1
+ export declare const UTC_OFFSETS: (`+${string}:${string}` | `-${string}:${string}`)[];
2
+ export declare const UTC_OFFSETS_SET: Set<`+${string}:${string}` | `-${string}:${string}`>;
@@ -0,0 +1,6 @@
1
+ export * from './TimeField';
2
+ export * from './TimeFieldControl';
3
+ export * from './TimeFieldInput';
4
+ export type * from './typings';
5
+ export * from './utils';
6
+ export * from './constants';
@@ -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;
@@ -0,0 +1,25 @@
1
+ import { ReactNode } from 'react';
2
+ import { SerializedURLField } from './typings';
3
+ import { BaseField, FieldOptions } from '../BaseField';
4
+ export interface URLFieldOptions extends FieldOptions {
5
+ placeholder?: string;
6
+ }
7
+ export declare class URLField extends BaseField<"url", URL | null, string | null, URLField> {
8
+ readonly type = "url";
9
+ placeholder: string;
10
+ constructor(options: URLFieldOptions);
11
+ serialize(): SerializedURLField;
12
+ getOptions(): URLFieldOptions;
13
+ duplicate(identifier: string): URLField;
14
+ setOptions(options: Partial<URLFieldOptions>): void;
15
+ static deserialize(data: SerializedURLField): URLField;
16
+ serializeValue(value: URL | null): string | null;
17
+ deserializeValue(value: string | null): URL | null;
18
+ isSerializedValue(value: unknown): value is string | null;
19
+ isValue(value: unknown): value is URL | null;
20
+ blankValue(): URL | null;
21
+ blankSerializedValue(): string | null;
22
+ areSerializedValuesEqual(value1: string | null, value2: string | null): boolean;
23
+ areValuesEqual(value1: URL | null, value2: URL | null): boolean;
24
+ render(): ReactNode;
25
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,7 @@
1
+ import { URLField } from './URLField';
2
+ import { FieldRenderProps } from '../BaseFormElement';
3
+ interface URLFieldInputProps extends FieldRenderProps {
4
+ field: URLField;
5
+ }
6
+ export declare const URLFieldInput: import('react').NamedExoticComponent<URLFieldInputProps>;
7
+ export {};
@@ -0,0 +1,3 @@
1
+ export * from './URLField';
2
+ export * from './URLFieldInput';
3
+ export type * from './typings';
@@ -0,0 +1,4 @@
1
+ import { BaseSerializedField } from '../BaseField';
2
+ export interface SerializedURLField extends BaseSerializedField<"url"> {
3
+ placeholder?: string;
4
+ }
@@ -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(props: FieldRenderProps): ReactNode;
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;
@@ -1,3 +1,3 @@
1
- export * from './typings';
1
+ export type * from './typings';
2
2
  export * from './UploadField';
3
3
  export * from './UploadFieldInput';
@@ -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
- description: string;
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,38 +1,17 @@
1
1
  import { IconComponent } from '@overmap-ai/blocks';
2
- import { FieldType } from './typings';
3
- import { BooleanField } from './BooleanField';
4
- import { CheckboxListField } from './CheckboxListField';
5
- import { DateField } from './DateField';
6
- import { MultiSelectField } from './MultiSelectField';
7
- import { MultiStringField } from './MultiStringField';
8
- import { NumberField } from './NumberField';
9
- import { OTPField } from './OTPField';
10
- import { PassFailField } from './PassFailField';
11
- import { RadioField } from './RadioField';
12
- import { RatingField } from './RatingField';
13
- import { ScanField } from './ScanField';
14
- import { SelectField } from './SelectField';
15
- import { StringField } from './StringField';
16
- import { TextField } from './TextField';
17
- import { UploadField } from './UploadField';
18
- export declare const FieldTypeToClsMapping: {
19
- date: typeof DateField;
20
- number: typeof NumberField;
21
- boolean: typeof BooleanField;
22
- select: typeof SelectField;
23
- string: typeof StringField;
24
- text: typeof TextField;
25
- upload: typeof UploadField;
26
- qr: typeof ScanField;
27
- "multi-string": typeof MultiStringField;
28
- "multi-select": typeof MultiSelectField;
29
- radio: typeof RadioField;
30
- "checkbox-list": typeof CheckboxListField;
31
- "pass-fail": typeof PassFailField;
32
- otp: typeof OTPField;
33
- rating: typeof RatingField;
34
- };
35
- 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
+ }>;
36
15
  export declare const maxFileSizeMB = 50;
37
16
  export declare const maxFileSizeKB: number;
38
17
  export declare const maxFileSizeB: number;
@@ -0,0 +1,9 @@
1
+ export declare enum FieldTypeGroup {
2
+ Text = "text",
3
+ Selection = "selection",
4
+ Numeric = "numeric",
5
+ Temporal = "temporal",
6
+ Capture = "capture",
7
+ Assessment = "assessment",
8
+ Verification = "verification"
9
+ }
@@ -1,31 +1,17 @@
1
1
  import { ReactNode } from 'react';
2
- import { AnyField, AnyFormElement, ValueOfField } from './typings';
3
- import { FieldRenderProps } from './BaseFormElement';
4
- export declare const useFieldInputs: (fields: AnyFormElement[], props: Omit<FieldRenderProps, "index">) => ReactNode;
5
- export declare const useFormikInput: <TField extends AnyField>(props: FieldRenderProps & {
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;
6
+ export interface useFieldInputProps<TField extends AnyField> {
6
7
  field: TField;
7
- }) => readonly [{
8
- readonly error: string;
9
- readonly size: import('..').FieldsRendererSize;
10
- readonly inputId: string;
11
- readonly labelId: string;
12
- readonly label: string;
13
- readonly description: string;
14
- readonly showInputOnly: boolean | undefined;
15
- readonly fieldProps: {
16
- onChange: (value: ValueOfField<TField>) => void;
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
+ };
@@ -21,6 +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';
27
+ export * from './URLField';
26
28
  export * from './utils';
29
+ export * from './enums';
@@ -15,18 +15,21 @@ 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';
20
+ import { SerializedURLField, URLField } from './URLField';
19
21
  export type AnyFormElement = BaseFormElement<any, any>;
20
22
  export type AnyField = BaseField<any, any, any, any>;
21
23
  export type TypeOfField<TField extends AnyFormElement> = TField extends BaseFormElement<infer TType, infer _TThis> ? TType : never;
22
24
  export type ValueOfField<TField extends AnyField> = TField extends BaseField<infer _TType, infer TValue, infer _TSerializedValue, infer _TThis> ? TValue : never;
23
25
  export type SerializedValueOfField<TField extends AnyField> = TField extends BaseField<infer _TType, infer _TValue, infer TSerializedValue, infer _TThis> ? TSerializedValue : never;
24
- export type Field = BooleanField | CheckboxListField | PassFailField | DateField | MultiSelectField | MultiStringField | NumberField | RadioField | RatingField | ScanField | SelectField | StringField | TextField | UploadField | OTPField;
25
- 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 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;
26
28
  export type FieldType = TypeOfField<Field> | TypeOfField<FieldSection>;
27
29
  export type FieldValue = ValueOfField<Field>;
30
+ export type FieldError = string;
28
31
  export type SerializedFieldValue = SerializedValueOfField<Field>;
29
- export type SerializedField = SerializedTextField | SerializedBooleanField | SerializedNumberField | SerializedDateField | SerializedStringField | 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;
30
33
  export type SerializedOnlyField = Exclude<SerializedField, SerializedFieldSection>;
31
34
  export interface FieldsManager {
32
35
  readonly fields: Field[];
@@ -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';
@@ -4,5 +4,6 @@ export * from './file';
4
4
  export * from './number';
5
5
  export * from './passFailStatus';
6
6
  export * from './string';
7
+ export * from './time';
7
8
  export type * from './typings';
8
9
  export * from './utils';
@@ -0,0 +1,8 @@
1
+ import { TimeRange } from '../fields';
2
+ import { ConditionModifier } from './conditionModifier';
3
+ export declare const TimeEqualsConditionModifier: ConditionModifier<`T${string}:${string}:00+${string}:${string}` | `T${string}:${string}:00-${string}:${string}`, `T${string}:${string}:00+${string}:${string}` | `T${string}:${string}:00-${string}:${string}`, `T${string}:${string}:00+${string}:${string}` | `T${string}:${string}:00-${string}:${string}`>;
4
+ export declare const TimeNotEqualsConditionModifier: ConditionModifier<`T${string}:${string}:00+${string}:${string}` | `T${string}:${string}:00-${string}:${string}`, `T${string}:${string}:00+${string}:${string}` | `T${string}:${string}:00-${string}:${string}`, `T${string}:${string}:00+${string}:${string}` | `T${string}:${string}:00-${string}:${string}`>;
5
+ export declare const TimeBeforeConditionModifier: ConditionModifier<`T${string}:${string}:00+${string}:${string}` | `T${string}:${string}:00-${string}:${string}`, `T${string}:${string}:00+${string}:${string}` | `T${string}:${string}:00-${string}:${string}`, `T${string}:${string}:00+${string}:${string}` | `T${string}:${string}:00-${string}:${string}`>;
6
+ export declare const TimeAfterConditionModifier: ConditionModifier<`T${string}:${string}:00+${string}:${string}` | `T${string}:${string}:00-${string}:${string}`, `T${string}:${string}:00+${string}:${string}` | `T${string}:${string}:00-${string}:${string}`, `T${string}:${string}:00+${string}:${string}` | `T${string}:${string}:00-${string}:${string}`>;
7
+ export declare const TimeRangeInConditionModifier: ConditionModifier<`T${string}:${string}:00+${string}:${string}` | `T${string}:${string}:00-${string}:${string}`, TimeRange, TimeRange>;
8
+ export declare const TimeRangeNotInConditionModifier: ConditionModifier<`T${string}:${string}:00+${string}:${string}` | `T${string}:${string}:00-${string}:${string}`, TimeRange, TimeRange>;
@@ -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
- readonly?: boolean;
6
+ disabled?: boolean;
7
7
  fieldSchema: FieldSchema;
8
8
  values?: FieldValues;
9
- onValuesChange?: (allValues: FieldValues, changedValues: FieldValues) => void;
10
- enableReinitialize?: boolean;
11
- excludeUnchangedFields?: boolean;
9
+ onValuesChange?: (values: FieldValues) => void;
12
10
  hideSubmit?: boolean;
13
- onSubmit?: (values: FieldValues) => Promise<void> | void;
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;
@@ -1,5 +1,5 @@
1
- import { FieldsRendererSize } from './typings';
2
1
  import { FieldSchema } from '../schema';
2
+ import { FieldsRendererSize } from './typings';
3
3
  interface FieldsRendererContextType {
4
4
  fieldSchema: FieldSchema;
5
5
  size: FieldsRendererSize;
@@ -24,7 +24,8 @@ 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('formik').FormikErrors<FieldValues> | undefined;
27
+ validateValues(values: FieldValues): import('..').FieldErrors;
28
+ areValuesValid(values: FieldValues): boolean;
28
29
  deserializeConditions(serializedConditions: SerializedCondition[]): Condition[];
29
30
  cleanConditions(conditions: Condition[]): Condition[];
30
31
  serializeConditions(conditions: Condition[]): SerializedCondition[];
@@ -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";