@react-types/form 3.0.0-nightly-641446f65-240905
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/README.md +3 -0
- package/package.json +21 -0
- package/src/index.d.ts +95 -0
package/README.md
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@react-types/form",
|
|
3
|
+
"version": "3.0.0-nightly-641446f65-240905",
|
|
4
|
+
"description": "Spectrum UI components in React",
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
|
+
"types": "src/index.d.ts",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/adobe/react-spectrum"
|
|
10
|
+
},
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"@react-types/shared": "^3.0.0-nightly-641446f65-240905"
|
|
13
|
+
},
|
|
14
|
+
"peerDependencies": {
|
|
15
|
+
"react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0"
|
|
16
|
+
},
|
|
17
|
+
"publishConfig": {
|
|
18
|
+
"access": "public"
|
|
19
|
+
},
|
|
20
|
+
"stableVersion": "3.7.6"
|
|
21
|
+
}
|
package/src/index.d.ts
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
3
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
*
|
|
7
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
* governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import {AriaLabelingProps, DOMProps, SpectrumLabelableProps, StyleProps, ValidationErrors, ValidationState} from '@react-types/shared';
|
|
14
|
+
import {FormEvent, FormHTMLAttributes, ReactElement} from 'react';
|
|
15
|
+
|
|
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
|
+
* Controls whether inputted text is automatically capitalized and, if so, in what manner.
|
|
61
|
+
* See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/autocapitalize).
|
|
62
|
+
*/
|
|
63
|
+
autoCapitalize?: 'off' | 'none' | 'on' | 'sentences' | 'words' | 'characters',
|
|
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'> {
|
|
71
|
+
/** The contents of the Form. */
|
|
72
|
+
children: ReactElement<SpectrumLabelableProps> | ReactElement<SpectrumLabelableProps>[],
|
|
73
|
+
/** Whether the Form elements are displayed with their quiet style. */
|
|
74
|
+
isQuiet?: boolean,
|
|
75
|
+
/** Whether the Form elements are rendered with their emphasized style. */
|
|
76
|
+
isEmphasized?: boolean,
|
|
77
|
+
/** Whether the Form elements are disabled. */
|
|
78
|
+
isDisabled?: boolean,
|
|
79
|
+
/** Whether user input is required on each of the Form elements before Form submission. */
|
|
80
|
+
isRequired?: boolean,
|
|
81
|
+
/** Whether the Form elements can be selected but not changed by the user. */
|
|
82
|
+
isReadOnly?: boolean,
|
|
83
|
+
/**
|
|
84
|
+
* Whether the Form elements should display their "valid" or "invalid" visual styling.
|
|
85
|
+
* @default 'valid'
|
|
86
|
+
*/
|
|
87
|
+
validationState?: ValidationState,
|
|
88
|
+
/**
|
|
89
|
+
* Whether to use native HTML form validation to prevent form submission
|
|
90
|
+
* when a field value is missing or invalid, or mark fields as required
|
|
91
|
+
* or invalid via ARIA.
|
|
92
|
+
* @default 'aria'
|
|
93
|
+
*/
|
|
94
|
+
validationBehavior?: 'aria' | 'native'
|
|
95
|
+
}
|