@bolttech/form-engine 3.0.0-beta.16 → 3.0.0-beta.18

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.
@@ -1,46 +1,20 @@
1
1
  import { TFieldEvent } from '@bolttech/form-engine-core';
2
2
  /**
3
- * @type TFieldWrapper
4
- * Represents the wrapper for a form field, including the component,
5
- * event handlers, and other properties related to form management.
3
+ * Represents a field wrapper containing the name of the field and its index in the form.
6
4
  *
7
- * @property {string} index - The index of the field in the form.
8
- * @property {ElementType} Component - The component to be rendered.
9
- * @property {(event: unknown) => unknown} [valueChangeEvent] - Function to handle value change events.
10
- * @property {string} formKey - The key of the form.
11
- * @property {string} [onBlur] - Function to handle the blur event.
12
- * @property {string} [onChange] - Function to handle the change event.
13
- * @property {string} [onFocus] - Function to handle the focus event.
14
- * @property {string} [onClick] - Function to handle the click event.
15
- * @property {string} [onKeyUp] - Function to handle the keyup event.
16
- * @property {string} [onKeyDown] - Function to handle the keydown event.
17
- * @property {unknown} [onValue] - The current value of the field.
18
- * @property {string} [onErrorMessage] - error message prop name to set message string
19
- *
20
- * @example
21
- * ```typescript
22
- * const fieldWrapper: TFieldWrapper = {
23
- * index: '1',
24
- * Component: MyComponent,
25
- * valueChangeEvent: (event) => {
26
- * const newValue = (event as React.ChangeEvent<HTMLInputElement>).target.value;
27
- * return newValue;
28
- * },
29
- * formKey: 'myForm',
30
- * onBlur: 'handleBlur',
31
- * onChange: 'handleChange',
32
- * onFocus: 'handleFocus',
33
- * onClick: 'handleClick',
34
- * onKeyUp: 'handleKeyUp',
35
- * onKeyDown: 'handleKeyDown',
36
- * onValue: 'value'
37
- * };
38
- * ```
5
+ * @property {string} name - The name of the field.
6
+ * @property {string} formIndex - The index of the field within the form.
39
7
  */
40
8
  type TFieldWrapper = {
41
9
  name: string;
42
10
  formIndex: string;
43
11
  };
44
- type eventProps = 'onChange' | 'onBlur' | 'onFocus' | 'onKeyDown' | 'onKeyUp' | 'onMount' | 'onApiResponse' | 'onClick';
45
- type TEventsCallbackProps = Partial<Record<eventProps, ((payload: TFieldEvent) => void) | null | undefined>>;
46
- export { TFieldWrapper, eventProps, TEventsCallbackProps };
12
+ /**
13
+ * Represents the possible event properties for form fields callbacks.
14
+ */
15
+ type TEventProps = 'onChange' | 'onBlur' | 'onFocus' | 'onKeyDown' | 'onKeyUp' | 'onMount' | 'onApiResponse' | 'onClick' | 'onSubmit';
16
+ /**
17
+ * Represents a mapping of event properties to their corresponding callback functions.
18
+ */
19
+ type TEventsCallbackProps = Partial<Record<TEventProps, ((payload: TFieldEvent) => void) | null | undefined>>;
20
+ export { TFieldWrapper, TEventProps, TEventsCallbackProps };