Skip to content

Commit 65c306c

Browse files
committed
Added types folder to git
1 parent 0f70973 commit 65c306c

File tree

2 files changed

+36
-1
lines changed

2 files changed

+36
-1
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
node_modules
22
dist
3-
types
43
package/
54
*.tgz

types/index.d.ts

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import type { Writable } from 'svelte/store';
2+
import type { ObjectSchema } from 'yup';
3+
declare type FormState = {
4+
[key: string]: {
5+
_touched?: boolean;
6+
_errors?: string[];
7+
[key: string]: any;
8+
};
9+
};
10+
declare type FormConfigInput<Data = any> = {
11+
initialValues: Data;
12+
validationSchema?: ObjectSchema<any>;
13+
css?: {
14+
enabled?: boolean;
15+
validClass?: string;
16+
invalidClass?: string;
17+
useValid?: boolean;
18+
useInvalid?: boolean;
19+
};
20+
validateOnChange?: boolean;
21+
validateOnBlur?: boolean;
22+
};
23+
export declare function createForm<Data>({ initialValues, validationSchema, css: cssConfig, validateOnChange, validateOnBlur }: FormConfigInput<Data>): {
24+
form: Writable<Data>;
25+
state: Writable<FormState>;
26+
isValid: Writable<boolean>;
27+
isTouched: Writable<boolean>;
28+
validateForm: (highlight?: 'none' | 'errors' | 'all') => void;
29+
handleChange: (event: Event) => void;
30+
updateForm: () => Promise<void>;
31+
setTouched: (state: boolean) => void;
32+
formControl: (node: HTMLInputElement, options?: any) => {
33+
destroy(): void;
34+
};
35+
};
36+
export {};

0 commit comments

Comments
 (0)