@atlaskit/form 10.3.0 → 10.4.0
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 +20 -1
- package/README.md +2 -1
- package/__perf__/default.tsx +46 -57
- package/dist/cjs/field.js +3 -1
- package/dist/cjs/fieldset.js +6 -1
- package/dist/cjs/form-footer.js +7 -2
- package/dist/cjs/form-header.js +6 -1
- package/dist/cjs/form-section.js +5 -0
- package/dist/cjs/label.js +11 -2
- package/dist/cjs/messages.js +5 -0
- package/dist/cjs/required-asterisk.js +4 -0
- package/dist/es2019/field.js +5 -0
- package/dist/es2019/fieldset.js +5 -1
- package/dist/es2019/form-footer.js +6 -2
- package/dist/es2019/form-header.js +5 -1
- package/dist/es2019/form-section.js +4 -0
- package/dist/es2019/label.js +10 -2
- package/dist/es2019/messages.js +4 -0
- package/dist/es2019/required-asterisk.js +4 -0
- package/dist/esm/field.js +5 -0
- package/dist/esm/fieldset.js +5 -1
- package/dist/esm/form-footer.js +6 -2
- package/dist/esm/form-header.js +5 -1
- package/dist/esm/form-section.js +4 -0
- package/dist/esm/label.js +10 -2
- package/dist/esm/messages.js +4 -0
- package/dist/esm/required-asterisk.js +4 -0
- package/dist/types/field.d.ts +3 -0
- package/dist/types/fieldset.d.ts +3 -0
- package/dist/types/form-footer.d.ts +4 -1
- package/dist/types/form-header.d.ts +3 -0
- package/dist/types/form-section.d.ts +3 -0
- package/dist/types/label.d.ts +3 -0
- package/dist/types/messages.d.ts +3 -0
- package/dist/types/required-asterisk.d.ts +3 -0
- package/dist/types-ts4.5/field.d.ts +3 -0
- package/dist/types-ts4.5/fieldset.d.ts +3 -0
- package/dist/types-ts4.5/form-footer.d.ts +4 -1
- package/dist/types-ts4.5/form-header.d.ts +3 -0
- package/dist/types-ts4.5/form-section.d.ts +3 -0
- package/dist/types-ts4.5/label.d.ts +3 -0
- package/dist/types-ts4.5/messages.d.ts +3 -0
- package/dist/types-ts4.5/required-asterisk.d.ts +3 -0
- package/extract-react-types/checkbox-field-props.tsx +1 -1
- package/extract-react-types/field-props.tsx +1 -1
- package/extract-react-types/fieldset-props.tsx +1 -1
- package/extract-react-types/form-footer-props.tsx +1 -1
- package/extract-react-types/form-header-props.tsx +1 -1
- package/extract-react-types/form-props.tsx +1 -1
- package/extract-react-types/form-section-props.tsx +1 -1
- package/extract-react-types/range-field-props.tsx +1 -1
- package/package.json +133 -133
- package/report.api.md +144 -181
package/report.api.md
CHANGED
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
## API Report File for "@atlaskit/form"
|
|
4
4
|
|
|
5
|
-
> Do not edit this file. This report is auto-generated using
|
|
5
|
+
> Do not edit this file. This report is auto-generated using
|
|
6
|
+
> [API Extractor](https://api-extractor.com/).
|
|
6
7
|
> [Learn more about API reports](https://hello.atlassian.net/wiki/spaces/UR/pages/1825484529/Package+API+Reports)
|
|
7
8
|
|
|
8
9
|
### Table of contents
|
|
@@ -31,94 +32,82 @@ export const CheckboxField: FC<CheckboxProps>;
|
|
|
31
32
|
|
|
32
33
|
// @public (undocumented)
|
|
33
34
|
export interface CheckboxFieldProps extends FieldProps<string | undefined> {
|
|
34
|
-
|
|
35
|
-
|
|
35
|
+
// (undocumented)
|
|
36
|
+
isChecked: boolean;
|
|
36
37
|
}
|
|
37
38
|
|
|
38
39
|
// @public (undocumented)
|
|
39
40
|
interface CheckboxProps {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
41
|
+
children: (args: {
|
|
42
|
+
fieldProps: CheckboxFieldProps;
|
|
43
|
+
error?: string;
|
|
44
|
+
valid: boolean;
|
|
45
|
+
meta: Meta;
|
|
46
|
+
}) => ReactNode;
|
|
47
|
+
defaultIsChecked?: boolean;
|
|
48
|
+
isDisabled?: boolean;
|
|
49
|
+
isRequired?: boolean;
|
|
50
|
+
label?: ReactNode;
|
|
51
|
+
name: string;
|
|
52
|
+
value?: string;
|
|
52
53
|
}
|
|
53
54
|
|
|
54
55
|
// @public
|
|
55
|
-
export const ErrorMessage: ({
|
|
56
|
-
children,
|
|
57
|
-
testId,
|
|
58
|
-
}: MessageProps) => jsx.JSX.Element;
|
|
56
|
+
export const ErrorMessage: ({ children, testId }: MessageProps) => jsx.JSX.Element;
|
|
59
57
|
|
|
60
58
|
// @public (undocumented)
|
|
61
|
-
export function Field<
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
>(props: FieldComponentProps<FieldValue, Element>): jsx.JSX.Element;
|
|
59
|
+
export function Field<FieldValue = string, Element extends SupportedElements = HTMLInputElement>(
|
|
60
|
+
props: FieldComponentProps<FieldValue, Element>,
|
|
61
|
+
): jsx.JSX.Element;
|
|
65
62
|
|
|
66
63
|
// @public (undocumented)
|
|
67
64
|
interface FieldComponentProps<FieldValue, Element extends SupportedElements> {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
validate?: (
|
|
89
|
-
value: FieldValue | undefined,
|
|
90
|
-
formState: Object,
|
|
91
|
-
fieldState: Meta,
|
|
92
|
-
) => Promise<string | void> | string | void;
|
|
65
|
+
children: (args: {
|
|
66
|
+
fieldProps: FieldProps<FieldValue, Element>;
|
|
67
|
+
error?: string;
|
|
68
|
+
valid: boolean;
|
|
69
|
+
meta: Meta;
|
|
70
|
+
}) => ReactNode;
|
|
71
|
+
defaultValue?: ((currentDefaultValue?: FieldValue) => FieldValue) | FieldValue;
|
|
72
|
+
elementAfterLabel?: ReactNode;
|
|
73
|
+
id?: string;
|
|
74
|
+
isDisabled?: boolean;
|
|
75
|
+
isRequired?: boolean;
|
|
76
|
+
label?: ReactNode;
|
|
77
|
+
name: string;
|
|
78
|
+
testId?: string;
|
|
79
|
+
transform?: (event: FieldValue | FormEvent<Element>, current: FieldValue) => FieldValue;
|
|
80
|
+
validate?: (
|
|
81
|
+
value: FieldValue | undefined,
|
|
82
|
+
formState: Object,
|
|
83
|
+
fieldState: Meta,
|
|
84
|
+
) => Promise<string | void> | string | void;
|
|
93
85
|
}
|
|
94
86
|
|
|
95
87
|
// @public (undocumented)
|
|
96
|
-
export interface FieldProps<
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
onFocus: () => void;
|
|
120
|
-
// (undocumented)
|
|
121
|
-
value: FieldValue;
|
|
88
|
+
export interface FieldProps<FieldValue, Element extends SupportedElements = HTMLInputElement> {
|
|
89
|
+
// (undocumented)
|
|
90
|
+
'aria-invalid': 'false' | 'true';
|
|
91
|
+
// (undocumented)
|
|
92
|
+
'aria-labelledby': string;
|
|
93
|
+
// (undocumented)
|
|
94
|
+
id: string;
|
|
95
|
+
// (undocumented)
|
|
96
|
+
isDisabled: boolean;
|
|
97
|
+
// (undocumented)
|
|
98
|
+
isInvalid: boolean;
|
|
99
|
+
// (undocumented)
|
|
100
|
+
isRequired: boolean;
|
|
101
|
+
// (undocumented)
|
|
102
|
+
name: string;
|
|
103
|
+
// (undocumented)
|
|
104
|
+
onBlur: () => void;
|
|
105
|
+
// (undocumented)
|
|
106
|
+
onChange: (value: FieldValue | FormEvent<Element>) => void;
|
|
107
|
+
// (undocumented)
|
|
108
|
+
onFocus: () => void;
|
|
109
|
+
// (undocumented)
|
|
110
|
+
value: FieldValue;
|
|
122
111
|
}
|
|
123
112
|
|
|
124
113
|
// @public
|
|
@@ -126,13 +115,13 @@ export const Fieldset: ({ children, legend }: FieldsetProps) => jsx.JSX.Element;
|
|
|
126
115
|
|
|
127
116
|
// @public (undocumented)
|
|
128
117
|
interface FieldsetProps {
|
|
129
|
-
|
|
130
|
-
|
|
118
|
+
children: ReactNode;
|
|
119
|
+
legend?: ReactNode;
|
|
131
120
|
}
|
|
132
121
|
|
|
133
122
|
// @public (undocumented)
|
|
134
123
|
function Form<FormValues extends Record<string, any> = {}>(
|
|
135
|
-
|
|
124
|
+
props: FormProps<FormValues>,
|
|
136
125
|
): JSX.Element;
|
|
137
126
|
export default Form;
|
|
138
127
|
|
|
@@ -141,87 +130,71 @@ export type FormApi<FormData> = FormApi_2<FormData>;
|
|
|
141
130
|
|
|
142
131
|
// @public (undocumented)
|
|
143
132
|
interface FormChildrenProps {
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
// (undocumented)
|
|
153
|
-
ref: React_2.RefObject<HTMLFormElement>;
|
|
133
|
+
// (undocumented)
|
|
134
|
+
onKeyDown: (event: React_2.KeyboardEvent<HTMLElement>) => void;
|
|
135
|
+
// (undocumented)
|
|
136
|
+
onSubmit: (
|
|
137
|
+
event?: React_2.FormEvent<HTMLFormElement> | React_2.SyntheticEvent<HTMLElement>,
|
|
138
|
+
) => void;
|
|
139
|
+
// (undocumented)
|
|
140
|
+
ref: React_2.RefObject<HTMLFormElement>;
|
|
154
141
|
}
|
|
155
142
|
|
|
156
143
|
// @public
|
|
157
|
-
export function FormFooter({
|
|
158
|
-
align,
|
|
159
|
-
children,
|
|
160
|
-
}: FormFooterProps): jsx.JSX.Element;
|
|
144
|
+
export function FormFooter({ align, children }: FormFooterProps): jsx.JSX.Element;
|
|
161
145
|
|
|
162
146
|
// @public (undocumented)
|
|
163
147
|
interface FormFooterProps {
|
|
164
|
-
|
|
165
|
-
|
|
148
|
+
align?: Align;
|
|
149
|
+
children?: ReactNode;
|
|
166
150
|
}
|
|
167
151
|
|
|
168
152
|
// @public
|
|
169
|
-
export const FormHeader: ({
|
|
170
|
-
children,
|
|
171
|
-
description,
|
|
172
|
-
title,
|
|
173
|
-
}: FormHeaderProps) => jsx.JSX.Element;
|
|
153
|
+
export const FormHeader: ({ children, description, title }: FormHeaderProps) => jsx.JSX.Element;
|
|
174
154
|
|
|
175
155
|
// @public (undocumented)
|
|
176
156
|
interface FormHeaderProps {
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
157
|
+
children?: ReactNode;
|
|
158
|
+
description?: ReactNode;
|
|
159
|
+
title?: ReactNode;
|
|
180
160
|
}
|
|
181
161
|
|
|
182
162
|
// @public (undocumented)
|
|
183
163
|
export interface FormProps<FormValues> {
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
164
|
+
children: (args: {
|
|
165
|
+
formProps: FormChildrenProps;
|
|
166
|
+
disabled: boolean;
|
|
167
|
+
dirty: boolean;
|
|
168
|
+
submitting: boolean;
|
|
169
|
+
getState: () => FormState<FormValues>;
|
|
170
|
+
getValues: () => FormValues;
|
|
171
|
+
setFieldValue: (name: string, value: any) => void;
|
|
172
|
+
reset: (initialValues?: FormValues) => void;
|
|
173
|
+
}) => ReactNode;
|
|
174
|
+
isDisabled?: boolean;
|
|
175
|
+
onSubmit: OnSubmitHandler<FormValues>;
|
|
196
176
|
}
|
|
197
177
|
|
|
198
178
|
// @public
|
|
199
|
-
export const FormSection: ({
|
|
200
|
-
children,
|
|
201
|
-
description,
|
|
202
|
-
title,
|
|
203
|
-
}: FormSectionProps) => jsx.JSX.Element;
|
|
179
|
+
export const FormSection: ({ children, description, title }: FormSectionProps) => jsx.JSX.Element;
|
|
204
180
|
|
|
205
181
|
// @public (undocumented)
|
|
206
182
|
interface FormSectionProps {
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
183
|
+
children?: ReactNode;
|
|
184
|
+
description?: ReactNode;
|
|
185
|
+
title?: ReactNode;
|
|
210
186
|
}
|
|
211
187
|
|
|
212
188
|
// @public
|
|
213
|
-
export const HelperMessage: ({
|
|
214
|
-
children,
|
|
215
|
-
testId,
|
|
216
|
-
}: MessageProps) => jsx.JSX.Element;
|
|
189
|
+
export const HelperMessage: ({ children, testId }: MessageProps) => jsx.JSX.Element;
|
|
217
190
|
|
|
218
191
|
// @public
|
|
219
192
|
interface InternalMessageProps {
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
193
|
+
appearance?: MessageAppearance;
|
|
194
|
+
children: ReactNode;
|
|
195
|
+
// (undocumented)
|
|
196
|
+
fieldId?: string;
|
|
197
|
+
testId?: string;
|
|
225
198
|
}
|
|
226
199
|
|
|
227
200
|
// @public
|
|
@@ -229,14 +202,14 @@ export const Label: FC<LabelProps>;
|
|
|
229
202
|
|
|
230
203
|
// @public (undocumented)
|
|
231
204
|
export interface LabelProps {
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
205
|
+
// (undocumented)
|
|
206
|
+
children: ReactNode;
|
|
207
|
+
// (undocumented)
|
|
208
|
+
htmlFor: string;
|
|
209
|
+
// (undocumented)
|
|
210
|
+
id?: string;
|
|
211
|
+
// (undocumented)
|
|
212
|
+
testId?: string;
|
|
240
213
|
}
|
|
241
214
|
|
|
242
215
|
// @public
|
|
@@ -244,8 +217,8 @@ export const Legend: FC<LegendProps>;
|
|
|
244
217
|
|
|
245
218
|
// @public (undocumented)
|
|
246
219
|
export interface LegendProps {
|
|
247
|
-
|
|
248
|
-
|
|
220
|
+
// (undocumented)
|
|
221
|
+
children: ReactNode;
|
|
249
222
|
}
|
|
250
223
|
|
|
251
224
|
// @public (undocumented)
|
|
@@ -256,31 +229,31 @@ type MessageProps = Pick<InternalMessageProps, 'children' | 'testId'>;
|
|
|
256
229
|
|
|
257
230
|
// @public (undocumented)
|
|
258
231
|
interface Meta {
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
232
|
+
// (undocumented)
|
|
233
|
+
dirty: boolean;
|
|
234
|
+
// (undocumented)
|
|
235
|
+
dirtySinceLastSubmit: boolean;
|
|
236
|
+
// (undocumented)
|
|
237
|
+
error?: string;
|
|
238
|
+
// (undocumented)
|
|
239
|
+
submitError?: boolean;
|
|
240
|
+
// (undocumented)
|
|
241
|
+
submitFailed: boolean;
|
|
242
|
+
// (undocumented)
|
|
243
|
+
submitting: boolean;
|
|
244
|
+
// (undocumented)
|
|
245
|
+
touched: boolean;
|
|
246
|
+
// (undocumented)
|
|
247
|
+
valid: boolean;
|
|
248
|
+
// (undocumented)
|
|
249
|
+
validating?: boolean;
|
|
277
250
|
}
|
|
278
251
|
|
|
279
252
|
// @public (undocumented)
|
|
280
253
|
export type OnSubmitHandler<FormData> = (
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
254
|
+
values: FormData,
|
|
255
|
+
form: FormApi<FormData>,
|
|
256
|
+
callback?: (errors?: Record<string, string>) => void,
|
|
284
257
|
) => Object | Promise<Object | void> | void;
|
|
285
258
|
|
|
286
259
|
// @public
|
|
@@ -288,17 +261,13 @@ export const RangeField: FC<RangeFieldProps>;
|
|
|
288
261
|
|
|
289
262
|
// @public (undocumented)
|
|
290
263
|
export interface RangeFieldProps {
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
id?: string;
|
|
299
|
-
isDisabled?: boolean;
|
|
300
|
-
label?: ReactNode;
|
|
301
|
-
name: string;
|
|
264
|
+
// (undocumented)
|
|
265
|
+
children: (args: { fieldProps: RangeProps; error?: string; meta: Meta }) => React_2.ReactNode;
|
|
266
|
+
defaultValue: ((currentDefaultValue?: number) => number) | number;
|
|
267
|
+
id?: string;
|
|
268
|
+
isDisabled?: boolean;
|
|
269
|
+
label?: ReactNode;
|
|
270
|
+
name: string;
|
|
302
271
|
}
|
|
303
272
|
|
|
304
273
|
// @public (undocumented)
|
|
@@ -308,16 +277,10 @@ type RangeProps = Omit<FieldProps<number>, 'isInvalid' | 'isRequired'>;
|
|
|
308
277
|
export function RequiredAsterisk(): jsx.JSX.Element;
|
|
309
278
|
|
|
310
279
|
// @public (undocumented)
|
|
311
|
-
type SupportedElements =
|
|
312
|
-
| HTMLInputElement
|
|
313
|
-
| HTMLSelectElement
|
|
314
|
-
| HTMLTextAreaElement;
|
|
280
|
+
type SupportedElements = HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement;
|
|
315
281
|
|
|
316
282
|
// @public
|
|
317
|
-
export const ValidMessage: ({
|
|
318
|
-
children,
|
|
319
|
-
testId,
|
|
320
|
-
}: MessageProps) => jsx.JSX.Element;
|
|
283
|
+
export const ValidMessage: ({ children, testId }: MessageProps) => jsx.JSX.Element;
|
|
321
284
|
|
|
322
285
|
// (No @packageDocumentation comment for this package)
|
|
323
286
|
```
|
|
@@ -330,7 +293,7 @@ export const ValidMessage: ({
|
|
|
330
293
|
|
|
331
294
|
```json
|
|
332
295
|
{
|
|
333
|
-
|
|
296
|
+
"react": "^16.8.0"
|
|
334
297
|
}
|
|
335
298
|
```
|
|
336
299
|
|