@atlaskit/react-select 0.0.2 → 1.0.1

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,9 +1,33 @@
1
1
  # @atlaskit/react-select
2
2
 
3
+ ## 1.0.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#140869](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/140869)
8
+ [`f08b672eb884b`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/f08b672eb884b) -
9
+ Add back removed props as deprecated for easier migration
10
+
11
+ ## 1.0.0
12
+
13
+ ### Major Changes
14
+
15
+ - [#139777](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/139777)
16
+ [`79c93576c6fff`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/79c93576c6fff) -
17
+ Delete/deprecate props that are unused, used incorrectly, or bad for accessibility.
18
+
3
19
  ## 0.0.2
4
20
 
5
21
  ### Patch Changes
6
22
 
23
+ - [#135374](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/135374)
24
+ [`c7db6f8caf0cd`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/c7db6f8caf0cd) -
25
+ Export async creatable API
26
+
27
+ ## 0.0.1
28
+
29
+ ### Patch Changes
30
+
7
31
  - [#132974](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/132974)
8
32
  [`c515f82f96ef1`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/c515f82f96ef1) -
9
33
  Initial fork of react-select
@@ -0,0 +1,15 @@
1
+ {
2
+ "name": "@atlaskit/react-select/async-creatable",
3
+ "main": "../dist/cjs/async-creatable.js",
4
+ "module": "../dist/esm/async-creatable.js",
5
+ "module:es2019": "../dist/es2019/async-creatable.js",
6
+ "sideEffects": false,
7
+ "types": "../dist/types/async-creatable.d.ts",
8
+ "typesVersions": {
9
+ ">=4.5 <5.4": {
10
+ "*": [
11
+ "../dist/types-ts4.5/async-creatable.d.ts"
12
+ ]
13
+ }
14
+ }
15
+ }
@@ -13,7 +13,7 @@ var _useAsync = _interopRequireDefault(require("./use-async"));
13
13
  var _useCreatable = _interopRequireDefault(require("./use-creatable"));
14
14
  var _useStateManager = _interopRequireDefault(require("./use-state-manager"));
15
15
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
16
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
16
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
17
17
  var AsyncCreatableSelect = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
18
18
  var stateManagerProps = (0, _useAsync.default)(props);
19
19
  var creatableProps = (0, _useStateManager.default)(stateManagerProps);
package/dist/cjs/async.js CHANGED
@@ -18,7 +18,7 @@ var _select = _interopRequireDefault(require("./select"));
18
18
  var _useAsync = _interopRequireDefault(require("./use-async"));
19
19
  var _useStateManager = _interopRequireDefault(require("./use-state-manager"));
20
20
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
21
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
21
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
22
22
  var AsyncSelect = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
23
23
  var stateManagedProps = (0, _useAsync.default)(props);
24
24
  var selectProps = (0, _useStateManager.default)(stateManagedProps);
@@ -18,7 +18,7 @@ var _option = _interopRequireDefault(require("./option"));
18
18
  var _placeholder = _interopRequireDefault(require("./placeholder"));
19
19
  var _singleValue = _interopRequireDefault(require("./single-value"));
20
20
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
21
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
21
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
22
22
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
23
23
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
24
24
  var components = exports.components = {
@@ -36,12 +36,13 @@ var LiveRegion = function LiveRegion(props) {
36
36
  isMulti = selectProps.isMulti,
37
37
  isOptionDisabled = selectProps.isOptionDisabled,
38
38
  isSearchable = selectProps.isSearchable,
39
+ label = selectProps.label,
39
40
  menuIsOpen = selectProps.menuIsOpen,
40
41
  options = selectProps.options,
41
42
  screenReaderStatus = selectProps.screenReaderStatus,
42
43
  tabSelectsValue = selectProps.tabSelectsValue,
43
44
  isLoading = selectProps.isLoading;
44
- var ariaLabel = selectProps['aria-label'];
45
+ var ariaLabel = selectProps['aria-label'] || label;
45
46
  var ariaLive = selectProps['aria-live'];
46
47
 
47
48
  // Update aria live message configuration when prop changes
@@ -65,7 +66,7 @@ var LiveRegion = function LiveRegion(props) {
65
66
 
66
67
  // If there is just one item from the action then get its label
67
68
  var selected = removedValue || option || asOption(value);
68
- var label = selected ? getOptionLabel(selected) : '';
69
+ var _label = selected ? getOptionLabel(selected) : '';
69
70
 
70
71
  // If there are multiple items from the action then return an array of labels
71
72
  var multiSelected = selectedOptions || removedValues || undefined;
@@ -74,7 +75,7 @@ var LiveRegion = function LiveRegion(props) {
74
75
  // multiSelected items are usually items that have already been selected
75
76
  // or set by the user as a default value so we assume they are not disabled
76
77
  isDisabled: selected && isOptionDisabled(selected, selectValue),
77
- label: label,
78
+ label: _label,
78
79
  labels: labels
79
80
  }, ariaSelection);
80
81
  message = messages.onChange(onChangeProps);
@@ -18,7 +18,7 @@ var _select = _interopRequireDefault(require("./select"));
18
18
  var _useCreatable = _interopRequireDefault(require("./use-creatable"));
19
19
  var _useStateManager = _interopRequireDefault(require("./use-state-manager"));
20
20
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
21
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
21
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
22
22
  var CreatableSelect = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
23
23
  var creatableProps = (0, _useStateManager.default)(props);
24
24
  var selectProps = (0, _useCreatable.default)(creatableProps);
@@ -10,7 +10,7 @@ var _react = _interopRequireWildcard(require("react"));
10
10
  var _cache = _interopRequireDefault(require("@emotion/cache"));
11
11
  var _react2 = require("@emotion/react");
12
12
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
13
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
13
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
14
14
  var NonceProvider = function NonceProvider(_ref) {
15
15
  var nonce = _ref.nonce,
16
16
  children = _ref.children,
@@ -27,10 +27,10 @@ var _styles = require("./styles");
27
27
  var _theme = require("./theme");
28
28
  var _utils = require("./utils");
29
29
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
30
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
30
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
31
31
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
32
32
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
33
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
33
+ function _createSuper(t) { var r = _isNativeReflectConstruct(); return function () { var e, o = (0, _getPrototypeOf2.default)(t); if (r) { var s = (0, _getPrototypeOf2.default)(this).constructor; e = Reflect.construct(o, arguments, s); } else e = o.apply(this, arguments); return (0, _possibleConstructorReturn2.default)(this, e); }; }
34
34
  function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
35
35
  var defaultProps = exports.defaultProps = {
36
36
  'aria-live': 'polite',
@@ -1143,12 +1143,12 @@ var Select = exports.default = /*#__PURE__*/function (_Component) {
1143
1143
  key: "formatOptionLabel",
1144
1144
  value: function formatOptionLabel(data, context) {
1145
1145
  if (typeof this.props.formatOptionLabel === 'function') {
1146
- var _inputValue = this.props.inputValue;
1147
- var _selectValue = this.state.selectValue;
1146
+ var inputValue = this.props.inputValue;
1147
+ var selectValue = this.state.selectValue;
1148
1148
  return this.props.formatOptionLabel(data, {
1149
1149
  context: context,
1150
- inputValue: _inputValue,
1151
- selectValue: _selectValue
1150
+ inputValue: inputValue,
1151
+ selectValue: selectValue
1152
1152
  });
1153
1153
  } else {
1154
1154
  return this.getOptionLabel(data);
@@ -1221,14 +1221,19 @@ var Select = exports.default = /*#__PURE__*/function (_Component) {
1221
1221
  // ==============================
1222
1222
  function renderInput() {
1223
1223
  var _this$props8 = this.props,
1224
- isDisabled = _this$props8.isDisabled,
1225
- isSearchable = _this$props8.isSearchable,
1224
+ descriptionId = _this$props8.descriptionId,
1225
+ form = _this$props8.form,
1226
1226
  inputId = _this$props8.inputId,
1227
1227
  inputValue = _this$props8.inputValue,
1228
- tabIndex = _this$props8.tabIndex,
1229
- form = _this$props8.form,
1228
+ isDisabled = _this$props8.isDisabled,
1229
+ isInvalid = _this$props8.isInvalid,
1230
+ isRequired = _this$props8.isRequired,
1231
+ isSearchable = _this$props8.isSearchable,
1232
+ label = _this$props8.label,
1233
+ labelId = _this$props8.labelId,
1230
1234
  menuIsOpen = _this$props8.menuIsOpen,
1231
- required = _this$props8.required;
1235
+ required = _this$props8.required,
1236
+ tabIndex = _this$props8.tabIndex;
1232
1237
  var _this$getComponents = this.getComponents(),
1233
1238
  Input = _this$getComponents.Input;
1234
1239
  var _this$state4 = this.state,
@@ -1236,18 +1241,19 @@ var Select = exports.default = /*#__PURE__*/function (_Component) {
1236
1241
  ariaSelection = _this$state4.ariaSelection;
1237
1242
  var commonProps = this.commonProps;
1238
1243
  var id = inputId || this.getElementId('input');
1244
+ var description = this.props['aria-describedby'] || descriptionId || null;
1239
1245
 
1240
1246
  // aria attributes makes the JSX "noisy", separated for clarity
1241
1247
  var ariaAttributes = _objectSpread(_objectSpread(_objectSpread({
1242
1248
  'aria-autocomplete': 'list',
1249
+ 'aria-errormessage': this.props['aria-errormessage'],
1243
1250
  'aria-expanded': menuIsOpen,
1244
1251
  'aria-haspopup': 'listbox',
1245
- 'aria-errormessage': this.props['aria-errormessage'],
1246
- 'aria-describedby': this.props['aria-describedby'],
1247
- 'aria-invalid': this.props['aria-invalid'],
1248
- 'aria-label': this.props['aria-label'],
1249
- 'aria-labelledby': this.props['aria-labelledby'],
1250
- 'aria-required': required,
1252
+ 'aria-describedby': description,
1253
+ 'aria-invalid': this.props['aria-invalid'] || isInvalid,
1254
+ 'aria-label': this.props['aria-label'] || label,
1255
+ 'aria-labelledby': this.props['aria-labelledby'] || labelId,
1256
+ 'aria-required': required || isRequired,
1251
1257
  role: 'combobox',
1252
1258
  'aria-activedescendant': this.isAppleDevice ? undefined : this.state.focusedOptionId
1253
1259
  }, menuIsOpen && {
@@ -1255,9 +1261,9 @@ var Select = exports.default = /*#__PURE__*/function (_Component) {
1255
1261
  }), !isSearchable && {
1256
1262
  'aria-readonly': true
1257
1263
  }), this.hasValue() ? (ariaSelection === null || ariaSelection === void 0 ? void 0 : ariaSelection.action) === 'initial-input-focus' && {
1258
- 'aria-describedby': this.getElementId('live-region')
1264
+ 'aria-describedby': description ? [description, this.getElementId('live-region')].join(' ') : this.getElementId('live-region')
1259
1265
  } : {
1260
- 'aria-describedby': this.getElementId('placeholder')
1266
+ 'aria-describedby': description ? [description, this.getElementId('placeholder')].join(' ') : this.getElementId('placeholder')
1261
1267
  });
1262
1268
  if (!isSearchable) {
1263
1269
  // use a dummy input to maintain focus/blur functionality
@@ -1528,14 +1534,14 @@ var Select = exports.default = /*#__PURE__*/function (_Component) {
1528
1534
  if (this.hasOptions()) {
1529
1535
  menuUI = this.getCategorizedOptions().map(function (item) {
1530
1536
  if (item.type === 'group') {
1531
- var _data = item.data,
1537
+ var data = item.data,
1532
1538
  options = item.options,
1533
1539
  groupIndex = item.index;
1534
1540
  var groupId = "".concat(_this4.getElementId('group'), "-").concat(groupIndex);
1535
1541
  var headingId = "".concat(groupId, "-heading");
1536
1542
  return /*#__PURE__*/_react.default.createElement(Group, (0, _extends2.default)({}, commonProps, {
1537
1543
  key: groupId,
1538
- data: _data,
1544
+ data: data,
1539
1545
  options: options,
1540
1546
  Heading: GroupHeading,
1541
1547
  headingProps: {
@@ -1628,10 +1634,12 @@ var Select = exports.default = /*#__PURE__*/function (_Component) {
1628
1634
  delimiter = _this$props13.delimiter,
1629
1635
  isDisabled = _this$props13.isDisabled,
1630
1636
  isMulti = _this$props13.isMulti,
1631
- name = _this$props13.name,
1632
- required = _this$props13.required;
1637
+ isRequired = _this$props13.isRequired,
1638
+ required = _this$props13.required,
1639
+ name = _this$props13.name;
1633
1640
  var selectValue = this.state.selectValue;
1634
- if (required && !this.hasValue() && !isDisabled) {
1641
+ var req = required || isRequired || null;
1642
+ if (req && !this.hasValue() && !isDisabled) {
1635
1643
  return /*#__PURE__*/_react.default.createElement(_internal.RequiredInput, {
1636
1644
  name: name,
1637
1645
  onFocus: this.onValueInputFocus
@@ -11,7 +11,7 @@ var _react = _interopRequireWildcard(require("react"));
11
11
  var _select = _interopRequireDefault(require("./select"));
12
12
  var _useStateManager = _interopRequireDefault(require("./use-state-manager"));
13
13
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
14
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
14
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
15
15
  /**
16
16
  * __StateManagedSelect__
17
17
  *
package/dist/cjs/utils.js CHANGED
@@ -142,9 +142,9 @@ var getStyleProps = exports.getStyleProps = function getStyleProps(props, name,
142
142
 
143
143
  function handleInputChange(inputValue, actionMeta, onInputChange) {
144
144
  if (onInputChange) {
145
- var _newValue = onInputChange(inputValue, actionMeta);
146
- if (typeof _newValue === 'string') {
147
- return _newValue;
145
+ var newValue = onInputChange(inputValue, actionMeta);
146
+ if (typeof newValue === 'string') {
147
+ return newValue;
148
148
  }
149
149
  }
150
150
  return inputValue;
@@ -31,13 +31,14 @@ const LiveRegion = props => {
31
31
  isMulti,
32
32
  isOptionDisabled,
33
33
  isSearchable,
34
+ label,
34
35
  menuIsOpen,
35
36
  options,
36
37
  screenReaderStatus,
37
38
  tabSelectsValue,
38
39
  isLoading
39
40
  } = selectProps;
40
- const ariaLabel = selectProps['aria-label'];
41
+ const ariaLabel = selectProps['aria-label'] || label;
41
42
  const ariaLive = selectProps['aria-live'];
42
43
 
43
44
  // Update aria live message configuration when prop changes
@@ -1226,14 +1226,19 @@ export default class Select extends Component {
1226
1226
  // ==============================
1227
1227
  renderInput() {
1228
1228
  const {
1229
- isDisabled,
1230
- isSearchable,
1229
+ descriptionId,
1230
+ form,
1231
1231
  inputId,
1232
1232
  inputValue,
1233
- tabIndex,
1234
- form,
1233
+ isDisabled,
1234
+ isInvalid,
1235
+ isRequired,
1236
+ isSearchable,
1237
+ label,
1238
+ labelId,
1235
1239
  menuIsOpen,
1236
- required
1240
+ required,
1241
+ tabIndex
1237
1242
  } = this.props;
1238
1243
  const {
1239
1244
  Input
@@ -1246,18 +1251,19 @@ export default class Select extends Component {
1246
1251
  commonProps
1247
1252
  } = this;
1248
1253
  const id = inputId || this.getElementId('input');
1254
+ const description = this.props['aria-describedby'] || descriptionId || null;
1249
1255
 
1250
1256
  // aria attributes makes the JSX "noisy", separated for clarity
1251
1257
  const ariaAttributes = {
1252
1258
  'aria-autocomplete': 'list',
1259
+ 'aria-errormessage': this.props['aria-errormessage'],
1253
1260
  'aria-expanded': menuIsOpen,
1254
1261
  'aria-haspopup': 'listbox',
1255
- 'aria-errormessage': this.props['aria-errormessage'],
1256
- 'aria-describedby': this.props['aria-describedby'],
1257
- 'aria-invalid': this.props['aria-invalid'],
1258
- 'aria-label': this.props['aria-label'],
1259
- 'aria-labelledby': this.props['aria-labelledby'],
1260
- 'aria-required': required,
1262
+ 'aria-describedby': description,
1263
+ 'aria-invalid': this.props['aria-invalid'] || isInvalid,
1264
+ 'aria-label': this.props['aria-label'] || label,
1265
+ 'aria-labelledby': this.props['aria-labelledby'] || labelId,
1266
+ 'aria-required': required || isRequired,
1261
1267
  role: 'combobox',
1262
1268
  'aria-activedescendant': this.isAppleDevice ? undefined : this.state.focusedOptionId,
1263
1269
  ...(menuIsOpen && {
@@ -1267,9 +1273,9 @@ export default class Select extends Component {
1267
1273
  'aria-readonly': true
1268
1274
  }),
1269
1275
  ...(this.hasValue() ? (ariaSelection === null || ariaSelection === void 0 ? void 0 : ariaSelection.action) === 'initial-input-focus' && {
1270
- 'aria-describedby': this.getElementId('live-region')
1276
+ 'aria-describedby': description ? [description, this.getElementId('live-region')].join(' ') : this.getElementId('live-region')
1271
1277
  } : {
1272
- 'aria-describedby': this.getElementId('placeholder')
1278
+ 'aria-describedby': description ? [description, this.getElementId('placeholder')].join(' ') : this.getElementId('placeholder')
1273
1279
  })
1274
1280
  };
1275
1281
  if (!isSearchable) {
@@ -1653,13 +1659,15 @@ export default class Select extends Component {
1653
1659
  delimiter,
1654
1660
  isDisabled,
1655
1661
  isMulti,
1656
- name,
1657
- required
1662
+ isRequired,
1663
+ required,
1664
+ name
1658
1665
  } = this.props;
1659
1666
  const {
1660
1667
  selectValue
1661
1668
  } = this.state;
1662
- if (required && !this.hasValue() && !isDisabled) {
1669
+ const req = required || isRequired || null;
1670
+ if (req && !this.hasValue() && !isDisabled) {
1663
1671
  return /*#__PURE__*/React.createElement(RequiredInput, {
1664
1672
  name: name,
1665
1673
  onFocus: this.onValueInputFocus
@@ -31,12 +31,13 @@ var LiveRegion = function LiveRegion(props) {
31
31
  isMulti = selectProps.isMulti,
32
32
  isOptionDisabled = selectProps.isOptionDisabled,
33
33
  isSearchable = selectProps.isSearchable,
34
+ label = selectProps.label,
34
35
  menuIsOpen = selectProps.menuIsOpen,
35
36
  options = selectProps.options,
36
37
  screenReaderStatus = selectProps.screenReaderStatus,
37
38
  tabSelectsValue = selectProps.tabSelectsValue,
38
39
  isLoading = selectProps.isLoading;
39
- var ariaLabel = selectProps['aria-label'];
40
+ var ariaLabel = selectProps['aria-label'] || label;
40
41
  var ariaLive = selectProps['aria-live'];
41
42
 
42
43
  // Update aria live message configuration when prop changes
@@ -60,7 +61,7 @@ var LiveRegion = function LiveRegion(props) {
60
61
 
61
62
  // If there is just one item from the action then get its label
62
63
  var selected = removedValue || option || asOption(value);
63
- var label = selected ? getOptionLabel(selected) : '';
64
+ var _label = selected ? getOptionLabel(selected) : '';
64
65
 
65
66
  // If there are multiple items from the action then return an array of labels
66
67
  var multiSelected = selectedOptions || removedValues || undefined;
@@ -69,7 +70,7 @@ var LiveRegion = function LiveRegion(props) {
69
70
  // multiSelected items are usually items that have already been selected
70
71
  // or set by the user as a default value so we assume they are not disabled
71
72
  isDisabled: selected && isOptionDisabled(selected, selectValue),
72
- label: label,
73
+ label: _label,
73
74
  labels: labels
74
75
  }, ariaSelection);
75
76
  message = messages.onChange(onChangeProps);
@@ -9,7 +9,7 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
9
9
  import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
10
10
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
11
11
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
12
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
12
+ function _createSuper(t) { var r = _isNativeReflectConstruct(); return function () { var e, o = _getPrototypeOf(t); if (r) { var s = _getPrototypeOf(this).constructor; e = Reflect.construct(o, arguments, s); } else e = o.apply(this, arguments); return _possibleConstructorReturn(this, e); }; }
13
13
  function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
14
14
  import React, { Component } from 'react';
15
15
  import { isAppleDevice } from './accessibility/helpers';
@@ -1133,12 +1133,12 @@ var Select = /*#__PURE__*/function (_Component) {
1133
1133
  key: "formatOptionLabel",
1134
1134
  value: function formatOptionLabel(data, context) {
1135
1135
  if (typeof this.props.formatOptionLabel === 'function') {
1136
- var _inputValue = this.props.inputValue;
1137
- var _selectValue = this.state.selectValue;
1136
+ var inputValue = this.props.inputValue;
1137
+ var selectValue = this.state.selectValue;
1138
1138
  return this.props.formatOptionLabel(data, {
1139
1139
  context: context,
1140
- inputValue: _inputValue,
1141
- selectValue: _selectValue
1140
+ inputValue: inputValue,
1141
+ selectValue: selectValue
1142
1142
  });
1143
1143
  } else {
1144
1144
  return this.getOptionLabel(data);
@@ -1211,14 +1211,19 @@ var Select = /*#__PURE__*/function (_Component) {
1211
1211
  // ==============================
1212
1212
  function renderInput() {
1213
1213
  var _this$props8 = this.props,
1214
- isDisabled = _this$props8.isDisabled,
1215
- isSearchable = _this$props8.isSearchable,
1214
+ descriptionId = _this$props8.descriptionId,
1215
+ form = _this$props8.form,
1216
1216
  inputId = _this$props8.inputId,
1217
1217
  inputValue = _this$props8.inputValue,
1218
- tabIndex = _this$props8.tabIndex,
1219
- form = _this$props8.form,
1218
+ isDisabled = _this$props8.isDisabled,
1219
+ isInvalid = _this$props8.isInvalid,
1220
+ isRequired = _this$props8.isRequired,
1221
+ isSearchable = _this$props8.isSearchable,
1222
+ label = _this$props8.label,
1223
+ labelId = _this$props8.labelId,
1220
1224
  menuIsOpen = _this$props8.menuIsOpen,
1221
- required = _this$props8.required;
1225
+ required = _this$props8.required,
1226
+ tabIndex = _this$props8.tabIndex;
1222
1227
  var _this$getComponents = this.getComponents(),
1223
1228
  Input = _this$getComponents.Input;
1224
1229
  var _this$state4 = this.state,
@@ -1226,18 +1231,19 @@ var Select = /*#__PURE__*/function (_Component) {
1226
1231
  ariaSelection = _this$state4.ariaSelection;
1227
1232
  var commonProps = this.commonProps;
1228
1233
  var id = inputId || this.getElementId('input');
1234
+ var description = this.props['aria-describedby'] || descriptionId || null;
1229
1235
 
1230
1236
  // aria attributes makes the JSX "noisy", separated for clarity
1231
1237
  var ariaAttributes = _objectSpread(_objectSpread(_objectSpread({
1232
1238
  'aria-autocomplete': 'list',
1239
+ 'aria-errormessage': this.props['aria-errormessage'],
1233
1240
  'aria-expanded': menuIsOpen,
1234
1241
  'aria-haspopup': 'listbox',
1235
- 'aria-errormessage': this.props['aria-errormessage'],
1236
- 'aria-describedby': this.props['aria-describedby'],
1237
- 'aria-invalid': this.props['aria-invalid'],
1238
- 'aria-label': this.props['aria-label'],
1239
- 'aria-labelledby': this.props['aria-labelledby'],
1240
- 'aria-required': required,
1242
+ 'aria-describedby': description,
1243
+ 'aria-invalid': this.props['aria-invalid'] || isInvalid,
1244
+ 'aria-label': this.props['aria-label'] || label,
1245
+ 'aria-labelledby': this.props['aria-labelledby'] || labelId,
1246
+ 'aria-required': required || isRequired,
1241
1247
  role: 'combobox',
1242
1248
  'aria-activedescendant': this.isAppleDevice ? undefined : this.state.focusedOptionId
1243
1249
  }, menuIsOpen && {
@@ -1245,9 +1251,9 @@ var Select = /*#__PURE__*/function (_Component) {
1245
1251
  }), !isSearchable && {
1246
1252
  'aria-readonly': true
1247
1253
  }), this.hasValue() ? (ariaSelection === null || ariaSelection === void 0 ? void 0 : ariaSelection.action) === 'initial-input-focus' && {
1248
- 'aria-describedby': this.getElementId('live-region')
1254
+ 'aria-describedby': description ? [description, this.getElementId('live-region')].join(' ') : this.getElementId('live-region')
1249
1255
  } : {
1250
- 'aria-describedby': this.getElementId('placeholder')
1256
+ 'aria-describedby': description ? [description, this.getElementId('placeholder')].join(' ') : this.getElementId('placeholder')
1251
1257
  });
1252
1258
  if (!isSearchable) {
1253
1259
  // use a dummy input to maintain focus/blur functionality
@@ -1518,14 +1524,14 @@ var Select = /*#__PURE__*/function (_Component) {
1518
1524
  if (this.hasOptions()) {
1519
1525
  menuUI = this.getCategorizedOptions().map(function (item) {
1520
1526
  if (item.type === 'group') {
1521
- var _data = item.data,
1527
+ var data = item.data,
1522
1528
  options = item.options,
1523
1529
  groupIndex = item.index;
1524
1530
  var groupId = "".concat(_this4.getElementId('group'), "-").concat(groupIndex);
1525
1531
  var headingId = "".concat(groupId, "-heading");
1526
1532
  return /*#__PURE__*/React.createElement(Group, _extends({}, commonProps, {
1527
1533
  key: groupId,
1528
- data: _data,
1534
+ data: data,
1529
1535
  options: options,
1530
1536
  Heading: GroupHeading,
1531
1537
  headingProps: {
@@ -1618,10 +1624,12 @@ var Select = /*#__PURE__*/function (_Component) {
1618
1624
  delimiter = _this$props13.delimiter,
1619
1625
  isDisabled = _this$props13.isDisabled,
1620
1626
  isMulti = _this$props13.isMulti,
1621
- name = _this$props13.name,
1622
- required = _this$props13.required;
1627
+ isRequired = _this$props13.isRequired,
1628
+ required = _this$props13.required,
1629
+ name = _this$props13.name;
1623
1630
  var selectValue = this.state.selectValue;
1624
- if (required && !this.hasValue() && !isDisabled) {
1631
+ var req = required || isRequired || null;
1632
+ if (req && !this.hasValue() && !isDisabled) {
1625
1633
  return /*#__PURE__*/React.createElement(RequiredInput, {
1626
1634
  name: name,
1627
1635
  onFocus: this.onValueInputFocus
package/dist/esm/utils.js CHANGED
@@ -113,9 +113,9 @@ export var getStyleProps = function getStyleProps(props, name, classNamesState)
113
113
 
114
114
  export function handleInputChange(inputValue, actionMeta, onInputChange) {
115
115
  if (onInputChange) {
116
- var _newValue = onInputChange(inputValue, actionMeta);
117
- if (typeof _newValue === 'string') {
118
- return _newValue;
116
+ var newValue = onInputChange(inputValue, actionMeta);
117
+ if (typeof newValue === 'string') {
118
+ return newValue;
119
119
  }
120
120
  }
121
121
  return inputValue;
@@ -14,35 +14,60 @@ export interface FormatOptionLabelMeta<Option> {
14
14
  export interface SelectProps<Option, IsMulti extends boolean, Group extends GroupBase<Option>> {
15
15
  /**
16
16
  * HTML ID of an element containing an error message related to the input
17
+ *
18
+ * @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-14529 Internal documentation for deprecation (no external access)}
19
+ * aria-errormessage is not supported widely by assistive technologies. Do not use!
17
20
  */
18
21
  'aria-errormessage'?: AriaAttributes['aria-errormessage'];
19
22
  /**
20
23
  * Indicate if the value entered in the field is invalid
24
+ *
25
+ * @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-14529 Internal documentation for deprecation (no external access)}
26
+ * Use `isInvalid` instead.
21
27
  */
22
28
  'aria-invalid'?: AriaAttributes['aria-invalid'];
23
29
  /**
24
30
  * Aria label (for assistive tech)
31
+ *
32
+ * @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-14529 Internal documentation for deprecation (no external access)}
33
+ * Use `label` instead.
25
34
  */
26
35
  'aria-label'?: AriaAttributes['aria-label'];
27
36
  /**
28
37
  * HTML ID of an element that should be used as the label (for assistive tech)
38
+ *
39
+ * @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-14529 Internal documentation for deprecation (no external access)}
40
+ * Use `labelId` instead.
29
41
  */
30
42
  'aria-labelledby'?: AriaAttributes['aria-labelledby'];
43
+ /**
44
+ * HTML ID of an element that should be used as a description (for assistive tech)
45
+ *
46
+ * @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-14529 Internal documentation for deprecation (no external access)}
47
+ * Use `descriptionId` instead.
48
+ */
31
49
  'aria-describedby'?: AriaAttributes['aria-describedby'];
32
50
  /**
33
51
  * Used to set the priority with which screen reader should treat updates to live regions. The possible settings are: off, polite (default) or assertive
52
+ *
53
+ * @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-14529 Internal documentation for deprecation (no external access)}
54
+ * Will be removed in future versions.
34
55
  */
35
56
  'aria-live'?: AriaAttributes['aria-live'];
36
57
  /**
37
58
  * Customise the messages used by the aria-live component
59
+ *
60
+ * @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-14529 Internal documentation for deprecation (no external access)}
38
61
  */
39
62
  ariaLiveMessages?: AriaLiveMessages<Option, IsMulti, Group>;
40
63
  /**
41
- * Focus the control when it is mounted
64
+ * Focus the control when it is mounted. There are very few cases that this should be used, and using incorrectly may violate accessibility guidelines.
42
65
  */
43
66
  autoFocus?: boolean;
44
67
  /**
45
68
  * Remove the currently focused option when the user presses backspace when Select isClearable or isMulti
69
+ *
70
+ * @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-14529 Internal documentation for deprecation (no external access)}. Will soon be handled automatically to support expected keyboard accessibility.
46
71
  */
47
72
  backspaceRemovesValue: boolean;
48
73
  /**
@@ -51,6 +76,8 @@ export interface SelectProps<Option, IsMulti extends boolean, Group extends Grou
51
76
  blurInputOnSelect: boolean;
52
77
  /**
53
78
  * When the user reaches the top/bottom of the menu, prevent scroll on the scroll-parent
79
+ *
80
+ * @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-14529 Internal documentation for deprecation (no external access)}
54
81
  */
55
82
  captureMenuScroll: boolean;
56
83
  /**
@@ -82,6 +109,8 @@ export interface SelectProps<Option, IsMulti extends boolean, Group extends Grou
82
109
  *
83
110
  * This is useful when you have a scrollable modal and want to portal the menu out,
84
111
  * but want to avoid graphical issues.
112
+ *
113
+ * @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-14529 Internal documentation for deprecation (no external access)}
85
114
  */
86
115
  closeMenuOnScroll: boolean | ((event: Event) => boolean);
87
116
  /**
@@ -96,14 +125,24 @@ export interface SelectProps<Option, IsMulti extends boolean, Group extends Grou
96
125
  components: SelectComponentsConfig<Option, IsMulti, Group>;
97
126
  /**
98
127
  * Whether the value of the select, e.g. SingleValue, should be displayed in the control.
128
+ *
129
+ * @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-14529 Internal documentation for deprecation (no external access)}
99
130
  */
100
131
  controlShouldRenderValue: boolean;
101
132
  /**
102
133
  * Delimiter used to join multiple values into a single HTML Input value
134
+ *
135
+ * @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-14529 Internal documentation for deprecation (no external access)}
103
136
  */
104
137
  delimiter?: string;
105
138
  /**
106
- * Clear all values when the user presses escape AND the menu is closed
139
+ * This sets the aria-describedby attribute. It sets an accessible description for the select, for people who use assistive technology. Use '<HelperMessage>' from '@atlaskit/form' is preferred.
140
+ */
141
+ descriptionId?: string;
142
+ /**
143
+ * Clear all values when the user presses escape AND the menu is closed.
144
+ *
145
+ * @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-14529 Internal documentation for deprecation (no external access)}. Will soon be handled automatically to support expected keyboard accessibility.
107
146
  */
108
147
  escapeClearsValue: boolean;
109
148
  /**
@@ -159,6 +198,10 @@ export interface SelectProps<Option, IsMulti extends boolean, Group extends Grou
159
198
  * Is the select disabled
160
199
  */
161
200
  isDisabled: boolean;
201
+ /**
202
+ * Is the select invalid
203
+ */
204
+ isInvalid?: boolean;
162
205
  /**
163
206
  * Is the select in a state of loading (async)
164
207
  */
@@ -177,14 +220,28 @@ export interface SelectProps<Option, IsMulti extends boolean, Group extends Grou
177
220
  * Support multiple selected options
178
221
  */
179
222
  isMulti: IsMulti;
223
+ /**
224
+ * This prop indicates if the component is required.
225
+ */
226
+ isRequired?: boolean;
180
227
  /**
181
228
  * Is the select direction right-to-left
229
+ *
230
+ * @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-14529 Internal documentation for deprecation (no external access)}
182
231
  */
183
232
  isRtl: boolean;
184
233
  /**
185
234
  * Whether to enable search functionality
186
235
  */
187
236
  isSearchable: boolean;
237
+ /**
238
+ * This sets the aria-label attribute. It sets an accessible name for the select, for people who use assistive technology. Use of a visible label is highly recommended for greater accessibility support.
239
+ */
240
+ label?: string;
241
+ /**
242
+ * This sets the aria-labelledby attribute. It sets an accessible name for the select, for people who use assistive technology. Use of a visible label is highly recommended for greater accessibility support.
243
+ */
244
+ labelId?: string;
188
245
  /**
189
246
  * Async: Text to display when loading options
190
247
  */
@@ -220,6 +277,8 @@ export interface SelectProps<Option, IsMulti extends boolean, Group extends Grou
220
277
  menuPortalTarget?: HTMLElement | null;
221
278
  /**
222
279
  * Whether to block scroll events when the menu is open
280
+ *
281
+ * @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-14529 Internal documentation for deprecation (no external access)}
223
282
  */
224
283
  menuShouldBlockScroll: boolean;
225
284
  /**
@@ -274,10 +333,14 @@ export interface SelectProps<Option, IsMulti extends boolean, Group extends Grou
274
333
  onMenuScrollToBottom?: (event: WheelEvent | TouchEvent) => void;
275
334
  /**
276
335
  * Allows control of whether the menu is opened when the Select is focused
336
+ *
337
+ * @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-14529 Internal documentation for deprecation (no external access)}. Will soon be removed to support expected accessibility interactions.
277
338
  */
278
339
  openMenuOnFocus: boolean;
279
340
  /**
280
341
  * Allows control of whether the menu is opened when the Select is clicked
342
+ *
343
+ * @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-14529 Internal documentation for deprecation (no external access)}. Will soon be removed to support expected accessibility interactions.
281
344
  */
282
345
  openMenuOnClick: boolean;
283
346
  /**
@@ -294,6 +357,8 @@ export interface SelectProps<Option, IsMulti extends boolean, Group extends Grou
294
357
  placeholder: ReactNode;
295
358
  /**
296
359
  * Status to relay to screen readers
360
+ *
361
+ * @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-14529 Internal documentation for deprecation (no external access)}
297
362
  */
298
363
  screenReaderStatus: (obj: {
299
364
  count: number;
@@ -306,14 +371,19 @@ export interface SelectProps<Option, IsMulti extends boolean, Group extends Grou
306
371
  styles: StylesConfig<Option, IsMulti, Group>;
307
372
  /**
308
373
  * Theme modifier method
374
+ *
375
+ * @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-14529 Internal documentation for deprecation (no external access)}
309
376
  */
310
377
  theme?: ThemeConfig;
311
378
  /**
312
- * Sets the tabIndex attribute on the input
379
+ * Sets the tabIndex attribute on the input for focus. Since focus is already managed, the only acceptable value to be used is '-1' in rare cases when removing this field from the document tab order is required.
380
+ *
313
381
  */
314
382
  tabIndex: number;
315
383
  /**
316
384
  * Select the currently focused option when the user presses tab
385
+ *
386
+ * @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-14529 Internal documentation for deprecation (no external access)}. Will soon be handled automatically to support expected keyboard accessibility.
317
387
  */
318
388
  tabSelectsValue: boolean;
319
389
  /**
@@ -330,6 +400,9 @@ export interface SelectProps<Option, IsMulti extends boolean, Group extends Grou
330
400
  form?: string;
331
401
  /**
332
402
  * Marks the value-holding input as required for form validation
403
+ *
404
+ * @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-14529 Internal documentation for deprecation (no external access)}
405
+ * Use `isRequired` instead.
333
406
  */
334
407
  required?: boolean;
335
408
  }
@@ -544,9 +617,6 @@ export default class Select<Option = unknown, IsMulti extends boolean = false, G
544
617
  IndicatorsContainer: <Option_6, IsMulti_6 extends boolean, Group_6 extends GroupBase<Option_6>>(props: import(".").IndicatorsContainerProps<Option_6, IsMulti_6, Group_6>) => import("@emotion/react").jsx.JSX.Element;
545
618
  IndicatorSeparator: <Option_7, IsMulti_7 extends boolean, Group_7 extends GroupBase<Option_7>>(props: import(".").IndicatorSeparatorProps<Option_7, IsMulti_7, Group_7>) => import("@emotion/react").jsx.JSX.Element;
546
619
  Input: <Option_8, IsMulti_8 extends boolean, Group_8 extends GroupBase<Option_8>>(props: import(".").InputProps<Option_8, IsMulti_8, Group_8>) => import("@emotion/react").jsx.JSX.Element;
547
- /**
548
- * Sets a className attribute on the outer component
549
- */
550
620
  LoadingIndicator: <Option_9, IsMulti_9 extends boolean, Group_9 extends GroupBase<Option_9>>({ innerProps, isRtl, size, ...restProps }: import(".").LoadingIndicatorProps<Option_9, IsMulti_9, Group_9>) => import("@emotion/react").jsx.JSX.Element;
551
621
  Menu: <Option_10, IsMulti_10 extends boolean, Group_10 extends GroupBase<Option_10>>(props: import("./components/menu").MenuProps<Option_10, IsMulti_10, Group_10>) => import("@emotion/react").jsx.JSX.Element;
552
622
  MenuList: <Option_11, IsMulti_11 extends boolean, Group_11 extends GroupBase<Option_11>>(props: import("./components/menu").MenuListProps<Option_11, IsMulti_11, Group_11>) => import("@emotion/react").jsx.JSX.Element;
@@ -14,35 +14,60 @@ export interface FormatOptionLabelMeta<Option> {
14
14
  export interface SelectProps<Option, IsMulti extends boolean, Group extends GroupBase<Option>> {
15
15
  /**
16
16
  * HTML ID of an element containing an error message related to the input
17
+ *
18
+ * @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-14529 Internal documentation for deprecation (no external access)}
19
+ * aria-errormessage is not supported widely by assistive technologies. Do not use!
17
20
  */
18
21
  'aria-errormessage'?: AriaAttributes['aria-errormessage'];
19
22
  /**
20
23
  * Indicate if the value entered in the field is invalid
24
+ *
25
+ * @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-14529 Internal documentation for deprecation (no external access)}
26
+ * Use `isInvalid` instead.
21
27
  */
22
28
  'aria-invalid'?: AriaAttributes['aria-invalid'];
23
29
  /**
24
30
  * Aria label (for assistive tech)
31
+ *
32
+ * @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-14529 Internal documentation for deprecation (no external access)}
33
+ * Use `label` instead.
25
34
  */
26
35
  'aria-label'?: AriaAttributes['aria-label'];
27
36
  /**
28
37
  * HTML ID of an element that should be used as the label (for assistive tech)
38
+ *
39
+ * @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-14529 Internal documentation for deprecation (no external access)}
40
+ * Use `labelId` instead.
29
41
  */
30
42
  'aria-labelledby'?: AriaAttributes['aria-labelledby'];
43
+ /**
44
+ * HTML ID of an element that should be used as a description (for assistive tech)
45
+ *
46
+ * @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-14529 Internal documentation for deprecation (no external access)}
47
+ * Use `descriptionId` instead.
48
+ */
31
49
  'aria-describedby'?: AriaAttributes['aria-describedby'];
32
50
  /**
33
51
  * Used to set the priority with which screen reader should treat updates to live regions. The possible settings are: off, polite (default) or assertive
52
+ *
53
+ * @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-14529 Internal documentation for deprecation (no external access)}
54
+ * Will be removed in future versions.
34
55
  */
35
56
  'aria-live'?: AriaAttributes['aria-live'];
36
57
  /**
37
58
  * Customise the messages used by the aria-live component
59
+ *
60
+ * @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-14529 Internal documentation for deprecation (no external access)}
38
61
  */
39
62
  ariaLiveMessages?: AriaLiveMessages<Option, IsMulti, Group>;
40
63
  /**
41
- * Focus the control when it is mounted
64
+ * Focus the control when it is mounted. There are very few cases that this should be used, and using incorrectly may violate accessibility guidelines.
42
65
  */
43
66
  autoFocus?: boolean;
44
67
  /**
45
68
  * Remove the currently focused option when the user presses backspace when Select isClearable or isMulti
69
+ *
70
+ * @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-14529 Internal documentation for deprecation (no external access)}. Will soon be handled automatically to support expected keyboard accessibility.
46
71
  */
47
72
  backspaceRemovesValue: boolean;
48
73
  /**
@@ -51,6 +76,8 @@ export interface SelectProps<Option, IsMulti extends boolean, Group extends Grou
51
76
  blurInputOnSelect: boolean;
52
77
  /**
53
78
  * When the user reaches the top/bottom of the menu, prevent scroll on the scroll-parent
79
+ *
80
+ * @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-14529 Internal documentation for deprecation (no external access)}
54
81
  */
55
82
  captureMenuScroll: boolean;
56
83
  /**
@@ -82,6 +109,8 @@ export interface SelectProps<Option, IsMulti extends boolean, Group extends Grou
82
109
  *
83
110
  * This is useful when you have a scrollable modal and want to portal the menu out,
84
111
  * but want to avoid graphical issues.
112
+ *
113
+ * @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-14529 Internal documentation for deprecation (no external access)}
85
114
  */
86
115
  closeMenuOnScroll: boolean | ((event: Event) => boolean);
87
116
  /**
@@ -96,14 +125,24 @@ export interface SelectProps<Option, IsMulti extends boolean, Group extends Grou
96
125
  components: SelectComponentsConfig<Option, IsMulti, Group>;
97
126
  /**
98
127
  * Whether the value of the select, e.g. SingleValue, should be displayed in the control.
128
+ *
129
+ * @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-14529 Internal documentation for deprecation (no external access)}
99
130
  */
100
131
  controlShouldRenderValue: boolean;
101
132
  /**
102
133
  * Delimiter used to join multiple values into a single HTML Input value
134
+ *
135
+ * @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-14529 Internal documentation for deprecation (no external access)}
103
136
  */
104
137
  delimiter?: string;
105
138
  /**
106
- * Clear all values when the user presses escape AND the menu is closed
139
+ * This sets the aria-describedby attribute. It sets an accessible description for the select, for people who use assistive technology. Use '<HelperMessage>' from '@atlaskit/form' is preferred.
140
+ */
141
+ descriptionId?: string;
142
+ /**
143
+ * Clear all values when the user presses escape AND the menu is closed.
144
+ *
145
+ * @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-14529 Internal documentation for deprecation (no external access)}. Will soon be handled automatically to support expected keyboard accessibility.
107
146
  */
108
147
  escapeClearsValue: boolean;
109
148
  /**
@@ -159,6 +198,10 @@ export interface SelectProps<Option, IsMulti extends boolean, Group extends Grou
159
198
  * Is the select disabled
160
199
  */
161
200
  isDisabled: boolean;
201
+ /**
202
+ * Is the select invalid
203
+ */
204
+ isInvalid?: boolean;
162
205
  /**
163
206
  * Is the select in a state of loading (async)
164
207
  */
@@ -177,14 +220,28 @@ export interface SelectProps<Option, IsMulti extends boolean, Group extends Grou
177
220
  * Support multiple selected options
178
221
  */
179
222
  isMulti: IsMulti;
223
+ /**
224
+ * This prop indicates if the component is required.
225
+ */
226
+ isRequired?: boolean;
180
227
  /**
181
228
  * Is the select direction right-to-left
229
+ *
230
+ * @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-14529 Internal documentation for deprecation (no external access)}
182
231
  */
183
232
  isRtl: boolean;
184
233
  /**
185
234
  * Whether to enable search functionality
186
235
  */
187
236
  isSearchable: boolean;
237
+ /**
238
+ * This sets the aria-label attribute. It sets an accessible name for the select, for people who use assistive technology. Use of a visible label is highly recommended for greater accessibility support.
239
+ */
240
+ label?: string;
241
+ /**
242
+ * This sets the aria-labelledby attribute. It sets an accessible name for the select, for people who use assistive technology. Use of a visible label is highly recommended for greater accessibility support.
243
+ */
244
+ labelId?: string;
188
245
  /**
189
246
  * Async: Text to display when loading options
190
247
  */
@@ -220,6 +277,8 @@ export interface SelectProps<Option, IsMulti extends boolean, Group extends Grou
220
277
  menuPortalTarget?: HTMLElement | null;
221
278
  /**
222
279
  * Whether to block scroll events when the menu is open
280
+ *
281
+ * @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-14529 Internal documentation for deprecation (no external access)}
223
282
  */
224
283
  menuShouldBlockScroll: boolean;
225
284
  /**
@@ -274,10 +333,14 @@ export interface SelectProps<Option, IsMulti extends boolean, Group extends Grou
274
333
  onMenuScrollToBottom?: (event: WheelEvent | TouchEvent) => void;
275
334
  /**
276
335
  * Allows control of whether the menu is opened when the Select is focused
336
+ *
337
+ * @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-14529 Internal documentation for deprecation (no external access)}. Will soon be removed to support expected accessibility interactions.
277
338
  */
278
339
  openMenuOnFocus: boolean;
279
340
  /**
280
341
  * Allows control of whether the menu is opened when the Select is clicked
342
+ *
343
+ * @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-14529 Internal documentation for deprecation (no external access)}. Will soon be removed to support expected accessibility interactions.
281
344
  */
282
345
  openMenuOnClick: boolean;
283
346
  /**
@@ -294,6 +357,8 @@ export interface SelectProps<Option, IsMulti extends boolean, Group extends Grou
294
357
  placeholder: ReactNode;
295
358
  /**
296
359
  * Status to relay to screen readers
360
+ *
361
+ * @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-14529 Internal documentation for deprecation (no external access)}
297
362
  */
298
363
  screenReaderStatus: (obj: {
299
364
  count: number;
@@ -306,14 +371,19 @@ export interface SelectProps<Option, IsMulti extends boolean, Group extends Grou
306
371
  styles: StylesConfig<Option, IsMulti, Group>;
307
372
  /**
308
373
  * Theme modifier method
374
+ *
375
+ * @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-14529 Internal documentation for deprecation (no external access)}
309
376
  */
310
377
  theme?: ThemeConfig;
311
378
  /**
312
- * Sets the tabIndex attribute on the input
379
+ * Sets the tabIndex attribute on the input for focus. Since focus is already managed, the only acceptable value to be used is '-1' in rare cases when removing this field from the document tab order is required.
380
+ *
313
381
  */
314
382
  tabIndex: number;
315
383
  /**
316
384
  * Select the currently focused option when the user presses tab
385
+ *
386
+ * @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-14529 Internal documentation for deprecation (no external access)}. Will soon be handled automatically to support expected keyboard accessibility.
317
387
  */
318
388
  tabSelectsValue: boolean;
319
389
  /**
@@ -330,6 +400,9 @@ export interface SelectProps<Option, IsMulti extends boolean, Group extends Grou
330
400
  form?: string;
331
401
  /**
332
402
  * Marks the value-holding input as required for form validation
403
+ *
404
+ * @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-14529 Internal documentation for deprecation (no external access)}
405
+ * Use `isRequired` instead.
333
406
  */
334
407
  required?: boolean;
335
408
  }
@@ -544,9 +617,6 @@ export default class Select<Option = unknown, IsMulti extends boolean = false, G
544
617
  IndicatorsContainer: <Option_6, IsMulti_6 extends boolean, Group_6 extends GroupBase<Option_6>>(props: import(".").IndicatorsContainerProps<Option_6, IsMulti_6, Group_6>) => import("@emotion/react").jsx.JSX.Element;
545
618
  IndicatorSeparator: <Option_7, IsMulti_7 extends boolean, Group_7 extends GroupBase<Option_7>>(props: import(".").IndicatorSeparatorProps<Option_7, IsMulti_7, Group_7>) => import("@emotion/react").jsx.JSX.Element;
546
619
  Input: <Option_8, IsMulti_8 extends boolean, Group_8 extends GroupBase<Option_8>>(props: import(".").InputProps<Option_8, IsMulti_8, Group_8>) => import("@emotion/react").jsx.JSX.Element;
547
- /**
548
- * Sets a className attribute on the outer component
549
- */
550
620
  LoadingIndicator: <Option_9, IsMulti_9 extends boolean, Group_9 extends GroupBase<Option_9>>({ innerProps, isRtl, size, ...restProps }: import(".").LoadingIndicatorProps<Option_9, IsMulti_9, Group_9>) => import("@emotion/react").jsx.JSX.Element;
551
621
  Menu: <Option_10, IsMulti_10 extends boolean, Group_10 extends GroupBase<Option_10>>(props: import("./components/menu").MenuProps<Option_10, IsMulti_10, Group_10>) => import("@emotion/react").jsx.JSX.Element;
552
622
  MenuList: <Option_11, IsMulti_11 extends boolean, Group_11 extends GroupBase<Option_11>>(props: import("./components/menu").MenuListProps<Option_11, IsMulti_11, Group_11>) => import("@emotion/react").jsx.JSX.Element;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/react-select",
3
- "version": "0.0.2",
3
+ "version": "1.0.1",
4
4
  "description": "A forked version of react-select to only be used in atlaskit/select",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -23,7 +23,8 @@
23
23
  ".": "./src/index.tsx",
24
24
  "./base": "./src/select.tsx",
25
25
  "./async": "./src/async.tsx",
26
- "./creatable": "./src/creatable.tsx"
26
+ "./creatable": "./src/creatable.tsx",
27
+ "./async-creatable": "./src/async-creatable.tsx"
27
28
  },
28
29
  "dependencies": {
29
30
  "@atlaskit/ds-lib": "^2.5.0",