@eliseubatista99/react-scaffold-core 0.1.97 → 0.1.99

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,9 +1,5 @@
1
1
  import { default as React } from 'react';
2
- import { FormFieldOutputData } from '../../types';
3
- export interface FormFieldInputData {
4
- name: string;
5
- content: JSX.Element;
6
- }
2
+ import { FormFieldInputData, FormFieldOutputData } from '../../types';
7
3
  export interface FormSubmitButton {
8
4
  styles?: React.CSSProperties;
9
5
  content: React.ReactNode;
@@ -14,7 +10,8 @@ export interface FormProps {
14
10
  styles?: React.CSSProperties;
15
11
  };
16
12
  submitButton: FormSubmitButton;
17
- onSubmit: (data: FormFieldOutputData[]) => void;
13
+ onPreSubmit?: () => void;
14
+ onSubmit: (data: FormFieldOutputData[]) => Promise<void>;
18
15
  styles?: React.CSSProperties;
19
16
  }
20
17
  export declare const Form: (props: FormProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,8 +1,7 @@
1
1
  import { default as React } from 'react';
2
2
  import { FormProps } from './form';
3
- export type FormFieldValidation = (value: string) => string | undefined;
4
- export declare const useFormHelper: ({ onSubmit, fields }: FormProps) => {
3
+ export declare const useFormHelper: ({ onPreSubmit, onSubmit, fields }: FormProps) => {
5
4
  ref: React.RefObject<HTMLFormElement | null>;
6
5
  submitForm: (_: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;
7
- handleFormSubmission: (event: React.FormEvent<HTMLFormElement>) => void;
6
+ handleFormSubmission: (event: React.FormEvent<HTMLFormElement>) => Promise<void>;
8
7
  };
@@ -22,7 +22,7 @@ declare const meta: {
22
22
  marginTop: string;
23
23
  };
24
24
  };
25
- onSubmit: (data: import('../../..').FormFieldOutputData[]) => void;
25
+ onSubmit: (_: import('../../..').FormFieldOutputData[]) => Promise<void>;
26
26
  styles: {
27
27
  boxSizing: "border-box";
28
28
  width: string;
@@ -0,0 +1,2 @@
1
+ import { FormProps } from '../form';
2
+ export declare const FormStoriesSetup: (props: FormProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,5 +1,5 @@
1
1
  import { FormFieldOutputData } from '../../types';
2
2
  export declare class FormsHelper {
3
- static getField: <T>(data: FormFieldOutputData[], name: string) => T | undefined;
4
- static getFieldOrDefault: <T>(data: FormFieldOutputData[], name: string, defaultValue: T) => T | undefined;
3
+ static getField: (data: FormFieldOutputData[], name: string) => FormFieldOutputData | undefined;
4
+ static getFieldValue: <T>(data: FormFieldOutputData[], name: string) => T | undefined;
5
5
  }