@atlaskit/form 8.7.0 → 8.8.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.
Files changed (35) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/cjs/field.js +32 -13
  3. package/dist/cjs/form.js +23 -3
  4. package/dist/cjs/version.json +1 -1
  5. package/dist/es2019/field.js +32 -13
  6. package/dist/es2019/form.js +22 -4
  7. package/dist/es2019/version.json +1 -1
  8. package/dist/esm/field.js +32 -13
  9. package/dist/esm/form.js +24 -4
  10. package/dist/esm/version.json +1 -1
  11. package/dist/types/form.d.ts +5 -1
  12. package/package.json +4 -12
  13. package/report.api.md +26 -18
  14. package/dist/types-ts4.0/checkbox-field.d.ts +0 -51
  15. package/dist/types-ts4.0/entry-points/checkbox-field.d.ts +0 -2
  16. package/dist/types-ts4.0/entry-points/field.d.ts +0 -2
  17. package/dist/types-ts4.0/entry-points/fieldset.d.ts +0 -1
  18. package/dist/types-ts4.0/entry-points/form-footer.d.ts +0 -1
  19. package/dist/types-ts4.0/entry-points/form-header.d.ts +0 -1
  20. package/dist/types-ts4.0/entry-points/form-section.d.ts +0 -1
  21. package/dist/types-ts4.0/entry-points/form.d.ts +0 -1
  22. package/dist/types-ts4.0/entry-points/label.d.ts +0 -2
  23. package/dist/types-ts4.0/entry-points/messages.d.ts +0 -1
  24. package/dist/types-ts4.0/entry-points/range-field.d.ts +0 -2
  25. package/dist/types-ts4.0/field.d.ts +0 -83
  26. package/dist/types-ts4.0/fieldset.d.ts +0 -25
  27. package/dist/types-ts4.0/form-footer.d.ts +0 -24
  28. package/dist/types-ts4.0/form-header.d.ts +0 -32
  29. package/dist/types-ts4.0/form-section.d.ts +0 -28
  30. package/dist/types-ts4.0/form.d.ts +0 -51
  31. package/dist/types-ts4.0/index.d.ts +0 -16
  32. package/dist/types-ts4.0/label.d.ts +0 -16
  33. package/dist/types-ts4.0/messages.d.ts +0 -48
  34. package/dist/types-ts4.0/range-field.d.ts +0 -41
  35. package/dist/types-ts4.0/types.d.ts +0 -4
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @atlaskit/form
2
2
 
3
+ ## 8.8.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`f2d39d67a70`](https://bitbucket.org/atlassian/atlassian-frontend/commits/f2d39d67a70) - Fixed the issue where field's value was reset on the component re-mount.
8
+
9
+ ## 8.7.1
10
+
11
+ ### Patch Changes
12
+
13
+ - Updated dependencies
14
+
3
15
  ## 8.7.0
4
16
 
5
17
  ### Minor Changes
package/dist/cjs/field.js CHANGED
@@ -93,9 +93,22 @@ function isShallowEqual(previousValue, currentValue) {
93
93
  }
94
94
 
