@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 CHANGED
@@ -1,67 +1,79 @@
1
- import * as React from "react";
2
- import { Label as _Label1 } 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 } from "@radix-ui/react-context";
6
- type ScopedProps<P> = P & {
7
- __scopeForm?: Scope;
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
- export const createFormScope: import("@radix-ui/react-context").CreateScope;
10
- type PrimitiveFormProps = Radix.ComponentPropsWithoutRef<typeof Primitive.form>;
11
- export interface FormProps extends PrimitiveFormProps {
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
- export const Form: React.ForwardRefExoticComponent<FormProps & React.RefAttributes<HTMLFormElement>>;
15
- type PrimitiveDivProps = Radix.ComponentPropsWithoutRef<typeof Primitive.div>;
16
- export interface FormFieldProps extends PrimitiveDivProps {
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
- export const FormField: React.ForwardRefExoticComponent<FormFieldProps & React.RefAttributes<HTMLDivElement>>;
21
- type LabelProps = Radix.ComponentPropsWithoutRef<typeof _Label1>;
22
- export interface FormLabelProps extends LabelProps {
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
- export const FormLabel: React.ForwardRefExoticComponent<FormLabelProps & React.RefAttributes<HTMLLabelElement>>;
25
- type PrimitiveInputProps = Radix.ComponentPropsWithoutRef<typeof Primitive.input>;
26
- export interface FormControlProps extends PrimitiveInputProps {
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
- export const FormControl: React.ForwardRefExoticComponent<FormControlProps & React.RefAttributes<HTMLInputElement>>;
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
- export interface FormMessageProps extends Omit<FormMessageImplProps, 'name'> {
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
- export const FormMessage: React.ForwardRefExoticComponent<FormMessageProps & React.RefAttributes<HTMLSpanElement>>;
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
- export interface FormValidityStateProps {
53
+ interface FormValidityStateProps {
42
54
  children(validity: ValidityState | undefined): React.ReactNode;
43
55
  name?: string;
44
56
  }
45
- export const FormValidityState: {
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
- export interface FormSubmitProps extends PrimitiveButtonProps {
61
+ declare type PrimitiveButtonProps = Radix.ComponentPropsWithoutRef<typeof Primitive.button>;
62
+ interface FormSubmitProps extends PrimitiveButtonProps {
51
63
  }
52
- export const FormSubmit: React.ForwardRefExoticComponent<FormSubmitProps & React.RefAttributes<HTMLButtonElement>>;
53
- type SyncCustomMatcher = (value: string, formData: FormData) => boolean;
54
- type AsyncCustomMatcher = (value: string, formData: FormData) => Promise<boolean>;
55
- type CustomMatcher = SyncCustomMatcher | AsyncCustomMatcher;
56
- export const Root: React.ForwardRefExoticComponent<FormProps & React.RefAttributes<HTMLFormElement>>;
57
- export const Field: React.ForwardRefExoticComponent<FormFieldProps & React.RefAttributes<HTMLDivElement>>;
58
- export const Label: React.ForwardRefExoticComponent<FormLabelProps & React.RefAttributes<HTMLLabelElement>>;
59
- export const Control: React.ForwardRefExoticComponent<FormControlProps & React.RefAttributes<HTMLInputElement>>;
60
- export const Message: React.ForwardRefExoticComponent<FormMessageProps & React.RefAttributes<HTMLSpanElement>>;
61
- export const ValidityState: {
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
- export const Submit: React.ForwardRefExoticComponent<FormSubmitProps & React.RefAttributes<HTMLButtonElement>>;
77
+ declare const Submit: React.ForwardRefExoticComponent<FormSubmitProps & React.RefAttributes<HTMLButtonElement>>;
66
78
 
67
- //# sourceMappingURL=index.d.ts.map
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 "react";
2
- import { Label as _Label1 } 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 } from "@radix-ui/react-context";
6
- type ScopedProps<P> = P & {
7
- __scopeForm?: Scope;
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
- export const createFormScope: import("@radix-ui/react-context").CreateScope;
10
- type PrimitiveFormProps = Radix.ComponentPropsWithoutRef<typeof Primitive.form>;
11
- export interface FormProps extends PrimitiveFormProps {
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
- export const Form: React.ForwardRefExoticComponent<FormProps & React.RefAttributes<HTMLFormElement>>;
15
- type PrimitiveDivProps = Radix.ComponentPropsWithoutRef<typeof Primitive.div>;
16
- export interface FormFieldProps extends PrimitiveDivProps {
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
- export const FormField: React.ForwardRefExoticComponent<FormFieldProps & React.RefAttributes<HTMLDivElement>>;
21
- type LabelProps = Radix.ComponentPropsWithoutRef<typeof _Label1>;
22
- export interface FormLabelProps extends LabelProps {
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
- export const FormLabel: React.ForwardRefExoticComponent<FormLabelProps & React.RefAttributes<HTMLLabelElement>>;
25
- type PrimitiveInputProps = Radix.ComponentPropsWithoutRef<typeof Primitive.input>;
26
- export interface FormControlProps extends PrimitiveInputProps {
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
- export const FormControl: React.ForwardRefExoticComponent<FormControlProps & React.RefAttributes<HTMLInputElement>>;
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
- export interface FormMessageProps extends Omit<FormMessageImplProps, 'name'> {
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
- export const FormMessage: React.ForwardRefExoticComponent<FormMessageProps & React.RefAttributes<HTMLSpanElement>>;
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
- export interface FormValidityStateProps {
53
+ interface FormValidityStateProps {
42
54
  children(validity: ValidityState | undefined): React.ReactNode;
43
55
  name?: string;
44
56
  }
45
- export const FormValidityState: {
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
- export interface FormSubmitProps extends PrimitiveButtonProps {
61
+ declare type PrimitiveButtonProps = Radix.ComponentPropsWithoutRef<typeof Primitive.button>;
62
+ interface FormSubmitProps extends PrimitiveButtonProps {
51
63
  }
52
- export const FormSubmit: React.ForwardRefExoticComponent<FormSubmitProps & React.RefAttributes<HTMLButtonElement>>;
53
- type SyncCustomMatcher = (value: string, formData: FormData) => boolean;
54
- type AsyncCustomMatcher = (value: string, formData: FormData) => Promise<boolean>;
55
- type CustomMatcher = SyncCustomMatcher | AsyncCustomMatcher;
56
- export const Root: React.ForwardRefExoticComponent<FormProps & React.RefAttributes<HTMLFormElement>>;
57
- export const Field: React.ForwardRefExoticComponent<FormFieldProps & React.RefAttributes<HTMLDivElement>>;
58
- export const Label: React.ForwardRefExoticComponent<FormLabelProps & React.RefAttributes<HTMLLabelElement>>;
59
- export const Control: React.ForwardRefExoticComponent<FormControlProps & React.RefAttributes<HTMLInputElement>>;
60
- export const Message: React.ForwardRefExoticComponent<FormMessageProps & React.RefAttributes<HTMLSpanElement>>;
61
- export const ValidityState: {
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
- export const Submit: React.ForwardRefExoticComponent<FormSubmitProps & React.RefAttributes<HTMLButtonElement>>;
77
+ declare const Submit: React.ForwardRefExoticComponent<FormSubmitProps & React.RefAttributes<HTMLButtonElement>>;
66
78
 
67
- //# sourceMappingURL=index.d.ts.map
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 };