@overmap-ai/forms 1.0.36-title-and-description-removal.0 → 1.0.37-condition-serialize-improvements.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.
@@ -2,3 +2,6 @@ import { Condition, SerializedCondition } from './typings';
2
2
  import { Field } from '../fields';
3
3
  export declare const deserializeCondition: (field: Field, serializedCondition: SerializedCondition) => Condition;
4
4
  export declare const deserializeConditions: (fields: Field[], serializedConditions: SerializedCondition[]) => Condition[];
5
+ export declare const serializeConditions: (fields: Field[], conditions: Condition[]) => SerializedCondition[];
6
+ export declare const cleanSerializedConditions: (fields: Field[], serializedConditions: SerializedCondition[]) => SerializedCondition[];
7
+ export declare const cleanConditions: (fields: Field[], conditions: Condition[]) => Condition[];
@@ -1,4 +1,4 @@
1
- import { TextSize } from '@overmap-ai/blocks';
1
+ import { FieldsRendererSize } from '../../renderer';
2
2
  export interface BaseFormElementOptions {
3
3
  identifier: string;
4
4
  }
@@ -8,7 +8,8 @@ export interface BaseSerializedFormElement<TType extends string> {
8
8
  }
9
9
  export interface FieldRenderProps {
10
10
  formId: string;
11
- size?: TextSize;
11
+ size: FieldsRendererSize;
12
+ index: number;
12
13
  disabled?: boolean;
13
14
  onValuesChange?: (identifier: string, value: any) => void;
14
15
  showInputOnly?: boolean;
@@ -1,14 +1,14 @@
1
- import { TextSize } from '@overmap-ai/blocks';
2
1
  import { ReactNode } from 'react';
3
- import { Severity } from '../../typings';
2
+ import { FieldsRendererSize } from '../../renderer';
4
3
  export interface InputWithLabelProps {
5
- size?: TextSize;
6
- severity: Severity | undefined;
4
+ size: FieldsRendererSize;
7
5
  inputId: string;
8
6
  labelId: string;
9
7
  label: string;
8
+ description: string;
10
9
  image: File | Promise<File> | undefined;
11
10
  children: ReactNode;
11
+ error: string;
12
12
  className?: string;
13
13
  }
14
14
  export declare const InputWithLabel: import('react').MemoExoticComponent<(props: InputWithLabelProps) => import("react/jsx-runtime").JSX.Element>;
@@ -1,3 +1 @@
1
- export * from './InputWithHelpText';
2
1
  export * from './InputWithLabel';
3
- export * from './InputWithLabelAndHelpText';
@@ -2,16 +2,16 @@ import { ReactNode } from 'react';
2
2
  import { AnyField, AnyFormElement, ValueOfField } from './typings';
3
3
  import { FieldRenderProps } from './BaseFormElement';
4
4
  export declare const useFieldInput: <TField extends AnyFormElement>(field: TField, props: FieldRenderProps) => ReactNode;
5
- export declare const useFieldInputs: (fields: AnyFormElement[], props: FieldRenderProps) => ReactNode;
5
+ export declare const useFieldInputs: (fields: AnyFormElement[], props: Omit<FieldRenderProps, "index">) => ReactNode;
6
6
  export declare const useFormikInput: <TField extends AnyField>(props: FieldRenderProps & {
7
7
  field: TField;
8
8
  }) => readonly [{
9
- readonly helpText: string | null;
10
- readonly size: import('@overmap-ai/blocks').TextSize | undefined;
11
- readonly severity: "danger" | undefined;
9
+ readonly error: string;
10
+ readonly size: import('..').FieldsRendererSize;
12
11
  readonly inputId: string;
13
12
  readonly labelId: string;
14
13
  readonly label: string;
14
+ readonly description: string;
15
15
  readonly showInputOnly: boolean | undefined;
16
16
  readonly fieldProps: {
17
17
  onChange: (value: ValueOfField<TField>) => void;
@@ -27,5 +27,6 @@ export declare const useFormikInput: <TField extends AnyField>(props: FieldRende
27
27
  }, {
28
28
  readonly "aria-labelledby": string;
29
29
  readonly formId: string;
30
+ readonly index: number;
30
31
  readonly disabled?: boolean;
31
32
  }];
@@ -1,9 +1,8 @@
1
1
  import { ButtonProps } from '@overmap-ai/blocks';
2
2
  import { FieldValues } from '../typings';
3
+ import { FieldsRendererSize } from './typings';
3
4
  import { FieldSchema } from '../schema';
4
- interface FormRendererProps {
5
- title: string;
6
- description?: string;
5
+ interface FieldsRendererProps {
7
6
  readonly?: boolean;
8
7
  fieldSchema: FieldSchema;
9
8
  values?: FieldValues;
@@ -18,10 +17,9 @@ interface FormRendererProps {
18
17
  onCancel?: () => void;
19
18
  onDirty?: () => void;
20
19
  onDirtyChange?: (dirty: boolean) => void;
21
- hideDescription?: boolean;
22
- hideTitle?: boolean;
23
20
  className?: string;
24
21
  buttonProps?: Omit<ButtonProps, "children">;
22
+ size?: FieldsRendererSize;
25
23
  }
26
- export declare const FormRenderer: import('react').NamedExoticComponent<FormRendererProps & import('react').RefAttributes<HTMLFormElement>>;
24
+ export declare const FieldsRenderer: import('react').NamedExoticComponent<FieldsRendererProps & import('react').RefAttributes<HTMLFormElement>>;
27
25
  export {};
@@ -1,2 +1,8 @@
1
+ import { FieldsRendererSize } from './typings';
1
2
  import { FieldSchema } from '../schema';
2
- export declare const RendererContext: import('react').Context<FieldSchema>;
3
+ interface FieldsRendererContextType {
4
+ fieldSchema: FieldSchema;
5
+ size: FieldsRendererSize;
6
+ }
7
+ export declare const FieldsRendererContext: import('react').Context<FieldsRendererContextType>;
8
+ export {};
@@ -1 +1,2 @@
1
- export * from './FormRenderer';
1
+ export * from './FieldsRenderer';
2
+ export type * from './typings';
@@ -0,0 +1 @@
1
+ export type FieldsRendererSize = "xs" | "sm" | "md" | "lg" | "xl";
@@ -1,7 +1,7 @@
1
1
  import { DirectedGraph } from 'graphology';
2
2
  import { FieldFilesAndPromises, FieldValues, SerializedFieldValues } from '../typings';
3
3
  import { ReseedOptions } from '../builder/list/sectionSerialization';
4
- import { SerializedCondition } from '../conditions';
4
+ import { Condition, SerializedCondition } from '../conditions';
5
5
  import { Field, FieldSection, FieldSectionManager, SerializedFieldSection } from '../fields';
6
6
  import { Observable } from '../Observable';
7
7
  export declare class FieldSchema extends Observable<FieldSchema> implements FieldSectionManager {
@@ -25,7 +25,8 @@ export declare class FieldSchema extends Observable<FieldSchema> implements Fiel
25
25
  serializeValues(values: FieldValues, clean?: boolean): SerializedFieldValues;
26
26
  initializeValues(values: FieldValues): FieldValues;
27
27
  validateValues(values: FieldValues): import('formik').FormikErrors<FieldValues> | undefined;
28
- deserializeConditions(conditions: SerializedCondition[]): import('..').Condition[];
28
+ deserializeConditions(serializedConditions: SerializedCondition[]): Condition[];
29
+ serializeConditions(conditions: Condition[]): SerializedCondition[];
29
30
  changedFieldValues(values1: FieldValues, values2: FieldValues): FieldValues;
30
31
  unchangedFieldValues(values1: FieldValues, values2: FieldValues): FieldValues;
31
32
  areValuesEqual(values1: FieldValues, values2: FieldValues): boolean;