@atlaskit/form 8.5.5 → 8.5.8
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/CHANGELOG.md +22 -0
- package/dist/cjs/form.js +0 -1
- package/dist/cjs/messages.js +2 -2
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/messages.js +3 -3
- package/dist/es2019/version.json +1 -1
- package/dist/esm/form.js +0 -1
- package/dist/esm/messages.js +3 -3
- package/dist/esm/version.json +1 -1
- package/package.json +16 -14
- package/report.api.md +424 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# @atlaskit/form
|
|
2
2
|
|
|
3
|
+
## 8.5.8
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`0fbb2840aba`](https://bitbucket.org/atlassian/atlassian-frontend/commits/0fbb2840aba) - Add isInvalid prop to `@atlastkit/Select`. The prop indicates whether if the component is in the error state. If true, it visually shows a red border around the input.
|
|
8
|
+
|
|
9
|
+
This replaces validationState to make Select more consistent like other components that uses isInvalid prop.
|
|
10
|
+
|
|
11
|
+
- Updated dependencies
|
|
12
|
+
|
|
13
|
+
## 8.5.7
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- [`8d4228767b0`](https://bitbucket.org/atlassian/atlassian-frontend/commits/8d4228767b0) - Upgrade Typescript from `4.2.4` to `4.3.5`.
|
|
18
|
+
|
|
19
|
+
## 8.5.6
|
|
20
|
+
|
|
21
|
+
### Patch Changes
|
|
22
|
+
|
|
23
|
+
- [`f2b8ca863a0`](https://bitbucket.org/atlassian/atlassian-frontend/commits/f2b8ca863a0) - [ux] Updates to slightly darken fallback colors for field messages
|
|
24
|
+
|
|
3
25
|
## 8.5.5
|
|
4
26
|
|
|
5
27
|
### Patch Changes
|
package/dist/cjs/form.js
CHANGED
package/dist/cjs/messages.js
CHANGED
|
@@ -41,13 +41,13 @@ var darkH200Styles = (0, _core.css)((0, _typography.h200)({
|
|
|
41
41
|
}
|
|
42
42
|
}));
|
|
43
43
|
var messageErrorColorStyles = (0, _core.css)({
|
|
44
|
-
color: "var(--ds-text-danger,
|
|
44
|
+
color: "var(--ds-text-danger, #AE2A19)"
|
|
45
45
|
});
|
|
46
46
|
var messageNeutralColorStyles = (0, _core.css)({
|
|
47
47
|
color: "var(--ds-text-subtlest, ".concat(_colors.N200, ")")
|
|
48
48
|
});
|
|
49
49
|
var messageValidColorStyles = (0, _core.css)({
|
|
50
|
-
color: "var(--ds-text-success,
|
|
50
|
+
color: "var(--ds-text-success, #216E4E)"
|
|
51
51
|
});
|
|
52
52
|
var messageStyles = (0, _core.css)({
|
|
53
53
|
display: 'flex',
|
package/dist/cjs/version.json
CHANGED
package/dist/es2019/messages.js
CHANGED
|
@@ -3,7 +3,7 @@ import React from 'react';
|
|
|
3
3
|
import { css, jsx } from '@emotion/core';
|
|
4
4
|
import SuccessIcon from '@atlaskit/icon/glyph/editor/success';
|
|
5
5
|
import ErrorIcon from '@atlaskit/icon/glyph/error';
|
|
6
|
-
import {
|
|
6
|
+
import { N200 } from '@atlaskit/theme/colors';
|
|
7
7
|
import { useGlobalTheme } from '@atlaskit/theme/components';
|
|
8
8
|
import { fontFamily as getFontFamily, gridSize as getGridSize } from '@atlaskit/theme/constants';
|
|
9
9
|
import { h200 } from '@atlaskit/theme/typography';
|
|
@@ -23,13 +23,13 @@ const darkH200Styles = css(h200({
|
|
|
23
23
|
}
|
|
24
24
|
}));
|
|
25
25
|
const messageErrorColorStyles = css({
|
|
26
|
-
color:
|
|
26
|
+
color: "var(--ds-text-danger, #AE2A19)"
|
|
27
27
|
});
|
|
28
28
|
const messageNeutralColorStyles = css({
|
|
29
29
|
color: `var(--ds-text-subtlest, ${N200})`
|
|
30
30
|
});
|
|
31
31
|
const messageValidColorStyles = css({
|
|
32
|
-
color:
|
|
32
|
+
color: "var(--ds-text-success, #216E4E)"
|
|
33
33
|
});
|
|
34
34
|
const messageStyles = css({
|
|
35
35
|
display: 'flex',
|
package/dist/es2019/version.json
CHANGED
package/dist/esm/form.js
CHANGED
package/dist/esm/messages.js
CHANGED
|
@@ -3,7 +3,7 @@ import React from 'react';
|
|
|
3
3
|
import { css, jsx } from '@emotion/core';
|
|
4
4
|
import SuccessIcon from '@atlaskit/icon/glyph/editor/success';
|
|
5
5
|
import ErrorIcon from '@atlaskit/icon/glyph/error';
|
|
6
|
-
import {
|
|
6
|
+
import { N200 } from '@atlaskit/theme/colors';
|
|
7
7
|
import { useGlobalTheme } from '@atlaskit/theme/components';
|
|
8
8
|
import { fontFamily as getFontFamily, gridSize as getGridSize } from '@atlaskit/theme/constants';
|
|
9
9
|
import { h200 } from '@atlaskit/theme/typography';
|
|
@@ -23,13 +23,13 @@ var darkH200Styles = css(h200({
|
|
|
23
23
|
}
|
|
24
24
|
}));
|
|
25
25
|
var messageErrorColorStyles = css({
|
|
26
|
-
color: "var(--ds-text-danger,
|
|
26
|
+
color: "var(--ds-text-danger, #AE2A19)"
|
|
27
27
|
});
|
|
28
28
|
var messageNeutralColorStyles = css({
|
|
29
29
|
color: "var(--ds-text-subtlest, ".concat(N200, ")")
|
|
30
30
|
});
|
|
31
31
|
var messageValidColorStyles = css({
|
|
32
|
-
color: "var(--ds-text-success,
|
|
32
|
+
color: "var(--ds-text-success, #216E4E)"
|
|
33
33
|
});
|
|
34
34
|
var messageStyles = css({
|
|
35
35
|
display: 'flex',
|
package/dist/esm/version.json
CHANGED
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/form",
|
|
3
|
-
"version": "8.5.
|
|
3
|
+
"version": "8.5.8",
|
|
4
4
|
"description": "A form allows users to input information.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
7
7
|
},
|
|
8
|
-
"repository": "https://bitbucket.org/atlassian/atlassian-frontend",
|
|
8
|
+
"repository": "https://bitbucket.org/atlassian/atlassian-frontend-mirror",
|
|
9
9
|
"author": "Atlassian Pty Ltd",
|
|
10
10
|
"license": "Apache-2.0",
|
|
11
11
|
"main": "dist/cjs/index.js",
|
|
@@ -32,13 +32,14 @@
|
|
|
32
32
|
"team": "Design System Team",
|
|
33
33
|
"releaseModel": "scheduled",
|
|
34
34
|
"website": {
|
|
35
|
-
"name": "Form"
|
|
35
|
+
"name": "Form",
|
|
36
|
+
"category": "Components"
|
|
36
37
|
}
|
|
37
38
|
},
|
|
38
39
|
"homepage": "https://atlassian.design/components/form/",
|
|
39
40
|
"dependencies": {
|
|
40
41
|
"@atlaskit/icon": "^21.10.0",
|
|
41
|
-
"@atlaskit/theme": "^12.
|
|
42
|
+
"@atlaskit/theme": "^12.2.0",
|
|
42
43
|
"@atlaskit/tokens": "^0.10.0",
|
|
43
44
|
"@babel/runtime": "^7.0.0",
|
|
44
45
|
"@emotion/core": "^10.0.9",
|
|
@@ -53,21 +54,21 @@
|
|
|
53
54
|
},
|
|
54
55
|
"devDependencies": {
|
|
55
56
|
"@atlaskit/button": "^16.3.0",
|
|
56
|
-
"@atlaskit/calendar": "^12.
|
|
57
|
+
"@atlaskit/calendar": "^12.4.0",
|
|
57
58
|
"@atlaskit/checkbox": "^12.3.0",
|
|
58
|
-
"@atlaskit/datetime-picker": "^
|
|
59
|
+
"@atlaskit/datetime-picker": "^12.2.0",
|
|
59
60
|
"@atlaskit/docs": "^9.0.0",
|
|
60
|
-
"@atlaskit/dropdown-menu": "^11.
|
|
61
|
+
"@atlaskit/dropdown-menu": "^11.4.0",
|
|
61
62
|
"@atlaskit/droplist": "^11.0.0",
|
|
62
|
-
"@atlaskit/modal-dialog": "^12.
|
|
63
|
-
"@atlaskit/radio": "^5.
|
|
63
|
+
"@atlaskit/modal-dialog": "^12.3.0",
|
|
64
|
+
"@atlaskit/radio": "^5.4.0",
|
|
64
65
|
"@atlaskit/range": "^6.0.0",
|
|
65
|
-
"@atlaskit/section-message": "^6.
|
|
66
|
-
"@atlaskit/select": "^15.
|
|
66
|
+
"@atlaskit/section-message": "^6.2.0",
|
|
67
|
+
"@atlaskit/select": "^15.7.0",
|
|
67
68
|
"@atlaskit/ssr": "*",
|
|
68
69
|
"@atlaskit/textarea": "^4.3.0",
|
|
69
|
-
"@atlaskit/textfield": "^5.
|
|
70
|
-
"@atlaskit/toggle": "^12.
|
|
70
|
+
"@atlaskit/textfield": "^5.2.0",
|
|
71
|
+
"@atlaskit/toggle": "^12.5.0",
|
|
71
72
|
"@atlaskit/tooltip": "^17.5.0",
|
|
72
73
|
"@atlaskit/visual-regression": "*",
|
|
73
74
|
"@atlaskit/webdriver-runner": "*",
|
|
@@ -79,7 +80,7 @@
|
|
|
79
80
|
"react-router": "^4.2.0",
|
|
80
81
|
"react-router-dom": "^4.2.2",
|
|
81
82
|
"react-test-renderer": "^16.8.0",
|
|
82
|
-
"typescript": "4.
|
|
83
|
+
"typescript": "4.3.5",
|
|
83
84
|
"validator": "^9.4.1",
|
|
84
85
|
"wait-for-expect": "^1.2.0"
|
|
85
86
|
},
|
|
@@ -93,6 +94,7 @@
|
|
|
93
94
|
"import-structure": "atlassian-conventions"
|
|
94
95
|
},
|
|
95
96
|
"@repo/internal": {
|
|
97
|
+
"dom-events": "use-bind-event-listener",
|
|
96
98
|
"analytics": "analytics-next",
|
|
97
99
|
"theming": [
|
|
98
100
|
"react-context",
|
package/report.api.md
ADDED
|
@@ -0,0 +1,424 @@
|
|
|
1
|
+
## API Report File for "@atlaskit/form"
|
|
2
|
+
|
|
3
|
+
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
import { FC } from 'react';
|
|
7
|
+
import { FormApi as FormApi_2 } from 'final-form';
|
|
8
|
+
import { FormEvent } from 'react';
|
|
9
|
+
import { FormState } from 'final-form';
|
|
10
|
+
import { default as React_2 } from 'react';
|
|
11
|
+
import { ReactNode } from 'react';
|
|
12
|
+
|
|
13
|
+
declare type Align = 'start' | 'end';
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* __Checkbox field__
|
|
17
|
+
*
|
|
18
|
+
* A checkbox field is a form field that lets users select an item. Users can check or uncheck the checkbox.
|
|
19
|
+
*
|
|
20
|
+
* - [Examples] https://atlaskit.atlassian.com/packages/design-system/form/docs/fields#checkboxfield-reference
|
|
21
|
+
* - [Code] https://atlaskit.atlassian.com/packages/design-system/form/docs/fields#checkboxfield-reference
|
|
22
|
+
* - [Usage] https://atlaskit.atlassian.com/packages/design-system/form/docs/fields#checkboxfield-reference
|
|
23
|
+
*/
|
|
24
|
+
export declare const CheckboxField: FC<CheckboxProps>;
|
|
25
|
+
|
|
26
|
+
export declare interface CheckboxFieldProps
|
|
27
|
+
extends FieldProps<string | undefined> {
|
|
28
|
+
isChecked: boolean;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
declare interface CheckboxProps {
|
|
32
|
+
/**
|
|
33
|
+
* Content to render in the checkbox field. This is a function that is called with information about the field.
|
|
34
|
+
*/
|
|
35
|
+
children: (args: {
|
|
36
|
+
fieldProps: CheckboxFieldProps;
|
|
37
|
+
error?: string;
|
|
38
|
+
valid: boolean;
|
|
39
|
+
meta: Meta;
|
|
40
|
+
}) => ReactNode;
|
|
41
|
+
/**
|
|
42
|
+
* Sets the default state of the checkbox as checked.
|
|
43
|
+
*/
|
|
44
|
+
defaultIsChecked?: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Sets whether the field is required for submission. Required fields are marked with a red asterisk.
|
|
47
|
+
*/
|
|
48
|
+
isRequired?: boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Sets whether the field is disabled. Users cannot edit or focus on the fields. If the parent form component is disabled, then the field will always be disabled.
|
|
51
|
+
*/
|
|
52
|
+
isDisabled?: boolean;
|
|
53
|
+
/**
|
|
54
|
+
* Label displayed beside the checkbox.
|
|
55
|
+
*/
|
|
56
|
+
label?: ReactNode;
|
|
57
|
+
/**
|
|
58
|
+
* Specifies the name of the field. This is important for referencing the form data.
|
|
59
|
+
*/
|
|
60
|
+
name: string;
|
|
61
|
+
/**
|
|
62
|
+
* The value of the checkbox. This is the value used in the form state when the checkbox is checked.
|
|
63
|
+
*/
|
|
64
|
+
value?: string;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* __Error message__
|
|
69
|
+
*
|
|
70
|
+
* An error message is used to tell a user that the field input is invalid. For example, an error message could be
|
|
71
|
+
* 'Invalid username, needs to be more than 4 characters'.
|
|
72
|
+
*
|
|
73
|
+
*/
|
|
74
|
+
export declare const ErrorMessage: React_2.FC<MessageProps>;
|
|
75
|
+
|
|
76
|
+
export declare function Field<
|
|
77
|
+
FieldValue = string,
|
|
78
|
+
Element extends SupportedElements = HTMLInputElement
|
|
79
|
+
>(props: FieldComponentProps<FieldValue, Element>): JSX.Element;
|
|
80
|
+
|
|
81
|
+
declare interface FieldComponentProps<
|
|
82
|
+
FieldValue,
|
|
83
|
+
Element extends SupportedElements
|
|
84
|
+
> {
|
|
85
|
+
/**
|
|
86
|
+
* Content to render in the field. This is a function that is called with props for the field component and other information about the field.
|
|
87
|
+
*/
|
|
88
|
+
children: (args: {
|
|
89
|
+
fieldProps: FieldProps<FieldValue, Element>;
|
|
90
|
+
error?: string;
|
|
91
|
+
valid: boolean;
|
|
92
|
+
meta: Meta;
|
|
93
|
+
}) => ReactNode;
|
|
94
|
+
/**
|
|
95
|
+
* Sets the default value of the field. If a function is provided, it is called with the current default value of the field.
|
|
96
|
+
*/
|
|
97
|
+
defaultValue?:
|
|
98
|
+
| FieldValue
|
|
99
|
+
| ((currentDefaultValue?: FieldValue) => FieldValue);
|
|
100
|
+
/**
|
|
101
|
+
* Passed to the ID attribute of the field. This is randomly generated if it is not specified.
|
|
102
|
+
*/
|
|
103
|
+
id?: string;
|
|
104
|
+
/**
|
|
105
|
+
* Sets whether the field is required for submission. Required fields are marked with a red asterisk.
|
|
106
|
+
*/
|
|
107
|
+
isRequired?: boolean;
|
|
108
|
+
/**
|
|
109
|
+
* Sets whether the field is disabled. Users cannot edit or focus on the fields. If the parent form component is disabled, then the field will always be disabled.
|
|
110
|
+
*/
|
|
111
|
+
isDisabled?: boolean;
|
|
112
|
+
/**
|
|
113
|
+
* Label displayed above the form field.
|
|
114
|
+
*/
|
|
115
|
+
label?: ReactNode;
|
|
116
|
+
/**
|
|
117
|
+
* Specifies the name of the field. This is important for referencing the form data.
|
|
118
|
+
*/
|
|
119
|
+
name: string;
|
|
120
|
+
/**
|
|
121
|
+
* Access the current field value and transform it to return a different field value.
|
|
122
|
+
*/
|
|
123
|
+
transform?: (
|
|
124
|
+
event: FormEvent<Element> | FieldValue,
|
|
125
|
+
current: FieldValue,
|
|
126
|
+
) => FieldValue;
|
|
127
|
+
/**
|
|
128
|
+
* Checks whether the field input is valid. This is usually used to display a message relevant to the current value using `ErrorMessage`, `HelperMessage` or `ValidMessage`.
|
|
129
|
+
*/
|
|
130
|
+
validate?: (
|
|
131
|
+
value: FieldValue | undefined,
|
|
132
|
+
formState: Object,
|
|
133
|
+
fieldState: Meta,
|
|
134
|
+
) => string | void | Promise<string | void>;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
export declare interface FieldProps<
|
|
138
|
+
FieldValue,
|
|
139
|
+
Element extends SupportedElements = HTMLInputElement
|
|
140
|
+
> {
|
|
141
|
+
id: string;
|
|
142
|
+
isRequired: boolean;
|
|
143
|
+
isDisabled: boolean;
|
|
144
|
+
isInvalid: boolean;
|
|
145
|
+
onChange: (value: FormEvent<Element> | FieldValue) => void;
|
|
146
|
+
onBlur: () => void;
|
|
147
|
+
onFocus: () => void;
|
|
148
|
+
value: FieldValue;
|
|
149
|
+
name: string;
|
|
150
|
+
'aria-invalid': 'true' | 'false';
|
|
151
|
+
'aria-labelledby': string;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* __Fieldset__
|
|
156
|
+
*
|
|
157
|
+
* A fieldset groups a number of fields together. For example, when multiple CheckboxFields share the same name,
|
|
158
|
+
* a fieldset can be used to group them together. This makes the form more accessible.
|
|
159
|
+
*
|
|
160
|
+
* - [Examples](https://atlaskit.atlassian.com/packages/design-system/form/docs/fields)
|
|
161
|
+
* - [Code](https://atlaskit.atlassian.com/packages/design-system/form/docs/fields)
|
|
162
|
+
* - [Usage](https://atlaskit.atlassian.com/packages/design-system/form/docs/fields)
|
|
163
|
+
*/
|
|
164
|
+
export declare const Fieldset: ({
|
|
165
|
+
children,
|
|
166
|
+
legend,
|
|
167
|
+
}: FieldsetProps) => JSX.Element;
|
|
168
|
+
|
|
169
|
+
declare interface FieldsetProps {
|
|
170
|
+
/**
|
|
171
|
+
* Content to render in the fieldset.
|
|
172
|
+
*/
|
|
173
|
+
children: ReactNode;
|
|
174
|
+
/**
|
|
175
|
+
* Label describing the contents of the fieldset.
|
|
176
|
+
*/
|
|
177
|
+
legend?: ReactNode;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
declare function Form<FormValues extends Record<string, any> = {}>(
|
|
181
|
+
props: FormProps<FormValues>,
|
|
182
|
+
): JSX.Element;
|
|
183
|
+
export default Form;
|
|
184
|
+
|
|
185
|
+
export declare type FormApi<FormData> = FormApi_2<FormData>;
|
|
186
|
+
|
|
187
|
+
declare interface FormChildrenProps {
|
|
188
|
+
ref: React_2.RefObject<HTMLFormElement>;
|
|
189
|
+
onSubmit: (
|
|
190
|
+
event?:
|
|
191
|
+
| React_2.FormEvent<HTMLFormElement>
|
|
192
|
+
| React_2.SyntheticEvent<HTMLElement>,
|
|
193
|
+
) => void;
|
|
194
|
+
onKeyDown: (event: React_2.KeyboardEvent<HTMLElement>) => void;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* __Form footer__
|
|
199
|
+
*
|
|
200
|
+
* A form footer has the content to be shown at the bottom of the form. This is usually the submit button.
|
|
201
|
+
*
|
|
202
|
+
* - [Examples](https://atlaskit.atlassian.com/packages/design-system/form/docs/layout)
|
|
203
|
+
* - [Code](https://atlaskit.atlassian.com/packages/design-system/form/docs/layout)
|
|
204
|
+
* - [Usage](https://atlaskit.atlassian.com/packages/design-system/form/docs/layout)
|
|
205
|
+
*/
|
|
206
|
+
export declare function FormFooter({
|
|
207
|
+
align,
|
|
208
|
+
children,
|
|
209
|
+
}: FormFooterProps): JSX.Element;
|
|
210
|
+
|
|
211
|
+
declare interface FormFooterProps {
|
|
212
|
+
/**
|
|
213
|
+
* Content to render in the footer of the form.
|
|
214
|
+
*/
|
|
215
|
+
children?: ReactNode;
|
|
216
|
+
/**
|
|
217
|
+
* Sets the alignment of the footer contents. This is often a button. This should be left-aligned in single-page forms, flags, cards, and section messages.
|
|
218
|
+
*/
|
|
219
|
+
align?: Align;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
/**
|
|
223
|
+
* __Form header__
|
|
224
|
+
*
|
|
225
|
+
* A form header contains the form component's heading and subheadings. This provides the correct padding
|
|
226
|
+
* and styling for it.
|
|
227
|
+
*
|
|
228
|
+
* - [Examples](https://atlaskit.atlassian.com/packages/design-system/form/docs/layout)
|
|
229
|
+
* - [Code](https://atlaskit.atlassian.com/packages/design-system/form/docs/layout)
|
|
230
|
+
* - [Usage](https://atlaskit.atlassian.com/packages/design-system/form/docs/layout)
|
|
231
|
+
*/
|
|
232
|
+
export declare const FormHeader: React.FC<FormHeaderProps>;
|
|
233
|
+
|
|
234
|
+
declare interface FormHeaderProps {
|
|
235
|
+
/**
|
|
236
|
+
* Title of the form. This is a header.
|
|
237
|
+
*/
|
|
238
|
+
title?: ReactNode;
|
|
239
|
+
/**
|
|
240
|
+
* Description or subtitle of the form.
|
|
241
|
+
*/
|
|
242
|
+
description?: ReactNode;
|
|
243
|
+
/**
|
|
244
|
+
* Child content to render in the form below the title and description.
|
|
245
|
+
*/
|
|
246
|
+
children?: ReactNode;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
export declare interface FormProps<FormValues> {
|
|
250
|
+
/**
|
|
251
|
+
* The contents rendered inside of the form. This is a function where the props will be passed from the form. The function props you can access are `dirty`, `submitting` and `disabled`.
|
|
252
|
+
* You can read more about these props in [react-final form documentation](https://final-form.org/docs/final-form/types/FormState).
|
|
253
|
+
*/
|
|
254
|
+
children: (args: {
|
|
255
|
+
formProps: FormChildrenProps;
|
|
256
|
+
disabled: boolean;
|
|
257
|
+
dirty: boolean;
|
|
258
|
+
submitting: boolean;
|
|
259
|
+
getState: () => FormState<FormValues>;
|
|
260
|
+
/**
|
|
261
|
+
* @deprecated
|
|
262
|
+
*/
|
|
263
|
+
getValues: () => FormValues;
|
|
264
|
+
setFieldValue: (name: string, value: any) => void;
|
|
265
|
+
reset: (initialValues?: FormValues) => void;
|
|
266
|
+
}) => ReactNode;
|
|
267
|
+
/**
|
|
268
|
+
* Event handler called when the form is submitted. Fields must be free of validation errors.
|
|
269
|
+
*/
|
|
270
|
+
onSubmit: OnSubmitHandler<FormValues>;
|
|
271
|
+
/**
|
|
272
|
+
* Sets the form and its fields as disabled. Users cannot edit or focus on the fields.
|
|
273
|
+
*/
|
|
274
|
+
isDisabled?: boolean;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
/**
|
|
278
|
+
* __Form section__
|
|
279
|
+
*
|
|
280
|
+
* A form section is used to define a section of a form layout. This contains a section title, content
|
|
281
|
+
* and a description of the section.
|
|
282
|
+
*
|
|
283
|
+
* - [Examples](https://atlaskit.atlassian.com/packages/design-system/form/docs/layout)
|
|
284
|
+
* - [Code](https://atlaskit.atlassian.com/packages/design-system/form/docs/layout)
|
|
285
|
+
* - [Usage](https://atlaskit.atlassian.com/packages/design-system/form/docs/layout)
|
|
286
|
+
*/
|
|
287
|
+
export declare const FormSection: React_2.FC<FormSectionProps>;
|
|
288
|
+
|
|
289
|
+
declare interface FormSectionProps {
|
|
290
|
+
/**
|
|
291
|
+
* Title of the form section.
|
|
292
|
+
*/
|
|
293
|
+
title?: ReactNode;
|
|
294
|
+
/**
|
|
295
|
+
* Content or components to render after the description.
|
|
296
|
+
*/
|
|
297
|
+
children?: ReactNode;
|
|
298
|
+
/**
|
|
299
|
+
* Description of the contents of the section.
|
|
300
|
+
*/
|
|
301
|
+
description?: ReactNode;
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
/**
|
|
305
|
+
* __Helper message__
|
|
306
|
+
*
|
|
307
|
+
* A helper message tells the user what kind of input the field takes. For example, a helper message could be
|
|
308
|
+
* 'Password should be more than 4 characters'
|
|
309
|
+
*
|
|
310
|
+
*/
|
|
311
|
+
export declare const HelperMessage: React_2.FC<MessageProps>;
|
|
312
|
+
|
|
313
|
+
/**
|
|
314
|
+
* __Label__
|
|
315
|
+
*
|
|
316
|
+
* A label represents a caption for an item in a user interface.
|
|
317
|
+
*
|
|
318
|
+
* It's recommended that a label has a `4px` spacing above its associated
|
|
319
|
+
* control element.
|
|
320
|
+
*/
|
|
321
|
+
export declare const Label: FC<LabelProps>;
|
|
322
|
+
|
|
323
|
+
export declare interface LabelProps {
|
|
324
|
+
id?: string;
|
|
325
|
+
htmlFor: string;
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
declare interface MessageProps {
|
|
329
|
+
/**
|
|
330
|
+
* The content of the message
|
|
331
|
+
*/
|
|
332
|
+
children: ReactNode;
|
|
333
|
+
/**
|
|
334
|
+
* A testId prop is provided for specified elements, which is a unique string
|
|
335
|
+
* that appears as a data attribute data-testid in the rendered code,
|
|
336
|
+
* serving as a hook for automated tests
|
|
337
|
+
*/
|
|
338
|
+
testId?: string;
|
|
339
|
+
/**
|
|
340
|
+
* Checks whether message input is invalid and should show an error.
|
|
341
|
+
*/
|
|
342
|
+
error?: boolean;
|
|
343
|
+
/**
|
|
344
|
+
* Checks whether message input is valid.
|
|
345
|
+
*/
|
|
346
|
+
valid?: boolean;
|
|
347
|
+
fieldId?: string;
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
declare interface Meta {
|
|
351
|
+
dirty: boolean;
|
|
352
|
+
dirtySinceLastSubmit: boolean;
|
|
353
|
+
submitFailed: boolean;
|
|
354
|
+
submitting: boolean;
|
|
355
|
+
touched: boolean;
|
|
356
|
+
valid: boolean;
|
|
357
|
+
error?: string;
|
|
358
|
+
submitError?: boolean;
|
|
359
|
+
validating?: boolean;
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
export declare type OnSubmitHandler<FormData> = (
|
|
363
|
+
values: FormData,
|
|
364
|
+
form: FormApi<FormData>,
|
|
365
|
+
callback?: (errors?: Record<string, string>) => void,
|
|
366
|
+
) => void | Object | Promise<Object | void>;
|
|
367
|
+
|
|
368
|
+
/**
|
|
369
|
+
* __Range field__
|
|
370
|
+
*
|
|
371
|
+
* A range field is where a user can submit a range input as a part of a form.
|
|
372
|
+
*
|
|
373
|
+
* - [Examples](https://atlaskit.atlassian.com/packages/design-system/form/docs/fields#rangefield-reference)
|
|
374
|
+
* - [Code](https://atlaskit.atlassian.com/packages/design-system/form/docs/fields#rangefield-reference)
|
|
375
|
+
* - [Usage](https://atlaskit.atlassian.com/packages/design-system/form/docs/fields#rangefield-reference)
|
|
376
|
+
*/
|
|
377
|
+
export declare const RangeField: FC<RangeFieldProps>;
|
|
378
|
+
|
|
379
|
+
export declare interface RangeFieldProps {
|
|
380
|
+
children: (args: {
|
|
381
|
+
fieldProps: RangeProps;
|
|
382
|
+
error?: string;
|
|
383
|
+
meta: Meta;
|
|
384
|
+
}) => React_2.ReactNode;
|
|
385
|
+
/**
|
|
386
|
+
* Specifies the name of the field. This is important for referencing the form data.
|
|
387
|
+
*/
|
|
388
|
+
name: string;
|
|
389
|
+
/**
|
|
390
|
+
* Sets the default value of the field. If a function is provided, it is called with the current default value of the field.
|
|
391
|
+
*/
|
|
392
|
+
defaultValue: number | ((currentDefaultValue?: number) => number);
|
|
393
|
+
/**
|
|
394
|
+
* Value passed to the `id` attribute of the field. This is randomly generated if it is not specified.
|
|
395
|
+
*/
|
|
396
|
+
id?: string;
|
|
397
|
+
/**
|
|
398
|
+
* Sets whether the field is disabled. Users cannot edit or focus on the fields. If the parent form component is disabled, then the field will always be disabled.
|
|
399
|
+
*/
|
|
400
|
+
isDisabled?: boolean;
|
|
401
|
+
/**
|
|
402
|
+
* Displays a label above the range field and identifies the form fields.
|
|
403
|
+
*/
|
|
404
|
+
label?: ReactNode;
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
declare type RangeProps = Omit<FieldProps<number>, 'isInvalid' | 'isRequired'>;
|
|
408
|
+
|
|
409
|
+
declare type SupportedElements =
|
|
410
|
+
| HTMLInputElement
|
|
411
|
+
| HTMLTextAreaElement
|
|
412
|
+
| HTMLSelectElement;
|
|
413
|
+
|
|
414
|
+
/**
|
|
415
|
+
* __Valid message__
|
|
416
|
+
*
|
|
417
|
+
* A valid message is used to tell a user that the field input is valid. For example,
|
|
418
|
+
* a helper message could be 'Nice one, this username is available'.
|
|
419
|
+
*
|
|
420
|
+
*/
|
|
421
|
+
export declare const ValidMessage: React_2.FC<MessageProps>;
|
|
422
|
+
|
|
423
|
+
export {};
|
|
424
|
+
```
|