@overmap-ai/forms 1.0.36-add-utils.20 → 1.0.36-fields-renderer-size.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/builder/Root.d.ts +0 -4
- package/dist/form/builder/context.d.ts +0 -2
- package/dist/form/builder/index.d.ts +1 -1
- package/dist/form/builder/preview/Preview.d.ts +1 -4
- package/dist/form/builder/typings.d.ts +1 -3
- package/dist/form/fields/BaseFormElement/typings.d.ts +2 -2
- package/dist/form/fields/components/InputWithHelpText.d.ts +2 -0
- package/dist/form/fields/components/InputWithLabel.d.ts +2 -2
- package/dist/form/fields/components/index.d.ts +0 -1
- package/dist/form/fields/hooks.d.ts +1 -1
- package/dist/form/renderer/{FormRenderer.d.ts → FieldsRenderer.d.ts} +6 -18
- package/dist/form/renderer/context.d.ts +7 -1
- package/dist/form/renderer/index.d.ts +2 -1
- package/dist/form/renderer/typings.d.ts +1 -0
- package/dist/forms.js +3658 -3740
- package/dist/forms.umd.cjs +58 -58
- package/package.json +1 -1
- package/dist/form/fields/components/InputWithLabelAndHelpText.d.ts +0 -8
|
@@ -2,13 +2,9 @@ import { PropsWithChildren } from 'react';
|
|
|
2
2
|
import { FormBuilderSaveHandler } from './typings';
|
|
3
3
|
import { SerializedFieldSection } from '../fields';
|
|
4
4
|
export interface FormBuilderRootProps extends PropsWithChildren {
|
|
5
|
-
initialTitle?: string;
|
|
6
|
-
initialDescription?: string;
|
|
7
5
|
initialFields?: SerializedFieldSection[];
|
|
8
6
|
onSave: FormBuilderSaveHandler;
|
|
9
7
|
onCancel?: () => void;
|
|
10
|
-
hideTitle?: boolean;
|
|
11
|
-
hideDescription?: boolean;
|
|
12
8
|
enableReinitialize?: boolean;
|
|
13
9
|
disableRequiredFields?: boolean;
|
|
14
10
|
}
|
|
@@ -3,7 +3,7 @@ export declare const FormBuilder: {
|
|
|
3
3
|
Root: import('react').NamedExoticComponent<import('./Root').FormBuilderRootProps>;
|
|
4
4
|
FlowBuilder: import('react').MemoExoticComponent<() => import("react/jsx-runtime").JSX.Element>;
|
|
5
5
|
ListBuilder: import('react').MemoExoticComponent<() => import("react/jsx-runtime").JSX.Element>;
|
|
6
|
-
Preview: import('react').
|
|
6
|
+
Preview: import('react').MemoExoticComponent<() => import("react/jsx-runtime").JSX.Element>;
|
|
7
7
|
};
|
|
8
8
|
export { createCondition } from './utils';
|
|
9
9
|
export { createField } from './utils';
|
|
@@ -1,4 +1 @@
|
|
|
1
|
-
export
|
|
2
|
-
showFormTitle?: boolean;
|
|
3
|
-
}
|
|
4
|
-
export declare const FormBuilderPreview: import('react').NamedExoticComponent<FormBuilderPreviewProps>;
|
|
1
|
+
export declare const FormBuilderPreview: import('react').MemoExoticComponent<() => import("react/jsx-runtime").JSX.Element>;
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import { SerializedFieldSection } from '../fields';
|
|
2
2
|
export interface FormBuilderValues {
|
|
3
|
-
title: string;
|
|
4
|
-
description: string;
|
|
5
3
|
fields: SerializedFieldSection[];
|
|
6
4
|
}
|
|
7
|
-
export type FormBuilderSaveHandler = (
|
|
5
|
+
export type FormBuilderSaveHandler = (values: FormBuilderValues) => void;
|
|
8
6
|
/** Using `lodash.get` and `lodash.set`, we can set and get attributes of nested objects using a string path. This is
|
|
9
7
|
used to get and set attributes of the `fields` of a `SerializedFieldSection` object. */
|
|
10
8
|
export type NestedFieldPath = "fields" | `fields.${number}.fields`;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { FieldsRendererSize } from '../../renderer';
|
|
2
2
|
export interface BaseFormElementOptions {
|
|
3
3
|
identifier: string;
|
|
4
4
|
}
|
|
@@ -8,7 +8,7 @@ export interface BaseSerializedFormElement<TType extends string> {
|
|
|
8
8
|
}
|
|
9
9
|
export interface FieldRenderProps {
|
|
10
10
|
formId: string;
|
|
11
|
-
size
|
|
11
|
+
size: FieldsRendererSize;
|
|
12
12
|
disabled?: boolean;
|
|
13
13
|
onValuesChange?: (identifier: string, value: any) => void;
|
|
14
14
|
showInputOnly?: boolean;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { ReactElement } from 'react';
|
|
2
|
+
import { FieldsRendererSize } from '../../renderer';
|
|
2
3
|
import { Severity } from '../../typings';
|
|
3
4
|
export interface InputWithHelpTextProps {
|
|
4
5
|
severity: Severity | undefined;
|
|
5
6
|
helpText: string | null;
|
|
6
7
|
children: ReactElement;
|
|
8
|
+
size: FieldsRendererSize;
|
|
7
9
|
}
|
|
8
10
|
export declare const InputWithHelpText: (props: InputWithHelpTextProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { TextSize } from '@overmap-ai/blocks';
|
|
2
1
|
import { ReactNode } from 'react';
|
|
2
|
+
import { FieldsRendererSize } from '../../renderer';
|
|
3
3
|
import { Severity } from '../../typings';
|
|
4
4
|
export interface InputWithLabelProps {
|
|
5
|
-
size
|
|
5
|
+
size: FieldsRendererSize;
|
|
6
6
|
severity: Severity | undefined;
|
|
7
7
|
inputId: string;
|
|
8
8
|
labelId: string;
|
|
@@ -7,7 +7,7 @@ export declare const useFormikInput: <TField extends AnyField>(props: FieldRende
|
|
|
7
7
|
field: TField;
|
|
8
8
|
}) => readonly [{
|
|
9
9
|
readonly helpText: string | null;
|
|
10
|
-
readonly size: import('
|
|
10
|
+
readonly size: import('..').FieldsRendererSize;
|
|
11
11
|
readonly severity: "danger" | undefined;
|
|
12
12
|
readonly inputId: string;
|
|
13
13
|
readonly labelId: string;
|
|
@@ -1,37 +1,25 @@
|
|
|
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
|
|
5
|
-
title: string;
|
|
6
|
-
description?: string;
|
|
5
|
+
interface FieldsRendererProps {
|
|
7
6
|
readonly?: boolean;
|
|
8
|
-
/** The schema of the form the render */
|
|
9
7
|
fieldSchema: FieldSchema;
|
|
10
|
-
/** Initial values of the form */
|
|
11
8
|
values?: FieldValues;
|
|
12
|
-
/** The function to call when the form values change */
|
|
13
9
|
onValuesChange?: (allValues: FieldValues, changedValues: FieldValues) => void;
|
|
14
10
|
enableReinitialize?: boolean;
|
|
15
11
|
excludeUnchangedFields?: boolean;
|
|
12
|
+
hideSubmit?: boolean;
|
|
16
13
|
onSubmit?: (values: FieldValues) => Promise<void> | void;
|
|
17
|
-
/** @default "Submit" */
|
|
18
14
|
submitText?: string;
|
|
19
|
-
|
|
20
|
-
* @default null
|
|
21
|
-
*/
|
|
15
|
+
hideCancel?: boolean;
|
|
22
16
|
cancelText?: string;
|
|
23
17
|
onCancel?: () => void;
|
|
24
18
|
onDirty?: () => void;
|
|
25
19
|
onDirtyChange?: (dirty: boolean) => void;
|
|
26
|
-
/** Hide the form description
|
|
27
|
-
* @default false */
|
|
28
|
-
hideDescription?: boolean;
|
|
29
|
-
/** Hide the title (and description)
|
|
30
|
-
* @default false
|
|
31
|
-
*/
|
|
32
|
-
hideTitle?: boolean;
|
|
33
20
|
className?: string;
|
|
34
21
|
buttonProps?: Omit<ButtonProps, "children">;
|
|
22
|
+
size?: FieldsRendererSize;
|
|
35
23
|
}
|
|
36
|
-
export declare const
|
|
24
|
+
export declare const FieldsRenderer: import('react').NamedExoticComponent<FieldsRendererProps & import('react').RefAttributes<HTMLFormElement>>;
|
|
37
25
|
export {};
|
|
@@ -1,2 +1,8 @@
|
|
|
1
|
+
import { FieldsRendererSize } from './typings';
|
|
1
2
|
import { FieldSchema } from '../schema';
|
|
2
|
-
|
|
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 './
|
|
1
|
+
export * from './FieldsRenderer';
|
|
2
|
+
export type * from './typings';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type FieldsRendererSize = "xs" | "sm" | "md" | "lg" | "xl";
|