@mantine/form
Advanced tools
Comparing version
@@ -1,2 +0,3 @@ | ||
import { FormFieldSubscriber, LooseKeys, Watch } from '../../types'; | ||
import { LooseKeys } from '../../paths.types'; | ||
import { FormFieldSubscriber, Watch } from '../../types'; | ||
import { $FormStatus } from '../use-form-status/use-form-status'; | ||
@@ -3,0 +4,0 @@ import { SetValuesSubscriberPayload } from '../use-form-values/use-form-values'; |
@@ -0,1 +1,2 @@ | ||
import type { FormPathValue, LooseKeys } from './paths.types'; | ||
import type { formRootRule } from './validate/validate-values'; | ||
@@ -31,3 +32,2 @@ export type GetInputPropsType = 'input' | 'checkbox'; | ||
export type FormValidateInput<Values> = FormRulesRecord<Values> | ((values: Values) => FormErrors); | ||
export type LooseKeys<Values> = keyof Values | (string & {}); | ||
export type SetValues<Values> = React.Dispatch<React.SetStateAction<Partial<Values>>>; | ||
@@ -56,4 +56,3 @@ export type SetInitialValues<Values> = (values: Values) => void; | ||
export type GetInputProps<Values> = <Field extends LooseKeys<Values>>(path: Field, options?: GetInputPropsOptions) => GetInputPropsReturnType; | ||
export type PathValue<T, P extends LooseKeys<T>> = P extends `${infer K}.${infer Rest}` ? K extends keyof T ? PathValue<T[K], Rest> : unknown : P extends keyof T ? T[P] : unknown; | ||
export type SetFieldValue<Values> = <Field extends LooseKeys<Values>>(path: Field, value: PathValue<Values, Field> | ((prevValue: PathValue<Values, Field>) => PathValue<Values, Field>), options?: { | ||
export type SetFieldValue<Values> = <Field extends LooseKeys<Values>>(path: Field, value: FormPathValue<Values, Field> | ((prevValue: FormPathValue<Values, Field>) => FormPathValue<Values, Field>), options?: { | ||
forceUpdate: boolean; | ||
@@ -70,3 +69,3 @@ }) => void; | ||
export type SetFieldDirty<Values> = <Field extends LooseKeys<Values>>(path: Field, dirty: boolean, forceUpdate?: boolean) => void; | ||
export type SetCalculatedFieldDirty<Values> = <Field extends LooseKeys<Values>>(path: Field, value: PathValue<Values, Field>) => void; | ||
export type SetCalculatedFieldDirty<Values> = <Field extends LooseKeys<Values>>(path: Field, value: FormPathValue<Values, Field>) => void; | ||
export type ReorderListItem<Values> = <Field extends LooseKeys<Values>>(path: Field, payload: ReorderPayload) => void; | ||
@@ -84,4 +83,4 @@ export type InsertListItem<Values> = <Field extends LooseKeys<Values>>(path: Field, item: unknown, index?: number) => void; | ||
export type FormFieldSubscriber<Values, Field extends LooseKeys<Values>> = (input: { | ||
previousValue: PathValue<Values, Field>; | ||
value: PathValue<Values, Field>; | ||
previousValue: FormPathValue<Values, Field>; | ||
value: FormPathValue<Values, Field>; | ||
touched: boolean; | ||
@@ -88,0 +87,0 @@ dirty: boolean; |
{ | ||
"name": "@mantine/form", | ||
"version": "7.17.0", | ||
"version": "8.0.0-alpha.0", | ||
"description": "Mantine form management library", | ||
@@ -5,0 +5,0 @@ "homepage": "https://mantine.dev", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
578106
0.31%213
0.47%3396
0.62%1
Infinity%