@atlaskit/form 8.8.6 → 8.8.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 CHANGED
@@ -1,5 +1,17 @@
1
1
  # @atlaskit/form
2
2
 
3
+ ## 8.8.8
4
+
5
+ ### Patch Changes
6
+
7
+ - [`e0460d5d989`](https://bitbucket.org/atlassian/atlassian-frontend/commits/e0460d5d989) - Usages of `process` are now guarded by a `typeof` check.
8
+
9
+ ## 8.8.7
10
+
11
+ ### Patch Changes
12
+
13
+ - [`1c6c493447f`](https://bitbucket.org/atlassian/atlassian-frontend/commits/1c6c493447f) - [ux] Place label and message fields in correct aria attributes.
14
+
3
15
  ## 8.8.6
4
16
 
5
17
  ### Patch Changes
package/dist/cjs/field.js CHANGED
@@ -18,7 +18,7 @@ var _constants = require("@atlaskit/theme/constants");
18
18
  var _form = require("./form");
19
19
  var _label = _interopRequireDefault(require("./label"));
20
20
  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; }
21
- 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) { (0, _defineProperty2.default)(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; }
21
+ 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) { (0, _defineProperty2.default)(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; } /** @jsx jsx */
22
22
  var gridSize = (0, _constants.gridSize)();
23
23
  var fontFamily = (0, _constants.fontFamily)();
24
24
  var fieldWrapperStyles = (0, _react2.css)({
@@ -122,7 +122,7 @@ function Field(props) {
122
122
  setState = _useState2[1];
123
123
  var latestStateRef = usePreviousRef(state);
124
124
  (0, _react.useEffect)(function () {
125
- if (process.env.NODE_ENV !== 'production' && !process.env.CI) {
125
+ if (typeof process !== 'undefined' && process.env.NODE_ENV !== 'production' && !process.env.CI) {
126
126
  (0, _tinyInvariant.default)(latestPropsRef.current.name, '@atlaskit/form: Field components have a required name prop');
127
127
  }
128
128
  function fieldStateToMeta() {
@@ -240,13 +240,24 @@ function Field(props) {
240
240
  id: props.name
241
241
  }));
242
242
  }, [props.id, props.name]);
243
+ var getDescribedBy = function getDescribedBy() {
244
+ var value = '';
245
+ if (state.error) {
246
+ value += "".concat(fieldId, "-error ");
247
+ }
248
+ if (state.valid) {
249
+ value += "".concat(fieldId, "-valid ");
250
+ }
251
+ return "".concat(value).concat(fieldId, "-helper");
252
+ };
243
253
  var extendedFieldProps = _objectSpread(_objectSpread({}, state.fieldProps), {}, {
244
254
  name: props.name,
245
255
  isDisabled: isDisabled,
246
256
  isInvalid: Boolean(state.error),
247
257
  isRequired: Boolean(props.isRequired),
248
258
  'aria-invalid': state.error ? 'true' : 'false',
249
- 'aria-labelledby': "".concat(fieldId, "-label ").concat(fieldId, "-helper ").concat(fieldId, "-valid ").concat(fieldId, "-error"),
259
+ 'aria-describedby': getDescribedBy(),
260
+ 'aria-labelledby': "".concat(fieldId, "-label"),
250
261
  id: fieldId
251
262
  });
252
263
  return (0, _react2.jsx)("div", {
@@ -16,6 +16,14 @@ var _typography = require("@atlaskit/theme/typography");
16
16
  var _field = require("./field");
17
17
  /** @jsx jsx */
18
18
 
19
+ /**
20
+ * API for the internal `<Message />` component. This is not public API.
21
+ */
22
+
23
+ /**
24
+ * Public API of the various message components.
25
+ */
26
+
19
27
  var gridSize = (0, _constants.gridSize)();
20
28
  var fontFamily = (0, _constants.fontFamily)();
21
29
 
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/form",
3
- "version": "8.8.6",
3
+ "version": "8.8.8",
4
4
  "sideEffects": false
5
5
  }
@@ -107,7 +107,7 @@ export default function Field(props) {
107
107
  });
108
108
  const latestStateRef = usePreviousRef(state);
109
109
  useEffect(() => {
110
- if (process.env.NODE_ENV !== 'production' && !process.env.CI) {
110
+ if (typeof process !== 'undefined' && process.env.NODE_ENV !== 'production' && !process.env.CI) {
111
111
  invariant(latestPropsRef.current.name, '@atlaskit/form: Field components have a required name prop');
112
112
  }
113
113
  function fieldStateToMeta(value = {}) {
@@ -222,6 +222,16 @@ export default function Field(props) {
222
222
  () => props.id ? props.id : `${props.name}-${uid({
223
223
  id: props.name
224
224
  })}`, [props.id, props.name]);
225
+ const getDescribedBy = () => {
226
+ let value = '';
227
+ if (state.error) {
228
+ value += `${fieldId}-error `;
229
+ }
230
+ if (state.valid) {
231
+ value += `${fieldId}-valid `;
232
+ }
233
+ return `${value}${fieldId}-helper`;
234
+ };
225
235
  const extendedFieldProps = {
226
236
  ...state.fieldProps,
227
237
  name: props.name,
@@ -229,7 +239,8 @@ export default function Field(props) {
229
239
  isInvalid: Boolean(state.error),
230
240
  isRequired: Boolean(props.isRequired),
231
241
  'aria-invalid': state.error ? 'true' : 'false',
232
- 'aria-labelledby': `${fieldId}-label ${fieldId}-helper ${fieldId}-valid ${fieldId}-error`,
242
+ 'aria-describedby': getDescribedBy(),
243
+ 'aria-labelledby': `${fieldId}-label`,
233
244
  id: fieldId
234
245
  };
235
246
  return jsx("div", {
@@ -9,6 +9,15 @@ import { useGlobalTheme } from '@atlaskit/theme/components';
9
9
  import { fontFamily as getFontFamily, gridSize as getGridSize } from '@atlaskit/theme/constants';
10
10
  import { h200 } from '@atlaskit/theme/typography';
11
11
  import { FieldId } from './field';
12
+
13
+ /**
14
+ * API for the internal `<Message />` component. This is not public API.
15
+ */
16
+
17
+ /**
18
+ * Public API of the various message components.
19
+ */
20
+
12
21
  const gridSize = getGridSize();
13
22
  const fontFamily = getFontFamily();
14
23
 
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/form",
3
- "version": "8.8.6",
3
+ "version": "8.8.8",
4
4
  "sideEffects": false
5
5
  }
package/dist/esm/field.js CHANGED
@@ -114,7 +114,7 @@ export default function Field(props) {
114
114
  setState = _useState2[1];
115
115
  var latestStateRef = usePreviousRef(state);
116
116
  useEffect(function () {
117
- if (process.env.NODE_ENV !== 'production' && !process.env.CI) {
117
+ if (typeof process !== 'undefined' && process.env.NODE_ENV !== 'production' && !process.env.CI) {
118
118
  invariant(latestPropsRef.current.name, '@atlaskit/form: Field components have a required name prop');
119
119
  }
120
120
  function fieldStateToMeta() {
@@ -232,13 +232,24 @@ export default function Field(props) {
232
232
  id: props.name
233
233
  }));
234
234
  }, [props.id, props.name]);
235
+ var getDescribedBy = function getDescribedBy() {
236
+ var value = '';
237
+ if (state.error) {
238
+ value += "".concat(fieldId, "-error ");
239
+ }
240
+ if (state.valid) {
241
+ value += "".concat(fieldId, "-valid ");
242
+ }
243
+ return "".concat(value).concat(fieldId, "-helper");
244
+ };
235
245
  var extendedFieldProps = _objectSpread(_objectSpread({}, state.fieldProps), {}, {
236
246
  name: props.name,
237
247
  isDisabled: isDisabled,
238
248
  isInvalid: Boolean(state.error),
239
249
  isRequired: Boolean(props.isRequired),
240
250
  'aria-invalid': state.error ? 'true' : 'false',
241
- 'aria-labelledby': "".concat(fieldId, "-label ").concat(fieldId, "-helper ").concat(fieldId, "-valid ").concat(fieldId, "-error"),
251
+ 'aria-describedby': getDescribedBy(),
252
+ 'aria-labelledby': "".concat(fieldId, "-label"),
242
253
  id: fieldId
243
254
  });
244
255
  return jsx("div", {
@@ -9,6 +9,15 @@ import { useGlobalTheme } from '@atlaskit/theme/components';
9
9
  import { fontFamily as getFontFamily, gridSize as getGridSize } from '@atlaskit/theme/constants';
10
10
  import { h200 } from '@atlaskit/theme/typography';
11
11
  import { FieldId } from './field';
12
+
13
+ /**
14
+ * API for the internal `<Message />` component. This is not public API.
15
+ */
16
+
17
+ /**
18
+ * Public API of the various message components.
19
+ */
20
+
12
21
  var gridSize = getGridSize();
13
22
  var fontFamily = getFontFamily();
14
23
 
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/form",
3
- "version": "8.8.6",
3
+ "version": "8.8.8",
4
4
  "sideEffects": false
5
5
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/form",
3
- "version": "8.8.6",
3
+ "version": "8.8.8",
4
4
  "description": "A form allows users to input information.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -39,7 +39,7 @@
39
39
  "homepage": "https://atlassian.design/components/form/",
40
40
  "dependencies": {
41
41
  "@atlaskit/icon": "^21.11.0",
42
- "@atlaskit/theme": "^12.3.0",
42
+ "@atlaskit/theme": "^12.4.0",
43
43
  "@atlaskit/tokens": "^1.2.0",
44
44
  "@babel/runtime": "^7.0.0",
45
45
  "@emotion/react": "^11.7.1",
@@ -53,7 +53,7 @@
53
53
  "react": "^16.8.0"
54
54
  },
55
55
  "devDependencies": {
56
- "@atlaskit/button": "^16.5.0",
56
+ "@atlaskit/button": "^16.6.0",
57
57
  "@atlaskit/calendar": "^13.0.0",
58
58
  "@atlaskit/checkbox": "^12.4.0",
59
59
  "@atlaskit/datetime-picker": "^12.3.0",
package/report.api.md CHANGED
@@ -214,6 +214,8 @@ export const Label: FC<LabelProps>;
214
214
 
215
215
  // @public (undocumented)
216
216
  export interface LabelProps {
217
+ // (undocumented)
218
+ children: ReactNode;
217
219
  // (undocumented)
218
220
  htmlFor: string;
219
221
  // (undocumented)