@atlaskit/form 8.11.8 → 8.11.10

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.11.10
4
+
5
+ ### Patch Changes
6
+
7
+ - [`7c7704ad529`](https://bitbucket.org/atlassian/atlassian-frontend/commits/7c7704ad529) - Imports from @atlaskit/form/Messages will no longer pull react-final-form and Field in the bundle.
8
+
9
+ ## 8.11.9
10
+
11
+ ### Patch Changes
12
+
13
+ - [`85935c8cde4`](https://bitbucket.org/atlassian/atlassian-frontend/commits/85935c8cde4) - [ux] Denoting live region of form messages using aria-live attribute instead of alert role.
14
+
3
15
  ## 8.11.8
4
16
 
5
17
  ### Patch Changes
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.FieldId = void 0;
7
+ var _react = require("react");
8
+ /**
9
+ * __Field id__
10
+ *
11
+ * 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.
12
+ */
13
+ var FieldId = /*#__PURE__*/(0, _react.createContext)(undefined);
14
+ exports.FieldId = FieldId;
package/dist/cjs/field.js CHANGED
@@ -4,7 +4,6 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.FieldId = void 0;
8
7
  exports.default = Field;
9
8
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
10
9
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
@@ -13,6 +12,7 @@ var _react = require("react");
13
12
  var _react2 = require("@emotion/react");
14
13
  var _reactUid = require("react-uid");
15
14
  var _tinyInvariant = _interopRequireDefault(require("tiny-invariant"));
15
+ var _fieldIdContext = require("./field-id-context");
16
16
  var _form = require("./form");
17
17
  var _label = require("./label");
18
18
  var _requiredAsterisk = _interopRequireDefault(require("./required-asterisk"));
@@ -27,13 +27,6 @@ function isEvent(event) {
27
27
  function isFunction(x) {
28
28
  return typeof x === 'function';
29
29
  }
30
- /**
31
- * __Field id__
32
- *
33
- * 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.
34
- */
35
- var FieldId = /*#__PURE__*/(0, _react.createContext)(undefined);
36
- exports.FieldId = FieldId;
37
30
  function usePreviousRef(current) {
38
31
  var ref = (0, _react.useRef)(current);
39
32
 
@@ -258,7 +251,7 @@ function Field(props) {
258
251
  htmlFor: fieldId,
259
252
  id: "".concat(fieldId, "-label"),
260
253
  testId: props.testId && "".concat(props.testId, "--label")
261
- }, props.label, props.isRequired && (0, _react2.jsx)(_requiredAsterisk.default, null), props.elementAfterLabel), (0, _react2.jsx)(FieldId.Provider, {
254
+ }, props.label, props.isRequired && (0, _react2.jsx)(_requiredAsterisk.default, null), props.elementAfterLabel), (0, _react2.jsx)(_fieldIdContext.FieldId.Provider, {
262
255
  value: fieldId
263
256
  }, props.children({
264
257
  fieldProps: extendedFieldProps,
@@ -12,7 +12,7 @@ var _colors = require("@atlaskit/theme/colors");
12
12
  var _components = require("@atlaskit/theme/components");
13
13
  var _constants = require("@atlaskit/theme/constants");
14
14
  var _typography = require("@atlaskit/theme/typography");
15
- var _field = require("./field");
15
+ var _fieldIdContext = require("./field-id-context");
16
16
  /** @jsx jsx */
17
17
 
18
18
  /**
@@ -97,7 +97,7 @@ var Message = function Message(_ref2) {
97
97
  css: [mode === 'light' ? lightH200Styles : darkH200Styles, messageStyles, messageAppearanceStyles[appearance]],
98
98
  "data-testid": testId,
99
99
  id: fieldId,
100
- role: "alert"
100
+ "aria-live": "polite"
101
101
  }, icon && (0, _react.jsx)(IconWrapper, null, icon), content);
102
102
  };
103
103
 
@@ -111,7 +111,7 @@ var Message = function Message(_ref2) {
111
111
  var HelperMessage = function HelperMessage(_ref3) {
112
112
  var children = _ref3.children,
113
113
  testId = _ref3.testId;
114
- return (0, _react.jsx)(_field.FieldId.Consumer, null, function (fieldId) {
114
+ return (0, _react.jsx)(_fieldIdContext.FieldId.Consumer, null, function (fieldId) {
115
115
  return (0, _react.jsx)(Message, {
116
116
  fieldId: fieldId ? "".concat(fieldId, "-helper") : undefined,
117
117
  testId: testId
@@ -130,7 +130,7 @@ exports.HelperMessage = HelperMessage;
130
130
  var ErrorMessage = function ErrorMessage(_ref4) {
131
131
  var children = _ref4.children,
132
132
  testId = _ref4.testId;
133
- return (0, _react.jsx)(_field.FieldId.Consumer, null, function (fieldId) {
133
+ return (0, _react.jsx)(_fieldIdContext.FieldId.Consumer, null, function (fieldId) {
134
134
  return (0, _react.jsx)(Message, {
135
135
  appearance: "error",
136
136
  fieldId: fieldId ? "".concat(fieldId, "-error") : undefined,
@@ -150,7 +150,7 @@ exports.ErrorMessage = ErrorMessage;
150
150
  var ValidMessage = function ValidMessage(_ref5) {
151
151
  var children = _ref5.children,
152
152
  testId = _ref5.testId;
153
- return (0, _react.jsx)(_field.FieldId.Consumer, null, function (fieldId) {
153
+ return (0, _react.jsx)(_fieldIdContext.FieldId.Consumer, null, function (fieldId) {
154
154
  return (0, _react.jsx)(Message, {
155
155
  appearance: "valid",
156
156
  fieldId: fieldId ? "".concat(fieldId, "-valid") : undefined,
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/form",
3
- "version": "8.11.8",
3
+ "version": "8.11.10",
4
4
  "sideEffects": false
5
5
  }
@@ -0,0 +1,8 @@
1
+ import { createContext } from 'react';
2
+
3
+ /**
4
+ * __Field id__
5
+ *
6
+ * 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.
7
+ */
8
+ export const FieldId = /*#__PURE__*/createContext(undefined);
@@ -1,8 +1,9 @@
1
1
  /** @jsx jsx */
2
- import { createContext, useContext, useEffect, useMemo, useRef, useState } from 'react';
2
+ import { useContext, useEffect, useMemo, useRef, useState } from 'react';
3
3
  import { css, jsx } from '@emotion/react';
4
4
  import { uid } from 'react-uid';
5
5
  import invariant from 'tiny-invariant';
6
+ import { FieldId } from './field-id-context';
6
7
  import { FormContext, IsDisabledContext } from './form';
7
8
  import { Label } from './label';
8
9
  import RequiredAsterisk from './required-asterisk';
@@ -15,12 +16,6 @@ function isEvent(event) {
15
16
  function isFunction(x) {
16
17
  return typeof x === 'function';
17
18
  }
18
- /**
19
- * __Field id__
20
- *
21
- * 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.
22
- */
23
- export const FieldId = /*#__PURE__*/createContext(undefined);
24
19
  function usePreviousRef(current) {
25
20
  const ref = useRef(current);
26
21
 
@@ -7,7 +7,7 @@ import { N200 } from '@atlaskit/theme/colors';
7
7
  import { useGlobalTheme } from '@atlaskit/theme/components';
8
8
  import { fontFamily as getFontFamily } from '@atlaskit/theme/constants';
9
9
  import { h200 } from '@atlaskit/theme/typography';
10
- import { FieldId } from './field';
10
+ import { FieldId } from './field-id-context';
11
11
 
12
12
  /**
13
13
  * API for the internal `<Message />` component. This is not public API.
@@ -93,7 +93,7 @@ const Message = ({
93
93
  css: [mode === 'light' ? lightH200Styles : darkH200Styles, messageStyles, messageAppearanceStyles[appearance]],
94
94
  "data-testid": testId,
95
95
  id: fieldId,
96
- role: "alert"
96
+ "aria-live": "polite"
97
97
  }, icon && jsx(IconWrapper, null, icon), content);
98
98
  };
99
99
 
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/form",
3
- "version": "8.11.8",
3
+ "version": "8.11.10",
4
4
  "sideEffects": false
5
5
  }
@@ -0,0 +1,8 @@
1
+ import { createContext } from 'react';
2
+
3
+ /**
4
+ * __Field id__
5
+ *
6
+ * 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.
7
+ */
8
+ export var FieldId = /*#__PURE__*/createContext(undefined);
package/dist/esm/field.js CHANGED
@@ -4,10 +4,11 @@ import _typeof from "@babel/runtime/helpers/typeof";
4
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; }
5
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; }
6
6
  /** @jsx jsx */
7
- import { createContext, useContext, useEffect, useMemo, useRef, useState } from 'react';
7
+ import { useContext, useEffect, useMemo, useRef, useState } from 'react';
8
8
  import { css, jsx } from '@emotion/react';
9
9
  import { uid } from 'react-uid';
10
10
  import invariant from 'tiny-invariant';
11
+ import { FieldId } from './field-id-context';
11
12
  import { FormContext, IsDisabledContext } from './form';
12
13
  import { Label } from './label';
13
14
  import RequiredAsterisk from './required-asterisk';
@@ -20,12 +21,6 @@ function isEvent(event) {
20
21
  function isFunction(x) {
21
22
  return typeof x === 'function';
22
23
  }
23
- /**
24
- * __Field id__
25
- *
26
- * 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.
27
- */
28
- export var FieldId = /*#__PURE__*/createContext(undefined);
29
24
  function usePreviousRef(current) {
30
25
  var ref = useRef(current);
31
26
 
@@ -7,7 +7,7 @@ import { N200 } from '@atlaskit/theme/colors';
7
7
  import { useGlobalTheme } from '@atlaskit/theme/components';
8
8
  import { fontFamily as getFontFamily } from '@atlaskit/theme/constants';
9
9
  import { h200 } from '@atlaskit/theme/typography';
10
- import { FieldId } from './field';
10
+ import { FieldId } from './field-id-context';
11
11
 
12
12
  /**
13
13
  * API for the internal `<Message />` component. This is not public API.
@@ -91,7 +91,7 @@ var Message = function Message(_ref2) {
91
91
  css: [mode === 'light' ? lightH200Styles : darkH200Styles, messageStyles, messageAppearanceStyles[appearance]],
92
92
  "data-testid": testId,
93
93
  id: fieldId,
94
- role: "alert"
94
+ "aria-live": "polite"
95
95
  }, icon && jsx(IconWrapper, null, icon), content);
96
96
  };
97
97
 
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/form",
3
- "version": "8.11.8",
3
+ "version": "8.11.10",
4
4
  "sideEffects": false
5
5
  }
@@ -0,0 +1,7 @@
1
+ /// <reference types="react" />
2
+ /**
3
+ * __Field id__
4
+ *
5
+ * 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.
6
+ */
7
+ export declare const FieldId: import("react").Context<string | undefined>;
@@ -77,11 +77,5 @@ export interface FieldComponentProps<FieldValue, Element extends SupportedElemen
77
77
  */
78
78
  testId?: string;
79
79
  }
80
- /**
81
- * __Field id__
82
- *
83
- * 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.
84
- */
85
- export declare const FieldId: import("react").Context<string | undefined>;
86
80
  export default function Field<FieldValue = string, Element extends SupportedElements = HTMLInputElement>(props: FieldComponentProps<FieldValue, Element>): jsx.JSX.Element;
87
81
  export {};
@@ -0,0 +1,7 @@
1
+ /// <reference types="react" />
2
+ /**
3
+ * __Field id__
4
+ *
5
+ * 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.
6
+ */
7
+ export declare const FieldId: import("react").Context<string | undefined>;
@@ -77,11 +77,5 @@ export interface FieldComponentProps<FieldValue, Element extends SupportedElemen
77
77
  */
78
78
  testId?: string;
79
79
  }
80
- /**
81
- * __Field id__
82
- *
83
- * 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.
84
- */
85
- export declare const FieldId: import("react").Context<string | undefined>;
86
80
  export default function Field<FieldValue = string, Element extends SupportedElements = HTMLInputElement>(props: FieldComponentProps<FieldValue, Element>): jsx.JSX.Element;
87
81
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/form",
3
- "version": "8.11.8",
3
+ "version": "8.11.10",
4
4
  "description": "A form allows users to input information.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -12,30 +12,9 @@
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.5 <4.9": {
17
- "*": [
18
- "dist/types-ts4.5/*",
19
- "dist/types-ts4.5/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",
26
- "af:exports": {
27
- "./CheckboxField": "./src/entry-points/checkbox-field.tsx",
28
- "./Field": "./src/entry-points/field.tsx",
29
- "./Fieldset": "./src/entry-points/fieldset.tsx",
30
- "./FormFooter": "./src/entry-points/form-footer.tsx",
31
- "./FormHeader": "./src/entry-points/form-header.tsx",
32
- "./FormSection": "./src/entry-points/form-section.tsx",
33
- "./Form": "./src/entry-points/form.tsx",
34
- "./Messages": "./src/entry-points/messages.tsx",
35
- "./RangeField": "./src/entry-points/range-field.tsx",
36
- "./Label": "./src/entry-points/label.tsx",
37
- ".": "./src/index.tsx"
38
- },
39
18
  "atlassian": {
40
19
  "team": "Design System Team",
41
20
  "releaseModel": "continuous",
@@ -44,11 +23,10 @@
44
23
  "category": "Components"
45
24
  }
46
25
  },
47
- "homepage": "https://atlassian.design/components/form/",
48
26
  "dependencies": {
49
27
  "@atlaskit/icon": "^21.12.0",
50
28
  "@atlaskit/theme": "^12.5.0",
51
- "@atlaskit/tokens": "^1.5.0",
29
+ "@atlaskit/tokens": "^1.13.0",
52
30
  "@babel/runtime": "^7.0.0",
53
31
  "@emotion/react": "^11.7.1",
54
32
  "final-form": "^4.20.1",
@@ -61,26 +39,22 @@
61
39
  "react": "^16.8.0"
62
40
  },
63
41
  "devDependencies": {
64
- "@atlaskit/button": "^16.7.0",
42
+ "@af/accessibility-testing": "*",
43
+ "@af/visual-regression": "*",
44
+ "@atlaskit/button": "^16.8.0",
65
45
  "@atlaskit/checkbox": "^12.6.0",
66
- "@atlaskit/datetime-picker": "^12.7.0",
67
- "@atlaskit/docs": "^9.1.0",
68
46
  "@atlaskit/ds-lib": "^2.2.0",
69
- "@atlaskit/lozenge": "^11.4.0",
70
- "@atlaskit/modal-dialog": "^12.6.0",
71
- "@atlaskit/radio": "^5.6.0",
72
47
  "@atlaskit/range": "^7.1.0",
73
- "@atlaskit/section-message": "^6.4.0",
74
48
  "@atlaskit/select": "^16.5.0",
75
49
  "@atlaskit/ssr": "*",
76
- "@atlaskit/textarea": "^4.7.0",
77
- "@atlaskit/textfield": "^5.5.0",
50
+ "@atlaskit/textfield": "^5.6.0",
78
51
  "@atlaskit/visual-regression": "*",
79
52
  "@atlaskit/webdriver-runner": "*",
80
53
  "@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
81
54
  "@testing-library/react": "^12.1.5",
82
55
  "@testing-library/user-event": "^14.4.3",
83
56
  "@types/final-form-focus": "^1.1.1",
57
+ "jest-in-case": "^1.0.2",
84
58
  "react-dom": "^16.8.0",
85
59
  "react-router": "^4.2.0",
86
60
  "react-router-dom": "^4.2.2",
@@ -116,5 +90,27 @@
116
90
  "deprecation": "no-deprecated-imports"
117
91
  }
118
92
  },
93
+ "typesVersions": {
94
+ ">=4.5 <4.9": {
95
+ "*": [
96
+ "dist/types-ts4.5/*",
97
+ "dist/types-ts4.5/index.d.ts"
98
+ ]
99
+ }
100
+ },
101
+ "af:exports": {
102
+ "./CheckboxField": "./src/entry-points/checkbox-field.tsx",
103
+ "./Field": "./src/entry-points/field.tsx",
104
+ "./Fieldset": "./src/entry-points/fieldset.tsx",
105
+ "./FormFooter": "./src/entry-points/form-footer.tsx",
106
+ "./FormHeader": "./src/entry-points/form-header.tsx",
107
+ "./FormSection": "./src/entry-points/form-section.tsx",
108
+ "./Form": "./src/entry-points/form.tsx",
109
+ "./Messages": "./src/entry-points/messages.tsx",
110
+ "./RangeField": "./src/entry-points/range-field.tsx",
111
+ "./Label": "./src/entry-points/label.tsx",
112
+ ".": "./src/index.tsx"
113
+ },
114
+ "homepage": "https://atlassian.design/components/form/",
119
115
  "prettier": "@atlassian/atlassian-frontend-prettier-config-1.0.1"
120
116
  }