@radix-ui/react-form 0.0.4-rc.7 → 0.1.0-rc.2
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/index.d.mts +52 -40
- package/dist/index.d.ts +52 -40
- package/dist/index.js +428 -545
- package/dist/index.js.map +7 -1
- package/dist/index.mjs +400 -510
- package/dist/index.mjs.map +7 -1
- package/package.json +7 -8
- package/dist/index.d.ts.map +0 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,67 +1,79 @@
|
|
|
1
|
-
import * as React from
|
|
2
|
-
import { Label as
|
|
3
|
-
import * as Radix from
|
|
4
|
-
import { Primitive } from
|
|
5
|
-
import { Scope } from
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { Label as Label$1 } from '@radix-ui/react-label';
|
|
3
|
+
import * as Radix from '@radix-ui/react-primitive';
|
|
4
|
+
import { Primitive } from '@radix-ui/react-primitive';
|
|
5
|
+
import { Scope as Scope$1 } from '@radix-ui/react-context';
|
|
6
|
+
|
|
7
|
+
declare type Scope<C = any> = {
|
|
8
|
+
[scopeName: string]: React.Context<C>[];
|
|
9
|
+
} | undefined;
|
|
10
|
+
declare type ScopeHook = (scope: Scope) => {
|
|
11
|
+
[__scopeProp: string]: Scope;
|
|
12
|
+
};
|
|
13
|
+
interface CreateScope {
|
|
14
|
+
scopeName: string;
|
|
15
|
+
(): ScopeHook;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
declare type ScopedProps<P> = P & {
|
|
19
|
+
__scopeForm?: Scope$1;
|
|
8
20
|
};
|
|
9
|
-
|
|
10
|
-
type PrimitiveFormProps = Radix.ComponentPropsWithoutRef<typeof Primitive.form>;
|
|
11
|
-
|
|
21
|
+
declare const createFormScope: CreateScope;
|
|
22
|
+
declare type PrimitiveFormProps = Radix.ComponentPropsWithoutRef<typeof Primitive.form>;
|
|
23
|
+
interface FormProps extends PrimitiveFormProps {
|
|
12
24
|
onClearServerErrors?(): void;
|
|
13
25
|
}
|
|
14
|
-
|
|
15
|
-
type PrimitiveDivProps = Radix.ComponentPropsWithoutRef<typeof Primitive.div>;
|
|
16
|
-
|
|
26
|
+
declare const Form: React.ForwardRefExoticComponent<FormProps & React.RefAttributes<HTMLFormElement>>;
|
|
27
|
+
declare type PrimitiveDivProps = Radix.ComponentPropsWithoutRef<typeof Primitive.div>;
|
|
28
|
+
interface FormFieldProps extends PrimitiveDivProps {
|
|
17
29
|
name: string;
|
|
18
30
|
serverInvalid?: boolean;
|
|
19
31
|
}
|
|
20
|
-
|
|
21
|
-
type LabelProps = Radix.ComponentPropsWithoutRef<typeof
|
|
22
|
-
|
|
32
|
+
declare const FormField: React.ForwardRefExoticComponent<FormFieldProps & React.RefAttributes<HTMLDivElement>>;
|
|
33
|
+
declare type LabelProps = Radix.ComponentPropsWithoutRef<typeof Label$1>;
|
|
34
|
+
interface FormLabelProps extends LabelProps {
|
|
23
35
|
}
|
|
24
|
-
|
|
25
|
-
type PrimitiveInputProps = Radix.ComponentPropsWithoutRef<typeof Primitive.input>;
|
|
26
|
-
|
|
36
|
+
declare const FormLabel: React.ForwardRefExoticComponent<FormLabelProps & React.RefAttributes<HTMLLabelElement>>;
|
|
37
|
+
declare type PrimitiveInputProps = Radix.ComponentPropsWithoutRef<typeof Primitive.input>;
|
|
38
|
+
interface FormControlProps extends PrimitiveInputProps {
|
|
27
39
|
}
|
|
28
|
-
|
|
40
|
+
declare const FormControl: React.ForwardRefExoticComponent<FormControlProps & React.RefAttributes<HTMLInputElement>>;
|
|
29
41
|
declare const validityMatchers: readonly ["badInput", "patternMismatch", "rangeOverflow", "rangeUnderflow", "stepMismatch", "tooLong", "tooShort", "typeMismatch", "valid", "valueMissing"];
|
|
30
|
-
type ValidityMatcher = typeof validityMatchers[number];
|
|
31
|
-
|
|
42
|
+
declare type ValidityMatcher = typeof validityMatchers[number];
|
|
43
|
+
interface FormMessageProps extends Omit<FormMessageImplProps, 'name'> {
|
|
32
44
|
match?: ValidityMatcher | CustomMatcher;
|
|
33
45
|
forceMatch?: boolean;
|
|
34
46
|
name?: string;
|
|
35
47
|
}
|
|
36
|
-
|
|
37
|
-
type PrimitiveSpanProps = Radix.ComponentPropsWithoutRef<typeof Primitive.span>;
|
|
48
|
+
declare const FormMessage: React.ForwardRefExoticComponent<FormMessageProps & React.RefAttributes<HTMLSpanElement>>;
|
|
49
|
+
declare type PrimitiveSpanProps = Radix.ComponentPropsWithoutRef<typeof Primitive.span>;
|
|
38
50
|
interface FormMessageImplProps extends PrimitiveSpanProps {
|
|
39
51
|
name: string;
|
|
40
52
|
}
|
|
41
|
-
|
|
53
|
+
interface FormValidityStateProps {
|
|
42
54
|
children(validity: ValidityState | undefined): React.ReactNode;
|
|
43
55
|
name?: string;
|
|
44
56
|
}
|
|
45
|
-
|
|
57
|
+
declare const FormValidityState: {
|
|
46
58
|
(props: ScopedProps<FormValidityStateProps>): JSX.Element;
|
|
47
59
|
displayName: string;
|
|
48
60
|
};
|
|
49
|
-
type PrimitiveButtonProps = Radix.ComponentPropsWithoutRef<typeof Primitive.button>;
|
|
50
|
-
|
|
61
|
+
declare type PrimitiveButtonProps = Radix.ComponentPropsWithoutRef<typeof Primitive.button>;
|
|
62
|
+
interface FormSubmitProps extends PrimitiveButtonProps {
|
|
51
63
|
}
|
|
52
|
-
|
|
53
|
-
type SyncCustomMatcher = (value: string, formData: FormData) => boolean;
|
|
54
|
-
type AsyncCustomMatcher = (value: string, formData: FormData) => Promise<boolean>;
|
|
55
|
-
type CustomMatcher = SyncCustomMatcher | AsyncCustomMatcher;
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
64
|
+
declare const FormSubmit: React.ForwardRefExoticComponent<FormSubmitProps & React.RefAttributes<HTMLButtonElement>>;
|
|
65
|
+
declare type SyncCustomMatcher = (value: string, formData: FormData) => boolean;
|
|
66
|
+
declare type AsyncCustomMatcher = (value: string, formData: FormData) => Promise<boolean>;
|
|
67
|
+
declare type CustomMatcher = SyncCustomMatcher | AsyncCustomMatcher;
|
|
68
|
+
declare const Root: React.ForwardRefExoticComponent<FormProps & React.RefAttributes<HTMLFormElement>>;
|
|
69
|
+
declare const Field: React.ForwardRefExoticComponent<FormFieldProps & React.RefAttributes<HTMLDivElement>>;
|
|
70
|
+
declare const Label: React.ForwardRefExoticComponent<FormLabelProps & React.RefAttributes<HTMLLabelElement>>;
|
|
71
|
+
declare const Control: React.ForwardRefExoticComponent<FormControlProps & React.RefAttributes<HTMLInputElement>>;
|
|
72
|
+
declare const Message: React.ForwardRefExoticComponent<FormMessageProps & React.RefAttributes<HTMLSpanElement>>;
|
|
73
|
+
declare const ValidityState: {
|
|
62
74
|
(props: ScopedProps<FormValidityStateProps>): JSX.Element;
|
|
63
75
|
displayName: string;
|
|
64
76
|
};
|
|
65
|
-
|
|
77
|
+
declare const Submit: React.ForwardRefExoticComponent<FormSubmitProps & React.RefAttributes<HTMLButtonElement>>;
|
|
66
78
|
|
|
67
|
-
|
|
79
|
+
export { Control, Field, Form, FormControl, type FormControlProps, FormField, type FormFieldProps, FormLabel, type FormLabelProps, FormMessage, type FormMessageProps, type FormProps, FormSubmit, type FormSubmitProps, FormValidityState, type FormValidityStateProps, Label, Message, Root, Submit, ValidityState, createFormScope };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,67 +1,79 @@
|
|
|
1
|
-
import * as React from
|
|
2
|
-
import { Label as
|
|
3
|
-
import * as Radix from
|
|
4
|
-
import { Primitive } from
|
|
5
|
-
import { Scope } from
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { Label as Label$1 } from '@radix-ui/react-label';
|
|
3
|
+
import * as Radix from '@radix-ui/react-primitive';
|
|
4
|
+
import { Primitive } from '@radix-ui/react-primitive';
|
|
5
|
+
import { Scope as Scope$1 } from '@radix-ui/react-context';
|
|
6
|
+
|
|
7
|
+
declare type Scope<C = any> = {
|
|
8
|
+
[scopeName: string]: React.Context<C>[];
|
|
9
|
+
} | undefined;
|
|
10
|
+
declare type ScopeHook = (scope: Scope) => {
|
|
11
|
+
[__scopeProp: string]: Scope;
|
|
12
|
+
};
|
|
13
|
+
interface CreateScope {
|
|
14
|
+
scopeName: string;
|
|
15
|
+
(): ScopeHook;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
declare type ScopedProps<P> = P & {
|
|
19
|
+
__scopeForm?: Scope$1;
|
|
8
20
|
};
|
|
9
|
-
|
|
10
|
-
type PrimitiveFormProps = Radix.ComponentPropsWithoutRef<typeof Primitive.form>;
|
|
11
|
-
|
|
21
|
+
declare const createFormScope: CreateScope;
|
|
22
|
+
declare type PrimitiveFormProps = Radix.ComponentPropsWithoutRef<typeof Primitive.form>;
|
|
23
|
+
interface FormProps extends PrimitiveFormProps {
|
|
12
24
|
onClearServerErrors?(): void;
|
|
13
25
|
}
|
|
14
|
-
|
|
15
|
-
type PrimitiveDivProps = Radix.ComponentPropsWithoutRef<typeof Primitive.div>;
|
|
16
|
-
|
|
26
|
+
declare const Form: React.ForwardRefExoticComponent<FormProps & React.RefAttributes<HTMLFormElement>>;
|
|
27
|
+
declare type PrimitiveDivProps = Radix.ComponentPropsWithoutRef<typeof Primitive.div>;
|
|
28
|
+
interface FormFieldProps extends PrimitiveDivProps {
|
|
17
29
|
name: string;
|
|
18
30
|
serverInvalid?: boolean;
|
|
19
31
|
}
|
|
20
|
-
|
|
21
|
-
type LabelProps = Radix.ComponentPropsWithoutRef<typeof
|
|
22
|
-
|
|
32
|
+
declare const FormField: React.ForwardRefExoticComponent<FormFieldProps & React.RefAttributes<HTMLDivElement>>;
|
|
33
|
+
declare type LabelProps = Radix.ComponentPropsWithoutRef<typeof Label$1>;
|
|
34
|
+
interface FormLabelProps extends LabelProps {
|
|
23
35
|
}
|
|
24
|
-
|
|
25
|
-
type PrimitiveInputProps = Radix.ComponentPropsWithoutRef<typeof Primitive.input>;
|
|
26
|
-
|
|
36
|
+
declare const FormLabel: React.ForwardRefExoticComponent<FormLabelProps & React.RefAttributes<HTMLLabelElement>>;
|
|
37
|
+
declare type PrimitiveInputProps = Radix.ComponentPropsWithoutRef<typeof Primitive.input>;
|
|
38
|
+
interface FormControlProps extends PrimitiveInputProps {
|
|
27
39
|
}
|
|
28
|
-
|
|
40
|
+
declare const FormControl: React.ForwardRefExoticComponent<FormControlProps & React.RefAttributes<HTMLInputElement>>;
|
|
29
41
|
declare const validityMatchers: readonly ["badInput", "patternMismatch", "rangeOverflow", "rangeUnderflow", "stepMismatch", "tooLong", "tooShort", "typeMismatch", "valid", "valueMissing"];
|
|
30
|
-
type ValidityMatcher = typeof validityMatchers[number];
|
|
31
|
-
|
|
42
|
+
declare type ValidityMatcher = typeof validityMatchers[number];
|
|
43
|
+
interface FormMessageProps extends Omit<FormMessageImplProps, 'name'> {
|
|
32
44
|
match?: ValidityMatcher | CustomMatcher;
|
|
33
45
|
forceMatch?: boolean;
|
|
34
46
|
name?: string;
|
|
35
47
|
}
|
|
36
|
-
|
|
37
|
-
type PrimitiveSpanProps = Radix.ComponentPropsWithoutRef<typeof Primitive.span>;
|
|
48
|
+
declare const FormMessage: React.ForwardRefExoticComponent<FormMessageProps & React.RefAttributes<HTMLSpanElement>>;
|
|
49
|
+
declare type PrimitiveSpanProps = Radix.ComponentPropsWithoutRef<typeof Primitive.span>;
|
|
38
50
|
interface FormMessageImplProps extends PrimitiveSpanProps {
|
|
39
51
|
name: string;
|
|
40
52
|
}
|
|
41
|
-
|
|
53
|
+
interface FormValidityStateProps {
|
|
42
54
|
children(validity: ValidityState | undefined): React.ReactNode;
|
|
43
55
|
name?: string;
|
|
44
56
|
}
|
|
45
|
-
|
|
57
|
+
declare const FormValidityState: {
|
|
46
58
|
(props: ScopedProps<FormValidityStateProps>): JSX.Element;
|
|
47
59
|
displayName: string;
|
|
48
60
|
};
|
|
49
|
-
type PrimitiveButtonProps = Radix.ComponentPropsWithoutRef<typeof Primitive.button>;
|
|
50
|
-
|
|
61
|
+
declare type PrimitiveButtonProps = Radix.ComponentPropsWithoutRef<typeof Primitive.button>;
|
|
62
|
+
interface FormSubmitProps extends PrimitiveButtonProps {
|
|
51
63
|
}
|
|
52
|
-
|
|
53
|
-
type SyncCustomMatcher = (value: string, formData: FormData) => boolean;
|
|
54
|
-
type AsyncCustomMatcher = (value: string, formData: FormData) => Promise<boolean>;
|
|
55
|
-
type CustomMatcher = SyncCustomMatcher | AsyncCustomMatcher;
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
64
|
+
declare const FormSubmit: React.ForwardRefExoticComponent<FormSubmitProps & React.RefAttributes<HTMLButtonElement>>;
|
|
65
|
+
declare type SyncCustomMatcher = (value: string, formData: FormData) => boolean;
|
|
66
|
+
declare type AsyncCustomMatcher = (value: string, formData: FormData) => Promise<boolean>;
|
|
67
|
+
declare type CustomMatcher = SyncCustomMatcher | AsyncCustomMatcher;
|
|
68
|
+
declare const Root: React.ForwardRefExoticComponent<FormProps & React.RefAttributes<HTMLFormElement>>;
|
|
69
|
+
declare const Field: React.ForwardRefExoticComponent<FormFieldProps & React.RefAttributes<HTMLDivElement>>;
|
|
70
|
+
declare const Label: React.ForwardRefExoticComponent<FormLabelProps & React.RefAttributes<HTMLLabelElement>>;
|
|
71
|
+
declare const Control: React.ForwardRefExoticComponent<FormControlProps & React.RefAttributes<HTMLInputElement>>;
|
|
72
|
+
declare const Message: React.ForwardRefExoticComponent<FormMessageProps & React.RefAttributes<HTMLSpanElement>>;
|
|
73
|
+
declare const ValidityState: {
|
|
62
74
|
(props: ScopedProps<FormValidityStateProps>): JSX.Element;
|
|
63
75
|
displayName: string;
|
|
64
76
|
};
|
|
65
|
-
|
|
77
|
+
declare const Submit: React.ForwardRefExoticComponent<FormSubmitProps & React.RefAttributes<HTMLButtonElement>>;
|
|
66
78
|
|
|
67
|
-
|
|
79
|
+
export { Control, Field, Form, FormControl, type FormControlProps, FormField, type FormFieldProps, FormLabel, type FormLabelProps, FormMessage, type FormMessageProps, type FormProps, FormSubmit, type FormSubmitProps, FormValidityState, type FormValidityStateProps, Label, Message, Root, Submit, ValidityState, createFormScope };
|