@react-types/form 3.5.5-nightly.4256 → 3.5.5-nightly.4266
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/package.json +3 -3
- package/src/index.d.ts +58 -29
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-types/form",
|
|
3
|
-
"version": "3.5.5-nightly.
|
|
3
|
+
"version": "3.5.5-nightly.4266+0b541f488",
|
|
4
4
|
"description": "Spectrum UI components in React",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"types": "src/index.d.ts",
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"url": "https://github.com/adobe/react-spectrum"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@react-types/shared": "3.0.0-nightly.
|
|
12
|
+
"@react-types/shared": "3.0.0-nightly.2555+0b541f488"
|
|
13
13
|
},
|
|
14
14
|
"peerDependencies": {
|
|
15
15
|
"react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0"
|
|
@@ -17,5 +17,5 @@
|
|
|
17
17
|
"publishConfig": {
|
|
18
18
|
"access": "public"
|
|
19
19
|
},
|
|
20
|
-
"gitHead": "
|
|
20
|
+
"gitHead": "0b541f48848eb43f74ae57e8b21dc4455d95040b"
|
|
21
21
|
}
|
package/src/index.d.ts
CHANGED
|
@@ -11,9 +11,63 @@
|
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
import {AriaLabelingProps, DOMProps, SpectrumLabelableProps, StyleProps, ValidationErrors, ValidationState} from '@react-types/shared';
|
|
14
|
-
import {
|
|
14
|
+
import {FormEvent, FormHTMLAttributes, ReactElement} from 'react';
|
|
15
15
|
|
|
16
|
-
export interface
|
|
16
|
+
export interface FormProps extends AriaLabelingProps {
|
|
17
|
+
/**
|
|
18
|
+
* Validation errors for the form, typically returned by a server.
|
|
19
|
+
* This should be set to an object mapping from input names to errors.
|
|
20
|
+
*/
|
|
21
|
+
validationErrors?: ValidationErrors,
|
|
22
|
+
/**
|
|
23
|
+
* Where to send the form-data when the form is submitted.
|
|
24
|
+
* See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/form#action).
|
|
25
|
+
*/
|
|
26
|
+
action?: string | FormHTMLAttributes<HTMLFormElement>['action'],
|
|
27
|
+
/**
|
|
28
|
+
* The enctype attribute specifies how the form-data should be encoded when submitting it to the server.
|
|
29
|
+
* See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/form#enctype).
|
|
30
|
+
*/
|
|
31
|
+
encType?: 'application/x-www-form-urlencoded' | 'multipart/form-data' | 'text/plain',
|
|
32
|
+
/**
|
|
33
|
+
* The HTTP method to submit the form with.
|
|
34
|
+
* See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/form#method).
|
|
35
|
+
*/
|
|
36
|
+
method?: 'get' | 'post' | 'dialog',
|
|
37
|
+
/**
|
|
38
|
+
* The target attribute specifies a name or a keyword that indicates where to display the response that is received after submitting the form.
|
|
39
|
+
* See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/form#target).
|
|
40
|
+
*/
|
|
41
|
+
target?: '_blank' | '_self' | '_parent' | '_top',
|
|
42
|
+
/**
|
|
43
|
+
* Triggered when a user submits the form.
|
|
44
|
+
*/
|
|
45
|
+
onSubmit?: (event: FormEvent<HTMLFormElement>) => void,
|
|
46
|
+
/**
|
|
47
|
+
* Triggered when a user resets the form.
|
|
48
|
+
*/
|
|
49
|
+
onReset?: (event: FormEvent<HTMLFormElement>) => void,
|
|
50
|
+
/**
|
|
51
|
+
* Triggered for each invalid field when a user submits the form.
|
|
52
|
+
*/
|
|
53
|
+
onInvalid?: (event: FormEvent<HTMLFormElement>) => void,
|
|
54
|
+
/**
|
|
55
|
+
* Indicates whether input elements can by default have their values automatically completed by the browser.
|
|
56
|
+
* See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/form#autocomplete).
|
|
57
|
+
*/
|
|
58
|
+
autoComplete?: 'off' | 'on',
|
|
59
|
+
/**
|
|
60
|
+
* A nonstandard attribute used by iOS Safari that controls how textual form elements should be automatically capitalized.
|
|
61
|
+
* See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/form#autocapitalize).
|
|
62
|
+
*/
|
|
63
|
+
autoCapitalize?: 'off' | 'on',
|
|
64
|
+
/**
|
|
65
|
+
* An ARIA role override to apply to the form element.
|
|
66
|
+
*/
|
|
67
|
+
role?: 'search' | 'presentation'
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export interface SpectrumFormProps extends FormProps, DOMProps, StyleProps, Omit<SpectrumLabelableProps, 'contextualHelp' | 'label'> {
|
|
17
71
|
/** The contents of the Form. */
|
|
18
72
|
children: ReactElement<SpectrumLabelableProps> | ReactElement<SpectrumLabelableProps>[],
|
|
19
73
|
/** Whether the Form elements are displayed with their quiet style. */
|
|
@@ -33,34 +87,9 @@ export interface SpectrumFormProps extends DOMProps, AriaLabelingProps, StylePro
|
|
|
33
87
|
validationState?: ValidationState,
|
|
34
88
|
/**
|
|
35
89
|
* Whether to use native HTML form validation to prevent form submission
|
|
36
|
-
* when a field value is missing or invalid, or mark
|
|
90
|
+
* when a field value is missing or invalid, or mark fields as required
|
|
37
91
|
* or invalid via ARIA.
|
|
38
92
|
* @default 'aria'
|
|
39
93
|
*/
|
|
40
|
-
validationBehavior?: 'aria' | 'native'
|
|
41
|
-
/**
|
|
42
|
-
* Validation errors for the form, typically returned by a server.
|
|
43
|
-
* This should be set to an object mapping from input names to errors.
|
|
44
|
-
*/
|
|
45
|
-
validationErrors?: ValidationErrors,
|
|
46
|
-
/**
|
|
47
|
-
* Where to send the form-data when the form is submitted.
|
|
48
|
-
*/
|
|
49
|
-
action?: string,
|
|
50
|
-
/**
|
|
51
|
-
* The enctype attribute specifies how the form-data should be encoded when submitting it to the server.
|
|
52
|
-
*/
|
|
53
|
-
encType?: 'application/x-www-form-urlencoded' | 'multipart/form-data' | 'text/plain',
|
|
54
|
-
/**
|
|
55
|
-
* The form-data can be sent as URL variables (with method="get") or as HTTP post transaction (with method="post").
|
|
56
|
-
*/
|
|
57
|
-
method?: 'get' | 'post',
|
|
58
|
-
/**
|
|
59
|
-
* The target attribute specifies a name or a keyword that indicates where to display the response that is received after submitting the form.
|
|
60
|
-
*/
|
|
61
|
-
target?: '_blank' | '_self' | '_parent' | '_top',
|
|
62
|
-
/**
|
|
63
|
-
* Fired on form submission.
|
|
64
|
-
*/
|
|
65
|
-
onSubmit?: FormEventHandler
|
|
94
|
+
validationBehavior?: 'aria' | 'native'
|
|
66
95
|
}
|