@eliseubatista99/react-scaffold-core 0.2.1 → 0.2.3
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/components/form/form.d.ts +4 -5
- package/dist/components/form/form.hook.d.ts +1 -1
- package/dist/components/form/stories/form.stories.d.ts +9 -7
- package/dist/helpers/formsHelper/formsHelper.d.ts +1 -1
- package/dist/index.cjs.js +10 -10
- package/dist/index.es.js +261 -257
- package/dist/types/types.d.ts +1 -0
- package/package.json +1 -1
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { FormFieldConfiguration, FormFieldOutputData } from '../../types';
|
|
3
3
|
export interface FormSubmitButton {
|
|
4
4
|
styles?: React.CSSProperties;
|
|
5
5
|
content: React.ReactNode;
|
|
6
6
|
}
|
|
7
7
|
export interface FormProps {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
styles?: React.CSSProperties;
|
|
11
|
-
};
|
|
8
|
+
children?: React.ReactNode;
|
|
9
|
+
configurations?: FormFieldConfiguration[];
|
|
12
10
|
submitButton: FormSubmitButton;
|
|
13
11
|
onPreSubmit?: () => void;
|
|
14
12
|
onSubmit: (data: FormFieldOutputData[]) => Promise<void>;
|
|
15
13
|
styles?: React.CSSProperties;
|
|
14
|
+
childrenStyles?: React.CSSProperties;
|
|
16
15
|
}
|
|
17
16
|
export declare const Form: (props: FormProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
2
|
import { FormProps } from './form';
|
|
3
|
-
export declare const useFormHelper: ({ onPreSubmit, onSubmit,
|
|
3
|
+
export declare const useFormHelper: ({ onPreSubmit, onSubmit, configurations, }: FormProps) => {
|
|
4
4
|
ref: React.RefObject<HTMLFormElement | null>;
|
|
5
5
|
submitForm: (_: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;
|
|
6
6
|
handleFormSubmission: (event: React.FormEvent<HTMLFormElement>) => Promise<void>;
|
|
@@ -7,14 +7,16 @@ declare const meta: {
|
|
|
7
7
|
};
|
|
8
8
|
tags: string[];
|
|
9
9
|
args: {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
gap: string;
|
|
10
|
+
children: import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
configurations: {
|
|
12
|
+
name: string;
|
|
13
|
+
emptyValidation: {
|
|
14
|
+
allow: false;
|
|
15
|
+
errorMessage: string;
|
|
17
16
|
};
|
|
17
|
+
}[];
|
|
18
|
+
childrenStyles: {
|
|
19
|
+
gap: string;
|
|
18
20
|
};
|
|
19
21
|
submitButton: {
|
|
20
22
|
content: import("react/jsx-runtime").JSX.Element;
|
|
@@ -2,5 +2,5 @@ import { FormFieldOutputData } from '../../types';
|
|
|
2
2
|
export declare class FormsHelper {
|
|
3
3
|
static getField: (data: FormFieldOutputData[], name: string) => FormFieldOutputData | undefined;
|
|
4
4
|
static getFieldValue: <T>(field: FormFieldOutputData | undefined) => T | undefined;
|
|
5
|
-
static getFieldValueOrDefault: <T>(field: FormFieldOutputData | undefined, defaultValue
|
|
5
|
+
static getFieldValueOrDefault: <T>(field: FormFieldOutputData | undefined, defaultValue: T) => T;
|
|
6
6
|
}
|