@atlaskit/form 8.8.2 → 8.8.4

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 (50) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/dist/cjs/checkbox-field.js +15 -29
  3. package/dist/cjs/entry-points/checkbox-field.js +0 -2
  4. package/dist/cjs/entry-points/field.js +0 -2
  5. package/dist/cjs/entry-points/fieldset.js +0 -2
  6. package/dist/cjs/entry-points/form-footer.js +0 -2
  7. package/dist/cjs/entry-points/form-header.js +0 -2
  8. package/dist/cjs/entry-points/form-section.js +0 -2
  9. package/dist/cjs/entry-points/form.js +0 -2
  10. package/dist/cjs/entry-points/label.js +0 -2
  11. package/dist/cjs/entry-points/messages.js +0 -1
  12. package/dist/cjs/entry-points/range-field.js +0 -2
  13. package/dist/cjs/field.js +49 -85
  14. package/dist/cjs/fieldset.js +27 -23
  15. package/dist/cjs/form-footer.js +4 -6
  16. package/dist/cjs/form-header.js +9 -23
  17. package/dist/cjs/form-section.js +9 -21
  18. package/dist/cjs/form.js +40 -63
  19. package/dist/cjs/index.js +0 -11
  20. package/dist/cjs/label.js +29 -23
  21. package/dist/cjs/messages.js +54 -55
  22. package/dist/cjs/range-field.js +8 -19
  23. package/dist/cjs/version.json +1 -1
  24. package/dist/es2019/checkbox-field.js +6 -5
  25. package/dist/es2019/field.js +16 -31
  26. package/dist/es2019/fieldset.js +21 -12
  27. package/dist/es2019/form-footer.js +2 -1
  28. package/dist/es2019/form-header.js +6 -10
  29. package/dist/es2019/form-section.js +5 -9
  30. package/dist/es2019/form.js +4 -11
  31. package/dist/es2019/index.js +2 -1
  32. package/dist/es2019/label.js +22 -11
  33. package/dist/es2019/messages.js +47 -31
  34. package/dist/es2019/range-field.js +2 -4
  35. package/dist/es2019/version.json +1 -1
  36. package/dist/esm/checkbox-field.js +15 -22
  37. package/dist/esm/field.js +49 -73
  38. package/dist/esm/fieldset.js +27 -18
  39. package/dist/esm/form-footer.js +4 -3
  40. package/dist/esm/form-header.js +9 -15
  41. package/dist/esm/form-section.js +8 -14
  42. package/dist/esm/form.js +40 -53
  43. package/dist/esm/index.js +2 -1
  44. package/dist/esm/label.js +29 -18
  45. package/dist/esm/messages.js +53 -38
  46. package/dist/esm/range-field.js +8 -15
  47. package/dist/esm/version.json +1 -1
  48. package/dist/types/messages.d.ts +11 -7
  49. package/package.json +5 -4
  50. package/report.api.md +27 -9
package/dist/esm/field.js CHANGED
@@ -1,11 +1,8 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
3
  import _typeof from "@babel/runtime/helpers/typeof";
4
-
5
4
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
6
-
7
5
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
8
-
9
6
  /** @jsx jsx */
10
7
  import { createContext, useContext, useEffect, useMemo, useRef, useState } from 'react';
11
8
  import { css, jsx } from '@emotion/react';
@@ -25,114 +22,101 @@ var requiredIndicatorStyles = css({
25
22
  color: "var(--ds-text-danger, ".concat(R400, ")"),
26
23
  fontFamily: fontFamily
27
24
  });
28
-
29
25
  function isEvent(event) {
30
26
  return Boolean(event && event.target);
31
27
  }
32
-
33
28
  function isFunction(x) {
34
29
  return typeof x === 'function';
35
30
  }
36
-
37
31
  /**
38
32
  * __Field id__
39
33
  *
40
34
  * 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.
41
35
  */
42
36
  export var FieldId = /*#__PURE__*/createContext(undefined);
43
-
44
37
  function usePreviousRef(current) {
45
- var ref = useRef(current); // will be updated on the next render
38
+ var ref = useRef(current);
46
39
 
40
+ // will be updated on the next render
47
41
  useEffect(function () {
48
42
  ref.current = current;
49
- }); // return the existing current (pre render)
43
+ });
50
44
 
