@radix-ui/react-form 0.1.0-rc.2 → 0.1.0-rc.4

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