95
95
  function Field(props) {
96
- var registerField = (0, _react.useContext)(_form.FormContext);
96
+ var _getCurrentValue;
97
+
98
+ var _useContext = (0, _react.useContext)(_form.FormContext),
99
+ registerField = _useContext.registerField,
100
+ getCurrentValue = _useContext.getCurrentValue;
101
+
97
102
  var isDisabled = (0, _react.useContext)(_form.IsDisabledContext) || props.isDisabled || false;
98
103
  var defaultValue = isFunction(props.defaultValue) ? props.defaultValue() : props.defaultValue;
104
+ var latestPropsRef = usePreviousRef(props);
105
+ /**
106
+ * HACK: defaultValue can potentially be an array or object which cannot be
107
+ * passed directly into a `useEffect` dependency array, since it will trigger
108
+ * the hook every time.
109
+ */
110
+
111
+ var isDefaultValueChanged = !isShallowEqual(latestPropsRef.current.defaultValue, props.defaultValue);
99
112
 
100
113
  var _useState = (0, _react.useState)({
101
114
  fieldProps: {
@@ -108,9 +121,13 @@ function Field(props) {
108
121
  * prop types defined defaultValue as required, so inside the component it was not
109
122
  * valid for defaultValue to be undefined. We need to suppress the error
110
123
  * after changing defaultValue to explictly be an optional prop.
124
+ * If default value has changed we are using new default value.
125
+ * Otherwise we need to check if we already have value for this field
126
+ * (because we are using changing key prop to re-run field level validation, and that
127
+ * cause the component re-mounting) to not override the actual value with the default value.
111
128
  */
112
129
  // @ts-ignore
113
- value: defaultValue
130
+ value: isDefaultValueChanged ? defaultValue : (_getCurrentValue = getCurrentValue(props.name)) !== null && _getCurrentValue !== void 0 ? _getCurrentValue : defaultValue
114
131
  },
115
132
  error: undefined,
116
133
  valid: false,
@@ -130,15 +147,7 @@ function Field(props) {
130
147
  state = _useState2[0],
131
148
  setState = _useState2[1];
132
149
 
133
- var latestPropsRef = usePreviousRef(props);
134
150
  var latestStateRef = usePreviousRef(state);
135
- /**
136
- * HACK: defaultValue can potentially be an array or object which cannot be
137
- * passed directly into a `useEffect` dependency array, since it will trigger
138
- * the hook every time.
139
- */
140
-
141
- var hasDefaultValueChanged = isShallowEqual(latestPropsRef.current.defaultValue, props.defaultValue);
142
151
  (0, _react.useEffect)(function () {
143
152
  if (process.env.NODE_ENV !== 'production' && !process.env.CI) {
144
153
  (0, _tinyInvariant.default)(latestPropsRef.current.name, '@atlaskit/form: Field components have a required name prop');
@@ -159,8 +168,18 @@ function Field(props) {
159
168
  };
160
169
  }
161
170
 
162
- var unregister = registerField(latestPropsRef.current.name, // @ts-ignore
163
- latestPropsRef.current.defaultValue, function (fieldState) {
171
+ var unregister = registerField(latestPropsRef.current.name,
172
+ /**
173
+ * Similar as for setting initial state value.
174
+ * Additionally we are checking if the default value is a function,
175
+ * it is used in checkbox fields, where fields with same name and
176
+ * defaultIsChecked should create array of values. In this situation we can't
177
+ * override the default value on re-registering, but also we don't need to change
178
+ * the key prop to re-run validation.
179
+ */
180
+ // @ts-ignore
181
+ isDefaultValueChanged || // @ts-ignore
182
+ isFunction(latestPropsRef.current.defaultValue) ? latestPropsRef.current.defaultValue : latestStateRef.current.fieldProps.value, function (fieldState) {
164
183
  /**
165
184
  * Do not update dirtySinceLastSubmit until submission has finished.
166
185
  */
@@ -248,7 +267,7 @@ function Field(props) {
248
267
  }
249
268
  });
250
269
  return unregister;
251
- }, [latestPropsRef, latestStateRef, registerField, props.name, hasDefaultValueChanged]);
270
+ }, [latestPropsRef, latestStateRef, registerField, props.name, isDefaultValueChanged]);
252
271
  var fieldId = (0, _react.useMemo)( // eslint-disable-next-line @repo/internal/react/disallow-unstable-values
253
272
  function () {
254
273
  return props.id ? props.id : "".concat(props.name, "-").concat((0, _reactUid.uid)({
package/dist/cjs/form.js CHANGED
@@ -29,8 +29,13 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
29
29
  *
30
30
  * A form context creates a context for the field values and allows them to be accessed by the children.
31
31
  */
32
- var FormContext = /*#__PURE__*/(0, _react.createContext)(function () {
33
- return function () {};
32
+ var FormContext = /*#__PURE__*/(0, _react.createContext)({
33
+ registerField: function registerField() {
34
+ return function () {};
35
+ },
36
+ getCurrentValue: function getCurrentValue() {
37
+ return undefined;
38
+ }
34
39
  });
35
40
  /**
36
41
  * __Is disabled context__
@@ -143,8 +148,23 @@ function Form(props) {
143
148
  children = props.children;
144
149
  var dirty = state.dirty,
145
150
  submitting = state.submitting;
151
+ /**
152
+ * This method is needed in FormContext to use it on the field level
153
+ * to check the current value of the field in case of the component re-mounting.
154
+ */
155
+
156
+ var getCurrentValue = (0, _react.useCallback)(function (name) {
157
+ var formState = form.getState();
158
+ return (formState === null || formState === void 0 ? void 0 : formState.values[name]) || undefined;
159
+ }, [form]);
160
+ var FormContextValue = (0, _react.useMemo)(function () {
161
+ return {
162
+ registerField: registerField,
163
+ getCurrentValue: getCurrentValue
164
+ };
165
+ }, [registerField, getCurrentValue]);
146
166
  return /*#__PURE__*/_react.default.createElement(FormContext.Provider, {
147
- value: registerField
167
+ value: FormContextValue
148
168
  }, /*#__PURE__*/_react.default.createElement(IsDisabledContext.Provider, {
149
169
  value: isDisabled
150
170
  }, children({
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/form",
3
- "version": "8.7.0",
3
+ "version": "8.8.0",
4
4
  "sideEffects": false
5
5
  }
@@ -65,9 +65,22 @@ function isShallowEqual(previousValue, currentValue) {
65
65
  }
66
66
 
67
67
  export default function Field(props) {
68
- const registerField = useContext(FormContext);
68
+ var _getCurrentValue;
69
+
70
+ const {
71
+ registerField,
72
+ getCurrentValue
73
+ } = useContext(FormContext);
69
74
  const isDisabled = useContext(IsDisabledContext) || props.isDisabled || false;
70
75
  const defaultValue = isFunction(props.defaultValue) ? props.defaultValue() : props.defaultValue;
76
+ const latestPropsRef = usePreviousRef(props);
77
+ /**
78
+ * HACK: defaultValue can potentially be an array or object which cannot be
79
+ * passed directly into a `useEffect` dependency array, since it will trigger
80
+ * the hook every time.
81
+ */
82
+
83
+ const isDefaultValueChanged = !isShallowEqual(latestPropsRef.current.defaultValue, props.defaultValue);
71
84
  const [state, setState] = useState({
72
85
  fieldProps: {
73
86
  onChange: () => {},
@@ -79,9 +92,13 @@ export default function Field(props) {
79
92
  * prop types defined defaultValue as required, so inside the component it was not
80
93
  * valid for defaultValue to be undefined. We need to suppress the error
81
94
  * after changing defaultValue to explictly be an optional prop.
95
+ * If default value has changed we are using new default value.
96
+ * Otherwise we need to check if we already have value for this field
97
+ * (because we are using changing key prop to re-run field level validation, and that
98
+ * cause the component re-mounting) to not override the actual value with the default value.
82
99
  */
83
100
  // @ts-ignore
84
- value: defaultValue
101
+ value: isDefaultValueChanged ? defaultValue : (_getCurrentValue = getCurrentValue(props.name)) !== null && _getCurrentValue !== void 0 ? _getCurrentValue : defaultValue
85
102
  },
86
103
  error: undefined,
87
104
  valid: false,
@@ -97,15 +114,7 @@ export default function Field(props) {
97
114
  submitError: undefined
98
115
  }
99
116
  });
100
- const latestPropsRef = usePreviousRef(props);
101
117
  const latestStateRef = usePreviousRef(state);
102
- /**
103
- * HACK: defaultValue can potentially be an array or object which cannot be
104
- * passed directly into a `useEffect` dependency array, since it will trigger
105
- * the hook every time.
106
- */
107
-
108
- const hasDefaultValueChanged = isShallowEqual(latestPropsRef.current.defaultValue, props.defaultValue);
109
118
  useEffect(() => {
110
119
  if (process.env.NODE_ENV !== 'production' && !process.env.CI) {
111
120
  invariant(latestPropsRef.current.name, '@atlaskit/form: Field components have a required name prop');
@@ -125,8 +134,18 @@ export default function Field(props) {
125
134
  };
126
135
  }
127
136
 
128
- const unregister = registerField(latestPropsRef.current.name, // @ts-ignore
129
- latestPropsRef.current.defaultValue, fieldState => {
137
+ const unregister = registerField(latestPropsRef.current.name,
138
+ /**
139
+ * Similar as for setting initial state value.
140
+ * Additionally we are checking if the default value is a function,
141
+ * it is used in checkbox fields, where fields with same name and
142
+ * defaultIsChecked should create array of values. In this situation we can't
143
+ * override the default value on re-registering, but also we don't need to change
144
+ * the key prop to re-run validation.
145
+ */
146
+ // @ts-ignore
147
+ isDefaultValueChanged || // @ts-ignore
148
+ isFunction(latestPropsRef.current.defaultValue) ? latestPropsRef.current.defaultValue : latestStateRef.current.fieldProps.value, fieldState => {
130
149
  /**
131
150
  * Do not update dirtySinceLastSubmit until submission has finished.
132
151
  */
@@ -214,7 +233,7 @@ export default function Field(props) {
214
233
  }
215
234
  });
216
235
  return unregister;
217
- }, [latestPropsRef, latestStateRef, registerField, props.name, hasDefaultValueChanged]);
236
+ }, [latestPropsRef, latestStateRef, registerField, props.name, isDefaultValueChanged]);
218
237
  const fieldId = useMemo( // eslint-disable-next-line @repo/internal/react/disallow-unstable-values
219
238
  () => props.id ? props.id : `${props.name}-${uid({
220
239
  id: props.name
@@ -1,4 +1,4 @@
1
- import React, { createContext, useCallback, useEffect, useRef, useState } from 'react';
1
+ import React, { createContext, useCallback, useEffect, useMemo, useRef, useState } from 'react';
2
2
  import { createForm } from 'final-form';
3
3
  import createDecorator from 'final-form-focus';
4
4
  import set from 'lodash/set';
@@ -8,8 +8,11 @@ import set from 'lodash/set';
8
8
  *
9
9
  * A form context creates a context for the field values and allows them to be accessed by the children.
10
10
  */
11
- export const FormContext = /*#__PURE__*/createContext(function () {
12
- return () => {};
11
+ export const FormContext = /*#__PURE__*/createContext({
12
+ registerField: function () {
13
+ return () => {};
14
+ },
15
+ getCurrentValue: () => undefined
13
16
  });
14
17
  /**
15
18
  * __Is disabled context__
@@ -105,8 +108,23 @@ export default function Form(props) {
105
108
  dirty,
106
109
  submitting
107
110
  } = state;
111
+ /**
112
+ * This method is needed in FormContext to use it on the field level
113
+ * to check the current value of the field in case of the component re-mounting.
114
+ */
115
+
116
+ const getCurrentValue = useCallback(name => {
117
+ const formState = form.getState();
118
+ return (formState === null || formState === void 0 ? void 0 : formState.values[name]) || undefined;
119
+ }, [form]);
120
+ const FormContextValue = useMemo(() => {
121
+ return {
122
+ registerField,
123
+ getCurrentValue
124
+ };
125
+ }, [registerField, getCurrentValue]);
108
126
  return /*#__PURE__*/React.createElement(FormContext.Provider, {
109
- value: registerField
127
+ value: FormContextValue
110
128
  }, /*#__PURE__*/React.createElement(IsDisabledContext.Provider, {
111
129
  value: isDisabled
112
130
  }, children({
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/form",
3
- "version": "8.7.0",
3
+ "version": "8.8.0",
4
4
  "sideEffects": false
5
5
  }
package/dist/esm/field.js CHANGED
@@ -73,9 +73,22 @@ function isShallowEqual(previousValue, currentValue) {
73
73
  }
74
74
 
75
75
  export default function Field(props) {
76
- var registerField = useContext(FormContext);
76
+ var _getCurrentValue;
77
+
78
+ var _useContext = useContext(FormContext),
79
+ registerField = _useContext.registerField,
80
+ getCurrentValue = _useContext.getCurrentValue;
81
+
77
82
  var isDisabled = useContext(IsDisabledContext) || props.isDisabled || false;
78
83
  var defaultValue = isFunction(props.defaultValue) ? props.defaultValue() : props.defaultValue;
84
+ var latestPropsRef = usePreviousRef(props);
85
+ /**
86
+ * HACK: defaultValue can potentially be an array or object which cannot be
87
+ * passed directly into a `useEffect` dependency array, since it will trigger
88
+ * the hook every time.
89
+ */
90
+
91
+ var isDefaultValueChanged = !isShallowEqual(latestPropsRef.current.defaultValue, props.defaultValue);
79
92
 
80
93
  var _useState = useState({
81
94
  fieldProps: {
@@ -88,9 +101,13 @@ export default function Field(props) {
88
101
  * prop types defined defaultValue as required, so inside the component it was not
89
102
  * valid for defaultValue to be undefined. We need to suppress the error
90
103
  * after changing defaultValue to explictly be an optional prop.
104
+ * If default value has changed we are using new default value.
105
+ * Otherwise we need to check if we already have value for this field
106
+ * (because we are using changing key prop to re-run field level validation, and that
107
+ * cause the component re-mounting) to not override the actual value with the default value.
91
108
  */
92
109
  // @ts-ignore
93
- value: defaultValue
110
+ value: isDefaultValueChanged ? defaultValue : (_getCurrentValue = getCurrentValue(props.name)) !== null && _getCurrentValue !== void 0 ? _getCurrentValue : defaultValue
94
111
  },
95
112
  error: undefined,
96
113
  valid: false,
@@ -110,15 +127,7 @@ export default function Field(props) {
110
127
  state = _useState2[0],
111
128
  setState = _useState2[1];
112
129
 
113
- var latestPropsRef = usePreviousRef(props);
114
130
  var latestStateRef = usePreviousRef(state);
115
- /**
116
- * HACK: defaultValue can potentially be an array or object which cannot be
117
- * passed directly into a `useEffect` dependency array, since it will trigger
118
- * the hook every time.
119
- */
120
-
121
- var hasDefaultValueChanged = isShallowEqual(latestPropsRef.current.defaultValue, props.defaultValue);
122
131
  useEffect(function () {
123
132
  if (process.env.NODE_ENV !== 'production' && !process.env.CI) {
124
133
  invariant(latestPropsRef.current.name, '@atlaskit/form: Field components have a required name prop');
@@ -139,8 +148,18 @@ export default function Field(props) {
139
148
  };
140
149
  }
141
150
 
142
- var unregister = registerField(latestPropsRef.current.name, // @ts-ignore
143
- latestPropsRef.current.defaultValue, function (fieldState) {
151
+ var unregister = registerField(latestPropsRef.current.name,
152
+ /**
153
+ * Similar as for setting initial state value.
154
+ * Additionally we are checking if the default value is a function,
155
+ * it is used in checkbox fields, where fields with same name and
156
+ * defaultIsChecked should create array of values. In this situation we can't
157
+ * override the default value on re-registering, but also we don't need to change
158
+ * the key prop to re-run validation.
159
+ */
160
+ // @ts-ignore
161
+ isDefaultValueChanged || // @ts-ignore
162
+ isFunction(latestPropsRef.current.defaultValue) ? latestPropsRef.current.defaultValue : latestStateRef.current.fieldProps.value, function (fieldState) {
144
163
  /**
145
164
  * Do not update dirtySinceLastSubmit until submission has finished.
146
165
  */
@@ -228,7 +247,7 @@ export default function Field(props) {
228
247
  }
229
248
  });
230
249
  return unregister;
231
- }, [latestPropsRef, latestStateRef, registerField, props.name, hasDefaultValueChanged]);
250
+ }, [latestPropsRef, latestStateRef, registerField, props.name, isDefaultValueChanged]);
232
251
  var fieldId = useMemo( // eslint-disable-next-line @repo/internal/react/disallow-unstable-values
233
252
  function () {
234
253
  return props.id ? props.id : "".concat(props.name, "-").concat(uid({
package/dist/esm/form.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
- import React, { createContext, useCallback, useEffect, useRef, useState } from 'react';
2
+ import React, { createContext, useCallback, useEffect, useMemo, useRef, useState } from 'react';
3
3
  import { createForm } from 'final-form';
4
4
  import createDecorator from 'final-form-focus';
5
5
  import set from 'lodash/set';
@@ -9,8 +9,13 @@ import set from 'lodash/set';
9
9
  *
10
10
  * A form context creates a context for the field values and allows them to be accessed by the children.
11
11
  */
12
- export var FormContext = /*#__PURE__*/createContext(function () {
13
- return function () {};
12
+ export var FormContext = /*#__PURE__*/createContext({
13
+ registerField: function registerField() {
14
+ return function () {};
15
+ },
16
+ getCurrentValue: function getCurrentValue() {
17
+ return undefined;
18
+ }
14
19
  });
15
20
  /**
16
21
  * __Is disabled context__
@@ -120,8 +125,23 @@ export default function Form(props) {
120
125
  children = props.children;
121
126
  var dirty = state.dirty,
122
127
  submitting = state.submitting;
128
+ /**
129
+ * This method is needed in FormContext to use it on the field level
130
+ * to check the current value of the field in case of the component re-mounting.
131
+ */
132
+
133
+ var getCurrentValue = useCallback(function (name) {
134
+ var formState = form.getState();
135
+ return (formState === null || formState === void 0 ? void 0 : formState.values[name]) || undefined;
136
+ }, [form]);
137
+ var FormContextValue = useMemo(function () {
138
+ return {
139
+ registerField: registerField,
140
+ getCurrentValue: getCurrentValue
141
+ };
142
+ }, [registerField, getCurrentValue]);
123
143
  return /*#__PURE__*/React.createElement(FormContext.Provider, {
124
- value: registerField
144
+ value: FormContextValue
125
145
  }, /*#__PURE__*/React.createElement(IsDisabledContext.Provider, {
126
146
  value: isDisabled
127
147
  }, children({
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/form",
3
- "version": "8.7.0",
3
+ "version": "8.8.0",
4
4
  "sideEffects": false
5
5
  }
@@ -3,12 +3,16 @@ import { FieldConfig, FieldSubscriber, FieldSubscription, FormState, Unsubscribe
3
3
  import { OnSubmitHandler } from './types';
4
4
  declare type DefaultValue<FieldValue> = (value?: FieldValue) => FieldValue;
5
5
  declare type RegisterField = <FieldValue>(name: string, defaultValue: FieldValue | DefaultValue<FieldValue>, subscriber: FieldSubscriber<FieldValue>, subscription: FieldSubscription, config: FieldConfig<FieldValue>) => Unsubscribe;
6
+ declare type GetCurrentValue = <FormValues>(name: string) => FormValues[keyof FormValues] | undefined;
6
7
  /**
7
8
  * __Form context__
8
9
  *
9
10
  * A form context creates a context for the field values and allows them to be accessed by the children.
10
11
  */
11
- export declare const FormContext: React.Context<RegisterField>;
12
+ export declare const FormContext: React.Context<{
13
+ registerField: RegisterField;
14
+ getCurrentValue: GetCurrentValue;
15
+ }>;
12
16
  /**
13
17
  * __Is disabled context__
14
18
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/form",
3
- "version": "8.7.0",
3
+ "version": "8.8.0",
4
4
  "description": "A form allows users to input information.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -12,14 +12,6 @@
12
12
  "module": "dist/esm/index.js",
13
13
  "module:es2019": "dist/es2019/index.js",
14
14
  "types": "dist/types/index.d.ts",
15
- "typesVersions": {
16
- ">=4.0 <4.5": {
17
- "*": [
18
- "dist/types-ts4.0/*",
19
- "dist/types-ts4.0/index.d.ts"
20
- ]
21
- }
22
- },
23
15
  "sideEffects": false,
24
16
  "atlaskit:src": "src/index.tsx",
25
17
  "atlaskit:designLink": "https://atlassian.design/guidelines/product/patterns/forms",
@@ -49,7 +41,7 @@
49
41
  "dependencies": {
50
42
  "@atlaskit/icon": "^21.11.0",
51
43
  "@atlaskit/theme": "^12.2.0",
52
- "@atlaskit/tokens": "^0.10.0",
44
+ "@atlaskit/tokens": "^0.11.0",
53
45
  "@babel/runtime": "^7.0.0",
54
46
  "@emotion/react": "^11.7.1",
55
47
  "final-form": "^4.20.1",
@@ -62,7 +54,7 @@
62
54
  "react": "^16.8.0"
63
55
  },
64
56
  "devDependencies": {
65
- "@atlaskit/button": "^16.4.0",
57
+ "@atlaskit/button": "^16.5.0",
66
58
  "@atlaskit/calendar": "^12.4.0",
67
59
  "@atlaskit/checkbox": "^12.4.0",
68
60
  "@atlaskit/datetime-picker": "^12.3.0",
@@ -74,7 +66,7 @@
74
66
  "@atlaskit/radio": "^5.4.0",
75
67
  "@atlaskit/range": "^7.0.0",
76
68
  "@atlaskit/section-message": "^6.3.0",
77
- "@atlaskit/select": "^15.7.0",
69
+ "@atlaskit/select": "^16.0.0",
78
70
  "@atlaskit/ssr": "*",
79
71
  "@atlaskit/textarea": "^4.5.0",
80
72
  "@atlaskit/textfield": "^5.3.0",
package/report.api.md CHANGED
@@ -1,12 +1,17 @@
1
+ <!-- API Report Version: 2.2 -->
2
+
1
3
  ## API Report File for "@atlaskit/form"
2
4
 
3
- > Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
5
+ > Do not edit this file. This report is auto-generated using [API Extractor](https://api-extractor.com/).
6
+ > [Learn more about API reports](https://hello.atlassian.net/wiki/spaces/UR/pages/1825484529/Package+API+Reports)
7
+
8
+ ### Table of contents
4
9
 
5
- <!--
6
- Generated API Report version: 2.0
7
- -->
10
+ - [Main Entry Types](#main-entry-types)
8
11
 
9
- [Learn more about API reports](https://hello.atlassian.net/wiki/spaces/UR/pages/1825484529/Package+API+Reports)
12
+ ### Main Entry Types
13
+
14
+ <!--SECTION START: Main Entry Types-->
10
15
 
11
16
  ```ts
12
17
  import { FC } from 'react';
@@ -18,7 +23,7 @@ import { default as React_2 } from 'react';
18
23
  import { ReactNode } from 'react';
19
24
 
20
25
  // @public (undocumented)
21
- type Align = 'start' | 'end';
26
+ type Align = 'end' | 'start';
22
27
 
23
28
  // @public
24
29
  export const CheckboxField: FC<CheckboxProps>;
@@ -51,7 +56,7 @@ export const ErrorMessage: React_2.FC<MessageProps>;
51
56
  // @public (undocumented)
52
57
  export function Field<
53
58
  FieldValue = string,
54
- Element extends SupportedElements = HTMLInputElement
59
+ Element extends SupportedElements = HTMLInputElement,
55
60
  >(props: FieldComponentProps<FieldValue, Element>): jsx.JSX.Element;
56
61
 
57
62
  // @public (undocumented)
@@ -63,31 +68,32 @@ interface FieldComponentProps<FieldValue, Element extends SupportedElements> {
63
68
  meta: Meta;
64
69
  }) => ReactNode;
65
70
  defaultValue?:
66
- | FieldValue
67
- | ((currentDefaultValue?: FieldValue) => FieldValue);
71
+ | ((currentDefaultValue?: FieldValue) => FieldValue)
72
+ | FieldValue;
73
+ elementAfterLabel?: ReactNode;
68
74
  id?: string;
69
75
  isDisabled?: boolean;
70
76
  isRequired?: boolean;
71
77
  label?: ReactNode;
72
78
  name: string;
73
79
  transform?: (
74
- event: FormEvent<Element> | FieldValue,
80
+ event: FieldValue | FormEvent<Element>,
75
81
  current: FieldValue,
76
82
  ) => FieldValue;
77
83
  validate?: (
78
84
  value: FieldValue | undefined,
79
85
  formState: Object,
80
86
  fieldState: Meta,
81
- ) => string | void | Promise<string | void>;
87
+ ) => Promise<string | void> | string | void;
82
88
  }
83
89
 
84
90
  // @public (undocumented)
85
91
  export interface FieldProps<
86
92
  FieldValue,
87
- Element extends SupportedElements = HTMLInputElement
93
+ Element extends SupportedElements = HTMLInputElement,
88
94
  > {
89
95
  // (undocumented)
90
- 'aria-invalid': 'true' | 'false';
96
+ 'aria-invalid': 'false' | 'true';
91
97
  // (undocumented)
92
98
  'aria-labelledby': string;
93
99
  // (undocumented)
@@ -103,7 +109,7 @@ export interface FieldProps<
103
109
  // (undocumented)
104
110
  onBlur: () => void;
105
111
  // (undocumented)
106
- onChange: (value: FormEvent<Element> | FieldValue) => void;
112
+ onChange: (value: FieldValue | FormEvent<Element>) => void;
107
113
  // (undocumented)
108
114
  onFocus: () => void;
109
115
  // (undocumented)
@@ -241,7 +247,7 @@ export type OnSubmitHandler<FormData> = (
241
247
  values: FormData,
242
248
  form: FormApi<FormData>,
243
249
  callback?: (errors?: Record<string, string>) => void,
244
- ) => void | Object | Promise<Object | void>;
250
+ ) => Object | Promise<Object | void> | void;
245
251
 
246
252
  // @public
247
253
  export const RangeField: FC<RangeFieldProps>;
@@ -254,7 +260,7 @@ export interface RangeFieldProps {
254
260
  error?: string;
255
261
  meta: Meta;
256
262
  }) => React_2.ReactNode;
257
- defaultValue: number | ((currentDefaultValue?: number) => number);
263
+ defaultValue: ((currentDefaultValue?: number) => number) | number;
258
264
  id?: string;
259
265
  isDisabled?: boolean;
260
266
  label?: ReactNode;
@@ -267,11 +273,13 @@ type RangeProps = Omit<FieldProps<number>, 'isInvalid' | 'isRequired'>;
267
273
  // @public (undocumented)
268
274
  type SupportedElements =
269
275
  | HTMLInputElement
270
- | HTMLTextAreaElement
271
- | HTMLSelectElement;
276
+ | HTMLSelectElement
277
+ | HTMLTextAreaElement;
272
278
 
273
279
  // @public
274
280
  export const ValidMessage: React_2.FC<MessageProps>;
275
281
 
276
282
  // (No @packageDocumentation comment for this package)
277
283
  ```
284
+
285
+ <!--SECTION END: Main Entry Types-->
@@ -1,51 +0,0 @@
1
- import { FC, ReactNode } from 'react';
2
- import { FieldProps, Meta } from './field';
3
- export interface CheckboxFieldProps extends FieldProps<string | undefined> {
4
- isChecked: boolean;
5
- }
6
- export interface CheckboxProps {
7
- /**
8
- * Content to render in the checkbox field. This is a function that is called with information about the field.
9
- */
10
- children: (args: {
11
- fieldProps: CheckboxFieldProps;
12
- error?: string;
13
- valid: boolean;
14
- meta: Meta;
15
- }) => ReactNode;
16
- /**
17
- * Sets the default state of the checkbox as checked.
18
- */
19
- defaultIsChecked?: boolean;
20
- /**
21
- * Sets whether the field is required for submission. Required fields are marked with a red asterisk.
22
- */
23
- isRequired?: boolean;
24
- /**
25
- * 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.
26
- */
27
- isDisabled?: boolean;
28
- /**
29
- * Label displayed beside the checkbox.
30
- */
31
- label?: ReactNode;
32
- /**
33
- * Specifies the name of the field. This is important for referencing the form data.
34
- */
35
- name: string;
36
- /**
37
- * The value of the checkbox. This is the value used in the form state when the checkbox is checked.
38
- */
39
- value?: string;
40
- }
41
- /**
42
- * __Checkbox field__
43
- *
44
- * A checkbox field is a form field that lets users select an item. Users can check or uncheck the checkbox.
45
- *
46
- * - [Examples] https://atlaskit.atlassian.com/packages/design-system/form/docs/fields#checkboxfield-reference
47
- * - [Code] https://atlaskit.atlassian.com/packages/design-system/form/docs/fields#checkboxfield-reference
48
- * - [Usage] https://atlaskit.atlassian.com/packages/design-system/form/docs/fields#checkboxfield-reference
49
- */
50
- declare const CheckboxField: FC<CheckboxProps>;
51
- export default CheckboxField;
@@ -1,2 +0,0 @@
1
- export { default as CheckboxField } from '../checkbox-field';
2
- export type { CheckboxFieldProps } from '../checkbox-field';
@@ -1,2 +0,0 @@
1
- export { default } from '../field';
2
- export type { FieldProps, Meta } from '../field';
@@ -1 +0,0 @@
1
- export { default as Fieldset } from '../fieldset';
@@ -1 +0,0 @@
1
- export { default as FormFooter } from '../form-footer';
@@ -1 +0,0 @@
1
- export { default as FormHeader } from '../form-header';
@@ -1 +0,0 @@
1
- export { default as FormSection } from '../form-section';
@@ -1 +0,0 @@
1
- export { default } from '../form';
@@ -1,2 +0,0 @@
1
- export { default as Label } from '../label';
2
- export type { LabelProps } from '../label';
@@ -1 +0,0 @@
1
- export { HelperMessage, ErrorMessage, ValidMessage } from '../messages';
@@ -1,2 +0,0 @@
1
- export { default as RangeField } from '../range-field';
2
- export type { RangeFieldProps } from '../range-field';
@@ -1,83 +0,0 @@
1
- /** @jsx jsx */
2
- import { FormEvent, ReactNode } from 'react';
3
- import { jsx } from '@emotion/react';
4
- declare type SupportedElements = HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement;
5
- export interface FieldProps<FieldValue, Element extends SupportedElements = HTMLInputElement> {
6
- id: string;
7
- isRequired: boolean;
8
- isDisabled: boolean;
9
- isInvalid: boolean;
10
- onChange: (value: FormEvent<Element> | FieldValue) => void;
11
- onBlur: () => void;
12
- onFocus: () => void;
13
- value: FieldValue;
14
- name: string;
15
- 'aria-invalid': 'true' | 'false';
16
- 'aria-labelledby': string;
17
- }
18
- export interface Meta {
19
- dirty: boolean;
20
- dirtySinceLastSubmit: boolean;
21
- submitFailed: boolean;
22
- submitting: boolean;
23
- touched: boolean;
24
- valid: boolean;
25
- error?: string;
26
- submitError?: boolean;
27
- validating?: boolean;
28
- }
29
- export interface FieldComponentProps<FieldValue, Element extends SupportedElements> {
30
- /**
31
- * 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.
32
- */
33
- children: (args: {
34
- fieldProps: FieldProps<FieldValue, Element>;
35
- error?: string;
36
- valid: boolean;
37
- meta: Meta;
38
- }) => ReactNode;
39
- /**
40
- * Sets the default value of the field. If a function is provided, it is called with the current default value of the field.
41
- */
42
- defaultValue?: FieldValue | ((currentDefaultValue?: FieldValue) => FieldValue);
43
- /**
44
- * Passed to the ID attribute of the field. This is randomly generated if it is not specified.
45
- */
46
- id?: string;
47
- /**
48
- * Sets whether the field is required for submission. Required fields are marked with a red asterisk.
49
- */
50
- isRequired?: boolean;
51
- /**
52
- * 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.
53
- */
54
- isDisabled?: boolean;
55
- /**
56
- * Label displayed above the form field.
57
- */
58
- label?: ReactNode;
59
- /**
60
- * Element displayed after the label, and after the red asterisk if field is required.
61
- */
62
- elementAfterLabel?: ReactNode;
63
- /**
64
- * Specifies the name of the field. This is important for referencing the form data.
65
- */
66
- name: string;
67
- /**
68
- * Access the current field value and transform it to return a different field value.
69
- */
70
- transform?: (event: FormEvent<Element> | FieldValue, current: FieldValue) => FieldValue;
71
- /**
72
- * 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`.
73
- */
74
- validate?: (value: FieldValue | undefined, formState: Object, fieldState: Meta) => string | void | Promise<string | void>;
75
- }
76
- /**
77
- * __Field id__
78
- *
79
- * A field id uses the context API. It provides the id of the field to message components. This links the message with the field of screenreaders.
80
- */
81
- export declare const FieldId: import("react").Context<string | undefined>;
82
- export default function Field<FieldValue = string, Element extends SupportedElements = HTMLInputElement>(props: FieldComponentProps<FieldValue, Element>): jsx.JSX.Element;
83
- export {};
@@ -1,25 +0,0 @@
1
- /** @jsx jsx */
2
- import { ReactNode } from 'react';
3
- import { jsx } from '@emotion/react';
4
- export interface FieldsetProps {
5
- /**
6
- * Content to render in the fieldset.
7
- */
8
- children: ReactNode;
9
- /**
10
- * Label describing the contents of the fieldset.
11
- */
12
- legend?: ReactNode;
13
- }
14
- /**
15
- * __Fieldset__
16
- *
17
- * A fieldset groups a number of fields together. For example, when multiple CheckboxFields share the same name,
18
- * a fieldset can be used to group them together. This makes the form more accessible.
19
- *
20
- * - [Examples](https://atlaskit.atlassian.com/packages/design-system/form/docs/fields)
21
- * - [Code](https://atlaskit.atlassian.com/packages/design-system/form/docs/fields)
22
- * - [Usage](https://atlaskit.atlassian.com/packages/design-system/form/docs/fields)
23
- */
24
- declare const Fieldset: ({ children, legend }: FieldsetProps) => jsx.JSX.Element;
25
- export default Fieldset;
@@ -1,24 +0,0 @@
1
- /** @jsx jsx */
2
- import { ReactNode } from 'react';
3
- import { jsx } from '@emotion/react';
4
- import { Align } from './types';
5
- export interface FormFooterProps {
6
- /**
7
- * Content to render in the footer of the form.
8
- */
9
- children?: ReactNode;
10
- /**
11
- * 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.
12
- */
13
- align?: Align;
14
- }
15
- /**
16
- * __Form footer__
17
- *
18
- * A form footer has the content to be shown at the bottom of the form. This is usually the submit button.
19
- *
20
- * - [Examples](https://atlaskit.atlassian.com/packages/design-system/form/docs/layout)
21
- * - [Code](https://atlaskit.atlassian.com/packages/design-system/form/docs/layout)
22
- * - [Usage](https://atlaskit.atlassian.com/packages/design-system/form/docs/layout)
23
- */
24
- export default function FormFooter({ align, children, }: FormFooterProps): jsx.JSX.Element;
@@ -1,32 +0,0 @@
1
- /** @jsx jsx */
2
- import { ReactNode } from 'react';
3
- export interface FormHeaderProps {
4
- /**
5
- * Title of the form. This is a header.
6
- */
7
- title?: ReactNode;
8
- /**
9
- * Description or subtitle of the form.
10
- */
11
- description?: ReactNode;
12
- /**
13
- * Child content to render in the form below the title and description.
14
- */
15
- children?: ReactNode;
16
- }
17
- declare const FormHeaderContent: React.FC;
18
- declare const FormHeaderDescription: React.FC;
19
- declare const FormHeaderTitle: React.FC;
20
- /**
21
- * __Form header__
22
- *
23
- * A form header contains the form component's heading and subheadings. This provides the correct padding
24
- * and styling for it.
25
- *
26
- * - [Examples](https://atlaskit.atlassian.com/packages/design-system/form/docs/layout)
27
- * - [Code](https://atlaskit.atlassian.com/packages/design-system/form/docs/layout)
28
- * - [Usage](https://atlaskit.atlassian.com/packages/design-system/form/docs/layout)
29
- */
30
- declare const FormHeader: React.FC<FormHeaderProps>;
31
- export default FormHeader;
32
- export { FormHeaderContent, FormHeaderDescription, FormHeaderTitle };
@@ -1,28 +0,0 @@
1
- /** @jsx jsx */
2
- import React, { ReactNode } from 'react';
3
- export interface FormSectionProps {
4
- /**
5
- * Title of the form section.
6
- */
7
- title?: ReactNode;
8
- /**
9
- * Content or components to render after the description.
10
- */
11
- children?: ReactNode;
12
- /**
13
- * Description of the contents of the section.
14
- */
15
- description?: ReactNode;
16
- }
17
- /**
18
- * __Form section__
19
- *
20
- * A form section is used to define a section of a form layout. This contains a section title, content
21
- * and a description of the section.
22
- *
23
- * - [Examples](https://atlaskit.atlassian.com/packages/design-system/form/docs/layout)
24
- * - [Code](https://atlaskit.atlassian.com/packages/design-system/form/docs/layout)
25
- * - [Usage](https://atlaskit.atlassian.com/packages/design-system/form/docs/layout)
26
- */
27
- declare const FormSection: React.FC<FormSectionProps>;
28
- export default FormSection;
@@ -1,51 +0,0 @@
1
- import React, { ReactNode } from 'react';
2
- import { FieldConfig, FieldSubscriber, FieldSubscription, FormState, Unsubscribe } from 'final-form';
3
- import { OnSubmitHandler } from './types';
4
- declare type DefaultValue<FieldValue> = (value?: FieldValue) => FieldValue;
5
- declare type RegisterField = <FieldValue>(name: string, defaultValue: FieldValue | DefaultValue<FieldValue>, subscriber: FieldSubscriber<FieldValue>, subscription: FieldSubscription, config: FieldConfig<FieldValue>) => Unsubscribe;
6
- /**
7
- * __Form context__
8
- *
9
- * A form context creates a context for the field values and allows them to be accessed by the children.
10
- */
11
- export declare const FormContext: React.Context<RegisterField>;
12
- /**
13
- * __Is disabled context__
14
- *
15
- * An is disabled context creates the context for when a value is disabled.
16
- */
17
- export declare const IsDisabledContext: React.Context<boolean>;
18
- interface FormChildrenProps {
19
- ref: React.RefObject<HTMLFormElement>;
20
- onSubmit: (event?: React.FormEvent<HTMLFormElement> | React.SyntheticEvent<HTMLElement>) => void;
21
- onKeyDown: (event: React.KeyboardEvent<HTMLElement>) => void;
22
- }
23
- export interface FormProps<FormValues> {
24
- /**
25
- * 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`.
26
- * You can read more about these props in [react-final form documentation](https://final-form.org/docs/final-form/types/FormState).
27
- */
28
- children: (args: {
29
- formProps: FormChildrenProps;
30
- disabled: boolean;
31
- dirty: boolean;
32
- submitting: boolean;
33
- getState: () => FormState<FormValues>;
34
- /**
35
- * @deprecated
36
- */
37
- getValues: () => FormValues;
38
- setFieldValue: (name: string, value: any) => void;
39
- reset: (initialValues?: FormValues) => void;
40
- }) => ReactNode;
41
- /**
42
- * Event handler called when the form is submitted. Fields must be free of validation errors.
43
- */
44
- onSubmit: OnSubmitHandler<FormValues>;
45
- /**
46
- * Sets the form and its fields as disabled. Users cannot edit or focus on the fields.
47
- */
48
- isDisabled?: boolean;
49
- }
50
- export default function Form<FormValues extends Record<string, any> = {}>(props: FormProps<FormValues>): JSX.Element;
51
- export {};
@@ -1,16 +0,0 @@
1
- export { default } from './form';
2
- export type { FormProps } from './form';
3
- export { default as FormHeader } from './form-header';
4
- export { default as FormFooter } from './form-footer';
5
- export { default as FormSection } from './form-section';
6
- export { default as Field } from './field';
7
- export type { FieldProps } from './field';
8
- export { default as CheckboxField } from './checkbox-field';
9
- export type { CheckboxFieldProps } from './checkbox-field';
10
- export { default as RangeField } from './range-field';
11
- export type { RangeFieldProps } from './range-field';
12
- export { default as Label } from './label';
13
- export type { LabelProps } from './label';
14
- export { HelperMessage, ErrorMessage, ValidMessage } from './messages';
15
- export { default as Fieldset } from './fieldset';
16
- export type { OnSubmitHandler, FormApi } from './types';
@@ -1,16 +0,0 @@
1
- /** @jsx jsx */
2
- import { FC } from 'react';
3
- export interface LabelProps {
4
- id?: string;
5
- htmlFor: string;
6
- }
7
- /**
8
- * __Label__
9
- *
10
- * A label represents a caption for an item in a user interface.
11
- *
12
- * It's recommended that a label has a `4px` spacing above its associated
13
- * control element.
14
- */
15
- declare const Label: FC<LabelProps>;
16
- export default Label;
@@ -1,48 +0,0 @@
1
- /** @jsx jsx */
2
- import React, { ReactNode } from 'react';
3
- interface MessageProps {
4
- /**
5
- * The content of the message
6
- */
7
- children: ReactNode;
8
- /**
9
- * A testId prop is provided for specified elements, which is a unique string
10
- * that appears as a data attribute data-testid in the rendered code,
11
- * serving as a hook for automated tests
12
- */
13
- testId?: string;
14
- /**
15
- * Checks whether message input is invalid and should show an error.
16
- */
17
- error?: boolean;
18
- /**
19
- * Checks whether message input is valid.
20
- */
21
- valid?: boolean;
22
- fieldId?: string;
23
- }
24
- /**
25
- * __Helper message__
26
- *
27
- * A helper message tells the user what kind of input the field takes. For example, a helper message could be
28
- * 'Password should be more than 4 characters'
29
- *
30
- */
31
- export declare const HelperMessage: React.FC<MessageProps>;
32
- /**
33
- * __Error message__
34
- *
35
- * An error message is used to tell a user that the field input is invalid. For example, an error message could be
36
- * 'Invalid username, needs to be more than 4 characters'.
37
- *
38
- */
39
- export declare const ErrorMessage: React.FC<MessageProps>;
40
- /**
41
- * __Valid message__
42
- *
43
- * A valid message is used to tell a user that the field input is valid. For example,
44
- * a helper message could be 'Nice one, this username is available'.
45
- *
46
- */
47
- export declare const ValidMessage: React.FC<MessageProps>;
48
- export {};
@@ -1,41 +0,0 @@
1
- import React, { FC, ReactNode } from 'react';
2
- import { FieldProps, Meta } from './field';
3
- declare type RangeProps = Omit<FieldProps<number>, 'isInvalid' | 'isRequired'>;
4
- export interface RangeFieldProps {
5
- children: (args: {
6
- fieldProps: RangeProps;
7
- error?: string;
8
- meta: Meta;
9
- }) => React.ReactNode;
10
- /**
11
- * Specifies the name of the field. This is important for referencing the form data.
12
- */
13
- name: string;
14
- /**
15
- * Sets the default value of the field. If a function is provided, it is called with the current default value of the field.
16
- */
17
- defaultValue: number | ((currentDefaultValue?: number) => number);
18
- /**
19
- * Value passed to the `id` attribute of the field. This is randomly generated if it is not specified.
20
- */
21
- id?: string;
22
- /**
23
- * 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.
24
- */
25
- isDisabled?: boolean;
26
- /**
27
- * Displays a label above the range field and identifies the form fields.
28
- */
29
- label?: ReactNode;
30
- }
31
- /**
32
- * __Range field__
33
- *
34
- * A range field is where a user can submit a range input as a part of a form.
35
- *
36
- * - [Examples](https://atlaskit.atlassian.com/packages/design-system/form/docs/fields#rangefield-reference)
37
- * - [Code](https://atlaskit.atlassian.com/packages/design-system/form/docs/fields#rangefield-reference)
38
- * - [Usage](https://atlaskit.atlassian.com/packages/design-system/form/docs/fields#rangefield-reference)
39
- */
40
- declare const RangeField: FC<RangeFieldProps>;
41
- export default RangeField;
@@ -1,4 +0,0 @@
1
- import { FormApi as FinalFormAPI } from 'final-form';
2
- export declare type Align = 'start' | 'end';
3
- export declare type FormApi<FormData> = FinalFormAPI<FormData>;
4
- export declare type OnSubmitHandler<FormData> = (values: FormData, form: FormApi<FormData>, callback?: (errors?: Record<string, string>) => void) => void | Object | Promise<Object | void>;