45
+ // return the existing current (pre render)
51
46
  return ref;
52
47
  }
53
-
54
48
  function isShallowEqual(previousValue, currentValue) {
55
49
  if (previousValue === currentValue) {
56
50
  return true;
57
- } // not checking functions
58
-
51
+ }
59
52
 
53
+ // not checking functions
60
54
  if (typeof previousValue === 'function' && typeof currentValue === 'function') {
61
55
  return true;
62
56
  }
63
-
64
57
  if (Array.isArray(previousValue) && Array.isArray(currentValue)) {
65
58
  return JSON.stringify(previousValue) === JSON.stringify(currentValue);
66
59
  }
67
-
68
60
  if (_typeof(previousValue) === 'object' && _typeof(currentValue) === 'object') {
69
61
  return JSON.stringify(previousValue) === JSON.stringify(currentValue);
70
62
  }
71
-
72
63
  return false;
73
64
  }
74
-
75
65
  export default function Field(props) {
76
66
  var _getCurrentValue;
77
-
78
67
  var _useContext = useContext(FormContext),
79
- registerField = _useContext.registerField,
80
- getCurrentValue = _useContext.getCurrentValue;
81
-
68
+ registerField = _useContext.registerField,
69
+ getCurrentValue = _useContext.getCurrentValue;
82
70
  var isDisabled = useContext(IsDisabledContext) || props.isDisabled || false;
83
71
  var defaultValue = isFunction(props.defaultValue) ? props.defaultValue() : props.defaultValue;
84
72
  var latestPropsRef = usePreviousRef(props);
73
+
85
74
  /**
86
75
  * HACK: defaultValue can potentially be an array or object which cannot be
87
76
  * passed directly into a `useEffect` dependency array, since it will trigger
88
77
  * the hook every time.
89
78
  */
90
-
91
79
  var isDefaultValueChanged = !isShallowEqual(latestPropsRef.current.defaultValue, props.defaultValue);
92
-
93
80
  var _useState = useState({
94
- fieldProps: {
95
- onChange: function onChange() {},
96
- onBlur: function onBlur() {},
97
- onFocus: function onFocus() {},
98
-
99
- /* Previously, defaultValue was being set as undefined in Field.defaultProps, which
100
- * effectively made it an optional prop to external consumers of Field. However the
101
- * prop types defined defaultValue as required, so inside the component it was not
102
- * valid for defaultValue to be undefined. We need to suppress the error
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.
108
- */
109
- // @ts-ignore
110
- value: isDefaultValueChanged ? defaultValue : (_getCurrentValue = getCurrentValue(props.name)) !== null && _getCurrentValue !== void 0 ? _getCurrentValue : defaultValue
111
- },
112
- error: undefined,
113
- valid: false,
114
- meta: {
115
- dirty: false,
116
- dirtySinceLastSubmit: false,
117
- touched: false,
118
- valid: false,
119
- validating: false,
120
- submitting: false,
121
- submitFailed: false,
81
+ fieldProps: {
82
+ onChange: function onChange() {},
83
+ onBlur: function onBlur() {},
84
+ onFocus: function onFocus() {},
85
+ /* Previously, defaultValue was being set as undefined in Field.defaultProps, which
86
+ * effectively made it an optional prop to external consumers of Field. However the
87
+ * prop types defined defaultValue as required, so inside the component it was not
88
+ * valid for defaultValue to be undefined. We need to suppress the error
89
+ * after changing defaultValue to explictly be an optional prop.
90
+ * If default value has changed we are using new default value.
91
+ * Otherwise we need to check if we already have value for this field
92
+ * (because we are using changing key prop to re-run field level validation, and that
93
+ * cause the component re-mounting) to not override the actual value with the default value.
94
+ */
95
+ // @ts-ignore
96
+ value: isDefaultValueChanged ? defaultValue : (_getCurrentValue = getCurrentValue(props.name)) !== null && _getCurrentValue !== void 0 ? _getCurrentValue : defaultValue
97
+ },
122
98
  error: undefined,
123
- submitError: undefined
124
- }
125
- }),
126
- _useState2 = _slicedToArray(_useState, 2),
127
- state = _useState2[0],
128
- setState = _useState2[1];
129
-
99
+ valid: false,
100
+ meta: {
101
+ dirty: false,
102
+ dirtySinceLastSubmit: false,
103
+ touched: false,
104
+ valid: false,
105
+ validating: false,
106
+ submitting: false,
107
+ submitFailed: false,
108
+ error: undefined,
109
+ submitError: undefined
110
+ }
111
+ }),
112
+ _useState2 = _slicedToArray(_useState, 2),
113
+ state = _useState2[0],
114
+ setState = _useState2[1];
130
115
  var latestStateRef = usePreviousRef(state);
131
116
  useEffect(function () {
132
117
  if (process.env.NODE_ENV !== 'production' && !process.env.CI) {
133
118
  invariant(latestPropsRef.current.name, '@atlaskit/form: Field components have a required name prop');
134
119
  }
135
-
136
120
  function fieldStateToMeta() {
137
121
  var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
138
122
  return {
@@ -147,7 +131,6 @@ export default function Field(props) {
147
131
  validating: !!value.validating
148
132
  };
149
133
  }
150
-
151
134
  var unregister = registerField(latestPropsRef.current.name,
152
135
  /**
153
136
  * Similar as for setting initial state value.
@@ -158,45 +141,42 @@ export default function Field(props) {
158
141
  * the key prop to re-run validation.
159
142
  */
160
143
  // @ts-ignore
161
- isDefaultValueChanged || // @ts-ignore
144
+ isDefaultValueChanged ||
145
+ // @ts-ignore
162
146
  isFunction(latestPropsRef.current.defaultValue) ? latestPropsRef.current.defaultValue : latestStateRef.current.fieldProps.value, function (fieldState) {
163
147
  /**
164
148
  * Do not update dirtySinceLastSubmit until submission has finished.
165
149
  */
166
150
  var modifiedDirtySinceLastSubmit = fieldState.submitting ? latestStateRef.current.meta.dirtySinceLastSubmit : fieldState.dirtySinceLastSubmit;
151
+
167
152
  /**
168
153
  * Do not update submitFailed until submission has finished.
169
154
  */
170
-
171
155
  var modifiedSubmitFailed = fieldState.submitting ? latestStateRef.current.meta.submitFailed : fieldState.submitFailed;
156
+
172
157
  /**
173
158
  * Do not use submitError if the value has changed.
174
159
  */
175
-
176
160
  var modifiedSubmitError = modifiedDirtySinceLastSubmit && latestPropsRef.current.validate ? undefined : fieldState.submitError;
177
161
  var modifiedError = modifiedSubmitError || (fieldState.touched || fieldState.dirty) && fieldState.error;
162
+
178
163
  /**
179
164
  * If there has been a submit error, then use logic in modifiedError to determine validity,
180
165
  * so we can determine when there is a submit error which we do not want to display
181
166
  * because the value has been changed.
182
167
  */
183
-
184
168
  var modifiedValid = modifiedSubmitFailed ? modifiedError === undefined : fieldState.valid;
185
-
186
169
  function getTransform(eventOrValue, currentValue) {
187
170
  if (latestPropsRef.current.transform) {
188
171
  return latestPropsRef.current.transform(eventOrValue, currentValue);
189
172
  }
190
-
191
173
  if (isEvent(eventOrValue)) {
192
174
  var currentTarget = eventOrValue.currentTarget;
193
-
194
175
  if (currentTarget.type === 'checkbox') {
195
176
  //@ts-expect-error TODO Fix legit TypeScript 3.9.6 improved inference error
196
177
  if (currentTarget.checked) {
197
178
  return currentTarget.value || true;
198
179
  }
199
-
200
180
  return currentTarget.value ? undefined : false;
201
181
  } else if (currentTarget) {
202
182
  return currentTarget.value;
@@ -205,7 +185,6 @@ export default function Field(props) {
205
185
  return eventOrValue;
206
186
  }
207
187
  }
208
-
209
188
  setState({
210
189
  fieldProps: {
211
190
  onChange: function onChange(e) {
@@ -216,7 +195,6 @@ export default function Field(props) {
216
195
  value: fieldState.value
217
196
  },
218
197
  error: modifiedError || undefined,
219
-
220
198
  /**
221
199
  * The following parameters are optionally typed in final-form to indicate that not all parameters need
222
200
  * to be subscribed to. We cast them as booleans (using || false), since this is what they are semantically.
@@ -239,7 +217,6 @@ export default function Field(props) {
239
217
  getValidator: function getValidator() {
240
218
  return function validate(value, formState, fieldState) {
241
219
  var supplied = latestPropsRef.current.validate;
242
-
243
220
  if (supplied && fieldState) {
244
221
  return supplied(value, formState, fieldStateToMeta(fieldState));
245
222
  }
@@ -248,13 +225,13 @@ export default function Field(props) {
248
225
  });
249
226
  return unregister;
250
227
  }, [latestPropsRef, latestStateRef, registerField, props.name, isDefaultValueChanged]);
251
- var fieldId = useMemo( // eslint-disable-next-line @repo/internal/react/disallow-unstable-values
228
+ var fieldId = useMemo(
229
+ // eslint-disable-next-line @repo/internal/react/disallow-unstable-values
252
230
  function () {
253
231
  return props.id ? props.id : "".concat(props.name, "-").concat(uid({
254
232
  id: props.name
255
233
  }));
256
234
  }, [props.id, props.name]);
257
-
258
235
  var extendedFieldProps = _objectSpread(_objectSpread({}, state.fieldProps), {}, {
259
236
  name: props.name,
260
237
  isDisabled: isDisabled,
@@ -264,7 +241,6 @@ export default function Field(props) {
264
241
  'aria-labelledby': "".concat(fieldId, "-label ").concat(fieldId, "-helper ").concat(fieldId, "-valid ").concat(fieldId, "-error"),
265
242
  id: fieldId
266
243
  });
267
-
268
244
  return jsx("div", {
269
245
  css: fieldWrapperStyles
270
246
  }, props.label && jsx(Label, {
@@ -1,5 +1,7 @@
1
1
  /** @jsx jsx */
2
+
2
3
  import { css, jsx } from '@emotion/react';
4
+ import { subtleHeading } from '@atlaskit/theme/colors';
3
5
  import { useGlobalTheme } from '@atlaskit/theme/components';
4
6
  import { fontFamily as getFontFamily, gridSize as getGridSize } from '@atlaskit/theme/constants';
5
7
  import { h200 } from '@atlaskit/theme/typography';
@@ -13,30 +15,40 @@ var fieldsetLabelStyles = css({
13
15
  });
14
16
  var fieldSetStyles = css({
15
17
  marginTop: "".concat(gridSize, "px")
16
- }); // eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
18
+ });
17
19
 
18
- var lightH200Styles = css(h200({
19
- theme: {
20
- mode: 'light'
21
- }
22
- })); // eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
20
+ /**
21
+ * TODO: Address duplication with packages/design-system/form/src/label.tsx
22
+ * in https://product-fabric.atlassian.net/browse/DSP-7731
23
+ */
24
+ var getFieldsetLabelDynamicStyles = function getFieldsetLabelDynamicStyles(mode) {
25
+ return css([h200({
26
+ theme: {
27
+ mode: mode
28
+ }
29
+ }), {
30
+ color: "var(--ds-text-subtle, ".concat(subtleHeading({
31
+ theme: {
32
+ mode: mode
33
+ }
34
+ }), ")")
35
+ }]);
36
+ };
23
37
 
24
- var darkH200Styles = css(h200({
25
- theme: {
26
- mode: 'dark'
27
- }
28
- }));
38
+ // eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
39
+ var lightH200Styles = getFieldsetLabelDynamicStyles('light');
29
40
 
41
+ // eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
42
+ var darkH200Styles = getFieldsetLabelDynamicStyles('dark');
30
43
  var FieldsetLabel = function FieldsetLabel(_ref) {
31
44
  var children = _ref.children;
32
-
33
45
  var _useGlobalTheme = useGlobalTheme(),
34
- mode = _useGlobalTheme.mode;
35
-
46
+ mode = _useGlobalTheme.mode;
36
47
  return jsx("label", {
37
48
  css: [mode === 'light' ? lightH200Styles : darkH200Styles, fieldsetLabelStyles]
38
49
  }, children);
39
50
  };
51
+
40
52
  /**
41
53
  * __Fieldset__
42
54
  *
@@ -47,14 +59,11 @@ var FieldsetLabel = function FieldsetLabel(_ref) {
47
59
  * - [Code](https://atlaskit.atlassian.com/packages/design-system/form/docs/fields)
48
60
  * - [Usage](https://atlaskit.atlassian.com/packages/design-system/form/docs/fields)
49
61
  */
50
-
51
-
52
62
  var Fieldset = function Fieldset(_ref2) {
53
63
  var children = _ref2.children,
54
- legend = _ref2.legend;
64
+ legend = _ref2.legend;
55
65
  return jsx("fieldset", {
56
66
  css: fieldSetStyles
57
67
  }, legend && jsx("legend", null, jsx(FieldsetLabel, null, legend)), children);
58
68
  };
59
-
60
69
  export default Fieldset;
@@ -1,4 +1,5 @@
1
1
  /** @jsx jsx */
2
+
2
3
  import { css, jsx } from '@emotion/react';
3
4
  import { gridSize as getGridSize } from '@atlaskit/theme/constants';
4
5
  var gridSize = getGridSize();
@@ -10,6 +11,7 @@ var formFooterWrapperStyles = css({
10
11
  var justifyContentStyles = css({
11
12
  justifyContent: 'flex-start'
12
13
  });
14
+
13
15
  /**
14
16
  * __Form footer__
15
17
  *
@@ -19,11 +21,10 @@ var justifyContentStyles = css({
19
21
  * - [Code](https://atlaskit.atlassian.com/packages/design-system/form/docs/layout)
20
22
  * - [Usage](https://atlaskit.atlassian.com/packages/design-system/form/docs/layout)
21
23
  */
22
-
23
24
  export default function FormFooter(_ref) {
24
25
  var _ref$align = _ref.align,
25
- align = _ref$align === void 0 ? 'end' : _ref$align,
26
- children = _ref.children;
26
+ align = _ref$align === void 0 ? 'end' : _ref$align,
27
+ children = _ref.children;
27
28
  return jsx("footer", {
28
29
  css: [formFooterWrapperStyles, align === 'start' && justifyContentStyles]
29
30
  }, children);
@@ -1,4 +1,5 @@
1
1
  /** @jsx jsx */
2
+
2
3
  import { css, jsx } from '@emotion/react';
3
4
  import { useGlobalTheme } from '@atlaskit/theme/components';
4
5
  import { fontFamily as getFontFamily, gridSize as getGridSize } from '@atlaskit/theme/constants';
@@ -22,51 +23,47 @@ var formHeaderTitleStyles = css({
22
23
  });
23
24
  var formHeaderWrapperStyles = css({
24
25
  fontFamily: "".concat(fontFamily)
25
- }); // eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
26
+ });
26
27
 
28
+ // eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
27
29
  var darkH700Styles = css(h700({
28
30
  theme: {
29
31
  mode: 'dark'
30
32
  }
31
- })); // eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
32
-
33
+ }));
34
+ // eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
33
35
  var lightH700Styles = css(h700({
34
36
  theme: {
35
37
  mode: 'light'
36
38
  }
37
39
  }));
38
-
39
40
  var FormHeaderContent = function FormHeaderContent(_ref) {
40
41
  var children = _ref.children;
41
42
  return jsx("div", {
42
43
  css: formHeaderContentStyles
43
44
  }, children);
44
45
  };
45
-
46
46
  var FormHeaderDescription = function FormHeaderDescription(_ref2) {
47
47
  var children = _ref2.children;
48
48
  return jsx("div", {
49
49
  css: formHeaderDescriptionStyles
50
50
  }, children);
51
51
  };
52
-
53
52
  var FormHeaderTitle = function FormHeaderTitle(_ref3) {
54
53
  var children = _ref3.children;
55
-
56
54
  var _useGlobalTheme = useGlobalTheme(),
57
- mode = _useGlobalTheme.mode;
58
-
55
+ mode = _useGlobalTheme.mode;
59
56
  return jsx("h2", {
60
57
  css: [mode === 'light' ? lightH700Styles : darkH700Styles, formHeaderTitleStyles]
61
58
  }, children);
62
59
  };
63
-
64
60
  var FormHeaderWrapper = function FormHeaderWrapper(_ref4) {
65
61
  var children = _ref4.children;
66
62
  return jsx("div", {
67
63
  css: formHeaderWrapperStyles
68
64
  }, children);
69
65
  };
66
+
70
67
  /**
71
68
  * __Form header__
72
69
  *
@@ -77,14 +74,11 @@ var FormHeaderWrapper = function FormHeaderWrapper(_ref4) {
77
74
  * - [Code](https://atlaskit.atlassian.com/packages/design-system/form/docs/layout)
78
75
  * - [Usage](https://atlaskit.atlassian.com/packages/design-system/form/docs/layout)
79
76
  */
80
-
81
-
82
77
  var FormHeader = function FormHeader(_ref5) {
83
78
  var children = _ref5.children,
84
- description = _ref5.description,
85
- title = _ref5.title;
79
+ description = _ref5.description,
80
+ title = _ref5.title;
86
81
  return jsx(FormHeaderWrapper, null, title && jsx(FormHeaderTitle, null, title), description && jsx(FormHeaderDescription, null, description), children && jsx(FormHeaderContent, null, children));
87
82
  };
88
-
89
83
  export default FormHeader;
90
84
  export { FormHeaderContent, FormHeaderDescription, FormHeaderTitle };
@@ -18,44 +18,41 @@ var formSectionTitleStyles = css({
18
18
  });
19
19
  var formSectionWrapperStyles = css({
20
20
  marginTop: "".concat(gridSize * 3, "px")
21
- }); // eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
21
+ });
22
22
 
23
+ // eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
23
24
  var lightH600Styles = css(h600({
24
25
  theme: {
25
26
  mode: 'light'
26
27
  }
27
- })); // eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
28
-
28
+ }));
29
+ // eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
29
30
  var darkH600Styles = css(h600({
30
31
  theme: {
31
32
  mode: 'dark'
32
33
  }
33
34
  }));
34
-
35
35
  var FormSectionWrapper = function FormSectionWrapper(_ref) {
36
36
  var children = _ref.children;
37
37
  return jsx("div", {
38
38
  css: formSectionWrapperStyles
39
39
  }, children);
40
40
  };
41
-
42
41
  var FormSectionTitle = function FormSectionTitle(_ref2) {
43
42
  var children = _ref2.children;
44
-
45
43
  var _useGlobalTheme = useGlobalTheme(),
46
- mode = _useGlobalTheme.mode;
47
-
44
+ mode = _useGlobalTheme.mode;
48
45
  return jsx("h3", {
49
46
  css: [formSectionTitleStyles, mode === 'light' ? lightH600Styles : darkH600Styles]
50
47
  }, children);
51
48
  };
52
-
53
49
  var FormSectionDescription = function FormSectionDescription(_ref3) {
54
50
  var children = _ref3.children;
55
51
  return jsx("div", {
56
52
  css: formSectionDescriptionStyles
57
53
  }, children);
58
54
  };
55
+
59
56
  /**
60
57
  * __Form section__
61
58
  *
@@ -66,13 +63,10 @@ var FormSectionDescription = function FormSectionDescription(_ref3) {
66
63
  * - [Code](https://atlaskit.atlassian.com/packages/design-system/form/docs/layout)
67
64
  * - [Usage](https://atlaskit.atlassian.com/packages/design-system/form/docs/layout)
68
65
  */
69
-
70
-
71
66
  var FormSection = function FormSection(_ref4) {
72
67
  var children = _ref4.children,
73
- description = _ref4.description,
74
- title = _ref4.title;
68
+ description = _ref4.description,
69
+ title = _ref4.title;
75
70
  return jsx(FormSectionWrapper, null, title && jsx(FormSectionTitle, null, title), description && jsx(FormSectionDescription, null, description), children);
76
71
  };
77
-
78
72
  export default FormSection;